summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto')
-rw-r--r--src/lib/libcrypto/Attic/Makefile217
-rw-r--r--src/lib/libcrypto/LPdir_nyi.c42
-rw-r--r--src/lib/libcrypto/LPdir_unix.c127
-rw-r--r--src/lib/libcrypto/LPdir_vms.c206
-rw-r--r--src/lib/libcrypto/LPdir_win.c153
-rw-r--r--src/lib/libcrypto/LPdir_win32.c30
-rw-r--r--src/lib/libcrypto/LPdir_wince.c31
-rw-r--r--src/lib/libcrypto/Makefile24
-rw-r--r--src/lib/libcrypto/aes/Makefile153
-rwxr-xr-xsrc/lib/libcrypto/aes/asm/aes-x86_64.pl3
-rw-r--r--src/lib/libcrypto/aes/asm/aesni-x86_64.pl3
-rw-r--r--src/lib/libcrypto/arch/alpha/opensslconf.h271
-rw-r--r--src/lib/libcrypto/arch/amd64/opensslconf.h268
-rw-r--r--src/lib/libcrypto/arch/arm/opensslconf.h273
-rw-r--r--src/lib/libcrypto/arch/hppa/opensslconf.h273
-rw-r--r--src/lib/libcrypto/arch/hppa64/opensslconf.h273
-rw-r--r--src/lib/libcrypto/arch/i386/opensslconf.h273
-rw-r--r--src/lib/libcrypto/arch/m88k/opensslconf.h273
-rw-r--r--src/lib/libcrypto/arch/mips64/opensslconf.h273
-rw-r--r--src/lib/libcrypto/arch/powerpc/opensslconf.h273
-rw-r--r--src/lib/libcrypto/arch/sh/opensslconf.h273
-rw-r--r--src/lib/libcrypto/arch/sparc/opensslconf.h273
-rw-r--r--src/lib/libcrypto/arch/sparc64/opensslconf.h273
-rw-r--r--src/lib/libcrypto/arch/vax/bn_asm_vax.S436
-rw-r--r--src/lib/libcrypto/arch/vax/opensslconf.h273
-rw-r--r--src/lib/libcrypto/asn1/Makefile930
-rw-r--r--src/lib/libcrypto/asn1/a_gentm.c263
-rw-r--r--src/lib/libcrypto/asn1/a_int.c2
-rw-r--r--src/lib/libcrypto/asn1/a_strex.c1
-rw-r--r--src/lib/libcrypto/asn1/a_utctm.c318
-rw-r--r--src/lib/libcrypto/asn1/asn1_err.c2
-rw-r--r--src/lib/libcrypto/asn1/x_pubkey.c5
-rw-r--r--src/lib/libcrypto/bf/Makefile101
-rw-r--r--src/lib/libcrypto/bf/asm/bf-586.pl2
-rw-r--r--src/lib/libcrypto/bf/asm/bf-686.pl127
-rw-r--r--src/lib/libcrypto/bf/asm/readme10
-rw-r--r--src/lib/libcrypto/bf/bf_opts.c331
-rw-r--r--src/lib/libcrypto/bf/bfs.cpp67
-rw-r--r--src/lib/libcrypto/bf/bfspeed.c277
-rw-r--r--src/lib/libcrypto/bf/bftest.c540
-rw-r--r--src/lib/libcrypto/bio/Makefile222
-rw-r--r--src/lib/libcrypto/bio/bio_lcl.h36
-rw-r--r--src/lib/libcrypto/bio/bss_dgram.c91
-rw-r--r--src/lib/libcrypto/bio/bss_log.c2
-rw-r--r--src/lib/libcrypto/bio/bss_rtcp.c294
-rw-r--r--src/lib/libcrypto/bn/Makefile375
-rw-r--r--src/lib/libcrypto/bn/asm/README27
-rw-r--r--src/lib/libcrypto/bn/asm/mips3-mont.pl327
-rw-r--r--src/lib/libcrypto/bn/asm/mips3.s2201
-rw-r--r--src/lib/libcrypto/bn/asm/vms.mar6440
-rw-r--r--src/lib/libcrypto/bn/asm/x86/f3
-rw-r--r--src/lib/libcrypto/bn/bn.h11
-rw-r--r--src/lib/libcrypto/bn/bn.mul19
-rw-r--r--src/lib/libcrypto/bn/bn_div.c2
-rw-r--r--src/lib/libcrypto/bn/bn_gcd.c1
-rw-r--r--src/lib/libcrypto/bn/bn_lcl.h11
-rw-r--r--src/lib/libcrypto/bn/bn_lib.c52
-rw-r--r--src/lib/libcrypto/bn/bn_nist.c55
-rw-r--r--src/lib/libcrypto/bn/bnspeed.c233
-rw-r--r--src/lib/libcrypto/bn/bntest.c2013
-rw-r--r--src/lib/libcrypto/bn/divtest.c41
-rw-r--r--src/lib/libcrypto/bn/exp.c62
-rw-r--r--src/lib/libcrypto/bn/expspeed.c353
-rw-r--r--src/lib/libcrypto/bn/exptest.c204
-rw-r--r--src/lib/libcrypto/bn/todo3
-rw-r--r--src/lib/libcrypto/bn/vms-helper.c68
-rw-r--r--src/lib/libcrypto/buffer/Makefile97
-rw-r--r--src/lib/libcrypto/buffer/buffer.c4
-rw-r--r--src/lib/libcrypto/buffer/buffer.h2
-rw-r--r--src/lib/libcrypto/buildinf.h6
-rw-r--r--src/lib/libcrypto/camellia/Makefile110
-rw-r--r--src/lib/libcrypto/camellia/cmll_utl.c64
-rw-r--r--src/lib/libcrypto/cast/Makefile102
-rw-r--r--src/lib/libcrypto/cast/asm/cast-586.pl2
-rw-r--r--src/lib/libcrypto/cast/asm/readme7
-rw-r--r--src/lib/libcrypto/cast/c_enc.c2
-rw-r--r--src/lib/libcrypto/cast/cast_spd.c278
-rw-r--r--src/lib/libcrypto/cast/castopts.c342
-rw-r--r--src/lib/libcrypto/cast/casts.cpp70
-rw-r--r--src/lib/libcrypto/cast/casttest.c233
-rw-r--r--src/lib/libcrypto/cert.pem3524
-rw-r--r--src/lib/libcrypto/cmac/Makefile111
-rw-r--r--src/lib/libcrypto/cms/Makefile284
-rw-r--r--src/lib/libcrypto/comp/Makefile108
-rw-r--r--src/lib/libcrypto/conf/Makefile152
-rw-r--r--src/lib/libcrypto/conf/cnf_save.c106
-rw-r--r--src/lib/libcrypto/conf/conf_mall.c1
-rw-r--r--src/lib/libcrypto/conf/test.c98
-rw-r--r--src/lib/libcrypto/cryptlib.c18
-rw-r--r--src/lib/libcrypto/cryptlib.h2
-rw-r--r--src/lib/libcrypto/crypto-lib.com1516
-rw-r--r--src/lib/libcrypto/crypto.h11
-rw-r--r--src/lib/libcrypto/crypto/Makefile573
-rw-r--r--src/lib/libcrypto/crypto/arch/alpha/opensslconf.h271
-rw-r--r--src/lib/libcrypto/crypto/arch/amd64/opensslconf.h268
-rw-r--r--src/lib/libcrypto/crypto/arch/arm/opensslconf.h273
-rw-r--r--src/lib/libcrypto/crypto/arch/hppa/opensslconf.h273
-rw-r--r--src/lib/libcrypto/crypto/arch/hppa64/opensslconf.h273
-rw-r--r--src/lib/libcrypto/crypto/arch/i386/opensslconf.h273
-rw-r--r--src/lib/libcrypto/crypto/arch/m88k/opensslconf.h273
-rw-r--r--src/lib/libcrypto/crypto/arch/mips64/opensslconf.h273
-rw-r--r--src/lib/libcrypto/crypto/arch/powerpc/opensslconf.h273
-rw-r--r--src/lib/libcrypto/crypto/arch/sh/opensslconf.h273
-rw-r--r--src/lib/libcrypto/crypto/arch/sparc/opensslconf.h273
-rw-r--r--src/lib/libcrypto/crypto/arch/sparc64/opensslconf.h273
-rw-r--r--src/lib/libcrypto/crypto/arch/vax/bn_asm_vax.S436
-rw-r--r--src/lib/libcrypto/crypto/arch/vax/opensslconf.h273
-rw-r--r--src/lib/libcrypto/crypto/shlib_version2
-rw-r--r--src/lib/libcrypto/des/DES.pm19
-rw-r--r--src/lib/libcrypto/des/DES.xs268
-rw-r--r--src/lib/libcrypto/des/FILES096
-rw-r--r--src/lib/libcrypto/des/INSTALL69
-rw-r--r--src/lib/libcrypto/des/Imakefile35
-rw-r--r--src/lib/libcrypto/des/KERBEROS41
-rw-r--r--src/lib/libcrypto/des/Makefile279
-rw-r--r--src/lib/libcrypto/des/README54
-rw-r--r--src/lib/libcrypto/des/VERSION412
-rw-r--r--src/lib/libcrypto/des/asm/readme131
-rw-r--r--src/lib/libcrypto/des/cbc3_enc.c99
-rw-r--r--src/lib/libcrypto/des/des-lib.com1005
-rw-r--r--src/lib/libcrypto/des/des.c932
-rw-r--r--src/lib/libcrypto/des/des.h6
-rw-r--r--src/lib/libcrypto/des/des.pod217
-rw-r--r--src/lib/libcrypto/des/des3s.cpp67
-rw-r--r--src/lib/libcrypto/des/des_enc.c4
-rw-r--r--src/lib/libcrypto/des/des_old.c273
-rw-r--r--src/lib/libcrypto/des/des_old.h446
-rw-r--r--src/lib/libcrypto/des/des_old2.c82
-rw-r--r--src/lib/libcrypto/des/des_opts.c608
-rw-r--r--src/lib/libcrypto/des/des_ver.h71
-rw-r--r--src/lib/libcrypto/des/dess.cpp67
-rw-r--r--src/lib/libcrypto/des/destest.c952
-rw-r--r--src/lib/libcrypto/des/fcrypt_b.c3
-rw-r--r--src/lib/libcrypto/des/makefile.bc50
-rw-r--r--src/lib/libcrypto/des/options.txt39
-rw-r--r--src/lib/libcrypto/des/read2pwd.c140
-rw-r--r--src/lib/libcrypto/des/read_pwd.c521
-rw-r--r--src/lib/libcrypto/des/rpc_des.h133
-rw-r--r--src/lib/libcrypto/des/rpc_enc.c98
-rw-r--r--src/lib/libcrypto/des/rpw.c99
-rw-r--r--src/lib/libcrypto/des/set_key.c3
-rw-r--r--src/lib/libcrypto/des/speed.c314
-rw-r--r--src/lib/libcrypto/des/str2key.c2
-rw-r--r--src/lib/libcrypto/des/t/test27
-rw-r--r--src/lib/libcrypto/des/times/486-50.sol16
-rw-r--r--src/lib/libcrypto/des/times/586-100.lnx20
-rw-r--r--src/lib/libcrypto/des/times/686-200.fre18
-rw-r--r--src/lib/libcrypto/des/times/aix.cc26
-rw-r--r--src/lib/libcrypto/des/times/alpha.cc18
-rw-r--r--src/lib/libcrypto/des/times/hpux.cc17
-rw-r--r--src/lib/libcrypto/des/times/sparc.gcc17
-rw-r--r--src/lib/libcrypto/des/times/usparc.cc31
-rw-r--r--src/lib/libcrypto/des/typemap34
-rw-r--r--src/lib/libcrypto/dh/Makefile180
-rw-r--r--src/lib/libcrypto/dh/dh1024.pem5
-rw-r--r--src/lib/libcrypto/dh/dh192.pem3
-rw-r--r--src/lib/libcrypto/dh/dh2048.pem16
-rw-r--r--src/lib/libcrypto/dh/dh4096.pem14
-rw-r--r--src/lib/libcrypto/dh/dh512.pem4
-rw-r--r--src/lib/libcrypto/dh/dhtest.c226
-rw-r--r--src/lib/libcrypto/dh/example50
-rw-r--r--src/lib/libcrypto/dh/generate65
-rw-r--r--src/lib/libcrypto/dh/p1024.c92
-rw-r--r--src/lib/libcrypto/dh/p192.c80
-rw-r--r--src/lib/libcrypto/dh/p512.c85
-rw-r--r--src/lib/libcrypto/doc/ERR_get_error.pod7
-rw-r--r--src/lib/libcrypto/doc/EVP_BytesToKey.pod2
-rw-r--r--src/lib/libcrypto/doc/EVP_DigestInit.pod6
-rw-r--r--src/lib/libcrypto/doc/EVP_EncryptInit.pod2
-rw-r--r--src/lib/libcrypto/doc/EVP_SignInit.pod8
-rw-r--r--src/lib/libcrypto/doc/dsa.pod3
-rw-r--r--src/lib/libcrypto/dsa/Makefile209
-rw-r--r--src/lib/libcrypto/dsa/README4
-rw-r--r--src/lib/libcrypto/dsa/dsagen.c111
-rw-r--r--src/lib/libcrypto/dsa/dsatest.c259
-rw-r--r--src/lib/libcrypto/dsa/fips186a.txt122
-rw-r--r--src/lib/libcrypto/dso/Makefile150
-rw-r--r--src/lib/libcrypto/dso/README22
-rw-r--r--src/lib/libcrypto/dso/dso_beos.c270
-rw-r--r--src/lib/libcrypto/dso/dso_dl.c395
-rw-r--r--src/lib/libcrypto/dso/dso_dlfcn.c23
-rw-r--r--src/lib/libcrypto/dso/dso_vms.c525
-rw-r--r--src/lib/libcrypto/dso/dso_win32.c844
-rw-r--r--src/lib/libcrypto/ebcdic.c221
-rw-r--r--src/lib/libcrypto/ebcdic.h19
-rw-r--r--src/lib/libcrypto/ec/Makefile263
-rw-r--r--src/lib/libcrypto/ec/ec.h28
-rw-r--r--src/lib/libcrypto/ec/ec_lib.c10
-rw-r--r--src/lib/libcrypto/ec/ecp_mont.c1
-rw-r--r--src/lib/libcrypto/ec/ectest.c1489
-rw-r--r--src/lib/libcrypto/ecdh/Makefile121
-rw-r--r--src/lib/libcrypto/ecdh/ecdhtest.c374
-rw-r--r--src/lib/libcrypto/ecdh/ech_ossl.c215
-rw-r--r--src/lib/libcrypto/ecdsa/Makefile140
-rw-r--r--src/lib/libcrypto/ecdsa/ecdsatest.c572
-rw-r--r--src/lib/libcrypto/engine/Makefile447
-rw-r--r--src/lib/libcrypto/engine/eng_aesni.c570
-rw-r--r--src/lib/libcrypto/engine/eng_all.c1
-rw-r--r--src/lib/libcrypto/engine/eng_cryptodev.c1449
-rw-r--r--src/lib/libcrypto/engine/eng_list.c1
-rw-r--r--src/lib/libcrypto/engine/eng_rdrand.c143
-rw-r--r--src/lib/libcrypto/engine/eng_rsax.c668
-rw-r--r--src/lib/libcrypto/engine/enginetest.c283
-rw-r--r--src/lib/libcrypto/engine/hw_cryptodev.c1367
-rw-r--r--src/lib/libcrypto/err/Makefile110
-rw-r--r--src/lib/libcrypto/err/err_all.c19
-rw-r--r--src/lib/libcrypto/evp/Makefile771
-rw-r--r--src/lib/libcrypto/evp/bio_b64.c2
-rw-r--r--src/lib/libcrypto/evp/bio_ok.c624
-rw-r--r--src/lib/libcrypto/evp/c_allc.c230
-rw-r--r--src/lib/libcrypto/evp/c_alld.c114
-rw-r--r--src/lib/libcrypto/evp/digest.c8
-rw-r--r--src/lib/libcrypto/evp/e_aes.c21
-rw-r--r--src/lib/libcrypto/evp/e_aes_cbc_hmac_sha1.c5
-rw-r--r--src/lib/libcrypto/evp/e_des3.c6
-rw-r--r--src/lib/libcrypto/evp/e_dsa.c71
-rw-r--r--src/lib/libcrypto/evp/e_rc5.c126
-rw-r--r--src/lib/libcrypto/evp/e_seed.c83
-rw-r--r--src/lib/libcrypto/evp/evp.h14
-rw-r--r--src/lib/libcrypto/evp/evp_acnf.c73
-rw-r--r--src/lib/libcrypto/evp/evp_err.c6
-rw-r--r--src/lib/libcrypto/evp/evp_fips.c113
-rw-r--r--src/lib/libcrypto/evp/evp_test.c450
-rw-r--r--src/lib/libcrypto/evp/evptests.txt334
-rw-r--r--src/lib/libcrypto/evp/m_dss.c2
-rw-r--r--src/lib/libcrypto/evp/m_dss1.c2
-rw-r--r--src/lib/libcrypto/evp/m_md2.c101
-rw-r--r--src/lib/libcrypto/evp/m_mdc2.c103
-rw-r--r--src/lib/libcrypto/evp/m_sha.c101
-rw-r--r--src/lib/libcrypto/evp/m_sha1.c2
-rw-r--r--src/lib/libcrypto/evp/openbsd_hw.c446
-rw-r--r--src/lib/libcrypto/evp/p5_crpt2.c40
-rw-r--r--src/lib/libcrypto/evp/p_sign.c2
-rw-r--r--src/lib/libcrypto/evp/p_verify.c2
-rw-r--r--src/lib/libcrypto/fips_ers.c7
-rw-r--r--src/lib/libcrypto/generate_pkgconfig.sh75
-rw-r--r--src/lib/libcrypto/hmac/Makefile110
-rw-r--r--src/lib/libcrypto/hmac/hmactest.c175
-rw-r--r--src/lib/libcrypto/idea/Makefile89
-rw-r--r--src/lib/libcrypto/idea/idea_spd.c299
-rw-r--r--src/lib/libcrypto/idea/ideatest.c235
-rw-r--r--src/lib/libcrypto/idea/version12
-rwxr-xr-xsrc/lib/libcrypto/install-crypto.com196
-rw-r--r--src/lib/libcrypto/install.com155
-rw-r--r--src/lib/libcrypto/jpake/Makefile64
-rw-r--r--src/lib/libcrypto/jpake/jpake.c511
-rw-r--r--src/lib/libcrypto/jpake/jpake.h131
-rw-r--r--src/lib/libcrypto/jpake/jpake_err.c107
-rw-r--r--src/lib/libcrypto/jpake/jpaketest.c192
-rw-r--r--src/lib/libcrypto/krb5/Makefile84
-rw-r--r--src/lib/libcrypto/lhash/Makefile88
-rw-r--r--src/lib/libcrypto/lhash/lh_test.c88
-rw-r--r--src/lib/libcrypto/lhash/num.pl17
-rw-r--r--src/lib/libcrypto/man/Makefile903
-rw-r--r--src/lib/libcrypto/md2/Makefile89
-rw-r--r--src/lib/libcrypto/md2/md2.c124
-rw-r--r--src/lib/libcrypto/md2/md2.h95
-rw-r--r--src/lib/libcrypto/md2/md2_dgst.c227
-rw-r--r--src/lib/libcrypto/md2/md2_one.c94
-rw-r--r--src/lib/libcrypto/md2/md2test.c143
-rw-r--r--src/lib/libcrypto/md4/Makefile89
-rw-r--r--src/lib/libcrypto/md4/md4.c127
-rw-r--r--src/lib/libcrypto/md4/md4_dgst.c31
-rw-r--r--src/lib/libcrypto/md4/md4_locl.h8
-rw-r--r--src/lib/libcrypto/md4/md4s.cpp78
-rw-r--r--src/lib/libcrypto/md4/md4test.c136
-rw-r--r--src/lib/libcrypto/md5/Makefile102
-rw-r--r--src/lib/libcrypto/md5/md5.c127
-rw-r--r--src/lib/libcrypto/md5/md5_locl.h8
-rw-r--r--src/lib/libcrypto/md5/md5s.cpp78
-rw-r--r--src/lib/libcrypto/md5/md5test.c140
-rw-r--r--src/lib/libcrypto/mdc2/Makefile93
-rw-r--r--src/lib/libcrypto/mdc2/mdc2.h98
-rw-r--r--src/lib/libcrypto/mdc2/mdc2_one.c76
-rw-r--r--src/lib/libcrypto/mdc2/mdc2dgst.c200
-rw-r--r--src/lib/libcrypto/mdc2/mdc2test.c149
-rw-r--r--src/lib/libcrypto/mem.c421
-rw-r--r--src/lib/libcrypto/modes/Makefile144
-rw-r--r--src/lib/libcrypto/o_dir.c83
-rw-r--r--src/lib/libcrypto/o_dir.h53
-rw-r--r--src/lib/libcrypto/o_dir_test.c70
-rw-r--r--src/lib/libcrypto/o_fips.c96
-rw-r--r--src/lib/libcrypto/o_str.h68
-rw-r--r--src/lib/libcrypto/objects/Makefile130
-rw-r--r--src/lib/libcrypto/objects/o_names.c2
-rw-r--r--src/lib/libcrypto/objects/objects.pl13
-rw-r--r--src/lib/libcrypto/ocsp/Makefile213
-rw-r--r--src/lib/libcrypto/ocsp/ocsp_vfy.c1
-rw-r--r--src/lib/libcrypto/openssl.cnf65
-rw-r--r--src/lib/libcrypto/opensslconf.h.in154
-rw-r--r--src/lib/libcrypto/opensslv.h6
-rw-r--r--src/lib/libcrypto/pem/Makefile258
-rw-r--r--src/lib/libcrypto/pem/pem_all.c161
-rw-r--r--src/lib/libcrypto/pem/pem_info.c1
-rw-r--r--src/lib/libcrypto/pem/pem_lib.c27
-rw-r--r--src/lib/libcrypto/pem/pem_seal.c6
-rw-r--r--src/lib/libcrypto/perlasm/cbc.pl2
-rw-r--r--src/lib/libcrypto/perlasm/x86asm.pl16
-rw-r--r--src/lib/libcrypto/perlasm/x86gas.pl21
-rw-r--r--src/lib/libcrypto/perlasm/x86masm.pl198
-rw-r--r--src/lib/libcrypto/perlasm/x86nasm.pl177
-rw-r--r--src/lib/libcrypto/pkcs12/Makefile286
-rw-r--r--src/lib/libcrypto/pkcs12/p12_crt.c7
-rw-r--r--src/lib/libcrypto/pkcs12/p12_key.c24
-rw-r--r--src/lib/libcrypto/pkcs7/Makefile194
-rw-r--r--src/lib/libcrypto/pkcs7/bio_ber.c466
-rw-r--r--src/lib/libcrypto/pkcs7/dec.c248
-rw-r--r--src/lib/libcrypto/pkcs7/des.pem15
-rw-r--r--src/lib/libcrypto/pkcs7/doc24
-rw-r--r--src/lib/libcrypto/pkcs7/enc.c174
-rw-r--r--src/lib/libcrypto/pkcs7/es1.pem66
-rw-r--r--src/lib/libcrypto/pkcs7/example.c329
-rw-r--r--src/lib/libcrypto/pkcs7/example.h57
-rw-r--r--src/lib/libcrypto/pkcs7/info.pem57
-rw-r--r--src/lib/libcrypto/pkcs7/infokey.pem9
-rw-r--r--src/lib/libcrypto/pkcs7/p7/a12
-rw-r--r--src/lib/libcrypto/pkcs7/p7/a21
-rw-r--r--src/lib/libcrypto/pkcs7/p7/cert.p7cbin0 -> 1728 bytes
-rw-r--r--src/lib/libcrypto/pkcs7/p7/smime.p7mbin0 -> 4894 bytes
-rw-r--r--src/lib/libcrypto/pkcs7/p7/smime.p7sbin0 -> 2625 bytes
-rw-r--r--src/lib/libcrypto/pkcs7/pk7_dgst.c66
-rw-r--r--src/lib/libcrypto/pkcs7/pk7_enc.c76
-rw-r--r--src/lib/libcrypto/pkcs7/server.pem24
-rw-r--r--src/lib/libcrypto/pkcs7/sign.c154
-rw-r--r--src/lib/libcrypto/pkcs7/t/3des.pem16
-rw-r--r--src/lib/libcrypto/pkcs7/t/3dess.pem32
-rw-r--r--src/lib/libcrypto/pkcs7/t/c.pem48
-rw-r--r--src/lib/libcrypto/pkcs7/t/ff32
-rw-r--r--src/lib/libcrypto/pkcs7/t/msie-e20
-rw-r--r--src/lib/libcrypto/pkcs7/t/msie-e.pem22
-rw-r--r--src/lib/libcrypto/pkcs7/t/msie-enc-0162
-rw-r--r--src/lib/libcrypto/pkcs7/t/msie-enc-01.pem66
-rw-r--r--src/lib/libcrypto/pkcs7/t/msie-enc-0290
-rw-r--r--src/lib/libcrypto/pkcs7/t/msie-enc-02.pem106
-rw-r--r--src/lib/libcrypto/pkcs7/t/msie-s-a-e91
-rw-r--r--src/lib/libcrypto/pkcs7/t/msie-s-a-e.pem106
-rw-r--r--src/lib/libcrypto/pkcs7/t/nav-smime157
-rw-r--r--src/lib/libcrypto/pkcs7/t/s.pem57
-rw-r--r--src/lib/libcrypto/pkcs7/t/server.pem57
-rw-r--r--src/lib/libcrypto/pkcs7/verify.c263
-rw-r--r--src/lib/libcrypto/pqueue/Makefile83
-rw-r--r--src/lib/libcrypto/pqueue/pq_test.c95
-rw-r--r--src/lib/libcrypto/pqueue/pqueue.c252
-rw-r--r--src/lib/libcrypto/pqueue/pqueue.h94
-rw-r--r--src/lib/libcrypto/rand/Makefile164
-rw-r--r--src/lib/libcrypto/rand/md_rand.c592
-rw-r--r--src/lib/libcrypto/rand/rand.h1
-rw-r--r--src/lib/libcrypto/rand/rand_egd.c303
-rw-r--r--src/lib/libcrypto/rand/rand_err.c1
-rw-r--r--src/lib/libcrypto/rand/rand_lcl.h158
-rw-r--r--src/lib/libcrypto/rand/rand_lib.c15
-rw-r--r--src/lib/libcrypto/rand/rand_nw.c183
-rw-r--r--src/lib/libcrypto/rand/rand_os2.c153
-rw-r--r--src/lib/libcrypto/rand/rand_unix.c425
-rw-r--r--src/lib/libcrypto/rand/rand_vms.c148
-rw-r--r--src/lib/libcrypto/rand/rand_win.c807
-rw-r--r--src/lib/libcrypto/rand/randfile.c2
-rw-r--r--src/lib/libcrypto/rand/randtest.c219
-rw-r--r--src/lib/libcrypto/rc2/Makefile90
-rw-r--r--src/lib/libcrypto/rc2/rc2speed.c277
-rw-r--r--src/lib/libcrypto/rc2/rc2test.c274
-rw-r--r--src/lib/libcrypto/rc2/tab.c86
-rw-r--r--src/lib/libcrypto/rc4/Makefile125
-rwxr-xr-xsrc/lib/libcrypto/rc4/asm/rc4-x86_64.pl3
-rw-r--r--src/lib/libcrypto/rc4/rc4.c193
-rw-r--r--src/lib/libcrypto/rc4/rc4_utl.c62
-rw-r--r--src/lib/libcrypto/rc4/rc4s.cpp73
-rw-r--r--src/lib/libcrypto/rc4/rc4speed.c253
-rw-r--r--src/lib/libcrypto/rc4/rc4test.c236
-rw-r--r--src/lib/libcrypto/rc4/rrc4.doc278
-rw-r--r--src/lib/libcrypto/rc5/Makefile94
-rw-r--r--src/lib/libcrypto/rc5/rc5.h118
-rw-r--r--src/lib/libcrypto/rc5/rc5_ecb.c80
-rw-r--r--src/lib/libcrypto/rc5/rc5_enc.c215
-rw-r--r--src/lib/libcrypto/rc5/rc5_locl.h207
-rw-r--r--src/lib/libcrypto/rc5/rc5_skey.c113
-rw-r--r--src/lib/libcrypto/rc5/rc5cfb64.c122
-rw-r--r--src/lib/libcrypto/rc5/rc5ofb64.c111
-rw-r--r--src/lib/libcrypto/rc5/rc5s.cpp70
-rw-r--r--src/lib/libcrypto/rc5/rc5speed.c277
-rw-r--r--src/lib/libcrypto/rc5/rc5test.c386
-rw-r--r--src/lib/libcrypto/ripemd/Makefile95
-rw-r--r--src/lib/libcrypto/ripemd/asm/rips.cpp82
-rw-r--r--src/lib/libcrypto/ripemd/rmd160.c127
-rw-r--r--src/lib/libcrypto/ripemd/rmd_dgst.c32
-rw-r--r--src/lib/libcrypto/ripemd/rmd_locl.h10
-rw-r--r--src/lib/libcrypto/ripemd/rmdtest.c145
-rw-r--r--src/lib/libcrypto/rsa/Makefile308
-rw-r--r--src/lib/libcrypto/rsa/rsa.h2
-rw-r--r--src/lib/libcrypto/rsa/rsa_chk.c6
-rw-r--r--src/lib/libcrypto/rsa/rsa_eay.c6
-rw-r--r--src/lib/libcrypto/rsa/rsa_null.c151
-rw-r--r--src/lib/libcrypto/rsa/rsa_oaep.c2
-rw-r--r--src/lib/libcrypto/rsa/rsa_test.c340
-rw-r--r--src/lib/libcrypto/seed/Makefile106
-rw-r--r--src/lib/libcrypto/seed/seed.c336
-rw-r--r--src/lib/libcrypto/seed/seed.h139
-rw-r--r--src/lib/libcrypto/seed/seed_cbc.c63
-rw-r--r--src/lib/libcrypto/seed/seed_cfb.c116
-rw-r--r--src/lib/libcrypto/seed/seed_ecb.c60
-rw-r--r--src/lib/libcrypto/seed/seed_locl.h116
-rw-r--r--src/lib/libcrypto/seed/seed_ofb.c116
-rw-r--r--src/lib/libcrypto/sha/Makefile168
-rw-r--r--src/lib/libcrypto/sha/asm/README1
-rw-r--r--src/lib/libcrypto/sha/sha.c124
-rw-r--r--src/lib/libcrypto/sha/sha1.c127
-rw-r--r--src/lib/libcrypto/sha/sha1_one.c2
-rw-r--r--src/lib/libcrypto/sha/sha1dgst.c2
-rw-r--r--src/lib/libcrypto/sha/sha1test.c178
-rw-r--r--src/lib/libcrypto/sha/sha256t.c147
-rw-r--r--src/lib/libcrypto/sha/sha512t.c184
-rw-r--r--src/lib/libcrypto/sha/sha_dgst.c75
-rw-r--r--src/lib/libcrypto/sha/sha_locl.h40
-rw-r--r--src/lib/libcrypto/sha/sha_one.c78
-rw-r--r--src/lib/libcrypto/sha/shatest.c178
-rw-r--r--src/lib/libcrypto/shlib_version2
-rw-r--r--src/lib/libcrypto/srp/Makefile98
-rw-r--r--src/lib/libcrypto/srp/srp.h172
-rw-r--r--src/lib/libcrypto/srp/srp_grps.h517
-rw-r--r--src/lib/libcrypto/srp/srp_lcl.h83
-rw-r--r--src/lib/libcrypto/srp/srp_lib.c361
-rw-r--r--src/lib/libcrypto/srp/srp_vfy.c658
-rw-r--r--src/lib/libcrypto/srp/srptest.c162
-rw-r--r--src/lib/libcrypto/stack/Makefile84
-rw-r--r--src/lib/libcrypto/store/Makefile112
-rw-r--r--src/lib/libcrypto/store/README95
-rw-r--r--src/lib/libcrypto/store/store.h561
-rw-r--r--src/lib/libcrypto/store/str_err.c211
-rw-r--r--src/lib/libcrypto/store/str_lib.c1828
-rw-r--r--src/lib/libcrypto/store/str_locl.h124
-rw-r--r--src/lib/libcrypto/store/str_mem.c365
-rw-r--r--src/lib/libcrypto/store/str_meth.c250
-rw-r--r--src/lib/libcrypto/symhacks.h477
-rw-r--r--src/lib/libcrypto/threads/README14
-rw-r--r--src/lib/libcrypto/threads/mttest.c1310
-rw-r--r--src/lib/libcrypto/threads/netware.bat79
-rw-r--r--src/lib/libcrypto/threads/profile.sh4
-rw-r--r--src/lib/libcrypto/threads/ptest.bat4
-rw-r--r--src/lib/libcrypto/threads/pthread.sh9
-rw-r--r--src/lib/libcrypto/threads/pthread2.sh7
-rw-r--r--src/lib/libcrypto/threads/pthreads-vms.com14
-rw-r--r--src/lib/libcrypto/threads/purify.sh4
-rw-r--r--src/lib/libcrypto/threads/solaris.sh4
-rw-r--r--src/lib/libcrypto/threads/th-lock.c387
-rw-r--r--src/lib/libcrypto/threads/win32.bat4
-rw-r--r--src/lib/libcrypto/ts/Makefile269
-rw-r--r--src/lib/libcrypto/ts/ts_rsp_verify.c8
-rw-r--r--src/lib/libcrypto/txt_db/Makefile84
-rw-r--r--src/lib/libcrypto/ui/Makefile111
-rw-r--r--src/lib/libcrypto/ui/ui_compat.c67
-rw-r--r--src/lib/libcrypto/ui/ui_openssl.c10
-rw-r--r--src/lib/libcrypto/uid.c89
-rw-r--r--src/lib/libcrypto/util/FreeBSD.sh6
-rw-r--r--src/lib/libcrypto/util/add_cr.pl123
-rw-r--r--src/lib/libcrypto/util/bat.sh134
-rw-r--r--src/lib/libcrypto/util/ck_errf.pl64
-rw-r--r--src/lib/libcrypto/util/clean-depend.pl58
-rw-r--r--src/lib/libcrypto/util/copy.pl70
-rw-r--r--src/lib/libcrypto/util/cygwin.sh154
-rw-r--r--src/lib/libcrypto/util/deleof.pl7
-rw-r--r--src/lib/libcrypto/util/deltree.com34
-rw-r--r--src/lib/libcrypto/util/dirname.pl18
-rw-r--r--src/lib/libcrypto/util/do_ms.sh19
-rw-r--r--src/lib/libcrypto/util/domd38
-rw-r--r--src/lib/libcrypto/util/err-ins.pl33
-rw-r--r--src/lib/libcrypto/util/extract-names.pl26
-rw-r--r--src/lib/libcrypto/util/extract-section.pl12
-rw-r--r--src/lib/libcrypto/util/files.pl61
-rw-r--r--src/lib/libcrypto/util/fixNT.sh14
-rw-r--r--src/lib/libcrypto/util/install.sh108
-rw-r--r--src/lib/libcrypto/util/libeay.num4312
-rw-r--r--src/lib/libcrypto/util/mk1mf.pl1231
-rw-r--r--src/lib/libcrypto/util/mkcerts.sh220
-rw-r--r--src/lib/libcrypto/util/mkdef.pl1539
-rw-r--r--src/lib/libcrypto/util/mkdir-p.pl34
-rw-r--r--src/lib/libcrypto/util/mkfiles.pl143
-rw-r--r--src/lib/libcrypto/util/mklink.pl73
-rwxr-xr-xsrc/lib/libcrypto/util/mkrc.pl71
-rwxr-xr-xsrc/lib/libcrypto/util/opensslwrap.sh26
-rw-r--r--src/lib/libcrypto/util/perlpath.pl35
-rw-r--r--src/lib/libcrypto/util/pl/BC-32.pl139
-rw-r--r--src/lib/libcrypto/util/pl/Mingw32.pl104
-rw-r--r--src/lib/libcrypto/util/pl/OS2-EMX.pl120
-rw-r--r--src/lib/libcrypto/util/pl/VC-32.pl397
-rw-r--r--src/lib/libcrypto/util/pl/linux.pl104
-rw-r--r--src/lib/libcrypto/util/pl/netware.pl532
-rw-r--r--src/lib/libcrypto/util/pl/ultrix.pl38
-rw-r--r--src/lib/libcrypto/util/pl/unix.pl96
-rw-r--r--src/lib/libcrypto/util/pod2man.pl1184
-rw-r--r--src/lib/libcrypto/util/pod2mantest58
-rw-r--r--src/lib/libcrypto/util/pod2mantest.pod15
-rw-r--r--src/lib/libcrypto/util/point.sh10
-rw-r--r--src/lib/libcrypto/util/selftest.pl201
-rwxr-xr-xsrc/lib/libcrypto/util/shlib_wrap.sh97
-rw-r--r--src/lib/libcrypto/util/sp-diff.pl80
-rw-r--r--src/lib/libcrypto/util/speed.sh39
-rw-r--r--src/lib/libcrypto/util/src-dep.pl147
-rw-r--r--src/lib/libcrypto/util/ssleay.num322
-rw-r--r--src/lib/libcrypto/util/tab_num.pl17
-rw-r--r--src/lib/libcrypto/util/x86asm.sh42
-rwxr-xr-xsrc/lib/libcrypto/vms_rms.h51
-rw-r--r--src/lib/libcrypto/whrlpool/Makefile96
-rw-r--r--src/lib/libcrypto/whrlpool/wp_test.c228
-rw-r--r--src/lib/libcrypto/x509/Makefile407
-rw-r--r--src/lib/libcrypto/x509/by_dir.c6
-rw-r--r--src/lib/libcrypto/x509/x509_cmp.c15
-rw-r--r--src/lib/libcrypto/x509/x509_vfy.c20
-rw-r--r--src/lib/libcrypto/x509/x_all.c2
-rw-r--r--src/lib/libcrypto/x509v3.cnf29
-rw-r--r--src/lib/libcrypto/x509v3/Makefile591
-rw-r--r--src/lib/libcrypto/x509v3/tabtest.c88
-rw-r--r--src/lib/libcrypto/x509v3/v3_addr.c1338
-rw-r--r--src/lib/libcrypto/x509v3/v3_alt.c4
-rw-r--r--src/lib/libcrypto/x509v3/v3_asid.c890
-rw-r--r--src/lib/libcrypto/x509v3/v3_purp.c4
-rw-r--r--src/lib/libcrypto/x509v3/v3conf.c127
-rw-r--r--src/lib/libcrypto/x509v3/v3prin.c99
-rw-r--r--src/lib/libcrypto/x86_64cpuid.pl3
518 files changed, 104061 insertions, 716 deletions
diff --git a/src/lib/libcrypto/Attic/Makefile b/src/lib/libcrypto/Attic/Makefile
new file mode 100644
index 0000000000..947dd5d44e
--- /dev/null
+++ b/src/lib/libcrypto/Attic/Makefile
@@ -0,0 +1,217 @@
1#
2# OpenSSL/crypto/Makefile
3#
4
5DIR= crypto
6TOP= ..
7CC= cc
8INCLUDE= -I. -I$(TOP) -I../include $(ZLIB_INCLUDE)
9# INCLUDES targets sudbirs!
10INCLUDES= -I.. -I../.. -I../modes -I../asn1 -I../evp -I../../include $(ZLIB_INCLUDE)
11CFLAG= -g
12MAKEDEPPROG= makedepend
13MAKEDEPEND= $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG)
14MAKEFILE= Makefile
15RM= rm -f
16AR= ar r
17
18RECURSIVE_MAKE= [ -n "$(SDIRS)" ] && for i in $(SDIRS) ; do \
19 (cd $$i && echo "making $$target in $(DIR)/$$i..." && \
20 $(MAKE) -e TOP=../.. DIR=$$i INCLUDES='$(INCLUDES)' $$target ) || exit 1; \
21 done;
22
23PEX_LIBS=
24EX_LIBS=
25
26CFLAGS= $(INCLUDE) $(CFLAG)
27ASFLAGS= $(INCLUDE) $(ASFLAG)
28AFLAGS=$(ASFLAGS)
29CPUID_OBJ=mem_clr.o
30
31LIBS=
32
33GENERAL=Makefile README crypto-lib.com install.com
34
35LIB= $(TOP)/libcrypto.a
36SHARED_LIB= libcrypto$(SHLIB_EXT)
37LIBSRC= cryptlib.c mem.c mem_clr.c mem_dbg.c cversion.c ex_data.c cpt_err.c \
38 ebcdic.c uid.c o_time.c o_str.c o_dir.c o_fips.c o_init.c fips_ers.c
39LIBOBJ= cryptlib.o mem.o mem_dbg.o cversion.o ex_data.o cpt_err.o ebcdic.o \
40 uid.o o_time.o o_str.o o_dir.o o_fips.o o_init.o fips_ers.o $(CPUID_OBJ)
41
42SRC= $(LIBSRC)
43
44EXHEADER= crypto.h opensslv.h opensslconf.h ebcdic.h symhacks.h \
45 ossl_typ.h
46HEADER= cryptlib.h buildinf.h md32_common.h o_time.h o_str.h o_dir.h $(EXHEADER)
47
48ALL= $(GENERAL) $(SRC) $(HEADER)
49
50top:
51 @(cd ..; $(MAKE) DIRS=$(DIR) all)
52
53all: shared
54
55buildinf.h: ../Makefile
56 ( echo "#ifndef MK1MF_BUILD"; \
57 echo ' /* auto-generated by crypto/Makefile for crypto/cversion.c */'; \
58 echo ' #define CFLAGS "$(CC) $(CFLAG)"'; \
59 echo ' #define PLATFORM "$(PLATFORM)"'; \
60 echo " #define DATE \"`LC_ALL=C LC_TIME=C date`\""; \
61 echo '#endif' ) >buildinf.h
62
63x86cpuid.s: x86cpuid.pl perlasm/x86asm.pl
64 $(PERL) x86cpuid.pl $(PERLASM_SCHEME) $(CFLAGS) $(PROCESSOR) > $@
65
66applink.o: $(TOP)/ms/applink.c
67 $(CC) $(CFLAGS) -c -o $@ $(TOP)/ms/applink.c
68
69uplink.o: $(TOP)/ms/uplink.c applink.o
70 $(CC) $(CFLAGS) -c -o $@ $(TOP)/ms/uplink.c
71
72uplink-x86.s: $(TOP)/ms/uplink-x86.pl
73 $(PERL) $(TOP)/ms/uplink-x86.pl $(PERLASM_SCHEME) > $@
74
75x86_64cpuid.s: x86_64cpuid.pl; $(PERL) x86_64cpuid.pl $(PERLASM_SCHEME) > $@
76ia64cpuid.s: ia64cpuid.S; $(CC) $(CFLAGS) -E ia64cpuid.S > $@
77ppccpuid.s: ppccpuid.pl; $(PERL) ppccpuid.pl $(PERLASM_SCHEME) $@
78pariscid.s: pariscid.pl; $(PERL) pariscid.pl $(PERLASM_SCHEME) $@
79alphacpuid.s: alphacpuid.pl
80 $(PERL) $< | $(CC) -E - | tee $@ > /dev/null
81
82testapps:
83 [ -z "$(THIS)" ] || ( if echo $(SDIRS) | fgrep ' des '; \
84 then cd des && $(MAKE) -e des; fi )
85 [ -z "$(THIS)" ] || ( cd pkcs7 && $(MAKE) -e testapps );
86 @if [ -z "$(THIS)" ]; then $(MAKE) -f $(TOP)/Makefile reflect THIS=$@; fi
87
88subdirs:
89 @target=all; $(RECURSIVE_MAKE)
90
91files:
92 $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
93 @target=files; $(RECURSIVE_MAKE)
94
95links:
96 @$(PERL) $(TOP)/util/mklink.pl ../include/openssl $(EXHEADER)
97 @$(PERL) $(TOP)/util/mklink.pl ../test $(TEST)
98 @$(PERL) $(TOP)/util/mklink.pl ../apps $(APPS)
99 @target=links; $(RECURSIVE_MAKE)
100
101# lib: $(LIB): are splitted to avoid end-less loop
102lib: $(LIB)
103 @touch lib
104$(LIB): $(LIBOBJ)
105 $(AR) $(LIB) $(LIBOBJ)
106 [ -z "$(FIPSLIBDIR)" ] || $(AR) $(LIB) $(FIPSLIBDIR)fipscanister.o
107 $(RANLIB) $(LIB) || echo Never mind.
108
109shared: buildinf.h lib subdirs
110 if [ -n "$(SHARED_LIBS)" ]; then \
111 (cd ..; $(MAKE) $(SHARED_LIB)); \
112 fi
113
114libs:
115 @target=lib; $(RECURSIVE_MAKE)
116
117install:
118 @[ -n "$(INSTALLTOP)" ] # should be set by top Makefile...
119 @headerlist="$(EXHEADER)"; for i in $$headerlist ;\
120 do \
121 (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
122 chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
123 done;
124 @target=install; $(RECURSIVE_MAKE)
125
126lint:
127 @target=lint; $(RECURSIVE_MAKE)
128
129depend:
130 @[ -z "$(THIS)" -o -f buildinf.h ] || touch buildinf.h # fake buildinf.h if it does not exist
131 @[ -z "$(THIS)" ] || $(MAKEDEPEND) -- $(CFLAG) $(INCLUDE) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
132 @[ -z "$(THIS)" -o -s buildinf.h ] || rm buildinf.h
133 @[ -z "$(THIS)" ] || (set -e; target=depend; $(RECURSIVE_MAKE) )
134 @if [ -z "$(THIS)" ]; then $(MAKE) -f $(TOP)/Makefile reflect THIS=$@; fi
135
136clean:
137 rm -f buildinf.h *.s *.o */*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
138 @target=clean; $(RECURSIVE_MAKE)
139
140dclean:
141 $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
142 mv -f Makefile.new $(MAKEFILE)
143 rm -f opensslconf.h
144 @target=dclean; $(RECURSIVE_MAKE)
145
146# DO NOT DELETE THIS LINE -- make depend depends on it.
147
148cpt_err.o: ../include/openssl/bio.h ../include/openssl/crypto.h
149cpt_err.o: ../include/openssl/e_os2.h ../include/openssl/err.h
150cpt_err.o: ../include/openssl/lhash.h ../include/openssl/opensslconf.h
151cpt_err.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
152cpt_err.o: ../include/openssl/safestack.h ../include/openssl/stack.h
153cpt_err.o: ../include/openssl/symhacks.h cpt_err.c
154cryptlib.o: ../e_os.h ../include/openssl/bio.h ../include/openssl/buffer.h
155cryptlib.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
156cryptlib.o: ../include/openssl/err.h ../include/openssl/lhash.h
157cryptlib.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
158cryptlib.o: ../include/openssl/ossl_typ.h ../include/openssl/safestack.h
159cryptlib.o: ../include/openssl/stack.h ../include/openssl/symhacks.h cryptlib.c
160cryptlib.o: cryptlib.h
161cversion.o: ../e_os.h ../include/openssl/bio.h ../include/openssl/buffer.h
162cversion.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
163cversion.o: ../include/openssl/err.h ../include/openssl/lhash.h
164cversion.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
165cversion.o: ../include/openssl/ossl_typ.h ../include/openssl/safestack.h
166cversion.o: ../include/openssl/stack.h ../include/openssl/symhacks.h buildinf.h
167cversion.o: cryptlib.h cversion.c
168ebcdic.o: ../include/openssl/e_os2.h ../include/openssl/opensslconf.h ebcdic.c
169ex_data.o: ../e_os.h ../include/openssl/bio.h ../include/openssl/buffer.h
170ex_data.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
171ex_data.o: ../include/openssl/err.h ../include/openssl/lhash.h
172ex_data.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
173ex_data.o: ../include/openssl/ossl_typ.h ../include/openssl/safestack.h
174ex_data.o: ../include/openssl/stack.h ../include/openssl/symhacks.h cryptlib.h
175ex_data.o: ex_data.c
176fips_ers.o: ../include/openssl/opensslconf.h fips_ers.c
177mem.o: ../e_os.h ../include/openssl/bio.h ../include/openssl/buffer.h
178mem.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
179mem.o: ../include/openssl/err.h ../include/openssl/lhash.h
180mem.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
181mem.o: ../include/openssl/ossl_typ.h ../include/openssl/safestack.h
182mem.o: ../include/openssl/stack.h ../include/openssl/symhacks.h cryptlib.h
183mem.o: mem.c
184mem_clr.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
185mem_clr.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
186mem_clr.o: ../include/openssl/ossl_typ.h ../include/openssl/safestack.h
187mem_clr.o: ../include/openssl/stack.h ../include/openssl/symhacks.h mem_clr.c
188mem_dbg.o: ../e_os.h ../include/openssl/bio.h ../include/openssl/buffer.h
189mem_dbg.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
190mem_dbg.o: ../include/openssl/err.h ../include/openssl/lhash.h
191mem_dbg.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
192mem_dbg.o: ../include/openssl/ossl_typ.h ../include/openssl/safestack.h
193mem_dbg.o: ../include/openssl/stack.h ../include/openssl/symhacks.h cryptlib.h
194mem_dbg.o: mem_dbg.c
195o_dir.o: ../e_os.h ../include/openssl/e_os2.h ../include/openssl/opensslconf.h
196o_dir.o: LPdir_unix.c o_dir.c o_dir.h
197o_fips.o: ../e_os.h ../include/openssl/bio.h ../include/openssl/buffer.h
198o_fips.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
199o_fips.o: ../include/openssl/err.h ../include/openssl/lhash.h
200o_fips.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
201o_fips.o: ../include/openssl/ossl_typ.h ../include/openssl/safestack.h
202o_fips.o: ../include/openssl/stack.h ../include/openssl/symhacks.h cryptlib.h
203o_fips.o: o_fips.c
204o_init.o: ../e_os.h ../include/openssl/bio.h ../include/openssl/crypto.h
205o_init.o: ../include/openssl/e_os2.h ../include/openssl/err.h
206o_init.o: ../include/openssl/lhash.h ../include/openssl/opensslconf.h
207o_init.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
208o_init.o: ../include/openssl/safestack.h ../include/openssl/stack.h
209o_init.o: ../include/openssl/symhacks.h o_init.c
210o_str.o: ../e_os.h ../include/openssl/e_os2.h ../include/openssl/opensslconf.h
211o_str.o: o_str.c o_str.h
212o_time.o: ../include/openssl/e_os2.h ../include/openssl/opensslconf.h o_time.c
213o_time.o: o_time.h
214uid.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
215uid.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
216uid.o: ../include/openssl/ossl_typ.h ../include/openssl/safestack.h
217uid.o: ../include/openssl/stack.h ../include/openssl/symhacks.h uid.c
diff --git a/src/lib/libcrypto/LPdir_nyi.c b/src/lib/libcrypto/LPdir_nyi.c
new file mode 100644
index 0000000000..6c1a50e6a8
--- /dev/null
+++ b/src/lib/libcrypto/LPdir_nyi.c
@@ -0,0 +1,42 @@
1/* $LP: LPlib/source/LPdir_win.c,v 1.1 2004/06/14 10:07:56 _cvs_levitte Exp $ */
2/*
3 * Copyright (c) 2004, Richard Levitte <richard@levitte.org>
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 *
15 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
16 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 * SUCH DAMAGE.
26 */
27
28#ifndef LPDIR_H
29#include "LPdir.h"
30#endif
31
32struct LP_dir_context_st { void *dummy; };
33const char *LP_find_file(LP_DIR_CTX **ctx, const char *directory)
34 {
35 errno = EINVAL;
36 return 0;
37 }
38int LP_find_file_end(LP_DIR_CTX **ctx)
39 {
40 errno = EINVAL;
41 return 0;
42 }
diff --git a/src/lib/libcrypto/LPdir_unix.c b/src/lib/libcrypto/LPdir_unix.c
new file mode 100644
index 0000000000..b004cd99e8
--- /dev/null
+++ b/src/lib/libcrypto/LPdir_unix.c
@@ -0,0 +1,127 @@
1/* $LP: LPlib/source/LPdir_unix.c,v 1.11 2004/09/23 22:07:22 _cvs_levitte Exp $ */
2/*
3 * Copyright (c) 2004, Richard Levitte <richard@levitte.org>
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 *
15 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
16 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
17 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
18 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
19 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
20 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
21 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28#include <stddef.h>
29#include <stdlib.h>
30#include <limits.h>
31#include <string.h>
32#include <sys/types.h>
33#include <dirent.h>
34#include <errno.h>
35#ifndef LPDIR_H
36#include "LPdir.h"
37#endif
38
39/* The POSIXly macro for the maximum number of characters in a file path
40 is NAME_MAX. However, some operating systems use PATH_MAX instead.
41 Therefore, it seems natural to first check for PATH_MAX and use that,
42 and if it doesn't exist, use NAME_MAX. */
43#if defined(PATH_MAX)
44# define LP_ENTRY_SIZE PATH_MAX
45#elif defined(NAME_MAX)
46# define LP_ENTRY_SIZE NAME_MAX
47#endif
48
49/* Of course, there's the possibility that neither PATH_MAX nor NAME_MAX
50 exist. It's also possible that NAME_MAX exists but is define to a
51 very small value (HP-UX offers 14), so we need to check if we got a
52 result, and if it meets a minimum standard, and create or change it
53 if not. */
54#if !defined(LP_ENTRY_SIZE) || LP_ENTRY_SIZE<255
55# undef LP_ENTRY_SIZE
56# define LP_ENTRY_SIZE 255
57#endif
58
59struct LP_dir_context_st
60{
61 DIR *dir;
62 char entry_name[LP_ENTRY_SIZE+1];
63};
64
65const char *LP_find_file(LP_DIR_CTX **ctx, const char *directory)
66{
67 struct dirent *direntry = NULL;
68
69 if (ctx == NULL || directory == NULL)
70 {
71 errno = EINVAL;
72 return 0;
73 }
74
75 errno = 0;
76 if (*ctx == NULL)
77 {
78 *ctx = (LP_DIR_CTX *)malloc(sizeof(LP_DIR_CTX));
79 if (*ctx == NULL)
80 {
81 errno = ENOMEM;
82 return 0;
83 }
84 memset(*ctx, '\0', sizeof(LP_DIR_CTX));
85
86 (*ctx)->dir = opendir(directory);
87 if ((*ctx)->dir == NULL)
88 {
89 int save_errno = errno; /* Probably not needed, but I'm paranoid */
90 free(*ctx);
91 *ctx = NULL;
92 errno = save_errno;
93 return 0;
94 }
95 }
96
97 direntry = readdir((*ctx)->dir);
98 if (direntry == NULL)
99 {
100 return 0;
101 }
102
103 strncpy((*ctx)->entry_name, direntry->d_name, sizeof((*ctx)->entry_name) - 1);
104 (*ctx)->entry_name[sizeof((*ctx)->entry_name) - 1] = '\0';
105 return (*ctx)->entry_name;
106}
107
108int LP_find_file_end(LP_DIR_CTX **ctx)
109{
110 if (ctx != NULL && *ctx != NULL)
111 {
112 int ret = closedir((*ctx)->dir);
113
114 free(*ctx);
115 switch (ret)
116 {
117 case 0:
118 return 1;
119 case -1:
120 return 0;
121 default:
122 break;
123 }
124 }
125 errno = EINVAL;
126 return 0;
127}
diff --git a/src/lib/libcrypto/LPdir_vms.c b/src/lib/libcrypto/LPdir_vms.c
new file mode 100644
index 0000000000..7613bd254e
--- /dev/null
+++ b/src/lib/libcrypto/LPdir_vms.c
@@ -0,0 +1,206 @@
1/* $LP: LPlib/source/LPdir_vms.c,v 1.20 2004/08/26 13:36:05 _cvs_levitte Exp $ */
2/*
3 * Copyright (c) 2004, Richard Levitte <richard@levitte.org>
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 *
15 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
16 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
17 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
18 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
19 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
20 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
21 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28#include <stddef.h>
29#include <stdlib.h>
30#include <string.h>
31#include <errno.h>
32#include <descrip.h>
33#include <namdef.h>
34#include <rmsdef.h>
35#include <libfildef.h>
36#include <lib$routines.h>
37#include <strdef.h>
38#include <str$routines.h>
39#include <stsdef.h>
40#ifndef LPDIR_H
41#include "LPdir.h"
42#endif
43#include "vms_rms.h"
44
45/* Some compiler options hide EVMSERR. */
46#ifndef EVMSERR
47# define EVMSERR 65535 /* error for non-translatable VMS errors */
48#endif
49
50struct LP_dir_context_st
51{
52 unsigned long VMS_context;
53 char filespec[ NAMX_MAXRSS+ 1];
54 char result[ NAMX_MAXRSS+ 1];
55 struct dsc$descriptor_d filespec_dsc;
56 struct dsc$descriptor_d result_dsc;
57};
58
59const char *LP_find_file(LP_DIR_CTX **ctx, const char *directory)
60{
61 int status;
62 char *p, *r;
63 size_t l;
64 unsigned long flags = 0;
65
66/* Arrange 32-bit pointer to (copied) string storage, if needed. */
67#if __INITIAL_POINTER_SIZE == 64
68# pragma pointer_size save
69# pragma pointer_size 32
70 char *ctx_filespec_32p;
71# pragma pointer_size restore
72 char ctx_filespec_32[ NAMX_MAXRSS+ 1];
73#endif /* __INITIAL_POINTER_SIZE == 64 */
74
75#ifdef NAML$C_MAXRSS
76 flags |= LIB$M_FIL_LONG_NAMES;
77#endif
78
79 if (ctx == NULL || directory == NULL)
80 {
81 errno = EINVAL;
82 return 0;
83 }
84
85 errno = 0;
86 if (*ctx == NULL)
87 {
88 size_t filespeclen = strlen(directory);
89 char *filespec = NULL;
90
91 /* MUST be a VMS directory specification! Let's estimate if it is. */
92 if (directory[filespeclen-1] != ']'
93 && directory[filespeclen-1] != '>'
94 && directory[filespeclen-1] != ':')
95 {
96 errno = EINVAL;
97 return 0;
98 }
99
100 filespeclen += 4; /* "*.*;" */
101
102 if (filespeclen > NAMX_MAXRSS)
103 {
104 errno = ENAMETOOLONG;
105 return 0;
106 }
107
108 *ctx = (LP_DIR_CTX *)malloc(sizeof(LP_DIR_CTX));
109 if (*ctx == NULL)
110 {
111 errno = ENOMEM;
112 return 0;
113 }
114 memset(*ctx, '\0', sizeof(LP_DIR_CTX));
115
116 strcpy((*ctx)->filespec,directory);
117 strcat((*ctx)->filespec,"*.*;");
118
119/* Arrange 32-bit pointer to (copied) string storage, if needed. */
120#if __INITIAL_POINTER_SIZE == 64
121# define CTX_FILESPEC ctx_filespec_32p
122 /* Copy the file name to storage with a 32-bit pointer. */
123 ctx_filespec_32p = ctx_filespec_32;
124 strcpy( ctx_filespec_32p, (*ctx)->filespec);
125#else /* __INITIAL_POINTER_SIZE == 64 */
126# define CTX_FILESPEC (*ctx)->filespec
127#endif /* __INITIAL_POINTER_SIZE == 64 [else] */
128
129 (*ctx)->filespec_dsc.dsc$w_length = filespeclen;
130 (*ctx)->filespec_dsc.dsc$b_dtype = DSC$K_DTYPE_T;
131 (*ctx)->filespec_dsc.dsc$b_class = DSC$K_CLASS_S;
132 (*ctx)->filespec_dsc.dsc$a_pointer = CTX_FILESPEC;
133 }
134
135 (*ctx)->result_dsc.dsc$w_length = 0;
136 (*ctx)->result_dsc.dsc$b_dtype = DSC$K_DTYPE_T;
137 (*ctx)->result_dsc.dsc$b_class = DSC$K_CLASS_D;
138 (*ctx)->result_dsc.dsc$a_pointer = 0;
139
140 status = lib$find_file(&(*ctx)->filespec_dsc, &(*ctx)->result_dsc,
141 &(*ctx)->VMS_context, 0, 0, 0, &flags);
142
143 if (status == RMS$_NMF)
144 {
145 errno = 0;
146 vaxc$errno = status;
147 return NULL;
148 }
149
150 if(!$VMS_STATUS_SUCCESS(status))
151 {
152 errno = EVMSERR;
153 vaxc$errno = status;
154 return NULL;
155 }
156
157 /* Quick, cheap and dirty way to discard any device and directory,
158 since we only want file names */
159 l = (*ctx)->result_dsc.dsc$w_length;
160 p = (*ctx)->result_dsc.dsc$a_pointer;
161 r = p;
162 for (; *p; p++)
163 {
164 if (*p == '^' && p[1] != '\0') /* Take care of ODS-5 escapes */
165 {
166 p++;
167 }
168 else if (*p == ':' || *p == '>' || *p == ']')
169 {
170 l -= p + 1 - r;
171 r = p + 1;
172 }
173 else if (*p == ';')
174 {
175 l = p - r;
176 break;
177 }
178 }
179
180 strncpy((*ctx)->result, r, l);
181 (*ctx)->result[l] = '\0';
182 str$free1_dx(&(*ctx)->result_dsc);
183
184 return (*ctx)->result;
185}
186
187int LP_find_file_end(LP_DIR_CTX **ctx)
188{
189 if (ctx != NULL && *ctx != NULL)
190 {
191 int status = lib$find_file_end(&(*ctx)->VMS_context);
192
193 free(*ctx);
194
195 if(!$VMS_STATUS_SUCCESS(status))
196 {
197 errno = EVMSERR;
198 vaxc$errno = status;
199 return 0;
200 }
201 return 1;
202 }
203 errno = EINVAL;
204 return 0;
205}
206
diff --git a/src/lib/libcrypto/LPdir_win.c b/src/lib/libcrypto/LPdir_win.c
new file mode 100644
index 0000000000..702dbc730f
--- /dev/null
+++ b/src/lib/libcrypto/LPdir_win.c
@@ -0,0 +1,153 @@
1/* $LP: LPlib/source/LPdir_win.c,v 1.10 2004/08/26 13:36:05 _cvs_levitte Exp $ */
2/*
3 * Copyright (c) 2004, Richard Levitte <richard@levitte.org>
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 *
15 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
16 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
17 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
18 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
19 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
20 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
21 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27#include <windows.h>
28#include <tchar.h>
29#ifndef LPDIR_H
30#include "LPdir.h"
31#endif
32
33/* We're most likely overcautious here, but let's reserve for
34 broken WinCE headers and explicitly opt for UNICODE call.
35 Keep in mind that our WinCE builds are compiled with -DUNICODE
36 [as well as -D_UNICODE]. */
37#if defined(LP_SYS_WINCE) && !defined(FindFirstFile)
38# define FindFirstFile FindFirstFileW
39#endif
40#if defined(LP_SYS_WINCE) && !defined(FindFirstFile)
41# define FindNextFile FindNextFileW
42#endif
43
44#ifndef NAME_MAX
45#define NAME_MAX 255
46#endif
47
48struct LP_dir_context_st
49{
50 WIN32_FIND_DATA ctx;
51 HANDLE handle;
52 char entry_name[NAME_MAX+1];
53};
54
55const char *LP_find_file(LP_DIR_CTX **ctx, const char *directory)
56{
57 if (ctx == NULL || directory == NULL)
58 {
59 errno = EINVAL;
60 return 0;
61 }
62
63 errno = 0;
64 if (*ctx == NULL)
65 {
66 *ctx = (LP_DIR_CTX *)malloc(sizeof(LP_DIR_CTX));
67 if (*ctx == NULL)
68 {
69 errno = ENOMEM;
70 return 0;
71 }
72 memset(*ctx, '\0', sizeof(LP_DIR_CTX));
73
74 if (sizeof(TCHAR) != sizeof(char))
75 {
76 TCHAR *wdir = NULL;
77 /* len_0 denotes string length *with* trailing 0 */
78 size_t index = 0,len_0 = strlen(directory) + 1;
79
80 wdir = (TCHAR *)malloc(len_0 * sizeof(TCHAR));
81 if (wdir == NULL)
82 {
83 free(*ctx);
84 *ctx = NULL;
85 errno = ENOMEM;
86 return 0;
87 }
88
89#ifdef LP_MULTIBYTE_AVAILABLE
90 if (!MultiByteToWideChar(CP_ACP, 0, directory, len_0, (WCHAR *)wdir, len_0))
91#endif
92 for (index = 0; index < len_0; index++)
93 wdir[index] = (TCHAR)directory[index];
94
95 (*ctx)->handle = FindFirstFile(wdir, &(*ctx)->ctx);
96
97 free(wdir);
98 }
99 else
100 (*ctx)->handle = FindFirstFile((TCHAR *)directory, &(*ctx)->ctx);
101
102 if ((*ctx)->handle == INVALID_HANDLE_VALUE)
103 {
104 free(*ctx);
105 *ctx = NULL;
106 errno = EINVAL;
107 return 0;
108 }
109 }
110 else
111 {
112 if (FindNextFile((*ctx)->handle, &(*ctx)->ctx) == FALSE)
113 {
114 return 0;
115 }
116 }
117
118 if (sizeof(TCHAR) != sizeof(char))
119 {
120 TCHAR *wdir = (*ctx)->ctx.cFileName;
121 size_t index, len_0 = 0;
122
123 while (wdir[len_0] && len_0 < (sizeof((*ctx)->entry_name) - 1)) len_0++;
124 len_0++;
125
126#ifdef LP_MULTIBYTE_AVAILABLE
127 if (!WideCharToMultiByte(CP_ACP, 0, (WCHAR *)wdir, len_0, (*ctx)->entry_name,
128 sizeof((*ctx)->entry_name), NULL, 0))
129#endif
130 for (index = 0; index < len_0; index++)
131 (*ctx)->entry_name[index] = (char)wdir[index];
132 }
133 else
134 strncpy((*ctx)->entry_name, (const char *)(*ctx)->ctx.cFileName,
135 sizeof((*ctx)->entry_name)-1);
136
137 (*ctx)->entry_name[sizeof((*ctx)->entry_name)-1] = '\0';
138
139 return (*ctx)->entry_name;
140}
141
142int LP_find_file_end(LP_DIR_CTX **ctx)
143{
144 if (ctx != NULL && *ctx != NULL)
145 {
146 FindClose((*ctx)->handle);
147 free(*ctx);
148 *ctx = NULL;
149 return 1;
150 }
151 errno = EINVAL;
152 return 0;
153}
diff --git a/src/lib/libcrypto/LPdir_win32.c b/src/lib/libcrypto/LPdir_win32.c
new file mode 100644
index 0000000000..e39872da52
--- /dev/null
+++ b/src/lib/libcrypto/LPdir_win32.c
@@ -0,0 +1,30 @@
1/* $LP: LPlib/source/LPdir_win32.c,v 1.3 2004/08/26 13:36:05 _cvs_levitte Exp $ */
2/*
3 * Copyright (c) 2004, Richard Levitte <richard@levitte.org>
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 *
15 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
16 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
17 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
18 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
19 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
20 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
21 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28#define LP_SYS_WIN32
29#define LP_MULTIBYTE_AVAILABLE
30#include "LPdir_win.c"
diff --git a/src/lib/libcrypto/LPdir_wince.c b/src/lib/libcrypto/LPdir_wince.c
new file mode 100644
index 0000000000..ab0e1e6f4f
--- /dev/null
+++ b/src/lib/libcrypto/LPdir_wince.c
@@ -0,0 +1,31 @@
1/* $LP: LPlib/source/LPdir_wince.c,v 1.3 2004/08/26 13:36:05 _cvs_levitte Exp $ */
2/*
3 * Copyright (c) 2004, Richard Levitte <richard@levitte.org>
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 *
15 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
16 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
17 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
18 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
19 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
20 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
21 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28#define LP_SYS_WINCE
29/* We might want to define LP_MULTIBYTE_AVAILABLE here. It's currently
30 under investigation what the exact conditions would be */
31#include "LPdir_win.c"
diff --git a/src/lib/libcrypto/Makefile b/src/lib/libcrypto/Makefile
new file mode 100644
index 0000000000..c0496ca2d1
--- /dev/null
+++ b/src/lib/libcrypto/Makefile
@@ -0,0 +1,24 @@
1# $OpenBSD: Makefile,v 1.1 2014/04/11 22:51:53 miod Exp $
2
3SUBDIR=crypto man
4PC_FILES=libcrypto.pc
5
6CLEANFILES=${PC_FILES}
7
8distribution:
9 ${INSTALL} ${INSTALL_COPY} -g ${BINGRP} -m 444 \
10 ${.CURDIR}/openssl.cnf ${DESTDIR}/etc/ssl/openssl.cnf && \
11 ${INSTALL} ${INSTALL_COPY} -g ${BINGRP} -m 444 \
12 ${.CURDIR}/cert.pem ${DESTDIR}/etc/ssl/cert.pem && \
13 ${INSTALL} ${INSTALL_COPY} -g ${BINGRP} -m 444 \
14 ${.CURDIR}/x509v3.cnf ${DESTDIR}/etc/ssl/x509v3.cnf
15
16beforeinstall:
17 /bin/sh ${.CURDIR}/generate_pkgconfig.sh -c ${.CURDIR} -o ${.OBJDIR}
18.for p in ${PC_FILES}
19 ${INSTALL} ${INSTALL_COPY} -o root -g ${SHAREGRP} \
20 -m ${SHAREMODE} ${.OBJDIR}/$p ${DESTDIR}/usr/lib/pkgconfig/
21.endfor
22
23.include <bsd.prog.mk>
24.include <bsd.subdir.mk>
diff --git a/src/lib/libcrypto/aes/Makefile b/src/lib/libcrypto/aes/Makefile
new file mode 100644
index 0000000000..45ede0a0b4
--- /dev/null
+++ b/src/lib/libcrypto/aes/Makefile
@@ -0,0 +1,153 @@
1#
2# crypto/aes/Makefile
3#
4
5DIR= aes
6TOP= ../..
7CC= cc
8CPP= $(CC) -E
9INCLUDES=
10CFLAG=-g
11MAKEFILE= Makefile
12AR= ar r
13
14AES_ENC=aes_core.o aes_cbc.o
15
16CFLAGS= $(INCLUDES) $(CFLAG)
17ASFLAGS= $(INCLUDES) $(ASFLAG)
18AFLAGS= $(ASFLAGS)
19
20GENERAL=Makefile
21#TEST=aestest.c
22TEST=
23APPS=
24
25LIB=$(TOP)/libcrypto.a
26LIBSRC=aes_core.c aes_misc.c aes_ecb.c aes_cbc.c aes_cfb.c aes_ofb.c \
27 aes_ctr.c aes_ige.c aes_wrap.c
28LIBOBJ=aes_misc.o aes_ecb.o aes_cfb.o aes_ofb.o aes_ctr.o aes_ige.o aes_wrap.o \
29 $(AES_ENC)
30
31SRC= $(LIBSRC)
32
33EXHEADER= aes.h
34HEADER= aes_locl.h $(EXHEADER)
35
36ALL= $(GENERAL) $(SRC) $(HEADER)
37
38top:
39 (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all)
40
41all: lib
42
43lib: $(LIBOBJ)
44 $(AR) $(LIB) $(LIBOBJ)
45 $(RANLIB) $(LIB) || echo Never mind.
46 @touch lib
47
48aes-ia64.s: asm/aes-ia64.S
49 $(CC) $(CFLAGS) -E asm/aes-ia64.S > $@
50
51aes-586.s: asm/aes-586.pl ../perlasm/x86asm.pl
52 $(PERL) asm/aes-586.pl $(PERLASM_SCHEME) $(CFLAGS) $(PROCESSOR) > $@
53vpaes-x86.s: asm/vpaes-x86.pl ../perlasm/x86asm.pl
54 $(PERL) asm/vpaes-x86.pl $(PERLASM_SCHEME) $(CFLAGS) $(PROCESSOR) > $@
55aesni-x86.s: asm/aesni-x86.pl ../perlasm/x86asm.pl
56 $(PERL) asm/aesni-x86.pl $(PERLASM_SCHEME) $(CFLAGS) $(PROCESSOR) > $@
57
58aes-x86_64.s: asm/aes-x86_64.pl
59 $(PERL) asm/aes-x86_64.pl $(PERLASM_SCHEME) > $@
60vpaes-x86_64.s: asm/vpaes-x86_64.pl
61 $(PERL) asm/vpaes-x86_64.pl $(PERLASM_SCHEME) > $@
62bsaes-x86_64.s: asm/bsaes-x86_64.pl
63 $(PERL) asm/bsaes-x86_64.pl $(PERLASM_SCHEME) > $@
64aesni-x86_64.s: asm/aesni-x86_64.pl
65 $(PERL) asm/aesni-x86_64.pl $(PERLASM_SCHEME) > $@
66aesni-sha1-x86_64.s: asm/aesni-sha1-x86_64.pl
67 $(PERL) asm/aesni-sha1-x86_64.pl $(PERLASM_SCHEME) > $@
68
69aes-sparcv9.s: asm/aes-sparcv9.pl
70 $(PERL) asm/aes-sparcv9.pl $(CFLAGS) > $@
71
72aes-ppc.s: asm/aes-ppc.pl
73 $(PERL) asm/aes-ppc.pl $(PERLASM_SCHEME) $@
74
75aes-parisc.s: asm/aes-parisc.pl
76 $(PERL) asm/aes-parisc.pl $(PERLASM_SCHEME) $@
77
78aes-mips.S: asm/aes-mips.pl
79 $(PERL) asm/aes-mips.pl $(PERLASM_SCHEME) $@
80
81# GNU make "catch all"
82aes-%.S: asm/aes-%.pl; $(PERL) $< $(PERLASM_SCHEME) > $@
83aes-armv4.o: aes-armv4.S
84
85files:
86 $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
87
88links:
89 @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
90 @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
91 @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
92
93install:
94 @[ -n "$(INSTALLTOP)" ] # should be set by top Makefile...
95 @headerlist="$(EXHEADER)"; for i in $$headerlist ; \
96 do \
97 (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
98 chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
99 done;
100
101tags:
102 ctags $(SRC)
103
104tests:
105
106lint:
107 lint -DLINT $(INCLUDES) $(SRC)>fluff
108
109depend:
110 @[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile...
111 $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
112
113dclean:
114 $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
115 mv -f Makefile.new $(MAKEFILE)
116
117clean:
118 rm -f *.s *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
119
120# DO NOT DELETE THIS LINE -- make depend depends on it.
121
122aes_cbc.o: ../../include/openssl/aes.h ../../include/openssl/modes.h
123aes_cbc.o: ../../include/openssl/opensslconf.h aes_cbc.c
124aes_cfb.o: ../../include/openssl/aes.h ../../include/openssl/modes.h
125aes_cfb.o: ../../include/openssl/opensslconf.h aes_cfb.c
126aes_core.o: ../../include/openssl/aes.h ../../include/openssl/e_os2.h
127aes_core.o: ../../include/openssl/opensslconf.h aes_core.c aes_locl.h
128aes_ctr.o: ../../include/openssl/aes.h ../../include/openssl/modes.h
129aes_ctr.o: ../../include/openssl/opensslconf.h aes_ctr.c
130aes_ecb.o: ../../include/openssl/aes.h ../../include/openssl/e_os2.h
131aes_ecb.o: ../../include/openssl/opensslconf.h aes_ecb.c aes_locl.h
132aes_ige.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/bio.h
133aes_ige.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
134aes_ige.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
135aes_ige.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
136aes_ige.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
137aes_ige.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
138aes_ige.o: ../../include/openssl/symhacks.h ../cryptlib.h aes_ige.c aes_locl.h
139aes_misc.o: ../../include/openssl/aes.h ../../include/openssl/crypto.h
140aes_misc.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslconf.h
141aes_misc.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
142aes_misc.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
143aes_misc.o: ../../include/openssl/symhacks.h aes_locl.h aes_misc.c
144aes_ofb.o: ../../include/openssl/aes.h ../../include/openssl/modes.h
145aes_ofb.o: ../../include/openssl/opensslconf.h aes_ofb.c
146aes_wrap.o: ../../e_os.h ../../include/openssl/aes.h
147aes_wrap.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
148aes_wrap.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
149aes_wrap.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
150aes_wrap.o: ../../include/openssl/opensslconf.h
151aes_wrap.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
152aes_wrap.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
153aes_wrap.o: ../../include/openssl/symhacks.h ../cryptlib.h aes_wrap.c
diff --git a/src/lib/libcrypto/aes/asm/aes-x86_64.pl b/src/lib/libcrypto/aes/asm/aes-x86_64.pl
index 34cbb5d844..48fa857d5b 100755
--- a/src/lib/libcrypto/aes/asm/aes-x86_64.pl
+++ b/src/lib/libcrypto/aes/asm/aes-x86_64.pl
@@ -36,8 +36,7 @@ $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1;
36( $xlate="${dir}../../perlasm/x86_64-xlate.pl" and -f $xlate) or 36( $xlate="${dir}../../perlasm/x86_64-xlate.pl" and -f $xlate) or
37die "can't locate x86_64-xlate.pl"; 37die "can't locate x86_64-xlate.pl";
38 38
39open OUT,"| \"$^X\" $xlate $flavour $output"; 39open STDOUT,"| $^X $xlate $flavour $output";
40*STDOUT=*OUT;
41 40
42$verticalspin=1; # unlike 32-bit version $verticalspin performs 41$verticalspin=1; # unlike 32-bit version $verticalspin performs
43 # ~15% better on both AMD and Intel cores 42 # ~15% better on both AMD and Intel cores
diff --git a/src/lib/libcrypto/aes/asm/aesni-x86_64.pl b/src/lib/libcrypto/aes/asm/aesni-x86_64.pl
index 0dbb194b8d..499f3b3f42 100644
--- a/src/lib/libcrypto/aes/asm/aesni-x86_64.pl
+++ b/src/lib/libcrypto/aes/asm/aesni-x86_64.pl
@@ -172,8 +172,7 @@ $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1;
172( $xlate="${dir}../../perlasm/x86_64-xlate.pl" and -f $xlate) or 172( $xlate="${dir}../../perlasm/x86_64-xlate.pl" and -f $xlate) or
173die "can't locate x86_64-xlate.pl"; 173die "can't locate x86_64-xlate.pl";
174 174
175open OUT,"| \"$^X\" $xlate $flavour $output"; 175open STDOUT,"| $^X $xlate $flavour $output";
176*STDOUT=*OUT;
177 176
178$movkey = $PREFIX eq "aesni" ? "movups" : "movups"; 177$movkey = $PREFIX eq "aesni" ? "movups" : "movups";
179@_4args=$win64? ("%rcx","%rdx","%r8", "%r9") : # Win64 order 178@_4args=$win64? ("%rcx","%rdx","%r8", "%r9") : # Win64 order
diff --git a/src/lib/libcrypto/arch/alpha/opensslconf.h b/src/lib/libcrypto/arch/alpha/opensslconf.h
new file mode 100644
index 0000000000..30f6acfbb1
--- /dev/null
+++ b/src/lib/libcrypto/arch/alpha/opensslconf.h
@@ -0,0 +1,271 @@
1/* opensslconf.h */
2/* WARNING: Generated automatically from opensslconf.h.in by Configure. */
3
4/* OpenSSL was configured with the following options: */
5#ifndef OPENSSL_DOING_MAKEDEPEND
6
7
8#ifndef OPENSSL_NO_CAMELLIA
9# define OPENSSL_NO_CAMELLIA
10#endif
11#ifndef OPENSSL_NO_EC_NISTP_64_GCC_128
12# define OPENSSL_NO_EC_NISTP_64_GCC_128
13#endif
14#ifndef OPENSSL_NO_CMS
15# define OPENSSL_NO_CMS
16#endif
17#ifndef OPENSSL_NO_GMP
18# define OPENSSL_NO_GMP
19#endif
20#ifndef OPENSSL_NO_GOST
21# define OPENSSL_NO_GOST
22#endif
23#ifndef OPENSSL_NO_JPAKE
24# define OPENSSL_NO_JPAKE
25#endif
26#ifndef OPENSSL_NO_KRB5
27# define OPENSSL_NO_KRB5
28#endif
29#ifndef OPENSSL_NO_MD2
30# define OPENSSL_NO_MD2
31#endif
32#ifndef OPENSSL_NO_RC5
33# define OPENSSL_NO_RC5
34#endif
35#ifndef OPENSSL_NO_RFC3779
36# define OPENSSL_NO_RFC3779
37#endif
38#ifndef OPENSSL_NO_SCTP
39# define OPENSSL_NO_SCTP
40#endif
41#ifndef OPENSSL_NO_SEED
42# define OPENSSL_NO_SEED
43#endif
44#ifndef OPENSSL_NO_SRP
45# define OPENSSL_NO_SRP
46#endif
47#ifndef OPENSSL_NO_SSL2
48# define OPENSSL_NO_SSL2
49#endif
50#ifndef OPENSSL_NO_STORE
51# define OPENSSL_NO_STORE
52#endif
53
54#endif /* OPENSSL_DOING_MAKEDEPEND */
55
56#ifndef OPENSSL_THREADS
57# define OPENSSL_THREADS
58#endif
59#ifndef OPENSSL_NO_DYNAMIC_ENGINE
60# define OPENSSL_NO_DYNAMIC_ENGINE
61#endif
62
63/* The OPENSSL_NO_* macros are also defined as NO_* if the application
64 asks for it. This is a transient feature that is provided for those
65 who haven't had the time to do the appropriate changes in their
66 applications. */
67#ifdef OPENSSL_ALGORITHM_DEFINES
68# if defined(OPENSSL_NO_CAMELLIA) && !defined(NO_CAMELLIA)
69# define NO_CAMELLIA
70# endif
71# if defined(OPENSSL_NO_EC_NISTP_64_GCC_128) && !defined(NO_EC_NISTP_64_GCC_128)
72# define NO_EC_NISTP_64_GCC_128
73# endif
74# if defined(OPENSSL_NO_CMS) && !defined(NO_CMS)
75# define NO_CMS
76# endif
77# if defined(OPENSSL_NO_GMP) && !defined(NO_GMP)
78# define NO_GMP
79# endif
80# if defined(OPENSSL_NO_GOST) && !defined(NO_GOST)
81# define NO_GOST
82# endif
83# if defined(OPENSSL_NO_JPAKE) && !defined(NO_JPAKE)
84# define NO_JPAKE
85# endif
86# if defined(OPENSSL_NO_KRB5) && !defined(NO_KRB5)
87# define NO_KRB5
88# endif
89# if defined(OPENSSL_NO_MD2) && !defined(NO_MD2)
90# define NO_MD2
91# endif
92# if defined(OPENSSL_NO_RC5) && !defined(NO_RC5)
93# define NO_RC5
94# endif
95# if defined(OPENSSL_NO_RFC3779) && !defined(NO_RFC3779)
96# define NO_RFC3779
97# endif
98# if defined(OPENSSL_NO_SCTP) && !defined(NO_SCTP)
99# define NO_SCTP
100# endif
101# if defined(OPENSSL_NO_SEED) && !defined(NO_SEED)
102# define NO_SEED
103# endif
104# if defined(OPENSSL_NO_SRP) && !defined(NO_SRP)
105# define NO_SRP
106# endif
107# if defined(OPENSSL_NO_SSL2) && !defined(NO_SSL2)
108# define NO_SSL2
109# endif
110# if defined(OPENSSL_NO_STORE) && !defined(NO_STORE)
111# define NO_STORE
112# endif
113#endif
114
115/* crypto/opensslconf.h.in */
116
117/* Generate 80386 code? */
118#undef I386_ONLY
119
120#if !(defined(VMS) || defined(__VMS)) /* VMS uses logical names instead */
121#if defined(HEADER_CRYPTLIB_H) && !defined(OPENSSLDIR)
122#define ENGINESDIR "/usr/lib/engines"
123#define OPENSSLDIR "/etc/ssl"
124#endif
125#endif
126
127#undef OPENSSL_UNISTD
128#define OPENSSL_UNISTD <unistd.h>
129
130#undef OPENSSL_EXPORT_VAR_AS_FUNCTION
131
132#if defined(HEADER_IDEA_H) && !defined(IDEA_INT)
133#define IDEA_INT unsigned int
134#endif
135
136#if defined(HEADER_MD2_H) && !defined(MD2_INT)
137#define MD2_INT unsigned int
138#endif
139
140#if defined(HEADER_RC2_H) && !defined(RC2_INT)
141/* I need to put in a mod for the alpha - eay */
142#define RC2_INT unsigned int
143#endif
144
145#if defined(HEADER_RC4_H)
146#if !defined(RC4_INT)
147/* using int types make the structure larger but make the code faster
148 * on most boxes I have tested - up to %20 faster. */
149/*
150 * I don't know what does "most" mean, but declaring "int" is a must on:
151 * - Intel P6 because partial register stalls are very expensive;
152 * - elder Alpha because it lacks byte load/store instructions;
153 */
154#define RC4_INT unsigned int
155#endif
156#if !defined(RC4_CHUNK)
157/*
158 * This enables code handling data aligned at natural CPU word
159 * boundary. See crypto/rc4/rc4_enc.c for further details.
160 */
161#define RC4_CHUNK unsigned long
162#endif
163#endif
164
165#if (defined(HEADER_NEW_DES_H) || defined(HEADER_DES_H)) && !defined(DES_LONG)
166/* If this is set to 'unsigned int' on a DEC Alpha, this gives about a
167 * %20 speed up (longs are 8 bytes, int's are 4). */
168#ifndef DES_LONG
169#define DES_LONG unsigned int
170#endif
171#endif
172
173#if defined(HEADER_BN_H) && !defined(CONFIG_HEADER_BN_H)
174#define CONFIG_HEADER_BN_H
175#undef BN_LLONG
176
177/* Should we define BN_DIV2W here? */
178
179/* Only one for the following should be defined */
180/* The prime number generation stuff may not work when
181 * EIGHT_BIT but I don't care since I've only used this mode
182 * for debuging the bignum libraries */
183#define SIXTY_FOUR_BIT_LONG
184#undef SIXTY_FOUR_BIT
185#undef THIRTY_TWO_BIT
186#endif
187
188#if defined(HEADER_RC4_LOCL_H) && !defined(CONFIG_HEADER_RC4_LOCL_H)
189#define CONFIG_HEADER_RC4_LOCL_H
190/* if this is defined data[i] is used instead of *data, this is a %20
191 * speedup on x86 */
192#undef RC4_INDEX
193#endif
194
195#if defined(HEADER_BF_LOCL_H) && !defined(CONFIG_HEADER_BF_LOCL_H)
196#define CONFIG_HEADER_BF_LOCL_H
197#define BF_PTR
198#endif /* HEADER_BF_LOCL_H */
199
200#if defined(HEADER_DES_LOCL_H) && !defined(CONFIG_HEADER_DES_LOCL_H)
201#define CONFIG_HEADER_DES_LOCL_H
202#ifndef DES_DEFAULT_OPTIONS
203/* the following is tweaked from a config script, that is why it is a
204 * protected undef/define */
205#ifndef DES_PTR
206#define DES_PTR
207#endif
208
209/* This helps C compiler generate the correct code for multiple functional
210 * units. It reduces register dependancies at the expense of 2 more
211 * registers */
212#ifndef DES_RISC1
213#undef DES_RISC1
214#endif
215
216#ifndef DES_RISC2
217#define DES_RISC2
218#endif
219
220#if defined(DES_RISC1) && defined(DES_RISC2)
221YOU SHOULD NOT HAVE BOTH DES_RISC1 AND DES_RISC2 DEFINED!!!!!
222#endif
223
224/* Unroll the inner loop, this sometimes helps, sometimes hinders.
225 * Very mucy CPU dependant */
226#ifndef DES_UNROLL
227#undef DES_UNROLL
228#endif
229
230/* These default values were supplied by
231 * Peter Gutman <pgut001@cs.auckland.ac.nz>
232 * They are only used if nothing else has been defined */
233#if !defined(DES_PTR) && !defined(DES_RISC1) && !defined(DES_RISC2) && !defined(DES_UNROLL)
234/* Special defines which change the way the code is built depending on the
235 CPU and OS. For SGI machines you can use _MIPS_SZLONG (32 or 64) to find
236 even newer MIPS CPU's, but at the moment one size fits all for
237 optimization options. Older Sparc's work better with only UNROLL, but
238 there's no way to tell at compile time what it is you're running on */
239
240#if defined( sun ) /* Newer Sparc's */
241# define DES_PTR
242# define DES_RISC1
243# define DES_UNROLL
244#elif defined( __ultrix ) /* Older MIPS */
245# define DES_PTR
246# define DES_RISC2
247# define DES_UNROLL
248#elif defined( __osf1__ ) /* Alpha */
249# define DES_PTR
250# define DES_RISC2
251#elif defined ( _AIX ) /* RS6000 */
252 /* Unknown */
253#elif defined( __hpux ) /* HP-PA */
254 /* Unknown */
255#elif defined( __aux ) /* 68K */
256 /* Unknown */
257#elif defined( __dgux ) /* 88K (but P6 in latest boxes) */
258# define DES_UNROLL
259#elif defined( __sgi ) /* Newer MIPS */
260# define DES_PTR
261# define DES_RISC2
262# define DES_UNROLL
263#elif defined(i386) || defined(__i386__) /* x86 boxes, should be gcc */
264# define DES_PTR
265# define DES_RISC1
266# define DES_UNROLL
267#endif /* Systems-specific speed defines */
268#endif
269
270#endif /* DES_DEFAULT_OPTIONS */
271#endif /* HEADER_DES_LOCL_H */
diff --git a/src/lib/libcrypto/arch/amd64/opensslconf.h b/src/lib/libcrypto/arch/amd64/opensslconf.h
new file mode 100644
index 0000000000..f969fd75e4
--- /dev/null
+++ b/src/lib/libcrypto/arch/amd64/opensslconf.h
@@ -0,0 +1,268 @@
1/* opensslconf.h */
2/* WARNING: Generated automatically from opensslconf.h.in by Configure. */
3
4/* OpenSSL was configured with the following options: */
5#ifndef OPENSSL_DOING_MAKEDEPEND
6
7
8#ifndef OPENSSL_NO_CAMELLIA
9# define OPENSSL_NO_CAMELLIA
10#endif
11#ifndef OPENSSL_NO_EC_NISTP_64_GCC_128
12# define OPENSSL_NO_EC_NISTP_64_GCC_128
13#endif
14#ifndef OPENSSL_NO_CMS
15# define OPENSSL_NO_CMS
16#endif
17#ifndef OPENSSL_NO_GMP
18# define OPENSSL_NO_GMP
19#endif
20#ifndef OPENSSL_NO_GOST
21# define OPENSSL_NO_GOST
22#endif
23#ifndef OPENSSL_NO_JPAKE
24# define OPENSSL_NO_JPAKE
25#endif
26#ifndef OPENSSL_NO_KRB5
27# define OPENSSL_NO_KRB5
28#endif
29#ifndef OPENSSL_NO_MD2
30# define OPENSSL_NO_MD2
31#endif
32#ifndef OPENSSL_NO_RC5
33# define OPENSSL_NO_RC5
34#endif
35#ifndef OPENSSL_NO_RFC3779
36# define OPENSSL_NO_RFC3779
37#endif
38#ifndef OPENSSL_NO_SCTP
39# define OPENSSL_NO_SCTP
40#endif
41#ifndef OPENSSL_NO_SEED
42# define OPENSSL_NO_SEED
43#endif
44#ifndef OPENSSL_NO_SRP
45# define OPENSSL_NO_SRP
46#endif
47#ifndef OPENSSL_NO_SSL2
48# define OPENSSL_NO_SSL2
49#endif
50#ifndef OPENSSL_NO_STORE
51# define OPENSSL_NO_STORE
52#endif
53
54#endif /* OPENSSL_DOING_MAKEDEPEND */
55
56#ifndef OPENSSL_THREADS
57# define OPENSSL_THREADS
58#endif
59#ifndef OPENSSL_NO_DYNAMIC_ENGINE
60# define OPENSSL_NO_DYNAMIC_ENGINE
61#endif
62
63/* The OPENSSL_NO_* macros are also defined as NO_* if the application
64 asks for it. This is a transient feature that is provided for those
65 who haven't had the time to do the appropriate changes in their
66 applications. */
67#ifdef OPENSSL_ALGORITHM_DEFINES
68# if defined(OPENSSL_NO_CAMELLIA) && !defined(NO_CAMELLIA)
69# define NO_CAMELLIA
70# endif
71# if defined(OPENSSL_NO_EC_NISTP_64_GCC_128) && !defined(NO_EC_NISTP_64_GCC_128)
72# define NO_EC_NISTP_64_GCC_128
73# endif
74# if defined(OPENSSL_NO_CMS) && !defined(NO_CMS)
75# define NO_CMS
76# endif
77# if defined(OPENSSL_NO_GMP) && !defined(NO_GMP)
78# define NO_GMP
79# endif
80# if defined(OPENSSL_NO_GOST) && !defined(NO_GOST)
81# define NO_GOST
82# endif
83# if defined(OPENSSL_NO_JPAKE) && !defined(NO_JPAKE)
84# define NO_JPAKE
85# endif
86# if defined(OPENSSL_NO_KRB5) && !defined(NO_KRB5)
87# define NO_KRB5
88# endif
89# if defined(OPENSSL_NO_MD2) && !defined(NO_MD2)
90# define NO_MD2
91# endif
92# if defined(OPENSSL_NO_RC5) && !defined(NO_RC5)
93# define NO_RC5
94# endif
95# if defined(OPENSSL_NO_RFC3779) && !defined(NO_RFC3779)
96# define NO_RFC3779
97# endif
98# if defined(OPENSSL_NO_SCTP) && !defined(NO_SCTP)
99# define NO_SCTP
100# endif
101# if defined(OPENSSL_NO_SEED) && !defined(NO_SEED)
102# define NO_SEED
103# endif
104# if defined(OPENSSL_NO_SRP) && !defined(NO_SRP)
105# define NO_SRP
106# endif
107# if defined(OPENSSL_NO_SSL2) && !defined(NO_SSL2)
108# define NO_SSL2
109# endif
110# if defined(OPENSSL_NO_STORE) && !defined(NO_STORE)
111# define NO_STORE
112# endif
113#endif
114
115/* crypto/opensslconf.h.in */
116
117/* Generate 80386 code? */
118#undef I386_ONLY
119
120#if !(defined(VMS) || defined(__VMS)) /* VMS uses logical names instead */
121#if defined(HEADER_CRYPTLIB_H) && !defined(OPENSSLDIR)
122#define ENGINESDIR "/usr/lib/engines"
123#define OPENSSLDIR "/etc/ssl"
124#endif
125#endif
126
127#undef OPENSSL_UNISTD
128#define OPENSSL_UNISTD <unistd.h>
129
130#undef OPENSSL_EXPORT_VAR_AS_FUNCTION
131
132#if defined(HEADER_IDEA_H) && !defined(IDEA_INT)
133#define IDEA_INT unsigned int
134#endif
135
136#if defined(HEADER_MD2_H) && !defined(MD2_INT)
137#define MD2_INT unsigned int
138#endif
139
140#if defined(HEADER_RC2_H) && !defined(RC2_INT)
141/* I need to put in a mod for the alpha - eay */
142#define RC2_INT unsigned int
143#endif
144
145#if defined(HEADER_RC4_H)
146#if !defined(RC4_INT)
147/* using int types make the structure larger but make the code faster
148 * on most boxes I have tested - up to %20 faster. */
149/*
150 * I don't know what does "most" mean, but declaring "int" is a must on:
151 * - Intel P6 because partial register stalls are very expensive;
152 * - elder Alpha because it lacks byte load/store instructions;
153 */
154#define RC4_INT unsigned int
155#endif
156#if !defined(RC4_CHUNK)
157/*
158 * This enables code handling data aligned at natural CPU word
159 * boundary. See crypto/rc4/rc4_enc.c for further details.
160 */
161#define RC4_CHUNK unsigned long
162#endif
163#endif
164
165#if (defined(HEADER_NEW_DES_H) || defined(HEADER_DES_H)) && !defined(DES_LONG)
166/* If this is set to 'unsigned int' on a DEC Alpha, this gives about a
167 * %20 speed up (longs are 8 bytes, int's are 4). */
168#ifndef DES_LONG
169#define DES_LONG unsigned int
170#endif
171#endif
172
173#if defined(HEADER_BN_H) && !defined(CONFIG_HEADER_BN_H)
174#define CONFIG_HEADER_BN_H
175#undef BN_LLONG
176
177/* Should we define BN_DIV2W here? */
178
179/* Only one for the following should be defined */
180#define SIXTY_FOUR_BIT_LONG
181#undef SIXTY_FOUR_BIT
182#undef THIRTY_TWO_BIT
183#endif
184
185#if defined(HEADER_RC4_LOCL_H) && !defined(CONFIG_HEADER_RC4_LOCL_H)
186#define CONFIG_HEADER_RC4_LOCL_H
187/* if this is defined data[i] is used instead of *data, this is a %20
188 * speedup on x86 */
189#undef RC4_INDEX
190#endif
191
192#if defined(HEADER_BF_LOCL_H) && !defined(CONFIG_HEADER_BF_LOCL_H)
193#define CONFIG_HEADER_BF_LOCL_H
194#undef BF_PTR
195#endif /* HEADER_BF_LOCL_H */
196
197#if defined(HEADER_DES_LOCL_H) && !defined(CONFIG_HEADER_DES_LOCL_H)
198#define CONFIG_HEADER_DES_LOCL_H
199#ifndef DES_DEFAULT_OPTIONS
200/* the following is tweaked from a config script, that is why it is a
201 * protected undef/define */
202#ifndef DES_PTR
203#undef DES_PTR
204#endif
205
206/* This helps C compiler generate the correct code for multiple functional
207 * units. It reduces register dependancies at the expense of 2 more
208 * registers */
209#ifndef DES_RISC1
210#undef DES_RISC1
211#endif
212
213#ifndef DES_RISC2
214#undef DES_RISC2
215#endif
216
217#if defined(DES_RISC1) && defined(DES_RISC2)
218YOU SHOULD NOT HAVE BOTH DES_RISC1 AND DES_RISC2 DEFINED!!!!!
219#endif
220
221/* Unroll the inner loop, this sometimes helps, sometimes hinders.
222 * Very mucy CPU dependant */
223#ifndef DES_UNROLL
224#define DES_UNROLL
225#endif
226
227/* These default values were supplied by
228 * Peter Gutman <pgut001@cs.auckland.ac.nz>
229 * They are only used if nothing else has been defined */
230#if !defined(DES_PTR) && !defined(DES_RISC1) && !defined(DES_RISC2) && !defined(DES_UNROLL)
231/* Special defines which change the way the code is built depending on the
232 CPU and OS. For SGI machines you can use _MIPS_SZLONG (32 or 64) to find
233 even newer MIPS CPU's, but at the moment one size fits all for
234 optimization options. Older Sparc's work better with only UNROLL, but
235 there's no way to tell at compile time what it is you're running on */
236
237#if defined( sun ) /* Newer Sparc's */
238# define DES_PTR
239# define DES_RISC1
240# define DES_UNROLL
241#elif defined( __ultrix ) /* Older MIPS */
242# define DES_PTR
243# define DES_RISC2
244# define DES_UNROLL
245#elif defined( __osf1__ ) /* Alpha */
246# define DES_PTR
247# define DES_RISC2
248#elif defined ( _AIX ) /* RS6000 */
249 /* Unknown */
250#elif defined( __hpux ) /* HP-PA */
251 /* Unknown */
252#elif defined( __aux ) /* 68K */
253 /* Unknown */
254#elif defined( __dgux ) /* 88K (but P6 in latest boxes) */
255# define DES_UNROLL
256#elif defined( __sgi ) /* Newer MIPS */
257# define DES_PTR
258# define DES_RISC2
259# define DES_UNROLL
260#elif defined(i386) || defined(__i386__) /* x86 boxes, should be gcc */
261# define DES_PTR
262# define DES_RISC1
263# define DES_UNROLL
264#endif /* Systems-specific speed defines */
265#endif
266
267#endif /* DES_DEFAULT_OPTIONS */
268#endif /* HEADER_DES_LOCL_H */
diff --git a/src/lib/libcrypto/arch/arm/opensslconf.h b/src/lib/libcrypto/arch/arm/opensslconf.h
new file mode 100644
index 0000000000..fc5ea38470
--- /dev/null
+++ b/src/lib/libcrypto/arch/arm/opensslconf.h
@@ -0,0 +1,273 @@
1/* opensslconf.h */
2/* WARNING: Generated automatically from opensslconf.h.in by Configure. */
3
4/* OpenSSL was configured with the following options: */
5#ifndef OPENSSL_DOING_MAKEDEPEND
6
7
8#ifndef OPENSSL_NO_CAMELLIA
9# define OPENSSL_NO_CAMELLIA
10#endif
11#ifndef OPENSSL_NO_EC_NISTP_64_GCC_128
12# define OPENSSL_NO_EC_NISTP_64_GCC_128
13#endif
14#ifndef OPENSSL_NO_CMS
15# define OPENSSL_NO_CMS
16#endif
17#ifndef OPENSSL_NO_GMP
18# define OPENSSL_NO_GMP
19#endif
20#ifndef OPENSSL_NO_GOST
21# define OPENSSL_NO_GOST
22#endif
23#ifndef OPENSSL_NO_JPAKE
24# define OPENSSL_NO_JPAKE
25#endif
26#ifndef OPENSSL_NO_KRB5
27# define OPENSSL_NO_KRB5
28#endif
29#ifndef OPENSSL_NO_MD2
30# define OPENSSL_NO_MD2
31#endif
32#ifndef OPENSSL_NO_RC5
33# define OPENSSL_NO_RC5
34#endif
35#ifndef OPENSSL_NO_RFC3779
36# define OPENSSL_NO_RFC3779
37#endif
38#ifndef OPENSSL_NO_SCTP
39# define OPENSSL_NO_SCTP
40#endif
41#ifndef OPENSSL_NO_SEED
42# define OPENSSL_NO_SEED
43#endif
44#ifndef OPENSSL_NO_SRP
45# define OPENSSL_NO_SRP
46#endif
47#ifndef OPENSSL_NO_SSL2
48# define OPENSSL_NO_SSL2
49#endif
50#ifndef OPENSSL_NO_STORE
51# define OPENSSL_NO_STORE
52#endif
53
54#endif /* OPENSSL_DOING_MAKEDEPEND */
55
56#ifndef OPENSSL_THREADS
57# define OPENSSL_THREADS
58#endif
59#ifndef OPENSSL_NO_DYNAMIC_ENGINE
60# define OPENSSL_NO_DYNAMIC_ENGINE
61#endif
62
63/* The OPENSSL_NO_* macros are also defined as NO_* if the application
64 asks for it. This is a transient feature that is provided for those
65 who haven't had the time to do the appropriate changes in their
66 applications. */
67#ifdef OPENSSL_ALGORITHM_DEFINES
68# if defined(OPENSSL_NO_CAMELLIA) && !defined(NO_CAMELLIA)
69# define NO_CAMELLIA
70# endif
71# if defined(OPENSSL_NO_EC_NISTP_64_GCC_128) && !defined(NO_EC_NISTP_64_GCC_128)
72# define NO_EC_NISTP_64_GCC_128
73# endif
74# if defined(OPENSSL_NO_CMS) && !defined(NO_CMS)
75# define NO_CMS
76# endif
77# if defined(OPENSSL_NO_GMP) && !defined(NO_GMP)
78# define NO_GMP
79# endif
80# if defined(OPENSSL_NO_GOST) && !defined(NO_GOST)
81# define NO_GOST
82# endif
83# if defined(OPENSSL_NO_JPAKE) && !defined(NO_JPAKE)
84# define NO_JPAKE
85# endif
86# if defined(OPENSSL_NO_KRB5) && !defined(NO_KRB5)
87# define NO_KRB5
88# endif
89# if defined(OPENSSL_NO_MD2) && !defined(NO_MD2)
90# define NO_MD2
91# endif
92# if defined(OPENSSL_NO_RC5) && !defined(NO_RC5)
93# define NO_RC5
94# endif
95# if defined(OPENSSL_NO_RFC3779) && !defined(NO_RFC3779)
96# define NO_RFC3779
97# endif
98# if defined(OPENSSL_NO_SCTP) && !defined(NO_SCTP)
99# define NO_SCTP
100# endif
101# if defined(OPENSSL_NO_SEED) && !defined(NO_SEED)
102# define NO_SEED
103# endif
104# if defined(OPENSSL_NO_SRP) && !defined(NO_SRP)
105# define NO_SRP
106# endif
107# if defined(OPENSSL_NO_SSL2) && !defined(NO_SSL2)
108# define NO_SSL2
109# endif
110# if defined(OPENSSL_NO_STORE) && !defined(NO_STORE)
111# define NO_STORE
112# endif
113#endif
114
115/* crypto/opensslconf.h.in */
116
117/* Generate 80386 code? */
118#undef I386_ONLY
119
120#if !(defined(VMS) || defined(__VMS)) /* VMS uses logical names instead */
121#if defined(HEADER_CRYPTLIB_H) && !defined(OPENSSLDIR)
122#define ENGINESDIR "/usr/lib/engines"
123#define OPENSSLDIR "/etc/ssl"
124#endif
125#endif
126
127#undef OPENSSL_UNISTD
128#define OPENSSL_UNISTD <unistd.h>
129
130#undef OPENSSL_EXPORT_VAR_AS_FUNCTION
131
132#if defined(HEADER_IDEA_H) && !defined(IDEA_INT)
133#define IDEA_INT unsigned int
134#endif
135
136#if defined(HEADER_MD2_H) && !defined(MD2_INT)
137#define MD2_INT unsigned int
138#endif
139
140#if defined(HEADER_RC2_H) && !defined(RC2_INT)
141/* I need to put in a mod for the alpha - eay */
142#define RC2_INT unsigned int
143#endif
144
145#if defined(HEADER_RC4_H)
146#if !defined(RC4_INT)
147/* using int types make the structure larger but make the code faster
148 * on most boxes I have tested - up to %20 faster. */
149/*
150 * I don't know what does "most" mean, but declaring "int" is a must on:
151 * - Intel P6 because partial register stalls are very expensive;
152 * - elder Alpha because it lacks byte load/store instructions;
153 */
154#define RC4_INT unsigned int
155#endif
156#if !defined(RC4_CHUNK)
157/*
158 * This enables code handling data aligned at natural CPU word
159 * boundary. See crypto/rc4/rc4_enc.c for further details.
160 */
161#undef RC4_CHUNK
162#endif
163#endif
164
165#if (defined(HEADER_NEW_DES_H) || defined(HEADER_DES_H)) && !defined(DES_LONG)
166/* If this is set to 'unsigned int' on a DEC Alpha, this gives about a
167 * %20 speed up (longs are 8 bytes, int's are 4). */
168#ifndef DES_LONG
169#define DES_LONG unsigned int
170#endif
171#endif
172
173#if defined(HEADER_BN_H) && !defined(CONFIG_HEADER_BN_H)
174#define CONFIG_HEADER_BN_H
175#define BN_LLONG
176
177/* Should we define BN_DIV2W here? */
178
179/* Only one for the following should be defined */
180/* The prime number generation stuff may not work when
181 * EIGHT_BIT but I don't care since I've only used this mode
182 * for debuging the bignum libraries */
183#undef SIXTY_FOUR_BIT_LONG
184#undef SIXTY_FOUR_BIT
185#define THIRTY_TWO_BIT
186#undef SIXTEEN_BIT
187#undef EIGHT_BIT
188#endif
189
190#if defined(HEADER_RC4_LOCL_H) && !defined(CONFIG_HEADER_RC4_LOCL_H)
191#define CONFIG_HEADER_RC4_LOCL_H
192/* if this is defined data[i] is used instead of *data, this is a %20
193 * speedup on x86 */
194#define RC4_INDEX
195#endif
196
197#if defined(HEADER_BF_LOCL_H) && !defined(CONFIG_HEADER_BF_LOCL_H)
198#define CONFIG_HEADER_BF_LOCL_H
199#undef BF_PTR
200#endif /* HEADER_BF_LOCL_H */
201
202#if defined(HEADER_DES_LOCL_H) && !defined(CONFIG_HEADER_DES_LOCL_H)
203#define CONFIG_HEADER_DES_LOCL_H
204#ifndef DES_DEFAULT_OPTIONS
205/* the following is tweaked from a config script, that is why it is a
206 * protected undef/define */
207#ifndef DES_PTR
208#undef DES_PTR
209#endif
210
211/* This helps C compiler generate the correct code for multiple functional
212 * units. It reduces register dependancies at the expense of 2 more
213 * registers */
214#ifndef DES_RISC1
215#undef DES_RISC1
216#endif
217
218#ifndef DES_RISC2
219#undef DES_RISC2
220#endif
221
222#if defined(DES_RISC1) && defined(DES_RISC2)
223YOU SHOULD NOT HAVE BOTH DES_RISC1 AND DES_RISC2 DEFINED!!!!!
224#endif
225
226/* Unroll the inner loop, this sometimes helps, sometimes hinders.
227 * Very mucy CPU dependant */
228#ifndef DES_UNROLL
229#define DES_UNROLL
230#endif
231
232/* These default values were supplied by
233 * Peter Gutman <pgut001@cs.auckland.ac.nz>
234 * They are only used if nothing else has been defined */
235#if !defined(DES_PTR) && !defined(DES_RISC1) && !defined(DES_RISC2) && !defined(DES_UNROLL)
236/* Special defines which change the way the code is built depending on the
237 CPU and OS. For SGI machines you can use _MIPS_SZLONG (32 or 64) to find
238 even newer MIPS CPU's, but at the moment one size fits all for
239 optimization options. Older Sparc's work better with only UNROLL, but
240 there's no way to tell at compile time what it is you're running on */
241
242#if defined( sun ) /* Newer Sparc's */
243# define DES_PTR
244# define DES_RISC1
245# define DES_UNROLL
246#elif defined( __ultrix ) /* Older MIPS */
247# define DES_PTR
248# define DES_RISC2
249# define DES_UNROLL
250#elif defined( __osf1__ ) /* Alpha */
251# define DES_PTR
252# define DES_RISC2
253#elif defined ( _AIX ) /* RS6000 */
254 /* Unknown */
255#elif defined( __hpux ) /* HP-PA */
256 /* Unknown */
257#elif defined( __aux ) /* 68K */
258 /* Unknown */
259#elif defined( __dgux ) /* 88K (but P6 in latest boxes) */
260# define DES_UNROLL
261#elif defined( __sgi ) /* Newer MIPS */
262# define DES_PTR
263# define DES_RISC2
264# define DES_UNROLL
265#elif defined(i386) || defined(__i386__) /* x86 boxes, should be gcc */
266# define DES_PTR
267# define DES_RISC1
268# define DES_UNROLL
269#endif /* Systems-specific speed defines */
270#endif
271
272#endif /* DES_DEFAULT_OPTIONS */
273#endif /* HEADER_DES_LOCL_H */
diff --git a/src/lib/libcrypto/arch/hppa/opensslconf.h b/src/lib/libcrypto/arch/hppa/opensslconf.h
new file mode 100644
index 0000000000..fc5ea38470
--- /dev/null
+++ b/src/lib/libcrypto/arch/hppa/opensslconf.h
@@ -0,0 +1,273 @@
1/* opensslconf.h */
2/* WARNING: Generated automatically from opensslconf.h.in by Configure. */
3
4/* OpenSSL was configured with the following options: */
5#ifndef OPENSSL_DOING_MAKEDEPEND
6
7
8#ifndef OPENSSL_NO_CAMELLIA
9# define OPENSSL_NO_CAMELLIA
10#endif
11#ifndef OPENSSL_NO_EC_NISTP_64_GCC_128
12# define OPENSSL_NO_EC_NISTP_64_GCC_128
13#endif
14#ifndef OPENSSL_NO_CMS
15# define OPENSSL_NO_CMS
16#endif
17#ifndef OPENSSL_NO_GMP
18# define OPENSSL_NO_GMP
19#endif
20#ifndef OPENSSL_NO_GOST
21# define OPENSSL_NO_GOST
22#endif
23#ifndef OPENSSL_NO_JPAKE
24# define OPENSSL_NO_JPAKE
25#endif
26#ifndef OPENSSL_NO_KRB5
27# define OPENSSL_NO_KRB5
28#endif
29#ifndef OPENSSL_NO_MD2
30# define OPENSSL_NO_MD2
31#endif
32#ifndef OPENSSL_NO_RC5
33# define OPENSSL_NO_RC5
34#endif
35#ifndef OPENSSL_NO_RFC3779
36# define OPENSSL_NO_RFC3779
37#endif
38#ifndef OPENSSL_NO_SCTP
39# define OPENSSL_NO_SCTP
40#endif
41#ifndef OPENSSL_NO_SEED
42# define OPENSSL_NO_SEED
43#endif
44#ifndef OPENSSL_NO_SRP
45# define OPENSSL_NO_SRP
46#endif
47#ifndef OPENSSL_NO_SSL2
48# define OPENSSL_NO_SSL2
49#endif
50#ifndef OPENSSL_NO_STORE
51# define OPENSSL_NO_STORE
52#endif
53
54#endif /* OPENSSL_DOING_MAKEDEPEND */
55
56#ifndef OPENSSL_THREADS
57# define OPENSSL_THREADS
58#endif
59#ifndef OPENSSL_NO_DYNAMIC_ENGINE
60# define OPENSSL_NO_DYNAMIC_ENGINE
61#endif
62
63/* The OPENSSL_NO_* macros are also defined as NO_* if the application
64 asks for it. This is a transient feature that is provided for those
65 who haven't had the time to do the appropriate changes in their
66 applications. */
67#ifdef OPENSSL_ALGORITHM_DEFINES
68# if defined(OPENSSL_NO_CAMELLIA) && !defined(NO_CAMELLIA)
69# define NO_CAMELLIA
70# endif
71# if defined(OPENSSL_NO_EC_NISTP_64_GCC_128) && !defined(NO_EC_NISTP_64_GCC_128)
72# define NO_EC_NISTP_64_GCC_128
73# endif
74# if defined(OPENSSL_NO_CMS) && !defined(NO_CMS)
75# define NO_CMS
76# endif
77# if defined(OPENSSL_NO_GMP) && !defined(NO_GMP)
78# define NO_GMP
79# endif
80# if defined(OPENSSL_NO_GOST) && !defined(NO_GOST)
81# define NO_GOST
82# endif
83# if defined(OPENSSL_NO_JPAKE) && !defined(NO_JPAKE)
84# define NO_JPAKE
85# endif
86# if defined(OPENSSL_NO_KRB5) && !defined(NO_KRB5)
87# define NO_KRB5
88# endif
89# if defined(OPENSSL_NO_MD2) && !defined(NO_MD2)
90# define NO_MD2
91# endif
92# if defined(OPENSSL_NO_RC5) && !defined(NO_RC5)
93# define NO_RC5
94# endif
95# if defined(OPENSSL_NO_RFC3779) && !defined(NO_RFC3779)
96# define NO_RFC3779
97# endif
98# if defined(OPENSSL_NO_SCTP) && !defined(NO_SCTP)
99# define NO_SCTP
100# endif
101# if defined(OPENSSL_NO_SEED) && !defined(NO_SEED)
102# define NO_SEED
103# endif
104# if defined(OPENSSL_NO_SRP) && !defined(NO_SRP)
105# define NO_SRP
106# endif
107# if defined(OPENSSL_NO_SSL2) && !defined(NO_SSL2)
108# define NO_SSL2
109# endif
110# if defined(OPENSSL_NO_STORE) && !defined(NO_STORE)
111# define NO_STORE
112# endif
113#endif
114
115/* crypto/opensslconf.h.in */
116
117/* Generate 80386 code? */
118#undef I386_ONLY
119
120#if !(defined(VMS) || defined(__VMS)) /* VMS uses logical names instead */
121#if defined(HEADER_CRYPTLIB_H) && !defined(OPENSSLDIR)
122#define ENGINESDIR "/usr/lib/engines"
123#define OPENSSLDIR "/etc/ssl"
124#endif
125#endif
126
127#undef OPENSSL_UNISTD
128#define OPENSSL_UNISTD <unistd.h>
129
130#undef OPENSSL_EXPORT_VAR_AS_FUNCTION
131
132#if defined(HEADER_IDEA_H) && !defined(IDEA_INT)
133#define IDEA_INT unsigned int
134#endif
135
136#if defined(HEADER_MD2_H) && !defined(MD2_INT)
137#define MD2_INT unsigned int
138#endif
139
140#if defined(HEADER_RC2_H) && !defined(RC2_INT)
141/* I need to put in a mod for the alpha - eay */
142#define RC2_INT unsigned int
143#endif
144
145#if defined(HEADER_RC4_H)
146#if !defined(RC4_INT)
147/* using int types make the structure larger but make the code faster
148 * on most boxes I have tested - up to %20 faster. */
149/*
150 * I don't know what does "most" mean, but declaring "int" is a must on:
151 * - Intel P6 because partial register stalls are very expensive;
152 * - elder Alpha because it lacks byte load/store instructions;
153 */
154#define RC4_INT unsigned int
155#endif
156#if !defined(RC4_CHUNK)
157/*
158 * This enables code handling data aligned at natural CPU word
159 * boundary. See crypto/rc4/rc4_enc.c for further details.
160 */
161#undef RC4_CHUNK
162#endif
163#endif
164
165#if (defined(HEADER_NEW_DES_H) || defined(HEADER_DES_H)) && !defined(DES_LONG)
166/* If this is set to 'unsigned int' on a DEC Alpha, this gives about a
167 * %20 speed up (longs are 8 bytes, int's are 4). */
168#ifndef DES_LONG
169#define DES_LONG unsigned int
170#endif
171#endif
172
173#if defined(HEADER_BN_H) && !defined(CONFIG_HEADER_BN_H)
174#define CONFIG_HEADER_BN_H
175#define BN_LLONG
176
177/* Should we define BN_DIV2W here? */
178
179/* Only one for the following should be defined */
180/* The prime number generation stuff may not work when
181 * EIGHT_BIT but I don't care since I've only used this mode
182 * for debuging the bignum libraries */
183#undef SIXTY_FOUR_BIT_LONG
184#undef SIXTY_FOUR_BIT
185#define THIRTY_TWO_BIT
186#undef SIXTEEN_BIT
187#undef EIGHT_BIT
188#endif
189
190#if defined(HEADER_RC4_LOCL_H) && !defined(CONFIG_HEADER_RC4_LOCL_H)
191#define CONFIG_HEADER_RC4_LOCL_H
192/* if this is defined data[i] is used instead of *data, this is a %20
193 * speedup on x86 */
194#define RC4_INDEX
195#endif
196
197#if defined(HEADER_BF_LOCL_H) && !defined(CONFIG_HEADER_BF_LOCL_H)
198#define CONFIG_HEADER_BF_LOCL_H
199#undef BF_PTR
200#endif /* HEADER_BF_LOCL_H */
201
202#if defined(HEADER_DES_LOCL_H) && !defined(CONFIG_HEADER_DES_LOCL_H)
203#define CONFIG_HEADER_DES_LOCL_H
204#ifndef DES_DEFAULT_OPTIONS
205/* the following is tweaked from a config script, that is why it is a
206 * protected undef/define */
207#ifndef DES_PTR
208#undef DES_PTR
209#endif
210
211/* This helps C compiler generate the correct code for multiple functional
212 * units. It reduces register dependancies at the expense of 2 more
213 * registers */
214#ifndef DES_RISC1
215#undef DES_RISC1
216#endif
217
218#ifndef DES_RISC2
219#undef DES_RISC2
220#endif
221
222#if defined(DES_RISC1) && defined(DES_RISC2)
223YOU SHOULD NOT HAVE BOTH DES_RISC1 AND DES_RISC2 DEFINED!!!!!
224#endif
225
226/* Unroll the inner loop, this sometimes helps, sometimes hinders.
227 * Very mucy CPU dependant */
228#ifndef DES_UNROLL
229#define DES_UNROLL
230#endif
231
232/* These default values were supplied by
233 * Peter Gutman <pgut001@cs.auckland.ac.nz>
234 * They are only used if nothing else has been defined */
235#if !defined(DES_PTR) && !defined(DES_RISC1) && !defined(DES_RISC2) && !defined(DES_UNROLL)
236/* Special defines which change the way the code is built depending on the
237 CPU and OS. For SGI machines you can use _MIPS_SZLONG (32 or 64) to find
238 even newer MIPS CPU's, but at the moment one size fits all for
239 optimization options. Older Sparc's work better with only UNROLL, but
240 there's no way to tell at compile time what it is you're running on */
241
242#if defined( sun ) /* Newer Sparc's */
243# define DES_PTR
244# define DES_RISC1
245# define DES_UNROLL
246#elif defined( __ultrix ) /* Older MIPS */
247# define DES_PTR
248# define DES_RISC2
249# define DES_UNROLL
250#elif defined( __osf1__ ) /* Alpha */
251# define DES_PTR
252# define DES_RISC2
253#elif defined ( _AIX ) /* RS6000 */
254 /* Unknown */
255#elif defined( __hpux ) /* HP-PA */
256 /* Unknown */
257#elif defined( __aux ) /* 68K */
258 /* Unknown */
259#elif defined( __dgux ) /* 88K (but P6 in latest boxes) */
260# define DES_UNROLL
261#elif defined( __sgi ) /* Newer MIPS */
262# define DES_PTR
263# define DES_RISC2
264# define DES_UNROLL
265#elif defined(i386) || defined(__i386__) /* x86 boxes, should be gcc */
266# define DES_PTR
267# define DES_RISC1
268# define DES_UNROLL
269#endif /* Systems-specific speed defines */
270#endif
271
272#endif /* DES_DEFAULT_OPTIONS */
273#endif /* HEADER_DES_LOCL_H */
diff --git a/src/lib/libcrypto/arch/hppa64/opensslconf.h b/src/lib/libcrypto/arch/hppa64/opensslconf.h
new file mode 100644
index 0000000000..f8f478ff52
--- /dev/null
+++ b/src/lib/libcrypto/arch/hppa64/opensslconf.h
@@ -0,0 +1,273 @@
1/* opensslconf.h */
2/* WARNING: Generated automatically from opensslconf.h.in by Configure. */
3
4/* OpenSSL was configured with the following options: */
5#ifndef OPENSSL_DOING_MAKEDEPEND
6
7
8#ifndef OPENSSL_NO_CAMELLIA
9# define OPENSSL_NO_CAMELLIA
10#endif
11#ifndef OPENSSL_NO_EC_NISTP_64_GCC_128
12# define OPENSSL_NO_EC_NISTP_64_GCC_128
13#endif
14#ifndef OPENSSL_NO_CMS
15# define OPENSSL_NO_CMS
16#endif
17#ifndef OPENSSL_NO_GMP
18# define OPENSSL_NO_GMP
19#endif
20#ifndef OPENSSL_NO_GOST
21# define OPENSSL_NO_GOST
22#endif
23#ifndef OPENSSL_NO_JPAKE
24# define OPENSSL_NO_JPAKE
25#endif
26#ifndef OPENSSL_NO_KRB5
27# define OPENSSL_NO_KRB5
28#endif
29#ifndef OPENSSL_NO_MD2
30# define OPENSSL_NO_MD2
31#endif
32#ifndef OPENSSL_NO_RC5
33# define OPENSSL_NO_RC5
34#endif
35#ifndef OPENSSL_NO_RFC3779
36# define OPENSSL_NO_RFC3779
37#endif
38#ifndef OPENSSL_NO_SCTP
39# define OPENSSL_NO_SCTP
40#endif
41#ifndef OPENSSL_NO_SEED
42# define OPENSSL_NO_SEED
43#endif
44#ifndef OPENSSL_NO_SRP
45# define OPENSSL_NO_SRP
46#endif
47#ifndef OPENSSL_NO_SSL2
48# define OPENSSL_NO_SSL2
49#endif
50#ifndef OPENSSL_NO_STORE
51# define OPENSSL_NO_STORE
52#endif
53
54#endif /* OPENSSL_DOING_MAKEDEPEND */
55
56#ifndef OPENSSL_THREADS
57# define OPENSSL_THREADS
58#endif
59#ifndef OPENSSL_NO_DYNAMIC_ENGINE
60# define OPENSSL_NO_DYNAMIC_ENGINE
61#endif
62
63/* The OPENSSL_NO_* macros are also defined as NO_* if the application
64 asks for it. This is a transient feature that is provided for those
65 who haven't had the time to do the appropriate changes in their
66 applications. */
67#ifdef OPENSSL_ALGORITHM_DEFINES
68# if defined(OPENSSL_NO_CAMELLIA) && !defined(NO_CAMELLIA)
69# define NO_CAMELLIA
70# endif
71# if defined(OPENSSL_NO_EC_NISTP_64_GCC_128) && !defined(NO_EC_NISTP_64_GCC_128)
72# define NO_EC_NISTP_64_GCC_128
73# endif
74# if defined(OPENSSL_NO_CMS) && !defined(NO_CMS)
75# define NO_CMS
76# endif
77# if defined(OPENSSL_NO_GMP) && !defined(NO_GMP)
78# define NO_GMP
79# endif
80# if defined(OPENSSL_NO_GOST) && !defined(NO_GOST)
81# define NO_GOST
82# endif
83# if defined(OPENSSL_NO_JPAKE) && !defined(NO_JPAKE)
84# define NO_JPAKE
85# endif
86# if defined(OPENSSL_NO_KRB5) && !defined(NO_KRB5)
87# define NO_KRB5
88# endif
89# if defined(OPENSSL_NO_MD2) && !defined(NO_MD2)
90# define NO_MD2
91# endif
92# if defined(OPENSSL_NO_RC5) && !defined(NO_RC5)
93# define NO_RC5
94# endif
95# if defined(OPENSSL_NO_RFC3779) && !defined(NO_RFC3779)
96# define NO_RFC3779
97# endif
98# if defined(OPENSSL_NO_SCTP) && !defined(NO_SCTP)
99# define NO_SCTP
100# endif
101# if defined(OPENSSL_NO_SEED) && !defined(NO_SEED)
102# define NO_SEED
103# endif
104# if defined(OPENSSL_NO_SRP) && !defined(NO_SRP)
105# define NO_SRP
106# endif
107# if defined(OPENSSL_NO_SSL2) && !defined(NO_SSL2)
108# define NO_SSL2
109# endif
110# if defined(OPENSSL_NO_STORE) && !defined(NO_STORE)
111# define NO_STORE
112# endif
113#endif
114
115/* crypto/opensslconf.h.in */
116
117/* Generate 80386 code? */
118#undef I386_ONLY
119
120#if !(defined(VMS) || defined(__VMS)) /* VMS uses logical names instead */
121#if defined(HEADER_CRYPTLIB_H) && !defined(OPENSSLDIR)
122#define ENGINESDIR "/usr/lib/engines"
123#define OPENSSLDIR "/etc/ssl"
124#endif
125#endif
126
127#undef OPENSSL_UNISTD
128#define OPENSSL_UNISTD <unistd.h>
129
130#undef OPENSSL_EXPORT_VAR_AS_FUNCTION
131
132#if defined(HEADER_IDEA_H) && !defined(IDEA_INT)
133#define IDEA_INT unsigned int
134#endif
135
136#if defined(HEADER_MD2_H) && !defined(MD2_INT)
137#define MD2_INT unsigned int
138#endif
139
140#if defined(HEADER_RC2_H) && !defined(RC2_INT)
141/* I need to put in a mod for the alpha - eay */
142#define RC2_INT unsigned int
143#endif
144
145#if defined(HEADER_RC4_H)
146#if !defined(RC4_INT)
147/* using int types make the structure larger but make the code faster
148 * on most boxes I have tested - up to %20 faster. */
149/*
150 * I don't know what does "most" mean, but declaring "int" is a must on:
151 * - Intel P6 because partial register stalls are very expensive;
152 * - elder Alpha because it lacks byte load/store instructions;
153 */
154#define RC4_INT unsigned int
155#endif
156#if !defined(RC4_CHUNK)
157/*
158 * This enables code handling data aligned at natural CPU word
159 * boundary. See crypto/rc4/rc4_enc.c for further details.
160 */
161#undef RC4_CHUNK
162#endif
163#endif
164
165#if (defined(HEADER_NEW_DES_H) || defined(HEADER_DES_H)) && !defined(DES_LONG)
166/* If this is set to 'unsigned int' on a DEC Alpha, this gives about a
167 * %20 speed up (longs are 8 bytes, int's are 4). */
168#ifndef DES_LONG
169#define DES_LONG unsigned int
170#endif
171#endif
172
173#if defined(HEADER_BN_H) && !defined(CONFIG_HEADER_BN_H)
174#define CONFIG_HEADER_BN_H
175#undef BN_LLONG
176
177/* Should we define BN_DIV2W here? */
178
179/* Only one for the following should be defined */
180/* The prime number generation stuff may not work when
181 * EIGHT_BIT but I don't care since I've only used this mode
182 * for debuging the bignum libraries */
183#define SIXTY_FOUR_BIT_LONG
184#undef SIXTY_FOUR_BIT
185#undef THIRTY_TWO_BIT
186#undef SIXTEEN_BIT
187#undef EIGHT_BIT
188#endif
189
190#if defined(HEADER_RC4_LOCL_H) && !defined(CONFIG_HEADER_RC4_LOCL_H)
191#define CONFIG_HEADER_RC4_LOCL_H
192/* if this is defined data[i] is used instead of *data, this is a %20
193 * speedup on x86 */
194#define RC4_INDEX
195#endif
196
197#if defined(HEADER_BF_LOCL_H) && !defined(CONFIG_HEADER_BF_LOCL_H)
198#define CONFIG_HEADER_BF_LOCL_H
199#undef BF_PTR
200#endif /* HEADER_BF_LOCL_H */
201
202#if defined(HEADER_DES_LOCL_H) && !defined(CONFIG_HEADER_DES_LOCL_H)
203#define CONFIG_HEADER_DES_LOCL_H
204#ifndef DES_DEFAULT_OPTIONS
205/* the following is tweaked from a config script, that is why it is a
206 * protected undef/define */
207#ifndef DES_PTR
208#undef DES_PTR
209#endif
210
211/* This helps C compiler generate the correct code for multiple functional
212 * units. It reduces register dependancies at the expense of 2 more
213 * registers */
214#ifndef DES_RISC1
215#define DES_RISC1
216#endif
217
218#ifndef DES_RISC2
219#undef DES_RISC2
220#endif
221
222#if defined(DES_RISC1) && defined(DES_RISC2)
223YOU SHOULD NOT HAVE BOTH DES_RISC1 AND DES_RISC2 DEFINED!!!!!
224#endif
225
226/* Unroll the inner loop, this sometimes helps, sometimes hinders.
227 * Very mucy CPU dependant */
228#ifndef DES_UNROLL
229#define DES_UNROLL
230#endif
231
232/* These default values were supplied by
233 * Peter Gutman <pgut001@cs.auckland.ac.nz>
234 * They are only used if nothing else has been defined */
235#if !defined(DES_PTR) && !defined(DES_RISC1) && !defined(DES_RISC2) && !defined(DES_UNROLL)
236/* Special defines which change the way the code is built depending on the
237 CPU and OS. For SGI machines you can use _MIPS_SZLONG (32 or 64) to find
238 even newer MIPS CPU's, but at the moment one size fits all for
239 optimization options. Older Sparc's work better with only UNROLL, but
240 there's no way to tell at compile time what it is you're running on */
241
242#if defined( sun ) /* Newer Sparc's */
243# define DES_PTR
244# define DES_RISC1
245# define DES_UNROLL
246#elif defined( __ultrix ) /* Older MIPS */
247# define DES_PTR
248# define DES_RISC2
249# define DES_UNROLL
250#elif defined( __osf1__ ) /* Alpha */
251# define DES_PTR
252# define DES_RISC2
253#elif defined ( _AIX ) /* RS6000 */
254 /* Unknown */
255#elif defined( __hpux ) /* HP-PA */
256 /* Unknown */
257#elif defined( __aux ) /* 68K */
258 /* Unknown */
259#elif defined( __dgux ) /* 88K (but P6 in latest boxes) */
260# define DES_UNROLL
261#elif defined( __sgi ) /* Newer MIPS */
262# define DES_PTR
263# define DES_RISC2
264# define DES_UNROLL
265#elif defined(i386) || defined(__i386__) /* x86 boxes, should be gcc */
266# define DES_PTR
267# define DES_RISC1
268# define DES_UNROLL
269#endif /* Systems-specific speed defines */
270#endif
271
272#endif /* DES_DEFAULT_OPTIONS */
273#endif /* HEADER_DES_LOCL_H */
diff --git a/src/lib/libcrypto/arch/i386/opensslconf.h b/src/lib/libcrypto/arch/i386/opensslconf.h
new file mode 100644
index 0000000000..f7b5a6dc38
--- /dev/null
+++ b/src/lib/libcrypto/arch/i386/opensslconf.h
@@ -0,0 +1,273 @@
1/* opensslconf.h */
2/* WARNING: Generated automatically from opensslconf.h.in by Configure. */
3
4/* OpenSSL was configured with the following options: */
5#ifndef OPENSSL_DOING_MAKEDEPEND
6
7
8#ifndef OPENSSL_NO_CAMELLIA
9# define OPENSSL_NO_CAMELLIA
10#endif
11#ifndef OPENSSL_NO_EC_NISTP_64_GCC_128
12# define OPENSSL_NO_EC_NISTP_64_GCC_128
13#endif
14#ifndef OPENSSL_NO_CMS
15# define OPENSSL_NO_CMS
16#endif
17#ifndef OPENSSL_NO_GMP
18# define OPENSSL_NO_GMP
19#endif
20#ifndef OPENSSL_NO_GOST
21# define OPENSSL_NO_GOST
22#endif
23#ifndef OPENSSL_NO_JPAKE
24# define OPENSSL_NO_JPAKE
25#endif
26#ifndef OPENSSL_NO_KRB5
27# define OPENSSL_NO_KRB5
28#endif
29#ifndef OPENSSL_NO_MD2
30# define OPENSSL_NO_MD2
31#endif
32#ifndef OPENSSL_NO_RC5
33# define OPENSSL_NO_RC5
34#endif
35#ifndef OPENSSL_NO_RFC3779
36# define OPENSSL_NO_RFC3779
37#endif
38#ifndef OPENSSL_NO_SCTP
39# define OPENSSL_NO_SCTP
40#endif
41#ifndef OPENSSL_NO_SEED
42# define OPENSSL_NO_SEED
43#endif
44#ifndef OPENSSL_NO_SRP
45# define OPENSSL_NO_SRP
46#endif
47#ifndef OPENSSL_NO_SSL2
48# define OPENSSL_NO_SSL2
49#endif
50#ifndef OPENSSL_NO_STORE
51# define OPENSSL_NO_STORE
52#endif
53
54#endif /* OPENSSL_DOING_MAKEDEPEND */
55
56#ifndef OPENSSL_THREADS
57# define OPENSSL_THREADS
58#endif
59#ifndef OPENSSL_NO_DYNAMIC_ENGINE
60# define OPENSSL_NO_DYNAMIC_ENGINE
61#endif
62
63/* The OPENSSL_NO_* macros are also defined as NO_* if the application
64 asks for it. This is a transient feature that is provided for those
65 who haven't had the time to do the appropriate changes in their
66 applications. */
67#ifdef OPENSSL_ALGORITHM_DEFINES
68# if defined(OPENSSL_NO_CAMELLIA) && !defined(NO_CAMELLIA)
69# define NO_CAMELLIA
70# endif
71# if defined(OPENSSL_NO_EC_NISTP_64_GCC_128) && !defined(NO_EC_NISTP_64_GCC_128)
72# define NO_EC_NISTP_64_GCC_128
73# endif
74# if defined(OPENSSL_NO_CMS) && !defined(NO_CMS)
75# define NO_CMS
76# endif
77# if defined(OPENSSL_NO_GMP) && !defined(NO_GMP)
78# define NO_GMP
79# endif
80# if defined(OPENSSL_NO_GOST) && !defined(NO_GOST)
81# define NO_GOST
82# endif
83# if defined(OPENSSL_NO_JPAKE) && !defined(NO_JPAKE)
84# define NO_JPAKE
85# endif
86# if defined(OPENSSL_NO_KRB5) && !defined(NO_KRB5)
87# define NO_KRB5
88# endif
89# if defined(OPENSSL_NO_MD2) && !defined(NO_MD2)
90# define NO_MD2
91# endif
92# if defined(OPENSSL_NO_RC5) && !defined(NO_RC5)
93# define NO_RC5
94# endif
95# if defined(OPENSSL_NO_RFC3779) && !defined(NO_RFC3779)
96# define NO_RFC3779
97# endif
98# if defined(OPENSSL_NO_SCTP) && !defined(NO_SCTP)
99# define NO_SCTP
100# endif
101# if defined(OPENSSL_NO_SEED) && !defined(NO_SEED)
102# define NO_SEED
103# endif
104# if defined(OPENSSL_NO_SRP) && !defined(NO_SRP)
105# define NO_SRP
106# endif
107# if defined(OPENSSL_NO_SSL2) && !defined(NO_SSL2)
108# define NO_SSL2
109# endif
110# if defined(OPENSSL_NO_STORE) && !defined(NO_STORE)
111# define NO_STORE
112# endif
113#endif
114
115/* crypto/opensslconf.h.in */
116
117/* Generate 80386 code? */
118#undef I386_ONLY
119
120#if !(defined(VMS) || defined(__VMS)) /* VMS uses logical names instead */
121#if defined(HEADER_CRYPTLIB_H) && !defined(OPENSSLDIR)
122#define ENGINESDIR "/usr/lib/engines"
123#define OPENSSLDIR "/etc/ssl"
124#endif
125#endif
126
127#undef OPENSSL_UNISTD
128#define OPENSSL_UNISTD <unistd.h>
129
130#undef OPENSSL_EXPORT_VAR_AS_FUNCTION
131
132#if defined(HEADER_IDEA_H) && !defined(IDEA_INT)
133#define IDEA_INT unsigned int
134#endif
135
136#if defined(HEADER_MD2_H) && !defined(MD2_INT)
137#define MD2_INT unsigned int
138#endif
139
140#if defined(HEADER_RC2_H) && !defined(RC2_INT)
141/* I need to put in a mod for the alpha - eay */
142#define RC2_INT unsigned int
143#endif
144
145#if defined(HEADER_RC4_H)
146#if !defined(RC4_INT)
147/* using int types make the structure larger but make the code faster
148 * on most boxes I have tested - up to %20 faster. */
149/*
150 * I don't know what does "most" mean, but declaring "int" is a must on:
151 * - Intel P6 because partial register stalls are very expensive;
152 * - elder Alpha because it lacks byte load/store instructions;
153 */
154#define RC4_INT unsigned int
155#endif
156#if !defined(RC4_CHUNK)
157/*
158 * This enables code handling data aligned at natural CPU word
159 * boundary. See crypto/rc4/rc4_enc.c for further details.
160 */
161#undef RC4_CHUNK
162#endif
163#endif
164
165#if (defined(HEADER_NEW_DES_H) || defined(HEADER_DES_H)) && !defined(DES_LONG)
166/* If this is set to 'unsigned int' on a DEC Alpha, this gives about a
167 * %20 speed up (longs are 8 bytes, int's are 4). */
168#ifndef DES_LONG
169#define DES_LONG unsigned long
170#endif
171#endif
172
173#if defined(HEADER_BN_H) && !defined(CONFIG_HEADER_BN_H)
174#define CONFIG_HEADER_BN_H
175#define BN_LLONG
176
177/* Should we define BN_DIV2W here? */
178
179/* Only one for the following should be defined */
180/* The prime number generation stuff may not work when
181 * EIGHT_BIT but I don't care since I've only used this mode
182 * for debuging the bignum libraries */
183#undef SIXTY_FOUR_BIT_LONG
184#undef SIXTY_FOUR_BIT
185#define THIRTY_TWO_BIT
186#undef SIXTEEN_BIT
187#undef EIGHT_BIT
188#endif
189
190#if defined(HEADER_RC4_LOCL_H) && !defined(CONFIG_HEADER_RC4_LOCL_H)
191#define CONFIG_HEADER_RC4_LOCL_H
192/* if this is defined data[i] is used instead of *data, this is a %20
193 * speedup on x86 */
194#define RC4_INDEX
195#endif
196
197#if defined(HEADER_BF_LOCL_H) && !defined(CONFIG_HEADER_BF_LOCL_H)
198#define CONFIG_HEADER_BF_LOCL_H
199#undef BF_PTR
200#endif /* HEADER_BF_LOCL_H */
201
202#if defined(HEADER_DES_LOCL_H) && !defined(CONFIG_HEADER_DES_LOCL_H)
203#define CONFIG_HEADER_DES_LOCL_H
204#ifndef DES_DEFAULT_OPTIONS
205/* the following is tweaked from a config script, that is why it is a
206 * protected undef/define */
207#ifndef DES_PTR
208#define DES_PTR
209#endif
210
211/* This helps C compiler generate the correct code for multiple functional
212 * units. It reduces register dependancies at the expense of 2 more
213 * registers */
214#ifndef DES_RISC1
215#define DES_RISC1
216#endif
217
218#ifndef DES_RISC2
219#undef DES_RISC2
220#endif
221
222#if defined(DES_RISC1) && defined(DES_RISC2)
223YOU SHOULD NOT HAVE BOTH DES_RISC1 AND DES_RISC2 DEFINED!!!!!
224#endif
225
226/* Unroll the inner loop, this sometimes helps, sometimes hinders.
227 * Very mucy CPU dependant */
228#ifndef DES_UNROLL
229#define DES_UNROLL
230#endif
231
232/* These default values were supplied by
233 * Peter Gutman <pgut001@cs.auckland.ac.nz>
234 * They are only used if nothing else has been defined */
235#if !defined(DES_PTR) && !defined(DES_RISC1) && !defined(DES_RISC2) && !defined(DES_UNROLL)
236/* Special defines which change the way the code is built depending on the
237 CPU and OS. For SGI machines you can use _MIPS_SZLONG (32 or 64) to find
238 even newer MIPS CPU's, but at the moment one size fits all for
239 optimization options. Older Sparc's work better with only UNROLL, but
240 there's no way to tell at compile time what it is you're running on */
241
242#if defined( sun ) /* Newer Sparc's */
243# define DES_PTR
244# define DES_RISC1
245# define DES_UNROLL
246#elif defined( __ultrix ) /* Older MIPS */
247# define DES_PTR
248# define DES_RISC2
249# define DES_UNROLL
250#elif defined( __osf1__ ) /* Alpha */
251# define DES_PTR
252# define DES_RISC2
253#elif defined ( _AIX ) /* RS6000 */
254 /* Unknown */
255#elif defined( __hpux ) /* HP-PA */
256 /* Unknown */
257#elif defined( __aux ) /* 68K */
258 /* Unknown */
259#elif defined( __dgux ) /* 88K (but P6 in latest boxes) */
260# define DES_UNROLL
261#elif defined( __sgi ) /* Newer MIPS */
262# define DES_PTR
263# define DES_RISC2
264# define DES_UNROLL
265#elif defined(i386) || defined(__i386__) /* x86 boxes, should be gcc */
266# define DES_PTR
267# define DES_RISC1
268# define DES_UNROLL
269#endif /* Systems-specific speed defines */
270#endif
271
272#endif /* DES_DEFAULT_OPTIONS */
273#endif /* HEADER_DES_LOCL_H */
diff --git a/src/lib/libcrypto/arch/m88k/opensslconf.h b/src/lib/libcrypto/arch/m88k/opensslconf.h
new file mode 100644
index 0000000000..fc5ea38470
--- /dev/null
+++ b/src/lib/libcrypto/arch/m88k/opensslconf.h
@@ -0,0 +1,273 @@
1/* opensslconf.h */
2/* WARNING: Generated automatically from opensslconf.h.in by Configure. */
3
4/* OpenSSL was configured with the following options: */
5#ifndef OPENSSL_DOING_MAKEDEPEND
6
7
8#ifndef OPENSSL_NO_CAMELLIA
9# define OPENSSL_NO_CAMELLIA
10#endif
11#ifndef OPENSSL_NO_EC_NISTP_64_GCC_128
12# define OPENSSL_NO_EC_NISTP_64_GCC_128
13#endif
14#ifndef OPENSSL_NO_CMS
15# define OPENSSL_NO_CMS
16#endif
17#ifndef OPENSSL_NO_GMP
18# define OPENSSL_NO_GMP
19#endif
20#ifndef OPENSSL_NO_GOST
21# define OPENSSL_NO_GOST
22#endif
23#ifndef OPENSSL_NO_JPAKE
24# define OPENSSL_NO_JPAKE
25#endif
26#ifndef OPENSSL_NO_KRB5
27# define OPENSSL_NO_KRB5
28#endif
29#ifndef OPENSSL_NO_MD2
30# define OPENSSL_NO_MD2
31#endif
32#ifndef OPENSSL_NO_RC5
33# define OPENSSL_NO_RC5
34#endif
35#ifndef OPENSSL_NO_RFC3779
36# define OPENSSL_NO_RFC3779
37#endif
38#ifndef OPENSSL_NO_SCTP
39# define OPENSSL_NO_SCTP
40#endif
41#ifndef OPENSSL_NO_SEED
42# define OPENSSL_NO_SEED
43#endif
44#ifndef OPENSSL_NO_SRP
45# define OPENSSL_NO_SRP
46#endif
47#ifndef OPENSSL_NO_SSL2
48# define OPENSSL_NO_SSL2
49#endif
50#ifndef OPENSSL_NO_STORE
51# define OPENSSL_NO_STORE
52#endif
53
54#endif /* OPENSSL_DOING_MAKEDEPEND */
55
56#ifndef OPENSSL_THREADS
57# define OPENSSL_THREADS
58#endif
59#ifndef OPENSSL_NO_DYNAMIC_ENGINE
60# define OPENSSL_NO_DYNAMIC_ENGINE
61#endif
62
63/* The OPENSSL_NO_* macros are also defined as NO_* if the application
64 asks for it. This is a transient feature that is provided for those
65 who haven't had the time to do the appropriate changes in their
66 applications. */
67#ifdef OPENSSL_ALGORITHM_DEFINES
68# if defined(OPENSSL_NO_CAMELLIA) && !defined(NO_CAMELLIA)
69# define NO_CAMELLIA
70# endif
71# if defined(OPENSSL_NO_EC_NISTP_64_GCC_128) && !defined(NO_EC_NISTP_64_GCC_128)
72# define NO_EC_NISTP_64_GCC_128
73# endif
74# if defined(OPENSSL_NO_CMS) && !defined(NO_CMS)
75# define NO_CMS
76# endif
77# if defined(OPENSSL_NO_GMP) && !defined(NO_GMP)
78# define NO_GMP
79# endif
80# if defined(OPENSSL_NO_GOST) && !defined(NO_GOST)
81# define NO_GOST
82# endif
83# if defined(OPENSSL_NO_JPAKE) && !defined(NO_JPAKE)
84# define NO_JPAKE
85# endif
86# if defined(OPENSSL_NO_KRB5) && !defined(NO_KRB5)
87# define NO_KRB5
88# endif
89# if defined(OPENSSL_NO_MD2) && !defined(NO_MD2)
90# define NO_MD2
91# endif
92# if defined(OPENSSL_NO_RC5) && !defined(NO_RC5)
93# define NO_RC5
94# endif
95# if defined(OPENSSL_NO_RFC3779) && !defined(NO_RFC3779)
96# define NO_RFC3779
97# endif
98# if defined(OPENSSL_NO_SCTP) && !defined(NO_SCTP)
99# define NO_SCTP
100# endif
101# if defined(OPENSSL_NO_SEED) && !defined(NO_SEED)
102# define NO_SEED
103# endif
104# if defined(OPENSSL_NO_SRP) && !defined(NO_SRP)
105# define NO_SRP
106# endif
107# if defined(OPENSSL_NO_SSL2) && !defined(NO_SSL2)
108# define NO_SSL2
109# endif
110# if defined(OPENSSL_NO_STORE) && !defined(NO_STORE)
111# define NO_STORE
112# endif
113#endif
114
115/* crypto/opensslconf.h.in */
116
117/* Generate 80386 code? */
118#undef I386_ONLY
119
120#if !(defined(VMS) || defined(__VMS)) /* VMS uses logical names instead */
121#if defined(HEADER_CRYPTLIB_H) && !defined(OPENSSLDIR)
122#define ENGINESDIR "/usr/lib/engines"
123#define OPENSSLDIR "/etc/ssl"
124#endif
125#endif
126
127#undef OPENSSL_UNISTD
128#define OPENSSL_UNISTD <unistd.h>
129
130#undef OPENSSL_EXPORT_VAR_AS_FUNCTION
131
132#if defined(HEADER_IDEA_H) && !defined(IDEA_INT)
133#define IDEA_INT unsigned int
134#endif
135
136#if defined(HEADER_MD2_H) && !defined(MD2_INT)
137#define MD2_INT unsigned int
138#endif
139
140#if defined(HEADER_RC2_H) && !defined(RC2_INT)
141/* I need to put in a mod for the alpha - eay */
142#define RC2_INT unsigned int
143#endif
144
145#if defined(HEADER_RC4_H)
146#if !defined(RC4_INT)
147/* using int types make the structure larger but make the code faster
148 * on most boxes I have tested - up to %20 faster. */
149/*
150 * I don't know what does "most" mean, but declaring "int" is a must on:
151 * - Intel P6 because partial register stalls are very expensive;
152 * - elder Alpha because it lacks byte load/store instructions;
153 */
154#define RC4_INT unsigned int
155#endif
156#if !defined(RC4_CHUNK)
157/*
158 * This enables code handling data aligned at natural CPU word
159 * boundary. See crypto/rc4/rc4_enc.c for further details.
160 */
161#undef RC4_CHUNK
162#endif
163#endif
164
165#if (defined(HEADER_NEW_DES_H) || defined(HEADER_DES_H)) && !defined(DES_LONG)
166/* If this is set to 'unsigned int' on a DEC Alpha, this gives about a
167 * %20 speed up (longs are 8 bytes, int's are 4). */
168#ifndef DES_LONG
169#define DES_LONG unsigned int
170#endif
171#endif
172
173#if defined(HEADER_BN_H) && !defined(CONFIG_HEADER_BN_H)
174#define CONFIG_HEADER_BN_H
175#define BN_LLONG
176
177/* Should we define BN_DIV2W here? */
178
179/* Only one for the following should be defined */
180/* The prime number generation stuff may not work when
181 * EIGHT_BIT but I don't care since I've only used this mode
182 * for debuging the bignum libraries */
183#undef SIXTY_FOUR_BIT_LONG
184#undef SIXTY_FOUR_BIT
185#define THIRTY_TWO_BIT
186#undef SIXTEEN_BIT
187#undef EIGHT_BIT
188#endif
189
190#if defined(HEADER_RC4_LOCL_H) && !defined(CONFIG_HEADER_RC4_LOCL_H)
191#define CONFIG_HEADER_RC4_LOCL_H
192/* if this is defined data[i] is used instead of *data, this is a %20
193 * speedup on x86 */
194#define RC4_INDEX
195#endif
196
197#if defined(HEADER_BF_LOCL_H) && !defined(CONFIG_HEADER_BF_LOCL_H)
198#define CONFIG_HEADER_BF_LOCL_H
199#undef BF_PTR
200#endif /* HEADER_BF_LOCL_H */
201
202#if defined(HEADER_DES_LOCL_H) && !defined(CONFIG_HEADER_DES_LOCL_H)
203#define CONFIG_HEADER_DES_LOCL_H
204#ifndef DES_DEFAULT_OPTIONS
205/* the following is tweaked from a config script, that is why it is a
206 * protected undef/define */
207#ifndef DES_PTR
208#undef DES_PTR
209#endif
210
211/* This helps C compiler generate the correct code for multiple functional
212 * units. It reduces register dependancies at the expense of 2 more
213 * registers */
214#ifndef DES_RISC1
215#undef DES_RISC1
216#endif
217
218#ifndef DES_RISC2
219#undef DES_RISC2
220#endif
221
222#if defined(DES_RISC1) && defined(DES_RISC2)
223YOU SHOULD NOT HAVE BOTH DES_RISC1 AND DES_RISC2 DEFINED!!!!!
224#endif
225
226/* Unroll the inner loop, this sometimes helps, sometimes hinders.
227 * Very mucy CPU dependant */
228#ifndef DES_UNROLL
229#define DES_UNROLL
230#endif
231
232/* These default values were supplied by
233 * Peter Gutman <pgut001@cs.auckland.ac.nz>
234 * They are only used if nothing else has been defined */
235#if !defined(DES_PTR) && !defined(DES_RISC1) && !defined(DES_RISC2) && !defined(DES_UNROLL)
236/* Special defines which change the way the code is built depending on the
237 CPU and OS. For SGI machines you can use _MIPS_SZLONG (32 or 64) to find
238 even newer MIPS CPU's, but at the moment one size fits all for
239 optimization options. Older Sparc's work better with only UNROLL, but
240 there's no way to tell at compile time what it is you're running on */
241
242#if defined( sun ) /* Newer Sparc's */
243# define DES_PTR
244# define DES_RISC1
245# define DES_UNROLL
246#elif defined( __ultrix ) /* Older MIPS */
247# define DES_PTR
248# define DES_RISC2
249# define DES_UNROLL
250#elif defined( __osf1__ ) /* Alpha */
251# define DES_PTR
252# define DES_RISC2
253#elif defined ( _AIX ) /* RS6000 */
254 /* Unknown */
255#elif defined( __hpux ) /* HP-PA */
256 /* Unknown */
257#elif defined( __aux ) /* 68K */
258 /* Unknown */
259#elif defined( __dgux ) /* 88K (but P6 in latest boxes) */
260# define DES_UNROLL
261#elif defined( __sgi ) /* Newer MIPS */
262# define DES_PTR
263# define DES_RISC2
264# define DES_UNROLL
265#elif defined(i386) || defined(__i386__) /* x86 boxes, should be gcc */
266# define DES_PTR
267# define DES_RISC1
268# define DES_UNROLL
269#endif /* Systems-specific speed defines */
270#endif
271
272#endif /* DES_DEFAULT_OPTIONS */
273#endif /* HEADER_DES_LOCL_H */
diff --git a/src/lib/libcrypto/arch/mips64/opensslconf.h b/src/lib/libcrypto/arch/mips64/opensslconf.h
new file mode 100644
index 0000000000..e55282fd63
--- /dev/null
+++ b/src/lib/libcrypto/arch/mips64/opensslconf.h
@@ -0,0 +1,273 @@
1/* opensslconf.h */
2/* WARNING: Generated automatically from opensslconf.h.in by Configure. */
3
4/* OpenSSL was configured with the following options: */
5#ifndef OPENSSL_DOING_MAKEDEPEND
6
7
8#ifndef OPENSSL_NO_CAMELLIA
9# define OPENSSL_NO_CAMELLIA
10#endif
11#ifndef OPENSSL_NO_EC_NISTP_64_GCC_128
12# define OPENSSL_NO_EC_NISTP_64_GCC_128
13#endif
14#ifndef OPENSSL_NO_CMS
15# define OPENSSL_NO_CMS
16#endif
17#ifndef OPENSSL_NO_GMP
18# define OPENSSL_NO_GMP
19#endif
20#ifndef OPENSSL_NO_GOST
21# define OPENSSL_NO_GOST
22#endif
23#ifndef OPENSSL_NO_JPAKE
24# define OPENSSL_NO_JPAKE
25#endif
26#ifndef OPENSSL_NO_KRB5
27# define OPENSSL_NO_KRB5
28#endif
29#ifndef OPENSSL_NO_MD2
30# define OPENSSL_NO_MD2
31#endif
32#ifndef OPENSSL_NO_RC5
33# define OPENSSL_NO_RC5
34#endif
35#ifndef OPENSSL_NO_RFC3779
36# define OPENSSL_NO_RFC3779
37#endif
38#ifndef OPENSSL_NO_SCTP
39# define OPENSSL_NO_SCTP
40#endif
41#ifndef OPENSSL_NO_SEED
42# define OPENSSL_NO_SEED
43#endif
44#ifndef OPENSSL_NO_SRP
45# define OPENSSL_NO_SRP
46#endif
47#ifndef OPENSSL_NO_SSL2
48# define OPENSSL_NO_SSL2
49#endif
50#ifndef OPENSSL_NO_STORE
51# define OPENSSL_NO_STORE
52#endif
53
54#endif /* OPENSSL_DOING_MAKEDEPEND */
55
56#ifndef OPENSSL_THREADS
57# define OPENSSL_THREADS
58#endif
59#ifndef OPENSSL_NO_DYNAMIC_ENGINE
60# define OPENSSL_NO_DYNAMIC_ENGINE
61#endif
62
63/* The OPENSSL_NO_* macros are also defined as NO_* if the application
64 asks for it. This is a transient feature that is provided for those
65 who haven't had the time to do the appropriate changes in their
66 applications. */
67#ifdef OPENSSL_ALGORITHM_DEFINES
68# if defined(OPENSSL_NO_CAMELLIA) && !defined(NO_CAMELLIA)
69# define NO_CAMELLIA
70# endif
71# if defined(OPENSSL_NO_EC_NISTP_64_GCC_128) && !defined(NO_EC_NISTP_64_GCC_128)
72# define NO_EC_NISTP_64_GCC_128
73# endif
74# if defined(OPENSSL_NO_CMS) && !defined(NO_CMS)
75# define NO_CMS
76# endif
77# if defined(OPENSSL_NO_GMP) && !defined(NO_GMP)
78# define NO_GMP
79# endif
80# if defined(OPENSSL_NO_GOST) && !defined(NO_GOST)
81# define NO_GOST
82# endif
83# if defined(OPENSSL_NO_JPAKE) && !defined(NO_JPAKE)
84# define NO_JPAKE
85# endif
86# if defined(OPENSSL_NO_KRB5) && !defined(NO_KRB5)
87# define NO_KRB5
88# endif
89# if defined(OPENSSL_NO_MD2) && !defined(NO_MD2)
90# define NO_MD2
91# endif
92# if defined(OPENSSL_NO_RC5) && !defined(NO_RC5)
93# define NO_RC5
94# endif
95# if defined(OPENSSL_NO_RFC3779) && !defined(NO_RFC3779)
96# define NO_RFC3779
97# endif
98# if defined(OPENSSL_NO_SCTP) && !defined(NO_SCTP)
99# define NO_SCTP
100# endif
101# if defined(OPENSSL_NO_SEED) && !defined(NO_SEED)
102# define NO_SEED
103# endif
104# if defined(OPENSSL_NO_SRP) && !defined(NO_SRP)
105# define NO_SRP
106# endif
107# if defined(OPENSSL_NO_SSL2) && !defined(NO_SSL2)
108# define NO_SSL2
109# endif
110# if defined(OPENSSL_NO_STORE) && !defined(NO_STORE)
111# define NO_STORE
112# endif
113#endif
114
115/* crypto/opensslconf.h.in */
116
117/* Generate 80386 code? */
118#undef I386_ONLY
119
120#if !(defined(VMS) || defined(__VMS)) /* VMS uses logical names instead */
121#if defined(HEADER_CRYPTLIB_H) && !defined(OPENSSLDIR)
122#define ENGINESDIR "/usr/lib/engines"
123#define OPENSSLDIR "/etc/ssl"
124#endif
125#endif
126
127#undef OPENSSL_UNISTD
128#define OPENSSL_UNISTD <unistd.h>
129
130#undef OPENSSL_EXPORT_VAR_AS_FUNCTION
131
132#if defined(HEADER_IDEA_H) && !defined(IDEA_INT)
133#define IDEA_INT unsigned int
134#endif
135
136#if defined(HEADER_MD2_H) && !defined(MD2_INT)
137#define MD2_INT unsigned int
138#endif
139
140#if defined(HEADER_RC2_H) && !defined(RC2_INT)
141/* I need to put in a mod for the alpha - eay */
142#define RC2_INT unsigned int
143#endif
144
145#if defined(HEADER_RC4_H)
146#if !defined(RC4_INT)
147/* using int types make the structure larger but make the code faster
148 * on most boxes I have tested - up to %20 faster. */
149/*
150 * I don't know what does "most" mean, but declaring "int" is a must on:
151 * - Intel P6 because partial register stalls are very expensive;
152 * - elder Alpha because it lacks byte load/store instructions;
153 */
154#define RC4_INT unsigned int
155#endif
156#if !defined(RC4_CHUNK)
157/*
158 * This enables code handling data aligned at natural CPU word
159 * boundary. See crypto/rc4/rc4_enc.c for further details.
160 */
161#define RC4_CHUNK unsigned long
162#endif
163#endif
164
165#if (defined(HEADER_NEW_DES_H) || defined(HEADER_DES_H)) && !defined(DES_LONG)
166/* If this is set to 'unsigned int' on a DEC Alpha, this gives about a
167 * %20 speed up (longs are 8 bytes, int's are 4). */
168#ifndef DES_LONG
169#define DES_LONG unsigned int
170#endif
171#endif
172
173#if defined(HEADER_BN_H) && !defined(CONFIG_HEADER_BN_H)
174#define CONFIG_HEADER_BN_H
175#undef BN_LLONG
176
177/* Should we define BN_DIV2W here? */
178
179/* Only one for the following should be defined */
180/* The prime number generation stuff may not work when
181 * EIGHT_BIT but I don't care since I've only used this mode
182 * for debuging the bignum libraries */
183#define SIXTY_FOUR_BIT_LONG
184#undef SIXTY_FOUR_BIT
185#undef THIRTY_TWO_BIT
186#undef SIXTEEN_BIT
187#undef EIGHT_BIT
188#endif
189
190#if defined(HEADER_RC4_LOCL_H) && !defined(CONFIG_HEADER_RC4_LOCL_H)
191#define CONFIG_HEADER_RC4_LOCL_H
192/* if this is defined data[i] is used instead of *data, this is a %20
193 * speedup on x86 */
194#undef RC4_INDEX
195#endif
196
197#if defined(HEADER_BF_LOCL_H) && !defined(CONFIG_HEADER_BF_LOCL_H)
198#define CONFIG_HEADER_BF_LOCL_H
199#define BF_PTR
200#endif /* HEADER_BF_LOCL_H */
201
202#if defined(HEADER_DES_LOCL_H) && !defined(CONFIG_HEADER_DES_LOCL_H)
203#define CONFIG_HEADER_DES_LOCL_H
204#ifndef DES_DEFAULT_OPTIONS
205/* the following is tweaked from a config script, that is why it is a
206 * protected undef/define */
207#ifndef DES_PTR
208#define DES_PTR
209#endif
210
211/* This helps C compiler generate the correct code for multiple functional
212 * units. It reduces register dependancies at the expense of 2 more
213 * registers */
214#ifndef DES_RISC1
215#undef DES_RISC1
216#endif
217
218#ifndef DES_RISC2
219#define DES_RISC2
220#endif
221
222#if defined(DES_RISC1) && defined(DES_RISC2)
223YOU SHOULD NOT HAVE BOTH DES_RISC1 AND DES_RISC2 DEFINED!!!!!
224#endif
225
226/* Unroll the inner loop, this sometimes helps, sometimes hinders.
227 * Very mucy CPU dependant */
228#ifndef DES_UNROLL
229#undef DES_UNROLL
230#endif
231
232/* These default values were supplied by
233 * Peter Gutman <pgut001@cs.auckland.ac.nz>
234 * They are only used if nothing else has been defined */
235#if !defined(DES_PTR) && !defined(DES_RISC1) && !defined(DES_RISC2) && !defined(DES_UNROLL)
236/* Special defines which change the way the code is built depending on the
237 CPU and OS. For SGI machines you can use _MIPS_SZLONG (32 or 64) to find
238 even newer MIPS CPU's, but at the moment one size fits all for
239 optimization options. Older Sparc's work better with only UNROLL, but
240 there's no way to tell at compile time what it is you're running on */
241
242#if defined( sun ) /* Newer Sparc's */
243# define DES_PTR
244# define DES_RISC1
245# define DES_UNROLL
246#elif defined( __ultrix ) /* Older MIPS */
247# define DES_PTR
248# define DES_RISC2
249# define DES_UNROLL
250#elif defined( __osf1__ ) /* Alpha */
251# define DES_PTR
252# define DES_RISC2
253#elif defined ( _AIX ) /* RS6000 */
254 /* Unknown */
255#elif defined( __hpux ) /* HP-PA */
256 /* Unknown */
257#elif defined( __aux ) /* 68K */
258 /* Unknown */
259#elif defined( __dgux ) /* 88K (but P6 in latest boxes) */
260# define DES_UNROLL
261#elif defined( __sgi ) /* Newer MIPS */
262# define DES_PTR
263# define DES_RISC2
264# define DES_UNROLL
265#elif defined(i386) || defined(__i386__) /* x86 boxes, should be gcc */
266# define DES_PTR
267# define DES_RISC1
268# define DES_UNROLL
269#endif /* Systems-specific speed defines */
270#endif
271
272#endif /* DES_DEFAULT_OPTIONS */
273#endif /* HEADER_DES_LOCL_H */
diff --git a/src/lib/libcrypto/arch/powerpc/opensslconf.h b/src/lib/libcrypto/arch/powerpc/opensslconf.h
new file mode 100644
index 0000000000..fc5ea38470
--- /dev/null
+++ b/src/lib/libcrypto/arch/powerpc/opensslconf.h
@@ -0,0 +1,273 @@
1/* opensslconf.h */
2/* WARNING: Generated automatically from opensslconf.h.in by Configure. */
3
4/* OpenSSL was configured with the following options: */
5#ifndef OPENSSL_DOING_MAKEDEPEND
6
7
8#ifndef OPENSSL_NO_CAMELLIA
9# define OPENSSL_NO_CAMELLIA
10#endif
11#ifndef OPENSSL_NO_EC_NISTP_64_GCC_128
12# define OPENSSL_NO_EC_NISTP_64_GCC_128
13#endif
14#ifndef OPENSSL_NO_CMS
15# define OPENSSL_NO_CMS
16#endif
17#ifndef OPENSSL_NO_GMP
18# define OPENSSL_NO_GMP
19#endif
20#ifndef OPENSSL_NO_GOST
21# define OPENSSL_NO_GOST
22#endif
23#ifndef OPENSSL_NO_JPAKE
24# define OPENSSL_NO_JPAKE
25#endif
26#ifndef OPENSSL_NO_KRB5
27# define OPENSSL_NO_KRB5
28#endif
29#ifndef OPENSSL_NO_MD2
30# define OPENSSL_NO_MD2
31#endif
32#ifndef OPENSSL_NO_RC5
33# define OPENSSL_NO_RC5
34#endif
35#ifndef OPENSSL_NO_RFC3779
36# define OPENSSL_NO_RFC3779
37#endif
38#ifndef OPENSSL_NO_SCTP
39# define OPENSSL_NO_SCTP
40#endif
41#ifndef OPENSSL_NO_SEED
42# define OPENSSL_NO_SEED
43#endif
44#ifndef OPENSSL_NO_SRP
45# define OPENSSL_NO_SRP
46#endif
47#ifndef OPENSSL_NO_SSL2
48# define OPENSSL_NO_SSL2
49#endif
50#ifndef OPENSSL_NO_STORE
51# define OPENSSL_NO_STORE
52#endif
53
54#endif /* OPENSSL_DOING_MAKEDEPEND */
55
56#ifndef OPENSSL_THREADS
57# define OPENSSL_THREADS
58#endif
59#ifndef OPENSSL_NO_DYNAMIC_ENGINE
60# define OPENSSL_NO_DYNAMIC_ENGINE
61#endif
62
63/* The OPENSSL_NO_* macros are also defined as NO_* if the application
64 asks for it. This is a transient feature that is provided for those
65 who haven't had the time to do the appropriate changes in their
66 applications. */
67#ifdef OPENSSL_ALGORITHM_DEFINES
68# if defined(OPENSSL_NO_CAMELLIA) && !defined(NO_CAMELLIA)
69# define NO_CAMELLIA
70# endif
71# if defined(OPENSSL_NO_EC_NISTP_64_GCC_128) && !defined(NO_EC_NISTP_64_GCC_128)
72# define NO_EC_NISTP_64_GCC_128
73# endif
74# if defined(OPENSSL_NO_CMS) && !defined(NO_CMS)
75# define NO_CMS
76# endif
77# if defined(OPENSSL_NO_GMP) && !defined(NO_GMP)
78# define NO_GMP
79# endif
80# if defined(OPENSSL_NO_GOST) && !defined(NO_GOST)
81# define NO_GOST
82# endif
83# if defined(OPENSSL_NO_JPAKE) && !defined(NO_JPAKE)
84# define NO_JPAKE
85# endif
86# if defined(OPENSSL_NO_KRB5) && !defined(NO_KRB5)
87# define NO_KRB5
88# endif
89# if defined(OPENSSL_NO_MD2) && !defined(NO_MD2)
90# define NO_MD2
91# endif
92# if defined(OPENSSL_NO_RC5) && !defined(NO_RC5)
93# define NO_RC5
94# endif
95# if defined(OPENSSL_NO_RFC3779) && !defined(NO_RFC3779)
96# define NO_RFC3779
97# endif
98# if defined(OPENSSL_NO_SCTP) && !defined(NO_SCTP)
99# define NO_SCTP
100# endif
101# if defined(OPENSSL_NO_SEED) && !defined(NO_SEED)
102# define NO_SEED
103# endif
104# if defined(OPENSSL_NO_SRP) && !defined(NO_SRP)
105# define NO_SRP
106# endif
107# if defined(OPENSSL_NO_SSL2) && !defined(NO_SSL2)
108# define NO_SSL2
109# endif
110# if defined(OPENSSL_NO_STORE) && !defined(NO_STORE)
111# define NO_STORE
112# endif
113#endif
114
115/* crypto/opensslconf.h.in */
116
117/* Generate 80386 code? */
118#undef I386_ONLY
119
120#if !(defined(VMS) || defined(__VMS)) /* VMS uses logical names instead */
121#if defined(HEADER_CRYPTLIB_H) && !defined(OPENSSLDIR)
122#define ENGINESDIR "/usr/lib/engines"
123#define OPENSSLDIR "/etc/ssl"
124#endif
125#endif
126
127#undef OPENSSL_UNISTD
128#define OPENSSL_UNISTD <unistd.h>
129
130#undef OPENSSL_EXPORT_VAR_AS_FUNCTION
131
132#if defined(HEADER_IDEA_H) && !defined(IDEA_INT)
133#define IDEA_INT unsigned int
134#endif
135
136#if defined(HEADER_MD2_H) && !defined(MD2_INT)
137#define MD2_INT unsigned int
138#endif
139
140#if defined(HEADER_RC2_H) && !defined(RC2_INT)
141/* I need to put in a mod for the alpha - eay */
142#define RC2_INT unsigned int
143#endif
144
145#if defined(HEADER_RC4_H)
146#if !defined(RC4_INT)
147/* using int types make the structure larger but make the code faster
148 * on most boxes I have tested - up to %20 faster. */
149/*
150 * I don't know what does "most" mean, but declaring "int" is a must on:
151 * - Intel P6 because partial register stalls are very expensive;
152 * - elder Alpha because it lacks byte load/store instructions;
153 */
154#define RC4_INT unsigned int
155#endif
156#if !defined(RC4_CHUNK)
157/*
158 * This enables code handling data aligned at natural CPU word
159 * boundary. See crypto/rc4/rc4_enc.c for further details.
160 */
161#undef RC4_CHUNK
162#endif
163#endif
164
165#if (defined(HEADER_NEW_DES_H) || defined(HEADER_DES_H)) && !defined(DES_LONG)
166/* If this is set to 'unsigned int' on a DEC Alpha, this gives about a
167 * %20 speed up (longs are 8 bytes, int's are 4). */
168#ifndef DES_LONG
169#define DES_LONG unsigned int
170#endif
171#endif
172
173#if defined(HEADER_BN_H) && !defined(CONFIG_HEADER_BN_H)
174#define CONFIG_HEADER_BN_H
175#define BN_LLONG
176
177/* Should we define BN_DIV2W here? */
178
179/* Only one for the following should be defined */
180/* The prime number generation stuff may not work when
181 * EIGHT_BIT but I don't care since I've only used this mode
182 * for debuging the bignum libraries */
183#undef SIXTY_FOUR_BIT_LONG
184#undef SIXTY_FOUR_BIT
185#define THIRTY_TWO_BIT
186#undef SIXTEEN_BIT
187#undef EIGHT_BIT
188#endif
189
190#if defined(HEADER_RC4_LOCL_H) && !defined(CONFIG_HEADER_RC4_LOCL_H)
191#define CONFIG_HEADER_RC4_LOCL_H
192/* if this is defined data[i] is used instead of *data, this is a %20
193 * speedup on x86 */
194#define RC4_INDEX
195#endif
196
197#if defined(HEADER_BF_LOCL_H) && !defined(CONFIG_HEADER_BF_LOCL_H)
198#define CONFIG_HEADER_BF_LOCL_H
199#undef BF_PTR
200#endif /* HEADER_BF_LOCL_H */
201
202#if defined(HEADER_DES_LOCL_H) && !defined(CONFIG_HEADER_DES_LOCL_H)
203#define CONFIG_HEADER_DES_LOCL_H
204#ifndef DES_DEFAULT_OPTIONS
205/* the following is tweaked from a config script, that is why it is a
206 * protected undef/define */
207#ifndef DES_PTR
208#undef DES_PTR
209#endif
210
211/* This helps C compiler generate the correct code for multiple functional
212 * units. It reduces register dependancies at the expense of 2 more
213 * registers */
214#ifndef DES_RISC1
215#undef DES_RISC1
216#endif
217
218#ifndef DES_RISC2
219#undef DES_RISC2
220#endif
221
222#if defined(DES_RISC1) && defined(DES_RISC2)
223YOU SHOULD NOT HAVE BOTH DES_RISC1 AND DES_RISC2 DEFINED!!!!!
224#endif
225
226/* Unroll the inner loop, this sometimes helps, sometimes hinders.
227 * Very mucy CPU dependant */
228#ifndef DES_UNROLL
229#define DES_UNROLL
230#endif
231
232/* These default values were supplied by
233 * Peter Gutman <pgut001@cs.auckland.ac.nz>
234 * They are only used if nothing else has been defined */
235#if !defined(DES_PTR) && !defined(DES_RISC1) && !defined(DES_RISC2) && !defined(DES_UNROLL)
236/* Special defines which change the way the code is built depending on the
237 CPU and OS. For SGI machines you can use _MIPS_SZLONG (32 or 64) to find
238 even newer MIPS CPU's, but at the moment one size fits all for
239 optimization options. Older Sparc's work better with only UNROLL, but
240 there's no way to tell at compile time what it is you're running on */
241
242#if defined( sun ) /* Newer Sparc's */
243# define DES_PTR
244# define DES_RISC1
245# define DES_UNROLL
246#elif defined( __ultrix ) /* Older MIPS */
247# define DES_PTR
248# define DES_RISC2
249# define DES_UNROLL
250#elif defined( __osf1__ ) /* Alpha */
251# define DES_PTR
252# define DES_RISC2
253#elif defined ( _AIX ) /* RS6000 */
254 /* Unknown */
255#elif defined( __hpux ) /* HP-PA */
256 /* Unknown */
257#elif defined( __aux ) /* 68K */
258 /* Unknown */
259#elif defined( __dgux ) /* 88K (but P6 in latest boxes) */
260# define DES_UNROLL
261#elif defined( __sgi ) /* Newer MIPS */
262# define DES_PTR
263# define DES_RISC2
264# define DES_UNROLL
265#elif defined(i386) || defined(__i386__) /* x86 boxes, should be gcc */
266# define DES_PTR
267# define DES_RISC1
268# define DES_UNROLL
269#endif /* Systems-specific speed defines */
270#endif
271
272#endif /* DES_DEFAULT_OPTIONS */
273#endif /* HEADER_DES_LOCL_H */
diff --git a/src/lib/libcrypto/arch/sh/opensslconf.h b/src/lib/libcrypto/arch/sh/opensslconf.h
new file mode 100644
index 0000000000..fc5ea38470
--- /dev/null
+++ b/src/lib/libcrypto/arch/sh/opensslconf.h
@@ -0,0 +1,273 @@
1/* opensslconf.h */
2/* WARNING: Generated automatically from opensslconf.h.in by Configure. */
3
4/* OpenSSL was configured with the following options: */
5#ifndef OPENSSL_DOING_MAKEDEPEND
6
7
8#ifndef OPENSSL_NO_CAMELLIA
9# define OPENSSL_NO_CAMELLIA
10#endif
11#ifndef OPENSSL_NO_EC_NISTP_64_GCC_128
12# define OPENSSL_NO_EC_NISTP_64_GCC_128
13#endif
14#ifndef OPENSSL_NO_CMS
15# define OPENSSL_NO_CMS
16#endif
17#ifndef OPENSSL_NO_GMP
18# define OPENSSL_NO_GMP
19#endif
20#ifndef OPENSSL_NO_GOST
21# define OPENSSL_NO_GOST
22#endif
23#ifndef OPENSSL_NO_JPAKE
24# define OPENSSL_NO_JPAKE
25#endif
26#ifndef OPENSSL_NO_KRB5
27# define OPENSSL_NO_KRB5
28#endif
29#ifndef OPENSSL_NO_MD2
30# define OPENSSL_NO_MD2
31#endif
32#ifndef OPENSSL_NO_RC5
33# define OPENSSL_NO_RC5
34#endif
35#ifndef OPENSSL_NO_RFC3779
36# define OPENSSL_NO_RFC3779
37#endif
38#ifndef OPENSSL_NO_SCTP
39# define OPENSSL_NO_SCTP
40#endif
41#ifndef OPENSSL_NO_SEED
42# define OPENSSL_NO_SEED
43#endif
44#ifndef OPENSSL_NO_SRP
45# define OPENSSL_NO_SRP
46#endif
47#ifndef OPENSSL_NO_SSL2
48# define OPENSSL_NO_SSL2
49#endif
50#ifndef OPENSSL_NO_STORE
51# define OPENSSL_NO_STORE
52#endif
53
54#endif /* OPENSSL_DOING_MAKEDEPEND */
55
56#ifndef OPENSSL_THREADS
57# define OPENSSL_THREADS
58#endif
59#ifndef OPENSSL_NO_DYNAMIC_ENGINE
60# define OPENSSL_NO_DYNAMIC_ENGINE
61#endif
62
63/* The OPENSSL_NO_* macros are also defined as NO_* if the application
64 asks for it. This is a transient feature that is provided for those
65 who haven't had the time to do the appropriate changes in their
66 applications. */
67#ifdef OPENSSL_ALGORITHM_DEFINES
68# if defined(OPENSSL_NO_CAMELLIA) && !defined(NO_CAMELLIA)
69# define NO_CAMELLIA
70# endif
71# if defined(OPENSSL_NO_EC_NISTP_64_GCC_128) && !defined(NO_EC_NISTP_64_GCC_128)
72# define NO_EC_NISTP_64_GCC_128
73# endif
74# if defined(OPENSSL_NO_CMS) && !defined(NO_CMS)
75# define NO_CMS
76# endif
77# if defined(OPENSSL_NO_GMP) && !defined(NO_GMP)
78# define NO_GMP
79# endif
80# if defined(OPENSSL_NO_GOST) && !defined(NO_GOST)
81# define NO_GOST
82# endif
83# if defined(OPENSSL_NO_JPAKE) && !defined(NO_JPAKE)
84# define NO_JPAKE
85# endif
86# if defined(OPENSSL_NO_KRB5) && !defined(NO_KRB5)
87# define NO_KRB5
88# endif
89# if defined(OPENSSL_NO_MD2) && !defined(NO_MD2)
90# define NO_MD2
91# endif
92# if defined(OPENSSL_NO_RC5) && !defined(NO_RC5)
93# define NO_RC5
94# endif
95# if defined(OPENSSL_NO_RFC3779) && !defined(NO_RFC3779)
96# define NO_RFC3779
97# endif
98# if defined(OPENSSL_NO_SCTP) && !defined(NO_SCTP)
99# define NO_SCTP
100# endif
101# if defined(OPENSSL_NO_SEED) && !defined(NO_SEED)
102# define NO_SEED
103# endif
104# if defined(OPENSSL_NO_SRP) && !defined(NO_SRP)
105# define NO_SRP
106# endif
107# if defined(OPENSSL_NO_SSL2) && !defined(NO_SSL2)
108# define NO_SSL2
109# endif
110# if defined(OPENSSL_NO_STORE) && !defined(NO_STORE)
111# define NO_STORE
112# endif
113#endif
114
115/* crypto/opensslconf.h.in */
116
117/* Generate 80386 code? */
118#undef I386_ONLY
119
120#if !(defined(VMS) || defined(__VMS)) /* VMS uses logical names instead */
121#if defined(HEADER_CRYPTLIB_H) && !defined(OPENSSLDIR)
122#define ENGINESDIR "/usr/lib/engines"
123#define OPENSSLDIR "/etc/ssl"
124#endif
125#endif
126
127#undef OPENSSL_UNISTD
128#define OPENSSL_UNISTD <unistd.h>
129
130#undef OPENSSL_EXPORT_VAR_AS_FUNCTION
131
132#if defined(HEADER_IDEA_H) && !defined(IDEA_INT)
133#define IDEA_INT unsigned int
134#endif
135
136#if defined(HEADER_MD2_H) && !defined(MD2_INT)
137#define MD2_INT unsigned int
138#endif
139
140#if defined(HEADER_RC2_H) && !defined(RC2_INT)
141/* I need to put in a mod for the alpha - eay */
142#define RC2_INT unsigned int
143#endif
144
145#if defined(HEADER_RC4_H)
146#if !defined(RC4_INT)
147/* using int types make the structure larger but make the code faster
148 * on most boxes I have tested - up to %20 faster. */
149/*
150 * I don't know what does "most" mean, but declaring "int" is a must on:
151 * - Intel P6 because partial register stalls are very expensive;
152 * - elder Alpha because it lacks byte load/store instructions;
153 */
154#define RC4_INT unsigned int
155#endif
156#if !defined(RC4_CHUNK)
157/*
158 * This enables code handling data aligned at natural CPU word
159 * boundary. See crypto/rc4/rc4_enc.c for further details.
160 */
161#undef RC4_CHUNK
162#endif
163#endif
164
165#if (defined(HEADER_NEW_DES_H) || defined(HEADER_DES_H)) && !defined(DES_LONG)
166/* If this is set to 'unsigned int' on a DEC Alpha, this gives about a
167 * %20 speed up (longs are 8 bytes, int's are 4). */
168#ifndef DES_LONG
169#define DES_LONG unsigned int
170#endif
171#endif
172
173#if defined(HEADER_BN_H) && !defined(CONFIG_HEADER_BN_H)
174#define CONFIG_HEADER_BN_H
175#define BN_LLONG
176
177/* Should we define BN_DIV2W here? */
178
179/* Only one for the following should be defined */
180/* The prime number generation stuff may not work when
181 * EIGHT_BIT but I don't care since I've only used this mode
182 * for debuging the bignum libraries */
183#undef SIXTY_FOUR_BIT_LONG
184#undef SIXTY_FOUR_BIT
185#define THIRTY_TWO_BIT
186#undef SIXTEEN_BIT
187#undef EIGHT_BIT
188#endif
189
190#if defined(HEADER_RC4_LOCL_H) && !defined(CONFIG_HEADER_RC4_LOCL_H)
191#define CONFIG_HEADER_RC4_LOCL_H
192/* if this is defined data[i] is used instead of *data, this is a %20
193 * speedup on x86 */
194#define RC4_INDEX
195#endif
196
197#if defined(HEADER_BF_LOCL_H) && !defined(CONFIG_HEADER_BF_LOCL_H)
198#define CONFIG_HEADER_BF_LOCL_H
199#undef BF_PTR
200#endif /* HEADER_BF_LOCL_H */
201
202#if defined(HEADER_DES_LOCL_H) && !defined(CONFIG_HEADER_DES_LOCL_H)
203#define CONFIG_HEADER_DES_LOCL_H
204#ifndef DES_DEFAULT_OPTIONS
205/* the following is tweaked from a config script, that is why it is a
206 * protected undef/define */
207#ifndef DES_PTR
208#undef DES_PTR
209#endif
210
211/* This helps C compiler generate the correct code for multiple functional
212 * units. It reduces register dependancies at the expense of 2 more
213 * registers */
214#ifndef DES_RISC1
215#undef DES_RISC1
216#endif
217
218#ifndef DES_RISC2
219#undef DES_RISC2
220#endif
221
222#if defined(DES_RISC1) && defined(DES_RISC2)
223YOU SHOULD NOT HAVE BOTH DES_RISC1 AND DES_RISC2 DEFINED!!!!!
224#endif
225
226/* Unroll the inner loop, this sometimes helps, sometimes hinders.
227 * Very mucy CPU dependant */
228#ifndef DES_UNROLL
229#define DES_UNROLL
230#endif
231
232/* These default values were supplied by
233 * Peter Gutman <pgut001@cs.auckland.ac.nz>
234 * They are only used if nothing else has been defined */
235#if !defined(DES_PTR) && !defined(DES_RISC1) && !defined(DES_RISC2) && !defined(DES_UNROLL)
236/* Special defines which change the way the code is built depending on the
237 CPU and OS. For SGI machines you can use _MIPS_SZLONG (32 or 64) to find
238 even newer MIPS CPU's, but at the moment one size fits all for
239 optimization options. Older Sparc's work better with only UNROLL, but
240 there's no way to tell at compile time what it is you're running on */
241
242#if defined( sun ) /* Newer Sparc's */
243# define DES_PTR
244# define DES_RISC1
245# define DES_UNROLL
246#elif defined( __ultrix ) /* Older MIPS */
247# define DES_PTR
248# define DES_RISC2
249# define DES_UNROLL
250#elif defined( __osf1__ ) /* Alpha */
251# define DES_PTR
252# define DES_RISC2
253#elif defined ( _AIX ) /* RS6000 */
254 /* Unknown */
255#elif defined( __hpux ) /* HP-PA */
256 /* Unknown */
257#elif defined( __aux ) /* 68K */
258 /* Unknown */
259#elif defined( __dgux ) /* 88K (but P6 in latest boxes) */
260# define DES_UNROLL
261#elif defined( __sgi ) /* Newer MIPS */
262# define DES_PTR
263# define DES_RISC2
264# define DES_UNROLL
265#elif defined(i386) || defined(__i386__) /* x86 boxes, should be gcc */
266# define DES_PTR
267# define DES_RISC1
268# define DES_UNROLL
269#endif /* Systems-specific speed defines */
270#endif
271
272#endif /* DES_DEFAULT_OPTIONS */
273#endif /* HEADER_DES_LOCL_H */
diff --git a/src/lib/libcrypto/arch/sparc/opensslconf.h b/src/lib/libcrypto/arch/sparc/opensslconf.h
new file mode 100644
index 0000000000..fc5ea38470
--- /dev/null
+++ b/src/lib/libcrypto/arch/sparc/opensslconf.h
@@ -0,0 +1,273 @@
1/* opensslconf.h */
2/* WARNING: Generated automatically from opensslconf.h.in by Configure. */
3
4/* OpenSSL was configured with the following options: */
5#ifndef OPENSSL_DOING_MAKEDEPEND
6
7
8#ifndef OPENSSL_NO_CAMELLIA
9# define OPENSSL_NO_CAMELLIA
10#endif
11#ifndef OPENSSL_NO_EC_NISTP_64_GCC_128
12# define OPENSSL_NO_EC_NISTP_64_GCC_128
13#endif
14#ifndef OPENSSL_NO_CMS
15# define OPENSSL_NO_CMS
16#endif
17#ifndef OPENSSL_NO_GMP
18# define OPENSSL_NO_GMP
19#endif
20#ifndef OPENSSL_NO_GOST
21# define OPENSSL_NO_GOST
22#endif
23#ifndef OPENSSL_NO_JPAKE
24# define OPENSSL_NO_JPAKE
25#endif
26#ifndef OPENSSL_NO_KRB5
27# define OPENSSL_NO_KRB5
28#endif
29#ifndef OPENSSL_NO_MD2
30# define OPENSSL_NO_MD2
31#endif
32#ifndef OPENSSL_NO_RC5
33# define OPENSSL_NO_RC5
34#endif
35#ifndef OPENSSL_NO_RFC3779
36# define OPENSSL_NO_RFC3779
37#endif
38#ifndef OPENSSL_NO_SCTP
39# define OPENSSL_NO_SCTP
40#endif
41#ifndef OPENSSL_NO_SEED
42# define OPENSSL_NO_SEED
43#endif
44#ifndef OPENSSL_NO_SRP
45# define OPENSSL_NO_SRP
46#endif
47#ifndef OPENSSL_NO_SSL2
48# define OPENSSL_NO_SSL2
49#endif
50#ifndef OPENSSL_NO_STORE
51# define OPENSSL_NO_STORE
52#endif
53
54#endif /* OPENSSL_DOING_MAKEDEPEND */
55
56#ifndef OPENSSL_THREADS
57# define OPENSSL_THREADS
58#endif
59#ifndef OPENSSL_NO_DYNAMIC_ENGINE
60# define OPENSSL_NO_DYNAMIC_ENGINE
61#endif
62
63/* The OPENSSL_NO_* macros are also defined as NO_* if the application
64 asks for it. This is a transient feature that is provided for those
65 who haven't had the time to do the appropriate changes in their
66 applications. */
67#ifdef OPENSSL_ALGORITHM_DEFINES
68# if defined(OPENSSL_NO_CAMELLIA) && !defined(NO_CAMELLIA)
69# define NO_CAMELLIA
70# endif
71# if defined(OPENSSL_NO_EC_NISTP_64_GCC_128) && !defined(NO_EC_NISTP_64_GCC_128)
72# define NO_EC_NISTP_64_GCC_128
73# endif
74# if defined(OPENSSL_NO_CMS) && !defined(NO_CMS)
75# define NO_CMS
76# endif
77# if defined(OPENSSL_NO_GMP) && !defined(NO_GMP)
78# define NO_GMP
79# endif
80# if defined(OPENSSL_NO_GOST) && !defined(NO_GOST)
81# define NO_GOST
82# endif
83# if defined(OPENSSL_NO_JPAKE) && !defined(NO_JPAKE)
84# define NO_JPAKE
85# endif
86# if defined(OPENSSL_NO_KRB5) && !defined(NO_KRB5)
87# define NO_KRB5
88# endif
89# if defined(OPENSSL_NO_MD2) && !defined(NO_MD2)
90# define NO_MD2
91# endif
92# if defined(OPENSSL_NO_RC5) && !defined(NO_RC5)
93# define NO_RC5
94# endif
95# if defined(OPENSSL_NO_RFC3779) && !defined(NO_RFC3779)
96# define NO_RFC3779
97# endif
98# if defined(OPENSSL_NO_SCTP) && !defined(NO_SCTP)
99# define NO_SCTP
100# endif
101# if defined(OPENSSL_NO_SEED) && !defined(NO_SEED)
102# define NO_SEED
103# endif
104# if defined(OPENSSL_NO_SRP) && !defined(NO_SRP)
105# define NO_SRP
106# endif
107# if defined(OPENSSL_NO_SSL2) && !defined(NO_SSL2)
108# define NO_SSL2
109# endif
110# if defined(OPENSSL_NO_STORE) && !defined(NO_STORE)
111# define NO_STORE
112# endif
113#endif
114
115/* crypto/opensslconf.h.in */
116
117/* Generate 80386 code? */
118#undef I386_ONLY
119
120#if !(defined(VMS) || defined(__VMS)) /* VMS uses logical names instead */
121#if defined(HEADER_CRYPTLIB_H) && !defined(OPENSSLDIR)
122#define ENGINESDIR "/usr/lib/engines"
123#define OPENSSLDIR "/etc/ssl"
124#endif
125#endif
126
127#undef OPENSSL_UNISTD
128#define OPENSSL_UNISTD <unistd.h>
129
130#undef OPENSSL_EXPORT_VAR_AS_FUNCTION
131
132#if defined(HEADER_IDEA_H) && !defined(IDEA_INT)
133#define IDEA_INT unsigned int
134#endif
135
136#if defined(HEADER_MD2_H) && !defined(MD2_INT)
137#define MD2_INT unsigned int
138#endif
139
140#if defined(HEADER_RC2_H) && !defined(RC2_INT)
141/* I need to put in a mod for the alpha - eay */
142#define RC2_INT unsigned int
143#endif
144
145#if defined(HEADER_RC4_H)
146#if !defined(RC4_INT)
147/* using int types make the structure larger but make the code faster
148 * on most boxes I have tested - up to %20 faster. */
149/*
150 * I don't know what does "most" mean, but declaring "int" is a must on:
151 * - Intel P6 because partial register stalls are very expensive;
152 * - elder Alpha because it lacks byte load/store instructions;
153 */
154#define RC4_INT unsigned int
155#endif
156#if !defined(RC4_CHUNK)
157/*
158 * This enables code handling data aligned at natural CPU word
159 * boundary. See crypto/rc4/rc4_enc.c for further details.
160 */
161#undef RC4_CHUNK
162#endif
163#endif
164
165#if (defined(HEADER_NEW_DES_H) || defined(HEADER_DES_H)) && !defined(DES_LONG)
166/* If this is set to 'unsigned int' on a DEC Alpha, this gives about a
167 * %20 speed up (longs are 8 bytes, int's are 4). */
168#ifndef DES_LONG
169#define DES_LONG unsigned int
170#endif
171#endif
172
173#if defined(HEADER_BN_H) && !defined(CONFIG_HEADER_BN_H)
174#define CONFIG_HEADER_BN_H
175#define BN_LLONG
176
177/* Should we define BN_DIV2W here? */
178
179/* Only one for the following should be defined */
180/* The prime number generation stuff may not work when
181 * EIGHT_BIT but I don't care since I've only used this mode
182 * for debuging the bignum libraries */
183#undef SIXTY_FOUR_BIT_LONG
184#undef SIXTY_FOUR_BIT
185#define THIRTY_TWO_BIT
186#undef SIXTEEN_BIT
187#undef EIGHT_BIT
188#endif
189
190#if defined(HEADER_RC4_LOCL_H) && !defined(CONFIG_HEADER_RC4_LOCL_H)
191#define CONFIG_HEADER_RC4_LOCL_H
192/* if this is defined data[i] is used instead of *data, this is a %20
193 * speedup on x86 */
194#define RC4_INDEX
195#endif
196
197#if defined(HEADER_BF_LOCL_H) && !defined(CONFIG_HEADER_BF_LOCL_H)
198#define CONFIG_HEADER_BF_LOCL_H
199#undef BF_PTR
200#endif /* HEADER_BF_LOCL_H */
201
202#if defined(HEADER_DES_LOCL_H) && !defined(CONFIG_HEADER_DES_LOCL_H)
203#define CONFIG_HEADER_DES_LOCL_H
204#ifndef DES_DEFAULT_OPTIONS
205/* the following is tweaked from a config script, that is why it is a
206 * protected undef/define */
207#ifndef DES_PTR
208#undef DES_PTR
209#endif
210
211/* This helps C compiler generate the correct code for multiple functional
212 * units. It reduces register dependancies at the expense of 2 more
213 * registers */
214#ifndef DES_RISC1
215#undef DES_RISC1
216#endif
217
218#ifndef DES_RISC2
219#undef DES_RISC2
220#endif
221
222#if defined(DES_RISC1) && defined(DES_RISC2)
223YOU SHOULD NOT HAVE BOTH DES_RISC1 AND DES_RISC2 DEFINED!!!!!
224#endif
225
226/* Unroll the inner loop, this sometimes helps, sometimes hinders.
227 * Very mucy CPU dependant */
228#ifndef DES_UNROLL
229#define DES_UNROLL
230#endif
231
232/* These default values were supplied by
233 * Peter Gutman <pgut001@cs.auckland.ac.nz>
234 * They are only used if nothing else has been defined */
235#if !defined(DES_PTR) && !defined(DES_RISC1) && !defined(DES_RISC2) && !defined(DES_UNROLL)
236/* Special defines which change the way the code is built depending on the
237 CPU and OS. For SGI machines you can use _MIPS_SZLONG (32 or 64) to find
238 even newer MIPS CPU's, but at the moment one size fits all for
239 optimization options. Older Sparc's work better with only UNROLL, but
240 there's no way to tell at compile time what it is you're running on */
241
242#if defined( sun ) /* Newer Sparc's */
243# define DES_PTR
244# define DES_RISC1
245# define DES_UNROLL
246#elif defined( __ultrix ) /* Older MIPS */
247# define DES_PTR
248# define DES_RISC2
249# define DES_UNROLL
250#elif defined( __osf1__ ) /* Alpha */
251# define DES_PTR
252# define DES_RISC2
253#elif defined ( _AIX ) /* RS6000 */
254 /* Unknown */
255#elif defined( __hpux ) /* HP-PA */
256 /* Unknown */
257#elif defined( __aux ) /* 68K */
258 /* Unknown */
259#elif defined( __dgux ) /* 88K (but P6 in latest boxes) */
260# define DES_UNROLL
261#elif defined( __sgi ) /* Newer MIPS */
262# define DES_PTR
263# define DES_RISC2
264# define DES_UNROLL
265#elif defined(i386) || defined(__i386__) /* x86 boxes, should be gcc */
266# define DES_PTR
267# define DES_RISC1
268# define DES_UNROLL
269#endif /* Systems-specific speed defines */
270#endif
271
272#endif /* DES_DEFAULT_OPTIONS */
273#endif /* HEADER_DES_LOCL_H */
diff --git a/src/lib/libcrypto/arch/sparc64/opensslconf.h b/src/lib/libcrypto/arch/sparc64/opensslconf.h
new file mode 100644
index 0000000000..e55282fd63
--- /dev/null
+++ b/src/lib/libcrypto/arch/sparc64/opensslconf.h
@@ -0,0 +1,273 @@
1/* opensslconf.h */
2/* WARNING: Generated automatically from opensslconf.h.in by Configure. */
3
4/* OpenSSL was configured with the following options: */
5#ifndef OPENSSL_DOING_MAKEDEPEND
6
7
8#ifndef OPENSSL_NO_CAMELLIA
9# define OPENSSL_NO_CAMELLIA
10#endif
11#ifndef OPENSSL_NO_EC_NISTP_64_GCC_128
12# define OPENSSL_NO_EC_NISTP_64_GCC_128
13#endif
14#ifndef OPENSSL_NO_CMS
15# define OPENSSL_NO_CMS
16#endif
17#ifndef OPENSSL_NO_GMP
18# define OPENSSL_NO_GMP
19#endif
20#ifndef OPENSSL_NO_GOST
21# define OPENSSL_NO_GOST
22#endif
23#ifndef OPENSSL_NO_JPAKE
24# define OPENSSL_NO_JPAKE
25#endif
26#ifndef OPENSSL_NO_KRB5
27# define OPENSSL_NO_KRB5
28#endif
29#ifndef OPENSSL_NO_MD2
30# define OPENSSL_NO_MD2
31#endif
32#ifndef OPENSSL_NO_RC5
33# define OPENSSL_NO_RC5
34#endif
35#ifndef OPENSSL_NO_RFC3779
36# define OPENSSL_NO_RFC3779
37#endif
38#ifndef OPENSSL_NO_SCTP
39# define OPENSSL_NO_SCTP
40#endif
41#ifndef OPENSSL_NO_SEED
42# define OPENSSL_NO_SEED
43#endif
44#ifndef OPENSSL_NO_SRP
45# define OPENSSL_NO_SRP
46#endif
47#ifndef OPENSSL_NO_SSL2
48# define OPENSSL_NO_SSL2
49#endif
50#ifndef OPENSSL_NO_STORE
51# define OPENSSL_NO_STORE
52#endif
53
54#endif /* OPENSSL_DOING_MAKEDEPEND */
55
56#ifndef OPENSSL_THREADS
57# define OPENSSL_THREADS
58#endif
59#ifndef OPENSSL_NO_DYNAMIC_ENGINE
60# define OPENSSL_NO_DYNAMIC_ENGINE
61#endif
62
63/* The OPENSSL_NO_* macros are also defined as NO_* if the application
64 asks for it. This is a transient feature that is provided for those
65 who haven't had the time to do the appropriate changes in their
66 applications. */
67#ifdef OPENSSL_ALGORITHM_DEFINES
68# if defined(OPENSSL_NO_CAMELLIA) && !defined(NO_CAMELLIA)
69# define NO_CAMELLIA
70# endif
71# if defined(OPENSSL_NO_EC_NISTP_64_GCC_128) && !defined(NO_EC_NISTP_64_GCC_128)
72# define NO_EC_NISTP_64_GCC_128
73# endif
74# if defined(OPENSSL_NO_CMS) && !defined(NO_CMS)
75# define NO_CMS
76# endif
77# if defined(OPENSSL_NO_GMP) && !defined(NO_GMP)
78# define NO_GMP
79# endif
80# if defined(OPENSSL_NO_GOST) && !defined(NO_GOST)
81# define NO_GOST
82# endif
83# if defined(OPENSSL_NO_JPAKE) && !defined(NO_JPAKE)
84# define NO_JPAKE
85# endif
86# if defined(OPENSSL_NO_KRB5) && !defined(NO_KRB5)
87# define NO_KRB5
88# endif
89# if defined(OPENSSL_NO_MD2) && !defined(NO_MD2)
90# define NO_MD2
91# endif
92# if defined(OPENSSL_NO_RC5) && !defined(NO_RC5)
93# define NO_RC5
94# endif
95# if defined(OPENSSL_NO_RFC3779) && !defined(NO_RFC3779)
96# define NO_RFC3779
97# endif
98# if defined(OPENSSL_NO_SCTP) && !defined(NO_SCTP)
99# define NO_SCTP
100# endif
101# if defined(OPENSSL_NO_SEED) && !defined(NO_SEED)
102# define NO_SEED
103# endif
104# if defined(OPENSSL_NO_SRP) && !defined(NO_SRP)
105# define NO_SRP
106# endif
107# if defined(OPENSSL_NO_SSL2) && !defined(NO_SSL2)
108# define NO_SSL2
109# endif
110# if defined(OPENSSL_NO_STORE) && !defined(NO_STORE)
111# define NO_STORE
112# endif
113#endif
114
115/* crypto/opensslconf.h.in */
116
117/* Generate 80386 code? */
118#undef I386_ONLY
119
120#if !(defined(VMS) || defined(__VMS)) /* VMS uses logical names instead */
121#if defined(HEADER_CRYPTLIB_H) && !defined(OPENSSLDIR)
122#define ENGINESDIR "/usr/lib/engines"
123#define OPENSSLDIR "/etc/ssl"
124#endif
125#endif
126
127#undef OPENSSL_UNISTD
128#define OPENSSL_UNISTD <unistd.h>
129
130#undef OPENSSL_EXPORT_VAR_AS_FUNCTION
131
132#if defined(HEADER_IDEA_H) && !defined(IDEA_INT)
133#define IDEA_INT unsigned int
134#endif
135
136#if defined(HEADER_MD2_H) && !defined(MD2_INT)
137#define MD2_INT unsigned int
138#endif
139
140#if defined(HEADER_RC2_H) && !defined(RC2_INT)
141/* I need to put in a mod for the alpha - eay */
142#define RC2_INT unsigned int
143#endif
144
145#if defined(HEADER_RC4_H)
146#if !defined(RC4_INT)
147/* using int types make the structure larger but make the code faster
148 * on most boxes I have tested - up to %20 faster. */
149/*
150 * I don't know what does "most" mean, but declaring "int" is a must on:
151 * - Intel P6 because partial register stalls are very expensive;
152 * - elder Alpha because it lacks byte load/store instructions;
153 */
154#define RC4_INT unsigned int
155#endif
156#if !defined(RC4_CHUNK)
157/*
158 * This enables code handling data aligned at natural CPU word
159 * boundary. See crypto/rc4/rc4_enc.c for further details.
160 */
161#define RC4_CHUNK unsigned long
162#endif
163#endif
164
165#if (defined(HEADER_NEW_DES_H) || defined(HEADER_DES_H)) && !defined(DES_LONG)
166/* If this is set to 'unsigned int' on a DEC Alpha, this gives about a
167 * %20 speed up (longs are 8 bytes, int's are 4). */
168#ifndef DES_LONG
169#define DES_LONG unsigned int
170#endif
171#endif
172
173#if defined(HEADER_BN_H) && !defined(CONFIG_HEADER_BN_H)
174#define CONFIG_HEADER_BN_H
175#undef BN_LLONG
176
177/* Should we define BN_DIV2W here? */
178
179/* Only one for the following should be defined */
180/* The prime number generation stuff may not work when
181 * EIGHT_BIT but I don't care since I've only used this mode
182 * for debuging the bignum libraries */
183#define SIXTY_FOUR_BIT_LONG
184#undef SIXTY_FOUR_BIT
185#undef THIRTY_TWO_BIT
186#undef SIXTEEN_BIT
187#undef EIGHT_BIT
188#endif
189
190#if defined(HEADER_RC4_LOCL_H) && !defined(CONFIG_HEADER_RC4_LOCL_H)
191#define CONFIG_HEADER_RC4_LOCL_H
192/* if this is defined data[i] is used instead of *data, this is a %20
193 * speedup on x86 */
194#undef RC4_INDEX
195#endif
196
197#if defined(HEADER_BF_LOCL_H) && !defined(CONFIG_HEADER_BF_LOCL_H)
198#define CONFIG_HEADER_BF_LOCL_H
199#define BF_PTR
200#endif /* HEADER_BF_LOCL_H */
201
202#if defined(HEADER_DES_LOCL_H) && !defined(CONFIG_HEADER_DES_LOCL_H)
203#define CONFIG_HEADER_DES_LOCL_H
204#ifndef DES_DEFAULT_OPTIONS
205/* the following is tweaked from a config script, that is why it is a
206 * protected undef/define */
207#ifndef DES_PTR
208#define DES_PTR
209#endif
210
211/* This helps C compiler generate the correct code for multiple functional
212 * units. It reduces register dependancies at the expense of 2 more
213 * registers */
214#ifndef DES_RISC1
215#undef DES_RISC1
216#endif
217
218#ifndef DES_RISC2
219#define DES_RISC2
220#endif
221
222#if defined(DES_RISC1) && defined(DES_RISC2)
223YOU SHOULD NOT HAVE BOTH DES_RISC1 AND DES_RISC2 DEFINED!!!!!
224#endif
225
226/* Unroll the inner loop, this sometimes helps, sometimes hinders.
227 * Very mucy CPU dependant */
228#ifndef DES_UNROLL
229#undef DES_UNROLL
230#endif
231
232/* These default values were supplied by
233 * Peter Gutman <pgut001@cs.auckland.ac.nz>
234 * They are only used if nothing else has been defined */
235#if !defined(DES_PTR) && !defined(DES_RISC1) && !defined(DES_RISC2) && !defined(DES_UNROLL)
236/* Special defines which change the way the code is built depending on the
237 CPU and OS. For SGI machines you can use _MIPS_SZLONG (32 or 64) to find
238 even newer MIPS CPU's, but at the moment one size fits all for
239 optimization options. Older Sparc's work better with only UNROLL, but
240 there's no way to tell at compile time what it is you're running on */
241
242#if defined( sun ) /* Newer Sparc's */
243# define DES_PTR
244# define DES_RISC1
245# define DES_UNROLL
246#elif defined( __ultrix ) /* Older MIPS */
247# define DES_PTR
248# define DES_RISC2
249# define DES_UNROLL
250#elif defined( __osf1__ ) /* Alpha */
251# define DES_PTR
252# define DES_RISC2
253#elif defined ( _AIX ) /* RS6000 */
254 /* Unknown */
255#elif defined( __hpux ) /* HP-PA */
256 /* Unknown */
257#elif defined( __aux ) /* 68K */
258 /* Unknown */
259#elif defined( __dgux ) /* 88K (but P6 in latest boxes) */
260# define DES_UNROLL
261#elif defined( __sgi ) /* Newer MIPS */
262# define DES_PTR
263# define DES_RISC2
264# define DES_UNROLL
265#elif defined(i386) || defined(__i386__) /* x86 boxes, should be gcc */
266# define DES_PTR
267# define DES_RISC1
268# define DES_UNROLL
269#endif /* Systems-specific speed defines */
270#endif
271
272#endif /* DES_DEFAULT_OPTIONS */
273#endif /* HEADER_DES_LOCL_H */
diff --git a/src/lib/libcrypto/arch/vax/bn_asm_vax.S b/src/lib/libcrypto/arch/vax/bn_asm_vax.S
new file mode 100644
index 0000000000..2969ae9dac
--- /dev/null
+++ b/src/lib/libcrypto/arch/vax/bn_asm_vax.S
@@ -0,0 +1,436 @@
1# $OpenBSD: bn_asm_vax.S,v 1.1 2014/04/11 22:51:53 miod Exp $
2# $NetBSD: bn_asm_vax.S,v 1.1 2003/11/03 10:22:28 ragge Exp $
3
4#include <machine/asm.h>
5
6# w.j.m. 15-jan-1999
7#
8# it's magic ...
9#
10# ULONG bn_mul_add_words(ULONG r[],ULONG a[],int n,ULONG w) {
11# ULONG c = 0;
12# int i;
13# for(i = 0; i < n; i++) <c,r[i]> := r[i] + c + a[i] * w ;
14# return c;
15# }
16
17ENTRY(bn_mul_add_words,R6)
18 movl 4(%ap),%r2 # *r
19 movl 8(%ap),%r3 # *a
20 movl 12(%ap),%r4 # n
21 movl 16(%ap),%r5 # w
22 clrl %r6 # return value ("carry")
23
240: emul %r5,(%r3),(%r2),%r0 # w * a[0] + r[0] -> r0
25
26 # fixup for "negative" r[]
27 tstl (%r2)
28 bgeq 1f
29 incl %r1 # add 1 to highword
30
311: # add saved carry to result
32 addl2 %r6,%r0
33 adwc $0,%r1
34
35 # combined fixup for "negative" w, a[]
36 tstl %r5 # if w is negative...
37 bgeq 1f
38 addl2 (%r3),%r1 # ...add a[0] again to highword
391: tstl (%r3) # if a[0] is negative...
40 bgeq 1f
41 addl2 %r5,%r1 # ...add w again to highword
421:
43 movl %r0,(%r2)+ # save low word in dest & advance *r
44 addl2 $4,%r3 # advance *a
45 movl %r1,%r6 # high word in r6 for return value
46
47 sobgtr %r4,0b # loop?
48
49 movl %r6,%r0
50 ret
51
52# .title vax_bn_mul_words unsigned multiply & add, 32*32+32=>64
53#;
54#; w.j.m. 15-jan-1999
55#;
56#; it's magic ...
57#;
58#; ULONG bn_mul_words(ULONG r[],ULONG a[],int n,ULONG w) {
59#; ULONG c = 0;
60#; int i;
61#; for(i = 0; i < num; i++) <c,r[i]> := a[i] * w + c ;
62#; return(c);
63#; }
64#
65
66ENTRY(bn_mul_words,R6)
67 movl 4(%ap),%r2 # *r
68 movl 8(%ap),%r3 # *a
69 movl 12(%ap),%r4 # n
70 movl 16(%ap),%r5 # w
71 clrl %r6 # carry
72
730: emul %r5,(%r3),%r6,%r0 # w * a[0] + carry -> r0
74
75 # fixup for "negative" carry
76 tstl %r6
77 bgeq 1f
78 incl %r1
79
801: # combined fixup for "negative" w, a[]
81 tstl %r5
82 bgeq 1f
83 addl2 (%r3),%r1
841: tstl (%r3)
85 bgeq 1f
86 addl2 %r5,%r1
87
881: movl %r0,(%r2)+
89 addl2 $4,%r3
90 movl %r1,%r6
91
92 sobgtr %r4,0b
93
94 movl %r6,%r0
95 ret
96
97
98
99# .title vax_bn_sqr_words unsigned square, 32*32=>64
100#;
101#; w.j.m. 15-jan-1999
102#;
103#; it's magic ...
104#;
105#; void bn_sqr_words(ULONG r[],ULONG a[],int n) {
106#; int i;
107#; for(i = 0; i < n; i++) <r[2*i+1],r[2*i]> := a[i] * a[i] ;
108#; }
109#
110
111ENTRY(bn_sqr_words,0)
112 movl 4(%ap),%r2 # r
113 movl 8(%ap),%r3 # a
114 movl 12(%ap),%r4 # n
115
1160: movl (%r3)+,%r5 # r5 = a[] & advance
117
118 emul %r5,%r5,$0,%r0 # a[0] * a[0] + 0 -> r0
119
120 # fixup for "negative" a[]
121 tstl %r5
122 bgeq 1f
123 addl2 %r5,%r1
124 addl2 %r5,%r1
125
1261: movq %r0,(%r2)+ # store 64-bit result
127
128 sobgtr %r4,0b # loop
129
130 ret
131
132
133# .title vax_bn_div_words unsigned divide
134#;
135#; Richard Levitte 20-Nov-2000
136#;
137#; ULONG bn_div_words(ULONG h, ULONG l, ULONG d)
138#; {
139#; return ((ULONG)((((ULLONG)h)<<32)|l) / (ULLONG)d);
140#; }
141#;
142#; Using EDIV would be very easy, if it didn't do signed calculations.
143#; Any time any of the input numbers are signed, there are problems,
144#; usually with integer overflow, at which point it returns useless
145#; data (the quotient gets the value of l, and the remainder becomes 0).
146#;
147#; If it was just for the dividend, it would be very easy, just divide
148#; it by 2 (unsigned), do the division, multiply the resulting quotient
149#; and remainder by 2, add the bit that was dropped when dividing by 2
150#; to the remainder, and do some adjustment so the remainder doesn't
151#; end up larger than the divisor. For some cases when the divisor is
152#; negative (from EDIV's point of view, i.e. when the highest bit is set),
153#; dividing the dividend by 2 isn't enough, and since some operations
154#; might generate integer overflows even when the dividend is divided by
155#; 4 (when the high part of the shifted down dividend ends up being exactly
156#; half of the divisor, the result is the quotient 0x80000000, which is
157#; negative...) it needs to be divided by 8. Furthermore, the divisor needs
158#; to be divided by 2 (unsigned) as well, to avoid more problems with the sign.
159#; In this case, a little extra fiddling with the remainder is required.
160#;
161#; So, the simplest way to handle this is always to divide the dividend
162#; by 8, and to divide the divisor by 2 if it's highest bit is set.
163#; After EDIV has been used, the quotient gets multiplied by 8 if the
164#; original divisor was positive, otherwise 4. The remainder, oddly
165#; enough, is *always* multiplied by 8.
166#; NOTE: in the case mentioned above, where the high part of the shifted
167#; down dividend ends up being exactly half the shifted down divisor, we
168#; end up with a 33 bit quotient. That's no problem however, it usually
169#; means we have ended up with a too large remainder as well, and the
170#; problem is fixed by the last part of the algorithm (next paragraph).
171#;
172#; The routine ends with comparing the resulting remainder with the
173#; original divisor and if the remainder is larger, subtract the
174#; original divisor from it, and increase the quotient by 1. This is
175#; done until the remainder is smaller than the divisor.
176#;
177#; The complete algorithm looks like this:
178#;
179#; d' = d
180#; l' = l & 7
181#; [h,l] = [h,l] >> 3
182#; [q,r] = floor([h,l] / d) # This is the EDIV operation
183#; if (q < 0) q = -q # I doubt this is necessary any more
184#;
185#; r' = r >> 29
186#; if (d' >= 0)
187#; q' = q >> 29
188#; q = q << 3
189#; else
190#; q' = q >> 30
191#; q = q << 2
192#; r = (r << 3) + l'
193#;
194#; if (d' < 0)
195#; {
196#; [r',r] = [r',r] - q
197#; while ([r',r] < 0)
198#; {
199#; [r',r] = [r',r] + d
200#; [q',q] = [q',q] - 1
201#; }
202#; }
203#;
204#; while ([r',r] >= d')
205#; {
206#; [r',r] = [r',r] - d'
207#; [q',q] = [q',q] + 1
208#; }
209#;
210#; return q
211#
212#;r2 = l, q
213#;r3 = h, r
214#;r4 = d
215#;r5 = l'
216#;r6 = r'
217#;r7 = d'
218#;r8 = q'
219#
220
221ENTRY(bn_div_words,R6|R7|R8)
222 movl 4(%ap),%r3 # h
223 movl 8(%ap),%r2 # l
224 movl 12(%ap),%r4 # d
225
226 bicl3 $-8,%r2,%r5 # l' = l & 7
227 bicl3 $7,%r2,%r2
228
229 bicl3 $-8,%r3,%r6
230 bicl3 $7,%r3,%r3
231
232 addl2 %r6,%r2
233
234 rotl $-3,%r2,%r2 # l = l >> 3
235 rotl $-3,%r3,%r3 # h = h >> 3
236
237 movl %r4,%r7 # d' = d
238
239 clrl %r6 # r' = 0
240 clrl %r8 # q' = 0
241
242 tstl %r4
243 beql 0f # Uh-oh, the divisor is 0...
244 bgtr 1f
245 rotl $-1,%r4,%r4 # If d is negative, shift it right.
246 bicl2 $0x80000000,%r4 # Since d is then a large number, the
247 # lowest bit is insignificant
248 # (contradict that, and I'll fix the problem!)
2491:
250 ediv %r4,%r2,%r2,%r3 # Do the actual division
251
252 tstl %r2
253 bgeq 1f
254 mnegl %r2,%r2 # if q < 0, negate it
2551:
256 tstl %r7
257 blss 1f
258 rotl $3,%r2,%r2 # q = q << 3
259 bicl3 $-8,%r2,%r8 # q' gets the high bits from q
260 bicl3 $7,%r2,%r2
261 brb 2f
262
2631: # else
264 rotl $2,%r2,%r2 # q = q << 2
265 bicl3 $-4,%r2,%r8 # q' gets the high bits from q
266 bicl3 $3,%r2,%r2
2672:
268 rotl $3,%r3,%r3 # r = r << 3
269 bicl3 $-8,%r3,%r6 # r' gets the high bits from r
270 bicl3 $7,%r3,%r3
271 addl2 %r5,%r3 # r = r + l'
272
273 tstl %r7
274 bgeq 5f
275 bitl $1,%r7
276 beql 5f # if d' < 0 && d' & 1
277 subl2 %r2,%r3 # [r',r] = [r',r] - [q',q]
278 sbwc %r8,%r6
2793:
280 bgeq 5f # while r < 0
281 decl %r2 # [q',q] = [q',q] - 1
282 sbwc $0,%r8
283 addl2 %r7,%r3 # [r',r] = [r',r] + d'
284 adwc $0,%r6
285 brb 3b
286
287# The return points are placed in the middle to keep a short distance from
288# all the branch points
2891:
290# movl %r3,%r1
291 movl %r2,%r0
292 ret
2930:
294 movl $-1,%r0
295 ret
2965:
297 tstl %r6
298 bneq 6f
299 cmpl %r3,%r7
300 blssu 1b # while [r',r] >= d'
3016:
302 subl2 %r7,%r3 # [r',r] = [r',r] - d'
303 sbwc $0,%r6
304 incl %r2 # [q',q] = [q',q] + 1
305 adwc $0,%r8
306 brb 5b
307
308
309
310# .title vax_bn_add_words unsigned add of two arrays
311#;
312#; Richard Levitte 20-Nov-2000
313#;
314#; ULONG bn_add_words(ULONG r[], ULONG a[], ULONG b[], int n) {
315#; ULONG c = 0;
316#; int i;
317#; for (i = 0; i < n; i++) <c,r[i]> = a[i] + b[i] + c;
318#; return(c);
319#; }
320#
321
322ENTRY(bn_add_words,0)
323 movl 4(%ap),%r2 # r
324 movl 8(%ap),%r3 # a
325 movl 12(%ap),%r4 # b
326 movl 16(%ap),%r5 # n
327 clrl %r0
328
329 tstl %r5
330 bleq 1f
331
3320: movl (%r3)+,%r1 # carry untouched
333 adwc (%r4)+,%r1 # carry used and touched
334 movl %r1,(%r2)+ # carry untouched
335 sobgtr %r5,0b # carry untouched
336
337 adwc $0,%r0
3381: ret
339
340#;
341#; Richard Levitte 20-Nov-2000
342#;
343#; ULONG bn_sub_words(ULONG r[], ULONG a[], ULONG b[], int n) {
344#; ULONG c = 0;
345#; int i;
346#; for (i = 0; i < n; i++) <c,r[i]> = a[i] - b[i] - c;
347#; return(c);
348#; }
349#
350
351ENTRY(bn_sub_words,R6)
352 movl 4(%ap),%r2 # r
353 movl 8(%ap),%r3 # a
354 movl 12(%ap),%r4 # b
355 movl 16(%ap),%r5 # n
356 clrl %r0
357
358 tstl %r5
359 bleq 1f
360
3610: movl (%r3)+,%r6 # carry untouched
362 sbwc (%r4)+,%r6 # carry used and touched
363 movl %r6,(%r2)+ # carry untouched
364 sobgtr %r5,0b # carry untouched
365
3661: adwc $0,%r0
367 ret
368
369#
370# Ragge 20-Sep-2003
371#
372# Multiply a vector of 4/8 longword by another.
373# Uses two loops and 16/64 emuls.
374#
375
376ENTRY(bn_mul_comba4,R6|R7|R8|R9)
377 movl $4,%r9 # 4*4
378 brb 6f
379
380ENTRY(bn_mul_comba8,R6|R7|R8|R9)
381 movl $8,%r9 # 8*8
382
3836: movl 8(%ap),%r3 # a[]
384 movl 12(%ap),%r7 # b[]
385 brb 5f
386
387ENTRY(bn_sqr_comba4,R6|R7|R8|R9)
388 movl $4,%r9 # 4*4
389 brb 0f
390
391ENTRY(bn_sqr_comba8,R6|R7|R8|R9)
392 movl $8,%r9 # 8*8
393
3940:
395 movl 8(%ap),%r3 # a[]
396 movl %r3,%r7 # a[]
397
3985: movl 4(%ap),%r5 # r[]
399 movl %r9,%r8
400
401 clrq (%r5) # clear destinatino, for add.
402 clrq 8(%r5)
403 clrq 16(%r5) # these only needed for comba8
404 clrq 24(%r5)
405
4062: clrl %r4 # carry
407 movl %r9,%r6 # inner loop count
408 movl (%r7)+,%r2 # value to multiply with
409
4101: emul %r2,(%r3),%r4,%r0
411 tstl %r4
412 bgeq 3f
413 incl %r1
4143: tstl %r2
415 bgeq 3f
416 addl2 (%r3),%r1
4173: tstl (%r3)
418 bgeq 3f
419 addl2 %r2,%r1
420
4213: addl2 %r0,(%r5)+ # add to destination
422 adwc $0,%r1 # remember carry
423 movl %r1,%r4 # add carry in next emul
424 addl2 $4,%r3
425 sobgtr %r6,1b
426
427 movl %r4,(%r5) # save highest add result
428
429 ashl $2,%r9,%r4
430 subl2 %r4,%r3
431 subl2 $4,%r4
432 subl2 %r4,%r5
433
434 sobgtr %r8,2b
435
436 ret
diff --git a/src/lib/libcrypto/arch/vax/opensslconf.h b/src/lib/libcrypto/arch/vax/opensslconf.h
new file mode 100644
index 0000000000..fc5ea38470
--- /dev/null
+++ b/src/lib/libcrypto/arch/vax/opensslconf.h
@@ -0,0 +1,273 @@
1/* opensslconf.h */
2/* WARNING: Generated automatically from opensslconf.h.in by Configure. */
3
4/* OpenSSL was configured with the following options: */
5#ifndef OPENSSL_DOING_MAKEDEPEND
6
7
8#ifndef OPENSSL_NO_CAMELLIA
9# define OPENSSL_NO_CAMELLIA
10#endif
11#ifndef OPENSSL_NO_EC_NISTP_64_GCC_128
12# define OPENSSL_NO_EC_NISTP_64_GCC_128
13#endif
14#ifndef OPENSSL_NO_CMS
15# define OPENSSL_NO_CMS
16#endif
17#ifndef OPENSSL_NO_GMP
18# define OPENSSL_NO_GMP
19#endif
20#ifndef OPENSSL_NO_GOST
21# define OPENSSL_NO_GOST
22#endif
23#ifndef OPENSSL_NO_JPAKE
24# define OPENSSL_NO_JPAKE
25#endif
26#ifndef OPENSSL_NO_KRB5
27# define OPENSSL_NO_KRB5
28#endif
29#ifndef OPENSSL_NO_MD2
30# define OPENSSL_NO_MD2
31#endif
32#ifndef OPENSSL_NO_RC5
33# define OPENSSL_NO_RC5
34#endif
35#ifndef OPENSSL_NO_RFC3779
36# define OPENSSL_NO_RFC3779
37#endif
38#ifndef OPENSSL_NO_SCTP
39# define OPENSSL_NO_SCTP
40#endif
41#ifndef OPENSSL_NO_SEED
42# define OPENSSL_NO_SEED
43#endif
44#ifndef OPENSSL_NO_SRP
45# define OPENSSL_NO_SRP
46#endif
47#ifndef OPENSSL_NO_SSL2
48# define OPENSSL_NO_SSL2
49#endif
50#ifndef OPENSSL_NO_STORE
51# define OPENSSL_NO_STORE
52#endif
53
54#endif /* OPENSSL_DOING_MAKEDEPEND */
55
56#ifndef OPENSSL_THREADS
57# define OPENSSL_THREADS
58#endif
59#ifndef OPENSSL_NO_DYNAMIC_ENGINE
60# define OPENSSL_NO_DYNAMIC_ENGINE
61#endif
62
63/* The OPENSSL_NO_* macros are also defined as NO_* if the application
64 asks for it. This is a transient feature that is provided for those
65 who haven't had the time to do the appropriate changes in their
66 applications. */
67#ifdef OPENSSL_ALGORITHM_DEFINES
68# if defined(OPENSSL_NO_CAMELLIA) && !defined(NO_CAMELLIA)
69# define NO_CAMELLIA
70# endif
71# if defined(OPENSSL_NO_EC_NISTP_64_GCC_128) && !defined(NO_EC_NISTP_64_GCC_128)
72# define NO_EC_NISTP_64_GCC_128
73# endif
74# if defined(OPENSSL_NO_CMS) && !defined(NO_CMS)
75# define NO_CMS
76# endif
77# if defined(OPENSSL_NO_GMP) && !defined(NO_GMP)
78# define NO_GMP
79# endif
80# if defined(OPENSSL_NO_GOST) && !defined(NO_GOST)
81# define NO_GOST
82# endif
83# if defined(OPENSSL_NO_JPAKE) && !defined(NO_JPAKE)
84# define NO_JPAKE
85# endif
86# if defined(OPENSSL_NO_KRB5) && !defined(NO_KRB5)
87# define NO_KRB5
88# endif
89# if defined(OPENSSL_NO_MD2) && !defined(NO_MD2)
90# define NO_MD2
91# endif
92# if defined(OPENSSL_NO_RC5) && !defined(NO_RC5)
93# define NO_RC5
94# endif
95# if defined(OPENSSL_NO_RFC3779) && !defined(NO_RFC3779)
96# define NO_RFC3779
97# endif
98# if defined(OPENSSL_NO_SCTP) && !defined(NO_SCTP)
99# define NO_SCTP
100# endif
101# if defined(OPENSSL_NO_SEED) && !defined(NO_SEED)
102# define NO_SEED
103# endif
104# if defined(OPENSSL_NO_SRP) && !defined(NO_SRP)
105# define NO_SRP
106# endif
107# if defined(OPENSSL_NO_SSL2) && !defined(NO_SSL2)
108# define NO_SSL2
109# endif
110# if defined(OPENSSL_NO_STORE) && !defined(NO_STORE)
111# define NO_STORE
112# endif
113#endif
114
115/* crypto/opensslconf.h.in */
116
117/* Generate 80386 code? */
118#undef I386_ONLY
119
120#if !(defined(VMS) || defined(__VMS)) /* VMS uses logical names instead */
121#if defined(HEADER_CRYPTLIB_H) && !defined(OPENSSLDIR)
122#define ENGINESDIR "/usr/lib/engines"
123#define OPENSSLDIR "/etc/ssl"
124#endif
125#endif
126
127#undef OPENSSL_UNISTD
128#define OPENSSL_UNISTD <unistd.h>
129
130#undef OPENSSL_EXPORT_VAR_AS_FUNCTION
131
132#if defined(HEADER_IDEA_H) && !defined(IDEA_INT)
133#define IDEA_INT unsigned int
134#endif
135
136#if defined(HEADER_MD2_H) && !defined(MD2_INT)
137#define MD2_INT unsigned int
138#endif
139
140#if defined(HEADER_RC2_H) && !defined(RC2_INT)
141/* I need to put in a mod for the alpha - eay */
142#define RC2_INT unsigned int
143#endif
144
145#if defined(HEADER_RC4_H)
146#if !defined(RC4_INT)
147/* using int types make the structure larger but make the code faster
148 * on most boxes I have tested - up to %20 faster. */
149/*
150 * I don't know what does "most" mean, but declaring "int" is a must on:
151 * - Intel P6 because partial register stalls are very expensive;
152 * - elder Alpha because it lacks byte load/store instructions;
153 */
154#define RC4_INT unsigned int
155#endif
156#if !defined(RC4_CHUNK)
157/*
158 * This enables code handling data aligned at natural CPU word
159 * boundary. See crypto/rc4/rc4_enc.c for further details.
160 */
161#undef RC4_CHUNK
162#endif
163#endif
164
165#if (defined(HEADER_NEW_DES_H) || defined(HEADER_DES_H)) && !defined(DES_LONG)
166/* If this is set to 'unsigned int' on a DEC Alpha, this gives about a
167 * %20 speed up (longs are 8 bytes, int's are 4). */
168#ifndef DES_LONG
169#define DES_LONG unsigned int
170#endif
171#endif
172
173#if defined(HEADER_BN_H) && !defined(CONFIG_HEADER_BN_H)
174#define CONFIG_HEADER_BN_H
175#define BN_LLONG
176
177/* Should we define BN_DIV2W here? */
178
179/* Only one for the following should be defined */
180/* The prime number generation stuff may not work when
181 * EIGHT_BIT but I don't care since I've only used this mode
182 * for debuging the bignum libraries */
183#undef SIXTY_FOUR_BIT_LONG
184#undef SIXTY_FOUR_BIT
185#define THIRTY_TWO_BIT
186#undef SIXTEEN_BIT
187#undef EIGHT_BIT
188#endif
189
190#if defined(HEADER_RC4_LOCL_H) && !defined(CONFIG_HEADER_RC4_LOCL_H)
191#define CONFIG_HEADER_RC4_LOCL_H
192/* if this is defined data[i] is used instead of *data, this is a %20
193 * speedup on x86 */
194#define RC4_INDEX
195#endif
196
197#if defined(HEADER_BF_LOCL_H) && !defined(CONFIG_HEADER_BF_LOCL_H)
198#define CONFIG_HEADER_BF_LOCL_H
199#undef BF_PTR
200#endif /* HEADER_BF_LOCL_H */
201
202#if defined(HEADER_DES_LOCL_H) && !defined(CONFIG_HEADER_DES_LOCL_H)
203#define CONFIG_HEADER_DES_LOCL_H
204#ifndef DES_DEFAULT_OPTIONS
205/* the following is tweaked from a config script, that is why it is a
206 * protected undef/define */
207#ifndef DES_PTR
208#undef DES_PTR
209#endif
210
211/* This helps C compiler generate the correct code for multiple functional
212 * units. It reduces register dependancies at the expense of 2 more
213 * registers */
214#ifndef DES_RISC1
215#undef DES_RISC1
216#endif
217
218#ifndef DES_RISC2
219#undef DES_RISC2
220#endif
221
222#if defined(DES_RISC1) && defined(DES_RISC2)
223YOU SHOULD NOT HAVE BOTH DES_RISC1 AND DES_RISC2 DEFINED!!!!!
224#endif
225
226/* Unroll the inner loop, this sometimes helps, sometimes hinders.
227 * Very mucy CPU dependant */
228#ifndef DES_UNROLL
229#define DES_UNROLL
230#endif
231
232/* These default values were supplied by
233 * Peter Gutman <pgut001@cs.auckland.ac.nz>
234 * They are only used if nothing else has been defined */
235#if !defined(DES_PTR) && !defined(DES_RISC1) && !defined(DES_RISC2) && !defined(DES_UNROLL)
236/* Special defines which change the way the code is built depending on the
237 CPU and OS. For SGI machines you can use _MIPS_SZLONG (32 or 64) to find
238 even newer MIPS CPU's, but at the moment one size fits all for
239 optimization options. Older Sparc's work better with only UNROLL, but
240 there's no way to tell at compile time what it is you're running on */
241
242#if defined( sun ) /* Newer Sparc's */
243# define DES_PTR
244# define DES_RISC1
245# define DES_UNROLL
246#elif defined( __ultrix ) /* Older MIPS */
247# define DES_PTR
248# define DES_RISC2
249# define DES_UNROLL
250#elif defined( __osf1__ ) /* Alpha */
251# define DES_PTR
252# define DES_RISC2
253#elif defined ( _AIX ) /* RS6000 */
254 /* Unknown */
255#elif defined( __hpux ) /* HP-PA */
256 /* Unknown */
257#elif defined( __aux ) /* 68K */
258 /* Unknown */
259#elif defined( __dgux ) /* 88K (but P6 in latest boxes) */
260# define DES_UNROLL
261#elif defined( __sgi ) /* Newer MIPS */
262# define DES_PTR
263# define DES_RISC2
264# define DES_UNROLL
265#elif defined(i386) || defined(__i386__) /* x86 boxes, should be gcc */
266# define DES_PTR
267# define DES_RISC1
268# define DES_UNROLL
269#endif /* Systems-specific speed defines */
270#endif
271
272#endif /* DES_DEFAULT_OPTIONS */
273#endif /* HEADER_DES_LOCL_H */
diff --git a/src/lib/libcrypto/asn1/Makefile b/src/lib/libcrypto/asn1/Makefile
new file mode 100644
index 0000000000..f7787005d4
--- /dev/null
+++ b/src/lib/libcrypto/asn1/Makefile
@@ -0,0 +1,930 @@
1#
2# OpenSSL/crypto/asn1/Makefile
3#
4
5DIR= asn1
6TOP= ../..
7CC= cc
8INCLUDES= -I.. -I$(TOP) -I../../include
9CFLAG=-g
10MAKEFILE= Makefile
11AR= ar r
12
13CFLAGS= $(INCLUDES) $(CFLAG)
14
15GENERAL=Makefile README
16TEST=
17APPS=
18
19LIB=$(TOP)/libcrypto.a
20LIBSRC= a_object.c a_bitstr.c a_utctm.c a_gentm.c a_time.c a_int.c a_octet.c \
21 a_print.c a_type.c a_set.c a_dup.c a_d2i_fp.c a_i2d_fp.c \
22 a_enum.c a_utf8.c a_sign.c a_digest.c a_verify.c a_mbstr.c a_strex.c \
23 x_algor.c x_val.c x_pubkey.c x_sig.c x_req.c x_attrib.c x_bignum.c \
24 x_long.c x_name.c x_x509.c x_x509a.c x_crl.c x_info.c x_spki.c nsseq.c \
25 x_nx509.c d2i_pu.c d2i_pr.c i2d_pu.c i2d_pr.c\
26 t_req.c t_x509.c t_x509a.c t_crl.c t_pkey.c t_spki.c t_bitst.c \
27 tasn_new.c tasn_fre.c tasn_enc.c tasn_dec.c tasn_utl.c tasn_typ.c \
28 tasn_prn.c ameth_lib.c \
29 f_int.c f_string.c n_pkey.c \
30 f_enum.c x_pkey.c a_bool.c x_exten.c bio_asn1.c bio_ndef.c asn_mime.c \
31 asn1_gen.c asn1_par.c asn1_lib.c asn1_err.c a_bytes.c a_strnid.c \
32 evp_asn1.c asn_pack.c p5_pbe.c p5_pbev2.c p8_pkey.c asn_moid.c
33LIBOBJ= a_object.o a_bitstr.o a_utctm.o a_gentm.o a_time.o a_int.o a_octet.o \
34 a_print.o a_type.o a_set.o a_dup.o a_d2i_fp.o a_i2d_fp.o \
35 a_enum.o a_utf8.o a_sign.o a_digest.o a_verify.o a_mbstr.o a_strex.o \
36 x_algor.o x_val.o x_pubkey.o x_sig.o x_req.o x_attrib.o x_bignum.o \
37 x_long.o x_name.o x_x509.o x_x509a.o x_crl.o x_info.o x_spki.o nsseq.o \
38 x_nx509.o d2i_pu.o d2i_pr.o i2d_pu.o i2d_pr.o \
39 t_req.o t_x509.o t_x509a.o t_crl.o t_pkey.o t_spki.o t_bitst.o \
40 tasn_new.o tasn_fre.o tasn_enc.o tasn_dec.o tasn_utl.o tasn_typ.o \
41 tasn_prn.o ameth_lib.o \
42 f_int.o f_string.o n_pkey.o \
43 f_enum.o x_pkey.o a_bool.o x_exten.o bio_asn1.o bio_ndef.o asn_mime.o \
44 asn1_gen.o asn1_par.o asn1_lib.o asn1_err.o a_bytes.o a_strnid.o \
45 evp_asn1.o asn_pack.o p5_pbe.o p5_pbev2.o p8_pkey.o asn_moid.o
46
47SRC= $(LIBSRC)
48
49EXHEADER= asn1.h asn1_mac.h asn1t.h
50HEADER= $(EXHEADER) asn1_locl.h
51
52ALL= $(GENERAL) $(SRC) $(HEADER)
53
54top:
55 (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all)
56
57test: test.c
58 cc -g -I../../include -c test.c
59 cc -g -I../../include -o test test.o -L../.. -lcrypto
60
61pk: pk.c
62 cc -g -I../../include -c pk.c
63 cc -g -I../../include -o pk pk.o -L../.. -lcrypto
64
65all: lib
66
67lib: $(LIBOBJ)
68 $(AR) $(LIB) $(LIBOBJ)
69 $(RANLIB) $(LIB) || echo Never mind.
70 @touch lib
71
72files:
73 $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
74
75links:
76 @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
77 @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
78 @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
79
80install:
81 @[ -n "$(INSTALLTOP)" ] # should be set by top Makefile...
82 @headerlist="$(EXHEADER)"; for i in $$headerlist ; \
83 do \
84 (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
85 chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
86 done;
87
88tags:
89 ctags $(SRC)
90
91tests:
92
93lint:
94 lint -DLINT $(INCLUDES) $(SRC)>fluff
95
96depend:
97 @[ -n "$(MAKEDEPEND)" ] # should be set by top Makefile...
98 $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
99
100dclean:
101 $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
102 mv -f Makefile.new $(MAKEFILE)
103
104clean:
105 rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
106
107
108# DO NOT DELETE THIS LINE -- make depend depends on it.
109
110a_bitstr.o: ../../e_os.h ../../include/openssl/asn1.h
111a_bitstr.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
112a_bitstr.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
113a_bitstr.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
114a_bitstr.o: ../../include/openssl/opensslconf.h
115a_bitstr.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
116a_bitstr.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
117a_bitstr.o: ../../include/openssl/symhacks.h ../cryptlib.h a_bitstr.c
118a_bool.o: ../../e_os.h ../../include/openssl/asn1.h
119a_bool.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
120a_bool.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
121a_bool.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
122a_bool.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
123a_bool.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
124a_bool.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
125a_bool.o: ../../include/openssl/symhacks.h ../cryptlib.h a_bool.c
126a_bytes.o: ../../e_os.h ../../include/openssl/asn1.h
127a_bytes.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
128a_bytes.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
129a_bytes.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
130a_bytes.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
131a_bytes.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
132a_bytes.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
133a_bytes.o: ../cryptlib.h a_bytes.c
134a_d2i_fp.o: ../../e_os.h ../../include/openssl/asn1.h
135a_d2i_fp.o: ../../include/openssl/asn1_mac.h ../../include/openssl/bio.h
136a_d2i_fp.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
137a_d2i_fp.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
138a_d2i_fp.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
139a_d2i_fp.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
140a_d2i_fp.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
141a_d2i_fp.o: ../../include/openssl/symhacks.h ../cryptlib.h a_d2i_fp.c
142a_digest.o: ../../e_os.h ../../include/openssl/asn1.h
143a_digest.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
144a_digest.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
145a_digest.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
146a_digest.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
147a_digest.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
148a_digest.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
149a_digest.o: ../../include/openssl/opensslconf.h
150a_digest.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
151a_digest.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
152a_digest.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
153a_digest.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
154a_digest.o: ../../include/openssl/x509_vfy.h ../cryptlib.h a_digest.c
155a_dup.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
156a_dup.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
157a_dup.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
158a_dup.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
159a_dup.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
160a_dup.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
161a_dup.o: ../../include/openssl/symhacks.h ../cryptlib.h a_dup.c
162a_enum.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
163a_enum.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
164a_enum.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
165a_enum.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
166a_enum.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
167a_enum.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
168a_enum.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
169a_enum.o: ../cryptlib.h a_enum.c
170a_gentm.o: ../../e_os.h ../../include/openssl/asn1.h
171a_gentm.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
172a_gentm.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
173a_gentm.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
174a_gentm.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
175a_gentm.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
176a_gentm.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
177a_gentm.o: ../cryptlib.h ../o_time.h a_gentm.c
178a_i2d_fp.o: ../../e_os.h ../../include/openssl/asn1.h
179a_i2d_fp.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
180a_i2d_fp.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
181a_i2d_fp.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
182a_i2d_fp.o: ../../include/openssl/opensslconf.h
183a_i2d_fp.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
184a_i2d_fp.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
185a_i2d_fp.o: ../../include/openssl/symhacks.h ../cryptlib.h a_i2d_fp.c
186a_int.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
187a_int.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
188a_int.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
189a_int.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
190a_int.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
191a_int.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
192a_int.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
193a_int.o: ../cryptlib.h a_int.c
194a_mbstr.o: ../../e_os.h ../../include/openssl/asn1.h
195a_mbstr.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
196a_mbstr.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
197a_mbstr.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
198a_mbstr.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
199a_mbstr.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
200a_mbstr.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
201a_mbstr.o: ../cryptlib.h a_mbstr.c
202a_object.o: ../../e_os.h ../../include/openssl/asn1.h
203a_object.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
204a_object.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
205a_object.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
206a_object.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
207a_object.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
208a_object.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
209a_object.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
210a_object.o: ../../include/openssl/symhacks.h ../cryptlib.h a_object.c
211a_octet.o: ../../e_os.h ../../include/openssl/asn1.h
212a_octet.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
213a_octet.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
214a_octet.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
215a_octet.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
216a_octet.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
217a_octet.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
218a_octet.o: ../cryptlib.h a_octet.c
219a_print.o: ../../e_os.h ../../include/openssl/asn1.h
220a_print.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
221a_print.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
222a_print.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
223a_print.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
224a_print.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
225a_print.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
226a_print.o: ../cryptlib.h a_print.c
227a_set.o: ../../e_os.h ../../include/openssl/asn1.h
228a_set.o: ../../include/openssl/asn1_mac.h ../../include/openssl/bio.h
229a_set.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
230a_set.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
231a_set.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
232a_set.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
233a_set.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
234a_set.o: ../../include/openssl/symhacks.h ../cryptlib.h a_set.c
235a_sign.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
236a_sign.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
237a_sign.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
238a_sign.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
239a_sign.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
240a_sign.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
241a_sign.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
242a_sign.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
243a_sign.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
244a_sign.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
245a_sign.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
246a_sign.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
247a_sign.o: ../cryptlib.h a_sign.c asn1_locl.h
248a_strex.o: ../../e_os.h ../../include/openssl/asn1.h
249a_strex.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
250a_strex.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
251a_strex.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
252a_strex.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
253a_strex.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
254a_strex.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
255a_strex.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
256a_strex.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
257a_strex.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
258a_strex.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
259a_strex.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
260a_strex.o: ../cryptlib.h a_strex.c charmap.h
261a_strnid.o: ../../e_os.h ../../include/openssl/asn1.h
262a_strnid.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
263a_strnid.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
264a_strnid.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
265a_strnid.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
266a_strnid.o: ../../include/openssl/opensslconf.h
267a_strnid.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
268a_strnid.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
269a_strnid.o: ../../include/openssl/symhacks.h ../cryptlib.h a_strnid.c
270a_time.o: ../../e_os.h ../../include/openssl/asn1.h
271a_time.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
272a_time.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
273a_time.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
274a_time.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
275a_time.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
276a_time.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
277a_time.o: ../../include/openssl/symhacks.h ../cryptlib.h ../o_time.h a_time.c
278a_type.o: ../../e_os.h ../../include/openssl/asn1.h
279a_type.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
280a_type.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
281a_type.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
282a_type.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
283a_type.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
284a_type.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
285a_type.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
286a_type.o: ../../include/openssl/symhacks.h ../cryptlib.h a_type.c
287a_utctm.o: ../../e_os.h ../../include/openssl/asn1.h
288a_utctm.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
289a_utctm.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
290a_utctm.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
291a_utctm.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
292a_utctm.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
293a_utctm.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
294a_utctm.o: ../cryptlib.h ../o_time.h a_utctm.c
295a_utf8.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
296a_utf8.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
297a_utf8.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
298a_utf8.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
299a_utf8.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
300a_utf8.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
301a_utf8.o: ../../include/openssl/symhacks.h ../cryptlib.h a_utf8.c
302a_verify.o: ../../e_os.h ../../include/openssl/asn1.h
303a_verify.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
304a_verify.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
305a_verify.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
306a_verify.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
307a_verify.o: ../../include/openssl/err.h ../../include/openssl/evp.h
308a_verify.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
309a_verify.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
310a_verify.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
311a_verify.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
312a_verify.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
313a_verify.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
314a_verify.o: ../../include/openssl/x509_vfy.h ../cryptlib.h a_verify.c
315a_verify.o: asn1_locl.h
316ameth_lib.o: ../../e_os.h ../../include/openssl/asn1.h
317ameth_lib.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
318ameth_lib.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
319ameth_lib.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
320ameth_lib.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
321ameth_lib.o: ../../include/openssl/engine.h ../../include/openssl/err.h
322ameth_lib.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
323ameth_lib.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
324ameth_lib.o: ../../include/openssl/opensslconf.h
325ameth_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
326ameth_lib.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
327ameth_lib.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
328ameth_lib.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
329ameth_lib.o: ../../include/openssl/x509_vfy.h ../cryptlib.h ameth_lib.c
330ameth_lib.o: asn1_locl.h
331asn1_err.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
332asn1_err.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
333asn1_err.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
334asn1_err.o: ../../include/openssl/opensslconf.h
335asn1_err.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
336asn1_err.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
337asn1_err.o: ../../include/openssl/symhacks.h asn1_err.c
338asn1_gen.o: ../../e_os.h ../../include/openssl/asn1.h
339asn1_gen.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
340asn1_gen.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
341asn1_gen.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
342asn1_gen.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
343asn1_gen.o: ../../include/openssl/err.h ../../include/openssl/evp.h
344asn1_gen.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
345asn1_gen.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
346asn1_gen.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
347asn1_gen.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
348asn1_gen.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
349asn1_gen.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
350asn1_gen.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
351asn1_gen.o: ../cryptlib.h asn1_gen.c
352asn1_lib.o: ../../e_os.h ../../include/openssl/asn1.h
353asn1_lib.o: ../../include/openssl/asn1_mac.h ../../include/openssl/bio.h
354asn1_lib.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
355asn1_lib.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
356asn1_lib.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
357asn1_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
358asn1_lib.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
359asn1_lib.o: ../../include/openssl/symhacks.h ../cryptlib.h asn1_lib.c
360asn1_par.o: ../../e_os.h ../../include/openssl/asn1.h
361asn1_par.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
362asn1_par.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
363asn1_par.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
364asn1_par.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
365asn1_par.o: ../../include/openssl/opensslconf.h
366asn1_par.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
367asn1_par.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
368asn1_par.o: ../../include/openssl/symhacks.h ../cryptlib.h asn1_par.c
369asn_mime.o: ../../e_os.h ../../include/openssl/asn1.h
370asn_mime.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
371asn_mime.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
372asn_mime.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
373asn_mime.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
374asn_mime.o: ../../include/openssl/err.h ../../include/openssl/evp.h
375asn_mime.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
376asn_mime.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
377asn_mime.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
378asn_mime.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h
379asn_mime.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
380asn_mime.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
381asn_mime.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
382asn_mime.o: ../cryptlib.h asn1_locl.h asn_mime.c
383asn_moid.o: ../../e_os.h ../../include/openssl/asn1.h
384asn_moid.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
385asn_moid.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
386asn_moid.o: ../../include/openssl/dso.h ../../include/openssl/e_os2.h
387asn_moid.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
388asn_moid.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
389asn_moid.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
390asn_moid.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
391asn_moid.o: ../../include/openssl/opensslconf.h
392asn_moid.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
393asn_moid.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
394asn_moid.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
395asn_moid.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
396asn_moid.o: ../../include/openssl/x509_vfy.h ../cryptlib.h asn_moid.c
397asn_pack.o: ../../e_os.h ../../include/openssl/asn1.h
398asn_pack.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
399asn_pack.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
400asn_pack.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
401asn_pack.o: ../../include/openssl/opensslconf.h
402asn_pack.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
403asn_pack.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
404asn_pack.o: ../../include/openssl/symhacks.h ../cryptlib.h asn_pack.c
405bio_asn1.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
406bio_asn1.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
407bio_asn1.o: ../../include/openssl/opensslconf.h
408bio_asn1.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
409bio_asn1.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
410bio_asn1.o: ../../include/openssl/symhacks.h bio_asn1.c
411bio_ndef.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h
412bio_ndef.o: ../../include/openssl/bio.h ../../include/openssl/crypto.h
413bio_ndef.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
414bio_ndef.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
415bio_ndef.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
416bio_ndef.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
417bio_ndef.o: ../../include/openssl/symhacks.h bio_ndef.c
418d2i_pr.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
419d2i_pr.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
420d2i_pr.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
421d2i_pr.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
422d2i_pr.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h
423d2i_pr.o: ../../include/openssl/err.h ../../include/openssl/evp.h
424d2i_pr.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
425d2i_pr.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
426d2i_pr.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
427d2i_pr.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
428d2i_pr.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
429d2i_pr.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
430d2i_pr.o: ../../include/openssl/x509_vfy.h ../cryptlib.h asn1_locl.h d2i_pr.c
431d2i_pu.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
432d2i_pu.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
433d2i_pu.o: ../../include/openssl/crypto.h ../../include/openssl/dsa.h
434d2i_pu.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
435d2i_pu.o: ../../include/openssl/err.h ../../include/openssl/evp.h
436d2i_pu.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
437d2i_pu.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
438d2i_pu.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
439d2i_pu.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
440d2i_pu.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
441d2i_pu.o: ../cryptlib.h d2i_pu.c
442evp_asn1.o: ../../e_os.h ../../include/openssl/asn1.h
443evp_asn1.o: ../../include/openssl/asn1_mac.h ../../include/openssl/bio.h
444evp_asn1.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
445evp_asn1.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
446evp_asn1.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
447evp_asn1.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
448evp_asn1.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
449evp_asn1.o: ../../include/openssl/symhacks.h ../cryptlib.h evp_asn1.c
450f_enum.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
451f_enum.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
452f_enum.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
453f_enum.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
454f_enum.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
455f_enum.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
456f_enum.o: ../../include/openssl/symhacks.h ../cryptlib.h f_enum.c
457f_int.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
458f_int.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
459f_int.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
460f_int.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
461f_int.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
462f_int.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
463f_int.o: ../../include/openssl/symhacks.h ../cryptlib.h f_int.c
464f_string.o: ../../e_os.h ../../include/openssl/asn1.h
465f_string.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
466f_string.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
467f_string.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
468f_string.o: ../../include/openssl/opensslconf.h
469f_string.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
470f_string.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
471f_string.o: ../../include/openssl/symhacks.h ../cryptlib.h f_string.c
472i2d_pr.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
473i2d_pr.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
474i2d_pr.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
475i2d_pr.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
476i2d_pr.o: ../../include/openssl/err.h ../../include/openssl/evp.h
477i2d_pr.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
478i2d_pr.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
479i2d_pr.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
480i2d_pr.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
481i2d_pr.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
482i2d_pr.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
483i2d_pr.o: ../../include/openssl/x509_vfy.h ../cryptlib.h asn1_locl.h i2d_pr.c
484i2d_pu.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
485i2d_pu.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
486i2d_pu.o: ../../include/openssl/crypto.h ../../include/openssl/dsa.h
487i2d_pu.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
488i2d_pu.o: ../../include/openssl/err.h ../../include/openssl/evp.h
489i2d_pu.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
490i2d_pu.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
491i2d_pu.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
492i2d_pu.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
493i2d_pu.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
494i2d_pu.o: ../cryptlib.h i2d_pu.c
495n_pkey.o: ../../e_os.h ../../include/openssl/asn1.h
496n_pkey.o: ../../include/openssl/asn1_mac.h ../../include/openssl/asn1t.h
497n_pkey.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
498n_pkey.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
499n_pkey.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
500n_pkey.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
501n_pkey.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
502n_pkey.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
503n_pkey.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
504n_pkey.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
505n_pkey.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
506n_pkey.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
507n_pkey.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
508n_pkey.o: ../../include/openssl/x509_vfy.h ../cryptlib.h n_pkey.c
509nsseq.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h
510nsseq.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
511nsseq.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
512nsseq.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
513nsseq.o: ../../include/openssl/ecdsa.h ../../include/openssl/evp.h
514nsseq.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
515nsseq.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
516nsseq.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
517nsseq.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
518nsseq.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
519nsseq.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
520nsseq.o: ../../include/openssl/x509_vfy.h nsseq.c
521p5_pbe.o: ../../e_os.h ../../include/openssl/asn1.h
522p5_pbe.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
523p5_pbe.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
524p5_pbe.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
525p5_pbe.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
526p5_pbe.o: ../../include/openssl/err.h ../../include/openssl/evp.h
527p5_pbe.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
528p5_pbe.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
529p5_pbe.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
530p5_pbe.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h
531p5_pbe.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
532p5_pbe.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
533p5_pbe.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
534p5_pbe.o: ../cryptlib.h p5_pbe.c
535p5_pbev2.o: ../../e_os.h ../../include/openssl/asn1.h
536p5_pbev2.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
537p5_pbev2.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
538p5_pbev2.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
539p5_pbev2.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
540p5_pbev2.o: ../../include/openssl/err.h ../../include/openssl/evp.h
541p5_pbev2.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
542p5_pbev2.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
543p5_pbev2.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
544p5_pbev2.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h
545p5_pbev2.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
546p5_pbev2.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
547p5_pbev2.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
548p5_pbev2.o: ../cryptlib.h p5_pbev2.c
549p8_pkey.o: ../../e_os.h ../../include/openssl/asn1.h
550p8_pkey.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
551p8_pkey.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
552p8_pkey.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
553p8_pkey.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
554p8_pkey.o: ../../include/openssl/err.h ../../include/openssl/evp.h
555p8_pkey.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
556p8_pkey.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
557p8_pkey.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
558p8_pkey.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
559p8_pkey.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
560p8_pkey.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
561p8_pkey.o: ../../include/openssl/x509_vfy.h ../cryptlib.h p8_pkey.c
562t_bitst.o: ../../e_os.h ../../include/openssl/asn1.h
563t_bitst.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
564t_bitst.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
565t_bitst.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
566t_bitst.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
567t_bitst.o: ../../include/openssl/err.h ../../include/openssl/evp.h
568t_bitst.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
569t_bitst.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
570t_bitst.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
571t_bitst.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
572t_bitst.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
573t_bitst.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
574t_bitst.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
575t_bitst.o: ../cryptlib.h t_bitst.c
576t_crl.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
577t_crl.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
578t_crl.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
579t_crl.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
580t_crl.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
581t_crl.o: ../../include/openssl/err.h ../../include/openssl/evp.h
582t_crl.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
583t_crl.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
584t_crl.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
585t_crl.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
586t_crl.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
587t_crl.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
588t_crl.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
589t_crl.o: ../cryptlib.h t_crl.c
590t_pkey.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
591t_pkey.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
592t_pkey.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
593t_pkey.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
594t_pkey.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
595t_pkey.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
596t_pkey.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
597t_pkey.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
598t_pkey.o: ../cryptlib.h t_pkey.c
599t_req.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
600t_req.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
601t_req.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
602t_req.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
603t_req.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
604t_req.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
605t_req.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
606t_req.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
607t_req.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
608t_req.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
609t_req.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
610t_req.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
611t_req.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
612t_req.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
613t_req.o: ../cryptlib.h t_req.c
614t_spki.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
615t_spki.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
616t_spki.o: ../../include/openssl/crypto.h ../../include/openssl/dsa.h
617t_spki.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
618t_spki.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
619t_spki.o: ../../include/openssl/err.h ../../include/openssl/evp.h
620t_spki.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
621t_spki.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
622t_spki.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
623t_spki.o: ../../include/openssl/pkcs7.h ../../include/openssl/rsa.h
624t_spki.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
625t_spki.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
626t_spki.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
627t_spki.o: ../cryptlib.h t_spki.c
628t_x509.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
629t_x509.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
630t_x509.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
631t_x509.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
632t_x509.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
633t_x509.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
634t_x509.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
635t_x509.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
636t_x509.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
637t_x509.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
638t_x509.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
639t_x509.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
640t_x509.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
641t_x509.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
642t_x509.o: ../cryptlib.h asn1_locl.h t_x509.c
643t_x509a.o: ../../e_os.h ../../include/openssl/asn1.h
644t_x509a.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
645t_x509a.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
646t_x509a.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
647t_x509a.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
648t_x509a.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
649t_x509a.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
650t_x509a.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
651t_x509a.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
652t_x509a.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
653t_x509a.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
654t_x509a.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
655t_x509a.o: ../cryptlib.h t_x509a.c
656tasn_dec.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h
657tasn_dec.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
658tasn_dec.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
659tasn_dec.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
660tasn_dec.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
661tasn_dec.o: ../../include/openssl/opensslconf.h
662tasn_dec.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
663tasn_dec.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
664tasn_dec.o: ../../include/openssl/symhacks.h tasn_dec.c
665tasn_enc.o: ../../e_os.h ../../include/openssl/asn1.h
666tasn_enc.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
667tasn_enc.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
668tasn_enc.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
669tasn_enc.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
670tasn_enc.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
671tasn_enc.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
672tasn_enc.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
673tasn_enc.o: ../../include/openssl/symhacks.h ../cryptlib.h tasn_enc.c
674tasn_fre.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h
675tasn_fre.o: ../../include/openssl/bio.h ../../include/openssl/crypto.h
676tasn_fre.o: ../../include/openssl/e_os2.h ../../include/openssl/obj_mac.h
677tasn_fre.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
678tasn_fre.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
679tasn_fre.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
680tasn_fre.o: ../../include/openssl/symhacks.h tasn_fre.c
681tasn_new.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h
682tasn_new.o: ../../include/openssl/bio.h ../../include/openssl/crypto.h
683tasn_new.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
684tasn_new.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
685tasn_new.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
686tasn_new.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
687tasn_new.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
688tasn_new.o: ../../include/openssl/symhacks.h tasn_new.c
689tasn_prn.o: ../../e_os.h ../../include/openssl/asn1.h
690tasn_prn.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
691tasn_prn.o: ../../include/openssl/buffer.h ../../include/openssl/conf.h
692tasn_prn.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
693tasn_prn.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
694tasn_prn.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
695tasn_prn.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
696tasn_prn.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
697tasn_prn.o: ../../include/openssl/opensslconf.h
698tasn_prn.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
699tasn_prn.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
700tasn_prn.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
701tasn_prn.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
702tasn_prn.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
703tasn_prn.o: ../cryptlib.h asn1_locl.h tasn_prn.c
704tasn_typ.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h
705tasn_typ.o: ../../include/openssl/bio.h ../../include/openssl/crypto.h
706tasn_typ.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslconf.h
707tasn_typ.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
708tasn_typ.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
709tasn_typ.o: ../../include/openssl/symhacks.h tasn_typ.c
710tasn_utl.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h
711tasn_utl.o: ../../include/openssl/bio.h ../../include/openssl/crypto.h
712tasn_utl.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
713tasn_utl.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
714tasn_utl.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
715tasn_utl.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
716tasn_utl.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
717tasn_utl.o: ../../include/openssl/symhacks.h tasn_utl.c
718x_algor.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h
719x_algor.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
720x_algor.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
721x_algor.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
722x_algor.o: ../../include/openssl/ecdsa.h ../../include/openssl/evp.h
723x_algor.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
724x_algor.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
725x_algor.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
726x_algor.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
727x_algor.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
728x_algor.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
729x_algor.o: ../../include/openssl/x509_vfy.h x_algor.c
730x_attrib.o: ../../e_os.h ../../include/openssl/asn1.h
731x_attrib.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
732x_attrib.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
733x_attrib.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
734x_attrib.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
735x_attrib.o: ../../include/openssl/err.h ../../include/openssl/evp.h
736x_attrib.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
737x_attrib.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
738x_attrib.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
739x_attrib.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
740x_attrib.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
741x_attrib.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
742x_attrib.o: ../../include/openssl/x509_vfy.h ../cryptlib.h x_attrib.c
743x_bignum.o: ../../e_os.h ../../include/openssl/asn1.h
744x_bignum.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
745x_bignum.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
746x_bignum.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
747x_bignum.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
748x_bignum.o: ../../include/openssl/opensslconf.h
749x_bignum.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
750x_bignum.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
751x_bignum.o: ../../include/openssl/symhacks.h ../cryptlib.h x_bignum.c
752x_crl.o: ../../e_os.h ../../include/openssl/asn1.h
753x_crl.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
754x_crl.o: ../../include/openssl/buffer.h ../../include/openssl/conf.h
755x_crl.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
756x_crl.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
757x_crl.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
758x_crl.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
759x_crl.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
760x_crl.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
761x_crl.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
762x_crl.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
763x_crl.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
764x_crl.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
765x_crl.o: ../../include/openssl/x509v3.h ../cryptlib.h asn1_locl.h x_crl.c
766x_exten.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h
767x_exten.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
768x_exten.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
769x_exten.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
770x_exten.o: ../../include/openssl/ecdsa.h ../../include/openssl/evp.h
771x_exten.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
772x_exten.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
773x_exten.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
774x_exten.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
775x_exten.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
776x_exten.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
777x_exten.o: ../../include/openssl/x509_vfy.h x_exten.c
778x_info.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
779x_info.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
780x_info.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
781x_info.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
782x_info.o: ../../include/openssl/err.h ../../include/openssl/evp.h
783x_info.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
784x_info.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
785x_info.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
786x_info.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
787x_info.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
788x_info.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
789x_info.o: ../../include/openssl/x509_vfy.h ../cryptlib.h x_info.c
790x_long.o: ../../e_os.h ../../include/openssl/asn1.h
791x_long.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
792x_long.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
793x_long.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
794x_long.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
795x_long.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
796x_long.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
797x_long.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
798x_long.o: ../cryptlib.h x_long.c
799x_name.o: ../../e_os.h ../../include/openssl/asn1.h
800x_name.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
801x_name.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
802x_name.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
803x_name.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
804x_name.o: ../../include/openssl/err.h ../../include/openssl/evp.h
805x_name.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
806x_name.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
807x_name.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
808x_name.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
809x_name.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
810x_name.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
811x_name.o: ../../include/openssl/x509_vfy.h ../cryptlib.h asn1_locl.h x_name.c
812x_nx509.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h
813x_nx509.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
814x_nx509.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
815x_nx509.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
816x_nx509.o: ../../include/openssl/ecdsa.h ../../include/openssl/evp.h
817x_nx509.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
818x_nx509.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
819x_nx509.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
820x_nx509.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
821x_nx509.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
822x_nx509.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
823x_nx509.o: ../../include/openssl/x509_vfy.h x_nx509.c
824x_pkey.o: ../../e_os.h ../../include/openssl/asn1.h
825x_pkey.o: ../../include/openssl/asn1_mac.h ../../include/openssl/bio.h
826x_pkey.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
827x_pkey.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
828x_pkey.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
829x_pkey.o: ../../include/openssl/err.h ../../include/openssl/evp.h
830x_pkey.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
831x_pkey.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
832x_pkey.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
833x_pkey.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
834x_pkey.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
835x_pkey.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
836x_pkey.o: ../../include/openssl/x509_vfy.h ../cryptlib.h x_pkey.c
837x_pubkey.o: ../../e_os.h ../../include/openssl/asn1.h
838x_pubkey.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
839x_pubkey.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
840x_pubkey.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
841x_pubkey.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
842x_pubkey.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
843x_pubkey.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
844x_pubkey.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
845x_pubkey.o: ../../include/openssl/opensslconf.h
846x_pubkey.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
847x_pubkey.o: ../../include/openssl/pkcs7.h ../../include/openssl/rsa.h
848x_pubkey.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
849x_pubkey.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
850x_pubkey.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
851x_pubkey.o: ../cryptlib.h asn1_locl.h x_pubkey.c
852x_req.o: ../../e_os.h ../../include/openssl/asn1.h
853x_req.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
854x_req.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
855x_req.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
856x_req.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
857x_req.o: ../../include/openssl/err.h ../../include/openssl/evp.h
858x_req.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
859x_req.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
860x_req.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
861x_req.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
862x_req.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
863x_req.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
864x_req.o: ../../include/openssl/x509_vfy.h ../cryptlib.h x_req.c
865x_sig.o: ../../e_os.h ../../include/openssl/asn1.h
866x_sig.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
867x_sig.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
868x_sig.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
869x_sig.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
870x_sig.o: ../../include/openssl/err.h ../../include/openssl/evp.h
871x_sig.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
872x_sig.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
873x_sig.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
874x_sig.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
875x_sig.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
876x_sig.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
877x_sig.o: ../../include/openssl/x509_vfy.h ../cryptlib.h x_sig.c
878x_spki.o: ../../e_os.h ../../include/openssl/asn1.h
879x_spki.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
880x_spki.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
881x_spki.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
882x_spki.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
883x_spki.o: ../../include/openssl/err.h ../../include/openssl/evp.h
884x_spki.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
885x_spki.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
886x_spki.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
887x_spki.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
888x_spki.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
889x_spki.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
890x_spki.o: ../../include/openssl/x509_vfy.h ../cryptlib.h x_spki.c
891x_val.o: ../../e_os.h ../../include/openssl/asn1.h
892x_val.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
893x_val.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
894x_val.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
895x_val.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
896x_val.o: ../../include/openssl/err.h ../../include/openssl/evp.h
897x_val.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
898x_val.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
899x_val.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
900x_val.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
901x_val.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
902x_val.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
903x_val.o: ../../include/openssl/x509_vfy.h ../cryptlib.h x_val.c
904x_x509.o: ../../e_os.h ../../include/openssl/asn1.h
905x_x509.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
906x_x509.o: ../../include/openssl/buffer.h ../../include/openssl/conf.h
907x_x509.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
908x_x509.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
909x_x509.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
910x_x509.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
911x_x509.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
912x_x509.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
913x_x509.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
914x_x509.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
915x_x509.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
916x_x509.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
917x_x509.o: ../../include/openssl/x509v3.h ../cryptlib.h x_x509.c
918x_x509a.o: ../../e_os.h ../../include/openssl/asn1.h
919x_x509a.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
920x_x509a.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
921x_x509a.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
922x_x509a.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
923x_x509a.o: ../../include/openssl/err.h ../../include/openssl/evp.h
924x_x509a.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
925x_x509a.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
926x_x509a.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
927x_x509a.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
928x_x509a.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
929x_x509a.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
930x_x509a.o: ../../include/openssl/x509_vfy.h ../cryptlib.h x_x509a.c
diff --git a/src/lib/libcrypto/asn1/a_gentm.c b/src/lib/libcrypto/asn1/a_gentm.c
new file mode 100644
index 0000000000..c79c6f538c
--- /dev/null
+++ b/src/lib/libcrypto/asn1/a_gentm.c
@@ -0,0 +1,263 @@
1/* crypto/asn1/a_gentm.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
59/* GENERALIZEDTIME implementation, written by Steve Henson. Based on UTCTIME */
60
61#include <stdio.h>
62#include <time.h>
63#include "cryptlib.h"
64#include "o_time.h"
65#include <openssl/asn1.h>
66
67#if 0
68
69int i2d_ASN1_GENERALIZEDTIME(ASN1_GENERALIZEDTIME *a, unsigned char **pp)
70 {
71#ifdef CHARSET_EBCDIC
72 /* KLUDGE! We convert to ascii before writing DER */
73 int len;
74 char tmp[24];
75 ASN1_STRING tmpstr = *(ASN1_STRING *)a;
76
77 len = tmpstr.length;
78 ebcdic2ascii(tmp, tmpstr.data, (len >= sizeof tmp) ? sizeof tmp : len);
79 tmpstr.data = tmp;
80
81 a = (ASN1_GENERALIZEDTIME *) &tmpstr;
82#endif
83 return(i2d_ASN1_bytes((ASN1_STRING *)a,pp,
84 V_ASN1_GENERALIZEDTIME,V_ASN1_UNIVERSAL));
85 }
86
87
88ASN1_GENERALIZEDTIME *d2i_ASN1_GENERALIZEDTIME(ASN1_GENERALIZEDTIME **a,
89 unsigned char **pp, long length)
90 {
91 ASN1_GENERALIZEDTIME *ret=NULL;
92
93 ret=(ASN1_GENERALIZEDTIME *)d2i_ASN1_bytes((ASN1_STRING **)a,pp,length,
94 V_ASN1_GENERALIZEDTIME,V_ASN1_UNIVERSAL);
95 if (ret == NULL)
96 {
97 ASN1err(ASN1_F_D2I_ASN1_GENERALIZEDTIME,ERR_R_NESTED_ASN1_ERROR);
98 return(NULL);
99 }
100#ifdef CHARSET_EBCDIC
101 ascii2ebcdic(ret->data, ret->data, ret->length);
102#endif
103 if (!ASN1_GENERALIZEDTIME_check(ret))
104 {
105 ASN1err(ASN1_F_D2I_ASN1_GENERALIZEDTIME,ASN1_R_INVALID_TIME_FORMAT);
106 goto err;
107 }
108
109 return(ret);
110err:
111 if ((ret != NULL) && ((a == NULL) || (*a != ret)))
112 M_ASN1_GENERALIZEDTIME_free(ret);
113 return(NULL);
114 }
115
116#endif
117
118int ASN1_GENERALIZEDTIME_check(ASN1_GENERALIZEDTIME *d)
119 {
120 static const int min[9]={ 0, 0, 1, 1, 0, 0, 0, 0, 0};
121 static const int max[9]={99, 99,12,31,23,59,59,12,59};
122 char *a;
123 int n,i,l,o;
124
125 if (d->type != V_ASN1_GENERALIZEDTIME) return(0);
126 l=d->length;
127 a=(char *)d->data;
128 o=0;
129 /* GENERALIZEDTIME is similar to UTCTIME except the year is
130 * represented as YYYY. This stuff treats everything as a two digit
131 * field so make first two fields 00 to 99
132 */
133 if (l < 13) goto err;
134 for (i=0; i<7; i++)
135 {
136 if ((i == 6) && ((a[o] == 'Z') ||
137 (a[o] == '+') || (a[o] == '-')))
138 { i++; break; }
139 if ((a[o] < '0') || (a[o] > '9')) goto err;
140 n= a[o]-'0';
141 if (++o > l) goto err;
142
143 if ((a[o] < '0') || (a[o] > '9')) goto err;
144 n=(n*10)+ a[o]-'0';
145 if (++o > l) goto err;
146
147 if ((n < min[i]) || (n > max[i])) goto err;
148 }
149 /* Optional fractional seconds: decimal point followed by one
150 * or more digits.
151 */
152 if (a[o] == '.')
153 {
154 if (++o > l) goto err;
155 i = o;
156 while ((a[o] >= '0') && (a[o] <= '9') && (o <= l))
157 o++;
158 /* Must have at least one digit after decimal point */
159 if (i == o) goto err;
160 }
161
162 if (a[o] == 'Z')
163 o++;
164 else if ((a[o] == '+') || (a[o] == '-'))
165 {
166 o++;
167 if (o+4 > l) goto err;
168 for (i=7; i<9; i++)
169 {
170 if ((a[o] < '0') || (a[o] > '9')) goto err;
171 n= a[o]-'0';
172 o++;
173 if ((a[o] < '0') || (a[o] > '9')) goto err;
174 n=(n*10)+ a[o]-'0';
175 if ((n < min[i]) || (n > max[i])) goto err;
176 o++;
177 }
178 }
179 else
180 {
181 /* Missing time zone information. */
182 goto err;
183 }
184 return(o == l);
185err:
186 return(0);
187 }
188
189int ASN1_GENERALIZEDTIME_set_string(ASN1_GENERALIZEDTIME *s, const char *str)
190 {
191 ASN1_GENERALIZEDTIME t;
192
193 t.type=V_ASN1_GENERALIZEDTIME;
194 t.length=strlen(str);
195 t.data=(unsigned char *)str;
196 if (ASN1_GENERALIZEDTIME_check(&t))
197 {
198 if (s != NULL)
199 {
200 if (!ASN1_STRING_set((ASN1_STRING *)s,
201 (unsigned char *)str,t.length))
202 return 0;
203 s->type=V_ASN1_GENERALIZEDTIME;
204 }
205 return(1);
206 }
207 else
208 return(0);
209 }
210
211ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_set(ASN1_GENERALIZEDTIME *s,
212 time_t t)
213 {
214 return ASN1_GENERALIZEDTIME_adj(s, t, 0, 0);
215 }
216
217ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_adj(ASN1_GENERALIZEDTIME *s,
218 time_t t, int offset_day, long offset_sec)
219 {
220 char *p;
221 struct tm *ts;
222 struct tm data;
223 size_t len = 20;
224
225 if (s == NULL)
226 s=M_ASN1_GENERALIZEDTIME_new();
227 if (s == NULL)
228 return(NULL);
229
230 ts=OPENSSL_gmtime(&t, &data);
231 if (ts == NULL)
232 return(NULL);
233
234 if (offset_day || offset_sec)
235 {
236 if (!OPENSSL_gmtime_adj(ts, offset_day, offset_sec))
237 return NULL;
238 }
239
240 p=(char *)s->data;
241 if ((p == NULL) || ((size_t)s->length < len))
242 {
243 p=OPENSSL_malloc(len);
244 if (p == NULL)
245 {
246 ASN1err(ASN1_F_ASN1_GENERALIZEDTIME_ADJ,
247 ERR_R_MALLOC_FAILURE);
248 return(NULL);
249 }
250 if (s->data != NULL)
251 OPENSSL_free(s->data);
252 s->data=(unsigned char *)p;
253 }
254
255 BIO_snprintf(p,len,"%04d%02d%02d%02d%02d%02dZ",ts->tm_year + 1900,
256 ts->tm_mon+1,ts->tm_mday,ts->tm_hour,ts->tm_min,ts->tm_sec);
257 s->length=strlen(p);
258 s->type=V_ASN1_GENERALIZEDTIME;
259#ifdef CHARSET_EBCDIC_not
260 ebcdic2ascii(s->data, s->data, s->length);
261#endif
262 return(s);
263 }
diff --git a/src/lib/libcrypto/asn1/a_int.c b/src/lib/libcrypto/asn1/a_int.c
index 297c45a9ff..ad0d2506f6 100644
--- a/src/lib/libcrypto/asn1/a_int.c
+++ b/src/lib/libcrypto/asn1/a_int.c
@@ -116,7 +116,7 @@ int i2c_ASN1_INTEGER(ASN1_INTEGER *a, unsigned char **pp)
116 int pad=0,ret,i,neg; 116 int pad=0,ret,i,neg;
117 unsigned char *p,*n,pb=0; 117 unsigned char *p,*n,pb=0;
118 118
119 if (a == NULL) return(0); 119 if ((a == NULL) || (a->data == NULL)) return(0);
120 neg=a->type & V_ASN1_NEG; 120 neg=a->type & V_ASN1_NEG;
121 if (a->length == 0) 121 if (a->length == 0)
122 ret=1; 122 ret=1;
diff --git a/src/lib/libcrypto/asn1/a_strex.c b/src/lib/libcrypto/asn1/a_strex.c
index ead37ac325..264ebf2393 100644
--- a/src/lib/libcrypto/asn1/a_strex.c
+++ b/src/lib/libcrypto/asn1/a_strex.c
@@ -567,7 +567,6 @@ int ASN1_STRING_to_UTF8(unsigned char **out, ASN1_STRING *in)
567 if(mbflag == -1) return -1; 567 if(mbflag == -1) return -1;
568 mbflag |= MBSTRING_FLAG; 568 mbflag |= MBSTRING_FLAG;
569 stmp.data = NULL; 569 stmp.data = NULL;
570 stmp.length = 0;
571 ret = ASN1_mbstring_copy(&str, in->data, in->length, mbflag, B_ASN1_UTF8STRING); 570 ret = ASN1_mbstring_copy(&str, in->data, in->length, mbflag, B_ASN1_UTF8STRING);
572 if(ret < 0) return ret; 571 if(ret < 0) return ret;
573 *out = stmp.data; 572 *out = stmp.data;
diff --git a/src/lib/libcrypto/asn1/a_utctm.c b/src/lib/libcrypto/asn1/a_utctm.c
new file mode 100644
index 0000000000..072e236592
--- /dev/null
+++ b/src/lib/libcrypto/asn1/a_utctm.c
@@ -0,0 +1,318 @@
1/* crypto/asn1/a_utctm.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
59#include <stdio.h>
60#include <time.h>
61#include "cryptlib.h"
62#include "o_time.h"
63#include <openssl/asn1.h>
64
65#if 0
66int i2d_ASN1_UTCTIME(ASN1_UTCTIME *a, unsigned char **pp)
67 {
68#ifndef CHARSET_EBCDIC
69 return(i2d_ASN1_bytes((ASN1_STRING *)a,pp,
70 V_ASN1_UTCTIME,V_ASN1_UNIVERSAL));
71#else
72 /* KLUDGE! We convert to ascii before writing DER */
73 int len;
74 char tmp[24];
75 ASN1_STRING x = *(ASN1_STRING *)a;
76
77 len = x.length;
78 ebcdic2ascii(tmp, x.data, (len >= sizeof tmp) ? sizeof tmp : len);
79 x.data = tmp;
80 return i2d_ASN1_bytes(&x, pp, V_ASN1_UTCTIME,V_ASN1_UNIVERSAL);
81#endif
82 }
83
84
85ASN1_UTCTIME *d2i_ASN1_UTCTIME(ASN1_UTCTIME **a, unsigned char **pp,
86 long length)
87 {
88 ASN1_UTCTIME *ret=NULL;
89
90 ret=(ASN1_UTCTIME *)d2i_ASN1_bytes((ASN1_STRING **)a,pp,length,
91 V_ASN1_UTCTIME,V_ASN1_UNIVERSAL);
92 if (ret == NULL)
93 {
94 ASN1err(ASN1_F_D2I_ASN1_UTCTIME,ERR_R_NESTED_ASN1_ERROR);
95 return(NULL);
96 }
97#ifdef CHARSET_EBCDIC
98 ascii2ebcdic(ret->data, ret->data, ret->length);
99#endif
100 if (!ASN1_UTCTIME_check(ret))
101 {
102 ASN1err(ASN1_F_D2I_ASN1_UTCTIME,ASN1_R_INVALID_TIME_FORMAT);
103 goto err;
104 }
105
106 return(ret);
107err:
108 if ((ret != NULL) && ((a == NULL) || (*a != ret)))
109 M_ASN1_UTCTIME_free(ret);
110 return(NULL);
111 }
112
113#endif
114
115int ASN1_UTCTIME_check(ASN1_UTCTIME *d)
116 {
117 static const int min[8]={ 0, 1, 1, 0, 0, 0, 0, 0};
118 static const int max[8]={99,12,31,23,59,59,12,59};
119 char *a;
120 int n,i,l,o;
121
122 if (d->type != V_ASN1_UTCTIME) return(0);
123 l=d->length;
124 a=(char *)d->data;
125 o=0;
126
127 if (l < 11) goto err;
128 for (i=0; i<6; i++)
129 {
130 if ((i == 5) && ((a[o] == 'Z') ||
131 (a[o] == '+') || (a[o] == '-')))
132 { i++; break; }
133 if ((a[o] < '0') || (a[o] > '9')) goto err;
134 n= a[o]-'0';
135 if (++o > l) goto err;
136
137 if ((a[o] < '0') || (a[o] > '9')) goto err;
138 n=(n*10)+ a[o]-'0';
139 if (++o > l) goto err;
140
141 if ((n < min[i]) || (n > max[i])) goto err;
142 }
143 if (a[o] == 'Z')
144 o++;
145 else if ((a[o] == '+') || (a[o] == '-'))
146 {
147 o++;
148 if (o+4 > l) goto err;
149 for (i=6; i<8; i++)
150 {
151 if ((a[o] < '0') || (a[o] > '9')) goto err;
152 n= a[o]-'0';
153 o++;
154 if ((a[o] < '0') || (a[o] > '9')) goto err;
155 n=(n*10)+ a[o]-'0';
156 if ((n < min[i]) || (n > max[i])) goto err;
157 o++;
158 }
159 }
160 return(o == l);
161err:
162 return(0);
163 }
164
165int ASN1_UTCTIME_set_string(ASN1_UTCTIME *s, const char *str)
166 {
167 ASN1_UTCTIME t;
168
169 t.type=V_ASN1_UTCTIME;
170 t.length=strlen(str);
171 t.data=(unsigned char *)str;
172 if (ASN1_UTCTIME_check(&t))
173 {
174 if (s != NULL)
175 {
176 if (!ASN1_STRING_set((ASN1_STRING *)s,
177 (unsigned char *)str,t.length))
178 return 0;
179 s->type = V_ASN1_UTCTIME;
180 }
181 return(1);
182 }
183 else
184 return(0);
185 }
186
187ASN1_UTCTIME *ASN1_UTCTIME_set(ASN1_UTCTIME *s, time_t t)
188 {
189 return ASN1_UTCTIME_adj(s, t, 0, 0);
190 }
191
192ASN1_UTCTIME *ASN1_UTCTIME_adj(ASN1_UTCTIME *s, time_t t,
193 int offset_day, long offset_sec)
194 {
195 char *p;
196 struct tm *ts;
197 struct tm data;
198 size_t len = 20;
199
200 if (s == NULL)
201 s=M_ASN1_UTCTIME_new();
202 if (s == NULL)
203 return(NULL);
204
205 ts=OPENSSL_gmtime(&t, &data);
206 if (ts == NULL)
207 return(NULL);
208
209 if (offset_day || offset_sec)
210 {
211 if (!OPENSSL_gmtime_adj(ts, offset_day, offset_sec))
212 return NULL;
213 }
214
215 if((ts->tm_year < 50) || (ts->tm_year >= 150))
216 return NULL;
217
218 p=(char *)s->data;
219 if ((p == NULL) || ((size_t)s->length < len))
220 {
221 p=OPENSSL_malloc(len);
222 if (p == NULL)
223 {
224 ASN1err(ASN1_F_ASN1_UTCTIME_ADJ,ERR_R_MALLOC_FAILURE);
225 return(NULL);
226 }
227 if (s->data != NULL)
228 OPENSSL_free(s->data);
229 s->data=(unsigned char *)p;
230 }
231
232 BIO_snprintf(p,len,"%02d%02d%02d%02d%02d%02dZ",ts->tm_year%100,
233 ts->tm_mon+1,ts->tm_mday,ts->tm_hour,ts->tm_min,ts->tm_sec);
234 s->length=strlen(p);
235 s->type=V_ASN1_UTCTIME;
236#ifdef CHARSET_EBCDIC_not
237 ebcdic2ascii(s->data, s->data, s->length);
238#endif
239 return(s);
240 }
241
242
243int ASN1_UTCTIME_cmp_time_t(const ASN1_UTCTIME *s, time_t t)
244 {
245 struct tm *tm;
246 struct tm data;
247 int offset;
248 int year;
249
250#define g2(p) (((p)[0]-'0')*10+(p)[1]-'0')
251
252 if (s->data[12] == 'Z')
253 offset=0;
254 else
255 {
256 offset = g2(s->data+13)*60+g2(s->data+15);
257 if (s->data[12] == '-')
258 offset = -offset;
259 }
260
261 t -= offset*60; /* FIXME: may overflow in extreme cases */
262
263 tm = OPENSSL_gmtime(&t, &data);
264
265#define return_cmp(a,b) if ((a)<(b)) return -1; else if ((a)>(b)) return 1
266 year = g2(s->data);
267 if (year < 50)
268 year += 100;
269 return_cmp(year, tm->tm_year);
270 return_cmp(g2(s->data+2) - 1, tm->tm_mon);
271 return_cmp(g2(s->data+4), tm->tm_mday);
272 return_cmp(g2(s->data+6), tm->tm_hour);
273 return_cmp(g2(s->data+8), tm->tm_min);
274 return_cmp(g2(s->data+10), tm->tm_sec);
275#undef g2
276#undef return_cmp
277
278 return 0;
279 }
280
281
282#if 0
283time_t ASN1_UTCTIME_get(const ASN1_UTCTIME *s)
284 {
285 struct tm tm;
286 int offset;
287
288 memset(&tm,'\0',sizeof tm);
289
290#define g2(p) (((p)[0]-'0')*10+(p)[1]-'0')
291 tm.tm_year=g2(s->data);
292 if(tm.tm_year < 50)
293 tm.tm_year+=100;
294 tm.tm_mon=g2(s->data+2)-1;
295 tm.tm_mday=g2(s->data+4);
296 tm.tm_hour=g2(s->data+6);
297 tm.tm_min=g2(s->data+8);
298 tm.tm_sec=g2(s->data+10);
299 if(s->data[12] == 'Z')
300 offset=0;
301 else
302 {
303 offset=g2(s->data+13)*60+g2(s->data+15);
304 if(s->data[12] == '-')
305 offset= -offset;
306 }
307#undef g2
308
309 return mktime(&tm)-offset*60; /* FIXME: mktime assumes the current timezone
310 * instead of UTC, and unless we rewrite OpenSSL
311 * in Lisp we cannot locally change the timezone
312 * without possibly interfering with other parts
313 * of the program. timegm, which uses UTC, is
314 * non-standard.
315 * Also time_t is inappropriate for general
316 * UTC times because it may a 32 bit type. */
317 }
318#endif
diff --git a/src/lib/libcrypto/asn1/asn1_err.c b/src/lib/libcrypto/asn1/asn1_err.c
index aa60203ba8..1a30bf119b 100644
--- a/src/lib/libcrypto/asn1/asn1_err.c
+++ b/src/lib/libcrypto/asn1/asn1_err.c
@@ -305,7 +305,7 @@ static ERR_STRING_DATA ASN1_str_reasons[]=
305{ERR_REASON(ASN1_R_UNKNOWN_PUBLIC_KEY_TYPE),"unknown public key type"}, 305{ERR_REASON(ASN1_R_UNKNOWN_PUBLIC_KEY_TYPE),"unknown public key type"},
306{ERR_REASON(ASN1_R_UNKNOWN_SIGNATURE_ALGORITHM),"unknown signature algorithm"}, 306{ERR_REASON(ASN1_R_UNKNOWN_SIGNATURE_ALGORITHM),"unknown signature algorithm"},
307{ERR_REASON(ASN1_R_UNKNOWN_TAG) ,"unknown tag"}, 307{ERR_REASON(ASN1_R_UNKNOWN_TAG) ,"unknown tag"},
308{ERR_REASON(ASN1_R_UNKOWN_FORMAT) ,"unknown format"}, 308{ERR_REASON(ASN1_R_UNKOWN_FORMAT) ,"unkown format"},
309{ERR_REASON(ASN1_R_UNSUPPORTED_ANY_DEFINED_BY_TYPE),"unsupported any defined by type"}, 309{ERR_REASON(ASN1_R_UNSUPPORTED_ANY_DEFINED_BY_TYPE),"unsupported any defined by type"},
310{ERR_REASON(ASN1_R_UNSUPPORTED_CIPHER) ,"unsupported cipher"}, 310{ERR_REASON(ASN1_R_UNSUPPORTED_CIPHER) ,"unsupported cipher"},
311{ERR_REASON(ASN1_R_UNSUPPORTED_ENCRYPTION_ALGORITHM),"unsupported encryption algorithm"}, 311{ERR_REASON(ASN1_R_UNSUPPORTED_ENCRYPTION_ALGORITHM),"unsupported encryption algorithm"},
diff --git a/src/lib/libcrypto/asn1/x_pubkey.c b/src/lib/libcrypto/asn1/x_pubkey.c
index b649e1fcf9..627ec87f9f 100644
--- a/src/lib/libcrypto/asn1/x_pubkey.c
+++ b/src/lib/libcrypto/asn1/x_pubkey.c
@@ -175,15 +175,12 @@ EVP_PKEY *X509_PUBKEY_get(X509_PUBKEY *key)
175 CRYPTO_w_lock(CRYPTO_LOCK_EVP_PKEY); 175 CRYPTO_w_lock(CRYPTO_LOCK_EVP_PKEY);
176 if (key->pkey) 176 if (key->pkey)
177 { 177 {
178 CRYPTO_w_unlock(CRYPTO_LOCK_EVP_PKEY);
179 EVP_PKEY_free(ret); 178 EVP_PKEY_free(ret);
180 ret = key->pkey; 179 ret = key->pkey;
181 } 180 }
182 else 181 else
183 {
184 key->pkey = ret; 182 key->pkey = ret;
185 CRYPTO_w_unlock(CRYPTO_LOCK_EVP_PKEY); 183 CRYPTO_w_unlock(CRYPTO_LOCK_EVP_PKEY);
186 }
187 CRYPTO_add(&ret->references, 1, CRYPTO_LOCK_EVP_PKEY); 184 CRYPTO_add(&ret->references, 1, CRYPTO_LOCK_EVP_PKEY);
188 185
189 return ret; 186 return ret;
diff --git a/src/lib/libcrypto/bf/Makefile b/src/lib/libcrypto/bf/Makefile
new file mode 100644
index 0000000000..d01bfaa315
--- /dev/null
+++ b/src/lib/libcrypto/bf/Makefile
@@ -0,0 +1,101 @@
1#
2# OpenSSL/crypto/blowfish/Makefile
3#
4
5DIR= bf
6TOP= ../..
7CC= cc
8CPP= $(CC) -E
9INCLUDES=
10CFLAG=-g
11MAKEFILE= Makefile
12AR= ar r
13
14BF_ENC= bf_enc.o
15
16CFLAGS= $(INCLUDES) $(CFLAG)
17ASFLAGS= $(INCLUDES) $(ASFLAG)
18AFLAGS= $(ASFLAGS)
19
20GENERAL=Makefile
21TEST=bftest.c
22APPS=
23
24LIB=$(TOP)/libcrypto.a
25LIBSRC=bf_skey.c bf_ecb.c bf_enc.c bf_cfb64.c bf_ofb64.c
26LIBOBJ=bf_skey.o bf_ecb.o $(BF_ENC) bf_cfb64.o bf_ofb64.o
27
28SRC= $(LIBSRC)
29
30EXHEADER= blowfish.h
31HEADER= bf_pi.h bf_locl.h $(EXHEADER)
32
33ALL= $(GENERAL) $(SRC) $(HEADER)
34
35top:
36 (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all)
37
38all: lib
39
40lib: $(LIBOBJ)
41 $(AR) $(LIB) $(LIBOBJ)
42 $(RANLIB) $(LIB) || echo Never mind.
43 @touch lib
44
45bf-586.s: asm/bf-586.pl ../perlasm/x86asm.pl ../perlasm/cbc.pl
46 $(PERL) asm/bf-586.pl $(PERLASM_SCHEME) $(CFLAGS) $(PROCESSOR) > $@
47
48files:
49 $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
50
51links:
52 @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
53 @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
54 @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
55
56# We need to use force because 'install' matches 'INSTALL' on case
57# insensitive systems
58FRC.install:
59install: FRC.install
60 @[ -n "$(INSTALLTOP)" ] # should be set by top Makefile...
61 @headerlist="$(EXHEADER)"; for i in $$headerlist ; \
62 do \
63 (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
64 chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
65 done;
66
67tags:
68 ctags $(SRC)
69
70tests:
71
72lint:
73 lint -DLINT $(INCLUDES) $(SRC)>fluff
74
75depend:
76 @[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile...
77 $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
78
79dclean:
80 $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
81 mv -f Makefile.new $(MAKEFILE)
82
83clean:
84 rm -f *.s *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
85
86# DO NOT DELETE THIS LINE -- make depend depends on it.
87
88bf_cfb64.o: ../../include/openssl/blowfish.h ../../include/openssl/e_os2.h
89bf_cfb64.o: ../../include/openssl/opensslconf.h bf_cfb64.c bf_locl.h
90bf_ecb.o: ../../include/openssl/blowfish.h ../../include/openssl/e_os2.h
91bf_ecb.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
92bf_ecb.o: bf_ecb.c bf_locl.h
93bf_enc.o: ../../include/openssl/blowfish.h ../../include/openssl/e_os2.h
94bf_enc.o: ../../include/openssl/opensslconf.h bf_enc.c bf_locl.h
95bf_ofb64.o: ../../include/openssl/blowfish.h ../../include/openssl/e_os2.h
96bf_ofb64.o: ../../include/openssl/opensslconf.h bf_locl.h bf_ofb64.c
97bf_skey.o: ../../include/openssl/blowfish.h ../../include/openssl/crypto.h
98bf_skey.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslconf.h
99bf_skey.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
100bf_skey.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
101bf_skey.o: ../../include/openssl/symhacks.h bf_locl.h bf_pi.h bf_skey.c
diff --git a/src/lib/libcrypto/bf/asm/bf-586.pl b/src/lib/libcrypto/bf/asm/bf-586.pl
index b74cfbafd4..1f9b345aee 100644
--- a/src/lib/libcrypto/bf/asm/bf-586.pl
+++ b/src/lib/libcrypto/bf/asm/bf-586.pl
@@ -19,7 +19,7 @@ $tmp4="edx";
19 19
20&BF_encrypt("BF_encrypt",1); 20&BF_encrypt("BF_encrypt",1);
21&BF_encrypt("BF_decrypt",0); 21&BF_encrypt("BF_decrypt",0);
22&cbc("BF_cbc_encrypt","BF_encrypt","BF_decrypt",1,4,5,3,-1,-1); 22&cbc("BF_cbc_encrypt","BF_encrypt","BF_decrypt",1,4,5,3,-1,-1) unless $main'openbsd;
23&asm_finish(); 23&asm_finish();
24 24
25sub BF_encrypt 25sub BF_encrypt
diff --git a/src/lib/libcrypto/bf/asm/bf-686.pl b/src/lib/libcrypto/bf/asm/bf-686.pl
new file mode 100644
index 0000000000..8e4c25f598
--- /dev/null
+++ b/src/lib/libcrypto/bf/asm/bf-686.pl
@@ -0,0 +1,127 @@
1#!/usr/local/bin/perl
2
3push(@INC,"perlasm","../../perlasm");
4require "x86asm.pl";
5require "cbc.pl";
6
7&asm_init($ARGV[0],"bf-686.pl");
8
9$BF_ROUNDS=16;
10$BF_OFF=($BF_ROUNDS+2)*4;
11$L="ecx";
12$R="edx";
13$P="edi";
14$tot="esi";
15$tmp1="eax";
16$tmp2="ebx";
17$tmp3="ebp";
18
19&des_encrypt("BF_encrypt",1);
20&des_encrypt("BF_decrypt",0);
21&cbc("BF_cbc_encrypt","BF_encrypt","BF_decrypt",1,4,5,3,-1,-1);
22
23&asm_finish();
24
25&file_end();
26
27sub des_encrypt
28 {
29 local($name,$enc)=@_;
30
31 &function_begin($name,"");
32
33 &comment("");
34 &comment("Load the 2 words");
35 &mov("eax",&wparam(0));
36 &mov($L,&DWP(0,"eax","",0));
37 &mov($R,&DWP(4,"eax","",0));
38
39 &comment("");
40 &comment("P pointer, s and enc flag");
41 &mov($P,&wparam(1));
42
43 &xor( $tmp1, $tmp1);
44 &xor( $tmp2, $tmp2);
45
46 # encrypting part
47
48 if ($enc)
49 {
50 &xor($L,&DWP(0,$P,"",0));
51 for ($i=0; $i<$BF_ROUNDS; $i+=2)
52 {
53 &comment("");
54 &comment("Round $i");
55 &BF_ENCRYPT($i+1,$R,$L,$P,$tot,$tmp1,$tmp2,$tmp3);
56
57 &comment("");
58 &comment("Round ".sprintf("%d",$i+1));
59 &BF_ENCRYPT($i+2,$L,$R,$P,$tot,$tmp1,$tmp2,$tmp3);
60 }
61 &xor($R,&DWP(($BF_ROUNDS+1)*4,$P,"",0));
62
63 &mov("eax",&wparam(0));
64 &mov(&DWP(0,"eax","",0),$R);
65 &mov(&DWP(4,"eax","",0),$L);
66 &function_end_A($name);
67 }
68 else
69 {
70 &xor($L,&DWP(($BF_ROUNDS+1)*4,$P,"",0));
71 for ($i=$BF_ROUNDS; $i>0; $i-=2)
72 {
73 &comment("");
74 &comment("Round $i");
75 &BF_ENCRYPT($i,$R,$L,$P,$tot,$tmp1,$tmp2,$tmp3);
76 &comment("");
77 &comment("Round ".sprintf("%d",$i-1));
78 &BF_ENCRYPT($i-1,$L,$R,$P,$tot,$tmp1,$tmp2,$tmp3);
79 }
80 &xor($R,&DWP(0,$P,"",0));
81
82 &mov("eax",&wparam(0));
83 &mov(&DWP(0,"eax","",0),$R);
84 &mov(&DWP(4,"eax","",0),$L);
85 &function_end_A($name);
86 }
87
88 &function_end_B($name);
89 }
90
91sub BF_ENCRYPT
92 {
93 local($i,$L,$R,$P,$tot,$tmp1,$tmp2,$tmp3)=@_;
94
95 &rotr( $R, 16);
96 &mov( $tot, &DWP(&n2a($i*4),$P,"",0));
97
98 &movb( &LB($tmp1), &HB($R));
99 &movb( &LB($tmp2), &LB($R));
100
101 &rotr( $R, 16);
102 &xor( $L, $tot);
103
104 &mov( $tot, &DWP(&n2a($BF_OFF+0x0000),$P,$tmp1,4));
105 &mov( $tmp3, &DWP(&n2a($BF_OFF+0x0400),$P,$tmp2,4));
106
107 &movb( &LB($tmp1), &HB($R));
108 &movb( &LB($tmp2), &LB($R));
109
110 &add( $tot, $tmp3);
111 &mov( $tmp1, &DWP(&n2a($BF_OFF+0x0800),$P,$tmp1,4)); # delay
112
113 &xor( $tot, $tmp1);
114 &mov( $tmp3, &DWP(&n2a($BF_OFF+0x0C00),$P,$tmp2,4));
115
116 &add( $tot, $tmp3);
117 &xor( $tmp1, $tmp1);
118
119 &xor( $L, $tot);
120 # delay
121 }
122
123sub n2a
124 {
125 sprintf("%d",$_[0]);
126 }
127
diff --git a/src/lib/libcrypto/bf/asm/readme b/src/lib/libcrypto/bf/asm/readme
new file mode 100644
index 0000000000..2385fa3812
--- /dev/null
+++ b/src/lib/libcrypto/bf/asm/readme
@@ -0,0 +1,10 @@
1There are blowfish assembler generation scripts.
2bf-586.pl version is for the pentium and
3bf-686.pl is my original version, which is faster on the pentium pro.
4
5When using a bf-586.pl, the pentium pro/II is %8 slower than using
6bf-686.pl. When using a bf-686.pl, the pentium is %16 slower
7than bf-586.pl
8
9So the default is bf-586.pl
10
diff --git a/src/lib/libcrypto/bf/bf_opts.c b/src/lib/libcrypto/bf/bf_opts.c
new file mode 100644
index 0000000000..1721bb99b4
--- /dev/null
+++ b/src/lib/libcrypto/bf/bf_opts.c
@@ -0,0 +1,331 @@
1/* crypto/bf/bf_opts.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
59/* define PART1, PART2, PART3 or PART4 to build only with a few of the options.
60 * This is for machines with 64k code segment size restrictions. */
61
62#if !defined(OPENSSL_SYS_MSDOS) && (!defined(OPENSSL_SYS_VMS) || defined(__DECC)) && !defined(OPENSSL_SYS_MACOSX)
63#define TIMES
64#endif
65
66#include <stdio.h>
67
68#include <openssl/e_os2.h>
69#include OPENSSL_UNISTD_IO
70OPENSSL_DECLARE_EXIT
71
72#ifndef OPENSSL_SYS_NETWARE
73#include <signal.h>
74#endif
75
76#ifndef _IRIX
77#include <time.h>
78#endif
79#ifdef TIMES
80#include <sys/types.h>
81#include <sys/times.h>
82#endif
83
84/* Depending on the VMS version, the tms structure is perhaps defined.
85 The __TMS macro will show if it was. If it wasn't defined, we should
86 undefine TIMES, since that tells the rest of the program how things
87 should be handled. -- Richard Levitte */
88#if defined(OPENSSL_SYS_VMS_DECC) && !defined(__TMS)
89#undef TIMES
90#endif
91
92#ifndef TIMES
93#include <sys/timeb.h>
94#endif
95
96#if defined(sun) || defined(__ultrix)
97#define _POSIX_SOURCE
98#include <limits.h>
99#include <sys/param.h>
100#endif
101
102#include <openssl/blowfish.h>
103
104#define BF_DEFAULT_OPTIONS
105
106#undef BF_ENC
107#define BF_encrypt BF_encrypt_normal
108#undef HEADER_BF_LOCL_H
109#include "bf_enc.c"
110
111#define BF_PTR
112#undef BF_PTR2
113#undef BF_ENC
114#undef BF_encrypt
115#define BF_encrypt BF_encrypt_ptr
116#undef HEADER_BF_LOCL_H
117#include "bf_enc.c"
118
119#undef BF_PTR
120#define BF_PTR2
121#undef BF_ENC
122#undef BF_encrypt
123#define BF_encrypt BF_encrypt_ptr2
124#undef HEADER_BF_LOCL_H
125#include "bf_enc.c"
126
127/* The following if from times(3) man page. It may need to be changed */
128#ifndef HZ
129# ifndef CLK_TCK
130# ifndef _BSD_CLK_TCK_ /* FreeBSD fix */
131# define HZ 100.0
132# else /* _BSD_CLK_TCK_ */
133# define HZ ((double)_BSD_CLK_TCK_)
134# endif
135# else /* CLK_TCK */
136# define HZ ((double)CLK_TCK)
137# endif
138#endif
139
140#define BUFSIZE ((long)1024)
141long run=0;
142
143double Time_F(int s);
144#ifdef SIGALRM
145#if defined(__STDC__) || defined(sgi)
146#define SIGRETTYPE void
147#else
148#define SIGRETTYPE int
149#endif
150
151SIGRETTYPE sig_done(int sig);
152SIGRETTYPE sig_done(int sig)
153 {
154 signal(SIGALRM,sig_done);
155 run=0;
156#ifdef LINT
157 sig=sig;
158#endif
159 }
160#endif
161
162#define START 0
163#define STOP 1
164
165double Time_F(int s)
166 {
167 double ret;
168#ifdef TIMES
169 static struct tms tstart,tend;
170
171 if (s == START)
172 {
173 times(&tstart);
174 return(0);
175 }
176 else
177 {
178 times(&tend);
179 ret=((double)(tend.tms_utime-tstart.tms_utime))/HZ;
180 return((ret == 0.0)?1e-6:ret);
181 }
182#else /* !times() */
183 static struct timeb tstart,tend;
184 long i;
185
186 if (s == START)
187 {
188 ftime(&tstart);
189 return(0);
190 }
191 else
192 {
193 ftime(&tend);
194 i=(long)tend.millitm-(long)tstart.millitm;
195 ret=((double)(tend.time-tstart.time))+((double)i)/1000.0;
196 return((ret == 0.0)?1e-6:ret);
197 }
198#endif
199 }
200
201#ifdef SIGALRM
202#define print_name(name) fprintf(stderr,"Doing %s's for 10 seconds\n",name); alarm(10);
203#else
204#define print_name(name) fprintf(stderr,"Doing %s %ld times\n",name,cb);
205#endif
206
207#define time_it(func,name,index) \
208 print_name(name); \
209 Time_F(START); \
210 for (count=0,run=1; COND(cb); count+=4) \
211 { \
212 unsigned long d[2]; \
213 func(d,&sch); \
214 func(d,&sch); \
215 func(d,&sch); \
216 func(d,&sch); \
217 } \
218 tm[index]=Time_F(STOP); \
219 fprintf(stderr,"%ld %s's in %.2f second\n",count,name,tm[index]); \
220 tm[index]=((double)COUNT(cb))/tm[index];
221
222#define print_it(name,index) \
223 fprintf(stderr,"%s bytes per sec = %12.2f (%5.1fuS)\n",name, \
224 tm[index]*8,1.0e6/tm[index]);
225
226int main(int argc, char **argv)
227 {
228 long count;
229 static unsigned char buf[BUFSIZE];
230 static char key[16]={ 0x12,0x34,0x56,0x78,0x9a,0xbc,0xde,0xf0,
231 0x12,0x34,0x56,0x78,0x9a,0xbc,0xde,0xf0};
232 BF_KEY sch;
233 double d,tm[16],max=0;
234 int rank[16];
235 char *str[16];
236 int max_idx=0,i,num=0,j;
237#ifndef SIGALARM
238 long ca,cb,cc,cd,ce;
239#endif
240
241 for (i=0; i<12; i++)
242 {
243 tm[i]=0.0;
244 rank[i]=0;
245 }
246
247#ifndef TIMES
248 fprintf(stderr,"To get the most accurate results, try to run this\n");
249 fprintf(stderr,"program when this computer is idle.\n");
250#endif
251
252 BF_set_key(&sch,16,key);
253
254#ifndef SIGALRM
255 fprintf(stderr,"First we calculate the approximate speed ...\n");
256 count=10;
257 do {
258 long i;
259 unsigned long data[2];
260
261 count*=2;
262 Time_F(START);
263 for (i=count; i; i--)
264 BF_encrypt(data,&sch);
265 d=Time_F(STOP);
266 } while (d < 3.0);
267 ca=count;
268 cb=count*3;
269 cc=count*3*8/BUFSIZE+1;
270 cd=count*8/BUFSIZE+1;
271
272 ce=count/20+1;
273#define COND(d) (count != (d))
274#define COUNT(d) (d)
275#else
276#define COND(c) (run)
277#define COUNT(d) (count)
278 signal(SIGALRM,sig_done);
279 alarm(10);
280#endif
281
282 time_it(BF_encrypt_normal, "BF_encrypt_normal ", 0);
283 time_it(BF_encrypt_ptr, "BF_encrypt_ptr ", 1);
284 time_it(BF_encrypt_ptr2, "BF_encrypt_ptr2 ", 2);
285 num+=3;
286
287 str[0]="<nothing>";
288 print_it("BF_encrypt_normal ",0);
289 max=tm[0];
290 max_idx=0;
291 str[1]="ptr ";
292 print_it("BF_encrypt_ptr ",1);
293 if (max < tm[1]) { max=tm[1]; max_idx=1; }
294 str[2]="ptr2 ";
295 print_it("BF_encrypt_ptr2 ",2);
296 if (max < tm[2]) { max=tm[2]; max_idx=2; }
297
298 printf("options BF ecb/s\n");
299 printf("%s %12.2f 100.0%%\n",str[max_idx],tm[max_idx]);
300 d=tm[max_idx];
301 tm[max_idx]= -2.0;
302 max= -1.0;
303 for (;;)
304 {
305 for (i=0; i<3; i++)
306 {
307 if (max < tm[i]) { max=tm[i]; j=i; }
308 }
309 if (max < 0.0) break;
310 printf("%s %12.2f %4.1f%%\n",str[j],tm[j],tm[j]/d*100.0);
311 tm[j]= -2.0;
312 max= -1.0;
313 }
314
315 switch (max_idx)
316 {
317 case 0:
318 printf("-DBF_DEFAULT_OPTIONS\n");
319 break;
320 case 1:
321 printf("-DBF_PTR\n");
322 break;
323 case 2:
324 printf("-DBF_PTR2\n");
325 break;
326 }
327 exit(0);
328#if defined(LINT) || defined(OPENSSL_SYS_MSDOS)
329 return(0);
330#endif
331 }
diff --git a/src/lib/libcrypto/bf/bfs.cpp b/src/lib/libcrypto/bf/bfs.cpp
new file mode 100644
index 0000000000..d74c457760
--- /dev/null
+++ b/src/lib/libcrypto/bf/bfs.cpp
@@ -0,0 +1,67 @@
1//
2// gettsc.inl
3//
4// gives access to the Pentium's (secret) cycle counter
5//
6// This software was written by Leonard Janke (janke@unixg.ubc.ca)
7// in 1996-7 and is entered, by him, into the public domain.
8
9#if defined(__WATCOMC__)
10void GetTSC(unsigned long&);
11#pragma aux GetTSC = 0x0f 0x31 "mov [edi], eax" parm [edi] modify [edx eax];
12#elif defined(__GNUC__)
13inline
14void GetTSC(unsigned long& tsc)
15{
16 asm volatile(".byte 15, 49\n\t"
17 : "=eax" (tsc)
18 :
19 : "%edx", "%eax");
20}
21#elif defined(_MSC_VER)
22inline
23void GetTSC(unsigned long& tsc)
24{
25 unsigned long a;
26 __asm _emit 0fh
27 __asm _emit 31h
28 __asm mov a, eax;
29 tsc=a;
30}
31#endif
32
33#include <stdio.h>
34#include <stdlib.h>
35#include <openssl/blowfish.h>
36
37void main(int argc,char *argv[])
38 {
39 BF_KEY key;
40 unsigned long s1,s2,e1,e2;
41 unsigned long data[2];
42 int i,j;
43
44 for (j=0; j<6; j++)
45 {
46 for (i=0; i<1000; i++) /**/
47 {
48 BF_encrypt(&data[0],&key);
49 GetTSC(s1);
50 BF_encrypt(&data[0],&key);
51 BF_encrypt(&data[0],&key);
52 BF_encrypt(&data[0],&key);
53 GetTSC(e1);
54 GetTSC(s2);
55 BF_encrypt(&data[0],&key);
56 BF_encrypt(&data[0],&key);
57 BF_encrypt(&data[0],&key);
58 BF_encrypt(&data[0],&key);
59 GetTSC(e2);
60 BF_encrypt(&data[0],&key);
61 }
62
63 printf("blowfish %d %d (%d)\n",
64 e1-s1,e2-s2,((e2-s2)-(e1-s1)));
65 }
66 }
67
diff --git a/src/lib/libcrypto/bf/bfspeed.c b/src/lib/libcrypto/bf/bfspeed.c
new file mode 100644
index 0000000000..c41ef3b403
--- /dev/null
+++ b/src/lib/libcrypto/bf/bfspeed.c
@@ -0,0 +1,277 @@
1/* crypto/bf/bfspeed.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
59/* 11-Sep-92 Andrew Daviel Support for Silicon Graphics IRIX added */
60/* 06-Apr-92 Luke Brennan Support for VMS and add extra signal calls */
61
62#if !defined(OPENSSL_SYS_MSDOS) && (!defined(OPENSSL_SYS_VMS) || defined(__DECC)) && !defined(OPENSSL_SYS_MACOSX)
63#define TIMES
64#endif
65
66#include <stdio.h>
67
68#include <openssl/e_os2.h>
69#include OPENSSL_UNISTD_IO
70OPENSSL_DECLARE_EXIT
71
72#ifndef OPENSSL_SYS_NETWARE
73#include <signal.h>
74#endif
75
76#ifndef _IRIX
77#include <time.h>
78#endif
79#ifdef TIMES
80#include <sys/types.h>
81#include <sys/times.h>
82#endif
83
84/* Depending on the VMS version, the tms structure is perhaps defined.
85 The __TMS macro will show if it was. If it wasn't defined, we should
86 undefine TIMES, since that tells the rest of the program how things
87 should be handled. -- Richard Levitte */
88#if defined(OPENSSL_SYS_VMS_DECC) && !defined(__TMS)
89#undef TIMES
90#endif
91
92#ifndef TIMES
93#include <sys/timeb.h>
94#endif
95
96#if defined(sun) || defined(__ultrix)
97#define _POSIX_SOURCE
98#include <limits.h>
99#include <sys/param.h>
100#endif
101
102#include <openssl/blowfish.h>
103
104/* The following if from times(3) man page. It may need to be changed */
105#ifndef HZ
106#ifndef CLK_TCK
107#define HZ 100.0
108#else /* CLK_TCK */
109#define HZ ((double)CLK_TCK)
110#endif
111#endif
112
113#define BUFSIZE ((long)1024)
114long run=0;
115
116double Time_F(int s);
117#ifdef SIGALRM
118#if defined(__STDC__) || defined(sgi) || defined(_AIX)
119#define SIGRETTYPE void
120#else
121#define SIGRETTYPE int
122#endif
123
124SIGRETTYPE sig_done(int sig);
125SIGRETTYPE sig_done(int sig)
126 {
127 signal(SIGALRM,sig_done);
128 run=0;
129#ifdef LINT
130 sig=sig;
131#endif
132 }
133#endif
134
135#define START 0
136#define STOP 1
137
138double Time_F(int s)
139 {
140 double ret;
141#ifdef TIMES
142 static struct tms tstart,tend;
143
144 if (s == START)
145 {
146 times(&tstart);
147 return(0);
148 }
149 else
150 {
151 times(&tend);
152 ret=((double)(tend.tms_utime-tstart.tms_utime))/HZ;
153 return((ret == 0.0)?1e-6:ret);
154 }
155#else /* !times() */
156 static struct timeb tstart,tend;
157 long i;
158
159 if (s == START)
160 {
161 ftime(&tstart);
162 return(0);
163 }
164 else
165 {
166 ftime(&tend);
167 i=(long)tend.millitm-(long)tstart.millitm;
168 ret=((double)(tend.time-tstart.time))+((double)i)/1e3;
169 return((ret == 0.0)?1e-6:ret);
170 }
171#endif
172 }
173
174int main(int argc, char **argv)
175 {
176 long count;
177 static unsigned char buf[BUFSIZE];
178 static unsigned char key[] ={
179 0x12,0x34,0x56,0x78,0x9a,0xbc,0xde,0xf0,
180 0xfe,0xdc,0xba,0x98,0x76,0x54,0x32,0x10,
181 };
182 BF_KEY sch;
183 double a,b,c,d;
184#ifndef SIGALRM
185 long ca,cb,cc;
186#endif
187
188#ifndef TIMES
189 printf("To get the most accurate results, try to run this\n");
190 printf("program when this computer is idle.\n");
191#endif
192
193#ifndef SIGALRM
194 printf("First we calculate the approximate speed ...\n");
195 BF_set_key(&sch,16,key);
196 count=10;
197 do {
198 long i;
199 BF_LONG data[2];
200
201 count*=2;
202 Time_F(START);
203 for (i=count; i; i--)
204 BF_encrypt(data,&sch);
205 d=Time_F(STOP);
206 } while (d < 3.0);
207 ca=count/512;
208 cb=count;
209 cc=count*8/BUFSIZE+1;
210 printf("Doing BF_set_key %ld times\n",ca);
211#define COND(d) (count != (d))
212#define COUNT(d) (d)
213#else
214#define COND(c) (run)
215#define COUNT(d) (count)
216 signal(SIGALRM,sig_done);
217 printf("Doing BF_set_key for 10 seconds\n");
218 alarm(10);
219#endif
220
221 Time_F(START);
222 for (count=0,run=1; COND(ca); count+=4)
223 {
224 BF_set_key(&sch,16,key);
225 BF_set_key(&sch,16,key);
226 BF_set_key(&sch,16,key);
227 BF_set_key(&sch,16,key);
228 }
229 d=Time_F(STOP);
230 printf("%ld BF_set_key's in %.2f seconds\n",count,d);
231 a=((double)COUNT(ca))/d;
232
233#ifdef SIGALRM
234 printf("Doing BF_encrypt's for 10 seconds\n");
235 alarm(10);
236#else
237 printf("Doing BF_encrypt %ld times\n",cb);
238#endif
239 Time_F(START);
240 for (count=0,run=1; COND(cb); count+=4)
241 {
242 BF_LONG data[2];
243
244 BF_encrypt(data,&sch);
245 BF_encrypt(data,&sch);
246 BF_encrypt(data,&sch);
247 BF_encrypt(data,&sch);
248 }
249 d=Time_F(STOP);
250 printf("%ld BF_encrypt's in %.2f second\n",count,d);
251 b=((double)COUNT(cb)*8)/d;
252
253#ifdef SIGALRM
254 printf("Doing BF_cbc_encrypt on %ld byte blocks for 10 seconds\n",
255 BUFSIZE);
256 alarm(10);
257#else
258 printf("Doing BF_cbc_encrypt %ld times on %ld byte blocks\n",cc,
259 BUFSIZE);
260#endif
261 Time_F(START);
262 for (count=0,run=1; COND(cc); count++)
263 BF_cbc_encrypt(buf,buf,BUFSIZE,&sch,
264 &(key[0]),BF_ENCRYPT);
265 d=Time_F(STOP);
266 printf("%ld BF_cbc_encrypt's of %ld byte blocks in %.2f second\n",
267 count,BUFSIZE,d);
268 c=((double)COUNT(cc)*BUFSIZE)/d;
269
270 printf("Blowfish set_key per sec = %12.3f (%9.3fuS)\n",a,1.0e6/a);
271 printf("Blowfish raw ecb bytes per sec = %12.3f (%9.3fuS)\n",b,8.0e6/b);
272 printf("Blowfish cbc bytes per sec = %12.3f (%9.3fuS)\n",c,8.0e6/c);
273 exit(0);
274#if defined(LINT) || defined(OPENSSL_SYS_MSDOS)
275 return(0);
276#endif
277 }
diff --git a/src/lib/libcrypto/bf/bftest.c b/src/lib/libcrypto/bf/bftest.c
new file mode 100644
index 0000000000..97e6634d37
--- /dev/null
+++ b/src/lib/libcrypto/bf/bftest.c
@@ -0,0 +1,540 @@
1/* crypto/bf/bftest.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
59/* This has been a quickly hacked 'ideatest.c'. When I add tests for other
60 * RC2 modes, more of the code will be uncommented. */
61
62#include <stdio.h>
63#include <string.h>
64#include <stdlib.h>
65#include <openssl/opensslconf.h> /* To see if OPENSSL_NO_BF is defined */
66
67#include "../e_os.h"
68
69#ifdef OPENSSL_NO_BF
70int main(int argc, char *argv[])
71{
72 printf("No BF support\n");
73 return(0);
74}
75#else
76#include <openssl/blowfish.h>
77
78#ifdef CHARSET_EBCDIC
79#include <openssl/ebcdic.h>
80#endif
81
82static char *bf_key[2]={
83 "abcdefghijklmnopqrstuvwxyz",
84 "Who is John Galt?"
85 };
86
87/* big endian */
88static BF_LONG bf_plain[2][2]={
89 {0x424c4f57L,0x46495348L},
90 {0xfedcba98L,0x76543210L}
91 };
92
93static BF_LONG bf_cipher[2][2]={
94 {0x324ed0feL,0xf413a203L},
95 {0xcc91732bL,0x8022f684L}
96 };
97/************/
98
99/* Lets use the DES test vectors :-) */
100#define NUM_TESTS 34
101static unsigned char ecb_data[NUM_TESTS][8]={
102 {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
103 {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF},
104 {0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
105 {0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11},
106 {0x01,0x23,0x45,0x67,0x89,0xAB,0xCD,0xEF},
107 {0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11},
108 {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
109 {0xFE,0xDC,0xBA,0x98,0x76,0x54,0x32,0x10},
110 {0x7C,0xA1,0x10,0x45,0x4A,0x1A,0x6E,0x57},
111 {0x01,0x31,0xD9,0x61,0x9D,0xC1,0x37,0x6E},
112 {0x07,0xA1,0x13,0x3E,0x4A,0x0B,0x26,0x86},
113 {0x38,0x49,0x67,0x4C,0x26,0x02,0x31,0x9E},
114 {0x04,0xB9,0x15,0xBA,0x43,0xFE,0xB5,0xB6},
115 {0x01,0x13,0xB9,0x70,0xFD,0x34,0xF2,0xCE},
116 {0x01,0x70,0xF1,0x75,0x46,0x8F,0xB5,0xE6},
117 {0x43,0x29,0x7F,0xAD,0x38,0xE3,0x73,0xFE},
118 {0x07,0xA7,0x13,0x70,0x45,0xDA,0x2A,0x16},
119 {0x04,0x68,0x91,0x04,0xC2,0xFD,0x3B,0x2F},
120 {0x37,0xD0,0x6B,0xB5,0x16,0xCB,0x75,0x46},
121 {0x1F,0x08,0x26,0x0D,0x1A,0xC2,0x46,0x5E},
122 {0x58,0x40,0x23,0x64,0x1A,0xBA,0x61,0x76},
123 {0x02,0x58,0x16,0x16,0x46,0x29,0xB0,0x07},
124 {0x49,0x79,0x3E,0xBC,0x79,0xB3,0x25,0x8F},
125 {0x4F,0xB0,0x5E,0x15,0x15,0xAB,0x73,0xA7},
126 {0x49,0xE9,0x5D,0x6D,0x4C,0xA2,0x29,0xBF},
127 {0x01,0x83,0x10,0xDC,0x40,0x9B,0x26,0xD6},
128 {0x1C,0x58,0x7F,0x1C,0x13,0x92,0x4F,0xEF},
129 {0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01},
130 {0x1F,0x1F,0x1F,0x1F,0x0E,0x0E,0x0E,0x0E},
131 {0xE0,0xFE,0xE0,0xFE,0xF1,0xFE,0xF1,0xFE},
132 {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
133 {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF},
134 {0x01,0x23,0x45,0x67,0x89,0xAB,0xCD,0xEF},
135 {0xFE,0xDC,0xBA,0x98,0x76,0x54,0x32,0x10}};
136
137static unsigned char plain_data[NUM_TESTS][8]={
138 {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
139 {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF},
140 {0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x01},
141 {0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11},
142 {0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11},
143 {0x01,0x23,0x45,0x67,0x89,0xAB,0xCD,0xEF},
144 {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
145 {0x01,0x23,0x45,0x67,0x89,0xAB,0xCD,0xEF},
146 {0x01,0xA1,0xD6,0xD0,0x39,0x77,0x67,0x42},
147 {0x5C,0xD5,0x4C,0xA8,0x3D,0xEF,0x57,0xDA},
148 {0x02,0x48,0xD4,0x38,0x06,0xF6,0x71,0x72},
149 {0x51,0x45,0x4B,0x58,0x2D,0xDF,0x44,0x0A},
150 {0x42,0xFD,0x44,0x30,0x59,0x57,0x7F,0xA2},
151 {0x05,0x9B,0x5E,0x08,0x51,0xCF,0x14,0x3A},
152 {0x07,0x56,0xD8,0xE0,0x77,0x47,0x61,0xD2},
153 {0x76,0x25,0x14,0xB8,0x29,0xBF,0x48,0x6A},
154 {0x3B,0xDD,0x11,0x90,0x49,0x37,0x28,0x02},
155 {0x26,0x95,0x5F,0x68,0x35,0xAF,0x60,0x9A},
156 {0x16,0x4D,0x5E,0x40,0x4F,0x27,0x52,0x32},
157 {0x6B,0x05,0x6E,0x18,0x75,0x9F,0x5C,0xCA},
158 {0x00,0x4B,0xD6,0xEF,0x09,0x17,0x60,0x62},
159 {0x48,0x0D,0x39,0x00,0x6E,0xE7,0x62,0xF2},
160 {0x43,0x75,0x40,0xC8,0x69,0x8F,0x3C,0xFA},
161 {0x07,0x2D,0x43,0xA0,0x77,0x07,0x52,0x92},
162 {0x02,0xFE,0x55,0x77,0x81,0x17,0xF1,0x2A},
163 {0x1D,0x9D,0x5C,0x50,0x18,0xF7,0x28,0xC2},
164 {0x30,0x55,0x32,0x28,0x6D,0x6F,0x29,0x5A},
165 {0x01,0x23,0x45,0x67,0x89,0xAB,0xCD,0xEF},
166 {0x01,0x23,0x45,0x67,0x89,0xAB,0xCD,0xEF},
167 {0x01,0x23,0x45,0x67,0x89,0xAB,0xCD,0xEF},
168 {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF},
169 {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
170 {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
171 {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}};
172
173static unsigned char cipher_data[NUM_TESTS][8]={
174 {0x4E,0xF9,0x97,0x45,0x61,0x98,0xDD,0x78},
175 {0x51,0x86,0x6F,0xD5,0xB8,0x5E,0xCB,0x8A},
176 {0x7D,0x85,0x6F,0x9A,0x61,0x30,0x63,0xF2},
177 {0x24,0x66,0xDD,0x87,0x8B,0x96,0x3C,0x9D},
178 {0x61,0xF9,0xC3,0x80,0x22,0x81,0xB0,0x96},
179 {0x7D,0x0C,0xC6,0x30,0xAF,0xDA,0x1E,0xC7},
180 {0x4E,0xF9,0x97,0x45,0x61,0x98,0xDD,0x78},
181 {0x0A,0xCE,0xAB,0x0F,0xC6,0xA0,0xA2,0x8D},
182 {0x59,0xC6,0x82,0x45,0xEB,0x05,0x28,0x2B},
183 {0xB1,0xB8,0xCC,0x0B,0x25,0x0F,0x09,0xA0},
184 {0x17,0x30,0xE5,0x77,0x8B,0xEA,0x1D,0xA4},
185 {0xA2,0x5E,0x78,0x56,0xCF,0x26,0x51,0xEB},
186 {0x35,0x38,0x82,0xB1,0x09,0xCE,0x8F,0x1A},
187 {0x48,0xF4,0xD0,0x88,0x4C,0x37,0x99,0x18},
188 {0x43,0x21,0x93,0xB7,0x89,0x51,0xFC,0x98},
189 {0x13,0xF0,0x41,0x54,0xD6,0x9D,0x1A,0xE5},
190 {0x2E,0xED,0xDA,0x93,0xFF,0xD3,0x9C,0x79},
191 {0xD8,0x87,0xE0,0x39,0x3C,0x2D,0xA6,0xE3},
192 {0x5F,0x99,0xD0,0x4F,0x5B,0x16,0x39,0x69},
193 {0x4A,0x05,0x7A,0x3B,0x24,0xD3,0x97,0x7B},
194 {0x45,0x20,0x31,0xC1,0xE4,0xFA,0xDA,0x8E},
195 {0x75,0x55,0xAE,0x39,0xF5,0x9B,0x87,0xBD},
196 {0x53,0xC5,0x5F,0x9C,0xB4,0x9F,0xC0,0x19},
197 {0x7A,0x8E,0x7B,0xFA,0x93,0x7E,0x89,0xA3},
198 {0xCF,0x9C,0x5D,0x7A,0x49,0x86,0xAD,0xB5},
199 {0xD1,0xAB,0xB2,0x90,0x65,0x8B,0xC7,0x78},
200 {0x55,0xCB,0x37,0x74,0xD1,0x3E,0xF2,0x01},
201 {0xFA,0x34,0xEC,0x48,0x47,0xB2,0x68,0xB2},
202 {0xA7,0x90,0x79,0x51,0x08,0xEA,0x3C,0xAE},
203 {0xC3,0x9E,0x07,0x2D,0x9F,0xAC,0x63,0x1D},
204 {0x01,0x49,0x33,0xE0,0xCD,0xAF,0xF6,0xE4},
205 {0xF2,0x1E,0x9A,0x77,0xB7,0x1C,0x49,0xBC},
206 {0x24,0x59,0x46,0x88,0x57,0x54,0x36,0x9A},
207 {0x6B,0x5C,0x5A,0x9C,0x5D,0x9E,0x0A,0x5A},
208 };
209
210static unsigned char cbc_key [16]={
211 0x01,0x23,0x45,0x67,0x89,0xab,0xcd,0xef,
212 0xf0,0xe1,0xd2,0xc3,0xb4,0xa5,0x96,0x87};
213static unsigned char cbc_iv [8]={0xfe,0xdc,0xba,0x98,0x76,0x54,0x32,0x10};
214static char cbc_data[40]="7654321 Now is the time for ";
215static unsigned char cbc_ok[32]={
216 0x6B,0x77,0xB4,0xD6,0x30,0x06,0xDE,0xE6,
217 0x05,0xB1,0x56,0xE2,0x74,0x03,0x97,0x93,
218 0x58,0xDE,0xB9,0xE7,0x15,0x46,0x16,0xD9,
219 0x59,0xF1,0x65,0x2B,0xD5,0xFF,0x92,0xCC};
220
221static unsigned char cfb64_ok[]={
222 0xE7,0x32,0x14,0xA2,0x82,0x21,0x39,0xCA,
223 0xF2,0x6E,0xCF,0x6D,0x2E,0xB9,0xE7,0x6E,
224 0x3D,0xA3,0xDE,0x04,0xD1,0x51,0x72,0x00,
225 0x51,0x9D,0x57,0xA6,0xC3};
226
227static unsigned char ofb64_ok[]={
228 0xE7,0x32,0x14,0xA2,0x82,0x21,0x39,0xCA,
229 0x62,0xB3,0x43,0xCC,0x5B,0x65,0x58,0x73,
230 0x10,0xDD,0x90,0x8D,0x0C,0x24,0x1B,0x22,
231 0x63,0xC2,0xCF,0x80,0xDA};
232
233#define KEY_TEST_NUM 25
234static unsigned char key_test[KEY_TEST_NUM]={
235 0xf0,0xe1,0xd2,0xc3,0xb4,0xa5,0x96,0x87,
236 0x78,0x69,0x5a,0x4b,0x3c,0x2d,0x1e,0x0f,
237 0x00,0x11,0x22,0x33,0x44,0x55,0x66,0x77,
238 0x88};
239
240static unsigned char key_data[8]=
241 {0xFE,0xDC,0xBA,0x98,0x76,0x54,0x32,0x10};
242
243static unsigned char key_out[KEY_TEST_NUM][8]={
244 {0xF9,0xAD,0x59,0x7C,0x49,0xDB,0x00,0x5E},
245 {0xE9,0x1D,0x21,0xC1,0xD9,0x61,0xA6,0xD6},
246 {0xE9,0xC2,0xB7,0x0A,0x1B,0xC6,0x5C,0xF3},
247 {0xBE,0x1E,0x63,0x94,0x08,0x64,0x0F,0x05},
248 {0xB3,0x9E,0x44,0x48,0x1B,0xDB,0x1E,0x6E},
249 {0x94,0x57,0xAA,0x83,0xB1,0x92,0x8C,0x0D},
250 {0x8B,0xB7,0x70,0x32,0xF9,0x60,0x62,0x9D},
251 {0xE8,0x7A,0x24,0x4E,0x2C,0xC8,0x5E,0x82},
252 {0x15,0x75,0x0E,0x7A,0x4F,0x4E,0xC5,0x77},
253 {0x12,0x2B,0xA7,0x0B,0x3A,0xB6,0x4A,0xE0},
254 {0x3A,0x83,0x3C,0x9A,0xFF,0xC5,0x37,0xF6},
255 {0x94,0x09,0xDA,0x87,0xA9,0x0F,0x6B,0xF2},
256 {0x88,0x4F,0x80,0x62,0x50,0x60,0xB8,0xB4},
257 {0x1F,0x85,0x03,0x1C,0x19,0xE1,0x19,0x68},
258 {0x79,0xD9,0x37,0x3A,0x71,0x4C,0xA3,0x4F},
259 {0x93,0x14,0x28,0x87,0xEE,0x3B,0xE1,0x5C},
260 {0x03,0x42,0x9E,0x83,0x8C,0xE2,0xD1,0x4B},
261 {0xA4,0x29,0x9E,0x27,0x46,0x9F,0xF6,0x7B},
262 {0xAF,0xD5,0xAE,0xD1,0xC1,0xBC,0x96,0xA8},
263 {0x10,0x85,0x1C,0x0E,0x38,0x58,0xDA,0x9F},
264 {0xE6,0xF5,0x1E,0xD7,0x9B,0x9D,0xB2,0x1F},
265 {0x64,0xA6,0xE1,0x4A,0xFD,0x36,0xB4,0x6F},
266 {0x80,0xC7,0xD7,0xD4,0x5A,0x54,0x79,0xAD},
267 {0x05,0x04,0x4B,0x62,0xFA,0x52,0xD0,0x80},
268 };
269
270static int test(void );
271static int print_test_data(void );
272int main(int argc, char *argv[])
273 {
274 int ret;
275
276 if (argc > 1)
277 ret=print_test_data();
278 else
279 ret=test();
280
281#ifdef OPENSSL_SYS_NETWARE
282 if (ret) printf("ERROR: %d\n", ret);
283#endif
284 EXIT(ret);
285 return(0);
286 }
287
288static int print_test_data(void)
289 {
290 unsigned int i,j;
291
292 printf("ecb test data\n");
293 printf("key bytes\t\tclear bytes\t\tcipher bytes\n");
294 for (i=0; i<NUM_TESTS; i++)
295 {
296 for (j=0; j<8; j++)
297 printf("%02X",ecb_data[i][j]);
298 printf("\t");
299 for (j=0; j<8; j++)
300 printf("%02X",plain_data[i][j]);
301 printf("\t");
302 for (j=0; j<8; j++)
303 printf("%02X",cipher_data[i][j]);
304 printf("\n");
305 }
306
307 printf("set_key test data\n");
308 printf("data[8]= ");
309 for (j=0; j<8; j++)
310 printf("%02X",key_data[j]);
311 printf("\n");
312 for (i=0; i<KEY_TEST_NUM-1; i++)
313 {
314 printf("c=");
315 for (j=0; j<8; j++)
316 printf("%02X",key_out[i][j]);
317 printf(" k[%2u]=",i+1);
318 for (j=0; j<i+1; j++)
319 printf("%02X",key_test[j]);
320 printf("\n");
321 }
322
323 printf("\nchaining mode test data\n");
324 printf("key[16] = ");
325 for (j=0; j<16; j++)
326 printf("%02X",cbc_key[j]);
327 printf("\niv[8] = ");
328 for (j=0; j<8; j++)
329 printf("%02X",cbc_iv[j]);
330 printf("\ndata[%d] = '%s'",(int)strlen(cbc_data)+1,cbc_data);
331 printf("\ndata[%d] = ",(int)strlen(cbc_data)+1);
332 for (j=0; j<strlen(cbc_data)+1; j++)
333 printf("%02X",cbc_data[j]);
334 printf("\n");
335 printf("cbc cipher text\n");
336 printf("cipher[%d]= ",32);
337 for (j=0; j<32; j++)
338 printf("%02X",cbc_ok[j]);
339 printf("\n");
340
341 printf("cfb64 cipher text\n");
342 printf("cipher[%d]= ",(int)strlen(cbc_data)+1);
343 for (j=0; j<strlen(cbc_data)+1; j++)
344 printf("%02X",cfb64_ok[j]);
345 printf("\n");
346
347 printf("ofb64 cipher text\n");
348 printf("cipher[%d]= ",(int)strlen(cbc_data)+1);
349 for (j=0; j<strlen(cbc_data)+1; j++)
350 printf("%02X",ofb64_ok[j]);
351 printf("\n");
352 return(0);
353 }
354
355static int test(void)
356 {
357 unsigned char cbc_in[40],cbc_out[40],iv[8];
358 int i,n,err=0;
359 BF_KEY key;
360 BF_LONG data[2];
361 unsigned char out[8];
362 BF_LONG len;
363
364#ifdef CHARSET_EBCDIC
365 ebcdic2ascii(cbc_data, cbc_data, strlen(cbc_data));
366#endif
367
368 printf("testing blowfish in raw ecb mode\n");
369 for (n=0; n<2; n++)
370 {
371#ifdef CHARSET_EBCDIC
372 ebcdic2ascii(bf_key[n], bf_key[n], strlen(bf_key[n]));
373#endif
374 BF_set_key(&key,strlen(bf_key[n]),(unsigned char *)bf_key[n]);
375
376 data[0]=bf_plain[n][0];
377 data[1]=bf_plain[n][1];
378 BF_encrypt(data,&key);
379 if (memcmp(&(bf_cipher[n][0]),&(data[0]),8) != 0)
380 {
381 printf("BF_encrypt error encrypting\n");
382 printf("got :");
383 for (i=0; i<2; i++)
384 printf("%08lX ",(unsigned long)data[i]);
385 printf("\n");
386 printf("expected:");
387 for (i=0; i<2; i++)
388 printf("%08lX ",(unsigned long)bf_cipher[n][i]);
389 err=1;
390 printf("\n");
391 }
392
393 BF_decrypt(&(data[0]),&key);
394 if (memcmp(&(bf_plain[n][0]),&(data[0]),8) != 0)
395 {
396 printf("BF_encrypt error decrypting\n");
397 printf("got :");
398 for (i=0; i<2; i++)
399 printf("%08lX ",(unsigned long)data[i]);
400 printf("\n");
401 printf("expected:");
402 for (i=0; i<2; i++)
403 printf("%08lX ",(unsigned long)bf_plain[n][i]);
404 printf("\n");
405 err=1;
406 }
407 }
408
409 printf("testing blowfish in ecb mode\n");
410
411 for (n=0; n<NUM_TESTS; n++)
412 {
413 BF_set_key(&key,8,ecb_data[n]);
414
415 BF_ecb_encrypt(&(plain_data[n][0]),out,&key,BF_ENCRYPT);
416 if (memcmp(&(cipher_data[n][0]),out,8) != 0)
417 {
418 printf("BF_ecb_encrypt blowfish error encrypting\n");
419 printf("got :");
420 for (i=0; i<8; i++)
421 printf("%02X ",out[i]);
422 printf("\n");
423 printf("expected:");
424 for (i=0; i<8; i++)
425 printf("%02X ",cipher_data[n][i]);
426 err=1;
427 printf("\n");
428 }
429
430 BF_ecb_encrypt(out,out,&key,BF_DECRYPT);
431 if (memcmp(&(plain_data[n][0]),out,8) != 0)
432 {
433 printf("BF_ecb_encrypt error decrypting\n");
434 printf("got :");
435 for (i=0; i<8; i++)
436 printf("%02X ",out[i]);
437 printf("\n");
438 printf("expected:");
439 for (i=0; i<8; i++)
440 printf("%02X ",plain_data[n][i]);
441 printf("\n");
442 err=1;
443 }
444 }
445
446 printf("testing blowfish set_key\n");
447 for (n=1; n<KEY_TEST_NUM; n++)
448 {
449 BF_set_key(&key,n,key_test);
450 BF_ecb_encrypt(key_data,out,&key,BF_ENCRYPT);
451 /* mips-sgi-irix6.5-gcc vv -mabi=64 bug workaround */
452 if (memcmp(out,&(key_out[i=n-1][0]),8) != 0)
453 {
454 printf("blowfish setkey error\n");
455 err=1;
456 }
457 }
458
459 printf("testing blowfish in cbc mode\n");
460 len=strlen(cbc_data)+1;
461
462 BF_set_key(&key,16,cbc_key);
463 memset(cbc_in,0,sizeof cbc_in);
464 memset(cbc_out,0,sizeof cbc_out);
465 memcpy(iv,cbc_iv,sizeof iv);
466 BF_cbc_encrypt((unsigned char *)cbc_data,cbc_out,len,
467 &key,iv,BF_ENCRYPT);
468 if (memcmp(cbc_out,cbc_ok,32) != 0)
469 {
470 err=1;
471 printf("BF_cbc_encrypt encrypt error\n");
472 for (i=0; i<32; i++) printf("0x%02X,",cbc_out[i]);
473 }
474 memcpy(iv,cbc_iv,8);
475 BF_cbc_encrypt(cbc_out,cbc_in,len,
476 &key,iv,BF_DECRYPT);
477 if (memcmp(cbc_in,cbc_data,strlen(cbc_data)+1) != 0)
478 {
479 printf("BF_cbc_encrypt decrypt error\n");
480 err=1;
481 }
482
483 printf("testing blowfish in cfb64 mode\n");
484
485 BF_set_key(&key,16,cbc_key);
486 memset(cbc_in,0,40);
487 memset(cbc_out,0,40);
488 memcpy(iv,cbc_iv,8);
489 n=0;
490 BF_cfb64_encrypt((unsigned char *)cbc_data,cbc_out,(long)13,
491 &key,iv,&n,BF_ENCRYPT);
492 BF_cfb64_encrypt((unsigned char *)&(cbc_data[13]),&(cbc_out[13]),len-13,
493 &key,iv,&n,BF_ENCRYPT);
494 if (memcmp(cbc_out,cfb64_ok,(int)len) != 0)
495 {
496 err=1;
497 printf("BF_cfb64_encrypt encrypt error\n");
498 for (i=0; i<(int)len; i++) printf("0x%02X,",cbc_out[i]);
499 }
500 n=0;
501 memcpy(iv,cbc_iv,8);
502 BF_cfb64_encrypt(cbc_out,cbc_in,17,
503 &key,iv,&n,BF_DECRYPT);
504 BF_cfb64_encrypt(&(cbc_out[17]),&(cbc_in[17]),len-17,
505 &key,iv,&n,BF_DECRYPT);
506 if (memcmp(cbc_in,cbc_data,(int)len) != 0)
507 {
508 printf("BF_cfb64_encrypt decrypt error\n");
509 err=1;
510 }
511
512 printf("testing blowfish in ofb64\n");
513
514 BF_set_key(&key,16,cbc_key);
515 memset(cbc_in,0,40);
516 memset(cbc_out,0,40);
517 memcpy(iv,cbc_iv,8);
518 n=0;
519 BF_ofb64_encrypt((unsigned char *)cbc_data,cbc_out,(long)13,&key,iv,&n);
520 BF_ofb64_encrypt((unsigned char *)&(cbc_data[13]),
521 &(cbc_out[13]),len-13,&key,iv,&n);
522 if (memcmp(cbc_out,ofb64_ok,(int)len) != 0)
523 {
524 err=1;
525 printf("BF_ofb64_encrypt encrypt error\n");
526 for (i=0; i<(int)len; i++) printf("0x%02X,",cbc_out[i]);
527 }
528 n=0;
529 memcpy(iv,cbc_iv,8);
530 BF_ofb64_encrypt(cbc_out,cbc_in,17,&key,iv,&n);
531 BF_ofb64_encrypt(&(cbc_out[17]),&(cbc_in[17]),len-17,&key,iv,&n);
532 if (memcmp(cbc_in,cbc_data,(int)len) != 0)
533 {
534 printf("BF_ofb64_encrypt decrypt error\n");
535 err=1;
536 }
537
538 return(err);
539 }
540#endif
diff --git a/src/lib/libcrypto/bio/Makefile b/src/lib/libcrypto/bio/Makefile
new file mode 100644
index 0000000000..c395d80496
--- /dev/null
+++ b/src/lib/libcrypto/bio/Makefile
@@ -0,0 +1,222 @@
1#
2# OpenSSL/crypto/bio/Makefile
3#
4
5DIR= bio
6TOP= ../..
7CC= cc
8INCLUDES= -I.. -I$(TOP) -I../../include
9CFLAG=-g
10MAKEFILE= Makefile
11AR= ar r
12
13CFLAGS= $(INCLUDES) $(CFLAG)
14
15GENERAL=Makefile
16TEST=
17APPS=
18
19LIB=$(TOP)/libcrypto.a
20LIBSRC= bio_lib.c bio_cb.c bio_err.c \
21 bss_mem.c bss_null.c bss_fd.c \
22 bss_file.c bss_sock.c bss_conn.c \
23 bf_null.c bf_buff.c b_print.c b_dump.c \
24 b_sock.c bss_acpt.c bf_nbio.c bss_log.c bss_bio.c \
25 bss_dgram.c
26# bf_lbuf.c
27LIBOBJ= bio_lib.o bio_cb.o bio_err.o \
28 bss_mem.o bss_null.o bss_fd.o \
29 bss_file.o bss_sock.o bss_conn.o \
30 bf_null.o bf_buff.o b_print.o b_dump.o \
31 b_sock.o bss_acpt.o bf_nbio.o bss_log.o bss_bio.o \
32 bss_dgram.o
33# bf_lbuf.o
34
35SRC= $(LIBSRC)
36
37EXHEADER= bio.h
38HEADER= bio_lcl.h $(EXHEADER)
39
40ALL= $(GENERAL) $(SRC) $(HEADER)
41
42top:
43 (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all)
44
45all: lib
46
47lib: $(LIBOBJ)
48 $(AR) $(LIB) $(LIBOBJ)
49 $(RANLIB) $(LIB) || echo Never mind.
50 @touch lib
51
52files:
53 $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
54
55links:
56 @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
57 @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
58 @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
59
60install:
61 @[ -n "$(INSTALLTOP)" ] # should be set by top Makefile...
62 @headerlist="$(EXHEADER)"; for i in $$headerlist; \
63 do \
64 (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
65 chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
66 done;
67
68tags:
69 ctags $(SRC)
70
71tests:
72
73lint:
74 lint -DLINT $(INCLUDES) $(SRC)>fluff
75
76depend:
77 @[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile...
78 $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
79
80dclean:
81 $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
82 mv -f Makefile.new $(MAKEFILE)
83
84clean:
85 rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
86
87# DO NOT DELETE THIS LINE -- make depend depends on it.
88
89b_dump.o: ../../e_os.h ../../include/openssl/bio.h
90b_dump.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
91b_dump.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
92b_dump.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
93b_dump.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
94b_dump.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
95b_dump.o: ../../include/openssl/symhacks.h ../cryptlib.h b_dump.c bio_lcl.h
96b_print.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h
97b_print.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
98b_print.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
99b_print.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
100b_print.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
101b_print.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
102b_print.o: ../../include/openssl/symhacks.h ../cryptlib.h b_print.c
103b_sock.o: ../../e_os.h ../../include/openssl/bio.h
104b_sock.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
105b_sock.o: ../../include/openssl/dso.h ../../include/openssl/e_os2.h
106b_sock.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
107b_sock.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
108b_sock.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
109b_sock.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
110b_sock.o: ../cryptlib.h b_sock.c
111bf_buff.o: ../../e_os.h ../../include/openssl/bio.h
112bf_buff.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
113bf_buff.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
114bf_buff.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
115bf_buff.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
116bf_buff.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
117bf_buff.o: ../../include/openssl/symhacks.h ../cryptlib.h bf_buff.c
118bf_nbio.o: ../../e_os.h ../../include/openssl/bio.h
119bf_nbio.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
120bf_nbio.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
121bf_nbio.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
122bf_nbio.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
123bf_nbio.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h
124bf_nbio.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
125bf_nbio.o: ../cryptlib.h bf_nbio.c
126bf_null.o: ../../e_os.h ../../include/openssl/bio.h
127bf_null.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
128bf_null.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
129bf_null.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
130bf_null.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
131bf_null.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
132bf_null.o: ../../include/openssl/symhacks.h ../cryptlib.h bf_null.c
133bio_cb.o: ../../e_os.h ../../include/openssl/bio.h
134bio_cb.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
135bio_cb.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
136bio_cb.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
137bio_cb.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
138bio_cb.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
139bio_cb.o: ../../include/openssl/symhacks.h ../cryptlib.h bio_cb.c
140bio_err.o: ../../include/openssl/bio.h ../../include/openssl/crypto.h
141bio_err.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
142bio_err.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
143bio_err.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
144bio_err.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
145bio_err.o: ../../include/openssl/symhacks.h bio_err.c
146bio_lib.o: ../../e_os.h ../../include/openssl/bio.h
147bio_lib.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
148bio_lib.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
149bio_lib.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
150bio_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
151bio_lib.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
152bio_lib.o: ../../include/openssl/symhacks.h ../cryptlib.h bio_lib.c
153bss_acpt.o: ../../e_os.h ../../include/openssl/bio.h
154bss_acpt.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
155bss_acpt.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
156bss_acpt.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
157bss_acpt.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
158bss_acpt.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
159bss_acpt.o: ../../include/openssl/symhacks.h ../cryptlib.h bss_acpt.c
160bss_bio.o: ../../e_os.h ../../include/openssl/bio.h
161bss_bio.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
162bss_bio.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
163bss_bio.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
164bss_bio.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
165bss_bio.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
166bss_bio.o: bss_bio.c
167bss_conn.o: ../../e_os.h ../../include/openssl/bio.h
168bss_conn.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
169bss_conn.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
170bss_conn.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
171bss_conn.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
172bss_conn.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
173bss_conn.o: ../../include/openssl/symhacks.h ../cryptlib.h bss_conn.c
174bss_dgram.o: ../../e_os.h ../../include/openssl/bio.h
175bss_dgram.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
176bss_dgram.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
177bss_dgram.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
178bss_dgram.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
179bss_dgram.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
180bss_dgram.o: ../../include/openssl/symhacks.h ../cryptlib.h bss_dgram.c
181bss_fd.o: ../../e_os.h ../../include/openssl/bio.h
182bss_fd.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
183bss_fd.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
184bss_fd.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
185bss_fd.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
186bss_fd.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
187bss_fd.o: ../../include/openssl/symhacks.h ../cryptlib.h bio_lcl.h bss_fd.c
188bss_file.o: ../../e_os.h ../../include/openssl/bio.h
189bss_file.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
190bss_file.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
191bss_file.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
192bss_file.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
193bss_file.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
194bss_file.o: ../../include/openssl/symhacks.h ../cryptlib.h bio_lcl.h bss_file.c
195bss_log.o: ../../e_os.h ../../include/openssl/bio.h
196bss_log.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
197bss_log.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
198bss_log.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
199bss_log.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
200bss_log.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
201bss_log.o: ../../include/openssl/symhacks.h ../cryptlib.h bss_log.c
202bss_mem.o: ../../e_os.h ../../include/openssl/bio.h
203bss_mem.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
204bss_mem.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
205bss_mem.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
206bss_mem.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
207bss_mem.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
208bss_mem.o: ../../include/openssl/symhacks.h ../cryptlib.h bss_mem.c
209bss_null.o: ../../e_os.h ../../include/openssl/bio.h
210bss_null.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
211bss_null.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
212bss_null.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
213bss_null.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
214bss_null.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
215bss_null.o: ../../include/openssl/symhacks.h ../cryptlib.h bss_null.c
216bss_sock.o: ../../e_os.h ../../include/openssl/bio.h
217bss_sock.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
218bss_sock.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
219bss_sock.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
220bss_sock.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
221bss_sock.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
222bss_sock.o: ../../include/openssl/symhacks.h ../cryptlib.h bss_sock.c
diff --git a/src/lib/libcrypto/bio/bio_lcl.h b/src/lib/libcrypto/bio/bio_lcl.h
new file mode 100644
index 0000000000..e7f7ec8d8b
--- /dev/null
+++ b/src/lib/libcrypto/bio/bio_lcl.h
@@ -0,0 +1,36 @@
1#include <openssl/bio.h>
2
3#if BIO_FLAGS_UPLINK==0
4/* Shortcut UPLINK calls on most platforms... */
5#define UP_stdin stdin
6#define UP_stdout stdout
7#define UP_stderr stderr
8#define UP_fprintf fprintf
9#define UP_fgets fgets
10#define UP_fread fread
11#define UP_fwrite fwrite
12#undef UP_fsetmod
13#define UP_feof feof
14#define UP_fclose fclose
15
16#define UP_fopen fopen
17#define UP_fseek fseek
18#define UP_ftell ftell
19#define UP_fflush fflush
20#define UP_ferror ferror
21#ifdef _WIN32
22#define UP_fileno _fileno
23#define UP_open _open
24#define UP_read _read
25#define UP_write _write
26#define UP_lseek _lseek
27#define UP_close _close
28#else
29#define UP_fileno fileno
30#define UP_open open
31#define UP_read read
32#define UP_write write
33#define UP_lseek lseek
34#define UP_close close
35#endif
36#endif
diff --git a/src/lib/libcrypto/bio/bss_dgram.c b/src/lib/libcrypto/bio/bss_dgram.c
index 54c012c47d..1b1e4bec81 100644
--- a/src/lib/libcrypto/bio/bss_dgram.c
+++ b/src/lib/libcrypto/bio/bss_dgram.c
@@ -77,20 +77,10 @@
77#define OPENSSL_SCTP_FORWARD_CUM_TSN_CHUNK_TYPE 0xc0 77#define OPENSSL_SCTP_FORWARD_CUM_TSN_CHUNK_TYPE 0xc0
78#endif 78#endif
79 79
80#if defined(OPENSSL_SYS_LINUX) && !defined(IP_MTU) 80#ifdef OPENSSL_SYS_LINUX
81#define IP_MTU 14 /* linux is lame */ 81#define IP_MTU 14 /* linux is lame */
82#endif 82#endif
83 83
84#if defined(__FreeBSD__) && defined(IN6_IS_ADDR_V4MAPPED)
85/* Standard definition causes type-punning problems. */
86#undef IN6_IS_ADDR_V4MAPPED
87#define s6_addr32 __u6_addr.__u6_addr32
88#define IN6_IS_ADDR_V4MAPPED(a) \
89 (((a)->s6_addr32[0] == 0) && \
90 ((a)->s6_addr32[1] == 0) && \
91 ((a)->s6_addr32[2] == htonl(0x0000ffff)))
92#endif
93
94#ifdef WATT32 84#ifdef WATT32
95#define sock_write SockWrite /* Watt-32 uses same names */ 85#define sock_write SockWrite /* Watt-32 uses same names */
96#define sock_read SockRead 86#define sock_read SockRead
@@ -265,7 +255,7 @@ static void dgram_adjust_rcv_timeout(BIO *b)
265 { 255 {
266#if defined(SO_RCVTIMEO) 256#if defined(SO_RCVTIMEO)
267 bio_dgram_data *data = (bio_dgram_data *)b->ptr; 257 bio_dgram_data *data = (bio_dgram_data *)b->ptr;
268 union { size_t s; int i; } sz = {0}; 258 int sz = sizeof(int);
269 259
270 /* Is a timer active? */ 260 /* Is a timer active? */
271 if (data->next_timeout.tv_sec > 0 || data->next_timeout.tv_usec > 0) 261 if (data->next_timeout.tv_sec > 0 || data->next_timeout.tv_usec > 0)
@@ -275,10 +265,8 @@ static void dgram_adjust_rcv_timeout(BIO *b)
275 /* Read current socket timeout */ 265 /* Read current socket timeout */
276#ifdef OPENSSL_SYS_WINDOWS 266#ifdef OPENSSL_SYS_WINDOWS
277 int timeout; 267 int timeout;
278
279 sz.i = sizeof(timeout);
280 if (getsockopt(b->num, SOL_SOCKET, SO_RCVTIMEO, 268 if (getsockopt(b->num, SOL_SOCKET, SO_RCVTIMEO,
281 (void*)&timeout, &sz.i) < 0) 269 (void*)&timeout, &sz) < 0)
282 { perror("getsockopt"); } 270 { perror("getsockopt"); }
283 else 271 else
284 { 272 {
@@ -286,12 +274,9 @@ static void dgram_adjust_rcv_timeout(BIO *b)
286 data->socket_timeout.tv_usec = (timeout % 1000) * 1000; 274 data->socket_timeout.tv_usec = (timeout % 1000) * 1000;
287 } 275 }
288#else 276#else
289 sz.i = sizeof(data->socket_timeout);
290 if ( getsockopt(b->num, SOL_SOCKET, SO_RCVTIMEO, 277 if ( getsockopt(b->num, SOL_SOCKET, SO_RCVTIMEO,
291 &(data->socket_timeout), (void *)&sz) < 0) 278 &(data->socket_timeout), (void *)&sz) < 0)
292 { perror("getsockopt"); } 279 { perror("getsockopt"); }
293 else if (sizeof(sz.s)!=sizeof(sz.i) && sz.i==0)
294 OPENSSL_assert(sz.s<=sizeof(data->socket_timeout));
295#endif 280#endif
296 281
297 /* Get current time */ 282 /* Get current time */
@@ -460,10 +445,11 @@ static long dgram_ctrl(BIO *b, int cmd, long num, void *ptr)
460 int *ip; 445 int *ip;
461 struct sockaddr *to = NULL; 446 struct sockaddr *to = NULL;
462 bio_dgram_data *data = NULL; 447 bio_dgram_data *data = NULL;
463#if defined(OPENSSL_SYS_LINUX) && (defined(IP_MTU_DISCOVER) || defined(IP_MTU)) 448#if defined(IP_MTU_DISCOVER) || defined(IP_MTU)
464 int sockopt_val = 0; 449 long sockopt_val = 0;
465 socklen_t sockopt_len; /* assume that system supporting IP_MTU is 450 unsigned int sockopt_len = 0;
466 * modern enough to define socklen_t */ 451#endif
452#ifdef OPENSSL_SYS_LINUX
467 socklen_t addr_len; 453 socklen_t addr_len;
468 union { 454 union {
469 struct sockaddr sa; 455 struct sockaddr sa;
@@ -545,7 +531,7 @@ static long dgram_ctrl(BIO *b, int cmd, long num, void *ptr)
545 break; 531 break;
546 /* (Linux)kernel sets DF bit on outgoing IP packets */ 532 /* (Linux)kernel sets DF bit on outgoing IP packets */
547 case BIO_CTRL_DGRAM_MTU_DISCOVER: 533 case BIO_CTRL_DGRAM_MTU_DISCOVER:
548#if defined(OPENSSL_SYS_LINUX) && defined(IP_MTU_DISCOVER) && defined(IP_PMTUDISC_DO) 534#ifdef OPENSSL_SYS_LINUX
549 addr_len = (socklen_t)sizeof(addr); 535 addr_len = (socklen_t)sizeof(addr);
550 memset((void *)&addr, 0, sizeof(addr)); 536 memset((void *)&addr, 0, sizeof(addr));
551 if (getsockname(b->num, &addr.sa, &addr_len) < 0) 537 if (getsockname(b->num, &addr.sa, &addr_len) < 0)
@@ -553,6 +539,7 @@ static long dgram_ctrl(BIO *b, int cmd, long num, void *ptr)
553 ret = 0; 539 ret = 0;
554 break; 540 break;
555 } 541 }
542 sockopt_len = sizeof(sockopt_val);
556 switch (addr.sa.sa_family) 543 switch (addr.sa.sa_family)
557 { 544 {
558 case AF_INET: 545 case AF_INET:
@@ -561,7 +548,7 @@ static long dgram_ctrl(BIO *b, int cmd, long num, void *ptr)
561 &sockopt_val, sizeof(sockopt_val))) < 0) 548 &sockopt_val, sizeof(sockopt_val))) < 0)
562 perror("setsockopt"); 549 perror("setsockopt");
563 break; 550 break;
564#if OPENSSL_USE_IPV6 && defined(IPV6_MTU_DISCOVER) && defined(IPV6_PMTUDISC_DO) 551#if OPENSSL_USE_IPV6 && defined(IPV6_MTU_DISCOVER)
565 case AF_INET6: 552 case AF_INET6:
566 sockopt_val = IPV6_PMTUDISC_DO; 553 sockopt_val = IPV6_PMTUDISC_DO;
567 if ((ret = setsockopt(b->num, IPPROTO_IPV6, IPV6_MTU_DISCOVER, 554 if ((ret = setsockopt(b->num, IPPROTO_IPV6, IPV6_MTU_DISCOVER,
@@ -578,7 +565,7 @@ static long dgram_ctrl(BIO *b, int cmd, long num, void *ptr)
578 break; 565 break;
579#endif 566#endif
580 case BIO_CTRL_DGRAM_QUERY_MTU: 567 case BIO_CTRL_DGRAM_QUERY_MTU:
581#if defined(OPENSSL_SYS_LINUX) && defined(IP_MTU) 568#ifdef OPENSSL_SYS_LINUX
582 addr_len = (socklen_t)sizeof(addr); 569 addr_len = (socklen_t)sizeof(addr);
583 memset((void *)&addr, 0, sizeof(addr)); 570 memset((void *)&addr, 0, sizeof(addr));
584 if (getsockname(b->num, &addr.sa, &addr_len) < 0) 571 if (getsockname(b->num, &addr.sa, &addr_len) < 0)
@@ -740,15 +727,12 @@ static long dgram_ctrl(BIO *b, int cmd, long num, void *ptr)
740#endif 727#endif
741 break; 728 break;
742 case BIO_CTRL_DGRAM_GET_RECV_TIMEOUT: 729 case BIO_CTRL_DGRAM_GET_RECV_TIMEOUT:
743 {
744 union { size_t s; int i; } sz = {0};
745#ifdef OPENSSL_SYS_WINDOWS 730#ifdef OPENSSL_SYS_WINDOWS
746 int timeout; 731 {
732 int timeout, sz = sizeof(timeout);
747 struct timeval *tv = (struct timeval *)ptr; 733 struct timeval *tv = (struct timeval *)ptr;
748
749 sz.i = sizeof(timeout);
750 if (getsockopt(b->num, SOL_SOCKET, SO_RCVTIMEO, 734 if (getsockopt(b->num, SOL_SOCKET, SO_RCVTIMEO,
751 (void*)&timeout, &sz.i) < 0) 735 (void*)&timeout, &sz) < 0)
752 { perror("getsockopt"); ret = -1; } 736 { perror("getsockopt"); ret = -1; }
753 else 737 else
754 { 738 {
@@ -756,20 +740,12 @@ static long dgram_ctrl(BIO *b, int cmd, long num, void *ptr)
756 tv->tv_usec = (timeout % 1000) * 1000; 740 tv->tv_usec = (timeout % 1000) * 1000;
757 ret = sizeof(*tv); 741 ret = sizeof(*tv);
758 } 742 }
743 }
759#else 744#else
760 sz.i = sizeof(struct timeval);
761 if ( getsockopt(b->num, SOL_SOCKET, SO_RCVTIMEO, 745 if ( getsockopt(b->num, SOL_SOCKET, SO_RCVTIMEO,
762 ptr, (void *)&sz) < 0) 746 ptr, (void *)&ret) < 0)
763 { perror("getsockopt"); ret = -1; } 747 { perror("getsockopt"); ret = -1; }
764 else if (sizeof(sz.s)!=sizeof(sz.i) && sz.i==0)
765 {
766 OPENSSL_assert(sz.s<=sizeof(struct timeval));
767 ret = (int)sz.s;
768 }
769 else
770 ret = sz.i;
771#endif 748#endif
772 }
773 break; 749 break;
774#endif 750#endif
775#if defined(SO_SNDTIMEO) 751#if defined(SO_SNDTIMEO)
@@ -789,15 +765,12 @@ static long dgram_ctrl(BIO *b, int cmd, long num, void *ptr)
789#endif 765#endif
790 break; 766 break;
791 case BIO_CTRL_DGRAM_GET_SEND_TIMEOUT: 767 case BIO_CTRL_DGRAM_GET_SEND_TIMEOUT:
792 {
793 union { size_t s; int i; } sz = {0};
794#ifdef OPENSSL_SYS_WINDOWS 768#ifdef OPENSSL_SYS_WINDOWS
795 int timeout; 769 {
770 int timeout, sz = sizeof(timeout);
796 struct timeval *tv = (struct timeval *)ptr; 771 struct timeval *tv = (struct timeval *)ptr;
797
798 sz.i = sizeof(timeout);
799 if (getsockopt(b->num, SOL_SOCKET, SO_SNDTIMEO, 772 if (getsockopt(b->num, SOL_SOCKET, SO_SNDTIMEO,
800 (void*)&timeout, &sz.i) < 0) 773 (void*)&timeout, &sz) < 0)
801 { perror("getsockopt"); ret = -1; } 774 { perror("getsockopt"); ret = -1; }
802 else 775 else
803 { 776 {
@@ -805,20 +778,12 @@ static long dgram_ctrl(BIO *b, int cmd, long num, void *ptr)
805 tv->tv_usec = (timeout % 1000) * 1000; 778 tv->tv_usec = (timeout % 1000) * 1000;
806 ret = sizeof(*tv); 779 ret = sizeof(*tv);
807 } 780 }
781 }
808#else 782#else
809 sz.i = sizeof(struct timeval);
810 if ( getsockopt(b->num, SOL_SOCKET, SO_SNDTIMEO, 783 if ( getsockopt(b->num, SOL_SOCKET, SO_SNDTIMEO,
811 ptr, (void *)&sz) < 0) 784 ptr, (void *)&ret) < 0)
812 { perror("getsockopt"); ret = -1; } 785 { perror("getsockopt"); ret = -1; }
813 else if (sizeof(sz.s)!=sizeof(sz.i) && sz.i==0)
814 {
815 OPENSSL_assert(sz.s<=sizeof(struct timeval));
816 ret = (int)sz.s;
817 }
818 else
819 ret = sz.i;
820#endif 786#endif
821 }
822 break; 787 break;
823#endif 788#endif
824 case BIO_CTRL_DGRAM_GET_SEND_TIMER_EXP: 789 case BIO_CTRL_DGRAM_GET_SEND_TIMER_EXP:
@@ -906,8 +871,8 @@ BIO *BIO_new_dgram_sctp(int fd, int close_flag)
906 memset(authchunks, 0, sizeof(sockopt_len)); 871 memset(authchunks, 0, sizeof(sockopt_len));
907 ret = getsockopt(fd, IPPROTO_SCTP, SCTP_LOCAL_AUTH_CHUNKS, authchunks, &sockopt_len); 872 ret = getsockopt(fd, IPPROTO_SCTP, SCTP_LOCAL_AUTH_CHUNKS, authchunks, &sockopt_len);
908 OPENSSL_assert(ret >= 0); 873 OPENSSL_assert(ret >= 0);
909 874
910 for (p = (unsigned char*) authchunks->gauth_chunks; 875 for (p = (unsigned char*) authchunks + sizeof(sctp_assoc_t);
911 p < (unsigned char*) authchunks + sockopt_len; 876 p < (unsigned char*) authchunks + sockopt_len;
912 p += sizeof(uint8_t)) 877 p += sizeof(uint8_t))
913 { 878 {
@@ -990,6 +955,7 @@ static int dgram_sctp_free(BIO *a)
990#ifdef SCTP_AUTHENTICATION_EVENT 955#ifdef SCTP_AUTHENTICATION_EVENT
991void dgram_sctp_handle_auth_free_key_event(BIO *b, union sctp_notification *snp) 956void dgram_sctp_handle_auth_free_key_event(BIO *b, union sctp_notification *snp)
992 { 957 {
958 unsigned int sockopt_len = 0;
993 int ret; 959 int ret;
994 struct sctp_authkey_event* authkeyevent = &snp->sn_auth_event; 960 struct sctp_authkey_event* authkeyevent = &snp->sn_auth_event;
995 961
@@ -999,8 +965,9 @@ void dgram_sctp_handle_auth_free_key_event(BIO *b, union sctp_notification *snp)
999 965
1000 /* delete key */ 966 /* delete key */
1001 authkeyid.scact_keynumber = authkeyevent->auth_keynumber; 967 authkeyid.scact_keynumber = authkeyevent->auth_keynumber;
968 sockopt_len = sizeof(struct sctp_authkeyid);
1002 ret = setsockopt(b->num, IPPROTO_SCTP, SCTP_AUTH_DELETE_KEY, 969 ret = setsockopt(b->num, IPPROTO_SCTP, SCTP_AUTH_DELETE_KEY,
1003 &authkeyid, sizeof(struct sctp_authkeyid)); 970 &authkeyid, sockopt_len);
1004 } 971 }
1005 } 972 }
1006#endif 973#endif
@@ -1197,7 +1164,7 @@ static int dgram_sctp_read(BIO *b, char *out, int outl)
1197 ii = getsockopt(b->num, IPPROTO_SCTP, SCTP_PEER_AUTH_CHUNKS, authchunks, &optlen); 1164 ii = getsockopt(b->num, IPPROTO_SCTP, SCTP_PEER_AUTH_CHUNKS, authchunks, &optlen);
1198 OPENSSL_assert(ii >= 0); 1165 OPENSSL_assert(ii >= 0);
1199 1166
1200 for (p = (unsigned char*) authchunks->gauth_chunks; 1167 for (p = (unsigned char*) authchunks + sizeof(sctp_assoc_t);
1201 p < (unsigned char*) authchunks + optlen; 1168 p < (unsigned char*) authchunks + optlen;
1202 p += sizeof(uint8_t)) 1169 p += sizeof(uint8_t))
1203 { 1170 {
@@ -1331,7 +1298,7 @@ static long dgram_sctp_ctrl(BIO *b, int cmd, long num, void *ptr)
1331 { 1298 {
1332 long ret=1; 1299 long ret=1;
1333 bio_dgram_sctp_data *data = NULL; 1300 bio_dgram_sctp_data *data = NULL;
1334 socklen_t sockopt_len = 0; 1301 unsigned int sockopt_len = 0;
1335 struct sctp_authkeyid authkeyid; 1302 struct sctp_authkeyid authkeyid;
1336 struct sctp_authkey *authkey; 1303 struct sctp_authkey *authkey;
1337 1304
diff --git a/src/lib/libcrypto/bio/bss_log.c b/src/lib/libcrypto/bio/bss_log.c
index 2227b2b52d..b7dce5c1a2 100644
--- a/src/lib/libcrypto/bio/bss_log.c
+++ b/src/lib/libcrypto/bio/bss_log.c
@@ -245,7 +245,7 @@ static int MS_CALLBACK slg_puts(BIO *bp, const char *str)
245 245
246static void xopenlog(BIO* bp, char* name, int level) 246static void xopenlog(BIO* bp, char* name, int level)
247{ 247{
248 if (check_winnt()) 248 if (GetVersion() < 0x80000000)
249 bp->ptr = RegisterEventSourceA(NULL,name); 249 bp->ptr = RegisterEventSourceA(NULL,name);
250 else 250 else
251 bp->ptr = NULL; 251 bp->ptr = NULL;
diff --git a/src/lib/libcrypto/bio/bss_rtcp.c b/src/lib/libcrypto/bio/bss_rtcp.c
new file mode 100644
index 0000000000..7dae485564
--- /dev/null
+++ b/src/lib/libcrypto/bio/bss_rtcp.c
@@ -0,0 +1,294 @@
1/* crypto/bio/bss_rtcp.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
59/* Written by David L. Jones <jonesd@kcgl1.eng.ohio-state.edu>
60 * Date: 22-JUL-1996
61 * Revised: 25-SEP-1997 Update for 0.8.1, BIO_CTRL_SET -> BIO_C_SET_FD
62 */
63/* VMS */
64#include <stdio.h>
65#include <stdlib.h>
66#include <string.h>
67#include <errno.h>
68#include "cryptlib.h"
69#include <openssl/bio.h>
70
71#include <iodef.h> /* VMS IO$_ definitions */
72#include <starlet.h>
73
74typedef unsigned short io_channel;
75/*************************************************************************/
76struct io_status { short status, count; long flags; };
77
78struct rpc_msg { /* Should have member alignment inhibited */
79 char channel; /* 'A'-app data. 'R'-remote client 'G'-global */
80 char function; /* 'G'-get, 'P'-put, 'C'-confirm, 'X'-close */
81 unsigned short int length; /* Amount of data returned or max to return */
82 char data[4092]; /* variable data */
83};
84#define RPC_HDR_SIZE (sizeof(struct rpc_msg) - 4092)
85
86struct rpc_ctx {
87 int filled, pos;
88 struct rpc_msg msg;
89};
90
91static int rtcp_write(BIO *h,const char *buf,int num);
92static int rtcp_read(BIO *h,char *buf,int size);
93static int rtcp_puts(BIO *h,const char *str);
94static int rtcp_gets(BIO *h,char *str,int size);
95static long rtcp_ctrl(BIO *h,int cmd,long arg1,void *arg2);
96static int rtcp_new(BIO *h);
97static int rtcp_free(BIO *data);
98
99static BIO_METHOD rtcp_method=
100 {
101 BIO_TYPE_FD,
102 "RTCP",
103 rtcp_write,
104 rtcp_read,
105 rtcp_puts,
106 rtcp_gets,
107 rtcp_ctrl,
108 rtcp_new,
109 rtcp_free,
110 NULL,
111 };
112
113BIO_METHOD *BIO_s_rtcp(void)
114 {
115 return(&rtcp_method);
116 }
117/*****************************************************************************/
118/* Decnet I/O routines.
119 */
120
121#ifdef __DECC
122#pragma message save
123#pragma message disable DOLLARID
124#endif
125
126static int get ( io_channel chan, char *buffer, int maxlen, int *length )
127{
128 int status;
129 struct io_status iosb;
130 status = sys$qiow ( 0, chan, IO$_READVBLK, &iosb, 0, 0,
131 buffer, maxlen, 0, 0, 0, 0 );
132 if ( (status&1) == 1 ) status = iosb.status;
133 if ( (status&1) == 1 ) *length = iosb.count;
134 return status;
135}
136
137static int put ( io_channel chan, char *buffer, int length )
138{
139 int status;
140 struct io_status iosb;
141 status = sys$qiow ( 0, chan, IO$_WRITEVBLK, &iosb, 0, 0,
142 buffer, length, 0, 0, 0, 0 );
143 if ( (status&1) == 1 ) status = iosb.status;
144 return status;
145}
146
147#ifdef __DECC
148#pragma message restore
149#endif
150
151/***************************************************************************/
152
153static int rtcp_new(BIO *bi)
154{
155 struct rpc_ctx *ctx;
156 bi->init=1;
157 bi->num=0;
158 bi->flags = 0;
159 bi->ptr=OPENSSL_malloc(sizeof(struct rpc_ctx));
160 ctx = (struct rpc_ctx *) bi->ptr;
161 ctx->filled = 0;
162 ctx->pos = 0;
163 return(1);
164}
165
166static int rtcp_free(BIO *a)
167{
168 if (a == NULL) return(0);
169 if ( a->ptr ) OPENSSL_free ( a->ptr );
170 a->ptr = NULL;
171 return(1);
172}
173
174static int rtcp_read(BIO *b, char *out, int outl)
175{
176 int status, length;
177 struct rpc_ctx *ctx;
178 /*
179 * read data, return existing.
180 */
181 ctx = (struct rpc_ctx *) b->ptr;
182 if ( ctx->pos < ctx->filled ) {
183 length = ctx->filled - ctx->pos;
184 if ( length > outl ) length = outl;
185 memmove ( out, &ctx->msg.data[ctx->pos], length );
186 ctx->pos += length;
187 return length;
188 }
189 /*
190 * Requst more data from R channel.
191 */
192 ctx->msg.channel = 'R';
193 ctx->msg.function = 'G';
194 ctx->msg.length = sizeof(ctx->msg.data);
195 status = put ( b->num, (char *) &ctx->msg, RPC_HDR_SIZE );
196 if ( (status&1) == 0 ) {
197 return -1;
198 }
199 /*
200 * Read.
201 */
202 ctx->pos = ctx->filled = 0;
203 status = get ( b->num, (char *) &ctx->msg, sizeof(ctx->msg), &length );
204 if ( (status&1) == 0 ) length = -1;
205 if ( ctx->msg.channel != 'R' || ctx->msg.function != 'C' ) {
206 length = -1;
207 }
208 ctx->filled = length - RPC_HDR_SIZE;
209
210 if ( ctx->pos < ctx->filled ) {
211 length = ctx->filled - ctx->pos;
212 if ( length > outl ) length = outl;
213 memmove ( out, ctx->msg.data, length );
214 ctx->pos += length;
215 return length;
216 }
217
218 return length;
219}
220
221static int rtcp_write(BIO *b, const char *in, int inl)
222{
223 int status, i, segment, length;
224 struct rpc_ctx *ctx;
225 /*
226 * Output data, send in chunks no larger that sizeof(ctx->msg.data).
227 */
228 ctx = (struct rpc_ctx *) b->ptr;
229 for ( i = 0; i < inl; i += segment ) {
230 segment = inl - i;
231 if ( segment > sizeof(ctx->msg.data) ) segment = sizeof(ctx->msg.data);
232 ctx->msg.channel = 'R';
233 ctx->msg.function = 'P';
234 ctx->msg.length = segment;
235 memmove ( ctx->msg.data, &in[i], segment );
236 status = put ( b->num, (char *) &ctx->msg, segment + RPC_HDR_SIZE );
237 if ((status&1) == 0 ) { i = -1; break; }
238
239 status = get ( b->num, (char *) &ctx->msg, sizeof(ctx->msg), &length );
240 if ( ((status&1) == 0) || (length < RPC_HDR_SIZE) ) { i = -1; break; }
241 if ( (ctx->msg.channel != 'R') || (ctx->msg.function != 'C') ) {
242 printf("unexpected response when confirming put %c %c\n",
243 ctx->msg.channel, ctx->msg.function );
244
245 }
246 }
247 return(i);
248}
249
250static long rtcp_ctrl(BIO *b, int cmd, long num, void *ptr)
251 {
252 long ret=1;
253
254 switch (cmd)
255 {
256 case BIO_CTRL_RESET:
257 case BIO_CTRL_EOF:
258 ret = 1;
259 break;
260 case BIO_C_SET_FD:
261 b->num = num;
262 ret = 1;
263 break;
264 case BIO_CTRL_SET_CLOSE:
265 case BIO_CTRL_FLUSH:
266 case BIO_CTRL_DUP:
267 ret=1;
268 break;
269 case BIO_CTRL_GET_CLOSE:
270 case BIO_CTRL_INFO:
271 case BIO_CTRL_GET:
272 case BIO_CTRL_PENDING:
273 case BIO_CTRL_WPENDING:
274 default:
275 ret=0;
276 break;
277 }
278 return(ret);
279 }
280
281static int rtcp_gets(BIO *bp, char *buf, int size)
282 {
283 return(0);
284 }
285
286static int rtcp_puts(BIO *bp, const char *str)
287{
288 int length;
289 if (str == NULL) return(0);
290 length = strlen ( str );
291 if ( length == 0 ) return (0);
292 return rtcp_write ( bp,str, length );
293}
294
diff --git a/src/lib/libcrypto/bn/Makefile b/src/lib/libcrypto/bn/Makefile
new file mode 100644
index 0000000000..672773454c
--- /dev/null
+++ b/src/lib/libcrypto/bn/Makefile
@@ -0,0 +1,375 @@
1#
2# OpenSSL/crypto/bn/Makefile
3#
4
5DIR= bn
6TOP= ../..
7CC= cc
8CPP= $(CC) -E
9INCLUDES= -I.. -I$(TOP) -I../../include
10CFLAG=-g
11MAKEFILE= Makefile
12AR= ar r
13
14BN_ASM= bn_asm.o
15
16CFLAGS= $(INCLUDES) $(CFLAG)
17ASFLAGS= $(INCLUDES) $(ASFLAG)
18AFLAGS= $(ASFLAGS)
19
20GENERAL=Makefile
21TEST=bntest.c exptest.c
22APPS=
23
24LIB=$(TOP)/libcrypto.a
25LIBSRC= bn_add.c bn_div.c bn_exp.c bn_lib.c bn_ctx.c bn_mul.c bn_mod.c \
26 bn_print.c bn_rand.c bn_shift.c bn_word.c bn_blind.c \
27 bn_kron.c bn_sqrt.c bn_gcd.c bn_prime.c bn_err.c bn_sqr.c bn_asm.c \
28 bn_recp.c bn_mont.c bn_mpi.c bn_exp2.c bn_gf2m.c bn_nist.c \
29 bn_depr.c bn_const.c bn_x931p.c
30
31LIBOBJ= bn_add.o bn_div.o bn_exp.o bn_lib.o bn_ctx.o bn_mul.o bn_mod.o \
32 bn_print.o bn_rand.o bn_shift.o bn_word.o bn_blind.o \
33 bn_kron.o bn_sqrt.o bn_gcd.o bn_prime.o bn_err.o bn_sqr.o $(BN_ASM) \
34 bn_recp.o bn_mont.o bn_mpi.o bn_exp2.o bn_gf2m.o bn_nist.o \
35 bn_depr.o bn_const.o bn_x931p.o
36
37SRC= $(LIBSRC)
38
39EXHEADER= bn.h
40HEADER= bn_lcl.h bn_prime.h $(EXHEADER)
41
42ALL= $(GENERAL) $(SRC) $(HEADER)
43
44top:
45 (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all)
46
47all: lib
48
49bn_prime.h: bn_prime.pl
50 $(PERL) bn_prime.pl >bn_prime.h
51
52divtest: divtest.c ../../libcrypto.a
53 cc -I../../include divtest.c -o divtest ../../libcrypto.a
54
55bnbug: bnbug.c ../../libcrypto.a top
56 cc -g -I../../include bnbug.c -o bnbug ../../libcrypto.a
57
58lib: $(LIBOBJ)
59 $(AR) $(LIB) $(LIBOBJ)
60 $(RANLIB) $(LIB) || echo Never mind.
61 @touch lib
62
63bn-586.s: asm/bn-586.pl ../perlasm/x86asm.pl
64 $(PERL) asm/bn-586.pl $(PERLASM_SCHEME) $(CFLAGS) $(PROCESSOR) > $@
65co-586.s: asm/co-586.pl ../perlasm/x86asm.pl
66 $(PERL) asm/co-586.pl $(PERLASM_SCHEME) $(CFLAGS) $(PROCESSOR) > $@
67x86-mont.s: asm/x86-mont.pl ../perlasm/x86asm.pl
68 $(PERL) asm/x86-mont.pl $(PERLASM_SCHEME) $(CFLAGS) $(PROCESSOR) > $@
69x86-gf2m.s: asm/x86-gf2m.pl ../perlasm/x86asm.pl
70 $(PERL) asm/x86-gf2m.pl $(PERLASM_SCHEME) $(CFLAGS) $(PROCESSOR) > $@
71
72sparcv8.o: asm/sparcv8.S
73 $(CC) $(CFLAGS) -c asm/sparcv8.S
74bn-sparcv9.o: asm/sparcv8plus.S
75 $(CC) $(CFLAGS) -c -o $@ asm/sparcv8plus.S
76sparcv9a-mont.s: asm/sparcv9a-mont.pl
77 $(PERL) asm/sparcv9a-mont.pl $(CFLAGS) > $@
78sparcv9-mont.s: asm/sparcv9-mont.pl
79 $(PERL) asm/sparcv9-mont.pl $(CFLAGS) > $@
80
81bn-mips3.o: asm/mips3.s
82 @if [ "$(CC)" = "gcc" ]; then \
83 ABI=`expr "$(CFLAGS)" : ".*-mabi=\([n3264]*\)"` && \
84 as -$$ABI -O -o $@ asm/mips3.s; \
85 else $(CC) -c $(CFLAGS) -o $@ asm/mips3.s; fi
86
87bn-mips.s: asm/mips.pl
88 $(PERL) asm/mips.pl $(PERLASM_SCHEME) $@
89mips-mont.s: asm/mips-mont.pl
90 $(PERL) asm/mips-mont.pl $(PERLASM_SCHEME) $@
91
92bn-s390x.o: asm/s390x.S
93 $(CC) $(CFLAGS) -c -o $@ asm/s390x.S
94s390x-gf2m.s: asm/s390x-gf2m.pl
95 $(PERL) asm/s390x-gf2m.pl $(PERLASM_SCHEME) $@
96
97x86_64-gcc.o: asm/x86_64-gcc.c
98 $(CC) $(CFLAGS) -c -o $@ asm/x86_64-gcc.c
99x86_64-mont.s: asm/x86_64-mont.pl
100 $(PERL) asm/x86_64-mont.pl $(PERLASM_SCHEME) > $@
101x86_64-mont5.s: asm/x86_64-mont5.pl
102 $(PERL) asm/x86_64-mont5.pl $(PERLASM_SCHEME) > $@
103x86_64-gf2m.s: asm/x86_64-gf2m.pl
104 $(PERL) asm/x86_64-gf2m.pl $(PERLASM_SCHEME) > $@
105modexp512-x86_64.s: asm/modexp512-x86_64.pl
106 $(PERL) asm/modexp512-x86_64.pl $(PERLASM_SCHEME) > $@
107
108bn-ia64.s: asm/ia64.S
109 $(CC) $(CFLAGS) -E asm/ia64.S > $@
110ia64-mont.s: asm/ia64-mont.pl
111 $(PERL) asm/ia64-mont.pl $@ $(CFLAGS)
112
113# GNU assembler fails to compile PA-RISC2 modules, insist on calling
114# vendor assembler...
115pa-risc2W.o: asm/pa-risc2W.s
116 /usr/ccs/bin/as -o pa-risc2W.o asm/pa-risc2W.s
117pa-risc2.o: asm/pa-risc2.s
118 /usr/ccs/bin/as -o pa-risc2.o asm/pa-risc2.s
119parisc-mont.s: asm/parisc-mont.pl
120 $(PERL) asm/parisc-mont.pl $(PERLASM_SCHEME) $@
121
122# ppc - AIX, Linux, MacOS X...
123bn-ppc.s: asm/ppc.pl; $(PERL) asm/ppc.pl $(PERLASM_SCHEME) $@
124ppc-mont.s: asm/ppc-mont.pl;$(PERL) asm/ppc-mont.pl $(PERLASM_SCHEME) $@
125ppc64-mont.s: asm/ppc64-mont.pl;$(PERL) asm/ppc64-mont.pl $(PERLASM_SCHEME) $@
126
127alpha-mont.s: asm/alpha-mont.pl
128 $(PERL) $< | $(CC) -E - | tee $@ > /dev/null
129
130# GNU make "catch all"
131%-mont.s: asm/%-mont.pl; $(PERL) $< $(PERLASM_SCHEME) $@
132%-gf2m.S: asm/%-gf2m.pl; $(PERL) $< $(PERLASM_SCHEME) $@
133
134armv4-gf2m.o: armv4-gf2m.S
135
136files:
137 $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
138
139links:
140 @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
141 @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
142 @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
143
144install:
145 @[ -n "$(INSTALLTOP)" ] # should be set by top Makefile...
146 @headerlist="$(EXHEADER)"; for i in $$headerlist ; \
147 do \
148 (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
149 chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
150 done;
151
152exptest:
153 rm -f exptest
154 gcc -I../../include -g2 -ggdb -o exptest exptest.c ../../libcrypto.a
155
156div:
157 rm -f a.out
158 gcc -I.. -g div.c ../../libcrypto.a
159
160tags:
161 ctags $(SRC)
162
163tests:
164
165lint:
166 lint -DLINT $(INCLUDES) $(SRC)>fluff
167
168depend:
169 @[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile...
170 $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
171
172dclean:
173 $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
174 mv -f Makefile.new $(MAKEFILE)
175
176clean:
177 rm -f *.s *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
178
179# DO NOT DELETE THIS LINE -- make depend depends on it.
180
181bn_add.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h
182bn_add.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
183bn_add.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
184bn_add.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
185bn_add.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
186bn_add.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
187bn_add.o: ../../include/openssl/symhacks.h ../cryptlib.h bn_add.c bn_lcl.h
188bn_asm.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h
189bn_asm.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
190bn_asm.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
191bn_asm.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
192bn_asm.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
193bn_asm.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
194bn_asm.o: ../../include/openssl/symhacks.h ../cryptlib.h bn_asm.c bn_lcl.h
195bn_blind.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h
196bn_blind.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
197bn_blind.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
198bn_blind.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
199bn_blind.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
200bn_blind.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
201bn_blind.o: ../../include/openssl/symhacks.h ../cryptlib.h bn_blind.c bn_lcl.h
202bn_const.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
203bn_const.o: ../../include/openssl/opensslconf.h
204bn_const.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
205bn_const.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
206bn_const.o: ../../include/openssl/symhacks.h bn.h bn_const.c
207bn_ctx.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h
208bn_ctx.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
209bn_ctx.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
210bn_ctx.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
211bn_ctx.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
212bn_ctx.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
213bn_ctx.o: ../../include/openssl/symhacks.h ../cryptlib.h bn_ctx.c bn_lcl.h
214bn_depr.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h
215bn_depr.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
216bn_depr.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
217bn_depr.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
218bn_depr.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
219bn_depr.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h
220bn_depr.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
221bn_depr.o: ../cryptlib.h bn_depr.c bn_lcl.h
222bn_div.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h
223bn_div.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
224bn_div.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
225bn_div.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
226bn_div.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
227bn_div.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
228bn_div.o: ../../include/openssl/symhacks.h ../cryptlib.h bn_div.c bn_lcl.h
229bn_err.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
230bn_err.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
231bn_err.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
232bn_err.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
233bn_err.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
234bn_err.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
235bn_err.o: bn_err.c
236bn_exp.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h
237bn_exp.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
238bn_exp.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
239bn_exp.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
240bn_exp.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
241bn_exp.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
242bn_exp.o: ../../include/openssl/symhacks.h ../cryptlib.h bn_exp.c bn_lcl.h
243bn_exp2.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h
244bn_exp2.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
245bn_exp2.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
246bn_exp2.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
247bn_exp2.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
248bn_exp2.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
249bn_exp2.o: ../../include/openssl/symhacks.h ../cryptlib.h bn_exp2.c bn_lcl.h
250bn_gcd.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h
251bn_gcd.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
252bn_gcd.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
253bn_gcd.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
254bn_gcd.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
255bn_gcd.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
256bn_gcd.o: ../../include/openssl/symhacks.h ../cryptlib.h bn_gcd.c bn_lcl.h
257bn_gf2m.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h
258bn_gf2m.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
259bn_gf2m.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
260bn_gf2m.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
261bn_gf2m.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
262bn_gf2m.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
263bn_gf2m.o: ../../include/openssl/symhacks.h ../cryptlib.h bn_gf2m.c bn_lcl.h
264bn_kron.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h
265bn_kron.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
266bn_kron.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
267bn_kron.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
268bn_kron.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
269bn_kron.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
270bn_kron.o: ../../include/openssl/symhacks.h ../cryptlib.h bn_kron.c bn_lcl.h
271bn_lib.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h
272bn_lib.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
273bn_lib.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
274bn_lib.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
275bn_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
276bn_lib.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
277bn_lib.o: ../../include/openssl/symhacks.h ../cryptlib.h bn_lcl.h bn_lib.c
278bn_mod.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h
279bn_mod.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
280bn_mod.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
281bn_mod.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
282bn_mod.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
283bn_mod.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
284bn_mod.o: ../../include/openssl/symhacks.h ../cryptlib.h bn_lcl.h bn_mod.c
285bn_mont.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h
286bn_mont.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
287bn_mont.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
288bn_mont.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
289bn_mont.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
290bn_mont.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
291bn_mont.o: ../../include/openssl/symhacks.h ../cryptlib.h bn_lcl.h bn_mont.c
292bn_mpi.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h
293bn_mpi.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
294bn_mpi.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
295bn_mpi.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
296bn_mpi.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
297bn_mpi.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
298bn_mpi.o: ../../include/openssl/symhacks.h ../cryptlib.h bn_lcl.h bn_mpi.c
299bn_mul.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h
300bn_mul.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
301bn_mul.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
302bn_mul.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
303bn_mul.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
304bn_mul.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
305bn_mul.o: ../../include/openssl/symhacks.h ../cryptlib.h bn_lcl.h bn_mul.c
306bn_nist.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h
307bn_nist.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
308bn_nist.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
309bn_nist.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
310bn_nist.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
311bn_nist.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
312bn_nist.o: ../../include/openssl/symhacks.h ../cryptlib.h bn_lcl.h bn_nist.c
313bn_prime.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h
314bn_prime.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
315bn_prime.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
316bn_prime.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
317bn_prime.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
318bn_prime.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h
319bn_prime.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
320bn_prime.o: ../cryptlib.h bn_lcl.h bn_prime.c bn_prime.h
321bn_print.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h
322bn_print.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
323bn_print.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
324bn_print.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
325bn_print.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
326bn_print.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
327bn_print.o: ../../include/openssl/symhacks.h ../cryptlib.h bn_lcl.h bn_print.c
328bn_rand.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h
329bn_rand.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
330bn_rand.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
331bn_rand.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
332bn_rand.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
333bn_rand.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h
334bn_rand.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
335bn_rand.o: ../cryptlib.h bn_lcl.h bn_rand.c
336bn_recp.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h
337bn_recp.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
338bn_recp.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
339bn_recp.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
340bn_recp.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
341bn_recp.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
342bn_recp.o: ../../include/openssl/symhacks.h ../cryptlib.h bn_lcl.h bn_recp.c
343bn_shift.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h
344bn_shift.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
345bn_shift.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
346bn_shift.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
347bn_shift.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
348bn_shift.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
349bn_shift.o: ../../include/openssl/symhacks.h ../cryptlib.h bn_lcl.h bn_shift.c
350bn_sqr.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h
351bn_sqr.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
352bn_sqr.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
353bn_sqr.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
354bn_sqr.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
355bn_sqr.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
356bn_sqr.o: ../../include/openssl/symhacks.h ../cryptlib.h bn_lcl.h bn_sqr.c
357bn_sqrt.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h
358bn_sqrt.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
359bn_sqrt.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
360bn_sqrt.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
361bn_sqrt.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
362bn_sqrt.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
363bn_sqrt.o: ../../include/openssl/symhacks.h ../cryptlib.h bn_lcl.h bn_sqrt.c
364bn_word.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h
365bn_word.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
366bn_word.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
367bn_word.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
368bn_word.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
369bn_word.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
370bn_word.o: ../../include/openssl/symhacks.h ../cryptlib.h bn_lcl.h bn_word.c
371bn_x931p.o: ../../include/openssl/bn.h ../../include/openssl/crypto.h
372bn_x931p.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslconf.h
373bn_x931p.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
374bn_x931p.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
375bn_x931p.o: ../../include/openssl/symhacks.h bn_x931p.c
diff --git a/src/lib/libcrypto/bn/asm/README b/src/lib/libcrypto/bn/asm/README
new file mode 100644
index 0000000000..b0f3a68a06
--- /dev/null
+++ b/src/lib/libcrypto/bn/asm/README
@@ -0,0 +1,27 @@
1<OBSOLETE>
2
3All assember in this directory are just version of the file
4crypto/bn/bn_asm.c.
5
6Quite a few of these files are just the assember output from gcc since on
7quite a few machines they are 2 times faster than the system compiler.
8
9For the x86, I have hand written assember because of the bad job all
10compilers seem to do on it. This normally gives a 2 time speed up in the RSA
11routines.
12
13For the DEC alpha, I also hand wrote the assember (except the division which
14is just the output from the C compiler pasted on the end of the file).
15On the 2 alpha C compilers I had access to, it was not possible to do
1664b x 64b -> 128b calculations (both long and the long long data types
17were 64 bits). So the hand assember gives access to the 128 bit result and
18a 2 times speedup :-).
19
20There are 3 versions of assember for the HP PA-RISC.
21
22pa-risc.s is the origional one which works fine and generated using gcc :-)
23
24pa-risc2W.s and pa-risc2.s are 64 and 32-bit PA-RISC 2.0 implementations
25by Chris Ruemmler from HP (with some help from the HP C compiler).
26
27</OBSOLETE>
diff --git a/src/lib/libcrypto/bn/asm/mips3-mont.pl b/src/lib/libcrypto/bn/asm/mips3-mont.pl
new file mode 100644
index 0000000000..8f9156e02a
--- /dev/null
+++ b/src/lib/libcrypto/bn/asm/mips3-mont.pl
@@ -0,0 +1,327 @@
1#!/usr/bin/env perl
2#
3# ====================================================================
4# Written by Andy Polyakov <appro@fy.chalmers.se> for the OpenSSL
5# project. The module is, however, dual licensed under OpenSSL and
6# CRYPTOGAMS licenses depending on where you obtain it. For further
7# details see http://www.openssl.org/~appro/cryptogams/.
8# ====================================================================
9
10# This module doesn't present direct interest for OpenSSL, because it
11# doesn't provide better performance for longer keys. While 512-bit
12# RSA private key operations are 40% faster, 1024-bit ones are hardly
13# faster at all, while longer key operations are slower by up to 20%.
14# It might be of interest to embedded system developers though, as
15# it's smaller than 1KB, yet offers ~3x improvement over compiler
16# generated code.
17#
18# The module targets N32 and N64 MIPS ABIs and currently is a bit
19# IRIX-centric, i.e. is likely to require adaptation for other OSes.
20
21# int bn_mul_mont(
22$rp="a0"; # BN_ULONG *rp,
23$ap="a1"; # const BN_ULONG *ap,
24$bp="a2"; # const BN_ULONG *bp,
25$np="a3"; # const BN_ULONG *np,
26$n0="a4"; # const BN_ULONG *n0,
27$num="a5"; # int num);
28
29$lo0="a6";
30$hi0="a7";
31$lo1="v0";
32$hi1="v1";
33$aj="t0";
34$bi="t1";
35$nj="t2";
36$tp="t3";
37$alo="s0";
38$ahi="s1";
39$nlo="s2";
40$nhi="s3";
41$tj="s4";
42$i="s5";
43$j="s6";
44$fp="t8";
45$m1="t9";
46
47$FRAME=8*(2+8);
48
49$code=<<___;
50#include <asm.h>
51#include <regdef.h>
52
53.text
54
55.set noat
56.set reorder
57
58.align 5
59.globl bn_mul_mont
60.ent bn_mul_mont
61bn_mul_mont:
62 .set noreorder
63 PTR_SUB sp,64
64 move $fp,sp
65 .frame $fp,64,ra
66 slt AT,$num,4
67 li v0,0
68 beqzl AT,.Lproceed
69 nop
70 jr ra
71 PTR_ADD sp,$fp,64
72 .set reorder
73.align 5
74.Lproceed:
75 ld $n0,0($n0)
76 ld $bi,0($bp) # bp[0]
77 ld $aj,0($ap) # ap[0]
78 ld $nj,0($np) # np[0]
79 PTR_SUB sp,16 # place for two extra words
80 sll $num,3
81 li AT,-4096
82 PTR_SUB sp,$num
83 and sp,AT
84
85 sd s0,0($fp)
86 sd s1,8($fp)
87 sd s2,16($fp)
88 sd s3,24($fp)
89 sd s4,32($fp)
90 sd s5,40($fp)
91 sd s6,48($fp)
92 sd s7,56($fp)
93
94 dmultu $aj,$bi
95 ld $alo,8($ap)
96 ld $nlo,8($np)
97 mflo $lo0
98 mfhi $hi0
99 dmultu $lo0,$n0
100 mflo $m1
101
102 dmultu $alo,$bi
103 mflo $alo
104 mfhi $ahi
105
106 dmultu $nj,$m1
107 mflo $lo1
108 mfhi $hi1
109 dmultu $nlo,$m1
110 daddu $lo1,$lo0
111 sltu AT,$lo1,$lo0
112 daddu $hi1,AT
113 mflo $nlo
114 mfhi $nhi
115
116 move $tp,sp
117 li $j,16
118.align 4
119.L1st:
120 .set noreorder
121 PTR_ADD $aj,$ap,$j
122 ld $aj,($aj)
123 PTR_ADD $nj,$np,$j
124 ld $nj,($nj)
125
126 dmultu $aj,$bi
127 daddu $lo0,$alo,$hi0
128 daddu $lo1,$nlo,$hi1
129 sltu AT,$lo0,$hi0
130 sltu s7,$lo1,$hi1
131 daddu $hi0,$ahi,AT
132 daddu $hi1,$nhi,s7
133 mflo $alo
134 mfhi $ahi
135
136 daddu $lo1,$lo0
137 sltu AT,$lo1,$lo0
138 dmultu $nj,$m1
139 daddu $hi1,AT
140 addu $j,8
141 sd $lo1,($tp)
142 sltu s7,$j,$num
143 mflo $nlo
144 mfhi $nhi
145
146 bnez s7,.L1st
147 PTR_ADD $tp,8
148 .set reorder
149
150 daddu $lo0,$alo,$hi0
151 sltu AT,$lo0,$hi0
152 daddu $hi0,$ahi,AT
153
154 daddu $lo1,$nlo,$hi1
155 sltu s7,$lo1,$hi1
156 daddu $hi1,$nhi,s7
157 daddu $lo1,$lo0
158 sltu AT,$lo1,$lo0
159 daddu $hi1,AT
160
161 sd $lo1,($tp)
162
163 daddu $hi1,$hi0
164 sltu AT,$hi1,$hi0
165 sd $hi1,8($tp)
166 sd AT,16($tp)
167
168 li $i,8
169.align 4
170.Louter:
171 PTR_ADD $bi,$bp,$i
172 ld $bi,($bi)
173 ld $aj,($ap)
174 ld $alo,8($ap)
175 ld $tj,(sp)
176
177 dmultu $aj,$bi
178 ld $nj,($np)
179 ld $nlo,8($np)
180 mflo $lo0
181 mfhi $hi0
182 daddu $lo0,$tj
183 dmultu $lo0,$n0
184 sltu AT,$lo0,$tj
185 daddu $hi0,AT
186 mflo $m1
187
188 dmultu $alo,$bi
189 mflo $alo
190 mfhi $ahi
191
192 dmultu $nj,$m1
193 mflo $lo1
194 mfhi $hi1
195
196 dmultu $nlo,$m1
197 daddu $lo1,$lo0
198 sltu AT,$lo1,$lo0
199 daddu $hi1,AT
200 mflo $nlo
201 mfhi $nhi
202
203 move $tp,sp
204 li $j,16
205 ld $tj,8($tp)
206.align 4
207.Linner:
208 .set noreorder
209 PTR_ADD $aj,$ap,$j
210 ld $aj,($aj)
211 PTR_ADD $nj,$np,$j
212 ld $nj,($nj)
213
214 dmultu $aj,$bi
215 daddu $lo0,$alo,$hi0
216 daddu $lo1,$nlo,$hi1
217 sltu AT,$lo0,$hi0
218 sltu s7,$lo1,$hi1
219 daddu $hi0,$ahi,AT
220 daddu $hi1,$nhi,s7
221 mflo $alo
222 mfhi $ahi
223
224 daddu $lo0,$tj
225 addu $j,8
226 dmultu $nj,$m1
227 sltu AT,$lo0,$tj
228 daddu $lo1,$lo0
229 daddu $hi0,AT
230 sltu s7,$lo1,$lo0
231 ld $tj,16($tp)
232 daddu $hi1,s7
233 sltu AT,$j,$num
234 mflo $nlo
235 mfhi $nhi
236 sd $lo1,($tp)
237 bnez AT,.Linner
238 PTR_ADD $tp,8
239 .set reorder
240
241 daddu $lo0,$alo,$hi0
242 sltu AT,$lo0,$hi0
243 daddu $hi0,$ahi,AT
244 daddu $lo0,$tj
245 sltu s7,$lo0,$tj
246 daddu $hi0,s7
247
248 ld $tj,16($tp)
249 daddu $lo1,$nlo,$hi1
250 sltu AT,$lo1,$hi1
251 daddu $hi1,$nhi,AT
252 daddu $lo1,$lo0
253 sltu s7,$lo1,$lo0
254 daddu $hi1,s7
255 sd $lo1,($tp)
256
257 daddu $lo1,$hi1,$hi0
258 sltu $hi1,$lo1,$hi0
259 daddu $lo1,$tj
260 sltu AT,$lo1,$tj
261 daddu $hi1,AT
262 sd $lo1,8($tp)
263 sd $hi1,16($tp)
264
265 addu $i,8
266 sltu s7,$i,$num
267 bnez s7,.Louter
268
269 .set noreorder
270 PTR_ADD $tj,sp,$num # &tp[num]
271 move $tp,sp
272 move $ap,sp
273 li $hi0,0 # clear borrow bit
274
275.align 4
276.Lsub: ld $lo0,($tp)
277 ld $lo1,($np)
278 PTR_ADD $tp,8
279 PTR_ADD $np,8
280 dsubu $lo1,$lo0,$lo1 # tp[i]-np[i]
281 sgtu AT,$lo1,$lo0
282 dsubu $lo0,$lo1,$hi0
283 sgtu $hi0,$lo0,$lo1
284 sd $lo0,($rp)
285 or $hi0,AT
286 sltu AT,$tp,$tj
287 bnez AT,.Lsub
288 PTR_ADD $rp,8
289
290 dsubu $hi0,$hi1,$hi0 # handle upmost overflow bit
291 move $tp,sp
292 PTR_SUB $rp,$num # restore rp
293 not $hi1,$hi0
294
295 and $ap,$hi0,sp
296 and $bp,$hi1,$rp
297 or $ap,$ap,$bp # ap=borrow?tp:rp
298
299.align 4
300.Lcopy: ld $aj,($ap)
301 PTR_ADD $ap,8
302 PTR_ADD $tp,8
303 sd zero,-8($tp)
304 sltu AT,$tp,$tj
305 sd $aj,($rp)
306 bnez AT,.Lcopy
307 PTR_ADD $rp,8
308
309 ld s0,0($fp)
310 ld s1,8($fp)
311 ld s2,16($fp)
312 ld s3,24($fp)
313 ld s4,32($fp)
314 ld s5,40($fp)
315 ld s6,48($fp)
316 ld s7,56($fp)
317 li v0,1
318 jr ra
319 PTR_ADD sp,$fp,64
320 .set reorder
321END(bn_mul_mont)
322.rdata
323.asciiz "Montgomery Multiplication for MIPS III/IV, CRYPTOGAMS by <appro\@openssl.org>"
324___
325
326print $code;
327close STDOUT;
diff --git a/src/lib/libcrypto/bn/asm/mips3.s b/src/lib/libcrypto/bn/asm/mips3.s
new file mode 100644
index 0000000000..dca4105c7d
--- /dev/null
+++ b/src/lib/libcrypto/bn/asm/mips3.s
@@ -0,0 +1,2201 @@
1.rdata
2.asciiz "mips3.s, Version 1.1"
3.asciiz "MIPS III/IV ISA artwork by Andy Polyakov <appro@fy.chalmers.se>"
4
5/*
6 * ====================================================================
7 * Written by Andy Polyakov <appro@fy.chalmers.se> for the OpenSSL
8 * project.
9 *
10 * Rights for redistribution and usage in source and binary forms are
11 * granted according to the OpenSSL license. Warranty of any kind is
12 * disclaimed.
13 * ====================================================================
14 */
15
16/*
17 * This is my modest contributon to the OpenSSL project (see
18 * http://www.openssl.org/ for more information about it) and is
19 * a drop-in MIPS III/IV ISA replacement for crypto/bn/bn_asm.c
20 * module. For updates see http://fy.chalmers.se/~appro/hpe/.
21 *
22 * The module is designed to work with either of the "new" MIPS ABI(5),
23 * namely N32 or N64, offered by IRIX 6.x. It's not ment to work under
24 * IRIX 5.x not only because it doesn't support new ABIs but also
25 * because 5.x kernels put R4x00 CPU into 32-bit mode and all those
26 * 64-bit instructions (daddu, dmultu, etc.) found below gonna only
27 * cause illegal instruction exception:-(
28 *
29 * In addition the code depends on preprocessor flags set up by MIPSpro
30 * compiler driver (either as or cc) and therefore (probably?) can't be
31 * compiled by the GNU assembler. GNU C driver manages fine though...
32 * I mean as long as -mmips-as is specified or is the default option,
33 * because then it simply invokes /usr/bin/as which in turn takes
34 * perfect care of the preprocessor definitions. Another neat feature
35 * offered by the MIPSpro assembler is an optimization pass. This gave
36 * me the opportunity to have the code looking more regular as all those
37 * architecture dependent instruction rescheduling details were left to
38 * the assembler. Cool, huh?
39 *
40 * Performance improvement is astonishing! 'apps/openssl speed rsa dsa'
41 * goes way over 3 times faster!
42 *
43 * <appro@fy.chalmers.se>
44 */
45#include <asm.h>
46#include <regdef.h>
47
48#if _MIPS_ISA>=4
49#define MOVNZ(cond,dst,src) \
50 movn dst,src,cond
51#else
52#define MOVNZ(cond,dst,src) \
53 .set noreorder; \
54 bnezl cond,.+8; \
55 move dst,src; \
56 .set reorder
57#endif
58
59.text
60
61.set noat
62.set reorder
63
64#define MINUS4 v1
65
66.align 5
67LEAF(bn_mul_add_words)
68 .set noreorder
69 bgtzl a2,.L_bn_mul_add_words_proceed
70 ld t0,0(a1)
71 jr ra
72 move v0,zero
73 .set reorder
74
75.L_bn_mul_add_words_proceed:
76 li MINUS4,-4
77 and ta0,a2,MINUS4
78 move v0,zero
79 beqz ta0,.L_bn_mul_add_words_tail
80
81.L_bn_mul_add_words_loop:
82 dmultu t0,a3
83 ld t1,0(a0)
84 ld t2,8(a1)
85 ld t3,8(a0)
86 ld ta0,16(a1)
87 ld ta1,16(a0)
88 daddu t1,v0
89 sltu v0,t1,v0 /* All manuals say it "compares 32-bit
90 * values", but it seems to work fine
91 * even on 64-bit registers. */
92 mflo AT
93 mfhi t0
94 daddu t1,AT
95 daddu v0,t0
96 sltu AT,t1,AT
97 sd t1,0(a0)
98 daddu v0,AT
99
100 dmultu t2,a3
101 ld ta2,24(a1)
102 ld ta3,24(a0)
103 daddu t3,v0
104 sltu v0,t3,v0
105 mflo AT
106 mfhi t2
107 daddu t3,AT
108 daddu v0,t2
109 sltu AT,t3,AT
110 sd t3,8(a0)
111 daddu v0,AT
112
113 dmultu ta0,a3
114 subu a2,4
115 PTR_ADD a0,32
116 PTR_ADD a1,32
117 daddu ta1,v0
118 sltu v0,ta1,v0
119 mflo AT
120 mfhi ta0
121 daddu ta1,AT
122 daddu v0,ta0
123 sltu AT,ta1,AT
124 sd ta1,-16(a0)
125 daddu v0,AT
126
127
128 dmultu ta2,a3
129 and ta0,a2,MINUS4
130 daddu ta3,v0
131 sltu v0,ta3,v0
132 mflo AT
133 mfhi ta2
134 daddu ta3,AT
135 daddu v0,ta2
136 sltu AT,ta3,AT
137 sd ta3,-8(a0)
138 daddu v0,AT
139 .set noreorder
140 bgtzl ta0,.L_bn_mul_add_words_loop
141 ld t0,0(a1)
142
143 bnezl a2,.L_bn_mul_add_words_tail
144 ld t0,0(a1)
145 .set reorder
146
147.L_bn_mul_add_words_return:
148 jr ra
149
150.L_bn_mul_add_words_tail:
151 dmultu t0,a3
152 ld t1,0(a0)
153 subu a2,1
154 daddu t1,v0
155 sltu v0,t1,v0
156 mflo AT
157 mfhi t0
158 daddu t1,AT
159 daddu v0,t0
160 sltu AT,t1,AT
161 sd t1,0(a0)
162 daddu v0,AT
163 beqz a2,.L_bn_mul_add_words_return
164
165 ld t0,8(a1)
166 dmultu t0,a3
167 ld t1,8(a0)
168 subu a2,1
169 daddu t1,v0
170 sltu v0,t1,v0
171 mflo AT
172 mfhi t0
173 daddu t1,AT
174 daddu v0,t0
175 sltu AT,t1,AT
176 sd t1,8(a0)
177 daddu v0,AT
178 beqz a2,.L_bn_mul_add_words_return
179
180 ld t0,16(a1)
181 dmultu t0,a3
182 ld t1,16(a0)
183 daddu t1,v0
184 sltu v0,t1,v0
185 mflo AT
186 mfhi t0
187 daddu t1,AT
188 daddu v0,t0
189 sltu AT,t1,AT
190 sd t1,16(a0)
191 daddu v0,AT
192 jr ra
193END(bn_mul_add_words)
194
195.align 5
196LEAF(bn_mul_words)
197 .set noreorder
198 bgtzl a2,.L_bn_mul_words_proceed
199 ld t0,0(a1)
200 jr ra
201 move v0,zero
202 .set reorder
203
204.L_bn_mul_words_proceed:
205 li MINUS4,-4
206 and ta0,a2,MINUS4
207 move v0,zero
208 beqz ta0,.L_bn_mul_words_tail
209
210.L_bn_mul_words_loop:
211 dmultu t0,a3
212 ld t2,8(a1)
213 ld ta0,16(a1)
214 ld ta2,24(a1)
215 mflo AT
216 mfhi t0
217 daddu v0,AT
218 sltu t1,v0,AT
219 sd v0,0(a0)
220 daddu v0,t1,t0
221
222 dmultu t2,a3
223 subu a2,4
224 PTR_ADD a0,32
225 PTR_ADD a1,32
226 mflo AT
227 mfhi t2
228 daddu v0,AT
229 sltu t3,v0,AT
230 sd v0,-24(a0)
231 daddu v0,t3,t2
232
233 dmultu ta0,a3
234 mflo AT
235 mfhi ta0
236 daddu v0,AT
237 sltu ta1,v0,AT
238 sd v0,-16(a0)
239 daddu v0,ta1,ta0
240
241
242 dmultu ta2,a3
243 and ta0,a2,MINUS4
244 mflo AT
245 mfhi ta2
246 daddu v0,AT
247 sltu ta3,v0,AT
248 sd v0,-8(a0)
249 daddu v0,ta3,ta2
250 .set noreorder
251 bgtzl ta0,.L_bn_mul_words_loop
252 ld t0,0(a1)
253
254 bnezl a2,.L_bn_mul_words_tail
255 ld t0,0(a1)
256 .set reorder
257
258.L_bn_mul_words_return:
259 jr ra
260
261.L_bn_mul_words_tail:
262 dmultu t0,a3
263 subu a2,1
264 mflo AT
265 mfhi t0
266 daddu v0,AT
267 sltu t1,v0,AT
268 sd v0,0(a0)
269 daddu v0,t1,t0
270 beqz a2,.L_bn_mul_words_return
271
272 ld t0,8(a1)
273 dmultu t0,a3
274 subu a2,1
275 mflo AT
276 mfhi t0
277 daddu v0,AT
278 sltu t1,v0,AT
279 sd v0,8(a0)
280 daddu v0,t1,t0
281 beqz a2,.L_bn_mul_words_return
282
283 ld t0,16(a1)
284 dmultu t0,a3
285 mflo AT
286 mfhi t0
287 daddu v0,AT
288 sltu t1,v0,AT
289 sd v0,16(a0)
290 daddu v0,t1,t0
291 jr ra
292END(bn_mul_words)
293
294.align 5
295LEAF(bn_sqr_words)
296 .set noreorder
297 bgtzl a2,.L_bn_sqr_words_proceed
298 ld t0,0(a1)
299 jr ra
300 move v0,zero
301 .set reorder
302
303.L_bn_sqr_words_proceed:
304 li MINUS4,-4
305 and ta0,a2,MINUS4
306 move v0,zero
307 beqz ta0,.L_bn_sqr_words_tail
308
309.L_bn_sqr_words_loop:
310 dmultu t0,t0
311 ld t2,8(a1)
312 ld ta0,16(a1)
313 ld ta2,24(a1)
314 mflo t1
315 mfhi t0
316 sd t1,0(a0)
317 sd t0,8(a0)
318
319 dmultu t2,t2
320 subu a2,4
321 PTR_ADD a0,64
322 PTR_ADD a1,32
323 mflo t3
324 mfhi t2
325 sd t3,-48(a0)
326 sd t2,-40(a0)
327
328 dmultu ta0,ta0
329 mflo ta1
330 mfhi ta0
331 sd ta1,-32(a0)
332 sd ta0,-24(a0)
333
334
335 dmultu ta2,ta2
336 and ta0,a2,MINUS4
337 mflo ta3
338 mfhi ta2
339 sd ta3,-16(a0)
340 sd ta2,-8(a0)
341
342 .set noreorder
343 bgtzl ta0,.L_bn_sqr_words_loop
344 ld t0,0(a1)
345
346 bnezl a2,.L_bn_sqr_words_tail
347 ld t0,0(a1)
348 .set reorder
349
350.L_bn_sqr_words_return:
351 move v0,zero
352 jr ra
353
354.L_bn_sqr_words_tail:
355 dmultu t0,t0
356 subu a2,1
357 mflo t1
358 mfhi t0
359 sd t1,0(a0)
360 sd t0,8(a0)
361 beqz a2,.L_bn_sqr_words_return
362
363 ld t0,8(a1)
364 dmultu t0,t0
365 subu a2,1
366 mflo t1
367 mfhi t0
368 sd t1,16(a0)
369 sd t0,24(a0)
370 beqz a2,.L_bn_sqr_words_return
371
372 ld t0,16(a1)
373 dmultu t0,t0
374 mflo t1
375 mfhi t0
376 sd t1,32(a0)
377 sd t0,40(a0)
378 jr ra
379END(bn_sqr_words)
380
381.align 5
382LEAF(bn_add_words)
383 .set noreorder
384 bgtzl a3,.L_bn_add_words_proceed
385 ld t0,0(a1)
386 jr ra
387 move v0,zero
388 .set reorder
389
390.L_bn_add_words_proceed:
391 li MINUS4,-4
392 and AT,a3,MINUS4
393 move v0,zero
394 beqz AT,.L_bn_add_words_tail
395
396.L_bn_add_words_loop:
397 ld ta0,0(a2)
398 subu a3,4
399 ld t1,8(a1)
400 and AT,a3,MINUS4
401 ld t2,16(a1)
402 PTR_ADD a2,32
403 ld t3,24(a1)
404 PTR_ADD a0,32
405 ld ta1,-24(a2)
406 PTR_ADD a1,32
407 ld ta2,-16(a2)
408 ld ta3,-8(a2)
409 daddu ta0,t0
410 sltu t8,ta0,t0
411 daddu t0,ta0,v0
412 sltu v0,t0,ta0
413 sd t0,-32(a0)
414 daddu v0,t8
415
416 daddu ta1,t1
417 sltu t9,ta1,t1
418 daddu t1,ta1,v0
419 sltu v0,t1,ta1
420 sd t1,-24(a0)
421 daddu v0,t9
422
423 daddu ta2,t2
424 sltu t8,ta2,t2
425 daddu t2,ta2,v0
426 sltu v0,t2,ta2
427 sd t2,-16(a0)
428 daddu v0,t8
429
430 daddu ta3,t3
431 sltu t9,ta3,t3
432 daddu t3,ta3,v0
433 sltu v0,t3,ta3
434 sd t3,-8(a0)
435 daddu v0,t9
436
437 .set noreorder
438 bgtzl AT,.L_bn_add_words_loop
439 ld t0,0(a1)
440
441 bnezl a3,.L_bn_add_words_tail
442 ld t0,0(a1)
443 .set reorder
444
445.L_bn_add_words_return:
446 jr ra
447
448.L_bn_add_words_tail:
449 ld ta0,0(a2)
450 daddu ta0,t0
451 subu a3,1
452 sltu t8,ta0,t0
453 daddu t0,ta0,v0
454 sltu v0,t0,ta0
455 sd t0,0(a0)
456 daddu v0,t8
457 beqz a3,.L_bn_add_words_return
458
459 ld t1,8(a1)
460 ld ta1,8(a2)
461 daddu ta1,t1
462 subu a3,1
463 sltu t9,ta1,t1
464 daddu t1,ta1,v0
465 sltu v0,t1,ta1
466 sd t1,8(a0)
467 daddu v0,t9
468 beqz a3,.L_bn_add_words_return
469
470 ld t2,16(a1)
471 ld ta2,16(a2)
472 daddu ta2,t2
473 sltu t8,ta2,t2
474 daddu t2,ta2,v0
475 sltu v0,t2,ta2
476 sd t2,16(a0)
477 daddu v0,t8
478 jr ra
479END(bn_add_words)
480
481.align 5
482LEAF(bn_sub_words)
483 .set noreorder
484 bgtzl a3,.L_bn_sub_words_proceed
485 ld t0,0(a1)
486 jr ra
487 move v0,zero
488 .set reorder
489
490.L_bn_sub_words_proceed:
491 li MINUS4,-4
492 and AT,a3,MINUS4
493 move v0,zero
494 beqz AT,.L_bn_sub_words_tail
495
496.L_bn_sub_words_loop:
497 ld ta0,0(a2)
498 subu a3,4
499 ld t1,8(a1)
500 and AT,a3,MINUS4
501 ld t2,16(a1)
502 PTR_ADD a2,32
503 ld t3,24(a1)
504 PTR_ADD a0,32
505 ld ta1,-24(a2)
506 PTR_ADD a1,32
507 ld ta2,-16(a2)
508 ld ta3,-8(a2)
509 sltu t8,t0,ta0
510 dsubu t0,ta0
511 dsubu ta0,t0,v0
512 sd ta0,-32(a0)
513 MOVNZ (t0,v0,t8)
514
515 sltu t9,t1,ta1
516 dsubu t1,ta1
517 dsubu ta1,t1,v0
518 sd ta1,-24(a0)
519 MOVNZ (t1,v0,t9)
520
521
522 sltu t8,t2,ta2
523 dsubu t2,ta2
524 dsubu ta2,t2,v0
525 sd ta2,-16(a0)
526 MOVNZ (t2,v0,t8)
527
528 sltu t9,t3,ta3
529 dsubu t3,ta3
530 dsubu ta3,t3,v0
531 sd ta3,-8(a0)
532 MOVNZ (t3,v0,t9)
533
534 .set noreorder
535 bgtzl AT,.L_bn_sub_words_loop
536 ld t0,0(a1)
537
538 bnezl a3,.L_bn_sub_words_tail
539 ld t0,0(a1)
540 .set reorder
541
542.L_bn_sub_words_return:
543 jr ra
544
545.L_bn_sub_words_tail:
546 ld ta0,0(a2)
547 subu a3,1
548 sltu t8,t0,ta0
549 dsubu t0,ta0
550 dsubu ta0,t0,v0
551 MOVNZ (t0,v0,t8)
552 sd ta0,0(a0)
553 beqz a3,.L_bn_sub_words_return
554
555 ld t1,8(a1)
556 subu a3,1
557 ld ta1,8(a2)
558 sltu t9,t1,ta1
559 dsubu t1,ta1
560 dsubu ta1,t1,v0
561 MOVNZ (t1,v0,t9)
562 sd ta1,8(a0)
563 beqz a3,.L_bn_sub_words_return
564
565 ld t2,16(a1)
566 ld ta2,16(a2)
567 sltu t8,t2,ta2
568 dsubu t2,ta2
569 dsubu ta2,t2,v0
570 MOVNZ (t2,v0,t8)
571 sd ta2,16(a0)
572 jr ra
573END(bn_sub_words)
574
575#undef MINUS4
576
577.align 5
578LEAF(bn_div_3_words)
579 .set reorder
580 move a3,a0 /* we know that bn_div_words doesn't
581 * touch a3, ta2, ta3 and preserves a2
582 * so that we can save two arguments
583 * and return address in registers
584 * instead of stack:-)
585 */
586 ld a0,(a3)
587 move ta2,a1
588 ld a1,-8(a3)
589 bne a0,a2,.L_bn_div_3_words_proceed
590 li v0,-1
591 jr ra
592.L_bn_div_3_words_proceed:
593 move ta3,ra
594 bal bn_div_words
595 move ra,ta3
596 dmultu ta2,v0
597 ld t2,-16(a3)
598 move ta0,zero
599 mfhi t1
600 mflo t0
601 sltu t8,t1,v1
602.L_bn_div_3_words_inner_loop:
603 bnez t8,.L_bn_div_3_words_inner_loop_done
604 sgeu AT,t2,t0
605 seq t9,t1,v1
606 and AT,t9
607 sltu t3,t0,ta2
608 daddu v1,a2
609 dsubu t1,t3
610 dsubu t0,ta2
611 sltu t8,t1,v1
612 sltu ta0,v1,a2
613 or t8,ta0
614 .set noreorder
615 beqzl AT,.L_bn_div_3_words_inner_loop
616 dsubu v0,1
617 .set reorder
618.L_bn_div_3_words_inner_loop_done:
619 jr ra
620END(bn_div_3_words)
621
622.align 5
623LEAF(bn_div_words)
624 .set noreorder
625 bnezl a2,.L_bn_div_words_proceed
626 move v1,zero
627 jr ra
628 li v0,-1 /* I'd rather signal div-by-zero
629 * which can be done with 'break 7' */
630
631.L_bn_div_words_proceed:
632 bltz a2,.L_bn_div_words_body
633 move t9,v1
634 dsll a2,1
635 bgtz a2,.-4
636 addu t9,1
637
638 .set reorder
639 negu t1,t9
640 li t2,-1
641 dsll t2,t1
642 and t2,a0
643 dsrl AT,a1,t1
644 .set noreorder
645 bnezl t2,.+8
646 break 6 /* signal overflow */
647 .set reorder
648 dsll a0,t9
649 dsll a1,t9
650 or a0,AT
651
652#define QT ta0
653#define HH ta1
654#define DH v1
655.L_bn_div_words_body:
656 dsrl DH,a2,32
657 sgeu AT,a0,a2
658 .set noreorder
659 bnezl AT,.+8
660 dsubu a0,a2
661 .set reorder
662
663 li QT,-1
664 dsrl HH,a0,32
665 dsrl QT,32 /* q=0xffffffff */
666 beq DH,HH,.L_bn_div_words_skip_div1
667 ddivu zero,a0,DH
668 mflo QT
669.L_bn_div_words_skip_div1:
670 dmultu a2,QT
671 dsll t3,a0,32
672 dsrl AT,a1,32
673 or t3,AT
674 mflo t0
675 mfhi t1
676.L_bn_div_words_inner_loop1:
677 sltu t2,t3,t0
678 seq t8,HH,t1
679 sltu AT,HH,t1
680 and t2,t8
681 sltu v0,t0,a2
682 or AT,t2
683 .set noreorder
684 beqz AT,.L_bn_div_words_inner_loop1_done
685 dsubu t1,v0
686 dsubu t0,a2
687 b .L_bn_div_words_inner_loop1
688 dsubu QT,1
689 .set reorder
690.L_bn_div_words_inner_loop1_done:
691
692 dsll a1,32
693 dsubu a0,t3,t0
694 dsll v0,QT,32
695
696 li QT,-1
697 dsrl HH,a0,32
698 dsrl QT,32 /* q=0xffffffff */
699 beq DH,HH,.L_bn_div_words_skip_div2
700 ddivu zero,a0,DH
701 mflo QT
702.L_bn_div_words_skip_div2:
703#undef DH
704 dmultu a2,QT
705 dsll t3,a0,32
706 dsrl AT,a1,32
707 or t3,AT
708 mflo t0
709 mfhi t1
710.L_bn_div_words_inner_loop2:
711 sltu t2,t3,t0
712 seq t8,HH,t1
713 sltu AT,HH,t1
714 and t2,t8
715 sltu v1,t0,a2
716 or AT,t2
717 .set noreorder
718 beqz AT,.L_bn_div_words_inner_loop2_done
719 dsubu t1,v1
720 dsubu t0,a2
721 b .L_bn_div_words_inner_loop2
722 dsubu QT,1
723 .set reorder
724.L_bn_div_words_inner_loop2_done:
725#undef HH
726
727 dsubu a0,t3,t0
728 or v0,QT
729 dsrl v1,a0,t9 /* v1 contains remainder if anybody wants it */
730 dsrl a2,t9 /* restore a2 */
731 jr ra
732#undef QT
733END(bn_div_words)
734
735#define a_0 t0
736#define a_1 t1
737#define a_2 t2
738#define a_3 t3
739#define b_0 ta0
740#define b_1 ta1
741#define b_2 ta2
742#define b_3 ta3
743
744#define a_4 s0
745#define a_5 s2
746#define a_6 s4
747#define a_7 a1 /* once we load a[7] we don't need a anymore */
748#define b_4 s1
749#define b_5 s3
750#define b_6 s5
751#define b_7 a2 /* once we load b[7] we don't need b anymore */
752
753#define t_1 t8
754#define t_2 t9
755
756#define c_1 v0
757#define c_2 v1
758#define c_3 a3
759
760#define FRAME_SIZE 48
761
762.align 5
763LEAF(bn_mul_comba8)
764 .set noreorder
765 PTR_SUB sp,FRAME_SIZE
766 .frame sp,64,ra
767 .set reorder
768 ld a_0,0(a1) /* If compiled with -mips3 option on
769 * R5000 box assembler barks on this
770 * line with "shouldn't have mult/div
771 * as last instruction in bb (R10K
772 * bug)" warning. If anybody out there
773 * has a clue about how to circumvent
774 * this do send me a note.
775 * <appro@fy.chalmers.se>
776 */
777 ld b_0,0(a2)
778 ld a_1,8(a1)
779 ld a_2,16(a1)
780 ld a_3,24(a1)
781 ld b_1,8(a2)
782 ld b_2,16(a2)
783 ld b_3,24(a2)
784 dmultu a_0,b_0 /* mul_add_c(a[0],b[0],c1,c2,c3); */
785 sd s0,0(sp)
786 sd s1,8(sp)
787 sd s2,16(sp)
788 sd s3,24(sp)
789 sd s4,32(sp)
790 sd s5,40(sp)
791 mflo c_1
792 mfhi c_2
793
794 dmultu a_0,b_1 /* mul_add_c(a[0],b[1],c2,c3,c1); */
795 ld a_4,32(a1)
796 ld a_5,40(a1)
797 ld a_6,48(a1)
798 ld a_7,56(a1)
799 ld b_4,32(a2)
800 ld b_5,40(a2)
801 mflo t_1
802 mfhi t_2
803 daddu c_2,t_1
804 sltu AT,c_2,t_1
805 daddu c_3,t_2,AT
806 dmultu a_1,b_0 /* mul_add_c(a[1],b[0],c2,c3,c1); */
807 ld b_6,48(a2)
808 ld b_7,56(a2)
809 sd c_1,0(a0) /* r[0]=c1; */
810 mflo t_1
811 mfhi t_2
812 daddu c_2,t_1
813 sltu AT,c_2,t_1
814 daddu t_2,AT
815 daddu c_3,t_2
816 sltu c_1,c_3,t_2
817 sd c_2,8(a0) /* r[1]=c2; */
818
819 dmultu a_2,b_0 /* mul_add_c(a[2],b[0],c3,c1,c2); */
820 mflo t_1
821 mfhi t_2
822 daddu c_3,t_1
823 sltu AT,c_3,t_1
824 daddu t_2,AT
825 daddu c_1,t_2
826 dmultu a_1,b_1 /* mul_add_c(a[1],b[1],c3,c1,c2); */
827 mflo t_1
828 mfhi t_2
829 daddu c_3,t_1
830 sltu AT,c_3,t_1
831 daddu t_2,AT
832 daddu c_1,t_2
833 sltu c_2,c_1,t_2
834 dmultu a_0,b_2 /* mul_add_c(a[0],b[2],c3,c1,c2); */
835 mflo t_1
836 mfhi t_2
837 daddu c_3,t_1
838 sltu AT,c_3,t_1
839 daddu t_2,AT
840 daddu c_1,t_2
841 sltu AT,c_1,t_2
842 daddu c_2,AT
843 sd c_3,16(a0) /* r[2]=c3; */
844
845 dmultu a_0,b_3 /* mul_add_c(a[0],b[3],c1,c2,c3); */
846 mflo t_1
847 mfhi t_2
848 daddu c_1,t_1
849 sltu AT,c_1,t_1
850 daddu t_2,AT
851 daddu c_2,t_2
852 sltu c_3,c_2,t_2
853 dmultu a_1,b_2 /* mul_add_c(a[1],b[2],c1,c2,c3); */
854 mflo t_1
855 mfhi t_2
856 daddu c_1,t_1
857 sltu AT,c_1,t_1
858 daddu t_2,AT
859 daddu c_2,t_2
860 sltu AT,c_2,t_2
861 daddu c_3,AT
862 dmultu a_2,b_1 /* mul_add_c(a[2],b[1],c1,c2,c3); */
863 mflo t_1
864 mfhi t_2
865 daddu c_1,t_1
866 sltu AT,c_1,t_1
867 daddu t_2,AT
868 daddu c_2,t_2
869 sltu AT,c_2,t_2
870 daddu c_3,AT
871 dmultu a_3,b_0 /* mul_add_c(a[3],b[0],c1,c2,c3); */
872 mflo t_1
873 mfhi t_2
874 daddu c_1,t_1
875 sltu AT,c_1,t_1
876 daddu t_2,AT
877 daddu c_2,t_2
878 sltu AT,c_2,t_2
879 daddu c_3,AT
880 sd c_1,24(a0) /* r[3]=c1; */
881
882 dmultu a_4,b_0 /* mul_add_c(a[4],b[0],c2,c3,c1); */
883 mflo t_1
884 mfhi t_2
885 daddu c_2,t_1
886 sltu AT,c_2,t_1
887 daddu t_2,AT
888 daddu c_3,t_2
889 sltu c_1,c_3,t_2
890 dmultu a_3,b_1 /* mul_add_c(a[3],b[1],c2,c3,c1); */
891 mflo t_1
892 mfhi t_2
893 daddu c_2,t_1
894 sltu AT,c_2,t_1
895 daddu t_2,AT
896 daddu c_3,t_2
897 sltu AT,c_3,t_2
898 daddu c_1,AT
899 dmultu a_2,b_2 /* mul_add_c(a[2],b[2],c2,c3,c1); */
900 mflo t_1
901 mfhi t_2
902 daddu c_2,t_1
903 sltu AT,c_2,t_1
904 daddu t_2,AT
905 daddu c_3,t_2
906 sltu AT,c_3,t_2
907 daddu c_1,AT
908 dmultu a_1,b_3 /* mul_add_c(a[1],b[3],c2,c3,c1); */
909 mflo t_1
910 mfhi t_2
911 daddu c_2,t_1
912 sltu AT,c_2,t_1
913 daddu t_2,AT
914 daddu c_3,t_2
915 sltu AT,c_3,t_2
916 daddu c_1,AT
917 dmultu a_0,b_4 /* mul_add_c(a[0],b[4],c2,c3,c1); */
918 mflo t_1
919 mfhi t_2
920 daddu c_2,t_1
921 sltu AT,c_2,t_1
922 daddu t_2,AT
923 daddu c_3,t_2
924 sltu AT,c_3,t_2
925 daddu c_1,AT
926 sd c_2,32(a0) /* r[4]=c2; */
927
928 dmultu a_0,b_5 /* mul_add_c(a[0],b[5],c3,c1,c2); */
929 mflo t_1
930 mfhi t_2
931 daddu c_3,t_1
932 sltu AT,c_3,t_1
933 daddu t_2,AT
934 daddu c_1,t_2
935 sltu c_2,c_1,t_2
936 dmultu a_1,b_4 /* mul_add_c(a[1],b[4],c3,c1,c2); */
937 mflo t_1
938 mfhi t_2
939 daddu c_3,t_1
940 sltu AT,c_3,t_1
941 daddu t_2,AT
942 daddu c_1,t_2
943 sltu AT,c_1,t_2
944 daddu c_2,AT
945 dmultu a_2,b_3 /* mul_add_c(a[2],b[3],c3,c1,c2); */
946 mflo t_1
947 mfhi t_2
948 daddu c_3,t_1
949 sltu AT,c_3,t_1
950 daddu t_2,AT
951 daddu c_1,t_2
952 sltu AT,c_1,t_2
953 daddu c_2,AT
954 dmultu a_3,b_2 /* mul_add_c(a[3],b[2],c3,c1,c2); */
955 mflo t_1
956 mfhi t_2
957 daddu c_3,t_1
958 sltu AT,c_3,t_1
959 daddu t_2,AT
960 daddu c_1,t_2
961 sltu AT,c_1,t_2
962 daddu c_2,AT
963 dmultu a_4,b_1 /* mul_add_c(a[4],b[1],c3,c1,c2); */
964 mflo t_1
965 mfhi t_2
966 daddu c_3,t_1
967 sltu AT,c_3,t_1
968 daddu t_2,AT
969 daddu c_1,t_2
970 sltu AT,c_1,t_2
971 daddu c_2,AT
972 dmultu a_5,b_0 /* mul_add_c(a[5],b[0],c3,c1,c2); */
973 mflo t_1
974 mfhi t_2
975 daddu c_3,t_1
976 sltu AT,c_3,t_1
977 daddu t_2,AT
978 daddu c_1,t_2
979 sltu AT,c_1,t_2
980 daddu c_2,AT
981 sd c_3,40(a0) /* r[5]=c3; */
982
983 dmultu a_6,b_0 /* mul_add_c(a[6],b[0],c1,c2,c3); */
984 mflo t_1
985 mfhi t_2
986 daddu c_1,t_1
987 sltu AT,c_1,t_1
988 daddu t_2,AT
989 daddu c_2,t_2
990 sltu c_3,c_2,t_2
991 dmultu a_5,b_1 /* mul_add_c(a[5],b[1],c1,c2,c3); */
992 mflo t_1
993 mfhi t_2
994 daddu c_1,t_1
995 sltu AT,c_1,t_1
996 daddu t_2,AT
997 daddu c_2,t_2
998 sltu AT,c_2,t_2
999 daddu c_3,AT
1000 dmultu a_4,b_2 /* mul_add_c(a[4],b[2],c1,c2,c3); */
1001 mflo t_1
1002 mfhi t_2
1003 daddu c_1,t_1
1004 sltu AT,c_1,t_1
1005 daddu t_2,AT
1006 daddu c_2,t_2
1007 sltu AT,c_2,t_2
1008 daddu c_3,AT
1009 dmultu a_3,b_3 /* mul_add_c(a[3],b[3],c1,c2,c3); */
1010 mflo t_1
1011 mfhi t_2
1012 daddu c_1,t_1
1013 sltu AT,c_1,t_1
1014 daddu t_2,AT
1015 daddu c_2,t_2
1016 sltu AT,c_2,t_2
1017 daddu c_3,AT
1018 dmultu a_2,b_4 /* mul_add_c(a[2],b[4],c1,c2,c3); */
1019 mflo t_1
1020 mfhi t_2
1021 daddu c_1,t_1
1022 sltu AT,c_1,t_1
1023 daddu t_2,AT
1024 daddu c_2,t_2
1025 sltu AT,c_2,t_2
1026 daddu c_3,AT
1027 dmultu a_1,b_5 /* mul_add_c(a[1],b[5],c1,c2,c3); */
1028 mflo t_1
1029 mfhi t_2
1030 daddu c_1,t_1
1031 sltu AT,c_1,t_1
1032 daddu t_2,AT
1033 daddu c_2,t_2
1034 sltu AT,c_2,t_2
1035 daddu c_3,AT
1036 dmultu a_0,b_6 /* mul_add_c(a[0],b[6],c1,c2,c3); */
1037 mflo t_1
1038 mfhi t_2
1039 daddu c_1,t_1
1040 sltu AT,c_1,t_1
1041 daddu t_2,AT
1042 daddu c_2,t_2
1043 sltu AT,c_2,t_2
1044 daddu c_3,AT
1045 sd c_1,48(a0) /* r[6]=c1; */
1046
1047 dmultu a_0,b_7 /* mul_add_c(a[0],b[7],c2,c3,c1); */
1048 mflo t_1
1049 mfhi t_2
1050 daddu c_2,t_1
1051 sltu AT,c_2,t_1
1052 daddu t_2,AT
1053 daddu c_3,t_2
1054 sltu c_1,c_3,t_2
1055 dmultu a_1,b_6 /* mul_add_c(a[1],b[6],c2,c3,c1); */
1056 mflo t_1
1057 mfhi t_2
1058 daddu c_2,t_1
1059 sltu AT,c_2,t_1
1060 daddu t_2,AT
1061 daddu c_3,t_2
1062 sltu AT,c_3,t_2
1063 daddu c_1,AT
1064 dmultu a_2,b_5 /* mul_add_c(a[2],b[5],c2,c3,c1); */
1065 mflo t_1
1066 mfhi t_2
1067 daddu c_2,t_1
1068 sltu AT,c_2,t_1
1069 daddu t_2,AT
1070 daddu c_3,t_2
1071 sltu AT,c_3,t_2
1072 daddu c_1,AT
1073 dmultu a_3,b_4 /* mul_add_c(a[3],b[4],c2,c3,c1); */
1074 mflo t_1
1075 mfhi t_2
1076 daddu c_2,t_1
1077 sltu AT,c_2,t_1
1078 daddu t_2,AT
1079 daddu c_3,t_2
1080 sltu AT,c_3,t_2
1081 daddu c_1,AT
1082 dmultu a_4,b_3 /* mul_add_c(a[4],b[3],c2,c3,c1); */
1083 mflo t_1
1084 mfhi t_2
1085 daddu c_2,t_1
1086 sltu AT,c_2,t_1
1087 daddu t_2,AT
1088 daddu c_3,t_2
1089 sltu AT,c_3,t_2
1090 daddu c_1,AT
1091 dmultu a_5,b_2 /* mul_add_c(a[5],b[2],c2,c3,c1); */
1092 mflo t_1
1093 mfhi t_2
1094 daddu c_2,t_1
1095 sltu AT,c_2,t_1
1096 daddu t_2,AT
1097 daddu c_3,t_2
1098 sltu AT,c_3,t_2
1099 daddu c_1,AT
1100 dmultu a_6,b_1 /* mul_add_c(a[6],b[1],c2,c3,c1); */
1101 mflo t_1
1102 mfhi t_2
1103 daddu c_2,t_1
1104 sltu AT,c_2,t_1
1105 daddu t_2,AT
1106 daddu c_3,t_2
1107 sltu AT,c_3,t_2
1108 daddu c_1,AT
1109 dmultu a_7,b_0 /* mul_add_c(a[7],b[0],c2,c3,c1); */
1110 mflo t_1
1111 mfhi t_2
1112 daddu c_2,t_1
1113 sltu AT,c_2,t_1
1114 daddu t_2,AT
1115 daddu c_3,t_2
1116 sltu AT,c_3,t_2
1117 daddu c_1,AT
1118 sd c_2,56(a0) /* r[7]=c2; */
1119
1120 dmultu a_7,b_1 /* mul_add_c(a[7],b[1],c3,c1,c2); */
1121 mflo t_1
1122 mfhi t_2
1123 daddu c_3,t_1
1124 sltu AT,c_3,t_1
1125 daddu t_2,AT
1126 daddu c_1,t_2
1127 sltu c_2,c_1,t_2
1128 dmultu a_6,b_2 /* mul_add_c(a[6],b[2],c3,c1,c2); */
1129 mflo t_1
1130 mfhi t_2
1131 daddu c_3,t_1
1132 sltu AT,c_3,t_1
1133 daddu t_2,AT
1134 daddu c_1,t_2
1135 sltu AT,c_1,t_2
1136 daddu c_2,AT
1137 dmultu a_5,b_3 /* mul_add_c(a[5],b[3],c3,c1,c2); */
1138 mflo t_1
1139 mfhi t_2
1140 daddu c_3,t_1
1141 sltu AT,c_3,t_1
1142 daddu t_2,AT
1143 daddu c_1,t_2
1144 sltu AT,c_1,t_2
1145 daddu c_2,AT
1146 dmultu a_4,b_4 /* mul_add_c(a[4],b[4],c3,c1,c2); */
1147 mflo t_1
1148 mfhi t_2
1149 daddu c_3,t_1
1150 sltu AT,c_3,t_1
1151 daddu t_2,AT
1152 daddu c_1,t_2
1153 sltu AT,c_1,t_2
1154 daddu c_2,AT
1155 dmultu a_3,b_5 /* mul_add_c(a[3],b[5],c3,c1,c2); */
1156 mflo t_1
1157 mfhi t_2
1158 daddu c_3,t_1
1159 sltu AT,c_3,t_1
1160 daddu t_2,AT
1161 daddu c_1,t_2
1162 sltu AT,c_1,t_2
1163 daddu c_2,AT
1164 dmultu a_2,b_6 /* mul_add_c(a[2],b[6],c3,c1,c2); */
1165 mflo t_1
1166 mfhi t_2
1167 daddu c_3,t_1
1168 sltu AT,c_3,t_1
1169 daddu t_2,AT
1170 daddu c_1,t_2
1171 sltu AT,c_1,t_2
1172 daddu c_2,AT
1173 dmultu a_1,b_7 /* mul_add_c(a[1],b[7],c3,c1,c2); */
1174 mflo t_1
1175 mfhi t_2
1176 daddu c_3,t_1
1177 sltu AT,c_3,t_1
1178 daddu t_2,AT
1179 daddu c_1,t_2
1180 sltu AT,c_1,t_2
1181 daddu c_2,AT
1182 sd c_3,64(a0) /* r[8]=c3; */
1183
1184 dmultu a_2,b_7 /* mul_add_c(a[2],b[7],c1,c2,c3); */
1185 mflo t_1
1186 mfhi t_2
1187 daddu c_1,t_1
1188 sltu AT,c_1,t_1
1189 daddu t_2,AT
1190 daddu c_2,t_2
1191 sltu c_3,c_2,t_2
1192 dmultu a_3,b_6 /* mul_add_c(a[3],b[6],c1,c2,c3); */
1193 mflo t_1
1194 mfhi t_2
1195 daddu c_1,t_1
1196 sltu AT,c_1,t_1
1197 daddu t_2,AT
1198 daddu c_2,t_2
1199 sltu AT,c_2,t_2
1200 daddu c_3,AT
1201 dmultu a_4,b_5 /* mul_add_c(a[4],b[5],c1,c2,c3); */
1202 mflo t_1
1203 mfhi t_2
1204 daddu c_1,t_1
1205 sltu AT,c_1,t_1
1206 daddu t_2,AT
1207 daddu c_2,t_2
1208 sltu AT,c_2,t_2
1209 daddu c_3,AT
1210 dmultu a_5,b_4 /* mul_add_c(a[5],b[4],c1,c2,c3); */
1211 mflo t_1
1212 mfhi t_2
1213 daddu c_1,t_1
1214 sltu AT,c_1,t_1
1215 daddu t_2,AT
1216 daddu c_2,t_2
1217 sltu AT,c_2,t_2
1218 daddu c_3,AT
1219 dmultu a_6,b_3 /* mul_add_c(a[6],b[3],c1,c2,c3); */
1220 mflo t_1
1221 mfhi t_2
1222 daddu c_1,t_1
1223 sltu AT,c_1,t_1
1224 daddu t_2,AT
1225 daddu c_2,t_2
1226 sltu AT,c_2,t_2
1227 daddu c_3,AT
1228 dmultu a_7,b_2 /* mul_add_c(a[7],b[2],c1,c2,c3); */
1229 mflo t_1
1230 mfhi t_2
1231 daddu c_1,t_1
1232 sltu AT,c_1,t_1
1233 daddu t_2,AT
1234 daddu c_2,t_2
1235 sltu AT,c_2,t_2
1236 daddu c_3,AT
1237 sd c_1,72(a0) /* r[9]=c1; */
1238
1239 dmultu a_7,b_3 /* mul_add_c(a[7],b[3],c2,c3,c1); */
1240 mflo t_1
1241 mfhi t_2
1242 daddu c_2,t_1
1243 sltu AT,c_2,t_1
1244 daddu t_2,AT
1245 daddu c_3,t_2
1246 sltu c_1,c_3,t_2
1247 dmultu a_6,b_4 /* mul_add_c(a[6],b[4],c2,c3,c1); */
1248 mflo t_1
1249 mfhi t_2
1250 daddu c_2,t_1
1251 sltu AT,c_2,t_1
1252 daddu t_2,AT
1253 daddu c_3,t_2
1254 sltu AT,c_3,t_2
1255 daddu c_1,AT
1256 dmultu a_5,b_5 /* mul_add_c(a[5],b[5],c2,c3,c1); */
1257 mflo t_1
1258 mfhi t_2
1259 daddu c_2,t_1
1260 sltu AT,c_2,t_1
1261 daddu t_2,AT
1262 daddu c_3,t_2
1263 sltu AT,c_3,t_2
1264 daddu c_1,AT
1265 dmultu a_4,b_6 /* mul_add_c(a[4],b[6],c2,c3,c1); */
1266 mflo t_1
1267 mfhi t_2
1268 daddu c_2,t_1
1269 sltu AT,c_2,t_1
1270 daddu t_2,AT
1271 daddu c_3,t_2
1272 sltu AT,c_3,t_2
1273 daddu c_1,AT
1274 dmultu a_3,b_7 /* mul_add_c(a[3],b[7],c2,c3,c1); */
1275 mflo t_1
1276 mfhi t_2
1277 daddu c_2,t_1
1278 sltu AT,c_2,t_1
1279 daddu t_2,AT
1280 daddu c_3,t_2
1281 sltu AT,c_3,t_2
1282 daddu c_1,AT
1283 sd c_2,80(a0) /* r[10]=c2; */
1284
1285 dmultu a_4,b_7 /* mul_add_c(a[4],b[7],c3,c1,c2); */
1286 mflo t_1
1287 mfhi t_2
1288 daddu c_3,t_1
1289 sltu AT,c_3,t_1
1290 daddu t_2,AT
1291 daddu c_1,t_2
1292 sltu c_2,c_1,t_2
1293 dmultu a_5,b_6 /* mul_add_c(a[5],b[6],c3,c1,c2); */
1294 mflo t_1
1295 mfhi t_2
1296 daddu c_3,t_1
1297 sltu AT,c_3,t_1
1298 daddu t_2,AT
1299 daddu c_1,t_2
1300 sltu AT,c_1,t_2
1301 daddu c_2,AT
1302 dmultu a_6,b_5 /* mul_add_c(a[6],b[5],c3,c1,c2); */
1303 mflo t_1
1304 mfhi t_2
1305 daddu c_3,t_1
1306 sltu AT,c_3,t_1
1307 daddu t_2,AT
1308 daddu c_1,t_2
1309 sltu AT,c_1,t_2
1310 daddu c_2,AT
1311 dmultu a_7,b_4 /* mul_add_c(a[7],b[4],c3,c1,c2); */
1312 mflo t_1
1313 mfhi t_2
1314 daddu c_3,t_1
1315 sltu AT,c_3,t_1
1316 daddu t_2,AT
1317 daddu c_1,t_2
1318 sltu AT,c_1,t_2
1319 daddu c_2,AT
1320 sd c_3,88(a0) /* r[11]=c3; */
1321
1322 dmultu a_7,b_5 /* mul_add_c(a[7],b[5],c1,c2,c3); */
1323 mflo t_1
1324 mfhi t_2
1325 daddu c_1,t_1
1326 sltu AT,c_1,t_1
1327 daddu t_2,AT
1328 daddu c_2,t_2
1329 sltu c_3,c_2,t_2
1330 dmultu a_6,b_6 /* mul_add_c(a[6],b[6],c1,c2,c3); */
1331 mflo t_1
1332 mfhi t_2
1333 daddu c_1,t_1
1334 sltu AT,c_1,t_1
1335 daddu t_2,AT
1336 daddu c_2,t_2
1337 sltu AT,c_2,t_2
1338 daddu c_3,AT
1339 dmultu a_5,b_7 /* mul_add_c(a[5],b[7],c1,c2,c3); */
1340 mflo t_1
1341 mfhi t_2
1342 daddu c_1,t_1
1343 sltu AT,c_1,t_1
1344 daddu t_2,AT
1345 daddu c_2,t_2
1346 sltu AT,c_2,t_2
1347 daddu c_3,AT
1348 sd c_1,96(a0) /* r[12]=c1; */
1349
1350 dmultu a_6,b_7 /* mul_add_c(a[6],b[7],c2,c3,c1); */
1351 mflo t_1
1352 mfhi t_2
1353 daddu c_2,t_1
1354 sltu AT,c_2,t_1
1355 daddu t_2,AT
1356 daddu c_3,t_2
1357 sltu c_1,c_3,t_2
1358 dmultu a_7,b_6 /* mul_add_c(a[7],b[6],c2,c3,c1); */
1359 mflo t_1
1360 mfhi t_2
1361 daddu c_2,t_1
1362 sltu AT,c_2,t_1
1363 daddu t_2,AT
1364 daddu c_3,t_2
1365 sltu AT,c_3,t_2
1366 daddu c_1,AT
1367 sd c_2,104(a0) /* r[13]=c2; */
1368
1369 dmultu a_7,b_7 /* mul_add_c(a[7],b[7],c3,c1,c2); */
1370 ld s0,0(sp)
1371 ld s1,8(sp)
1372 ld s2,16(sp)
1373 ld s3,24(sp)
1374 ld s4,32(sp)
1375 ld s5,40(sp)
1376 mflo t_1
1377 mfhi t_2
1378 daddu c_3,t_1
1379 sltu AT,c_3,t_1
1380 daddu t_2,AT
1381 daddu c_1,t_2
1382 sd c_3,112(a0) /* r[14]=c3; */
1383 sd c_1,120(a0) /* r[15]=c1; */
1384
1385 PTR_ADD sp,FRAME_SIZE
1386
1387 jr ra
1388END(bn_mul_comba8)
1389
1390.align 5
1391LEAF(bn_mul_comba4)
1392 .set reorder
1393 ld a_0,0(a1)
1394 ld b_0,0(a2)
1395 ld a_1,8(a1)
1396 ld a_2,16(a1)
1397 dmultu a_0,b_0 /* mul_add_c(a[0],b[0],c1,c2,c3); */
1398 ld a_3,24(a1)
1399 ld b_1,8(a2)
1400 ld b_2,16(a2)
1401 ld b_3,24(a2)
1402 mflo c_1
1403 mfhi c_2
1404 sd c_1,0(a0)
1405
1406 dmultu a_0,b_1 /* mul_add_c(a[0],b[1],c2,c3,c1); */
1407 mflo t_1
1408 mfhi t_2
1409 daddu c_2,t_1
1410 sltu AT,c_2,t_1
1411 daddu c_3,t_2,AT
1412 dmultu a_1,b_0 /* mul_add_c(a[1],b[0],c2,c3,c1); */
1413 mflo t_1
1414 mfhi t_2
1415 daddu c_2,t_1
1416 sltu AT,c_2,t_1
1417 daddu t_2,AT
1418 daddu c_3,t_2
1419 sltu c_1,c_3,t_2
1420 sd c_2,8(a0)
1421
1422 dmultu a_2,b_0 /* mul_add_c(a[2],b[0],c3,c1,c2); */
1423 mflo t_1
1424 mfhi t_2
1425 daddu c_3,t_1
1426 sltu AT,c_3,t_1
1427 daddu t_2,AT
1428 daddu c_1,t_2
1429 dmultu a_1,b_1 /* mul_add_c(a[1],b[1],c3,c1,c2); */
1430 mflo t_1
1431 mfhi t_2
1432 daddu c_3,t_1
1433 sltu AT,c_3,t_1
1434 daddu t_2,AT
1435 daddu c_1,t_2
1436 sltu c_2,c_1,t_2
1437 dmultu a_0,b_2 /* mul_add_c(a[0],b[2],c3,c1,c2); */
1438 mflo t_1
1439 mfhi t_2
1440 daddu c_3,t_1
1441 sltu AT,c_3,t_1
1442 daddu t_2,AT
1443 daddu c_1,t_2
1444 sltu AT,c_1,t_2
1445 daddu c_2,AT
1446 sd c_3,16(a0)
1447
1448 dmultu a_0,b_3 /* mul_add_c(a[0],b[3],c1,c2,c3); */
1449 mflo t_1
1450 mfhi t_2
1451 daddu c_1,t_1
1452 sltu AT,c_1,t_1
1453 daddu t_2,AT
1454 daddu c_2,t_2
1455 sltu c_3,c_2,t_2
1456 dmultu a_1,b_2 /* mul_add_c(a[1],b[2],c1,c2,c3); */
1457 mflo t_1
1458 mfhi t_2
1459 daddu c_1,t_1
1460 sltu AT,c_1,t_1
1461 daddu t_2,AT
1462 daddu c_2,t_2
1463 sltu AT,c_2,t_2
1464 daddu c_3,AT
1465 dmultu a_2,b_1 /* mul_add_c(a[2],b[1],c1,c2,c3); */
1466 mflo t_1
1467 mfhi t_2
1468 daddu c_1,t_1
1469 sltu AT,c_1,t_1
1470 daddu t_2,AT
1471 daddu c_2,t_2
1472 sltu AT,c_2,t_2
1473 daddu c_3,AT
1474 dmultu a_3,b_0 /* mul_add_c(a[3],b[0],c1,c2,c3); */
1475 mflo t_1
1476 mfhi t_2
1477 daddu c_1,t_1
1478 sltu AT,c_1,t_1
1479 daddu t_2,AT
1480 daddu c_2,t_2
1481 sltu AT,c_2,t_2
1482 daddu c_3,AT
1483 sd c_1,24(a0)
1484
1485 dmultu a_3,b_1 /* mul_add_c(a[3],b[1],c2,c3,c1); */
1486 mflo t_1
1487 mfhi t_2
1488 daddu c_2,t_1
1489 sltu AT,c_2,t_1
1490 daddu t_2,AT
1491 daddu c_3,t_2
1492 sltu c_1,c_3,t_2
1493 dmultu a_2,b_2 /* mul_add_c(a[2],b[2],c2,c3,c1); */
1494 mflo t_1
1495 mfhi t_2
1496 daddu c_2,t_1
1497 sltu AT,c_2,t_1
1498 daddu t_2,AT
1499 daddu c_3,t_2
1500 sltu AT,c_3,t_2
1501 daddu c_1,AT
1502 dmultu a_1,b_3 /* mul_add_c(a[1],b[3],c2,c3,c1); */
1503 mflo t_1
1504 mfhi t_2
1505 daddu c_2,t_1
1506 sltu AT,c_2,t_1
1507 daddu t_2,AT
1508 daddu c_3,t_2
1509 sltu AT,c_3,t_2
1510 daddu c_1,AT
1511 sd c_2,32(a0)
1512
1513 dmultu a_2,b_3 /* mul_add_c(a[2],b[3],c3,c1,c2); */
1514 mflo t_1
1515 mfhi t_2
1516 daddu c_3,t_1
1517 sltu AT,c_3,t_1
1518 daddu t_2,AT
1519 daddu c_1,t_2
1520 sltu c_2,c_1,t_2
1521 dmultu a_3,b_2 /* mul_add_c(a[3],b[2],c3,c1,c2); */
1522 mflo t_1
1523 mfhi t_2
1524 daddu c_3,t_1
1525 sltu AT,c_3,t_1
1526 daddu t_2,AT
1527 daddu c_1,t_2
1528 sltu AT,c_1,t_2
1529 daddu c_2,AT
1530 sd c_3,40(a0)
1531
1532 dmultu a_3,b_3 /* mul_add_c(a[3],b[3],c1,c2,c3); */
1533 mflo t_1
1534 mfhi t_2
1535 daddu c_1,t_1
1536 sltu AT,c_1,t_1
1537 daddu t_2,AT
1538 daddu c_2,t_2
1539 sd c_1,48(a0)
1540 sd c_2,56(a0)
1541
1542 jr ra
1543END(bn_mul_comba4)
1544
1545#undef a_4
1546#undef a_5
1547#undef a_6
1548#undef a_7
1549#define a_4 b_0
1550#define a_5 b_1
1551#define a_6 b_2
1552#define a_7 b_3
1553
1554.align 5
1555LEAF(bn_sqr_comba8)
1556 .set reorder
1557 ld a_0,0(a1)
1558 ld a_1,8(a1)
1559 ld a_2,16(a1)
1560 ld a_3,24(a1)
1561
1562 dmultu a_0,a_0 /* mul_add_c(a[0],b[0],c1,c2,c3); */
1563 ld a_4,32(a1)
1564 ld a_5,40(a1)
1565 ld a_6,48(a1)
1566 ld a_7,56(a1)
1567 mflo c_1
1568 mfhi c_2
1569 sd c_1,0(a0)
1570
1571 dmultu a_0,a_1 /* mul_add_c2(a[0],b[1],c2,c3,c1); */
1572 mflo t_1
1573 mfhi t_2
1574 slt c_1,t_2,zero
1575 dsll t_2,1
1576 slt a2,t_1,zero
1577 daddu t_2,a2
1578 dsll t_1,1
1579 daddu c_2,t_1
1580 sltu AT,c_2,t_1
1581 daddu c_3,t_2,AT
1582 sd c_2,8(a0)
1583
1584 dmultu a_2,a_0 /* mul_add_c2(a[2],b[0],c3,c1,c2); */
1585 mflo t_1
1586 mfhi t_2
1587 slt c_2,t_2,zero
1588 dsll t_2,1
1589 slt a2,t_1,zero
1590 daddu t_2,a2
1591 dsll t_1,1
1592 daddu c_3,t_1
1593 sltu AT,c_3,t_1
1594 daddu t_2,AT
1595 daddu c_1,t_2
1596 sltu AT,c_1,t_2
1597 daddu c_2,AT
1598 dmultu a_1,a_1 /* mul_add_c(a[1],b[1],c3,c1,c2); */
1599 mflo t_1
1600 mfhi t_2
1601 daddu c_3,t_1
1602 sltu AT,c_3,t_1
1603 daddu t_2,AT
1604 daddu c_1,t_2
1605 sltu AT,c_1,t_2
1606 daddu c_2,AT
1607 sd c_3,16(a0)
1608
1609 dmultu a_0,a_3 /* mul_add_c2(a[0],b[3],c1,c2,c3); */
1610 mflo t_1
1611 mfhi t_2
1612 slt c_3,t_2,zero
1613 dsll t_2,1
1614 slt a2,t_1,zero
1615 daddu t_2,a2
1616 dsll t_1,1
1617 daddu c_1,t_1
1618 sltu AT,c_1,t_1
1619 daddu t_2,AT
1620 daddu c_2,t_2
1621 sltu AT,c_2,t_2
1622 daddu c_3,AT
1623 dmultu a_1,a_2 /* mul_add_c2(a[1],b[2],c1,c2,c3); */
1624 mflo t_1
1625 mfhi t_2
1626 slt AT,t_2,zero
1627 daddu c_3,AT
1628 dsll t_2,1
1629 slt a2,t_1,zero
1630 daddu t_2,a2
1631 dsll t_1,1
1632 daddu c_1,t_1
1633 sltu AT,c_1,t_1
1634 daddu t_2,AT
1635 daddu c_2,t_2
1636 sltu AT,c_2,t_2
1637 daddu c_3,AT
1638 sd c_1,24(a0)
1639
1640 dmultu a_4,a_0 /* mul_add_c2(a[4],b[0],c2,c3,c1); */
1641 mflo t_1
1642 mfhi t_2
1643 slt c_1,t_2,zero
1644 dsll t_2,1
1645 slt a2,t_1,zero
1646 daddu t_2,a2
1647 dsll t_1,1
1648 daddu c_2,t_1
1649 sltu AT,c_2,t_1
1650 daddu t_2,AT
1651 daddu c_3,t_2
1652 sltu AT,c_3,t_2
1653 daddu c_1,AT
1654 dmultu a_3,a_1 /* mul_add_c2(a[3],b[1],c2,c3,c1); */
1655 mflo t_1
1656 mfhi t_2
1657 slt AT,t_2,zero
1658 daddu c_1,AT
1659 dsll t_2,1
1660 slt a2,t_1,zero
1661 daddu t_2,a2
1662 dsll t_1,1
1663 daddu c_2,t_1
1664 sltu AT,c_2,t_1
1665 daddu t_2,AT
1666 daddu c_3,t_2
1667 sltu AT,c_3,t_2
1668 daddu c_1,AT
1669 dmultu a_2,a_2 /* mul_add_c(a[2],b[2],c2,c3,c1); */
1670 mflo t_1
1671 mfhi t_2
1672 daddu c_2,t_1
1673 sltu AT,c_2,t_1
1674 daddu t_2,AT
1675 daddu c_3,t_2
1676 sltu AT,c_3,t_2
1677 daddu c_1,AT
1678 sd c_2,32(a0)
1679
1680 dmultu a_0,a_5 /* mul_add_c2(a[0],b[5],c3,c1,c2); */
1681 mflo t_1
1682 mfhi t_2
1683 slt c_2,t_2,zero
1684 dsll t_2,1
1685 slt a2,t_1,zero
1686 daddu t_2,a2
1687 dsll t_1,1
1688 daddu c_3,t_1
1689 sltu AT,c_3,t_1
1690 daddu t_2,AT
1691 daddu c_1,t_2
1692 sltu AT,c_1,t_2
1693 daddu c_2,AT
1694 dmultu a_1,a_4 /* mul_add_c2(a[1],b[4],c3,c1,c2); */
1695 mflo t_1
1696 mfhi t_2
1697 slt AT,t_2,zero
1698 daddu c_2,AT
1699 dsll t_2,1
1700 slt a2,t_1,zero
1701 daddu t_2,a2
1702 dsll t_1,1
1703 daddu c_3,t_1
1704 sltu AT,c_3,t_1
1705 daddu t_2,AT
1706 daddu c_1,t_2
1707 sltu AT,c_1,t_2
1708 daddu c_2,AT
1709 dmultu a_2,a_3 /* mul_add_c2(a[2],b[3],c3,c1,c2); */
1710 mflo t_1
1711 mfhi t_2
1712 slt AT,t_2,zero
1713 daddu c_2,AT
1714 dsll t_2,1
1715 slt a2,t_1,zero
1716 daddu t_2,a2
1717 dsll t_1,1
1718 daddu c_3,t_1
1719 sltu AT,c_3,t_1
1720 daddu t_2,AT
1721 daddu c_1,t_2
1722 sltu AT,c_1,t_2
1723 daddu c_2,AT
1724 sd c_3,40(a0)
1725
1726 dmultu a_6,a_0 /* mul_add_c2(a[6],b[0],c1,c2,c3); */
1727 mflo t_1
1728 mfhi t_2
1729 slt c_3,t_2,zero
1730 dsll t_2,1
1731 slt a2,t_1,zero
1732 daddu t_2,a2
1733 dsll t_1,1
1734 daddu c_1,t_1
1735 sltu AT,c_1,t_1
1736 daddu t_2,AT
1737 daddu c_2,t_2
1738 sltu AT,c_2,t_2
1739 daddu c_3,AT
1740 dmultu a_5,a_1 /* mul_add_c2(a[5],b[1],c1,c2,c3); */
1741 mflo t_1
1742 mfhi t_2
1743 slt AT,t_2,zero
1744 daddu c_3,AT
1745 dsll t_2,1
1746 slt a2,t_1,zero
1747 daddu t_2,a2
1748 dsll t_1,1
1749 daddu c_1,t_1
1750 sltu AT,c_1,t_1
1751 daddu t_2,AT
1752 daddu c_2,t_2
1753 sltu AT,c_2,t_2
1754 daddu c_3,AT
1755 dmultu a_4,a_2 /* mul_add_c2(a[4],b[2],c1,c2,c3); */
1756 mflo t_1
1757 mfhi t_2
1758 slt AT,t_2,zero
1759 daddu c_3,AT
1760 dsll t_2,1
1761 slt a2,t_1,zero
1762 daddu t_2,a2
1763 dsll t_1,1
1764 daddu c_1,t_1
1765 sltu AT,c_1,t_1
1766 daddu t_2,AT
1767 daddu c_2,t_2
1768 sltu AT,c_2,t_2
1769 daddu c_3,AT
1770 dmultu a_3,a_3 /* mul_add_c(a[3],b[3],c1,c2,c3); */
1771 mflo t_1
1772 mfhi t_2
1773 daddu c_1,t_1
1774 sltu AT,c_1,t_1
1775 daddu t_2,AT
1776 daddu c_2,t_2
1777 sltu AT,c_2,t_2
1778 daddu c_3,AT
1779 sd c_1,48(a0)
1780
1781 dmultu a_0,a_7 /* mul_add_c2(a[0],b[7],c2,c3,c1); */
1782 mflo t_1
1783 mfhi t_2
1784 slt c_1,t_2,zero
1785 dsll t_2,1
1786 slt a2,t_1,zero
1787 daddu t_2,a2
1788 dsll t_1,1
1789 daddu c_2,t_1
1790 sltu AT,c_2,t_1
1791 daddu t_2,AT
1792 daddu c_3,t_2
1793 sltu AT,c_3,t_2
1794 daddu c_1,AT
1795 dmultu a_1,a_6 /* mul_add_c2(a[1],b[6],c2,c3,c1); */
1796 mflo t_1
1797 mfhi t_2
1798 slt AT,t_2,zero
1799 daddu c_1,AT
1800 dsll t_2,1
1801 slt a2,t_1,zero
1802 daddu t_2,a2
1803 dsll t_1,1
1804 daddu c_2,t_1
1805 sltu AT,c_2,t_1
1806 daddu t_2,AT
1807 daddu c_3,t_2
1808 sltu AT,c_3,t_2
1809 daddu c_1,AT
1810 dmultu a_2,a_5 /* mul_add_c2(a[2],b[5],c2,c3,c1); */
1811 mflo t_1
1812 mfhi t_2
1813 slt AT,t_2,zero
1814 daddu c_1,AT
1815 dsll t_2,1
1816 slt a2,t_1,zero
1817 daddu t_2,a2
1818 dsll t_1,1
1819 daddu c_2,t_1
1820 sltu AT,c_2,t_1
1821 daddu t_2,AT
1822 daddu c_3,t_2
1823 sltu AT,c_3,t_2
1824 daddu c_1,AT
1825 dmultu a_3,a_4 /* mul_add_c2(a[3],b[4],c2,c3,c1); */
1826 mflo t_1
1827 mfhi t_2
1828 slt AT,t_2,zero
1829 daddu c_1,AT
1830 dsll t_2,1
1831 slt a2,t_1,zero
1832 daddu t_2,a2
1833 dsll t_1,1
1834 daddu c_2,t_1
1835 sltu AT,c_2,t_1
1836 daddu t_2,AT
1837 daddu c_3,t_2
1838 sltu AT,c_3,t_2
1839 daddu c_1,AT
1840 sd c_2,56(a0)
1841
1842 dmultu a_7,a_1 /* mul_add_c2(a[7],b[1],c3,c1,c2); */
1843 mflo t_1
1844 mfhi t_2
1845 slt c_2,t_2,zero
1846 dsll t_2,1
1847 slt a2,t_1,zero
1848 daddu t_2,a2
1849 dsll t_1,1
1850 daddu c_3,t_1
1851 sltu AT,c_3,t_1
1852 daddu t_2,AT
1853 daddu c_1,t_2
1854 sltu AT,c_1,t_2
1855 daddu c_2,AT
1856 dmultu a_6,a_2 /* mul_add_c2(a[6],b[2],c3,c1,c2); */
1857 mflo t_1
1858 mfhi t_2
1859 slt AT,t_2,zero
1860 daddu c_2,AT
1861 dsll t_2,1
1862 slt a2,t_1,zero
1863 daddu t_2,a2
1864 dsll t_1,1
1865 daddu c_3,t_1
1866 sltu AT,c_3,t_1
1867 daddu t_2,AT
1868 daddu c_1,t_2
1869 sltu AT,c_1,t_2
1870 daddu c_2,AT
1871 dmultu a_5,a_3 /* mul_add_c2(a[5],b[3],c3,c1,c2); */
1872 mflo t_1
1873 mfhi t_2
1874 slt AT,t_2,zero
1875 daddu c_2,AT
1876 dsll t_2,1
1877 slt a2,t_1,zero
1878 daddu t_2,a2
1879 dsll t_1,1
1880 daddu c_3,t_1
1881 sltu AT,c_3,t_1
1882 daddu t_2,AT
1883 daddu c_1,t_2
1884 sltu AT,c_1,t_2
1885 daddu c_2,AT
1886 dmultu a_4,a_4 /* mul_add_c(a[4],b[4],c3,c1,c2); */
1887 mflo t_1
1888 mfhi t_2
1889 daddu c_3,t_1
1890 sltu AT,c_3,t_1
1891 daddu t_2,AT
1892 daddu c_1,t_2
1893 sltu AT,c_1,t_2
1894 daddu c_2,AT
1895 sd c_3,64(a0)
1896
1897 dmultu a_2,a_7 /* mul_add_c2(a[2],b[7],c1,c2,c3); */
1898 mflo t_1
1899 mfhi t_2
1900 slt c_3,t_2,zero
1901 dsll t_2,1
1902 slt a2,t_1,zero
1903 daddu t_2,a2
1904 dsll t_1,1
1905 daddu c_1,t_1
1906 sltu AT,c_1,t_1
1907 daddu t_2,AT
1908 daddu c_2,t_2
1909 sltu AT,c_2,t_2
1910 daddu c_3,AT
1911 dmultu a_3,a_6 /* mul_add_c2(a[3],b[6],c1,c2,c3); */
1912 mflo t_1
1913 mfhi t_2
1914 slt AT,t_2,zero
1915 daddu c_3,AT
1916 dsll t_2,1
1917 slt a2,t_1,zero
1918 daddu t_2,a2
1919 dsll t_1,1
1920 daddu c_1,t_1
1921 sltu AT,c_1,t_1
1922 daddu t_2,AT
1923 daddu c_2,t_2
1924 sltu AT,c_2,t_2
1925 daddu c_3,AT
1926 dmultu a_4,a_5 /* mul_add_c2(a[4],b[5],c1,c2,c3); */
1927 mflo t_1
1928 mfhi t_2
1929 slt AT,t_2,zero
1930 daddu c_3,AT
1931 dsll t_2,1
1932 slt a2,t_1,zero
1933 daddu t_2,a2
1934 dsll t_1,1
1935 daddu c_1,t_1
1936 sltu AT,c_1,t_1
1937 daddu t_2,AT
1938 daddu c_2,t_2
1939 sltu AT,c_2,t_2
1940 daddu c_3,AT
1941 sd c_1,72(a0)
1942
1943 dmultu a_7,a_3 /* mul_add_c2(a[7],b[3],c2,c3,c1); */
1944 mflo t_1
1945 mfhi t_2
1946 slt c_1,t_2,zero
1947 dsll t_2,1
1948 slt a2,t_1,zero
1949 daddu t_2,a2
1950 dsll t_1,1
1951 daddu c_2,t_1
1952 sltu AT,c_2,t_1
1953 daddu t_2,AT
1954 daddu c_3,t_2
1955 sltu AT,c_3,t_2
1956 daddu c_1,AT
1957 dmultu a_6,a_4 /* mul_add_c2(a[6],b[4],c2,c3,c1); */
1958 mflo t_1
1959 mfhi t_2
1960 slt AT,t_2,zero
1961 daddu c_1,AT
1962 dsll t_2,1
1963 slt a2,t_1,zero
1964 daddu t_2,a2
1965 dsll t_1,1
1966 daddu c_2,t_1
1967 sltu AT,c_2,t_1
1968 daddu t_2,AT
1969 daddu c_3,t_2
1970 sltu AT,c_3,t_2
1971 daddu c_1,AT
1972 dmultu a_5,a_5 /* mul_add_c(a[5],b[5],c2,c3,c1); */
1973 mflo t_1
1974 mfhi t_2
1975 daddu c_2,t_1
1976 sltu AT,c_2,t_1
1977 daddu t_2,AT
1978 daddu c_3,t_2
1979 sltu AT,c_3,t_2
1980 daddu c_1,AT
1981 sd c_2,80(a0)
1982
1983 dmultu a_4,a_7 /* mul_add_c2(a[4],b[7],c3,c1,c2); */
1984 mflo t_1
1985 mfhi t_2
1986 slt c_2,t_2,zero
1987 dsll t_2,1
1988 slt a2,t_1,zero
1989 daddu t_2,a2
1990 dsll t_1,1
1991 daddu c_3,t_1
1992 sltu AT,c_3,t_1
1993 daddu t_2,AT
1994 daddu c_1,t_2
1995 sltu AT,c_1,t_2
1996 daddu c_2,AT
1997 dmultu a_5,a_6 /* mul_add_c2(a[5],b[6],c3,c1,c2); */
1998 mflo t_1
1999 mfhi t_2
2000 slt AT,t_2,zero
2001 daddu c_2,AT
2002 dsll t_2,1
2003 slt a2,t_1,zero
2004 daddu t_2,a2
2005 dsll t_1,1
2006 daddu c_3,t_1
2007 sltu AT,c_3,t_1
2008 daddu t_2,AT
2009 daddu c_1,t_2
2010 sltu AT,c_1,t_2
2011 daddu c_2,AT
2012 sd c_3,88(a0)
2013
2014 dmultu a_7,a_5 /* mul_add_c2(a[7],b[5],c1,c2,c3); */
2015 mflo t_1
2016 mfhi t_2
2017 slt c_3,t_2,zero
2018 dsll t_2,1
2019 slt a2,t_1,zero
2020 daddu t_2,a2
2021 dsll t_1,1
2022 daddu c_1,t_1
2023 sltu AT,c_1,t_1
2024 daddu t_2,AT
2025 daddu c_2,t_2
2026 sltu AT,c_2,t_2
2027 daddu c_3,AT
2028 dmultu a_6,a_6 /* mul_add_c(a[6],b[6],c1,c2,c3); */
2029 mflo t_1
2030 mfhi t_2
2031 daddu c_1,t_1
2032 sltu AT,c_1,t_1
2033 daddu t_2,AT
2034 daddu c_2,t_2
2035 sltu AT,c_2,t_2
2036 daddu c_3,AT
2037 sd c_1,96(a0)
2038
2039 dmultu a_6,a_7 /* mul_add_c2(a[6],b[7],c2,c3,c1); */
2040 mflo t_1
2041 mfhi t_2
2042 slt c_1,t_2,zero
2043 dsll t_2,1
2044 slt a2,t_1,zero
2045 daddu t_2,a2
2046 dsll t_1,1
2047 daddu c_2,t_1
2048 sltu AT,c_2,t_1
2049 daddu t_2,AT
2050 daddu c_3,t_2
2051 sltu AT,c_3,t_2
2052 daddu c_1,AT
2053 sd c_2,104(a0)
2054
2055 dmultu a_7,a_7 /* mul_add_c(a[7],b[7],c3,c1,c2); */
2056 mflo t_1
2057 mfhi t_2
2058 daddu c_3,t_1
2059 sltu AT,c_3,t_1
2060 daddu t_2,AT
2061 daddu c_1,t_2
2062 sd c_3,112(a0)
2063 sd c_1,120(a0)
2064
2065 jr ra
2066END(bn_sqr_comba8)
2067
2068.align 5
2069LEAF(bn_sqr_comba4)
2070 .set reorder
2071 ld a_0,0(a1)
2072 ld a_1,8(a1)
2073 ld a_2,16(a1)
2074 ld a_3,24(a1)
2075 dmultu a_0,a_0 /* mul_add_c(a[0],b[0],c1,c2,c3); */
2076 mflo c_1
2077 mfhi c_2
2078 sd c_1,0(a0)
2079
2080 dmultu a_0,a_1 /* mul_add_c2(a[0],b[1],c2,c3,c1); */
2081 mflo t_1
2082 mfhi t_2
2083 slt c_1,t_2,zero
2084 dsll t_2,1
2085 slt a2,t_1,zero
2086 daddu t_2,a2
2087 dsll t_1,1
2088 daddu c_2,t_1
2089 sltu AT,c_2,t_1
2090 daddu c_3,t_2,AT
2091 sd c_2,8(a0)
2092
2093 dmultu a_2,a_0 /* mul_add_c2(a[2],b[0],c3,c1,c2); */
2094 mflo t_1
2095 mfhi t_2
2096 slt c_2,t_2,zero
2097 dsll t_2,1
2098 slt a2,t_1,zero
2099 daddu t_2,a2
2100 dsll t_1,1
2101 daddu c_3,t_1
2102 sltu AT,c_3,t_1
2103 daddu t_2,AT
2104 daddu c_1,t_2
2105 sltu AT,c_1,t_2
2106 daddu c_2,AT
2107 dmultu a_1,a_1 /* mul_add_c(a[1],b[1],c3,c1,c2); */
2108 mflo t_1
2109 mfhi t_2
2110 daddu c_3,t_1
2111 sltu AT,c_3,t_1
2112 daddu t_2,AT
2113 daddu c_1,t_2
2114 sltu AT,c_1,t_2
2115 daddu c_2,AT
2116 sd c_3,16(a0)
2117
2118 dmultu a_0,a_3 /* mul_add_c2(a[0],b[3],c1,c2,c3); */
2119 mflo t_1
2120 mfhi t_2
2121 slt c_3,t_2,zero
2122 dsll t_2,1
2123 slt a2,t_1,zero
2124 daddu t_2,a2
2125 dsll t_1,1
2126 daddu c_1,t_1
2127 sltu AT,c_1,t_1
2128 daddu t_2,AT
2129 daddu c_2,t_2
2130 sltu AT,c_2,t_2
2131 daddu c_3,AT
2132 dmultu a_1,a_2 /* mul_add_c(a2[1],b[2],c1,c2,c3); */
2133 mflo t_1
2134 mfhi t_2
2135 slt AT,t_2,zero
2136 daddu c_3,AT
2137 dsll t_2,1
2138 slt a2,t_1,zero
2139 daddu t_2,a2
2140 dsll t_1,1
2141 daddu c_1,t_1
2142 sltu AT,c_1,t_1
2143 daddu t_2,AT
2144 daddu c_2,t_2
2145 sltu AT,c_2,t_2
2146 daddu c_3,AT
2147 sd c_1,24(a0)
2148
2149 dmultu a_3,a_1 /* mul_add_c2(a[3],b[1],c2,c3,c1); */
2150 mflo t_1
2151 mfhi t_2
2152 slt c_1,t_2,zero
2153 dsll t_2,1
2154 slt a2,t_1,zero
2155 daddu t_2,a2
2156 dsll t_1,1
2157 daddu c_2,t_1
2158 sltu AT,c_2,t_1
2159 daddu t_2,AT
2160 daddu c_3,t_2
2161 sltu AT,c_3,t_2
2162 daddu c_1,AT
2163 dmultu a_2,a_2 /* mul_add_c(a[2],b[2],c2,c3,c1); */
2164 mflo t_1
2165 mfhi t_2
2166 daddu c_2,t_1
2167 sltu AT,c_2,t_1
2168 daddu t_2,AT
2169 daddu c_3,t_2
2170 sltu AT,c_3,t_2
2171 daddu c_1,AT
2172 sd c_2,32(a0)
2173
2174 dmultu a_2,a_3 /* mul_add_c2(a[2],b[3],c3,c1,c2); */
2175 mflo t_1
2176 mfhi t_2
2177 slt c_2,t_2,zero
2178 dsll t_2,1
2179 slt a2,t_1,zero
2180 daddu t_2,a2
2181 dsll t_1,1
2182 daddu c_3,t_1
2183 sltu AT,c_3,t_1
2184 daddu t_2,AT
2185 daddu c_1,t_2
2186 sltu AT,c_1,t_2
2187 daddu c_2,AT
2188 sd c_3,40(a0)
2189
2190 dmultu a_3,a_3 /* mul_add_c(a[3],b[3],c1,c2,c3); */
2191 mflo t_1
2192 mfhi t_2
2193 daddu c_1,t_1
2194 sltu AT,c_1,t_1
2195 daddu t_2,AT
2196 daddu c_2,t_2
2197 sd c_1,48(a0)
2198 sd c_2,56(a0)
2199
2200 jr ra
2201END(bn_sqr_comba4)
diff --git a/src/lib/libcrypto/bn/asm/vms.mar b/src/lib/libcrypto/bn/asm/vms.mar
new file mode 100644
index 0000000000..aefab15cdb
--- /dev/null
+++ b/src/lib/libcrypto/bn/asm/vms.mar
@@ -0,0 +1,6440 @@
1 .title vax_bn_mul_add_words unsigned multiply & add, 32*32+32+32=>64
2;
3; w.j.m. 15-jan-1999
4;
5; it's magic ...
6;
7; ULONG bn_mul_add_words(ULONG r[],ULONG a[],int n,ULONG w) {
8; ULONG c = 0;
9; int i;
10; for(i = 0; i < n; i++) <c,r[i]> := r[i] + c + a[i] * w ;
11; return c;
12; }
13
14r=4 ;(AP)
15a=8 ;(AP)
16n=12 ;(AP) n by value (input)
17w=16 ;(AP) w by value (input)
18
19
20 .psect code,nowrt
21
22.entry bn_mul_add_words,^m<r2,r3,r4,r5,r6>
23
24 moval @r(ap),r2
25 moval @a(ap),r3
26 movl n(ap),r4 ; assumed >0 by C code
27 movl w(ap),r5
28 clrl r6 ; c
29
300$:
31 emul r5,(r3),(r2),r0 ; w, a[], r[] considered signed
32
33 ; fixup for "negative" r[]
34 tstl (r2)
35 bgeq 10$
36 incl r1
3710$:
38
39 ; add in c
40 addl2 r6,r0
41 adwc #0,r1
42
43 ; combined fixup for "negative" w, a[]
44 tstl r5
45 bgeq 20$
46 addl2 (r3),r1
4720$:
48 tstl (r3)
49 bgeq 30$
50 addl2 r5,r1
5130$:
52
53 movl r0,(r2)+ ; store lo result in r[] & advance
54 addl #4,r3 ; advance a[]
55 movl r1,r6 ; store hi result => c
56
57 sobgtr r4,0$
58
59 movl r6,r0 ; return c
60 ret
61
62 .title vax_bn_mul_words unsigned multiply & add, 32*32+32=>64
63;
64; w.j.m. 15-jan-1999
65;
66; it's magic ...
67;
68; ULONG bn_mul_words(ULONG r[],ULONG a[],int n,ULONG w) {
69; ULONG c = 0;
70; int i;
71; for(i = 0; i < num; i++) <c,r[i]> := a[i] * w + c ;
72; return(c);
73; }
74
75r=4 ;(AP)
76a=8 ;(AP)
77n=12 ;(AP) n by value (input)
78w=16 ;(AP) w by value (input)
79
80
81 .psect code,nowrt
82
83.entry bn_mul_words,^m<r2,r3,r4,r5,r6>
84
85 moval @r(ap),r2 ; r2 -> r[]
86 moval @a(ap),r3 ; r3 -> a[]
87 movl n(ap),r4 ; r4 = loop count (assumed >0 by C code)
88 movl w(ap),r5 ; r5 = w
89 clrl r6 ; r6 = c
90
910$:
92 ; <r1,r0> := w * a[] + c
93 emul r5,(r3),r6,r0 ; w, a[], c considered signed
94
95 ; fixup for "negative" c
96 tstl r6 ; c
97 bgeq 10$
98 incl r1
9910$:
100
101 ; combined fixup for "negative" w, a[]
102 tstl r5 ; w
103 bgeq 20$
104 addl2 (r3),r1 ; a[]
10520$:
106 tstl (r3) ; a[]
107 bgeq 30$
108 addl2 r5,r1 ; w
10930$:
110
111 movl r0,(r2)+ ; store lo result in r[] & advance
112 addl #4,r3 ; advance a[]
113 movl r1,r6 ; store hi result => c
114
115 sobgtr r4,0$
116
117 movl r6,r0 ; return c
118 ret
119
120 .title vax_bn_sqr_words unsigned square, 32*32=>64
121;
122; w.j.m. 15-jan-1999
123;
124; it's magic ...
125;
126; void bn_sqr_words(ULONG r[],ULONG a[],int n) {
127; int i;
128; for(i = 0; i < n; i++) <r[2*i+1],r[2*i]> := a[i] * a[i] ;
129; }
130
131r=4 ;(AP)
132a=8 ;(AP)
133n=12 ;(AP) n by value (input)
134
135
136 .psect code,nowrt
137
138.entry bn_sqr_words,^m<r2,r3,r4,r5>
139
140 moval @r(ap),r2 ; r2 -> r[]
141 moval @a(ap),r3 ; r3 -> a[]
142 movl n(ap),r4 ; r4 = n (assumed >0 by C code)
143
1440$:
145 movl (r3)+,r5 ; r5 = a[] & advance
146
147 ; <r1,r0> := a[] * a[]
148 emul r5,r5,#0,r0 ; a[] considered signed
149
150 ; fixup for "negative" a[]
151 tstl r5 ; a[]
152 bgeq 30$
153 addl2 r5,r1 ; a[]
154 addl2 r5,r1 ; a[]
15530$:
156
157 movl r0,(r2)+ ; store lo result in r[] & advance
158 movl r1,(r2)+ ; store hi result in r[] & advance
159
160 sobgtr r4,0$
161
162 movl #1,r0 ; return SS$_NORMAL
163 ret
164
165 .title vax_bn_div_words unsigned divide
166;
167; Richard Levitte 20-Nov-2000
168;
169; ULONG bn_div_words(ULONG h, ULONG l, ULONG d)
170; {
171; return ((ULONG)((((ULLONG)h)<<32)|l) / (ULLONG)d);
172; }
173;
174; Using EDIV would be very easy, if it didn't do signed calculations.
175; Any time any of the input numbers are signed, there are problems,
176; usually with integer overflow, at which point it returns useless
177; data (the quotient gets the value of l, and the remainder becomes 0).
178;
179; If it was just for the dividend, it would be very easy, just divide
180; it by 2 (unsigned), do the division, multiply the resulting quotient
181; and remainder by 2, add the bit that was dropped when dividing by 2
182; to the remainder, and do some adjustment so the remainder doesn't
183; end up larger than the divisor. For some cases when the divisor is
184; negative (from EDIV's point of view, i.e. when the highest bit is set),
185; dividing the dividend by 2 isn't enough, and since some operations
186; might generate integer overflows even when the dividend is divided by
187; 4 (when the high part of the shifted down dividend ends up being exactly
188; half of the divisor, the result is the quotient 0x80000000, which is
189; negative...) it needs to be divided by 8. Furthermore, the divisor needs
190; to be divided by 2 (unsigned) as well, to avoid more problems with the sign.
191; In this case, a little extra fiddling with the remainder is required.
192;
193; So, the simplest way to handle this is always to divide the dividend
194; by 8, and to divide the divisor by 2 if it's highest bit is set.
195; After EDIV has been used, the quotient gets multiplied by 8 if the
196; original divisor was positive, otherwise 4. The remainder, oddly
197; enough, is *always* multiplied by 8.
198; NOTE: in the case mentioned above, where the high part of the shifted
199; down dividend ends up being exactly half the shifted down divisor, we
200; end up with a 33 bit quotient. That's no problem however, it usually
201; means we have ended up with a too large remainder as well, and the
202; problem is fixed by the last part of the algorithm (next paragraph).
203;
204; The routine ends with comparing the resulting remainder with the
205; original divisor and if the remainder is larger, subtract the
206; original divisor from it, and increase the quotient by 1. This is
207; done until the remainder is smaller than the divisor.
208;
209; The complete algorithm looks like this:
210;
211; d' = d
212; l' = l & 7
213; [h,l] = [h,l] >> 3
214; [q,r] = floor([h,l] / d) # This is the EDIV operation
215; if (q < 0) q = -q # I doubt this is necessary any more
216;
217; r' = r >> 29
218; if (d' >= 0)
219; q' = q >> 29
220; q = q << 3
221; else
222; q' = q >> 30
223; q = q << 2
224; r = (r << 3) + l'
225;
226; if (d' < 0)
227; {
228; [r',r] = [r',r] - q
229; while ([r',r] < 0)
230; {
231; [r',r] = [r',r] + d
232; [q',q] = [q',q] - 1
233; }
234; }
235;
236; while ([r',r] >= d')
237; {
238; [r',r] = [r',r] - d'
239; [q',q] = [q',q] + 1
240; }
241;
242; return q
243
244h=4 ;(AP) h by value (input)
245l=8 ;(AP) l by value (input)
246d=12 ;(AP) d by value (input)
247
248;r2 = l, q
249;r3 = h, r
250;r4 = d
251;r5 = l'
252;r6 = r'
253;r7 = d'
254;r8 = q'
255
256 .psect code,nowrt
257
258.entry bn_div_words,^m<r2,r3,r4,r5,r6,r7,r8>
259 movl l(ap),r2
260 movl h(ap),r3
261 movl d(ap),r4
262
263 bicl3 #^XFFFFFFF8,r2,r5 ; l' = l & 7
264 bicl3 #^X00000007,r2,r2
265
266 bicl3 #^XFFFFFFF8,r3,r6
267 bicl3 #^X00000007,r3,r3
268
269 addl r6,r2
270
271 rotl #-3,r2,r2 ; l = l >> 3
272 rotl #-3,r3,r3 ; h = h >> 3
273
274 movl r4,r7 ; d' = d
275
276 movl #0,r6 ; r' = 0
277 movl #0,r8 ; q' = 0
278
279 tstl r4
280 beql 666$ ; Uh-oh, the divisor is 0...
281 bgtr 1$
282 rotl #-1,r4,r4 ; If d is negative, shift it right.
283 bicl2 #^X80000000,r4 ; Since d is then a large number, the
284 ; lowest bit is insignificant
285 ; (contradict that, and I'll fix the problem!)
2861$:
287 ediv r4,r2,r2,r3 ; Do the actual division
288
289 tstl r2
290 bgeq 3$
291 mnegl r2,r2 ; if q < 0, negate it
2923$:
293 tstl r7
294 blss 4$
295 rotl #3,r2,r2 ; q = q << 3
296 bicl3 #^XFFFFFFF8,r2,r8 ; q' gets the high bits from q
297 bicl3 #^X00000007,r2,r2
298 bsb 41$
2994$: ; else
300 rotl #2,r2,r2 ; q = q << 2
301 bicl3 #^XFFFFFFFC,r2,r8 ; q' gets the high bits from q
302 bicl3 #^X00000003,r2,r2
30341$:
304 rotl #3,r3,r3 ; r = r << 3
305 bicl3 #^XFFFFFFF8,r3,r6 ; r' gets the high bits from r
306 bicl3 #^X00000007,r3,r3
307 addl r5,r3 ; r = r + l'
308
309 tstl r7
310 bgeq 5$
311 bitl #1,r7
312 beql 5$ ; if d' < 0 && d' & 1
313 subl r2,r3 ; [r',r] = [r',r] - [q',q]
314 sbwc r8,r6
31545$:
316 bgeq 5$ ; while r < 0
317 decl r2 ; [q',q] = [q',q] - 1
318 sbwc #0,r8
319 addl r7,r3 ; [r',r] = [r',r] + d'
320 adwc #0,r6
321 brb 45$
322
323; The return points are placed in the middle to keep a short distance from
324; all the branch points
32542$:
326; movl r3,r1
327 movl r2,r0
328 ret
329666$:
330 movl #^XFFFFFFFF,r0
331 ret
332
3335$:
334 tstl r6
335 bneq 6$
336 cmpl r3,r7
337 blssu 42$ ; while [r',r] >= d'
3386$:
339 subl r7,r3 ; [r',r] = [r',r] - d'
340 sbwc #0,r6
341 incl r2 ; [q',q] = [q',q] + 1
342 adwc #0,r8
343 brb 5$
344
345 .title vax_bn_add_words unsigned add of two arrays
346;
347; Richard Levitte 20-Nov-2000
348;
349; ULONG bn_add_words(ULONG r[], ULONG a[], ULONG b[], int n) {
350; ULONG c = 0;
351; int i;
352; for (i = 0; i < n; i++) <c,r[i]> = a[i] + b[i] + c;
353; return(c);
354; }
355
356r=4 ;(AP) r by reference (output)
357a=8 ;(AP) a by reference (input)
358b=12 ;(AP) b by reference (input)
359n=16 ;(AP) n by value (input)
360
361
362 .psect code,nowrt
363
364.entry bn_add_words,^m<r2,r3,r4,r5,r6>
365
366 moval @r(ap),r2
367 moval @a(ap),r3
368 moval @b(ap),r4
369 movl n(ap),r5 ; assumed >0 by C code
370 clrl r0 ; c
371
372 tstl r5 ; carry = 0
373 bleq 666$
374
3750$:
376 movl (r3)+,r6 ; carry untouched
377 adwc (r4)+,r6 ; carry used and touched
378 movl r6,(r2)+ ; carry untouched
379 sobgtr r5,0$ ; carry untouched
380
381 adwc #0,r0
382666$:
383 ret
384
385 .title vax_bn_sub_words unsigned add of two arrays
386;
387; Richard Levitte 20-Nov-2000
388;
389; ULONG bn_sub_words(ULONG r[], ULONG a[], ULONG b[], int n) {
390; ULONG c = 0;
391; int i;
392; for (i = 0; i < n; i++) <c,r[i]> = a[i] - b[i] - c;
393; return(c);
394; }
395
396r=4 ;(AP) r by reference (output)
397a=8 ;(AP) a by reference (input)
398b=12 ;(AP) b by reference (input)
399n=16 ;(AP) n by value (input)
400
401
402 .psect code,nowrt
403
404.entry bn_sub_words,^m<r2,r3,r4,r5,r6>
405
406 moval @r(ap),r2
407 moval @a(ap),r3
408 moval @b(ap),r4
409 movl n(ap),r5 ; assumed >0 by C code
410 clrl r0 ; c
411
412 tstl r5 ; carry = 0
413 bleq 666$
414
4150$:
416 movl (r3)+,r6 ; carry untouched
417 sbwc (r4)+,r6 ; carry used and touched
418 movl r6,(r2)+ ; carry untouched
419 sobgtr r5,0$ ; carry untouched
420
421 adwc #0,r0
422666$:
423 ret
424
425
426;r=4 ;(AP)
427;a=8 ;(AP)
428;b=12 ;(AP)
429;n=16 ;(AP) n by value (input)
430
431 .psect code,nowrt
432
433.entry BN_MUL_COMBA8,^m<r2,r3,r4,r5,r6,r7,r8,r9,r10,r11>
434 movab -924(sp),sp
435 clrq r8
436
437 clrl r10
438
439 movl 8(ap),r6
440 movzwl 2(r6),r3
441 movl 12(ap),r7
442 bicl3 #-65536,(r7),r2
443 movzwl 2(r7),r0
444 bicl2 #-65536,r0
445 bicl3 #-65536,(r6),-12(fp)
446 bicl3 #-65536,r3,-16(fp)
447 mull3 r0,-12(fp),-4(fp)
448 mull2 r2,-12(fp)
449 mull3 r2,-16(fp),-8(fp)
450 mull2 r0,-16(fp)
451 addl3 -4(fp),-8(fp),r0
452 bicl3 #0,r0,-4(fp)
453 cmpl -4(fp),-8(fp)
454 bgequ noname.45
455 addl2 #65536,-16(fp)
456noname.45:
457 movzwl -2(fp),r0
458 bicl2 #-65536,r0
459 addl2 r0,-16(fp)
460 bicl3 #-65536,-4(fp),r0
461 ashl #16,r0,-8(fp)
462 addl3 -8(fp),-12(fp),r0
463 bicl3 #0,r0,-12(fp)
464 cmpl -12(fp),-8(fp)
465 bgequ noname.46
466 incl -16(fp)
467noname.46:
468 movl -12(fp),r1
469 movl -16(fp),r2
470 addl2 r1,r9
471 bicl2 #0,r9
472 cmpl r9,r1
473 bgequ noname.47
474 incl r2
475noname.47:
476 addl2 r2,r8
477 bicl2 #0,r8
478 cmpl r8,r2
479 bgequ noname.48
480 incl r10
481noname.48:
482
483 movl 4(ap),r11
484 movl r9,(r11)
485
486 clrl r9
487
488 movzwl 2(r6),r2
489 bicl3 #-65536,4(r7),r3
490 movzwl 6(r7),r0
491 bicl2 #-65536,r0
492 bicl3 #-65536,(r6),-28(fp)
493 bicl3 #-65536,r2,-32(fp)
494 mull3 r0,-28(fp),-20(fp)
495 mull2 r3,-28(fp)
496 mull3 r3,-32(fp),-24(fp)
497 mull2 r0,-32(fp)
498 addl3 -20(fp),-24(fp),r0
499 bicl3 #0,r0,-20(fp)
500 cmpl -20(fp),-24(fp)
501 bgequ noname.49
502 addl2 #65536,-32(fp)
503noname.49:
504 movzwl -18(fp),r0
505 bicl2 #-65536,r0
506 addl2 r0,-32(fp)
507 bicl3 #-65536,-20(fp),r0
508 ashl #16,r0,-24(fp)
509 addl3 -24(fp),-28(fp),r0
510 bicl3 #0,r0,-28(fp)
511 cmpl -28(fp),-24(fp)
512 bgequ noname.50
513 incl -32(fp)
514noname.50:
515 movl -28(fp),r1
516 movl -32(fp),r2
517 addl2 r1,r8
518 bicl2 #0,r8
519 cmpl r8,r1
520 bgequ noname.51
521 incl r2
522noname.51:
523 addl2 r2,r10
524 bicl2 #0,r10
525 cmpl r10,r2
526 bgequ noname.52
527 incl r9
528noname.52:
529
530 movzwl 6(r6),r2
531 bicl3 #-65536,(r7),r3
532 movzwl 2(r7),r0
533 bicl2 #-65536,r0
534 bicl3 #-65536,4(r6),-44(fp)
535 bicl3 #-65536,r2,-48(fp)
536 mull3 r0,-44(fp),-36(fp)
537 mull2 r3,-44(fp)
538 mull3 r3,-48(fp),-40(fp)
539 mull2 r0,-48(fp)
540 addl3 -36(fp),-40(fp),r0
541 bicl3 #0,r0,-36(fp)
542 cmpl -36(fp),-40(fp)
543 bgequ noname.53
544 addl2 #65536,-48(fp)
545noname.53:
546 movzwl -34(fp),r0
547 bicl2 #-65536,r0
548 addl2 r0,-48(fp)
549 bicl3 #-65536,-36(fp),r0
550 ashl #16,r0,-40(fp)
551 addl3 -40(fp),-44(fp),r0
552 bicl3 #0,r0,-44(fp)
553 cmpl -44(fp),-40(fp)
554 bgequ noname.54
555 incl -48(fp)
556noname.54:
557 movl -44(fp),r1
558 movl -48(fp),r2
559 addl2 r1,r8
560 bicl2 #0,r8
561 cmpl r8,r1
562 bgequ noname.55
563 incl r2
564noname.55:
565 addl2 r2,r10
566 bicl2 #0,r10
567 cmpl r10,r2
568 bgequ noname.56
569 incl r9
570noname.56:
571
572 movl r8,4(r11)
573
574 clrl r8
575
576 movzwl 10(r6),r2
577 bicl3 #-65536,(r7),r3
578 movzwl 2(r7),r0
579 bicl2 #-65536,r0
580 bicl3 #-65536,8(r6),-60(fp)
581 bicl3 #-65536,r2,-64(fp)
582 mull3 r0,-60(fp),-52(fp)
583 mull2 r3,-60(fp)
584 mull3 r3,-64(fp),-56(fp)
585 mull2 r0,-64(fp)
586 addl3 -52(fp),-56(fp),r0
587 bicl3 #0,r0,-52(fp)
588 cmpl -52(fp),-56(fp)
589 bgequ noname.57
590 addl2 #65536,-64(fp)
591noname.57:
592 movzwl -50(fp),r0
593 bicl2 #-65536,r0
594 addl2 r0,-64(fp)
595 bicl3 #-65536,-52(fp),r0
596 ashl #16,r0,-56(fp)
597 addl3 -56(fp),-60(fp),r0
598 bicl3 #0,r0,-60(fp)
599 cmpl -60(fp),-56(fp)
600 bgequ noname.58
601 incl -64(fp)
602noname.58:
603 movl -60(fp),r1
604 movl -64(fp),r2
605 addl2 r1,r10
606 bicl2 #0,r10
607 cmpl r10,r1
608 bgequ noname.59
609 incl r2
610noname.59:
611 addl2 r2,r9
612 bicl2 #0,r9
613 cmpl r9,r2
614 bgequ noname.60
615 incl r8
616noname.60:
617
618 movzwl 6(r6),r2
619 bicl3 #-65536,4(r7),r3
620 movzwl 6(r7),r0
621 bicl2 #-65536,r0
622 bicl3 #-65536,4(r6),-76(fp)
623 bicl3 #-65536,r2,-80(fp)
624 mull3 r0,-76(fp),-68(fp)
625 mull2 r3,-76(fp)
626 mull3 r3,-80(fp),-72(fp)
627 mull2 r0,-80(fp)
628 addl3 -68(fp),-72(fp),r0
629 bicl3 #0,r0,-68(fp)
630 cmpl -68(fp),-72(fp)
631 bgequ noname.61
632 addl2 #65536,-80(fp)
633noname.61:
634 movzwl -66(fp),r0
635 bicl2 #-65536,r0
636 addl2 r0,-80(fp)
637 bicl3 #-65536,-68(fp),r0
638 ashl #16,r0,-72(fp)
639 addl3 -72(fp),-76(fp),r0
640 bicl3 #0,r0,-76(fp)
641 cmpl -76(fp),-72(fp)
642 bgequ noname.62
643 incl -80(fp)
644noname.62:
645 movl -76(fp),r1
646 movl -80(fp),r2
647 addl2 r1,r10
648 bicl2 #0,r10
649 cmpl r10,r1
650 bgequ noname.63
651 incl r2
652noname.63:
653 addl2 r2,r9
654 bicl2 #0,r9
655 cmpl r9,r2
656 bgequ noname.64
657 incl r8
658noname.64:
659
660 movzwl 2(r6),r2
661 bicl3 #-65536,8(r7),r3
662 movzwl 10(r7),r0
663 bicl2 #-65536,r0
664 bicl3 #-65536,(r6),-92(fp)
665 bicl3 #-65536,r2,-96(fp)
666 mull3 r0,-92(fp),-84(fp)
667 mull2 r3,-92(fp)
668 mull3 r3,-96(fp),-88(fp)
669 mull2 r0,-96(fp)
670 addl3 -84(fp),-88(fp),r0
671 bicl3 #0,r0,-84(fp)
672 cmpl -84(fp),-88(fp)
673 bgequ noname.65
674 addl2 #65536,-96(fp)
675noname.65:
676 movzwl -82(fp),r0
677 bicl2 #-65536,r0
678 addl2 r0,-96(fp)
679 bicl3 #-65536,-84(fp),r0
680 ashl #16,r0,-88(fp)
681 addl3 -88(fp),-92(fp),r0
682 bicl3 #0,r0,-92(fp)
683 cmpl -92(fp),-88(fp)
684 bgequ noname.66
685 incl -96(fp)
686noname.66:
687 movl -92(fp),r1
688 movl -96(fp),r2
689 addl2 r1,r10
690 bicl2 #0,r10
691 cmpl r10,r1
692 bgequ noname.67
693 incl r2
694noname.67:
695 addl2 r2,r9
696 bicl2 #0,r9
697 cmpl r9,r2
698 bgequ noname.68
699 incl r8
700noname.68:
701
702 movl r10,8(r11)
703
704 clrl r10
705
706 movzwl 2(r6),r2
707 bicl3 #-65536,12(r7),r3
708 movzwl 14(r7),r0
709 bicl2 #-65536,r0
710 bicl3 #-65536,(r6),-108(fp)
711 bicl3 #-65536,r2,-112(fp)
712 mull3 r0,-108(fp),-100(fp)
713 mull2 r3,-108(fp)
714 mull3 r3,-112(fp),-104(fp)
715 mull2 r0,-112(fp)
716 addl3 -100(fp),-104(fp),r0
717 bicl3 #0,r0,-100(fp)
718 cmpl -100(fp),-104(fp)
719 bgequ noname.69
720 addl2 #65536,-112(fp)
721noname.69:
722 movzwl -98(fp),r0
723 bicl2 #-65536,r0
724 addl2 r0,-112(fp)
725 bicl3 #-65536,-100(fp),r0
726 ashl #16,r0,-104(fp)
727 addl3 -104(fp),-108(fp),r0
728 bicl3 #0,r0,-108(fp)
729 cmpl -108(fp),-104(fp)
730 bgequ noname.70
731 incl -112(fp)
732noname.70:
733 movl -108(fp),r1
734 movl -112(fp),r2
735 addl2 r1,r9
736 bicl2 #0,r9
737 cmpl r9,r1
738 bgequ noname.71
739 incl r2
740noname.71:
741 addl2 r2,r8
742 bicl2 #0,r8
743 cmpl r8,r2
744 bgequ noname.72
745 incl r10
746noname.72:
747
748 movzwl 6(r6),r2
749 bicl3 #-65536,8(r7),r3
750 movzwl 10(r7),r0
751 bicl2 #-65536,r0
752 bicl3 #-65536,4(r6),-124(fp)
753 bicl3 #-65536,r2,-128(fp)
754 mull3 r0,-124(fp),-116(fp)
755 mull2 r3,-124(fp)
756 mull3 r3,-128(fp),-120(fp)
757 mull2 r0,-128(fp)
758 addl3 -116(fp),-120(fp),r0
759 bicl3 #0,r0,-116(fp)
760 cmpl -116(fp),-120(fp)
761 bgequ noname.73
762 addl2 #65536,-128(fp)
763noname.73:
764 movzwl -114(fp),r0
765 bicl2 #-65536,r0
766 addl2 r0,-128(fp)
767 bicl3 #-65536,-116(fp),r0
768 ashl #16,r0,-120(fp)
769 addl3 -120(fp),-124(fp),r0
770 bicl3 #0,r0,-124(fp)
771 cmpl -124(fp),-120(fp)
772 bgequ noname.74
773 incl -128(fp)
774noname.74:
775 movl -124(fp),r1
776 movl -128(fp),r2
777 addl2 r1,r9
778 bicl2 #0,r9
779 cmpl r9,r1
780 bgequ noname.75
781 incl r2
782noname.75:
783 addl2 r2,r8
784 bicl2 #0,r8
785 cmpl r8,r2
786 bgequ noname.76
787 incl r10
788noname.76:
789
790 movzwl 10(r6),r2
791 bicl3 #-65536,4(r7),r3
792 movzwl 6(r7),r0
793 bicl2 #-65536,r0
794 bicl3 #-65536,8(r6),-140(fp)
795 bicl3 #-65536,r2,-144(fp)
796 mull3 r0,-140(fp),-132(fp)
797 mull2 r3,-140(fp)
798 mull3 r3,-144(fp),-136(fp)
799 mull2 r0,-144(fp)
800 addl3 -132(fp),-136(fp),r0
801 bicl3 #0,r0,-132(fp)
802 cmpl -132(fp),-136(fp)
803 bgequ noname.77
804 addl2 #65536,-144(fp)
805noname.77:
806 movzwl -130(fp),r0
807 bicl2 #-65536,r0
808 addl2 r0,-144(fp)
809 bicl3 #-65536,-132(fp),r0
810 ashl #16,r0,-136(fp)
811 addl3 -136(fp),-140(fp),r0
812 bicl3 #0,r0,-140(fp)
813 cmpl -140(fp),-136(fp)
814 bgequ noname.78
815 incl -144(fp)
816noname.78:
817 movl -140(fp),r1
818 movl -144(fp),r2
819 addl2 r1,r9
820 bicl2 #0,r9
821 cmpl r9,r1
822 bgequ noname.79
823 incl r2
824noname.79:
825 addl2 r2,r8
826 bicl2 #0,r8
827 cmpl r8,r2
828 bgequ noname.80
829 incl r10
830noname.80:
831
832 movzwl 14(r6),r2
833 bicl3 #-65536,(r7),r3
834 movzwl 2(r7),r0
835 bicl2 #-65536,r0
836 bicl3 #-65536,12(r6),-156(fp)
837 bicl3 #-65536,r2,-160(fp)
838 mull3 r0,-156(fp),-148(fp)
839 mull2 r3,-156(fp)
840 mull3 r3,-160(fp),-152(fp)
841 mull2 r0,-160(fp)
842 addl3 -148(fp),-152(fp),r0
843 bicl3 #0,r0,-148(fp)
844 cmpl -148(fp),-152(fp)
845 bgequ noname.81
846 addl2 #65536,-160(fp)
847noname.81:
848 movzwl -146(fp),r0
849 bicl2 #-65536,r0
850 addl2 r0,-160(fp)
851 bicl3 #-65536,-148(fp),r0
852 ashl #16,r0,-152(fp)
853 addl3 -152(fp),-156(fp),r0
854 bicl3 #0,r0,-156(fp)
855 cmpl -156(fp),-152(fp)
856 bgequ noname.82
857 incl -160(fp)
858noname.82:
859 movl -156(fp),r1
860 movl -160(fp),r2
861 addl2 r1,r9
862 bicl2 #0,r9
863 cmpl r9,r1
864 bgequ noname.83
865 incl r2
866noname.83:
867 addl2 r2,r8
868 bicl2 #0,r8
869 cmpl r8,r2
870 bgequ noname.84
871 incl r10
872noname.84:
873
874 movl r9,12(r11)
875
876 clrl r9
877
878 movzwl 18(r6),r2
879 bicl3 #-65536,(r7),r3
880 movzwl 2(r7),r0
881 bicl2 #-65536,r0
882 bicl3 #-65536,16(r6),-172(fp)
883 bicl3 #-65536,r2,-176(fp)
884 mull3 r0,-172(fp),-164(fp)
885 mull2 r3,-172(fp)
886 mull3 r3,-176(fp),-168(fp)
887 mull2 r0,-176(fp)
888 addl3 -164(fp),-168(fp),r0
889 bicl3 #0,r0,-164(fp)
890 cmpl -164(fp),-168(fp)
891 bgequ noname.85
892 addl2 #65536,-176(fp)
893noname.85:
894 movzwl -162(fp),r0
895 bicl2 #-65536,r0
896 addl2 r0,-176(fp)
897 bicl3 #-65536,-164(fp),r0
898 ashl #16,r0,-168(fp)
899 addl3 -168(fp),-172(fp),r0
900 bicl3 #0,r0,-172(fp)
901 cmpl -172(fp),-168(fp)
902 bgequ noname.86
903 incl -176(fp)
904noname.86:
905 movl -172(fp),r1
906 movl -176(fp),r2
907 addl2 r1,r8
908 bicl2 #0,r8
909 cmpl r8,r1
910 bgequ noname.87
911 incl r2
912noname.87:
913 addl2 r2,r10
914 bicl2 #0,r10
915 cmpl r10,r2
916 bgequ noname.88
917 incl r9
918noname.88:
919
920 movzwl 14(r6),r2
921 bicl3 #-65536,4(r7),r3
922 movzwl 6(r7),r0
923 bicl2 #-65536,r0
924 bicl3 #-65536,12(r6),-188(fp)
925 bicl3 #-65536,r2,-192(fp)
926 mull3 r0,-188(fp),-180(fp)
927 mull2 r3,-188(fp)
928 mull3 r3,-192(fp),-184(fp)
929 mull2 r0,-192(fp)
930 addl3 -180(fp),-184(fp),r0
931 bicl3 #0,r0,-180(fp)
932 cmpl -180(fp),-184(fp)
933 bgequ noname.89
934 addl2 #65536,-192(fp)
935noname.89:
936 movzwl -178(fp),r0
937 bicl2 #-65536,r0
938 addl2 r0,-192(fp)
939 bicl3 #-65536,-180(fp),r0
940 ashl #16,r0,-184(fp)
941 addl3 -184(fp),-188(fp),r0
942 bicl3 #0,r0,-188(fp)
943 cmpl -188(fp),-184(fp)
944 bgequ noname.90
945 incl -192(fp)
946noname.90:
947 movl -188(fp),r1
948 movl -192(fp),r2
949 addl2 r1,r8
950 bicl2 #0,r8
951 cmpl r8,r1
952 bgequ noname.91
953 incl r2
954noname.91:
955 addl2 r2,r10
956 bicl2 #0,r10
957 cmpl r10,r2
958 bgequ noname.92
959 incl r9
960noname.92:
961
962 movzwl 10(r6),r2
963 bicl3 #-65536,8(r7),r3
964 movzwl 10(r7),r0
965 bicl2 #-65536,r0
966 bicl3 #-65536,8(r6),-204(fp)
967 bicl3 #-65536,r2,-208(fp)
968 mull3 r0,-204(fp),-196(fp)
969 mull2 r3,-204(fp)
970 mull3 r3,-208(fp),-200(fp)
971 mull2 r0,-208(fp)
972 addl3 -196(fp),-200(fp),r0
973 bicl3 #0,r0,-196(fp)
974 cmpl -196(fp),-200(fp)
975 bgequ noname.93
976 addl2 #65536,-208(fp)
977noname.93:
978 movzwl -194(fp),r0
979 bicl2 #-65536,r0
980 addl2 r0,-208(fp)
981 bicl3 #-65536,-196(fp),r0
982 ashl #16,r0,-200(fp)
983 addl3 -200(fp),-204(fp),r0
984 bicl3 #0,r0,-204(fp)
985 cmpl -204(fp),-200(fp)
986 bgequ noname.94
987 incl -208(fp)
988noname.94:
989 movl -204(fp),r1
990 movl -208(fp),r2
991 addl2 r1,r8
992 bicl2 #0,r8
993 cmpl r8,r1
994 bgequ noname.95
995 incl r2
996noname.95:
997 addl2 r2,r10
998 bicl2 #0,r10
999 cmpl r10,r2
1000 bgequ noname.96
1001 incl r9
1002noname.96:
1003
1004 movzwl 6(r6),r2
1005 bicl3 #-65536,12(r7),r3
1006 movzwl 14(r7),r0
1007 bicl2 #-65536,r0
1008 bicl3 #-65536,4(r6),-220(fp)
1009 bicl3 #-65536,r2,-224(fp)
1010 mull3 r0,-220(fp),-212(fp)
1011 mull2 r3,-220(fp)
1012 mull3 r3,-224(fp),-216(fp)
1013 mull2 r0,-224(fp)
1014 addl3 -212(fp),-216(fp),r0
1015 bicl3 #0,r0,-212(fp)
1016 cmpl -212(fp),-216(fp)
1017 bgequ noname.97
1018 addl2 #65536,-224(fp)
1019noname.97:
1020 movzwl -210(fp),r0
1021 bicl2 #-65536,r0
1022 addl2 r0,-224(fp)
1023 bicl3 #-65536,-212(fp),r0
1024 ashl #16,r0,-216(fp)
1025 addl3 -216(fp),-220(fp),r0
1026 bicl3 #0,r0,-220(fp)
1027 cmpl -220(fp),-216(fp)
1028 bgequ noname.98
1029 incl -224(fp)
1030noname.98:
1031 movl -220(fp),r1
1032 movl -224(fp),r2
1033 addl2 r1,r8
1034 bicl2 #0,r8
1035 cmpl r8,r1
1036 bgequ noname.99
1037 incl r2
1038noname.99:
1039 addl2 r2,r10
1040 bicl2 #0,r10
1041 cmpl r10,r2
1042 bgequ noname.100
1043 incl r9
1044noname.100:
1045
1046 movzwl 2(r6),r2
1047 bicl3 #-65536,16(r7),r3
1048 movzwl 18(r7),r0
1049 bicl2 #-65536,r0
1050 bicl3 #-65536,(r6),-236(fp)
1051 bicl3 #-65536,r2,-240(fp)
1052 mull3 r0,-236(fp),-228(fp)
1053 mull2 r3,-236(fp)
1054 mull3 r3,-240(fp),-232(fp)
1055 mull2 r0,-240(fp)
1056 addl3 -228(fp),-232(fp),r0
1057 bicl3 #0,r0,-228(fp)
1058 cmpl -228(fp),-232(fp)
1059 bgequ noname.101
1060 addl2 #65536,-240(fp)
1061noname.101:
1062 movzwl -226(fp),r0
1063 bicl2 #-65536,r0
1064 addl2 r0,-240(fp)
1065 bicl3 #-65536,-228(fp),r0
1066 ashl #16,r0,-232(fp)
1067 addl3 -232(fp),-236(fp),r0
1068 bicl3 #0,r0,-236(fp)
1069 cmpl -236(fp),-232(fp)
1070 bgequ noname.102
1071 incl -240(fp)
1072noname.102:
1073 movl -236(fp),r1
1074 movl -240(fp),r2
1075 addl2 r1,r8
1076 bicl2 #0,r8
1077 cmpl r8,r1
1078 bgequ noname.103
1079 incl r2
1080noname.103:
1081 addl2 r2,r10
1082 bicl2 #0,r10
1083 cmpl r10,r2
1084 bgequ noname.104
1085 incl r9
1086noname.104:
1087
1088 movl r8,16(r11)
1089
1090 clrl r8
1091
1092 movzwl 2(r6),r2
1093 bicl3 #-65536,20(r7),r3
1094 movzwl 22(r7),r0
1095 bicl2 #-65536,r0
1096 bicl3 #-65536,(r6),-252(fp)
1097 bicl3 #-65536,r2,-256(fp)
1098 mull3 r0,-252(fp),-244(fp)
1099 mull2 r3,-252(fp)
1100 mull3 r3,-256(fp),-248(fp)
1101 mull2 r0,-256(fp)
1102 addl3 -244(fp),-248(fp),r0
1103 bicl3 #0,r0,-244(fp)
1104 cmpl -244(fp),-248(fp)
1105 bgequ noname.105
1106 addl2 #65536,-256(fp)
1107noname.105:
1108 movzwl -242(fp),r0
1109 bicl2 #-65536,r0
1110 addl2 r0,-256(fp)
1111 bicl3 #-65536,-244(fp),r0
1112 ashl #16,r0,-248(fp)
1113 addl3 -248(fp),-252(fp),r0
1114 bicl3 #0,r0,-252(fp)
1115 cmpl -252(fp),-248(fp)
1116 bgequ noname.106
1117 incl -256(fp)
1118noname.106:
1119 movl -252(fp),r1
1120 movl -256(fp),r2
1121 addl2 r1,r10
1122 bicl2 #0,r10
1123 cmpl r10,r1
1124 bgequ noname.107
1125 incl r2
1126noname.107:
1127 addl2 r2,r9
1128 bicl2 #0,r9
1129 cmpl r9,r2
1130 bgequ noname.108
1131 incl r8
1132noname.108:
1133
1134 movzwl 6(r6),r2
1135 bicl3 #-65536,16(r7),r3
1136 movzwl 18(r7),r0
1137 bicl2 #-65536,r0
1138 bicl3 #-65536,4(r6),-268(fp)
1139 bicl3 #-65536,r2,-272(fp)
1140 mull3 r0,-268(fp),-260(fp)
1141 mull2 r3,-268(fp)
1142 mull3 r3,-272(fp),-264(fp)
1143 mull2 r0,-272(fp)
1144 addl3 -260(fp),-264(fp),r0
1145 bicl3 #0,r0,-260(fp)
1146 cmpl -260(fp),-264(fp)
1147 bgequ noname.109
1148 addl2 #65536,-272(fp)
1149noname.109:
1150 movzwl -258(fp),r0
1151 bicl2 #-65536,r0
1152 addl2 r0,-272(fp)
1153 bicl3 #-65536,-260(fp),r0
1154 ashl #16,r0,-264(fp)
1155 addl3 -264(fp),-268(fp),r0
1156 bicl3 #0,r0,-268(fp)
1157 cmpl -268(fp),-264(fp)
1158 bgequ noname.110
1159 incl -272(fp)
1160noname.110:
1161 movl -268(fp),r1
1162 movl -272(fp),r2
1163 addl2 r1,r10
1164 bicl2 #0,r10
1165 cmpl r10,r1
1166 bgequ noname.111
1167 incl r2
1168noname.111:
1169 addl2 r2,r9
1170 bicl2 #0,r9
1171 cmpl r9,r2
1172 bgequ noname.112
1173 incl r8
1174noname.112:
1175
1176 movzwl 10(r6),r2
1177 bicl3 #-65536,12(r7),r3
1178 movzwl 14(r7),r0
1179 bicl2 #-65536,r0
1180 bicl3 #-65536,8(r6),-284(fp)
1181 bicl3 #-65536,r2,-288(fp)
1182 mull3 r0,-284(fp),-276(fp)
1183 mull2 r3,-284(fp)
1184 mull3 r3,-288(fp),-280(fp)
1185 mull2 r0,-288(fp)
1186 addl3 -276(fp),-280(fp),r0
1187 bicl3 #0,r0,-276(fp)
1188 cmpl -276(fp),-280(fp)
1189 bgequ noname.113
1190 addl2 #65536,-288(fp)
1191noname.113:
1192 movzwl -274(fp),r0
1193 bicl2 #-65536,r0
1194 addl2 r0,-288(fp)
1195 bicl3 #-65536,-276(fp),r0
1196 ashl #16,r0,-280(fp)
1197 addl3 -280(fp),-284(fp),r0
1198 bicl3 #0,r0,-284(fp)
1199 cmpl -284(fp),-280(fp)
1200 bgequ noname.114
1201 incl -288(fp)
1202noname.114:
1203 movl -284(fp),r1
1204 movl -288(fp),r2
1205 addl2 r1,r10
1206 bicl2 #0,r10
1207 cmpl r10,r1
1208 bgequ noname.115
1209 incl r2
1210noname.115:
1211 addl2 r2,r9
1212 bicl2 #0,r9
1213 cmpl r9,r2
1214 bgequ noname.116
1215 incl r8
1216noname.116:
1217
1218 movzwl 14(r6),r2
1219 bicl3 #-65536,8(r7),r3
1220 movzwl 10(r7),r0
1221 bicl2 #-65536,r0
1222 bicl3 #-65536,12(r6),-300(fp)
1223 bicl3 #-65536,r2,-304(fp)
1224 mull3 r0,-300(fp),-292(fp)
1225 mull2 r3,-300(fp)
1226 mull3 r3,-304(fp),-296(fp)
1227 mull2 r0,-304(fp)
1228 addl3 -292(fp),-296(fp),r0
1229 bicl3 #0,r0,-292(fp)
1230 cmpl -292(fp),-296(fp)
1231 bgequ noname.117
1232 addl2 #65536,-304(fp)
1233noname.117:
1234 movzwl -290(fp),r0
1235 bicl2 #-65536,r0
1236 addl2 r0,-304(fp)
1237 bicl3 #-65536,-292(fp),r0
1238 ashl #16,r0,-296(fp)
1239 addl3 -296(fp),-300(fp),r0
1240 bicl3 #0,r0,-300(fp)
1241 cmpl -300(fp),-296(fp)
1242 bgequ noname.118
1243 incl -304(fp)
1244noname.118:
1245 movl -300(fp),r1
1246 movl -304(fp),r2
1247 addl2 r1,r10
1248 bicl2 #0,r10
1249 cmpl r10,r1
1250 bgequ noname.119
1251 incl r2
1252noname.119:
1253 addl2 r2,r9
1254 bicl2 #0,r9
1255 cmpl r9,r2
1256 bgequ noname.120
1257 incl r8
1258noname.120:
1259
1260 movzwl 18(r6),r2
1261 bicl3 #-65536,4(r7),r3
1262 movzwl 6(r7),r0
1263 bicl2 #-65536,r0
1264 bicl3 #-65536,16(r6),-316(fp)
1265 bicl3 #-65536,r2,-320(fp)
1266 mull3 r0,-316(fp),-308(fp)
1267 mull2 r3,-316(fp)
1268 mull3 r3,-320(fp),-312(fp)
1269 mull2 r0,-320(fp)
1270 addl3 -308(fp),-312(fp),r0
1271 bicl3 #0,r0,-308(fp)
1272 cmpl -308(fp),-312(fp)
1273 bgequ noname.121
1274 addl2 #65536,-320(fp)
1275noname.121:
1276 movzwl -306(fp),r0
1277 bicl2 #-65536,r0
1278 addl2 r0,-320(fp)
1279 bicl3 #-65536,-308(fp),r0
1280 ashl #16,r0,-312(fp)
1281 addl3 -312(fp),-316(fp),r0
1282 bicl3 #0,r0,-316(fp)
1283 cmpl -316(fp),-312(fp)
1284 bgequ noname.122
1285 incl -320(fp)
1286noname.122:
1287 movl -316(fp),r1
1288 movl -320(fp),r2
1289 addl2 r1,r10
1290 bicl2 #0,r10
1291 cmpl r10,r1
1292 bgequ noname.123
1293 incl r2
1294
1295noname.123:
1296 addl2 r2,r9
1297 bicl2 #0,r9
1298 cmpl r9,r2
1299 bgequ noname.124
1300 incl r8
1301noname.124:
1302
1303 movzwl 22(r6),r2
1304 bicl3 #-65536,(r7),r3
1305 movzwl 2(r7),r0
1306 bicl2 #-65536,r0
1307 bicl3 #-65536,20(r6),-332(fp)
1308 bicl3 #-65536,r2,-336(fp)
1309 mull3 r0,-332(fp),-324(fp)
1310 mull2 r3,-332(fp)
1311 mull3 r3,-336(fp),-328(fp)
1312 mull2 r0,-336(fp)
1313 addl3 -324(fp),-328(fp),r0
1314 bicl3 #0,r0,-324(fp)
1315 cmpl -324(fp),-328(fp)
1316 bgequ noname.125
1317 addl2 #65536,-336(fp)
1318noname.125:
1319 movzwl -322(fp),r0
1320 bicl2 #-65536,r0
1321 addl2 r0,-336(fp)
1322 bicl3 #-65536,-324(fp),r0
1323 ashl #16,r0,-328(fp)
1324 addl3 -328(fp),-332(fp),r0
1325 bicl3 #0,r0,-332(fp)
1326 cmpl -332(fp),-328(fp)
1327 bgequ noname.126
1328 incl -336(fp)
1329noname.126:
1330 movl -332(fp),r1
1331 movl -336(fp),r2
1332 addl2 r1,r10
1333 bicl2 #0,r10
1334 cmpl r10,r1
1335 bgequ noname.127
1336 incl r2
1337noname.127:
1338 addl2 r2,r9
1339 bicl2 #0,r9
1340 cmpl r9,r2
1341 bgequ noname.128
1342 incl r8
1343noname.128:
1344
1345 movl r10,20(r11)
1346
1347 clrl r10
1348
1349 movzwl 26(r6),r2
1350 bicl3 #-65536,(r7),r3
1351 movzwl 2(r7),r0
1352 bicl2 #-65536,r0
1353 bicl3 #-65536,24(r6),-348(fp)
1354 bicl3 #-65536,r2,-352(fp)
1355 mull3 r0,-348(fp),-340(fp)
1356 mull2 r3,-348(fp)
1357 mull3 r3,-352(fp),-344(fp)
1358 mull2 r0,-352(fp)
1359 addl3 -340(fp),-344(fp),r0
1360 bicl3 #0,r0,-340(fp)
1361 cmpl -340(fp),-344(fp)
1362 bgequ noname.129
1363 addl2 #65536,-352(fp)
1364noname.129:
1365 movzwl -338(fp),r0
1366 bicl2 #-65536,r0
1367 addl2 r0,-352(fp)
1368 bicl3 #-65536,-340(fp),r0
1369 ashl #16,r0,-344(fp)
1370 addl3 -344(fp),-348(fp),r0
1371 bicl3 #0,r0,-348(fp)
1372 cmpl -348(fp),-344(fp)
1373 bgequ noname.130
1374 incl -352(fp)
1375noname.130:
1376 movl -348(fp),r1
1377 movl -352(fp),r2
1378 addl2 r1,r9
1379 bicl2 #0,r9
1380 cmpl r9,r1
1381 bgequ noname.131
1382 incl r2
1383noname.131:
1384 addl2 r2,r8
1385 bicl2 #0,r8
1386 cmpl r8,r2
1387 bgequ noname.132
1388 incl r10
1389noname.132:
1390
1391 movzwl 22(r6),r2
1392 bicl3 #-65536,4(r7),r3
1393 movzwl 6(r7),r0
1394 bicl2 #-65536,r0
1395 bicl3 #-65536,20(r6),-364(fp)
1396 bicl3 #-65536,r2,-368(fp)
1397 mull3 r0,-364(fp),-356(fp)
1398 mull2 r3,-364(fp)
1399 mull3 r3,-368(fp),-360(fp)
1400 mull2 r0,-368(fp)
1401 addl3 -356(fp),-360(fp),r0
1402 bicl3 #0,r0,-356(fp)
1403 cmpl -356(fp),-360(fp)
1404 bgequ noname.133
1405 addl2 #65536,-368(fp)
1406noname.133:
1407 movzwl -354(fp),r0
1408 bicl2 #-65536,r0
1409 addl2 r0,-368(fp)
1410 bicl3 #-65536,-356(fp),r0
1411 ashl #16,r0,-360(fp)
1412 addl3 -360(fp),-364(fp),r0
1413 bicl3 #0,r0,-364(fp)
1414 cmpl -364(fp),-360(fp)
1415 bgequ noname.134
1416 incl -368(fp)
1417noname.134:
1418 movl -364(fp),r1
1419 movl -368(fp),r2
1420 addl2 r1,r9
1421 bicl2 #0,r9
1422 cmpl r9,r1
1423 bgequ noname.135
1424 incl r2
1425noname.135:
1426 addl2 r2,r8
1427 bicl2 #0,r8
1428 cmpl r8,r2
1429 bgequ noname.136
1430 incl r10
1431noname.136:
1432
1433 movzwl 18(r6),r2
1434 bicl3 #-65536,8(r7),r3
1435 movzwl 10(r7),r0
1436 bicl2 #-65536,r0
1437 bicl3 #-65536,16(r6),-380(fp)
1438 bicl3 #-65536,r2,-384(fp)
1439 mull3 r0,-380(fp),-372(fp)
1440 mull2 r3,-380(fp)
1441 mull3 r3,-384(fp),-376(fp)
1442 mull2 r0,-384(fp)
1443 addl3 -372(fp),-376(fp),r0
1444 bicl3 #0,r0,-372(fp)
1445 cmpl -372(fp),-376(fp)
1446 bgequ noname.137
1447 addl2 #65536,-384(fp)
1448noname.137:
1449 movzwl -370(fp),r0
1450 bicl2 #-65536,r0
1451 addl2 r0,-384(fp)
1452 bicl3 #-65536,-372(fp),r0
1453 ashl #16,r0,-376(fp)
1454 addl3 -376(fp),-380(fp),r0
1455 bicl3 #0,r0,-380(fp)
1456 cmpl -380(fp),-376(fp)
1457 bgequ noname.138
1458 incl -384(fp)
1459noname.138:
1460 movl -380(fp),r1
1461 movl -384(fp),r2
1462 addl2 r1,r9
1463 bicl2 #0,r9
1464 cmpl r9,r1
1465 bgequ noname.139
1466 incl r2
1467noname.139:
1468 addl2 r2,r8
1469 bicl2 #0,r8
1470 cmpl r8,r2
1471 bgequ noname.140
1472 incl r10
1473noname.140:
1474
1475 movzwl 14(r6),r2
1476 bicl3 #-65536,12(r7),r3
1477 movzwl 14(r7),r0
1478 bicl2 #-65536,r0
1479 bicl3 #-65536,12(r6),-396(fp)
1480 bicl3 #-65536,r2,-400(fp)
1481 mull3 r0,-396(fp),-388(fp)
1482 mull2 r3,-396(fp)
1483 mull3 r3,-400(fp),-392(fp)
1484 mull2 r0,-400(fp)
1485 addl3 -388(fp),-392(fp),r0
1486 bicl3 #0,r0,-388(fp)
1487 cmpl -388(fp),-392(fp)
1488 bgequ noname.141
1489 addl2 #65536,-400(fp)
1490noname.141:
1491 movzwl -386(fp),r0
1492 bicl2 #-65536,r0
1493 addl2 r0,-400(fp)
1494 bicl3 #-65536,-388(fp),r0
1495 ashl #16,r0,-392(fp)
1496 addl3 -392(fp),-396(fp),r0
1497 bicl3 #0,r0,-396(fp)
1498 cmpl -396(fp),-392(fp)
1499 bgequ noname.142
1500 incl -400(fp)
1501noname.142:
1502 movl -396(fp),r1
1503 movl -400(fp),r2
1504 addl2 r1,r9
1505 bicl2 #0,r9
1506 cmpl r9,r1
1507 bgequ noname.143
1508 incl r2
1509noname.143:
1510 addl2 r2,r8
1511 bicl2 #0,r8
1512 cmpl r8,r2
1513 bgequ noname.144
1514 incl r10
1515noname.144:
1516
1517 movzwl 10(r6),r2
1518 bicl3 #-65536,16(r7),r3
1519 movzwl 18(r7),r0
1520 bicl2 #-65536,r0
1521 bicl3 #-65536,8(r6),-412(fp)
1522 bicl3 #-65536,r2,-416(fp)
1523 mull3 r0,-412(fp),-404(fp)
1524 mull2 r3,-412(fp)
1525 mull3 r3,-416(fp),-408(fp)
1526 mull2 r0,-416(fp)
1527 addl3 -404(fp),-408(fp),r0
1528 bicl3 #0,r0,-404(fp)
1529 cmpl -404(fp),-408(fp)
1530 bgequ noname.145
1531 addl2 #65536,-416(fp)
1532noname.145:
1533 movzwl -402(fp),r0
1534 bicl2 #-65536,r0
1535 addl2 r0,-416(fp)
1536 bicl3 #-65536,-404(fp),r0
1537 ashl #16,r0,-408(fp)
1538 addl3 -408(fp),-412(fp),r0
1539 bicl3 #0,r0,-412(fp)
1540 cmpl -412(fp),-408(fp)
1541 bgequ noname.146
1542 incl -416(fp)
1543noname.146:
1544 movl -412(fp),r1
1545 movl -416(fp),r2
1546 addl2 r1,r9
1547 bicl2 #0,r9
1548 cmpl r9,r1
1549 bgequ noname.147
1550 incl r2
1551noname.147:
1552 addl2 r2,r8
1553 bicl2 #0,r8
1554 cmpl r8,r2
1555 bgequ noname.148
1556 incl r10
1557noname.148:
1558
1559 movzwl 6(r6),r2
1560 bicl3 #-65536,20(r7),r3
1561 movzwl 22(r7),r0
1562 bicl2 #-65536,r0
1563 bicl3 #-65536,4(r6),-428(fp)
1564 bicl3 #-65536,r2,-432(fp)
1565 mull3 r0,-428(fp),-420(fp)
1566 mull2 r3,-428(fp)
1567 mull3 r3,-432(fp),-424(fp)
1568 mull2 r0,-432(fp)
1569 addl3 -420(fp),-424(fp),r0
1570 bicl3 #0,r0,-420(fp)
1571 cmpl -420(fp),-424(fp)
1572 bgequ noname.149
1573 addl2 #65536,-432(fp)
1574noname.149:
1575 movzwl -418(fp),r0
1576 bicl2 #-65536,r0
1577 addl2 r0,-432(fp)
1578 bicl3 #-65536,-420(fp),r0
1579 ashl #16,r0,-424(fp)
1580 addl3 -424(fp),-428(fp),r0
1581 bicl3 #0,r0,-428(fp)
1582 cmpl -428(fp),-424(fp)
1583 bgequ noname.150
1584 incl -432(fp)
1585noname.150:
1586 movl -428(fp),r1
1587 movl -432(fp),r2
1588 addl2 r1,r9
1589 bicl2 #0,r9
1590 cmpl r9,r1
1591 bgequ noname.151
1592 incl r2
1593noname.151:
1594 addl2 r2,r8
1595 bicl2 #0,r8
1596 cmpl r8,r2
1597 bgequ noname.152
1598 incl r10
1599noname.152:
1600
1601 movzwl 2(r6),r2
1602 bicl3 #-65536,24(r7),r3
1603 movzwl 26(r7),r0
1604 bicl2 #-65536,r0
1605 bicl3 #-65536,(r6),-444(fp)
1606 bicl3 #-65536,r2,-448(fp)
1607 mull3 r0,-444(fp),-436(fp)
1608 mull2 r3,-444(fp)
1609 mull3 r3,-448(fp),-440(fp)
1610 mull2 r0,-448(fp)
1611 addl3 -436(fp),-440(fp),r0
1612 bicl3 #0,r0,-436(fp)
1613 cmpl -436(fp),-440(fp)
1614 bgequ noname.153
1615 addl2 #65536,-448(fp)
1616noname.153:
1617 movzwl -434(fp),r0
1618 bicl2 #-65536,r0
1619 addl2 r0,-448(fp)
1620 bicl3 #-65536,-436(fp),r0
1621 ashl #16,r0,-440(fp)
1622 addl3 -440(fp),-444(fp),r0
1623 bicl3 #0,r0,-444(fp)
1624 cmpl -444(fp),-440(fp)
1625 bgequ noname.154
1626 incl -448(fp)
1627noname.154:
1628 movl -444(fp),r1
1629 movl -448(fp),r2
1630 addl2 r1,r9
1631 bicl2 #0,r9
1632 cmpl r9,r1
1633 bgequ noname.155
1634 incl r2
1635noname.155:
1636 addl2 r2,r8
1637 bicl2 #0,r8
1638 cmpl r8,r2
1639 bgequ noname.156
1640 incl r10
1641noname.156:
1642
1643 movl r9,24(r11)
1644
1645 clrl r9
1646
1647 movzwl 2(r6),r2
1648 bicl3 #-65536,28(r7),r3
1649 movzwl 30(r7),r0
1650 bicl2 #-65536,r0
1651 bicl3 #-65536,(r6),-460(fp)
1652 bicl3 #-65536,r2,-464(fp)
1653 mull3 r0,-460(fp),-452(fp)
1654 mull2 r3,-460(fp)
1655 mull3 r3,-464(fp),-456(fp)
1656 mull2 r0,-464(fp)
1657 addl3 -452(fp),-456(fp),r0
1658 bicl3 #0,r0,-452(fp)
1659 cmpl -452(fp),-456(fp)
1660 bgequ noname.157
1661 addl2 #65536,-464(fp)
1662noname.157:
1663 movzwl -450(fp),r0
1664 bicl2 #-65536,r0
1665 addl2 r0,-464(fp)
1666 bicl3 #-65536,-452(fp),r0
1667 ashl #16,r0,-456(fp)
1668 addl3 -456(fp),-460(fp),r0
1669 bicl3 #0,r0,-460(fp)
1670 cmpl -460(fp),-456(fp)
1671 bgequ noname.158
1672 incl -464(fp)
1673noname.158:
1674 movl -460(fp),r1
1675 movl -464(fp),r2
1676 addl2 r1,r8
1677 bicl2 #0,r8
1678 cmpl r8,r1
1679 bgequ noname.159
1680 incl r2
1681noname.159:
1682 addl2 r2,r10
1683 bicl2 #0,r10
1684 cmpl r10,r2
1685 bgequ noname.160
1686 incl r9
1687noname.160:
1688
1689 movzwl 6(r6),r2
1690 bicl3 #-65536,24(r7),r3
1691 movzwl 26(r7),r0
1692 bicl2 #-65536,r0
1693 bicl3 #-65536,4(r6),-476(fp)
1694 bicl3 #-65536,r2,-480(fp)
1695 mull3 r0,-476(fp),-468(fp)
1696 mull2 r3,-476(fp)
1697 mull3 r3,-480(fp),-472(fp)
1698 mull2 r0,-480(fp)
1699 addl3 -468(fp),-472(fp),r0
1700 bicl3 #0,r0,-468(fp)
1701 cmpl -468(fp),-472(fp)
1702 bgequ noname.161
1703 addl2 #65536,-480(fp)
1704noname.161:
1705 movzwl -466(fp),r0
1706 bicl2 #-65536,r0
1707 addl2 r0,-480(fp)
1708 bicl3 #-65536,-468(fp),r0
1709 ashl #16,r0,-472(fp)
1710 addl3 -472(fp),-476(fp),r0
1711 bicl3 #0,r0,-476(fp)
1712 cmpl -476(fp),-472(fp)
1713 bgequ noname.162
1714 incl -480(fp)
1715noname.162:
1716 movl -476(fp),r1
1717 movl -480(fp),r2
1718 addl2 r1,r8
1719 bicl2 #0,r8
1720 cmpl r8,r1
1721 bgequ noname.163
1722 incl r2
1723noname.163:
1724 addl2 r2,r10
1725 bicl2 #0,r10
1726 cmpl r10,r2
1727 bgequ noname.164
1728 incl r9
1729noname.164:
1730
1731 movzwl 10(r6),r2
1732 bicl3 #-65536,20(r7),r3
1733 movzwl 22(r7),r0
1734 bicl2 #-65536,r0
1735 bicl3 #-65536,8(r6),-492(fp)
1736 bicl3 #-65536,r2,-496(fp)
1737 mull3 r0,-492(fp),-484(fp)
1738 mull2 r3,-492(fp)
1739 mull3 r3,-496(fp),-488(fp)
1740 mull2 r0,-496(fp)
1741 addl3 -484(fp),-488(fp),r0
1742 bicl3 #0,r0,-484(fp)
1743 cmpl -484(fp),-488(fp)
1744 bgequ noname.165
1745 addl2 #65536,-496(fp)
1746noname.165:
1747 movzwl -482(fp),r0
1748 bicl2 #-65536,r0
1749 addl2 r0,-496(fp)
1750 bicl3 #-65536,-484(fp),r0
1751 ashl #16,r0,-488(fp)
1752 addl3 -488(fp),-492(fp),r0
1753 bicl3 #0,r0,-492(fp)
1754 cmpl -492(fp),-488(fp)
1755 bgequ noname.166
1756 incl -496(fp)
1757noname.166:
1758 movl -492(fp),r1
1759 movl -496(fp),r2
1760 addl2 r1,r8
1761 bicl2 #0,r8
1762 cmpl r8,r1
1763 bgequ noname.167
1764 incl r2
1765noname.167:
1766 addl2 r2,r10
1767 bicl2 #0,r10
1768 cmpl r10,r2
1769 bgequ noname.168
1770 incl r9
1771noname.168:
1772
1773 movzwl 14(r6),r2
1774 bicl3 #-65536,16(r7),r3
1775 movzwl 18(r7),r0
1776 bicl2 #-65536,r0
1777 bicl3 #-65536,12(r6),-508(fp)
1778 bicl3 #-65536,r2,-512(fp)
1779 mull3 r0,-508(fp),-500(fp)
1780 mull2 r3,-508(fp)
1781 mull3 r3,-512(fp),-504(fp)
1782 mull2 r0,-512(fp)
1783 addl3 -500(fp),-504(fp),r0
1784 bicl3 #0,r0,-500(fp)
1785 cmpl -500(fp),-504(fp)
1786 bgequ noname.169
1787 addl2 #65536,-512(fp)
1788noname.169:
1789 movzwl -498(fp),r0
1790 bicl2 #-65536,r0
1791 addl2 r0,-512(fp)
1792 bicl3 #-65536,-500(fp),r0
1793 ashl #16,r0,-504(fp)
1794 addl3 -504(fp),-508(fp),r0
1795 bicl3 #0,r0,-508(fp)
1796 cmpl -508(fp),-504(fp)
1797 bgequ noname.170
1798 incl -512(fp)
1799noname.170:
1800 movl -508(fp),r1
1801 movl -512(fp),r2
1802 addl2 r1,r8
1803 bicl2 #0,r8
1804 cmpl r8,r1
1805 bgequ noname.171
1806 incl r2
1807noname.171:
1808 addl2 r2,r10
1809 bicl2 #0,r10
1810 cmpl r10,r2
1811 bgequ noname.172
1812 incl r9
1813noname.172:
1814
1815 movzwl 18(r6),r2
1816 bicl3 #-65536,12(r7),r3
1817 movzwl 14(r7),r0
1818 bicl2 #-65536,r0
1819 bicl3 #-65536,16(r6),-524(fp)
1820 bicl3 #-65536,r2,-528(fp)
1821 mull3 r0,-524(fp),-516(fp)
1822 mull2 r3,-524(fp)
1823 mull3 r3,-528(fp),-520(fp)
1824 mull2 r0,-528(fp)
1825 addl3 -516(fp),-520(fp),r0
1826 bicl3 #0,r0,-516(fp)
1827 cmpl -516(fp),-520(fp)
1828 bgequ noname.173
1829 addl2 #65536,-528(fp)
1830noname.173:
1831 movzwl -514(fp),r0
1832 bicl2 #-65536,r0
1833 addl2 r0,-528(fp)
1834 bicl3 #-65536,-516(fp),r0
1835 ashl #16,r0,-520(fp)
1836 addl3 -520(fp),-524(fp),r0
1837 bicl3 #0,r0,-524(fp)
1838 cmpl -524(fp),-520(fp)
1839 bgequ noname.174
1840 incl -528(fp)
1841noname.174:
1842 movl -524(fp),r1
1843 movl -528(fp),r2
1844 addl2 r1,r8
1845 bicl2 #0,r8
1846 cmpl r8,r1
1847 bgequ noname.175
1848 incl r2
1849noname.175:
1850 addl2 r2,r10
1851 bicl2 #0,r10
1852 cmpl r10,r2
1853 bgequ noname.176
1854 incl r9
1855noname.176:
1856
1857 movzwl 22(r6),r2
1858 bicl3 #-65536,8(r7),r3
1859 movzwl 10(r7),r0
1860 bicl2 #-65536,r0
1861 bicl3 #-65536,20(r6),-540(fp)
1862 bicl3 #-65536,r2,-544(fp)
1863 mull3 r0,-540(fp),-532(fp)
1864 mull2 r3,-540(fp)
1865 mull3 r3,-544(fp),-536(fp)
1866 mull2 r0,-544(fp)
1867 addl3 -532(fp),-536(fp),r0
1868 bicl3 #0,r0,-532(fp)
1869 cmpl -532(fp),-536(fp)
1870 bgequ noname.177
1871 addl2 #65536,-544(fp)
1872noname.177:
1873 movzwl -530(fp),r0
1874 bicl2 #-65536,r0
1875 addl2 r0,-544(fp)
1876 bicl3 #-65536,-532(fp),r0
1877 ashl #16,r0,-536(fp)
1878 addl3 -536(fp),-540(fp),r0
1879 bicl3 #0,r0,-540(fp)
1880 cmpl -540(fp),-536(fp)
1881 bgequ noname.178
1882 incl -544(fp)
1883noname.178:
1884 movl -540(fp),r1
1885 movl -544(fp),r2
1886 addl2 r1,r8
1887 bicl2 #0,r8
1888 cmpl r8,r1
1889 bgequ noname.179
1890 incl r2
1891noname.179:
1892 addl2 r2,r10
1893 bicl2 #0,r10
1894 cmpl r10,r2
1895 bgequ noname.180
1896 incl r9
1897noname.180:
1898
1899 movzwl 26(r6),r2
1900 bicl3 #-65536,4(r7),r3
1901 movzwl 6(r7),r0
1902 bicl2 #-65536,r0
1903 bicl3 #-65536,24(r6),-556(fp)
1904 bicl3 #-65536,r2,-560(fp)
1905 mull3 r0,-556(fp),-548(fp)
1906 mull2 r3,-556(fp)
1907 mull3 r3,-560(fp),-552(fp)
1908 mull2 r0,-560(fp)
1909 addl3 -548(fp),-552(fp),r0
1910 bicl3 #0,r0,-548(fp)
1911 cmpl -548(fp),-552(fp)
1912 bgequ noname.181
1913 addl2 #65536,-560(fp)
1914noname.181:
1915 movzwl -546(fp),r0
1916 bicl2 #-65536,r0
1917 addl2 r0,-560(fp)
1918 bicl3 #-65536,-548(fp),r0
1919 ashl #16,r0,-552(fp)
1920 addl3 -552(fp),-556(fp),r0
1921 bicl3 #0,r0,-556(fp)
1922 cmpl -556(fp),-552(fp)
1923 bgequ noname.182
1924 incl -560(fp)
1925noname.182:
1926 movl -556(fp),r1
1927 movl -560(fp),r2
1928 addl2 r1,r8
1929 bicl2 #0,r8
1930 cmpl r8,r1
1931 bgequ noname.183
1932 incl r2
1933noname.183:
1934 addl2 r2,r10
1935 bicl2 #0,r10
1936 cmpl r10,r2
1937 bgequ noname.184
1938 incl r9
1939noname.184:
1940
1941 movzwl 30(r6),r2
1942 bicl3 #-65536,(r7),r3
1943 movzwl 2(r7),r0
1944 bicl2 #-65536,r0
1945 bicl3 #-65536,28(r6),-572(fp)
1946 bicl3 #-65536,r2,-576(fp)
1947 mull3 r0,-572(fp),-564(fp)
1948 mull2 r3,-572(fp)
1949 mull3 r3,-576(fp),-568(fp)
1950 mull2 r0,-576(fp)
1951 addl3 -564(fp),-568(fp),r0
1952 bicl3 #0,r0,-564(fp)
1953 cmpl -564(fp),-568(fp)
1954 bgequ noname.185
1955 addl2 #65536,-576(fp)
1956noname.185:
1957 movzwl -562(fp),r0
1958 bicl2 #-65536,r0
1959 addl2 r0,-576(fp)
1960 bicl3 #-65536,-564(fp),r0
1961 ashl #16,r0,-568(fp)
1962 addl3 -568(fp),-572(fp),r0
1963 bicl3 #0,r0,-572(fp)
1964 cmpl -572(fp),-568(fp)
1965 bgequ noname.186
1966 incl -576(fp)
1967noname.186:
1968 movl -572(fp),r1
1969 movl -576(fp),r2
1970 addl2 r1,r8
1971 bicl2 #0,r8
1972 cmpl r8,r1
1973 bgequ noname.187
1974 incl r2
1975noname.187:
1976 addl2 r2,r10
1977 bicl2 #0,r10
1978 cmpl r10,r2
1979 bgequ noname.188
1980 incl r9
1981noname.188:
1982
1983 movl r8,28(r11)
1984
1985 clrl r8
1986
1987 movzwl 30(r6),r2
1988 bicl3 #-65536,4(r7),r3
1989 movzwl 6(r7),r0
1990 bicl2 #-65536,r0
1991 bicl3 #-65536,28(r6),-588(fp)
1992 bicl3 #-65536,r2,-592(fp)
1993 mull3 r0,-588(fp),-580(fp)
1994 mull2 r3,-588(fp)
1995 mull3 r3,-592(fp),-584(fp)
1996 mull2 r0,-592(fp)
1997 addl3 -580(fp),-584(fp),r0
1998 bicl3 #0,r0,-580(fp)
1999 cmpl -580(fp),-584(fp)
2000 bgequ noname.189
2001 addl2 #65536,-592(fp)
2002noname.189:
2003 movzwl -578(fp),r0
2004 bicl2 #-65536,r0
2005 addl2 r0,-592(fp)
2006 bicl3 #-65536,-580(fp),r0
2007 ashl #16,r0,-584(fp)
2008 addl3 -584(fp),-588(fp),r0
2009 bicl3 #0,r0,-588(fp)
2010 cmpl -588(fp),-584(fp)
2011 bgequ noname.190
2012 incl -592(fp)
2013noname.190:
2014 movl -588(fp),r1
2015 movl -592(fp),r2
2016 addl2 r1,r10
2017 bicl2 #0,r10
2018 cmpl r10,r1
2019 bgequ noname.191
2020 incl r2
2021noname.191:
2022 addl2 r2,r9
2023 bicl2 #0,r9
2024 cmpl r9,r2
2025 bgequ noname.192
2026 incl r8
2027noname.192:
2028
2029 movzwl 26(r6),r2
2030 bicl3 #-65536,8(r7),r3
2031 movzwl 10(r7),r0
2032 bicl2 #-65536,r0
2033 bicl3 #-65536,24(r6),-604(fp)
2034 bicl3 #-65536,r2,-608(fp)
2035 mull3 r0,-604(fp),-596(fp)
2036 mull2 r3,-604(fp)
2037 mull3 r3,-608(fp),-600(fp)
2038 mull2 r0,-608(fp)
2039 addl3 -596(fp),-600(fp),r0
2040 bicl3 #0,r0,-596(fp)
2041 cmpl -596(fp),-600(fp)
2042 bgequ noname.193
2043 addl2 #65536,-608(fp)
2044noname.193:
2045 movzwl -594(fp),r0
2046 bicl2 #-65536,r0
2047 addl2 r0,-608(fp)
2048 bicl3 #-65536,-596(fp),r0
2049 ashl #16,r0,-600(fp)
2050 addl3 -600(fp),-604(fp),r0
2051 bicl3 #0,r0,-604(fp)
2052 cmpl -604(fp),-600(fp)
2053 bgequ noname.194
2054 incl -608(fp)
2055noname.194:
2056 movl -604(fp),r1
2057 movl -608(fp),r2
2058 addl2 r1,r10
2059 bicl2 #0,r10
2060 cmpl r10,r1
2061 bgequ noname.195
2062 incl r2
2063noname.195:
2064 addl2 r2,r9
2065 bicl2 #0,r9
2066 cmpl r9,r2
2067 bgequ noname.196
2068 incl r8
2069noname.196:
2070
2071 movzwl 22(r6),r2
2072 bicl3 #-65536,12(r7),r3
2073 movzwl 14(r7),r0
2074 bicl2 #-65536,r0
2075 bicl3 #-65536,20(r6),-620(fp)
2076 bicl3 #-65536,r2,-624(fp)
2077 mull3 r0,-620(fp),-612(fp)
2078 mull2 r3,-620(fp)
2079 mull3 r3,-624(fp),-616(fp)
2080 mull2 r0,-624(fp)
2081 addl3 -612(fp),-616(fp),r0
2082 bicl3 #0,r0,-612(fp)
2083 cmpl -612(fp),-616(fp)
2084 bgequ noname.197
2085 addl2 #65536,-624(fp)
2086noname.197:
2087 movzwl -610(fp),r0
2088 bicl2 #-65536,r0
2089 addl2 r0,-624(fp)
2090 bicl3 #-65536,-612(fp),r0
2091 ashl #16,r0,-616(fp)
2092 addl3 -616(fp),-620(fp),r0
2093 bicl3 #0,r0,-620(fp)
2094 cmpl -620(fp),-616(fp)
2095 bgequ noname.198
2096 incl -624(fp)
2097noname.198:
2098 movl -620(fp),r1
2099 movl -624(fp),r2
2100 addl2 r1,r10
2101 bicl2 #0,r10
2102 cmpl r10,r1
2103 bgequ noname.199
2104 incl r2
2105noname.199:
2106 addl2 r2,r9
2107 bicl2 #0,r9
2108 cmpl r9,r2
2109 bgequ noname.200
2110 incl r8
2111noname.200:
2112
2113 movzwl 18(r6),r2
2114 bicl3 #-65536,16(r7),r3
2115 movzwl 18(r7),r0
2116 bicl2 #-65536,r0
2117 bicl3 #-65536,16(r6),-636(fp)
2118 bicl3 #-65536,r2,-640(fp)
2119 mull3 r0,-636(fp),-628(fp)
2120 mull2 r3,-636(fp)
2121 mull3 r3,-640(fp),-632(fp)
2122 mull2 r0,-640(fp)
2123 addl3 -628(fp),-632(fp),r0
2124 bicl3 #0,r0,-628(fp)
2125 cmpl -628(fp),-632(fp)
2126 bgequ noname.201
2127 addl2 #65536,-640(fp)
2128noname.201:
2129 movzwl -626(fp),r0
2130 bicl2 #-65536,r0
2131 addl2 r0,-640(fp)
2132 bicl3 #-65536,-628(fp),r0
2133 ashl #16,r0,-632(fp)
2134 addl3 -632(fp),-636(fp),r0
2135 bicl3 #0,r0,-636(fp)
2136 cmpl -636(fp),-632(fp)
2137 bgequ noname.202
2138 incl -640(fp)
2139noname.202:
2140 movl -636(fp),r1
2141 movl -640(fp),r2
2142 addl2 r1,r10
2143 bicl2 #0,r10
2144 cmpl r10,r1
2145 bgequ noname.203
2146 incl r2
2147noname.203:
2148 addl2 r2,r9
2149 bicl2 #0,r9
2150 cmpl r9,r2
2151 bgequ noname.204
2152 incl r8
2153noname.204:
2154
2155 movzwl 14(r6),r2
2156 bicl3 #-65536,20(r7),r3
2157 movzwl 22(r7),r0
2158 bicl2 #-65536,r0
2159 bicl3 #-65536,12(r6),-652(fp)
2160 bicl3 #-65536,r2,-656(fp)
2161 mull3 r0,-652(fp),-644(fp)
2162 mull2 r3,-652(fp)
2163 mull3 r3,-656(fp),-648(fp)
2164 mull2 r0,-656(fp)
2165 addl3 -644(fp),-648(fp),r0
2166 bicl3 #0,r0,-644(fp)
2167 cmpl -644(fp),-648(fp)
2168 bgequ noname.205
2169 addl2 #65536,-656(fp)
2170noname.205:
2171 movzwl -642(fp),r0
2172 bicl2 #-65536,r0
2173 addl2 r0,-656(fp)
2174 bicl3 #-65536,-644(fp),r0
2175 ashl #16,r0,-648(fp)
2176 addl3 -648(fp),-652(fp),r0
2177 bicl3 #0,r0,-652(fp)
2178 cmpl -652(fp),-648(fp)
2179 bgequ noname.206
2180 incl -656(fp)
2181noname.206:
2182 movl -652(fp),r1
2183 movl -656(fp),r2
2184 addl2 r1,r10
2185 bicl2 #0,r10
2186 cmpl r10,r1
2187 bgequ noname.207
2188 incl r2
2189noname.207:
2190 addl2 r2,r9
2191 bicl2 #0,r9
2192 cmpl r9,r2
2193 bgequ noname.208
2194 incl r8
2195noname.208:
2196
2197 movzwl 10(r6),r2
2198 bicl3 #-65536,24(r7),r3
2199 movzwl 26(r7),r0
2200 bicl2 #-65536,r0
2201 bicl3 #-65536,8(r6),-668(fp)
2202 bicl3 #-65536,r2,-672(fp)
2203 mull3 r0,-668(fp),-660(fp)
2204 mull2 r3,-668(fp)
2205 mull3 r3,-672(fp),-664(fp)
2206 mull2 r0,-672(fp)
2207 addl3 -660(fp),-664(fp),r0
2208 bicl3 #0,r0,-660(fp)
2209 cmpl -660(fp),-664(fp)
2210 bgequ noname.209
2211 addl2 #65536,-672(fp)
2212noname.209:
2213 movzwl -658(fp),r0
2214 bicl2 #-65536,r0
2215 addl2 r0,-672(fp)
2216 bicl3 #-65536,-660(fp),r0
2217 ashl #16,r0,-664(fp)
2218 addl3 -664(fp),-668(fp),r0
2219 bicl3 #0,r0,-668(fp)
2220 cmpl -668(fp),-664(fp)
2221 bgequ noname.210
2222 incl -672(fp)
2223noname.210:
2224 movl -668(fp),r1
2225 movl -672(fp),r2
2226 addl2 r1,r10
2227 bicl2 #0,r10
2228 cmpl r10,r1
2229 bgequ noname.211
2230 incl r2
2231noname.211:
2232 addl2 r2,r9
2233 bicl2 #0,r9
2234 cmpl r9,r2
2235 bgequ noname.212
2236 incl r8
2237noname.212:
2238
2239 movzwl 6(r6),r2
2240 bicl3 #-65536,28(r7),r3
2241 movzwl 30(r7),r0
2242 bicl2 #-65536,r0
2243 bicl3 #-65536,4(r6),-684(fp)
2244 bicl3 #-65536,r2,-688(fp)
2245 mull3 r0,-684(fp),-676(fp)
2246 mull2 r3,-684(fp)
2247 mull3 r3,-688(fp),-680(fp)
2248 mull2 r0,-688(fp)
2249 addl3 -676(fp),-680(fp),r0
2250 bicl3 #0,r0,-676(fp)
2251 cmpl -676(fp),-680(fp)
2252 bgequ noname.213
2253 addl2 #65536,-688(fp)
2254noname.213:
2255 movzwl -674(fp),r0
2256 bicl2 #-65536,r0
2257 addl2 r0,-688(fp)
2258 bicl3 #-65536,-676(fp),r0
2259 ashl #16,r0,-680(fp)
2260 addl3 -680(fp),-684(fp),r0
2261 bicl3 #0,r0,-684(fp)
2262 cmpl -684(fp),-680(fp)
2263 bgequ noname.214
2264 incl -688(fp)
2265noname.214:
2266 movl -684(fp),r1
2267 movl -688(fp),r2
2268 addl2 r1,r10
2269 bicl2 #0,r10
2270 cmpl r10,r1
2271 bgequ noname.215
2272 incl r2
2273noname.215:
2274 addl2 r2,r9
2275 bicl2 #0,r9
2276 cmpl r9,r2
2277 bgequ noname.216
2278 incl r8
2279noname.216:
2280
2281 movl r10,32(r11)
2282
2283 clrl r10
2284
2285 movzwl 10(r6),r2
2286 bicl3 #-65536,28(r7),r3
2287 movzwl 30(r7),r0
2288 bicl2 #-65536,r0
2289 bicl3 #-65536,8(r6),-700(fp)
2290 bicl3 #-65536,r2,-704(fp)
2291 mull3 r0,-700(fp),-692(fp)
2292 mull2 r3,-700(fp)
2293 mull3 r3,-704(fp),-696(fp)
2294 mull2 r0,-704(fp)
2295 addl3 -692(fp),-696(fp),r0
2296 bicl3 #0,r0,-692(fp)
2297 cmpl -692(fp),-696(fp)
2298 bgequ noname.217
2299 addl2 #65536,-704(fp)
2300noname.217:
2301 movzwl -690(fp),r0
2302 bicl2 #-65536,r0
2303 addl2 r0,-704(fp)
2304 bicl3 #-65536,-692(fp),r0
2305 ashl #16,r0,-696(fp)
2306 addl3 -696(fp),-700(fp),r0
2307 bicl3 #0,r0,-700(fp)
2308 cmpl -700(fp),-696(fp)
2309 bgequ noname.218
2310 incl -704(fp)
2311noname.218:
2312 movl -700(fp),r1
2313 movl -704(fp),r2
2314 addl2 r1,r9
2315 bicl2 #0,r9
2316 cmpl r9,r1
2317 bgequ noname.219
2318 incl r2
2319noname.219:
2320 addl2 r2,r8
2321 bicl2 #0,r8
2322 cmpl r8,r2
2323 bgequ noname.220
2324 incl r10
2325noname.220:
2326
2327 movzwl 14(r6),r2
2328 bicl3 #-65536,24(r7),r3
2329 movzwl 26(r7),r0
2330 bicl2 #-65536,r0
2331 bicl3 #-65536,12(r6),-716(fp)
2332 bicl3 #-65536,r2,-720(fp)
2333 mull3 r0,-716(fp),-708(fp)
2334 mull2 r3,-716(fp)
2335 mull3 r3,-720(fp),-712(fp)
2336 mull2 r0,-720(fp)
2337 addl3 -708(fp),-712(fp),r0
2338 bicl3 #0,r0,-708(fp)
2339 cmpl -708(fp),-712(fp)
2340 bgequ noname.221
2341 addl2 #65536,-720(fp)
2342noname.221:
2343 movzwl -706(fp),r0
2344 bicl2 #-65536,r0
2345 addl2 r0,-720(fp)
2346 bicl3 #-65536,-708(fp),r0
2347 ashl #16,r0,-712(fp)
2348 addl3 -712(fp),-716(fp),r0
2349 bicl3 #0,r0,-716(fp)
2350 cmpl -716(fp),-712(fp)
2351 bgequ noname.222
2352 incl -720(fp)
2353noname.222:
2354 movl -716(fp),r1
2355 movl -720(fp),r2
2356 addl2 r1,r9
2357 bicl2 #0,r9
2358 cmpl r9,r1
2359 bgequ noname.223
2360 incl r2
2361noname.223:
2362 addl2 r2,r8
2363 bicl2 #0,r8
2364 cmpl r8,r2
2365 bgequ noname.224
2366 incl r10
2367noname.224:
2368
2369 movzwl 18(r6),r2
2370 bicl3 #-65536,20(r7),r3
2371 movzwl 22(r7),r0
2372 bicl2 #-65536,r0
2373 bicl3 #-65536,16(r6),-732(fp)
2374 bicl3 #-65536,r2,-736(fp)
2375 mull3 r0,-732(fp),-724(fp)
2376 mull2 r3,-732(fp)
2377 mull3 r3,-736(fp),-728(fp)
2378 mull2 r0,-736(fp)
2379 addl3 -724(fp),-728(fp),r0
2380 bicl3 #0,r0,-724(fp)
2381 cmpl -724(fp),-728(fp)
2382 bgequ noname.225
2383 addl2 #65536,-736(fp)
2384noname.225:
2385 movzwl -722(fp),r0
2386 bicl2 #-65536,r0
2387 addl2 r0,-736(fp)
2388 bicl3 #-65536,-724(fp),r0
2389 ashl #16,r0,-728(fp)
2390 addl3 -728(fp),-732(fp),r0
2391 bicl3 #0,r0,-732(fp)
2392 cmpl -732(fp),-728(fp)
2393 bgequ noname.226
2394 incl -736(fp)
2395noname.226:
2396 movl -732(fp),r1
2397 movl -736(fp),r2
2398 addl2 r1,r9
2399 bicl2 #0,r9
2400 cmpl r9,r1
2401 bgequ noname.227
2402 incl r2
2403noname.227:
2404 addl2 r2,r8
2405 bicl2 #0,r8
2406 cmpl r8,r2
2407 bgequ noname.228
2408 incl r10
2409noname.228:
2410
2411 movzwl 22(r6),r2
2412 bicl3 #-65536,16(r7),r3
2413 movzwl 18(r7),r0
2414 bicl2 #-65536,r0
2415 bicl3 #-65536,20(r6),-748(fp)
2416 bicl3 #-65536,r2,-752(fp)
2417 mull3 r0,-748(fp),-740(fp)
2418 mull2 r3,-748(fp)
2419 mull3 r3,-752(fp),-744(fp)
2420 mull2 r0,-752(fp)
2421 addl3 -740(fp),-744(fp),r0
2422 bicl3 #0,r0,-740(fp)
2423 cmpl -740(fp),-744(fp)
2424 bgequ noname.229
2425 addl2 #65536,-752(fp)
2426noname.229:
2427 movzwl -738(fp),r0
2428 bicl2 #-65536,r0
2429 addl2 r0,-752(fp)
2430 bicl3 #-65536,-740(fp),r0
2431 ashl #16,r0,-744(fp)
2432 addl3 -744(fp),-748(fp),r0
2433 bicl3 #0,r0,-748(fp)
2434 cmpl -748(fp),-744(fp)
2435 bgequ noname.230
2436 incl -752(fp)
2437noname.230:
2438 movl -748(fp),r1
2439 movl -752(fp),r2
2440 addl2 r1,r9
2441 bicl2 #0,r9
2442 cmpl r9,r1
2443 bgequ noname.231
2444 incl r2
2445noname.231:
2446 addl2 r2,r8
2447 bicl2 #0,r8
2448 cmpl r8,r2
2449 bgequ noname.232
2450 incl r10
2451noname.232:
2452
2453 movzwl 26(r6),r2
2454 bicl3 #-65536,12(r7),r3
2455 movzwl 14(r7),r0
2456 bicl2 #-65536,r0
2457 bicl3 #-65536,24(r6),-764(fp)
2458 bicl3 #-65536,r2,-768(fp)
2459 mull3 r0,-764(fp),-756(fp)
2460 mull2 r3,-764(fp)
2461 mull3 r3,-768(fp),-760(fp)
2462 mull2 r0,-768(fp)
2463 addl3 -756(fp),-760(fp),r0
2464 bicl3 #0,r0,-756(fp)
2465 cmpl -756(fp),-760(fp)
2466 bgequ noname.233
2467 addl2 #65536,-768(fp)
2468noname.233:
2469 movzwl -754(fp),r0
2470 bicl2 #-65536,r0
2471 addl2 r0,-768(fp)
2472 bicl3 #-65536,-756(fp),r0
2473 ashl #16,r0,-760(fp)
2474 addl3 -760(fp),-764(fp),r0
2475 bicl3 #0,r0,-764(fp)
2476 cmpl -764(fp),-760(fp)
2477 bgequ noname.234
2478 incl -768(fp)
2479noname.234:
2480 movl -764(fp),r1
2481 movl -768(fp),r2
2482 addl2 r1,r9
2483 bicl2 #0,r9
2484 cmpl r9,r1
2485 bgequ noname.235
2486 incl r2
2487noname.235:
2488 addl2 r2,r8
2489 bicl2 #0,r8
2490 cmpl r8,r2
2491 bgequ noname.236
2492 incl r10
2493noname.236:
2494
2495 bicl3 #-65536,28(r6),r3
2496 movzwl 30(r6),r1
2497 bicl2 #-65536,r1
2498 bicl3 #-65536,8(r7),r2
2499 movzwl 10(r7),r0
2500 bicl2 #-65536,r0
2501 movl r3,r5
2502 movl r1,r4
2503 mull3 r0,r5,-772(fp)
2504 mull2 r2,r5
2505 mull3 r2,r4,-776(fp)
2506 mull2 r0,r4
2507 addl3 -772(fp),-776(fp),r0
2508 bicl3 #0,r0,-772(fp)
2509 cmpl -772(fp),-776(fp)
2510 bgequ noname.237
2511 addl2 #65536,r4
2512noname.237:
2513 movzwl -770(fp),r0
2514 bicl2 #-65536,r0
2515 addl2 r0,r4
2516 bicl3 #-65536,-772(fp),r0
2517 ashl #16,r0,-776(fp)
2518 addl2 -776(fp),r5
2519 bicl2 #0,r5
2520 cmpl r5,-776(fp)
2521 bgequ noname.238
2522 incl r4
2523noname.238:
2524 movl r5,r1
2525 movl r4,r2
2526 addl2 r1,r9
2527 bicl2 #0,r9
2528 cmpl r9,r1
2529 bgequ noname.239
2530 incl r2
2531noname.239:
2532 addl2 r2,r8
2533 bicl2 #0,r8
2534 cmpl r8,r2
2535 bgequ noname.240
2536 incl r10
2537noname.240:
2538
2539 movl r9,36(r11)
2540
2541 clrl r9
2542
2543 bicl3 #-65536,28(r6),r3
2544 movzwl 30(r6),r1
2545 bicl2 #-65536,r1
2546 bicl3 #-65536,12(r7),r2
2547 movzwl 14(r7),r0
2548 bicl2 #-65536,r0
2549 movl r3,r5
2550 movl r1,r4
2551 mull3 r0,r5,-780(fp)
2552 mull2 r2,r5
2553 mull3 r2,r4,-784(fp)
2554 mull2 r0,r4
2555 addl3 -780(fp),-784(fp),r0
2556 bicl3 #0,r0,-780(fp)
2557 cmpl -780(fp),-784(fp)
2558 bgequ noname.241
2559 addl2 #65536,r4
2560noname.241:
2561 movzwl -778(fp),r0
2562 bicl2 #-65536,r0
2563 addl2 r0,r4
2564 bicl3 #-65536,-780(fp),r0
2565 ashl #16,r0,-784(fp)
2566 addl2 -784(fp),r5
2567 bicl2 #0,r5
2568 cmpl r5,-784(fp)
2569 bgequ noname.242
2570 incl r4
2571noname.242:
2572 movl r5,r1
2573 movl r4,r2
2574 addl2 r1,r8
2575 bicl2 #0,r8
2576 cmpl r8,r1
2577 bgequ noname.243
2578 incl r2
2579noname.243:
2580 addl2 r2,r10
2581 bicl2 #0,r10
2582 cmpl r10,r2
2583 bgequ noname.244
2584 incl r9
2585noname.244:
2586
2587 bicl3 #-65536,24(r6),r3
2588 movzwl 26(r6),r1
2589 bicl2 #-65536,r1
2590 bicl3 #-65536,16(r7),r2
2591 movzwl 18(r7),r0
2592 bicl2 #-65536,r0
2593 movl r3,r5
2594 movl r1,r4
2595 mull3 r0,r5,-788(fp)
2596 mull2 r2,r5
2597 mull3 r2,r4,-792(fp)
2598 mull2 r0,r4
2599 addl3 -788(fp),-792(fp),r0
2600 bicl3 #0,r0,-788(fp)
2601 cmpl -788(fp),-792(fp)
2602 bgequ noname.245
2603 addl2 #65536,r4
2604noname.245:
2605 movzwl -786(fp),r0
2606 bicl2 #-65536,r0
2607 addl2 r0,r4
2608 bicl3 #-65536,-788(fp),r0
2609 ashl #16,r0,-792(fp)
2610 addl2 -792(fp),r5
2611 bicl2 #0,r5
2612 cmpl r5,-792(fp)
2613 bgequ noname.246
2614 incl r4
2615noname.246:
2616 movl r5,r1
2617 movl r4,r2
2618 addl2 r1,r8
2619 bicl2 #0,r8
2620 cmpl r8,r1
2621 bgequ noname.247
2622 incl r2
2623noname.247:
2624 addl2 r2,r10
2625 bicl2 #0,r10
2626 cmpl r10,r2
2627 bgequ noname.248
2628 incl r9
2629noname.248:
2630
2631 bicl3 #-65536,20(r6),r3
2632 movzwl 22(r6),r1
2633 bicl2 #-65536,r1
2634 bicl3 #-65536,20(r7),r2
2635 movzwl 22(r7),r0
2636 bicl2 #-65536,r0
2637 movl r3,r5
2638 movl r1,r4
2639 mull3 r0,r5,-796(fp)
2640 mull2 r2,r5
2641 mull3 r2,r4,-800(fp)
2642 mull2 r0,r4
2643 addl3 -796(fp),-800(fp),r0
2644 bicl3 #0,r0,-796(fp)
2645 cmpl -796(fp),-800(fp)
2646 bgequ noname.249
2647 addl2 #65536,r4
2648noname.249:
2649 movzwl -794(fp),r0
2650 bicl2 #-65536,r0
2651 addl2 r0,r4
2652 bicl3 #-65536,-796(fp),r0
2653 ashl #16,r0,-800(fp)
2654 addl2 -800(fp),r5
2655 bicl2 #0,r5
2656 cmpl r5,-800(fp)
2657 bgequ noname.250
2658 incl r4
2659noname.250:
2660 movl r5,r1
2661 movl r4,r2
2662 addl2 r1,r8
2663 bicl2 #0,r8
2664 cmpl r8,r1
2665 bgequ noname.251
2666 incl r2
2667noname.251:
2668 addl2 r2,r10
2669 bicl2 #0,r10
2670 cmpl r10,r2
2671 bgequ noname.252
2672 incl r9
2673noname.252:
2674
2675 bicl3 #-65536,16(r6),r3
2676 movzwl 18(r6),r1
2677 bicl2 #-65536,r1
2678 bicl3 #-65536,24(r7),r2
2679 movzwl 26(r7),r0
2680 bicl2 #-65536,r0
2681 movl r3,r5
2682 movl r1,r4
2683 mull3 r0,r5,-804(fp)
2684 mull2 r2,r5
2685 mull3 r2,r4,-808(fp)
2686 mull2 r0,r4
2687 addl3 -804(fp),-808(fp),r0
2688 bicl3 #0,r0,-804(fp)
2689 cmpl -804(fp),-808(fp)
2690 bgequ noname.253
2691 addl2 #65536,r4
2692noname.253:
2693 movzwl -802(fp),r0
2694 bicl2 #-65536,r0
2695 addl2 r0,r4
2696 bicl3 #-65536,-804(fp),r0
2697 ashl #16,r0,-808(fp)
2698 addl2 -808(fp),r5
2699 bicl2 #0,r5
2700 cmpl r5,-808(fp)
2701 bgequ noname.254
2702 incl r4
2703noname.254:
2704 movl r5,r1
2705 movl r4,r2
2706 addl2 r1,r8
2707 bicl2 #0,r8
2708 cmpl r8,r1
2709 bgequ noname.255
2710 incl r2
2711noname.255:
2712 addl2 r2,r10
2713 bicl2 #0,r10
2714 cmpl r10,r2
2715 bgequ noname.256
2716 incl r9
2717noname.256:
2718
2719 bicl3 #-65536,12(r6),r3
2720 movzwl 14(r6),r1
2721 bicl2 #-65536,r1
2722 bicl3 #-65536,28(r7),r2
2723 movzwl 30(r7),r0
2724 bicl2 #-65536,r0
2725 movl r3,r5
2726 movl r1,r4
2727 mull3 r0,r5,-812(fp)
2728 mull2 r2,r5
2729 mull3 r2,r4,-816(fp)
2730 mull2 r0,r4
2731 addl3 -812(fp),-816(fp),r0
2732 bicl3 #0,r0,-812(fp)
2733 cmpl -812(fp),-816(fp)
2734 bgequ noname.257
2735 addl2 #65536,r4
2736noname.257:
2737 movzwl -810(fp),r0
2738 bicl2 #-65536,r0
2739 addl2 r0,r4
2740 bicl3 #-65536,-812(fp),r0
2741 ashl #16,r0,-816(fp)
2742 addl2 -816(fp),r5
2743 bicl2 #0,r5
2744 cmpl r5,-816(fp)
2745 bgequ noname.258
2746 incl r4
2747noname.258:
2748 movl r5,r1
2749 movl r4,r2
2750 addl2 r1,r8
2751 bicl2 #0,r8
2752 cmpl r8,r1
2753 bgequ noname.259
2754 incl r2
2755noname.259:
2756 addl2 r2,r10
2757 bicl2 #0,r10
2758 cmpl r10,r2
2759 bgequ noname.260
2760 incl r9
2761noname.260:
2762
2763 movl r8,40(r11)
2764
2765 clrl r8
2766
2767 bicl3 #-65536,16(r6),r3
2768 movzwl 18(r6),r2
2769 bicl3 #-65536,28(r7),r1
2770 movzwl 30(r7),r0
2771 bicl2 #-65536,r0
2772 movl r3,r4
2773 bicl3 #-65536,r2,-828(fp)
2774 mull3 r0,r4,-820(fp)
2775 mull2 r1,r4
2776 mull3 r1,-828(fp),-824(fp)
2777 mull2 r0,-828(fp)
2778 addl3 -820(fp),-824(fp),r0
2779 bicl3 #0,r0,-820(fp)
2780 cmpl -820(fp),-824(fp)
2781 bgequ noname.261
2782 addl2 #65536,-828(fp)
2783noname.261:
2784 movzwl -818(fp),r0
2785 bicl2 #-65536,r0
2786 addl2 r0,-828(fp)
2787 bicl3 #-65536,-820(fp),r0
2788 ashl #16,r0,-824(fp)
2789 addl2 -824(fp),r4
2790 bicl2 #0,r4
2791 cmpl r4,-824(fp)
2792 bgequ noname.262
2793 incl -828(fp)
2794noname.262:
2795 movl r4,r1
2796 movl -828(fp),r2
2797 addl2 r1,r10
2798 bicl2 #0,r10
2799 cmpl r10,r1
2800 bgequ noname.263
2801 incl r2
2802noname.263:
2803 addl2 r2,r9
2804 bicl2 #0,r9
2805 cmpl r9,r2
2806 bgequ noname.264
2807 incl r8
2808noname.264:
2809
2810 movzwl 22(r6),r2
2811 bicl3 #-65536,24(r7),r3
2812 movzwl 26(r7),r0
2813 bicl2 #-65536,r0
2814 bicl3 #-65536,20(r6),-840(fp)
2815 bicl3 #-65536,r2,-844(fp)
2816 mull3 r0,-840(fp),-832(fp)
2817 mull2 r3,-840(fp)
2818 mull3 r3,-844(fp),-836(fp)
2819 mull2 r0,-844(fp)
2820 addl3 -832(fp),-836(fp),r0
2821 bicl3 #0,r0,-832(fp)
2822 cmpl -832(fp),-836(fp)
2823 bgequ noname.265
2824 addl2 #65536,-844(fp)
2825noname.265:
2826 movzwl -830(fp),r0
2827 bicl2 #-65536,r0
2828 addl2 r0,-844(fp)
2829 bicl3 #-65536,-832(fp),r0
2830 ashl #16,r0,-836(fp)
2831 addl3 -836(fp),-840(fp),r0
2832 bicl3 #0,r0,-840(fp)
2833 cmpl -840(fp),-836(fp)
2834 bgequ noname.266
2835 incl -844(fp)
2836noname.266:
2837 movl -840(fp),r1
2838 movl -844(fp),r2
2839 addl2 r1,r10
2840 bicl2 #0,r10
2841 cmpl r10,r1
2842 bgequ noname.267
2843 incl r2
2844noname.267:
2845 addl2 r2,r9
2846 bicl2 #0,r9
2847 cmpl r9,r2
2848 bgequ noname.268
2849 incl r8
2850noname.268:
2851
2852 bicl3 #-65536,24(r6),r3
2853 movzwl 26(r6),r1
2854 bicl2 #-65536,r1
2855 bicl3 #-65536,20(r7),r2
2856 movzwl 22(r7),r0
2857 bicl2 #-65536,r0
2858 movl r3,r5
2859 movl r1,r4
2860 mull3 r0,r5,-848(fp)
2861 mull2 r2,r5
2862 mull3 r2,r4,-852(fp)
2863 mull2 r0,r4
2864 addl3 -848(fp),-852(fp),r0
2865 bicl3 #0,r0,-848(fp)
2866 cmpl -848(fp),-852(fp)
2867 bgequ noname.269
2868 addl2 #65536,r4
2869noname.269:
2870 movzwl -846(fp),r0
2871 bicl2 #-65536,r0
2872 addl2 r0,r4
2873 bicl3 #-65536,-848(fp),r0
2874 ashl #16,r0,-852(fp)
2875 addl2 -852(fp),r5
2876 bicl2 #0,r5
2877 cmpl r5,-852(fp)
2878 bgequ noname.270
2879 incl r4
2880noname.270:
2881 movl r5,r1
2882 movl r4,r2
2883 addl2 r1,r10
2884 bicl2 #0,r10
2885 cmpl r10,r1
2886 bgequ noname.271
2887 incl r2
2888noname.271:
2889 addl2 r2,r9
2890 bicl2 #0,r9
2891 cmpl r9,r2
2892 bgequ noname.272
2893 incl r8
2894noname.272:
2895
2896 bicl3 #-65536,28(r6),r3
2897 movzwl 30(r6),r1
2898 bicl2 #-65536,r1
2899 bicl3 #-65536,16(r7),r2
2900 movzwl 18(r7),r0
2901 bicl2 #-65536,r0
2902 movl r3,r5
2903 movl r1,r4
2904 mull3 r0,r5,-856(fp)
2905 mull2 r2,r5
2906 mull3 r2,r4,-860(fp)
2907 mull2 r0,r4
2908 addl3 -856(fp),-860(fp),r0
2909 bicl3 #0,r0,-856(fp)
2910 cmpl -856(fp),-860(fp)
2911 bgequ noname.273
2912 addl2 #65536,r4
2913noname.273:
2914 movzwl -854(fp),r0
2915 bicl2 #-65536,r0
2916 addl2 r0,r4
2917 bicl3 #-65536,-856(fp),r0
2918 ashl #16,r0,-860(fp)
2919 addl2 -860(fp),r5
2920 bicl2 #0,r5
2921 cmpl r5,-860(fp)
2922 bgequ noname.274
2923 incl r4
2924noname.274:
2925 movl r5,r1
2926 movl r4,r2
2927 addl2 r1,r10
2928 bicl2 #0,r10
2929 cmpl r10,r1
2930 bgequ noname.275
2931 incl r2
2932noname.275:
2933 addl2 r2,r9
2934 bicl2 #0,r9
2935 cmpl r9,r2
2936 bgequ noname.276
2937 incl r8
2938noname.276:
2939
2940 movl r10,44(r11)
2941
2942 clrl r10
2943
2944 bicl3 #-65536,28(r6),r3
2945 movzwl 30(r6),r1
2946 bicl2 #-65536,r1
2947 bicl3 #-65536,20(r7),r2
2948 movzwl 22(r7),r0
2949 bicl2 #-65536,r0
2950 movl r3,r5
2951 movl r1,r4
2952 mull3 r0,r5,-864(fp)
2953 mull2 r2,r5
2954 mull3 r2,r4,-868(fp)
2955 mull2 r0,r4
2956 addl3 -864(fp),-868(fp),r0
2957 bicl3 #0,r0,-864(fp)
2958 cmpl -864(fp),-868(fp)
2959 bgequ noname.277
2960 addl2 #65536,r4
2961noname.277:
2962 movzwl -862(fp),r0
2963 bicl2 #-65536,r0
2964 addl2 r0,r4
2965 bicl3 #-65536,-864(fp),r0
2966 ashl #16,r0,-868(fp)
2967 addl2 -868(fp),r5
2968 bicl2 #0,r5
2969 cmpl r5,-868(fp)
2970 bgequ noname.278
2971 incl r4
2972noname.278:
2973 movl r5,r1
2974 movl r4,r2
2975 addl2 r1,r9
2976 bicl2 #0,r9
2977 cmpl r9,r1
2978 bgequ noname.279
2979 incl r2
2980noname.279:
2981 addl2 r2,r8
2982 bicl2 #0,r8
2983 cmpl r8,r2
2984 bgequ noname.280
2985 incl r10
2986noname.280:
2987
2988 bicl3 #-65536,24(r6),r3
2989 movzwl 26(r6),r1
2990 bicl2 #-65536,r1
2991 bicl3 #-65536,24(r7),r2
2992 movzwl 26(r7),r0
2993 bicl2 #-65536,r0
2994 movl r3,r5
2995 movl r1,r4
2996 mull3 r0,r5,-872(fp)
2997 mull2 r2,r5
2998 mull3 r2,r4,-876(fp)
2999 mull2 r0,r4
3000 addl3 -872(fp),-876(fp),r0
3001 bicl3 #0,r0,-872(fp)
3002 cmpl -872(fp),-876(fp)
3003 bgequ noname.281
3004 addl2 #65536,r4
3005noname.281:
3006 movzwl -870(fp),r0
3007 bicl2 #-65536,r0
3008 addl2 r0,r4
3009 bicl3 #-65536,-872(fp),r0
3010 ashl #16,r0,-876(fp)
3011 addl2 -876(fp),r5
3012 bicl2 #0,r5
3013 cmpl r5,-876(fp)
3014 bgequ noname.282
3015 incl r4
3016noname.282:
3017 movl r5,r1
3018 movl r4,r2
3019 addl2 r1,r9
3020 bicl2 #0,r9
3021 cmpl r9,r1
3022 bgequ noname.283
3023 incl r2
3024noname.283:
3025 addl2 r2,r8
3026 bicl2 #0,r8
3027 cmpl r8,r2
3028 bgequ noname.284
3029 incl r10
3030noname.284:
3031
3032 bicl3 #-65536,20(r6),r3
3033 movzwl 22(r6),r1
3034 bicl2 #-65536,r1
3035 bicl3 #-65536,28(r7),r2
3036 movzwl 30(r7),r0
3037 bicl2 #-65536,r0
3038 movl r3,r5
3039 movl r1,r4
3040 mull3 r0,r5,-880(fp)
3041 mull2 r2,r5
3042 mull3 r2,r4,-884(fp)
3043 mull2 r0,r4
3044 addl3 -880(fp),-884(fp),r0
3045 bicl3 #0,r0,-880(fp)
3046 cmpl -880(fp),-884(fp)
3047 bgequ noname.285
3048 addl2 #65536,r4
3049noname.285:
3050 movzwl -878(fp),r0
3051 bicl2 #-65536,r0
3052 addl2 r0,r4
3053 bicl3 #-65536,-880(fp),r0
3054 ashl #16,r0,-884(fp)
3055 addl2 -884(fp),r5
3056 bicl2 #0,r5
3057 cmpl r5,-884(fp)
3058 bgequ noname.286
3059 incl r4
3060noname.286:
3061 movl r5,r1
3062 movl r4,r2
3063 addl2 r1,r9
3064 bicl2 #0,r9
3065 cmpl r9,r1
3066 bgequ noname.287
3067 incl r2
3068noname.287:
3069 addl2 r2,r8
3070 bicl2 #0,r8
3071 cmpl r8,r2
3072 bgequ noname.288
3073 incl r10
3074noname.288:
3075
3076 movl r9,48(r11)
3077
3078 clrl r9
3079
3080 bicl3 #-65536,24(r6),r3
3081 movzwl 26(r6),r1
3082 bicl2 #-65536,r1
3083 bicl3 #-65536,28(r7),r2
3084 movzwl 30(r7),r0
3085 bicl2 #-65536,r0
3086 movl r3,r5
3087 movl r1,r4
3088 mull3 r0,r5,-888(fp)
3089 mull2 r2,r5
3090 mull3 r2,r4,-892(fp)
3091 mull2 r0,r4
3092 addl3 -888(fp),-892(fp),r0
3093 bicl3 #0,r0,-888(fp)
3094 cmpl -888(fp),-892(fp)
3095 bgequ noname.289
3096 addl2 #65536,r4
3097noname.289:
3098 movzwl -886(fp),r0
3099 bicl2 #-65536,r0
3100 addl2 r0,r4
3101 bicl3 #-65536,-888(fp),r0
3102 ashl #16,r0,-892(fp)
3103 addl2 -892(fp),r5
3104 bicl2 #0,r5
3105 cmpl r5,-892(fp)
3106 bgequ noname.290
3107 incl r4
3108noname.290:
3109 movl r5,r1
3110 movl r4,r2
3111 addl2 r1,r8
3112 bicl2 #0,r8
3113 cmpl r8,r1
3114 bgequ noname.291
3115 incl r2
3116noname.291:
3117 addl2 r2,r10
3118 bicl2 #0,r10
3119 cmpl r10,r2
3120 bgequ noname.292
3121 incl r9
3122noname.292:
3123
3124 movzwl 30(r6),r2
3125 bicl3 #-65536,24(r7),r3
3126 movzwl 26(r7),r0
3127 bicl2 #-65536,r0
3128 bicl3 #-65536,28(r6),-904(fp)
3129 bicl3 #-65536,r2,-908(fp)
3130 mull3 r0,-904(fp),-896(fp)
3131 mull2 r3,-904(fp)
3132 mull3 r3,-908(fp),-900(fp)
3133 mull2 r0,-908(fp)
3134 addl3 -896(fp),-900(fp),r0
3135 bicl3 #0,r0,-896(fp)
3136 cmpl -896(fp),-900(fp)
3137 bgequ noname.293
3138 addl2 #65536,-908(fp)
3139noname.293:
3140 movzwl -894(fp),r0
3141 bicl2 #-65536,r0
3142 addl2 r0,-908(fp)
3143 bicl3 #-65536,-896(fp),r0
3144 ashl #16,r0,-900(fp)
3145 addl3 -900(fp),-904(fp),r0
3146 bicl3 #0,r0,-904(fp)
3147 cmpl -904(fp),-900(fp)
3148 bgequ noname.294
3149 incl -908(fp)
3150noname.294:
3151 movl -904(fp),r1
3152 movl -908(fp),r2
3153 addl2 r1,r8
3154 bicl2 #0,r8
3155 cmpl r8,r1
3156 bgequ noname.295
3157 incl r2
3158noname.295:
3159 addl2 r2,r10
3160 bicl2 #0,r10
3161 cmpl r10,r2
3162 bgequ noname.296
3163 incl r9
3164noname.296:
3165
3166 movl r8,52(r11)
3167
3168 clrl r8
3169
3170 movzwl 30(r6),r2
3171 bicl3 #-65536,28(r7),r3
3172 movzwl 30(r7),r0
3173 bicl2 #-65536,r0
3174 bicl3 #-65536,28(r6),-920(fp)
3175 bicl3 #-65536,r2,-924(fp)
3176 mull3 r0,-920(fp),-912(fp)
3177 mull2 r3,-920(fp)
3178 mull3 r3,-924(fp),-916(fp)
3179 mull2 r0,-924(fp)
3180 addl3 -912(fp),-916(fp),r0
3181 bicl3 #0,r0,-912(fp)
3182 cmpl -912(fp),-916(fp)
3183 bgequ noname.297
3184 addl2 #65536,-924(fp)
3185noname.297:
3186 movzwl -910(fp),r0
3187 bicl2 #-65536,r0
3188 addl2 r0,-924(fp)
3189 bicl3 #-65536,-912(fp),r0
3190 ashl #16,r0,-916(fp)
3191 addl3 -916(fp),-920(fp),r0
3192 bicl3 #0,r0,-920(fp)
3193 cmpl -920(fp),-916(fp)
3194 bgequ noname.298
3195 incl -924(fp)
3196noname.298:
3197 movl -920(fp),r1
3198 movl -924(fp),r2
3199 addl2 r1,r10
3200 bicl2 #0,r10
3201 cmpl r10,r1
3202 bgequ noname.299
3203 incl r2
3204noname.299:
3205 addl2 r2,r9
3206 bicl2 #0,r9
3207 cmpl r9,r2
3208 bgequ noname.300
3209 incl r8
3210noname.300:
3211
3212 movl r10,56(r11)
3213
3214 movl r9,60(r11)
3215
3216 ret
3217
3218
3219
3220;r=4 ;(AP)
3221;a=8 ;(AP)
3222;b=12 ;(AP)
3223;n=16 ;(AP) n by value (input)
3224
3225 .psect code,nowrt
3226
3227.entry BN_MUL_COMBA4,^m<r2,r3,r4,r5,r6,r7,r8,r9,r10,r11>
3228 movab -156(sp),sp
3229
3230 clrq r9
3231
3232 clrl r8
3233
3234 movl 8(ap),r6
3235 bicl3 #-65536,(r6),r3
3236 movzwl 2(r6),r2
3237 bicl2 #-65536,r2
3238 movl 12(ap),r7
3239 bicl3 #-65536,(r7),r1
3240 movzwl 2(r7),r0
3241 bicl2 #-65536,r0
3242 movl r3,r5
3243 movl r2,r4
3244 mull3 r0,r5,-4(fp)
3245 mull2 r1,r5
3246 mull3 r1,r4,-8(fp)
3247 mull2 r0,r4
3248 addl3 -4(fp),-8(fp),r0
3249 bicl3 #0,r0,-4(fp)
3250 cmpl -4(fp),-8(fp)
3251 bgequ noname.303
3252 addl2 #65536,r4
3253noname.303:
3254 movzwl -2(fp),r0
3255 bicl2 #-65536,r0
3256 addl2 r0,r4
3257 bicl3 #-65536,-4(fp),r0
3258 ashl #16,r0,-8(fp)
3259 addl2 -8(fp),r5
3260 bicl2 #0,r5
3261 cmpl r5,-8(fp)
3262 bgequ noname.304
3263 incl r4
3264noname.304:
3265 movl r5,r1
3266 movl r4,r2
3267 addl2 r1,r10
3268 bicl2 #0,r10
3269 cmpl r10,r1
3270 bgequ noname.305
3271 incl r2
3272noname.305:
3273 addl2 r2,r9
3274 bicl2 #0,r9
3275 cmpl r9,r2
3276 bgequ noname.306
3277 incl r8
3278noname.306:
3279
3280 movl 4(ap),r11
3281 movl r10,(r11)
3282
3283 clrl r10
3284
3285 bicl3 #-65536,(r6),r3
3286 movzwl 2(r6),r1
3287 bicl2 #-65536,r1
3288 bicl3 #-65536,4(r7),r2
3289 movzwl 6(r7),r0
3290 bicl2 #-65536,r0
3291 movl r3,r5
3292 movl r1,r4
3293 mull3 r0,r5,-12(fp)
3294 mull2 r2,r5
3295 mull3 r2,r4,-16(fp)
3296 mull2 r0,r4
3297 addl3 -12(fp),-16(fp),r0
3298 bicl3 #0,r0,-12(fp)
3299 cmpl -12(fp),-16(fp)
3300 bgequ noname.307
3301 addl2 #65536,r4
3302noname.307:
3303 movzwl -10(fp),r0
3304 bicl2 #-65536,r0
3305 addl2 r0,r4
3306 bicl3 #-65536,-12(fp),r0
3307 ashl #16,r0,-16(fp)
3308 addl2 -16(fp),r5
3309 bicl2 #0,r5
3310 cmpl r5,-16(fp)
3311 bgequ noname.308
3312 incl r4
3313noname.308:
3314 movl r5,r1
3315 movl r4,r2
3316 addl2 r1,r9
3317 bicl2 #0,r9
3318 cmpl r9,r1
3319 bgequ noname.309
3320 incl r2
3321noname.309:
3322 addl2 r2,r8
3323 bicl2 #0,r8
3324 cmpl r8,r2
3325 bgequ noname.310
3326 incl r10
3327noname.310:
3328
3329 bicl3 #-65536,4(r6),r3
3330 movzwl 6(r6),r1
3331 bicl2 #-65536,r1
3332 bicl3 #-65536,(r7),r2
3333 movzwl 2(r7),r0
3334 bicl2 #-65536,r0
3335 movl r3,r5
3336 movl r1,r4
3337 mull3 r0,r5,-20(fp)
3338 mull2 r2,r5
3339 mull3 r2,r4,-24(fp)
3340 mull2 r0,r4
3341 addl3 -20(fp),-24(fp),r0
3342 bicl3 #0,r0,-20(fp)
3343 cmpl -20(fp),-24(fp)
3344 bgequ noname.311
3345 addl2 #65536,r4
3346noname.311:
3347 movzwl -18(fp),r0
3348 bicl2 #-65536,r0
3349 addl2 r0,r4
3350 bicl3 #-65536,-20(fp),r0
3351 ashl #16,r0,-24(fp)
3352 addl2 -24(fp),r5
3353 bicl2 #0,r5
3354 cmpl r5,-24(fp)
3355 bgequ noname.312
3356 incl r4
3357noname.312:
3358 movl r5,r1
3359 movl r4,r2
3360 addl2 r1,r9
3361 bicl2 #0,r9
3362 cmpl r9,r1
3363 bgequ noname.313
3364 incl r2
3365noname.313:
3366 addl2 r2,r8
3367 bicl2 #0,r8
3368 cmpl r8,r2
3369 bgequ noname.314
3370 incl r10
3371noname.314:
3372
3373 movl r9,4(r11)
3374
3375 clrl r9
3376
3377 bicl3 #-65536,8(r6),r3
3378 movzwl 10(r6),r1
3379 bicl2 #-65536,r1
3380 bicl3 #-65536,(r7),r2
3381 movzwl 2(r7),r0
3382 bicl2 #-65536,r0
3383 movl r3,r5
3384 movl r1,r4
3385 mull3 r0,r5,-28(fp)
3386 mull2 r2,r5
3387 mull3 r2,r4,-32(fp)
3388 mull2 r0,r4
3389 addl3 -28(fp),-32(fp),r0
3390 bicl3 #0,r0,-28(fp)
3391 cmpl -28(fp),-32(fp)
3392 bgequ noname.315
3393 addl2 #65536,r4
3394noname.315:
3395 movzwl -26(fp),r0
3396 bicl2 #-65536,r0
3397 addl2 r0,r4
3398 bicl3 #-65536,-28(fp),r0
3399 ashl #16,r0,-32(fp)
3400 addl2 -32(fp),r5
3401 bicl2 #0,r5
3402 cmpl r5,-32(fp)
3403 bgequ noname.316
3404 incl r4
3405noname.316:
3406 movl r5,r1
3407 movl r4,r2
3408 addl2 r1,r8
3409 bicl2 #0,r8
3410 cmpl r8,r1
3411 bgequ noname.317
3412 incl r2
3413noname.317:
3414 addl2 r2,r10
3415 bicl2 #0,r10
3416 cmpl r10,r2
3417 bgequ noname.318
3418 incl r9
3419noname.318:
3420
3421 bicl3 #-65536,4(r6),r3
3422 movzwl 6(r6),r1
3423 bicl2 #-65536,r1
3424 bicl3 #-65536,4(r7),r2
3425 movzwl 6(r7),r0
3426 bicl2 #-65536,r0
3427 movl r3,r5
3428 movl r1,r4
3429 mull3 r0,r5,-36(fp)
3430 mull2 r2,r5
3431 mull3 r2,r4,-40(fp)
3432 mull2 r0,r4
3433 addl3 -36(fp),-40(fp),r0
3434 bicl3 #0,r0,-36(fp)
3435 cmpl -36(fp),-40(fp)
3436 bgequ noname.319
3437 addl2 #65536,r4
3438noname.319:
3439 movzwl -34(fp),r0
3440 bicl2 #-65536,r0
3441 addl2 r0,r4
3442 bicl3 #-65536,-36(fp),r0
3443 ashl #16,r0,-40(fp)
3444 addl2 -40(fp),r5
3445 bicl2 #0,r5
3446 cmpl r5,-40(fp)
3447 bgequ noname.320
3448 incl r4
3449noname.320:
3450 movl r5,r1
3451 movl r4,r2
3452 addl2 r1,r8
3453 bicl2 #0,r8
3454 cmpl r8,r1
3455 bgequ noname.321
3456 incl r2
3457noname.321:
3458 addl2 r2,r10
3459 bicl2 #0,r10
3460 cmpl r10,r2
3461 bgequ noname.322
3462 incl r9
3463noname.322:
3464
3465 bicl3 #-65536,(r6),r3
3466 movzwl 2(r6),r1
3467 bicl2 #-65536,r1
3468 bicl3 #-65536,8(r7),r2
3469 movzwl 10(r7),r0
3470 bicl2 #-65536,r0
3471 movl r3,r5
3472 movl r1,r4
3473 mull3 r0,r5,-44(fp)
3474 mull2 r2,r5
3475 mull3 r2,r4,-48(fp)
3476 mull2 r0,r4
3477 addl3 -44(fp),-48(fp),r0
3478 bicl3 #0,r0,-44(fp)
3479 cmpl -44(fp),-48(fp)
3480 bgequ noname.323
3481 addl2 #65536,r4
3482noname.323:
3483 movzwl -42(fp),r0
3484 bicl2 #-65536,r0
3485 addl2 r0,r4
3486 bicl3 #-65536,-44(fp),r0
3487 ashl #16,r0,-48(fp)
3488 addl2 -48(fp),r5
3489 bicl2 #0,r5
3490 cmpl r5,-48(fp)
3491 bgequ noname.324
3492 incl r4
3493noname.324:
3494 movl r5,r1
3495 movl r4,r2
3496 addl2 r1,r8
3497 bicl2 #0,r8
3498 cmpl r8,r1
3499 bgequ noname.325
3500 incl r2
3501noname.325:
3502 addl2 r2,r10
3503 bicl2 #0,r10
3504 cmpl r10,r2
3505 bgequ noname.326
3506 incl r9
3507noname.326:
3508
3509 movl r8,8(r11)
3510
3511 clrl r8
3512
3513 bicl3 #-65536,(r6),r3
3514 movzwl 2(r6),r2
3515 bicl3 #-65536,12(r7),r1
3516 movzwl 14(r7),r0
3517 bicl2 #-65536,r0
3518 movl r3,r4
3519 bicl3 #-65536,r2,-60(fp)
3520 mull3 r0,r4,-52(fp)
3521 mull2 r1,r4
3522 mull3 r1,-60(fp),-56(fp)
3523 mull2 r0,-60(fp)
3524 addl3 -52(fp),-56(fp),r0
3525 bicl3 #0,r0,-52(fp)
3526 cmpl -52(fp),-56(fp)
3527 bgequ noname.327
3528 addl2 #65536,-60(fp)
3529noname.327:
3530 movzwl -50(fp),r0
3531 bicl2 #-65536,r0
3532 addl2 r0,-60(fp)
3533 bicl3 #-65536,-52(fp),r0
3534 ashl #16,r0,-56(fp)
3535 addl2 -56(fp),r4
3536 bicl2 #0,r4
3537 cmpl r4,-56(fp)
3538 bgequ noname.328
3539 incl -60(fp)
3540noname.328:
3541 movl r4,r1
3542 movl -60(fp),r2
3543 addl2 r1,r10
3544 bicl2 #0,r10
3545 cmpl r10,r1
3546 bgequ noname.329
3547 incl r2
3548noname.329:
3549 addl2 r2,r9
3550 bicl2 #0,r9
3551 cmpl r9,r2
3552 bgequ noname.330
3553 incl r8
3554noname.330:
3555
3556 movzwl 6(r6),r2
3557 bicl3 #-65536,8(r7),r3
3558 movzwl 10(r7),r0
3559 bicl2 #-65536,r0
3560 bicl3 #-65536,4(r6),-72(fp)
3561 bicl3 #-65536,r2,-76(fp)
3562 mull3 r0,-72(fp),-64(fp)
3563 mull2 r3,-72(fp)
3564 mull3 r3,-76(fp),-68(fp)
3565 mull2 r0,-76(fp)
3566 addl3 -64(fp),-68(fp),r0
3567 bicl3 #0,r0,-64(fp)
3568 cmpl -64(fp),-68(fp)
3569 bgequ noname.331
3570 addl2 #65536,-76(fp)
3571noname.331:
3572 movzwl -62(fp),r0
3573 bicl2 #-65536,r0
3574 addl2 r0,-76(fp)
3575 bicl3 #-65536,-64(fp),r0
3576 ashl #16,r0,-68(fp)
3577 addl3 -68(fp),-72(fp),r0
3578 bicl3 #0,r0,-72(fp)
3579 cmpl -72(fp),-68(fp)
3580 bgequ noname.332
3581 incl -76(fp)
3582noname.332:
3583 movl -72(fp),r1
3584 movl -76(fp),r2
3585 addl2 r1,r10
3586 bicl2 #0,r10
3587 cmpl r10,r1
3588 bgequ noname.333
3589 incl r2
3590noname.333:
3591 addl2 r2,r9
3592 bicl2 #0,r9
3593 cmpl r9,r2
3594 bgequ noname.334
3595 incl r8
3596noname.334:
3597
3598 bicl3 #-65536,8(r6),r3
3599 movzwl 10(r6),r1
3600 bicl2 #-65536,r1
3601 bicl3 #-65536,4(r7),r2
3602 movzwl 6(r7),r0
3603 bicl2 #-65536,r0
3604 movl r3,r5
3605 movl r1,r4
3606 mull3 r0,r5,-80(fp)
3607 mull2 r2,r5
3608 mull3 r2,r4,-84(fp)
3609 mull2 r0,r4
3610 addl3 -80(fp),-84(fp),r0
3611 bicl3 #0,r0,-80(fp)
3612 cmpl -80(fp),-84(fp)
3613 bgequ noname.335
3614 addl2 #65536,r4
3615noname.335:
3616 movzwl -78(fp),r0
3617 bicl2 #-65536,r0
3618 addl2 r0,r4
3619 bicl3 #-65536,-80(fp),r0
3620 ashl #16,r0,-84(fp)
3621 addl2 -84(fp),r5
3622 bicl2 #0,r5
3623 cmpl r5,-84(fp)
3624 bgequ noname.336
3625 incl r4
3626noname.336:
3627 movl r5,r1
3628 movl r4,r2
3629 addl2 r1,r10
3630 bicl2 #0,r10
3631 cmpl r10,r1
3632 bgequ noname.337
3633 incl r2
3634noname.337:
3635 addl2 r2,r9
3636 bicl2 #0,r9
3637 cmpl r9,r2
3638 bgequ noname.338
3639 incl r8
3640noname.338:
3641
3642 bicl3 #-65536,12(r6),r3
3643 movzwl 14(r6),r1
3644 bicl2 #-65536,r1
3645 bicl3 #-65536,(r7),r2
3646 movzwl 2(r7),r0
3647 bicl2 #-65536,r0
3648 movl r3,r5
3649 movl r1,r4
3650 mull3 r0,r5,-88(fp)
3651 mull2 r2,r5
3652 mull3 r2,r4,-92(fp)
3653 mull2 r0,r4
3654 addl3 -88(fp),-92(fp),r0
3655 bicl3 #0,r0,-88(fp)
3656 cmpl -88(fp),-92(fp)
3657 bgequ noname.339
3658 addl2 #65536,r4
3659noname.339:
3660 movzwl -86(fp),r0
3661 bicl2 #-65536,r0
3662 addl2 r0,r4
3663 bicl3 #-65536,-88(fp),r0
3664 ashl #16,r0,-92(fp)
3665 addl2 -92(fp),r5
3666 bicl2 #0,r5
3667 cmpl r5,-92(fp)
3668 bgequ noname.340
3669 incl r4
3670noname.340:
3671 movl r5,r1
3672 movl r4,r2
3673 addl2 r1,r10
3674 bicl2 #0,r10
3675 cmpl r10,r1
3676 bgequ noname.341
3677 incl r2
3678noname.341:
3679 addl2 r2,r9
3680 bicl2 #0,r9
3681 cmpl r9,r2
3682 bgequ noname.342
3683 incl r8
3684noname.342:
3685
3686 movl r10,12(r11)
3687
3688 clrl r10
3689
3690 bicl3 #-65536,12(r6),r3
3691 movzwl 14(r6),r1
3692 bicl2 #-65536,r1
3693 bicl3 #-65536,4(r7),r2
3694 movzwl 6(r7),r0
3695 bicl2 #-65536,r0
3696 movl r3,r5
3697 movl r1,r4
3698 mull3 r0,r5,-96(fp)
3699 mull2 r2,r5
3700 mull3 r2,r4,-100(fp)
3701 mull2 r0,r4
3702 addl3 -96(fp),-100(fp),r0
3703 bicl3 #0,r0,-96(fp)
3704 cmpl -96(fp),-100(fp)
3705 bgequ noname.343
3706 addl2 #65536,r4
3707noname.343:
3708 movzwl -94(fp),r0
3709 bicl2 #-65536,r0
3710 addl2 r0,r4
3711 bicl3 #-65536,-96(fp),r0
3712 ashl #16,r0,-100(fp)
3713 addl2 -100(fp),r5
3714 bicl2 #0,r5
3715 cmpl r5,-100(fp)
3716 bgequ noname.344
3717 incl r4
3718noname.344:
3719 movl r5,r1
3720 movl r4,r2
3721 addl2 r1,r9
3722 bicl2 #0,r9
3723 cmpl r9,r1
3724 bgequ noname.345
3725 incl r2
3726noname.345:
3727 addl2 r2,r8
3728 bicl2 #0,r8
3729 cmpl r8,r2
3730 bgequ noname.346
3731 incl r10
3732noname.346:
3733
3734 bicl3 #-65536,8(r6),r3
3735 movzwl 10(r6),r1
3736 bicl2 #-65536,r1
3737 bicl3 #-65536,8(r7),r2
3738 movzwl 10(r7),r0
3739 bicl2 #-65536,r0
3740 movl r3,r5
3741 movl r1,r4
3742 mull3 r0,r5,-104(fp)
3743 mull2 r2,r5
3744 mull3 r2,r4,-108(fp)
3745 mull2 r0,r4
3746 addl3 -104(fp),-108(fp),r0
3747 bicl3 #0,r0,-104(fp)
3748 cmpl -104(fp),-108(fp)
3749 bgequ noname.347
3750 addl2 #65536,r4
3751noname.347:
3752 movzwl -102(fp),r0
3753 bicl2 #-65536,r0
3754 addl2 r0,r4
3755 bicl3 #-65536,-104(fp),r0
3756 ashl #16,r0,-108(fp)
3757 addl2 -108(fp),r5
3758 bicl2 #0,r5
3759 cmpl r5,-108(fp)
3760 bgequ noname.348
3761 incl r4
3762noname.348:
3763 movl r5,r1
3764 movl r4,r2
3765 addl2 r1,r9
3766 bicl2 #0,r9
3767 cmpl r9,r1
3768 bgequ noname.349
3769 incl r2
3770noname.349:
3771 addl2 r2,r8
3772 bicl2 #0,r8
3773 cmpl r8,r2
3774 bgequ noname.350
3775 incl r10
3776noname.350:
3777
3778 bicl3 #-65536,4(r6),r3
3779 movzwl 6(r6),r1
3780 bicl2 #-65536,r1
3781 bicl3 #-65536,12(r7),r2
3782 movzwl 14(r7),r0
3783 bicl2 #-65536,r0
3784 movl r3,r5
3785 movl r1,r4
3786 mull3 r0,r5,-112(fp)
3787 mull2 r2,r5
3788 mull3 r2,r4,-116(fp)
3789 mull2 r0,r4
3790 addl3 -112(fp),-116(fp),r0
3791 bicl3 #0,r0,-112(fp)
3792 cmpl -112(fp),-116(fp)
3793 bgequ noname.351
3794 addl2 #65536,r4
3795noname.351:
3796 movzwl -110(fp),r0
3797 bicl2 #-65536,r0
3798 addl2 r0,r4
3799 bicl3 #-65536,-112(fp),r0
3800 ashl #16,r0,-116(fp)
3801 addl2 -116(fp),r5
3802 bicl2 #0,r5
3803 cmpl r5,-116(fp)
3804 bgequ noname.352
3805 incl r4
3806noname.352:
3807 movl r5,r1
3808 movl r4,r2
3809 addl2 r1,r9
3810 bicl2 #0,r9
3811 cmpl r9,r1
3812 bgequ noname.353
3813 incl r2
3814noname.353:
3815 addl2 r2,r8
3816 bicl2 #0,r8
3817 cmpl r8,r2
3818 bgequ noname.354
3819 incl r10
3820noname.354:
3821
3822 movl r9,16(r11)
3823
3824 clrl r9
3825
3826 bicl3 #-65536,8(r6),r3
3827 movzwl 10(r6),r1
3828 bicl2 #-65536,r1
3829 bicl3 #-65536,12(r7),r2
3830 movzwl 14(r7),r0
3831 bicl2 #-65536,r0
3832 movl r3,r5
3833 movl r1,r4
3834 mull3 r0,r5,-120(fp)
3835 mull2 r2,r5
3836 mull3 r2,r4,-124(fp)
3837 mull2 r0,r4
3838 addl3 -120(fp),-124(fp),r0
3839 bicl3 #0,r0,-120(fp)
3840 cmpl -120(fp),-124(fp)
3841 bgequ noname.355
3842 addl2 #65536,r4
3843noname.355:
3844 movzwl -118(fp),r0
3845 bicl2 #-65536,r0
3846 addl2 r0,r4
3847 bicl3 #-65536,-120(fp),r0
3848 ashl #16,r0,-124(fp)
3849 addl2 -124(fp),r5
3850 bicl2 #0,r5
3851 cmpl r5,-124(fp)
3852 bgequ noname.356
3853 incl r4
3854noname.356:
3855 movl r5,r1
3856 movl r4,r2
3857 addl2 r1,r8
3858 bicl2 #0,r8
3859 cmpl r8,r1
3860 bgequ noname.357
3861 incl r2
3862noname.357:
3863 addl2 r2,r10
3864 bicl2 #0,r10
3865 cmpl r10,r2
3866 bgequ noname.358
3867 incl r9
3868noname.358:
3869
3870 movzwl 14(r6),r2
3871 bicl3 #-65536,8(r7),r3
3872 movzwl 10(r7),r0
3873 bicl2 #-65536,r0
3874 bicl3 #-65536,12(r6),-136(fp)
3875 bicl3 #-65536,r2,-140(fp)
3876 mull3 r0,-136(fp),-128(fp)
3877 mull2 r3,-136(fp)
3878 mull3 r3,-140(fp),-132(fp)
3879 mull2 r0,-140(fp)
3880 addl3 -128(fp),-132(fp),r0
3881 bicl3 #0,r0,-128(fp)
3882 cmpl -128(fp),-132(fp)
3883 bgequ noname.359
3884 addl2 #65536,-140(fp)
3885noname.359:
3886 movzwl -126(fp),r0
3887 bicl2 #-65536,r0
3888 addl2 r0,-140(fp)
3889 bicl3 #-65536,-128(fp),r0
3890 ashl #16,r0,-132(fp)
3891 addl3 -132(fp),-136(fp),r0
3892 bicl3 #0,r0,-136(fp)
3893 cmpl -136(fp),-132(fp)
3894 bgequ noname.360
3895 incl -140(fp)
3896noname.360:
3897 movl -136(fp),r1
3898 movl -140(fp),r2
3899 addl2 r1,r8
3900 bicl2 #0,r8
3901 cmpl r8,r1
3902 bgequ noname.361
3903 incl r2
3904noname.361:
3905 addl2 r2,r10
3906 bicl2 #0,r10
3907 cmpl r10,r2
3908 bgequ noname.362
3909 incl r9
3910noname.362:
3911
3912 movl r8,20(r11)
3913
3914 clrl r8
3915
3916 movzwl 14(r6),r2
3917 bicl3 #-65536,12(r7),r3
3918 movzwl 14(r7),r0
3919 bicl2 #-65536,r0
3920 bicl3 #-65536,12(r6),-152(fp)
3921 bicl3 #-65536,r2,-156(fp)
3922 mull3 r0,-152(fp),-144(fp)
3923 mull2 r3,-152(fp)
3924 mull3 r3,-156(fp),-148(fp)
3925 mull2 r0,-156(fp)
3926 addl3 -144(fp),-148(fp),r0
3927 bicl3 #0,r0,-144(fp)
3928 cmpl -144(fp),-148(fp)
3929 bgequ noname.363
3930 addl2 #65536,-156(fp)
3931noname.363:
3932 movzwl -142(fp),r0
3933 bicl2 #-65536,r0
3934 addl2 r0,-156(fp)
3935 bicl3 #-65536,-144(fp),r0
3936 ashl #16,r0,-148(fp)
3937 addl3 -148(fp),-152(fp),r0
3938 bicl3 #0,r0,-152(fp)
3939 cmpl -152(fp),-148(fp)
3940 bgequ noname.364
3941 incl -156(fp)
3942noname.364:
3943 movl -152(fp),r1
3944 movl -156(fp),r2
3945 addl2 r1,r10
3946 bicl2 #0,r10
3947 cmpl r10,r1
3948 bgequ noname.365
3949 incl r2
3950noname.365:
3951 addl2 r2,r9
3952 bicl2 #0,r9
3953 cmpl r9,r2
3954 bgequ noname.366
3955 incl r8
3956noname.366:
3957
3958 movl r10,24(r11)
3959
3960 movl r9,28(r11)
3961
3962 ret
3963
3964
3965
3966;r=4 ;(AP)
3967;a=8 ;(AP)
3968;b=12 ;(AP)
3969;n=16 ;(AP) n by value (input)
3970
3971 .psect code,nowrt
3972
3973.entry BN_SQR_COMBA8,^m<r2,r3,r4,r5,r6,r7,r8,r9>
3974 movab -444(sp),sp
3975
3976 clrq r8
3977
3978 clrl r7
3979
3980 movl 8(ap),r4
3981 movl (r4),r3
3982 bicl3 #-65536,r3,-4(fp)
3983 extzv #16,#16,r3,r0
3984 bicl3 #-65536,r0,r3
3985 movl -4(fp),r0
3986 mull3 r0,r3,-8(fp)
3987 mull3 r0,r0,-4(fp)
3988 mull2 r3,r3
3989 bicl3 #32767,-8(fp),r0
3990 extzv #15,#17,r0,r0
3991 addl2 r0,r3
3992 bicl3 #-65536,-8(fp),r0
3993 ashl #17,r0,-8(fp)
3994 addl3 -4(fp),-8(fp),r0
3995 bicl3 #0,r0,-4(fp)
3996 cmpl -4(fp),-8(fp)
3997 bgequ noname.369
3998 incl r3
3999noname.369:
4000 movl -4(fp),r1
4001 movl r3,r2
4002 addl2 r1,r9
4003 bicl2 #0,r9
4004 cmpl r9,r1
4005 bgequ noname.370
4006 incl r2
4007noname.370:
4008 addl2 r2,r8
4009 bicl2 #0,r8
4010 cmpl r8,r2
4011 bgequ noname.371
4012 incl r7
4013noname.371:
4014
4015 movl r9,@4(ap)
4016
4017 clrl r9
4018
4019 movzwl 6(r4),r2
4020 bicl3 #-65536,(r4),r3
4021 movzwl 2(r4),r0
4022 bicl2 #-65536,r0
4023 bicl3 #-65536,4(r4),-20(fp)
4024 bicl3 #-65536,r2,-24(fp)
4025 mull3 r0,-20(fp),-12(fp)
4026 mull2 r3,-20(fp)
4027 mull3 r3,-24(fp),-16(fp)
4028 mull2 r0,-24(fp)
4029 addl3 -12(fp),-16(fp),r0
4030 bicl3 #0,r0,-12(fp)
4031 cmpl -12(fp),-16(fp)
4032 bgequ noname.372
4033 addl2 #65536,-24(fp)
4034noname.372:
4035 movzwl -10(fp),r0
4036 bicl2 #-65536,r0
4037 addl2 r0,-24(fp)
4038 bicl3 #-65536,-12(fp),r0
4039 ashl #16,r0,-16(fp)
4040 addl3 -16(fp),-20(fp),r0
4041 bicl3 #0,r0,-20(fp)
4042 cmpl -20(fp),-16(fp)
4043 bgequ noname.373
4044 incl -24(fp)
4045noname.373:
4046 movl -20(fp),r3
4047 movl -24(fp),r2
4048 bbc #31,r2,noname.374
4049 incl r9
4050noname.374:
4051 addl2 r2,r2
4052 bicl2 #0,r2
4053 bbc #31,r3,noname.375
4054 incl r2
4055noname.375:
4056 addl2 r3,r3
4057 bicl2 #0,r3
4058 addl2 r3,r8
4059 bicl2 #0,r8
4060 cmpl r8,r3
4061 bgequ noname.376
4062 incl r2
4063 bicl3 #0,r2,r0
4064 bneq noname.376
4065 incl r9
4066noname.376:
4067 addl2 r2,r7
4068 bicl2 #0,r7
4069 cmpl r7,r2
4070 bgequ noname.377
4071 incl r9
4072noname.377:
4073
4074 movl 4(ap),r0
4075 movl r8,4(r0)
4076
4077 clrl r8
4078
4079 movl 8(ap),r4
4080 movl 4(r4),r3
4081 bicl3 #-65536,r3,-28(fp)
4082 extzv #16,#16,r3,r0
4083 bicl3 #-65536,r0,r3
4084 movl -28(fp),r0
4085 mull3 r0,r3,-32(fp)
4086 mull3 r0,r0,-28(fp)
4087 mull2 r3,r3
4088 bicl3 #32767,-32(fp),r0
4089 extzv #15,#17,r0,r0
4090 addl2 r0,r3
4091 bicl3 #-65536,-32(fp),r0
4092 ashl #17,r0,-32(fp)
4093 addl3 -28(fp),-32(fp),r0
4094 bicl3 #0,r0,-28(fp)
4095 cmpl -28(fp),-32(fp)
4096 bgequ noname.378
4097 incl r3
4098noname.378:
4099 movl -28(fp),r1
4100 movl r3,r2
4101 addl2 r1,r7
4102 bicl2 #0,r7
4103 cmpl r7,r1
4104 bgequ noname.379
4105 incl r2
4106noname.379:
4107 addl2 r2,r9
4108 bicl2 #0,r9
4109 cmpl r9,r2
4110 bgequ noname.380
4111 incl r8
4112noname.380:
4113
4114 movzwl 10(r4),r2
4115 bicl3 #-65536,(r4),r3
4116 movzwl 2(r4),r0
4117 bicl2 #-65536,r0
4118 bicl3 #-65536,8(r4),-44(fp)
4119 bicl3 #-65536,r2,-48(fp)
4120 mull3 r0,-44(fp),-36(fp)
4121 mull2 r3,-44(fp)
4122 mull3 r3,-48(fp),-40(fp)
4123 mull2 r0,-48(fp)
4124 addl3 -36(fp),-40(fp),r0
4125 bicl3 #0,r0,-36(fp)
4126 cmpl -36(fp),-40(fp)
4127 bgequ noname.381
4128 addl2 #65536,-48(fp)
4129noname.381:
4130 movzwl -34(fp),r0
4131 bicl2 #-65536,r0
4132 addl2 r0,-48(fp)
4133 bicl3 #-65536,-36(fp),r0
4134 ashl #16,r0,-40(fp)
4135 addl3 -40(fp),-44(fp),r0
4136 bicl3 #0,r0,-44(fp)
4137 cmpl -44(fp),-40(fp)
4138 bgequ noname.382
4139 incl -48(fp)
4140noname.382:
4141 movl -44(fp),r3
4142 movl -48(fp),r2
4143 bbc #31,r2,noname.383
4144 incl r8
4145noname.383:
4146 addl2 r2,r2
4147 bicl2 #0,r2
4148 bbc #31,r3,noname.384
4149 incl r2
4150noname.384:
4151 addl2 r3,r3
4152 bicl2 #0,r3
4153 addl2 r3,r7
4154 bicl2 #0,r7
4155 cmpl r7,r3
4156 bgequ noname.385
4157 incl r2
4158 bicl3 #0,r2,r0
4159 bneq noname.385
4160 incl r8
4161noname.385:
4162 addl2 r2,r9
4163 bicl2 #0,r9
4164 cmpl r9,r2
4165 bgequ noname.386
4166 incl r8
4167noname.386:
4168
4169 movl 4(ap),r0
4170 movl r7,8(r0)
4171
4172 clrl r7
4173
4174 movl 8(ap),r0
4175 movzwl 14(r0),r2
4176 bicl3 #-65536,(r0),r3
4177 movzwl 2(r0),r1
4178 bicl2 #-65536,r1
4179 bicl3 #-65536,12(r0),-60(fp)
4180 bicl3 #-65536,r2,-64(fp)
4181 mull3 r1,-60(fp),-52(fp)
4182 mull2 r3,-60(fp)
4183 mull3 r3,-64(fp),-56(fp)
4184 mull2 r1,-64(fp)
4185 addl3 -52(fp),-56(fp),r0
4186 bicl3 #0,r0,-52(fp)
4187 cmpl -52(fp),-56(fp)
4188 bgequ noname.387
4189 addl2 #65536,-64(fp)
4190noname.387:
4191 movzwl -50(fp),r0
4192 bicl2 #-65536,r0
4193 addl2 r0,-64(fp)
4194 bicl3 #-65536,-52(fp),r0
4195 ashl #16,r0,-56(fp)
4196 addl3 -56(fp),-60(fp),r0
4197 bicl3 #0,r0,-60(fp)
4198 cmpl -60(fp),-56(fp)
4199 bgequ noname.388
4200 incl -64(fp)
4201noname.388:
4202 movl -60(fp),r3
4203 movl -64(fp),r2
4204 bbc #31,r2,noname.389
4205 incl r7
4206noname.389:
4207 addl2 r2,r2
4208 bicl2 #0,r2
4209 bbc #31,r3,noname.390
4210 incl r2
4211noname.390:
4212 addl2 r3,r3
4213 bicl2 #0,r3
4214 addl2 r3,r9
4215 bicl2 #0,r9
4216 cmpl r9,r3
4217 bgequ noname.391
4218 incl r2
4219 bicl3 #0,r2,r0
4220 bneq noname.391
4221 incl r7
4222noname.391:
4223 addl2 r2,r8
4224 bicl2 #0,r8
4225 cmpl r8,r2
4226 bgequ noname.392
4227 incl r7
4228noname.392:
4229
4230 movl 8(ap),r0
4231 movzwl 10(r0),r2
4232 bicl3 #-65536,4(r0),r3
4233 movzwl 6(r0),r1
4234 bicl2 #-65536,r1
4235 bicl3 #-65536,8(r0),-76(fp)
4236 bicl3 #-65536,r2,-80(fp)
4237 mull3 r1,-76(fp),-68(fp)
4238 mull2 r3,-76(fp)
4239 mull3 r3,-80(fp),-72(fp)
4240 mull2 r1,-80(fp)
4241 addl3 -68(fp),-72(fp),r0
4242 bicl3 #0,r0,-68(fp)
4243 cmpl -68(fp),-72(fp)
4244 bgequ noname.393
4245 addl2 #65536,-80(fp)
4246noname.393:
4247 movzwl -66(fp),r0
4248 bicl2 #-65536,r0
4249 addl2 r0,-80(fp)
4250 bicl3 #-65536,-68(fp),r0
4251 ashl #16,r0,-72(fp)
4252 addl3 -72(fp),-76(fp),r0
4253 bicl3 #0,r0,-76(fp)
4254 cmpl -76(fp),-72(fp)
4255 bgequ noname.394
4256 incl -80(fp)
4257noname.394:
4258 movl -76(fp),r3
4259 movl -80(fp),r2
4260 bbc #31,r2,noname.395
4261 incl r7
4262noname.395:
4263 addl2 r2,r2
4264 bicl2 #0,r2
4265 bbc #31,r3,noname.396
4266 incl r2
4267noname.396:
4268 addl2 r3,r3
4269 bicl2 #0,r3
4270 addl2 r3,r9
4271 bicl2 #0,r9
4272 cmpl r9,r3
4273 bgequ noname.397
4274 incl r2
4275 bicl3 #0,r2,r0
4276 bneq noname.397
4277 incl r7
4278noname.397:
4279 addl2 r2,r8
4280 bicl2 #0,r8
4281 cmpl r8,r2
4282 bgequ noname.398
4283 incl r7
4284noname.398:
4285
4286 movl 4(ap),r0
4287 movl r9,12(r0)
4288
4289 clrl r9
4290
4291 movl 8(ap),r2
4292 movl 8(r2),r4
4293 bicl3 #-65536,r4,-84(fp)
4294 extzv #16,#16,r4,r0
4295 bicl3 #-65536,r0,r4
4296 movl -84(fp),r0
4297 mull3 r0,r4,-88(fp)
4298 mull3 r0,r0,-84(fp)
4299 mull2 r4,r4
4300 bicl3 #32767,-88(fp),r0
4301 extzv #15,#17,r0,r0
4302 addl2 r0,r4
4303 bicl3 #-65536,-88(fp),r0
4304 ashl #17,r0,-88(fp)
4305 addl3 -84(fp),-88(fp),r0
4306 bicl3 #0,r0,-84(fp)
4307 cmpl -84(fp),-88(fp)
4308 bgequ noname.399
4309 incl r4
4310noname.399:
4311 movl -84(fp),r1
4312 movl r4,r3
4313 addl2 r1,r8
4314 bicl2 #0,r8
4315 cmpl r8,r1
4316 bgequ noname.400
4317 incl r3
4318noname.400:
4319 addl2 r3,r7
4320 bicl2 #0,r7
4321 cmpl r7,r3
4322 bgequ noname.401
4323 incl r9
4324noname.401:
4325
4326 movzwl 14(r2),r3
4327 bicl3 #-65536,4(r2),r1
4328 movzwl 6(r2),r0
4329 bicl2 #-65536,r0
4330 bicl3 #-65536,12(r2),-100(fp)
4331 bicl3 #-65536,r3,-104(fp)
4332 mull3 r0,-100(fp),-92(fp)
4333 mull2 r1,-100(fp)
4334 mull3 r1,-104(fp),-96(fp)
4335 mull2 r0,-104(fp)
4336 addl3 -92(fp),-96(fp),r0
4337 bicl3 #0,r0,-92(fp)
4338 cmpl -92(fp),-96(fp)
4339 bgequ noname.402
4340 addl2 #65536,-104(fp)
4341noname.402:
4342 movzwl -90(fp),r0
4343 bicl2 #-65536,r0
4344 addl2 r0,-104(fp)
4345 bicl3 #-65536,-92(fp),r0
4346 ashl #16,r0,-96(fp)
4347 addl3 -96(fp),-100(fp),r0
4348 bicl3 #0,r0,-100(fp)
4349 cmpl -100(fp),-96(fp)
4350 bgequ noname.403
4351 incl -104(fp)
4352noname.403:
4353 movl -100(fp),r3
4354 movl -104(fp),r2
4355 bbc #31,r2,noname.404
4356 incl r9
4357noname.404:
4358 addl2 r2,r2
4359 bicl2 #0,r2
4360 bbc #31,r3,noname.405
4361 incl r2
4362noname.405:
4363 addl2 r3,r3
4364 bicl2 #0,r3
4365 addl2 r3,r8
4366 bicl2 #0,r8
4367 cmpl r8,r3
4368 bgequ noname.406
4369 incl r2
4370 bicl3 #0,r2,r0
4371 bneq noname.406
4372 incl r9
4373noname.406:
4374 addl2 r2,r7
4375 bicl2 #0,r7
4376 cmpl r7,r2
4377 bgequ noname.407
4378 incl r9
4379noname.407:
4380
4381 movl 8(ap),r0
4382 movzwl 18(r0),r2
4383 bicl3 #-65536,(r0),r3
4384 movzwl 2(r0),r1
4385 bicl2 #-65536,r1
4386 bicl3 #-65536,16(r0),-116(fp)
4387 bicl3 #-65536,r2,-120(fp)
4388 mull3 r1,-116(fp),-108(fp)
4389 mull2 r3,-116(fp)
4390 mull3 r3,-120(fp),-112(fp)
4391 mull2 r1,-120(fp)
4392 addl3 -108(fp),-112(fp),r0
4393 bicl3 #0,r0,-108(fp)
4394 cmpl -108(fp),-112(fp)
4395 bgequ noname.408
4396 addl2 #65536,-120(fp)
4397noname.408:
4398 movzwl -106(fp),r0
4399 bicl2 #-65536,r0
4400 addl2 r0,-120(fp)
4401 bicl3 #-65536,-108(fp),r0
4402 ashl #16,r0,-112(fp)
4403 addl3 -112(fp),-116(fp),r0
4404 bicl3 #0,r0,-116(fp)
4405 cmpl -116(fp),-112(fp)
4406 bgequ noname.409
4407 incl -120(fp)
4408noname.409:
4409 movl -116(fp),r3
4410 movl -120(fp),r2
4411 bbc #31,r2,noname.410
4412 incl r9
4413noname.410:
4414 addl2 r2,r2
4415 bicl2 #0,r2
4416 bbc #31,r3,noname.411
4417 incl r2
4418noname.411:
4419 addl2 r3,r3
4420 bicl2 #0,r3
4421 addl2 r3,r8
4422 bicl2 #0,r8
4423 cmpl r8,r3
4424 bgequ noname.412
4425 incl r2
4426 bicl3 #0,r2,r0
4427 bneq noname.412
4428 incl r9
4429noname.412:
4430 addl2 r2,r7
4431 bicl2 #0,r7
4432 cmpl r7,r2
4433 bgequ noname.413
4434 incl r9
4435noname.413:
4436
4437 movl 4(ap),r0
4438 movl r8,16(r0)
4439
4440 clrl r8
4441
4442 movl 8(ap),r0
4443 movzwl 22(r0),r2
4444 bicl3 #-65536,(r0),r3
4445 movzwl 2(r0),r1
4446 bicl2 #-65536,r1
4447 bicl3 #-65536,20(r0),-132(fp)
4448 bicl3 #-65536,r2,-136(fp)
4449 mull3 r1,-132(fp),-124(fp)
4450 mull2 r3,-132(fp)
4451 mull3 r3,-136(fp),-128(fp)
4452 mull2 r1,-136(fp)
4453 addl3 -124(fp),-128(fp),r0
4454 bicl3 #0,r0,-124(fp)
4455 cmpl -124(fp),-128(fp)
4456 bgequ noname.414
4457 addl2 #65536,-136(fp)
4458noname.414:
4459 movzwl -122(fp),r0
4460 bicl2 #-65536,r0
4461 addl2 r0,-136(fp)
4462 bicl3 #-65536,-124(fp),r0
4463 ashl #16,r0,-128(fp)
4464 addl3 -128(fp),-132(fp),r0
4465 bicl3 #0,r0,-132(fp)
4466 cmpl -132(fp),-128(fp)
4467 bgequ noname.415
4468 incl -136(fp)
4469noname.415:
4470 movl -132(fp),r3
4471 movl -136(fp),r2
4472 bbc #31,r2,noname.416
4473 incl r8
4474noname.416:
4475 addl2 r2,r2
4476 bicl2 #0,r2
4477 bbc #31,r3,noname.417
4478 incl r2
4479noname.417:
4480 addl2 r3,r3
4481 bicl2 #0,r3
4482 addl2 r3,r7
4483 bicl2 #0,r7
4484 cmpl r7,r3
4485 bgequ noname.418
4486 incl r2
4487 bicl3 #0,r2,r0
4488 bneq noname.418
4489 incl r8
4490noname.418:
4491 addl2 r2,r9
4492 bicl2 #0,r9
4493 cmpl r9,r2
4494 bgequ noname.419
4495 incl r8
4496noname.419:
4497
4498 movl 8(ap),r0
4499 movzwl 18(r0),r2
4500 bicl3 #-65536,4(r0),r3
4501 movzwl 6(r0),r1
4502 bicl2 #-65536,r1
4503 bicl3 #-65536,16(r0),-148(fp)
4504 bicl3 #-65536,r2,-152(fp)
4505 mull3 r1,-148(fp),-140(fp)
4506 mull2 r3,-148(fp)
4507 mull3 r3,-152(fp),-144(fp)
4508 mull2 r1,-152(fp)
4509 addl3 -140(fp),-144(fp),r0
4510 bicl3 #0,r0,-140(fp)
4511 cmpl -140(fp),-144(fp)
4512 bgequ noname.420
4513 addl2 #65536,-152(fp)
4514noname.420:
4515 movzwl -138(fp),r0
4516 bicl2 #-65536,r0
4517 addl2 r0,-152(fp)
4518 bicl3 #-65536,-140(fp),r0
4519 ashl #16,r0,-144(fp)
4520 addl3 -144(fp),-148(fp),r0
4521 bicl3 #0,r0,-148(fp)
4522 cmpl -148(fp),-144(fp)
4523 bgequ noname.421
4524 incl -152(fp)
4525noname.421:
4526 movl -148(fp),r3
4527 movl -152(fp),r2
4528 bbc #31,r2,noname.422
4529 incl r8
4530noname.422:
4531 addl2 r2,r2
4532 bicl2 #0,r2
4533 bbc #31,r3,noname.423
4534 incl r2
4535noname.423:
4536 addl2 r3,r3
4537 bicl2 #0,r3
4538 addl2 r3,r7
4539 bicl2 #0,r7
4540 cmpl r7,r3
4541 bgequ noname.424
4542 incl r2
4543 bicl3 #0,r2,r0
4544 bneq noname.424
4545 incl r8
4546noname.424:
4547 addl2 r2,r9
4548 bicl2 #0,r9
4549 cmpl r9,r2
4550 bgequ noname.425
4551 incl r8
4552noname.425:
4553
4554 movl 8(ap),r0
4555 movzwl 14(r0),r2
4556 bicl3 #-65536,8(r0),r3
4557 movzwl 10(r0),r1
4558 bicl2 #-65536,r1
4559 bicl3 #-65536,12(r0),-164(fp)
4560 bicl3 #-65536,r2,-168(fp)
4561 mull3 r1,-164(fp),-156(fp)
4562 mull2 r3,-164(fp)
4563 mull3 r3,-168(fp),-160(fp)
4564 mull2 r1,-168(fp)
4565 addl3 -156(fp),-160(fp),r0
4566 bicl3 #0,r0,-156(fp)
4567 cmpl -156(fp),-160(fp)
4568 bgequ noname.426
4569 addl2 #65536,-168(fp)
4570noname.426:
4571 movzwl -154(fp),r0
4572 bicl2 #-65536,r0
4573 addl2 r0,-168(fp)
4574 bicl3 #-65536,-156(fp),r0
4575 ashl #16,r0,-160(fp)
4576 addl3 -160(fp),-164(fp),r0
4577 bicl3 #0,r0,-164(fp)
4578 cmpl -164(fp),-160(fp)
4579 bgequ noname.427
4580 incl -168(fp)
4581noname.427:
4582 movl -164(fp),r3
4583 movl -168(fp),r2
4584 bbc #31,r2,noname.428
4585 incl r8
4586noname.428:
4587 addl2 r2,r2
4588 bicl2 #0,r2
4589 bbc #31,r3,noname.429
4590 incl r2
4591noname.429:
4592 addl2 r3,r3
4593 bicl2 #0,r3
4594 addl2 r3,r7
4595 bicl2 #0,r7
4596 cmpl r7,r3
4597 bgequ noname.430
4598 incl r2
4599 bicl3 #0,r2,r0
4600 bneq noname.430
4601 incl r8
4602noname.430:
4603 addl2 r2,r9
4604 bicl2 #0,r9
4605 cmpl r9,r2
4606 bgequ noname.431
4607 incl r8
4608noname.431:
4609
4610 movl 4(ap),r0
4611 movl r7,20(r0)
4612
4613 clrl r7
4614
4615 movl 8(ap),r2
4616 movl 12(r2),r4
4617 bicl3 #-65536,r4,-172(fp)
4618 extzv #16,#16,r4,r0
4619 bicl3 #-65536,r0,r4
4620 movl -172(fp),r0
4621 mull3 r0,r4,-176(fp)
4622 mull3 r0,r0,-172(fp)
4623 mull2 r4,r4
4624 bicl3 #32767,-176(fp),r0
4625 extzv #15,#17,r0,r0
4626 addl2 r0,r4
4627 bicl3 #-65536,-176(fp),r0
4628 ashl #17,r0,-176(fp)
4629 addl3 -172(fp),-176(fp),r0
4630 bicl3 #0,r0,-172(fp)
4631 cmpl -172(fp),-176(fp)
4632 bgequ noname.432
4633 incl r4
4634noname.432:
4635 movl -172(fp),r1
4636 movl r4,r3
4637 addl2 r1,r9
4638 bicl2 #0,r9
4639 cmpl r9,r1
4640 bgequ noname.433
4641 incl r3
4642noname.433:
4643 addl2 r3,r8
4644 bicl2 #0,r8
4645 cmpl r8,r3
4646 bgequ noname.434
4647 incl r7
4648noname.434:
4649
4650 movzwl 18(r2),r3
4651 bicl3 #-65536,8(r2),r1
4652 movzwl 10(r2),r0
4653 bicl2 #-65536,r0
4654 bicl3 #-65536,16(r2),-188(fp)
4655 bicl3 #-65536,r3,-192(fp)
4656 mull3 r0,-188(fp),-180(fp)
4657 mull2 r1,-188(fp)
4658 mull3 r1,-192(fp),-184(fp)
4659 mull2 r0,-192(fp)
4660 addl3 -180(fp),-184(fp),r0
4661 bicl3 #0,r0,-180(fp)
4662 cmpl -180(fp),-184(fp)
4663 bgequ noname.435
4664 addl2 #65536,-192(fp)
4665noname.435:
4666 movzwl -178(fp),r0
4667 bicl2 #-65536,r0
4668 addl2 r0,-192(fp)
4669 bicl3 #-65536,-180(fp),r0
4670 ashl #16,r0,-184(fp)
4671 addl3 -184(fp),-188(fp),r0
4672 bicl3 #0,r0,-188(fp)
4673 cmpl -188(fp),-184(fp)
4674 bgequ noname.436
4675 incl -192(fp)
4676noname.436:
4677 movl -188(fp),r3
4678 movl -192(fp),r2
4679 bbc #31,r2,noname.437
4680 incl r7
4681noname.437:
4682 addl2 r2,r2
4683 bicl2 #0,r2
4684 bbc #31,r3,noname.438
4685 incl r2
4686noname.438:
4687 addl2 r3,r3
4688 bicl2 #0,r3
4689 addl2 r3,r9
4690 bicl2 #0,r9
4691 cmpl r9,r3
4692 bgequ noname.439
4693 incl r2
4694 bicl3 #0,r2,r0
4695 bneq noname.439
4696 incl r7
4697noname.439:
4698 addl2 r2,r8
4699 bicl2 #0,r8
4700 cmpl r8,r2
4701 bgequ noname.440
4702 incl r7
4703noname.440:
4704
4705 movl 8(ap),r0
4706 movzwl 22(r0),r2
4707 bicl3 #-65536,4(r0),r3
4708 movzwl 6(r0),r1
4709 bicl2 #-65536,r1
4710 bicl3 #-65536,20(r0),-204(fp)
4711 bicl3 #-65536,r2,-208(fp)
4712 mull3 r1,-204(fp),-196(fp)
4713 mull2 r3,-204(fp)
4714 mull3 r3,-208(fp),-200(fp)
4715 mull2 r1,-208(fp)
4716 addl3 -196(fp),-200(fp),r0
4717 bicl3 #0,r0,-196(fp)
4718 cmpl -196(fp),-200(fp)
4719 bgequ noname.441
4720 addl2 #65536,-208(fp)
4721noname.441:
4722 movzwl -194(fp),r0
4723 bicl2 #-65536,r0
4724 addl2 r0,-208(fp)
4725 bicl3 #-65536,-196(fp),r0
4726 ashl #16,r0,-200(fp)
4727 addl3 -200(fp),-204(fp),r0
4728 bicl3 #0,r0,-204(fp)
4729 cmpl -204(fp),-200(fp)
4730 bgequ noname.442
4731 incl -208(fp)
4732noname.442:
4733 movl -204(fp),r3
4734 movl -208(fp),r2
4735 bbc #31,r2,noname.443
4736 incl r7
4737noname.443:
4738 addl2 r2,r2
4739 bicl2 #0,r2
4740 bbc #31,r3,noname.444
4741 incl r2
4742noname.444:
4743 addl2 r3,r3
4744 bicl2 #0,r3
4745 addl2 r3,r9
4746 bicl2 #0,r9
4747 cmpl r9,r3
4748 bgequ noname.445
4749 incl r2
4750 bicl3 #0,r2,r0
4751 bneq noname.445
4752 incl r7
4753noname.445:
4754 addl2 r2,r8
4755 bicl2 #0,r8
4756 cmpl r8,r2
4757 bgequ noname.446
4758 incl r7
4759noname.446:
4760
4761 movl 8(ap),r0
4762 movzwl 26(r0),r2
4763 bicl3 #-65536,(r0),r3
4764 movzwl 2(r0),r1
4765 bicl2 #-65536,r1
4766 bicl3 #-65536,24(r0),-220(fp)
4767 bicl3 #-65536,r2,-224(fp)
4768 mull3 r1,-220(fp),-212(fp)
4769 mull2 r3,-220(fp)
4770 mull3 r3,-224(fp),-216(fp)
4771 mull2 r1,-224(fp)
4772 addl3 -212(fp),-216(fp),r0
4773 bicl3 #0,r0,-212(fp)
4774 cmpl -212(fp),-216(fp)
4775 bgequ noname.447
4776 addl2 #65536,-224(fp)
4777noname.447:
4778 movzwl -210(fp),r0
4779 bicl2 #-65536,r0
4780 addl2 r0,-224(fp)
4781 bicl3 #-65536,-212(fp),r0
4782 ashl #16,r0,-216(fp)
4783 addl3 -216(fp),-220(fp),r0
4784 bicl3 #0,r0,-220(fp)
4785 cmpl -220(fp),-216(fp)
4786 bgequ noname.448
4787 incl -224(fp)
4788noname.448:
4789 movl -220(fp),r3
4790 movl -224(fp),r2
4791 bbc #31,r2,noname.449
4792 incl r7
4793noname.449:
4794 addl2 r2,r2
4795 bicl2 #0,r2
4796 bbc #31,r3,noname.450
4797 incl r2
4798noname.450:
4799 addl2 r3,r3
4800 bicl2 #0,r3
4801 addl2 r3,r9
4802 bicl2 #0,r9
4803 cmpl r9,r3
4804 bgequ noname.451
4805 incl r2
4806 bicl3 #0,r2,r0
4807 bneq noname.451
4808 incl r7
4809noname.451:
4810 addl2 r2,r8
4811 bicl2 #0,r8
4812 cmpl r8,r2
4813 bgequ noname.452
4814 incl r7
4815noname.452:
4816
4817 movl 4(ap),r0
4818 movl r9,24(r0)
4819
4820 clrl r9
4821
4822 movl 8(ap),r0
4823 movzwl 30(r0),r2
4824 bicl3 #-65536,(r0),r3
4825 movzwl 2(r0),r1
4826 bicl2 #-65536,r1
4827 bicl3 #-65536,28(r0),-236(fp)
4828 bicl3 #-65536,r2,-240(fp)
4829 mull3 r1,-236(fp),-228(fp)
4830 mull2 r3,-236(fp)
4831 mull3 r3,-240(fp),-232(fp)
4832 mull2 r1,-240(fp)
4833 addl3 -228(fp),-232(fp),r0
4834 bicl3 #0,r0,-228(fp)
4835 cmpl -228(fp),-232(fp)
4836 bgequ noname.453
4837 addl2 #65536,-240(fp)
4838noname.453:
4839 movzwl -226(fp),r0
4840 bicl2 #-65536,r0
4841 addl2 r0,-240(fp)
4842 bicl3 #-65536,-228(fp),r0
4843 ashl #16,r0,-232(fp)
4844 addl3 -232(fp),-236(fp),r0
4845 bicl3 #0,r0,-236(fp)
4846 cmpl -236(fp),-232(fp)
4847 bgequ noname.454
4848 incl -240(fp)
4849noname.454:
4850 movl -236(fp),r3
4851 movl -240(fp),r2
4852 bbc #31,r2,noname.455
4853 incl r9
4854noname.455:
4855 addl2 r2,r2
4856 bicl2 #0,r2
4857 bbc #31,r3,noname.456
4858 incl r2
4859noname.456:
4860 addl2 r3,r3
4861 bicl2 #0,r3
4862 addl2 r3,r8
4863 bicl2 #0,r8
4864 cmpl r8,r3
4865 bgequ noname.457
4866 incl r2
4867 bicl3 #0,r2,r0
4868 bneq noname.457
4869 incl r9
4870noname.457:
4871 addl2 r2,r7
4872 bicl2 #0,r7
4873 cmpl r7,r2
4874 bgequ noname.458
4875 incl r9
4876noname.458:
4877
4878 movl 8(ap),r0
4879 movzwl 26(r0),r2
4880 bicl3 #-65536,4(r0),r3
4881 movzwl 6(r0),r1
4882 bicl2 #-65536,r1
4883 bicl3 #-65536,24(r0),-252(fp)
4884 bicl3 #-65536,r2,-256(fp)
4885 mull3 r1,-252(fp),-244(fp)
4886 mull2 r3,-252(fp)
4887 mull3 r3,-256(fp),-248(fp)
4888 mull2 r1,-256(fp)
4889 addl3 -244(fp),-248(fp),r0
4890 bicl3 #0,r0,-244(fp)
4891 cmpl -244(fp),-248(fp)
4892 bgequ noname.459
4893 addl2 #65536,-256(fp)
4894noname.459:
4895 movzwl -242(fp),r0
4896 bicl2 #-65536,r0
4897 addl2 r0,-256(fp)
4898 bicl3 #-65536,-244(fp),r0
4899 ashl #16,r0,-248(fp)
4900 addl3 -248(fp),-252(fp),r0
4901 bicl3 #0,r0,-252(fp)
4902 cmpl -252(fp),-248(fp)
4903 bgequ noname.460
4904 incl -256(fp)
4905noname.460:
4906 movl -252(fp),r3
4907 movl -256(fp),r2
4908 bbc #31,r2,noname.461
4909 incl r9
4910noname.461:
4911 addl2 r2,r2
4912 bicl2 #0,r2
4913 bbc #31,r3,noname.462
4914 incl r2
4915noname.462:
4916 addl2 r3,r3
4917 bicl2 #0,r3
4918 addl2 r3,r8
4919 bicl2 #0,r8
4920 cmpl r8,r3
4921 bgequ noname.463
4922 incl r2
4923 bicl3 #0,r2,r0
4924 bneq noname.463
4925 incl r9
4926noname.463:
4927 addl2 r2,r7
4928 bicl2 #0,r7
4929 cmpl r7,r2
4930 bgequ noname.464
4931 incl r9
4932noname.464:
4933
4934 movl 8(ap),r0
4935 movzwl 22(r0),r2
4936 bicl3 #-65536,8(r0),r3
4937 movzwl 10(r0),r1
4938 bicl2 #-65536,r1
4939 bicl3 #-65536,20(r0),-268(fp)
4940 bicl3 #-65536,r2,-272(fp)
4941 mull3 r1,-268(fp),-260(fp)
4942 mull2 r3,-268(fp)
4943 mull3 r3,-272(fp),-264(fp)
4944 mull2 r1,-272(fp)
4945 addl3 -260(fp),-264(fp),r0
4946 bicl3 #0,r0,-260(fp)
4947 cmpl -260(fp),-264(fp)
4948 bgequ noname.465
4949 addl2 #65536,-272(fp)
4950noname.465:
4951 movzwl -258(fp),r0
4952 bicl2 #-65536,r0
4953 addl2 r0,-272(fp)
4954 bicl3 #-65536,-260(fp),r0
4955 ashl #16,r0,-264(fp)
4956 addl3 -264(fp),-268(fp),r0
4957 bicl3 #0,r0,-268(fp)
4958 cmpl -268(fp),-264(fp)
4959 bgequ noname.466
4960 incl -272(fp)
4961noname.466:
4962 movl -268(fp),r3
4963 movl -272(fp),r2
4964 bbc #31,r2,noname.467
4965 incl r9
4966noname.467:
4967 addl2 r2,r2
4968 bicl2 #0,r2
4969 bbc #31,r3,noname.468
4970 incl r2
4971noname.468:
4972 addl2 r3,r3
4973 bicl2 #0,r3
4974 addl2 r3,r8
4975 bicl2 #0,r8
4976 cmpl r8,r3
4977 bgequ noname.469
4978 incl r2
4979 bicl3 #0,r2,r0
4980 bneq noname.469
4981 incl r9
4982noname.469:
4983 addl2 r2,r7
4984 bicl2 #0,r7
4985 cmpl r7,r2
4986 bgequ noname.470
4987 incl r9
4988noname.470:
4989
4990 movl 8(ap),r0
4991 movzwl 18(r0),r2
4992 bicl3 #-65536,12(r0),r3
4993 movzwl 14(r0),r1
4994 bicl2 #-65536,r1
4995 bicl3 #-65536,16(r0),-284(fp)
4996 bicl3 #-65536,r2,-288(fp)
4997 mull3 r1,-284(fp),-276(fp)
4998 mull2 r3,-284(fp)
4999 mull3 r3,-288(fp),-280(fp)
5000 mull2 r1,-288(fp)
5001 addl3 -276(fp),-280(fp),r0
5002 bicl3 #0,r0,-276(fp)
5003 cmpl -276(fp),-280(fp)
5004 bgequ noname.471
5005 addl2 #65536,-288(fp)
5006noname.471:
5007 movzwl -274(fp),r0
5008 bicl2 #-65536,r0
5009 addl2 r0,-288(fp)
5010 bicl3 #-65536,-276(fp),r0
5011 ashl #16,r0,-280(fp)
5012 addl3 -280(fp),-284(fp),r0
5013 bicl3 #0,r0,-284(fp)
5014 cmpl -284(fp),-280(fp)
5015 bgequ noname.472
5016 incl -288(fp)
5017noname.472:
5018 movl -284(fp),r3
5019 movl -288(fp),r2
5020 bbc #31,r2,noname.473
5021 incl r9
5022noname.473:
5023 addl2 r2,r2
5024 bicl2 #0,r2
5025 bbc #31,r3,noname.474
5026 incl r2
5027noname.474:
5028 addl2 r3,r3
5029 bicl2 #0,r3
5030 addl2 r3,r8
5031 bicl2 #0,r8
5032 cmpl r8,r3
5033 bgequ noname.475
5034 incl r2
5035 bicl3 #0,r2,r0
5036 bneq noname.475
5037 incl r9
5038noname.475:
5039 addl2 r2,r7
5040 bicl2 #0,r7
5041 cmpl r7,r2
5042 bgequ noname.476
5043 incl r9
5044noname.476:
5045
5046 movl 4(ap),r0
5047 movl r8,28(r0)
5048
5049 clrl r8
5050
5051 movl 8(ap),r3
5052 movl 16(r3),r4
5053 bicl3 #-65536,r4,r5
5054 extzv #16,#16,r4,r0
5055 bicl3 #-65536,r0,r4
5056 mull3 r5,r4,-292(fp)
5057 mull2 r5,r5
5058 mull2 r4,r4
5059 bicl3 #32767,-292(fp),r0
5060 extzv #15,#17,r0,r0
5061 addl2 r0,r4
5062 bicl3 #-65536,-292(fp),r0
5063 ashl #17,r0,-292(fp)
5064 addl2 -292(fp),r5
5065 bicl2 #0,r5
5066 cmpl r5,-292(fp)
5067 bgequ noname.477
5068 incl r4
5069noname.477:
5070 movl r5,r1
5071 movl r4,r2
5072 addl2 r1,r7
5073 bicl2 #0,r7
5074 cmpl r7,r1
5075 bgequ noname.478
5076 incl r2
5077noname.478:
5078 addl2 r2,r9
5079 bicl2 #0,r9
5080 cmpl r9,r2
5081 bgequ noname.479
5082 incl r8
5083noname.479:
5084
5085 bicl3 #-65536,20(r3),r4
5086 movzwl 22(r3),r1
5087 bicl2 #-65536,r1
5088 bicl3 #-65536,12(r3),r2
5089 movzwl 14(r3),r0
5090 bicl2 #-65536,r0
5091 movl r4,r6
5092 movl r1,r5
5093 mull3 r0,r6,-296(fp)
5094 mull2 r2,r6
5095 mull3 r2,r5,-300(fp)
5096 mull2 r0,r5
5097 addl3 -296(fp),-300(fp),r0
5098 bicl3 #0,r0,-296(fp)
5099 cmpl -296(fp),-300(fp)
5100 bgequ noname.480
5101 addl2 #65536,r5
5102noname.480:
5103 movzwl -294(fp),r0
5104 bicl2 #-65536,r0
5105 addl2 r0,r5
5106 bicl3 #-65536,-296(fp),r0
5107 ashl #16,r0,-300(fp)
5108 addl2 -300(fp),r6
5109 bicl2 #0,r6
5110 cmpl r6,-300(fp)
5111 bgequ noname.481
5112 incl r5
5113noname.481:
5114 movl r6,r3
5115 movl r5,r2
5116 bbc #31,r2,noname.482
5117 incl r8
5118noname.482:
5119 addl2 r2,r2
5120 bicl2 #0,r2
5121 bbc #31,r3,noname.483
5122 incl r2
5123noname.483:
5124 addl2 r3,r3
5125 bicl2 #0,r3
5126 addl2 r3,r7
5127 bicl2 #0,r7
5128 cmpl r7,r3
5129 bgequ noname.484
5130 incl r2
5131 bicl3 #0,r2,r0
5132 bneq noname.484
5133 incl r8
5134noname.484:
5135 addl2 r2,r9
5136 bicl2 #0,r9
5137 cmpl r9,r2
5138 bgequ noname.485
5139 incl r8
5140noname.485:
5141
5142 movl 8(ap),r0
5143 bicl3 #-65536,24(r0),r3
5144 movzwl 26(r0),r1
5145 bicl2 #-65536,r1
5146 bicl3 #-65536,8(r0),r2
5147 movzwl 10(r0),r0
5148 bicl2 #-65536,r0
5149 movl r3,r5
5150 movl r1,r4
5151 mull3 r0,r5,-304(fp)
5152 mull2 r2,r5
5153 mull3 r2,r4,-308(fp)
5154 mull2 r0,r4
5155 addl3 -304(fp),-308(fp),r0
5156 bicl3 #0,r0,-304(fp)
5157 cmpl -304(fp),-308(fp)
5158 bgequ noname.486
5159 addl2 #65536,r4
5160noname.486:
5161 movzwl -302(fp),r0
5162 bicl2 #-65536,r0
5163 addl2 r0,r4
5164 bicl3 #-65536,-304(fp),r0
5165 ashl #16,r0,-308(fp)
5166 addl2 -308(fp),r5
5167 bicl2 #0,r5
5168 cmpl r5,-308(fp)
5169 bgequ noname.487
5170 incl r4
5171noname.487:
5172 movl r5,r3
5173 movl r4,r2
5174 bbc #31,r2,noname.488
5175 incl r8
5176noname.488:
5177 addl2 r2,r2
5178 bicl2 #0,r2
5179 bbc #31,r3,noname.489
5180 incl r2
5181noname.489:
5182 addl2 r3,r3
5183 bicl2 #0,r3
5184 addl2 r3,r7
5185 bicl2 #0,r7
5186 cmpl r7,r3
5187 bgequ noname.490
5188 incl r2
5189 bicl3 #0,r2,r0
5190 bneq noname.490
5191 incl r8
5192noname.490:
5193 addl2 r2,r9
5194 bicl2 #0,r9
5195 cmpl r9,r2
5196 bgequ noname.491
5197 incl r8
5198noname.491:
5199
5200 movl 8(ap),r0
5201 bicl3 #-65536,28(r0),r3
5202 movzwl 30(r0),r1
5203 bicl2 #-65536,r1
5204 bicl3 #-65536,4(r0),r2
5205 movzwl 6(r0),r0
5206 bicl2 #-65536,r0
5207 movl r3,r5
5208 movl r1,r4
5209 mull3 r0,r5,-312(fp)
5210 mull2 r2,r5
5211 mull3 r2,r4,-316(fp)
5212 mull2 r0,r4
5213 addl3 -312(fp),-316(fp),r0
5214 bicl3 #0,r0,-312(fp)
5215 cmpl -312(fp),-316(fp)
5216 bgequ noname.492
5217 addl2 #65536,r4
5218noname.492:
5219 movzwl -310(fp),r0
5220 bicl2 #-65536,r0
5221 addl2 r0,r4
5222 bicl3 #-65536,-312(fp),r0
5223 ashl #16,r0,-316(fp)
5224 addl2 -316(fp),r5
5225 bicl2 #0,r5
5226 cmpl r5,-316(fp)
5227 bgequ noname.493
5228 incl r4
5229noname.493:
5230 movl r5,r3
5231 movl r4,r2
5232 bbc #31,r2,noname.494
5233 incl r8
5234noname.494:
5235 addl2 r2,r2
5236 bicl2 #0,r2
5237 bbc #31,r3,noname.495
5238 incl r2
5239noname.495:
5240 addl2 r3,r3
5241 bicl2 #0,r3
5242 addl2 r3,r7
5243 bicl2 #0,r7
5244 cmpl r7,r3
5245 bgequ noname.496
5246 incl r2
5247 bicl3 #0,r2,r0
5248 bneq noname.496
5249 incl r8
5250noname.496:
5251 addl2 r2,r9
5252 bicl2 #0,r9
5253 cmpl r9,r2
5254 bgequ noname.497
5255 incl r8
5256noname.497:
5257
5258 movl 4(ap),r0
5259 movl r7,32(r0)
5260
5261 clrl r7
5262
5263 movl 8(ap),r0
5264 bicl3 #-65536,28(r0),r3
5265 movzwl 30(r0),r2
5266 bicl3 #-65536,8(r0),r1
5267 movzwl 10(r0),r0
5268 bicl2 #-65536,r0
5269 movl r3,r4
5270 bicl3 #-65536,r2,-328(fp)
5271 mull3 r0,r4,-320(fp)
5272 mull2 r1,r4
5273 mull3 r1,-328(fp),-324(fp)
5274 mull2 r0,-328(fp)
5275 addl3 -320(fp),-324(fp),r0
5276 bicl3 #0,r0,-320(fp)
5277 cmpl -320(fp),-324(fp)
5278 bgequ noname.498
5279 addl2 #65536,-328(fp)
5280noname.498:
5281 movzwl -318(fp),r0
5282 bicl2 #-65536,r0
5283 addl2 r0,-328(fp)
5284 bicl3 #-65536,-320(fp),r0
5285 ashl #16,r0,-324(fp)
5286 addl2 -324(fp),r4
5287 bicl2 #0,r4
5288 cmpl r4,-324(fp)
5289 bgequ noname.499
5290 incl -328(fp)
5291noname.499:
5292 movl r4,r3
5293 movl -328(fp),r2
5294 bbc #31,r2,noname.500
5295 incl r7
5296noname.500:
5297 addl2 r2,r2
5298 bicl2 #0,r2
5299 bbc #31,r3,noname.501
5300 incl r2
5301noname.501:
5302 addl2 r3,r3
5303 bicl2 #0,r3
5304 addl2 r3,r9
5305 bicl2 #0,r9
5306 cmpl r9,r3
5307 bgequ noname.502
5308 incl r2
5309 bicl3 #0,r2,r0
5310 bneq noname.502
5311 incl r7
5312noname.502:
5313 addl2 r2,r8
5314 bicl2 #0,r8
5315 cmpl r8,r2
5316 bgequ noname.503
5317 incl r7
5318noname.503:
5319
5320 movl 8(ap),r0
5321 movzwl 26(r0),r2
5322 bicl3 #-65536,12(r0),r3
5323 movzwl 14(r0),r1
5324 bicl2 #-65536,r1
5325 bicl3 #-65536,24(r0),-340(fp)
5326 bicl3 #-65536,r2,-344(fp)
5327 mull3 r1,-340(fp),-332(fp)
5328 mull2 r3,-340(fp)
5329 mull3 r3,-344(fp),-336(fp)
5330 mull2 r1,-344(fp)
5331 addl3 -332(fp),-336(fp),r0
5332 bicl3 #0,r0,-332(fp)
5333 cmpl -332(fp),-336(fp)
5334 bgequ noname.504
5335 addl2 #65536,-344(fp)
5336noname.504:
5337 movzwl -330(fp),r0
5338 bicl2 #-65536,r0
5339 addl2 r0,-344(fp)
5340 bicl3 #-65536,-332(fp),r0
5341 ashl #16,r0,-336(fp)
5342 addl3 -336(fp),-340(fp),r0
5343 bicl3 #0,r0,-340(fp)
5344 cmpl -340(fp),-336(fp)
5345 bgequ noname.505
5346 incl -344(fp)
5347noname.505:
5348 movl -340(fp),r3
5349 movl -344(fp),r2
5350 bbc #31,r2,noname.506
5351 incl r7
5352noname.506:
5353 addl2 r2,r2
5354 bicl2 #0,r2
5355 bbc #31,r3,noname.507
5356 incl r2
5357noname.507:
5358 addl2 r3,r3
5359 bicl2 #0,r3
5360 addl2 r3,r9
5361 bicl2 #0,r9
5362 cmpl r9,r3
5363 bgequ noname.508
5364 incl r2
5365 bicl3 #0,r2,r0
5366 bneq noname.508
5367 incl r7
5368noname.508:
5369 addl2 r2,r8
5370 bicl2 #0,r8
5371 cmpl r8,r2
5372 bgequ noname.509
5373 incl r7
5374noname.509:
5375
5376 movl 8(ap),r0
5377 movzwl 22(r0),r2
5378 bicl3 #-65536,16(r0),r3
5379 movzwl 18(r0),r1
5380 bicl2 #-65536,r1
5381 bicl3 #-65536,20(r0),-356(fp)
5382 bicl3 #-65536,r2,-360(fp)
5383 mull3 r1,-356(fp),-348(fp)
5384 mull2 r3,-356(fp)
5385 mull3 r3,-360(fp),-352(fp)
5386 mull2 r1,-360(fp)
5387 addl3 -348(fp),-352(fp),r0
5388 bicl3 #0,r0,-348(fp)
5389 cmpl -348(fp),-352(fp)
5390 bgequ noname.510
5391 addl2 #65536,-360(fp)
5392noname.510:
5393 movzwl -346(fp),r0
5394 bicl2 #-65536,r0
5395 addl2 r0,-360(fp)
5396 bicl3 #-65536,-348(fp),r0
5397 ashl #16,r0,-352(fp)
5398 addl3 -352(fp),-356(fp),r0
5399 bicl3 #0,r0,-356(fp)
5400 cmpl -356(fp),-352(fp)
5401 bgequ noname.511
5402 incl -360(fp)
5403noname.511:
5404 movl -356(fp),r3
5405 movl -360(fp),r2
5406 bbc #31,r2,noname.512
5407 incl r7
5408noname.512:
5409 addl2 r2,r2
5410 bicl2 #0,r2
5411 bbc #31,r3,noname.513
5412 incl r2
5413noname.513:
5414 addl2 r3,r3
5415 bicl2 #0,r3
5416 addl2 r3,r9
5417 bicl2 #0,r9
5418 cmpl r9,r3
5419 bgequ noname.514
5420 incl r2
5421 bicl3 #0,r2,r0
5422 bneq noname.514
5423 incl r7
5424noname.514:
5425 addl2 r2,r8
5426 bicl2 #0,r8
5427 cmpl r8,r2
5428 bgequ noname.515
5429 incl r7
5430noname.515:
5431
5432 movl 4(ap),r0
5433 movl r9,36(r0)
5434
5435 clrl r9
5436
5437 movl 8(ap),r3
5438 movl 20(r3),r4
5439 bicl3 #-65536,r4,-364(fp)
5440 extzv #16,#16,r4,r0
5441 bicl3 #-65536,r0,r4
5442 movl -364(fp),r0
5443 mull3 r0,r4,-368(fp)
5444 mull3 r0,r0,-364(fp)
5445 mull2 r4,r4
5446 bicl3 #32767,-368(fp),r0
5447 extzv #15,#17,r0,r0
5448 addl2 r0,r4
5449 bicl3 #-65536,-368(fp),r0
5450 ashl #17,r0,-368(fp)
5451 addl3 -364(fp),-368(fp),r0
5452 bicl3 #0,r0,-364(fp)
5453 cmpl -364(fp),-368(fp)
5454 bgequ noname.516
5455 incl r4
5456noname.516:
5457 movl -364(fp),r1
5458 movl r4,r2
5459 addl2 r1,r8
5460 bicl2 #0,r8
5461 cmpl r8,r1
5462 bgequ noname.517
5463 incl r2
5464noname.517:
5465 addl2 r2,r7
5466 bicl2 #0,r7
5467 cmpl r7,r2
5468 bgequ noname.518
5469 incl r9
5470noname.518:
5471
5472 bicl3 #-65536,24(r3),r4
5473 movzwl 26(r3),r1
5474 bicl2 #-65536,r1
5475 bicl3 #-65536,16(r3),r2
5476 movzwl 18(r3),r0
5477 bicl2 #-65536,r0
5478 movl r4,r6
5479 movl r1,r5
5480 mull3 r0,r6,-372(fp)
5481 mull2 r2,r6
5482 mull3 r2,r5,-376(fp)
5483 mull2 r0,r5
5484 addl3 -372(fp),-376(fp),r0
5485 bicl3 #0,r0,-372(fp)
5486 cmpl -372(fp),-376(fp)
5487 bgequ noname.519
5488 addl2 #65536,r5
5489noname.519:
5490 movzwl -370(fp),r0
5491 bicl2 #-65536,r0
5492 addl2 r0,r5
5493 bicl3 #-65536,-372(fp),r0
5494 ashl #16,r0,-376(fp)
5495 addl2 -376(fp),r6
5496 bicl2 #0,r6
5497 cmpl r6,-376(fp)
5498 bgequ noname.520
5499 incl r5
5500noname.520:
5501 movl r6,r3
5502 movl r5,r2
5503 bbc #31,r2,noname.521
5504 incl r9
5505noname.521:
5506 addl2 r2,r2
5507 bicl2 #0,r2
5508 bbc #31,r3,noname.522
5509 incl r2
5510noname.522:
5511 addl2 r3,r3
5512 bicl2 #0,r3
5513 addl2 r3,r8
5514 bicl2 #0,r8
5515 cmpl r8,r3
5516 bgequ noname.523
5517 incl r2
5518 bicl3 #0,r2,r0
5519 bneq noname.523
5520 incl r9
5521noname.523:
5522 addl2 r2,r7
5523 bicl2 #0,r7
5524 cmpl r7,r2
5525 bgequ noname.524
5526 incl r9
5527noname.524:
5528
5529 movl 8(ap),r0
5530 bicl3 #-65536,28(r0),r3
5531 movzwl 30(r0),r1
5532 bicl2 #-65536,r1
5533 bicl3 #-65536,12(r0),r2
5534 movzwl 14(r0),r0
5535 bicl2 #-65536,r0
5536 movl r3,r5
5537 movl r1,r4
5538 mull3 r0,r5,-380(fp)
5539 mull2 r2,r5
5540 mull3 r2,r4,-384(fp)
5541 mull2 r0,r4
5542 addl3 -380(fp),-384(fp),r0
5543 bicl3 #0,r0,-380(fp)
5544 cmpl -380(fp),-384(fp)
5545 bgequ noname.525
5546 addl2 #65536,r4
5547noname.525:
5548 movzwl -378(fp),r0
5549 bicl2 #-65536,r0
5550 addl2 r0,r4
5551 bicl3 #-65536,-380(fp),r0
5552 ashl #16,r0,-384(fp)
5553 addl2 -384(fp),r5
5554 bicl2 #0,r5
5555 cmpl r5,-384(fp)
5556 bgequ noname.526
5557 incl r4
5558noname.526:
5559 movl r5,r3
5560 movl r4,r2
5561 bbc #31,r2,noname.527
5562 incl r9
5563noname.527:
5564 addl2 r2,r2
5565 bicl2 #0,r2
5566 bbc #31,r3,noname.528
5567 incl r2
5568noname.528:
5569 addl2 r3,r3
5570 bicl2 #0,r3
5571 addl2 r3,r8
5572 bicl2 #0,r8
5573 cmpl r8,r3
5574 bgequ noname.529
5575 incl r2
5576 bicl3 #0,r2,r0
5577 bneq noname.529
5578 incl r9
5579noname.529:
5580 addl2 r2,r7
5581 bicl2 #0,r7
5582 cmpl r7,r2
5583 bgequ noname.530
5584 incl r9
5585noname.530:
5586 movl 4(ap),r0
5587 movl r8,40(r0)
5588
5589 clrl r8
5590
5591 movl 8(ap),r0
5592 bicl3 #-65536,28(r0),r3
5593 movzwl 30(r0),r1
5594 bicl2 #-65536,r1
5595 bicl3 #-65536,16(r0),r2
5596 movzwl 18(r0),r0
5597 bicl2 #-65536,r0
5598 movl r3,r5
5599 movl r1,r4
5600 mull3 r0,r5,-388(fp)
5601 mull2 r2,r5
5602 mull3 r2,r4,-392(fp)
5603 mull2 r0,r4
5604 addl3 -388(fp),-392(fp),r0
5605 bicl3 #0,r0,-388(fp)
5606 cmpl -388(fp),-392(fp)
5607 bgequ noname.531
5608 addl2 #65536,r4
5609noname.531:
5610 movzwl -386(fp),r0
5611 bicl2 #-65536,r0
5612 addl2 r0,r4
5613 bicl3 #-65536,-388(fp),r0
5614 ashl #16,r0,-392(fp)
5615 addl2 -392(fp),r5
5616 bicl2 #0,r5
5617 cmpl r5,-392(fp)
5618 bgequ noname.532
5619 incl r4
5620noname.532:
5621 movl r5,r3
5622 movl r4,r2
5623 bbc #31,r2,noname.533
5624 incl r8
5625noname.533:
5626 addl2 r2,r2
5627 bicl2 #0,r2
5628 bbc #31,r3,noname.534
5629 incl r2
5630noname.534:
5631 addl2 r3,r3
5632 bicl2 #0,r3
5633 addl2 r3,r7
5634 bicl2 #0,r7
5635 cmpl r7,r3
5636 bgequ noname.535
5637 incl r2
5638 bicl3 #0,r2,r0
5639 bneq noname.535
5640 incl r8
5641noname.535:
5642 addl2 r2,r9
5643 bicl2 #0,r9
5644 cmpl r9,r2
5645 bgequ noname.536
5646 incl r8
5647noname.536:
5648
5649 movl 8(ap),r0
5650 bicl3 #-65536,24(r0),r3
5651 movzwl 26(r0),r1
5652 bicl2 #-65536,r1
5653 bicl3 #-65536,20(r0),r2
5654 movzwl 22(r0),r0
5655 bicl2 #-65536,r0
5656 movl r3,r5
5657 movl r1,r4
5658 mull3 r0,r5,-396(fp)
5659 mull2 r2,r5
5660 mull3 r2,r4,-400(fp)
5661 mull2 r0,r4
5662 addl3 -396(fp),-400(fp),r0
5663 bicl3 #0,r0,-396(fp)
5664 cmpl -396(fp),-400(fp)
5665 bgequ noname.537
5666 addl2 #65536,r4
5667noname.537:
5668 movzwl -394(fp),r0
5669 bicl2 #-65536,r0
5670 addl2 r0,r4
5671 bicl3 #-65536,-396(fp),r0
5672 ashl #16,r0,-400(fp)
5673 addl2 -400(fp),r5
5674 bicl2 #0,r5
5675 cmpl r5,-400(fp)
5676 bgequ noname.538
5677 incl r4
5678noname.538:
5679 movl r5,r3
5680 movl r4,r2
5681 bbc #31,r2,noname.539
5682 incl r8
5683noname.539:
5684 addl2 r2,r2
5685 bicl2 #0,r2
5686 bbc #31,r3,noname.540
5687 incl r2
5688noname.540:
5689 addl2 r3,r3
5690 bicl2 #0,r3
5691 addl2 r3,r7
5692 bicl2 #0,r7
5693 cmpl r7,r3
5694 bgequ noname.541
5695 incl r2
5696 bicl3 #0,r2,r0
5697 bneq noname.541
5698 incl r8
5699noname.541:
5700 addl2 r2,r9
5701 bicl2 #0,r9
5702 cmpl r9,r2
5703 bgequ noname.542
5704 incl r8
5705noname.542:
5706
5707 movl 4(ap),r0
5708 movl r7,44(r0)
5709
5710 clrl r7
5711
5712 movl 8(ap),r3
5713 movl 24(r3),r4
5714 bicl3 #-65536,r4,r5
5715 extzv #16,#16,r4,r0
5716 bicl3 #-65536,r0,r4
5717 mull3 r5,r4,-404(fp)
5718 mull2 r5,r5
5719 mull2 r4,r4
5720 bicl3 #32767,-404(fp),r0
5721 extzv #15,#17,r0,r0
5722 addl2 r0,r4
5723 bicl3 #-65536,-404(fp),r0
5724 ashl #17,r0,-404(fp)
5725 addl2 -404(fp),r5
5726 bicl2 #0,r5
5727 cmpl r5,-404(fp)
5728 bgequ noname.543
5729 incl r4
5730noname.543:
5731 movl r5,r1
5732 movl r4,r2
5733 addl2 r1,r9
5734 bicl2 #0,r9
5735 cmpl r9,r1
5736 bgequ noname.544
5737 incl r2
5738noname.544:
5739 addl2 r2,r8
5740 bicl2 #0,r8
5741 cmpl r8,r2
5742 bgequ noname.545
5743 incl r7
5744noname.545:
5745
5746 movzwl 30(r3),r2
5747 bicl3 #-65536,20(r3),r1
5748 movzwl 22(r3),r0
5749 bicl2 #-65536,r0
5750 bicl3 #-65536,28(r3),-416(fp)
5751 bicl3 #-65536,r2,-420(fp)
5752 mull3 r0,-416(fp),-408(fp)
5753 mull2 r1,-416(fp)
5754 mull3 r1,-420(fp),-412(fp)
5755 mull2 r0,-420(fp)
5756 addl3 -408(fp),-412(fp),r0
5757 bicl3 #0,r0,-408(fp)
5758 cmpl -408(fp),-412(fp)
5759 bgequ noname.546
5760 addl2 #65536,-420(fp)
5761noname.546:
5762 movzwl -406(fp),r0
5763 bicl2 #-65536,r0
5764 addl2 r0,-420(fp)
5765 bicl3 #-65536,-408(fp),r0
5766 ashl #16,r0,-412(fp)
5767 addl3 -412(fp),-416(fp),r0
5768 bicl3 #0,r0,-416(fp)
5769 cmpl -416(fp),-412(fp)
5770 bgequ noname.547
5771 incl -420(fp)
5772noname.547:
5773 movl -416(fp),r3
5774 movl -420(fp),r2
5775 bbc #31,r2,noname.548
5776 incl r7
5777noname.548:
5778 addl2 r2,r2
5779 bicl2 #0,r2
5780 bbc #31,r3,noname.549
5781 incl r2
5782noname.549:
5783 addl2 r3,r3
5784 bicl2 #0,r3
5785 addl2 r3,r9
5786 bicl2 #0,r9
5787 cmpl r9,r3
5788 bgequ noname.550
5789 incl r2
5790 bicl3 #0,r2,r0
5791 bneq noname.550
5792 incl r7
5793noname.550:
5794 addl2 r2,r8
5795 bicl2 #0,r8
5796 cmpl r8,r2
5797 bgequ noname.551
5798 incl r7
5799noname.551:
5800
5801 movl 4(ap),r0
5802 movl r9,48(r0)
5803
5804 clrl r9
5805
5806 movl 8(ap),r0
5807 movzwl 30(r0),r2
5808 bicl3 #-65536,24(r0),r3
5809 movzwl 26(r0),r1
5810 bicl2 #-65536,r1
5811 bicl3 #-65536,28(r0),-432(fp)
5812 bicl3 #-65536,r2,-436(fp)
5813 mull3 r1,-432(fp),-424(fp)
5814 mull2 r3,-432(fp)
5815 mull3 r3,-436(fp),-428(fp)
5816 mull2 r1,-436(fp)
5817 addl3 -424(fp),-428(fp),r0
5818 bicl3 #0,r0,-424(fp)
5819 cmpl -424(fp),-428(fp)
5820 bgequ noname.552
5821 addl2 #65536,-436(fp)
5822noname.552:
5823 movzwl -422(fp),r0
5824 bicl2 #-65536,r0
5825 addl2 r0,-436(fp)
5826 bicl3 #-65536,-424(fp),r0
5827 ashl #16,r0,-428(fp)
5828 addl3 -428(fp),-432(fp),r0
5829 bicl3 #0,r0,-432(fp)
5830 cmpl -432(fp),-428(fp)
5831 bgequ noname.553
5832 incl -436(fp)
5833noname.553:
5834 movl -432(fp),r3
5835 movl -436(fp),r2
5836 bbc #31,r2,noname.554
5837 incl r9
5838noname.554:
5839 addl2 r2,r2
5840 bicl2 #0,r2
5841 bbc #31,r3,noname.555
5842 incl r2
5843noname.555:
5844 addl2 r3,r3
5845 bicl2 #0,r3
5846 addl2 r3,r8
5847 bicl2 #0,r8
5848 cmpl r8,r3
5849 bgequ noname.556
5850 incl r2
5851 bicl3 #0,r2,r0
5852 bneq noname.556
5853 incl r9
5854noname.556:
5855 addl2 r2,r7
5856 bicl2 #0,r7
5857 cmpl r7,r2
5858 bgequ noname.557
5859 incl r9
5860noname.557:
5861
5862 movl 4(ap),r4
5863 movl r8,52(r4)
5864
5865 clrl r8
5866
5867 movl 8(ap),r0
5868 movl 28(r0),r3
5869 bicl3 #-65536,r3,-440(fp)
5870 extzv #16,#16,r3,r0
5871 bicl3 #-65536,r0,r3
5872 movl -440(fp),r0
5873 mull3 r0,r3,-444(fp)
5874 mull3 r0,r0,-440(fp)
5875 mull2 r3,r3
5876 bicl3 #32767,-444(fp),r0
5877 extzv #15,#17,r0,r0
5878 addl2 r0,r3
5879 bicl3 #-65536,-444(fp),r0
5880 ashl #17,r0,-444(fp)
5881 addl3 -440(fp),-444(fp),r0
5882 bicl3 #0,r0,-440(fp)
5883 cmpl -440(fp),-444(fp)
5884 bgequ noname.558
5885 incl r3
5886noname.558:
5887 movl -440(fp),r1
5888 movl r3,r2
5889 addl2 r1,r7
5890 bicl2 #0,r7
5891 cmpl r7,r1
5892 bgequ noname.559
5893 incl r2
5894noname.559:
5895 addl2 r2,r9
5896 bicl2 #0,r9
5897 cmpl r9,r2
5898 bgequ noname.560
5899 incl r8
5900noname.560:
5901
5902 movl r7,56(r4)
5903
5904 movl r9,60(r4)
5905
5906 ret
5907
5908
5909
5910;r=4 ;(AP)
5911;a=8 ;(AP)
5912;b=12 ;(AP)
5913;n=16 ;(AP) n by value (input)
5914
5915 .psect code,nowrt
5916
5917.entry BN_SQR_COMBA4,^m<r2,r3,r4,r5,r6,r7,r8,r9,r10>
5918 subl2 #44,sp
5919
5920 clrq r8
5921
5922 clrl r10
5923
5924 movl 8(ap),r5
5925 movl (r5),r3
5926 bicl3 #-65536,r3,r4
5927 extzv #16,#16,r3,r0
5928 bicl3 #-65536,r0,r3
5929 mull3 r4,r3,-4(fp)
5930 mull2 r4,r4
5931 mull2 r3,r3
5932 bicl3 #32767,-4(fp),r0
5933 extzv #15,#17,r0,r0
5934 addl2 r0,r3
5935 bicl3 #-65536,-4(fp),r0
5936 ashl #17,r0,-4(fp)
5937 addl2 -4(fp),r4
5938 bicl2 #0,r4
5939 cmpl r4,-4(fp)
5940 bgequ noname.563
5941 incl r3
5942noname.563:
5943 movl r4,r1
5944 movl r3,r2
5945 addl2 r1,r9
5946 bicl2 #0,r9
5947 cmpl r9,r1
5948 bgequ noname.564
5949 incl r2
5950noname.564:
5951 addl2 r2,r8
5952 bicl2 #0,r8
5953 cmpl r8,r2
5954 bgequ noname.565
5955 incl r10
5956noname.565:
5957
5958 movl r9,@4(ap)
5959
5960 clrl r9
5961
5962 bicl3 #-65536,4(r5),r3
5963 movzwl 6(r5),r1
5964 bicl2 #-65536,r1
5965 bicl3 #-65536,(r5),r2
5966 movzwl 2(r5),r0
5967 bicl2 #-65536,r0
5968 movl r3,r6
5969 movl r1,r4
5970 mull3 r0,r6,-8(fp)
5971 mull2 r2,r6
5972 mull2 r4,r2
5973 mull2 r0,r4
5974 addl3 -8(fp),r2,r0
5975 bicl3 #0,r0,-8(fp)
5976 cmpl -8(fp),r2
5977 bgequ noname.566
5978 addl2 #65536,r4
5979noname.566:
5980 movzwl -6(fp),r0
5981 bicl2 #-65536,r0
5982 addl2 r0,r4
5983 bicl3 #-65536,-8(fp),r0
5984 ashl #16,r0,r1
5985 addl2 r1,r6
5986 bicl2 #0,r6
5987 cmpl r6,r1
5988 bgequ noname.567
5989 incl r4
5990noname.567:
5991 movl r6,r3
5992 movl r4,r2
5993 bbc #31,r2,noname.568
5994 incl r9
5995noname.568:
5996 addl2 r2,r2
5997 bicl2 #0,r2
5998 bbc #31,r3,noname.569
5999 incl r2
6000noname.569:
6001 addl2 r3,r3
6002 bicl2 #0,r3
6003 addl2 r3,r8
6004 bicl2 #0,r8
6005 cmpl r8,r3
6006 bgequ noname.570
6007 incl r2
6008 bicl3 #0,r2,r0
6009 bneq noname.570
6010 incl r9
6011noname.570:
6012 addl2 r2,r10
6013 bicl2 #0,r10
6014 cmpl r10,r2
6015 bgequ noname.571
6016 incl r9
6017noname.571:
6018
6019 movl 4(ap),r0
6020 movl r8,4(r0)
6021
6022 clrl r8
6023
6024 movl 8(ap),r4
6025 movl 4(r4),r3
6026 bicl3 #-65536,r3,r5
6027 extzv #16,#16,r3,r0
6028 bicl3 #-65536,r0,r3
6029 mull3 r5,r3,r1
6030 mull2 r5,r5
6031 mull2 r3,r3
6032 bicl3 #32767,r1,r0
6033 extzv #15,#17,r0,r0
6034 addl2 r0,r3
6035 bicl2 #-65536,r1
6036 ashl #17,r1,r1
6037 addl2 r1,r5
6038 bicl2 #0,r5
6039 cmpl r5,r1
6040 bgequ noname.572
6041 incl r3
6042noname.572:
6043 movl r5,r1
6044 movl r3,r2
6045 addl2 r1,r10
6046 bicl2 #0,r10
6047 cmpl r10,r1
6048 bgequ noname.573
6049 incl r2
6050noname.573:
6051 addl2 r2,r9
6052 bicl2 #0,r9
6053 cmpl r9,r2
6054 bgequ noname.574
6055 incl r8
6056noname.574:
6057
6058 bicl3 #-65536,8(r4),r3
6059 movzwl 10(r4),r1
6060 bicl2 #-65536,r1
6061 bicl3 #-65536,(r4),r2
6062 movzwl 2(r4),r0
6063 bicl2 #-65536,r0
6064 movl r3,r6
6065 movl r1,r5
6066 mull3 r0,r6,r7
6067 mull2 r2,r6
6068 mull2 r5,r2
6069 mull2 r0,r5
6070 addl2 r2,r7
6071 bicl2 #0,r7
6072 cmpl r7,r2
6073 bgequ noname.575
6074 addl2 #65536,r5
6075noname.575:
6076 extzv #16,#16,r7,r0
6077 bicl2 #-65536,r0
6078 addl2 r0,r5
6079 bicl3 #-65536,r7,r0
6080 ashl #16,r0,r1
6081 addl2 r1,r6
6082 bicl2 #0,r6
6083 cmpl r6,r1
6084 bgequ noname.576
6085 incl r5
6086noname.576:
6087 movl r6,r3
6088 movl r5,r2
6089 bbc #31,r2,noname.577
6090 incl r8
6091noname.577:
6092 addl2 r2,r2
6093 bicl2 #0,r2
6094 bbc #31,r3,noname.578
6095 incl r2
6096noname.578:
6097 addl2 r3,r3
6098 bicl2 #0,r3
6099 addl2 r3,r10
6100 bicl2 #0,r10
6101 cmpl r10,r3
6102 bgequ noname.579
6103 incl r2
6104 bicl3 #0,r2,r0
6105 bneq noname.579
6106 incl r8
6107noname.579:
6108 addl2 r2,r9
6109 bicl2 #0,r9
6110 cmpl r9,r2
6111 bgequ noname.580
6112 incl r8
6113noname.580:
6114
6115 movl 4(ap),r0
6116 movl r10,8(r0)
6117
6118 clrl r10
6119
6120 movl 8(ap),r0
6121 bicl3 #-65536,12(r0),r3
6122 movzwl 14(r0),r1
6123 bicl2 #-65536,r1
6124 bicl3 #-65536,(r0),r2
6125 movzwl 2(r0),r0
6126 bicl2 #-65536,r0
6127 movl r3,r5
6128 movl r1,r4
6129 mull3 r0,r5,r6
6130 mull2 r2,r5
6131 mull3 r2,r4,-12(fp)
6132 mull2 r0,r4
6133 addl2 -12(fp),r6
6134 bicl2 #0,r6
6135 cmpl r6,-12(fp)
6136 bgequ noname.581
6137 addl2 #65536,r4
6138noname.581:
6139 extzv #16,#16,r6,r0
6140 bicl2 #-65536,r0
6141 addl2 r0,r4
6142 bicl3 #-65536,r6,r0
6143 ashl #16,r0,-12(fp)
6144 addl2 -12(fp),r5
6145 bicl2 #0,r5
6146 cmpl r5,-12(fp)
6147 bgequ noname.582
6148 incl r4
6149noname.582:
6150 movl r5,r3
6151 movl r4,r2
6152 bbc #31,r2,noname.583
6153 incl r10
6154noname.583:
6155 addl2 r2,r2
6156 bicl2 #0,r2
6157 bbc #31,r3,noname.584
6158 incl r2
6159noname.584:
6160 addl2 r3,r3
6161 bicl2 #0,r3
6162 addl2 r3,r9
6163 bicl2 #0,r9
6164 cmpl r9,r3
6165 bgequ noname.585
6166 incl r2
6167 bicl3 #0,r2,r0
6168 bneq noname.585
6169 incl r10
6170noname.585:
6171 addl2 r2,r8
6172 bicl2 #0,r8
6173 cmpl r8,r2
6174 bgequ noname.586
6175 incl r10
6176noname.586:
6177
6178 movl 8(ap),r0
6179 bicl3 #-65536,8(r0),r3
6180 movzwl 10(r0),r1
6181 bicl2 #-65536,r1
6182 bicl3 #-65536,4(r0),r2
6183 movzwl 6(r0),r0
6184 bicl2 #-65536,r0
6185 movl r3,r5
6186 movl r1,r4
6187 mull3 r0,r5,-16(fp)
6188 mull2 r2,r5
6189 mull3 r2,r4,-20(fp)
6190 mull2 r0,r4
6191 addl3 -16(fp),-20(fp),r0
6192 bicl3 #0,r0,-16(fp)
6193 cmpl -16(fp),-20(fp)
6194 bgequ noname.587
6195 addl2 #65536,r4
6196noname.587:
6197 movzwl -14(fp),r0
6198 bicl2 #-65536,r0
6199 addl2 r0,r4
6200 bicl3 #-65536,-16(fp),r0
6201 ashl #16,r0,-20(fp)
6202 addl2 -20(fp),r5
6203 bicl2 #0,r5
6204 cmpl r5,-20(fp)
6205 bgequ noname.588
6206 incl r4
6207noname.588:
6208 movl r5,r3
6209 movl r4,r2
6210 bbc #31,r2,noname.589
6211 incl r10
6212noname.589:
6213 addl2 r2,r2
6214 bicl2 #0,r2
6215 bbc #31,r3,noname.590
6216 incl r2
6217noname.590:
6218 addl2 r3,r3
6219 bicl2 #0,r3
6220 addl2 r3,r9
6221 bicl2 #0,r9
6222 cmpl r9,r3
6223 bgequ noname.591
6224 incl r2
6225 bicl3 #0,r2,r0
6226 bneq noname.591
6227 incl r10
6228noname.591:
6229 addl2 r2,r8
6230 bicl2 #0,r8
6231 cmpl r8,r2
6232 bgequ noname.592
6233 incl r10
6234noname.592:
6235 movl 4(ap),r0
6236 movl r9,12(r0)
6237
6238 clrl r9
6239
6240 movl 8(ap),r3
6241 movl 8(r3),r4
6242 bicl3 #-65536,r4,r5
6243 extzv #16,#16,r4,r0
6244 bicl3 #-65536,r0,r4
6245 mull3 r5,r4,-24(fp)
6246 mull2 r5,r5
6247 mull2 r4,r4
6248 bicl3 #32767,-24(fp),r0
6249 extzv #15,#17,r0,r0
6250 addl2 r0,r4
6251 bicl3 #-65536,-24(fp),r0
6252 ashl #17,r0,-24(fp)
6253 addl2 -24(fp),r5
6254 bicl2 #0,r5
6255 cmpl r5,-24(fp)
6256 bgequ noname.593
6257 incl r4
6258noname.593:
6259 movl r5,r1
6260 movl r4,r2
6261 addl2 r1,r8
6262 bicl2 #0,r8
6263 cmpl r8,r1
6264 bgequ noname.594
6265 incl r2
6266noname.594:
6267 addl2 r2,r10
6268 bicl2 #0,r10
6269 cmpl r10,r2
6270 bgequ noname.595
6271 incl r9
6272noname.595:
6273
6274 bicl3 #-65536,12(r3),r4
6275 movzwl 14(r3),r1
6276 bicl2 #-65536,r1
6277 bicl3 #-65536,4(r3),r2
6278 movzwl 6(r3),r0
6279 bicl2 #-65536,r0
6280 movl r4,r6
6281 movl r1,r5
6282 mull3 r0,r6,-28(fp)
6283 mull2 r2,r6
6284 mull3 r2,r5,-32(fp)
6285 mull2 r0,r5
6286 addl3 -28(fp),-32(fp),r0
6287 bicl3 #0,r0,-28(fp)
6288 cmpl -28(fp),-32(fp)
6289 bgequ noname.596
6290 addl2 #65536,r5
6291noname.596:
6292 movzwl -26(fp),r0
6293 bicl2 #-65536,r0
6294 addl2 r0,r5
6295 bicl3 #-65536,-28(fp),r0
6296 ashl #16,r0,-32(fp)
6297 addl2 -32(fp),r6
6298 bicl2 #0,r6
6299 cmpl r6,-32(fp)
6300 bgequ noname.597
6301 incl r5
6302noname.597:
6303 movl r6,r3
6304 movl r5,r2
6305 bbc #31,r2,noname.598
6306 incl r9
6307noname.598:
6308 addl2 r2,r2
6309 bicl2 #0,r2
6310 bbc #31,r3,noname.599
6311 incl r2
6312noname.599:
6313 addl2 r3,r3
6314 bicl2 #0,r3
6315 addl2 r3,r8
6316 bicl2 #0,r8
6317 cmpl r8,r3
6318 bgequ noname.600
6319 incl r2
6320 bicl3 #0,r2,r0
6321 bneq noname.600
6322 incl r9
6323noname.600:
6324 addl2 r2,r10
6325 bicl2 #0,r10
6326 cmpl r10,r2
6327 bgequ noname.601
6328 incl r9
6329noname.601:
6330
6331 movl 4(ap),r0
6332 movl r8,16(r0)
6333
6334 clrl r8
6335
6336 movl 8(ap),r0
6337 bicl3 #-65536,12(r0),r3
6338 movzwl 14(r0),r1
6339 bicl2 #-65536,r1
6340 bicl3 #-65536,8(r0),r2
6341 movzwl 10(r0),r0
6342 bicl2 #-65536,r0
6343 movl r3,r5
6344 movl r1,r4
6345 mull3 r0,r5,-36(fp)
6346 mull2 r2,r5
6347 mull3 r2,r4,-40(fp)
6348 mull2 r0,r4
6349 addl3 -36(fp),-40(fp),r0
6350 bicl3 #0,r0,-36(fp)
6351 cmpl -36(fp),-40(fp)
6352 bgequ noname.602
6353 addl2 #65536,r4
6354noname.602:
6355 movzwl -34(fp),r0
6356 bicl2 #-65536,r0
6357 addl2 r0,r4
6358 bicl3 #-65536,-36(fp),r0
6359 ashl #16,r0,-40(fp)
6360 addl2 -40(fp),r5
6361 bicl2 #0,r5
6362 cmpl r5,-40(fp)
6363 bgequ noname.603
6364 incl r4
6365noname.603:
6366 movl r5,r3
6367 movl r4,r2
6368 bbc #31,r2,noname.604
6369 incl r8
6370noname.604:
6371 addl2 r2,r2
6372 bicl2 #0,r2
6373 bbc #31,r3,noname.605
6374 incl r2
6375noname.605:
6376 addl2 r3,r3
6377 bicl2 #0,r3
6378 addl2 r3,r10
6379 bicl2 #0,r10
6380 cmpl r10,r3
6381 bgequ noname.606
6382 incl r2
6383 bicl3 #0,r2,r0
6384 bneq noname.606
6385 incl r8
6386noname.606:
6387 addl2 r2,r9
6388 bicl2 #0,r9
6389 cmpl r9,r2
6390 bgequ noname.607
6391 incl r8
6392noname.607:
6393
6394 movl 4(ap),r4
6395 movl r10,20(r4)
6396
6397 clrl r10
6398
6399 movl 8(ap),r0
6400 movl 12(r0),r3
6401 bicl3 #-65536,r3,r5
6402 extzv #16,#16,r3,r0
6403 bicl3 #-65536,r0,r3
6404 mull3 r5,r3,-44(fp)
6405 mull2 r5,r5
6406 mull2 r3,r3
6407 bicl3 #32767,-44(fp),r0
6408 extzv #15,#17,r0,r0
6409 addl2 r0,r3
6410 bicl3 #-65536,-44(fp),r0
6411 ashl #17,r0,-44(fp)
6412 addl2 -44(fp),r5
6413 bicl2 #0,r5
6414 cmpl r5,-44(fp)
6415 bgequ noname.608
6416 incl r3
6417noname.608:
6418 movl r5,r1
6419 movl r3,r2
6420 addl2 r1,r9
6421 bicl2 #0,r9
6422 cmpl r9,r1
6423 bgequ noname.609
6424 incl r2
6425noname.609:
6426 addl2 r2,r8
6427 bicl2 #0,r8
6428 cmpl r8,r2
6429 bgequ noname.610
6430 incl r10
6431noname.610:
6432
6433 movl r9,24(r4)
6434
6435 movl r8,28(r4)
6436
6437 ret
6438
6439; For now, the code below doesn't work, so I end this prematurely.
6440.end
diff --git a/src/lib/libcrypto/bn/asm/x86/f b/src/lib/libcrypto/bn/asm/x86/f
new file mode 100644
index 0000000000..22e4112224
--- /dev/null
+++ b/src/lib/libcrypto/bn/asm/x86/f
@@ -0,0 +1,3 @@
1#!/usr/local/bin/perl
2# x86 assember
3
diff --git a/src/lib/libcrypto/bn/bn.h b/src/lib/libcrypto/bn/bn.h
index 21a1a3fe35..f34248ec4f 100644
--- a/src/lib/libcrypto/bn/bn.h
+++ b/src/lib/libcrypto/bn/bn.h
@@ -538,8 +538,6 @@ BIGNUM *BN_mod_inverse(BIGNUM *ret,
538BIGNUM *BN_mod_sqrt(BIGNUM *ret, 538BIGNUM *BN_mod_sqrt(BIGNUM *ret,
539 const BIGNUM *a, const BIGNUM *n,BN_CTX *ctx); 539 const BIGNUM *a, const BIGNUM *n,BN_CTX *ctx);
540 540
541void BN_consttime_swap(BN_ULONG swap, BIGNUM *a, BIGNUM *b, int nwords);
542
543/* Deprecated versions */ 541/* Deprecated versions */
544#ifndef OPENSSL_NO_DEPRECATED 542#ifndef OPENSSL_NO_DEPRECATED
545BIGNUM *BN_generate_prime(BIGNUM *ret,int bits,int safe, 543BIGNUM *BN_generate_prime(BIGNUM *ret,int bits,int safe,
@@ -776,20 +774,11 @@ int RAND_pseudo_bytes(unsigned char *buf,int num);
776 774
777#define bn_fix_top(a) bn_check_top(a) 775#define bn_fix_top(a) bn_check_top(a)
778 776
779#define bn_check_size(bn, bits) bn_wcheck_size(bn, ((bits+BN_BITS2-1))/BN_BITS2)
780#define bn_wcheck_size(bn, words) \
781 do { \
782 const BIGNUM *_bnum2 = (bn); \
783 assert(words <= (_bnum2)->dmax && words >= (_bnum2)->top); \
784 } while(0)
785
786#else /* !BN_DEBUG */ 777#else /* !BN_DEBUG */
787 778
788#define bn_pollute(a) 779#define bn_pollute(a)
789#define bn_check_top(a) 780#define bn_check_top(a)
790#define bn_fix_top(a) bn_correct_top(a) 781#define bn_fix_top(a) bn_correct_top(a)
791#define bn_check_size(bn, bits)
792#define bn_wcheck_size(bn, words)
793 782
794#endif 783#endif
795 784
diff --git a/src/lib/libcrypto/bn/bn.mul b/src/lib/libcrypto/bn/bn.mul
new file mode 100644
index 0000000000..9728870d38
--- /dev/null
+++ b/src/lib/libcrypto/bn/bn.mul
@@ -0,0 +1,19 @@
1We need
2
3* bn_mul_comba8
4* bn_mul_comba4
5* bn_mul_normal
6* bn_mul_recursive
7
8* bn_sqr_comba8
9* bn_sqr_comba4
10bn_sqr_normal -> BN_sqr
11* bn_sqr_recursive
12
13* bn_mul_low_recursive
14* bn_mul_low_normal
15* bn_mul_high
16
17* bn_mul_part_recursive # symetric but not power of 2
18
19bn_mul_asymetric_recursive # uneven, but do the chop up.
diff --git a/src/lib/libcrypto/bn/bn_div.c b/src/lib/libcrypto/bn/bn_div.c
index 7b2403185e..52b3304293 100644
--- a/src/lib/libcrypto/bn/bn_div.c
+++ b/src/lib/libcrypto/bn/bn_div.c
@@ -141,7 +141,6 @@ int BN_div(BIGNUM *dv, BIGNUM *rem, const BIGNUM *m, const BIGNUM *d,
141 * 141 *
142 * <appro@fy.chalmers.se> 142 * <appro@fy.chalmers.se>
143 */ 143 */
144#undef bn_div_words
145# define bn_div_words(n0,n1,d0) \ 144# define bn_div_words(n0,n1,d0) \
146 ({ asm volatile ( \ 145 ({ asm volatile ( \
147 "divl %4" \ 146 "divl %4" \
@@ -156,7 +155,6 @@ int BN_div(BIGNUM *dv, BIGNUM *rem, const BIGNUM *m, const BIGNUM *d,
156 * Same story here, but it's 128-bit by 64-bit division. Wow! 155 * Same story here, but it's 128-bit by 64-bit division. Wow!
157 * <appro@fy.chalmers.se> 156 * <appro@fy.chalmers.se>
158 */ 157 */
159# undef bn_div_words
160# define bn_div_words(n0,n1,d0) \ 158# define bn_div_words(n0,n1,d0) \
161 ({ asm volatile ( \ 159 ({ asm volatile ( \
162 "divq %4" \ 160 "divq %4" \
diff --git a/src/lib/libcrypto/bn/bn_gcd.c b/src/lib/libcrypto/bn/bn_gcd.c
index a808f53178..4a352119ba 100644
--- a/src/lib/libcrypto/bn/bn_gcd.c
+++ b/src/lib/libcrypto/bn/bn_gcd.c
@@ -205,7 +205,6 @@ err:
205/* solves ax == 1 (mod n) */ 205/* solves ax == 1 (mod n) */
206static BIGNUM *BN_mod_inverse_no_branch(BIGNUM *in, 206static BIGNUM *BN_mod_inverse_no_branch(BIGNUM *in,
207 const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx); 207 const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx);
208
209BIGNUM *BN_mod_inverse(BIGNUM *in, 208BIGNUM *BN_mod_inverse(BIGNUM *in,
210 const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx) 209 const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx)
211 { 210 {
diff --git a/src/lib/libcrypto/bn/bn_lcl.h b/src/lib/libcrypto/bn/bn_lcl.h
index 817c773b65..eecfd8cc99 100644
--- a/src/lib/libcrypto/bn/bn_lcl.h
+++ b/src/lib/libcrypto/bn/bn_lcl.h
@@ -282,23 +282,16 @@ extern "C" {
282# endif 282# endif
283# elif defined(__mips) && (defined(SIXTY_FOUR_BIT) || defined(SIXTY_FOUR_BIT_LONG)) 283# elif defined(__mips) && (defined(SIXTY_FOUR_BIT) || defined(SIXTY_FOUR_BIT_LONG))
284# if defined(__GNUC__) && __GNUC__>=2 284# if defined(__GNUC__) && __GNUC__>=2
285# if __GNUC__>=4 && __GNUC_MINOR__>=4 /* "h" constraint is no more since 4.4 */ 285# define BN_UMULT_HIGH(a,b) ({ \
286# define BN_UMULT_HIGH(a,b) (((__uint128_t)(a)*(b))>>64)
287# define BN_UMULT_LOHI(low,high,a,b) ({ \
288 __uint128_t ret=(__uint128_t)(a)*(b); \
289 (high)=ret>>64; (low)=ret; })
290# else
291# define BN_UMULT_HIGH(a,b) ({ \
292 register BN_ULONG ret; \ 286 register BN_ULONG ret; \
293 asm ("dmultu %1,%2" \ 287 asm ("dmultu %1,%2" \
294 : "=h"(ret) \ 288 : "=h"(ret) \
295 : "r"(a), "r"(b) : "l"); \ 289 : "r"(a), "r"(b) : "l"); \
296 ret; }) 290 ret; })
297# define BN_UMULT_LOHI(low,high,a,b)\ 291# define BN_UMULT_LOHI(low,high,a,b) \
298 asm ("dmultu %2,%3" \ 292 asm ("dmultu %2,%3" \
299 : "=l"(low),"=h"(high) \ 293 : "=l"(low),"=h"(high) \
300 : "r"(a), "r"(b)); 294 : "r"(a), "r"(b));
301# endif
302# endif 295# endif
303# endif /* cpu */ 296# endif /* cpu */
304#endif /* OPENSSL_NO_ASM */ 297#endif /* OPENSSL_NO_ASM */
diff --git a/src/lib/libcrypto/bn/bn_lib.c b/src/lib/libcrypto/bn/bn_lib.c
index 5461e6ee7d..7a5676de69 100644
--- a/src/lib/libcrypto/bn/bn_lib.c
+++ b/src/lib/libcrypto/bn/bn_lib.c
@@ -824,55 +824,3 @@ int bn_cmp_part_words(const BN_ULONG *a, const BN_ULONG *b,
824 } 824 }
825 return bn_cmp_words(a,b,cl); 825 return bn_cmp_words(a,b,cl);
826 } 826 }
827
828/*
829 * Constant-time conditional swap of a and b.
830 * a and b are swapped if condition is not 0. The code assumes that at most one bit of condition is set.
831 * nwords is the number of words to swap. The code assumes that at least nwords are allocated in both a and b,
832 * and that no more than nwords are used by either a or b.
833 * a and b cannot be the same number
834 */
835void BN_consttime_swap(BN_ULONG condition, BIGNUM *a, BIGNUM *b, int nwords)
836 {
837 BN_ULONG t;
838 int i;
839
840 bn_wcheck_size(a, nwords);
841 bn_wcheck_size(b, nwords);
842
843 assert(a != b);
844 assert((condition & (condition - 1)) == 0);
845 assert(sizeof(BN_ULONG) >= sizeof(int));
846
847 condition = ((condition - 1) >> (BN_BITS2 - 1)) - 1;
848
849 t = (a->top^b->top) & condition;
850 a->top ^= t;
851 b->top ^= t;
852
853#define BN_CONSTTIME_SWAP(ind) \
854 do { \
855 t = (a->d[ind] ^ b->d[ind]) & condition; \
856 a->d[ind] ^= t; \
857 b->d[ind] ^= t; \
858 } while (0)
859
860
861 switch (nwords) {
862 default:
863 for (i = 10; i < nwords; i++)
864 BN_CONSTTIME_SWAP(i);
865 /* Fallthrough */
866 case 10: BN_CONSTTIME_SWAP(9); /* Fallthrough */
867 case 9: BN_CONSTTIME_SWAP(8); /* Fallthrough */
868 case 8: BN_CONSTTIME_SWAP(7); /* Fallthrough */
869 case 7: BN_CONSTTIME_SWAP(6); /* Fallthrough */
870 case 6: BN_CONSTTIME_SWAP(5); /* Fallthrough */
871 case 5: BN_CONSTTIME_SWAP(4); /* Fallthrough */
872 case 4: BN_CONSTTIME_SWAP(3); /* Fallthrough */
873 case 3: BN_CONSTTIME_SWAP(2); /* Fallthrough */
874 case 2: BN_CONSTTIME_SWAP(1); /* Fallthrough */
875 case 1: BN_CONSTTIME_SWAP(0);
876 }
877#undef BN_CONSTTIME_SWAP
878}
diff --git a/src/lib/libcrypto/bn/bn_nist.c b/src/lib/libcrypto/bn/bn_nist.c
index e22968d4a3..43caee4770 100644
--- a/src/lib/libcrypto/bn/bn_nist.c
+++ b/src/lib/libcrypto/bn/bn_nist.c
@@ -286,25 +286,26 @@ const BIGNUM *BN_get0_nist_prime_521(void)
286 } 286 }
287 287
288 288
289static void nist_cp_bn_0(BN_ULONG *dst, const BN_ULONG *src, int top, int max) 289static void nist_cp_bn_0(BN_ULONG *buf, BN_ULONG *a, int top, int max)
290 { 290 {
291 int i; 291 int i;
292 BN_ULONG *_tmp1 = (buf), *_tmp2 = (a);
292 293
293#ifdef BN_DEBUG 294#ifdef BN_DEBUG
294 OPENSSL_assert(top <= max); 295 OPENSSL_assert(top <= max);
295#endif 296#endif
296 for (i = 0; i < top; i++) 297 for (i = (top); i != 0; i--)
297 dst[i] = src[i]; 298 *_tmp1++ = *_tmp2++;
298 for (; i < max; i++) 299 for (i = (max) - (top); i != 0; i--)
299 dst[i] = 0; 300 *_tmp1++ = (BN_ULONG) 0;
300 } 301 }
301 302
302static void nist_cp_bn(BN_ULONG *dst, const BN_ULONG *src, int top) 303static void nist_cp_bn(BN_ULONG *buf, BN_ULONG *a, int top)
303 { 304 {
304 int i; 305 int i;
305 306 BN_ULONG *_tmp1 = (buf), *_tmp2 = (a);
306 for (i = 0; i < top; i++) 307 for (i = (top); i != 0; i--)
307 dst[i] = src[i]; 308 *_tmp1++ = *_tmp2++;
308 } 309 }
309 310
310#if BN_BITS2 == 64 311#if BN_BITS2 == 64
@@ -450,9 +451,8 @@ int BN_nist_mod_192(BIGNUM *r, const BIGNUM *a, const BIGNUM *field,
450 */ 451 */
451 mask = 0-(PTR_SIZE_INT)bn_sub_words(c_d,r_d,_nist_p_192[0],BN_NIST_192_TOP); 452 mask = 0-(PTR_SIZE_INT)bn_sub_words(c_d,r_d,_nist_p_192[0],BN_NIST_192_TOP);
452 mask &= 0-(PTR_SIZE_INT)carry; 453 mask &= 0-(PTR_SIZE_INT)carry;
453 res = c_d;
454 res = (BN_ULONG *) 454 res = (BN_ULONG *)
455 (((PTR_SIZE_INT)res&~mask) | ((PTR_SIZE_INT)r_d&mask)); 455 (((PTR_SIZE_INT)c_d&~mask) | ((PTR_SIZE_INT)r_d&mask));
456 nist_cp_bn(r_d, res, BN_NIST_192_TOP); 456 nist_cp_bn(r_d, res, BN_NIST_192_TOP);
457 r->top = BN_NIST_192_TOP; 457 r->top = BN_NIST_192_TOP;
458 bn_correct_top(r); 458 bn_correct_top(r);
@@ -479,11 +479,8 @@ int BN_nist_mod_224(BIGNUM *r, const BIGNUM *a, const BIGNUM *field,
479 int top = a->top, i; 479 int top = a->top, i;
480 int carry; 480 int carry;
481 BN_ULONG *r_d, *a_d = a->d; 481 BN_ULONG *r_d, *a_d = a->d;
482 union { 482 BN_ULONG buf[BN_NIST_224_TOP],
483 BN_ULONG bn[BN_NIST_224_TOP]; 483 c_d[BN_NIST_224_TOP],
484 unsigned int ui[BN_NIST_224_TOP*sizeof(BN_ULONG)/sizeof(unsigned int)];
485 } buf;
486 BN_ULONG c_d[BN_NIST_224_TOP],
487 *res; 484 *res;
488 PTR_SIZE_INT mask; 485 PTR_SIZE_INT mask;
489 union { bn_addsub_f f; PTR_SIZE_INT p; } u; 486 union { bn_addsub_f f; PTR_SIZE_INT p; } u;
@@ -522,18 +519,18 @@ int BN_nist_mod_224(BIGNUM *r, const BIGNUM *a, const BIGNUM *field,
522 /* copy upper 256 bits of 448 bit number ... */ 519 /* copy upper 256 bits of 448 bit number ... */
523 nist_cp_bn_0(c_d, a_d + (BN_NIST_224_TOP-1), top - (BN_NIST_224_TOP-1), BN_NIST_224_TOP); 520 nist_cp_bn_0(c_d, a_d + (BN_NIST_224_TOP-1), top - (BN_NIST_224_TOP-1), BN_NIST_224_TOP);
524 /* ... and right shift by 32 to obtain upper 224 bits */ 521 /* ... and right shift by 32 to obtain upper 224 bits */
525 nist_set_224(buf.bn, c_d, 14, 13, 12, 11, 10, 9, 8); 522 nist_set_224(buf, c_d, 14, 13, 12, 11, 10, 9, 8);
526 /* truncate lower part to 224 bits too */ 523 /* truncate lower part to 224 bits too */
527 r_d[BN_NIST_224_TOP-1] &= BN_MASK2l; 524 r_d[BN_NIST_224_TOP-1] &= BN_MASK2l;
528#else 525#else
529 nist_cp_bn_0(buf.bn, a_d + BN_NIST_224_TOP, top - BN_NIST_224_TOP, BN_NIST_224_TOP); 526 nist_cp_bn_0(buf, a_d + BN_NIST_224_TOP, top - BN_NIST_224_TOP, BN_NIST_224_TOP);
530#endif 527#endif
531 528
532#if defined(NIST_INT64) && BN_BITS2!=64 529#if defined(NIST_INT64) && BN_BITS2!=64
533 { 530 {
534 NIST_INT64 acc; /* accumulator */ 531 NIST_INT64 acc; /* accumulator */
535 unsigned int *rp=(unsigned int *)r_d; 532 unsigned int *rp=(unsigned int *)r_d;
536 const unsigned int *bp=(const unsigned int *)buf.ui; 533 const unsigned int *bp=(const unsigned int *)buf;
537 534
538 acc = rp[0]; acc -= bp[7-7]; 535 acc = rp[0]; acc -= bp[7-7];
539 acc -= bp[11-7]; rp[0] = (unsigned int)acc; acc >>= 32; 536 acc -= bp[11-7]; rp[0] = (unsigned int)acc; acc >>= 32;
@@ -568,13 +565,13 @@ int BN_nist_mod_224(BIGNUM *r, const BIGNUM *a, const BIGNUM *field,
568 { 565 {
569 BN_ULONG t_d[BN_NIST_224_TOP]; 566 BN_ULONG t_d[BN_NIST_224_TOP];
570 567
571 nist_set_224(t_d, buf.bn, 10, 9, 8, 7, 0, 0, 0); 568 nist_set_224(t_d, buf, 10, 9, 8, 7, 0, 0, 0);
572 carry = (int)bn_add_words(r_d, r_d, t_d, BN_NIST_224_TOP); 569 carry = (int)bn_add_words(r_d, r_d, t_d, BN_NIST_224_TOP);
573 nist_set_224(t_d, buf.bn, 0, 13, 12, 11, 0, 0, 0); 570 nist_set_224(t_d, buf, 0, 13, 12, 11, 0, 0, 0);
574 carry += (int)bn_add_words(r_d, r_d, t_d, BN_NIST_224_TOP); 571 carry += (int)bn_add_words(r_d, r_d, t_d, BN_NIST_224_TOP);
575 nist_set_224(t_d, buf.bn, 13, 12, 11, 10, 9, 8, 7); 572 nist_set_224(t_d, buf, 13, 12, 11, 10, 9, 8, 7);
576 carry -= (int)bn_sub_words(r_d, r_d, t_d, BN_NIST_224_TOP); 573 carry -= (int)bn_sub_words(r_d, r_d, t_d, BN_NIST_224_TOP);
577 nist_set_224(t_d, buf.bn, 0, 0, 0, 0, 13, 12, 11); 574 nist_set_224(t_d, buf, 0, 0, 0, 0, 13, 12, 11);
578 carry -= (int)bn_sub_words(r_d, r_d, t_d, BN_NIST_224_TOP); 575 carry -= (int)bn_sub_words(r_d, r_d, t_d, BN_NIST_224_TOP);
579 576
580#if BN_BITS2==64 577#if BN_BITS2==64
@@ -609,8 +606,7 @@ int BN_nist_mod_224(BIGNUM *r, const BIGNUM *a, const BIGNUM *field,
609 /* otherwise it's effectively same as in BN_nist_mod_192... */ 606 /* otherwise it's effectively same as in BN_nist_mod_192... */
610 mask = 0-(PTR_SIZE_INT)(*u.f)(c_d,r_d,_nist_p_224[0],BN_NIST_224_TOP); 607 mask = 0-(PTR_SIZE_INT)(*u.f)(c_d,r_d,_nist_p_224[0],BN_NIST_224_TOP);
611 mask &= 0-(PTR_SIZE_INT)carry; 608 mask &= 0-(PTR_SIZE_INT)carry;
612 res = c_d; 609 res = (BN_ULONG *)(((PTR_SIZE_INT)c_d&~mask) |
613 res = (BN_ULONG *)(((PTR_SIZE_INT)res&~mask) |
614 ((PTR_SIZE_INT)r_d&mask)); 610 ((PTR_SIZE_INT)r_d&mask));
615 nist_cp_bn(r_d, res, BN_NIST_224_TOP); 611 nist_cp_bn(r_d, res, BN_NIST_224_TOP);
616 r->top = BN_NIST_224_TOP; 612 r->top = BN_NIST_224_TOP;
@@ -809,8 +805,7 @@ int BN_nist_mod_256(BIGNUM *r, const BIGNUM *a, const BIGNUM *field,
809 805
810 mask = 0-(PTR_SIZE_INT)(*u.f)(c_d,r_d,_nist_p_256[0],BN_NIST_256_TOP); 806 mask = 0-(PTR_SIZE_INT)(*u.f)(c_d,r_d,_nist_p_256[0],BN_NIST_256_TOP);
811 mask &= 0-(PTR_SIZE_INT)carry; 807 mask &= 0-(PTR_SIZE_INT)carry;
812 res = c_d; 808 res = (BN_ULONG *)(((PTR_SIZE_INT)c_d&~mask) |
813 res = (BN_ULONG *)(((PTR_SIZE_INT)res&~mask) |
814 ((PTR_SIZE_INT)r_d&mask)); 809 ((PTR_SIZE_INT)r_d&mask));
815 nist_cp_bn(r_d, res, BN_NIST_256_TOP); 810 nist_cp_bn(r_d, res, BN_NIST_256_TOP);
816 r->top = BN_NIST_256_TOP; 811 r->top = BN_NIST_256_TOP;
@@ -1031,8 +1026,7 @@ int BN_nist_mod_384(BIGNUM *r, const BIGNUM *a, const BIGNUM *field,
1031 1026
1032 mask = 0-(PTR_SIZE_INT)(*u.f)(c_d,r_d,_nist_p_384[0],BN_NIST_384_TOP); 1027 mask = 0-(PTR_SIZE_INT)(*u.f)(c_d,r_d,_nist_p_384[0],BN_NIST_384_TOP);
1033 mask &= 0-(PTR_SIZE_INT)carry; 1028 mask &= 0-(PTR_SIZE_INT)carry;
1034 res = c_d; 1029 res = (BN_ULONG *)(((PTR_SIZE_INT)c_d&~mask) |
1035 res = (BN_ULONG *)(((PTR_SIZE_INT)res&~mask) |
1036 ((PTR_SIZE_INT)r_d&mask)); 1030 ((PTR_SIZE_INT)r_d&mask));
1037 nist_cp_bn(r_d, res, BN_NIST_384_TOP); 1031 nist_cp_bn(r_d, res, BN_NIST_384_TOP);
1038 r->top = BN_NIST_384_TOP; 1032 r->top = BN_NIST_384_TOP;
@@ -1098,8 +1092,7 @@ int BN_nist_mod_521(BIGNUM *r, const BIGNUM *a, const BIGNUM *field,
1098 1092
1099 bn_add_words(r_d,r_d,t_d,BN_NIST_521_TOP); 1093 bn_add_words(r_d,r_d,t_d,BN_NIST_521_TOP);
1100 mask = 0-(PTR_SIZE_INT)bn_sub_words(t_d,r_d,_nist_p_521,BN_NIST_521_TOP); 1094 mask = 0-(PTR_SIZE_INT)bn_sub_words(t_d,r_d,_nist_p_521,BN_NIST_521_TOP);
1101 res = t_d; 1095 res = (BN_ULONG *)(((PTR_SIZE_INT)t_d&~mask) |
1102 res = (BN_ULONG *)(((PTR_SIZE_INT)res&~mask) |
1103 ((PTR_SIZE_INT)r_d&mask)); 1096 ((PTR_SIZE_INT)r_d&mask));
1104 nist_cp_bn(r_d,res,BN_NIST_521_TOP); 1097 nist_cp_bn(r_d,res,BN_NIST_521_TOP);
1105 r->top = BN_NIST_521_TOP; 1098 r->top = BN_NIST_521_TOP;
diff --git a/src/lib/libcrypto/bn/bnspeed.c b/src/lib/libcrypto/bn/bnspeed.c
new file mode 100644
index 0000000000..b554ac8cf8
--- /dev/null
+++ b/src/lib/libcrypto/bn/bnspeed.c
@@ -0,0 +1,233 @@
1/* unused */
2
3/* crypto/bn/bnspeed.c */
4/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
5 * All rights reserved.
6 *
7 * This package is an SSL implementation written
8 * by Eric Young (eay@cryptsoft.com).
9 * The implementation was written so as to conform with Netscapes SSL.
10 *
11 * This library is free for commercial and non-commercial use as long as
12 * the following conditions are aheared to. The following conditions
13 * apply to all code found in this distribution, be it the RC4, RSA,
14 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
15 * included with this distribution is covered by the same copyright terms
16 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
17 *
18 * Copyright remains Eric Young's, and as such any Copyright notices in
19 * the code are not to be removed.
20 * If this package is used in a product, Eric Young should be given attribution
21 * as the author of the parts of the library used.
22 * This can be in the form of a textual message at program startup or
23 * in documentation (online or textual) provided with the package.
24 *
25 * Redistribution and use in source and binary forms, with or without
26 * modification, are permitted provided that the following conditions
27 * are met:
28 * 1. Redistributions of source code must retain the copyright
29 * notice, this list of conditions and the following disclaimer.
30 * 2. Redistributions in binary form must reproduce the above copyright
31 * notice, this list of conditions and the following disclaimer in the
32 * documentation and/or other materials provided with the distribution.
33 * 3. All advertising materials mentioning features or use of this software
34 * must display the following acknowledgement:
35 * "This product includes cryptographic software written by
36 * Eric Young (eay@cryptsoft.com)"
37 * The word 'cryptographic' can be left out if the rouines from the library
38 * being used are not cryptographic related :-).
39 * 4. If you include any Windows specific code (or a derivative thereof) from
40 * the apps directory (application code) you must include an acknowledgement:
41 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
42 *
43 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
44 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
45 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
46 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
47 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
48 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
49 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
50 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
51 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
52 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
53 * SUCH DAMAGE.
54 *
55 * The licence and distribution terms for any publically available version or
56 * derivative of this code cannot be changed. i.e. this code cannot simply be
57 * copied and put under another distribution licence
58 * [including the GNU Public Licence.]
59 */
60
61/* most of this code has been pilfered from my libdes speed.c program */
62
63#define BASENUM 1000000
64#undef PROG
65#define PROG bnspeed_main
66
67#include <stdio.h>
68#include <stdlib.h>
69#include <signal.h>
70#include <string.h>
71#include <openssl/crypto.h>
72#include <openssl/err.h>
73
74#if !defined(OPENSSL_SYS_MSDOS) && (!defined(OPENSSL_SYS_VMS) || defined(__DECC)) && !defined(OPENSSL_SYS_MACOSX)
75#define TIMES
76#endif
77
78#ifndef _IRIX
79#include <time.h>
80#endif
81#ifdef TIMES
82#include <sys/types.h>
83#include <sys/times.h>
84#endif
85
86/* Depending on the VMS version, the tms structure is perhaps defined.
87 The __TMS macro will show if it was. If it wasn't defined, we should
88 undefine TIMES, since that tells the rest of the program how things
89 should be handled. -- Richard Levitte */
90#if defined(OPENSSL_SYS_VMS_DECC) && !defined(__TMS)
91#undef TIMES
92#endif
93
94#ifndef TIMES
95#include <sys/timeb.h>
96#endif
97
98#if defined(sun) || defined(__ultrix)
99#define _POSIX_SOURCE
100#include <limits.h>
101#include <sys/param.h>
102#endif
103
104#include <openssl/bn.h>
105#include <openssl/x509.h>
106
107/* The following if from times(3) man page. It may need to be changed */
108#ifndef HZ
109# ifndef CLK_TCK
110# ifndef _BSD_CLK_TCK_ /* FreeBSD hack */
111# define HZ 100.0
112# else /* _BSD_CLK_TCK_ */
113# define HZ ((double)_BSD_CLK_TCK_)
114# endif
115# else /* CLK_TCK */
116# define HZ ((double)CLK_TCK)
117# endif
118#endif
119
120#undef BUFSIZE
121#define BUFSIZE ((long)1024*8)
122int run=0;
123
124static double Time_F(int s);
125#define START 0
126#define STOP 1
127
128static double Time_F(int s)
129 {
130 double ret;
131#ifdef TIMES
132 static struct tms tstart,tend;
133
134 if (s == START)
135 {
136 times(&tstart);
137 return(0);
138 }
139 else
140 {
141 times(&tend);
142 ret=((double)(tend.tms_utime-tstart.tms_utime))/HZ;
143 return((ret < 1e-3)?1e-3:ret);
144 }
145#else /* !times() */
146 static struct timeb tstart,tend;
147 long i;
148
149 if (s == START)
150 {
151 ftime(&tstart);
152 return(0);
153 }
154 else
155 {
156 ftime(&tend);
157 i=(long)tend.millitm-(long)tstart.millitm;
158 ret=((double)(tend.time-tstart.time))+((double)i)/1000.0;
159 return((ret < 0.001)?0.001:ret);
160 }
161#endif
162 }
163
164#define NUM_SIZES 5
165static int sizes[NUM_SIZES]={128,256,512,1024,2048};
166/*static int sizes[NUM_SIZES]={59,179,299,419,539}; */
167
168void do_mul(BIGNUM *r,BIGNUM *a,BIGNUM *b,BN_CTX *ctx);
169
170int main(int argc, char **argv)
171 {
172 BN_CTX *ctx;
173 BIGNUM a,b,c;
174
175 ctx=BN_CTX_new();
176 BN_init(&a);
177 BN_init(&b);
178 BN_init(&c);
179
180 do_mul(&a,&b,&c,ctx);
181 }
182
183void do_mul(BIGNUM *r, BIGNUM *a, BIGNUM *b, BN_CTX *ctx)
184 {
185 int i,j,k;
186 double tm;
187 long num;
188
189 for (i=0; i<NUM_SIZES; i++)
190 {
191 num=BASENUM;
192 if (i) num/=(i*3);
193 BN_rand(a,sizes[i],1,0);
194 for (j=i; j<NUM_SIZES; j++)
195 {
196 BN_rand(b,sizes[j],1,0);
197 Time_F(START);
198 for (k=0; k<num; k++)
199 BN_mul(r,b,a,ctx);
200 tm=Time_F(STOP);
201 printf("mul %4d x %4d -> %8.3fms\n",sizes[i],sizes[j],tm*1000.0/num);
202 }
203 }
204
205 for (i=0; i<NUM_SIZES; i++)
206 {
207 num=BASENUM;
208 if (i) num/=(i*3);
209 BN_rand(a,sizes[i],1,0);
210 Time_F(START);
211 for (k=0; k<num; k++)
212 BN_sqr(r,a,ctx);
213 tm=Time_F(STOP);
214 printf("sqr %4d x %4d -> %8.3fms\n",sizes[i],sizes[i],tm*1000.0/num);
215 }
216
217 for (i=0; i<NUM_SIZES; i++)
218 {
219 num=BASENUM/10;
220 if (i) num/=(i*3);
221 BN_rand(a,sizes[i]-1,1,0);
222 for (j=i; j<NUM_SIZES; j++)
223 {
224 BN_rand(b,sizes[j],1,0);
225 Time_F(START);
226 for (k=0; k<100000; k++)
227 BN_div(r, NULL, b, a,ctx);
228 tm=Time_F(STOP);
229 printf("div %4d / %4d -> %8.3fms\n",sizes[j],sizes[i]-1,tm*1000.0/num);
230 }
231 }
232 }
233
diff --git a/src/lib/libcrypto/bn/bntest.c b/src/lib/libcrypto/bn/bntest.c
new file mode 100644
index 0000000000..06f5954acc
--- /dev/null
+++ b/src/lib/libcrypto/bn/bntest.c
@@ -0,0 +1,2013 @@
1/* crypto/bn/bntest.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58/* ====================================================================
59 * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED.
60 *
61 * Portions of the attached software ("Contribution") are developed by
62 * SUN MICROSYSTEMS, INC., and are contributed to the OpenSSL project.
63 *
64 * The Contribution is licensed pursuant to the Eric Young open source
65 * license provided above.
66 *
67 * The binary polynomial arithmetic software is originally written by
68 * Sheueling Chang Shantz and Douglas Stebila of Sun Microsystems Laboratories.
69 *
70 */
71
72/* Until the key-gen callbacks are modified to use newer prototypes, we allow
73 * deprecated functions for openssl-internal code */
74#ifdef OPENSSL_NO_DEPRECATED
75#undef OPENSSL_NO_DEPRECATED
76#endif
77
78#include <stdio.h>
79#include <stdlib.h>
80#include <string.h>
81
82#include "e_os.h"
83
84#include <openssl/bio.h>
85#include <openssl/bn.h>
86#include <openssl/rand.h>
87#include <openssl/x509.h>
88#include <openssl/err.h>
89
90const int num0 = 100; /* number of tests */
91const int num1 = 50; /* additional tests for some functions */
92const int num2 = 5; /* number of tests for slow functions */
93
94int test_add(BIO *bp);
95int test_sub(BIO *bp);
96int test_lshift1(BIO *bp);
97int test_lshift(BIO *bp,BN_CTX *ctx,BIGNUM *a_);
98int test_rshift1(BIO *bp);
99int test_rshift(BIO *bp,BN_CTX *ctx);
100int test_div(BIO *bp,BN_CTX *ctx);
101int test_div_word(BIO *bp);
102int test_div_recp(BIO *bp,BN_CTX *ctx);
103int test_mul(BIO *bp);
104int test_sqr(BIO *bp,BN_CTX *ctx);
105int test_mont(BIO *bp,BN_CTX *ctx);
106int test_mod(BIO *bp,BN_CTX *ctx);
107int test_mod_mul(BIO *bp,BN_CTX *ctx);
108int test_mod_exp(BIO *bp,BN_CTX *ctx);
109int test_mod_exp_mont_consttime(BIO *bp,BN_CTX *ctx);
110int test_exp(BIO *bp,BN_CTX *ctx);
111int test_gf2m_add(BIO *bp);
112int test_gf2m_mod(BIO *bp);
113int test_gf2m_mod_mul(BIO *bp,BN_CTX *ctx);
114int test_gf2m_mod_sqr(BIO *bp,BN_CTX *ctx);
115int test_gf2m_mod_inv(BIO *bp,BN_CTX *ctx);
116int test_gf2m_mod_div(BIO *bp,BN_CTX *ctx);
117int test_gf2m_mod_exp(BIO *bp,BN_CTX *ctx);
118int test_gf2m_mod_sqrt(BIO *bp,BN_CTX *ctx);
119int test_gf2m_mod_solve_quad(BIO *bp,BN_CTX *ctx);
120int test_kron(BIO *bp,BN_CTX *ctx);
121int test_sqrt(BIO *bp,BN_CTX *ctx);
122int rand_neg(void);
123static int results=0;
124
125static unsigned char lst[]="\xC6\x4F\x43\x04\x2A\xEA\xCA\x6E\x58\x36\x80\x5B\xE8\xC9"
126"\x9B\x04\x5D\x48\x36\xC2\xFD\x16\xC9\x64\xF0";
127
128static const char rnd_seed[] = "string to make the random number generator think it has entropy";
129
130static void message(BIO *out, char *m)
131 {
132 fprintf(stderr, "test %s\n", m);
133 BIO_puts(out, "print \"test ");
134 BIO_puts(out, m);
135 BIO_puts(out, "\\n\"\n");
136 }
137
138int main(int argc, char *argv[])
139 {
140 BN_CTX *ctx;
141 BIO *out;
142 char *outfile=NULL;
143
144 results = 0;
145
146 RAND_seed(rnd_seed, sizeof rnd_seed); /* or BN_generate_prime may fail */
147
148 argc--;
149 argv++;
150 while (argc >= 1)
151 {
152 if (strcmp(*argv,"-results") == 0)
153 results=1;
154 else if (strcmp(*argv,"-out") == 0)
155 {
156 if (--argc < 1) break;
157 outfile= *(++argv);
158 }
159 argc--;
160 argv++;
161 }
162
163
164 ctx=BN_CTX_new();
165 if (ctx == NULL) EXIT(1);
166
167 out=BIO_new(BIO_s_file());
168 if (out == NULL) EXIT(1);
169 if (outfile == NULL)
170 {
171 BIO_set_fp(out,stdout,BIO_NOCLOSE);
172 }
173 else
174 {
175 if (!BIO_write_filename(out,outfile))
176 {
177 perror(outfile);
178 EXIT(1);
179 }
180 }
181
182 if (!results)
183 BIO_puts(out,"obase=16\nibase=16\n");
184
185 message(out,"BN_add");
186 if (!test_add(out)) goto err;
187 (void)BIO_flush(out);
188
189 message(out,"BN_sub");
190 if (!test_sub(out)) goto err;
191 (void)BIO_flush(out);
192
193 message(out,"BN_lshift1");
194 if (!test_lshift1(out)) goto err;
195 (void)BIO_flush(out);
196
197 message(out,"BN_lshift (fixed)");
198 if (!test_lshift(out,ctx,BN_bin2bn(lst,sizeof(lst)-1,NULL)))
199 goto err;
200 (void)BIO_flush(out);
201
202 message(out,"BN_lshift");
203 if (!test_lshift(out,ctx,NULL)) goto err;
204 (void)BIO_flush(out);
205
206 message(out,"BN_rshift1");
207 if (!test_rshift1(out)) goto err;
208 (void)BIO_flush(out);
209
210 message(out,"BN_rshift");
211 if (!test_rshift(out,ctx)) goto err;
212 (void)BIO_flush(out);
213
214 message(out,"BN_sqr");
215 if (!test_sqr(out,ctx)) goto err;
216 (void)BIO_flush(out);
217
218 message(out,"BN_mul");
219 if (!test_mul(out)) goto err;
220 (void)BIO_flush(out);
221
222 message(out,"BN_div");
223 if (!test_div(out,ctx)) goto err;
224 (void)BIO_flush(out);
225
226 message(out,"BN_div_word");
227 if (!test_div_word(out)) goto err;
228 (void)BIO_flush(out);
229
230 message(out,"BN_div_recp");
231 if (!test_div_recp(out,ctx)) goto err;
232 (void)BIO_flush(out);
233
234 message(out,"BN_mod");
235 if (!test_mod(out,ctx)) goto err;
236 (void)BIO_flush(out);
237
238 message(out,"BN_mod_mul");
239 if (!test_mod_mul(out,ctx)) goto err;
240 (void)BIO_flush(out);
241
242 message(out,"BN_mont");
243 if (!test_mont(out,ctx)) goto err;
244 (void)BIO_flush(out);
245
246 message(out,"BN_mod_exp");
247 if (!test_mod_exp(out,ctx)) goto err;
248 (void)BIO_flush(out);
249
250 message(out,"BN_mod_exp_mont_consttime");
251 if (!test_mod_exp_mont_consttime(out,ctx)) goto err;
252 (void)BIO_flush(out);
253
254 message(out,"BN_exp");
255 if (!test_exp(out,ctx)) goto err;
256 (void)BIO_flush(out);
257
258 message(out,"BN_kronecker");
259 if (!test_kron(out,ctx)) goto err;
260 (void)BIO_flush(out);
261
262 message(out,"BN_mod_sqrt");
263 if (!test_sqrt(out,ctx)) goto err;
264 (void)BIO_flush(out);
265#ifndef OPENSSL_NO_EC2M
266 message(out,"BN_GF2m_add");
267 if (!test_gf2m_add(out)) goto err;
268 (void)BIO_flush(out);
269
270 message(out,"BN_GF2m_mod");
271 if (!test_gf2m_mod(out)) goto err;
272 (void)BIO_flush(out);
273
274 message(out,"BN_GF2m_mod_mul");
275 if (!test_gf2m_mod_mul(out,ctx)) goto err;
276 (void)BIO_flush(out);
277
278 message(out,"BN_GF2m_mod_sqr");
279 if (!test_gf2m_mod_sqr(out,ctx)) goto err;
280 (void)BIO_flush(out);
281
282 message(out,"BN_GF2m_mod_inv");
283 if (!test_gf2m_mod_inv(out,ctx)) goto err;
284 (void)BIO_flush(out);
285
286 message(out,"BN_GF2m_mod_div");
287 if (!test_gf2m_mod_div(out,ctx)) goto err;
288 (void)BIO_flush(out);
289
290 message(out,"BN_GF2m_mod_exp");
291 if (!test_gf2m_mod_exp(out,ctx)) goto err;
292 (void)BIO_flush(out);
293
294 message(out,"BN_GF2m_mod_sqrt");
295 if (!test_gf2m_mod_sqrt(out,ctx)) goto err;
296 (void)BIO_flush(out);
297
298 message(out,"BN_GF2m_mod_solve_quad");
299 if (!test_gf2m_mod_solve_quad(out,ctx)) goto err;
300 (void)BIO_flush(out);
301#endif
302 BN_CTX_free(ctx);
303 BIO_free(out);
304
305/**/
306 EXIT(0);
307err:
308 BIO_puts(out,"1\n"); /* make sure the Perl script fed by bc notices
309 * the failure, see test_bn in test/Makefile.ssl*/
310 (void)BIO_flush(out);
311 ERR_load_crypto_strings();
312 ERR_print_errors_fp(stderr);
313 EXIT(1);
314 return(1);
315 }
316
317int test_add(BIO *bp)
318 {
319 BIGNUM a,b,c;
320 int i;
321
322 BN_init(&a);
323 BN_init(&b);
324 BN_init(&c);
325
326 BN_bntest_rand(&a,512,0,0);
327 for (i=0; i<num0; i++)
328 {
329 BN_bntest_rand(&b,450+i,0,0);
330 a.neg=rand_neg();
331 b.neg=rand_neg();
332 BN_add(&c,&a,&b);
333 if (bp != NULL)
334 {
335 if (!results)
336 {
337 BN_print(bp,&a);
338 BIO_puts(bp," + ");
339 BN_print(bp,&b);
340 BIO_puts(bp," - ");
341 }
342 BN_print(bp,&c);
343 BIO_puts(bp,"\n");
344 }
345 a.neg=!a.neg;
346 b.neg=!b.neg;
347 BN_add(&c,&c,&b);
348 BN_add(&c,&c,&a);
349 if(!BN_is_zero(&c))
350 {
351 fprintf(stderr,"Add test failed!\n");
352 return 0;
353 }
354 }
355 BN_free(&a);
356 BN_free(&b);
357 BN_free(&c);
358 return(1);
359 }
360
361int test_sub(BIO *bp)
362 {
363 BIGNUM a,b,c;
364 int i;
365
366 BN_init(&a);
367 BN_init(&b);
368 BN_init(&c);
369
370 for (i=0; i<num0+num1; i++)
371 {
372 if (i < num1)
373 {
374 BN_bntest_rand(&a,512,0,0);
375 BN_copy(&b,&a);
376 if (BN_set_bit(&a,i)==0) return(0);
377 BN_add_word(&b,i);
378 }
379 else
380 {
381 BN_bntest_rand(&b,400+i-num1,0,0);
382 a.neg=rand_neg();
383 b.neg=rand_neg();
384 }
385 BN_sub(&c,&a,&b);
386 if (bp != NULL)
387 {
388 if (!results)
389 {
390 BN_print(bp,&a);
391 BIO_puts(bp," - ");
392 BN_print(bp,&b);
393 BIO_puts(bp," - ");
394 }
395 BN_print(bp,&c);
396 BIO_puts(bp,"\n");
397 }
398 BN_add(&c,&c,&b);
399 BN_sub(&c,&c,&a);
400 if(!BN_is_zero(&c))
401 {
402 fprintf(stderr,"Subtract test failed!\n");
403 return 0;
404 }
405 }
406 BN_free(&a);
407 BN_free(&b);
408 BN_free(&c);
409 return(1);
410 }
411
412int test_div(BIO *bp, BN_CTX *ctx)
413 {
414 BIGNUM a,b,c,d,e;
415 int i;
416
417 BN_init(&a);
418 BN_init(&b);
419 BN_init(&c);
420 BN_init(&d);
421 BN_init(&e);
422
423 for (i=0; i<num0+num1; i++)
424 {
425 if (i < num1)
426 {
427 BN_bntest_rand(&a,400,0,0);
428 BN_copy(&b,&a);
429 BN_lshift(&a,&a,i);
430 BN_add_word(&a,i);
431 }
432 else
433 BN_bntest_rand(&b,50+3*(i-num1),0,0);
434 a.neg=rand_neg();
435 b.neg=rand_neg();
436 BN_div(&d,&c,&a,&b,ctx);
437 if (bp != NULL)
438 {
439 if (!results)
440 {
441 BN_print(bp,&a);
442 BIO_puts(bp," / ");
443 BN_print(bp,&b);
444 BIO_puts(bp," - ");
445 }
446 BN_print(bp,&d);
447 BIO_puts(bp,"\n");
448
449 if (!results)
450 {
451 BN_print(bp,&a);
452 BIO_puts(bp," % ");
453 BN_print(bp,&b);
454 BIO_puts(bp," - ");
455 }
456 BN_print(bp,&c);
457 BIO_puts(bp,"\n");
458 }
459 BN_mul(&e,&d,&b,ctx);
460 BN_add(&d,&e,&c);
461 BN_sub(&d,&d,&a);
462 if(!BN_is_zero(&d))
463 {
464 fprintf(stderr,"Division test failed!\n");
465 return 0;
466 }
467 }
468 BN_free(&a);
469 BN_free(&b);
470 BN_free(&c);
471 BN_free(&d);
472 BN_free(&e);
473 return(1);
474 }
475
476static void print_word(BIO *bp,BN_ULONG w)
477 {
478#ifdef SIXTY_FOUR_BIT
479 if (sizeof(w) > sizeof(unsigned long))
480 {
481 unsigned long h=(unsigned long)(w>>32),
482 l=(unsigned long)(w);
483
484 if (h) BIO_printf(bp,"%lX%08lX",h,l);
485 else BIO_printf(bp,"%lX",l);
486 return;
487 }
488#endif
489 BIO_printf(bp,BN_HEX_FMT1,w);
490 }
491
492int test_div_word(BIO *bp)
493 {
494 BIGNUM a,b;
495 BN_ULONG r,s;
496 int i;
497
498 BN_init(&a);
499 BN_init(&b);
500
501 for (i=0; i<num0; i++)
502 {
503 do {
504 BN_bntest_rand(&a,512,-1,0);
505 BN_bntest_rand(&b,BN_BITS2,-1,0);
506 s = b.d[0];
507 } while (!s);
508
509 BN_copy(&b, &a);
510 r = BN_div_word(&b, s);
511
512 if (bp != NULL)
513 {
514 if (!results)
515 {
516 BN_print(bp,&a);
517 BIO_puts(bp," / ");
518 print_word(bp,s);
519 BIO_puts(bp," - ");
520 }
521 BN_print(bp,&b);
522 BIO_puts(bp,"\n");
523
524 if (!results)
525 {
526 BN_print(bp,&a);
527 BIO_puts(bp," % ");
528 print_word(bp,s);
529 BIO_puts(bp," - ");
530 }
531 print_word(bp,r);
532 BIO_puts(bp,"\n");
533 }
534 BN_mul_word(&b,s);
535 BN_add_word(&b,r);
536 BN_sub(&b,&a,&b);
537 if(!BN_is_zero(&b))
538 {
539 fprintf(stderr,"Division (word) test failed!\n");
540 return 0;
541 }
542 }
543 BN_free(&a);
544 BN_free(&b);
545 return(1);
546 }
547
548int test_div_recp(BIO *bp, BN_CTX *ctx)
549 {
550 BIGNUM a,b,c,d,e;
551 BN_RECP_CTX recp;
552 int i;
553
554 BN_RECP_CTX_init(&recp);
555 BN_init(&a);
556 BN_init(&b);
557 BN_init(&c);
558 BN_init(&d);
559 BN_init(&e);
560
561 for (i=0; i<num0+num1; i++)
562 {
563 if (i < num1)
564 {
565 BN_bntest_rand(&a,400,0,0);
566 BN_copy(&b,&a);
567 BN_lshift(&a,&a,i);
568 BN_add_word(&a,i);
569 }
570 else
571 BN_bntest_rand(&b,50+3*(i-num1),0,0);
572 a.neg=rand_neg();
573 b.neg=rand_neg();
574 BN_RECP_CTX_set(&recp,&b,ctx);
575 BN_div_recp(&d,&c,&a,&recp,ctx);
576 if (bp != NULL)
577 {
578 if (!results)
579 {
580 BN_print(bp,&a);
581 BIO_puts(bp," / ");
582 BN_print(bp,&b);
583 BIO_puts(bp," - ");
584 }
585 BN_print(bp,&d);
586 BIO_puts(bp,"\n");
587
588 if (!results)
589 {
590 BN_print(bp,&a);
591 BIO_puts(bp," % ");
592 BN_print(bp,&b);
593 BIO_puts(bp," - ");
594 }
595 BN_print(bp,&c);
596 BIO_puts(bp,"\n");
597 }
598 BN_mul(&e,&d,&b,ctx);
599 BN_add(&d,&e,&c);
600 BN_sub(&d,&d,&a);
601 if(!BN_is_zero(&d))
602 {
603 fprintf(stderr,"Reciprocal division test failed!\n");
604 fprintf(stderr,"a=");
605 BN_print_fp(stderr,&a);
606 fprintf(stderr,"\nb=");
607 BN_print_fp(stderr,&b);
608 fprintf(stderr,"\n");
609 return 0;
610 }
611 }
612 BN_free(&a);
613 BN_free(&b);
614 BN_free(&c);
615 BN_free(&d);
616 BN_free(&e);
617 BN_RECP_CTX_free(&recp);
618 return(1);
619 }
620
621int test_mul(BIO *bp)
622 {
623 BIGNUM a,b,c,d,e;
624 int i;
625 BN_CTX *ctx;
626
627 ctx = BN_CTX_new();
628 if (ctx == NULL) EXIT(1);
629
630 BN_init(&a);
631 BN_init(&b);
632 BN_init(&c);
633 BN_init(&d);
634 BN_init(&e);
635
636 for (i=0; i<num0+num1; i++)
637 {
638 if (i <= num1)
639 {
640 BN_bntest_rand(&a,100,0,0);
641 BN_bntest_rand(&b,100,0,0);
642 }
643 else
644 BN_bntest_rand(&b,i-num1,0,0);
645 a.neg=rand_neg();
646 b.neg=rand_neg();
647 BN_mul(&c,&a,&b,ctx);
648 if (bp != NULL)
649 {
650 if (!results)
651 {
652 BN_print(bp,&a);
653 BIO_puts(bp," * ");
654 BN_print(bp,&b);
655 BIO_puts(bp," - ");
656 }
657 BN_print(bp,&c);
658 BIO_puts(bp,"\n");
659 }
660 BN_div(&d,&e,&c,&a,ctx);
661 BN_sub(&d,&d,&b);
662 if(!BN_is_zero(&d) || !BN_is_zero(&e))
663 {
664 fprintf(stderr,"Multiplication test failed!\n");
665 return 0;
666 }
667 }
668 BN_free(&a);
669 BN_free(&b);
670 BN_free(&c);
671 BN_free(&d);
672 BN_free(&e);
673 BN_CTX_free(ctx);
674 return(1);
675 }
676
677int test_sqr(BIO *bp, BN_CTX *ctx)
678 {
679 BIGNUM a,c,d,e;
680 int i;
681
682 BN_init(&a);
683 BN_init(&c);
684 BN_init(&d);
685 BN_init(&e);
686
687 for (i=0; i<num0; i++)
688 {
689 BN_bntest_rand(&a,40+i*10,0,0);
690 a.neg=rand_neg();
691 BN_sqr(&c,&a,ctx);
692 if (bp != NULL)
693 {
694 if (!results)
695 {
696 BN_print(bp,&a);
697 BIO_puts(bp," * ");
698 BN_print(bp,&a);
699 BIO_puts(bp," - ");
700 }
701 BN_print(bp,&c);
702 BIO_puts(bp,"\n");
703 }
704 BN_div(&d,&e,&c,&a,ctx);
705 BN_sub(&d,&d,&a);
706 if(!BN_is_zero(&d) || !BN_is_zero(&e))
707 {
708 fprintf(stderr,"Square test failed!\n");
709 return 0;
710 }
711 }
712 BN_free(&a);
713 BN_free(&c);
714 BN_free(&d);
715 BN_free(&e);
716 return(1);
717 }
718
719int test_mont(BIO *bp, BN_CTX *ctx)
720 {
721 BIGNUM a,b,c,d,A,B;
722 BIGNUM n;
723 int i;
724 BN_MONT_CTX *mont;
725
726 BN_init(&a);
727 BN_init(&b);
728 BN_init(&c);
729 BN_init(&d);
730 BN_init(&A);
731 BN_init(&B);
732 BN_init(&n);
733
734 mont=BN_MONT_CTX_new();
735 if (mont == NULL)
736 return 0;
737
738 BN_bntest_rand(&a,100,0,0); /**/
739 BN_bntest_rand(&b,100,0,0); /**/
740 for (i=0; i<num2; i++)
741 {
742 int bits = (200*(i+1))/num2;
743
744 if (bits == 0)
745 continue;
746 BN_bntest_rand(&n,bits,0,1);
747 BN_MONT_CTX_set(mont,&n,ctx);
748
749 BN_nnmod(&a,&a,&n,ctx);
750 BN_nnmod(&b,&b,&n,ctx);
751
752 BN_to_montgomery(&A,&a,mont,ctx);
753 BN_to_montgomery(&B,&b,mont,ctx);
754
755 BN_mod_mul_montgomery(&c,&A,&B,mont,ctx);/**/
756 BN_from_montgomery(&A,&c,mont,ctx);/**/
757 if (bp != NULL)
758 {
759 if (!results)
760 {
761#ifdef undef
762fprintf(stderr,"%d * %d %% %d\n",
763BN_num_bits(&a),
764BN_num_bits(&b),
765BN_num_bits(mont->N));
766#endif
767 BN_print(bp,&a);
768 BIO_puts(bp," * ");
769 BN_print(bp,&b);
770 BIO_puts(bp," % ");
771 BN_print(bp,&(mont->N));
772 BIO_puts(bp," - ");
773 }
774 BN_print(bp,&A);
775 BIO_puts(bp,"\n");
776 }
777 BN_mod_mul(&d,&a,&b,&n,ctx);
778 BN_sub(&d,&d,&A);
779 if(!BN_is_zero(&d))
780 {
781 fprintf(stderr,"Montgomery multiplication test failed!\n");
782 return 0;
783 }
784 }
785 BN_MONT_CTX_free(mont);
786 BN_free(&a);
787 BN_free(&b);
788 BN_free(&c);
789 BN_free(&d);
790 BN_free(&A);
791 BN_free(&B);
792 BN_free(&n);
793 return(1);
794 }
795
796int test_mod(BIO *bp, BN_CTX *ctx)
797 {
798 BIGNUM *a,*b,*c,*d,*e;
799 int i;
800
801 a=BN_new();
802 b=BN_new();
803 c=BN_new();
804 d=BN_new();
805 e=BN_new();
806
807 BN_bntest_rand(a,1024,0,0); /**/
808 for (i=0; i<num0; i++)
809 {
810 BN_bntest_rand(b,450+i*10,0,0); /**/
811 a->neg=rand_neg();
812 b->neg=rand_neg();
813 BN_mod(c,a,b,ctx);/**/
814 if (bp != NULL)
815 {
816 if (!results)
817 {
818 BN_print(bp,a);
819 BIO_puts(bp," % ");
820 BN_print(bp,b);
821 BIO_puts(bp," - ");
822 }
823 BN_print(bp,c);
824 BIO_puts(bp,"\n");
825 }
826 BN_div(d,e,a,b,ctx);
827 BN_sub(e,e,c);
828 if(!BN_is_zero(e))
829 {
830 fprintf(stderr,"Modulo test failed!\n");
831 return 0;
832 }
833 }
834 BN_free(a);
835 BN_free(b);
836 BN_free(c);
837 BN_free(d);
838 BN_free(e);
839 return(1);
840 }
841
842int test_mod_mul(BIO *bp, BN_CTX *ctx)
843 {
844 BIGNUM *a,*b,*c,*d,*e;
845 int i,j;
846
847 a=BN_new();
848 b=BN_new();
849 c=BN_new();
850 d=BN_new();
851 e=BN_new();
852
853 for (j=0; j<3; j++) {
854 BN_bntest_rand(c,1024,0,0); /**/
855 for (i=0; i<num0; i++)
856 {
857 BN_bntest_rand(a,475+i*10,0,0); /**/
858 BN_bntest_rand(b,425+i*11,0,0); /**/
859 a->neg=rand_neg();
860 b->neg=rand_neg();
861 if (!BN_mod_mul(e,a,b,c,ctx))
862 {
863 unsigned long l;
864
865 while ((l=ERR_get_error()))
866 fprintf(stderr,"ERROR:%s\n",
867 ERR_error_string(l,NULL));
868 EXIT(1);
869 }
870 if (bp != NULL)
871 {
872 if (!results)
873 {
874 BN_print(bp,a);
875 BIO_puts(bp," * ");
876 BN_print(bp,b);
877 BIO_puts(bp," % ");
878 BN_print(bp,c);
879 if ((a->neg ^ b->neg) && !BN_is_zero(e))
880 {
881 /* If (a*b) % c is negative, c must be added
882 * in order to obtain the normalized remainder
883 * (new with OpenSSL 0.9.7, previous versions of
884 * BN_mod_mul could generate negative results)
885 */
886 BIO_puts(bp," + ");
887 BN_print(bp,c);
888 }
889 BIO_puts(bp," - ");
890 }
891 BN_print(bp,e);
892 BIO_puts(bp,"\n");
893 }
894 BN_mul(d,a,b,ctx);
895 BN_sub(d,d,e);
896 BN_div(a,b,d,c,ctx);
897 if(!BN_is_zero(b))
898 {
899 fprintf(stderr,"Modulo multiply test failed!\n");
900 ERR_print_errors_fp(stderr);
901 return 0;
902 }
903 }
904 }
905 BN_free(a);
906 BN_free(b);
907 BN_free(c);
908 BN_free(d);
909 BN_free(e);
910 return(1);
911 }
912
913int test_mod_exp(BIO *bp, BN_CTX *ctx)
914 {
915 BIGNUM *a,*b,*c,*d,*e;
916 int i;
917
918 a=BN_new();
919 b=BN_new();
920 c=BN_new();
921 d=BN_new();
922 e=BN_new();
923
924 BN_bntest_rand(c,30,0,1); /* must be odd for montgomery */
925 for (i=0; i<num2; i++)
926 {
927 BN_bntest_rand(a,20+i*5,0,0); /**/
928 BN_bntest_rand(b,2+i,0,0); /**/
929
930 if (!BN_mod_exp(d,a,b,c,ctx))
931 return(0);
932
933 if (bp != NULL)
934 {
935 if (!results)
936 {
937 BN_print(bp,a);
938 BIO_puts(bp," ^ ");
939 BN_print(bp,b);
940 BIO_puts(bp," % ");
941 BN_print(bp,c);
942 BIO_puts(bp," - ");
943 }
944 BN_print(bp,d);
945 BIO_puts(bp,"\n");
946 }
947 BN_exp(e,a,b,ctx);
948 BN_sub(e,e,d);
949 BN_div(a,b,e,c,ctx);
950 if(!BN_is_zero(b))
951 {
952 fprintf(stderr,"Modulo exponentiation test failed!\n");
953 return 0;
954 }
955 }
956 BN_free(a);
957 BN_free(b);
958 BN_free(c);
959 BN_free(d);
960 BN_free(e);
961 return(1);
962 }
963
964int test_mod_exp_mont_consttime(BIO *bp, BN_CTX *ctx)
965 {
966 BIGNUM *a,*b,*c,*d,*e;
967 int i;
968
969 a=BN_new();
970 b=BN_new();
971 c=BN_new();
972 d=BN_new();
973 e=BN_new();
974
975 BN_bntest_rand(c,30,0,1); /* must be odd for montgomery */
976 for (i=0; i<num2; i++)
977 {
978 BN_bntest_rand(a,20+i*5,0,0); /**/
979 BN_bntest_rand(b,2+i,0,0); /**/
980
981 if (!BN_mod_exp_mont_consttime(d,a,b,c,ctx,NULL))
982 return(00);
983
984 if (bp != NULL)
985 {
986 if (!results)
987 {
988 BN_print(bp,a);
989 BIO_puts(bp," ^ ");
990 BN_print(bp,b);
991 BIO_puts(bp," % ");
992 BN_print(bp,c);
993 BIO_puts(bp," - ");
994 }
995 BN_print(bp,d);
996 BIO_puts(bp,"\n");
997 }
998 BN_exp(e,a,b,ctx);
999 BN_sub(e,e,d);
1000 BN_div(a,b,e,c,ctx);
1001 if(!BN_is_zero(b))
1002 {
1003 fprintf(stderr,"Modulo exponentiation test failed!\n");
1004 return 0;
1005 }
1006 }
1007 BN_free(a);
1008 BN_free(b);
1009 BN_free(c);
1010 BN_free(d);
1011 BN_free(e);
1012 return(1);
1013 }
1014
1015int test_exp(BIO *bp, BN_CTX *ctx)
1016 {
1017 BIGNUM *a,*b,*d,*e,*one;
1018 int i;
1019
1020 a=BN_new();
1021 b=BN_new();
1022 d=BN_new();
1023 e=BN_new();
1024 one=BN_new();
1025 BN_one(one);
1026
1027 for (i=0; i<num2; i++)
1028 {
1029 BN_bntest_rand(a,20+i*5,0,0); /**/
1030 BN_bntest_rand(b,2+i,0,0); /**/
1031
1032 if (BN_exp(d,a,b,ctx) <= 0)
1033 return(0);
1034
1035 if (bp != NULL)
1036 {
1037 if (!results)
1038 {
1039 BN_print(bp,a);
1040 BIO_puts(bp," ^ ");
1041 BN_print(bp,b);
1042 BIO_puts(bp," - ");
1043 }
1044 BN_print(bp,d);
1045 BIO_puts(bp,"\n");
1046 }
1047 BN_one(e);
1048 for( ; !BN_is_zero(b) ; BN_sub(b,b,one))
1049 BN_mul(e,e,a,ctx);
1050 BN_sub(e,e,d);
1051 if(!BN_is_zero(e))
1052 {
1053 fprintf(stderr,"Exponentiation test failed!\n");
1054 return 0;
1055 }
1056 }
1057 BN_free(a);
1058 BN_free(b);
1059 BN_free(d);
1060 BN_free(e);
1061 BN_free(one);
1062 return(1);
1063 }
1064#ifndef OPENSSL_NO_EC2M
1065int test_gf2m_add(BIO *bp)
1066 {
1067 BIGNUM a,b,c;
1068 int i, ret = 0;
1069
1070 BN_init(&a);
1071 BN_init(&b);
1072 BN_init(&c);
1073
1074 for (i=0; i<num0; i++)
1075 {
1076 BN_rand(&a,512,0,0);
1077 BN_copy(&b, BN_value_one());
1078 a.neg=rand_neg();
1079 b.neg=rand_neg();
1080 BN_GF2m_add(&c,&a,&b);
1081#if 0 /* make test uses ouput in bc but bc can't handle GF(2^m) arithmetic */
1082 if (bp != NULL)
1083 {
1084 if (!results)
1085 {
1086 BN_print(bp,&a);
1087 BIO_puts(bp," ^ ");
1088 BN_print(bp,&b);
1089 BIO_puts(bp," = ");
1090 }
1091 BN_print(bp,&c);
1092 BIO_puts(bp,"\n");
1093 }
1094#endif
1095 /* Test that two added values have the correct parity. */
1096 if((BN_is_odd(&a) && BN_is_odd(&c)) || (!BN_is_odd(&a) && !BN_is_odd(&c)))
1097 {
1098 fprintf(stderr,"GF(2^m) addition test (a) failed!\n");
1099 goto err;
1100 }
1101 BN_GF2m_add(&c,&c,&c);
1102 /* Test that c + c = 0. */
1103 if(!BN_is_zero(&c))
1104 {
1105 fprintf(stderr,"GF(2^m) addition test (b) failed!\n");
1106 goto err;
1107 }
1108 }
1109 ret = 1;
1110 err:
1111 BN_free(&a);
1112 BN_free(&b);
1113 BN_free(&c);
1114 return ret;
1115 }
1116
1117int test_gf2m_mod(BIO *bp)
1118 {
1119 BIGNUM *a,*b[2],*c,*d,*e;
1120 int i, j, ret = 0;
1121 int p0[] = {163,7,6,3,0,-1};
1122 int p1[] = {193,15,0,-1};
1123
1124 a=BN_new();
1125 b[0]=BN_new();
1126 b[1]=BN_new();
1127 c=BN_new();
1128 d=BN_new();
1129 e=BN_new();
1130
1131 BN_GF2m_arr2poly(p0, b[0]);
1132 BN_GF2m_arr2poly(p1, b[1]);
1133
1134 for (i=0; i<num0; i++)
1135 {
1136 BN_bntest_rand(a, 1024, 0, 0);
1137 for (j=0; j < 2; j++)
1138 {
1139 BN_GF2m_mod(c, a, b[j]);
1140#if 0 /* make test uses ouput in bc but bc can't handle GF(2^m) arithmetic */
1141 if (bp != NULL)
1142 {
1143 if (!results)
1144 {
1145 BN_print(bp,a);
1146 BIO_puts(bp," % ");
1147 BN_print(bp,b[j]);
1148 BIO_puts(bp," - ");
1149 BN_print(bp,c);
1150 BIO_puts(bp,"\n");
1151 }
1152 }
1153#endif
1154 BN_GF2m_add(d, a, c);
1155 BN_GF2m_mod(e, d, b[j]);
1156 /* Test that a + (a mod p) mod p == 0. */
1157 if(!BN_is_zero(e))
1158 {
1159 fprintf(stderr,"GF(2^m) modulo test failed!\n");
1160 goto err;
1161 }
1162 }
1163 }
1164 ret = 1;
1165 err:
1166 BN_free(a);
1167 BN_free(b[0]);
1168 BN_free(b[1]);
1169 BN_free(c);
1170 BN_free(d);
1171 BN_free(e);
1172 return ret;
1173 }
1174
1175int test_gf2m_mod_mul(BIO *bp,BN_CTX *ctx)
1176 {
1177 BIGNUM *a,*b[2],*c,*d,*e,*f,*g,*h;
1178 int i, j, ret = 0;
1179 int p0[] = {163,7,6,3,0,-1};
1180 int p1[] = {193,15,0,-1};
1181
1182 a=BN_new();
1183 b[0]=BN_new();
1184 b[1]=BN_new();
1185 c=BN_new();
1186 d=BN_new();
1187 e=BN_new();
1188 f=BN_new();
1189 g=BN_new();
1190 h=BN_new();
1191
1192 BN_GF2m_arr2poly(p0, b[0]);
1193 BN_GF2m_arr2poly(p1, b[1]);
1194
1195 for (i=0; i<num0; i++)
1196 {
1197 BN_bntest_rand(a, 1024, 0, 0);
1198 BN_bntest_rand(c, 1024, 0, 0);
1199 BN_bntest_rand(d, 1024, 0, 0);
1200 for (j=0; j < 2; j++)
1201 {
1202 BN_GF2m_mod_mul(e, a, c, b[j], ctx);
1203#if 0 /* make test uses ouput in bc but bc can't handle GF(2^m) arithmetic */
1204 if (bp != NULL)
1205 {
1206 if (!results)
1207 {
1208 BN_print(bp,a);
1209 BIO_puts(bp," * ");
1210 BN_print(bp,c);
1211 BIO_puts(bp," % ");
1212 BN_print(bp,b[j]);
1213 BIO_puts(bp," - ");
1214 BN_print(bp,e);
1215 BIO_puts(bp,"\n");
1216 }
1217 }
1218#endif
1219 BN_GF2m_add(f, a, d);
1220 BN_GF2m_mod_mul(g, f, c, b[j], ctx);
1221 BN_GF2m_mod_mul(h, d, c, b[j], ctx);
1222 BN_GF2m_add(f, e, g);
1223 BN_GF2m_add(f, f, h);
1224 /* Test that (a+d)*c = a*c + d*c. */
1225 if(!BN_is_zero(f))
1226 {
1227 fprintf(stderr,"GF(2^m) modular multiplication test failed!\n");
1228 goto err;
1229 }
1230 }
1231 }
1232 ret = 1;
1233 err:
1234 BN_free(a);
1235 BN_free(b[0]);
1236 BN_free(b[1]);
1237 BN_free(c);
1238 BN_free(d);
1239 BN_free(e);
1240 BN_free(f);
1241 BN_free(g);
1242 BN_free(h);
1243 return ret;
1244 }
1245
1246int test_gf2m_mod_sqr(BIO *bp,BN_CTX *ctx)
1247 {
1248 BIGNUM *a,*b[2],*c,*d;
1249 int i, j, ret = 0;
1250 int p0[] = {163,7,6,3,0,-1};
1251 int p1[] = {193,15,0,-1};
1252
1253 a=BN_new();
1254 b[0]=BN_new();
1255 b[1]=BN_new();
1256 c=BN_new();
1257 d=BN_new();
1258
1259 BN_GF2m_arr2poly(p0, b[0]);
1260 BN_GF2m_arr2poly(p1, b[1]);
1261
1262 for (i=0; i<num0; i++)
1263 {
1264 BN_bntest_rand(a, 1024, 0, 0);
1265 for (j=0; j < 2; j++)
1266 {
1267 BN_GF2m_mod_sqr(c, a, b[j], ctx);
1268 BN_copy(d, a);
1269 BN_GF2m_mod_mul(d, a, d, b[j], ctx);
1270#if 0 /* make test uses ouput in bc but bc can't handle GF(2^m) arithmetic */
1271 if (bp != NULL)
1272 {
1273 if (!results)
1274 {
1275 BN_print(bp,a);
1276 BIO_puts(bp," ^ 2 % ");
1277 BN_print(bp,b[j]);
1278 BIO_puts(bp, " = ");
1279 BN_print(bp,c);
1280 BIO_puts(bp,"; a * a = ");
1281 BN_print(bp,d);
1282 BIO_puts(bp,"\n");
1283 }
1284 }
1285#endif
1286 BN_GF2m_add(d, c, d);
1287 /* Test that a*a = a^2. */
1288 if(!BN_is_zero(d))
1289 {
1290 fprintf(stderr,"GF(2^m) modular squaring test failed!\n");
1291 goto err;
1292 }
1293 }
1294 }
1295 ret = 1;
1296 err:
1297 BN_free(a);
1298 BN_free(b[0]);
1299 BN_free(b[1]);
1300 BN_free(c);
1301 BN_free(d);
1302 return ret;
1303 }
1304
1305int test_gf2m_mod_inv(BIO *bp,BN_CTX *ctx)
1306 {
1307 BIGNUM *a,*b[2],*c,*d;
1308 int i, j, ret = 0;
1309 int p0[] = {163,7,6,3,0,-1};
1310 int p1[] = {193,15,0,-1};
1311
1312 a=BN_new();
1313 b[0]=BN_new();
1314 b[1]=BN_new();
1315 c=BN_new();
1316 d=BN_new();
1317
1318 BN_GF2m_arr2poly(p0, b[0]);
1319 BN_GF2m_arr2poly(p1, b[1]);
1320
1321 for (i=0; i<num0; i++)
1322 {
1323 BN_bntest_rand(a, 512, 0, 0);
1324 for (j=0; j < 2; j++)
1325 {
1326 BN_GF2m_mod_inv(c, a, b[j], ctx);
1327 BN_GF2m_mod_mul(d, a, c, b[j], ctx);
1328#if 0 /* make test uses ouput in bc but bc can't handle GF(2^m) arithmetic */
1329 if (bp != NULL)
1330 {
1331 if (!results)
1332 {
1333 BN_print(bp,a);
1334 BIO_puts(bp, " * ");
1335 BN_print(bp,c);
1336 BIO_puts(bp," - 1 % ");
1337 BN_print(bp,b[j]);
1338 BIO_puts(bp,"\n");
1339 }
1340 }
1341#endif
1342 /* Test that ((1/a)*a) = 1. */
1343 if(!BN_is_one(d))
1344 {
1345 fprintf(stderr,"GF(2^m) modular inversion test failed!\n");
1346 goto err;
1347 }
1348 }
1349 }
1350 ret = 1;
1351 err:
1352 BN_free(a);
1353 BN_free(b[0]);
1354 BN_free(b[1]);
1355 BN_free(c);
1356 BN_free(d);
1357 return ret;
1358 }
1359
1360int test_gf2m_mod_div(BIO *bp,BN_CTX *ctx)
1361 {
1362 BIGNUM *a,*b[2],*c,*d,*e,*f;
1363 int i, j, ret = 0;
1364 int p0[] = {163,7,6,3,0,-1};
1365 int p1[] = {193,15,0,-1};
1366
1367 a=BN_new();
1368 b[0]=BN_new();
1369 b[1]=BN_new();
1370 c=BN_new();
1371 d=BN_new();
1372 e=BN_new();
1373 f=BN_new();
1374
1375 BN_GF2m_arr2poly(p0, b[0]);
1376 BN_GF2m_arr2poly(p1, b[1]);
1377
1378 for (i=0; i<num0; i++)
1379 {
1380 BN_bntest_rand(a, 512, 0, 0);
1381 BN_bntest_rand(c, 512, 0, 0);
1382 for (j=0; j < 2; j++)
1383 {
1384 BN_GF2m_mod_div(d, a, c, b[j], ctx);
1385 BN_GF2m_mod_mul(e, d, c, b[j], ctx);
1386 BN_GF2m_mod_div(f, a, e, b[j], ctx);
1387#if 0 /* make test uses ouput in bc but bc can't handle GF(2^m) arithmetic */
1388 if (bp != NULL)
1389 {
1390 if (!results)
1391 {
1392 BN_print(bp,a);
1393 BIO_puts(bp, " = ");
1394 BN_print(bp,c);
1395 BIO_puts(bp," * ");
1396 BN_print(bp,d);
1397 BIO_puts(bp, " % ");
1398 BN_print(bp,b[j]);
1399 BIO_puts(bp,"\n");
1400 }
1401 }
1402#endif
1403 /* Test that ((a/c)*c)/a = 1. */
1404 if(!BN_is_one(f))
1405 {
1406 fprintf(stderr,"GF(2^m) modular division test failed!\n");
1407 goto err;
1408 }
1409 }
1410 }
1411 ret = 1;
1412 err:
1413 BN_free(a);
1414 BN_free(b[0]);
1415 BN_free(b[1]);
1416 BN_free(c);
1417 BN_free(d);
1418 BN_free(e);
1419 BN_free(f);
1420 return ret;
1421 }
1422
1423int test_gf2m_mod_exp(BIO *bp,BN_CTX *ctx)
1424 {
1425 BIGNUM *a,*b[2],*c,*d,*e,*f;
1426 int i, j, ret = 0;
1427 int p0[] = {163,7,6,3,0,-1};
1428 int p1[] = {193,15,0,-1};
1429
1430 a=BN_new();
1431 b[0]=BN_new();
1432 b[1]=BN_new();
1433 c=BN_new();
1434 d=BN_new();
1435 e=BN_new();
1436 f=BN_new();
1437
1438 BN_GF2m_arr2poly(p0, b[0]);
1439 BN_GF2m_arr2poly(p1, b[1]);
1440
1441 for (i=0; i<num0; i++)
1442 {
1443 BN_bntest_rand(a, 512, 0, 0);
1444 BN_bntest_rand(c, 512, 0, 0);
1445 BN_bntest_rand(d, 512, 0, 0);
1446 for (j=0; j < 2; j++)
1447 {
1448 BN_GF2m_mod_exp(e, a, c, b[j], ctx);
1449 BN_GF2m_mod_exp(f, a, d, b[j], ctx);
1450 BN_GF2m_mod_mul(e, e, f, b[j], ctx);
1451 BN_add(f, c, d);
1452 BN_GF2m_mod_exp(f, a, f, b[j], ctx);
1453#if 0 /* make test uses ouput in bc but bc can't handle GF(2^m) arithmetic */
1454 if (bp != NULL)
1455 {
1456 if (!results)
1457 {
1458 BN_print(bp,a);
1459 BIO_puts(bp, " ^ (");
1460 BN_print(bp,c);
1461 BIO_puts(bp," + ");
1462 BN_print(bp,d);
1463 BIO_puts(bp, ") = ");
1464 BN_print(bp,e);
1465 BIO_puts(bp, "; - ");
1466 BN_print(bp,f);
1467 BIO_puts(bp, " % ");
1468 BN_print(bp,b[j]);
1469 BIO_puts(bp,"\n");
1470 }
1471 }
1472#endif
1473 BN_GF2m_add(f, e, f);
1474 /* Test that a^(c+d)=a^c*a^d. */
1475 if(!BN_is_zero(f))
1476 {
1477 fprintf(stderr,"GF(2^m) modular exponentiation test failed!\n");
1478 goto err;
1479 }
1480 }
1481 }
1482 ret = 1;
1483 err:
1484 BN_free(a);
1485 BN_free(b[0]);
1486 BN_free(b[1]);
1487 BN_free(c);
1488 BN_free(d);
1489 BN_free(e);
1490 BN_free(f);
1491 return ret;
1492 }
1493
1494int test_gf2m_mod_sqrt(BIO *bp,BN_CTX *ctx)
1495 {
1496 BIGNUM *a,*b[2],*c,*d,*e,*f;
1497 int i, j, ret = 0;
1498 int p0[] = {163,7,6,3,0,-1};
1499 int p1[] = {193,15,0,-1};
1500
1501 a=BN_new();
1502 b[0]=BN_new();
1503 b[1]=BN_new();
1504 c=BN_new();
1505 d=BN_new();
1506 e=BN_new();
1507 f=BN_new();
1508
1509 BN_GF2m_arr2poly(p0, b[0]);
1510 BN_GF2m_arr2poly(p1, b[1]);
1511
1512 for (i=0; i<num0; i++)
1513 {
1514 BN_bntest_rand(a, 512, 0, 0);
1515 for (j=0; j < 2; j++)
1516 {
1517 BN_GF2m_mod(c, a, b[j]);
1518 BN_GF2m_mod_sqrt(d, a, b[j], ctx);
1519 BN_GF2m_mod_sqr(e, d, b[j], ctx);
1520#if 0 /* make test uses ouput in bc but bc can't handle GF(2^m) arithmetic */
1521 if (bp != NULL)
1522 {
1523 if (!results)
1524 {
1525 BN_print(bp,d);
1526 BIO_puts(bp, " ^ 2 - ");
1527 BN_print(bp,a);
1528 BIO_puts(bp,"\n");
1529 }
1530 }
1531#endif
1532 BN_GF2m_add(f, c, e);
1533 /* Test that d^2 = a, where d = sqrt(a). */
1534 if(!BN_is_zero(f))
1535 {
1536 fprintf(stderr,"GF(2^m) modular square root test failed!\n");
1537 goto err;
1538 }
1539 }
1540 }
1541 ret = 1;
1542 err:
1543 BN_free(a);
1544 BN_free(b[0]);
1545 BN_free(b[1]);
1546 BN_free(c);
1547 BN_free(d);
1548 BN_free(e);
1549 BN_free(f);
1550 return ret;
1551 }
1552
1553int test_gf2m_mod_solve_quad(BIO *bp,BN_CTX *ctx)
1554 {
1555 BIGNUM *a,*b[2],*c,*d,*e;
1556 int i, j, s = 0, t, ret = 0;
1557 int p0[] = {163,7,6,3,0,-1};
1558 int p1[] = {193,15,0,-1};
1559
1560 a=BN_new();
1561 b[0]=BN_new();
1562 b[1]=BN_new();
1563 c=BN_new();
1564 d=BN_new();
1565 e=BN_new();
1566
1567 BN_GF2m_arr2poly(p0, b[0]);
1568 BN_GF2m_arr2poly(p1, b[1]);
1569
1570 for (i=0; i<num0; i++)
1571 {
1572 BN_bntest_rand(a, 512, 0, 0);
1573 for (j=0; j < 2; j++)
1574 {
1575 t = BN_GF2m_mod_solve_quad(c, a, b[j], ctx);
1576 if (t)
1577 {
1578 s++;
1579 BN_GF2m_mod_sqr(d, c, b[j], ctx);
1580 BN_GF2m_add(d, c, d);
1581 BN_GF2m_mod(e, a, b[j]);
1582#if 0 /* make test uses ouput in bc but bc can't handle GF(2^m) arithmetic */
1583 if (bp != NULL)
1584 {
1585 if (!results)
1586 {
1587 BN_print(bp,c);
1588 BIO_puts(bp, " is root of z^2 + z = ");
1589 BN_print(bp,a);
1590 BIO_puts(bp, " % ");
1591 BN_print(bp,b[j]);
1592 BIO_puts(bp, "\n");
1593 }
1594 }
1595#endif
1596 BN_GF2m_add(e, e, d);
1597 /* Test that solution of quadratic c satisfies c^2 + c = a. */
1598 if(!BN_is_zero(e))
1599 {
1600 fprintf(stderr,"GF(2^m) modular solve quadratic test failed!\n");
1601 goto err;
1602 }
1603
1604 }
1605 else
1606 {
1607#if 0 /* make test uses ouput in bc but bc can't handle GF(2^m) arithmetic */
1608 if (bp != NULL)
1609 {
1610 if (!results)
1611 {
1612 BIO_puts(bp, "There are no roots of z^2 + z = ");
1613 BN_print(bp,a);
1614 BIO_puts(bp, " % ");
1615 BN_print(bp,b[j]);
1616 BIO_puts(bp, "\n");
1617 }
1618 }
1619#endif
1620 }
1621 }
1622 }
1623 if (s == 0)
1624 {
1625 fprintf(stderr,"All %i tests of GF(2^m) modular solve quadratic resulted in no roots;\n", num0);
1626 fprintf(stderr,"this is very unlikely and probably indicates an error.\n");
1627 goto err;
1628 }
1629 ret = 1;
1630 err:
1631 BN_free(a);
1632 BN_free(b[0]);
1633 BN_free(b[1]);
1634 BN_free(c);
1635 BN_free(d);
1636 BN_free(e);
1637 return ret;
1638 }
1639#endif
1640static int genprime_cb(int p, int n, BN_GENCB *arg)
1641 {
1642 char c='*';
1643
1644 if (p == 0) c='.';
1645 if (p == 1) c='+';
1646 if (p == 2) c='*';
1647 if (p == 3) c='\n';
1648 putc(c, stderr);
1649 fflush(stderr);
1650 return 1;
1651 }
1652
1653int test_kron(BIO *bp, BN_CTX *ctx)
1654 {
1655 BN_GENCB cb;
1656 BIGNUM *a,*b,*r,*t;
1657 int i;
1658 int legendre, kronecker;
1659 int ret = 0;
1660
1661 a = BN_new();
1662 b = BN_new();
1663 r = BN_new();
1664 t = BN_new();
1665 if (a == NULL || b == NULL || r == NULL || t == NULL) goto err;
1666
1667 BN_GENCB_set(&cb, genprime_cb, NULL);
1668
1669 /* We test BN_kronecker(a, b, ctx) just for b odd (Jacobi symbol).
1670 * In this case we know that if b is prime, then BN_kronecker(a, b, ctx)
1671 * is congruent to $a^{(b-1)/2}$, modulo $b$ (Legendre symbol).
1672 * So we generate a random prime b and compare these values
1673 * for a number of random a's. (That is, we run the Solovay-Strassen
1674 * primality test to confirm that b is prime, except that we
1675 * don't want to test whether b is prime but whether BN_kronecker
1676 * works.) */
1677
1678 if (!BN_generate_prime_ex(b, 512, 0, NULL, NULL, &cb)) goto err;
1679 b->neg = rand_neg();
1680 putc('\n', stderr);
1681
1682 for (i = 0; i < num0; i++)
1683 {
1684 if (!BN_bntest_rand(a, 512, 0, 0)) goto err;
1685 a->neg = rand_neg();
1686
1687 /* t := (|b|-1)/2 (note that b is odd) */
1688 if (!BN_copy(t, b)) goto err;
1689 t->neg = 0;
1690 if (!BN_sub_word(t, 1)) goto err;
1691 if (!BN_rshift1(t, t)) goto err;
1692 /* r := a^t mod b */
1693 b->neg=0;
1694
1695 if (!BN_mod_exp_recp(r, a, t, b, ctx)) goto err;
1696 b->neg=1;
1697
1698 if (BN_is_word(r, 1))
1699 legendre = 1;
1700 else if (BN_is_zero(r))
1701 legendre = 0;
1702 else
1703 {
1704 if (!BN_add_word(r, 1)) goto err;
1705 if (0 != BN_ucmp(r, b))
1706 {
1707 fprintf(stderr, "Legendre symbol computation failed\n");
1708 goto err;
1709 }
1710 legendre = -1;
1711 }
1712
1713 kronecker = BN_kronecker(a, b, ctx);
1714 if (kronecker < -1) goto err;
1715 /* we actually need BN_kronecker(a, |b|) */
1716 if (a->neg && b->neg)
1717 kronecker = -kronecker;
1718
1719 if (legendre != kronecker)
1720 {
1721 fprintf(stderr, "legendre != kronecker; a = ");
1722 BN_print_fp(stderr, a);
1723 fprintf(stderr, ", b = ");
1724 BN_print_fp(stderr, b);
1725 fprintf(stderr, "\n");
1726 goto err;
1727 }
1728
1729 putc('.', stderr);
1730 fflush(stderr);
1731 }
1732
1733 putc('\n', stderr);
1734 fflush(stderr);
1735 ret = 1;
1736 err:
1737 if (a != NULL) BN_free(a);
1738 if (b != NULL) BN_free(b);
1739 if (r != NULL) BN_free(r);
1740 if (t != NULL) BN_free(t);
1741 return ret;
1742 }
1743
1744int test_sqrt(BIO *bp, BN_CTX *ctx)
1745 {
1746 BN_GENCB cb;
1747 BIGNUM *a,*p,*r;
1748 int i, j;
1749 int ret = 0;
1750
1751 a = BN_new();
1752 p = BN_new();
1753 r = BN_new();
1754 if (a == NULL || p == NULL || r == NULL) goto err;
1755
1756 BN_GENCB_set(&cb, genprime_cb, NULL);
1757
1758 for (i = 0; i < 16; i++)
1759 {
1760 if (i < 8)
1761 {
1762 unsigned primes[8] = { 2, 3, 5, 7, 11, 13, 17, 19 };
1763
1764 if (!BN_set_word(p, primes[i])) goto err;
1765 }
1766 else
1767 {
1768 if (!BN_set_word(a, 32)) goto err;
1769 if (!BN_set_word(r, 2*i + 1)) goto err;
1770
1771 if (!BN_generate_prime_ex(p, 256, 0, a, r, &cb)) goto err;
1772 putc('\n', stderr);
1773 }
1774 p->neg = rand_neg();
1775
1776 for (j = 0; j < num2; j++)
1777 {
1778 /* construct 'a' such that it is a square modulo p,
1779 * but in general not a proper square and not reduced modulo p */
1780 if (!BN_bntest_rand(r, 256, 0, 3)) goto err;
1781 if (!BN_nnmod(r, r, p, ctx)) goto err;
1782 if (!BN_mod_sqr(r, r, p, ctx)) goto err;
1783 if (!BN_bntest_rand(a, 256, 0, 3)) goto err;
1784 if (!BN_nnmod(a, a, p, ctx)) goto err;
1785 if (!BN_mod_sqr(a, a, p, ctx)) goto err;
1786 if (!BN_mul(a, a, r, ctx)) goto err;
1787 if (rand_neg())
1788 if (!BN_sub(a, a, p)) goto err;
1789
1790 if (!BN_mod_sqrt(r, a, p, ctx)) goto err;
1791 if (!BN_mod_sqr(r, r, p, ctx)) goto err;
1792
1793 if (!BN_nnmod(a, a, p, ctx)) goto err;
1794
1795 if (BN_cmp(a, r) != 0)
1796 {
1797 fprintf(stderr, "BN_mod_sqrt failed: a = ");
1798 BN_print_fp(stderr, a);
1799 fprintf(stderr, ", r = ");
1800 BN_print_fp(stderr, r);
1801 fprintf(stderr, ", p = ");
1802 BN_print_fp(stderr, p);
1803 fprintf(stderr, "\n");
1804 goto err;
1805 }
1806
1807 putc('.', stderr);
1808 fflush(stderr);
1809 }
1810
1811 putc('\n', stderr);
1812 fflush(stderr);
1813 }
1814 ret = 1;
1815 err:
1816 if (a != NULL) BN_free(a);
1817 if (p != NULL) BN_free(p);
1818 if (r != NULL) BN_free(r);
1819 return ret;
1820 }
1821
1822int test_lshift(BIO *bp,BN_CTX *ctx,BIGNUM *a_)
1823 {
1824 BIGNUM *a,*b,*c,*d;
1825 int i;
1826
1827 b=BN_new();
1828 c=BN_new();
1829 d=BN_new();
1830 BN_one(c);
1831
1832 if(a_)
1833 a=a_;
1834 else
1835 {
1836 a=BN_new();
1837 BN_bntest_rand(a,200,0,0); /**/
1838 a->neg=rand_neg();
1839 }
1840 for (i=0; i<num0; i++)
1841 {
1842 BN_lshift(b,a,i+1);
1843 BN_add(c,c,c);
1844 if (bp != NULL)
1845 {
1846 if (!results)
1847 {
1848 BN_print(bp,a);
1849 BIO_puts(bp," * ");
1850 BN_print(bp,c);
1851 BIO_puts(bp," - ");
1852 }
1853 BN_print(bp,b);
1854 BIO_puts(bp,"\n");
1855 }
1856 BN_mul(d,a,c,ctx);
1857 BN_sub(d,d,b);
1858 if(!BN_is_zero(d))
1859 {
1860 fprintf(stderr,"Left shift test failed!\n");
1861 fprintf(stderr,"a=");
1862 BN_print_fp(stderr,a);
1863 fprintf(stderr,"\nb=");
1864 BN_print_fp(stderr,b);
1865 fprintf(stderr,"\nc=");
1866 BN_print_fp(stderr,c);
1867 fprintf(stderr,"\nd=");
1868 BN_print_fp(stderr,d);
1869 fprintf(stderr,"\n");
1870 return 0;
1871 }
1872 }
1873 BN_free(a);
1874 BN_free(b);
1875 BN_free(c);
1876 BN_free(d);
1877 return(1);
1878 }
1879
1880int test_lshift1(BIO *bp)
1881 {
1882 BIGNUM *a,*b,*c;
1883 int i;
1884
1885 a=BN_new();
1886 b=BN_new();
1887 c=BN_new();
1888
1889 BN_bntest_rand(a,200,0,0); /**/
1890 a->neg=rand_neg();
1891 for (i=0; i<num0; i++)
1892 {
1893 BN_lshift1(b,a);
1894 if (bp != NULL)
1895 {
1896 if (!results)
1897 {
1898 BN_print(bp,a);
1899 BIO_puts(bp," * 2");
1900 BIO_puts(bp," - ");
1901 }
1902 BN_print(bp,b);
1903 BIO_puts(bp,"\n");
1904 }
1905 BN_add(c,a,a);
1906 BN_sub(a,b,c);
1907 if(!BN_is_zero(a))
1908 {
1909 fprintf(stderr,"Left shift one test failed!\n");
1910 return 0;
1911 }
1912
1913 BN_copy(a,b);
1914 }
1915 BN_free(a);
1916 BN_free(b);
1917 BN_free(c);
1918 return(1);
1919 }
1920
1921int test_rshift(BIO *bp,BN_CTX *ctx)
1922 {
1923 BIGNUM *a,*b,*c,*d,*e;
1924 int i;
1925
1926 a=BN_new();
1927 b=BN_new();
1928 c=BN_new();
1929 d=BN_new();
1930 e=BN_new();
1931 BN_one(c);
1932
1933 BN_bntest_rand(a,200,0,0); /**/
1934 a->neg=rand_neg();
1935 for (i=0; i<num0; i++)
1936 {
1937 BN_rshift(b,a,i+1);
1938 BN_add(c,c,c);
1939 if (bp != NULL)
1940 {
1941 if (!results)
1942 {
1943 BN_print(bp,a);
1944 BIO_puts(bp," / ");
1945 BN_print(bp,c);
1946 BIO_puts(bp," - ");
1947 }
1948 BN_print(bp,b);
1949 BIO_puts(bp,"\n");
1950 }
1951 BN_div(d,e,a,c,ctx);
1952 BN_sub(d,d,b);
1953 if(!BN_is_zero(d))
1954 {
1955 fprintf(stderr,"Right shift test failed!\n");
1956 return 0;
1957 }
1958 }
1959 BN_free(a);
1960 BN_free(b);
1961 BN_free(c);
1962 BN_free(d);
1963 BN_free(e);
1964 return(1);
1965 }
1966
1967int test_rshift1(BIO *bp)
1968 {
1969 BIGNUM *a,*b,*c;
1970 int i;
1971
1972 a=BN_new();
1973 b=BN_new();
1974 c=BN_new();
1975
1976 BN_bntest_rand(a,200,0,0); /**/
1977 a->neg=rand_neg();
1978 for (i=0; i<num0; i++)
1979 {
1980 BN_rshift1(b,a);
1981 if (bp != NULL)
1982 {
1983 if (!results)
1984 {
1985 BN_print(bp,a);
1986 BIO_puts(bp," / 2");
1987 BIO_puts(bp," - ");
1988 }
1989 BN_print(bp,b);
1990 BIO_puts(bp,"\n");
1991 }
1992 BN_sub(c,a,b);
1993 BN_sub(c,c,b);
1994 if(!BN_is_zero(c) && !BN_abs_is_word(c, 1))
1995 {
1996 fprintf(stderr,"Right shift one test failed!\n");
1997 return 0;
1998 }
1999 BN_copy(a,b);
2000 }
2001 BN_free(a);
2002 BN_free(b);
2003 BN_free(c);
2004 return(1);
2005 }
2006
2007int rand_neg(void)
2008 {
2009 static unsigned int neg=0;
2010 static int sign[8]={0,0,0,1,1,0,1,1};
2011
2012 return(sign[(neg++)%8]);
2013 }
diff --git a/src/lib/libcrypto/bn/divtest.c b/src/lib/libcrypto/bn/divtest.c
new file mode 100644
index 0000000000..d3fc688f33
--- /dev/null
+++ b/src/lib/libcrypto/bn/divtest.c
@@ -0,0 +1,41 @@
1#include <openssl/bn.h>
2#include <openssl/rand.h>
3
4static int Rand(n)
5{
6 unsigned char x[2];
7 RAND_pseudo_bytes(x,2);
8 return (x[0] + 2*x[1]);
9}
10
11static void bug(char *m, BIGNUM *a, BIGNUM *b)
12{
13 printf("%s!\na=",m);
14 BN_print_fp(stdout, a);
15 printf("\nb=");
16 BN_print_fp(stdout, b);
17 printf("\n");
18 fflush(stdout);
19}
20
21main()
22{
23 BIGNUM *a=BN_new(), *b=BN_new(), *c=BN_new(), *d=BN_new(),
24 *C=BN_new(), *D=BN_new();
25 BN_RECP_CTX *recp=BN_RECP_CTX_new();
26 BN_CTX *ctx=BN_CTX_new();
27
28 for(;;) {
29 BN_pseudo_rand(a,Rand(),0,0);
30 BN_pseudo_rand(b,Rand(),0,0);
31 if (BN_is_zero(b)) continue;
32
33 BN_RECP_CTX_set(recp,b,ctx);
34 if (BN_div(C,D,a,b,ctx) != 1)
35 bug("BN_div failed",a,b);
36 if (BN_div_recp(c,d,a,recp,ctx) != 1)
37 bug("BN_div_recp failed",a,b);
38 else if (BN_cmp(c,C) != 0 || BN_cmp(c,C) != 0)
39 bug("mismatch",a,b);
40 }
41}
diff --git a/src/lib/libcrypto/bn/exp.c b/src/lib/libcrypto/bn/exp.c
new file mode 100644
index 0000000000..4865b0ef74
--- /dev/null
+++ b/src/lib/libcrypto/bn/exp.c
@@ -0,0 +1,62 @@
1/* unused */
2
3#include <stdio.h>
4#include <openssl/tmdiff.h>
5#include "bn_lcl.h"
6
7#define SIZE 256
8#define NUM (8*8*8)
9#define MOD (8*8*8*8*8)
10
11main(argc,argv)
12int argc;
13char *argv[];
14 {
15 BN_CTX ctx;
16 BIGNUM a,b,c,r,rr,t,l;
17 int j,i,size=SIZE,num=NUM,mod=MOD;
18 char *start,*end;
19 BN_MONT_CTX mont;
20 double d,md;
21
22 BN_MONT_CTX_init(&mont);
23 BN_CTX_init(&ctx);
24 BN_init(&a);
25 BN_init(&b);
26 BN_init(&c);
27 BN_init(&r);
28
29 start=ms_time_new();
30 end=ms_time_new();
31 while (size <= 1024*8)
32 {
33 BN_rand(&a,size,0,0);
34 BN_rand(&b,size,1,0);
35 BN_rand(&c,size,0,1);
36
37 BN_mod(&a,&a,&c,&ctx);
38
39 ms_time_get(start);
40 for (i=0; i<10; i++)
41 BN_MONT_CTX_set(&mont,&c,&ctx);
42 ms_time_get(end);
43 md=ms_time_diff(start,end);
44
45 ms_time_get(start);
46 for (i=0; i<num; i++)
47 {
48 /* bn_mull(&r,&a,&b,&ctx); */
49 /* BN_sqr(&r,&a,&ctx); */
50 BN_mod_exp_mont(&r,&a,&b,&c,&ctx,&mont);
51 }
52 ms_time_get(end);
53 d=ms_time_diff(start,end)/* *50/33 */;
54 printf("%5d bit:%6.2f %6d %6.4f %4d m_set(%5.4f)\n",size,
55 d,num,d/num,(int)((d/num)*mod),md/10.0);
56 num/=8;
57 mod/=8;
58 if (num <= 0) num=1;
59 size*=2;
60 }
61
62 }
diff --git a/src/lib/libcrypto/bn/expspeed.c b/src/lib/libcrypto/bn/expspeed.c
new file mode 100644
index 0000000000..4d5f221f33
--- /dev/null
+++ b/src/lib/libcrypto/bn/expspeed.c
@@ -0,0 +1,353 @@
1/* unused */
2
3/* crypto/bn/expspeed.c */
4/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
5 * All rights reserved.
6 *
7 * This package is an SSL implementation written
8 * by Eric Young (eay@cryptsoft.com).
9 * The implementation was written so as to conform with Netscapes SSL.
10 *
11 * This library is free for commercial and non-commercial use as long as
12 * the following conditions are aheared to. The following conditions
13 * apply to all code found in this distribution, be it the RC4, RSA,
14 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
15 * included with this distribution is covered by the same copyright terms
16 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
17 *
18 * Copyright remains Eric Young's, and as such any Copyright notices in
19 * the code are not to be removed.
20 * If this package is used in a product, Eric Young should be given attribution
21 * as the author of the parts of the library used.
22 * This can be in the form of a textual message at program startup or
23 * in documentation (online or textual) provided with the package.
24 *
25 * Redistribution and use in source and binary forms, with or without
26 * modification, are permitted provided that the following conditions
27 * are met:
28 * 1. Redistributions of source code must retain the copyright
29 * notice, this list of conditions and the following disclaimer.
30 * 2. Redistributions in binary form must reproduce the above copyright
31 * notice, this list of conditions and the following disclaimer in the
32 * documentation and/or other materials provided with the distribution.
33 * 3. All advertising materials mentioning features or use of this software
34 * must display the following acknowledgement:
35 * "This product includes cryptographic software written by
36 * Eric Young (eay@cryptsoft.com)"
37 * The word 'cryptographic' can be left out if the rouines from the library
38 * being used are not cryptographic related :-).
39 * 4. If you include any Windows specific code (or a derivative thereof) from
40 * the apps directory (application code) you must include an acknowledgement:
41 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
42 *
43 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
44 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
45 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
46 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
47 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
48 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
49 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
50 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
51 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
52 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
53 * SUCH DAMAGE.
54 *
55 * The licence and distribution terms for any publically available version or
56 * derivative of this code cannot be changed. i.e. this code cannot simply be
57 * copied and put under another distribution licence
58 * [including the GNU Public Licence.]
59 */
60
61/* most of this code has been pilfered from my libdes speed.c program */
62
63#define BASENUM 5000
64#define NUM_START 0
65
66
67/* determine timings for modexp, modmul, modsqr, gcd, Kronecker symbol,
68 * modular inverse, or modular square roots */
69#define TEST_EXP
70#undef TEST_MUL
71#undef TEST_SQR
72#undef TEST_GCD
73#undef TEST_KRON
74#undef TEST_INV
75#undef TEST_SQRT
76#define P_MOD_64 9 /* least significant 6 bits for prime to be used for BN_sqrt timings */
77
78#if defined(TEST_EXP) + defined(TEST_MUL) + defined(TEST_SQR) + defined(TEST_GCD) + defined(TEST_KRON) + defined(TEST_INV) +defined(TEST_SQRT) != 1
79# error "choose one test"
80#endif
81
82#if defined(TEST_INV) || defined(TEST_SQRT)
83# define C_PRIME
84static void genprime_cb(int p, int n, void *arg);
85#endif
86
87
88
89#undef PROG
90#define PROG bnspeed_main
91
92#include <stdio.h>
93#include <stdlib.h>
94#include <signal.h>
95#include <string.h>
96#include <openssl/crypto.h>
97#include <openssl/err.h>
98#include <openssl/rand.h>
99
100#if !defined(OPENSSL_SYS_MSDOS) && (!defined(OPENSSL_SYS_VMS) || defined(__DECC)) && !defined(OPENSSL_SYS_MACOSX)
101#define TIMES
102#endif
103
104#ifndef _IRIX
105#include <time.h>
106#endif
107#ifdef TIMES
108#include <sys/types.h>
109#include <sys/times.h>
110#endif
111
112/* Depending on the VMS version, the tms structure is perhaps defined.
113 The __TMS macro will show if it was. If it wasn't defined, we should
114 undefine TIMES, since that tells the rest of the program how things
115 should be handled. -- Richard Levitte */
116#if defined(OPENSSL_SYS_VMS_DECC) && !defined(__TMS)
117#undef TIMES
118#endif
119
120#ifndef TIMES
121#include <sys/timeb.h>
122#endif
123
124#if defined(sun) || defined(__ultrix)
125#define _POSIX_SOURCE
126#include <limits.h>
127#include <sys/param.h>
128#endif
129
130#include <openssl/bn.h>
131#include <openssl/x509.h>
132
133/* The following if from times(3) man page. It may need to be changed */
134#ifndef HZ
135# ifndef CLK_TCK
136# ifndef _BSD_CLK_TCK_ /* FreeBSD hack */
137# define HZ 100.0
138# else /* _BSD_CLK_TCK_ */
139# define HZ ((double)_BSD_CLK_TCK_)
140# endif
141# else /* CLK_TCK */
142# define HZ ((double)CLK_TCK)
143# endif
144#endif
145
146#undef BUFSIZE
147#define BUFSIZE ((long)1024*8)
148int run=0;
149
150static double Time_F(int s);
151#define START 0
152#define STOP 1
153
154static double Time_F(int s)
155 {
156 double ret;
157#ifdef TIMES
158 static struct tms tstart,tend;
159
160 if (s == START)
161 {
162 times(&tstart);
163 return(0);
164 }
165 else
166 {
167 times(&tend);
168 ret=((double)(tend.tms_utime-tstart.tms_utime))/HZ;
169 return((ret < 1e-3)?1e-3:ret);
170 }
171#else /* !times() */
172 static struct timeb tstart,tend;
173 long i;
174
175 if (s == START)
176 {
177 ftime(&tstart);
178 return(0);
179 }
180 else
181 {
182 ftime(&tend);
183 i=(long)tend.millitm-(long)tstart.millitm;
184 ret=((double)(tend.time-tstart.time))+((double)i)/1000.0;
185 return((ret < 0.001)?0.001:ret);
186 }
187#endif
188 }
189
190#define NUM_SIZES 7
191#if NUM_START > NUM_SIZES
192# error "NUM_START > NUM_SIZES"
193#endif
194static int sizes[NUM_SIZES]={128,256,512,1024,2048,4096,8192};
195static int mul_c[NUM_SIZES]={8*8*8*8*8*8,8*8*8*8*8,8*8*8*8,8*8*8,8*8,8,1};
196/*static int sizes[NUM_SIZES]={59,179,299,419,539}; */
197
198#define RAND_SEED(string) { const char str[] = string; RAND_seed(string, sizeof str); }
199
200void do_mul_exp(BIGNUM *r,BIGNUM *a,BIGNUM *b,BIGNUM *c,BN_CTX *ctx);
201
202int main(int argc, char **argv)
203 {
204 BN_CTX *ctx;
205 BIGNUM *a,*b,*c,*r;
206
207#if 1
208 if (!CRYPTO_set_mem_debug_functions(0,0,0,0,0))
209 abort();
210#endif
211
212 ctx=BN_CTX_new();
213 a=BN_new();
214 b=BN_new();
215 c=BN_new();
216 r=BN_new();
217
218 while (!RAND_status())
219 /* not enough bits */
220 RAND_SEED("I demand a manual recount!");
221
222 do_mul_exp(r,a,b,c,ctx);
223 return 0;
224 }
225
226void do_mul_exp(BIGNUM *r, BIGNUM *a, BIGNUM *b, BIGNUM *c, BN_CTX *ctx)
227 {
228 int i,k;
229 double tm;
230 long num;
231
232 num=BASENUM;
233 for (i=NUM_START; i<NUM_SIZES; i++)
234 {
235#ifdef C_PRIME
236# ifdef TEST_SQRT
237 if (!BN_set_word(a, 64)) goto err;
238 if (!BN_set_word(b, P_MOD_64)) goto err;
239# define ADD a
240# define REM b
241# else
242# define ADD NULL
243# define REM NULL
244# endif
245 if (!BN_generate_prime(c,sizes[i],0,ADD,REM,genprime_cb,NULL)) goto err;
246 putc('\n', stderr);
247 fflush(stderr);
248#endif
249
250 for (k=0; k<num; k++)
251 {
252 if (k%50 == 0) /* Average over num/50 different choices of random numbers. */
253 {
254 if (!BN_pseudo_rand(a,sizes[i],1,0)) goto err;
255
256 if (!BN_pseudo_rand(b,sizes[i],1,0)) goto err;
257
258#ifndef C_PRIME
259 if (!BN_pseudo_rand(c,sizes[i],1,1)) goto err;
260#endif
261
262#ifdef TEST_SQRT
263 if (!BN_mod_sqr(a,a,c,ctx)) goto err;
264 if (!BN_mod_sqr(b,b,c,ctx)) goto err;
265#else
266 if (!BN_nnmod(a,a,c,ctx)) goto err;
267 if (!BN_nnmod(b,b,c,ctx)) goto err;
268#endif
269
270 if (k == 0)
271 Time_F(START);
272 }
273
274#if defined(TEST_EXP)
275 if (!BN_mod_exp(r,a,b,c,ctx)) goto err;
276#elif defined(TEST_MUL)
277 {
278 int i = 0;
279 for (i = 0; i < 50; i++)
280 if (!BN_mod_mul(r,a,b,c,ctx)) goto err;
281 }
282#elif defined(TEST_SQR)
283 {
284 int i = 0;
285 for (i = 0; i < 50; i++)
286 {
287 if (!BN_mod_sqr(r,a,c,ctx)) goto err;
288 if (!BN_mod_sqr(r,b,c,ctx)) goto err;
289 }
290 }
291#elif defined(TEST_GCD)
292 if (!BN_gcd(r,a,b,ctx)) goto err;
293 if (!BN_gcd(r,b,c,ctx)) goto err;
294 if (!BN_gcd(r,c,a,ctx)) goto err;
295#elif defined(TEST_KRON)
296 if (-2 == BN_kronecker(a,b,ctx)) goto err;
297 if (-2 == BN_kronecker(b,c,ctx)) goto err;
298 if (-2 == BN_kronecker(c,a,ctx)) goto err;
299#elif defined(TEST_INV)
300 if (!BN_mod_inverse(r,a,c,ctx)) goto err;
301 if (!BN_mod_inverse(r,b,c,ctx)) goto err;
302#else /* TEST_SQRT */
303 if (!BN_mod_sqrt(r,a,c,ctx)) goto err;
304 if (!BN_mod_sqrt(r,b,c,ctx)) goto err;
305#endif
306 }
307 tm=Time_F(STOP);
308 printf(
309#if defined(TEST_EXP)
310 "modexp %4d ^ %4d %% %4d"
311#elif defined(TEST_MUL)
312 "50*modmul %4d %4d %4d"
313#elif defined(TEST_SQR)
314 "100*modsqr %4d %4d %4d"
315#elif defined(TEST_GCD)
316 "3*gcd %4d %4d %4d"
317#elif defined(TEST_KRON)
318 "3*kronecker %4d %4d %4d"
319#elif defined(TEST_INV)
320 "2*inv %4d %4d mod %4d"
321#else /* TEST_SQRT */
322 "2*sqrt [prime == %d (mod 64)] %4d %4d mod %4d"
323#endif
324 " -> %8.6fms %5.1f (%ld)\n",
325#ifdef TEST_SQRT
326 P_MOD_64,
327#endif
328 sizes[i],sizes[i],sizes[i],tm*1000.0/num,tm*mul_c[i]/num, num);
329 num/=7;
330 if (num <= 0) num=1;
331 }
332 return;
333
334 err:
335 ERR_print_errors_fp(stderr);
336 }
337
338
339#ifdef C_PRIME
340static void genprime_cb(int p, int n, void *arg)
341 {
342 char c='*';
343
344 if (p == 0) c='.';
345 if (p == 1) c='+';
346 if (p == 2) c='*';
347 if (p == 3) c='\n';
348 putc(c, stderr);
349 fflush(stderr);
350 (void)n;
351 (void)arg;
352 }
353#endif
diff --git a/src/lib/libcrypto/bn/exptest.c b/src/lib/libcrypto/bn/exptest.c
new file mode 100644
index 0000000000..074a8e882a
--- /dev/null
+++ b/src/lib/libcrypto/bn/exptest.c
@@ -0,0 +1,204 @@
1/* crypto/bn/exptest.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
59#include <stdio.h>
60#include <stdlib.h>
61#include <string.h>
62
63#include "../e_os.h"
64
65#include <openssl/bio.h>
66#include <openssl/bn.h>
67#include <openssl/rand.h>
68#include <openssl/err.h>
69
70#define NUM_BITS (BN_BITS*2)
71
72static const char rnd_seed[] = "string to make the random number generator think it has entropy";
73
74int main(int argc, char *argv[])
75 {
76 BN_CTX *ctx;
77 BIO *out=NULL;
78 int i,ret;
79 unsigned char c;
80 BIGNUM *r_mont,*r_mont_const,*r_recp,*r_simple,*a,*b,*m;
81
82 RAND_seed(rnd_seed, sizeof rnd_seed); /* or BN_rand may fail, and we don't
83 * even check its return value
84 * (which we should) */
85
86 ERR_load_BN_strings();
87
88 ctx=BN_CTX_new();
89 if (ctx == NULL) EXIT(1);
90 r_mont=BN_new();
91 r_mont_const=BN_new();
92 r_recp=BN_new();
93 r_simple=BN_new();
94 a=BN_new();
95 b=BN_new();
96 m=BN_new();
97 if ( (r_mont == NULL) || (r_recp == NULL) ||
98 (a == NULL) || (b == NULL))
99 goto err;
100
101 out=BIO_new(BIO_s_file());
102
103 if (out == NULL) EXIT(1);
104 BIO_set_fp(out,stdout,BIO_NOCLOSE);
105
106 for (i=0; i<200; i++)
107 {
108 RAND_bytes(&c,1);
109 c=(c%BN_BITS)-BN_BITS2;
110 BN_rand(a,NUM_BITS+c,0,0);
111
112 RAND_bytes(&c,1);
113 c=(c%BN_BITS)-BN_BITS2;
114 BN_rand(b,NUM_BITS+c,0,0);
115
116 RAND_bytes(&c,1);
117 c=(c%BN_BITS)-BN_BITS2;
118 BN_rand(m,NUM_BITS+c,0,1);
119
120 BN_mod(a,a,m,ctx);
121 BN_mod(b,b,m,ctx);
122
123 ret=BN_mod_exp_mont(r_mont,a,b,m,ctx,NULL);
124 if (ret <= 0)
125 {
126 printf("BN_mod_exp_mont() problems\n");
127 ERR_print_errors(out);
128 EXIT(1);
129 }
130
131 ret=BN_mod_exp_recp(r_recp,a,b,m,ctx);
132 if (ret <= 0)
133 {
134 printf("BN_mod_exp_recp() problems\n");
135 ERR_print_errors(out);
136 EXIT(1);
137 }
138
139 ret=BN_mod_exp_simple(r_simple,a,b,m,ctx);
140 if (ret <= 0)
141 {
142 printf("BN_mod_exp_simple() problems\n");
143 ERR_print_errors(out);
144 EXIT(1);
145 }
146
147 ret=BN_mod_exp_mont_consttime(r_mont_const,a,b,m,ctx,NULL);
148 if (ret <= 0)
149 {
150 printf("BN_mod_exp_mont_consttime() problems\n");
151 ERR_print_errors(out);
152 EXIT(1);
153 }
154
155 if (BN_cmp(r_simple, r_mont) == 0
156 && BN_cmp(r_simple,r_recp) == 0
157 && BN_cmp(r_simple,r_mont_const) == 0)
158 {
159 printf(".");
160 fflush(stdout);
161 }
162 else
163 {
164 if (BN_cmp(r_simple,r_mont) != 0)
165 printf("\nsimple and mont results differ\n");
166 if (BN_cmp(r_simple,r_mont_const) != 0)
167 printf("\nsimple and mont const time results differ\n");
168 if (BN_cmp(r_simple,r_recp) != 0)
169 printf("\nsimple and recp results differ\n");
170
171 printf("a (%3d) = ",BN_num_bits(a)); BN_print(out,a);
172 printf("\nb (%3d) = ",BN_num_bits(b)); BN_print(out,b);
173 printf("\nm (%3d) = ",BN_num_bits(m)); BN_print(out,m);
174 printf("\nsimple ="); BN_print(out,r_simple);
175 printf("\nrecp ="); BN_print(out,r_recp);
176 printf("\nmont ="); BN_print(out,r_mont);
177 printf("\nmont_ct ="); BN_print(out,r_mont_const);
178 printf("\n");
179 EXIT(1);
180 }
181 }
182 BN_free(r_mont);
183 BN_free(r_mont_const);
184 BN_free(r_recp);
185 BN_free(r_simple);
186 BN_free(a);
187 BN_free(b);
188 BN_free(m);
189 BN_CTX_free(ctx);
190 ERR_remove_thread_state(NULL);
191 CRYPTO_mem_leaks(out);
192 BIO_free(out);
193 printf(" done\n");
194 EXIT(0);
195err:
196 ERR_load_crypto_strings();
197 ERR_print_errors(out);
198#ifdef OPENSSL_SYS_NETWARE
199 printf("ERROR\n");
200#endif
201 EXIT(1);
202 return(1);
203 }
204
diff --git a/src/lib/libcrypto/bn/todo b/src/lib/libcrypto/bn/todo
new file mode 100644
index 0000000000..e47e381aea
--- /dev/null
+++ b/src/lib/libcrypto/bn/todo
@@ -0,0 +1,3 @@
1Cache RECP_CTX values
2make the result argument independant of the inputs.
3split up the _exp_ functions
diff --git a/src/lib/libcrypto/bn/vms-helper.c b/src/lib/libcrypto/bn/vms-helper.c
new file mode 100644
index 0000000000..4b63149bf3
--- /dev/null
+++ b/src/lib/libcrypto/bn/vms-helper.c
@@ -0,0 +1,68 @@
1/* vms-helper.c */
2/* ====================================================================
3 * Copyright (c) 1999 The OpenSSL Project. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 *
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in
14 * the documentation and/or other materials provided with the
15 * distribution.
16 *
17 * 3. All advertising materials mentioning features or use of this
18 * software must display the following acknowledgment:
19 * "This product includes software developed by the OpenSSL Project
20 * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
21 *
22 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
23 * endorse or promote products derived from this software without
24 * prior written permission. For written permission, please contact
25 * openssl-core@OpenSSL.org.
26 *
27 * 5. Products derived from this software may not be called "OpenSSL"
28 * nor may "OpenSSL" appear in their names without prior written
29 * permission of the OpenSSL Project.
30 *
31 * 6. Redistributions of any form whatsoever must retain the following
32 * acknowledgment:
33 * "This product includes software developed by the OpenSSL Project
34 * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
35 *
36 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
37 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
38 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
39 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
40 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
41 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
42 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
43 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
44 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
45 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
46 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
47 * OF THE POSSIBILITY OF SUCH DAMAGE.
48 * ====================================================================
49 *
50 * This product includes cryptographic software written by Eric Young
51 * (eay@cryptsoft.com). This product includes software written by Tim
52 * Hudson (tjh@cryptsoft.com).
53 *
54 */
55
56#include <stdio.h>
57#include "cryptlib.h"
58#include "bn_lcl.h"
59
60bn_div_words_abort(int i)
61{
62#ifdef BN_DEBUG
63#if !defined(OPENSSL_NO_STDIO) && !defined(OPENSSL_SYS_WIN16)
64 fprintf(stderr,"Division would overflow (%d)\n",i);
65#endif
66 abort();
67#endif
68}
diff --git a/src/lib/libcrypto/buffer/Makefile b/src/lib/libcrypto/buffer/Makefile
new file mode 100644
index 0000000000..2efba47f07
--- /dev/null
+++ b/src/lib/libcrypto/buffer/Makefile
@@ -0,0 +1,97 @@
1#
2# OpenSSL/crypto/buffer/Makefile
3#
4
5DIR= buffer
6TOP= ../..
7CC= cc
8INCLUDES= -I.. -I$(TOP) -I../../include
9CFLAG=-g
10MAKEFILE= Makefile
11AR= ar r
12
13CFLAGS= $(INCLUDES) $(CFLAG)
14
15GENERAL=Makefile
16TEST=
17APPS=
18
19LIB=$(TOP)/libcrypto.a
20LIBSRC= buffer.c buf_str.c buf_err.c
21LIBOBJ= buffer.o buf_str.o buf_err.o
22
23SRC= $(LIBSRC)
24
25EXHEADER= buffer.h
26HEADER= $(EXHEADER)
27
28ALL= $(GENERAL) $(SRC) $(HEADER)
29
30top:
31 (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all)
32
33all: lib
34
35lib: $(LIBOBJ)
36 $(AR) $(LIB) $(LIBOBJ)
37 $(RANLIB) $(LIB) || echo Never mind.
38 @touch lib
39
40files:
41 $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
42
43links:
44 @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
45 @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
46 @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
47
48install:
49 @[ -n "$(INSTALLTOP)" ] # should be set by top Makefile...
50 @headerlist="$(EXHEADER)"; for i in $$headerlist ; \
51 do \
52 (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
53 chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
54 done;
55
56tags:
57 ctags $(SRC)
58
59tests:
60
61lint:
62 lint -DLINT $(INCLUDES) $(SRC)>fluff
63
64depend:
65 @[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile...
66 $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
67
68dclean:
69 $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
70 mv -f Makefile.new $(MAKEFILE)
71
72clean:
73 rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
74
75# DO NOT DELETE THIS LINE -- make depend depends on it.
76
77buf_err.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
78buf_err.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
79buf_err.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
80buf_err.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
81buf_err.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
82buf_err.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
83buf_err.o: buf_err.c
84buf_str.o: ../../e_os.h ../../include/openssl/bio.h
85buf_str.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
86buf_str.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
87buf_str.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
88buf_str.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
89buf_str.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
90buf_str.o: ../../include/openssl/symhacks.h ../cryptlib.h buf_str.c
91buffer.o: ../../e_os.h ../../include/openssl/bio.h
92buffer.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
93buffer.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
94buffer.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
95buffer.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
96buffer.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
97buffer.o: ../../include/openssl/symhacks.h ../cryptlib.h buffer.c
diff --git a/src/lib/libcrypto/buffer/buffer.c b/src/lib/libcrypto/buffer/buffer.c
index d4a4ce43b3..d7aa79ad7f 100644
--- a/src/lib/libcrypto/buffer/buffer.c
+++ b/src/lib/libcrypto/buffer/buffer.c
@@ -179,14 +179,14 @@ int BUF_MEM_grow_clean(BUF_MEM *str, size_t len)
179 return(len); 179 return(len);
180 } 180 }
181 181
182void BUF_reverse(unsigned char *out, const unsigned char *in, size_t size) 182void BUF_reverse(unsigned char *out, unsigned char *in, size_t size)
183 { 183 {
184 size_t i; 184 size_t i;
185 if (in) 185 if (in)
186 { 186 {
187 out += size - 1; 187 out += size - 1;
188 for (i = 0; i < size; i++) 188 for (i = 0; i < size; i++)
189 *out-- = *in++; 189 *in++ = *out--;
190 } 190 }
191 else 191 else
192 { 192 {
diff --git a/src/lib/libcrypto/buffer/buffer.h b/src/lib/libcrypto/buffer/buffer.h
index f8da32b485..178e418282 100644
--- a/src/lib/libcrypto/buffer/buffer.h
+++ b/src/lib/libcrypto/buffer/buffer.h
@@ -88,7 +88,7 @@ int BUF_MEM_grow_clean(BUF_MEM *str, size_t len);
88char * BUF_strdup(const char *str); 88char * BUF_strdup(const char *str);
89char * BUF_strndup(const char *str, size_t siz); 89char * BUF_strndup(const char *str, size_t siz);
90void * BUF_memdup(const void *data, size_t siz); 90void * BUF_memdup(const void *data, size_t siz);
91void BUF_reverse(unsigned char *out, const unsigned char *in, size_t siz); 91void BUF_reverse(unsigned char *out, unsigned char *in, size_t siz);
92 92
93/* safe string functions */ 93/* safe string functions */
94size_t BUF_strlcpy(char *dst,const char *src,size_t siz); 94size_t BUF_strlcpy(char *dst,const char *src,size_t siz);
diff --git a/src/lib/libcrypto/buildinf.h b/src/lib/libcrypto/buildinf.h
new file mode 100644
index 0000000000..957f09d5fd
--- /dev/null
+++ b/src/lib/libcrypto/buildinf.h
@@ -0,0 +1,6 @@
1#ifndef MK1MF_BUILD
2 /* auto-generated by crypto/Makefile for crypto/cversion.c */
3 #define CFLAGS "cc -O"
4 #define PLATFORM "dist"
5 #define DATE "Sat Aug 21 10:52:09 EST 2010"
6#endif
diff --git a/src/lib/libcrypto/camellia/Makefile b/src/lib/libcrypto/camellia/Makefile
new file mode 100644
index 0000000000..6ce6fc99cd
--- /dev/null
+++ b/src/lib/libcrypto/camellia/Makefile
@@ -0,0 +1,110 @@
1#
2# crypto/camellia/Makefile
3#
4
5DIR= camellia
6TOP= ../..
7CC= cc
8CPP= $(CC) -E
9INCLUDES=
10CFLAG=-g
11MAKEFILE= Makefile
12AR= ar r
13
14CMLL_ENC= camellia.o cmll_misc.o cmll_cbc.o
15
16CFLAGS= $(INCLUDES) $(CFLAG)
17ASFLAGS= $(INCLUDES) $(ASFLAG)
18AFLAGS= $(ASFLAGS)
19
20GENERAL=Makefile
21#TEST=camelliatest.c
22APPS=
23
24LIB=$(TOP)/libcrypto.a
25LIBSRC=camellia.c cmll_misc.c cmll_ecb.c cmll_cbc.c cmll_ofb.c \
26 cmll_cfb.c cmll_ctr.c cmll_utl.c
27
28LIBOBJ= cmll_ecb.o cmll_ofb.o cmll_cfb.o cmll_ctr.o cmll_utl.o $(CMLL_ENC)
29
30SRC= $(LIBSRC)
31
32EXHEADER= camellia.h
33HEADER= cmll_locl.h $(EXHEADER)
34
35ALL= $(GENERAL) $(SRC) $(HEADER)
36
37top:
38 (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all)
39
40all: lib
41
42lib: $(LIBOBJ)
43 $(AR) $(LIB) $(LIBOBJ)
44 $(RANLIB) $(LIB) || echo Never mind.
45 @touch lib
46
47cmll-x86.s: asm/cmll-x86.pl ../perlasm/x86asm.pl
48 $(PERL) asm/cmll-x86.pl $(PERLASM_SCHEME) $(CFLAGS) $(PROCESSOR) > $@
49cmll-x86_64.s: asm/cmll-x86_64.pl
50 $(PERL) asm/cmll-x86_64.pl $(PERLASM_SCHEME) > $@
51
52files:
53 $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
54
55links:
56 @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
57 @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
58 @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
59
60install:
61 @[ -n "$(INSTALLTOP)" ] # should be set by top Makefile...
62 @headerlist="$(EXHEADER)"; for i in $$headerlist ; \
63 do \
64 (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
65 chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
66 done;
67
68tags:
69 ctags $(SRC)
70
71tests:
72
73lint:
74 lint -DLINT $(INCLUDES) $(SRC)>fluff
75
76depend:
77 @[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile...
78 $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
79
80dclean:
81 $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
82 mv -f Makefile.new $(MAKEFILE)
83
84clean:
85 rm -f *.s *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
86
87# DO NOT DELETE THIS LINE -- make depend depends on it.
88
89camellia.o: ../../include/openssl/opensslconf.h camellia.c camellia.h
90camellia.o: cmll_locl.h
91cmll_cbc.o: ../../include/openssl/camellia.h ../../include/openssl/modes.h
92cmll_cbc.o: ../../include/openssl/opensslconf.h cmll_cbc.c
93cmll_cfb.o: ../../include/openssl/camellia.h ../../include/openssl/modes.h
94cmll_cfb.o: ../../include/openssl/opensslconf.h cmll_cfb.c
95cmll_ctr.o: ../../include/openssl/camellia.h ../../include/openssl/modes.h
96cmll_ctr.o: ../../include/openssl/opensslconf.h cmll_ctr.c
97cmll_ecb.o: ../../include/openssl/camellia.h
98cmll_ecb.o: ../../include/openssl/opensslconf.h cmll_ecb.c cmll_locl.h
99cmll_misc.o: ../../include/openssl/camellia.h ../../include/openssl/crypto.h
100cmll_misc.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslconf.h
101cmll_misc.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
102cmll_misc.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
103cmll_misc.o: ../../include/openssl/symhacks.h cmll_locl.h cmll_misc.c
104cmll_ofb.o: ../../include/openssl/camellia.h ../../include/openssl/modes.h
105cmll_ofb.o: ../../include/openssl/opensslconf.h cmll_ofb.c
106cmll_utl.o: ../../include/openssl/camellia.h ../../include/openssl/crypto.h
107cmll_utl.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslconf.h
108cmll_utl.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
109cmll_utl.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
110cmll_utl.o: ../../include/openssl/symhacks.h cmll_locl.h cmll_utl.c
diff --git a/src/lib/libcrypto/camellia/cmll_utl.c b/src/lib/libcrypto/camellia/cmll_utl.c
new file mode 100644
index 0000000000..7a35711ec1
--- /dev/null
+++ b/src/lib/libcrypto/camellia/cmll_utl.c
@@ -0,0 +1,64 @@
1/* crypto/camellia/cmll_utl.c -*- mode:C; c-file-style: "eay" -*- */
2/* ====================================================================
3 * Copyright (c) 2011 The OpenSSL Project. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 *
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in
14 * the documentation and/or other materials provided with the
15 * distribution.
16 *
17 * 3. All advertising materials mentioning features or use of this
18 * software must display the following acknowledgment:
19 * "This product includes software developed by the OpenSSL Project
20 * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
21 *
22 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
23 * endorse or promote products derived from this software without
24 * prior written permission. For written permission, please contact
25 * openssl-core@openssl.org.
26 *
27 * 5. Products derived from this software may not be called "OpenSSL"
28 * nor may "OpenSSL" appear in their names without prior written
29 * permission of the OpenSSL Project.
30 *
31 * 6. Redistributions of any form whatsoever must retain the following
32 * acknowledgment:
33 * "This product includes software developed by the OpenSSL Project
34 * for use in the OpenSSL Toolkit (http://www.openssl.org/)"
35 *
36 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
37 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
38 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
39 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
40 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
41 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
42 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
43 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
44 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
45 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
46 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
47 * OF THE POSSIBILITY OF SUCH DAMAGE.
48 * ====================================================================
49 *
50 */
51
52#include <openssl/opensslv.h>
53#include <openssl/crypto.h>
54#include <openssl/camellia.h>
55#include "cmll_locl.h"
56
57int Camellia_set_key(const unsigned char *userKey, const int bits,
58 CAMELLIA_KEY *key)
59 {
60#ifdef OPENSSL_FIPS
61 fips_cipher_abort(Camellia);
62#endif
63 return private_Camellia_set_key(userKey, bits, key);
64 }
diff --git a/src/lib/libcrypto/cast/Makefile b/src/lib/libcrypto/cast/Makefile
new file mode 100644
index 0000000000..f3f4859886
--- /dev/null
+++ b/src/lib/libcrypto/cast/Makefile
@@ -0,0 +1,102 @@
1#
2# OpenSSL/crypto/cast/Makefile
3#
4
5DIR= cast
6TOP= ../..
7CC= cc
8CPP= $(CC) -E
9INCLUDES=
10CFLAG=-g
11MAKEFILE= Makefile
12AR= ar r
13
14CAST_ENC=c_enc.o
15
16CFLAGS= $(INCLUDES) $(CFLAG)
17ASFLAGS= $(INCLUDES) $(ASFLAG)
18AFLAGS= $(ASFLAGS)
19
20GENERAL=Makefile
21TEST=casttest.c
22APPS=
23
24LIB=$(TOP)/libcrypto.a
25LIBSRC=c_skey.c c_ecb.c c_enc.c c_cfb64.c c_ofb64.c
26LIBOBJ=c_skey.o c_ecb.o $(CAST_ENC) c_cfb64.o c_ofb64.o
27
28SRC= $(LIBSRC)
29
30EXHEADER= cast.h
31HEADER= cast_s.h cast_lcl.h $(EXHEADER)
32
33ALL= $(GENERAL) $(SRC) $(HEADER)
34
35top:
36 (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all)
37
38all: lib
39
40lib: $(LIBOBJ)
41 $(AR) $(LIB) $(LIBOBJ)
42 $(RANLIB) $(LIB) || echo Never mind.
43 @touch lib
44
45cast-586.s: asm/cast-586.pl ../perlasm/x86asm.pl ../perlasm/cbc.pl
46 $(PERL) asm/cast-586.pl $(PERLASM_SCHEME) $(CLAGS) $(PROCESSOR) > $@
47
48files:
49 $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
50
51links:
52 @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
53 @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
54 @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
55
56install:
57 @[ -n "$(INSTALLTOP)" ] # should be set by top Makefile...
58 @headerlist="$(EXHEADER)"; for i in $$headerlist ; \
59 do \
60 (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
61 chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
62 done;
63
64tags:
65 ctags $(SRC)
66
67tests:
68
69lint:
70 lint -DLINT $(INCLUDES) $(SRC)>fluff
71
72depend:
73 @[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile...
74 $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
75
76dclean:
77 $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
78 mv -f Makefile.new $(MAKEFILE)
79
80clean:
81 rm -f *.s *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
82
83# DO NOT DELETE THIS LINE -- make depend depends on it.
84
85c_cfb64.o: ../../e_os.h ../../include/openssl/cast.h
86c_cfb64.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslconf.h
87c_cfb64.o: c_cfb64.c cast_lcl.h
88c_ecb.o: ../../e_os.h ../../include/openssl/cast.h
89c_ecb.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslconf.h
90c_ecb.o: ../../include/openssl/opensslv.h c_ecb.c cast_lcl.h
91c_enc.o: ../../e_os.h ../../include/openssl/cast.h
92c_enc.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslconf.h
93c_enc.o: c_enc.c cast_lcl.h
94c_ofb64.o: ../../e_os.h ../../include/openssl/cast.h
95c_ofb64.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslconf.h
96c_ofb64.o: c_ofb64.c cast_lcl.h
97c_skey.o: ../../e_os.h ../../include/openssl/cast.h
98c_skey.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
99c_skey.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
100c_skey.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
101c_skey.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
102c_skey.o: c_skey.c cast_lcl.h cast_s.h
diff --git a/src/lib/libcrypto/cast/asm/cast-586.pl b/src/lib/libcrypto/cast/asm/cast-586.pl
index bf6810d335..7a0083ecb8 100644
--- a/src/lib/libcrypto/cast/asm/cast-586.pl
+++ b/src/lib/libcrypto/cast/asm/cast-586.pl
@@ -29,7 +29,7 @@ $S4="CAST_S_table3";
29 29
30&CAST_encrypt("CAST_encrypt",1); 30&CAST_encrypt("CAST_encrypt",1);
31&CAST_encrypt("CAST_decrypt",0); 31&CAST_encrypt("CAST_decrypt",0);
32&cbc("CAST_cbc_encrypt","CAST_encrypt","CAST_decrypt",1,4,5,3,-1,-1); 32&cbc("CAST_cbc_encrypt","CAST_encrypt","CAST_decrypt",1,4,5,3,-1,-1) unless $main'openbsd;
33 33
34&asm_finish(); 34&asm_finish();
35 35
diff --git a/src/lib/libcrypto/cast/asm/readme b/src/lib/libcrypto/cast/asm/readme
new file mode 100644
index 0000000000..fbcd76289e
--- /dev/null
+++ b/src/lib/libcrypto/cast/asm/readme
@@ -0,0 +1,7 @@
1There is a ppro flag in cast-586 which turns on/off
2generation of pentium pro/II friendly code
3
4This flag makes the inner loop one cycle longer, but generates
5code that runs %30 faster on the pentium pro/II, while only %7 slower
6on the pentium. By default, this flag is on.
7
diff --git a/src/lib/libcrypto/cast/c_enc.c b/src/lib/libcrypto/cast/c_enc.c
index 357c41ebf0..2ae54f5cfb 100644
--- a/src/lib/libcrypto/cast/c_enc.c
+++ b/src/lib/libcrypto/cast/c_enc.c
@@ -59,6 +59,7 @@
59#include <openssl/cast.h> 59#include <openssl/cast.h>
60#include "cast_lcl.h" 60#include "cast_lcl.h"
61 61
62#ifndef OPENBSD_CAST_ASM
62void CAST_encrypt(CAST_LONG *data, const CAST_KEY *key) 63void CAST_encrypt(CAST_LONG *data, const CAST_KEY *key)
63 { 64 {
64 register CAST_LONG l,r,t; 65 register CAST_LONG l,r,t;
@@ -124,6 +125,7 @@ void CAST_decrypt(CAST_LONG *data, const CAST_KEY *key)
124 data[1]=l&0xffffffffL; 125 data[1]=l&0xffffffffL;
125 data[0]=r&0xffffffffL; 126 data[0]=r&0xffffffffL;
126 } 127 }
128#endif
127 129
128void CAST_cbc_encrypt(const unsigned char *in, unsigned char *out, long length, 130void CAST_cbc_encrypt(const unsigned char *in, unsigned char *out, long length,
129 const CAST_KEY *ks, unsigned char *iv, int enc) 131 const CAST_KEY *ks, unsigned char *iv, int enc)
diff --git a/src/lib/libcrypto/cast/cast_spd.c b/src/lib/libcrypto/cast/cast_spd.c
new file mode 100644
index 0000000000..d650af475c
--- /dev/null
+++ b/src/lib/libcrypto/cast/cast_spd.c
@@ -0,0 +1,278 @@
1/* crypto/cast/cast_spd.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
59/* 11-Sep-92 Andrew Daviel Support for Silicon Graphics IRIX added */
60/* 06-Apr-92 Luke Brennan Support for VMS and add extra signal calls */
61
62#if !defined(OPENSSL_SYS_MSDOS) && (!defined(OPENSSL_SYS_VMS) || defined(__DECC)) && !defined(OPENSSL_SYS_MACOSX)
63#define TIMES
64#endif
65
66#include <stdio.h>
67
68#include <openssl/e_os2.h>
69#include OPENSSL_UNISTD_IO
70OPENSSL_DECLARE_EXIT
71
72#ifndef OPENSSL_SYS_NETWARE
73#include <signal.h>
74#endif
75
76#ifndef _IRIX
77#include <time.h>
78#endif
79#ifdef TIMES
80#include <sys/types.h>
81#include <sys/times.h>
82#endif
83
84/* Depending on the VMS version, the tms structure is perhaps defined.
85 The __TMS macro will show if it was. If it wasn't defined, we should
86 undefine TIMES, since that tells the rest of the program how things
87 should be handled. -- Richard Levitte */
88#if defined(OPENSSL_SYS_VMS_DECC) && !defined(__TMS)
89#undef TIMES
90#endif
91
92#ifndef TIMES
93#include <sys/timeb.h>
94#endif
95
96#if defined(sun) || defined(__ultrix)
97#define _POSIX_SOURCE
98#include <limits.h>
99#include <sys/param.h>
100#endif
101
102#include <openssl/cast.h>
103
104/* The following if from times(3) man page. It may need to be changed */
105#ifndef HZ
106#ifndef CLK_TCK
107#define HZ 100.0
108#else /* CLK_TCK */
109#define HZ ((double)CLK_TCK)
110#endif
111#endif
112
113#define BUFSIZE ((long)1024)
114long run=0;
115
116double Time_F(int s);
117#ifdef SIGALRM
118#if defined(__STDC__) || defined(sgi) || defined(_AIX)
119#define SIGRETTYPE void
120#else
121#define SIGRETTYPE int
122#endif
123
124SIGRETTYPE sig_done(int sig);
125SIGRETTYPE sig_done(int sig)
126 {
127 signal(SIGALRM,sig_done);
128 run=0;
129#ifdef LINT
130 sig=sig;
131#endif
132 }
133#endif
134
135#define START 0
136#define STOP 1
137
138double Time_F(int s)
139 {
140 double ret;
141#ifdef TIMES
142 static struct tms tstart,tend;
143
144 if (s == START)
145 {
146 times(&tstart);
147 return(0);
148 }
149 else
150 {
151 times(&tend);
152 ret=((double)(tend.tms_utime-tstart.tms_utime))/HZ;
153 return((ret == 0.0)?1e-6:ret);
154 }
155#else /* !times() */
156 static struct timeb tstart,tend;
157 long i;
158
159 if (s == START)
160 {
161 ftime(&tstart);
162 return(0);
163 }
164 else
165 {
166 ftime(&tend);
167 i=(long)tend.millitm-(long)tstart.millitm;
168 ret=((double)(tend.time-tstart.time))+((double)i)/1e3;
169 return((ret == 0.0)?1e-6:ret);
170 }
171#endif
172 }
173
174int main(int argc, char **argv)
175 {
176 long count;
177 static unsigned char buf[BUFSIZE];
178 static unsigned char key[] ={
179 0x12,0x34,0x56,0x78,0x9a,0xbc,0xde,0xf0,
180 0xfe,0xdc,0xba,0x98,0x76,0x54,0x32,0x10,
181 };
182 CAST_KEY sch;
183 double a,b,c,d;
184#ifndef SIGALRM
185 long ca,cb,cc;
186#endif
187
188#ifndef TIMES
189 printf("To get the most accurate results, try to run this\n");
190 printf("program when this computer is idle.\n");
191#endif
192
193#ifndef SIGALRM
194 printf("First we calculate the approximate speed ...\n");
195 CAST_set_key(&sch,16,key);
196 count=10;
197 do {
198 long i;
199 CAST_LONG data[2];
200
201 count*=2;
202 Time_F(START);
203 for (i=count; i; i--)
204 CAST_encrypt(data,&sch);
205 d=Time_F(STOP);
206 } while (d < 3.0);
207 ca=count/512;
208 cb=count;
209 cc=count*8/BUFSIZE+1;
210 printf("Doing CAST_set_key %ld times\n",ca);
211#define COND(d) (count != (d))
212#define COUNT(d) (d)
213#else
214#define COND(c) (run)
215#define COUNT(d) (count)
216 signal(SIGALRM,sig_done);
217 printf("Doing CAST_set_key for 10 seconds\n");
218 alarm(10);
219#endif
220
221 Time_F(START);
222 for (count=0,run=1; COND(ca); count+=4)
223 {
224 CAST_set_key(&sch,16,key);
225 CAST_set_key(&sch,16,key);
226 CAST_set_key(&sch,16,key);
227 CAST_set_key(&sch,16,key);
228 }
229 d=Time_F(STOP);
230 printf("%ld cast set_key's in %.2f seconds\n",count,d);
231 a=((double)COUNT(ca))/d;
232
233#ifdef SIGALRM
234 printf("Doing CAST_encrypt's for 10 seconds\n");
235 alarm(10);
236#else
237 printf("Doing CAST_encrypt %ld times\n",cb);
238#endif
239 Time_F(START);
240 for (count=0,run=1; COND(cb); count+=4)
241 {
242 CAST_LONG data[2];
243
244 CAST_encrypt(data,&sch);
245 CAST_encrypt(data,&sch);
246 CAST_encrypt(data,&sch);
247 CAST_encrypt(data,&sch);
248 }
249 d=Time_F(STOP);
250 printf("%ld CAST_encrypt's in %.2f second\n",count,d);
251 b=((double)COUNT(cb)*8)/d;
252
253#ifdef SIGALRM
254 printf("Doing CAST_cbc_encrypt on %ld byte blocks for 10 seconds\n",
255 BUFSIZE);
256 alarm(10);
257#else
258 printf("Doing CAST_cbc_encrypt %ld times on %ld byte blocks\n",cc,
259 BUFSIZE);
260#endif
261 Time_F(START);
262 for (count=0,run=1; COND(cc); count++)
263 CAST_cbc_encrypt(buf,buf,BUFSIZE,&sch,
264 &(key[0]),CAST_ENCRYPT);
265 d=Time_F(STOP);
266 printf("%ld CAST_cbc_encrypt's of %ld byte blocks in %.2f second\n",
267 count,BUFSIZE,d);
268 c=((double)COUNT(cc)*BUFSIZE)/d;
269
270 printf("CAST set_key per sec = %12.2f (%9.3fuS)\n",a,1.0e6/a);
271 printf("CAST raw ecb bytes per sec = %12.2f (%9.3fuS)\n",b,8.0e6/b);
272 printf("CAST cbc bytes per sec = %12.2f (%9.3fuS)\n",c,8.0e6/c);
273 exit(0);
274#if defined(LINT) || defined(OPENSSL_SYS_MSDOS)
275 return(0);
276#endif
277 }
278
diff --git a/src/lib/libcrypto/cast/castopts.c b/src/lib/libcrypto/cast/castopts.c
new file mode 100644
index 0000000000..33b2c7b06f
--- /dev/null
+++ b/src/lib/libcrypto/cast/castopts.c
@@ -0,0 +1,342 @@
1/* crypto/cast/castopts.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
59/* define PART1, PART2, PART3 or PART4 to build only with a few of the options.
60 * This is for machines with 64k code segment size restrictions. */
61
62#if !defined(OPENSSL_SYS_MSDOS) && (!defined(OPENSSL_SYS_VMS) || defined(__DECC))
63#define TIMES
64#endif
65
66#include <stdio.h>
67
68#include <openssl/e_os2.h>
69#include OPENSSL_UNISTD_IO
70OPENSSL_DECLARE_EXIT
71
72#ifndef OPENSSL_SYS_NETWARE
73#include <signal.h>
74#endif
75
76#ifndef _IRIX
77#include <time.h>
78#endif
79#ifdef TIMES
80#include <sys/types.h>
81#include <sys/times.h>
82#endif
83
84/* Depending on the VMS version, the tms structure is perhaps defined.
85 The __TMS macro will show if it was. If it wasn't defined, we should
86 undefine TIMES, since that tells the rest of the program how things
87 should be handled. -- Richard Levitte */
88#if defined(OPENSSL_SYS_VMS_DECC) && !defined(__TMS)
89#undef TIMES
90#endif
91
92#ifndef TIMES
93#include <sys/timeb.h>
94#endif
95
96#if defined(sun) || defined(__ultrix)
97#define _POSIX_SOURCE
98#include <limits.h>
99#include <sys/param.h>
100#endif
101
102#include <openssl/cast.h>
103
104#define CAST_DEFAULT_OPTIONS
105
106#undef E_CAST
107#define CAST_encrypt CAST_encrypt_normal
108#define CAST_decrypt CAST_decrypt_normal
109#define CAST_cbc_encrypt CAST_cbc_encrypt_normal
110#undef HEADER_CAST_LOCL_H
111#include "c_enc.c"
112
113#define CAST_PTR
114#undef CAST_PTR2
115#undef E_CAST
116#undef CAST_encrypt
117#undef CAST_decrypt
118#undef CAST_cbc_encrypt
119#define CAST_encrypt CAST_encrypt_ptr
120#define CAST_decrypt CAST_decrypt_ptr
121#define CAST_cbc_encrypt CAST_cbc_encrypt_ptr
122#undef HEADER_CAST_LOCL_H
123#include "c_enc.c"
124
125#undef CAST_PTR
126#define CAST_PTR2
127#undef E_CAST
128#undef CAST_encrypt
129#undef CAST_decrypt
130#undef CAST_cbc_encrypt
131#define CAST_encrypt CAST_encrypt_ptr2
132#define CAST_decrypt CAST_decrypt_ptr2
133#define CAST_cbc_encrypt CAST_cbc_encrypt_ptr2
134#undef HEADER_CAST_LOCL_H
135#include "c_enc.c"
136
137/* The following if from times(3) man page. It may need to be changed */
138#ifndef HZ
139# ifndef CLK_TCK
140# ifndef _BSD_CLK_TCK_ /* FreeBSD fix */
141# define HZ 100.0
142# else /* _BSD_CLK_TCK_ */
143# define HZ ((double)_BSD_CLK_TCK_)
144# endif
145# else /* CLK_TCK */
146# define HZ ((double)CLK_TCK)
147# endif
148#endif
149
150#define BUFSIZE ((long)1024)
151long run=0;
152
153double Time_F(int s);
154#ifdef SIGALRM
155#if defined(__STDC__) || defined(sgi)
156#define SIGRETTYPE void
157#else
158#define SIGRETTYPE int
159#endif
160
161SIGRETTYPE sig_done(int sig);
162SIGRETTYPE sig_done(int sig)
163 {
164 signal(SIGALRM,sig_done);
165 run=0;
166#ifdef LINT
167 sig=sig;
168#endif
169 }
170#endif
171
172#define START 0
173#define STOP 1
174
175double Time_F(int s)
176 {
177 double ret;
178#ifdef TIMES
179 static struct tms tstart,tend;
180
181 if (s == START)
182 {
183 times(&tstart);
184 return(0);
185 }
186 else
187 {
188 times(&tend);
189 ret=((double)(tend.tms_utime-tstart.tms_utime))/HZ;
190 return((ret == 0.0)?1e-6:ret);
191 }
192#else /* !times() */
193 static struct timeb tstart,tend;
194 long i;
195
196 if (s == START)
197 {
198 ftime(&tstart);
199 return(0);
200 }
201 else
202 {
203 ftime(&tend);
204 i=(long)tend.millitm-(long)tstart.millitm;
205 ret=((double)(tend.time-tstart.time))+((double)i)/1000.0;
206 return((ret == 0.0)?1e-6:ret);
207 }
208#endif
209 }
210
211#ifdef SIGALRM
212#define print_name(name) fprintf(stderr,"Doing %s's for 10 seconds\n",name); alarm(10);
213#else
214#define print_name(name) fprintf(stderr,"Doing %s %ld times\n",name,cb);
215#endif
216
217#define time_it(func,name,index) \
218 print_name(name); \
219 Time_F(START); \
220 for (count=0,run=1; COND(cb); count+=4) \
221 { \
222 unsigned long d[2]; \
223 func(d,&sch); \
224 func(d,&sch); \
225 func(d,&sch); \
226 func(d,&sch); \
227 } \
228 tm[index]=Time_F(STOP); \
229 fprintf(stderr,"%ld %s's in %.2f second\n",count,name,tm[index]); \
230 tm[index]=((double)COUNT(cb))/tm[index];
231
232#define print_it(name,index) \
233 fprintf(stderr,"%s bytes per sec = %12.2f (%5.1fuS)\n",name, \
234 tm[index]*8,1.0e6/tm[index]);
235
236int main(int argc, char **argv)
237 {
238 long count;
239 static unsigned char buf[BUFSIZE];
240 static char key[16]={ 0x12,0x34,0x56,0x78,0x9a,0xbc,0xde,0xf0,
241 0x12,0x34,0x56,0x78,0x9a,0xbc,0xde,0xf0};
242 CAST_KEY sch;
243 double d,tm[16],max=0;
244 int rank[16];
245 char *str[16];
246 int max_idx=0,i,num=0,j;
247#ifndef SIGALARM
248 long ca,cb,cc,cd,ce;
249#endif
250
251 for (i=0; i<12; i++)
252 {
253 tm[i]=0.0;
254 rank[i]=0;
255 }
256
257#ifndef TIMES
258 fprintf(stderr,"To get the most accurate results, try to run this\n");
259 fprintf(stderr,"program when this computer is idle.\n");
260#endif
261
262 CAST_set_key(&sch,16,key);
263
264#ifndef SIGALRM
265 fprintf(stderr,"First we calculate the approximate speed ...\n");
266 count=10;
267 do {
268 long i;
269 unsigned long data[2];
270
271 count*=2;
272 Time_F(START);
273 for (i=count; i; i--)
274 CAST_encrypt(data,&sch);
275 d=Time_F(STOP);
276 } while (d < 3.0);
277 ca=count;
278 cb=count*3;
279 cc=count*3*8/BUFSIZE+1;
280 cd=count*8/BUFSIZE+1;
281
282 ce=count/20+1;
283#define COND(d) (count != (d))
284#define COUNT(d) (d)
285#else
286#define COND(c) (run)
287#define COUNT(d) (count)
288 signal(SIGALRM,sig_done);
289 alarm(10);
290#endif
291
292 time_it(CAST_encrypt_normal, "CAST_encrypt_normal ", 0);
293 time_it(CAST_encrypt_ptr, "CAST_encrypt_ptr ", 1);
294 time_it(CAST_encrypt_ptr2, "CAST_encrypt_ptr2 ", 2);
295 num+=3;
296
297 str[0]="<nothing>";
298 print_it("CAST_encrypt_normal ",0);
299 max=tm[0];
300 max_idx=0;
301 str[1]="ptr ";
302 print_it("CAST_encrypt_ptr ",1);
303 if (max < tm[1]) { max=tm[1]; max_idx=1; }
304 str[2]="ptr2 ";
305 print_it("CAST_encrypt_ptr2 ",2);
306 if (max < tm[2]) { max=tm[2]; max_idx=2; }
307
308 printf("options CAST ecb/s\n");
309 printf("%s %12.2f 100.0%%\n",str[max_idx],tm[max_idx]);
310 d=tm[max_idx];
311 tm[max_idx]= -2.0;
312 max= -1.0;
313 for (;;)
314 {
315 for (i=0; i<3; i++)
316 {
317 if (max < tm[i]) { max=tm[i]; j=i; }
318 }
319 if (max < 0.0) break;
320 printf("%s %12.2f %4.1f%%\n",str[j],tm[j],tm[j]/d*100.0);
321 tm[j]= -2.0;
322 max= -1.0;
323 }
324
325 switch (max_idx)
326 {
327 case 0:
328 printf("-DCAST_DEFAULT_OPTIONS\n");
329 break;
330 case 1:
331 printf("-DCAST_PTR\n");
332 break;
333 case 2:
334 printf("-DCAST_PTR2\n");
335 break;
336 }
337 exit(0);
338#if defined(LINT) || defined(OPENSSL_SYS_MSDOS)
339 return(0);
340#endif
341 }
342
diff --git a/src/lib/libcrypto/cast/casts.cpp b/src/lib/libcrypto/cast/casts.cpp
new file mode 100644
index 0000000000..8d7bd468d2
--- /dev/null
+++ b/src/lib/libcrypto/cast/casts.cpp
@@ -0,0 +1,70 @@
1//
2// gettsc.inl
3//
4// gives access to the Pentium's (secret) cycle counter
5//
6// This software was written by Leonard Janke (janke@unixg.ubc.ca)
7// in 1996-7 and is entered, by him, into the public domain.
8
9#if defined(__WATCOMC__)
10void GetTSC(unsigned long&);
11#pragma aux GetTSC = 0x0f 0x31 "mov [edi], eax" parm [edi] modify [edx eax];
12#elif defined(__GNUC__)
13inline
14void GetTSC(unsigned long& tsc)
15{
16 asm volatile(".byte 15, 49\n\t"
17 : "=eax" (tsc)
18 :
19 : "%edx", "%eax");
20}
21#elif defined(_MSC_VER)
22inline
23void GetTSC(unsigned long& tsc)
24{
25 unsigned long a;
26 __asm _emit 0fh
27 __asm _emit 31h
28 __asm mov a, eax;
29 tsc=a;
30}
31#endif
32
33#include <stdio.h>
34#include <stdlib.h>
35#include <openssl/cast.h>
36
37void main(int argc,char *argv[])
38 {
39 CAST_KEY key;
40 unsigned long s1,s2,e1,e2;
41 unsigned long data[2];
42 int i,j;
43 static unsigned char d[16]={0x01,0x23,0x45,0x67,0x89,0xAB,0xCD,0xEF};
44
45 CAST_set_key(&key, 16,d);
46
47 for (j=0; j<6; j++)
48 {
49 for (i=0; i<1000; i++) /**/
50 {
51 CAST_encrypt(&data[0],&key);
52 GetTSC(s1);
53 CAST_encrypt(&data[0],&key);
54 CAST_encrypt(&data[0],&key);
55 CAST_encrypt(&data[0],&key);
56 GetTSC(e1);
57 GetTSC(s2);
58 CAST_encrypt(&data[0],&key);
59 CAST_encrypt(&data[0],&key);
60 CAST_encrypt(&data[0],&key);
61 CAST_encrypt(&data[0],&key);
62 GetTSC(e2);
63 CAST_encrypt(&data[0],&key);
64 }
65
66 printf("cast %d %d (%d)\n",
67 e1-s1,e2-s2,((e2-s2)-(e1-s1)));
68 }
69 }
70
diff --git a/src/lib/libcrypto/cast/casttest.c b/src/lib/libcrypto/cast/casttest.c
new file mode 100644
index 0000000000..0d020d6975
--- /dev/null
+++ b/src/lib/libcrypto/cast/casttest.c
@@ -0,0 +1,233 @@
1/* crypto/cast/casttest.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
59#include <stdio.h>
60#include <string.h>
61#include <stdlib.h>
62#include <openssl/opensslconf.h> /* To see if OPENSSL_NO_CAST is defined */
63
64#include "../e_os.h"
65
66#ifdef OPENSSL_NO_CAST
67int main(int argc, char *argv[])
68{
69 printf("No CAST support\n");
70 return(0);
71}
72#else
73#include <openssl/cast.h>
74
75#define FULL_TEST
76
77static unsigned char k[16]={
78 0x01,0x23,0x45,0x67,0x12,0x34,0x56,0x78,
79 0x23,0x45,0x67,0x89,0x34,0x56,0x78,0x9A
80 };
81
82static unsigned char in[8]={ 0x01,0x23,0x45,0x67,0x89,0xAB,0xCD,0xEF};
83
84static int k_len[3]={16,10,5};
85static unsigned char c[3][8]={
86 {0x23,0x8B,0x4F,0xE5,0x84,0x7E,0x44,0xB2},
87 {0xEB,0x6A,0x71,0x1A,0x2C,0x02,0x27,0x1B},
88 {0x7A,0xC8,0x16,0xD1,0x6E,0x9B,0x30,0x2E},
89 };
90static unsigned char out[80];
91
92static unsigned char in_a[16]={
93 0x01,0x23,0x45,0x67,0x12,0x34,0x56,0x78,
94 0x23,0x45,0x67,0x89,0x34,0x56,0x78,0x9A};
95static unsigned char in_b[16]={
96 0x01,0x23,0x45,0x67,0x12,0x34,0x56,0x78,
97 0x23,0x45,0x67,0x89,0x34,0x56,0x78,0x9A};
98
99static unsigned char c_a[16]={
100 0xEE,0xA9,0xD0,0xA2,0x49,0xFD,0x3B,0xA6,
101 0xB3,0x43,0x6F,0xB8,0x9D,0x6D,0xCA,0x92};
102static unsigned char c_b[16]={
103 0xB2,0xC9,0x5E,0xB0,0x0C,0x31,0xAD,0x71,
104 0x80,0xAC,0x05,0xB8,0xE8,0x3D,0x69,0x6E};
105
106#if 0
107char *text="Hello to all people out there";
108
109static unsigned char cfb_key[16]={
110 0xe1,0xf0,0xc3,0xd2,0xa5,0xb4,0x87,0x96,
111 0x69,0x78,0x4b,0x5a,0x2d,0x3c,0x0f,0x1e,
112 };
113static unsigned char cfb_iv[80]={0x34,0x12,0x78,0x56,0xab,0x90,0xef,0xcd};
114static unsigned char cfb_buf1[40],cfb_buf2[40],cfb_tmp[8];
115#define CFB_TEST_SIZE 24
116static unsigned char plain[CFB_TEST_SIZE]=
117 {
118 0x4e,0x6f,0x77,0x20,0x69,0x73,
119 0x20,0x74,0x68,0x65,0x20,0x74,
120 0x69,0x6d,0x65,0x20,0x66,0x6f,
121 0x72,0x20,0x61,0x6c,0x6c,0x20
122 };
123static unsigned char cfb_cipher64[CFB_TEST_SIZE]={
124 0x59,0xD8,0xE2,0x65,0x00,0x58,0x6C,0x3F,
125 0x2C,0x17,0x25,0xD0,0x1A,0x38,0xB7,0x2A,
126 0x39,0x61,0x37,0xDC,0x79,0xFB,0x9F,0x45
127
128/* 0xF9,0x78,0x32,0xB5,0x42,0x1A,0x6B,0x38,
129 0x9A,0x44,0xD6,0x04,0x19,0x43,0xC4,0xD9,
130 0x3D,0x1E,0xAE,0x47,0xFC,0xCF,0x29,0x0B,*/
131 };
132#endif
133
134int main(int argc, char *argv[])
135 {
136#ifdef FULL_TEST
137 long l;
138 CAST_KEY key_b;
139#endif
140 int i,z,err=0;
141 CAST_KEY key;
142
143 for (z=0; z<3; z++)
144 {
145 CAST_set_key(&key,k_len[z],k);
146
147 CAST_ecb_encrypt(in,out,&key,CAST_ENCRYPT);
148 if (memcmp(out,&(c[z][0]),8) != 0)
149 {
150 printf("ecb cast error encrypting for keysize %d\n",k_len[z]*8);
151 printf("got :");
152 for (i=0; i<8; i++)
153 printf("%02X ",out[i]);
154 printf("\n");
155 printf("expected:");
156 for (i=0; i<8; i++)
157 printf("%02X ",c[z][i]);
158 err=20;
159 printf("\n");
160 }
161
162 CAST_ecb_encrypt(out,out,&key,CAST_DECRYPT);
163 if (memcmp(out,in,8) != 0)
164 {
165 printf("ecb cast error decrypting for keysize %d\n",k_len[z]*8);
166 printf("got :");
167 for (i=0; i<8; i++)
168 printf("%02X ",out[i]);
169 printf("\n");
170 printf("expected:");
171 for (i=0; i<8; i++)
172 printf("%02X ",in[i]);
173 printf("\n");
174 err=3;
175 }
176 }
177 if (err == 0)
178 printf("ecb cast5 ok\n");
179
180#ifdef FULL_TEST
181 {
182 unsigned char out_a[16],out_b[16];
183 static char *hex="0123456789ABCDEF";
184
185 printf("This test will take some time....");
186 fflush(stdout);
187 memcpy(out_a,in_a,sizeof(in_a));
188 memcpy(out_b,in_b,sizeof(in_b));
189 i=1;
190
191 for (l=0; l<1000000L; l++)
192 {
193 CAST_set_key(&key_b,16,out_b);
194 CAST_ecb_encrypt(&(out_a[0]),&(out_a[0]),&key_b,CAST_ENCRYPT);
195 CAST_ecb_encrypt(&(out_a[8]),&(out_a[8]),&key_b,CAST_ENCRYPT);
196 CAST_set_key(&key,16,out_a);
197 CAST_ecb_encrypt(&(out_b[0]),&(out_b[0]),&key,CAST_ENCRYPT);
198 CAST_ecb_encrypt(&(out_b[8]),&(out_b[8]),&key,CAST_ENCRYPT);
199 if ((l & 0xffff) == 0xffff)
200 {
201 printf("%c",hex[i&0x0f]);
202 fflush(stdout);
203 i++;
204 }
205 }
206
207 if ( (memcmp(out_a,c_a,sizeof(c_a)) != 0) ||
208 (memcmp(out_b,c_b,sizeof(c_b)) != 0))
209 {
210 printf("\n");
211 printf("Error\n");
212
213 printf("A out =");
214 for (i=0; i<16; i++) printf("%02X ",out_a[i]);
215 printf("\nactual=");
216 for (i=0; i<16; i++) printf("%02X ",c_a[i]);
217 printf("\n");
218
219 printf("B out =");
220 for (i=0; i<16; i++) printf("%02X ",out_b[i]);
221 printf("\nactual=");
222 for (i=0; i<16; i++) printf("%02X ",c_b[i]);
223 printf("\n");
224 }
225 else
226 printf(" ok\n");
227 }
228#endif
229
230 EXIT(err);
231 return(err);
232 }
233#endif
diff --git a/src/lib/libcrypto/cert.pem b/src/lib/libcrypto/cert.pem
new file mode 100644
index 0000000000..7305e2d0ef
--- /dev/null
+++ b/src/lib/libcrypto/cert.pem
@@ -0,0 +1,3524 @@
1Certificate:
2 Data:
3 Version: 1 (0x0)
4 Serial Number: 421 (0x1a5)
5 Signature Algorithm: md5WithRSAEncryption
6 Issuer: C=US, O=GTE Corporation, OU=GTE CyberTrust Solutions, Inc., CN=GTE CyberTrust Global Root
7 Validity
8 Not Before: Aug 13 00:29:00 1998 GMT
9 Not After : Aug 13 23:59:00 2018 GMT
10 Subject: C=US, O=GTE Corporation, OU=GTE CyberTrust Solutions, Inc., CN=GTE CyberTrust Global Root
11 Subject Public Key Info:
12 Public Key Algorithm: rsaEncryption
13 Public-Key: (1024 bit)
14 Modulus:
15 00:95:0f:a0:b6:f0:50:9c:e8:7a:c7:88:cd:dd:17:
16 0e:2e:b0:94:d0:1b:3d:0e:f6:94:c0:8a:94:c7:06:
17 c8:90:97:c8:b8:64:1a:7a:7e:6c:3c:53:e1:37:28:
18 73:60:7f:b2:97:53:07:9f:53:f9:6d:58:94:d2:af:
19 8d:6d:88:67:80:e6:ed:b2:95:cf:72:31:ca:a5:1c:
20 72:ba:5c:02:e7:64:42:e7:f9:a9:2c:d6:3a:0d:ac:
21 8d:42:aa:24:01:39:e6:9c:3f:01:85:57:0d:58:87:
22 45:f8:d3:85:aa:93:69:26:85:70:48:80:3f:12:15:
23 c7:79:b4:1f:05:2f:3b:62:99
24 Exponent: 65537 (0x10001)
25 Signature Algorithm: md5WithRSAEncryption
26 6d:eb:1b:09:e9:5e:d9:51:db:67:22:61:a4:2a:3c:48:77:e3:
27 a0:7c:a6:de:73:a2:14:03:85:3d:fb:ab:0e:30:c5:83:16:33:
28 81:13:08:9e:7b:34:4e:df:40:c8:74:d7:b9:7d:dc:f4:76:55:
29 7d:9b:63:54:18:e9:f0:ea:f3:5c:b1:d9:8b:42:1e:b9:c0:95:
30 4e:ba:fa:d5:e2:7c:f5:68:61:bf:8e:ec:05:97:5f:5b:b0:d7:
31 a3:85:34:c4:24:a7:0d:0f:95:93:ef:cb:94:d8:9e:1f:9d:5c:
32 85:6d:c7:aa:ae:4f:1f:22:b5:cd:95:ad:ba:a7:cc:f9:ab:0b:
33 7a:7f
34SHA1 Fingerprint=97:81:79:50:D8:1C:96:70:CC:34:D8:09:CF:79:44:31:36:7E:F4:74
35-----BEGIN CERTIFICATE-----
36MIICWjCCAcMCAgGlMA0GCSqGSIb3DQEBBAUAMHUxCzAJBgNVBAYTAlVTMRgwFgYD
37VQQKEw9HVEUgQ29ycG9yYXRpb24xJzAlBgNVBAsTHkdURSBDeWJlclRydXN0IFNv
38bHV0aW9ucywgSW5jLjEjMCEGA1UEAxMaR1RFIEN5YmVyVHJ1c3QgR2xvYmFsIFJv
39b3QwHhcNOTgwODEzMDAyOTAwWhcNMTgwODEzMjM1OTAwWjB1MQswCQYDVQQGEwJV
40UzEYMBYGA1UEChMPR1RFIENvcnBvcmF0aW9uMScwJQYDVQQLEx5HVEUgQ3liZXJU
41cnVzdCBTb2x1dGlvbnMsIEluYy4xIzAhBgNVBAMTGkdURSBDeWJlclRydXN0IEds
42b2JhbCBSb290MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCVD6C28FCc6HrH
43iM3dFw4usJTQGz0O9pTAipTHBsiQl8i4ZBp6fmw8U+E3KHNgf7KXUwefU/ltWJTS
44r41tiGeA5u2ylc9yMcqlHHK6XALnZELn+aks1joNrI1CqiQBOeacPwGFVw1Yh0X4
4504Wqk2kmhXBIgD8SFcd5tB8FLztimQIDAQABMA0GCSqGSIb3DQEBBAUAA4GBAG3r
46GwnpXtlR22ciYaQqPEh346B8pt5zohQDhT37qw4wxYMWM4ETCJ57NE7fQMh017l9
473PR2VX2bY1QY6fDq81yx2YtCHrnAlU66+tXifPVoYb+O7AWXX1uw16OFNMQkpw0P
48lZPvy5TYnh+dXIVtx6quTx8itc2VrbqnzPmrC3p/
49-----END CERTIFICATE-----
50Certificate:
51 Data:
52 Version: 3 (0x2)
53 Serial Number: 903804111 (0x35def4cf)
54 Signature Algorithm: sha1WithRSAEncryption
55 Issuer: C=US, O=Equifax, OU=Equifax Secure Certificate Authority
56 Validity
57 Not Before: Aug 22 16:41:51 1998 GMT
58 Not After : Aug 22 16:41:51 2018 GMT
59 Subject: C=US, O=Equifax, OU=Equifax Secure Certificate Authority
60 Subject Public Key Info:
61 Public Key Algorithm: rsaEncryption
62 Public-Key: (1024 bit)
63 Modulus:
64 00:c1:5d:b1:58:67:08:62:ee:a0:9a:2d:1f:08:6d:
65 91:14:68:98:0a:1e:fe:da:04:6f:13:84:62:21:c3:
66 d1:7c:ce:9f:05:e0:b8:01:f0:4e:34:ec:e2:8a:95:
67 04:64:ac:f1:6b:53:5f:05:b3:cb:67:80:bf:42:02:
68 8e:fe:dd:01:09:ec:e1:00:14:4f:fc:fb:f0:0c:dd:
69 43:ba:5b:2b:e1:1f:80:70:99:15:57:93:16:f1:0f:
70 97:6a:b7:c2:68:23:1c:cc:4d:59:30:ac:51:1e:3b:
71 af:2b:d6:ee:63:45:7b:c5:d9:5f:50:d2:e3:50:0f:
72 3a:88:e7:bf:14:fd:e0:c7:b9
73 Exponent: 65537 (0x10001)
74 X509v3 extensions:
75 X509v3 CRL Distribution Points:
76
77 Full Name:
78 DirName: C = US, O = Equifax, OU = Equifax Secure Certificate Authority, CN = CRL1
79
80 X509v3 Private Key Usage Period:
81 Not After: Aug 22 16:41:51 2018 GMT
82 X509v3 Key Usage:
83 Certificate Sign, CRL Sign
84 X509v3 Authority Key Identifier:
85 keyid:48:E6:68:F9:2B:D2:B2:95:D7:47:D8:23:20:10:4F:33:98:90:9F:D4
86
87 X509v3 Subject Key Identifier:
88 48:E6:68:F9:2B:D2:B2:95:D7:47:D8:23:20:10:4F:33:98:90:9F:D4
89 X509v3 Basic Constraints:
90 CA:TRUE
91 1.2.840.113533.7.65.0:
92 0...V3.0c....
93 Signature Algorithm: sha1WithRSAEncryption
94 58:ce:29:ea:fc:f7:de:b5:ce:02:b9:17:b5:85:d1:b9:e3:e0:
95 95:cc:25:31:0d:00:a6:92:6e:7f:b6:92:63:9e:50:95:d1:9a:
96 6f:e4:11:de:63:85:6e:98:ee:a8:ff:5a:c8:d3:55:b2:66:71:
97 57:de:c0:21:eb:3d:2a:a7:23:49:01:04:86:42:7b:fc:ee:7f:
98 a2:16:52:b5:67:67:d3:40:db:3b:26:58:b2:28:77:3d:ae:14:
99 77:61:d6:fa:2a:66:27:a0:0d:fa:a7:73:5c:ea:70:f1:94:21:
100 65:44:5f:fa:fc:ef:29:68:a9:a2:87:79:ef:79:ef:4f:ac:07:
101 77:38
102SHA1 Fingerprint=D2:32:09:AD:23:D3:14:23:21:74:E4:0D:7F:9D:62:13:97:86:63:3A
103-----BEGIN CERTIFICATE-----
104MIIDIDCCAomgAwIBAgIENd70zzANBgkqhkiG9w0BAQUFADBOMQswCQYDVQQGEwJV
105UzEQMA4GA1UEChMHRXF1aWZheDEtMCsGA1UECxMkRXF1aWZheCBTZWN1cmUgQ2Vy
106dGlmaWNhdGUgQXV0aG9yaXR5MB4XDTk4MDgyMjE2NDE1MVoXDTE4MDgyMjE2NDE1
107MVowTjELMAkGA1UEBhMCVVMxEDAOBgNVBAoTB0VxdWlmYXgxLTArBgNVBAsTJEVx
108dWlmYXggU2VjdXJlIENlcnRpZmljYXRlIEF1dGhvcml0eTCBnzANBgkqhkiG9w0B
109AQEFAAOBjQAwgYkCgYEAwV2xWGcIYu6gmi0fCG2RFGiYCh7+2gRvE4RiIcPRfM6f
110BeC4AfBONOziipUEZKzxa1NfBbPLZ4C/QgKO/t0BCezhABRP/PvwDN1Dulsr4R+A
111cJkVV5MW8Q+XarfCaCMczE1ZMKxRHjuvK9buY0V7xdlfUNLjUA86iOe/FP3gx7kC
112AwEAAaOCAQkwggEFMHAGA1UdHwRpMGcwZaBjoGGkXzBdMQswCQYDVQQGEwJVUzEQ
113MA4GA1UEChMHRXF1aWZheDEtMCsGA1UECxMkRXF1aWZheCBTZWN1cmUgQ2VydGlm
114aWNhdGUgQXV0aG9yaXR5MQ0wCwYDVQQDEwRDUkwxMBoGA1UdEAQTMBGBDzIwMTgw
115ODIyMTY0MTUxWjALBgNVHQ8EBAMCAQYwHwYDVR0jBBgwFoAUSOZo+SvSspXXR9gj
116IBBPM5iQn9QwHQYDVR0OBBYEFEjmaPkr0rKV10fYIyAQTzOYkJ/UMAwGA1UdEwQF
117MAMBAf8wGgYJKoZIhvZ9B0EABA0wCxsFVjMuMGMDAgbAMA0GCSqGSIb3DQEBBQUA
118A4GBAFjOKer89961zgK5F7WF0bnj4JXMJTENAKaSbn+2kmOeUJXRmm/kEd5jhW6Y
1197qj/WsjTVbJmcVfewCHrPSqnI0kBBIZCe/zuf6IWUrVnZ9NA2zsmWLIodz2uFHdh
1201voqZiegDfqnc1zqcPGUIWVEX/r87yloqaKHee9570+sB3c4
121-----END CERTIFICATE-----
122Certificate:
123 Data:
124 Version: 1 (0x0)
125 Serial Number:
126 7d:d9:fe:07:cf:a8:1e:b7:10:79:67:fb:a7:89:34:c6
127 Signature Algorithm: sha1WithRSAEncryption
128 Issuer: C=US, O=VeriSign, Inc., OU=Class 3 Public Primary Certification Authority - G2, OU=(c) 1998 VeriSign, Inc. - For authorized use only, OU=VeriSign Trust Network
129 Validity
130 Not Before: May 18 00:00:00 1998 GMT
131 Not After : Aug 1 23:59:59 2028 GMT
132 Subject: C=US, O=VeriSign, Inc., OU=Class 3 Public Primary Certification Authority - G2, OU=(c) 1998 VeriSign, Inc. - For authorized use only, OU=VeriSign Trust Network
133 Subject Public Key Info:
134 Public Key Algorithm: rsaEncryption
135 Public-Key: (1024 bit)
136 Modulus:
137 00:cc:5e:d1:11:5d:5c:69:d0:ab:d3:b9:6a:4c:99:
138 1f:59:98:30:8e:16:85:20:46:6d:47:3f:d4:85:20:
139 84:e1:6d:b3:f8:a4:ed:0c:f1:17:0f:3b:f9:a7:f9:
140 25:d7:c1:cf:84:63:f2:7c:63:cf:a2:47:f2:c6:5b:
141 33:8e:64:40:04:68:c1:80:b9:64:1c:45:77:c7:d8:
142 6e:f5:95:29:3c:50:e8:34:d7:78:1f:a8:ba:6d:43:
143 91:95:8f:45:57:5e:7e:c5:fb:ca:a4:04:eb:ea:97:
144 37:54:30:6f:bb:01:47:32:33:cd:dc:57:9b:64:69:
145 61:f8:9b:1d:1c:89:4f:5c:67
146 Exponent: 65537 (0x10001)
147 Signature Algorithm: sha1WithRSAEncryption
148 51:4d:cd:be:5c:cb:98:19:9c:15:b2:01:39:78:2e:4d:0f:67:
149 70:70:99:c6:10:5a:94:a4:53:4d:54:6d:2b:af:0d:5d:40:8b:
150 64:d3:d7:ee:de:56:61:92:5f:a6:c4:1d:10:61:36:d3:2c:27:
151 3c:e8:29:09:b9:11:64:74:cc:b5:73:9f:1c:48:a9:bc:61:01:
152 ee:e2:17:a6:0c:e3:40:08:3b:0e:e7:eb:44:73:2a:9a:f1:69:
153 92:ef:71:14:c3:39:ac:71:a7:91:09:6f:e4:71:06:b3:ba:59:
154 57:26:79:00:f6:f8:0d:a2:33:30:28:d4:aa:58:a0:9d:9d:69:
155 91:fd
156SHA1 Fingerprint=85:37:1C:A6:E5:50:14:3D:CE:28:03:47:1B:DE:3A:09:E8:F8:77:0F
157-----BEGIN CERTIFICATE-----
158MIIDAjCCAmsCEH3Z/gfPqB63EHln+6eJNMYwDQYJKoZIhvcNAQEFBQAwgcExCzAJ
159BgNVBAYTAlVTMRcwFQYDVQQKEw5WZXJpU2lnbiwgSW5jLjE8MDoGA1UECxMzQ2xh
160c3MgMyBQdWJsaWMgUHJpbWFyeSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAtIEcy
161MTowOAYDVQQLEzEoYykgMTk5OCBWZXJpU2lnbiwgSW5jLiAtIEZvciBhdXRob3Jp
162emVkIHVzZSBvbmx5MR8wHQYDVQQLExZWZXJpU2lnbiBUcnVzdCBOZXR3b3JrMB4X
163DTk4MDUxODAwMDAwMFoXDTI4MDgwMTIzNTk1OVowgcExCzAJBgNVBAYTAlVTMRcw
164FQYDVQQKEw5WZXJpU2lnbiwgSW5jLjE8MDoGA1UECxMzQ2xhc3MgMyBQdWJsaWMg
165UHJpbWFyeSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAtIEcyMTowOAYDVQQLEzEo
166YykgMTk5OCBWZXJpU2lnbiwgSW5jLiAtIEZvciBhdXRob3JpemVkIHVzZSBvbmx5
167MR8wHQYDVQQLExZWZXJpU2lnbiBUcnVzdCBOZXR3b3JrMIGfMA0GCSqGSIb3DQEB
168AQUAA4GNADCBiQKBgQDMXtERXVxp0KvTuWpMmR9ZmDCOFoUgRm1HP9SFIIThbbP4
169pO0M8RcPO/mn+SXXwc+EY/J8Y8+iR/LGWzOOZEAEaMGAuWQcRXfH2G71lSk8UOg0
17013gfqLptQ5GVj0VXXn7F+8qkBOvqlzdUMG+7AUcyM83cV5tkaWH4mx0ciU9cZwID
171AQABMA0GCSqGSIb3DQEBBQUAA4GBAFFNzb5cy5gZnBWyATl4Lk0PZ3BwmcYQWpSk
172U01UbSuvDV1Ai2TT1+7eVmGSX6bEHRBhNtMsJzzoKQm5EWR0zLVznxxIqbxhAe7i
173F6YM40AIOw7n60RzKprxaZLvcRTDOaxxp5EJb+RxBrO6WVcmeQD2+A2iMzAo1KpY
174oJ2daZH9
175-----END CERTIFICATE-----
176Certificate:
177 Data:
178 Version: 3 (0x2)
179 Serial Number:
180 04:00:00:00:00:01:15:4b:5a:c3:94
181 Signature Algorithm: sha1WithRSAEncryption
182 Issuer: C=BE, O=GlobalSign nv-sa, OU=Root CA, CN=GlobalSign Root CA
183 Validity
184 Not Before: Sep 1 12:00:00 1998 GMT
185 Not After : Jan 28 12:00:00 2028 GMT
186 Subject: C=BE, O=GlobalSign nv-sa, OU=Root CA, CN=GlobalSign Root CA
187 Subject Public Key Info:
188 Public Key Algorithm: rsaEncryption
189 Public-Key: (2048 bit)
190 Modulus:
191 00:da:0e:e6:99:8d:ce:a3:e3:4f:8a:7e:fb:f1:8b:
192 83:25:6b:ea:48:1f:f1:2a:b0:b9:95:11:04:bd:f0:
193 63:d1:e2:67:66:cf:1c:dd:cf:1b:48:2b:ee:8d:89:
194 8e:9a:af:29:80:65:ab:e9:c7:2d:12:cb:ab:1c:4c:
195 70:07:a1:3d:0a:30:cd:15:8d:4f:f8:dd:d4:8c:50:
196 15:1c:ef:50:ee:c4:2e:f7:fc:e9:52:f2:91:7d:e0:
197 6d:d5:35:30:8e:5e:43:73:f2:41:e9:d5:6a:e3:b2:
198 89:3a:56:39:38:6f:06:3c:88:69:5b:2a:4d:c5:a7:
199 54:b8:6c:89:cc:9b:f9:3c:ca:e5:fd:89:f5:12:3c:
200 92:78:96:d6:dc:74:6e:93:44:61:d1:8d:c7:46:b2:
201 75:0e:86:e8:19:8a:d5:6d:6c:d5:78:16:95:a2:e9:
202 c8:0a:38:eb:f2:24:13:4f:73:54:93:13:85:3a:1b:
203 bc:1e:34:b5:8b:05:8c:b9:77:8b:b1:db:1f:20:91:
204 ab:09:53:6e:90:ce:7b:37:74:b9:70:47:91:22:51:
205 63:16:79:ae:b1:ae:41:26:08:c8:19:2b:d1:46:aa:
206 48:d6:64:2a:d7:83:34:ff:2c:2a:c1:6c:19:43:4a:
207 07:85:e7:d3:7c:f6:21:68:ef:ea:f2:52:9f:7f:93:
208 90:cf
209 Exponent: 65537 (0x10001)
210 X509v3 extensions:
211 X509v3 Key Usage: critical
212 Certificate Sign, CRL Sign
213 X509v3 Basic Constraints: critical
214 CA:TRUE
215 X509v3 Subject Key Identifier:
216 60:7B:66:1A:45:0D:97:CA:89:50:2F:7D:04:CD:34:A8:FF:FC:FD:4B
217 Signature Algorithm: sha1WithRSAEncryption
218 d6:73:e7:7c:4f:76:d0:8d:bf:ec:ba:a2:be:34:c5:28:32:b5:
219 7c:fc:6c:9c:2c:2b:bd:09:9e:53:bf:6b:5e:aa:11:48:b6:e5:
220 08:a3:b3:ca:3d:61:4d:d3:46:09:b3:3e:c3:a0:e3:63:55:1b:
221 f2:ba:ef:ad:39:e1:43:b9:38:a3:e6:2f:8a:26:3b:ef:a0:50:
222 56:f9:c6:0a:fd:38:cd:c4:0b:70:51:94:97:98:04:df:c3:5f:
223 94:d5:15:c9:14:41:9c:c4:5d:75:64:15:0d:ff:55:30:ec:86:
224 8f:ff:0d:ef:2c:b9:63:46:f6:aa:fc:df:bc:69:fd:2e:12:48:
225 64:9a:e0:95:f0:a6:ef:29:8f:01:b1:15:b5:0c:1d:a5:fe:69:
226 2c:69:24:78:1e:b3:a7:1c:71:62:ee:ca:c8:97:ac:17:5d:8a:
227 c2:f8:47:86:6e:2a:c4:56:31:95:d0:67:89:85:2b:f9:6c:a6:
228 5d:46:9d:0c:aa:82:e4:99:51:dd:70:b7:db:56:3d:61:e4:6a:
229 e1:5c:d6:f6:fe:3d:de:41:cc:07:ae:63:52:bf:53:53:f4:2b:
230 e9:c7:fd:b6:f7:82:5f:85:d2:41:18:db:81:b3:04:1c:c5:1f:
231 a4:80:6f:15:20:c9:de:0c:88:0a:1d:d6:66:55:e2:fc:48:c9:
232 29:26:69:e0
233SHA1 Fingerprint=B1:BC:96:8B:D4:F4:9D:62:2A:A8:9A:81:F2:15:01:52:A4:1D:82:9C
234-----BEGIN CERTIFICATE-----
235MIIDdTCCAl2gAwIBAgILBAAAAAABFUtaw5QwDQYJKoZIhvcNAQEFBQAwVzELMAkG
236A1UEBhMCQkUxGTAXBgNVBAoTEEdsb2JhbFNpZ24gbnYtc2ExEDAOBgNVBAsTB1Jv
237b3QgQ0ExGzAZBgNVBAMTEkdsb2JhbFNpZ24gUm9vdCBDQTAeFw05ODA5MDExMjAw
238MDBaFw0yODAxMjgxMjAwMDBaMFcxCzAJBgNVBAYTAkJFMRkwFwYDVQQKExBHbG9i
239YWxTaWduIG52LXNhMRAwDgYDVQQLEwdSb290IENBMRswGQYDVQQDExJHbG9iYWxT
240aWduIFJvb3QgQ0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDaDuaZ
241jc6j40+Kfvvxi4Mla+pIH/EqsLmVEQS98GPR4mdmzxzdzxtIK+6NiY6arymAZavp
242xy0Sy6scTHAHoT0KMM0VjU/43dSMUBUc71DuxC73/OlS8pF94G3VNTCOXkNz8kHp
2431Wrjsok6Vjk4bwY8iGlbKk3Fp1S4bInMm/k8yuX9ifUSPJJ4ltbcdG6TRGHRjcdG
244snUOhugZitVtbNV4FpWi6cgKOOvyJBNPc1STE4U6G7weNLWLBYy5d4ux2x8gkasJ
245U26Qzns3dLlwR5EiUWMWea6xrkEmCMgZK9FGqkjWZCrXgzT/LCrBbBlDSgeF59N8
2469iFo7+ryUp9/k5DPAgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8E
247BTADAQH/MB0GA1UdDgQWBBRge2YaRQ2XyolQL30EzTSo//z9SzANBgkqhkiG9w0B
248AQUFAAOCAQEA1nPnfE920I2/7LqivjTFKDK1fPxsnCwrvQmeU79rXqoRSLblCKOz
249yj1hTdNGCbM+w6DjY1Ub8rrvrTnhQ7k4o+YviiY776BQVvnGCv04zcQLcFGUl5gE
25038NflNUVyRRBnMRddWQVDf9VMOyGj/8N7yy5Y0b2qvzfvGn9LhJIZJrglfCm7ymP
251AbEVtQwdpf5pLGkkeB6zpxxxYu7KyJesF12KwvhHhm4qxFYxldBniYUr+WymXUad
252DKqC5JlR3XC321Y9YeRq4VzW9v493kHMB65jUr9TU/Qr6cf9tveCX4XSQRjbgbME
253HMUfpIBvFSDJ3gyICh3WZlXi/EjJKSZp4A==
254-----END CERTIFICATE-----
255Certificate:
256 Data:
257 Version: 3 (0x2)
258 Serial Number:
259 04:00:00:00:00:01:0f:86:26:e6:0d
260 Signature Algorithm: sha1WithRSAEncryption
261 Issuer: OU=GlobalSign Root CA - R2, O=GlobalSign, CN=GlobalSign
262 Validity
263 Not Before: Dec 15 08:00:00 2006 GMT
264 Not After : Dec 15 08:00:00 2021 GMT
265 Subject: OU=GlobalSign Root CA - R2, O=GlobalSign, CN=GlobalSign
266 Subject Public Key Info:
267 Public Key Algorithm: rsaEncryption
268 Public-Key: (2048 bit)
269 Modulus:
270 00:a6:cf:24:0e:be:2e:6f:28:99:45:42:c4:ab:3e:
271 21:54:9b:0b:d3:7f:84:70:fa:12:b3:cb:bf:87:5f:
272 c6:7f:86:d3:b2:30:5c:d6:fd:ad:f1:7b:dc:e5:f8:
273 60:96:09:92:10:f5:d0:53:de:fb:7b:7e:73:88:ac:
274 52:88:7b:4a:a6:ca:49:a6:5e:a8:a7:8c:5a:11:bc:
275 7a:82:eb:be:8c:e9:b3:ac:96:25:07:97:4a:99:2a:
276 07:2f:b4:1e:77:bf:8a:0f:b5:02:7c:1b:96:b8:c5:
277 b9:3a:2c:bc:d6:12:b9:eb:59:7d:e2:d0:06:86:5f:
278 5e:49:6a:b5:39:5e:88:34:ec:bc:78:0c:08:98:84:
279 6c:a8:cd:4b:b4:a0:7d:0c:79:4d:f0:b8:2d:cb:21:
280 ca:d5:6c:5b:7d:e1:a0:29:84:a1:f9:d3:94:49:cb:
281 24:62:91:20:bc:dd:0b:d5:d9:cc:f9:ea:27:0a:2b:
282 73:91:c6:9d:1b:ac:c8:cb:e8:e0:a0:f4:2f:90:8b:
283 4d:fb:b0:36:1b:f6:19:7a:85:e0:6d:f2:61:13:88:
284 5c:9f:e0:93:0a:51:97:8a:5a:ce:af:ab:d5:f7:aa:
285 09:aa:60:bd:dc:d9:5f:df:72:a9:60:13:5e:00:01:
286 c9:4a:fa:3f:a4:ea:07:03:21:02:8e:82:ca:03:c2:
287 9b:8f
288 Exponent: 65537 (0x10001)
289 X509v3 extensions:
290 X509v3 Key Usage: critical
291 Certificate Sign, CRL Sign
292 X509v3 Basic Constraints: critical
293 CA:TRUE
294 X509v3 Subject Key Identifier:
295 9B:E2:07:57:67:1C:1E:C0:6A:06:DE:59:B4:9A:2D:DF:DC:19:86:2E
296 X509v3 CRL Distribution Points:
297
298 Full Name:
299 URI:http://crl.globalsign.net/root-r2.crl
300
301 X509v3 Authority Key Identifier:
302 keyid:9B:E2:07:57:67:1C:1E:C0:6A:06:DE:59:B4:9A:2D:DF:DC:19:86:2E
303
304 Signature Algorithm: sha1WithRSAEncryption
305 99:81:53:87:1c:68:97:86:91:ec:e0:4a:b8:44:0b:ab:81:ac:
306 27:4f:d6:c1:b8:1c:43:78:b3:0c:9a:fc:ea:2c:3c:6e:61:1b:
307 4d:4b:29:f5:9f:05:1d:26:c1:b8:e9:83:00:62:45:b6:a9:08:
308 93:b9:a9:33:4b:18:9a:c2:f8:87:88:4e:db:dd:71:34:1a:c1:
309 54:da:46:3f:e0:d3:2a:ab:6d:54:22:f5:3a:62:cd:20:6f:ba:
310 29:89:d7:dd:91:ee:d3:5c:a2:3e:a1:5b:41:f5:df:e5:64:43:
311 2d:e9:d5:39:ab:d2:a2:df:b7:8b:d0:c0:80:19:1c:45:c0:2d:
312 8c:e8:f8:2d:a4:74:56:49:c5:05:b5:4f:15:de:6e:44:78:39:
313 87:a8:7e:bb:f3:79:18:91:bb:f4:6f:9d:c1:f0:8c:35:8c:5d:
314 01:fb:c3:6d:b9:ef:44:6d:79:46:31:7e:0a:fe:a9:82:c1:ff:
315 ef:ab:6e:20:c4:50:c9:5f:9d:4d:9b:17:8c:0c:e5:01:c9:a0:
316 41:6a:73:53:fa:a5:50:b4:6e:25:0f:fb:4c:18:f4:fd:52:d9:
317 8e:69:b1:e8:11:0f:de:88:d8:fb:1d:49:f7:aa:de:95:cf:20:
318 78:c2:60:12:db:25:40:8c:6a:fc:7e:42:38:40:64:12:f7:9e:
319 81:e1:93:2e
320SHA1 Fingerprint=75:E0:AB:B6:13:85:12:27:1C:04:F8:5F:DD:DE:38:E4:B7:24:2E:FE
321-----BEGIN CERTIFICATE-----
322MIIDujCCAqKgAwIBAgILBAAAAAABD4Ym5g0wDQYJKoZIhvcNAQEFBQAwTDEgMB4G
323A1UECxMXR2xvYmFsU2lnbiBSb290IENBIC0gUjIxEzARBgNVBAoTCkdsb2JhbFNp
324Z24xEzARBgNVBAMTCkdsb2JhbFNpZ24wHhcNMDYxMjE1MDgwMDAwWhcNMjExMjE1
325MDgwMDAwWjBMMSAwHgYDVQQLExdHbG9iYWxTaWduIFJvb3QgQ0EgLSBSMjETMBEG
326A1UEChMKR2xvYmFsU2lnbjETMBEGA1UEAxMKR2xvYmFsU2lnbjCCASIwDQYJKoZI
327hvcNAQEBBQADggEPADCCAQoCggEBAKbPJA6+Lm8omUVCxKs+IVSbC9N/hHD6ErPL
328v4dfxn+G07IwXNb9rfF73OX4YJYJkhD10FPe+3t+c4isUoh7SqbKSaZeqKeMWhG8
329eoLrvozps6yWJQeXSpkqBy+0Hne/ig+1AnwblrjFuTosvNYSuetZfeLQBoZfXklq
330tTleiDTsvHgMCJiEbKjNS7SgfQx5TfC4LcshytVsW33hoCmEofnTlEnLJGKRILzd
331C9XZzPnqJworc5HGnRusyMvo4KD0L5CLTfuwNhv2GXqF4G3yYROIXJ/gkwpRl4pa
332zq+r1feqCapgvdzZX99yqWATXgAByUr6P6TqBwMhAo6CygPCm48CAwEAAaOBnDCB
333mTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUm+IH
334V2ccHsBqBt5ZtJot39wZhi4wNgYDVR0fBC8wLTAroCmgJ4YlaHR0cDovL2NybC5n
335bG9iYWxzaWduLm5ldC9yb290LXIyLmNybDAfBgNVHSMEGDAWgBSb4gdXZxwewGoG
3363lm0mi3f3BmGLjANBgkqhkiG9w0BAQUFAAOCAQEAmYFThxxol4aR7OBKuEQLq4Gs
337J0/WwbgcQ3izDJr86iw8bmEbTUsp9Z8FHSbBuOmDAGJFtqkIk7mpM0sYmsL4h4hO
338291xNBrBVNpGP+DTKqttVCL1OmLNIG+6KYnX3ZHu01yiPqFbQfXf5WRDLenVOavS
339ot+3i9DAgBkcRcAtjOj4LaR0VknFBbVPFd5uRHg5h6h+u/N5GJG79G+dwfCMNYxd
340AfvDbbnvRG15RjF+Cv6pgsH/76tuIMRQyV+dTZsXjAzlAcmgQWpzU/qlULRuJQ/7
341TBj0/VLZjmmx6BEP3ojY+x1J96relc8geMJgEtslQIxq/H5COEBkEveegeGTLg==
342-----END CERTIFICATE-----
343Certificate:
344 Data:
345 Version: 3 (0x2)
346 Serial Number:
347 04:00:00:00:00:01:21:58:53:08:a2
348 Signature Algorithm: sha256WithRSAEncryption
349 Issuer: OU=GlobalSign Root CA - R3, O=GlobalSign, CN=GlobalSign
350 Validity
351 Not Before: Mar 18 10:00:00 2009 GMT
352 Not After : Mar 18 10:00:00 2029 GMT
353 Subject: OU=GlobalSign Root CA - R3, O=GlobalSign, CN=GlobalSign
354 Subject Public Key Info:
355 Public Key Algorithm: rsaEncryption
356 Public-Key: (2048 bit)
357 Modulus:
358 00:cc:25:76:90:79:06:78:22:16:f5:c0:83:b6:84:
359 ca:28:9e:fd:05:76:11:c5:ad:88:72:fc:46:02:43:
360 c7:b2:8a:9d:04:5f:24:cb:2e:4b:e1:60:82:46:e1:
361 52:ab:0c:81:47:70:6c:dd:64:d1:eb:f5:2c:a3:0f:
362 82:3d:0c:2b:ae:97:d7:b6:14:86:10:79:bb:3b:13:
363 80:77:8c:08:e1:49:d2:6a:62:2f:1f:5e:fa:96:68:
364 df:89:27:95:38:9f:06:d7:3e:c9:cb:26:59:0d:73:
365 de:b0:c8:e9:26:0e:83:15:c6:ef:5b:8b:d2:04:60:
366 ca:49:a6:28:f6:69:3b:f6:cb:c8:28:91:e5:9d:8a:
367 61:57:37:ac:74:14:dc:74:e0:3a:ee:72:2f:2e:9c:
368 fb:d0:bb:bf:f5:3d:00:e1:06:33:e8:82:2b:ae:53:
369 a6:3a:16:73:8c:dd:41:0e:20:3a:c0:b4:a7:a1:e9:
370 b2:4f:90:2e:32:60:e9:57:cb:b9:04:92:68:68:e5:
371 38:26:60:75:b2:9f:77:ff:91:14:ef:ae:20:49:fc:
372 ad:40:15:48:d1:02:31:61:19:5e:b8:97:ef:ad:77:
373 b7:64:9a:7a:bf:5f:c1:13:ef:9b:62:fb:0d:6c:e0:
374 54:69:16:a9:03:da:6e:e9:83:93:71:76:c6:69:85:
375 82:17
376 Exponent: 65537 (0x10001)
377 X509v3 extensions:
378 X509v3 Key Usage: critical
379 Certificate Sign, CRL Sign
380 X509v3 Basic Constraints: critical
381 CA:TRUE
382 X509v3 Subject Key Identifier:
383 8F:F0:4B:7F:A8:2E:45:24:AE:4D:50:FA:63:9A:8B:DE:E2:DD:1B:BC
384 Signature Algorithm: sha256WithRSAEncryption
385 4b:40:db:c0:50:aa:fe:c8:0c:ef:f7:96:54:45:49:bb:96:00:
386 09:41:ac:b3:13:86:86:28:07:33:ca:6b:e6:74:b9:ba:00:2d:
387 ae:a4:0a:d3:f5:f1:f1:0f:8a:bf:73:67:4a:83:c7:44:7b:78:
388 e0:af:6e:6c:6f:03:29:8e:33:39:45:c3:8e:e4:b9:57:6c:aa:
389 fc:12:96:ec:53:c6:2d:e4:24:6c:b9:94:63:fb:dc:53:68:67:
390 56:3e:83:b8:cf:35:21:c3:c9:68:fe:ce:da:c2:53:aa:cc:90:
391 8a:e9:f0:5d:46:8c:95:dd:7a:58:28:1a:2f:1d:de:cd:00:37:
392 41:8f:ed:44:6d:d7:53:28:97:7e:f3:67:04:1e:15:d7:8a:96:
393 b4:d3:de:4c:27:a4:4c:1b:73:73:76:f4:17:99:c2:1f:7a:0e:
394 e3:2d:08:ad:0a:1c:2c:ff:3c:ab:55:0e:0f:91:7e:36:eb:c3:
395 57:49:be:e1:2e:2d:7c:60:8b:c3:41:51:13:23:9d:ce:f7:32:
396 6b:94:01:a8:99:e7:2c:33:1f:3a:3b:25:d2:86:40:ce:3b:2c:
397 86:78:c9:61:2f:14:ba:ee:db:55:6f:df:84:ee:05:09:4d:bd:
398 28:d8:72:ce:d3:62:50:65:1e:eb:92:97:83:31:d9:b3:b5:ca:
399 47:58:3f:5f
400SHA1 Fingerprint=D6:9B:56:11:48:F0:1C:77:C5:45:78:C1:09:26:DF:5B:85:69:76:AD
401-----BEGIN CERTIFICATE-----
402MIIDXzCCAkegAwIBAgILBAAAAAABIVhTCKIwDQYJKoZIhvcNAQELBQAwTDEgMB4G
403A1UECxMXR2xvYmFsU2lnbiBSb290IENBIC0gUjMxEzARBgNVBAoTCkdsb2JhbFNp
404Z24xEzARBgNVBAMTCkdsb2JhbFNpZ24wHhcNMDkwMzE4MTAwMDAwWhcNMjkwMzE4
405MTAwMDAwWjBMMSAwHgYDVQQLExdHbG9iYWxTaWduIFJvb3QgQ0EgLSBSMzETMBEG
406A1UEChMKR2xvYmFsU2lnbjETMBEGA1UEAxMKR2xvYmFsU2lnbjCCASIwDQYJKoZI
407hvcNAQEBBQADggEPADCCAQoCggEBAMwldpB5BngiFvXAg7aEyiie/QV2EcWtiHL8
408RgJDx7KKnQRfJMsuS+FggkbhUqsMgUdwbN1k0ev1LKMPgj0MK66X17YUhhB5uzsT
409gHeMCOFJ0mpiLx9e+pZo34knlTifBtc+ycsmWQ1z3rDI6SYOgxXG71uL0gRgykmm
410KPZpO/bLyCiR5Z2KYVc3rHQU3HTgOu5yLy6c+9C7v/U9AOEGM+iCK65TpjoWc4zd
411QQ4gOsC0p6Hpsk+QLjJg6VfLuQSSaGjlOCZgdbKfd/+RFO+uIEn8rUAVSNECMWEZ
412XriX7613t2Saer9fwRPvm2L7DWzgVGkWqQPabumDk3F2xmmFghcCAwEAAaNCMEAw
413DgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFI/wS3+o
414LkUkrk1Q+mOai97i3Ru8MA0GCSqGSIb3DQEBCwUAA4IBAQBLQNvAUKr+yAzv95ZU
415RUm7lgAJQayzE4aGKAczymvmdLm6AC2upArT9fHxD4q/c2dKg8dEe3jgr25sbwMp
416jjM5RcOO5LlXbKr8EpbsU8Yt5CRsuZRj+9xTaGdWPoO4zzUhw8lo/s7awlOqzJCK
4176fBdRoyV3XpYKBovHd7NADdBj+1EbddTKJd+82cEHhXXipa0095MJ6RMG3NzdvQX
418mcIfeg7jLQitChws/zyrVQ4PkX4268NXSb7hLi18YIvDQVETI53O9zJrlAGomecs
419Mx86OyXShkDOOyyGeMlhLxS67ttVb9+E7gUJTb0o2HLO02JQZR7rkpeDMdmztcpH
420WD9f
421-----END CERTIFICATE-----
422Certificate:
423 Data:
424 Version: 3 (0x2)
425 Serial Number: 1 (0x1)
426 Signature Algorithm: md5WithRSAEncryption
427 Issuer: C=ZA, ST=Western Cape, L=Cape Town, O=Thawte Consulting cc, OU=Certification Services Division, CN=Thawte Premium Server CA/emailAddress=premium-server@thawte.com
428 Validity
429 Not Before: Aug 1 00:00:00 1996 GMT
430 Not After : Dec 31 23:59:59 2020 GMT
431 Subject: C=ZA, ST=Western Cape, L=Cape Town, O=Thawte Consulting cc, OU=Certification Services Division, CN=Thawte Premium Server CA/emailAddress=premium-server@thawte.com
432 Subject Public Key Info:
433 Public Key Algorithm: rsaEncryption
434 Public-Key: (1024 bit)
435 Modulus:
436 00:d2:36:36:6a:8b:d7:c2:5b:9e:da:81:41:62:8f:
437 38:ee:49:04:55:d6:d0:ef:1c:1b:95:16:47:ef:18:
438 48:35:3a:52:f4:2b:6a:06:8f:3b:2f:ea:56:e3:af:
439 86:8d:9e:17:f7:9e:b4:65:75:02:4d:ef:cb:09:a2:
440 21:51:d8:9b:d0:67:d0:ba:0d:92:06:14:73:d4:93:
441 cb:97:2a:00:9c:5c:4e:0c:bc:fa:15:52:fc:f2:44:
442 6e:da:11:4a:6e:08:9f:2f:2d:e3:f9:aa:3a:86:73:
443 b6:46:53:58:c8:89:05:bd:83:11:b8:73:3f:aa:07:
444 8d:f4:42:4d:e7:40:9d:1c:37
445 Exponent: 65537 (0x10001)
446 X509v3 extensions:
447 X509v3 Basic Constraints: critical
448 CA:TRUE
449 Signature Algorithm: md5WithRSAEncryption
450 26:48:2c:16:c2:58:fa:e8:16:74:0c:aa:aa:5f:54:3f:f2:d7:
451 c9:78:60:5e:5e:6e:37:63:22:77:36:7e:b2:17:c4:34:b9:f5:
452 08:85:fc:c9:01:38:ff:4d:be:f2:16:42:43:e7:bb:5a:46:fb:
453 c1:c6:11:1f:f1:4a:b0:28:46:c9:c3:c4:42:7d:bc:fa:ab:59:
454 6e:d5:b7:51:88:11:e3:a4:85:19:6b:82:4c:a4:0c:12:ad:e9:
455 a4:ae:3f:f1:c3:49:65:9a:8c:c5:c8:3e:25:b7:94:99:bb:92:
456 32:71:07:f0:86:5e:ed:50:27:a6:0d:a6:23:f9:bb:cb:a6:07:
457 14:42
458SHA1 Fingerprint=62:7F:8D:78:27:65:63:99:D2:7D:7F:90:44:C9:FE:B3:F3:3E:FA:9A
459-----BEGIN CERTIFICATE-----
460MIIDJzCCApCgAwIBAgIBATANBgkqhkiG9w0BAQQFADCBzjELMAkGA1UEBhMCWkEx
461FTATBgNVBAgTDFdlc3Rlcm4gQ2FwZTESMBAGA1UEBxMJQ2FwZSBUb3duMR0wGwYD
462VQQKExRUaGF3dGUgQ29uc3VsdGluZyBjYzEoMCYGA1UECxMfQ2VydGlmaWNhdGlv
463biBTZXJ2aWNlcyBEaXZpc2lvbjEhMB8GA1UEAxMYVGhhd3RlIFByZW1pdW0gU2Vy
464dmVyIENBMSgwJgYJKoZIhvcNAQkBFhlwcmVtaXVtLXNlcnZlckB0aGF3dGUuY29t
465MB4XDTk2MDgwMTAwMDAwMFoXDTIwMTIzMTIzNTk1OVowgc4xCzAJBgNVBAYTAlpB
466MRUwEwYDVQQIEwxXZXN0ZXJuIENhcGUxEjAQBgNVBAcTCUNhcGUgVG93bjEdMBsG
467A1UEChMUVGhhd3RlIENvbnN1bHRpbmcgY2MxKDAmBgNVBAsTH0NlcnRpZmljYXRp
468b24gU2VydmljZXMgRGl2aXNpb24xITAfBgNVBAMTGFRoYXd0ZSBQcmVtaXVtIFNl
469cnZlciBDQTEoMCYGCSqGSIb3DQEJARYZcHJlbWl1bS1zZXJ2ZXJAdGhhd3RlLmNv
470bTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA0jY2aovXwlue2oFBYo847kkE
471VdbQ7xwblRZH7xhINTpS9CtqBo87L+pW46+GjZ4X9560ZXUCTe/LCaIhUdib0GfQ
472ug2SBhRz1JPLlyoAnFxODLz6FVL88kRu2hFKbgifLy3j+ao6hnO2RlNYyIkFvYMR
473uHM/qgeN9EJN50CdHDcCAwEAAaMTMBEwDwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG
4749w0BAQQFAAOBgQAmSCwWwlj66BZ0DKqqX1Q/8tfJeGBeXm43YyJ3Nn6yF8Q0ufUI
475hfzJATj/Tb7yFkJD57taRvvBxhEf8UqwKEbJw8RCfbz6q1lu1bdRiBHjpIUZa4JM
476pAwSremkrj/xw0llmozFyD4lt5SZu5IycQfwhl7tUCemDaYj+bvLpgcUQg==
477-----END CERTIFICATE-----
478Certificate:
479 Data:
480 Version: 3 (0x2)
481 Serial Number: 1 (0x1)
482 Signature Algorithm: md5WithRSAEncryption
483 Issuer: C=ZA, ST=Western Cape, L=Cape Town, O=Thawte Consulting cc, OU=Certification Services Division, CN=Thawte Server CA/emailAddress=server-certs@thawte.com
484 Validity
485 Not Before: Aug 1 00:00:00 1996 GMT
486 Not After : Dec 31 23:59:59 2020 GMT
487 Subject: C=ZA, ST=Western Cape, L=Cape Town, O=Thawte Consulting cc, OU=Certification Services Division, CN=Thawte Server CA/emailAddress=server-certs@thawte.com
488 Subject Public Key Info:
489 Public Key Algorithm: rsaEncryption
490 Public-Key: (1024 bit)
491 Modulus:
492 00:d3:a4:50:6e:c8:ff:56:6b:e6:cf:5d:b6:ea:0c:
493 68:75:47:a2:aa:c2:da:84:25:fc:a8:f4:47:51:da:
494 85:b5:20:74:94:86:1e:0f:75:c9:e9:08:61:f5:06:
495 6d:30:6e:15:19:02:e9:52:c0:62:db:4d:99:9e:e2:
496 6a:0c:44:38:cd:fe:be:e3:64:09:70:c5:fe:b1:6b:
497 29:b6:2f:49:c8:3b:d4:27:04:25:10:97:2f:e7:90:
498 6d:c0:28:42:99:d7:4c:43:de:c3:f5:21:6d:54:9f:
499 5d:c3:58:e1:c0:e4:d9:5b:b0:b8:dc:b4:7b:df:36:
500 3a:c2:b5:66:22:12:d6:87:0d
501 Exponent: 65537 (0x10001)
502 X509v3 extensions:
503 X509v3 Basic Constraints: critical
504 CA:TRUE
505 Signature Algorithm: md5WithRSAEncryption
506 07:fa:4c:69:5c:fb:95:cc:46:ee:85:83:4d:21:30:8e:ca:d9:
507 a8:6f:49:1a:e6:da:51:e3:60:70:6c:84:61:11:a1:1a:c8:48:
508 3e:59:43:7d:4f:95:3d:a1:8b:b7:0b:62:98:7a:75:8a:dd:88:
509 4e:4e:9e:40:db:a8:cc:32:74:b9:6f:0d:c6:e3:b3:44:0b:d9:
510 8a:6f:9a:29:9b:99:18:28:3b:d1:e3:40:28:9a:5a:3c:d5:b5:
511 e7:20:1b:8b:ca:a4:ab:8d:e9:51:d9:e2:4c:2c:59:a9:da:b9:
512 b2:75:1b:f6:42:f2:ef:c7:f2:18:f9:89:bc:a3:ff:8a:23:2e:
513 70:47
514SHA1 Fingerprint=23:E5:94:94:51:95:F2:41:48:03:B4:D5:64:D2:A3:A3:F5:D8:8B:8C
515-----BEGIN CERTIFICATE-----
516MIIDEzCCAnygAwIBAgIBATANBgkqhkiG9w0BAQQFADCBxDELMAkGA1UEBhMCWkEx
517FTATBgNVBAgTDFdlc3Rlcm4gQ2FwZTESMBAGA1UEBxMJQ2FwZSBUb3duMR0wGwYD
518VQQKExRUaGF3dGUgQ29uc3VsdGluZyBjYzEoMCYGA1UECxMfQ2VydGlmaWNhdGlv
519biBTZXJ2aWNlcyBEaXZpc2lvbjEZMBcGA1UEAxMQVGhhd3RlIFNlcnZlciBDQTEm
520MCQGCSqGSIb3DQEJARYXc2VydmVyLWNlcnRzQHRoYXd0ZS5jb20wHhcNOTYwODAx
521MDAwMDAwWhcNMjAxMjMxMjM1OTU5WjCBxDELMAkGA1UEBhMCWkExFTATBgNVBAgT
522DFdlc3Rlcm4gQ2FwZTESMBAGA1UEBxMJQ2FwZSBUb3duMR0wGwYDVQQKExRUaGF3
523dGUgQ29uc3VsdGluZyBjYzEoMCYGA1UECxMfQ2VydGlmaWNhdGlvbiBTZXJ2aWNl
524cyBEaXZpc2lvbjEZMBcGA1UEAxMQVGhhd3RlIFNlcnZlciBDQTEmMCQGCSqGSIb3
525DQEJARYXc2VydmVyLWNlcnRzQHRoYXd0ZS5jb20wgZ8wDQYJKoZIhvcNAQEBBQAD
526gY0AMIGJAoGBANOkUG7I/1Zr5s9dtuoMaHVHoqrC2oQl/Kj0R1HahbUgdJSGHg91
527yekIYfUGbTBuFRkC6VLAYttNmZ7iagxEOM3+vuNkCXDF/rFrKbYvScg71CcEJRCX
528L+eQbcAoQpnXTEPew/UhbVSfXcNY4cDk2VuwuNy0e982OsK1ZiIS1ocNAgMBAAGj
529EzARMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQEEBQADgYEAB/pMaVz7lcxG
5307oWDTSEwjsrZqG9JGubaUeNgcGyEYRGhGshIPllDfU+VPaGLtwtimHp1it2ITk6e
531QNuozDJ0uW8NxuOzRAvZim+aKZuZGCg70eNAKJpaPNW15yAbi8qkq43pUdniTCxZ
532qdq5snUb9kLy78fyGPmJvKP/iiMucEc=
533-----END CERTIFICATE-----
534Certificate:
535 Data:
536 Version: 1 (0x0)
537 Serial Number:
538 3c:91:31:cb:1f:f6:d0:1b:0e:9a:b8:d0:44:bf:12:be
539 Signature Algorithm: sha1WithRSAEncryption
540 Issuer: C=US, O=VeriSign, Inc., OU=Class 3 Public Primary Certification Authority
541 Validity
542 Not Before: Jan 29 00:00:00 1996 GMT
543 Not After : Aug 2 23:59:59 2028 GMT
544 Subject: C=US, O=VeriSign, Inc., OU=Class 3 Public Primary Certification Authority
545 Subject Public Key Info:
546 Public Key Algorithm: rsaEncryption
547 Public-Key: (1024 bit)
548 Modulus:
549 00:c9:5c:59:9e:f2:1b:8a:01:14:b4:10:df:04:40:
550 db:e3:57:af:6a:45:40:8f:84:0c:0b:d1:33:d9:d9:
551 11:cf:ee:02:58:1f:25:f7:2a:a8:44:05:aa:ec:03:
552 1f:78:7f:9e:93:b9:9a:00:aa:23:7d:d6:ac:85:a2:
553 63:45:c7:72:27:cc:f4:4c:c6:75:71:d2:39:ef:4f:
554 42:f0:75:df:0a:90:c6:8e:20:6f:98:0f:f8:ac:23:
555 5f:70:29:36:a4:c9:86:e7:b1:9a:20:cb:53:a5:85:
556 e7:3d:be:7d:9a:fe:24:45:33:dc:76:15:ed:0f:a2:
557 71:64:4c:65:2e:81:68:45:a7
558 Exponent: 65537 (0x10001)
559 Signature Algorithm: sha1WithRSAEncryption
560 10:72:52:a9:05:14:19:32:08:41:f0:c5:6b:0a:cc:7e:0f:21:
561 19:cd:e4:67:dc:5f:a9:1b:e6:ca:e8:73:9d:22:d8:98:6e:73:
562 03:61:91:c5:7c:b0:45:40:6e:44:9d:8d:b0:b1:96:74:61:2d:
563 0d:a9:45:d2:a4:92:2a:d6:9a:75:97:6e:3f:53:fd:45:99:60:
564 1d:a8:2b:4c:f9:5e:a7:09:d8:75:30:d7:d2:65:60:3d:67:d6:
565 48:55:75:69:3f:91:f5:48:0b:47:69:22:69:82:96:be:c9:c8:
566 38:86:4a:7a:2c:73:19:48:69:4e:6b:7c:65:bf:0f:fc:70:ce:
567 88:90
568SHA1 Fingerprint=A1:DB:63:93:91:6F:17:E4:18:55:09:40:04:15:C7:02:40:B0:AE:6B
569-----BEGIN CERTIFICATE-----
570MIICPDCCAaUCEDyRMcsf9tAbDpq40ES/Er4wDQYJKoZIhvcNAQEFBQAwXzELMAkG
571A1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMTcwNQYDVQQLEy5DbGFz
572cyAzIFB1YmxpYyBQcmltYXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTk2
573MDEyOTAwMDAwMFoXDTI4MDgwMjIzNTk1OVowXzELMAkGA1UEBhMCVVMxFzAVBgNV
574BAoTDlZlcmlTaWduLCBJbmMuMTcwNQYDVQQLEy5DbGFzcyAzIFB1YmxpYyBQcmlt
575YXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIGfMA0GCSqGSIb3DQEBAQUAA4GN
576ADCBiQKBgQDJXFme8huKARS0EN8EQNvjV69qRUCPhAwL0TPZ2RHP7gJYHyX3KqhE
577BarsAx94f56TuZoAqiN91qyFomNFx3InzPRMxnVx0jnvT0Lwdd8KkMaOIG+YD/is
578I19wKTakyYbnsZogy1Olhec9vn2a/iRFM9x2Fe0PonFkTGUugWhFpwIDAQABMA0G
579CSqGSIb3DQEBBQUAA4GBABByUqkFFBkyCEHwxWsKzH4PIRnN5GfcX6kb5sroc50i
5802JhucwNhkcV8sEVAbkSdjbCxlnRhLQ2pRdKkkirWmnWXbj9T/UWZYB2oK0z5XqcJ
5812HUw19JlYD1n1khVdWk/kfVIC0dpImmClr7JyDiGSnoscxlIaU5rfGW/D/xwzoiQ
582-----END CERTIFICATE-----
583Certificate:
584 Data:
585 Version: 3 (0x2)
586 Serial Number:
587 18:da:d1:9e:26:7d:e8:bb:4a:21:58:cd:cc:6b:3b:4a
588 Signature Algorithm: sha1WithRSAEncryption
589 Issuer: C=US, O=VeriSign, Inc., OU=VeriSign Trust Network, OU=(c) 2006 VeriSign, Inc. - For authorized use only, CN=VeriSign Class 3 Public Primary Certification Authority - G5
590 Validity
591 Not Before: Nov 8 00:00:00 2006 GMT
592 Not After : Jul 16 23:59:59 2036 GMT
593 Subject: C=US, O=VeriSign, Inc., OU=VeriSign Trust Network, OU=(c) 2006 VeriSign, Inc. - For authorized use only, CN=VeriSign Class 3 Public Primary Certification Authority - G5
594 Subject Public Key Info:
595 Public Key Algorithm: rsaEncryption
596 Public-Key: (2048 bit)
597 Modulus:
598 00:af:24:08:08:29:7a:35:9e:60:0c:aa:e7:4b:3b:
599 4e:dc:7c:bc:3c:45:1c:bb:2b:e0:fe:29:02:f9:57:
600 08:a3:64:85:15:27:f5:f1:ad:c8:31:89:5d:22:e8:
601 2a:aa:a6:42:b3:8f:f8:b9:55:b7:b1:b7:4b:b3:fe:
602 8f:7e:07:57:ec:ef:43:db:66:62:15:61:cf:60:0d:
603 a4:d8:de:f8:e0:c3:62:08:3d:54:13:eb:49:ca:59:
604 54:85:26:e5:2b:8f:1b:9f:eb:f5:a1:91:c2:33:49:
605 d8:43:63:6a:52:4b:d2:8f:e8:70:51:4d:d1:89:69:
606 7b:c7:70:f6:b3:dc:12:74:db:7b:5d:4b:56:d3:96:
607 bf:15:77:a1:b0:f4:a2:25:f2:af:1c:92:67:18:e5:
608 f4:06:04:ef:90:b9:e4:00:e4:dd:3a:b5:19:ff:02:
609 ba:f4:3c:ee:e0:8b:eb:37:8b:ec:f4:d7:ac:f2:f6:
610 f0:3d:af:dd:75:91:33:19:1d:1c:40:cb:74:24:19:
611 21:93:d9:14:fe:ac:2a:52:c7:8f:d5:04:49:e4:8d:
612 63:47:88:3c:69:83:cb:fe:47:bd:2b:7e:4f:c5:95:
613 ae:0e:9d:d4:d1:43:c0:67:73:e3:14:08:7e:e5:3f:
614 9f:73:b8:33:0a:cf:5d:3f:34:87:96:8a:ee:53:e8:
615 25:15
616 Exponent: 65537 (0x10001)
617 X509v3 extensions:
618 X509v3 Basic Constraints: critical
619 CA:TRUE
620 X509v3 Key Usage: critical
621 Certificate Sign, CRL Sign
622 1.3.6.1.5.5.7.1.12:
623 0_.].[0Y0W0U..image/gif0!0.0...+..............k...j.H.,{..0%.#http://logo.verisign.com/vslogo.gif
624 X509v3 Subject Key Identifier:
625 7F:D3:65:A7:C2:DD:EC:BB:F0:30:09:F3:43:39:FA:02:AF:33:31:33
626 Signature Algorithm: sha1WithRSAEncryption
627 93:24:4a:30:5f:62:cf:d8:1a:98:2f:3d:ea:dc:99:2d:bd:77:
628 f6:a5:79:22:38:ec:c4:a7:a0:78:12:ad:62:0e:45:70:64:c5:
629 e7:97:66:2d:98:09:7e:5f:af:d6:cc:28:65:f2:01:aa:08:1a:
630 47:de:f9:f9:7c:92:5a:08:69:20:0d:d9:3e:6d:6e:3c:0d:6e:
631 d8:e6:06:91:40:18:b9:f8:c1:ed:df:db:41:aa:e0:96:20:c9:
632 cd:64:15:38:81:c9:94:ee:a2:84:29:0b:13:6f:8e:db:0c:dd:
633 25:02:db:a4:8b:19:44:d2:41:7a:05:69:4a:58:4f:60:ca:7e:
634 82:6a:0b:02:aa:25:17:39:b5:db:7f:e7:84:65:2a:95:8a:bd:
635 86:de:5e:81:16:83:2d:10:cc:de:fd:a8:82:2a:6d:28:1f:0d:
636 0b:c4:e5:e7:1a:26:19:e1:f4:11:6f:10:b5:95:fc:e7:42:05:
637 32:db:ce:9d:51:5e:28:b6:9e:85:d3:5b:ef:a5:7d:45:40:72:
638 8e:b7:0e:6b:0e:06:fb:33:35:48:71:b8:9d:27:8b:c4:65:5f:
639 0d:86:76:9c:44:7a:f6:95:5c:f6:5d:32:08:33:a4:54:b6:18:
640 3f:68:5c:f2:42:4a:85:38:54:83:5f:d1:e8:2c:f2:ac:11:d6:
641 a8:ed:63:6a
642SHA1 Fingerprint=4E:B6:D5:78:49:9B:1C:CF:5F:58:1E:AD:56:BE:3D:9B:67:44:A5:E5
643-----BEGIN CERTIFICATE-----
644MIIE0zCCA7ugAwIBAgIQGNrRniZ96LtKIVjNzGs7SjANBgkqhkiG9w0BAQUFADCB
645yjELMAkGA1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQL
646ExZWZXJpU2lnbiBUcnVzdCBOZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwNiBWZXJp
647U2lnbiwgSW5jLiAtIEZvciBhdXRob3JpemVkIHVzZSBvbmx5MUUwQwYDVQQDEzxW
648ZXJpU2lnbiBDbGFzcyAzIFB1YmxpYyBQcmltYXJ5IENlcnRpZmljYXRpb24gQXV0
649aG9yaXR5IC0gRzUwHhcNMDYxMTA4MDAwMDAwWhcNMzYwNzE2MjM1OTU5WjCByjEL
650MAkGA1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZW
651ZXJpU2lnbiBUcnVzdCBOZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwNiBWZXJpU2ln
652biwgSW5jLiAtIEZvciBhdXRob3JpemVkIHVzZSBvbmx5MUUwQwYDVQQDEzxWZXJp
653U2lnbiBDbGFzcyAzIFB1YmxpYyBQcmltYXJ5IENlcnRpZmljYXRpb24gQXV0aG9y
654aXR5IC0gRzUwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCvJAgIKXo1
655nmAMqudLO07cfLw8RRy7K+D+KQL5VwijZIUVJ/XxrcgxiV0i6CqqpkKzj/i5Vbex
656t0uz/o9+B1fs70PbZmIVYc9gDaTY3vjgw2IIPVQT60nKWVSFJuUrjxuf6/WhkcIz
657SdhDY2pSS9KP6HBRTdGJaXvHcPaz3BJ023tdS1bTlr8Vd6Gw9KIl8q8ckmcY5fQG
658BO+QueQA5N06tRn/Arr0PO7gi+s3i+z016zy9vA9r911kTMZHRxAy3QkGSGT2RT+
659rCpSx4/VBEnkjWNHiDxpg8v+R70rfk/Fla4OndTRQ8Bnc+MUCH7lP59zuDMKz10/
660NIeWiu5T6CUVAgMBAAGjgbIwga8wDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8E
661BAMCAQYwbQYIKwYBBQUHAQwEYTBfoV2gWzBZMFcwVRYJaW1hZ2UvZ2lmMCEwHzAH
662BgUrDgMCGgQUj+XTGoasjY5rw8+AatRIGCx7GS4wJRYjaHR0cDovL2xvZ28udmVy
663aXNpZ24uY29tL3ZzbG9nby5naWYwHQYDVR0OBBYEFH/TZafC3ey78DAJ80M5+gKv
664MzEzMA0GCSqGSIb3DQEBBQUAA4IBAQCTJEowX2LP2BqYLz3q3JktvXf2pXkiOOzE
665p6B4Eq1iDkVwZMXnl2YtmAl+X6/WzChl8gGqCBpH3vn5fJJaCGkgDdk+bW48DW7Y
6665gaRQBi5+MHt39tBquCWIMnNZBU4gcmU7qKEKQsTb47bDN0lAtukixlE0kF6BWlK
667WE9gyn6CagsCqiUXObXbf+eEZSqVir2G3l6BFoMtEMze/aiCKm0oHw0LxOXnGiYZ
6684fQRbxC1lfznQgUy286dUV4otp6F01vvpX1FQHKOtw5rDgb7MzVIcbidJ4vEZV8N
669hnacRHr2lVz2XTIIM6RUthg/aFzyQkqFOFSDX9HoLPKsEdao7WNq
670-----END CERTIFICATE-----
671Certificate:
672 Data:
673 Version: 1 (0x0)
674 Serial Number:
675 9b:7e:06:49:a3:3e:62:b9:d5:ee:90:48:71:29:ef:57
676 Signature Algorithm: sha1WithRSAEncryption
677 Issuer: C=US, O=VeriSign, Inc., OU=VeriSign Trust Network, OU=(c) 1999 VeriSign, Inc. - For authorized use only, CN=VeriSign Class 3 Public Primary Certification Authority - G3
678 Validity
679 Not Before: Oct 1 00:00:00 1999 GMT
680 Not After : Jul 16 23:59:59 2036 GMT
681 Subject: C=US, O=VeriSign, Inc., OU=VeriSign Trust Network, OU=(c) 1999 VeriSign, Inc. - For authorized use only, CN=VeriSign Class 3 Public Primary Certification Authority - G3
682 Subject Public Key Info:
683 Public Key Algorithm: rsaEncryption
684 Public-Key: (2048 bit)
685 Modulus:
686 00:cb:ba:9c:52:fc:78:1f:1a:1e:6f:1b:37:73:bd:
687 f8:c9:6b:94:12:30:4f:f0:36:47:f5:d0:91:0a:f5:
688 17:c8:a5:61:c1:16:40:4d:fb:8a:61:90:e5:76:20:
689 c1:11:06:7d:ab:2c:6e:a6:f5:11:41:8e:fa:2d:ad:
690 2a:61:59:a4:67:26:4c:d0:e8:bc:52:5b:70:20:04:
691 58:d1:7a:c9:a4:69:bc:83:17:64:ad:05:8b:bc:d0:
692 58:ce:8d:8c:f5:eb:f0:42:49:0b:9d:97:27:67:32:
693 6e:e1:ae:93:15:1c:70:bc:20:4d:2f:18:de:92:88:
694 e8:6c:85:57:11:1a:e9:7e:e3:26:11:54:a2:45:96:
695 55:83:ca:30:89:e8:dc:d8:a3:ed:2a:80:3f:7f:79:
696 65:57:3e:15:20:66:08:2f:95:93:bf:aa:47:2f:a8:
697 46:97:f0:12:e2:fe:c2:0a:2b:51:e6:76:e6:b7:46:
698 b7:e2:0d:a6:cc:a8:c3:4c:59:55:89:e6:e8:53:5c:
699 1c:ea:9d:f0:62:16:0b:a7:c9:5f:0c:f0:de:c2:76:
700 ce:af:f7:6a:f2:fa:41:a6:a2:33:14:c9:e5:7a:63:
701 d3:9e:62:37:d5:85:65:9e:0e:e6:53:24:74:1b:5e:
702 1d:12:53:5b:c7:2c:e7:83:49:3b:15:ae:8a:68:b9:
703 57:97
704 Exponent: 65537 (0x10001)
705 Signature Algorithm: sha1WithRSAEncryption
706 11:14:96:c1:ab:92:08:f7:3f:2f:c9:b2:fe:e4:5a:9f:64:de:
707 db:21:4f:86:99:34:76:36:57:dd:d0:15:2f:c5:ad:7f:15:1f:
708 37:62:73:3e:d4:e7:5f:ce:17:03:db:35:fa:2b:db:ae:60:09:
709 5f:1e:5f:8f:6e:bb:0b:3d:ea:5a:13:1e:0c:60:6f:b5:c0:b5:
710 23:22:2e:07:0b:cb:a9:74:cb:47:bb:1d:c1:d7:a5:6b:cc:2f:
711 d2:42:fd:49:dd:a7:89:cf:53:ba:da:00:5a:28:bf:82:df:f8:
712 ba:13:1d:50:86:82:fd:8e:30:8f:29:46:b0:1e:3d:35:da:38:
713 62:16:18:4a:ad:e6:b6:51:6c:de:af:62:eb:01:d0:1e:24:fe:
714 7a:8f:12:1a:12:68:b8:fb:66:99:14:14:45:5c:ae:e7:ae:69:
715 17:81:2b:5a:37:c9:5e:2a:f4:c6:e2:a1:5c:54:9b:a6:54:00:
716 cf:f0:f1:c1:c7:98:30:1a:3b:36:16:db:a3:6e:ea:fd:ad:b2:
717 c2:da:ef:02:47:13:8a:c0:f1:b3:31:ad:4f:1c:e1:4f:9c:af:
718 0f:0c:9d:f7:78:0d:d8:f4:35:56:80:da:b7:6d:17:8f:9d:1e:
719 81:64:e1:fe:c5:45:ba:ad:6b:b9:0a:7a:4e:4f:4b:84:ee:4b:
720 f1:7d:dd:11
721SHA1 Fingerprint=13:2D:0D:45:53:4B:69:97:CD:B2:D5:C3:39:E2:55:76:60:9B:5C:C6
722-----BEGIN CERTIFICATE-----
723MIIEGjCCAwICEQCbfgZJoz5iudXukEhxKe9XMA0GCSqGSIb3DQEBBQUAMIHKMQsw
724CQYDVQQGEwJVUzEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xHzAdBgNVBAsTFlZl
725cmlTaWduIFRydXN0IE5ldHdvcmsxOjA4BgNVBAsTMShjKSAxOTk5IFZlcmlTaWdu
726LCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxRTBDBgNVBAMTPFZlcmlT
727aWduIENsYXNzIDMgUHVibGljIFByaW1hcnkgQ2VydGlmaWNhdGlvbiBBdXRob3Jp
728dHkgLSBHMzAeFw05OTEwMDEwMDAwMDBaFw0zNjA3MTYyMzU5NTlaMIHKMQswCQYD
729VQQGEwJVUzEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xHzAdBgNVBAsTFlZlcmlT
730aWduIFRydXN0IE5ldHdvcmsxOjA4BgNVBAsTMShjKSAxOTk5IFZlcmlTaWduLCBJ
731bmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxRTBDBgNVBAMTPFZlcmlTaWdu
732IENsYXNzIDMgUHVibGljIFByaW1hcnkgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkg
733LSBHMzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMu6nFL8eB8aHm8b
734N3O9+MlrlBIwT/A2R/XQkQr1F8ilYcEWQE37imGQ5XYgwREGfassbqb1EUGO+i2t
735KmFZpGcmTNDovFJbcCAEWNF6yaRpvIMXZK0Fi7zQWM6NjPXr8EJJC52XJ2cybuGu
736kxUccLwgTS8Y3pKI6GyFVxEa6X7jJhFUokWWVYPKMIno3Nij7SqAP395ZVc+FSBm
737CC+Vk7+qRy+oRpfwEuL+wgorUeZ25rdGt+INpsyow0xZVYnm6FNcHOqd8GIWC6fJ
738Xwzw3sJ2zq/3avL6QaaiMxTJ5Xpj055iN9WFZZ4O5lMkdBteHRJTW8cs54NJOxWu
739imi5V5cCAwEAATANBgkqhkiG9w0BAQUFAAOCAQEAERSWwauSCPc/L8my/uRan2Te
7402yFPhpk0djZX3dAVL8WtfxUfN2JzPtTnX84XA9s1+ivbrmAJXx5fj267Cz3qWhMe
741DGBvtcC1IyIuBwvLqXTLR7sdwdela8wv0kL9Sd2nic9TutoAWii/gt/4uhMdUIaC
742/Y4wjylGsB49Ndo4YhYYSq3mtlFs3q9i6wHQHiT+eo8SGhJouPtmmRQURVyu565p
743F4ErWjfJXir0xuKhXFSbplQAz/DxwceYMBo7Nhbbo27q/a2ywtrvAkcTisDxszGt
744TxzhT5yvDwyd93gN2PQ1VoDat20Xj50egWTh/sVFuq1ruQp6Tk9LhO5L8X3dEQ==
745-----END CERTIFICATE-----
746Certificate:
747 Data:
748 Version: 3 (0x2)
749 Serial Number:
750 2f:80:fe:23:8c:0e:22:0f:48:67:12:28:91:87:ac:b3
751 Signature Algorithm: ecdsa-with-SHA384
752 Issuer: C=US, O=VeriSign, Inc., OU=VeriSign Trust Network, OU=(c) 2007 VeriSign, Inc. - For authorized use only, CN=VeriSign Class 3 Public Primary Certification Authority - G4
753 Validity
754 Not Before: Nov 5 00:00:00 2007 GMT
755 Not After : Jan 18 23:59:59 2038 GMT
756 Subject: C=US, O=VeriSign, Inc., OU=VeriSign Trust Network, OU=(c) 2007 VeriSign, Inc. - For authorized use only, CN=VeriSign Class 3 Public Primary Certification Authority - G4
757 Subject Public Key Info:
758 Public Key Algorithm: id-ecPublicKey
759 Public-Key: (384 bit)
760 pub:
761 04:a7:56:7a:7c:52:da:64:9b:0e:2d:5c:d8:5e:ac:
762 92:3d:fe:01:e6:19:4a:3d:14:03:4b:fa:60:27:20:
763 d9:83:89:69:fa:54:c6:9a:18:5e:55:2a:64:de:06:
764 f6:8d:4a:3b:ad:10:3c:65:3d:90:88:04:89:e0:30:
765 61:b3:ae:5d:01:a7:7b:de:7c:b2:be:ca:65:61:00:
766 86:ae:da:8f:7b:d0:89:ad:4d:1d:59:9a:41:b1:bc:
767 47:80:dc:9e:62:c3:f9
768 ASN1 OID: secp384r1
769 X509v3 extensions:
770 X509v3 Basic Constraints: critical
771 CA:TRUE
772 X509v3 Key Usage: critical
773 Certificate Sign, CRL Sign
774 1.3.6.1.5.5.7.1.12:
775 0_.].[0Y0W0U..image/gif0!0.0...+..............k...j.H.,{..0%.#http://logo.verisign.com/vslogo.gif
776 X509v3 Subject Key Identifier:
777 B3:16:91:FD:EE:A6:6E:E4:B5:2E:49:8F:87:78:81:80:EC:E5:B1:B5
778 Signature Algorithm: ecdsa-with-SHA384
779 30:65:02:30:66:21:0c:18:26:60:5a:38:7b:56:42:e0:a7:fc:
780 36:84:51:91:20:2c:76:4d:43:3d:c4:1d:84:23:d0:ac:d6:7c:
781 35:06:ce:cd:69:bd:90:0d:db:6c:48:42:1d:0e:aa:42:02:31:
782 00:9c:3d:48:39:23:39:58:1a:15:12:59:6a:9e:ef:d5:59:b2:
783 1d:52:2c:99:71:cd:c7:29:df:1b:2a:61:7b:71:d1:de:f3:c0:
784 e5:0d:3a:4a:aa:2d:a7:d8:86:2a:dd:2e:10
785SHA1 Fingerprint=22:D5:D8:DF:8F:02:31:D1:8D:F7:9D:B7:CF:8A:2D:64:C9:3F:6C:3A
786-----BEGIN CERTIFICATE-----
787MIIDhDCCAwqgAwIBAgIQL4D+I4wOIg9IZxIokYesszAKBggqhkjOPQQDAzCByjEL
788MAkGA1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZW
789ZXJpU2lnbiBUcnVzdCBOZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwNyBWZXJpU2ln
790biwgSW5jLiAtIEZvciBhdXRob3JpemVkIHVzZSBvbmx5MUUwQwYDVQQDEzxWZXJp
791U2lnbiBDbGFzcyAzIFB1YmxpYyBQcmltYXJ5IENlcnRpZmljYXRpb24gQXV0aG9y
792aXR5IC0gRzQwHhcNMDcxMTA1MDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCByjELMAkG
793A1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJp
794U2lnbiBUcnVzdCBOZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwNyBWZXJpU2lnbiwg
795SW5jLiAtIEZvciBhdXRob3JpemVkIHVzZSBvbmx5MUUwQwYDVQQDEzxWZXJpU2ln
796biBDbGFzcyAzIFB1YmxpYyBQcmltYXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5
797IC0gRzQwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAASnVnp8Utpkmw4tXNherJI9/gHm
798GUo9FANL+mAnINmDiWn6VMaaGF5VKmTeBvaNSjutEDxlPZCIBIngMGGzrl0Bp3ve
799fLK+ymVhAIau2o970ImtTR1ZmkGxvEeA3J5iw/mjgbIwga8wDwYDVR0TAQH/BAUw
800AwEB/zAOBgNVHQ8BAf8EBAMCAQYwbQYIKwYBBQUHAQwEYTBfoV2gWzBZMFcwVRYJ
801aW1hZ2UvZ2lmMCEwHzAHBgUrDgMCGgQUj+XTGoasjY5rw8+AatRIGCx7GS4wJRYj
802aHR0cDovL2xvZ28udmVyaXNpZ24uY29tL3ZzbG9nby5naWYwHQYDVR0OBBYEFLMW
803kf3upm7ktS5Jj4d4gYDs5bG1MAoGCCqGSM49BAMDA2gAMGUCMGYhDBgmYFo4e1ZC
8044Kf8NoRRkSAsdk1DPcQdhCPQrNZ8NQbOzWm9kA3bbEhCHQ6qQgIxAJw9SDkjOVga
805FRJZap7v1VmyHVIsmXHNxynfGyphe3HR3vPA5Q06Sqotp9iGKt0uEA==
806-----END CERTIFICATE-----
807Certificate:
808 Data:
809 Version: 3 (0x2)
810 Serial Number:
811 40:1a:c4:64:21:b3:13:21:03:0e:bb:e4:12:1a:c5:1d
812 Signature Algorithm: sha256WithRSAEncryption
813 Issuer: C=US, O=VeriSign, Inc., OU=VeriSign Trust Network, OU=(c) 2008 VeriSign, Inc. - For authorized use only, CN=VeriSign Universal Root Certification Authority
814 Validity
815 Not Before: Apr 2 00:00:00 2008 GMT
816 Not After : Dec 1 23:59:59 2037 GMT
817 Subject: C=US, O=VeriSign, Inc., OU=VeriSign Trust Network, OU=(c) 2008 VeriSign, Inc. - For authorized use only, CN=VeriSign Universal Root Certification Authority
818 Subject Public Key Info:
819 Public Key Algorithm: rsaEncryption
820 Public-Key: (2048 bit)
821 Modulus:
822 00:c7:61:37:5e:b1:01:34:db:62:d7:15:9b:ff:58:
823 5a:8c:23:23:d6:60:8e:91:d7:90:98:83:7a:e6:58:
824 19:38:8c:c5:f6:e5:64:85:b4:a2:71:fb:ed:bd:b9:
825 da:cd:4d:00:b4:c8:2d:73:a5:c7:69:71:95:1f:39:
826 3c:b2:44:07:9c:e8:0e:fa:4d:4a:c4:21:df:29:61:
827 8f:32:22:61:82:c5:87:1f:6e:8c:7c:5f:16:20:51:
828 44:d1:70:4f:57:ea:e3:1c:e3:cc:79:ee:58:d8:0e:
829 c2:b3:45:93:c0:2c:e7:9a:17:2b:7b:00:37:7a:41:
830 33:78:e1:33:e2:f3:10:1a:7f:87:2c:be:f6:f5:f7:
831 42:e2:e5:bf:87:62:89:5f:00:4b:df:c5:dd:e4:75:
832 44:32:41:3a:1e:71:6e:69:cb:0b:75:46:08:d1:ca:
833 d2:2b:95:d0:cf:fb:b9:40:6b:64:8c:57:4d:fc:13:
834 11:79:84:ed:5e:54:f6:34:9f:08:01:f3:10:25:06:
835 17:4a:da:f1:1d:7a:66:6b:98:60:66:a4:d9:ef:d2:
836 2e:82:f1:f0:ef:09:ea:44:c9:15:6a:e2:03:6e:33:
837 d3:ac:9f:55:00:c7:f6:08:6a:94:b9:5f:dc:e0:33:
838 f1:84:60:f9:5b:27:11:b4:fc:16:f2:bb:56:6a:80:
839 25:8d
840 Exponent: 65537 (0x10001)
841 X509v3 extensions:
842 X509v3 Basic Constraints: critical
843 CA:TRUE
844 X509v3 Key Usage: critical
845 Certificate Sign, CRL Sign
846 1.3.6.1.5.5.7.1.12:
847 0_.].[0Y0W0U..image/gif0!0.0...+..............k...j.H.,{..0%.#http://logo.verisign.com/vslogo.gif
848 X509v3 Subject Key Identifier:
849 B6:77:FA:69:48:47:9F:53:12:D5:C2:EA:07:32:76:07:D1:97:07:19
850 Signature Algorithm: sha256WithRSAEncryption
851 4a:f8:f8:b0:03:e6:2c:67:7b:e4:94:77:63:cc:6e:4c:f9:7d:
852 0e:0d:dc:c8:b9:35:b9:70:4f:63:fa:24:fa:6c:83:8c:47:9d:
853 3b:63:f3:9a:f9:76:32:95:91:b1:77:bc:ac:9a:be:b1:e4:31:
854 21:c6:81:95:56:5a:0e:b1:c2:d4:b1:a6:59:ac:f1:63:cb:b8:
855 4c:1d:59:90:4a:ef:90:16:28:1f:5a:ae:10:fb:81:50:38:0c:
856 6c:cc:f1:3d:c3:f5:63:e3:b3:e3:21:c9:24:39:e9:fd:15:66:
857 46:f4:1b:11:d0:4d:73:a3:7d:46:f9:3d:ed:a8:5f:62:d4:f1:
858 3f:f8:e0:74:57:2b:18:9d:81:b4:c4:28:da:94:97:a5:70:eb:
859 ac:1d:be:07:11:f0:d5:db:dd:e5:8c:f0:d5:32:b0:83:e6:57:
860 e2:8f:bf:be:a1:aa:bf:3d:1d:b5:d4:38:ea:d7:b0:5c:3a:4f:
861 6a:3f:8f:c0:66:6c:63:aa:e9:d9:a4:16:f4:81:d1:95:14:0e:
862 7d:cd:95:34:d9:d2:8f:70:73:81:7b:9c:7e:bd:98:61:d8:45:
863 87:98:90:c5:eb:86:30:c6:35:bf:f0:ff:c3:55:88:83:4b:ef:
864 05:92:06:71:f2:b8:98:93:b7:ec:cd:82:61:f1:38:e6:4f:97:
865 98:2a:5a:8d
866SHA1 Fingerprint=36:79:CA:35:66:87:72:30:4D:30:A5:FB:87:3B:0F:A7:7B:B7:0D:54
867-----BEGIN CERTIFICATE-----
868MIIEuTCCA6GgAwIBAgIQQBrEZCGzEyEDDrvkEhrFHTANBgkqhkiG9w0BAQsFADCB
869vTELMAkGA1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQL
870ExZWZXJpU2lnbiBUcnVzdCBOZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwOCBWZXJp
871U2lnbiwgSW5jLiAtIEZvciBhdXRob3JpemVkIHVzZSBvbmx5MTgwNgYDVQQDEy9W
872ZXJpU2lnbiBVbml2ZXJzYWwgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAe
873Fw0wODA0MDIwMDAwMDBaFw0zNzEyMDEyMzU5NTlaMIG9MQswCQYDVQQGEwJVUzEX
874MBUGA1UEChMOVmVyaVNpZ24sIEluYy4xHzAdBgNVBAsTFlZlcmlTaWduIFRydXN0
875IE5ldHdvcmsxOjA4BgNVBAsTMShjKSAyMDA4IFZlcmlTaWduLCBJbmMuIC0gRm9y
876IGF1dGhvcml6ZWQgdXNlIG9ubHkxODA2BgNVBAMTL1ZlcmlTaWduIFVuaXZlcnNh
877bCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIIBIjANBgkqhkiG9w0BAQEF
878AAOCAQ8AMIIBCgKCAQEAx2E3XrEBNNti1xWb/1hajCMj1mCOkdeQmIN65lgZOIzF
8799uVkhbSicfvtvbnazU0AtMgtc6XHaXGVHzk8skQHnOgO+k1KxCHfKWGPMiJhgsWH
880H26MfF8WIFFE0XBPV+rjHOPMee5Y2A7Cs0WTwCznmhcrewA3ekEzeOEz4vMQGn+H
881LL729fdC4uW/h2KJXwBL38Xd5HVEMkE6HnFuacsLdUYI0crSK5XQz/u5QGtkjFdN
882/BMReYTtXlT2NJ8IAfMQJQYXStrxHXpma5hgZqTZ79IugvHw7wnqRMkVauIDbjPT
883rJ9VAMf2CGqUuV/c4DPxhGD5WycRtPwW8rtWaoAljQIDAQABo4GyMIGvMA8GA1Ud
884EwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMG0GCCsGAQUFBwEMBGEwX6FdoFsw
885WTBXMFUWCWltYWdlL2dpZjAhMB8wBwYFKw4DAhoEFI/l0xqGrI2Oa8PPgGrUSBgs
886exkuMCUWI2h0dHA6Ly9sb2dvLnZlcmlzaWduLmNvbS92c2xvZ28uZ2lmMB0GA1Ud
887DgQWBBS2d/ppSEefUxLVwuoHMnYH0ZcHGTANBgkqhkiG9w0BAQsFAAOCAQEASvj4
888sAPmLGd75JR3Y8xuTPl9Dg3cyLk1uXBPY/ok+myDjEedO2Pzmvl2MpWRsXe8rJq+
889seQxIcaBlVZaDrHC1LGmWazxY8u4TB1ZkErvkBYoH1quEPuBUDgMbMzxPcP1Y+Oz
8904yHJJDnp/RVmRvQbEdBNc6N9Rvk97ahfYtTxP/jgdFcrGJ2BtMQo2pSXpXDrrB2+
891BxHw1dvd5Yzw1TKwg+ZX4o+/vqGqvz0dtdQ46tewXDpPaj+PwGZsY6rp2aQW9IHR
892lRQOfc2VNNnSj3BzgXucfr2YYdhFh5iQxeuGMMY1v/D/w1WIg0vvBZIGcfK4mJO3
8937M2CYfE45k+XmCpajQ==
894-----END CERTIFICATE-----
895Certificate:
896 Data:
897 Version: 1 (0x0)
898 Serial Number:
899 ec:a0:a7:8b:6e:75:6a:01:cf:c4:7c:cc:2f:94:5e:d7
900 Signature Algorithm: sha1WithRSAEncryption
901 Issuer: C=US, O=VeriSign, Inc., OU=VeriSign Trust Network, OU=(c) 1999 VeriSign, Inc. - For authorized use only, CN=VeriSign Class 4 Public Primary Certification Authority - G3
902 Validity
903 Not Before: Oct 1 00:00:00 1999 GMT
904 Not After : Jul 16 23:59:59 2036 GMT
905 Subject: C=US, O=VeriSign, Inc., OU=VeriSign Trust Network, OU=(c) 1999 VeriSign, Inc. - For authorized use only, CN=VeriSign Class 4 Public Primary Certification Authority - G3
906 Subject Public Key Info:
907 Public Key Algorithm: rsaEncryption
908 Public-Key: (2048 bit)
909 Modulus:
910 00:ad:cb:a5:11:69:c6:59:ab:f1:8f:b5:19:0f:56:
911 ce:cc:b5:1f:20:e4:9e:26:25:4b:e0:73:65:89:59:
912 de:d0:83:e4:f5:0f:b5:bb:ad:f1:7c:e8:21:fc:e4:
913 e8:0c:ee:7c:45:22:19:76:92:b4:13:b7:20:5b:09:
914 fa:61:ae:a8:f2:a5:8d:85:c2:2a:d6:de:66:36:d2:
915 9b:02:f4:a8:92:60:7c:9c:69:b4:8f:24:1e:d0:86:
916 52:f6:32:9c:41:58:1e:22:bd:cd:45:62:95:08:6e:
917 d0:66:dd:53:a2:cc:f0:10:dc:54:73:8b:04:a1:46:
918 33:33:5c:17:40:b9:9e:4d:d3:f3:be:55:83:e8:b1:
919 89:8e:5a:7c:9a:96:22:90:3b:88:25:f2:d2:53:88:
920 02:0c:0b:78:f2:e6:37:17:4b:30:46:07:e4:80:6d:
921 a6:d8:96:2e:e8:2c:f8:11:b3:38:0d:66:a6:9b:ea:
922 c9:23:5b:db:8e:e2:f3:13:8e:1a:59:2d:aa:02:f0:
923 ec:a4:87:66:dc:c1:3f:f5:d8:b9:f4:ec:82:c6:d2:
924 3d:95:1d:e5:c0:4f:84:c9:d9:a3:44:28:06:6a:d7:
925 45:ac:f0:6b:6a:ef:4e:5f:f8:11:82:1e:38:63:34:
926 66:50:d4:3e:93:73:fa:30:c3:66:ad:ff:93:2d:97:
927 ef:03
928 Exponent: 65537 (0x10001)
929 Signature Algorithm: sha1WithRSAEncryption
930 8f:fa:25:6b:4f:5b:e4:a4:4e:27:55:ab:22:15:59:3c:ca:b5:
931 0a:d4:4a:db:ab:dd:a1:5f:53:c5:a0:57:39:c2:ce:47:2b:be:
932 3a:c8:56:bf:c2:d9:27:10:3a:b1:05:3c:c0:77:31:bb:3a:d3:
933 05:7b:6d:9a:1c:30:8c:80:cb:93:93:2a:83:ab:05:51:82:02:
934 00:11:67:6b:f3:88:61:47:5f:03:93:d5:5b:0d:e0:f1:d4:a1:
935 32:35:85:b2:3a:db:b0:82:ab:d1:cb:0a:bc:4f:8c:5b:c5:4b:
936 00:3b:1f:2a:82:a6:7e:36:85:dc:7e:3c:67:00:b5:e4:3b:52:
937 e0:a8:eb:5d:15:f9:c6:6d:f0:ad:1d:0e:85:b7:a9:9a:73:14:
938 5a:5b:8f:41:28:c0:d5:e8:2d:4d:a4:5e:cd:aa:d9:ed:ce:dc:
939 d8:d5:3c:42:1d:17:c1:12:5d:45:38:c3:38:f3:fc:85:2e:83:
940 46:48:b2:d7:20:5f:92:36:8f:e7:79:0f:98:5e:99:e8:f0:d0:
941 a4:bb:f5:53:bd:2a:ce:59:b0:af:6e:7f:6c:bb:d2:1e:00:b0:
942 21:ed:f8:41:62:82:b9:d8:b2:c4:bb:46:50:f3:31:c5:8f:01:
943 a8:74:eb:f5:78:27:da:e7:f7:66:43:f3:9e:83:3e:20:aa:c3:
944 35:60:91:ce
945SHA1 Fingerprint=C8:EC:8C:87:92:69:CB:4B:AB:39:E9:8D:7E:57:67:F3:14:95:73:9D
946-----BEGIN CERTIFICATE-----
947MIIEGjCCAwICEQDsoKeLbnVqAc/EfMwvlF7XMA0GCSqGSIb3DQEBBQUAMIHKMQsw
948CQYDVQQGEwJVUzEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xHzAdBgNVBAsTFlZl
949cmlTaWduIFRydXN0IE5ldHdvcmsxOjA4BgNVBAsTMShjKSAxOTk5IFZlcmlTaWdu
950LCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxRTBDBgNVBAMTPFZlcmlT
951aWduIENsYXNzIDQgUHVibGljIFByaW1hcnkgQ2VydGlmaWNhdGlvbiBBdXRob3Jp
952dHkgLSBHMzAeFw05OTEwMDEwMDAwMDBaFw0zNjA3MTYyMzU5NTlaMIHKMQswCQYD
953VQQGEwJVUzEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xHzAdBgNVBAsTFlZlcmlT
954aWduIFRydXN0IE5ldHdvcmsxOjA4BgNVBAsTMShjKSAxOTk5IFZlcmlTaWduLCBJ
955bmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxRTBDBgNVBAMTPFZlcmlTaWdu
956IENsYXNzIDQgUHVibGljIFByaW1hcnkgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkg
957LSBHMzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAK3LpRFpxlmr8Y+1
958GQ9Wzsy1HyDkniYlS+BzZYlZ3tCD5PUPtbut8XzoIfzk6AzufEUiGXaStBO3IFsJ
959+mGuqPKljYXCKtbeZjbSmwL0qJJgfJxptI8kHtCGUvYynEFYHiK9zUVilQhu0Gbd
960U6LM8BDcVHOLBKFGMzNcF0C5nk3T875Vg+ixiY5afJqWIpA7iCXy0lOIAgwLePLm
961NxdLMEYH5IBtptiWLugs+BGzOA1mppvqySNb247i8xOOGlktqgLw7KSHZtzBP/XY
962ufTsgsbSPZUd5cBPhMnZo0QoBmrXRazwa2rvTl/4EYIeOGM0ZlDUPpNz+jDDZq3/
963ky2X7wMCAwEAATANBgkqhkiG9w0BAQUFAAOCAQEAj/ola09b5KROJ1WrIhVZPMq1
964CtRK26vdoV9TxaBXOcLORyu+OshWv8LZJxA6sQU8wHcxuzrTBXttmhwwjIDLk5Mq
965g6sFUYICABFna/OIYUdfA5PVWw3g8dShMjWFsjrbsIKr0csKvE+MW8VLADsfKoKm
966fjaF3H48ZwC15DtS4KjrXRX5xm3wrR0OhbepmnMUWluPQSjA1egtTaRezarZ7c7c
9672NU8Qh0XwRJdRTjDOPP8hS6DRkiy1yBfkjaP53kPmF6Z6PDQpLv1U70qzlmwr25/
968bLvSHgCwIe34QWKCudiyxLtGUPMxxY8BqHTr9Xgn2uf3ZkPznoM+IKrDNWCRzg==
969-----END CERTIFICATE-----
970Certificate:
971 Data:
972 Version: 3 (0x2)
973 Serial Number: 1 (0x1)
974 Signature Algorithm: sha1WithRSAEncryption
975 Issuer: C=IL, O=StartCom Ltd., OU=Secure Digital Certificate Signing, CN=StartCom Certification Authority
976 Validity
977 Not Before: Sep 17 19:46:36 2006 GMT
978 Not After : Sep 17 19:46:36 2036 GMT
979 Subject: C=IL, O=StartCom Ltd., OU=Secure Digital Certificate Signing, CN=StartCom Certification Authority
980 Subject Public Key Info:
981 Public Key Algorithm: rsaEncryption
982 Public-Key: (4096 bit)
983 Modulus:
984 00:c1:88:db:09:bc:6c:46:7c:78:9f:95:7b:b5:33:
985 90:f2:72:62:d6:c1:36:20:22:24:5e:ce:e9:77:f2:
986 43:0a:a2:06:64:a4:cc:8e:36:f8:38:e6:23:f0:6e:
987 6d:b1:3c:dd:72:a3:85:1c:a1:d3:3d:b4:33:2b:d3:
988 2f:af:fe:ea:b0:41:59:67:b6:c4:06:7d:0a:9e:74:
989 85:d6:79:4c:80:37:7a:df:39:05:52:59:f7:f4:1b:
990 46:43:a4:d2:85:85:d2:c3:71:f3:75:62:34:ba:2c:
991 8a:7f:1e:8f:ee:ed:34:d0:11:c7:96:cd:52:3d:ba:
992 33:d6:dd:4d:de:0b:3b:4a:4b:9f:c2:26:2f:fa:b5:
993 16:1c:72:35:77:ca:3c:5d:e6:ca:e1:26:8b:1a:36:
994 76:5c:01:db:74:14:25:fe:ed:b5:a0:88:0f:dd:78:
995 ca:2d:1f:07:97:30:01:2d:72:79:fa:46:d6:13:2a:
996 a8:b9:a6:ab:83:49:1d:e5:f2:ef:dd:e4:01:8e:18:
997 0a:8f:63:53:16:85:62:a9:0e:19:3a:cc:b5:66:a6:
998 c2:6b:74:07:e4:2b:e1:76:3e:b4:6d:d8:f6:44:e1:
999 73:62:1f:3b:c4:be:a0:53:56:25:6c:51:09:f7:aa:
1000 ab:ca:bf:76:fd:6d:9b:f3:9d:db:bf:3d:66:bc:0c:
1001 56:aa:af:98:48:95:3a:4b:df:a7:58:50:d9:38:75:
1002 a9:5b:ea:43:0c:02:ff:99:eb:e8:6c:4d:70:5b:29:
1003 65:9c:dd:aa:5d:cc:af:01:31:ec:0c:eb:d2:8d:e8:
1004 ea:9c:7b:e6:6e:f7:27:66:0c:1a:48:d7:6e:42:e3:
1005 3f:de:21:3e:7b:e1:0d:70:fb:63:aa:a8:6c:1a:54:
1006 b4:5c:25:7a:c9:a2:c9:8b:16:a6:bb:2c:7e:17:5e:
1007 05:4d:58:6e:12:1d:01:ee:12:10:0d:c6:32:7f:18:
1008 ff:fc:f4:fa:cd:6e:91:e8:36:49:be:1a:48:69:8b:
1009 c2:96:4d:1a:12:b2:69:17:c1:0a:90:d6:fa:79:22:
1010 48:bf:ba:7b:69:f8:70:c7:fa:7a:37:d8:d8:0d:d2:
1011 76:4f:57:ff:90:b7:e3:91:d2:dd:ef:c2:60:b7:67:
1012 3a:dd:fe:aa:9c:f0:d4:8b:7f:72:22:ce:c6:9f:97:
1013 b6:f8:af:8a:a0:10:a8:d9:fb:18:c6:b6:b5:5c:52:
1014 3c:89:b6:19:2a:73:01:0a:0f:03:b3:12:60:f2:7a:
1015 2f:81:db:a3:6e:ff:26:30:97:f5:8b:dd:89:57:b6:
1016 ad:3d:b3:af:2b:c5:b7:76:02:f0:a5:d6:2b:9a:86:
1017 14:2a:72:f6:e3:33:8c:5d:09:4b:13:df:bb:8c:74:
1018 13:52:4b
1019 Exponent: 65537 (0x10001)
1020 X509v3 extensions:
1021 X509v3 Basic Constraints:
1022 CA:TRUE
1023 X509v3 Key Usage:
1024 Digital Signature, Key Encipherment, Key Agreement, Certificate Sign, CRL Sign
1025 X509v3 Subject Key Identifier:
1026 4E:0B:EF:1A:A4:40:5B:A5:17:69:87:30:CA:34:68:43:D0:41:AE:F2
1027 X509v3 CRL Distribution Points:
1028
1029 Full Name:
1030 URI:http://cert.startcom.org/sfsca-crl.crl
1031
1032 Full Name:
1033 URI:http://crl.startcom.org/sfsca-crl.crl
1034
1035 X509v3 Certificate Policies:
1036 Policy: 1.3.6.1.4.1.23223.1.1.1
1037 CPS: http://cert.startcom.org/policy.pdf
1038 CPS: http://cert.startcom.org/intermediate.pdf
1039 User Notice:
1040 Organization: Start Commercial (StartCom) Ltd.
1041 Number: 1
1042 Explicit Text: Limited Liability, read the section *Legal Limitations* of the StartCom Certification Authority Policy available at http://cert.startcom.org/policy.pdf
1043
1044 Netscape Cert Type:
1045 SSL CA, S/MIME CA, Object Signing CA
1046 Netscape Comment:
1047 StartCom Free SSL Certification Authority
1048 Signature Algorithm: sha1WithRSAEncryption
1049 16:6c:99:f4:66:0c:34:f5:d0:85:5e:7d:0a:ec:da:10:4e:38:
1050 1c:5e:df:a6:25:05:4b:91:32:c1:e8:3b:f1:3d:dd:44:09:5b:
1051 07:49:8a:29:cb:66:02:b7:b1:9a:f7:25:98:09:3c:8e:1b:e1:
1052 dd:36:87:2b:4b:bb:68:d3:39:66:3d:a0:26:c7:f2:39:91:1d:
1053 51:ab:82:7b:7e:d5:ce:5a:e4:e2:03:57:70:69:97:08:f9:5e:
1054 58:a6:0a:df:8c:06:9a:45:16:16:38:0a:5e:57:f6:62:c7:7a:
1055 02:05:e6:bc:1e:b5:f2:9e:f4:a9:29:83:f8:b2:14:e3:6e:28:
1056 87:44:c3:90:1a:de:38:a9:3c:ac:43:4d:64:45:ce:dd:28:a9:
1057 5c:f2:73:7b:04:f8:17:e8:ab:b1:f3:2e:5c:64:6e:73:31:3a:
1058 12:b8:bc:b3:11:e4:7d:8f:81:51:9a:3b:8d:89:f4:4d:93:66:
1059 7b:3c:03:ed:d3:9a:1d:9a:f3:65:50:f5:a0:d0:75:9f:2f:af:
1060 f0:ea:82:43:98:f8:69:9c:89:79:c4:43:8e:46:72:e3:64:36:
1061 12:af:f7:25:1e:38:89:90:77:7e:c3:6b:6a:b9:c3:cb:44:4b:
1062 ac:78:90:8b:e7:c7:2c:1e:4b:11:44:c8:34:52:27:cd:0a:5d:
1063 9f:85:c1:89:d5:1a:78:f2:95:10:53:32:dd:80:84:66:75:d9:
1064 b5:68:28:fb:61:2e:be:84:a8:38:c0:99:12:86:a5:1e:67:64:
1065 ad:06:2e:2f:a9:70:85:c7:96:0f:7c:89:65:f5:8e:43:54:0e:
1066 ab:dd:a5:80:39:94:60:c0:34:c9:96:70:2c:a3:12:f5:1f:48:
1067 7b:bd:1c:7e:6b:b7:9d:90:f4:22:3b:ae:f8:fc:2a:ca:fa:82:
1068 52:a0:ef:af:4b:55:93:eb:c1:b5:f0:22:8b:ac:34:4e:26:22:
1069 04:a1:87:2c:75:4a:b7:e5:7d:13:d7:b8:0c:64:c0:36:d2:c9:
1070 2f:86:12:8c:23:09:c1:1b:82:3b:73:49:a3:6a:57:87:94:e5:
1071 d6:78:c5:99:43:63:e3:4d:e0:77:2d:e1:65:99:72:69:04:1a:
1072 47:09:e6:0f:01:56:24:fb:1f:bf:0e:79:a9:58:2e:b9:c4:09:
1073 01:7e:95:ba:6d:00:06:3e:b2:ea:4a:10:39:d8:d0:2b:f5:bf:
1074 ec:75:bf:97:02:c5:09:1b:08:dc:55:37:e2:81:fb:37:84:43:
1075 62:20:ca:e7:56:4b:65:ea:fe:6c:c1:24:93:24:a1:34:eb:05:
1076 ff:9a:22:ae:9b:7d:3f:f1:65:51:0a:a6:30:6a:b3:f4:88:1c:
1077 80:0d:fc:72:8a:e8:83:5e
1078SHA1 Fingerprint=3E:2B:F7:F2:03:1B:96:F3:8C:E6:C4:D8:A8:5D:3E:2D:58:47:6A:0F
1079-----BEGIN CERTIFICATE-----
1080MIIHyTCCBbGgAwIBAgIBATANBgkqhkiG9w0BAQUFADB9MQswCQYDVQQGEwJJTDEW
1081MBQGA1UEChMNU3RhcnRDb20gTHRkLjErMCkGA1UECxMiU2VjdXJlIERpZ2l0YWwg
1082Q2VydGlmaWNhdGUgU2lnbmluZzEpMCcGA1UEAxMgU3RhcnRDb20gQ2VydGlmaWNh
1083dGlvbiBBdXRob3JpdHkwHhcNMDYwOTE3MTk0NjM2WhcNMzYwOTE3MTk0NjM2WjB9
1084MQswCQYDVQQGEwJJTDEWMBQGA1UEChMNU3RhcnRDb20gTHRkLjErMCkGA1UECxMi
1085U2VjdXJlIERpZ2l0YWwgQ2VydGlmaWNhdGUgU2lnbmluZzEpMCcGA1UEAxMgU3Rh
1086cnRDb20gQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwggIiMA0GCSqGSIb3DQEBAQUA
1087A4ICDwAwggIKAoICAQDBiNsJvGxGfHiflXu1M5DycmLWwTYgIiRezul38kMKogZk
1088pMyONvg45iPwbm2xPN1yo4UcodM9tDMr0y+v/uqwQVlntsQGfQqedIXWeUyAN3rf
1089OQVSWff0G0ZDpNKFhdLDcfN1YjS6LIp/Ho/u7TTQEceWzVI9ujPW3U3eCztKS5/C
1090Ji/6tRYccjV3yjxd5srhJosaNnZcAdt0FCX+7bWgiA/deMotHweXMAEtcnn6RtYT
1091Kqi5pquDSR3l8u/d5AGOGAqPY1MWhWKpDhk6zLVmpsJrdAfkK+F2PrRt2PZE4XNi
1092HzvEvqBTViVsUQn3qqvKv3b9bZvzndu/PWa8DFaqr5hIlTpL36dYUNk4dalb6kMM
1093Av+Z6+hsTXBbKWWc3apdzK8BMewM69KN6Oqce+Zu9ydmDBpI125C4z/eIT574Q1w
1094+2OqqGwaVLRcJXrJosmLFqa7LH4XXgVNWG4SHQHuEhANxjJ/GP/89PrNbpHoNkm+
1095Gkhpi8KWTRoSsmkXwQqQ1vp5Iki/untp+HDH+no32NgN0nZPV/+Qt+OR0t3vwmC3
1096Zzrd/qqc8NSLf3Iizsafl7b4r4qgEKjZ+xjGtrVcUjyJthkqcwEKDwOzEmDyei+B
109726Nu/yYwl/WL3YlXtq09s68rxbd2AvCl1iuahhQqcvbjM4xdCUsT37uMdBNSSwID
1098AQABo4ICUjCCAk4wDAYDVR0TBAUwAwEB/zALBgNVHQ8EBAMCAa4wHQYDVR0OBBYE
1099FE4L7xqkQFulF2mHMMo0aEPQQa7yMGQGA1UdHwRdMFswLKAqoCiGJmh0dHA6Ly9j
1100ZXJ0LnN0YXJ0Y29tLm9yZy9zZnNjYS1jcmwuY3JsMCugKaAnhiVodHRwOi8vY3Js
1101LnN0YXJ0Y29tLm9yZy9zZnNjYS1jcmwuY3JsMIIBXQYDVR0gBIIBVDCCAVAwggFM
1102BgsrBgEEAYG1NwEBATCCATswLwYIKwYBBQUHAgEWI2h0dHA6Ly9jZXJ0LnN0YXJ0
1103Y29tLm9yZy9wb2xpY3kucGRmMDUGCCsGAQUFBwIBFilodHRwOi8vY2VydC5zdGFy
1104dGNvbS5vcmcvaW50ZXJtZWRpYXRlLnBkZjCB0AYIKwYBBQUHAgIwgcMwJxYgU3Rh
1105cnQgQ29tbWVyY2lhbCAoU3RhcnRDb20pIEx0ZC4wAwIBARqBl0xpbWl0ZWQgTGlh
1106YmlsaXR5LCByZWFkIHRoZSBzZWN0aW9uICpMZWdhbCBMaW1pdGF0aW9ucyogb2Yg
1107dGhlIFN0YXJ0Q29tIENlcnRpZmljYXRpb24gQXV0aG9yaXR5IFBvbGljeSBhdmFp
1108bGFibGUgYXQgaHR0cDovL2NlcnQuc3RhcnRjb20ub3JnL3BvbGljeS5wZGYwEQYJ
1109YIZIAYb4QgEBBAQDAgAHMDgGCWCGSAGG+EIBDQQrFilTdGFydENvbSBGcmVlIFNT
1110TCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTANBgkqhkiG9w0BAQUFAAOCAgEAFmyZ
11119GYMNPXQhV59CuzaEE44HF7fpiUFS5Eyweg78T3dRAlbB0mKKctmArexmvclmAk8
1112jhvh3TaHK0u7aNM5Zj2gJsfyOZEdUauCe37Vzlrk4gNXcGmXCPleWKYK34wGmkUW
1113FjgKXlf2Ysd6AgXmvB618p70qSmD+LIU424oh0TDkBreOKk8rENNZEXO3SipXPJz
1114ewT4F+irsfMuXGRuczE6Eri8sxHkfY+BUZo7jYn0TZNmezwD7dOaHZrzZVD1oNB1
1115ny+v8OqCQ5j4aZyJecRDjkZy42Q2Eq/3JR44iZB3fsNrarnDy0RLrHiQi+fHLB5L
1116EUTINFInzQpdn4XBidUaePKVEFMy3YCEZnXZtWgo+2EuvoSoOMCZEoalHmdkrQYu
1117L6lwhceWD3yJZfWOQ1QOq92lgDmUYMA0yZZwLKMS9R9Ie70cfmu3nZD0Ijuu+Pwq
1118yvqCUqDvr0tVk+vBtfAii6w0TiYiBKGHLHVKt+V9E9e4DGTANtLJL4YSjCMJwRuC
1119O3NJo2pXh5Tl1njFmUNj403gdy3hZZlyaQQaRwnmDwFWJPsfvw55qVguucQJAX6V
1120um0ABj6y6koQOdjQK/W/7HW/lwLFCRsI3FU34oH7N4RDYiDK51ZLZer+bMEkkySh
1121NOsF/5oirpt9P/FlUQqmMGqz9IgcgA38corog14=
1122-----END CERTIFICATE-----
1123Certificate:
1124 Data:
1125 Version: 1 (0x0)
1126 Serial Number: 1 (0x1)
1127 Signature Algorithm: sha1WithRSAEncryption
1128 Issuer: L=ValiCert Validation Network, O=ValiCert, Inc., OU=ValiCert Class 2 Policy Validation Authority, CN=http://www.valicert.com//emailAddress=info@valicert.com
1129 Validity
1130 Not Before: Jun 26 00:19:54 1999 GMT
1131 Not After : Jun 26 00:19:54 2019 GMT
1132 Subject: L=ValiCert Validation Network, O=ValiCert, Inc., OU=ValiCert Class 2 Policy Validation Authority, CN=http://www.valicert.com//emailAddress=info@valicert.com
1133 Subject Public Key Info:
1134 Public Key Algorithm: rsaEncryption
1135 Public-Key: (1024 bit)
1136 Modulus:
1137 00:ce:3a:71:ca:e5:ab:c8:59:92:55:d7:ab:d8:74:
1138 0e:f9:ee:d9:f6:55:47:59:65:47:0e:05:55:dc:eb:
1139 98:36:3c:5c:53:5d:d3:30:cf:38:ec:bd:41:89:ed:
1140 25:42:09:24:6b:0a:5e:b3:7c:dd:52:2d:4c:e6:d4:
1141 d6:7d:5a:59:a9:65:d4:49:13:2d:24:4d:1c:50:6f:
1142 b5:c1:85:54:3b:fe:71:e4:d3:5c:42:f9:80:e0:91:
1143 1a:0a:5b:39:36:67:f3:3f:55:7c:1b:3f:b4:5f:64:
1144 73:34:e3:b4:12:bf:87:64:f8:da:12:ff:37:27:c1:
1145 b3:43:bb:ef:7b:6e:2e:69:f7
1146 Exponent: 65537 (0x10001)
1147 Signature Algorithm: sha1WithRSAEncryption
1148 3b:7f:50:6f:6f:50:94:99:49:62:38:38:1f:4b:f8:a5:c8:3e:
1149 a7:82:81:f6:2b:c7:e8:c5:ce:e8:3a:10:82:cb:18:00:8e:4d:
1150 bd:a8:58:7f:a1:79:00:b5:bb:e9:8d:af:41:d9:0f:34:ee:21:
1151 81:19:a0:32:49:28:f4:c4:8e:56:d5:52:33:fd:50:d5:7e:99:
1152 6c:03:e4:c9:4c:fc:cb:6c:ab:66:b3:4a:21:8c:e5:b5:0c:32:
1153 3e:10:b2:cc:6c:a1:dc:9a:98:4c:02:5b:f3:ce:b9:9e:a5:72:
1154 0e:4a:b7:3f:3c:e6:16:68:f8:be:ed:74:4c:bc:5b:d5:62:1f:
1155 43:dd
1156SHA1 Fingerprint=31:7A:2A:D0:7F:2B:33:5E:F5:A1:C3:4E:4B:57:E8:B7:D8:F1:FC:A6
1157-----BEGIN CERTIFICATE-----
1158MIIC5zCCAlACAQEwDQYJKoZIhvcNAQEFBQAwgbsxJDAiBgNVBAcTG1ZhbGlDZXJ0
1159IFZhbGlkYXRpb24gTmV0d29yazEXMBUGA1UEChMOVmFsaUNlcnQsIEluYy4xNTAz
1160BgNVBAsTLFZhbGlDZXJ0IENsYXNzIDIgUG9saWN5IFZhbGlkYXRpb24gQXV0aG9y
1161aXR5MSEwHwYDVQQDExhodHRwOi8vd3d3LnZhbGljZXJ0LmNvbS8xIDAeBgkqhkiG
11629w0BCQEWEWluZm9AdmFsaWNlcnQuY29tMB4XDTk5MDYyNjAwMTk1NFoXDTE5MDYy
1163NjAwMTk1NFowgbsxJDAiBgNVBAcTG1ZhbGlDZXJ0IFZhbGlkYXRpb24gTmV0d29y
1164azEXMBUGA1UEChMOVmFsaUNlcnQsIEluYy4xNTAzBgNVBAsTLFZhbGlDZXJ0IENs
1165YXNzIDIgUG9saWN5IFZhbGlkYXRpb24gQXV0aG9yaXR5MSEwHwYDVQQDExhodHRw
1166Oi8vd3d3LnZhbGljZXJ0LmNvbS8xIDAeBgkqhkiG9w0BCQEWEWluZm9AdmFsaWNl
1167cnQuY29tMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDOOnHK5avIWZJV16vY
1168dA757tn2VUdZZUcOBVXc65g2PFxTXdMwzzjsvUGJ7SVCCSRrCl6zfN1SLUzm1NZ9
1169WlmpZdRJEy0kTRxQb7XBhVQ7/nHk01xC+YDgkRoKWzk2Z/M/VXwbP7RfZHM047QS
1170v4dk+NoS/zcnwbNDu+97bi5p9wIDAQABMA0GCSqGSIb3DQEBBQUAA4GBADt/UG9v
1171UJSZSWI4OB9L+KXIPqeCgfYrx+jFzug6EILLGACOTb2oWH+heQC1u+mNr0HZDzTu
1172IYEZoDJJKPTEjlbVUjP9UNV+mWwD5MlM/Mtsq2azSiGM5bUMMj4QssxsodyamEwC
1173W/POuZ6lcg5Ktz885hZo+L7tdEy8W9ViH0Pd
1174-----END CERTIFICATE-----
1175Certificate:
1176 Data:
1177 Version: 3 (0x2)
1178 Serial Number: 927650371 (0x374ad243)
1179 Signature Algorithm: sha1WithRSAEncryption
1180 Issuer: C=US, O=Entrust.net, OU=www.entrust.net/CPS incorp. by ref. (limits liab.), OU=(c) 1999 Entrust.net Limited, CN=Entrust.net Secure Server Certification Authority
1181 Validity
1182 Not Before: May 25 16:09:40 1999 GMT
1183 Not After : May 25 16:39:40 2019 GMT
1184 Subject: C=US, O=Entrust.net, OU=www.entrust.net/CPS incorp. by ref. (limits liab.), OU=(c) 1999 Entrust.net Limited, CN=Entrust.net Secure Server Certification Authority
1185 Subject Public Key Info:
1186 Public Key Algorithm: rsaEncryption
1187 Public-Key: (1024 bit)
1188 Modulus:
1189 00:cd:28:83:34:54:1b:89:f3:0f:af:37:91:31:ff:
1190 af:31:60:c9:a8:e8:b2:10:68:ed:9f:e7:93:36:f1:
1191 0a:64:bb:47:f5:04:17:3f:23:47:4d:c5:27:19:81:
1192 26:0c:54:72:0d:88:2d:d9:1f:9a:12:9f:bc:b3:71:
1193 d3:80:19:3f:47:66:7b:8c:35:28:d2:b9:0a:df:24:
1194 da:9c:d6:50:79:81:7a:5a:d3:37:f7:c2:4a:d8:29:
1195 92:26:64:d1:e4:98:6c:3a:00:8a:f5:34:9b:65:f8:
1196 ed:e3:10:ff:fd:b8:49:58:dc:a0:de:82:39:6b:81:
1197 b1:16:19:61:b9:54:b6:e6:43
1198 Exponent: 3 (0x3)
1199 X509v3 extensions:
1200 Netscape Cert Type:
1201 SSL CA, S/MIME CA, Object Signing CA
1202 X509v3 CRL Distribution Points:
1203
1204 Full Name:
1205 DirName: C = US, O = Entrust.net, OU = www.entrust.net/CPS incorp. by ref. (limits liab.), OU = (c) 1999 Entrust.net Limited, CN = Entrust.net Secure Server Certification Authority, CN = CRL1
1206
1207 Full Name:
1208 URI:http://www.entrust.net/CRL/net1.crl
1209
1210 X509v3 Private Key Usage Period:
1211 Not Before: May 25 16:09:40 1999 GMT, Not After: May 25 16:09:40 2019 GMT
1212 X509v3 Key Usage:
1213 Certificate Sign, CRL Sign
1214 X509v3 Authority Key Identifier:
1215 keyid:F0:17:62:13:55:3D:B3:FF:0A:00:6B:FB:50:84:97:F3:ED:62:D0:1A
1216
1217 X509v3 Subject Key Identifier:
1218 F0:17:62:13:55:3D:B3:FF:0A:00:6B:FB:50:84:97:F3:ED:62:D0:1A
1219 X509v3 Basic Constraints:
1220 CA:TRUE
1221 1.2.840.113533.7.65.0:
1222 0
1223..V4.0....
1224 Signature Algorithm: sha1WithRSAEncryption
1225 90:dc:30:02:fa:64:74:c2:a7:0a:a5:7c:21:8d:34:17:a8:fb:
1226 47:0e:ff:25:7c:8d:13:0a:fb:e4:98:b5:ef:8c:f8:c5:10:0d:
1227 f7:92:be:f1:c3:d5:d5:95:6a:04:bb:2c:ce:26:36:65:c8:31:
1228 c6:e7:ee:3f:e3:57:75:84:7a:11:ef:46:4f:18:f4:d3:98:bb:
1229 a8:87:32:ba:72:f6:3c:e2:3d:9f:d7:1d:d9:c3:60:43:8c:58:
1230 0e:22:96:2f:62:a3:2c:1f:ba:ad:05:ef:ab:32:78:87:a0:54:
1231 73:19:b5:5c:05:f9:52:3e:6d:2d:45:0b:f7:0a:93:ea:ed:06:
1232 f9:b2
1233SHA1 Fingerprint=99:A6:9B:E6:1A:FE:88:6B:4D:2B:82:00:7C:B8:54:FC:31:7E:15:39
1234-----BEGIN CERTIFICATE-----
1235MIIE2DCCBEGgAwIBAgIEN0rSQzANBgkqhkiG9w0BAQUFADCBwzELMAkGA1UEBhMC
1236VVMxFDASBgNVBAoTC0VudHJ1c3QubmV0MTswOQYDVQQLEzJ3d3cuZW50cnVzdC5u
1237ZXQvQ1BTIGluY29ycC4gYnkgcmVmLiAobGltaXRzIGxpYWIuKTElMCMGA1UECxMc
1238KGMpIDE5OTkgRW50cnVzdC5uZXQgTGltaXRlZDE6MDgGA1UEAxMxRW50cnVzdC5u
1239ZXQgU2VjdXJlIFNlcnZlciBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw05OTA1
1240MjUxNjA5NDBaFw0xOTA1MjUxNjM5NDBaMIHDMQswCQYDVQQGEwJVUzEUMBIGA1UE
1241ChMLRW50cnVzdC5uZXQxOzA5BgNVBAsTMnd3dy5lbnRydXN0Lm5ldC9DUFMgaW5j
1242b3JwLiBieSByZWYuIChsaW1pdHMgbGlhYi4pMSUwIwYDVQQLExwoYykgMTk5OSBF
1243bnRydXN0Lm5ldCBMaW1pdGVkMTowOAYDVQQDEzFFbnRydXN0Lm5ldCBTZWN1cmUg
1244U2VydmVyIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIGdMA0GCSqGSIb3DQEBAQUA
1245A4GLADCBhwKBgQDNKIM0VBuJ8w+vN5Ex/68xYMmo6LIQaO2f55M28Qpku0f1BBc/
1246I0dNxScZgSYMVHINiC3ZH5oSn7yzcdOAGT9HZnuMNSjSuQrfJNqc1lB5gXpa0zf3
1247wkrYKZImZNHkmGw6AIr1NJtl+O3jEP/9uElY3KDegjlrgbEWGWG5VLbmQwIBA6OC
1248AdcwggHTMBEGCWCGSAGG+EIBAQQEAwIABzCCARkGA1UdHwSCARAwggEMMIHeoIHb
1249oIHYpIHVMIHSMQswCQYDVQQGEwJVUzEUMBIGA1UEChMLRW50cnVzdC5uZXQxOzA5
1250BgNVBAsTMnd3dy5lbnRydXN0Lm5ldC9DUFMgaW5jb3JwLiBieSByZWYuIChsaW1p
1251dHMgbGlhYi4pMSUwIwYDVQQLExwoYykgMTk5OSBFbnRydXN0Lm5ldCBMaW1pdGVk
1252MTowOAYDVQQDEzFFbnRydXN0Lm5ldCBTZWN1cmUgU2VydmVyIENlcnRpZmljYXRp
1253b24gQXV0aG9yaXR5MQ0wCwYDVQQDEwRDUkwxMCmgJ6AlhiNodHRwOi8vd3d3LmVu
1254dHJ1c3QubmV0L0NSTC9uZXQxLmNybDArBgNVHRAEJDAigA8xOTk5MDUyNTE2MDk0
1255MFqBDzIwMTkwNTI1MTYwOTQwWjALBgNVHQ8EBAMCAQYwHwYDVR0jBBgwFoAU8Bdi
1256E1U9s/8KAGv7UISX8+1i0BowHQYDVR0OBBYEFPAXYhNVPbP/CgBr+1CEl/PtYtAa
1257MAwGA1UdEwQFMAMBAf8wGQYJKoZIhvZ9B0EABAwwChsEVjQuMAMCBJAwDQYJKoZI
1258hvcNAQEFBQADgYEAkNwwAvpkdMKnCqV8IY00F6j7Rw7/JXyNEwr75Ji174z4xRAN
125995K+8cPV1ZVqBLssziY2ZcgxxufuP+NXdYR6Ee9GTxj005i7qIcyunL2POI9n9cd
12602cNgQ4xYDiKWL2KjLB+6rQXvqzJ4h6BUcxm1XAX5Uj5tLUUL9wqT6u0G+bI=
1261-----END CERTIFICATE-----
1262Certificate:
1263 Data:
1264 Version: 3 (0x2)
1265 Serial Number:
1266 02:ac:5c:26:6a:0b:40:9b:8f:0b:79:f2:ae:46:25:77
1267 Signature Algorithm: sha1WithRSAEncryption
1268 Issuer: C=US, O=DigiCert Inc, OU=www.digicert.com, CN=DigiCert High Assurance EV Root CA
1269 Validity
1270 Not Before: Nov 10 00:00:00 2006 GMT
1271 Not After : Nov 10 00:00:00 2031 GMT
1272 Subject: C=US, O=DigiCert Inc, OU=www.digicert.com, CN=DigiCert High Assurance EV Root CA
1273 Subject Public Key Info:
1274 Public Key Algorithm: rsaEncryption
1275 Public-Key: (2048 bit)
1276 Modulus:
1277 00:c6:cc:e5:73:e6:fb:d4:bb:e5:2d:2d:32:a6:df:
1278 e5:81:3f:c9:cd:25:49:b6:71:2a:c3:d5:94:34:67:
1279 a2:0a:1c:b0:5f:69:a6:40:b1:c4:b7:b2:8f:d0:98:
1280 a4:a9:41:59:3a:d3:dc:94:d6:3c:db:74:38:a4:4a:
1281 cc:4d:25:82:f7:4a:a5:53:12:38:ee:f3:49:6d:71:
1282 91:7e:63:b6:ab:a6:5f:c3:a4:84:f8:4f:62:51:be:
1283 f8:c5:ec:db:38:92:e3:06:e5:08:91:0c:c4:28:41:
1284 55:fb:cb:5a:89:15:7e:71:e8:35:bf:4d:72:09:3d:
1285 be:3a:38:50:5b:77:31:1b:8d:b3:c7:24:45:9a:a7:
1286 ac:6d:00:14:5a:04:b7:ba:13:eb:51:0a:98:41:41:
1287 22:4e:65:61:87:81:41:50:a6:79:5c:89:de:19:4a:
1288 57:d5:2e:e6:5d:1c:53:2c:7e:98:cd:1a:06:16:a4:
1289 68:73:d0:34:04:13:5c:a1:71:d3:5a:7c:55:db:5e:
1290 64:e1:37:87:30:56:04:e5:11:b4:29:80:12:f1:79:
1291 39:88:a2:02:11:7c:27:66:b7:88:b7:78:f2:ca:0a:
1292 a8:38:ab:0a:64:c2:bf:66:5d:95:84:c1:a1:25:1e:
1293 87:5d:1a:50:0b:20:12:cc:41:bb:6e:0b:51:38:b8:
1294 4b:cb
1295 Exponent: 65537 (0x10001)
1296 X509v3 extensions:
1297 X509v3 Key Usage: critical
1298 Digital Signature, Certificate Sign, CRL Sign
1299 X509v3 Basic Constraints: critical
1300 CA:TRUE
1301 X509v3 Subject Key Identifier:
1302 B1:3E:C3:69:03:F8:BF:47:01:D4:98:26:1A:08:02:EF:63:64:2B:C3
1303 X509v3 Authority Key Identifier:
1304 keyid:B1:3E:C3:69:03:F8:BF:47:01:D4:98:26:1A:08:02:EF:63:64:2B:C3
1305
1306 Signature Algorithm: sha1WithRSAEncryption
1307 1c:1a:06:97:dc:d7:9c:9f:3c:88:66:06:08:57:21:db:21:47:
1308 f8:2a:67:aa:bf:18:32:76:40:10:57:c1:8a:f3:7a:d9:11:65:
1309 8e:35:fa:9e:fc:45:b5:9e:d9:4c:31:4b:b8:91:e8:43:2c:8e:
1310 b3:78:ce:db:e3:53:79:71:d6:e5:21:94:01:da:55:87:9a:24:
1311 64:f6:8a:66:cc:de:9c:37:cd:a8:34:b1:69:9b:23:c8:9e:78:
1312 22:2b:70:43:e3:55:47:31:61:19:ef:58:c5:85:2f:4e:30:f6:
1313 a0:31:16:23:c8:e7:e2:65:16:33:cb:bf:1a:1b:a0:3d:f8:ca:
1314 5e:8b:31:8b:60:08:89:2d:0c:06:5c:52:b7:c4:f9:0a:98:d1:
1315 15:5f:9f:12:be:7c:36:63:38:bd:44:a4:7f:e4:26:2b:0a:c4:
1316 97:69:0d:e9:8c:e2:c0:10:57:b8:c8:76:12:91:55:f2:48:69:
1317 d8:bc:2a:02:5b:0f:44:d4:20:31:db:f4:ba:70:26:5d:90:60:
1318 9e:bc:4b:17:09:2f:b4:cb:1e:43:68:c9:07:27:c1:d2:5c:f7:
1319 ea:21:b9:68:12:9c:3c:9c:bf:9e:fc:80:5c:9b:63:cd:ec:47:
1320 aa:25:27:67:a0:37:f3:00:82:7d:54:d7:a9:f8:e9:2e:13:a3:
1321 77:e8:1f:4a
1322SHA1 Fingerprint=5F:B7:EE:06:33:E2:59:DB:AD:0C:4C:9A:E6:D3:8F:1A:61:C7:DC:25
1323-----BEGIN CERTIFICATE-----
1324MIIDxTCCAq2gAwIBAgIQAqxcJmoLQJuPC3nyrkYldzANBgkqhkiG9w0BAQUFADBs
1325MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3
1326d3cuZGlnaWNlcnQuY29tMSswKQYDVQQDEyJEaWdpQ2VydCBIaWdoIEFzc3VyYW5j
1327ZSBFViBSb290IENBMB4XDTA2MTExMDAwMDAwMFoXDTMxMTExMDAwMDAwMFowbDEL
1328MAkGA1UEBhMCVVMxFTATBgNVBAoTDERpZ2lDZXJ0IEluYzEZMBcGA1UECxMQd3d3
1329LmRpZ2ljZXJ0LmNvbTErMCkGA1UEAxMiRGlnaUNlcnQgSGlnaCBBc3N1cmFuY2Ug
1330RVYgUm9vdCBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMbM5XPm
1331+9S75S0tMqbf5YE/yc0lSbZxKsPVlDRnogocsF9ppkCxxLeyj9CYpKlBWTrT3JTW
1332PNt0OKRKzE0lgvdKpVMSOO7zSW1xkX5jtqumX8OkhPhPYlG++MXs2ziS4wblCJEM
1333xChBVfvLWokVfnHoNb9Ncgk9vjo4UFt3MRuNs8ckRZqnrG0AFFoEt7oT61EKmEFB
1334Ik5lYYeBQVCmeVyJ3hlKV9Uu5l0cUyx+mM0aBhakaHPQNAQTXKFx01p8VdteZOE3
1335hzBWBOURtCmAEvF5OYiiAhF8J2a3iLd48soKqDirCmTCv2ZdlYTBoSUeh10aUAsg
1336EsxBu24LUTi4S8sCAwEAAaNjMGEwDgYDVR0PAQH/BAQDAgGGMA8GA1UdEwEB/wQF
1337MAMBAf8wHQYDVR0OBBYEFLE+w2kD+L9HAdSYJhoIAu9jZCvDMB8GA1UdIwQYMBaA
1338FLE+w2kD+L9HAdSYJhoIAu9jZCvDMA0GCSqGSIb3DQEBBQUAA4IBAQAcGgaX3Nec
1339nzyIZgYIVyHbIUf4KmeqvxgydkAQV8GK83rZEWWONfqe/EW1ntlMMUu4kehDLI6z
1340eM7b41N5cdblIZQB2lWHmiRk9opmzN6cN82oNLFpmyPInngiK3BD41VHMWEZ71jF
1341hS9OMPagMRYjyOfiZRYzy78aG6A9+MpeizGLYAiJLQwGXFK3xPkKmNEVX58Svnw2
1342Yzi9RKR/5CYrCsSXaQ3pjOLAEFe4yHYSkVXySGnYvCoCWw9E1CAx2/S6cCZdkGCe
1343vEsXCS+0yx5DaMkHJ8HSXPfqIbloEpw8nL+e/IBcm2PN7EeqJSdnoDfzAIJ9VNep
1344+OkuE6N36B9K
1345-----END CERTIFICATE-----
1346Certificate:
1347 Data:
1348 Version: 3 (0x2)
1349 Serial Number:
1350 0c:e7:e0:e5:17:d8:46:fe:8f:e5:60:fc:1b:f0:30:39
1351 Signature Algorithm: sha1WithRSAEncryption
1352 Issuer: C=US, O=DigiCert Inc, OU=www.digicert.com, CN=DigiCert Assured ID Root CA
1353 Validity
1354 Not Before: Nov 10 00:00:00 2006 GMT
1355 Not After : Nov 10 00:00:00 2031 GMT
1356 Subject: C=US, O=DigiCert Inc, OU=www.digicert.com, CN=DigiCert Assured ID Root CA
1357 Subject Public Key Info:
1358 Public Key Algorithm: rsaEncryption
1359 Public-Key: (2048 bit)
1360 Modulus:
1361 00:ad:0e:15:ce:e4:43:80:5c:b1:87:f3:b7:60:f9:
1362 71:12:a5:ae:dc:26:94:88:aa:f4:ce:f5:20:39:28:
1363 58:60:0c:f8:80:da:a9:15:95:32:61:3c:b5:b1:28:
1364 84:8a:8a:dc:9f:0a:0c:83:17:7a:8f:90:ac:8a:e7:
1365 79:53:5c:31:84:2a:f6:0f:98:32:36:76:cc:de:dd:
1366 3c:a8:a2:ef:6a:fb:21:f2:52:61:df:9f:20:d7:1f:
1367 e2:b1:d9:fe:18:64:d2:12:5b:5f:f9:58:18:35:bc:
1368 47:cd:a1:36:f9:6b:7f:d4:b0:38:3e:c1:1b:c3:8c:
1369 33:d9:d8:2f:18:fe:28:0f:b3:a7:83:d6:c3:6e:44:
1370 c0:61:35:96:16:fe:59:9c:8b:76:6d:d7:f1:a2:4b:
1371 0d:2b:ff:0b:72:da:9e:60:d0:8e:90:35:c6:78:55:
1372 87:20:a1:cf:e5:6d:0a:c8:49:7c:31:98:33:6c:22:
1373 e9:87:d0:32:5a:a2:ba:13:82:11:ed:39:17:9d:99:
1374 3a:72:a1:e6:fa:a4:d9:d5:17:31:75:ae:85:7d:22:
1375 ae:3f:01:46:86:f6:28:79:c8:b1:da:e4:57:17:c4:
1376 7e:1c:0e:b0:b4:92:a6:56:b3:bd:b2:97:ed:aa:a7:
1377 f0:b7:c5:a8:3f:95:16:d0:ff:a1:96:eb:08:5f:18:
1378 77:4f
1379 Exponent: 65537 (0x10001)
1380 X509v3 extensions:
1381 X509v3 Key Usage: critical
1382 Digital Signature, Certificate Sign, CRL Sign
1383 X509v3 Basic Constraints: critical
1384 CA:TRUE
1385 X509v3 Subject Key Identifier:
1386 45:EB:A2:AF:F4:92:CB:82:31:2D:51:8B:A7:A7:21:9D:F3:6D:C8:0F
1387 X509v3 Authority Key Identifier:
1388 keyid:45:EB:A2:AF:F4:92:CB:82:31:2D:51:8B:A7:A7:21:9D:F3:6D:C8:0F
1389
1390 Signature Algorithm: sha1WithRSAEncryption
1391 a2:0e:bc:df:e2:ed:f0:e3:72:73:7a:64:94:bf:f7:72:66:d8:
1392 32:e4:42:75:62:ae:87:eb:f2:d5:d9:de:56:b3:9f:cc:ce:14:
1393 28:b9:0d:97:60:5c:12:4c:58:e4:d3:3d:83:49:45:58:97:35:
1394 69:1a:a8:47:ea:56:c6:79:ab:12:d8:67:81:84:df:7f:09:3c:
1395 94:e6:b8:26:2c:20:bd:3d:b3:28:89:f7:5f:ff:22:e2:97:84:
1396 1f:e9:65:ef:87:e0:df:c1:67:49:b3:5d:eb:b2:09:2a:eb:26:
1397 ed:78:be:7d:3f:2b:f3:b7:26:35:6d:5f:89:01:b6:49:5b:9f:
1398 01:05:9b:ab:3d:25:c1:cc:b6:7f:c2:f1:6f:86:c6:fa:64:68:
1399 eb:81:2d:94:eb:42:b7:fa:8c:1e:dd:62:f1:be:50:67:b7:6c:
1400 bd:f3:f1:1f:6b:0c:36:07:16:7f:37:7c:a9:5b:6d:7a:f1:12:
1401 46:60:83:d7:27:04:be:4b:ce:97:be:c3:67:2a:68:11:df:80:
1402 e7:0c:33:66:bf:13:0d:14:6e:f3:7f:1f:63:10:1e:fa:8d:1b:
1403 25:6d:6c:8f:a5:b7:61:01:b1:d2:a3:26:a1:10:71:9d:ad:e2:
1404 c3:f9:c3:99:51:b7:2b:07:08:ce:2e:e6:50:b2:a7:fa:0a:45:
1405 2f:a2:f0:f2
1406SHA1 Fingerprint=05:63:B8:63:0D:62:D7:5A:BB:C8:AB:1E:4B:DF:B5:A8:99:B2:4D:43
1407-----BEGIN CERTIFICATE-----
1408MIIDtzCCAp+gAwIBAgIQDOfg5RfYRv6P5WD8G/AwOTANBgkqhkiG9w0BAQUFADBl
1409MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3
1410d3cuZGlnaWNlcnQuY29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJv
1411b3QgQ0EwHhcNMDYxMTEwMDAwMDAwWhcNMzExMTEwMDAwMDAwWjBlMQswCQYDVQQG
1412EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNl
1413cnQuY29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgQ0EwggEi
1414MA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCtDhXO5EOAXLGH87dg+XESpa7c
1415JpSIqvTO9SA5KFhgDPiA2qkVlTJhPLWxKISKityfCgyDF3qPkKyK53lTXDGEKvYP
1416mDI2dsze3Tyoou9q+yHyUmHfnyDXH+Kx2f4YZNISW1/5WBg1vEfNoTb5a3/UsDg+
1417wRvDjDPZ2C8Y/igPs6eD1sNuRMBhNZYW/lmci3Zt1/GiSw0r/wty2p5g0I6QNcZ4
1418VYcgoc/lbQrISXwxmDNsIumH0DJaoroTghHtORedmTpyoeb6pNnVFzF1roV9Iq4/
1419AUaG9ih5yLHa5FcXxH4cDrC0kqZWs72yl+2qp/C3xag/lRbQ/6GW6whfGHdPAgMB
1420AAGjYzBhMA4GA1UdDwEB/wQEAwIBhjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQW
1421BBRF66Kv9JLLgjEtUYunpyGd823IDzAfBgNVHSMEGDAWgBRF66Kv9JLLgjEtUYun
1422pyGd823IDzANBgkqhkiG9w0BAQUFAAOCAQEAog683+Lt8ONyc3pklL/3cmbYMuRC
1423dWKuh+vy1dneVrOfzM4UKLkNl2BcEkxY5NM9g0lFWJc1aRqoR+pWxnmrEthngYTf
1424fwk8lOa4JiwgvT2zKIn3X/8i4peEH+ll74fg38FnSbNd67IJKusm7Xi+fT8r87cm
1425NW1fiQG2SVufAQWbqz0lwcy2f8Lxb4bG+mRo64EtlOtCt/qMHt1i8b5QZ7dsvfPx
1426H2sMNgcWfzd8qVttevESRmCD1ycEvkvOl77DZypoEd+A5wwzZr8TDRRu838fYxAe
1427+o0bJW1sj6W3YQGx0qMmoRBxna3iw/nDmVG3KwcIzi7mULKn+gpFL6Lw8g==
1428-----END CERTIFICATE-----
1429Certificate:
1430 Data:
1431 Version: 3 (0x2)
1432 Serial Number:
1433 08:3b:e0:56:90:42:46:b1:a1:75:6a:c9:59:91:c7:4a
1434 Signature Algorithm: sha1WithRSAEncryption
1435 Issuer: C=US, O=DigiCert Inc, OU=www.digicert.com, CN=DigiCert Global Root CA
1436 Validity
1437 Not Before: Nov 10 00:00:00 2006 GMT
1438 Not After : Nov 10 00:00:00 2031 GMT
1439 Subject: C=US, O=DigiCert Inc, OU=www.digicert.com, CN=DigiCert Global Root CA
1440 Subject Public Key Info:
1441 Public Key Algorithm: rsaEncryption
1442 Public-Key: (2048 bit)
1443 Modulus:
1444 00:e2:3b:e1:11:72:de:a8:a4:d3:a3:57:aa:50:a2:
1445 8f:0b:77:90:c9:a2:a5:ee:12:ce:96:5b:01:09:20:
1446 cc:01:93:a7:4e:30:b7:53:f7:43:c4:69:00:57:9d:
1447 e2:8d:22:dd:87:06:40:00:81:09:ce:ce:1b:83:bf:
1448 df:cd:3b:71:46:e2:d6:66:c7:05:b3:76:27:16:8f:
1449 7b:9e:1e:95:7d:ee:b7:48:a3:08:da:d6:af:7a:0c:
1450 39:06:65:7f:4a:5d:1f:bc:17:f8:ab:be:ee:28:d7:
1451 74:7f:7a:78:99:59:85:68:6e:5c:23:32:4b:bf:4e:
1452 c0:e8:5a:6d:e3:70:bf:77:10:bf:fc:01:f6:85:d9:
1453 a8:44:10:58:32:a9:75:18:d5:d1:a2:be:47:e2:27:
1454 6a:f4:9a:33:f8:49:08:60:8b:d4:5f:b4:3a:84:bf:
1455 a1:aa:4a:4c:7d:3e:cf:4f:5f:6c:76:5e:a0:4b:37:
1456 91:9e:dc:22:e6:6d:ce:14:1a:8e:6a:cb:fe:cd:b3:
1457 14:64:17:c7:5b:29:9e:32:bf:f2:ee:fa:d3:0b:42:
1458 d4:ab:b7:41:32:da:0c:d4:ef:f8:81:d5:bb:8d:58:
1459 3f:b5:1b:e8:49:28:a2:70:da:31:04:dd:f7:b2:16:
1460 f2:4c:0a:4e:07:a8:ed:4a:3d:5e:b5:7f:a3:90:c3:
1461 af:27
1462 Exponent: 65537 (0x10001)
1463 X509v3 extensions:
1464 X509v3 Key Usage: critical
1465 Digital Signature, Certificate Sign, CRL Sign
1466 X509v3 Basic Constraints: critical
1467 CA:TRUE
1468 X509v3 Subject Key Identifier:
1469 03:DE:50:35:56:D1:4C:BB:66:F0:A3:E2:1B:1B:C3:97:B2:3D:D1:55
1470 X509v3 Authority Key Identifier:
1471 keyid:03:DE:50:35:56:D1:4C:BB:66:F0:A3:E2:1B:1B:C3:97:B2:3D:D1:55
1472
1473 Signature Algorithm: sha1WithRSAEncryption
1474 cb:9c:37:aa:48:13:12:0a:fa:dd:44:9c:4f:52:b0:f4:df:ae:
1475 04:f5:79:79:08:a3:24:18:fc:4b:2b:84:c0:2d:b9:d5:c7:fe:
1476 f4:c1:1f:58:cb:b8:6d:9c:7a:74:e7:98:29:ab:11:b5:e3:70:
1477 a0:a1:cd:4c:88:99:93:8c:91:70:e2:ab:0f:1c:be:93:a9:ff:
1478 63:d5:e4:07:60:d3:a3:bf:9d:5b:09:f1:d5:8e:e3:53:f4:8e:
1479 63:fa:3f:a7:db:b4:66:df:62:66:d6:d1:6e:41:8d:f2:2d:b5:
1480 ea:77:4a:9f:9d:58:e2:2b:59:c0:40:23:ed:2d:28:82:45:3e:
1481 79:54:92:26:98:e0:80:48:a8:37:ef:f0:d6:79:60:16:de:ac:
1482 e8:0e:cd:6e:ac:44:17:38:2f:49:da:e1:45:3e:2a:b9:36:53:
1483 cf:3a:50:06:f7:2e:e8:c4:57:49:6c:61:21:18:d5:04:ad:78:
1484 3c:2c:3a:80:6b:a7:eb:af:15:14:e9:d8:89:c1:b9:38:6c:e2:
1485 91:6c:8a:ff:64:b9:77:25:57:30:c0:1b:24:a3:e1:dc:e9:df:
1486 47:7c:b5:b4:24:08:05:30:ec:2d:bd:0b:bf:45:bf:50:b9:a9:
1487 f3:eb:98:01:12:ad:c8:88:c6:98:34:5f:8d:0a:3c:c6:e9:d5:
1488 95:95:6d:de
1489SHA1 Fingerprint=A8:98:5D:3A:65:E5:E5:C4:B2:D7:D6:6D:40:C6:DD:2F:B1:9C:54:36
1490-----BEGIN CERTIFICATE-----
1491MIIDrzCCApegAwIBAgIQCDvgVpBCRrGhdWrJWZHHSjANBgkqhkiG9w0BAQUFADBh
1492MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3
1493d3cuZGlnaWNlcnQuY29tMSAwHgYDVQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBD
1494QTAeFw0wNjExMTAwMDAwMDBaFw0zMTExMTAwMDAwMDBaMGExCzAJBgNVBAYTAlVT
1495MRUwEwYDVQQKEwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3dy5kaWdpY2VydC5j
1496b20xIDAeBgNVBAMTF0RpZ2lDZXJ0IEdsb2JhbCBSb290IENBMIIBIjANBgkqhkiG
14979w0BAQEFAAOCAQ8AMIIBCgKCAQEA4jvhEXLeqKTTo1eqUKKPC3eQyaKl7hLOllsB
1498CSDMAZOnTjC3U/dDxGkAV53ijSLdhwZAAIEJzs4bg7/fzTtxRuLWZscFs3YnFo97
1499nh6Vfe63SKMI2tavegw5BmV/Sl0fvBf4q77uKNd0f3p4mVmFaG5cIzJLv07A6Fpt
150043C/dxC//AH2hdmoRBBYMql1GNXRor5H4idq9Joz+EkIYIvUX7Q6hL+hqkpMfT7P
1501T19sdl6gSzeRntwi5m3OFBqOasv+zbMUZBfHWymeMr/y7vrTC0LUq7dBMtoM1O/4
1502gdW7jVg/tRvoSSiicNoxBN33shbyTApOB6jtSj1etX+jkMOvJwIDAQABo2MwYTAO
1503BgNVHQ8BAf8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUA95QNVbR
1504TLtm8KPiGxvDl7I90VUwHwYDVR0jBBgwFoAUA95QNVbRTLtm8KPiGxvDl7I90VUw
1505DQYJKoZIhvcNAQEFBQADggEBAMucN6pIExIK+t1EnE9SsPTfrgT1eXkIoyQY/Esr
1506hMAtudXH/vTBH1jLuG2cenTnmCmrEbXjcKChzUyImZOMkXDiqw8cvpOp/2PV5Adg
150706O/nVsJ8dWO41P0jmP6P6fbtGbfYmbW0W5BjfIttep3Sp+dWOIrWcBAI+0tKIJF
1508PnlUkiaY4IBIqDfv8NZ5YBberOgOzW6sRBc4L0na4UU+Krk2U886UAb3LujEV0ls
1509YSEY1QSteDwsOoBrp+uvFRTp2InBuThs4pFsiv9kuXclVzDAGySj4dzp30d8tbQk
1510CAUw7C29C79Fv1C5qfPrmAESrciIxpg0X40KPMbp1ZWVbd4=
1511-----END CERTIFICATE-----
1512Certificate:
1513 Data:
1514 Version: 3 (0x2)
1515 Serial Number: 1 (0x1)
1516 Signature Algorithm: md5WithRSAEncryption
1517 Issuer: C=US, O=Equifax Secure Inc., CN=Equifax Secure Global eBusiness CA-1
1518 Validity
1519 Not Before: Jun 21 04:00:00 1999 GMT
1520 Not After : Jun 21 04:00:00 2020 GMT
1521 Subject: C=US, O=Equifax Secure Inc., CN=Equifax Secure Global eBusiness CA-1
1522 Subject Public Key Info:
1523 Public Key Algorithm: rsaEncryption
1524 Public-Key: (1024 bit)
1525 Modulus:
1526 00:ba:e7:17:90:02:65:b1:34:55:3c:49:c2:51:d5:
1527 df:a7:d1:37:8f:d1:e7:81:73:41:52:60:9b:9d:a1:
1528 17:26:78:ad:c7:b1:e8:26:94:32:b5:de:33:8d:3a:
1529 2f:db:f2:9a:7a:5a:73:98:a3:5c:e9:fb:8a:73:1b:
1530 5c:e7:c3:bf:80:6c:cd:a9:f4:d6:2b:c0:f7:f9:99:
1531 aa:63:a2:b1:47:02:0f:d4:e4:51:3a:12:3c:6c:8a:
1532 5a:54:84:70:db:c1:c5:90:cf:72:45:cb:a8:59:c0:
1533 cd:33:9d:3f:a3:96:eb:85:33:21:1c:3e:1e:3e:60:
1534 6e:76:9c:67:85:c5:c8:c3:61
1535 Exponent: 65537 (0x10001)
1536 X509v3 extensions:
1537 Netscape Cert Type:
1538 SSL CA, S/MIME CA, Object Signing CA
1539 X509v3 Basic Constraints: critical
1540 CA:TRUE
1541 X509v3 Authority Key Identifier:
1542 keyid:BE:A8:A0:74:72:50:6B:44:B7:C9:23:D8:FB:A8:FF:B3:57:6B:68:6C
1543
1544 X509v3 Subject Key Identifier:
1545 BE:A8:A0:74:72:50:6B:44:B7:C9:23:D8:FB:A8:FF:B3:57:6B:68:6C
1546 Signature Algorithm: md5WithRSAEncryption
1547 30:e2:01:51:aa:c7:ea:5f:da:b9:d0:65:0f:30:d6:3e:da:0d:
1548 14:49:6e:91:93:27:14:31:ef:c4:f7:2d:45:f8:ec:c7:bf:a2:
1549 41:0d:23:b4:92:f9:19:00:67:bd:01:af:cd:e0:71:fc:5a:cf:
1550 64:c4:e0:96:98:d0:a3:40:e2:01:8a:ef:27:07:f1:65:01:8a:
1551 44:2d:06:65:75:52:c0:86:10:20:21:5f:6c:6b:0f:6c:ae:09:
1552 1c:af:f2:a2:18:34:c4:75:a4:73:1c:f1:8d:dc:ef:ad:f9:b3:
1553 76:b4:92:bf:dc:95:10:1e:be:cb:c8:3b:5a:84:60:19:56:94:
1554 a9:55
1555SHA1 Fingerprint=7E:78:4A:10:1C:82:65:CC:2D:E1:F1:6D:47:B4:40:CA:D9:0A:19:45
1556-----BEGIN CERTIFICATE-----
1557MIICkDCCAfmgAwIBAgIBATANBgkqhkiG9w0BAQQFADBaMQswCQYDVQQGEwJVUzEc
1558MBoGA1UEChMTRXF1aWZheCBTZWN1cmUgSW5jLjEtMCsGA1UEAxMkRXF1aWZheCBT
1559ZWN1cmUgR2xvYmFsIGVCdXNpbmVzcyBDQS0xMB4XDTk5MDYyMTA0MDAwMFoXDTIw
1560MDYyMTA0MDAwMFowWjELMAkGA1UEBhMCVVMxHDAaBgNVBAoTE0VxdWlmYXggU2Vj
1561dXJlIEluYy4xLTArBgNVBAMTJEVxdWlmYXggU2VjdXJlIEdsb2JhbCBlQnVzaW5l
1562c3MgQ0EtMTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAuucXkAJlsTRVPEnC
1563UdXfp9E3j9HngXNBUmCbnaEXJnitx7HoJpQytd4zjTov2/KaelpzmKNc6fuKcxtc
156458O/gGzNqfTWK8D3+ZmqY6KxRwIP1ORROhI8bIpaVIRw28HFkM9yRcuoWcDNM50/
1565o5brhTMhHD4ePmBudpxnhcXIw2ECAwEAAaNmMGQwEQYJYIZIAYb4QgEBBAQDAgAH
1566MA8GA1UdEwEB/wQFMAMBAf8wHwYDVR0jBBgwFoAUvqigdHJQa0S3ySPY+6j/s1dr
1567aGwwHQYDVR0OBBYEFL6ooHRyUGtEt8kj2Puo/7NXa2hsMA0GCSqGSIb3DQEBBAUA
1568A4GBADDiAVGqx+pf2rnQZQ8w1j7aDRRJbpGTJxQx78T3LUX47Me/okENI7SS+RkA
1569Z70Br83gcfxaz2TE4JaY0KNA4gGK7ycH8WUBikQtBmV1UsCGECAhX2xrD2yuCRyv
15708qIYNMR1pHMc8Y3c7635s3a0kr/clRAevsvIO1qEYBlWlKlV
1571-----END CERTIFICATE-----
1572Certificate:
1573 Data:
1574 Version: 3 (0x2)
1575 Serial Number: 4 (0x4)
1576 Signature Algorithm: md5WithRSAEncryption
1577 Issuer: C=US, O=Equifax Secure Inc., CN=Equifax Secure eBusiness CA-1
1578 Validity
1579 Not Before: Jun 21 04:00:00 1999 GMT
1580 Not After : Jun 21 04:00:00 2020 GMT
1581 Subject: C=US, O=Equifax Secure Inc., CN=Equifax Secure eBusiness CA-1
1582 Subject Public Key Info:
1583 Public Key Algorithm: rsaEncryption
1584 Public-Key: (1024 bit)
1585 Modulus:
1586 00:ce:2f:19:bc:17:b7:77:de:93:a9:5f:5a:0d:17:
1587 4f:34:1a:0c:98:f4:22:d9:59:d4:c4:68:46:f0:b4:
1588 35:c5:85:03:20:c6:af:45:a5:21:51:45:41:eb:16:
1589 58:36:32:6f:e2:50:62:64:f9:fd:51:9c:aa:24:d9:
1590 f4:9d:83:2a:87:0a:21:d3:12:38:34:6c:8d:00:6e:
1591 5a:a0:d9:42:ee:1a:21:95:f9:52:4c:55:5a:c5:0f:
1592 38:4f:46:fa:6d:f8:2e:35:d6:1d:7c:eb:e2:f0:b0:
1593 75:80:c8:a9:13:ac:be:88:ef:3a:6e:ab:5f:2a:38:
1594 62:02:b0:12:7b:fe:8f:a6:03
1595 Exponent: 65537 (0x10001)
1596 X509v3 extensions:
1597 Netscape Cert Type:
1598 SSL CA, S/MIME CA, Object Signing CA
1599 X509v3 Basic Constraints: critical
1600 CA:TRUE
1601 X509v3 Authority Key Identifier:
1602 keyid:4A:78:32:52:11:DB:59:16:36:5E:DF:C1:14:36:40:6A:47:7C:4C:A1
1603
1604 X509v3 Subject Key Identifier:
1605 4A:78:32:52:11:DB:59:16:36:5E:DF:C1:14:36:40:6A:47:7C:4C:A1
1606 Signature Algorithm: md5WithRSAEncryption
1607 75:5b:a8:9b:03:11:e6:e9:56:4c:cd:f9:a9:4c:c0:0d:9a:f3:
1608 cc:65:69:e6:25:76:cc:59:b7:d6:54:c3:1d:cd:99:ac:19:dd:
1609 b4:85:d5:e0:3d:fc:62:20:a7:84:4b:58:65:f1:e2:f9:95:21:
1610 3f:f5:d4:7e:58:1e:47:87:54:3e:58:a1:b5:b5:f8:2a:ef:71:
1611 e7:bc:c3:f6:b1:49:46:e2:d7:a0:6b:e5:56:7a:9a:27:98:7c:
1612 46:62:14:e7:c9:fc:6e:03:12:79:80:38:1d:48:82:8d:fc:17:
1613 fe:2a:96:2b:b5:62:a6:a6:3d:bd:7f:92:59:cd:5a:2a:82:b2:
1614 37:79
1615SHA1 Fingerprint=DA:40:18:8B:91:89:A3:ED:EE:AE:DA:97:FE:2F:9D:F5:B7:D1:8A:41
1616-----BEGIN CERTIFICATE-----
1617MIICgjCCAeugAwIBAgIBBDANBgkqhkiG9w0BAQQFADBTMQswCQYDVQQGEwJVUzEc
1618MBoGA1UEChMTRXF1aWZheCBTZWN1cmUgSW5jLjEmMCQGA1UEAxMdRXF1aWZheCBT
1619ZWN1cmUgZUJ1c2luZXNzIENBLTEwHhcNOTkwNjIxMDQwMDAwWhcNMjAwNjIxMDQw
1620MDAwWjBTMQswCQYDVQQGEwJVUzEcMBoGA1UEChMTRXF1aWZheCBTZWN1cmUgSW5j
1621LjEmMCQGA1UEAxMdRXF1aWZheCBTZWN1cmUgZUJ1c2luZXNzIENBLTEwgZ8wDQYJ
1622KoZIhvcNAQEBBQADgY0AMIGJAoGBAM4vGbwXt3fek6lfWg0XTzQaDJj0ItlZ1MRo
1623RvC0NcWFAyDGr0WlIVFFQesWWDYyb+JQYmT5/VGcqiTZ9J2DKocKIdMSODRsjQBu
1624WqDZQu4aIZX5UkxVWsUPOE9G+m34LjXWHXzr4vCwdYDIqROsvojvOm6rXyo4YgKw
1625Env+j6YDAgMBAAGjZjBkMBEGCWCGSAGG+EIBAQQEAwIABzAPBgNVHRMBAf8EBTAD
1626AQH/MB8GA1UdIwQYMBaAFEp4MlIR21kWNl7fwRQ2QGpHfEyhMB0GA1UdDgQWBBRK
1627eDJSEdtZFjZe38EUNkBqR3xMoTANBgkqhkiG9w0BAQQFAAOBgQB1W6ibAxHm6VZM
1628zfmpTMANmvPMZWnmJXbMWbfWVMMdzZmsGd20hdXgPfxiIKeES1hl8eL5lSE/9dR+
1629WB5Hh1Q+WKG1tfgq73HnvMP2sUlG4tega+VWeponmHxGYhTnyfxuAxJ5gDgdSIKN
1630/Bf+KpYrtWKmpj29f5JZzVoqgrI3eQ==
1631-----END CERTIFICATE-----
1632Certificate:
1633 Data:
1634 Version: 3 (0x2)
1635 Serial Number: 144470 (0x23456)
1636 Signature Algorithm: sha1WithRSAEncryption
1637 Issuer: C=US, O=GeoTrust Inc., CN=GeoTrust Global CA
1638 Validity
1639 Not Before: May 21 04:00:00 2002 GMT
1640 Not After : May 21 04:00:00 2022 GMT
1641 Subject: C=US, O=GeoTrust Inc., CN=GeoTrust Global CA
1642 Subject Public Key Info:
1643 Public Key Algorithm: rsaEncryption
1644 Public-Key: (2048 bit)
1645 Modulus:
1646 00:da:cc:18:63:30:fd:f4:17:23:1a:56:7e:5b:df:
1647 3c:6c:38:e4:71:b7:78:91:d4:bc:a1:d8:4c:f8:a8:
1648 43:b6:03:e9:4d:21:07:08:88:da:58:2f:66:39:29:
1649 bd:05:78:8b:9d:38:e8:05:b7:6a:7e:71:a4:e6:c4:
1650 60:a6:b0:ef:80:e4:89:28:0f:9e:25:d6:ed:83:f3:
1651 ad:a6:91:c7:98:c9:42:18:35:14:9d:ad:98:46:92:
1652 2e:4f:ca:f1:87:43:c1:16:95:57:2d:50:ef:89:2d:
1653 80:7a:57:ad:f2:ee:5f:6b:d2:00:8d:b9:14:f8:14:
1654 15:35:d9:c0:46:a3:7b:72:c8:91:bf:c9:55:2b:cd:
1655 d0:97:3e:9c:26:64:cc:df:ce:83:19:71:ca:4e:e6:
1656 d4:d5:7b:a9:19:cd:55:de:c8:ec:d2:5e:38:53:e5:
1657 5c:4f:8c:2d:fe:50:23:36:fc:66:e6:cb:8e:a4:39:
1658 19:00:b7:95:02:39:91:0b:0e:fe:38:2e:d1:1d:05:
1659 9a:f6:4d:3e:6f:0f:07:1d:af:2c:1e:8f:60:39:e2:
1660 fa:36:53:13:39:d4:5e:26:2b:db:3d:a8:14:bd:32:
1661 eb:18:03:28:52:04:71:e5:ab:33:3d:e1:38:bb:07:
1662 36:84:62:9c:79:ea:16:30:f4:5f:c0:2b:e8:71:6b:
1663 e4:f9
1664 Exponent: 65537 (0x10001)
1665 X509v3 extensions:
1666 X509v3 Basic Constraints: critical
1667 CA:TRUE
1668 X509v3 Subject Key Identifier:
1669 C0:7A:98:68:8D:89:FB:AB:05:64:0C:11:7D:AA:7D:65:B8:CA:CC:4E
1670 X509v3 Authority Key Identifier:
1671 keyid:C0:7A:98:68:8D:89:FB:AB:05:64:0C:11:7D:AA:7D:65:B8:CA:CC:4E
1672
1673 Signature Algorithm: sha1WithRSAEncryption
1674 35:e3:29:6a:e5:2f:5d:54:8e:29:50:94:9f:99:1a:14:e4:8f:
1675 78:2a:62:94:a2:27:67:9e:d0:cf:1a:5e:47:e9:c1:b2:a4:cf:
1676 dd:41:1a:05:4e:9b:4b:ee:4a:6f:55:52:b3:24:a1:37:0a:eb:
1677 64:76:2a:2e:2c:f3:fd:3b:75:90:bf:fa:71:d8:c7:3d:37:d2:
1678 b5:05:95:62:b9:a6:de:89:3d:36:7b:38:77:48:97:ac:a6:20:
1679 8f:2e:a6:c9:0c:c2:b2:99:45:00:c7:ce:11:51:22:22:e0:a5:
1680 ea:b6:15:48:09:64:ea:5e:4f:74:f7:05:3e:c7:8a:52:0c:db:
1681 15:b4:bd:6d:9b:e5:c6:b1:54:68:a9:e3:69:90:b6:9a:a5:0f:
1682 b8:b9:3f:20:7d:ae:4a:b5:b8:9c:e4:1d:b6:ab:e6:94:a5:c1:
1683 c7:83:ad:db:f5:27:87:0e:04:6c:d5:ff:dd:a0:5d:ed:87:52:
1684 b7:2b:15:02:ae:39:a6:6a:74:e9:da:c4:e7:bc:4d:34:1e:a9:
1685 5c:4d:33:5f:92:09:2f:88:66:5d:77:97:c7:1d:76:13:a9:d5:
1686 e5:f1:16:09:11:35:d5:ac:db:24:71:70:2c:98:56:0b:d9:17:
1687 b4:d1:e3:51:2b:5e:75:e8:d5:d0:dc:4f:34:ed:c2:05:66:80:
1688 a1:cb:e6:33
1689SHA1 Fingerprint=DE:28:F4:A4:FF:E5:B9:2F:A3:C5:03:D1:A3:49:A7:F9:96:2A:82:12
1690-----BEGIN CERTIFICATE-----
1691MIIDVDCCAjygAwIBAgIDAjRWMA0GCSqGSIb3DQEBBQUAMEIxCzAJBgNVBAYTAlVT
1692MRYwFAYDVQQKEw1HZW9UcnVzdCBJbmMuMRswGQYDVQQDExJHZW9UcnVzdCBHbG9i
1693YWwgQ0EwHhcNMDIwNTIxMDQwMDAwWhcNMjIwNTIxMDQwMDAwWjBCMQswCQYDVQQG
1694EwJVUzEWMBQGA1UEChMNR2VvVHJ1c3QgSW5jLjEbMBkGA1UEAxMSR2VvVHJ1c3Qg
1695R2xvYmFsIENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA2swYYzD9
16969BcjGlZ+W988bDjkcbd4kdS8odhM+KhDtgPpTSEHCIjaWC9mOSm9BXiLnTjoBbdq
1697fnGk5sRgprDvgOSJKA+eJdbtg/OtppHHmMlCGDUUna2YRpIuT8rxh0PBFpVXLVDv
1698iS2Aelet8u5fa9IAjbkU+BQVNdnARqN7csiRv8lVK83Qlz6cJmTM386DGXHKTubU
16991XupGc1V3sjs0l44U+VcT4wt/lAjNvxm5suOpDkZALeVAjmRCw7+OC7RHQWa9k0+
1700bw8HHa8sHo9gOeL6NlMTOdReJivbPagUvTLrGAMoUgRx5aszPeE4uwc2hGKceeoW
1701MPRfwCvocWvk+QIDAQABo1MwUTAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBTA
1702ephojYn7qwVkDBF9qn1luMrMTjAfBgNVHSMEGDAWgBTAephojYn7qwVkDBF9qn1l
1703uMrMTjANBgkqhkiG9w0BAQUFAAOCAQEANeMpauUvXVSOKVCUn5kaFOSPeCpilKIn
1704Z57QzxpeR+nBsqTP3UEaBU6bS+5Kb1VSsyShNwrrZHYqLizz/Tt1kL/6cdjHPTfS
1705tQWVYrmm3ok9Nns4d0iXrKYgjy6myQzCsplFAMfOEVEiIuCl6rYVSAlk6l5PdPcF
1706PseKUgzbFbS9bZvlxrFUaKnjaZC2mqUPuLk/IH2uSrW4nOQdtqvmlKXBx4Ot2/Un
1707hw4EbNX/3aBd7YdStysVAq45pmp06drE57xNNB6pXE0zX5IJL4hmXXeXxx12E6nV
17085fEWCRE11azbJHFwLJhWC9kXtNHjUStedejV0NxPNO3CBWaAocvmMw==
1709-----END CERTIFICATE-----
1710Certificate:
1711 Data:
1712 Version: 3 (0x2)
1713 Serial Number: 1 (0x1)
1714 Signature Algorithm: sha1WithRSAEncryption
1715 Issuer: C=US, O=GeoTrust Inc., CN=GeoTrust Global CA 2
1716 Validity
1717 Not Before: Mar 4 05:00:00 2004 GMT
1718 Not After : Mar 4 05:00:00 2019 GMT
1719 Subject: C=US, O=GeoTrust Inc., CN=GeoTrust Global CA 2
1720 Subject Public Key Info:
1721 Public Key Algorithm: rsaEncryption
1722 Public-Key: (2048 bit)
1723 Modulus:
1724 00:ef:3c:4d:40:3d:10:df:3b:53:00:e1:67:fe:94:
1725 60:15:3e:85:88:f1:89:0d:90:c8:28:23:99:05:e8:
1726 2b:20:9d:c6:f3:60:46:d8:c1:b2:d5:8c:31:d9:dc:
1727 20:79:24:81:bf:35:32:fc:63:69:db:b1:2a:6b:ee:
1728 21:58:f2:08:e9:78:cb:6f:cb:fc:16:52:c8:91:c4:
1729 ff:3d:73:de:b1:3e:a7:c2:7d:66:c1:f5:7e:52:24:
1730 1a:e2:d5:67:91:d0:82:10:d7:78:4b:4f:2b:42:39:
1731 bd:64:2d:40:a0:b0:10:d3:38:48:46:88:a1:0c:bb:
1732 3a:33:2a:62:98:fb:00:9d:13:59:7f:6f:3b:72:aa:
1733 ee:a6:0f:86:f9:05:61:ea:67:7f:0c:37:96:8b:e6:
1734 69:16:47:11:c2:27:59:03:b3:a6:60:c2:21:40:56:
1735 fa:a0:c7:7d:3a:13:e3:ec:57:c7:b3:d6:ae:9d:89:
1736 80:f7:01:e7:2c:f6:96:2b:13:0d:79:2c:d9:c0:e4:
1737 86:7b:4b:8c:0c:72:82:8a:fb:17:cd:00:6c:3a:13:
1738 3c:b0:84:87:4b:16:7a:29:b2:4f:db:1d:d4:0b:f3:
1739 66:37:bd:d8:f6:57:bb:5e:24:7a:b8:3c:8b:b9:fa:
1740 92:1a:1a:84:9e:d8:74:8f:aa:1b:7f:5e:f4:fe:45:
1741 22:21
1742 Exponent: 65537 (0x10001)
1743 X509v3 extensions:
1744 X509v3 Basic Constraints: critical
1745 CA:TRUE
1746 X509v3 Subject Key Identifier:
1747 71:38:36:F2:02:31:53:47:2B:6E:BA:65:46:A9:10:15:58:20:05:09
1748 X509v3 Authority Key Identifier:
1749 keyid:71:38:36:F2:02:31:53:47:2B:6E:BA:65:46:A9:10:15:58:20:05:09
1750
1751 X509v3 Key Usage: critical
1752 Digital Signature, Certificate Sign, CRL Sign
1753 Signature Algorithm: sha1WithRSAEncryption
1754 03:f7:b5:2b:ab:5d:10:fc:7b:b2:b2:5e:ac:9b:0e:7e:53:78:
1755 59:3e:42:04:fe:75:a3:ad:ac:81:4e:d7:02:8b:5e:c4:2d:c8:
1756 52:76:c7:2c:1f:fc:81:32:98:d1:4b:c6:92:93:33:35:31:2f:
1757 fc:d8:1d:44:dd:e0:81:7f:9d:e9:8b:e1:64:91:62:0b:39:08:
1758 8c:ac:74:9d:59:d9:7a:59:52:97:11:b9:16:7b:6f:45:d3:96:
1759 d9:31:7d:02:36:0f:9c:3b:6e:cf:2c:0d:03:46:45:eb:a0:f4:
1760 7f:48:44:c6:08:40:cc:de:1b:70:b5:29:ad:ba:8b:3b:34:65:
1761 75:1b:71:21:1d:2c:14:0a:b0:96:95:b8:d6:ea:f2:65:fb:29:
1762 ba:4f:ea:91:93:74:69:b6:f2:ff:e1:1a:d0:0c:d1:76:85:cb:
1763 8a:25:bd:97:5e:2c:6f:15:99:26:e7:b6:29:ff:22:ec:c9:02:
1764 c7:56:00:cd:49:b9:b3:6c:7b:53:04:1a:e2:a8:c9:aa:12:05:
1765 23:c2:ce:e7:bb:04:02:cc:c0:47:a2:e4:c4:29:2f:5b:45:57:
1766 89:51:ee:3c:eb:52:08:ff:07:35:1e:9f:35:6a:47:4a:56:98:
1767 d1:5a:85:1f:8c:f5:22:bf:ab:ce:83:f3:e2:22:29:ae:7d:83:
1768 40:a8:ba:6c
1769SHA1 Fingerprint=A9:E9:78:08:14:37:58:88:F2:05:19:B0:6D:2B:0D:2B:60:16:90:7D
1770-----BEGIN CERTIFICATE-----
1771MIIDZjCCAk6gAwIBAgIBATANBgkqhkiG9w0BAQUFADBEMQswCQYDVQQGEwJVUzEW
1772MBQGA1UEChMNR2VvVHJ1c3QgSW5jLjEdMBsGA1UEAxMUR2VvVHJ1c3QgR2xvYmFs
1773IENBIDIwHhcNMDQwMzA0MDUwMDAwWhcNMTkwMzA0MDUwMDAwWjBEMQswCQYDVQQG
1774EwJVUzEWMBQGA1UEChMNR2VvVHJ1c3QgSW5jLjEdMBsGA1UEAxMUR2VvVHJ1c3Qg
1775R2xvYmFsIENBIDIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDvPE1A
1776PRDfO1MA4Wf+lGAVPoWI8YkNkMgoI5kF6CsgncbzYEbYwbLVjDHZ3CB5JIG/NTL8
1777Y2nbsSpr7iFY8gjpeMtvy/wWUsiRxP89c96xPqfCfWbB9X5SJBri1WeR0IIQ13hL
1778TytCOb1kLUCgsBDTOEhGiKEMuzozKmKY+wCdE1l/bztyqu6mD4b5BWHqZ38MN5aL
17795mkWRxHCJ1kDs6ZgwiFAVvqgx306E+PsV8ez1q6diYD3Aecs9pYrEw15LNnA5IZ7
1780S4wMcoKK+xfNAGw6EzywhIdLFnopsk/bHdQL82Y3vdj2V7teJHq4PIu5+pIaGoSe
17812HSPqht/XvT+RSIhAgMBAAGjYzBhMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYE
1782FHE4NvICMVNHK266ZUapEBVYIAUJMB8GA1UdIwQYMBaAFHE4NvICMVNHK266ZUap
1783EBVYIAUJMA4GA1UdDwEB/wQEAwIBhjANBgkqhkiG9w0BAQUFAAOCAQEAA/e1K6td
1784EPx7srJerJsOflN4WT5CBP51o62sgU7XAotexC3IUnbHLB/8gTKY0UvGkpMzNTEv
1785/NgdRN3ggX+d6YvhZJFiCzkIjKx0nVnZellSlxG5FntvRdOW2TF9AjYPnDtuzywN
1786A0ZF66D0f0hExghAzN4bcLUprbqLOzRldRtxIR0sFAqwlpW41uryZfspuk/qkZN0
1787abby/+Ea0AzRdoXLiiW9l14sbxWZJue2Kf8i7MkCx1YAzUm5s2x7UwQa4qjJqhIF
1788I8LO57sEAszAR6LkxCkvW0VXiVHuPOtSCP8HNR6fNWpHSlaY0VqFH4z1Ir+rzoPz
17894iIprn2DQKi6bA==
1790-----END CERTIFICATE-----
1791Certificate:
1792 Data:
1793 Version: 3 (0x2)
1794 Serial Number:
1795 18:ac:b5:6a:fd:69:b6:15:3a:63:6c:af:da:fa:c4:a1
1796 Signature Algorithm: sha1WithRSAEncryption
1797 Issuer: C=US, O=GeoTrust Inc., CN=GeoTrust Primary Certification Authority
1798 Validity
1799 Not Before: Nov 27 00:00:00 2006 GMT
1800 Not After : Jul 16 23:59:59 2036 GMT
1801 Subject: C=US, O=GeoTrust Inc., CN=GeoTrust Primary Certification Authority
1802 Subject Public Key Info:
1803 Public Key Algorithm: rsaEncryption
1804 Public-Key: (2048 bit)
1805 Modulus:
1806 00:be:b8:15:7b:ff:d4:7c:7d:67:ad:83:64:7b:c8:
1807 42:53:2d:df:f6:84:08:20:61:d6:01:59:6a:9c:44:
1808 11:af:ef:76:fd:95:7e:ce:61:30:bb:7a:83:5f:02:
1809 bd:01:66:ca:ee:15:8d:6f:a1:30:9c:bd:a1:85:9e:
1810 94:3a:f3:56:88:00:31:cf:d8:ee:6a:96:02:d9:ed:
1811 03:8c:fb:75:6d:e7:ea:b8:55:16:05:16:9a:f4:e0:
1812 5e:b1:88:c0:64:85:5c:15:4d:88:c7:b7:ba:e0:75:
1813 e9:ad:05:3d:9d:c7:89:48:e0:bb:28:c8:03:e1:30:
1814 93:64:5e:52:c0:59:70:22:35:57:88:8a:f1:95:0a:
1815 83:d7:bc:31:73:01:34:ed:ef:46:71:e0:6b:02:a8:
1816 35:72:6b:97:9b:66:e0:cb:1c:79:5f:d8:1a:04:68:
1817 1e:47:02:e6:9d:60:e2:36:97:01:df:ce:35:92:df:
1818 be:67:c7:6d:77:59:3b:8f:9d:d6:90:15:94:bc:42:
1819 34:10:c1:39:f9:b1:27:3e:7e:d6:8a:75:c5:b2:af:
1820 96:d3:a2:de:9b:e4:98:be:7d:e1:e9:81:ad:b6:6f:
1821 fc:d7:0e:da:e0:34:b0:0d:1a:77:e7:e3:08:98:ef:
1822 58:fa:9c:84:b7:36:af:c2:df:ac:d2:f4:10:06:70:
1823 71:35
1824 Exponent: 65537 (0x10001)
1825 X509v3 extensions:
1826 X509v3 Basic Constraints: critical
1827 CA:TRUE
1828 X509v3 Key Usage: critical
1829 Certificate Sign, CRL Sign
1830 X509v3 Subject Key Identifier:
1831 2C:D5:50:41:97:15:8B:F0:8F:36:61:5B:4A:FB:6B:D9:99:C9:33:92
1832 Signature Algorithm: sha1WithRSAEncryption
1833 5a:70:7f:2c:dd:b7:34:4f:f5:86:51:a9:26:be:4b:b8:aa:f1:
1834 71:0d:dc:61:c7:a0:ea:34:1e:7a:77:0f:04:35:e8:27:8f:6c:
1835 90:bf:91:16:24:46:3e:4a:4e:ce:2b:16:d5:0b:52:1d:fc:1f:
1836 67:a2:02:45:31:4f:ce:f3:fa:03:a7:79:9d:53:6a:d9:da:63:
1837 3a:f8:80:d7:d3:99:e1:a5:e1:be:d4:55:71:98:35:3a:be:93:
1838 ea:ae:ad:42:b2:90:6f:e0:fc:21:4d:35:63:33:89:49:d6:9b:
1839 4e:ca:c7:e7:4e:09:00:f7:da:c7:ef:99:62:99:77:b6:95:22:
1840 5e:8a:a0:ab:f4:b8:78:98:ca:38:19:99:c9:72:9e:78:cd:4b:
1841 ac:af:19:a0:73:12:2d:fc:c2:41:ba:81:91:da:16:5a:31:b7:
1842 f9:b4:71:80:12:48:99:72:73:5a:59:53:c1:63:52:33:ed:a7:
1843 c9:d2:39:02:70:fa:e0:b1:42:66:29:aa:9b:51:ed:30:54:22:
1844 14:5f:d9:ab:1d:c1:e4:94:f0:f8:f5:2b:f7:ea:ca:78:46:d6:
1845 b8:91:fd:a6:0d:2b:1a:14:01:3e:80:f0:42:a0:95:07:5e:6d:
1846 cd:cc:4b:a4:45:8d:ab:12:e8:b3:de:5a:e5:a0:7c:e8:0f:22:
1847 1d:5a:e9:59
1848SHA1 Fingerprint=32:3C:11:8E:1B:F7:B8:B6:52:54:E2:E2:10:0D:D6:02:90:37:F0:96
1849-----BEGIN CERTIFICATE-----
1850MIIDfDCCAmSgAwIBAgIQGKy1av1pthU6Y2yv2vrEoTANBgkqhkiG9w0BAQUFADBY
1851MQswCQYDVQQGEwJVUzEWMBQGA1UEChMNR2VvVHJ1c3QgSW5jLjExMC8GA1UEAxMo
1852R2VvVHJ1c3QgUHJpbWFyeSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0wNjEx
1853MjcwMDAwMDBaFw0zNjA3MTYyMzU5NTlaMFgxCzAJBgNVBAYTAlVTMRYwFAYDVQQK
1854Ew1HZW9UcnVzdCBJbmMuMTEwLwYDVQQDEyhHZW9UcnVzdCBQcmltYXJ5IENlcnRp
1855ZmljYXRpb24gQXV0aG9yaXR5MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKC
1856AQEAvrgVe//UfH1nrYNke8hCUy3f9oQIIGHWAVlqnEQRr+92/ZV+zmEwu3qDXwK9
1857AWbK7hWNb6EwnL2hhZ6UOvNWiAAxz9juapYC2e0DjPt1befquFUWBRaa9OBesYjA
1858ZIVcFU2Ix7e64HXprQU9nceJSOC7KMgD4TCTZF5SwFlwIjVXiIrxlQqD17wxcwE0
18597e9GceBrAqg1cmuXm2bgyxx5X9gaBGgeRwLmnWDiNpcB3841kt++Z8dtd1k7j53W
1860kBWUvEI0EME5+bEnPn7WinXFsq+W06Lem+SYvn3h6YGttm/81w7a4DSwDRp35+MI
1861mO9Y+pyEtzavwt+s0vQQBnBxNQIDAQABo0IwQDAPBgNVHRMBAf8EBTADAQH/MA4G
1862A1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQULNVQQZcVi/CPNmFbSvtr2ZnJM5IwDQYJ
1863KoZIhvcNAQEFBQADggEBAFpwfyzdtzRP9YZRqSa+S7iq8XEN3GHHoOo0Hnp3DwQ1
18646CePbJC/kRYkRj5KTs4rFtULUh38H2eiAkUxT87z+gOneZ1TatnaYzr4gNfTmeGl
18654b7UVXGYNTq+k+qurUKykG/g/CFNNWMziUnWm07Kx+dOCQD32sfvmWKZd7aVIl6K
1866oKv0uHiYyjgZmclynnjNS6yvGaBzEi38wkG6gZHaFloxt/m0cYASSJlyc1pZU8Fj
1867UjPtp8nSOQJw+uCxQmYpqptR7TBUIhRf2asdweSU8Pj1K/fqynhG1riR/aYNKxoU
1868AT6A8EKglQdebc3MS6RFjasS6LPeWuWgfOgPIh1a6Vk=
1869-----END CERTIFICATE-----
1870Certificate:
1871 Data:
1872 Version: 3 (0x2)
1873 Serial Number:
1874 15:ac:6e:94:19:b2:79:4b:41:f6:27:a9:c3:18:0f:1f
1875 Signature Algorithm: sha256WithRSAEncryption
1876 Issuer: C=US, O=GeoTrust Inc., OU=(c) 2008 GeoTrust Inc. - For authorized use only, CN=GeoTrust Primary Certification Authority - G3
1877 Validity
1878 Not Before: Apr 2 00:00:00 2008 GMT
1879 Not After : Dec 1 23:59:59 2037 GMT
1880 Subject: C=US, O=GeoTrust Inc., OU=(c) 2008 GeoTrust Inc. - For authorized use only, CN=GeoTrust Primary Certification Authority - G3
1881 Subject Public Key Info:
1882 Public Key Algorithm: rsaEncryption
1883 Public-Key: (2048 bit)
1884 Modulus:
1885 00:dc:e2:5e:62:58:1d:33:57:39:32:33:fa:eb:cb:
1886 87:8c:a7:d4:4a:dd:06:88:ea:64:8e:31:98:a5:38:
1887 90:1e:98:cf:2e:63:2b:f0:46:bc:44:b2:89:a1:c0:
1888 28:0c:49:70:21:95:9f:64:c0:a6:93:12:02:65:26:
1889 86:c6:a5:89:f0:fa:d7:84:a0:70:af:4f:1a:97:3f:
1890 06:44:d5:c9:eb:72:10:7d:e4:31:28:fb:1c:61:e6:
1891 28:07:44:73:92:22:69:a7:03:88:6c:9d:63:c8:52:
1892 da:98:27:e7:08:4c:70:3e:b4:c9:12:c1:c5:67:83:
1893 5d:33:f3:03:11:ec:6a:d0:53:e2:d1:ba:36:60:94:
1894 80:bb:61:63:6c:5b:17:7e:df:40:94:1e:ab:0d:c2:
1895 21:28:70:88:ff:d6:26:6c:6c:60:04:25:4e:55:7e:
1896 7d:ef:bf:94:48:de:b7:1d:dd:70:8d:05:5f:88:a5:
1897 9b:f2:c2:ee:ea:d1:40:41:6d:62:38:1d:56:06:c5:
1898 03:47:51:20:19:fc:7b:10:0b:0e:62:ae:76:55:bf:
1899 5f:77:be:3e:49:01:53:3d:98:25:03:76:24:5a:1d:
1900 b4:db:89:ea:79:e5:b6:b3:3b:3f:ba:4c:28:41:7f:
1901 06:ac:6a:8e:c1:d0:f6:05:1d:7d:e6:42:86:e3:a5:
1902 d5:47
1903 Exponent: 65537 (0x10001)
1904 X509v3 extensions:
1905 X509v3 Basic Constraints: critical
1906 CA:TRUE
1907 X509v3 Key Usage: critical
1908 Certificate Sign, CRL Sign
1909 X509v3 Subject Key Identifier:
1910 C4:79:CA:8E:A1:4E:03:1D:1C:DC:6B:DB:31:5B:94:3E:3F:30:7F:2D
1911 Signature Algorithm: sha256WithRSAEncryption
1912 2d:c5:13:cf:56:80:7b:7a:78:bd:9f:ae:2c:99:e7:ef:da:df:
1913 94:5e:09:69:a7:e7:6e:68:8c:bd:72:be:47:a9:0e:97:12:b8:
1914 4a:f1:64:d3:39:df:25:34:d4:c1:cd:4e:81:f0:0f:04:c4:24:
1915 b3:34:96:c6:a6:aa:30:df:68:61:73:d7:f9:8e:85:89:ef:0e:
1916 5e:95:28:4a:2a:27:8f:10:8e:2e:7c:86:c4:02:9e:da:0c:77:
1917 65:0e:44:0d:92:fd:fd:b3:16:36:fa:11:0d:1d:8c:0e:07:89:
1918 6a:29:56:f7:72:f4:dd:15:9c:77:35:66:57:ab:13:53:d8:8e:
1919 c1:40:c5:d7:13:16:5a:72:c7:b7:69:01:c4:7a:b1:83:01:68:
1920 7d:8d:41:a1:94:18:c1:25:5c:fc:f0:fe:83:02:87:7c:0d:0d:
1921 cf:2e:08:5c:4a:40:0d:3e:ec:81:61:e6:24:db:ca:e0:0e:2d:
1922 07:b2:3e:56:dc:8d:f5:41:85:07:48:9b:0c:0b:cb:49:3f:7d:
1923 ec:b7:fd:cb:8d:67:89:1a:ab:ed:bb:1e:a3:00:08:08:17:2a:
1924 82:5c:31:5d:46:8a:2d:0f:86:9b:74:d9:45:fb:d4:40:b1:7a:
1925 aa:68:2d:86:b2:99:22:e1:c1:2b:c7:9c:f8:f3:5f:a8:82:12:
1926 eb:19:11:2d
1927SHA1 Fingerprint=03:9E:ED:B8:0B:E7:A0:3C:69:53:89:3B:20:D2:D9:32:3A:4C:2A:FD
1928-----BEGIN CERTIFICATE-----
1929MIID/jCCAuagAwIBAgIQFaxulBmyeUtB9iepwxgPHzANBgkqhkiG9w0BAQsFADCB
1930mDELMAkGA1UEBhMCVVMxFjAUBgNVBAoTDUdlb1RydXN0IEluYy4xOTA3BgNVBAsT
1931MChjKSAyMDA4IEdlb1RydXN0IEluYy4gLSBGb3IgYXV0aG9yaXplZCB1c2Ugb25s
1932eTE2MDQGA1UEAxMtR2VvVHJ1c3QgUHJpbWFyeSBDZXJ0aWZpY2F0aW9uIEF1dGhv
1933cml0eSAtIEczMB4XDTA4MDQwMjAwMDAwMFoXDTM3MTIwMTIzNTk1OVowgZgxCzAJ
1934BgNVBAYTAlVTMRYwFAYDVQQKEw1HZW9UcnVzdCBJbmMuMTkwNwYDVQQLEzAoYykg
1935MjAwOCBHZW9UcnVzdCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxNjA0
1936BgNVBAMTLUdlb1RydXN0IFByaW1hcnkgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkg
1937LSBHMzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBANziXmJYHTNXOTIz
1938+uvLh4yn1ErdBojqZI4xmKU4kB6Yzy5jK/BGvESyiaHAKAxJcCGVn2TAppMSAmUm
1939hsalifD614SgcK9PGpc/BkTVyetyEH3kMSj7HGHmKAdEc5IiaacDiGydY8hS2pgn
19405whMcD60yRLBxWeDXTPzAxHsatBT4tG6NmCUgLthY2xbF37fQJQeqw3CIShwiP/W
1941JmxsYAQlTlV+fe+/lEjetx3dcI0FX4ilm/LC7urRQEFtYjgdVgbFA0dRIBn8exAL
1942DmKudlW/X3e+PkkBUz2YJQN2JFodtNuJ6nnltrM7P7pMKEF/BqxqjsHQ9gUdfeZC
1943huOl1UcCAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYw
1944HQYDVR0OBBYEFMR5yo6hTgMdHNxr2zFblD4/MH8tMA0GCSqGSIb3DQEBCwUAA4IB
1945AQAtxRPPVoB7eni9n64smefv2t+UXglpp+duaIy9cr5HqQ6XErhK8WTTOd8lNNTB
1946zU6B8A8ExCSzNJbGpqow32hhc9f5joWJ7w5elShKKiePEI4ufIbEAp7aDHdlDkQN
1947kv39sxY2+hENHYwOB4lqKVb3cvTdFZx3NWZXqxNT2I7BQMXXExZacse3aQHEerGD
1948AWh9jUGhlBjBJVz88P6DAod8DQ3PLghcSkANPuyBYeYk28rgDi0Hsj5W3I31QYUH
1949SJsMC8tJP33st/3LjWeJGqvtux6jAAgIFyqCXDFdRootD4abdNlF+9RAsXqqaC2G
1950spki4cErx5z481+oghLrGREt
1951-----END CERTIFICATE-----
1952Certificate:
1953 Data:
1954 Version: 3 (0x2)
1955 Serial Number: 1 (0x1)
1956 Signature Algorithm: sha1WithRSAEncryption
1957 Issuer: C=US, O=GeoTrust Inc., CN=GeoTrust Universal CA
1958 Validity
1959 Not Before: Mar 4 05:00:00 2004 GMT
1960 Not After : Mar 4 05:00:00 2029 GMT
1961 Subject: C=US, O=GeoTrust Inc., CN=GeoTrust Universal CA
1962 Subject Public Key Info:
1963 Public Key Algorithm: rsaEncryption
1964 Public-Key: (4096 bit)
1965 Modulus:
1966 00:a6:15:55:a0:a3:c6:e0:1f:8c:9d:21:50:d7:c1:
1967 be:2b:5b:b5:a4:9e:a1:d9:72:58:bd:00:1b:4c:bf:
1968 61:c9:14:1d:45:82:ab:c6:1d:80:d6:3d:eb:10:9c:
1969 3a:af:6d:24:f8:bc:71:01:9e:06:f5:7c:5f:1e:c1:
1970 0e:55:ca:83:9a:59:30:ae:19:cb:30:48:95:ed:22:
1971 37:8d:f4:4a:9a:72:66:3e:ad:95:c0:e0:16:00:e0:
1972 10:1f:2b:31:0e:d7:94:54:d3:42:33:a0:34:1d:1e:
1973 45:76:dd:4f:ca:18:37:ec:85:15:7a:19:08:fc:d5:
1974 c7:9c:f0:f2:a9:2e:10:a9:92:e6:3d:58:3d:a9:16:
1975 68:3c:2f:75:21:18:7f:28:77:a5:e1:61:17:b7:a6:
1976 e9:f8:1e:99:db:73:6e:f4:0a:a2:21:6c:ee:da:aa:
1977 85:92:66:af:f6:7a:6b:82:da:ba:22:08:35:0f:cf:
1978 42:f1:35:fa:6a:ee:7e:2b:25:cc:3a:11:e4:6d:af:
1979 73:b2:76:1d:ad:d0:b2:78:67:1a:a4:39:1c:51:0b:
1980 67:56:83:fd:38:5d:0d:ce:dd:f0:bb:2b:96:1f:de:
1981 7b:32:52:fd:1d:bb:b5:06:a1:b2:21:5e:a5:d6:95:
1982 68:7f:f0:99:9e:dc:45:08:3e:e7:d2:09:0d:35:94:
1983 dd:80:4e:53:97:d7:b5:09:44:20:64:16:17:03:02:
1984 4c:53:0d:68:de:d5:aa:72:4d:93:6d:82:0e:db:9c:
1985 bd:cf:b4:f3:5c:5d:54:7a:69:09:96:d6:db:11:c1:
1986 8d:75:a8:b4:cf:39:c8:ce:3c:bc:24:7c:e6:62:ca:
1987 e1:bd:7d:a7:bd:57:65:0b:e4:fe:25:ed:b6:69:10:
1988 dc:28:1a:46:bd:01:1d:d0:97:b5:e1:98:3b:c0:37:
1989 64:d6:3d:94:ee:0b:e1:f5:28:ae:0b:56:bf:71:8b:
1990 23:29:41:8e:86:c5:4b:52:7b:d8:71:ab:1f:8a:15:
1991 a6:3b:83:5a:d7:58:01:51:c6:4c:41:d9:7f:d8:41:
1992 67:72:a2:28:df:60:83:a9:9e:c8:7b:fc:53:73:72:
1993 59:f5:93:7a:17:76:0e:ce:f7:e5:5c:d9:0b:55:34:
1994 a2:aa:5b:b5:6a:54:e7:13:ca:57:ec:97:6d:f4:5e:
1995 06:2f:45:8b:58:d4:23:16:92:e4:16:6e:28:63:59:
1996 30:df:50:01:9c:63:89:1a:9f:db:17:94:82:70:37:
1997 c3:24:9e:9a:47:d6:5a:ca:4e:a8:69:89:72:1f:91:
1998 6c:db:7e:9e:1b:ad:c7:1f:73:dd:2c:4f:19:65:fd:
1999 7f:93:40:10:2e:d2:f0:ed:3c:9e:2e:28:3e:69:26:
2000 33:c5:7b
2001 Exponent: 65537 (0x10001)
2002 X509v3 extensions:
2003 X509v3 Basic Constraints: critical
2004 CA:TRUE
2005 X509v3 Subject Key Identifier:
2006 DA:BB:2E:AA:B0:0C:B8:88:26:51:74:5C:6D:03:D3:C0:D8:8F:7A:D6
2007 X509v3 Authority Key Identifier:
2008 keyid:DA:BB:2E:AA:B0:0C:B8:88:26:51:74:5C:6D:03:D3:C0:D8:8F:7A:D6
2009
2010 X509v3 Key Usage: critical
2011 Digital Signature, Certificate Sign, CRL Sign
2012 Signature Algorithm: sha1WithRSAEncryption
2013 31:78:e6:c7:b5:df:b8:94:40:c9:71:c4:a8:35:ec:46:1d:c2:
2014 85:f3:28:58:86:b0:0b:fc:8e:b2:39:8f:44:55:ab:64:84:5c:
2015 69:a9:d0:9a:38:3c:fa:e5:1f:35:e5:44:e3:80:79:94:68:a4:
2016 bb:c4:9f:3d:e1:34:cd:30:46:8b:54:2b:95:a5:ef:f7:3f:99:
2017 84:fd:35:e6:cf:31:c6:dc:6a:bf:a7:d7:23:08:e1:98:5e:c3:
2018 5a:08:76:a9:a6:af:77:2f:b7:60:bd:44:46:6a:ef:97:ff:73:
2019 95:c1:8e:e8:93:fb:fd:31:b7:ec:57:11:11:45:9b:30:f1:1a:
2020 88:39:c1:4f:3c:a7:00:d5:c7:fc:ab:6d:80:22:70:a5:0c:e0:
2021 5d:04:29:02:fb:cb:a0:91:d1:7c:d6:c3:7e:50:d5:9d:58:be:
2022 41:38:eb:b9:75:3c:15:d9:9b:c9:4a:83:59:c0:da:53:fd:33:
2023 bb:36:18:9b:85:0f:15:dd:ee:2d:ac:76:93:b9:d9:01:8d:48:
2024 10:a8:fb:f5:38:86:f1:db:0a:c6:bd:84:a3:23:41:de:d6:77:
2025 6f:85:d4:85:1c:50:e0:ae:51:8a:ba:8d:3e:76:e2:b9:ca:27:
2026 f2:5f:9f:ef:6e:59:0d:06:d8:2b:17:a4:d2:7c:6b:bb:5f:14:
2027 1a:48:8f:1a:4c:e7:b3:47:1c:8e:4c:45:2b:20:ee:48:df:e7:
2028 dd:09:8e:18:a8:da:40:8d:92:26:11:53:61:73:5d:eb:bd:e7:
2029 c4:4d:29:37:61:eb:ac:39:2d:67:2e:16:d6:f5:00:83:85:a1:
2030 cc:7f:76:c4:7d:e4:b7:4b:66:ef:03:45:60:69:b6:0c:52:96:
2031 92:84:5e:a6:a3:b5:a4:3e:2b:d9:cc:d8:1b:47:aa:f2:44:da:
2032 4f:f9:03:e8:f0:14:cb:3f:f3:83:de:d0:c1:54:e3:b7:e8:0a:
2033 37:4d:8b:20:59:03:30:19:a1:2c:c8:bd:11:1f:df:ae:c9:4a:
2034 c5:f3:27:66:66:86:ac:68:91:ff:d9:e6:53:1c:0f:8b:5c:69:
2035 65:0a:26:c8:1e:34:c3:5d:51:7b:d7:a9:9c:06:a1:36:dd:d5:
2036 89:94:bc:d9:e4:2d:0c:5e:09:6c:08:97:7c:a3:3d:7c:93:ff:
2037 3f:a1:14:a7:cf:b5:5d:eb:db:db:1c:c4:76:df:88:b9:bd:45:
2038 05:95:1b:ae:fc:46:6a:4c:af:48:e3:ce:ae:0f:d2:7e:eb:e6:
2039 6c:9c:4f:81:6a:7a:64:ac:bb:3e:d5:e7:cb:76:2e:c5:a7:48:
2040 c1:5c:90:0f:cb:c8:3f:fa:e6:32:e1:8d:1b:6f:a4:e6:8e:d8:
2041 f9:29:48:8a:ce:73:fe:2c
2042SHA1 Fingerprint=E6:21:F3:35:43:79:05:9A:4B:68:30:9D:8A:2F:74:22:15:87:EC:79
2043-----BEGIN CERTIFICATE-----
2044MIIFaDCCA1CgAwIBAgIBATANBgkqhkiG9w0BAQUFADBFMQswCQYDVQQGEwJVUzEW
2045MBQGA1UEChMNR2VvVHJ1c3QgSW5jLjEeMBwGA1UEAxMVR2VvVHJ1c3QgVW5pdmVy
2046c2FsIENBMB4XDTA0MDMwNDA1MDAwMFoXDTI5MDMwNDA1MDAwMFowRTELMAkGA1UE
2047BhMCVVMxFjAUBgNVBAoTDUdlb1RydXN0IEluYy4xHjAcBgNVBAMTFUdlb1RydXN0
2048IFVuaXZlcnNhbCBDQTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAKYV
2049VaCjxuAfjJ0hUNfBvitbtaSeodlyWL0AG0y/YckUHUWCq8YdgNY96xCcOq9tJPi8
2050cQGeBvV8Xx7BDlXKg5pZMK4ZyzBIle0iN430SppyZj6tlcDgFgDgEB8rMQ7XlFTT
2051QjOgNB0eRXbdT8oYN+yFFXoZCPzVx5zw8qkuEKmS5j1YPakWaDwvdSEYfyh3peFh
2052F7em6fgemdtzbvQKoiFs7tqqhZJmr/Z6a4LauiIINQ/PQvE1+mrufislzDoR5G2v
2053c7J2Ha3QsnhnGqQ5HFELZ1aD/ThdDc7d8Lsrlh/eezJS/R27tQahsiFepdaVaH/w
2054mZ7cRQg+59IJDTWU3YBOU5fXtQlEIGQWFwMCTFMNaN7VqnJNk22CDtucvc+081xd
2055VHppCZbW2xHBjXWotM85yM48vCR85mLK4b19p71XZQvk/iXttmkQ3CgaRr0BHdCX
2056teGYO8A3ZNY9lO4L4fUorgtWv3GLIylBjobFS1J72HGrH4oVpjuDWtdYAVHGTEHZ
2057f9hBZ3KiKN9gg6meyHv8U3NyWfWTehd2Ds735VzZC1U0oqpbtWpU5xPKV+yXbfRe
2058Bi9Fi1jUIxaS5BZuKGNZMN9QAZxjiRqf2xeUgnA3wySemkfWWspOqGmJch+RbNt+
2059nhutxx9z3SxPGWX9f5NAEC7S8O08ni4oPmkmM8V7AgMBAAGjYzBhMA8GA1UdEwEB
2060/wQFMAMBAf8wHQYDVR0OBBYEFNq7LqqwDLiIJlF0XG0D08DYj3rWMB8GA1UdIwQY
2061MBaAFNq7LqqwDLiIJlF0XG0D08DYj3rWMA4GA1UdDwEB/wQEAwIBhjANBgkqhkiG
20629w0BAQUFAAOCAgEAMXjmx7XfuJRAyXHEqDXsRh3ChfMoWIawC/yOsjmPRFWrZIRc
2063aanQmjg8+uUfNeVE44B5lGiku8SfPeE0zTBGi1QrlaXv9z+ZhP015s8xxtxqv6fX
2064IwjhmF7DWgh2qaavdy+3YL1ERmrvl/9zlcGO6JP7/TG37FcREUWbMPEaiDnBTzyn
2065ANXH/KttgCJwpQzgXQQpAvvLoJHRfNbDflDVnVi+QTjruXU8FdmbyUqDWcDaU/0z
2066uzYYm4UPFd3uLax2k7nZAY1IEKj79TiG8dsKxr2EoyNB3tZ3b4XUhRxQ4K5RirqN
2067Pnbiucon8l+f725ZDQbYKxek0nxru18UGkiPGkzns0ccjkxFKyDuSN/n3QmOGKja
2068QI2SJhFTYXNd673nxE0pN2HrrDktZy4W1vUAg4WhzH92xH3kt0tm7wNFYGm2DFKW
2069koRepqO1pD4r2czYG0eq8kTaT/kD6PAUyz/zg97QwVTjt+gKN02LIFkDMBmhLMi9
2070ER/frslKxfMnZmaGrGiR/9nmUxwPi1xpZQomyB40w11Re9epnAahNt3ViZS82eQt
2071DF4JbAiXfKM9fJP/P6EUp8+1Xevb2xzEdt+Iub1FBZUbrvxGakyvSOPOrg/Sfuvm
2072bJxPgWp6ZKy7PtXny3YuxadIwVyQD8vIP/rmMuGNG2+k5o7Y+SlIis5z/iw=
2073-----END CERTIFICATE-----
2074Certificate:
2075 Data:
2076 Version: 3 (0x2)
2077 Serial Number: 1 (0x1)
2078 Signature Algorithm: sha1WithRSAEncryption
2079 Issuer: C=US, O=GeoTrust Inc., CN=GeoTrust Universal CA 2
2080 Validity
2081 Not Before: Mar 4 05:00:00 2004 GMT
2082 Not After : Mar 4 05:00:00 2029 GMT
2083 Subject: C=US, O=GeoTrust Inc., CN=GeoTrust Universal CA 2
2084 Subject Public Key Info:
2085 Public Key Algorithm: rsaEncryption
2086 Public-Key: (4096 bit)
2087 Modulus:
2088 00:b3:54:52:c1:c9:3e:f2:d9:dc:b1:53:1a:59:29:
2089 e7:b1:c3:45:28:e5:d7:d1:ed:c5:c5:4b:a1:aa:74:
2090 7b:57:af:4a:26:fc:d8:f5:5e:a7:6e:19:db:74:0c:
2091 4f:35:5b:32:0b:01:e3:db:eb:7a:77:35:ea:aa:5a:
2092 e0:d6:e8:a1:57:94:f0:90:a3:74:56:94:44:30:03:
2093 1e:5c:4e:2b:85:26:74:82:7a:0c:76:a0:6f:4d:ce:
2094 41:2d:a0:15:06:14:5f:b7:42:cd:7b:8f:58:61:34:
2095 dc:2a:08:f9:2e:c3:01:a6:22:44:1c:4c:07:82:e6:
2096 5b:ce:d0:4a:7c:04:d3:19:73:27:f0:aa:98:7f:2e:
2097 af:4e:eb:87:1e:24:77:6a:5d:b6:e8:5b:45:ba:dc:
2098 c3:a1:05:6f:56:8e:8f:10:26:a5:49:c3:2e:d7:41:
2099 87:22:e0:4f:86:ca:60:b5:ea:a1:63:c0:01:97:10:
2100 79:bd:00:3c:12:6d:2b:15:b1:ac:4b:b1:ee:18:b9:
2101 4e:96:dc:dc:76:ff:3b:be:cf:5f:03:c0:fc:3b:e8:
2102 be:46:1b:ff:da:40:c2:52:f7:fe:e3:3a:f7:6a:77:
2103 35:d0:da:8d:eb:5e:18:6a:31:c7:1e:ba:3c:1b:28:
2104 d6:6b:54:c6:aa:5b:d7:a2:2c:1b:19:cc:a2:02:f6:
2105 9b:59:bd:37:6b:86:b5:6d:82:ba:d8:ea:c9:56:bc:
2106 a9:36:58:fd:3e:19:f3:ed:0c:26:a9:93:38:f8:4f:
2107 c1:5d:22:06:d0:97:ea:e1:ad:c6:55:e0:81:2b:28:
2108 83:3a:fa:f4:7b:21:51:00:be:52:38:ce:cd:66:79:
2109 a8:f4:81:56:e2:d0:83:09:47:51:5b:50:6a:cf:db:
2110 48:1a:5d:3e:f7:cb:f6:65:f7:6c:f1:95:f8:02:3b:
2111 32:56:82:39:7a:5b:bd:2f:89:1b:bf:a1:b4:e8:ff:
2112 7f:8d:8c:df:03:f1:60:4e:58:11:4c:eb:a3:3f:10:
2113 2b:83:9a:01:73:d9:94:6d:84:00:27:66:ac:f0:70:
2114 40:09:42:92:ad:4f:93:0d:61:09:51:24:d8:92:d5:
2115 0b:94:61:b2:87:b2:ed:ff:9a:35:ff:85:54:ca:ed:
2116 44:43:ac:1b:3c:16:6b:48:4a:0a:1c:40:88:1f:92:
2117 c2:0b:00:05:ff:f2:c8:02:4a:a4:aa:a9:cc:99:96:
2118 9c:2f:58:e0:7d:e1:be:bb:07:dc:5f:04:72:5c:31:
2119 34:c3:ec:5f:2d:e0:3d:64:90:22:e6:d1:ec:b8:2e:
2120 dd:59:ae:d9:a1:37:bf:54:35:dc:73:32:4f:8c:04:
2121 1e:33:b2:c9:46:f1:d8:5c:c8:55:50:c9:68:bd:a8:
2122 ba:36:09
2123 Exponent: 65537 (0x10001)
2124 X509v3 extensions:
2125 X509v3 Basic Constraints: critical
2126 CA:TRUE
2127 X509v3 Subject Key Identifier:
2128 76:F3:55:E1:FA:A4:36:FB:F0:9F:5C:62:71:ED:3C:F4:47:38:10:2B
2129 X509v3 Authority Key Identifier:
2130 keyid:76:F3:55:E1:FA:A4:36:FB:F0:9F:5C:62:71:ED:3C:F4:47:38:10:2B
2131
2132 X509v3 Key Usage: critical
2133 Digital Signature, Certificate Sign, CRL Sign
2134 Signature Algorithm: sha1WithRSAEncryption
2135 66:c1:c6:23:f3:d9:e0:2e:6e:5f:e8:cf:ae:b0:b0:25:4d:2b:
2136 f8:3b:58:9b:40:24:37:5a:cb:ab:16:49:ff:b3:75:79:33:a1:
2137 2f:6d:70:17:34:91:fe:67:7e:8f:ec:9b:e5:5e:82:a9:55:1f:
2138 2f:dc:d4:51:07:12:fe:ac:16:3e:2c:35:c6:63:fc:dc:10:eb:
2139 0d:a3:aa:d0:7c:cc:d1:d0:2f:51:2e:c4:14:5a:de:e8:19:e1:
2140 3e:c6:cc:a4:29:e7:2e:84:aa:06:30:78:76:54:73:28:98:59:
2141 38:e0:00:0d:62:d3:42:7d:21:9f:ae:3d:3a:8c:d5:fa:77:0d:
2142 18:2b:16:0e:5f:36:e1:fc:2a:b5:30:24:cf:e0:63:0c:7b:58:
2143 1a:fe:99:ba:42:12:b1:91:f4:7c:68:e2:c8:e8:af:2c:ea:c9:
2144 7e:ae:bb:2a:3d:0d:15:dc:34:95:b6:18:74:a8:6a:0f:c7:b4:
2145 f4:13:c4:e4:5b:ed:0a:d2:a4:97:4c:2a:ed:2f:6c:12:89:3d:
2146 f1:27:70:aa:6a:03:52:21:9f:40:a8:67:50:f2:f3:5a:1f:df:
2147 df:23:f6:dc:78:4e:e6:98:4f:55:3a:53:e3:ef:f2:f4:9f:c7:
2148 7c:d8:58:af:29:22:97:b8:e0:bd:91:2e:b0:76:ec:57:11:cf:
2149 ef:29:44:f3:e9:85:7a:60:63:e4:5d:33:89:17:d9:31:aa:da:
2150 d6:f3:18:35:72:cf:87:2b:2f:63:23:84:5d:84:8c:3f:57:a0:
2151 88:fc:99:91:28:26:69:99:d4:8f:97:44:be:8e:d5:48:b1:a4:
2152 28:29:f1:15:b4:e1:e5:9e:dd:f8:8f:a6:6f:26:d7:09:3c:3a:
2153 1c:11:0e:a6:6c:37:f7:ad:44:87:2c:28:c7:d8:74:82:b3:d0:
2154 6f:4a:57:bb:35:29:27:a0:8b:e8:21:a7:87:64:36:5d:cc:d8:
2155 16:ac:c7:b2:27:40:92:55:38:28:8d:51:6e:dd:14:67:53:6c:
2156 71:5c:26:84:4d:75:5a:b6:7e:60:56:a9:4d:ad:fb:9b:1e:97:
2157 f3:0d:d9:d2:97:54:77:da:3d:12:b7:e0:1e:ef:08:06:ac:f9:
2158 85:87:e9:a2:dc:af:7e:18:12:83:fd:56:17:41:2e:d5:29:82:
2159 7d:99:f4:31:f6:71:a9:cf:2c:01:27:a5:05:b9:aa:b2:48:4e:
2160 2a:ef:9f:93:52:51:95:3c:52:73:8e:56:4c:17:40:c0:09:28:
2161 e4:8b:6a:48:53:db:ec:cd:55:55:f1:c6:f8:e9:a2:2c:4c:a6:
2162 d1:26:5f:7e:af:5a:4c:da:1f:a6:f2:1c:2c:7e:ae:02:16:d2:
2163 56:d0:2f:57:53:47:e8:92
2164SHA1 Fingerprint=37:9A:19:7B:41:85:45:35:0C:A6:03:69:F3:3C:2E:AF:47:4F:20:79
2165-----BEGIN CERTIFICATE-----
2166MIIFbDCCA1SgAwIBAgIBATANBgkqhkiG9w0BAQUFADBHMQswCQYDVQQGEwJVUzEW
2167MBQGA1UEChMNR2VvVHJ1c3QgSW5jLjEgMB4GA1UEAxMXR2VvVHJ1c3QgVW5pdmVy
2168c2FsIENBIDIwHhcNMDQwMzA0MDUwMDAwWhcNMjkwMzA0MDUwMDAwWjBHMQswCQYD
2169VQQGEwJVUzEWMBQGA1UEChMNR2VvVHJ1c3QgSW5jLjEgMB4GA1UEAxMXR2VvVHJ1
2170c3QgVW5pdmVyc2FsIENBIDIwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoIC
2171AQCzVFLByT7y2dyxUxpZKeexw0Uo5dfR7cXFS6GqdHtXr0om/Nj1XqduGdt0DE81
2172WzILAePb63p3NeqqWuDW6KFXlPCQo3RWlEQwAx5cTiuFJnSCegx2oG9NzkEtoBUG
2173FF+3Qs17j1hhNNwqCPkuwwGmIkQcTAeC5lvO0Ep8BNMZcyfwqph/Lq9O64ceJHdq
2174XbboW0W63MOhBW9Wjo8QJqVJwy7XQYci4E+GymC16qFjwAGXEHm9ADwSbSsVsaxL
2175se4YuU6W3Nx2/zu+z18DwPw76L5GG//aQMJS9/7jOvdqdzXQ2o3rXhhqMcceujwb
2176KNZrVMaqW9eiLBsZzKIC9ptZvTdrhrVtgrrY6slWvKk2WP0+GfPtDCapkzj4T8Fd
2177IgbQl+rhrcZV4IErKIM6+vR7IVEAvlI4zs1meaj0gVbi0IMJR1FbUGrP20gaXT73
2178y/Zl92zxlfgCOzJWgjl6W70viRu/obTo/3+NjN8D8WBOWBFM66M/ECuDmgFz2ZRt
2179hAAnZqzwcEAJQpKtT5MNYQlRJNiS1QuUYbKHsu3/mjX/hVTK7URDrBs8FmtISgoc
2180QIgfksILAAX/8sgCSqSqqcyZlpwvWOB94b67B9xfBHJcMTTD7F8t4D1kkCLm0ey4
2181Lt1ZrtmhN79UNdxzMk+MBB4zsslG8dhcyFVQyWi9qLo2CQIDAQABo2MwYTAPBgNV
2182HRMBAf8EBTADAQH/MB0GA1UdDgQWBBR281Xh+qQ2+/CfXGJx7Tz0RzgQKzAfBgNV
2183HSMEGDAWgBR281Xh+qQ2+/CfXGJx7Tz0RzgQKzAOBgNVHQ8BAf8EBAMCAYYwDQYJ
2184KoZIhvcNAQEFBQADggIBAGbBxiPz2eAubl/oz66wsCVNK/g7WJtAJDday6sWSf+z
2185dXkzoS9tcBc0kf5nfo/sm+VegqlVHy/c1FEHEv6sFj4sNcZj/NwQ6w2jqtB8zNHQ
2186L1EuxBRa3ugZ4T7GzKQp5y6EqgYweHZUcyiYWTjgAA1i00J9IZ+uPTqM1fp3DRgr
2187Fg5fNuH8KrUwJM/gYwx7WBr+mbpCErGR9Hxo4sjoryzqyX6uuyo9DRXcNJW2GHSo
2188ag/HtPQTxORb7QrSpJdMKu0vbBKJPfEncKpqA1Ihn0CoZ1Dy81of398j9tx4TuaY
2189T1U6U+Pv8vSfx3zYWK8pIpe44L2RLrB27FcRz+8pRPPphXpgY+RdM4kX2TGq2tbz
2190GDVyz4crL2MjhF2EjD9XoIj8mZEoJmmZ1I+XRL6O1UixpCgp8RW04eWe3fiPpm8m
21911wk8OhwRDqZsN/etRIcsKMfYdIKz0G9KV7s1KSegi+ghp4dkNl3M2Basx7InQJJV
2192OCiNUW7dFGdTbHFcJoRNdVq2fmBWqU2t+5sel/MN2dKXVHfaPRK34B7vCAas+YWH
21936aLcr34YEoP9VhdBLtUpgn2Z9DH2canPLAEnpQW5qrJITirvn5NSUZU8UnOOVkwX
2194QMAJKOSLakhT2+zNVVXxxvjpoixMptEmX36vWkzaH6byHCx+rgIW0lbQL1dTR+iS
2195-----END CERTIFICATE-----
2196Certificate:
2197 Data:
2198 Version: 3 (0x2)
2199 Serial Number: 0 (0x0)
2200 Signature Algorithm: sha1WithRSAEncryption
2201 Issuer: C=US, O=The Go Daddy Group, Inc., OU=Go Daddy Class 2 Certification Authority
2202 Validity
2203 Not Before: Jun 29 17:06:20 2004 GMT
2204 Not After : Jun 29 17:06:20 2034 GMT
2205 Subject: C=US, O=The Go Daddy Group, Inc., OU=Go Daddy Class 2 Certification Authority
2206 Subject Public Key Info:
2207 Public Key Algorithm: rsaEncryption
2208 Public-Key: (2048 bit)
2209 Modulus:
2210 00:de:9d:d7:ea:57:18:49:a1:5b:eb:d7:5f:48:86:
2211 ea:be:dd:ff:e4:ef:67:1c:f4:65:68:b3:57:71:a0:
2212 5e:77:bb:ed:9b:49:e9:70:80:3d:56:18:63:08:6f:
2213 da:f2:cc:d0:3f:7f:02:54:22:54:10:d8:b2:81:d4:
2214 c0:75:3d:4b:7f:c7:77:c3:3e:78:ab:1a:03:b5:20:
2215 6b:2f:6a:2b:b1:c5:88:7e:c4:bb:1e:b0:c1:d8:45:
2216 27:6f:aa:37:58:f7:87:26:d7:d8:2d:f6:a9:17:b7:
2217 1f:72:36:4e:a6:17:3f:65:98:92:db:2a:6e:5d:a2:
2218 fe:88:e0:0b:de:7f:e5:8d:15:e1:eb:cb:3a:d5:e2:
2219 12:a2:13:2d:d8:8e:af:5f:12:3d:a0:08:05:08:b6:
2220 5c:a5:65:38:04:45:99:1e:a3:60:60:74:c5:41:a5:
2221 72:62:1b:62:c5:1f:6f:5f:1a:42:be:02:51:65:a8:
2222 ae:23:18:6a:fc:78:03:a9:4d:7f:80:c3:fa:ab:5a:
2223 fc:a1:40:a4:ca:19:16:fe:b2:c8:ef:5e:73:0d:ee:
2224 77:bd:9a:f6:79:98:bc:b1:07:67:a2:15:0d:dd:a0:
2225 58:c6:44:7b:0a:3e:62:28:5f:ba:41:07:53:58:cf:
2226 11:7e:38:74:c5:f8:ff:b5:69:90:8f:84:74:ea:97:
2227 1b:af
2228 Exponent: 3 (0x3)
2229 X509v3 extensions:
2230 X509v3 Subject Key Identifier:
2231 D2:C4:B0:D2:91:D4:4C:11:71:B3:61:CB:3D:A1:FE:DD:A8:6A:D4:E3
2232 X509v3 Authority Key Identifier:
2233 keyid:D2:C4:B0:D2:91:D4:4C:11:71:B3:61:CB:3D:A1:FE:DD:A8:6A:D4:E3
2234 DirName:/C=US/O=The Go Daddy Group, Inc./OU=Go Daddy Class 2 Certification Authority
2235 serial:00
2236
2237 X509v3 Basic Constraints:
2238 CA:TRUE
2239 Signature Algorithm: sha1WithRSAEncryption
2240 32:4b:f3:b2:ca:3e:91:fc:12:c6:a1:07:8c:8e:77:a0:33:06:
2241 14:5c:90:1e:18:f7:08:a6:3d:0a:19:f9:87:80:11:6e:69:e4:
2242 96:17:30:ff:34:91:63:72:38:ee:cc:1c:01:a3:1d:94:28:a4:
2243 31:f6:7a:c4:54:d7:f6:e5:31:58:03:a2:cc:ce:62:db:94:45:
2244 73:b5:bf:45:c9:24:b5:d5:82:02:ad:23:79:69:8d:b8:b6:4d:
2245 ce:cf:4c:ca:33:23:e8:1c:88:aa:9d:8b:41:6e:16:c9:20:e5:
2246 89:9e:cd:3b:da:70:f7:7e:99:26:20:14:54:25:ab:6e:73:85:
2247 e6:9b:21:9d:0a:6c:82:0e:a8:f8:c2:0c:fa:10:1e:6c:96:ef:
2248 87:0d:c4:0f:61:8b:ad:ee:83:2b:95:f8:8e:92:84:72:39:eb:
2249 20:ea:83:ed:83:cd:97:6e:08:bc:eb:4e:26:b6:73:2b:e4:d3:
2250 f6:4c:fe:26:71:e2:61:11:74:4a:ff:57:1a:87:0f:75:48:2e:
2251 cf:51:69:17:a0:02:12:61:95:d5:d1:40:b2:10:4c:ee:c4:ac:
2252 10:43:a6:a5:9e:0a:d5:95:62:9a:0d:cf:88:82:c5:32:0c:e4:
2253 2b:9f:45:e6:0d:9f:28:9c:b1:b9:2a:5a:57:ad:37:0f:af:1d:
2254 7f:db:bd:9f
2255SHA1 Fingerprint=27:96:BA:E6:3F:18:01:E2:77:26:1B:A0:D7:77:70:02:8F:20:EE:E4
2256-----BEGIN CERTIFICATE-----
2257MIIEADCCAuigAwIBAgIBADANBgkqhkiG9w0BAQUFADBjMQswCQYDVQQGEwJVUzEh
2258MB8GA1UEChMYVGhlIEdvIERhZGR5IEdyb3VwLCBJbmMuMTEwLwYDVQQLEyhHbyBE
2259YWRkeSBDbGFzcyAyIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTA0MDYyOTE3
2260MDYyMFoXDTM0MDYyOTE3MDYyMFowYzELMAkGA1UEBhMCVVMxITAfBgNVBAoTGFRo
2261ZSBHbyBEYWRkeSBHcm91cCwgSW5jLjExMC8GA1UECxMoR28gRGFkZHkgQ2xhc3Mg
2262MiBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTCCASAwDQYJKoZIhvcNAQEBBQADggEN
2263ADCCAQgCggEBAN6d1+pXGEmhW+vXX0iG6r7d/+TvZxz0ZWizV3GgXne77ZtJ6XCA
2264PVYYYwhv2vLM0D9/AlQiVBDYsoHUwHU9S3/Hd8M+eKsaA7Ugay9qK7HFiH7Eux6w
2265wdhFJ2+qN1j3hybX2C32qRe3H3I2TqYXP2WYktsqbl2i/ojgC95/5Y0V4evLOtXi
2266EqITLdiOr18SPaAIBQi2XKVlOARFmR6jYGB0xUGlcmIbYsUfb18aQr4CUWWoriMY
2267avx4A6lNf4DD+qta/KFApMoZFv6yyO9ecw3ud72a9nmYvLEHZ6IVDd2gWMZEewo+
2268YihfukEHU1jPEX44dMX4/7VpkI+EdOqXG68CAQOjgcAwgb0wHQYDVR0OBBYEFNLE
2269sNKR1EwRcbNhyz2h/t2oatTjMIGNBgNVHSMEgYUwgYKAFNLEsNKR1EwRcbNhyz2h
2270/t2oatTjoWekZTBjMQswCQYDVQQGEwJVUzEhMB8GA1UEChMYVGhlIEdvIERhZGR5
2271IEdyb3VwLCBJbmMuMTEwLwYDVQQLEyhHbyBEYWRkeSBDbGFzcyAyIENlcnRpZmlj
2272YXRpb24gQXV0aG9yaXR5ggEAMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQAD
2273ggEBADJL87LKPpH8EsahB4yOd6AzBhRckB4Y9wimPQoZ+YeAEW5p5JYXMP80kWNy
2274OO7MHAGjHZQopDH2esRU1/blMVgDoszOYtuURXO1v0XJJLXVggKtI3lpjbi2Tc7P
2275TMozI+gciKqdi0FuFskg5YmezTvacPd+mSYgFFQlq25zheabIZ0KbIIOqPjCDPoQ
2276HmyW74cNxA9hi63ugyuV+I6ShHI56yDqg+2DzZduCLzrTia2cyvk0/ZM/iZx4mER
2277dEr/VxqHD3VILs9RaRegAhJhldXRQLIQTO7ErBBDpqWeCtWVYpoNz4iCxTIM5Cuf
2278ReYNnyicsbkqWletNw+vHX/bvZ8=
2279-----END CERTIFICATE-----
2280Certificate:
2281 Data:
2282 Version: 3 (0x2)
2283 Serial Number: 0 (0x0)
2284 Signature Algorithm: sha256WithRSAEncryption
2285 Issuer: C=US, ST=Arizona, L=Scottsdale, O=GoDaddy.com, Inc., CN=Go Daddy Root Certificate Authority - G2
2286 Validity
2287 Not Before: Sep 1 00:00:00 2009 GMT
2288 Not After : Dec 31 23:59:59 2037 GMT
2289 Subject: C=US, ST=Arizona, L=Scottsdale, O=GoDaddy.com, Inc., CN=Go Daddy Root Certificate Authority - G2
2290 Subject Public Key Info:
2291 Public Key Algorithm: rsaEncryption
2292 Public-Key: (2048 bit)
2293 Modulus:
2294 00:bf:71:62:08:f1:fa:59:34:f7:1b:c9:18:a3:f7:
2295 80:49:58:e9:22:83:13:a6:c5:20:43:01:3b:84:f1:
2296 e6:85:49:9f:27:ea:f6:84:1b:4e:a0:b4:db:70:98:
2297 c7:32:01:b1:05:3e:07:4e:ee:f4:fa:4f:2f:59:30:
2298 22:e7:ab:19:56:6b:e2:80:07:fc:f3:16:75:80:39:
2299 51:7b:e5:f9:35:b6:74:4e:a9:8d:82:13:e4:b6:3f:
2300 a9:03:83:fa:a2:be:8a:15:6a:7f:de:0b:c3:b6:19:
2301 14:05:ca:ea:c3:a8:04:94:3b:46:7c:32:0d:f3:00:
2302 66:22:c8:8d:69:6d:36:8c:11:18:b7:d3:b2:1c:60:
2303 b4:38:fa:02:8c:ce:d3:dd:46:07:de:0a:3e:eb:5d:
2304 7c:c8:7c:fb:b0:2b:53:a4:92:62:69:51:25:05:61:
2305 1a:44:81:8c:2c:a9:43:96:23:df:ac:3a:81:9a:0e:
2306 29:c5:1c:a9:e9:5d:1e:b6:9e:9e:30:0a:39:ce:f1:
2307 88:80:fb:4b:5d:cc:32:ec:85:62:43:25:34:02:56:
2308 27:01:91:b4:3b:70:2a:3f:6e:b1:e8:9c:88:01:7d:
2309 9f:d4:f9:db:53:6d:60:9d:bf:2c:e7:58:ab:b8:5f:
2310 46:fc:ce:c4:1b:03:3c:09:eb:49:31:5c:69:46:b3:
2311 e0:47
2312 Exponent: 65537 (0x10001)
2313 X509v3 extensions:
2314 X509v3 Basic Constraints: critical
2315 CA:TRUE
2316 X509v3 Key Usage: critical
2317 Certificate Sign, CRL Sign
2318 X509v3 Subject Key Identifier:
2319 3A:9A:85:07:10:67:28:B6:EF:F6:BD:05:41:6E:20:C1:94:DA:0F:DE
2320 Signature Algorithm: sha256WithRSAEncryption
2321 99:db:5d:79:d5:f9:97:59:67:03:61:f1:7e:3b:06:31:75:2d:
2322 a1:20:8e:4f:65:87:b4:f7:a6:9c:bc:d8:e9:2f:d0:db:5a:ee:
2323 cf:74:8c:73:b4:38:42:da:05:7b:f8:02:75:b8:fd:a5:b1:d7:
2324 ae:f6:d7:de:13:cb:53:10:7e:8a:46:d1:97:fa:b7:2e:2b:11:
2325 ab:90:b0:27:80:f9:e8:9f:5a:e9:37:9f:ab:e4:df:6c:b3:85:
2326 17:9d:3d:d9:24:4f:79:91:35:d6:5f:04:eb:80:83:ab:9a:02:
2327 2d:b5:10:f4:d8:90:c7:04:73:40:ed:72:25:a0:a9:9f:ec:9e:
2328 ab:68:12:99:57:c6:8f:12:3a:09:a4:bd:44:fd:06:15:37:c1:
2329 9b:e4:32:a3:ed:38:e8:d8:64:f3:2c:7e:14:fc:02:ea:9f:cd:
2330 ff:07:68:17:db:22:90:38:2d:7a:8d:d1:54:f1:69:e3:5f:33:
2331 ca:7a:3d:7b:0a:e3:ca:7f:5f:39:e5:e2:75:ba:c5:76:18:33:
2332 ce:2c:f0:2f:4c:ad:f7:b1:e7:ce:4f:a8:c4:9b:4a:54:06:c5:
2333 7f:7d:d5:08:0f:e2:1c:fe:7e:17:b8:ac:5e:f6:d4:16:b2:43:
2334 09:0c:4d:f6:a7:6b:b4:99:84:65:ca:7a:88:e2:e2:44:be:5c:
2335 f7:ea:1c:f5
2336SHA1 Fingerprint=47:BE:AB:C9:22:EA:E8:0E:78:78:34:62:A7:9F:45:C2:54:FD:E6:8B
2337-----BEGIN CERTIFICATE-----
2338MIIDxTCCAq2gAwIBAgIBADANBgkqhkiG9w0BAQsFADCBgzELMAkGA1UEBhMCVVMx
2339EDAOBgNVBAgTB0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxGjAYBgNVBAoT
2340EUdvRGFkZHkuY29tLCBJbmMuMTEwLwYDVQQDEyhHbyBEYWRkeSBSb290IENlcnRp
2341ZmljYXRlIEF1dGhvcml0eSAtIEcyMB4XDTA5MDkwMTAwMDAwMFoXDTM3MTIzMTIz
2342NTk1OVowgYMxCzAJBgNVBAYTAlVTMRAwDgYDVQQIEwdBcml6b25hMRMwEQYDVQQH
2343EwpTY290dHNkYWxlMRowGAYDVQQKExFHb0RhZGR5LmNvbSwgSW5jLjExMC8GA1UE
2344AxMoR28gRGFkZHkgUm9vdCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkgLSBHMjCCASIw
2345DQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAL9xYgjx+lk09xvJGKP3gElY6SKD
2346E6bFIEMBO4Tx5oVJnyfq9oQbTqC023CYxzIBsQU+B07u9PpPL1kwIuerGVZr4oAH
2347/PMWdYA5UXvl+TW2dE6pjYIT5LY/qQOD+qK+ihVqf94Lw7YZFAXK6sOoBJQ7Rnwy
2348DfMAZiLIjWltNowRGLfTshxgtDj6AozO091GB94KPutdfMh8+7ArU6SSYmlRJQVh
2349GkSBjCypQ5Yj36w6gZoOKcUcqeldHraenjAKOc7xiID7S13MMuyFYkMlNAJWJwGR
2350tDtwKj9useiciAF9n9T521NtYJ2/LOdYq7hfRvzOxBsDPAnrSTFcaUaz4EcCAwEA
2351AaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYE
2352FDqahQcQZyi27/a9BUFuIMGU2g/eMA0GCSqGSIb3DQEBCwUAA4IBAQCZ21151fmX
2353WWcDYfF+OwYxdS2hII5PZYe096acvNjpL9DbWu7PdIxztDhC2gV7+AJ1uP2lsdeu
23549tfeE8tTEH6KRtGX+rcuKxGrkLAngPnon1rpN5+r5N9ss4UXnT3ZJE95kTXWXwTr
2355gIOrmgIttRD02JDHBHNA7XIloKmf7J6raBKZV8aPEjoJpL1E/QYVN8Gb5DKj7Tjo
23562GTzLH4U/ALqn83/B2gX2yKQOC16jdFU8WnjXzPKej17CuPKf1855eJ1usV2GDPO
2357LPAvTK33sefOT6jEm0pUBsV/fdUID+Ic/n4XuKxe9tQWskMJDE32p2u0mYRlynqI
23584uJEvlz36hz1
2359-----END CERTIFICATE-----
2360Certificate:
2361 Data:
2362 Version: 3 (0x2)
2363 Serial Number: 0 (0x0)
2364 Signature Algorithm: sha1WithRSAEncryption
2365 Issuer: C=US, O=Starfield Technologies, Inc., OU=Starfield Class 2 Certification Authority
2366 Validity
2367 Not Before: Jun 29 17:39:16 2004 GMT
2368 Not After : Jun 29 17:39:16 2034 GMT
2369 Subject: C=US, O=Starfield Technologies, Inc., OU=Starfield Class 2 Certification Authority
2370 Subject Public Key Info:
2371 Public Key Algorithm: rsaEncryption
2372 Public-Key: (2048 bit)
2373 Modulus:
2374 00:b7:32:c8:fe:e9:71:a6:04:85:ad:0c:11:64:df:
2375 ce:4d:ef:c8:03:18:87:3f:a1:ab:fb:3c:a6:9f:f0:
2376 c3:a1:da:d4:d8:6e:2b:53:90:fb:24:a4:3e:84:f0:
2377 9e:e8:5f:ec:e5:27:44:f5:28:a6:3f:7b:de:e0:2a:
2378 f0:c8:af:53:2f:9e:ca:05:01:93:1e:8f:66:1c:39:
2379 a7:4d:fa:5a:b6:73:04:25:66:eb:77:7f:e7:59:c6:
2380 4a:99:25:14:54:eb:26:c7:f3:7f:19:d5:30:70:8f:
2381 af:b0:46:2a:ff:ad:eb:29:ed:d7:9f:aa:04:87:a3:
2382 d4:f9:89:a5:34:5f:db:43:91:82:36:d9:66:3c:b1:
2383 b8:b9:82:fd:9c:3a:3e:10:c8:3b:ef:06:65:66:7a:
2384 9b:19:18:3d:ff:71:51:3c:30:2e:5f:be:3d:77:73:
2385 b2:5d:06:6c:c3:23:56:9a:2b:85:26:92:1c:a7:02:
2386 b3:e4:3f:0d:af:08:79:82:b8:36:3d:ea:9c:d3:35:
2387 b3:bc:69:ca:f5:cc:9d:e8:fd:64:8d:17:80:33:6e:
2388 5e:4a:5d:99:c9:1e:87:b4:9d:1a:c0:d5:6e:13:35:
2389 23:5e:df:9b:5f:3d:ef:d6:f7:76:c2:ea:3e:bb:78:
2390 0d:1c:42:67:6b:04:d8:f8:d6:da:6f:8b:f2:44:a0:
2391 01:ab
2392 Exponent: 3 (0x3)
2393 X509v3 extensions:
2394 X509v3 Subject Key Identifier:
2395 BF:5F:B7:D1:CE:DD:1F:86:F4:5B:55:AC:DC:D7:10:C2:0E:A9:88:E7
2396 X509v3 Authority Key Identifier:
2397 keyid:BF:5F:B7:D1:CE:DD:1F:86:F4:5B:55:AC:DC:D7:10:C2:0E:A9:88:E7
2398 DirName:/C=US/O=Starfield Technologies, Inc./OU=Starfield Class 2 Certification Authority
2399 serial:00
2400
2401 X509v3 Basic Constraints:
2402 CA:TRUE
2403 Signature Algorithm: sha1WithRSAEncryption
2404 05:9d:3f:88:9d:d1:c9:1a:55:a1:ac:69:f3:f3:59:da:9b:01:
2405 87:1a:4f:57:a9:a1:79:09:2a:db:f7:2f:b2:1e:cc:c7:5e:6a:
2406 d8:83:87:a1:97:ef:49:35:3e:77:06:41:58:62:bf:8e:58:b8:
2407 0a:67:3f:ec:b3:dd:21:66:1f:c9:54:fa:72:cc:3d:4c:40:d8:
2408 81:af:77:9e:83:7a:bb:a2:c7:f5:34:17:8e:d9:11:40:f4:fc:
2409 2c:2a:4d:15:7f:a7:62:5d:2e:25:d3:00:0b:20:1a:1d:68:f9:
2410 17:b8:f4:bd:8b:ed:28:59:dd:4d:16:8b:17:83:c8:b2:65:c7:
2411 2d:7a:a5:aa:bc:53:86:6d:dd:57:a4:ca:f8:20:41:0b:68:f0:
2412 f4:fb:74:be:56:5d:7a:79:f5:f9:1d:85:e3:2d:95:be:f5:71:
2413 90:43:cc:8d:1f:9a:00:0a:87:29:e9:55:22:58:00:23:ea:e3:
2414 12:43:29:5b:47:08:dd:8c:41:6a:65:06:a8:e5:21:aa:41:b4:
2415 95:21:95:b9:7d:d1:34:ab:13:d6:ad:bc:dc:e2:3d:39:cd:bd:
2416 3e:75:70:a1:18:59:03:c9:22:b4:8f:9c:d5:5e:2a:d7:a5:b6:
2417 d4:0a:6d:f8:b7:40:11:46:9a:1f:79:0e:62:bf:0f:97:ec:e0:
2418 2f:1f:17:94
2419SHA1 Fingerprint=AD:7E:1C:28:B0:64:EF:8F:60:03:40:20:14:C3:D0:E3:37:0E:B5:8A
2420-----BEGIN CERTIFICATE-----
2421MIIEDzCCAvegAwIBAgIBADANBgkqhkiG9w0BAQUFADBoMQswCQYDVQQGEwJVUzEl
2422MCMGA1UEChMcU3RhcmZpZWxkIFRlY2hub2xvZ2llcywgSW5jLjEyMDAGA1UECxMp
2423U3RhcmZpZWxkIENsYXNzIDIgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMDQw
2424NjI5MTczOTE2WhcNMzQwNjI5MTczOTE2WjBoMQswCQYDVQQGEwJVUzElMCMGA1UE
2425ChMcU3RhcmZpZWxkIFRlY2hub2xvZ2llcywgSW5jLjEyMDAGA1UECxMpU3RhcmZp
2426ZWxkIENsYXNzIDIgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwggEgMA0GCSqGSIb3
2427DQEBAQUAA4IBDQAwggEIAoIBAQC3Msj+6XGmBIWtDBFk385N78gDGIc/oav7PKaf
24288MOh2tTYbitTkPskpD6E8J7oX+zlJ0T1KKY/e97gKvDIr1MvnsoFAZMej2YcOadN
2429+lq2cwQlZut3f+dZxkqZJRRU6ybH838Z1TBwj6+wRir/resp7defqgSHo9T5iaU0
2430X9tDkYI22WY8sbi5gv2cOj4QyDvvBmVmepsZGD3/cVE8MC5fvj13c7JdBmzDI1aa
2431K4UmkhynArPkPw2vCHmCuDY96pzTNbO8acr1zJ3o/WSNF4Azbl5KXZnJHoe0nRrA
24321W4TNSNe35tfPe/W93bC6j67eA0cQmdrBNj41tpvi/JEoAGrAgEDo4HFMIHCMB0G
2433A1UdDgQWBBS/X7fRzt0fhvRbVazc1xDCDqmI5zCBkgYDVR0jBIGKMIGHgBS/X7fR
2434zt0fhvRbVazc1xDCDqmI56FspGowaDELMAkGA1UEBhMCVVMxJTAjBgNVBAoTHFN0
2435YXJmaWVsZCBUZWNobm9sb2dpZXMsIEluYy4xMjAwBgNVBAsTKVN0YXJmaWVsZCBD
2436bGFzcyAyIENlcnRpZmljYXRpb24gQXV0aG9yaXR5ggEAMAwGA1UdEwQFMAMBAf8w
2437DQYJKoZIhvcNAQEFBQADggEBAAWdP4id0ckaVaGsafPzWdqbAYcaT1epoXkJKtv3
2438L7IezMdeatiDh6GX70k1PncGQVhiv45YuApnP+yz3SFmH8lU+nLMPUxA2IGvd56D
2439eruix/U0F47ZEUD0/CwqTRV/p2JdLiXTAAsgGh1o+Re49L2L7ShZ3U0WixeDyLJl
2440xy16paq8U4Zt3VekyvggQQto8PT7dL5WXXp59fkdheMtlb71cZBDzI0fmgAKhynp
2441VSJYACPq4xJDKVtHCN2MQWplBqjlIapBtJUhlbl90TSrE9atvNziPTnNvT51cKEY
2442WQPJIrSPnNVeKtelttQKbfi3QBFGmh95DmK/D5fs4C8fF5Q=
2443-----END CERTIFICATE-----
2444Certificate:
2445 Data:
2446 Version: 3 (0x2)
2447 Serial Number: 0 (0x0)
2448 Signature Algorithm: sha256WithRSAEncryption
2449 Issuer: C=US, ST=Arizona, L=Scottsdale, O=Starfield Technologies, Inc., CN=Starfield Root Certificate Authority - G2
2450 Validity
2451 Not Before: Sep 1 00:00:00 2009 GMT
2452 Not After : Dec 31 23:59:59 2037 GMT
2453 Subject: C=US, ST=Arizona, L=Scottsdale, O=Starfield Technologies, Inc., CN=Starfield Root Certificate Authority - G2
2454 Subject Public Key Info:
2455 Public Key Algorithm: rsaEncryption
2456 Public-Key: (2048 bit)
2457 Modulus:
2458 00:bd:ed:c1:03:fc:f6:8f:fc:02:b1:6f:5b:9f:48:
2459 d9:9d:79:e2:a2:b7:03:61:56:18:c3:47:b6:d7:ca:
2460 3d:35:2e:89:43:f7:a1:69:9b:de:8a:1a:fd:13:20:
2461 9c:b4:49:77:32:29:56:fd:b9:ec:8c:dd:22:fa:72:
2462 dc:27:61:97:ee:f6:5a:84:ec:6e:19:b9:89:2c:dc:
2463 84:5b:d5:74:fb:6b:5f:c5:89:a5:10:52:89:46:55:
2464 f4:b8:75:1c:e6:7f:e4:54:ae:4b:f8:55:72:57:02:
2465 19:f8:17:71:59:eb:1e:28:07:74:c5:9d:48:be:6c:
2466 b4:f4:a4:b0:f3:64:37:79:92:c0:ec:46:5e:7f:e1:
2467 6d:53:4c:62:af:cd:1f:0b:63:bb:3a:9d:fb:fc:79:
2468 00:98:61:74:cf:26:82:40:63:f3:b2:72:6a:19:0d:
2469 99:ca:d4:0e:75:cc:37:fb:8b:89:c1:59:f1:62:7f:
2470 5f:b3:5f:65:30:f8:a7:b7:4d:76:5a:1e:76:5e:34:
2471 c0:e8:96:56:99:8a:b3:f0:7f:a4:cd:bd:dc:32:31:
2472 7c:91:cf:e0:5f:11:f8:6b:aa:49:5c:d1:99:94:d1:
2473 a2:e3:63:5b:09:76:b5:56:62:e1:4b:74:1d:96:d4:
2474 26:d4:08:04:59:d0:98:0e:0e:e6:de:fc:c3:ec:1f:
2475 90:f1
2476 Exponent: 65537 (0x10001)
2477 X509v3 extensions:
2478 X509v3 Basic Constraints: critical
2479 CA:TRUE
2480 X509v3 Key Usage: critical
2481 Certificate Sign, CRL Sign
2482 X509v3 Subject Key Identifier:
2483 7C:0C:32:1F:A7:D9:30:7F:C4:7D:68:A3:62:A8:A1:CE:AB:07:5B:27
2484 Signature Algorithm: sha256WithRSAEncryption
2485 11:59:fa:25:4f:03:6f:94:99:3b:9a:1f:82:85:39:d4:76:05:
2486 94:5e:e1:28:93:6d:62:5d:09:c2:a0:a8:d4:b0:75:38:f1:34:
2487 6a:9d:e4:9f:8a:86:26:51:e6:2c:d1:c6:2d:6e:95:20:4a:92:
2488 01:ec:b8:8a:67:7b:31:e2:67:2e:8c:95:03:26:2e:43:9d:4a:
2489 31:f6:0e:b5:0c:bb:b7:e2:37:7f:22:ba:00:a3:0e:7b:52:fb:
2490 6b:bb:3b:c4:d3:79:51:4e:cd:90:f4:67:07:19:c8:3c:46:7a:
2491 0d:01:7d:c5:58:e7:6d:e6:85:30:17:9a:24:c4:10:e0:04:f7:
2492 e0:f2:7f:d4:aa:0a:ff:42:1d:37:ed:94:e5:64:59:12:20:77:
2493 38:d3:32:3e:38:81:75:96:73:fa:68:8f:b1:cb:ce:1f:c5:ec:
2494 fa:9c:7e:cf:7e:b1:f1:07:2d:b6:fc:bf:ca:a4:bf:d0:97:05:
2495 4a:bc:ea:18:28:02:90:bd:54:78:09:21:71:d3:d1:7d:1d:d9:
2496 16:b0:a9:61:3d:d0:0a:00:22:fc:c7:7b:cb:09:64:45:0b:3b:
2497 40:81:f7:7d:7c:32:f5:98:ca:58:8e:7d:2a:ee:90:59:73:64:
2498 f9:36:74:5e:25:a1:f5:66:05:2e:7f:39:15:a9:2a:fb:50:8b:
2499 8e:85:69:f4
2500SHA1 Fingerprint=B5:1C:06:7C:EE:2B:0C:3D:F8:55:AB:2D:92:F4:FE:39:D4:E7:0F:0E
2501-----BEGIN CERTIFICATE-----
2502MIID3TCCAsWgAwIBAgIBADANBgkqhkiG9w0BAQsFADCBjzELMAkGA1UEBhMCVVMx
2503EDAOBgNVBAgTB0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxJTAjBgNVBAoT
2504HFN0YXJmaWVsZCBUZWNobm9sb2dpZXMsIEluYy4xMjAwBgNVBAMTKVN0YXJmaWVs
2505ZCBSb290IENlcnRpZmljYXRlIEF1dGhvcml0eSAtIEcyMB4XDTA5MDkwMTAwMDAw
2506MFoXDTM3MTIzMTIzNTk1OVowgY8xCzAJBgNVBAYTAlVTMRAwDgYDVQQIEwdBcml6
2507b25hMRMwEQYDVQQHEwpTY290dHNkYWxlMSUwIwYDVQQKExxTdGFyZmllbGQgVGVj
2508aG5vbG9naWVzLCBJbmMuMTIwMAYDVQQDEylTdGFyZmllbGQgUm9vdCBDZXJ0aWZp
2509Y2F0ZSBBdXRob3JpdHkgLSBHMjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
2510ggEBAL3twQP89o/8ArFvW59I2Z154qK3A2FWGMNHttfKPTUuiUP3oWmb3ooa/RMg
2511nLRJdzIpVv257IzdIvpy3Cdhl+72WoTsbhm5iSzchFvVdPtrX8WJpRBSiUZV9Lh1
2512HOZ/5FSuS/hVclcCGfgXcVnrHigHdMWdSL5stPSksPNkN3mSwOxGXn/hbVNMYq/N
2513Hwtjuzqd+/x5AJhhdM8mgkBj87JyahkNmcrUDnXMN/uLicFZ8WJ/X7NfZTD4p7dN
2514dloedl40wOiWVpmKs/B/pM293DIxfJHP4F8R+GuqSVzRmZTRouNjWwl2tVZi4Ut0
2515HZbUJtQIBFnQmA4O5t78w+wfkPECAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAO
2516BgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFHwMMh+n2TB/xH1oo2Kooc6rB1snMA0G
2517CSqGSIb3DQEBCwUAA4IBAQARWfolTwNvlJk7mh+ChTnUdgWUXuEok21iXQnCoKjU
2518sHU48TRqneSfioYmUeYs0cYtbpUgSpIB7LiKZ3sx4mcujJUDJi5DnUox9g61DLu3
25194jd/IroAow57UvtruzvE03lRTs2Q9GcHGcg8RnoNAX3FWOdt5oUwF5okxBDgBPfg
25208n/Uqgr/Qh037ZTlZFkSIHc40zI+OIF1lnP6aI+xy84fxez6nH7PfrHxBy22/L/K
2521pL/QlwVKvOoYKAKQvVR4CSFx09F9HdkWsKlhPdAKACL8x3vLCWRFCztAgfd9fDL1
2522mMpYjn0q7pBZc2T5NnReJaH1ZgUufzkVqSr7UIuOhWn0
2523-----END CERTIFICATE-----
2524Certificate:
2525 Data:
2526 Version: 3 (0x2)
2527 Serial Number: 0 (0x0)
2528 Signature Algorithm: sha256WithRSAEncryption
2529 Issuer: C=US, ST=Arizona, L=Scottsdale, O=Starfield Technologies, Inc., CN=Starfield Services Root Certificate Authority - G2
2530 Validity
2531 Not Before: Sep 1 00:00:00 2009 GMT
2532 Not After : Dec 31 23:59:59 2037 GMT
2533 Subject: C=US, ST=Arizona, L=Scottsdale, O=Starfield Technologies, Inc., CN=Starfield Services Root Certificate Authority - G2
2534 Subject Public Key Info:
2535 Public Key Algorithm: rsaEncryption
2536 Public-Key: (2048 bit)
2537 Modulus:
2538 00:d5:0c:3a:c4:2a:f9:4e:e2:f5:be:19:97:5f:8e:
2539 88:53:b1:1f:3f:cb:cf:9f:20:13:6d:29:3a:c8:0f:
2540 7d:3c:f7:6b:76:38:63:d9:36:60:a8:9b:5e:5c:00:
2541 80:b2:2f:59:7f:f6:87:f9:25:43:86:e7:69:1b:52:
2542 9a:90:e1:71:e3:d8:2d:0d:4e:6f:f6:c8:49:d9:b6:
2543 f3:1a:56:ae:2b:b6:74:14:eb:cf:fb:26:e3:1a:ba:
2544 1d:96:2e:6a:3b:58:94:89:47:56:ff:25:a0:93:70:
2545 53:83:da:84:74:14:c3:67:9e:04:68:3a:df:8e:40:
2546 5a:1d:4a:4e:cf:43:91:3b:e7:56:d6:00:70:cb:52:
2547 ee:7b:7d:ae:3a:e7:bc:31:f9:45:f6:c2:60:cf:13:
2548 59:02:2b:80:cc:34:47:df:b9:de:90:65:6d:02:cf:
2549 2c:91:a6:a6:e7:de:85:18:49:7c:66:4e:a3:3a:6d:
2550 a9:b5:ee:34:2e:ba:0d:03:b8:33:df:47:eb:b1:6b:
2551 8d:25:d9:9b:ce:81:d1:45:46:32:96:70:87:de:02:
2552 0e:49:43:85:b6:6c:73:bb:64:ea:61:41:ac:c9:d4:
2553 54:df:87:2f:c7:22:b2:26:cc:9f:59:54:68:9f:fc:
2554 be:2a:2f:c4:55:1c:75:40:60:17:85:02:55:39:8b:
2555 7f:05
2556 Exponent: 65537 (0x10001)
2557 X509v3 extensions:
2558 X509v3 Basic Constraints: critical
2559 CA:TRUE
2560 X509v3 Key Usage: critical
2561 Certificate Sign, CRL Sign
2562 X509v3 Subject Key Identifier:
2563 9C:5F:00:DF:AA:01:D7:30:2B:38:88:A2:B8:6D:4A:9C:F2:11:91:83
2564 Signature Algorithm: sha256WithRSAEncryption
2565 4b:36:a6:84:77:69:dd:3b:19:9f:67:23:08:6f:0e:61:c9:fd:
2566 84:dc:5f:d8:36:81:cd:d8:1b:41:2d:9f:60:dd:c7:1a:68:d9:
2567 d1:6e:86:e1:88:23:cf:13:de:43:cf:e2:34:b3:04:9d:1f:29:
2568 d5:bf:f8:5e:c8:d5:c1:bd:ee:92:6f:32:74:f2:91:82:2f:bd:
2569 82:42:7a:ad:2a:b7:20:7d:4d:bc:7a:55:12:c2:15:ea:bd:f7:
2570 6a:95:2e:6c:74:9f:cf:1c:b4:f2:c5:01:a3:85:d0:72:3e:ad:
2571 73:ab:0b:9b:75:0c:6d:45:b7:8e:94:ac:96:37:b5:a0:d0:8f:
2572 15:47:0e:e3:e8:83:dd:8f:fd:ef:41:01:77:cc:27:a9:62:85:
2573 33:f2:37:08:ef:71:cf:77:06:de:c8:19:1d:88:40:cf:7d:46:
2574 1d:ff:1e:c7:e1:ce:ff:23:db:c6:fa:8d:55:4e:a9:02:e7:47:
2575 11:46:3e:f4:fd:bd:7b:29:26:bb:a9:61:62:37:28:b6:2d:2a:
2576 f6:10:86:64:c9:70:a7:d2:ad:b7:29:70:79:ea:3c:da:63:25:
2577 9f:fd:68:b7:30:ec:70:fb:75:8a:b7:6d:60:67:b2:1e:c8:b9:
2578 e9:d8:a8:6f:02:8b:67:0d:4d:26:57:71:da:20:fc:c1:4a:50:
2579 8d:b1:28:ba
2580SHA1 Fingerprint=92:5A:8F:8D:2C:6D:04:E0:66:5F:59:6A:FF:22:D8:63:E8:25:6F:3F
2581-----BEGIN CERTIFICATE-----
2582MIID7zCCAtegAwIBAgIBADANBgkqhkiG9w0BAQsFADCBmDELMAkGA1UEBhMCVVMx
2583EDAOBgNVBAgTB0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxJTAjBgNVBAoT
2584HFN0YXJmaWVsZCBUZWNobm9sb2dpZXMsIEluYy4xOzA5BgNVBAMTMlN0YXJmaWVs
2585ZCBTZXJ2aWNlcyBSb290IENlcnRpZmljYXRlIEF1dGhvcml0eSAtIEcyMB4XDTA5
2586MDkwMTAwMDAwMFoXDTM3MTIzMTIzNTk1OVowgZgxCzAJBgNVBAYTAlVTMRAwDgYD
2587VQQIEwdBcml6b25hMRMwEQYDVQQHEwpTY290dHNkYWxlMSUwIwYDVQQKExxTdGFy
2588ZmllbGQgVGVjaG5vbG9naWVzLCBJbmMuMTswOQYDVQQDEzJTdGFyZmllbGQgU2Vy
2589dmljZXMgUm9vdCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkgLSBHMjCCASIwDQYJKoZI
2590hvcNAQEBBQADggEPADCCAQoCggEBANUMOsQq+U7i9b4Zl1+OiFOxHz/Lz58gE20p
2591OsgPfTz3a3Y4Y9k2YKibXlwAgLIvWX/2h/klQ4bnaRtSmpDhcePYLQ1Ob/bISdm2
25928xpWriu2dBTrz/sm4xq6HZYuajtYlIlHVv8loJNwU4PahHQUw2eeBGg6345AWh1K
2593Ts9DkTvnVtYAcMtS7nt9rjrnvDH5RfbCYM8TWQIrgMw0R9+53pBlbQLPLJGmpufe
2594hRhJfGZOozptqbXuNC66DQO4M99H67FrjSXZm86B0UVGMpZwh94CDklDhbZsc7tk
25956mFBrMnUVN+HL8cisibMn1lUaJ/8viovxFUcdUBgF4UCVTmLfwUCAwEAAaNCMEAw
2596DwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFJxfAN+q
2597AdcwKziIorhtSpzyEZGDMA0GCSqGSIb3DQEBCwUAA4IBAQBLNqaEd2ndOxmfZyMI
2598bw5hyf2E3F/YNoHN2BtBLZ9g3ccaaNnRbobhiCPPE95Dz+I0swSdHynVv/heyNXB
2599ve6SbzJ08pGCL72CQnqtKrcgfU28elUSwhXqvfdqlS5sdJ/PHLTyxQGjhdByPq1z
2600qwubdQxtRbeOlKyWN7Wg0I8VRw7j6IPdj/3vQQF3zCepYoUz8jcI73HPdwbeyBkd
2601iEDPfUYd/x7H4c7/I9vG+o1VTqkC50cRRj70/b17KSa7qWFiNyi2LSr2EIZkyXCn
26020q23KXB56jzaYyWf/Wi3MOxw+3WKt21gZ7IeyLnp2KhvAotnDU0mV3HaIPzBSlCN
2603sSi6
2604-----END CERTIFICATE-----
2605Certificate:
2606 Data:
2607 Version: 3 (0x2)
2608 Serial Number: 59 (0x3b)
2609 Signature Algorithm: sha256WithRSAEncryption
2610 Issuer: C=IL, O=StartCom Ltd., CN=StartCom Certification Authority G2
2611 Validity
2612 Not Before: Jan 1 01:00:01 2010 GMT
2613 Not After : Dec 31 23:59:01 2039 GMT
2614 Subject: C=IL, O=StartCom Ltd., CN=StartCom Certification Authority G2
2615 Subject Public Key Info:
2616 Public Key Algorithm: rsaEncryption
2617 Public-Key: (4096 bit)
2618 Modulus:
2619 00:b6:89:36:5b:07:b7:20:36:bd:82:bb:e1:16:20:
2620 03:95:7a:af:0e:a3:55:c9:25:99:4a:c5:d0:56:41:
2621 87:90:4d:21:60:a4:14:87:3b:cd:fd:b2:3e:b4:67:
2622 03:6a:ed:e1:0f:4b:c0:91:85:70:45:e0:42:9e:de:
2623 29:23:d4:01:0d:a0:10:79:b8:db:03:bd:f3:a9:2f:
2624 d1:c6:e0:0f:cb:9e:8a:14:0a:b8:bd:f6:56:62:f1:
2625 c5:72:b6:32:25:d9:b2:f3:bd:65:c5:0d:2c:6e:d5:
2626 92:6f:18:8b:00:41:14:82:6f:40:20:26:7a:28:0f:
2627 f5:1e:7f:27:f7:94:b1:37:3d:b7:c7:91:f7:e2:01:
2628 ec:fd:94:89:e1:cc:6e:d3:36:d6:0a:19:79:ae:d7:
2629 34:82:65:ff:7c:42:bb:b6:dd:0b:a6:34:af:4b:60:
2630 fe:7f:43:49:06:8b:8c:43:b8:56:f2:d9:7f:21:43:
2631 17:ea:a7:48:95:01:75:75:ea:2b:a5:43:95:ea:15:
2632 84:9d:08:8d:26:6e:55:9b:ab:dc:d2:39:d2:31:1d:
2633 60:e2:ac:cc:56:45:24:f5:1c:54:ab:ee:86:dd:96:
2634 32:85:f8:4c:4f:e8:95:76:b6:05:dd:36:23:67:bc:
2635 ff:15:e2:ca:3b:e6:a6:ec:3b:ec:26:11:34:48:8d:
2636 f6:80:2b:1a:23:02:eb:8a:1c:3a:76:2a:7b:56:16:
2637 1c:72:2a:b3:aa:e3:60:a5:00:9f:04:9b:e2:6f:1e:
2638 14:58:5b:a5:6c:8b:58:3c:c3:ba:4e:3a:5c:f7:e1:
2639 96:2b:3e:ef:07:bc:a4:e5:5d:cc:4d:9f:0d:e1:dc:
2640 aa:bb:e1:6e:1a:ec:8f:e1:b6:4c:4d:79:72:5d:17:
2641 35:0b:1d:d7:c1:47:da:96:24:e0:d0:72:a8:5a:5f:
2642 66:2d:10:dc:2f:2a:13:ae:26:fe:0a:1c:19:cc:d0:
2643 3e:0b:9c:c8:09:2e:f9:5b:96:7a:47:9c:e9:7a:f3:
2644 05:50:74:95:73:9e:30:09:f3:97:82:5e:e6:8f:39:
2645 08:1e:59:e5:35:14:42:13:ff:00:9c:f7:be:aa:50:
2646 cf:e2:51:48:d7:b8:6f:af:f8:4e:7e:33:98:92:14:
2647 62:3a:75:63:cf:7b:fa:de:82:3b:a9:bb:39:e2:c4:
2648 bd:2c:00:0e:c8:17:ac:13:ef:4d:25:8e:d8:b3:90:
2649 2f:a9:da:29:7d:1d:af:74:3a:b2:27:c0:c1:1e:3e:
2650 75:a3:16:a9:af:7a:22:5d:9f:13:1a:cf:a7:a0:eb:
2651 e3:86:0a:d3:fd:e6:96:95:d7:23:c8:37:dd:c4:7c:
2652 aa:36:ac:98:1a:12:b1:e0:4e:e8:b1:3b:f5:d6:6f:
2653 f1:30:d7
2654 Exponent: 65537 (0x10001)
2655 X509v3 extensions:
2656 X509v3 Basic Constraints: critical
2657 CA:TRUE
2658 X509v3 Key Usage: critical
2659 Certificate Sign, CRL Sign
2660 X509v3 Subject Key Identifier:
2661 4B:C5:B4:40:6B:AD:1C:B3:A5:1C:65:6E:46:36:89:87:05:0C:0E:B6
2662 Signature Algorithm: sha256WithRSAEncryption
2663 73:57:3f:2c:d5:95:32:7e:37:db:96:92:eb:19:5e:7e:53:e7:
2664 41:ec:11:b6:47:ef:b5:de:ed:74:5c:c5:f1:8e:49:e0:fc:6e:
2665 99:13:cd:9f:8a:da:cd:3a:0a:d8:3a:5a:09:3f:5f:34:d0:2f:
2666 03:d2:66:1d:1a:bd:9c:90:37:c8:0c:8e:07:5a:94:45:46:2a:
2667 e6:be:7a:da:a1:a9:a4:69:12:92:b0:7d:36:d4:44:87:d7:51:
2668 f1:29:63:d6:75:cd:16:e4:27:89:1d:f8:c2:32:48:fd:db:99:
2669 d0:8f:5f:54:74:cc:ac:67:34:11:62:d9:0c:0a:37:87:d1:a3:
2670 17:48:8e:d2:17:1d:f6:d7:fd:db:65:eb:fd:a8:d4:f5:d6:4f:
2671 a4:5b:75:e8:c5:d2:60:b2:db:09:7e:25:8b:7b:ba:52:92:9e:
2672 3e:e8:c5:77:a1:3c:e0:4a:73:6b:61:cf:86:dc:43:ff:ff:21:
2673 fe:23:5d:24:4a:f5:d3:6d:0f:62:04:05:57:82:da:6e:a4:33:
2674 25:79:4b:2e:54:19:8b:cc:2c:3d:30:e9:d1:06:ff:e8:32:46:
2675 be:b5:33:76:77:a8:01:5d:96:c1:c1:d5:be:ae:25:c0:c9:1e:
2676 0a:09:20:88:a1:0e:c9:f3:6f:4d:82:54:00:20:a7:d2:8f:e4:
2677 39:54:17:2e:8d:1e:b8:1b:bb:1b:bd:9a:4e:3b:10:34:dc:9c:
2678 88:53:ef:a2:31:5b:58:4f:91:62:c8:c2:9a:9a:cd:15:5d:38:
2679 a9:d6:be:f8:13:b5:9f:12:69:f2:50:62:ac:fb:17:37:f4:ee:
2680 b8:75:67:60:10:fb:83:50:f9:44:b5:75:9c:40:17:b2:fe:fd:
2681 79:5d:6e:58:58:5f:30:fc:00:ae:af:33:c1:0e:4e:6c:ba:a7:
2682 a6:a1:7f:32:db:38:e0:b1:72:17:0a:2b:91:ec:6a:63:26:ed:
2683 89:d4:78:cc:74:1e:05:f8:6b:fe:8c:6a:76:39:29:ae:65:23:
2684 12:95:08:22:1c:97:ce:5b:06:ee:0c:e2:bb:bc:1f:44:93:f6:
2685 d8:38:45:05:21:ed:e4:ad:ab:12:b6:03:a4:42:2e:2d:c4:09:
2686 3a:03:67:69:84:9a:e1:59:90:8a:28:85:d5:5d:74:b1:d1:0e:
2687 20:58:9b:13:a5:b0:63:a6:ed:7b:47:fd:45:55:30:a4:ee:9a:
2688 d4:e6:e2:87:ef:98:c9:32:82:11:29:22:bc:00:0a:31:5e:2d:
2689 0f:c0:8e:e9:6b:b2:8f:2e:06:d8:d1:91:c7:c6:12:f4:4c:fd:
2690 30:17:c3:c1:da:38:5b:e3:a9:ea:e6:a1:ba:79:ef:73:d8:b6:
2691 53:57:2d:f6:d0:e1:d7:48
2692SHA1 Fingerprint=31:F1:FD:68:22:63:20:EE:C6:3B:3F:9D:EA:4A:3E:53:7C:7C:39:17
2693-----BEGIN CERTIFICATE-----
2694MIIFYzCCA0ugAwIBAgIBOzANBgkqhkiG9w0BAQsFADBTMQswCQYDVQQGEwJJTDEW
2695MBQGA1UEChMNU3RhcnRDb20gTHRkLjEsMCoGA1UEAxMjU3RhcnRDb20gQ2VydGlm
2696aWNhdGlvbiBBdXRob3JpdHkgRzIwHhcNMTAwMTAxMDEwMDAxWhcNMzkxMjMxMjM1
2697OTAxWjBTMQswCQYDVQQGEwJJTDEWMBQGA1UEChMNU3RhcnRDb20gTHRkLjEsMCoG
2698A1UEAxMjU3RhcnRDb20gQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgRzIwggIiMA0G
2699CSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQC2iTZbB7cgNr2Cu+EWIAOVeq8Oo1XJ
2700JZlKxdBWQYeQTSFgpBSHO839sj60ZwNq7eEPS8CRhXBF4EKe3ikj1AENoBB5uNsD
2701vfOpL9HG4A/LnooUCri99lZi8cVytjIl2bLzvWXFDSxu1ZJvGIsAQRSCb0AgJnoo
2702D/Uefyf3lLE3PbfHkffiAez9lInhzG7TNtYKGXmu1zSCZf98Qru23QumNK9LYP5/
2703Q0kGi4xDuFby2X8hQxfqp0iVAXV16iulQ5XqFYSdCI0mblWbq9zSOdIxHWDirMxW
2704RST1HFSr7obdljKF+ExP6JV2tgXdNiNnvP8V4so75qbsO+wmETRIjfaAKxojAuuK
2705HDp2KntWFhxyKrOq42ClAJ8Em+JvHhRYW6Vsi1g8w7pOOlz34ZYrPu8HvKTlXcxN
2706nw3h3Kq74W4a7I/htkxNeXJdFzULHdfBR9qWJODQcqhaX2YtENwvKhOuJv4KHBnM
27070D4LnMgJLvlblnpHnOl68wVQdJVznjAJ85eCXuaPOQgeWeU1FEIT/wCc976qUM/i
2708UUjXuG+v+E5+M5iSFGI6dWPPe/regjupuznixL0sAA7IF6wT700ljtizkC+p2il9
2709Ha90OrInwMEePnWjFqmveiJdnxMaz6eg6+OGCtP95paV1yPIN93EfKo2rJgaErHg
2710TuixO/XWb/Ew1wIDAQABo0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQE
2711AwIBBjAdBgNVHQ4EFgQUS8W0QGutHLOlHGVuRjaJhwUMDrYwDQYJKoZIhvcNAQEL
2712BQADggIBAHNXPyzVlTJ+N9uWkusZXn5T50HsEbZH77Xe7XRcxfGOSeD8bpkTzZ+K
27132s06Ctg6Wgk/XzTQLwPSZh0avZyQN8gMjgdalEVGKua+etqhqaRpEpKwfTbURIfX
2714UfEpY9Z1zRbkJ4kd+MIySP3bmdCPX1R0zKxnNBFi2QwKN4fRoxdIjtIXHfbX/dtl
27156/2o1PXWT6RbdejF0mCy2wl+JYt7ulKSnj7oxXehPOBKc2thz4bcQ///If4jXSRK
27169dNtD2IEBVeC2m6kMyV5Sy5UGYvMLD0w6dEG/+gyRr61M3Z3qAFdlsHB1b6uJcDJ
2717HgoJIIihDsnzb02CVAAgp9KP5DlUFy6NHrgbuxu9mk47EDTcnIhT76IxW1hPkWLI
2718wpqazRVdOKnWvvgTtZ8SafJQYqz7Fzf07rh1Z2AQ+4NQ+US1dZxAF7L+/XldblhY
2719XzD8AK6vM8EOTmy6p6ahfzLbOOCxchcKK5HsamMm7YnUeMx0HgX4a/6ManY5Ka5l
2720IxKVCCIcl85bBu4M4ru8H0ST9tg4RQUh7eStqxK2A6RCLi3ECToDZ2mEmuFZkIoo
2721hdVddLHRDiBYmxOlsGOm7XtH/UVVMKTumtTm4ofvmMkyghEpIrwACjFeLQ/Ajulr
2722so8uBtjRkcfGEvRM/TAXw8HaOFvjqermobp573PYtlNXLfbQ4ddI
2723-----END CERTIFICATE-----
2724Certificate:
2725 Data:
2726 Version: 3 (0x2)
2727 Serial Number:
2728 34:4e:d5:57:20:d5:ed:ec:49:f4:2f:ce:37:db:2b:6d
2729 Signature Algorithm: sha1WithRSAEncryption
2730 Issuer: C=US, O=thawte, Inc., OU=Certification Services Division, OU=(c) 2006 thawte, Inc. - For authorized use only, CN=thawte Primary Root CA
2731 Validity
2732 Not Before: Nov 17 00:00:00 2006 GMT
2733 Not After : Jul 16 23:59:59 2036 GMT
2734 Subject: C=US, O=thawte, Inc., OU=Certification Services Division, OU=(c) 2006 thawte, Inc. - For authorized use only, CN=thawte Primary Root CA
2735 Subject Public Key Info:
2736 Public Key Algorithm: rsaEncryption
2737 Public-Key: (2048 bit)
2738 Modulus:
2739 00:ac:a0:f0:fb:80:59:d4:9c:c7:a4:cf:9d:a1:59:
2740 73:09:10:45:0c:0d:2c:6e:68:f1:6c:5b:48:68:49:
2741 59:37:fc:0b:33:19:c2:77:7f:cc:10:2d:95:34:1c:
2742 e6:eb:4d:09:a7:1c:d2:b8:c9:97:36:02:b7:89:d4:
2743 24:5f:06:c0:cc:44:94:94:8d:02:62:6f:eb:5a:dd:
2744 11:8d:28:9a:5c:84:90:10:7a:0d:bd:74:66:2f:6a:
2745 38:a0:e2:d5:54:44:eb:1d:07:9f:07:ba:6f:ee:e9:
2746 fd:4e:0b:29:f5:3e:84:a0:01:f1:9c:ab:f8:1c:7e:
2747 89:a4:e8:a1:d8:71:65:0d:a3:51:7b:ee:bc:d2:22:
2748 60:0d:b9:5b:9d:df:ba:fc:51:5b:0b:af:98:b2:e9:
2749 2e:e9:04:e8:62:87:de:2b:c8:d7:4e:c1:4c:64:1e:
2750 dd:cf:87:58:ba:4a:4f:ca:68:07:1d:1c:9d:4a:c6:
2751 d5:2f:91:cc:7c:71:72:1c:c5:c0:67:eb:32:fd:c9:
2752 92:5c:94:da:85:c0:9b:bf:53:7d:2b:09:f4:8c:9d:
2753 91:1f:97:6a:52:cb:de:09:36:a4:77:d8:7b:87:50:
2754 44:d5:3e:6e:29:69:fb:39:49:26:1e:09:a5:80:7b:
2755 40:2d:eb:e8:27:85:c9:fe:61:fd:7e:e6:7c:97:1d:
2756 d5:9d
2757 Exponent: 65537 (0x10001)
2758 X509v3 extensions:
2759 X509v3 Basic Constraints: critical
2760 CA:TRUE
2761 X509v3 Key Usage: critical
2762 Certificate Sign, CRL Sign
2763 X509v3 Subject Key Identifier:
2764 7B:5B:45:CF:AF:CE:CB:7A:FD:31:92:1A:6A:B6:F3:46:EB:57:48:50
2765 Signature Algorithm: sha1WithRSAEncryption
2766 79:11:c0:4b:b3:91:b6:fc:f0:e9:67:d4:0d:6e:45:be:55:e8:
2767 93:d2:ce:03:3f:ed:da:25:b0:1d:57:cb:1e:3a:76:a0:4c:ec:
2768 50:76:e8:64:72:0c:a4:a9:f1:b8:8b:d6:d6:87:84:bb:32:e5:
2769 41:11:c0:77:d9:b3:60:9d:eb:1b:d5:d1:6e:44:44:a9:a6:01:
2770 ec:55:62:1d:77:b8:5c:8e:48:49:7c:9c:3b:57:11:ac:ad:73:
2771 37:8e:2f:78:5c:90:68:47:d9:60:60:e6:fc:07:3d:22:20:17:
2772 c4:f7:16:e9:c4:d8:72:f9:c8:73:7c:df:16:2f:15:a9:3e:fd:
2773 6a:27:b6:a1:eb:5a:ba:98:1f:d5:e3:4d:64:0a:9d:13:c8:61:
2774 ba:f5:39:1c:87:ba:b8:bd:7b:22:7f:f6:fe:ac:40:79:e5:ac:
2775 10:6f:3d:8f:1b:79:76:8b:c4:37:b3:21:18:84:e5:36:00:eb:
2776 63:20:99:b9:e9:fe:33:04:bb:41:c8:c1:02:f9:44:63:20:9e:
2777 81:ce:42:d3:d6:3f:2c:76:d3:63:9c:59:dd:8f:a6:e1:0e:a0:
2778 2e:41:f7:2e:95:47:cf:bc:fd:33:f3:f6:0b:61:7e:7e:91:2b:
2779 81:47:c2:27:30:ee:a7:10:5d:37:8f:5c:39:2b:e4:04:f0:7b:
2780 8d:56:8c:68
2781SHA1 Fingerprint=91:C6:D6:EE:3E:8A:C8:63:84:E5:48:C2:99:29:5C:75:6C:81:7B:81
2782-----BEGIN CERTIFICATE-----
2783MIIEIDCCAwigAwIBAgIQNE7VVyDV7exJ9C/ON9srbTANBgkqhkiG9w0BAQUFADCB
2784qTELMAkGA1UEBhMCVVMxFTATBgNVBAoTDHRoYXd0ZSwgSW5jLjEoMCYGA1UECxMf
2785Q2VydGlmaWNhdGlvbiBTZXJ2aWNlcyBEaXZpc2lvbjE4MDYGA1UECxMvKGMpIDIw
2786MDYgdGhhd3RlLCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxHzAdBgNV
2787BAMTFnRoYXd0ZSBQcmltYXJ5IFJvb3QgQ0EwHhcNMDYxMTE3MDAwMDAwWhcNMzYw
2788NzE2MjM1OTU5WjCBqTELMAkGA1UEBhMCVVMxFTATBgNVBAoTDHRoYXd0ZSwgSW5j
2789LjEoMCYGA1UECxMfQ2VydGlmaWNhdGlvbiBTZXJ2aWNlcyBEaXZpc2lvbjE4MDYG
2790A1UECxMvKGMpIDIwMDYgdGhhd3RlLCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNl
2791IG9ubHkxHzAdBgNVBAMTFnRoYXd0ZSBQcmltYXJ5IFJvb3QgQ0EwggEiMA0GCSqG
2792SIb3DQEBAQUAA4IBDwAwggEKAoIBAQCsoPD7gFnUnMekz52hWXMJEEUMDSxuaPFs
2793W0hoSVk3/AszGcJ3f8wQLZU0HObrTQmnHNK4yZc2AreJ1CRfBsDMRJSUjQJib+ta
27943RGNKJpchJAQeg29dGYvajig4tVUROsdB58Hum/u6f1OCyn1PoSgAfGcq/gcfomk
27956KHYcWUNo1F77rzSImANuVud37r8UVsLr5iy6S7pBOhih94ryNdOwUxkHt3Ph1i6
2796Sk/KaAcdHJ1KxtUvkcx8cXIcxcBn6zL9yZJclNqFwJu/U30rCfSMnZEfl2pSy94J
2797NqR32HuHUETVPm4pafs5SSYeCaWAe0At6+gnhcn+Yf1+5nyXHdWdAgMBAAGjQjBA
2798MA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBR7W0XP
2799r87Lev0xkhpqtvNG61dIUDANBgkqhkiG9w0BAQUFAAOCAQEAeRHAS7ORtvzw6WfU
2800DW5FvlXok9LOAz/t2iWwHVfLHjp2oEzsUHboZHIMpKnxuIvW1oeEuzLlQRHAd9mz
2801YJ3rG9XRbkREqaYB7FViHXe4XI5ISXycO1cRrK1zN44veFyQaEfZYGDm/Ac9IiAX
2802xPcW6cTYcvnIc3zfFi8VqT79aie2oetaupgf1eNNZAqdE8hhuvU5HIe6uL17In/2
2803/qxAeeWsEG89jxt5dovEN7MhGITlNgDrYyCZuen+MwS7QcjBAvlEYyCegc5C09Y/
2804LHbTY5xZ3Y+m4Q6gLkH3LpVHz7z9M/P2C2F+fpErgUfCJzDupxBdN49cOSvkBPB7
2805jVaMaA==
2806-----END CERTIFICATE-----
2807Certificate:
2808 Data:
2809 Version: 3 (0x2)
2810 Serial Number:
2811 35:fc:26:5c:d9:84:4f:c9:3d:26:3d:57:9b:ae:d7:56
2812 Signature Algorithm: ecdsa-with-SHA384
2813 Issuer: C=US, O=thawte, Inc., OU=(c) 2007 thawte, Inc. - For authorized use only, CN=thawte Primary Root CA - G2
2814 Validity
2815 Not Before: Nov 5 00:00:00 2007 GMT
2816 Not After : Jan 18 23:59:59 2038 GMT
2817 Subject: C=US, O=thawte, Inc., OU=(c) 2007 thawte, Inc. - For authorized use only, CN=thawte Primary Root CA - G2
2818 Subject Public Key Info:
2819 Public Key Algorithm: id-ecPublicKey
2820 Public-Key: (384 bit)
2821 pub:
2822 04:a2:d5:9c:82:7b:95:9d:f1:52:78:87:fe:8a:16:
2823 bf:05:e6:df:a3:02:4f:0d:07:c6:00:51:ba:0c:02:
2824 52:2d:22:a4:42:39:c4:fe:8f:ea:c9:c1:be:d4:4d:
2825 ff:9f:7a:9e:e2:b1:7c:9a:ad:a7:86:09:73:87:d1:
2826 e7:9a:e3:7a:a5:aa:6e:fb:ba:b3:70:c0:67:88:a2:
2827 35:d4:a3:9a:b1:fd:ad:c2:ef:31:fa:a8:b9:f3:fb:
2828 08:c6:91:d1:fb:29:95
2829 ASN1 OID: secp384r1
2830 X509v3 extensions:
2831 X509v3 Basic Constraints: critical
2832 CA:TRUE
2833 X509v3 Key Usage: critical
2834 Certificate Sign, CRL Sign
2835 X509v3 Subject Key Identifier:
2836 9A:D8:00:30:00:E7:6B:7F:85:18:EE:8B:B6:CE:8A:0C:F8:11:E1:BB
2837 Signature Algorithm: ecdsa-with-SHA384
2838 30:66:02:31:00:dd:f8:e0:57:47:5b:a7:e6:0a:c3:bd:f5:80:
2839 8a:97:35:0d:1b:89:3c:54:86:77:28:ca:a1:f4:79:de:b5:e6:
2840 38:b0:f0:65:70:8c:7f:02:54:c2:bf:ff:d8:a1:3e:d9:cf:02:
2841 31:00:c4:8d:94:fc:dc:53:d2:dc:9d:78:16:1f:15:33:23:53:
2842 52:e3:5a:31:5d:9d:ca:ae:bd:13:29:44:0d:27:5b:a8:e7:68:
2843 9c:12:f7:58:3f:2e:72:02:57:a3:8f:a1:14:2e
2844SHA1 Fingerprint=AA:DB:BC:22:23:8F:C4:01:A1:27:BB:38:DD:F4:1D:DB:08:9E:F0:12
2845-----BEGIN CERTIFICATE-----
2846MIICiDCCAg2gAwIBAgIQNfwmXNmET8k9Jj1Xm67XVjAKBggqhkjOPQQDAzCBhDEL
2847MAkGA1UEBhMCVVMxFTATBgNVBAoTDHRoYXd0ZSwgSW5jLjE4MDYGA1UECxMvKGMp
2848IDIwMDcgdGhhd3RlLCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxJDAi
2849BgNVBAMTG3RoYXd0ZSBQcmltYXJ5IFJvb3QgQ0EgLSBHMjAeFw0wNzExMDUwMDAw
2850MDBaFw0zODAxMTgyMzU5NTlaMIGEMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMdGhh
2851d3RlLCBJbmMuMTgwNgYDVQQLEy8oYykgMjAwNyB0aGF3dGUsIEluYy4gLSBGb3Ig
2852YXV0aG9yaXplZCB1c2Ugb25seTEkMCIGA1UEAxMbdGhhd3RlIFByaW1hcnkgUm9v
2853dCBDQSAtIEcyMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAEotWcgnuVnfFSeIf+iha/
2854BebfowJPDQfGAFG6DAJSLSKkQjnE/o/qycG+1E3/n3qe4rF8mq2nhglzh9HnmuN6
2855papu+7qzcMBniKI11KOasf2twu8x+qi58/sIxpHR+ymVo0IwQDAPBgNVHRMBAf8E
2856BTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUmtgAMADna3+FGO6Lts6K
2857DPgR4bswCgYIKoZIzj0EAwMDaQAwZgIxAN344FdHW6fmCsO99YCKlzUNG4k8VIZ3
2858KMqh9HneteY4sPBlcIx/AlTCv//YoT7ZzwIxAMSNlPzcU9LcnXgWHxUzI1NS41ox
2859XZ3Krr0TKUQNJ1uo52icEvdYPy5yAlejj6EULg==
2860-----END CERTIFICATE-----
2861Certificate:
2862 Data:
2863 Version: 3 (0x2)
2864 Serial Number:
2865 60:01:97:b7:46:a7:ea:b4:b4:9a:d6:4b:2f:f7:90:fb
2866 Signature Algorithm: sha256WithRSAEncryption
2867 Issuer: C=US, O=thawte, Inc., OU=Certification Services Division, OU=(c) 2008 thawte, Inc. - For authorized use only, CN=thawte Primary Root CA - G3
2868 Validity
2869 Not Before: Apr 2 00:00:00 2008 GMT
2870 Not After : Dec 1 23:59:59 2037 GMT
2871 Subject: C=US, O=thawte, Inc., OU=Certification Services Division, OU=(c) 2008 thawte, Inc. - For authorized use only, CN=thawte Primary Root CA - G3
2872 Subject Public Key Info:
2873 Public Key Algorithm: rsaEncryption
2874 Public-Key: (2048 bit)
2875 Modulus:
2876 00:b2:bf:27:2c:fb:db:d8:5b:dd:78:7b:1b:9e:77:
2877 66:81:cb:3e:bc:7c:ae:f3:a6:27:9a:34:a3:68:31:
2878 71:38:33:62:e4:f3:71:66:79:b1:a9:65:a3:a5:8b:
2879 d5:8f:60:2d:3f:42:cc:aa:6b:32:c0:23:cb:2c:41:
2880 dd:e4:df:fc:61:9c:e2:73:b2:22:95:11:43:18:5f:
2881 c4:b6:1f:57:6c:0a:05:58:22:c8:36:4c:3a:7c:a5:
2882 d1:cf:86:af:88:a7:44:02:13:74:71:73:0a:42:59:
2883 02:f8:1b:14:6b:42:df:6f:5f:ba:6b:82:a2:9d:5b:
2884 e7:4a:bd:1e:01:72:db:4b:74:e8:3b:7f:7f:7d:1f:
2885 04:b4:26:9b:e0:b4:5a:ac:47:3d:55:b8:d7:b0:26:
2886 52:28:01:31:40:66:d8:d9:24:bd:f6:2a:d8:ec:21:
2887 49:5c:9b:f6:7a:e9:7f:55:35:7e:96:6b:8d:93:93:
2888 27:cb:92:bb:ea:ac:40:c0:9f:c2:f8:80:cf:5d:f4:
2889 5a:dc:ce:74:86:a6:3e:6c:0b:53:ca:bd:92:ce:19:
2890 06:72:e6:0c:5c:38:69:c7:04:d6:bc:6c:ce:5b:f6:
2891 f7:68:9c:dc:25:15:48:88:a1:e9:a9:f8:98:9c:e0:
2892 f3:d5:31:28:61:11:6c:67:96:8d:39:99:cb:c2:45:
2893 24:39
2894 Exponent: 65537 (0x10001)
2895 X509v3 extensions:
2896 X509v3 Basic Constraints: critical
2897 CA:TRUE
2898 X509v3 Key Usage: critical
2899 Certificate Sign, CRL Sign
2900 X509v3 Subject Key Identifier:
2901 AD:6C:AA:94:60:9C:ED:E4:FF:FA:3E:0A:74:2B:63:03:F7:B6:59:BF
2902 Signature Algorithm: sha256WithRSAEncryption
2903 1a:40:d8:95:65:ac:09:92:89:c6:39:f4:10:e5:a9:0e:66:53:
2904 5d:78:de:fa:24:91:bb:e7:44:51:df:c6:16:34:0a:ef:6a:44:
2905 51:ea:2b:07:8a:03:7a:c3:eb:3f:0a:2c:52:16:a0:2b:43:b9:
2906 25:90:3f:70:a9:33:25:6d:45:1a:28:3b:27:cf:aa:c3:29:42:
2907 1b:df:3b:4c:c0:33:34:5b:41:88:bf:6b:2b:65:af:28:ef:b2:
2908 f5:c3:aa:66:ce:7b:56:ee:b7:c8:cb:67:c1:c9:9c:1a:18:b8:
2909 c4:c3:49:03:f1:60:0e:50:cd:46:c5:f3:77:79:f7:b6:15:e0:
2910 38:db:c7:2f:28:a0:0c:3f:77:26:74:d9:25:12:da:31:da:1a:
2911 1e:dc:29:41:91:22:3c:69:a7:bb:02:f2:b6:5c:27:03:89:f4:
2912 06:ea:9b:e4:72:82:e3:a1:09:c1:e9:00:19:d3:3e:d4:70:6b:
2913 ba:71:a6:aa:58:ae:f4:bb:e9:6c:b6:ef:87:cc:9b:bb:ff:39:
2914 e6:56:61:d3:0a:a7:c4:5c:4c:60:7b:05:77:26:7a:bf:d8:07:
2915 52:2c:62:f7:70:63:d9:39:bc:6f:1c:c2:79:dc:76:29:af:ce:
2916 c5:2c:64:04:5e:88:36:6e:31:d4:40:1a:62:34:36:3f:35:01:
2917 ae:ac:63:a0
2918SHA1 Fingerprint=F1:8B:53:8D:1B:E9:03:B6:A6:F0:56:43:5B:17:15:89:CA:F3:6B:F2
2919-----BEGIN CERTIFICATE-----
2920MIIEKjCCAxKgAwIBAgIQYAGXt0an6rS0mtZLL/eQ+zANBgkqhkiG9w0BAQsFADCB
2921rjELMAkGA1UEBhMCVVMxFTATBgNVBAoTDHRoYXd0ZSwgSW5jLjEoMCYGA1UECxMf
2922Q2VydGlmaWNhdGlvbiBTZXJ2aWNlcyBEaXZpc2lvbjE4MDYGA1UECxMvKGMpIDIw
2923MDggdGhhd3RlLCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxJDAiBgNV
2924BAMTG3RoYXd0ZSBQcmltYXJ5IFJvb3QgQ0EgLSBHMzAeFw0wODA0MDIwMDAwMDBa
2925Fw0zNzEyMDEyMzU5NTlaMIGuMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMdGhhd3Rl
2926LCBJbmMuMSgwJgYDVQQLEx9DZXJ0aWZpY2F0aW9uIFNlcnZpY2VzIERpdmlzaW9u
2927MTgwNgYDVQQLEy8oYykgMjAwOCB0aGF3dGUsIEluYy4gLSBGb3IgYXV0aG9yaXpl
2928ZCB1c2Ugb25seTEkMCIGA1UEAxMbdGhhd3RlIFByaW1hcnkgUm9vdCBDQSAtIEcz
2929MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsr8nLPvb2FvdeHsbnndm
2930gcs+vHyu86YnmjSjaDFxODNi5PNxZnmxqWWjpYvVj2AtP0LMqmsywCPLLEHd5N/8
2931YZzic7IilRFDGF/Eth9XbAoFWCLINkw6fKXRz4aviKdEAhN0cXMKQlkC+BsUa0Lf
2932b1+6a4KinVvnSr0eAXLbS3ToO39/fR8EtCab4LRarEc9VbjXsCZSKAExQGbY2SS9
29339irY7CFJXJv2eul/VTV+lmuNk5Mny5K76qxAwJ/C+IDPXfRa3M50hqY+bAtTyr2S
2934zhkGcuYMXDhpxwTWvGzOW/b3aJzcJRVIiKHpqfiYnODz1TEoYRFsZ5aNOZnLwkUk
2935OQIDAQABo0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNV
2936HQ4EFgQUrWyqlGCc7eT/+j4KdCtjA/e2Wb8wDQYJKoZIhvcNAQELBQADggEBABpA
29372JVlrAmSicY59BDlqQ5mU1143vokkbvnRFHfxhY0Cu9qRFHqKweKA3rD6z8KLFIW
2938oCtDuSWQP3CpMyVtRRooOyfPqsMpQhvfO0zAMzRbQYi/aytlryjvsvXDqmbOe1bu
2939t8jLZ8HJnBoYuMTDSQPxYA5QzUbF83d597YV4Djbxy8ooAw/dyZ02SUS2jHaGh7c
2940KUGRIjxpp7sC8rZcJwOJ9Abqm+RyguOhCcHpABnTPtRwa7pxpqpYrvS76Wy274fM
2941m7v/OeZWYdMKp8RcTGB7BXcmer/YB1IsYvdwY9k5vG8cwnncdimvzsUsZAReiDZu
2942MdRAGmI0Nj81Aa6sY6A=
2943-----END CERTIFICATE-----
2944Certificate:
2945 Data:
2946 Version: 3 (0x2)
2947 Serial Number: 1 (0x1)
2948 Signature Algorithm: sha1WithRSAEncryption
2949 Issuer: C=SE, O=AddTrust AB, OU=AddTrust External TTP Network, CN=AddTrust External CA Root
2950 Validity
2951 Not Before: May 30 10:48:38 2000 GMT
2952 Not After : May 30 10:48:38 2020 GMT
2953 Subject: C=SE, O=AddTrust AB, OU=AddTrust External TTP Network, CN=AddTrust External CA Root
2954 Subject Public Key Info:
2955 Public Key Algorithm: rsaEncryption
2956 Public-Key: (2048 bit)
2957 Modulus:
2958 00:b7:f7:1a:33:e6:f2:00:04:2d:39:e0:4e:5b:ed:
2959 1f:bc:6c:0f:cd:b5:fa:23:b6:ce:de:9b:11:33:97:
2960 a4:29:4c:7d:93:9f:bd:4a:bc:93:ed:03:1a:e3:8f:
2961 cf:e5:6d:50:5a:d6:97:29:94:5a:80:b0:49:7a:db:
2962 2e:95:fd:b8:ca:bf:37:38:2d:1e:3e:91:41:ad:70:
2963 56:c7:f0:4f:3f:e8:32:9e:74:ca:c8:90:54:e9:c6:
2964 5f:0f:78:9d:9a:40:3c:0e:ac:61:aa:5e:14:8f:9e:
2965 87:a1:6a:50:dc:d7:9a:4e:af:05:b3:a6:71:94:9c:
2966 71:b3:50:60:0a:c7:13:9d:38:07:86:02:a8:e9:a8:
2967 69:26:18:90:ab:4c:b0:4f:23:ab:3a:4f:84:d8:df:
2968 ce:9f:e1:69:6f:bb:d7:42:d7:6b:44:e4:c7:ad:ee:
2969 6d:41:5f:72:5a:71:08:37:b3:79:65:a4:59:a0:94:
2970 37:f7:00:2f:0d:c2:92:72:da:d0:38:72:db:14:a8:
2971 45:c4:5d:2a:7d:b7:b4:d6:c4:ee:ac:cd:13:44:b7:
2972 c9:2b:dd:43:00:25:fa:61:b9:69:6a:58:23:11:b7:
2973 a7:33:8f:56:75:59:f5:cd:29:d7:46:b7:0a:2b:65:
2974 b6:d3:42:6f:15:b2:b8:7b:fb:ef:e9:5d:53:d5:34:
2975 5a:27
2976 Exponent: 65537 (0x10001)
2977 X509v3 extensions:
2978 X509v3 Subject Key Identifier:
2979 AD:BD:98:7A:34:B4:26:F7:FA:C4:26:54:EF:03:BD:E0:24:CB:54:1A
2980 X509v3 Key Usage:
2981 Certificate Sign, CRL Sign
2982 X509v3 Basic Constraints: critical
2983 CA:TRUE
2984 X509v3 Authority Key Identifier:
2985 keyid:AD:BD:98:7A:34:B4:26:F7:FA:C4:26:54:EF:03:BD:E0:24:CB:54:1A
2986 DirName:/C=SE/O=AddTrust AB/OU=AddTrust External TTP Network/CN=AddTrust External CA Root
2987 serial:01
2988
2989 Signature Algorithm: sha1WithRSAEncryption
2990 b0:9b:e0:85:25:c2:d6:23:e2:0f:96:06:92:9d:41:98:9c:d9:
2991 84:79:81:d9:1e:5b:14:07:23:36:65:8f:b0:d8:77:bb:ac:41:
2992 6c:47:60:83:51:b0:f9:32:3d:e7:fc:f6:26:13:c7:80:16:a5:
2993 bf:5a:fc:87:cf:78:79:89:21:9a:e2:4c:07:0a:86:35:bc:f2:
2994 de:51:c4:d2:96:b7:dc:7e:4e:ee:70:fd:1c:39:eb:0c:02:51:
2995 14:2d:8e:bd:16:e0:c1:df:46:75:e7:24:ad:ec:f4:42:b4:85:
2996 93:70:10:67:ba:9d:06:35:4a:18:d3:2b:7a:cc:51:42:a1:7a:
2997 63:d1:e6:bb:a1:c5:2b:c2:36:be:13:0d:e6:bd:63:7e:79:7b:
2998 a7:09:0d:40:ab:6a:dd:8f:8a:c3:f6:f6:8c:1a:42:05:51:d4:
2999 45:f5:9f:a7:62:21:68:15:20:43:3c:99:e7:7c:bd:24:d8:a9:
3000 91:17:73:88:3f:56:1b:31:38:18:b4:71:0f:9a:cd:c8:0e:9e:
3001 8e:2e:1b:e1:8c:98:83:cb:1f:31:f1:44:4c:c6:04:73:49:76:
3002 60:0f:c7:f8:bd:17:80:6b:2e:e9:cc:4c:0e:5a:9a:79:0f:20:
3003 0a:2e:d5:9e:63:26:1e:55:92:94:d8:82:17:5a:7b:d0:bc:c7:
3004 8f:4e:86:04
3005SHA1 Fingerprint=02:FA:F3:E2:91:43:54:68:60:78:57:69:4D:F5:E4:5B:68:85:18:68
3006-----BEGIN CERTIFICATE-----
3007MIIENjCCAx6gAwIBAgIBATANBgkqhkiG9w0BAQUFADBvMQswCQYDVQQGEwJTRTEU
3008MBIGA1UEChMLQWRkVHJ1c3QgQUIxJjAkBgNVBAsTHUFkZFRydXN0IEV4dGVybmFs
3009IFRUUCBOZXR3b3JrMSIwIAYDVQQDExlBZGRUcnVzdCBFeHRlcm5hbCBDQSBSb290
3010MB4XDTAwMDUzMDEwNDgzOFoXDTIwMDUzMDEwNDgzOFowbzELMAkGA1UEBhMCU0Ux
3011FDASBgNVBAoTC0FkZFRydXN0IEFCMSYwJAYDVQQLEx1BZGRUcnVzdCBFeHRlcm5h
3012bCBUVFAgTmV0d29yazEiMCAGA1UEAxMZQWRkVHJ1c3QgRXh0ZXJuYWwgQ0EgUm9v
3013dDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALf3GjPm8gAELTngTlvt
3014H7xsD821+iO2zt6bETOXpClMfZOfvUq8k+0DGuOPz+VtUFrWlymUWoCwSXrbLpX9
3015uMq/NzgtHj6RQa1wVsfwTz/oMp50ysiQVOnGXw94nZpAPA6sYapeFI+eh6FqUNzX
3016mk6vBbOmcZSccbNQYArHE504B4YCqOmoaSYYkKtMsE8jqzpPhNjfzp/haW+710LX
3017a0Tkx63ubUFfclpxCDezeWWkWaCUN/cALw3CknLa0Dhy2xSoRcRdKn23tNbE7qzN
3018E0S3ySvdQwAl+mG5aWpYIxG3pzOPVnVZ9c0p10a3CitlttNCbxWyuHv77+ldU9U0
3019WicCAwEAAaOB3DCB2TAdBgNVHQ4EFgQUrb2YejS0Jvf6xCZU7wO94CTLVBowCwYD
3020VR0PBAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wgZkGA1UdIwSBkTCBjoAUrb2YejS0
3021Jvf6xCZU7wO94CTLVBqhc6RxMG8xCzAJBgNVBAYTAlNFMRQwEgYDVQQKEwtBZGRU
3022cnVzdCBBQjEmMCQGA1UECxMdQWRkVHJ1c3QgRXh0ZXJuYWwgVFRQIE5ldHdvcmsx
3023IjAgBgNVBAMTGUFkZFRydXN0IEV4dGVybmFsIENBIFJvb3SCAQEwDQYJKoZIhvcN
3024AQEFBQADggEBALCb4IUlwtYj4g+WBpKdQZic2YR5gdkeWxQHIzZlj7DYd7usQWxH
3025YINRsPkyPef89iYTx4AWpb9a/IfPeHmJIZriTAcKhjW88t5RxNKWt9x+Tu5w/Rw5
30266wwCURQtjr0W4MHfRnXnJK3s9EK0hZNwEGe6nQY1ShjTK3rMUUKhemPR5ruhxSvC
3027Nr4TDea9Y355e6cJDUCrat2PisP29owaQgVR1EX1n6diIWgVIEM8med8vSTYqZEX
3028c4g/VhsxOBi0cQ+azcgOno4uG+GMmIPLHzHxREzGBHNJdmAPx/i9F4BrLunMTA5a
3029mnkPIAou1Z5jJh5VkpTYghdae9C8x49OhgQ=
3030-----END CERTIFICATE-----
3031Certificate:
3032 Data:
3033 Version: 3 (0x2)
3034 Serial Number: 1 (0x1)
3035 Signature Algorithm: sha1WithRSAEncryption
3036 Issuer: C=GB, ST=Greater Manchester, L=Salford, O=Comodo CA Limited, CN=AAA Certificate Services
3037 Validity
3038 Not Before: Jan 1 00:00:00 2004 GMT
3039 Not After : Dec 31 23:59:59 2028 GMT
3040 Subject: C=GB, ST=Greater Manchester, L=Salford, O=Comodo CA Limited, CN=AAA Certificate Services
3041 Subject Public Key Info:
3042 Public Key Algorithm: rsaEncryption
3043 Public-Key: (2048 bit)
3044 Modulus:
3045 00:be:40:9d:f4:6e:e1:ea:76:87:1c:4d:45:44:8e:
3046 be:46:c8:83:06:9d:c1:2a:fe:18:1f:8e:e4:02:fa:
3047 f3:ab:5d:50:8a:16:31:0b:9a:06:d0:c5:70:22:cd:
3048 49:2d:54:63:cc:b6:6e:68:46:0b:53:ea:cb:4c:24:
3049 c0:bc:72:4e:ea:f1:15:ae:f4:54:9a:12:0a:c3:7a:
3050 b2:33:60:e2:da:89:55:f3:22:58:f3:de:dc:cf:ef:
3051 83:86:a2:8c:94:4f:9f:68:f2:98:90:46:84:27:c7:
3052 76:bf:e3:cc:35:2c:8b:5e:07:64:65:82:c0:48:b0:
3053 a8:91:f9:61:9f:76:20:50:a8:91:c7:66:b5:eb:78:
3054 62:03:56:f0:8a:1a:13:ea:31:a3:1e:a0:99:fd:38:
3055 f6:f6:27:32:58:6f:07:f5:6b:b8:fb:14:2b:af:b7:
3056 aa:cc:d6:63:5f:73:8c:da:05:99:a8:38:a8:cb:17:
3057 78:36:51:ac:e9:9e:f4:78:3a:8d:cf:0f:d9:42:e2:
3058 98:0c:ab:2f:9f:0e:01:de:ef:9f:99:49:f1:2d:df:
3059 ac:74:4d:1b:98:b5:47:c5:e5:29:d1:f9:90:18:c7:
3060 62:9c:be:83:c7:26:7b:3e:8a:25:c7:c0:dd:9d:e6:
3061 35:68:10:20:9d:8f:d8:de:d2:c3:84:9c:0d:5e:e8:
3062 2f:c9
3063 Exponent: 65537 (0x10001)
3064 X509v3 extensions:
3065 X509v3 Subject Key Identifier:
3066 A0:11:0A:23:3E:96:F1:07:EC:E2:AF:29:EF:82:A5:7F:D0:30:A4:B4
3067 X509v3 Key Usage: critical
3068 Certificate Sign, CRL Sign
3069 X509v3 Basic Constraints: critical
3070 CA:TRUE
3071 X509v3 CRL Distribution Points:
3072
3073 Full Name:
3074 URI:http://crl.comodoca.com/AAACertificateServices.crl
3075
3076 Full Name:
3077 URI:http://crl.comodo.net/AAACertificateServices.crl
3078
3079 Signature Algorithm: sha1WithRSAEncryption
3080 08:56:fc:02:f0:9b:e8:ff:a4:fa:d6:7b:c6:44:80:ce:4f:c4:
3081 c5:f6:00:58:cc:a6:b6:bc:14:49:68:04:76:e8:e6:ee:5d:ec:
3082 02:0f:60:d6:8d:50:18:4f:26:4e:01:e3:e6:b0:a5:ee:bf:bc:
3083 74:54:41:bf:fd:fc:12:b8:c7:4f:5a:f4:89:60:05:7f:60:b7:
3084 05:4a:f3:f6:f1:c2:bf:c4:b9:74:86:b6:2d:7d:6b:cc:d2:f3:
3085 46:dd:2f:c6:e0:6a:c3:c3:34:03:2c:7d:96:dd:5a:c2:0e:a7:
3086 0a:99:c1:05:8b:ab:0c:2f:f3:5c:3a:cf:6c:37:55:09:87:de:
3087 53:40:6c:58:ef:fc:b6:ab:65:6e:04:f6:1b:dc:3c:e0:5a:15:
3088 c6:9e:d9:f1:59:48:30:21:65:03:6c:ec:e9:21:73:ec:9b:03:
3089 a1:e0:37:ad:a0:15:18:8f:fa:ba:02:ce:a7:2c:a9:10:13:2c:
3090 d4:e5:08:26:ab:22:97:60:f8:90:5e:74:d4:a2:9a:53:bd:f2:
3091 a9:68:e0:a2:6e:c2:d7:6c:b1:a3:0f:9e:bf:eb:68:e7:56:f2:
3092 ae:f2:e3:2b:38:3a:09:81:b5:6b:85:d7:be:2d:ed:3f:1a:b7:
3093 b2:63:e2:f5:62:2c:82:d4:6a:00:41:50:f1:39:83:9f:95:e9:
3094 36:96:98:6e
3095SHA1 Fingerprint=D1:EB:23:A4:6D:17:D6:8F:D9:25:64:C2:F1:F1:60:17:64:D8:E3:49
3096-----BEGIN CERTIFICATE-----
3097MIIEMjCCAxqgAwIBAgIBATANBgkqhkiG9w0BAQUFADB7MQswCQYDVQQGEwJHQjEb
3098MBkGA1UECAwSR3JlYXRlciBNYW5jaGVzdGVyMRAwDgYDVQQHDAdTYWxmb3JkMRow
3099GAYDVQQKDBFDb21vZG8gQ0EgTGltaXRlZDEhMB8GA1UEAwwYQUFBIENlcnRpZmlj
3100YXRlIFNlcnZpY2VzMB4XDTA0MDEwMTAwMDAwMFoXDTI4MTIzMTIzNTk1OVowezEL
3101MAkGA1UEBhMCR0IxGzAZBgNVBAgMEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UE
3102BwwHU2FsZm9yZDEaMBgGA1UECgwRQ29tb2RvIENBIExpbWl0ZWQxITAfBgNVBAMM
3103GEFBQSBDZXJ0aWZpY2F0ZSBTZXJ2aWNlczCCASIwDQYJKoZIhvcNAQEBBQADggEP
3104ADCCAQoCggEBAL5AnfRu4ep2hxxNRUSOvkbIgwadwSr+GB+O5AL686tdUIoWMQua
3105BtDFcCLNSS1UY8y2bmhGC1Pqy0wkwLxyTurxFa70VJoSCsN6sjNg4tqJVfMiWPPe
31063M/vg4aijJRPn2jymJBGhCfHdr/jzDUsi14HZGWCwEiwqJH5YZ92IFCokcdmtet4
3107YgNW8IoaE+oxox6gmf049vYnMlhvB/VruPsUK6+3qszWY19zjNoFmag4qMsXeDZR
3108rOme9Hg6jc8P2ULimAyrL58OAd7vn5lJ8S3frHRNG5i1R8XlKdH5kBjHYpy+g8cm
3109ez6KJcfA3Z3mNWgQIJ2P2N7Sw4ScDV7oL8kCAwEAAaOBwDCBvTAdBgNVHQ4EFgQU
3110oBEKIz6W8Qfs4q8p74Klf9AwpLQwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQF
3111MAMBAf8wewYDVR0fBHQwcjA4oDagNIYyaHR0cDovL2NybC5jb21vZG9jYS5jb20v
3112QUFBQ2VydGlmaWNhdGVTZXJ2aWNlcy5jcmwwNqA0oDKGMGh0dHA6Ly9jcmwuY29t
3113b2RvLm5ldC9BQUFDZXJ0aWZpY2F0ZVNlcnZpY2VzLmNybDANBgkqhkiG9w0BAQUF
3114AAOCAQEACFb8AvCb6P+k+tZ7xkSAzk/ExfYAWMymtrwUSWgEdujm7l3sAg9g1o1Q
3115GE8mTgHj5rCl7r+8dFRBv/38ErjHT1r0iWAFf2C3BUrz9vHCv8S5dIa2LX1rzNLz
3116Rt0vxuBqw8M0Ayx9lt1awg6nCpnBBYurDC/zXDrPbDdVCYfeU0BsWO/8tqtlbgT2
3117G9w84FoVxp7Z8VlIMCFlA2zs6SFz7JsDoeA3raAVGI/6ugLOpyypEBMs1OUIJqsi
3118l2D4kF501KKaU73yqWjgom7C12yxow+ev+to51byrvLjKzg6CYG1a4XXvi3tPxq3
3119smPi9WIsgtRqAEFQ8TmDn5XpNpaYbg==
3120-----END CERTIFICATE-----
3121Certificate:
3122 Data:
3123 Version: 3 (0x2)
3124 Serial Number:
3125 44:be:0c:8b:50:00:24:b4:11:d3:36:2a:fe:65:0a:fd
3126 Signature Algorithm: sha1WithRSAEncryption
3127 Issuer: C=US, ST=UT, L=Salt Lake City, O=The USERTRUST Network, OU=http://www.usertrust.com, CN=UTN-USERFirst-Hardware
3128 Validity
3129 Not Before: Jul 9 18:10:42 1999 GMT
3130 Not After : Jul 9 18:19:22 2019 GMT
3131 Subject: C=US, ST=UT, L=Salt Lake City, O=The USERTRUST Network, OU=http://www.usertrust.com, CN=UTN-USERFirst-Hardware
3132 Subject Public Key Info:
3133 Public Key Algorithm: rsaEncryption
3134 Public-Key: (2048 bit)
3135 Modulus:
3136 00:b1:f7:c3:38:3f:b4:a8:7f:cf:39:82:51:67:d0:
3137 6d:9f:d2:ff:58:f3:e7:9f:2b:ec:0d:89:54:99:b9:
3138 38:99:16:f7:e0:21:79:48:c2:bb:61:74:12:96:1d:
3139 3c:6a:72:d5:3c:10:67:3a:39:ed:2b:13:cd:66:eb:
3140 95:09:33:a4:6c:97:b1:e8:c6:ec:c1:75:79:9c:46:
3141 5e:8d:ab:d0:6a:fd:b9:2a:55:17:10:54:b3:19:f0:
3142 9a:f6:f1:b1:5d:b6:a7:6d:fb:e0:71:17:6b:a2:88:
3143 fb:00:df:fe:1a:31:77:0c:9a:01:7a:b1:32:e3:2b:
3144 01:07:38:6e:c3:a5:5e:23:bc:45:9b:7b:50:c1:c9:
3145 30:8f:db:e5:2b:7a:d3:5b:fb:33:40:1e:a0:d5:98:
3146 17:bc:8b:87:c3:89:d3:5d:a0:8e:b2:aa:aa:f6:8e:
3147 69:88:06:c5:fa:89:21:f3:08:9d:69:2e:09:33:9b:
3148 29:0d:46:0f:8c:cc:49:34:b0:69:51:bd:f9:06:cd:
3149 68:ad:66:4c:bc:3e:ac:61:bd:0a:88:0e:c8:df:3d:
3150 ee:7c:04:4c:9d:0a:5e:6b:91:d6:ee:c7:ed:28:8d:
3151 ab:4d:87:89:73:d0:6e:a4:d0:1e:16:8b:14:e1:76:
3152 44:03:7f:63:ac:e4:cd:49:9c:c5:92:f4:ab:32:a1:
3153 48:5b
3154 Exponent: 65537 (0x10001)
3155 X509v3 extensions:
3156 X509v3 Key Usage:
3157 Digital Signature, Non Repudiation, Certificate Sign, CRL Sign
3158 X509v3 Basic Constraints: critical
3159 CA:TRUE
3160 X509v3 Subject Key Identifier:
3161 A1:72:5F:26:1B:28:98:43:95:5D:07:37:D5:85:96:9D:4B:D2:C3:45
3162 X509v3 CRL Distribution Points:
3163
3164 Full Name:
3165 URI:http://crl.usertrust.com/UTN-USERFirst-Hardware.crl
3166
3167 X509v3 Extended Key Usage:
3168 TLS Web Server Authentication, IPSec End System, IPSec Tunnel, IPSec User
3169 Signature Algorithm: sha1WithRSAEncryption
3170 47:19:0f:de:74:c6:99:97:af:fc:ad:28:5e:75:8e:eb:2d:67:
3171 ee:4e:7b:2b:d7:0c:ff:f6:de:cb:55:a2:0a:e1:4c:54:65:93:
3172 60:6b:9f:12:9c:ad:5e:83:2c:eb:5a:ae:c0:e4:2d:f4:00:63:
3173 1d:b8:c0:6c:f2:cf:49:bb:4d:93:6f:06:a6:0a:22:b2:49:62:
3174 08:4e:ff:c8:c8:14:b2:88:16:5d:e7:01:e4:12:95:e5:45:34:
3175 b3:8b:69:bd:cf:b4:85:8f:75:51:9e:7d:3a:38:3a:14:48:12:
3176 c6:fb:a7:3b:1a:8d:0d:82:40:07:e8:04:08:90:a1:89:cb:19:
3177 50:df:ca:1c:01:bc:1d:04:19:7b:10:76:97:3b:ee:90:90:ca:
3178 c4:0e:1f:16:6e:75:ef:33:f8:d3:6f:5b:1e:96:e3:e0:74:77:
3179 74:7b:8a:a2:6e:2d:dd:76:d6:39:30:82:f0:ab:9c:52:f2:2a:
3180 c7:af:49:5e:7e:c7:68:e5:82:81:c8:6a:27:f9:27:88:2a:d5:
3181 58:50:95:1f:f0:3b:1c:57:bb:7d:14:39:62:2b:9a:c9:94:92:
3182 2a:a3:22:0c:ff:89:26:7d:5f:23:2b:47:d7:15:1d:a9:6a:9e:
3183 51:0d:2a:51:9e:81:f9:d4:3b:5e:70:12:7f:10:32:9c:1e:bb:
3184 9d:f8:66:a8
3185SHA1 Fingerprint=04:83:ED:33:99:AC:36:08:05:87:22:ED:BC:5E:46:00:E3:BE:F9:D7
3186-----BEGIN CERTIFICATE-----
3187MIIEdDCCA1ygAwIBAgIQRL4Mi1AAJLQR0zYq/mUK/TANBgkqhkiG9w0BAQUFADCB
3188lzELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAlVUMRcwFQYDVQQHEw5TYWx0IExha2Ug
3189Q2l0eTEeMBwGA1UEChMVVGhlIFVTRVJUUlVTVCBOZXR3b3JrMSEwHwYDVQQLExho
3190dHRwOi8vd3d3LnVzZXJ0cnVzdC5jb20xHzAdBgNVBAMTFlVUTi1VU0VSRmlyc3Qt
3191SGFyZHdhcmUwHhcNOTkwNzA5MTgxMDQyWhcNMTkwNzA5MTgxOTIyWjCBlzELMAkG
3192A1UEBhMCVVMxCzAJBgNVBAgTAlVUMRcwFQYDVQQHEw5TYWx0IExha2UgQ2l0eTEe
3193MBwGA1UEChMVVGhlIFVTRVJUUlVTVCBOZXR3b3JrMSEwHwYDVQQLExhodHRwOi8v
3194d3d3LnVzZXJ0cnVzdC5jb20xHzAdBgNVBAMTFlVUTi1VU0VSRmlyc3QtSGFyZHdh
3195cmUwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCx98M4P7Sof885glFn
31960G2f0v9Y8+efK+wNiVSZuTiZFvfgIXlIwrthdBKWHTxqctU8EGc6Oe0rE81m65UJ
3197M6Rsl7HoxuzBdXmcRl6Nq9Bq/bkqVRcQVLMZ8Jr28bFdtqdt++BxF2uiiPsA3/4a
3198MXcMmgF6sTLjKwEHOG7DpV4jvEWbe1DByTCP2+UretNb+zNAHqDVmBe8i4fDidNd
3199oI6yqqr2jmmIBsX6iSHzCJ1pLgkzmykNRg+MzEk0sGlRvfkGzWitZky8PqxhvQqI
3200DsjfPe58BEydCl5rkdbux+0ojatNh4lz0G6k0B4WixThdkQDf2Os5M1JnMWS9Ksy
3201oUhbAgMBAAGjgbkwgbYwCwYDVR0PBAQDAgHGMA8GA1UdEwEB/wQFMAMBAf8wHQYD
3202VR0OBBYEFKFyXyYbKJhDlV0HN9WFlp1L0sNFMEQGA1UdHwQ9MDswOaA3oDWGM2h0
3203dHA6Ly9jcmwudXNlcnRydXN0LmNvbS9VVE4tVVNFUkZpcnN0LUhhcmR3YXJlLmNy
3204bDAxBgNVHSUEKjAoBggrBgEFBQcDAQYIKwYBBQUHAwUGCCsGAQUFBwMGBggrBgEF
3205BQcDBzANBgkqhkiG9w0BAQUFAAOCAQEARxkP3nTGmZev/K0oXnWO6y1n7k57K9cM
3206//bey1WiCuFMVGWTYGufEpytXoMs61quwOQt9ABjHbjAbPLPSbtNk28Gpgoiskli
3207CE7/yMgUsogWXecB5BKV5UU0s4tpvc+0hY91UZ59Ojg6FEgSxvunOxqNDYJAB+gE
3208CJChicsZUN/KHAG8HQQZexB2lzvukJDKxA4fFm517zP4029bHpbj4HR3dHuKom4t
32093XbWOTCC8KucUvIqx69JXn7HaOWCgchqJ/kniCrVWFCVH/A7HFe7fRQ5YiuayZSS
3210KqMiDP+JJn1fIytH1xUdqWqeUQ0qUZ6B+dQ7XnASfxAynB67nfhmqA==
3211-----END CERTIFICATE-----
3212Certificate:
3213 Data:
3214 Version: 3 (0x2)
3215 Serial Number: 33554617 (0x20000b9)
3216 Signature Algorithm: sha1WithRSAEncryption
3217 Issuer: C=IE, O=Baltimore, OU=CyberTrust, CN=Baltimore CyberTrust Root
3218 Validity
3219 Not Before: May 12 18:46:00 2000 GMT
3220 Not After : May 12 23:59:00 2025 GMT
3221 Subject: C=IE, O=Baltimore, OU=CyberTrust, CN=Baltimore CyberTrust Root
3222 Subject Public Key Info:
3223 Public Key Algorithm: rsaEncryption
3224 Public-Key: (2048 bit)
3225 Modulus:
3226 00:a3:04:bb:22:ab:98:3d:57:e8:26:72:9a:b5:79:
3227 d4:29:e2:e1:e8:95:80:b1:b0:e3:5b:8e:2b:29:9a:
3228 64:df:a1:5d:ed:b0:09:05:6d:db:28:2e:ce:62:a2:
3229 62:fe:b4:88:da:12:eb:38:eb:21:9d:c0:41:2b:01:
3230 52:7b:88:77:d3:1c:8f:c7:ba:b9:88:b5:6a:09:e7:
3231 73:e8:11:40:a7:d1:cc:ca:62:8d:2d:e5:8f:0b:a6:
3232 50:d2:a8:50:c3:28:ea:f5:ab:25:87:8a:9a:96:1c:
3233 a9:67:b8:3f:0c:d5:f7:f9:52:13:2f:c2:1b:d5:70:
3234 70:f0:8f:c0:12:ca:06:cb:9a:e1:d9:ca:33:7a:77:
3235 d6:f8:ec:b9:f1:68:44:42:48:13:d2:c0:c2:a4:ae:
3236 5e:60:fe:b6:a6:05:fc:b4:dd:07:59:02:d4:59:18:
3237 98:63:f5:a5:63:e0:90:0c:7d:5d:b2:06:7a:f3:85:
3238 ea:eb:d4:03:ae:5e:84:3e:5f:ff:15:ed:69:bc:f9:
3239 39:36:72:75:cf:77:52:4d:f3:c9:90:2c:b9:3d:e5:
3240 c9:23:53:3f:1f:24:98:21:5c:07:99:29:bd:c6:3a:
3241 ec:e7:6e:86:3a:6b:97:74:63:33:bd:68:18:31:f0:
3242 78:8d:76:bf:fc:9e:8e:5d:2a:86:a7:4d:90:dc:27:
3243 1a:39
3244 Exponent: 65537 (0x10001)
3245 X509v3 extensions:
3246 X509v3 Subject Key Identifier:
3247 E5:9D:59:30:82:47:58:CC:AC:FA:08:54:36:86:7B:3A:B5:04:4D:F0
3248 X509v3 Basic Constraints: critical
3249 CA:TRUE, pathlen:3
3250 X509v3 Key Usage: critical
3251 Certificate Sign, CRL Sign
3252 Signature Algorithm: sha1WithRSAEncryption
3253 85:0c:5d:8e:e4:6f:51:68:42:05:a0:dd:bb:4f:27:25:84:03:
3254 bd:f7:64:fd:2d:d7:30:e3:a4:10:17:eb:da:29:29:b6:79:3f:
3255 76:f6:19:13:23:b8:10:0a:f9:58:a4:d4:61:70:bd:04:61:6a:
3256 12:8a:17:d5:0a:bd:c5:bc:30:7c:d6:e9:0c:25:8d:86:40:4f:
3257 ec:cc:a3:7e:38:c6:37:11:4f:ed:dd:68:31:8e:4c:d2:b3:01:
3258 74:ee:be:75:5e:07:48:1a:7f:70:ff:16:5c:84:c0:79:85:b8:
3259 05:fd:7f:be:65:11:a3:0f:c0:02:b4:f8:52:37:39:04:d5:a9:
3260 31:7a:18:bf:a0:2a:f4:12:99:f7:a3:45:82:e3:3c:5e:f5:9d:
3261 9e:b5:c8:9e:7c:2e:c8:a4:9e:4e:08:14:4b:6d:fd:70:6d:6b:
3262 1a:63:bd:64:e6:1f:b7:ce:f0:f2:9f:2e:bb:1b:b7:f2:50:88:
3263 73:92:c2:e2:e3:16:8d:9a:32:02:ab:8e:18:dd:e9:10:11:ee:
3264 7e:35:ab:90:af:3e:30:94:7a:d0:33:3d:a7:65:0f:f5:fc:8e:
3265 9e:62:cf:47:44:2c:01:5d:bb:1d:b5:32:d2:47:d2:38:2e:d0:
3266 fe:81:dc:32:6a:1e:b5:ee:3c:d5:fc:e7:81:1d:19:c3:24:42:
3267 ea:63:39:a9
3268-----BEGIN CERTIFICATE-----
3269MIIDdzCCAl+gAwIBAgIEAgAAuTANBgkqhkiG9w0BAQUFADBaMQswCQYDVQQGEwJJ
3270RTESMBAGA1UEChMJQmFsdGltb3JlMRMwEQYDVQQLEwpDeWJlclRydXN0MSIwIAYD
3271VQQDExlCYWx0aW1vcmUgQ3liZXJUcnVzdCBSb290MB4XDTAwMDUxMjE4NDYwMFoX
3272DTI1MDUxMjIzNTkwMFowWjELMAkGA1UEBhMCSUUxEjAQBgNVBAoTCUJhbHRpbW9y
3273ZTETMBEGA1UECxMKQ3liZXJUcnVzdDEiMCAGA1UEAxMZQmFsdGltb3JlIEN5YmVy
3274VHJ1c3QgUm9vdDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKMEuyKr
3275mD1X6CZymrV51Cni4eiVgLGw41uOKymaZN+hXe2wCQVt2yguzmKiYv60iNoS6zjr
3276IZ3AQSsBUnuId9Mcj8e6uYi1agnnc+gRQKfRzMpijS3ljwumUNKoUMMo6vWrJYeK
3277mpYcqWe4PwzV9/lSEy/CG9VwcPCPwBLKBsua4dnKM3p31vjsufFoREJIE9LAwqSu
3278XmD+tqYF/LTdB1kC1FkYmGP1pWPgkAx9XbIGevOF6uvUA65ehD5f/xXtabz5OTZy
3279dc93Uk3zyZAsuT3lySNTPx8kmCFcB5kpvcY67Oduhjprl3RjM71oGDHweI12v/ye
3280jl0qhqdNkNwnGjkCAwEAAaNFMEMwHQYDVR0OBBYEFOWdWTCCR1jMrPoIVDaGezq1
3281BE3wMBIGA1UdEwEB/wQIMAYBAf8CAQMwDgYDVR0PAQH/BAQDAgEGMA0GCSqGSIb3
3282DQEBBQUAA4IBAQCFDF2O5G9RaEIFoN27TyclhAO992T9Ldcw46QQF+vaKSm2eT92
32839hkTI7gQCvlYpNRhcL0EYWoSihfVCr3FvDB81ukMJY2GQE/szKN+OMY3EU/t3Wgx
3284jkzSswF07r51XgdIGn9w/xZchMB5hbgF/X++ZRGjD8ACtPhSNzkE1akxehi/oCr0
3285Epn3o0WC4zxe9Z2etciefC7IpJ5OCBRLbf1wbWsaY71k5h+3zvDyny67G7fyUIhz
3286ksLi4xaNmjICq44Y3ekQEe5+NauQrz4wlHrQMz2nZQ/1/I6eYs9HRCwBXbsdtTLS
3287R9I4LtD+gdwyah617jzV/OeBHRnDJELqYzmp
3288-----END CERTIFICATE-----
3289Certificate:
3290 Data:
3291 Version: 3 (0x2)
3292 Serial Number: 38 (0x26)
3293 Signature Algorithm: sha1WithRSAEncryption
3294 Issuer: C=DE, O=Deutsche Telekom AG, OU=T-TeleSec Trust Center, CN=Deutsche Telekom Root CA 2
3295 Validity
3296 Not Before: Jul 9 12:11:00 1999 GMT
3297 Not After : Jul 9 23:59:00 2019 GMT
3298 Subject: C=DE, O=Deutsche Telekom AG, OU=T-TeleSec Trust Center, CN=Deutsche Telekom Root CA 2
3299 Subject Public Key Info:
3300 Public Key Algorithm: rsaEncryption
3301 Public-Key: (2048 bit)
3302 Modulus:
3303 00:ab:0b:a3:35:e0:8b:29:14:b1:14:85:af:3c:10:
3304 e4:39:6f:35:5d:4a:ae:dd:ea:61:8d:95:49:f4:6f:
3305 64:a3:1a:60:66:a4:a9:40:22:84:d9:d4:a5:e5:78:
3306 93:0e:68:01:ad:b9:4d:5c:3a:ce:d3:b8:a8:42:40:
3307 df:cf:a3:ba:82:59:6a:92:1b:ac:1c:9a:da:08:2b:
3308 25:27:f9:69:23:47:f1:e0:eb:2c:7a:9b:f5:13:02:
3309 d0:7e:34:7c:c2:9e:3c:00:59:ab:f5:da:0c:f5:32:
3310 3c:2b:ac:50:da:d6:c3:de:83:94:ca:a8:0c:99:32:
3311 0e:08:48:56:5b:6a:fb:da:e1:58:58:01:49:5f:72:
3312 41:3c:15:06:01:8e:5d:ad:aa:b8:93:b4:cd:9e:eb:
3313 a7:e8:6a:2d:52:34:db:3a:ef:5c:75:51:da:db:f3:
3314 31:f9:ee:71:98:32:c4:54:15:44:0c:f9:9b:55:ed:
3315 ad:df:18:08:a0:a3:86:8a:49:ee:53:05:8f:19:4c:
3316 d5:de:58:79:9b:d2:6a:1c:42:ab:c5:d5:a7:cf:68:
3317 0f:96:e4:e1:61:98:76:61:c8:91:7c:d6:3e:00:e2:
3318 91:50:87:e1:9d:0a:e6:ad:97:d2:1d:c6:3a:7d:cb:
3319 bc:da:03:34:d5:8e:5b:01:f5:6a:07:b7:16:b6:6e:
3320 4a:7f
3321 Exponent: 65537 (0x10001)
3322 X509v3 extensions:
3323 X509v3 Subject Key Identifier:
3324 31:C3:79:1B:BA:F5:53:D7:17:E0:89:7A:2D:17:6C:0A:B3:2B:9D:33
3325 X509v3 Basic Constraints:
3326 CA:TRUE, pathlen:5
3327 X509v3 Key Usage: critical
3328 Certificate Sign, CRL Sign
3329 Signature Algorithm: sha1WithRSAEncryption
3330 94:64:59:ad:39:64:e7:29:eb:13:fe:5a:c3:8b:13:57:c8:04:
3331 24:f0:74:77:c0:60:e3:67:fb:e9:89:a6:83:bf:96:82:7c:6e:
3332 d4:c3:3d:ef:9e:80:6e:bb:29:b4:98:7a:b1:3b:54:eb:39:17:
3333 47:7e:1a:8e:0b:fc:1f:31:59:31:04:b2:ce:17:f3:2c:c7:62:
3334 36:55:e2:22:d8:89:55:b4:98:48:aa:64:fa:d6:1c:36:d8:44:
3335 78:5a:5a:23:3a:57:97:f5:7a:30:4f:ae:9f:6a:4c:4b:2b:8e:
3336 a0:03:e3:3e:e0:a9:d4:d2:7b:d2:b3:a8:e2:72:3c:ad:9e:ff:
3337 80:59:e4:9b:45:b4:f6:3b:b0:cd:39:19:98:32:e5:ea:21:61:
3338 90:e4:31:21:8e:34:b1:f7:2f:35:4a:85:10:da:e7:8a:37:21:
3339 be:59:63:e0:f2:85:88:31:53:d4:54:14:85:70:79:f4:2e:06:
3340 77:27:75:2f:1f:b8:8a:f9:fe:c5:ba:d8:36:e4:83:ec:e7:65:
3341 b7:bf:63:5a:f3:46:af:81:94:37:d4:41:8c:d6:23:d6:1e:cf:
3342 f5:68:1b:44:63:a2:5a:ba:a7:35:59:a1:e5:70:05:9b:0e:23:
3343 57:99:94:0a:6d:ba:39:63:28:86:92:f3:18:84:d8:fb:d1:cf:
3344 05:56:64:57
3345-----BEGIN CERTIFICATE-----
3346MIIDnzCCAoegAwIBAgIBJjANBgkqhkiG9w0BAQUFADBxMQswCQYDVQQGEwJERTEc
3347MBoGA1UEChMTRGV1dHNjaGUgVGVsZWtvbSBBRzEfMB0GA1UECxMWVC1UZWxlU2Vj
3348IFRydXN0IENlbnRlcjEjMCEGA1UEAxMaRGV1dHNjaGUgVGVsZWtvbSBSb290IENB
3349IDIwHhcNOTkwNzA5MTIxMTAwWhcNMTkwNzA5MjM1OTAwWjBxMQswCQYDVQQGEwJE
3350RTEcMBoGA1UEChMTRGV1dHNjaGUgVGVsZWtvbSBBRzEfMB0GA1UECxMWVC1UZWxl
3351U2VjIFRydXN0IENlbnRlcjEjMCEGA1UEAxMaRGV1dHNjaGUgVGVsZWtvbSBSb290
3352IENBIDIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCrC6M14IspFLEU
3353ha88EOQ5bzVdSq7d6mGNlUn0b2SjGmBmpKlAIoTZ1KXleJMOaAGtuU1cOs7TuKhC
3354QN/Po7qCWWqSG6wcmtoIKyUn+WkjR/Hg6yx6m/UTAtB+NHzCnjwAWav12gz1Mjwr
3355rFDa1sPeg5TKqAyZMg4ISFZbavva4VhYAUlfckE8FQYBjl2tqriTtM2e66foai1S
3356NNs671x1Udrb8zH57nGYMsRUFUQM+ZtV7a3fGAigo4aKSe5TBY8ZTNXeWHmb0moc
3357QqvF1afPaA+W5OFhmHZhyJF81j4A4pFQh+GdCuatl9Idxjp9y7zaAzTVjlsB9WoH
3358txa2bkp/AgMBAAGjQjBAMB0GA1UdDgQWBBQxw3kbuvVT1xfgiXotF2wKsyudMzAP
3359BgNVHRMECDAGAQH/AgEFMA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQUFAAOC
3360AQEAlGRZrTlk5ynrE/5aw4sTV8gEJPB0d8Bg42f76Ymmg7+Wgnxu1MM9756Abrsp
3361tJh6sTtU6zkXR34ajgv8HzFZMQSyzhfzLMdiNlXiItiJVbSYSKpk+tYcNthEeFpa
3362IzpXl/V6ME+un2pMSyuOoAPjPuCp1NJ70rOo4nI8rZ7/gFnkm0W09juwzTkZmDLl
33636iFhkOQxIY40sfcvNUqFENrnijchvllj4PKFiDFT1FQUhXB59C4Gdyd1Lx+4ivn+
3364xbrYNuSD7Odlt79jWvNGr4GUN9RBjNYj1h7P9WgbRGOiWrqnNVmh5XAFmw4jV5mU
3365Cm26OWMohpLzGITY+9HPBVZkVw==
3366-----END CERTIFICATE-----
3367Certificate:
3368 Data:
3369 Version: 3 (0x2)
3370 Serial Number: 1 (0x1)
3371 Signature Algorithm: sha256WithRSAEncryption
3372 Issuer: C=DE, O=T-Systems Enterprise Services GmbH, OU=T-Systems Trust Center, CN=T-TeleSec GlobalRoot Class 2
3373 Validity
3374 Not Before: Oct 1 10:40:14 2008 GMT
3375 Not After : Oct 1 23:59:59 2033 GMT
3376 Subject: C=DE, O=T-Systems Enterprise Services GmbH, OU=T-Systems Trust Center, CN=T-TeleSec GlobalRoot Class 2
3377 Subject Public Key Info:
3378 Public Key Algorithm: rsaEncryption
3379 Public-Key: (2048 bit)
3380 Modulus:
3381 00:aa:5f:da:1b:5f:e8:73:91:e5:da:5c:f4:a2:e6:
3382 47:e5:f3:68:55:60:05:1d:02:a4:b3:9b:59:f3:1e:
3383 8a:af:34:ad:fc:0d:c2:d9:48:19:ee:69:8f:c9:20:
3384 fc:21:aa:07:19:ed:b0:5c:ac:65:c7:5f:ed:02:7c:
3385 7b:7c:2d:1b:d6:ba:b9:80:c2:18:82:16:84:fa:66:
3386 b0:08:c6:54:23:81:e4:cd:b9:49:3f:f6:4f:6e:37:
3387 48:28:38:0f:c5:be:e7:68:70:fd:39:97:4d:d2:c7:
3388 98:91:50:aa:c4:44:b3:23:7d:39:47:e9:52:62:d6:
3389 12:93:5e:b7:31:96:42:05:fb:76:a7:1e:a3:f5:c2:
3390 fc:e9:7a:c5:6c:a9:71:4f:ea:cb:78:bc:60:af:c7:
3391 de:f4:d9:cb:be:7e:33:a5:6e:94:83:f0:34:fa:21:
3392 ab:ea:8e:72:a0:3f:a4:de:30:5b:ef:86:4d:6a:95:
3393 5b:43:44:a8:10:15:1c:e5:01:57:c5:98:f1:e6:06:
3394 28:91:aa:20:c5:b7:53:26:51:43:b2:0b:11:95:58:
3395 e1:c0:0f:76:d9:c0:8d:7c:81:f3:72:70:9e:6f:fe:
3396 1a:8e:d9:5f:35:c6:b2:6f:34:7c:be:48:4f:e2:5a:
3397 39:d7:d8:9d:78:9e:9f:86:3e:03:5e:19:8b:44:a2:
3398 d5:c7
3399 Exponent: 65537 (0x10001)
3400 X509v3 extensions:
3401 X509v3 Basic Constraints: critical
3402 CA:TRUE
3403 X509v3 Key Usage: critical
3404 Certificate Sign, CRL Sign
3405 X509v3 Subject Key Identifier:
3406 BF:59:20:36:00:79:A0:A0:22:6B:8C:D5:F2:61:D2:B8:2C:CB:82:4A
3407 Signature Algorithm: sha256WithRSAEncryption
3408 31:03:a2:61:0b:1f:74:e8:72:36:c6:6d:f9:4d:9e:fa:22:a8:
3409 e1:81:56:cf:cd:bb:9f:ea:ab:91:19:38:af:aa:7c:15:4d:f3:
3410 b6:a3:8d:a5:f4:8e:f6:44:a9:a7:e8:21:95:ad:3e:00:62:16:
3411 88:f0:02:ba:fc:61:23:e6:33:9b:30:7a:6b:36:62:7b:ad:04:
3412 23:84:58:65:e2:db:2b:8a:e7:25:53:37:62:53:5f:bc:da:01:
3413 62:29:a2:a6:27:71:e6:3a:22:7e:c1:6f:1d:95:70:20:4a:07:
3414 34:df:ea:ff:15:80:e5:ba:d7:7a:d8:5b:75:7c:05:7a:29:47:
3415 7e:40:a8:31:13:77:cd:40:3b:b4:51:47:7a:2e:11:e3:47:11:
3416 de:9d:66:d0:8b:d5:54:66:fa:83:55:ea:7c:c2:29:89:1b:e9:
3417 6f:b3:ce:e2:05:84:c9:2f:3e:78:85:62:6e:c9:5f:c1:78:63:
3418 74:58:c0:48:18:0c:99:39:eb:a4:cc:1a:b5:79:5a:8d:15:9c:
3419 d8:14:0d:f6:7a:07:57:c7:22:83:05:2d:3c:9b:25:26:3d:18:
3420 b3:a9:43:7c:c8:c8:ab:64:8f:0e:a3:bf:9c:1b:9d:30:db:da:
3421 d0:19:2e:aa:3c:f1:fb:33:80:76:e4:cd:ad:19:4f:05:27:8e:
3422 13:a1:6e:c2
3423-----BEGIN CERTIFICATE-----
3424MIIDwzCCAqugAwIBAgIBATANBgkqhkiG9w0BAQsFADCBgjELMAkGA1UEBhMCREUx
3425KzApBgNVBAoMIlQtU3lzdGVtcyBFbnRlcnByaXNlIFNlcnZpY2VzIEdtYkgxHzAd
3426BgNVBAsMFlQtU3lzdGVtcyBUcnVzdCBDZW50ZXIxJTAjBgNVBAMMHFQtVGVsZVNl
3427YyBHbG9iYWxSb290IENsYXNzIDIwHhcNMDgxMDAxMTA0MDE0WhcNMzMxMDAxMjM1
3428OTU5WjCBgjELMAkGA1UEBhMCREUxKzApBgNVBAoMIlQtU3lzdGVtcyBFbnRlcnBy
3429aXNlIFNlcnZpY2VzIEdtYkgxHzAdBgNVBAsMFlQtU3lzdGVtcyBUcnVzdCBDZW50
3430ZXIxJTAjBgNVBAMMHFQtVGVsZVNlYyBHbG9iYWxSb290IENsYXNzIDIwggEiMA0G
3431CSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCqX9obX+hzkeXaXPSi5kfl82hVYAUd
3432AqSzm1nzHoqvNK38DcLZSBnuaY/JIPwhqgcZ7bBcrGXHX+0CfHt8LRvWurmAwhiC
3433FoT6ZrAIxlQjgeTNuUk/9k9uN0goOA/FvudocP05l03Sx5iRUKrERLMjfTlH6VJi
34341hKTXrcxlkIF+3anHqP1wvzpesVsqXFP6st4vGCvx9702cu+fjOlbpSD8DT6Iavq
3435jnKgP6TeMFvvhk1qlVtDRKgQFRzlAVfFmPHmBiiRqiDFt1MmUUOyCxGVWOHAD3bZ
3436wI18gfNycJ5v/hqO2V81xrJvNHy+SE/iWjnX2J14np+GPgNeGYtEotXHAgMBAAGj
3437QjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBS/
3438WSA2AHmgoCJrjNXyYdK4LMuCSjANBgkqhkiG9w0BAQsFAAOCAQEAMQOiYQsfdOhy
3439NsZt+U2e+iKo4YFWz827n+qrkRk4r6p8FU3ztqONpfSO9kSpp+ghla0+AGIWiPAC
3440uvxhI+YzmzB6azZie60EI4RYZeLbK4rnJVM3YlNfvNoBYimipidx5joifsFvHZVw
3441IEoHNN/q/xWA5brXethbdXwFeilHfkCoMRN3zUA7tFFHei4R40cR3p1m0IvVVGb6
3442g1XqfMIpiRvpb7PO4gWEyS8+eIVibslfwXhjdFjASBgMmTnrpMwatXlajRWc2BQN
34439noHV8cigwUtPJslJj0Ys6lDfMjIq2SPDqO/nBudMNva0Bkuqjzx+zOAduTNrRlP
3444BSeOE6Fuwg==
3445-----END CERTIFICATE-----
3446Certificate:
3447 Data:
3448 Version: 3 (0x2)
3449 Serial Number: 1 (0x1)
3450 Signature Algorithm: sha256WithRSAEncryption
3451 Issuer: C=DE, O=T-Systems Enterprise Services GmbH, OU=T-Systems Trust Center, CN=T-TeleSec GlobalRoot Class 3
3452 Validity
3453 Not Before: Oct 1 10:29:56 2008 GMT
3454 Not After : Oct 1 23:59:59 2033 GMT
3455 Subject: C=DE, O=T-Systems Enterprise Services GmbH, OU=T-Systems Trust Center, CN=T-TeleSec GlobalRoot Class 3
3456 Subject Public Key Info:
3457 Public Key Algorithm: rsaEncryption
3458 Public-Key: (2048 bit)
3459 Modulus:
3460 00:bd:75:93:f0:62:22:6f:24:ae:e0:7a:76:ac:7d:
3461 bd:d9:24:d5:b8:b7:fc:cd:f0:42:e0:eb:78:88:56:
3462 5e:9b:9a:54:1d:4d:0c:8a:f6:d3:cf:70:f4:52:b5:
3463 d8:93:04:e3:46:86:71:41:4a:2b:f0:2a:2c:55:03:
3464 d6:48:c3:e0:39:38:ed:f2:5c:3c:3f:44:bc:93:3d:
3465 61:ab:4e:cd:0d:be:f0:20:27:58:0e:44:7f:04:1a:
3466 87:a5:d7:96:14:36:90:d0:49:7b:a1:75:fb:1a:6b:
3467 73:b1:f8:ce:a9:09:2c:f2:53:d5:c3:14:44:b8:86:
3468 a5:f6:8b:2b:39:da:a3:33:54:d9:fa:72:1a:f7:22:
3469 15:1c:88:91:6b:7f:66:e5:c3:6a:80:b0:24:f3:df:
3470 86:45:88:fd:19:7f:75:87:1f:1f:b1:1b:0a:73:24:
3471 5b:b9:65:e0:2c:54:c8:60:d3:66:17:3f:e1:cc:54:
3472 33:73:91:02:3a:a6:7f:7b:76:39:a2:1f:96:b6:38:
3473 ae:b5:c8:93:74:1d:9e:b9:b4:e5:60:9d:2f:56:d1:
3474 e0:eb:5e:5b:4c:12:70:0c:6c:44:20:ab:11:d8:f4:
3475 19:f6:d2:9c:52:37:e7:fa:b6:c2:31:3b:4a:d4:14:
3476 99:ad:c7:1a:f5:5d:5f:fa:07:b8:7c:0d:1f:d6:83:
3477 1e:b3
3478 Exponent: 65537 (0x10001)
3479 X509v3 extensions:
3480 X509v3 Basic Constraints: critical
3481 CA:TRUE
3482 X509v3 Key Usage: critical
3483 Certificate Sign, CRL Sign
3484 X509v3 Subject Key Identifier:
3485 B5:03:F7:76:3B:61:82:6A:12:AA:18:53:EB:03:21:94:BF:FE:CE:CA
3486 Signature Algorithm: sha256WithRSAEncryption
3487 56:3d:ef:94:d5:bd:da:73:b2:58:be:ae:90:ad:98:27:97:fe:
3488 01:b1:b0:52:00:b8:4d:e4:1b:21:74:1b:7e:c0:ee:5e:69:2a:
3489 25:af:5c:d6:1d:da:d2:79:c9:f3:97:29:e0:86:87:de:04:59:
3490 0f:f1:59:d4:64:85:4b:99:af:25:04:1e:c9:46:a9:97:de:82:
3491 b2:1b:70:9f:9c:f6:af:71:31:dd:7b:05:a5:2c:d3:b9:ca:47:
3492 f6:ca:f2:f6:e7:ad:b9:48:3f:bc:16:b7:c1:6d:f4:ea:09:af:
3493 ec:f3:b5:e7:05:9e:a6:1e:8a:53:51:d6:93:81:cc:74:93:f6:
3494 b9:da:a6:25:05:74:79:5a:7e:40:3e:82:4b:26:11:30:6e:e1:
3495 3f:41:c7:47:00:35:d5:f5:d3:f7:54:3e:81:3d:da:49:6a:9a:
3496 b3:ef:10:3d:e6:eb:6f:d1:c8:22:47:cb:cc:cf:01:31:92:d9:
3497 18:e3:22:be:09:1e:1a:3e:5a:b2:e4:6b:0c:54:7a:7d:43:4e:
3498 b8:89:a5:7b:d7:a2:3d:96:86:cc:f2:26:34:2d:6a:92:9d:9a:
3499 1a:d0:30:e2:5d:4e:04:b0:5f:8b:20:7e:77:c1:3d:95:82:d1:
3500 46:9a:3b:3c:78:b8:6f:a1:d0:0d:64:a2:78:1e:29:4e:93:c3:
3501 a4:54:14:5b
3502-----BEGIN CERTIFICATE-----
3503MIIDwzCCAqugAwIBAgIBATANBgkqhkiG9w0BAQsFADCBgjELMAkGA1UEBhMCREUx
3504KzApBgNVBAoMIlQtU3lzdGVtcyBFbnRlcnByaXNlIFNlcnZpY2VzIEdtYkgxHzAd
3505BgNVBAsMFlQtU3lzdGVtcyBUcnVzdCBDZW50ZXIxJTAjBgNVBAMMHFQtVGVsZVNl
3506YyBHbG9iYWxSb290IENsYXNzIDMwHhcNMDgxMDAxMTAyOTU2WhcNMzMxMDAxMjM1
3507OTU5WjCBgjELMAkGA1UEBhMCREUxKzApBgNVBAoMIlQtU3lzdGVtcyBFbnRlcnBy
3508aXNlIFNlcnZpY2VzIEdtYkgxHzAdBgNVBAsMFlQtU3lzdGVtcyBUcnVzdCBDZW50
3509ZXIxJTAjBgNVBAMMHFQtVGVsZVNlYyBHbG9iYWxSb290IENsYXNzIDMwggEiMA0G
3510CSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC9dZPwYiJvJK7genasfb3ZJNW4t/zN
35118ELg63iIVl6bmlQdTQyK9tPPcPRStdiTBONGhnFBSivwKixVA9ZIw+A5OO3yXDw/
3512RLyTPWGrTs0NvvAgJ1gORH8EGoel15YUNpDQSXuhdfsaa3Ox+M6pCSzyU9XDFES4
3513hqX2iys52qMzVNn6chr3IhUciJFrf2blw2qAsCTz34ZFiP0Zf3WHHx+xGwpzJFu5
3514ZeAsVMhg02YXP+HMVDNzkQI6pn97djmiH5a2OK61yJN0HZ65tOVgnS9W0eDrXltM
3515EnAMbEQgqxHY9Bn20pxSN+f6tsIxO0rUFJmtxxr1XV/6B7h8DR/Wgx6zAgMBAAGj
3516QjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBS1
3517A/d2O2GCahKqGFPrAyGUv/7OyjANBgkqhkiG9w0BAQsFAAOCAQEAVj3vlNW92nOy
3518WL6ukK2YJ5f+AbGwUgC4TeQbIXQbfsDuXmkqJa9c1h3a0nnJ85cp4IaH3gRZD/FZ
35191GSFS5mvJQQeyUapl96Cshtwn5z2r3Ex3XsFpSzTucpH9sry9uetuUg/vBa3wW30
35206gmv7PO15wWeph6KU1HWk4HMdJP2udqmJQV0eVp+QD6CSyYRMG7hP0HHRwA11fXT
352191Q+gT3aSWqas+8QPebrb9HIIkfLzM8BMZLZGOMivgkeGj5asuRrDFR6fUNOuIml
3522e9eiPZaGzPImNC1qkp2aGtAw4l1OBLBfiyB+d8E9lYLRRpo7PHi4b6HQDWSieB4p
3523TpPDpFQUWw==
3524-----END CERTIFICATE-----
diff --git a/src/lib/libcrypto/cmac/Makefile b/src/lib/libcrypto/cmac/Makefile
new file mode 100644
index 0000000000..54e7cc39d5
--- /dev/null
+++ b/src/lib/libcrypto/cmac/Makefile
@@ -0,0 +1,111 @@
1#
2# OpenSSL/crypto/cmac/Makefile
3#
4
5DIR= cmac
6TOP= ../..
7CC= cc
8INCLUDES=
9CFLAG=-g
10MAKEFILE= Makefile
11AR= ar r
12
13CFLAGS= $(INCLUDES) $(CFLAG)
14
15GENERAL=Makefile
16TEST=
17APPS=
18
19LIB=$(TOP)/libcrypto.a
20LIBSRC=cmac.c cm_ameth.c cm_pmeth.c
21LIBOBJ=cmac.o cm_ameth.o cm_pmeth.o
22
23SRC= $(LIBSRC)
24
25EXHEADER= cmac.h
26HEADER= $(EXHEADER)
27
28ALL= $(GENERAL) $(SRC) $(HEADER)
29
30top:
31 (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all)
32
33all: lib
34
35lib: $(LIBOBJ)
36 $(AR) $(LIB) $(LIBOBJ)
37 $(RANLIB) $(LIB) || echo Never mind.
38 @touch lib
39
40files:
41 $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
42
43links:
44 @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
45 @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
46 @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
47
48install:
49 @[ -n "$(INSTALLTOP)" ] # should be set by top Makefile...
50 @headerlist="$(EXHEADER)"; for i in $$headerlist ; \
51 do \
52 (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
53 chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
54 done;
55
56tags:
57 ctags $(SRC)
58
59tests:
60
61lint:
62 lint -DLINT $(INCLUDES) $(SRC)>fluff
63
64depend:
65 @[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile...
66 $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
67
68dclean:
69 $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
70 mv -f Makefile.new $(MAKEFILE)
71
72clean:
73 rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
74
75# DO NOT DELETE THIS LINE -- make depend depends on it.
76
77cm_ameth.o: ../../e_os.h ../../include/openssl/asn1.h
78cm_ameth.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
79cm_ameth.o: ../../include/openssl/cmac.h ../../include/openssl/crypto.h
80cm_ameth.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
81cm_ameth.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
82cm_ameth.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
83cm_ameth.o: ../../include/openssl/opensslconf.h
84cm_ameth.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
85cm_ameth.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
86cm_ameth.o: ../../include/openssl/symhacks.h ../asn1/asn1_locl.h ../cryptlib.h
87cm_ameth.o: cm_ameth.c
88cm_pmeth.o: ../../e_os.h ../../include/openssl/asn1.h
89cm_pmeth.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
90cm_pmeth.o: ../../include/openssl/cmac.h ../../include/openssl/conf.h
91cm_pmeth.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
92cm_pmeth.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
93cm_pmeth.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
94cm_pmeth.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
95cm_pmeth.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
96cm_pmeth.o: ../../include/openssl/opensslconf.h
97cm_pmeth.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
98cm_pmeth.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
99cm_pmeth.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
100cm_pmeth.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
101cm_pmeth.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
102cm_pmeth.o: ../cryptlib.h ../evp/evp_locl.h cm_pmeth.c
103cmac.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
104cmac.o: ../../include/openssl/buffer.h ../../include/openssl/cmac.h
105cmac.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
106cmac.o: ../../include/openssl/err.h ../../include/openssl/evp.h
107cmac.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
108cmac.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
109cmac.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
110cmac.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
111cmac.o: ../../include/openssl/symhacks.h ../cryptlib.h cmac.c
diff --git a/src/lib/libcrypto/cms/Makefile b/src/lib/libcrypto/cms/Makefile
new file mode 100644
index 0000000000..9820adb212
--- /dev/null
+++ b/src/lib/libcrypto/cms/Makefile
@@ -0,0 +1,284 @@
1#
2# OpenSSL/crypto/cms/Makefile
3#
4
5DIR= cms
6TOP= ../..
7CC= cc
8INCLUDES= -I.. -I$(TOP) -I../../include
9CFLAG=-g
10MAKEFILE= Makefile
11AR= ar r
12
13CFLAGS= $(INCLUDES) $(CFLAG)
14
15GENERAL=Makefile
16TEST=
17APPS=
18
19LIB=$(TOP)/libcrypto.a
20LIBSRC= cms_lib.c cms_asn1.c cms_att.c cms_io.c cms_smime.c cms_err.c \
21 cms_sd.c cms_dd.c cms_cd.c cms_env.c cms_enc.c cms_ess.c \
22 cms_pwri.c
23LIBOBJ= cms_lib.o cms_asn1.o cms_att.o cms_io.o cms_smime.o cms_err.o \
24 cms_sd.o cms_dd.o cms_cd.o cms_env.o cms_enc.o cms_ess.o \
25 cms_pwri.o
26
27SRC= $(LIBSRC)
28
29EXHEADER= cms.h
30HEADER= cms_lcl.h $(EXHEADER)
31
32ALL= $(GENERAL) $(SRC) $(HEADER)
33
34top:
35 (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all)
36
37test:
38
39all: lib
40
41lib: $(LIBOBJ)
42 $(AR) $(LIB) $(LIBOBJ)
43 $(RANLIB) $(LIB) || echo Never mind.
44 @touch lib
45
46files:
47 $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
48
49links:
50 @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
51 @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
52 @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
53
54install:
55 @[ -n "$(INSTALLTOP)" ] # should be set by top Makefile...
56 @headerlist="$(EXHEADER)"; for i in $$headerlist ; \
57 do \
58 (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
59 chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
60 done;
61
62tags:
63 ctags $(SRC)
64
65tests:
66
67lint:
68 lint -DLINT $(INCLUDES) $(SRC)>fluff
69
70depend:
71 @[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile...
72 $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
73
74dclean:
75 $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
76 mv -f Makefile.new $(MAKEFILE)
77
78clean:
79 rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
80
81# DO NOT DELETE THIS LINE -- make depend depends on it.
82
83cms_asn1.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h
84cms_asn1.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
85cms_asn1.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
86cms_asn1.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
87cms_asn1.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
88cms_asn1.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
89cms_asn1.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
90cms_asn1.o: ../../include/openssl/opensslconf.h
91cms_asn1.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
92cms_asn1.o: ../../include/openssl/pem.h ../../include/openssl/pem2.h
93cms_asn1.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
94cms_asn1.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
95cms_asn1.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
96cms_asn1.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
97cms_asn1.o: cms.h cms_asn1.c cms_lcl.h
98cms_att.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h
99cms_att.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
100cms_att.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
101cms_att.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
102cms_att.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
103cms_att.o: ../../include/openssl/err.h ../../include/openssl/evp.h
104cms_att.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
105cms_att.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
106cms_att.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
107cms_att.o: ../../include/openssl/pem.h ../../include/openssl/pem2.h
108cms_att.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
109cms_att.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
110cms_att.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
111cms_att.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
112cms_att.o: cms.h cms_att.c cms_lcl.h
113cms_cd.o: ../../e_os.h ../../include/openssl/asn1.h
114cms_cd.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
115cms_cd.o: ../../include/openssl/buffer.h ../../include/openssl/cms.h
116cms_cd.o: ../../include/openssl/comp.h ../../include/openssl/conf.h
117cms_cd.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
118cms_cd.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
119cms_cd.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
120cms_cd.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
121cms_cd.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
122cms_cd.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
123cms_cd.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pem.h
124cms_cd.o: ../../include/openssl/pem2.h ../../include/openssl/pkcs7.h
125cms_cd.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
126cms_cd.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
127cms_cd.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
128cms_cd.o: ../../include/openssl/x509v3.h ../cryptlib.h cms_cd.c cms_lcl.h
129cms_dd.o: ../../e_os.h ../../include/openssl/asn1.h
130cms_dd.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
131cms_dd.o: ../../include/openssl/buffer.h ../../include/openssl/cms.h
132cms_dd.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
133cms_dd.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
134cms_dd.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
135cms_dd.o: ../../include/openssl/err.h ../../include/openssl/evp.h
136cms_dd.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
137cms_dd.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
138cms_dd.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
139cms_dd.o: ../../include/openssl/pem.h ../../include/openssl/pem2.h
140cms_dd.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
141cms_dd.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
142cms_dd.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
143cms_dd.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
144cms_dd.o: ../cryptlib.h cms_dd.c cms_lcl.h
145cms_enc.o: ../../e_os.h ../../include/openssl/asn1.h
146cms_enc.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
147cms_enc.o: ../../include/openssl/buffer.h ../../include/openssl/cms.h
148cms_enc.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
149cms_enc.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
150cms_enc.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
151cms_enc.o: ../../include/openssl/err.h ../../include/openssl/evp.h
152cms_enc.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
153cms_enc.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
154cms_enc.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
155cms_enc.o: ../../include/openssl/pem.h ../../include/openssl/pem2.h
156cms_enc.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h
157cms_enc.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
158cms_enc.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
159cms_enc.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
160cms_enc.o: ../../include/openssl/x509v3.h ../cryptlib.h cms_enc.c cms_lcl.h
161cms_env.o: ../../e_os.h ../../include/openssl/aes.h
162cms_env.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h
163cms_env.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
164cms_env.o: ../../include/openssl/cms.h ../../include/openssl/conf.h
165cms_env.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
166cms_env.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
167cms_env.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
168cms_env.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
169cms_env.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
170cms_env.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
171cms_env.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pem.h
172cms_env.o: ../../include/openssl/pem2.h ../../include/openssl/pkcs7.h
173cms_env.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h
174cms_env.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
175cms_env.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
176cms_env.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
177cms_env.o: ../asn1/asn1_locl.h ../cryptlib.h cms_env.c cms_lcl.h
178cms_err.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
179cms_err.o: ../../include/openssl/buffer.h ../../include/openssl/cms.h
180cms_err.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
181cms_err.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
182cms_err.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
183cms_err.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
184cms_err.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
185cms_err.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
186cms_err.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
187cms_err.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
188cms_err.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
189cms_err.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
190cms_err.o: cms_err.c
191cms_ess.o: ../../e_os.h ../../include/openssl/asn1.h
192cms_ess.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
193cms_ess.o: ../../include/openssl/buffer.h ../../include/openssl/cms.h
194cms_ess.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
195cms_ess.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
196cms_ess.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
197cms_ess.o: ../../include/openssl/err.h ../../include/openssl/evp.h
198cms_ess.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
199cms_ess.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
200cms_ess.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
201cms_ess.o: ../../include/openssl/pem.h ../../include/openssl/pem2.h
202cms_ess.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h
203cms_ess.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
204cms_ess.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
205cms_ess.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
206cms_ess.o: ../../include/openssl/x509v3.h ../cryptlib.h cms_ess.c cms_lcl.h
207cms_io.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h
208cms_io.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
209cms_io.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
210cms_io.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
211cms_io.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
212cms_io.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
213cms_io.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
214cms_io.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
215cms_io.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pem.h
216cms_io.o: ../../include/openssl/pem2.h ../../include/openssl/pkcs7.h
217cms_io.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
218cms_io.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
219cms_io.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h cms.h
220cms_io.o: cms_io.c cms_lcl.h
221cms_lib.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h
222cms_lib.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
223cms_lib.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
224cms_lib.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
225cms_lib.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
226cms_lib.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
227cms_lib.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
228cms_lib.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
229cms_lib.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pem.h
230cms_lib.o: ../../include/openssl/pem2.h ../../include/openssl/pkcs7.h
231cms_lib.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
232cms_lib.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
233cms_lib.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h cms.h
234cms_lib.o: cms_lcl.h cms_lib.c
235cms_pwri.o: ../../e_os.h ../../include/openssl/aes.h
236cms_pwri.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h
237cms_pwri.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
238cms_pwri.o: ../../include/openssl/cms.h ../../include/openssl/conf.h
239cms_pwri.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
240cms_pwri.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
241cms_pwri.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
242cms_pwri.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
243cms_pwri.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
244cms_pwri.o: ../../include/openssl/opensslconf.h
245cms_pwri.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
246cms_pwri.o: ../../include/openssl/pem.h ../../include/openssl/pem2.h
247cms_pwri.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h
248cms_pwri.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
249cms_pwri.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
250cms_pwri.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
251cms_pwri.o: ../../include/openssl/x509v3.h ../asn1/asn1_locl.h ../cryptlib.h
252cms_pwri.o: cms_lcl.h cms_pwri.c
253cms_sd.o: ../../e_os.h ../../include/openssl/asn1.h
254cms_sd.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
255cms_sd.o: ../../include/openssl/buffer.h ../../include/openssl/cms.h
256cms_sd.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
257cms_sd.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
258cms_sd.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
259cms_sd.o: ../../include/openssl/err.h ../../include/openssl/evp.h
260cms_sd.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
261cms_sd.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
262cms_sd.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
263cms_sd.o: ../../include/openssl/pem.h ../../include/openssl/pem2.h
264cms_sd.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
265cms_sd.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
266cms_sd.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
267cms_sd.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
268cms_sd.o: ../asn1/asn1_locl.h ../cryptlib.h cms_lcl.h cms_sd.c
269cms_smime.o: ../../e_os.h ../../include/openssl/asn1.h
270cms_smime.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
271cms_smime.o: ../../include/openssl/buffer.h ../../include/openssl/cms.h
272cms_smime.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
273cms_smime.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
274cms_smime.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
275cms_smime.o: ../../include/openssl/err.h ../../include/openssl/evp.h
276cms_smime.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
277cms_smime.o: ../../include/openssl/objects.h
278cms_smime.o: ../../include/openssl/opensslconf.h
279cms_smime.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
280cms_smime.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
281cms_smime.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
282cms_smime.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
283cms_smime.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
284cms_smime.o: ../cryptlib.h cms_lcl.h cms_smime.c
diff --git a/src/lib/libcrypto/comp/Makefile b/src/lib/libcrypto/comp/Makefile
new file mode 100644
index 0000000000..efda832dce
--- /dev/null
+++ b/src/lib/libcrypto/comp/Makefile
@@ -0,0 +1,108 @@
1#
2# OpenSSL/crypto/comp/Makefile
3#
4
5DIR= comp
6TOP= ../..
7CC= cc
8INCLUDES= -I.. -I$(TOP) -I../../include
9CFLAG=-g
10MAKEFILE= Makefile
11AR= ar r
12
13CFLAGS= $(INCLUDES) $(CFLAG)
14
15GENERAL=Makefile
16TEST=
17APPS=
18
19LIB=$(TOP)/libcrypto.a
20LIBSRC= comp_lib.c comp_err.c \
21 c_rle.c c_zlib.c
22
23LIBOBJ= comp_lib.o comp_err.o \
24 c_rle.o c_zlib.o
25
26SRC= $(LIBSRC)
27
28EXHEADER= comp.h
29HEADER= $(EXHEADER)
30
31ALL= $(GENERAL) $(SRC) $(HEADER)
32
33top:
34 (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all)
35
36all: lib
37
38lib: $(LIBOBJ)
39 $(AR) $(LIB) $(LIBOBJ)
40 $(RANLIB) $(LIB) || echo Never mind.
41 @touch lib
42
43files:
44 $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
45
46links:
47 @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
48 @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
49 @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
50
51install:
52 @[ -n "$(INSTALLTOP)" ] # should be set by top Makefile...
53 @headerlist="$(EXHEADER)"; for i in $$headerlist ; \
54 do \
55 (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
56 chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
57 done;
58
59tags:
60 ctags $(SRC)
61
62tests:
63
64lint:
65 lint -DLINT $(INCLUDES) $(SRC)>fluff
66
67depend:
68 @[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile...
69 $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(LIBSRC)
70
71dclean:
72 $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
73 mv -f Makefile.new $(MAKEFILE)
74
75clean:
76 rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
77
78# DO NOT DELETE THIS LINE -- make depend depends on it.
79
80c_rle.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
81c_rle.o: ../../include/openssl/comp.h ../../include/openssl/crypto.h
82c_rle.o: ../../include/openssl/e_os2.h ../../include/openssl/obj_mac.h
83c_rle.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
84c_rle.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
85c_rle.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
86c_rle.o: ../../include/openssl/symhacks.h c_rle.c
87c_zlib.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
88c_zlib.o: ../../include/openssl/comp.h ../../include/openssl/crypto.h
89c_zlib.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
90c_zlib.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
91c_zlib.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
92c_zlib.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
93c_zlib.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
94c_zlib.o: ../../include/openssl/symhacks.h c_zlib.c
95comp_err.o: ../../include/openssl/bio.h ../../include/openssl/comp.h
96comp_err.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
97comp_err.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
98comp_err.o: ../../include/openssl/opensslconf.h
99comp_err.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
100comp_err.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
101comp_err.o: ../../include/openssl/symhacks.h comp_err.c
102comp_lib.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
103comp_lib.o: ../../include/openssl/comp.h ../../include/openssl/crypto.h
104comp_lib.o: ../../include/openssl/e_os2.h ../../include/openssl/obj_mac.h
105comp_lib.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
106comp_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
107comp_lib.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
108comp_lib.o: ../../include/openssl/symhacks.h comp_lib.c
diff --git a/src/lib/libcrypto/conf/Makefile b/src/lib/libcrypto/conf/Makefile
new file mode 100644
index 0000000000..78bb324106
--- /dev/null
+++ b/src/lib/libcrypto/conf/Makefile
@@ -0,0 +1,152 @@
1#
2# OpenSSL/crypto/conf/Makefile
3#
4
5DIR= conf
6TOP= ../..
7CC= cc
8INCLUDES= -I.. -I$(TOP) -I../../include
9CFLAG=-g
10MAKEFILE= Makefile
11AR= ar r
12
13CFLAGS= $(INCLUDES) $(CFLAG)
14
15GENERAL=Makefile
16TEST=
17APPS=
18
19LIB=$(TOP)/libcrypto.a
20LIBSRC= conf_err.c conf_lib.c conf_api.c conf_def.c conf_mod.c \
21 conf_mall.c conf_sap.c
22
23LIBOBJ= conf_err.o conf_lib.o conf_api.o conf_def.o conf_mod.o \
24 conf_mall.o conf_sap.o
25
26SRC= $(LIBSRC)
27
28EXHEADER= conf.h conf_api.h
29HEADER= conf_def.h $(EXHEADER)
30
31ALL= $(GENERAL) $(SRC) $(HEADER)
32
33top:
34 (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all)
35
36all: lib
37
38lib: $(LIBOBJ)
39 $(AR) $(LIB) $(LIBOBJ)
40 $(RANLIB) $(LIB) || echo Never mind.
41 @touch lib
42
43files:
44 $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
45
46links:
47 @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
48 @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
49 @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
50
51install:
52 @[ -n "$(INSTALLTOP)" ] # should be set by top Makefile...
53 @headerlist="$(EXHEADER)"; for i in $$headerlist ; \
54 do \
55 (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
56 chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
57 done;
58
59tags:
60 ctags $(SRC)
61
62tests:
63
64lint:
65 lint -DLINT $(INCLUDES) $(SRC)>fluff
66
67depend:
68 @[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile...
69 $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(LIBSRC)
70
71dclean:
72 $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
73 mv -f Makefile.new $(MAKEFILE)
74
75clean:
76 rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
77
78# DO NOT DELETE THIS LINE -- make depend depends on it.
79
80conf_api.o: ../../e_os.h ../../include/openssl/bio.h
81conf_api.o: ../../include/openssl/conf.h ../../include/openssl/conf_api.h
82conf_api.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
83conf_api.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
84conf_api.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
85conf_api.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
86conf_api.o: ../../include/openssl/symhacks.h conf_api.c
87conf_def.o: ../../e_os.h ../../include/openssl/bio.h
88conf_def.o: ../../include/openssl/buffer.h ../../include/openssl/conf.h
89conf_def.o: ../../include/openssl/conf_api.h ../../include/openssl/crypto.h
90conf_def.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
91conf_def.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
92conf_def.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
93conf_def.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
94conf_def.o: ../../include/openssl/symhacks.h ../cryptlib.h conf_def.c
95conf_def.o: conf_def.h
96conf_err.o: ../../include/openssl/bio.h ../../include/openssl/conf.h
97conf_err.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
98conf_err.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
99conf_err.o: ../../include/openssl/opensslconf.h
100conf_err.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
101conf_err.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
102conf_err.o: ../../include/openssl/symhacks.h conf_err.c
103conf_lib.o: ../../include/openssl/bio.h ../../include/openssl/conf.h
104conf_lib.o: ../../include/openssl/conf_api.h ../../include/openssl/crypto.h
105conf_lib.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
106conf_lib.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
107conf_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
108conf_lib.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
109conf_lib.o: ../../include/openssl/symhacks.h conf_lib.c
110conf_mall.o: ../../e_os.h ../../include/openssl/asn1.h
111conf_mall.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
112conf_mall.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
113conf_mall.o: ../../include/openssl/dso.h ../../include/openssl/e_os2.h
114conf_mall.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
115conf_mall.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h
116conf_mall.o: ../../include/openssl/err.h ../../include/openssl/evp.h
117conf_mall.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
118conf_mall.o: ../../include/openssl/objects.h
119conf_mall.o: ../../include/openssl/opensslconf.h
120conf_mall.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
121conf_mall.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
122conf_mall.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
123conf_mall.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
124conf_mall.o: ../../include/openssl/x509_vfy.h ../cryptlib.h conf_mall.c
125conf_mod.o: ../../e_os.h ../../include/openssl/asn1.h
126conf_mod.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
127conf_mod.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
128conf_mod.o: ../../include/openssl/dso.h ../../include/openssl/e_os2.h
129conf_mod.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
130conf_mod.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
131conf_mod.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
132conf_mod.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
133conf_mod.o: ../../include/openssl/opensslconf.h
134conf_mod.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
135conf_mod.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
136conf_mod.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
137conf_mod.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
138conf_mod.o: ../../include/openssl/x509_vfy.h ../cryptlib.h conf_mod.c
139conf_sap.o: ../../e_os.h ../../include/openssl/asn1.h
140conf_sap.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
141conf_sap.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
142conf_sap.o: ../../include/openssl/dso.h ../../include/openssl/e_os2.h
143conf_sap.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
144conf_sap.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h
145conf_sap.o: ../../include/openssl/err.h ../../include/openssl/evp.h
146conf_sap.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
147conf_sap.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
148conf_sap.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
149conf_sap.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
150conf_sap.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
151conf_sap.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
152conf_sap.o: ../../include/openssl/x509_vfy.h ../cryptlib.h conf_sap.c
diff --git a/src/lib/libcrypto/conf/cnf_save.c b/src/lib/libcrypto/conf/cnf_save.c
new file mode 100644
index 0000000000..1439487526
--- /dev/null
+++ b/src/lib/libcrypto/conf/cnf_save.c
@@ -0,0 +1,106 @@
1/* crypto/conf/cnf_save.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
59#include <stdio.h>
60#include <openssl/conf.h>
61
62static void print_conf(CONF_VALUE *cv);
63static IMPLEMENT_LHASH_DOALL_FN(print_conf, CONF_VALUE *);
64
65main()
66 {
67 LHASH *conf;
68 long l;
69
70 conf=CONF_load(NULL,"../../apps/openssl.cnf",&l);
71 if (conf == NULL)
72 {
73 fprintf(stderr,"error loading config, line %ld\n",l);
74 exit(1);
75 }
76
77 lh_doall(conf,LHASH_DOALL_FN(print_conf));
78 }
79
80
81static void print_conf(CONF_VALUE *cv)
82 {
83 int i;
84 CONF_VALUE *v;
85 char *section;
86 char *name;
87 char *value;
88 STACK *s;
89
90 /* If it is a single entry, return */
91
92 if (cv->name != NULL) return;
93
94 printf("[ %s ]\n",cv->section);
95 s=(STACK *)cv->value;
96
97 for (i=0; i<sk_num(s); i++)
98 {
99 v=(CONF_VALUE *)sk_value(s,i);
100 section=(v->section == NULL)?"None":v->section;
101 name=(v->name == NULL)?"None":v->name;
102 value=(v->value == NULL)?"None":v->value;
103 printf("%s=%s\n",name,value);
104 }
105 printf("\n");
106 }
diff --git a/src/lib/libcrypto/conf/conf_mall.c b/src/lib/libcrypto/conf/conf_mall.c
index 213890e0c2..c6f4cb2d55 100644
--- a/src/lib/libcrypto/conf/conf_mall.c
+++ b/src/lib/libcrypto/conf/conf_mall.c
@@ -76,6 +76,5 @@ void OPENSSL_load_builtin_modules(void)
76#ifndef OPENSSL_NO_ENGINE 76#ifndef OPENSSL_NO_ENGINE
77 ENGINE_add_conf_module(); 77 ENGINE_add_conf_module();
78#endif 78#endif
79 EVP_add_alg_module();
80 } 79 }
81 80
diff --git a/src/lib/libcrypto/conf/test.c b/src/lib/libcrypto/conf/test.c
new file mode 100644
index 0000000000..7fab85053e
--- /dev/null
+++ b/src/lib/libcrypto/conf/test.c
@@ -0,0 +1,98 @@
1/* crypto/conf/test.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
59#include <stdio.h>
60#include <stdlib.h>
61#include <openssl/conf.h>
62#include <openssl/err.h>
63
64main()
65 {
66 LHASH *conf;
67 long eline;
68 char *s,*s2;
69
70#ifdef USE_WIN32
71 CONF_set_default_method(CONF_WIN32);
72#endif
73 conf=CONF_load(NULL,"ssleay.cnf",&eline);
74 if (conf == NULL)
75 {
76 ERR_load_crypto_strings();
77 printf("unable to load configuration, line %ld\n",eline);
78 ERR_print_errors_fp(stderr);
79 exit(1);
80 }
81 lh_stats(conf,stdout);
82 lh_node_stats(conf,stdout);
83 lh_node_usage_stats(conf,stdout);
84
85 s=CONF_get_string(conf,NULL,"init2");
86 printf("init2=%s\n",(s == NULL)?"NULL":s);
87
88 s=CONF_get_string(conf,NULL,"cipher1");
89 printf("cipher1=%s\n",(s == NULL)?"NULL":s);
90
91 s=CONF_get_string(conf,"s_client","cipher1");
92 printf("s_client:cipher1=%s\n",(s == NULL)?"NULL":s);
93
94 printf("---------------------------- DUMP ------------------------\n");
95 CONF_dump_fp(conf, stdout);
96
97 exit(0);
98 }
diff --git a/src/lib/libcrypto/cryptlib.c b/src/lib/libcrypto/cryptlib.c
index 0b77d8b7d0..766ea8cac7 100644
--- a/src/lib/libcrypto/cryptlib.c
+++ b/src/lib/libcrypto/cryptlib.c
@@ -504,7 +504,7 @@ void CRYPTO_THREADID_current(CRYPTO_THREADID *id)
504 CRYPTO_THREADID_set_numeric(id, (unsigned long)find_thread(NULL)); 504 CRYPTO_THREADID_set_numeric(id, (unsigned long)find_thread(NULL));
505#else 505#else
506 /* For everything else, default to using the address of 'errno' */ 506 /* For everything else, default to using the address of 'errno' */
507 CRYPTO_THREADID_set_pointer(id, (void*)&errno); 507 CRYPTO_THREADID_set_pointer(id, &errno);
508#endif 508#endif
509 } 509 }
510 510
@@ -704,7 +704,6 @@ void OPENSSL_cpuid_setup(void)
704 } 704 }
705 else 705 else
706 vec = OPENSSL_ia32_cpuid(); 706 vec = OPENSSL_ia32_cpuid();
707
708 /* 707 /*
709 * |(1<<10) sets a reserved bit to signal that variable 708 * |(1<<10) sets a reserved bit to signal that variable
710 * was initialized already... This is to avoid interference 709 * was initialized already... This is to avoid interference
@@ -889,7 +888,7 @@ void OPENSSL_showfatal (const char *fmta,...)
889 888
890#if defined(_WIN32_WINNT) && _WIN32_WINNT>=0x0333 889#if defined(_WIN32_WINNT) && _WIN32_WINNT>=0x0333
891 /* this -------------v--- guards NT-specific calls */ 890 /* this -------------v--- guards NT-specific calls */
892 if (check_winnt() && OPENSSL_isservice() > 0) 891 if (GetVersion() < 0x80000000 && OPENSSL_isservice() > 0)
893 { HANDLE h = RegisterEventSource(0,_T("OPENSSL")); 892 { HANDLE h = RegisterEventSource(0,_T("OPENSSL"));
894 const TCHAR *pmsg=buf; 893 const TCHAR *pmsg=buf;
895 ReportEvent(h,EVENTLOG_ERROR_TYPE,0,0,0,1,0,&pmsg,0); 894 ReportEvent(h,EVENTLOG_ERROR_TYPE,0,0,0,1,0,&pmsg,0);
@@ -925,16 +924,3 @@ void OpenSSLDie(const char *file,int line,const char *assertion)
925 } 924 }
926 925
927void *OPENSSL_stderr(void) { return stderr; } 926void *OPENSSL_stderr(void) { return stderr; }
928
929int CRYPTO_memcmp(const void *in_a, const void *in_b, size_t len)
930 {
931 size_t i;
932 const unsigned char *a = in_a;
933 const unsigned char *b = in_b;
934 unsigned char x = 0;
935
936 for (i = 0; i < len; i++)
937 x |= a[i] ^ b[i];
938
939 return x;
940 }
diff --git a/src/lib/libcrypto/cryptlib.h b/src/lib/libcrypto/cryptlib.h
index d26f9630ea..1761f6b668 100644
--- a/src/lib/libcrypto/cryptlib.h
+++ b/src/lib/libcrypto/cryptlib.h
@@ -100,7 +100,7 @@ extern "C" {
100 100
101void OPENSSL_cpuid_setup(void); 101void OPENSSL_cpuid_setup(void);
102extern unsigned int OPENSSL_ia32cap_P[]; 102extern unsigned int OPENSSL_ia32cap_P[];
103void OPENSSL_showfatal(const char *fmta,...); 103void OPENSSL_showfatal(const char *,...);
104void *OPENSSL_stderr(void); 104void *OPENSSL_stderr(void);
105extern int OPENSSL_NONPIC_relocated; 105extern int OPENSSL_NONPIC_relocated;
106 106
diff --git a/src/lib/libcrypto/crypto-lib.com b/src/lib/libcrypto/crypto-lib.com
new file mode 100644
index 0000000000..c280aa03a8
--- /dev/null
+++ b/src/lib/libcrypto/crypto-lib.com
@@ -0,0 +1,1516 @@
1$!
2$! CRYPTO-LIB.COM
3$! Written By: Robert Byer
4$! Vice-President
5$! A-Com Computing, Inc.
6$! byer@mail.all-net.net
7$!
8$! Changes by Richard Levitte <richard@levitte.org>
9$! Zoltan Arpadffy <arpadffy@polarhome.com>
10$!
11$! This command files compiles and creates the "[.xxx.EXE.CRYPTO]LIBCRYPTO.OLB"
12$! library for OpenSSL. The "xxx" denotes the machine architecture, ALPHA,
13$! IA64 or VAX.
14$!
15$! It was re-written so it would try to determine what "C" compiler to use
16$! or you can specify which "C" compiler to use.
17$!
18$! Specify the following as P1 to build just that part or ALL to just
19$! build everything.
20$!
21$! LIBRARY To just compile the [.xxx.EXE.CRYPTO]LIBCRYPTO.OLB Library.
22$! APPS To just compile the [.xxx.EXE.CRYPTO]*.EXE
23$! ALL To do both LIBRARY and APPS
24$!
25$! Specify DEBUG or NODEBUG as P2 to compile with or without debugger
26$! information.
27$!
28$! Specify which compiler at P3 to try to compile under.
29$!
30$! VAXC For VAX C.
31$! DECC For DEC C.
32$! GNUC For GNU C.
33$!
34$! If you don't specify a compiler, it will try to determine which
35$! "C" compiler to use.
36$!
37$! P4, if defined, sets a TCP/IP library to use, through one of the following
38$! keywords:
39$!
40$! UCX For UCX
41$! TCPIP For TCPIP (post UCX)
42$! SOCKETSHR For SOCKETSHR+NETLIB
43$!
44$! P5, if defined, sets a compiler thread NOT needed on OpenVMS 7.1 (and up)
45$!
46$! P6, if defined, sets a choice of crypto methods to compile.
47$! WARNING: this should only be done to recompile some part of an already
48$! fully compiled library.
49$!
50$! P7, if defined, specifies the C pointer size. Ignored on VAX.
51$! ("64=ARGV" gives more efficient code with HP C V7.3 or newer.)
52$! Supported values are:
53$!
54$! "" Compile with default (/NOPOINTER_SIZE)
55$! 32 Compile with /POINTER_SIZE=32 (SHORT)
56$! 64 Compile with /POINTER_SIZE=64[=ARGV] (LONG[=ARGV]).
57$! (Automatically select ARGV if compiler supports it.)
58$! 64= Compile with /POINTER_SIZE=64 (LONG).
59$! 64=ARGV Compile with /POINTER_SIZE=64=ARGV (LONG=ARGV).
60$!
61$! P8, if defined, specifies a directory where ZLIB files (zlib.h,
62$! libz.olb) may be found. Optionally, a non-default object library
63$! name may be included ("dev:[dir]libz_64.olb", for example).
64$!
65$!
66$! Announce/identify.
67$!
68$ proc = f$environment( "procedure")
69$ write sys$output "@@@ "+ -
70 f$parse( proc, , , "name")+ f$parse( proc, , , "type")
71$!
72$! Define A TCP/IP Library That We Will Need To Link To.
73$! (That Is, If We Need To Link To One.)
74$!
75$ TCPIP_LIB = ""
76$ ZLIB_LIB = ""
77$!
78$! Check Which Architecture We Are Using.
79$!
80$ IF (F$GETSYI("CPU").LT.128)
81$ THEN
82$!
83$! The Architecture Is VAX
84$!
85$ ARCH = "VAX"
86$!
87$! Else...
88$!
89$ ELSE
90$!
91$! The Architecture Is Alpha, IA64 or whatever comes in the future.
92$!
93$ ARCH = F$EDIT( F$GETSYI( "ARCH_NAME"), "UPCASE")
94$ IF (ARCH .EQS. "") THEN ARCH = "UNK"
95$!
96$! End The Architecture Check.
97$!
98$ ENDIF
99$!
100$ ARCHD = ARCH
101$ LIB32 = "32"
102$ OPT_FILE = ""
103$ POINTER_SIZE = ""
104$!
105$! Define The Different Encryption Types.
106$! NOTE: Some might think this list ugly. However, it's made this way to
107$! reflect the SDIRS variable in [-]Makefile.org as closely as possible,
108$! thereby making it fairly easy to verify that the lists are the same.
109$!
110$ ET_WHIRLPOOL = "WHRLPOOL"
111$ IF ARCH .EQS. "VAX" THEN ET_WHIRLPOOL = ""
112$ ENCRYPT_TYPES = "Basic,"+ -
113 "OBJECTS,"+ -
114 "MD2,MD4,MD5,SHA,MDC2,HMAC,RIPEMD,"+ET_WHIRLPOOL+","+ -
115 "DES,AES,RC2,RC4,RC5,IDEA,BF,CAST,CAMELLIA,SEED,MODES,"+ -
116 "BN,EC,RSA,DSA,ECDSA,DH,ECDH,DSO,ENGINE,"+ -
117 "BUFFER,BIO,STACK,LHASH,RAND,ERR,"+ -
118 "EVP,EVP_2,EVP_3,ASN1,ASN1_2,PEM,X509,X509V3,"+ -
119 "CONF,TXT_DB,PKCS7,PKCS12,COMP,OCSP,UI,KRB5,"+ -
120 "CMS,PQUEUE,TS,JPAKE,SRP,STORE,CMAC"
121$!
122$! Check To Make Sure We Have Valid Command Line Parameters.
123$!
124$ GOSUB CHECK_OPTIONS
125$!
126$! Define The OBJ and EXE Directories.
127$!
128$ OBJ_DIR := SYS$DISK:[-.'ARCHD'.OBJ.CRYPTO]
129$ EXE_DIR := SYS$DISK:[-.'ARCHD'.EXE.CRYPTO]
130$!
131$! Specify the destination directory in any /MAP option.
132$!
133$ if (LINKMAP .eqs. "MAP")
134$ then
135$ LINKMAP = LINKMAP+ "=''EXE_DIR'"
136$ endif
137$!
138$! Add the location prefix to the linker options file name.
139$!
140$ if (OPT_FILE .nes. "")
141$ then
142$ OPT_FILE = EXE_DIR+ OPT_FILE
143$ endif
144$!
145$! Initialise logical names and such
146$!
147$ GOSUB INITIALISE
148$!
149$! Tell The User What Kind of Machine We Run On.
150$!
151$ WRITE SYS$OUTPUT "Host system architecture: ''ARCHD'"
152$!
153$!
154$! Check To See If The Architecture Specific OBJ Directory Exists.
155$!
156$ IF (F$PARSE(OBJ_DIR).EQS."")
157$ THEN
158$!
159$! It Dosen't Exist, So Create It.
160$!
161$ CREATE/DIR 'OBJ_DIR'
162$!
163$! End The Architecture Specific OBJ Directory Check.
164$!
165$ ENDIF
166$!
167$! Check To See If The Architecture Specific Directory Exists.
168$!
169$ IF (F$PARSE(EXE_DIR).EQS."")
170$ THEN
171$!
172$! It Dosen't Exist, So Create It.
173$!
174$ CREATE/DIRECTORY 'EXE_DIR'
175$!
176$! End The Architecture Specific Directory Check.
177$!
178$ ENDIF
179$!
180$! Define The Library Name.
181$!
182$ LIB_NAME := 'EXE_DIR'SSL_LIBCRYPTO'LIB32'.OLB
183$!
184$! Define The CRYPTO-LIB We Are To Use.
185$!
186$ CRYPTO_LIB := 'EXE_DIR'SSL_LIBCRYPTO'LIB32'.OLB
187$!
188$! Check To See If We Already Have A "[.xxx.EXE.CRYPTO]LIBCRYPTO.OLB" Library...
189$!
190$ IF (F$SEARCH(LIB_NAME).EQS."")
191$ THEN
192$!
193$! Guess Not, Create The Library.
194$!
195$ LIBRARY/CREATE/OBJECT 'LIB_NAME'
196$!
197$! End The Library Check.
198$!
199$ ENDIF
200$!
201$! Build our options file for the application
202$!
203$ GOSUB CHECK_OPT_FILE
204$!
205$! Define The Different Encryption "library" Strings.
206$!
207$ APPS_DES = "DES/DES,CBC3_ENC"
208$ APPS_PKCS7 = "ENC/ENC;DEC/DEC;SIGN/SIGN;VERIFY/VERIFY,EXAMPLE"
209$
210$ LIB_ = "cryptlib,mem,mem_clr,mem_dbg,cversion,ex_data,cpt_err,"+ -
211 "ebcdic,uid,o_time,o_str,o_dir,o_fips.c,o_init,fips_ers"
212$ LIB_MD2 = "md2_dgst,md2_one"
213$ LIB_MD4 = "md4_dgst,md4_one"
214$ LIB_MD5 = "md5_dgst,md5_one"
215$ LIB_SHA = "sha_dgst,sha1dgst,sha_one,sha1_one,sha256,sha512"
216$ LIB_MDC2 = "mdc2dgst,mdc2_one"
217$ LIB_HMAC = "hmac,hm_ameth,hm_pmeth"
218$ LIB_RIPEMD = "rmd_dgst,rmd_one"
219$ LIB_WHRLPOOL = "wp_dgst,wp_block"
220$ LIB_DES = "set_key,ecb_enc,cbc_enc,"+ -
221 "ecb3_enc,cfb64enc,cfb64ede,cfb_enc,ofb64ede,"+ -
222 "enc_read,enc_writ,ofb64enc,"+ -
223 "ofb_enc,str2key,pcbc_enc,qud_cksm,rand_key,"+ -
224 "des_enc,fcrypt_b,"+ -
225 "fcrypt,xcbc_enc,rpc_enc,cbc_cksm,"+ -
226 "ede_cbcm_enc,des_old,des_old2,read2pwd"
227$ LIB_RC2 = "rc2_ecb,rc2_skey,rc2_cbc,rc2cfb64,rc2ofb64"
228$ LIB_RC4 = "rc4_skey,rc4_enc,rc4_utl"
229$ LIB_RC5 = "rc5_skey,rc5_ecb,rc5_enc,rc5cfb64,rc5ofb64"
230$ LIB_IDEA = "i_cbc,i_cfb64,i_ofb64,i_ecb,i_skey"
231$ LIB_BF = "bf_skey,bf_ecb,bf_enc,bf_cfb64,bf_ofb64"
232$ LIB_CAST = "c_skey,c_ecb,c_enc,c_cfb64,c_ofb64"
233$ LIB_CAMELLIA = "camellia,cmll_misc,cmll_ecb,cmll_cbc,cmll_ofb,"+ -
234 "cmll_cfb,cmll_ctr,cmll_utl"
235$ LIB_SEED = "seed,seed_ecb,seed_cbc,seed_cfb,seed_ofb"
236$ LIB_MODES = "cbc128,ctr128,cts128,cfb128,ofb128,gcm128,"+ -
237 "ccm128,xts128"
238$ LIB_BN_ASM = "[.asm]vms.mar,vms-helper"
239$ IF F$TRNLNM("OPENSSL_NO_ASM") .OR. ARCH .NES. "VAX" THEN -
240 LIB_BN_ASM = "bn_asm"
241$ LIB_BN = "bn_add,bn_div,bn_exp,bn_lib,bn_ctx,bn_mul,bn_mod,"+ -
242 "bn_print,bn_rand,bn_shift,bn_word,bn_blind,"+ -
243 "bn_kron,bn_sqrt,bn_gcd,bn_prime,bn_err,bn_sqr,"+LIB_BN_ASM+","+ -
244 "bn_recp,bn_mont,bn_mpi,bn_exp2,bn_gf2m,bn_nist,"+ -
245 "bn_depr,bn_const,bn_x931p"
246$ LIB_EC = "ec_lib,ecp_smpl,ecp_mont,ecp_nist,ec_cvt,ec_mult,"+ -
247 "ec_err,ec_curve,ec_check,ec_print,ec_asn1,ec_key,"+ -
248 "ec2_smpl,ec2_mult,ec_ameth,ec_pmeth,eck_prn,"+ -
249 "ecp_nistp224,ecp_nistp256,ecp_nistp521,ecp_nistputil,"+ -
250 "ecp_oct,ec2_oct,ec_oct"
251$ LIB_RSA = "rsa_eay,rsa_gen,rsa_lib,rsa_sign,rsa_saos,rsa_err,"+ -
252 "rsa_pk1,rsa_ssl,rsa_none,rsa_oaep,rsa_chk,rsa_null,"+ -
253 "rsa_pss,rsa_x931,rsa_asn1,rsa_depr,rsa_ameth,rsa_prn,"+ -
254 "rsa_pmeth,rsa_crpt"
255$ LIB_DSA = "dsa_gen,dsa_key,dsa_lib,dsa_asn1,dsa_vrf,dsa_sign,"+ -
256 "dsa_err,dsa_ossl,dsa_depr,dsa_ameth,dsa_pmeth,dsa_prn"
257$ LIB_ECDSA = "ecs_lib,ecs_asn1,ecs_ossl,ecs_sign,ecs_vrf,ecs_err"
258$ LIB_DH = "dh_asn1,dh_gen,dh_key,dh_lib,dh_check,dh_err,dh_depr,"+ -
259 "dh_ameth,dh_pmeth,dh_prn"
260$ LIB_ECDH = "ech_lib,ech_ossl,ech_key,ech_err"
261$ LIB_DSO = "dso_dl,dso_dlfcn,dso_err,dso_lib,dso_null,"+ -
262 "dso_openssl,dso_win32,dso_vms,dso_beos"
263$ LIB_ENGINE = "eng_err,eng_lib,eng_list,eng_init,eng_ctrl,"+ -
264 "eng_table,eng_pkey,eng_fat,eng_all,"+ -
265 "tb_rsa,tb_dsa,tb_ecdsa,tb_dh,tb_ecdh,tb_rand,tb_store,"+ -
266 "tb_cipher,tb_digest,tb_pkmeth,tb_asnmth,"+ -
267 "eng_openssl,eng_dyn,eng_cnf,eng_cryptodev,"+ -
268 "eng_rsax,eng_rdrand"
269$ LIB_AES = "aes_core,aes_misc,aes_ecb,aes_cbc,aes_cfb,aes_ofb,aes_ctr,"+ -
270 "aes_ige,aes_wrap"
271$ LIB_BUFFER = "buffer,buf_str,buf_err"
272$ LIB_BIO = "bio_lib,bio_cb,bio_err,"+ -
273 "bss_mem,bss_null,bss_fd,"+ -
274 "bss_file,bss_sock,bss_conn,"+ -
275 "bf_null,bf_buff,b_print,b_dump,"+ -
276 "b_sock,bss_acpt,bf_nbio,bss_rtcp,bss_bio,bss_log,"+ -
277 "bss_dgram,"+ -
278 "bf_lbuf"
279$ LIB_STACK = "stack"
280$ LIB_LHASH = "lhash,lh_stats"
281$ LIB_RAND = "md_rand,randfile,rand_lib,rand_err,rand_egd,"+ -
282 "rand_vms"
283$ LIB_ERR = "err,err_all,err_prn"
284$ LIB_OBJECTS = "o_names,obj_dat,obj_lib,obj_err,obj_xref"
285$ LIB_EVP = "encode,digest,evp_enc,evp_key,evp_acnf,"+ -
286 "e_des,e_bf,e_idea,e_des3,e_camellia,"+ -
287 "e_rc4,e_aes,names,e_seed,"+ -
288 "e_xcbc_d,e_rc2,e_cast,e_rc5"
289$ LIB_EVP_2 = "m_null,m_md2,m_md4,m_md5,m_sha,m_sha1,m_wp," + -
290 "m_dss,m_dss1,m_mdc2,m_ripemd,m_ecdsa,"+ -
291 "p_open,p_seal,p_sign,p_verify,p_lib,p_enc,p_dec,"+ -
292 "bio_md,bio_b64,bio_enc,evp_err,e_null,"+ -
293 "c_all,c_allc,c_alld,evp_lib,bio_ok,"+-
294 "evp_pkey,evp_pbe,p5_crpt,p5_crpt2"
295$ LIB_EVP_3 = "e_old,pmeth_lib,pmeth_fn,pmeth_gn,m_sigver,evp_fips,"+ -
296 "e_aes_cbc_hmac_sha1,e_rc4_hmac_md5"
297$ LIB_ASN1 = "a_object,a_bitstr,a_utctm,a_gentm,a_time,a_int,a_octet,"+ -
298 "a_print,a_type,a_set,a_dup,a_d2i_fp,a_i2d_fp,"+ -
299 "a_enum,a_utf8,a_sign,a_digest,a_verify,a_mbstr,a_strex,"+ -
300 "x_algor,x_val,x_pubkey,x_sig,x_req,x_attrib,x_bignum,"+ -
301 "x_long,x_name,x_x509,x_x509a,x_crl,x_info,x_spki,nsseq,"+ -
302 "x_nx509,d2i_pu,d2i_pr,i2d_pu,i2d_pr"
303$ LIB_ASN1_2 = "t_req,t_x509,t_x509a,t_crl,t_pkey,t_spki,t_bitst,"+ -
304 "tasn_new,tasn_fre,tasn_enc,tasn_dec,tasn_utl,tasn_typ,"+ -
305 "tasn_prn,ameth_lib,"+ -
306 "f_int,f_string,n_pkey,"+ -
307 "f_enum,x_pkey,a_bool,x_exten,bio_asn1,bio_ndef,asn_mime,"+ -
308 "asn1_gen,asn1_par,asn1_lib,asn1_err,a_bytes,a_strnid,"+ -
309 "evp_asn1,asn_pack,p5_pbe,p5_pbev2,p8_pkey,asn_moid"
310$ LIB_PEM = "pem_sign,pem_seal,pem_info,pem_lib,pem_all,pem_err,"+ -
311 "pem_x509,pem_xaux,pem_oth,pem_pk8,pem_pkey,pvkfmt"
312$ LIB_X509 = "x509_def,x509_d2,x509_r2x,x509_cmp,"+ -
313 "x509_obj,x509_req,x509spki,x509_vfy,"+ -
314 "x509_set,x509cset,x509rset,x509_err,"+ -
315 "x509name,x509_v3,x509_ext,x509_att,"+ -
316 "x509type,x509_lu,x_all,x509_txt,"+ -
317 "x509_trs,by_file,by_dir,x509_vpm"
318$ LIB_X509V3 = "v3_bcons,v3_bitst,v3_conf,v3_extku,v3_ia5,v3_lib,"+ -
319 "v3_prn,v3_utl,v3err,v3_genn,v3_alt,v3_skey,v3_akey,v3_pku,"+ -
320 "v3_int,v3_enum,v3_sxnet,v3_cpols,v3_crld,v3_purp,v3_info,"+ -
321 "v3_ocsp,v3_akeya,v3_pmaps,v3_pcons,v3_ncons,v3_pcia,v3_pci,"+ -
322 "pcy_cache,pcy_node,pcy_data,pcy_map,pcy_tree,pcy_lib,"+ -
323 "v3_asid,v3_addr"
324$ LIB_CONF = "conf_err,conf_lib,conf_api,conf_def,conf_mod,conf_mall,conf_sap"
325$ LIB_TXT_DB = "txt_db"
326$ LIB_PKCS7 = "pk7_asn1,pk7_lib,pkcs7err,pk7_doit,pk7_smime,pk7_attr,"+ -
327 "pk7_mime,bio_pk7"
328$ LIB_PKCS12 = "p12_add,p12_asn,p12_attr,p12_crpt,p12_crt,p12_decr,"+ -
329 "p12_init,p12_key,p12_kiss,p12_mutl,"+ -
330 "p12_utl,p12_npas,pk12err,p12_p8d,p12_p8e"
331$ LIB_COMP = "comp_lib,comp_err,"+ -
332 "c_rle,c_zlib"
333$ LIB_OCSP = "ocsp_asn,ocsp_ext,ocsp_ht,ocsp_lib,ocsp_cl,"+ -
334 "ocsp_srv,ocsp_prn,ocsp_vfy,ocsp_err"
335$ LIB_UI_COMPAT = ",ui_compat"
336$ LIB_UI = "ui_err,ui_lib,ui_openssl,ui_util"+LIB_UI_COMPAT
337$ LIB_KRB5 = "krb5_asn"
338$ LIB_CMS = "cms_lib,cms_asn1,cms_att,cms_io,cms_smime,cms_err,"+ -
339 "cms_sd,cms_dd,cms_cd,cms_env,cms_enc,cms_ess,"+ -
340 "cms_pwri"
341$ LIB_PQUEUE = "pqueue"
342$ LIB_TS = "ts_err,ts_req_utils,ts_req_print,ts_rsp_utils,ts_rsp_print,"+ -
343 "ts_rsp_sign,ts_rsp_verify,ts_verify_ctx,ts_lib,ts_conf,"+ -
344 "ts_asn1"
345$ LIB_JPAKE = "jpake,jpake_err"
346$ LIB_SRP = "srp_lib,srp_vfy"
347$ LIB_STORE = "str_err,str_lib,str_meth,str_mem"
348$ LIB_CMAC = "cmac,cm_ameth.c,cm_pmeth"
349$!
350$! Setup exceptional compilations
351$!
352$ CC3_SHOWN = 0
353$ CC4_SHOWN = 0
354$ CC5_SHOWN = 0
355$ CC6_SHOWN = 0
356$!
357$! The following lists must have leading and trailing commas, and no
358$! embedded spaces. (They are scanned for ",name,".)
359$!
360$ ! Add definitions for no threads on OpenVMS 7.1 and higher.
361$ COMPILEWITH_CC3 = ",bss_rtcp,"
362$ ! Disable the DOLLARID warning. Not needed with /STANDARD=RELAXED.
363$ COMPILEWITH_CC4 = "" !!! ",a_utctm,bss_log,o_time,o_dir,"
364$ ! Disable disjoint optimization on VAX with DECC.
365$ COMPILEWITH_CC5 = ",md2_dgst,md4_dgst,md5_dgst,mdc2dgst," + -
366 "seed,sha_dgst,sha1dgst,rmd_dgst,bf_enc,"
367$ ! Disable the MIXLINKAGE warning.
368$ COMPILEWITH_CC6 = "" !!! ",enc_read,set_key,"
369$!
370$! Figure Out What Other Modules We Are To Build.
371$!
372$ BUILD_SET:
373$!
374$! Define A Module Counter.
375$!
376$ MODULE_COUNTER = 0
377$!
378$! Top Of The Loop.
379$!
380$ MODULE_NEXT:
381$!
382$! Extract The Module Name From The Encryption List.
383$!
384$ MODULE_NAME = F$ELEMENT(MODULE_COUNTER,",",ENCRYPT_TYPES)
385$ IF MODULE_NAME.EQS."Basic" THEN MODULE_NAME = ""
386$ MODULE_NAME1 = MODULE_NAME
387$!
388$! Check To See If We Are At The End Of The Module List.
389$!
390$ IF (MODULE_NAME.EQS.",")
391$ THEN
392$!
393$! We Are At The End Of The Module List, Go To MODULE_DONE.
394$!
395$ GOTO MODULE_DONE
396$!
397$! End The Module List Check.
398$!
399$ ENDIF
400$!
401$! Increment The Moudle Counter.
402$!
403$ MODULE_COUNTER = MODULE_COUNTER + 1
404$!
405$! Create The Library and Apps Module Names.
406$!
407$ LIB_MODULE = "LIB_" + MODULE_NAME
408$ APPS_MODULE = "APPS_" + MODULE_NAME
409$ IF (F$EXTRACT(0,5,MODULE_NAME).EQS."ASN1_")
410$ THEN
411$ MODULE_NAME = "ASN1"
412$ ENDIF
413$ IF (F$EXTRACT(0,4,MODULE_NAME).EQS."EVP_")
414$ THEN
415$ MODULE_NAME = "EVP"
416$ ENDIF
417$!
418$! Set state (can be LIB and APPS)
419$!
420$ STATE = "LIB"
421$ IF BUILDALL .EQS. "APPS" THEN STATE = "APPS"
422$!
423$! Check if the library module name actually is defined
424$!
425$ IF F$TYPE('LIB_MODULE') .EQS. ""
426$ THEN
427$ WRITE SYS$ERROR ""
428$ WRITE SYS$ERROR "The module ",MODULE_NAME1," does not exist. Continuing..."
429$ WRITE SYS$ERROR ""
430$ GOTO MODULE_NEXT
431$ ENDIF
432$!
433$! Top Of The Module Loop.
434$!
435$ MODULE_AGAIN:
436$!
437$! Tell The User What Module We Are Building.
438$!
439$ IF (MODULE_NAME1.NES."")
440$ THEN
441$ IF STATE .EQS. "LIB"
442$ THEN
443$ WRITE SYS$OUTPUT "Compiling The ",MODULE_NAME1," Library Files. (",BUILDALL,",",STATE,")"
444$ ELSE IF F$TYPE('APPS_MODULE') .NES. ""
445$ THEN
446$ WRITE SYS$OUTPUT "Compiling The ",MODULE_NAME1," Applications. (",BUILDALL,",",STATE,")"
447$ ENDIF
448$ ENDIF
449$ ENDIF
450$!
451$! Define A File Counter And Set It To "0".
452$!
453$ FILE_COUNTER = 0
454$ APPLICATION = ""
455$ APPLICATION_COUNTER = 0
456$!
457$! Top Of The File Loop.
458$!
459$ NEXT_FILE:
460$!
461$! Look in the LIB_MODULE is we're in state LIB
462$!
463$ IF STATE .EQS. "LIB"
464$ THEN
465$!
466$! O.K, Extract The File Name From The File List.
467$!
468$ FILE_NAME = F$ELEMENT(FILE_COUNTER,",",'LIB_MODULE')
469$!
470$! else
471$!
472$ ELSE
473$ FILE_NAME = ","
474$!
475$ IF F$TYPE('APPS_MODULE') .NES. ""
476$ THEN
477$!
478$! Extract The File Name From The File List.
479$! This part is a bit more complicated.
480$!
481$ IF APPLICATION .EQS. ""
482$ THEN
483$ APPLICATION = F$ELEMENT(APPLICATION_COUNTER,";",'APPS_MODULE')
484$ APPLICATION_COUNTER = APPLICATION_COUNTER + 1
485$ APPLICATION_OBJECTS = F$ELEMENT(1,"/",APPLICATION)
486$ APPLICATION = F$ELEMENT(0,"/",APPLICATION)
487$ FILE_COUNTER = 0
488$ ENDIF
489$
490$! WRITE SYS$OUTPUT "DEBUG: SHOW SYMBOL APPLICATION*"
491$! SHOW SYMBOL APPLICATION*
492$!
493$ IF APPLICATION .NES. ";"
494$ THEN
495$ FILE_NAME = F$ELEMENT(FILE_COUNTER,",",APPLICATION_OBJECTS)
496$ IF FILE_NAME .EQS. ","
497$ THEN
498$ APPLICATION = ""
499$ GOTO NEXT_FILE
500$ ENDIF
501$ ENDIF
502$ ENDIF
503$ ENDIF
504$!
505$! Check To See If We Are At The End Of The File List.
506$!
507$ IF (FILE_NAME.EQS.",")
508$ THEN
509$!
510$! We Are At The End Of The File List, Change State Or Goto FILE_DONE.
511$!
512$ IF STATE .EQS. "LIB" .AND. BUILDALL .NES. "LIBRARY"
513$ THEN
514$ STATE = "APPS"
515$ GOTO MODULE_AGAIN
516$ ELSE
517$ GOTO FILE_DONE
518$ ENDIF
519$!
520$! End The File List Check.
521$!
522$ ENDIF
523$!
524$! Increment The Counter.
525$!
526$ FILE_COUNTER = FILE_COUNTER + 1
527$!
528$! Create The Source File Name.
529$!
530$ TMP_FILE_NAME = F$ELEMENT(1,"]",FILE_NAME)
531$ IF TMP_FILE_NAME .EQS. "]" THEN TMP_FILE_NAME = FILE_NAME
532$ IF F$ELEMENT(0,".",TMP_FILE_NAME) .EQS. TMP_FILE_NAME THEN -
533 FILE_NAME = FILE_NAME + ".c"
534$ IF (MODULE_NAME.NES."")
535$ THEN
536$ SOURCE_FILE = "SYS$DISK:[." + MODULE_NAME+ "]" + FILE_NAME
537$ ELSE
538$ SOURCE_FILE = "SYS$DISK:[]" + FILE_NAME
539$ ENDIF
540$ SOURCE_FILE = SOURCE_FILE - "]["
541$!
542$! Create The Object File Name.
543$!
544$ OBJECT_FILE = OBJ_DIR + F$PARSE(FILE_NAME,,,"NAME","SYNTAX_ONLY") + ".OBJ"
545$ ON WARNING THEN GOTO NEXT_FILE
546$!
547$! Check To See If The File We Want To Compile Is Actually There.
548$!
549$ IF (F$SEARCH(SOURCE_FILE).EQS."")
550$ THEN
551$!
552$! Tell The User That The File Doesn't Exist.
553$!
554$ WRITE SYS$OUTPUT ""
555$ WRITE SYS$OUTPUT "The File ",SOURCE_FILE," Doesn't Exist."
556$ WRITE SYS$OUTPUT ""
557$!
558$! Exit The Build.
559$!
560$ GOTO EXIT
561$!
562$! End The File Exist Check.
563$!
564$ ENDIF
565$!
566$! Tell The User We Are Compiling The File.
567$!
568$ IF (MODULE_NAME.EQS."")
569$ THEN
570$ WRITE SYS$OUTPUT "Compiling The ",FILE_NAME," File. (",BUILDALL,",",STATE,")"
571$ ENDIF
572$ IF (MODULE_NAME.NES."")
573$ THEN
574$ WRITE SYS$OUTPUT " ",FILE_NAME,""
575$ ENDIF
576$!
577$! Compile The File.
578$!
579$ ON ERROR THEN GOTO NEXT_FILE
580$ FILE_NAME0 = ","+ F$ELEMENT(0,".",FILE_NAME)+ ","
581$ IF FILE_NAME - ".mar" .NES. FILE_NAME
582$ THEN
583$ MACRO/OBJECT='OBJECT_FILE' 'SOURCE_FILE'
584$ ELSE
585$ IF COMPILEWITH_CC3 - FILE_NAME0 .NES. COMPILEWITH_CC3
586$ THEN
587$ write sys$output " \Using special rule (3)"
588$ if (.not. CC3_SHOWN)
589$ then
590$ CC3_SHOWN = 1
591$ x = " "+ CC3
592$ write /symbol sys$output x
593$ endif
594$ CC3/OBJECT='OBJECT_FILE' 'SOURCE_FILE'
595$ ELSE
596$ IF COMPILEWITH_CC4 - FILE_NAME0 .NES. COMPILEWITH_CC4
597$ THEN
598$ write /symbol sys$output " \Using special rule (4)"
599$ if (.not. CC4_SHOWN)
600$ then
601$ CC4_SHOWN = 1
602$ x = " "+ CC4
603$ write /symbol sys$output x
604$ endif
605$ CC4/OBJECT='OBJECT_FILE' 'SOURCE_FILE'
606$ ELSE
607$ IF CC5_DIFFERENT .AND. -
608 (COMPILEWITH_CC5 - FILE_NAME0 .NES. COMPILEWITH_CC5)
609$ THEN
610$ write sys$output " \Using special rule (5)"
611$ if (.not. CC5_SHOWN)
612$ then
613$ CC5_SHOWN = 1
614$ x = " "+ CC5
615$ write /symbol sys$output x
616$ endif
617$ CC5/OBJECT='OBJECT_FILE' 'SOURCE_FILE'
618$ ELSE
619$ IF COMPILEWITH_CC6 - FILE_NAME0 .NES. COMPILEWITH_CC6
620$ THEN
621$ write sys$output " \Using special rule (6)"
622$ if (.not. CC6_SHOWN)
623$ then
624$ CC6_SHOWN = 1
625$ x = " "+ CC6
626$ write /symbol sys$output x
627$ endif
628$ CC6/OBJECT='OBJECT_FILE' 'SOURCE_FILE'
629$ ELSE
630$ CC/OBJECT='OBJECT_FILE' 'SOURCE_FILE'
631$ ENDIF
632$ ENDIF
633$ ENDIF
634$ ENDIF
635$ ENDIF
636$ IF STATE .EQS. "LIB"
637$ THEN
638$!
639$! Add It To The Library.
640$!
641$ LIBRARY/REPLACE 'LIB_NAME' 'OBJECT_FILE'
642$!
643$! Time To Clean Up The Object File.
644$!
645$ DELETE 'OBJECT_FILE';*
646$ ENDIF
647$!
648$! Go Back And Do It Again.
649$!
650$ GOTO NEXT_FILE
651$!
652$! All Done With This Library Part.
653$!
654$ FILE_DONE:
655$!
656$! Time To Build Some Applications
657$!
658$ IF F$TYPE('APPS_MODULE') .NES. "" .AND. BUILDALL .NES. "LIBRARY"
659$ THEN
660$ APPLICATION_COUNTER = 0
661$ NEXT_APPLICATION:
662$ APPLICATION = F$ELEMENT(APPLICATION_COUNTER,";",'APPS_MODULE')
663$ IF APPLICATION .EQS. ";" THEN GOTO APPLICATION_DONE
664$
665$ APPLICATION_COUNTER = APPLICATION_COUNTER + 1
666$ APPLICATION_OBJECTS = F$ELEMENT(1,"/",APPLICATION)
667$ APPLICATION = F$ELEMENT(0,"/",APPLICATION)
668$
669$! WRITE SYS$OUTPUT "DEBUG: SHOW SYMBOL APPLICATION*"
670$! SHOW SYMBOL APPLICATION*
671$!
672$! Tell the user what happens
673$!
674$ WRITE SYS$OUTPUT " ",APPLICATION,".exe"
675$!
676$! Link The Program.
677$!
678$ ON ERROR THEN GOTO NEXT_APPLICATION
679$!
680$! Link With A TCP/IP Library.
681$!
682$ LINK /'DEBUGGER' /'LINKMAP' /'TRACEBACK' -
683 /EXE='EXE_DIR''APPLICATION'.EXE -
684 'OBJ_DIR''APPLICATION_OBJECTS', -
685 'CRYPTO_LIB'/LIBRARY -
686 'TCPIP_LIB' -
687 'ZLIB_LIB' -
688 ,'OPT_FILE' /OPTIONS
689$!
690$ GOTO NEXT_APPLICATION
691$ APPLICATION_DONE:
692$ ENDIF
693$!
694$! Go Back And Get The Next Module.
695$!
696$ GOTO MODULE_NEXT
697$!
698$! All Done With This Module.
699$!
700$ MODULE_DONE:
701$!
702$! Tell The User That We Are All Done.
703$!
704$ WRITE SYS$OUTPUT "All Done..."
705$ EXIT:
706$ GOSUB CLEANUP
707$ EXIT
708$!
709$! Check For The Link Option FIle.
710$!
711$ CHECK_OPT_FILE:
712$!
713$! Check To See If We Need To Make A VAX C Option File.
714$!
715$ IF (COMPILER.EQS."VAXC")
716$ THEN
717$!
718$! Check To See If We Already Have A VAX C Linker Option File.
719$!
720$ IF (F$SEARCH(OPT_FILE).EQS."")
721$ THEN
722$!
723$! We Need A VAX C Linker Option File.
724$!
725$ CREATE 'OPT_FILE'
726$DECK
727!
728! Default System Options File To Link Against
729! The Sharable VAX C Runtime Library.
730!
731SYS$SHARE:VAXCRTL.EXE/SHARE
732$EOD
733$!
734$! End The Option File Check.
735$!
736$ ENDIF
737$!
738$! End The VAXC Check.
739$!
740$ ENDIF
741$!
742$! Check To See If We Need A GNU C Option File.
743$!
744$ IF (COMPILER.EQS."GNUC")
745$ THEN
746$!
747$! Check To See If We Already Have A GNU C Linker Option File.
748$!
749$ IF (F$SEARCH(OPT_FILE).EQS."")
750$ THEN
751$!
752$! We Need A GNU C Linker Option File.
753$!
754$ CREATE 'OPT_FILE'
755$DECK
756!
757! Default System Options File To Link Against
758! The Sharable C Runtime Library.
759!
760GNU_CC:[000000]GCCLIB/LIBRARY
761SYS$SHARE:VAXCRTL/SHARE
762$EOD
763$!
764$! End The Option File Check.
765$!
766$ ENDIF
767$!
768$! End The GNU C Check.
769$!
770$ ENDIF
771$!
772$! Check To See If We Need A DEC C Option File.
773$!
774$ IF (COMPILER.EQS."DECC")
775$ THEN
776$!
777$! Check To See If We Already Have A DEC C Linker Option File.
778$!
779$ IF (F$SEARCH(OPT_FILE).EQS."")
780$ THEN
781$!
782$! Figure Out If We Need A non-VAX Or A VAX Linker Option File.
783$!
784$ IF ARCH .EQS. "VAX"
785$ THEN
786$!
787$! We Need A DEC C Linker Option File For VAX.
788$!
789$ CREATE 'OPT_FILE'
790$DECK
791!
792! Default System Options File To Link Against
793! The Sharable DEC C Runtime Library.
794!
795SYS$SHARE:DECC$SHR.EXE/SHARE
796$EOD
797$!
798$! Else...
799$!
800$ ELSE
801$!
802$! Create The non-VAX Linker Option File.
803$!
804$ CREATE 'OPT_FILE'
805$DECK
806!
807! Default System Options File For non-VAX To Link Against
808! The Sharable C Runtime Library.
809!
810SYS$SHARE:CMA$OPEN_LIB_SHR/SHARE
811SYS$SHARE:CMA$OPEN_RTL/SHARE
812$EOD
813$!
814$! End The DEC C Option File Check.
815$!
816$ ENDIF
817$!
818$! End The Option File Search.
819$!
820$ ENDIF
821$!
822$! End The DEC C Check.
823$!
824$ ENDIF
825$!
826$! Tell The User What Linker Option File We Are Using.
827$!
828$ WRITE SYS$OUTPUT "Using Linker Option File ",OPT_FILE,"."
829$!
830$! Time To RETURN.
831$!
832$ RETURN
833$!
834$! Check The User's Options.
835$!
836$ CHECK_OPTIONS:
837$!
838$! Check To See If P1 Is Blank.
839$!
840$ IF (P1.EQS."ALL")
841$ THEN
842$!
843$! P1 Is Blank, So Build Everything.
844$!
845$ BUILDALL = "TRUE"
846$!
847$! Else...
848$!
849$ ELSE
850$!
851$! Else, Check To See If P1 Has A Valid Argument.
852$!
853$ IF (P1.EQS."LIBRARY").OR.(P1.EQS."APPS")
854$ THEN
855$!
856$! A Valid Argument.
857$!
858$ BUILDALL = P1
859$!
860$! Else...
861$!
862$ ELSE
863$!
864$! Tell The User We Don't Know What They Want.
865$!
866$ WRITE SYS$OUTPUT ""
867$ WRITE SYS$OUTPUT "The Option ",P1," Is Invalid. The Valid Options Are:"
868$ WRITE SYS$OUTPUT ""
869$ WRITE SYS$OUTPUT " ALL : Just Build Everything."
870$ WRITE SYS$OUTPUT " LIBRARY : To Compile Just The [.xxx.EXE.CRYPTO]LIBCRYPTO.OLB Library."
871$ WRITE SYS$OUTPUT " APPS : To Compile Just The [.xxx.EXE.CRYPTO]*.EXE Programs."
872$ WRITE SYS$OUTPUT ""
873$ WRITE SYS$OUTPUT " Where 'xxx' Stands For:"
874$ WRITE SYS$OUTPUT ""
875$ WRITE SYS$OUTPUT " ALPHA[64]: Alpha Architecture."
876$ WRITE SYS$OUTPUT " IA64[64] : IA64 Architecture."
877$ WRITE SYS$OUTPUT " VAX : VAX Architecture."
878$ WRITE SYS$OUTPUT ""
879$!
880$! Time To EXIT.
881$!
882$ EXIT
883$!
884$! End The Valid Argument Check.
885$!
886$ ENDIF
887$!
888$! End The P1 Check.
889$!
890$ ENDIF
891$!
892$! Check To See If P2 Is Blank.
893$!
894$ IF (P2.EQS."NODEBUG")
895$ THEN
896$!
897$! P2 Is NODEBUG, So Compile Without The Debugger Information.
898$!
899$ DEBUGGER = "NODEBUG"
900$ LINKMAP = "NOMAP"
901$ TRACEBACK = "NOTRACEBACK"
902$ GCC_OPTIMIZE = "OPTIMIZE"
903$ CC_OPTIMIZE = "OPTIMIZE"
904$ MACRO_OPTIMIZE = "OPTIMIZE"
905$ WRITE SYS$OUTPUT "No Debugger Information Will Be Produced During Compile."
906$ WRITE SYS$OUTPUT "Compiling With Compiler Optimization."
907$ ELSE
908$!
909$! Check To See If We Are To Compile With Debugger Information.
910$!
911$ IF (P2.EQS."DEBUG")
912$ THEN
913$!
914$! Compile With Debugger Information.
915$!
916$ DEBUGGER = "DEBUG"
917$ LINKMAP = "MAP"
918$ TRACEBACK = "TRACEBACK"
919$ GCC_OPTIMIZE = "NOOPTIMIZE"
920$ CC_OPTIMIZE = "NOOPTIMIZE"
921$ MACRO_OPTIMIZE = "NOOPTIMIZE"
922$ WRITE SYS$OUTPUT "Debugger Information Will Be Produced During Compile."
923$ WRITE SYS$OUTPUT "Compiling Without Compiler Optimization."
924$ ELSE
925$!
926$! They Entered An Invalid Option.
927$!
928$ WRITE SYS$OUTPUT ""
929$ WRITE SYS$OUTPUT "The Option ",P2," Is Invalid. The Valid Options Are:"
930$ WRITE SYS$OUTPUT ""
931$ WRITE SYS$OUTPUT " DEBUG : Compile With The Debugger Information."
932$ WRITE SYS$OUTPUT " NODEBUG : Compile Without The Debugger Information."
933$ WRITE SYS$OUTPUT ""
934$!
935$! Time To EXIT.
936$!
937$ EXIT
938$!
939$! End The Valid Argument Check.
940$!
941$ ENDIF
942$!
943$! End The P2 Check.
944$!
945$ ENDIF
946$!
947$! Special Threads For OpenVMS v7.1 Or Later
948$!
949$! Written By: Richard Levitte
950$! richard@levitte.org
951$!
952$!
953$! Check To See If We Have A Option For P5.
954$!
955$ IF (P5.EQS."")
956$ THEN
957$!
958$! Get The Version Of VMS We Are Using.
959$!
960$ ISSEVEN :=
961$ TMP = F$ELEMENT(0,"-",F$EXTRACT(1,4,F$GETSYI("VERSION")))
962$ TMP = F$INTEGER(F$ELEMENT(0,".",TMP)+F$ELEMENT(1,".",TMP))
963$!
964$! Check To See If The VMS Version Is v7.1 Or Later.
965$!
966$ IF (TMP.GE.71)
967$ THEN
968$!
969$! We Have OpenVMS v7.1 Or Later, So Use The Special Threads.
970$!
971$ ISSEVEN := ,PTHREAD_USE_D4
972$!
973$! End The VMS Version Check.
974$!
975$ ENDIF
976$!
977$! End The P5 Check.
978$!
979$ ENDIF
980$!
981$! Check P7 (POINTER_SIZE).
982$!
983$ IF (P7 .NES. "") .AND. (ARCH .NES. "VAX")
984$ THEN
985$!
986$ IF (P7 .EQS. "32")
987$ THEN
988$ POINTER_SIZE = " /POINTER_SIZE=32"
989$ ELSE
990$ POINTER_SIZE = F$EDIT( P7, "COLLAPSE, UPCASE")
991$ IF ((POINTER_SIZE .EQS. "64") .OR. -
992 (POINTER_SIZE .EQS. "64=") .OR. -
993 (POINTER_SIZE .EQS. "64=ARGV"))
994$ THEN
995$ ARCHD = ARCH+ "_64"
996$ LIB32 = ""
997$ POINTER_SIZE = " /POINTER_SIZE=64"
998$ ELSE
999$!
1000$! Tell The User Entered An Invalid Option.
1001$!
1002$ WRITE SYS$OUTPUT ""
1003$ WRITE SYS$OUTPUT "The Option ", P7, -
1004 " Is Invalid. The Valid Options Are:"
1005$ WRITE SYS$OUTPUT ""
1006$ WRITE SYS$OUTPUT -
1007 " """" : Compile with default (short) pointers."
1008$ WRITE SYS$OUTPUT -
1009 " 32 : Compile with 32-bit (short) pointers."
1010$ WRITE SYS$OUTPUT -
1011 " 64 : Compile with 64-bit (long) pointers (auto ARGV)."
1012$ WRITE SYS$OUTPUT -
1013 " 64= : Compile with 64-bit (long) pointers (no ARGV)."
1014$ WRITE SYS$OUTPUT -
1015 " 64=ARGV : Compile with 64-bit (long) pointers (ARGV)."
1016$ WRITE SYS$OUTPUT ""
1017$!
1018$! Time To EXIT.
1019$!
1020$ EXIT
1021$!
1022$ ENDIF
1023$!
1024$ ENDIF
1025$!
1026$! End The P7 (POINTER_SIZE) Check.
1027$!
1028$ ENDIF
1029$!
1030$! Set basic C compiler /INCLUDE directories.
1031$!
1032$ CC_INCLUDES = "SYS$DISK:[.''ARCHD'],SYS$DISK:[],SYS$DISK:[-],"+ -
1033 "SYS$DISK:[.ENGINE.VENDOR_DEFNS],SYS$DISK:[.MODES],SYS$DISK:[.ASN1],SYS$DISK:[.EVP]"
1034$!
1035$! Check To See If P3 Is Blank.
1036$!
1037$ IF (P3.EQS."")
1038$ THEN
1039$!
1040$! O.K., The User Didn't Specify A Compiler, Let's Try To
1041$! Find Out Which One To Use.
1042$!
1043$! Check To See If We Have GNU C.
1044$!
1045$ IF (F$TRNLNM("GNU_CC").NES."")
1046$ THEN
1047$!
1048$! Looks Like GNUC, Set To Use GNUC.
1049$!
1050$ P3 = "GNUC"
1051$!
1052$! Else...
1053$!
1054$ ELSE
1055$!
1056$! Check To See If We Have VAXC Or DECC.
1057$!
1058$ IF (ARCH.NES."VAX").OR.(F$TRNLNM("DECC$CC_DEFAULT").NES."")
1059$ THEN
1060$!
1061$! Looks Like DECC, Set To Use DECC.
1062$!
1063$ P3 = "DECC"
1064$!
1065$! Else...
1066$!
1067$ ELSE
1068$!
1069$! Looks Like VAXC, Set To Use VAXC.
1070$!
1071$ P3 = "VAXC"
1072$!
1073$! End The VAXC Compiler Check.
1074$!
1075$ ENDIF
1076$!
1077$! End The DECC & VAXC Compiler Check.
1078$!
1079$ ENDIF
1080$!
1081$! End The Compiler Check.
1082$!
1083$ ENDIF
1084$!
1085$! Check To See If We Have A Option For P4.
1086$!
1087$ IF (P4.EQS."")
1088$ THEN
1089$!
1090$! Find out what socket library we have available
1091$!
1092$ IF F$PARSE("SOCKETSHR:") .NES. ""
1093$ THEN
1094$!
1095$! We have SOCKETSHR, and it is my opinion that it's the best to use.
1096$!
1097$ P4 = "SOCKETSHR"
1098$!
1099$! Tell the user
1100$!
1101$ WRITE SYS$OUTPUT "Using SOCKETSHR for TCP/IP"
1102$!
1103$! Else, let's look for something else
1104$!
1105$ ELSE
1106$!
1107$! Like UCX (the reason to do this before Multinet is that the UCX
1108$! emulation is easier to use...)
1109$!
1110$ IF F$TRNLNM("UCX$IPC_SHR") .NES. "" -
1111 .OR. F$PARSE("SYS$SHARE:UCX$IPC_SHR.EXE") .NES. "" -
1112 .OR. F$PARSE("SYS$LIBRARY:UCX$IPC.OLB") .NES. ""
1113$ THEN
1114$!
1115$! Last resort: a UCX or UCX-compatible library
1116$!
1117$ P4 = "UCX"
1118$!
1119$! Tell the user
1120$!
1121$ WRITE SYS$OUTPUT "Using UCX or an emulation thereof for TCP/IP"
1122$!
1123$! That was all...
1124$!
1125$ ENDIF
1126$ ENDIF
1127$ ENDIF
1128$!
1129$! Set Up Initial CC Definitions, Possibly With User Ones
1130$!
1131$ CCDEFS = "TCPIP_TYPE_''P4',DSO_VMS"
1132$ IF F$TYPE(USER_CCDEFS) .NES. "" THEN CCDEFS = CCDEFS + "," + USER_CCDEFS
1133$ CCEXTRAFLAGS = ""
1134$ IF F$TYPE(USER_CCFLAGS) .NES. "" THEN CCEXTRAFLAGS = USER_CCFLAGS
1135$ CCDISABLEWARNINGS = "" !!! "LONGLONGTYPE,LONGLONGSUFX,FOUNDCR"
1136$ IF F$TYPE(USER_CCDISABLEWARNINGS) .NES. "" THEN -
1137 CCDISABLEWARNINGS = CCDISABLEWARNINGS + "," + USER_CCDISABLEWARNINGS
1138$!
1139$! Check To See If We Have A ZLIB Option.
1140$!
1141$ ZLIB = P8
1142$ IF (ZLIB .NES. "")
1143$ THEN
1144$!
1145$! Check for expected ZLIB files.
1146$!
1147$ err = 0
1148$ file1 = f$parse( "zlib.h", ZLIB, , , "SYNTAX_ONLY")
1149$ if (f$search( file1) .eqs. "")
1150$ then
1151$ WRITE SYS$OUTPUT ""
1152$ WRITE SYS$OUTPUT "The Option ", ZLIB, " Is Invalid."
1153$ WRITE SYS$OUTPUT " Can't find header: ''file1'"
1154$ err = 1
1155$ endif
1156$ file1 = f$parse( "A.;", ZLIB)- "A.;"
1157$!
1158$ file2 = f$parse( ZLIB, "libz.olb", , , "SYNTAX_ONLY")
1159$ if (f$search( file2) .eqs. "")
1160$ then
1161$ if (err .eq. 0)
1162$ then
1163$ WRITE SYS$OUTPUT ""
1164$ WRITE SYS$OUTPUT "The Option ", ZLIB, " Is Invalid."
1165$ endif
1166$ WRITE SYS$OUTPUT " Can't find library: ''file2'"
1167$ WRITE SYS$OUTPUT ""
1168$ err = err+ 2
1169$ endif
1170$ if (err .eq. 1)
1171$ then
1172$ WRITE SYS$OUTPUT ""
1173$ endif
1174$!
1175$ if (err .ne. 0)
1176$ then
1177$ EXIT
1178$ endif
1179$!
1180$ CCDEFS = """ZLIB=1"", "+ CCDEFS
1181$ CC_INCLUDES = CC_INCLUDES+ ", "+ file1
1182$ ZLIB_LIB = ", ''file2' /library"
1183$!
1184$! Print info
1185$!
1186$ WRITE SYS$OUTPUT "ZLIB library spec: ", file2
1187$!
1188$! End The ZLIB Check.
1189$!
1190$ ENDIF
1191$!
1192$! Check To See If The User Entered A Valid Parameter.
1193$!
1194$ IF (P3.EQS."VAXC").OR.(P3.EQS."DECC").OR.(P3.EQS."GNUC")
1195$ THEN
1196$!
1197$! Check To See If The User Wanted DECC.
1198$!
1199$ IF (P3.EQS."DECC")
1200$ THEN
1201$!
1202$! Looks Like DECC, Set To Use DECC.
1203$!
1204$ COMPILER = "DECC"
1205$!
1206$! Tell The User We Are Using DECC.
1207$!
1208$ WRITE SYS$OUTPUT "Using DECC 'C' Compiler."
1209$!
1210$! Use DECC...
1211$!
1212$ CC = "CC"
1213$ IF ARCH.EQS."VAX" .AND. F$TRNLNM("DECC$CC_DEFAULT").NES."/DECC" -
1214 THEN CC = "CC/DECC"
1215$ CC = CC + " /''CC_OPTIMIZE' /''DEBUGGER' /STANDARD=RELAXED"+ -
1216 "''POINTER_SIZE' /NOLIST /PREFIX=ALL" + -
1217 " /INCLUDE=(''CC_INCLUDES')"+ -
1218 CCEXTRAFLAGS
1219$!
1220$! Define The Linker Options File Name.
1221$!
1222$ OPT_FILE = "VAX_DECC_OPTIONS.OPT"
1223$!
1224$! End DECC Check.
1225$!
1226$ ENDIF
1227$!
1228$! Check To See If We Are To Use VAXC.
1229$!
1230$ IF (P3.EQS."VAXC")
1231$ THEN
1232$!
1233$! Looks Like VAXC, Set To Use VAXC.
1234$!
1235$ COMPILER = "VAXC"
1236$!
1237$! Tell The User We Are Using VAX C.
1238$!
1239$ WRITE SYS$OUTPUT "Using VAXC 'C' Compiler."
1240$!
1241$! Compile Using VAXC.
1242$!
1243$ CC = "CC"
1244$ IF ARCH.NES."VAX"
1245$ THEN
1246$ WRITE SYS$OUTPUT "There is no VAX C on ''ARCH'!"
1247$ EXIT
1248$ ENDIF
1249$ IF F$TRNLNM("DECC$CC_DEFAULT").EQS."/DECC" THEN CC = "CC/VAXC"
1250$ CC = CC + "/''CC_OPTIMIZE'/''DEBUGGER'/NOLIST" + -
1251 "/INCLUDE=(''CC_INCLUDES')"+ -
1252 CCEXTRAFLAGS
1253$ CCDEFS = """VAXC""," + CCDEFS
1254$!
1255$! Define <sys> As SYS$COMMON:[SYSLIB]
1256$!
1257$ DEFINE/NOLOG SYS SYS$COMMON:[SYSLIB]
1258$!
1259$! Define The Linker Options File Name.
1260$!
1261$ OPT_FILE = "VAX_VAXC_OPTIONS.OPT"
1262$!
1263$! End VAXC Check
1264$!
1265$ ENDIF
1266$!
1267$! Check To See If We Are To Use GNU C.
1268$!
1269$ IF (P3.EQS."GNUC")
1270$ THEN
1271$!
1272$! Looks Like GNUC, Set To Use GNUC.
1273$!
1274$ COMPILER = "GNUC"
1275$!
1276$! Tell The User We Are Using GNUC.
1277$!
1278$ WRITE SYS$OUTPUT "Using GNU 'C' Compiler."
1279$!
1280$! Use GNU C...
1281$!
1282$ CC = "GCC/NOCASE_HACK/''GCC_OPTIMIZE'/''DEBUGGER'/NOLIST" + -
1283 "/INCLUDE=(''CC_INCLUDES')"+ -
1284 CCEXTRAFLAGS
1285$!
1286$! Define The Linker Options File Name.
1287$!
1288$ OPT_FILE = "VAX_GNUC_OPTIONS.OPT"
1289$!
1290$! End The GNU C Check.
1291$!
1292$ ENDIF
1293$!
1294$! Set up default defines
1295$!
1296$ CCDEFS = """FLAT_INC=1""," + CCDEFS
1297$!
1298$! Finish up the definition of CC.
1299$!
1300$ IF COMPILER .EQS. "DECC"
1301$ THEN
1302$ IF CCDISABLEWARNINGS .EQS. ""
1303$ THEN
1304$ CC4DISABLEWARNINGS = "DOLLARID"
1305$ CC6DISABLEWARNINGS = "MIXLINKAGE"
1306$ ELSE
1307$ CC4DISABLEWARNINGS = CCDISABLEWARNINGS + ",DOLLARID"
1308$ CC6DISABLEWARNINGS = CCDISABLEWARNINGS + ",MIXLINKAGE"
1309$ CCDISABLEWARNINGS = " /WARNING=(DISABLE=(" + CCDISABLEWARNINGS + "))"
1310$ ENDIF
1311$ CC4DISABLEWARNINGS = " /WARNING=(DISABLE=(" + CC4DISABLEWARNINGS + "))"
1312$ CC6DISABLEWARNINGS = " /WARNING=(DISABLE=(" + CC6DISABLEWARNINGS + "))"
1313$ ELSE
1314$ CCDISABLEWARNINGS = ""
1315$ CC4DISABLEWARNINGS = ""
1316$ CC6DISABLEWARNINGS = ""
1317$ ENDIF
1318$ CC3 = CC + " /DEFINE=(" + CCDEFS + ISSEVEN + ")" + CCDISABLEWARNINGS
1319$ CC = CC + " /DEFINE=(" + CCDEFS + ")" + CCDISABLEWARNINGS
1320$ IF ARCH .EQS. "VAX" .AND. COMPILER .EQS. "DECC" .AND. P2 .NES. "DEBUG"
1321$ THEN
1322$ CC5 = CC + " /OPTIMIZE=NODISJOINT"
1323$ CC5_DIFFERENT = 1
1324$ ELSE
1325$ CC5 = CC
1326$ CC5_DIFFERENT = 0
1327$ ENDIF
1328$ CC4 = CC - CCDISABLEWARNINGS + CC4DISABLEWARNINGS
1329$ CC6 = CC - CCDISABLEWARNINGS + CC6DISABLEWARNINGS
1330$!
1331$! Show user the result
1332$!
1333$ WRITE/SYMBOL SYS$OUTPUT "Main C Compiling Command: ",CC
1334$!
1335$! Else The User Entered An Invalid Argument.
1336$!
1337$ ELSE
1338$!
1339$! Tell The User We Don't Know What They Want.
1340$!
1341$ WRITE SYS$OUTPUT ""
1342$ WRITE SYS$OUTPUT "The Option ",P3," Is Invalid. The Valid Options Are:"
1343$ WRITE SYS$OUTPUT ""
1344$ WRITE SYS$OUTPUT " VAXC : To Compile With VAX C."
1345$ WRITE SYS$OUTPUT " DECC : To Compile With DEC C."
1346$ WRITE SYS$OUTPUT " GNUC : To Compile With GNU C."
1347$ WRITE SYS$OUTPUT ""
1348$!
1349$! Time To EXIT.
1350$!
1351$ EXIT
1352$!
1353$! End The Valid Argument Check.
1354$!
1355$ ENDIF
1356$!
1357$! Build a MACRO command for the architecture at hand
1358$!
1359$ IF ARCH .EQS. "VAX" THEN MACRO = "MACRO/''DEBUGGER'"
1360$ IF ARCH .NES. "VAX" THEN MACRO = "MACRO/MIGRATION/''DEBUGGER'/''MACRO_OPTIMIZE'"
1361$!
1362$! Show user the result
1363$!
1364$ WRITE/SYMBOL SYS$OUTPUT "Main MACRO Compiling Command: ",MACRO
1365$!
1366$! Time to check the contents, and to make sure we get the correct library.
1367$!
1368$ IF P4.EQS."SOCKETSHR" .OR. P4.EQS."MULTINET" .OR. P4.EQS."UCX" -
1369 .OR. P4.EQS."TCPIP" .OR. P4.EQS."NONE"
1370$ THEN
1371$!
1372$! Check to see if SOCKETSHR was chosen
1373$!
1374$ IF P4.EQS."SOCKETSHR"
1375$ THEN
1376$!
1377$! Set the library to use SOCKETSHR
1378$!
1379$ TCPIP_LIB = ",SYS$DISK:[-.VMS]SOCKETSHR_SHR.OPT /OPTIONS"
1380$!
1381$! Done with SOCKETSHR
1382$!
1383$ ENDIF
1384$!
1385$! Check to see if MULTINET was chosen
1386$!
1387$ IF P4.EQS."MULTINET"
1388$ THEN
1389$!
1390$! Set the library to use UCX emulation.
1391$!
1392$ P4 = "UCX"
1393$!
1394$! Done with MULTINET
1395$!
1396$ ENDIF
1397$!
1398$! Check to see if UCX was chosen
1399$!
1400$ IF P4.EQS."UCX"
1401$ THEN
1402$!
1403$! Set the library to use UCX.
1404$!
1405$ TCPIP_LIB = ",SYS$DISK:[-.VMS]UCX_SHR_DECC.OPT /OPTIONS"
1406$ IF F$TRNLNM("UCX$IPC_SHR") .NES. ""
1407$ THEN
1408$ TCPIP_LIB = ",SYS$DISK:[-.VMS]UCX_SHR_DECC_LOG.OPT /OPTIONS"
1409$ ELSE
1410$ IF COMPILER .NES. "DECC" .AND. ARCH .EQS. "VAX" THEN -
1411 TCPIP_LIB = ",SYS$DISK:[-.VMS]UCX_SHR_VAXC.OPT /OPTIONS"
1412$ ENDIF
1413$!
1414$! Done with UCX
1415$!
1416$ ENDIF
1417$!
1418$! Check to see if TCPIP was chosen
1419$!
1420$ IF P4.EQS."TCPIP"
1421$ THEN
1422$!
1423$! Set the library to use TCPIP (post UCX).
1424$!
1425$ TCPIP_LIB = ",SYS$DISK:[-.VMS]TCPIP_SHR_DECC.OPT /OPTIONS"
1426$!
1427$! Done with TCPIP
1428$!
1429$ ENDIF
1430$!
1431$! Check to see if NONE was chosen
1432$!
1433$ IF P4.EQS."NONE"
1434$ THEN
1435$!
1436$! Do not use a TCPIP library.
1437$!
1438$ TCPIP_LIB = ""
1439$!
1440$! Done with TCPIP
1441$!
1442$ ENDIF
1443$!
1444$! Print info
1445$!
1446$ WRITE SYS$OUTPUT "TCP/IP library spec: ", TCPIP_LIB- ","
1447$!
1448$! Else The User Entered An Invalid Argument.
1449$!
1450$ ELSE
1451$!
1452$! Tell The User We Don't Know What They Want.
1453$!
1454$ WRITE SYS$OUTPUT ""
1455$ WRITE SYS$OUTPUT "The Option ",P4," Is Invalid. The Valid Options Are:"
1456$ WRITE SYS$OUTPUT ""
1457$ WRITE SYS$OUTPUT " SOCKETSHR : To link with SOCKETSHR TCP/IP library."
1458$ WRITE SYS$OUTPUT " UCX : To link with UCX TCP/IP library."
1459$ WRITE SYS$OUTPUT " TCPIP : To link with TCPIP (post UCX) TCP/IP library."
1460$ WRITE SYS$OUTPUT ""
1461$!
1462$! Time To EXIT.
1463$!
1464$ EXIT
1465$!
1466$! Done with TCP/IP libraries
1467$!
1468$ ENDIF
1469$!
1470$! Check if the user wanted to compile just a subset of all the encryption
1471$! methods.
1472$!
1473$ IF P6 .NES. ""
1474$ THEN
1475$ ENCRYPT_TYPES = P6
1476$ ENDIF
1477$!
1478$! Time To RETURN...
1479$!
1480$ RETURN
1481$!
1482$ INITIALISE:
1483$!
1484$! Save old value of the logical name OPENSSL
1485$!
1486$ __SAVE_OPENSSL = F$TRNLNM("OPENSSL","LNM$PROCESS_TABLE")
1487$!
1488$! Save directory information
1489$!
1490$ __HERE = F$PARSE(F$PARSE("A.;",F$ENVIRONMENT("PROCEDURE"))-"A.;","[]A.;") - "A.;"
1491$ __HERE = F$EDIT(__HERE,"UPCASE")
1492$ __TOP = __HERE - "CRYPTO]"
1493$ __INCLUDE = __TOP + "INCLUDE.OPENSSL]"
1494$!
1495$! Set up the logical name OPENSSL to point at the include directory
1496$!
1497$ DEFINE OPENSSL/NOLOG '__INCLUDE'
1498$!
1499$! Done
1500$!
1501$ RETURN
1502$!
1503$ CLEANUP:
1504$!
1505$! Restore the logical name OPENSSL if it had a value
1506$!
1507$ IF __SAVE_OPENSSL .EQS. ""
1508$ THEN
1509$ DEASSIGN OPENSSL
1510$ ELSE
1511$ DEFINE/NOLOG OPENSSL '__SAVE_OPENSSL'
1512$ ENDIF
1513$!
1514$! Done
1515$!
1516$ RETURN
diff --git a/src/lib/libcrypto/crypto.h b/src/lib/libcrypto/crypto.h
index f92fc5182d..6aeda0a9ac 100644
--- a/src/lib/libcrypto/crypto.h
+++ b/src/lib/libcrypto/crypto.h
@@ -488,10 +488,10 @@ void CRYPTO_get_mem_debug_functions(void (**m)(void *,int,const char *,int,int),
488 long (**go)(void)); 488 long (**go)(void));
489 489
490void *CRYPTO_malloc_locked(int num, const char *file, int line); 490void *CRYPTO_malloc_locked(int num, const char *file, int line);
491void CRYPTO_free_locked(void *ptr); 491void CRYPTO_free_locked(void *);
492void *CRYPTO_malloc(int num, const char *file, int line); 492void *CRYPTO_malloc(int num, const char *file, int line);
493char *CRYPTO_strdup(const char *str, const char *file, int line); 493char *CRYPTO_strdup(const char *str, const char *file, int line);
494void CRYPTO_free(void *ptr); 494void CRYPTO_free(void *);
495void *CRYPTO_realloc(void *addr,int num, const char *file, int line); 495void *CRYPTO_realloc(void *addr,int num, const char *file, int line);
496void *CRYPTO_realloc_clean(void *addr,int old_num,int num,const char *file, 496void *CRYPTO_realloc_clean(void *addr,int old_num,int num,const char *file,
497 int line); 497 int line);
@@ -574,13 +574,6 @@ void OPENSSL_init(void);
574#define fips_cipher_abort(alg) while(0) 574#define fips_cipher_abort(alg) while(0)
575#endif 575#endif
576 576
577/* CRYPTO_memcmp returns zero iff the |len| bytes at |a| and |b| are equal. It
578 * takes an amount of time dependent on |len|, but independent of the contents
579 * of |a| and |b|. Unlike memcmp, it cannot be used to put elements into a
580 * defined order as the return value when a != b is undefined, other than to be
581 * non-zero. */
582int CRYPTO_memcmp(const void *a, const void *b, size_t len);
583
584/* BEGIN ERROR CODES */ 577/* BEGIN ERROR CODES */
585/* The following lines are auto generated by the script mkerr.pl. Any changes 578/* The following lines are auto generated by the script mkerr.pl. Any changes
586 * made after this point may be overwritten when the script is next run. 579 * made after this point may be overwritten when the script is next run.
diff --git a/src/lib/libcrypto/crypto/Makefile b/src/lib/libcrypto/crypto/Makefile
new file mode 100644
index 0000000000..d95ac156ec
--- /dev/null
+++ b/src/lib/libcrypto/crypto/Makefile
@@ -0,0 +1,573 @@
1# $OpenBSD: Makefile,v 1.1 2014/04/11 22:51:53 miod Exp $
2
3LIB= crypto
4
5SSL_SRC= ${.CURDIR}/../../libssl/src
6LCRYPTO_SRC= ${SSL_SRC}/crypto
7
8# arm and sh default to little endian, mips defaults to big endian
9.if ${MACHINE_ARCH} == "alpha" || ${MACHINE_ARCH} == "amd64" || \
10 ${MACHINE_ARCH} == "arm" || ${MACHINE_ARCH} == "i386" || \
11 ${MACHINE_ARCH} == "mips64el" || ${MACHINE_ARCH} == "sh" || \
12 ${MACHINE_ARCH} == "vax"
13CFLAGS+= -DL_ENDIAN
14.else
15CFLAGS+= -DB_ENDIAN
16.endif
17
18.include <bsd.own.mk> # for 'NOPIC' definition
19.if !defined(NOPIC)
20CFLAGS+= -DDSO_DLFCN -DHAVE_DLFCN_H
21.endif
22
23.if ${MACHINE_ARCH} == "sparc"
24PICFLAG=-fPIC
25.endif
26
27CFLAGS+= -DTERMIOS -DANSI_SOURCE -DNO_ERR -DNO_WINDOWS_BRAINDEATH
28# Hardware engines
29CFLAGS+= -DOPENSSL_NO_HW_4758_CCA
30CFLAGS+= -DOPENSSL_NO_HW_AEP
31CFLAGS+= -DOPENSSL_NO_HW_ATALLA
32CFLAGS+= -DOPENSSL_NO_CAPIENG
33CFLAGS+= -DOPENSSL_NO_HW_CSWIFT
34CFLAGS+= -DOPENSSL_NO_HW_NCIPHER
35CFLAGS+= -DOPENSSL_NO_HW_NURON
36CFLAGS+= -DOPENSSL_NO_HW_PADLOCK # XXX enable this?
37CFLAGS+= -DOPENSSL_NO_HW_SUREWARE
38CFLAGS+= -DOPENSSL_NO_HW_UBSEC
39
40CFLAGS+= -I${SSL_SRC}
41CFLAGS+= -I${LCRYPTO_SRC}
42CFLAGS+= -I${LCRYPTO_SRC}/modes -I${LCRYPTO_SRC}/asn1 -I${LCRYPTO_SRC}/evp
43
44# crypto/
45SRCS+= cryptlib.c mem.c mem_dbg.c cversion.c ex_data.c cpt_err.c
46SRCS+= ebcdic.c uid.c o_time.c o_str.c o_dir.c o_fips.c o_init.c fips_ers.c
47
48# aes/
49SRCS+= aes_misc.c aes_ecb.c aes_cfb.c aes_ofb.c
50SRCS+= aes_ctr.c aes_ige.c aes_wrap.c
51
52# asn1/
53SRCS+= a_object.c a_bitstr.c a_utctm.c a_gentm.c a_time.c a_int.c a_octet.c
54SRCS+= a_print.c a_type.c a_set.c a_dup.c a_d2i_fp.c a_i2d_fp.c
55SRCS+= a_enum.c a_utf8.c a_sign.c a_digest.c a_verify.c a_mbstr.c a_strex.c
56SRCS+= x_algor.c x_val.c x_pubkey.c x_sig.c x_req.c x_attrib.c x_bignum.c
57SRCS+= x_long.c x_name.c x_x509.c x_x509a.c x_crl.c x_info.c x_spki.c nsseq.c
58SRCS+= x_nx509.c d2i_pu.c d2i_pr.c i2d_pu.c i2d_pr.c
59SRCS+= t_req.c t_x509.c t_x509a.c t_crl.c t_pkey.c t_spki.c t_bitst.c
60SRCS+= tasn_new.c tasn_fre.c tasn_enc.c tasn_dec.c tasn_utl.c tasn_typ.c
61SRCS+= tasn_prn.c ameth_lib.c
62SRCS+= f_int.c f_string.c n_pkey.c
63SRCS+= f_enum.c x_pkey.c a_bool.c x_exten.c bio_asn1.c bio_ndef.c asn_mime.c
64SRCS+= asn1_gen.c asn1_par.c asn1_lib.c asn1_err.c a_bytes.c a_strnid.c
65SRCS+= evp_asn1.c asn_pack.c p5_pbe.c p5_pbev2.c p8_pkey.c asn_moid.c
66
67# bf/
68SRCS+= bf_skey.c bf_ecb.c bf_cfb64.c bf_ofb64.c
69
70# bio/
71SRCS+= bio_lib.c bio_cb.c bio_err.c
72SRCS+= bss_mem.c bss_null.c bss_fd.c
73SRCS+= bss_file.c bss_sock.c bss_conn.c
74SRCS+= bf_null.c bf_buff.c b_print.c b_dump.c
75SRCS+= b_sock.c bss_acpt.c bf_nbio.c bss_log.c bss_bio.c
76SRCS+= bss_dgram.c
77
78# bn/
79SRCS+= bn_add.c bn_div.c bn_exp.c bn_lib.c bn_ctx.c bn_mul.c bn_mod.c
80SRCS+= bn_print.c bn_rand.c bn_shift.c bn_word.c bn_blind.c
81SRCS+= bn_kron.c bn_sqrt.c bn_gcd.c bn_prime.c bn_err.c bn_sqr.c
82SRCS+= bn_recp.c bn_mont.c bn_mpi.c bn_exp2.c bn_gf2m.c bn_nist.c
83SRCS+= bn_depr.c bn_const.c bn_x931p.c
84
85# buffer/
86SRCS+= buffer.c buf_err.c buf_str.c
87
88# camellia/
89#SRCS+= cmll_ecb.c cmll_ofb.c cmll_cfb.c cmll_ctr.c cmll_utl.c
90
91# cast/
92SRCS+= c_skey.c c_ecb.c c_enc.c c_cfb64.c c_ofb64.c
93
94# cmac/
95SRCS+= cmac.c cm_ameth.c cm_pmeth.c
96
97# cms/
98#SRCS+= cms_lib.c cms_asn1.c cms_att.c cms_io.c cms_smime.c cms_err.c
99#SRCS+= cms_sd.c cms_dd.c cms_cd.c cms_env.c cms_enc.c cms_ess.c
100#SRCS+= cms_pwri.c
101
102# comp/
103SRCS+= comp_lib.c comp_err.c c_rle.c c_zlib.c
104
105# conf/
106SRCS+= conf_err.c conf_lib.c conf_api.c conf_def.c conf_mod.c
107SRCS+= conf_mall.c conf_sap.c
108
109# des/
110SRCS+= cbc_cksm.c cbc_enc.c cfb64enc.c cfb_enc.c
111SRCS+= ecb3_enc.c ecb_enc.c enc_read.c enc_writ.c
112SRCS+= fcrypt.c ofb64enc.c ofb_enc.c pcbc_enc.c
113SRCS+= qud_cksm.c rand_key.c rpc_enc.c set_key.c xcbc_enc.c
114SRCS+= str2key.c cfb64ede.c ofb64ede.c ede_cbcm_enc.c des_old.c des_old2.c
115SRCS+= read2pwd.c
116
117# dh/
118SRCS+= dh_asn1.c dh_gen.c dh_key.c dh_lib.c dh_check.c dh_err.c dh_depr.c
119SRCS+= dh_ameth.c dh_pmeth.c dh_prn.c
120
121# dsa/
122SRCS+= dsa_gen.c dsa_key.c dsa_lib.c dsa_asn1.c dsa_vrf.c dsa_sign.c
123SRCS+= dsa_err.c dsa_ossl.c dsa_depr.c dsa_ameth.c dsa_pmeth.c dsa_prn.c
124
125# dso/
126SRCS+= dso_dl.c dso_dlfcn.c dso_err.c dso_lib.c dso_null.c
127SRCS+= dso_openssl.c dso_win32.c dso_vms.c dso_beos.c
128
129# ec/
130SRCS+= ec_lib.c ecp_smpl.c ecp_mont.c ecp_nist.c ec_cvt.c ec_mult.c
131SRCS+= ec_err.c ec_curve.c ec_check.c ec_print.c ec_asn1.c ec_key.c
132SRCS+= ec2_smpl.c ec2_mult.c ec_ameth.c ec_pmeth.c eck_prn.c
133SRCS+= ecp_nistp224.c ecp_nistp256.c ecp_nistp521.c ecp_nistputil.c
134SRCS+= ecp_oct.c ec2_oct.c ec_oct.c
135
136# ecdh/
137SRCS+= ech_lib.c ech_ossl.c ech_key.c ech_err.c
138
139# ecdsa/
140SRCS+= ecs_lib.c ecs_asn1.c ecs_ossl.c ecs_sign.c ecs_vrf.c ecs_err.c
141
142# engine/
143SRCS+= eng_err.c eng_lib.c eng_list.c eng_init.c eng_ctrl.c
144SRCS+= eng_table.c eng_pkey.c eng_fat.c eng_all.c
145SRCS+= tb_rsa.c tb_dsa.c tb_ecdsa.c tb_dh.c tb_ecdh.c tb_rand.c tb_store.c
146SRCS+= tb_cipher.c tb_digest.c tb_pkmeth.c tb_asnmth.c
147SRCS+= eng_openssl.c eng_cnf.c eng_dyn.c hw_cryptodev.c
148SRCS+= eng_rsax.c eng_rdrand.c
149# XXX unnecessary? handled in EVP now...
150# SRCS+= eng_aesni.c # local addition
151
152# err/
153SRCS+= err.c err_all.c err_prn.c
154
155# evp/
156SRCS+= encode.c digest.c evp_enc.c evp_key.c evp_acnf.c
157SRCS+= e_des.c e_bf.c e_idea.c e_des3.c e_camellia.c
158SRCS+= e_rc4.c e_aes.c names.c e_seed.c
159SRCS+= e_xcbc_d.c e_rc2.c e_cast.c e_rc5.c
160SRCS+= m_null.c m_md2.c m_md4.c m_md5.c m_sha.c m_sha1.c m_wp.c
161SRCS+= m_dss.c m_dss1.c m_mdc2.c m_ripemd.c m_ecdsa.c
162SRCS+= p_open.c p_seal.c p_sign.c p_verify.c p_lib.c p_enc.c p_dec.c
163SRCS+= bio_md.c bio_b64.c bio_enc.c evp_err.c e_null.c
164SRCS+= c_all.c c_allc.c c_alld.c evp_lib.c bio_ok.c
165SRCS+= evp_pkey.c evp_pbe.c p5_crpt.c p5_crpt2.c
166SRCS+= e_old.c pmeth_lib.c pmeth_fn.c pmeth_gn.c m_sigver.c evp_fips.c
167SRCS+= e_aes_cbc_hmac_sha1.c e_rc4_hmac_md5.c
168
169# hmac/
170SRCS+= hmac.c hm_ameth.c hm_pmeth.c
171
172# idea/
173SRCS+= i_cbc.c i_cfb64.c i_ofb64.c i_ecb.c i_skey.c
174
175# jpake/
176#SRCS+= jpake.c jpake_err.c
177
178# krb5/
179SRCS+= krb5_asn.c
180
181# lhash/
182SRCS+= lhash.c lh_stats.c
183
184# md2
185##SRCS+= md2_dgst.c md2_one.c
186
187# md4/
188SRCS+= md4_dgst.c md4_one.c
189
190# md5/
191SRCS+= md5_dgst.c md5_one.c
192
193# mdc2/
194SRCS+= mdc2dgst.c mdc2_one.c
195
196# modes/
197SRCS+= cbc128.c ctr128.c cts128.c cfb128.c ofb128.c gcm128.c ccm128.c xts128.c
198
199# objects/
200SRCS+= o_names.c obj_dat.c obj_lib.c obj_err.c obj_xref.c
201
202# ocsp/
203SRCS+= ocsp_asn.c ocsp_ext.c ocsp_ht.c ocsp_lib.c ocsp_cl.c
204SRCS+= ocsp_srv.c ocsp_prn.c ocsp_vfy.c ocsp_err.c
205
206# pem/
207SRCS+= pem_sign.c pem_seal.c pem_info.c pem_lib.c pem_all.c pem_err.c
208SRCS+= pem_x509.c pem_xaux.c pem_oth.c pem_pk8.c pem_pkey.c pvkfmt.c
209
210# pkcs12/
211SRCS+= p12_add.c p12_asn.c p12_attr.c p12_crpt.c p12_crt.c p12_decr.c
212SRCS+= p12_init.c p12_key.c p12_kiss.c p12_mutl.c
213SRCS+= p12_utl.c p12_npas.c pk12err.c p12_p8d.c p12_p8e.c
214
215# pkcs7/
216SRCS+= pk7_asn1.c pk7_lib.c pkcs7err.c pk7_doit.c pk7_smime.c pk7_attr.c
217SRCS+= pk7_mime.c bio_pk7.c
218
219# pqueue/
220SRCS+= pqueue.c
221
222# rand/
223SRCS+= md_rand.c randfile.c rand_lib.c rand_err.c rand_egd.c
224SRCS+= rand_win.c rand_unix.c rand_os2.c rand_nw.c
225
226# rc2/
227SRCS+= rc2_ecb.c rc2_skey.c rc2_cbc.c rc2cfb64.c rc2ofb64.c
228
229# rc4/
230SRCS+= rc4_utl.c
231
232# rc5/
233#SRCS+= rc5_skey.c rc5_ecb.c rc5cfb64.c rc5ofb64.c
234
235# ripemd/
236SRCS+= rmd_dgst.c rmd_one.c
237
238# rsa/
239SRCS+= rsa_eay.c rsa_gen.c rsa_lib.c rsa_sign.c rsa_saos.c rsa_err.c
240SRCS+= rsa_pk1.c rsa_ssl.c rsa_none.c rsa_oaep.c rsa_chk.c rsa_null.c
241SRCS+= rsa_pss.c rsa_x931.c rsa_asn1.c rsa_depr.c rsa_ameth.c rsa_prn.c
242SRCS+= rsa_pmeth.c rsa_crpt.c
243
244# seed/
245#SRCS+= seed.c seed_ecb.c seed_cbc.c seed_cfb.c seed_ofb.c
246
247# sha/
248SRCS+= sha_dgst.c sha1dgst.c sha_one.c sha1_one.c sha256.c sha512.c
249
250# srp/
251#SRCS+= srp_lib.c srp_vfy.c
252
253# stack/
254SRCS+= stack.c
255
256# store/
257#SRCS+= str_err.c str_lib.c str_meth.c str_mem.c
258
259# ts/
260SRCS+= ts_err.c ts_req_utils.c ts_req_print.c ts_rsp_utils.c ts_rsp_print.c
261SRCS+= ts_rsp_sign.c ts_rsp_verify.c ts_verify_ctx.c ts_lib.c ts_conf.c
262SRCS+= ts_asn1.c
263
264# txt_db/
265SRCS+=txt_db.c
266
267# ui/
268SRCS+= ui_err.c ui_lib.c ui_openssl.c ui_util.c ui_compat.c
269
270# whrlpool/
271SRCS+= wp_dgst.c
272
273# x509/
274SRCS+= x509_def.c x509_d2.c x509_r2x.c x509_cmp.c
275SRCS+= x509_obj.c x509_req.c x509spki.c x509_vfy.c
276SRCS+= x509_set.c x509cset.c x509rset.c x509_err.c
277SRCS+= x509name.c x509_v3.c x509_ext.c x509_att.c
278SRCS+= x509type.c x509_lu.c x_all.c x509_txt.c
279SRCS+= x509_trs.c by_file.c by_dir.c x509_vpm.c
280
281# x509v3/
282SRCS+= v3_bcons.c v3_bitst.c v3_conf.c v3_extku.c v3_ia5.c v3_lib.c
283SRCS+= v3_prn.c v3_utl.c v3err.c v3_genn.c v3_alt.c v3_skey.c v3_akey.c v3_pku.c
284SRCS+= v3_int.c v3_enum.c v3_sxnet.c v3_cpols.c v3_crld.c v3_purp.c v3_info.c
285SRCS+= v3_ocsp.c v3_akeya.c v3_pmaps.c v3_pcons.c v3_ncons.c v3_pcia.c v3_pci.c
286SRCS+= pcy_cache.c pcy_node.c pcy_data.c pcy_map.c pcy_tree.c pcy_lib.c
287SRCS+= v3_asid.c v3_addr.c
288
289.PATH: ${.CURDIR}/arch/${MACHINE_CPU} \
290 ${LCRYPTO_SRC} \
291 ${LCRYPTO_SRC}/aes \
292 ${LCRYPTO_SRC}/asn1 \
293 ${LCRYPTO_SRC}/bf \
294 ${LCRYPTO_SRC}/bio \
295 ${LCRYPTO_SRC}/bn \
296 ${LCRYPTO_SRC}/bn/asm \
297 ${LCRYPTO_SRC}/buffer \
298 ${LCRYPTO_SRC}/camellia \
299 ${LCRYPTO_SRC}/cast \
300 ${LCRYPTO_SRC}/cmac \
301 ${LCRYPTO_SRC}/cms \
302 ${LCRYPTO_SRC}/comp \
303 ${LCRYPTO_SRC}/conf \
304 ${LCRYPTO_SRC}/des \
305 ${LCRYPTO_SRC}/dh \
306 ${LCRYPTO_SRC}/dsa \
307 ${LCRYPTO_SRC}/dso \
308 ${LCRYPTO_SRC}/ec \
309 ${LCRYPTO_SRC}/ecdh \
310 ${LCRYPTO_SRC}/ecdsa \
311 ${LCRYPTO_SRC}/engine \
312 ${LCRYPTO_SRC}/err \
313 ${LCRYPTO_SRC}/evp \
314 ${LCRYPTO_SRC}/md2 \
315 ${LCRYPTO_SRC}/hmac \
316 ${LCRYPTO_SRC}/idea \
317 ${LCRYPTO_SRC}/jpake \
318 ${LCRYPTO_SRC}/krb5 \
319 ${LCRYPTO_SRC}/lhash \
320 ${LCRYPTO_SRC}/md4 \
321 ${LCRYPTO_SRC}/md5 \
322 ${LCRYPTO_SRC}/mdc2 \
323 ${LCRYPTO_SRC}/modes \
324 ${LCRYPTO_SRC}/objects \
325 ${LCRYPTO_SRC}/ocsp \
326 ${LCRYPTO_SRC}/pem \
327 ${LCRYPTO_SRC}/perlasm \
328 ${LCRYPTO_SRC}/pkcs12 \
329 ${LCRYPTO_SRC}/pkcs7 \
330 ${LCRYPTO_SRC}/pqueue \
331 ${LCRYPTO_SRC}/rand \
332 ${LCRYPTO_SRC}/rc2 \
333 ${LCRYPTO_SRC}/rc4 \
334 ${LCRYPTO_SRC}/rc5 \
335 ${LCRYPTO_SRC}/ripemd \
336 ${LCRYPTO_SRC}/rsa \
337 ${LCRYPTO_SRC}/seed \
338 ${LCRYPTO_SRC}/sha \
339 ${LCRYPTO_SRC}/stack \
340 ${LCRYPTO_SRC}/store \
341 ${LCRYPTO_SRC}/threads \
342 ${LCRYPTO_SRC}/ts \
343 ${LCRYPTO_SRC}/txt_db \
344 ${LCRYPTO_SRC}/ui \
345 ${LCRYPTO_SRC}/whrlpool \
346 ${LCRYPTO_SRC}/x509 \
347 ${LCRYPTO_SRC}/x509v3
348
349HDRS=\
350 e_os.h \
351 e_os2.h \
352 crypto/aes/aes.h \
353 crypto/asn1/asn1.h \
354 crypto/asn1/asn1_mac.h \
355 crypto/asn1/asn1t.h \
356 crypto/bf/blowfish.h \
357 crypto/bio/bio.h \
358 crypto/bn/bn.h \
359 crypto/buffer/buffer.h \
360 crypto/camellia/camellia.h \
361 crypto/cast/cast.h \
362 crypto/cmac/cmac.h \
363 crypto/cms/cms.h \
364 crypto/comp/comp.h \
365 crypto/conf/conf.h \
366 crypto/conf/conf_api.h \
367 crypto/crypto.h \
368 crypto/des/des.h \
369 crypto/des/des_old.h \
370 crypto/dh/dh.h \
371 crypto/dsa/dsa.h \
372 crypto/dso/dso.h \
373 crypto/ebcdic.h \
374 crypto/ec/ec.h \
375 crypto/ecdh/ecdh.h \
376 crypto/ecdsa/ecdsa.h \
377 crypto/engine/engine.h \
378 crypto/err/err.h \
379 crypto/evp/evp.h \
380 crypto/hmac/hmac.h \
381 crypto/idea/idea.h \
382 crypto/krb5/krb5_asn.h \
383 crypto/lhash/lhash.h \
384 crypto/md2/md2.h \
385 crypto/md4/md4.h \
386 crypto/md5/md5.h \
387 crypto/mdc2/mdc2.h \
388 crypto/modes/modes.h \
389 crypto/objects/objects.h \
390 crypto/ocsp/ocsp.h \
391 crypto/opensslv.h \
392 crypto/ossl_typ.h \
393 crypto/pem/pem.h \
394 crypto/pem/pem2.h \
395 crypto/pkcs12/pkcs12.h \
396 crypto/pkcs7/pkcs7.h \
397 crypto/pqueue/pqueue.h \
398 crypto/rand/rand.h \
399 crypto/rc2/rc2.h \
400 crypto/rc4/rc4.h \
401 crypto/rc5/rc5.h \
402 crypto/ripemd/ripemd.h \
403 crypto/rsa/rsa.h \
404 crypto/seed/seed.h \
405 crypto/sha/sha.h \
406 crypto/srp/srp.h \
407 crypto/stack/safestack.h \
408 crypto/stack/stack.h \
409 crypto/store/store.h \
410 crypto/symhacks.h \
411 crypto/ts/ts.h \
412 crypto/txt_db/txt_db.h \
413 crypto/ui/ui.h \
414 crypto/ui/ui_compat.h \
415 crypto/whrlpool/whrlpool.h \
416 crypto/x509/x509.h \
417 crypto/x509/x509_vfy.h \
418 crypto/x509v3/x509v3.h
419
420HDRS_GEN=\
421 ${.CURDIR}/arch/${MACHINE_CPU}/opensslconf.h \
422 ${.OBJDIR}/obj_mac.h
423
424includes: obj_mac.h
425 @test -d ${DESTDIR}/usr/include/openssl || \
426 mkdir ${DESTDIR}/usr/include/openssl
427 @cd ${SSL_SRC}; \
428 for i in $(HDRS); do \
429 j="cmp -s $$i ${DESTDIR}/usr/include/openssl/`basename $$i` || \
430 ${INSTALL} ${INSTALL_COPY} -o ${BINOWN} -g ${BINGRP} -m 444 $$i\
431 ${DESTDIR}/usr/include/openssl"; \
432 echo $$j; \
433 eval "$$j"; \
434 done; \
435 for i in $(HDRS_GEN); do \
436 j="cmp -s $$i ${DESTDIR}/usr/include/openssl/`basename $$i` || \
437 ${INSTALL} ${INSTALL_COPY} -o ${BINOWN} -g ${BINGRP} -m 444 $$i\
438 ${DESTDIR}/usr/include/openssl"; \
439 echo $$j; \
440 eval "$$j"; \
441 done;
442
443# generated
444CFLAGS+= -I${.OBJDIR}
445
446GENERATED=obj_mac.h obj_dat.h
447CLEANFILES=${GENERATED} obj_mac.num.tmp
448SSL_OBJECTS=${SSL_SRC}/crypto/objects
449
450obj_mac.h: ${SSL_OBJECTS}/objects.h ${SSL_OBJECTS}/obj_mac.num ${SSL_OBJECTS}/objects.txt
451 cat ${SSL_OBJECTS}/obj_mac.num > obj_mac.num.tmp
452 /usr/bin/perl ${SSL_OBJECTS}/objects.pl ${SSL_OBJECTS}/objects.txt obj_mac.num.tmp obj_mac.h
453
454obj_dat.h: obj_mac.h
455 /usr/bin/perl ${SSL_OBJECTS}/obj_dat.pl obj_mac.h obj_dat.h
456
457.if (${MACHINE_ARCH} == "i386")
458SRCS+= wp_block.c
459SRCS+= bf_cbc.c
460CFLAGS+= -DOPENSSL_BN_ASM_PART_WORDS
461CFLAGS+= -DOPENSSL_IA32_SSE2
462CFLAGS+= -DOPENSSL_BN_ASM_MONT
463CFLAGS+= -DOPENSSL_BN_ASM_GF2m
464CFLAGS+= -DSHA1_ASM
465CFLAGS+= -DSHA256_ASM
466CFLAGS+= -DSHA512_ASM
467CFLAGS+= -DMD5_ASM
468CFLAGS+= -DRMD160_ASM
469CFLAGS+= -DAES_ASM
470CFLAGS+= -DVPAES_ASM
471CFLAGS+= -DWHIRLPOOL_ASM
472CFLAGS+= -DGHASH_ASM
473CFLAGS+= -DOPENSSL_CPUID_OBJ
474SSLASM=\
475 aes aes-586 \
476 aes vpaes-x86 \
477 aes aesni-x86 \
478 bf bf-586 \
479 bn bn-586 \
480 bn co-586 \
481 bn x86-mont \
482 bn x86-gf2m \
483 des crypt586 \
484 des des-586 \
485 md5 md5-586 \
486 modes ghash-x86 \
487 rc4 rc4-586 \
488 ripemd rmd-586 \
489 sha sha1-586 \
490 sha sha256-586 \
491 sha sha512-586 \
492 whrlpool wp-mmx
493.for dir f in ${SSLASM}
494SRCS+= ${f}.S
495GENERATED+=${f}.S
496${f}.S: ${LCRYPTO_SRC}/${dir}/asm/${f}.pl ${LCRYPTO_SRC}/perlasm/x86gas.pl
497 /usr/bin/perl -I${LCRYPTO_SRC}/perlasm -I${LCRYPTO_SRC}/${dir}/asm \
498 ${LCRYPTO_SRC}/${dir}/asm/${f}.pl \
499 openbsd-elf ${CFLAGS} 386 ${PICFLAG} > ${.TARGET}
500.endfor
501SRCS+= x86cpuid.S
502GENERATED+=x86cpuid.S
503x86cpuid.S: ${LCRYPTO_SRC}/x86cpuid.pl ${LCRYPTO_SRC}/perlasm/x86gas.pl
504 /usr/bin/perl -I${LCRYPTO_SRC}/perlasm ${LCRYPTO_SRC}/x86cpuid.pl \
505 openbsd-elf ${CFLAGS} 386 ${PICFLAG} > ${.TARGET}
506.elif (${MACHINE_ARCH} == "amd64")
507SRCS+= bf_enc.c des_enc.c fcrypt_b.c
508SRCS+= x86_64-gcc.c
509CFLAGS+= -DOPENSSL_CPUID_OBJ
510CFLAGS+= -DOPENSSL_IA32_SSE2
511CFLAGS+= -DOPENSSL_BN_ASM_MONT
512CFLAGS+= -DOPENSSL_BN_ASM_MONT5
513CFLAGS+= -DOPENSSL_BN_ASM_GF2m
514CFLAGS+= -DSHA1_ASM
515CFLAGS+= -DSHA256_ASM
516CFLAGS+= -DSHA512_ASM
517CFLAGS+= -DMD5_ASM
518CFLAGS+= -DAES_ASM
519CFLAGS+= -DVPAES_ASM
520CFLAGS+= -DBSAES_ASM
521CFLAGS+= -DWHIRLPOOL_ASM
522CFLAGS+= -DGHASH_ASM
523SSLASM=\
524 aes aes-x86_64 \
525 aes aesni-x86_64 \
526 aes aesni-sha1-x86_64 \
527 aes bsaes-x86_64 \
528 aes vpaes-x86_64 \
529 bn x86_64-mont \
530 bn x86_64-mont5 \
531 bn x86_64-gf2m \
532 bn modexp512-x86_64 \
533 md5 md5-x86_64 \
534 modes ghash-x86_64 \
535 rc4 rc4-x86_64 \
536 rc4 rc4-md5-x86_64 \
537 sha sha1-x86_64 \
538 whrlpool wp-x86_64
539.for dir f in ${SSLASM}
540SRCS+= ${f}.S
541GENERATED+=${f}.S
542${f}.S: ${LCRYPTO_SRC}/${dir}/asm/${f}.pl
543 (cd ${LCRYPTO_SRC}/${dir} ; \
544 /usr/bin/perl ./asm/${f}.pl openbsd-elf) > ${.TARGET}
545.endfor
546SRCS+= x86_64cpuid.S sha256-x86_64.S sha512-x86_64.S
547GENERATED+=x86_64cpuid.S sha256-x86_64.S sha512-x86_64.S
548x86_64cpuid.S: ${LCRYPTO_SRC}/x86_64cpuid.pl
549 (cd ${LCRYPTO_SRC}/${dir} ; \
550 /usr/bin/perl ./x86_64cpuid.pl) > ${.TARGET}
551sha256-x86_64.S: ${LCRYPTO_SRC}/sha/asm/sha512-x86_64.pl
552 cd ${LCRYPTO_SRC}/sha/asm ; \
553 /usr/bin/perl ./sha512-x86_64.pl ${.OBJDIR}/${.TARGET}
554sha512-x86_64.S: ${LCRYPTO_SRC}/sha/asm/sha512-x86_64.pl
555 cd ${LCRYPTO_SRC}/sha/asm ; \
556 /usr/bin/perl ./sha512-x86_64.pl ${.OBJDIR}/${.TARGET}
557.else
558# XXX lots more asm we can turn on for other platforms. Shouldn't require
559# major cranks.
560CFLAGS+=-DOPENSSL_NO_ASM
561SRCS+= mem_clr.c
562SRCS+= aes_core.c aes_cbc.c
563SRCS+= bf_enc.c
564SRCS+= bn_asm.c
565SRCS+= des_enc.c fcrypt_b.c
566SRCS+= rc4_enc.c rc4_skey.c
567#SRCS+= rc5_enc.c
568SRCS+= wp_block.c
569.endif
570
571all beforedepend: ${GENERATED}
572
573.include <bsd.lib.mk>
diff --git a/src/lib/libcrypto/crypto/arch/alpha/opensslconf.h b/src/lib/libcrypto/crypto/arch/alpha/opensslconf.h
new file mode 100644
index 0000000000..30f6acfbb1
--- /dev/null
+++ b/src/lib/libcrypto/crypto/arch/alpha/opensslconf.h
@@ -0,0 +1,271 @@
1/* opensslconf.h */
2/* WARNING: Generated automatically from opensslconf.h.in by Configure. */
3
4/* OpenSSL was configured with the following options: */
5#ifndef OPENSSL_DOING_MAKEDEPEND
6
7
8#ifndef OPENSSL_NO_CAMELLIA
9# define OPENSSL_NO_CAMELLIA
10#endif
11#ifndef OPENSSL_NO_EC_NISTP_64_GCC_128
12# define OPENSSL_NO_EC_NISTP_64_GCC_128
13#endif
14#ifndef OPENSSL_NO_CMS
15# define OPENSSL_NO_CMS
16#endif
17#ifndef OPENSSL_NO_GMP
18# define OPENSSL_NO_GMP
19#endif
20#ifndef OPENSSL_NO_GOST
21# define OPENSSL_NO_GOST
22#endif
23#ifndef OPENSSL_NO_JPAKE
24# define OPENSSL_NO_JPAKE
25#endif
26#ifndef OPENSSL_NO_KRB5
27# define OPENSSL_NO_KRB5
28#endif
29#ifndef OPENSSL_NO_MD2
30# define OPENSSL_NO_MD2
31#endif
32#ifndef OPENSSL_NO_RC5
33# define OPENSSL_NO_RC5
34#endif
35#ifndef OPENSSL_NO_RFC3779
36# define OPENSSL_NO_RFC3779
37#endif
38#ifndef OPENSSL_NO_SCTP
39# define OPENSSL_NO_SCTP
40#endif
41#ifndef OPENSSL_NO_SEED
42# define OPENSSL_NO_SEED
43#endif
44#ifndef OPENSSL_NO_SRP
45# define OPENSSL_NO_SRP
46#endif
47#ifndef OPENSSL_NO_SSL2
48# define OPENSSL_NO_SSL2
49#endif
50#ifndef OPENSSL_NO_STORE
51# define OPENSSL_NO_STORE
52#endif
53
54#endif /* OPENSSL_DOING_MAKEDEPEND */
55
56#ifndef OPENSSL_THREADS
57# define OPENSSL_THREADS
58#endif
59#ifndef OPENSSL_NO_DYNAMIC_ENGINE
60# define OPENSSL_NO_DYNAMIC_ENGINE
61#endif
62
63/* The OPENSSL_NO_* macros are also defined as NO_* if the application
64 asks for it. This is a transient feature that is provided for those
65 who haven't had the time to do the appropriate changes in their
66 applications. */
67#ifdef OPENSSL_ALGORITHM_DEFINES
68# if defined(OPENSSL_NO_CAMELLIA) && !defined(NO_CAMELLIA)
69# define NO_CAMELLIA
70# endif
71# if defined(OPENSSL_NO_EC_NISTP_64_GCC_128) && !defined(NO_EC_NISTP_64_GCC_128)
72# define NO_EC_NISTP_64_GCC_128
73# endif
74# if defined(OPENSSL_NO_CMS) && !defined(NO_CMS)
75# define NO_CMS
76# endif
77# if defined(OPENSSL_NO_GMP) && !defined(NO_GMP)
78# define NO_GMP
79# endif
80# if defined(OPENSSL_NO_GOST) && !defined(NO_GOST)
81# define NO_GOST
82# endif
83# if defined(OPENSSL_NO_JPAKE) && !defined(NO_JPAKE)
84# define NO_JPAKE
85# endif
86# if defined(OPENSSL_NO_KRB5) && !defined(NO_KRB5)
87# define NO_KRB5
88# endif
89# if defined(OPENSSL_NO_MD2) && !defined(NO_MD2)
90# define NO_MD2
91# endif
92# if defined(OPENSSL_NO_RC5) && !defined(NO_RC5)
93# define NO_RC5
94# endif
95# if defined(OPENSSL_NO_RFC3779) && !defined(NO_RFC3779)
96# define NO_RFC3779
97# endif
98# if defined(OPENSSL_NO_SCTP) && !defined(NO_SCTP)
99# define NO_SCTP
100# endif
101# if defined(OPENSSL_NO_SEED) && !defined(NO_SEED)
102# define NO_SEED
103# endif
104# if defined(OPENSSL_NO_SRP) && !defined(NO_SRP)
105# define NO_SRP
106# endif
107# if defined(OPENSSL_NO_SSL2) && !defined(NO_SSL2)
108# define NO_SSL2
109# endif
110# if defined(OPENSSL_NO_STORE) && !defined(NO_STORE)
111# define NO_STORE
112# endif
113#endif
114
115/* crypto/opensslconf.h.in */
116
117/* Generate 80386 code? */
118#undef I386_ONLY
119
120#if !(defined(VMS) || defined(__VMS)) /* VMS uses logical names instead */
121#if defined(HEADER_CRYPTLIB_H) && !defined(OPENSSLDIR)
122#define ENGINESDIR "/usr/lib/engines"
123#define OPENSSLDIR "/etc/ssl"
124#endif
125#endif
126
127#undef OPENSSL_UNISTD
128#define OPENSSL_UNISTD <unistd.h>
129
130#undef OPENSSL_EXPORT_VAR_AS_FUNCTION
131
132#if defined(HEADER_IDEA_H) && !defined(IDEA_INT)
133#define IDEA_INT unsigned int
134#endif
135
136#if defined(HEADER_MD2_H) && !defined(MD2_INT)
137#define MD2_INT unsigned int
138#endif
139
140#if defined(HEADER_RC2_H) && !defined(RC2_INT)
141/* I need to put in a mod for the alpha - eay */
142#define RC2_INT unsigned int
143#endif
144
145#if defined(HEADER_RC4_H)
146#if !defined(RC4_INT)
147/* using int types make the structure larger but make the code faster
148 * on most boxes I have tested - up to %20 faster. */
149/*
150 * I don't know what does "most" mean, but declaring "int" is a must on:
151 * - Intel P6 because partial register stalls are very expensive;
152 * - elder Alpha because it lacks byte load/store instructions;
153 */
154#define RC4_INT unsigned int
155#endif
156#if !defined(RC4_CHUNK)
157/*
158 * This enables code handling data aligned at natural CPU word
159 * boundary. See crypto/rc4/rc4_enc.c for further details.
160 */
161#define RC4_CHUNK unsigned long
162#endif
163#endif
164
165#if (defined(HEADER_NEW_DES_H) || defined(HEADER_DES_H)) && !defined(DES_LONG)
166/* If this is set to 'unsigned int' on a DEC Alpha, this gives about a
167 * %20 speed up (longs are 8 bytes, int's are 4). */
168#ifndef DES_LONG
169#define DES_LONG unsigned int
170#endif
171#endif
172
173#if defined(HEADER_BN_H) && !defined(CONFIG_HEADER_BN_H)
174#define CONFIG_HEADER_BN_H
175#undef BN_LLONG
176
177/* Should we define BN_DIV2W here? */
178
179/* Only one for the following should be defined */
180/* The prime number generation stuff may not work when
181 * EIGHT_BIT but I don't care since I've only used this mode
182 * for debuging the bignum libraries */
183#define SIXTY_FOUR_BIT_LONG
184#undef SIXTY_FOUR_BIT
185#undef THIRTY_TWO_BIT
186#endif
187
188#if defined(HEADER_RC4_LOCL_H) && !defined(CONFIG_HEADER_RC4_LOCL_H)
189#define CONFIG_HEADER_RC4_LOCL_H
190/* if this is defined data[i] is used instead of *data, this is a %20
191 * speedup on x86 */
192#undef RC4_INDEX
193#endif
194
195#if defined(HEADER_BF_LOCL_H) && !defined(CONFIG_HEADER_BF_LOCL_H)
196#define CONFIG_HEADER_BF_LOCL_H
197#define BF_PTR
198#endif /* HEADER_BF_LOCL_H */
199
200#if defined(HEADER_DES_LOCL_H) && !defined(CONFIG_HEADER_DES_LOCL_H)
201#define CONFIG_HEADER_DES_LOCL_H
202#ifndef DES_DEFAULT_OPTIONS
203/* the following is tweaked from a config script, that is why it is a
204 * protected undef/define */
205#ifndef DES_PTR
206#define DES_PTR
207#endif
208
209/* This helps C compiler generate the correct code for multiple functional
210 * units. It reduces register dependancies at the expense of 2 more
211 * registers */
212#ifndef DES_RISC1
213#undef DES_RISC1
214#endif
215
216#ifndef DES_RISC2
217#define DES_RISC2
218#endif
219
220#if defined(DES_RISC1) && defined(DES_RISC2)
221YOU SHOULD NOT HAVE BOTH DES_RISC1 AND DES_RISC2 DEFINED!!!!!
222#endif
223
224/* Unroll the inner loop, this sometimes helps, sometimes hinders.
225 * Very mucy CPU dependant */
226#ifndef DES_UNROLL
227#undef DES_UNROLL
228#endif
229
230/* These default values were supplied by
231 * Peter Gutman <pgut001@cs.auckland.ac.nz>
232 * They are only used if nothing else has been defined */
233#if !defined(DES_PTR) && !defined(DES_RISC1) && !defined(DES_RISC2) && !defined(DES_UNROLL)
234/* Special defines which change the way the code is built depending on the
235 CPU and OS. For SGI machines you can use _MIPS_SZLONG (32 or 64) to find
236 even newer MIPS CPU's, but at the moment one size fits all for
237 optimization options. Older Sparc's work better with only UNROLL, but
238 there's no way to tell at compile time what it is you're running on */
239
240#if defined( sun ) /* Newer Sparc's */
241# define DES_PTR
242# define DES_RISC1
243# define DES_UNROLL
244#elif defined( __ultrix ) /* Older MIPS */
245# define DES_PTR
246# define DES_RISC2
247# define DES_UNROLL
248#elif defined( __osf1__ ) /* Alpha */
249# define DES_PTR
250# define DES_RISC2
251#elif defined ( _AIX ) /* RS6000 */
252 /* Unknown */
253#elif defined( __hpux ) /* HP-PA */
254 /* Unknown */
255#elif defined( __aux ) /* 68K */
256 /* Unknown */
257#elif defined( __dgux ) /* 88K (but P6 in latest boxes) */
258# define DES_UNROLL
259#elif defined( __sgi ) /* Newer MIPS */
260# define DES_PTR
261# define DES_RISC2
262# define DES_UNROLL
263#elif defined(i386) || defined(__i386__) /* x86 boxes, should be gcc */
264# define DES_PTR
265# define DES_RISC1
266# define DES_UNROLL
267#endif /* Systems-specific speed defines */
268#endif
269
270#endif /* DES_DEFAULT_OPTIONS */
271#endif /* HEADER_DES_LOCL_H */
diff --git a/src/lib/libcrypto/crypto/arch/amd64/opensslconf.h b/src/lib/libcrypto/crypto/arch/amd64/opensslconf.h
new file mode 100644
index 0000000000..f969fd75e4
--- /dev/null
+++ b/src/lib/libcrypto/crypto/arch/amd64/opensslconf.h
@@ -0,0 +1,268 @@
1/* opensslconf.h */
2/* WARNING: Generated automatically from opensslconf.h.in by Configure. */
3
4/* OpenSSL was configured with the following options: */
5#ifndef OPENSSL_DOING_MAKEDEPEND
6
7
8#ifndef OPENSSL_NO_CAMELLIA
9# define OPENSSL_NO_CAMELLIA
10#endif
11#ifndef OPENSSL_NO_EC_NISTP_64_GCC_128
12# define OPENSSL_NO_EC_NISTP_64_GCC_128
13#endif
14#ifndef OPENSSL_NO_CMS
15# define OPENSSL_NO_CMS
16#endif
17#ifndef OPENSSL_NO_GMP
18# define OPENSSL_NO_GMP
19#endif
20#ifndef OPENSSL_NO_GOST
21# define OPENSSL_NO_GOST
22#endif
23#ifndef OPENSSL_NO_JPAKE
24# define OPENSSL_NO_JPAKE
25#endif
26#ifndef OPENSSL_NO_KRB5
27# define OPENSSL_NO_KRB5
28#endif
29#ifndef OPENSSL_NO_MD2
30# define OPENSSL_NO_MD2
31#endif
32#ifndef OPENSSL_NO_RC5
33# define OPENSSL_NO_RC5
34#endif
35#ifndef OPENSSL_NO_RFC3779
36# define OPENSSL_NO_RFC3779
37#endif
38#ifndef OPENSSL_NO_SCTP
39# define OPENSSL_NO_SCTP
40#endif
41#ifndef OPENSSL_NO_SEED
42# define OPENSSL_NO_SEED
43#endif
44#ifndef OPENSSL_NO_SRP
45# define OPENSSL_NO_SRP
46#endif
47#ifndef OPENSSL_NO_SSL2
48# define OPENSSL_NO_SSL2
49#endif
50#ifndef OPENSSL_NO_STORE
51# define OPENSSL_NO_STORE
52#endif
53
54#endif /* OPENSSL_DOING_MAKEDEPEND */
55
56#ifndef OPENSSL_THREADS
57# define OPENSSL_THREADS
58#endif
59#ifndef OPENSSL_NO_DYNAMIC_ENGINE
60# define OPENSSL_NO_DYNAMIC_ENGINE
61#endif
62
63/* The OPENSSL_NO_* macros are also defined as NO_* if the application
64 asks for it. This is a transient feature that is provided for those
65 who haven't had the time to do the appropriate changes in their
66 applications. */
67#ifdef OPENSSL_ALGORITHM_DEFINES
68# if defined(OPENSSL_NO_CAMELLIA) && !defined(NO_CAMELLIA)
69# define NO_CAMELLIA
70# endif
71# if defined(OPENSSL_NO_EC_NISTP_64_GCC_128) && !defined(NO_EC_NISTP_64_GCC_128)
72# define NO_EC_NISTP_64_GCC_128
73# endif
74# if defined(OPENSSL_NO_CMS) && !defined(NO_CMS)
75# define NO_CMS
76# endif
77# if defined(OPENSSL_NO_GMP) && !defined(NO_GMP)
78# define NO_GMP
79# endif
80# if defined(OPENSSL_NO_GOST) && !defined(NO_GOST)
81# define NO_GOST
82# endif
83# if defined(OPENSSL_NO_JPAKE) && !defined(NO_JPAKE)
84# define NO_JPAKE
85# endif
86# if defined(OPENSSL_NO_KRB5) && !defined(NO_KRB5)
87# define NO_KRB5
88# endif
89# if defined(OPENSSL_NO_MD2) && !defined(NO_MD2)
90# define NO_MD2
91# endif
92# if defined(OPENSSL_NO_RC5) && !defined(NO_RC5)
93# define NO_RC5
94# endif
95# if defined(OPENSSL_NO_RFC3779) && !defined(NO_RFC3779)
96# define NO_RFC3779
97# endif
98# if defined(OPENSSL_NO_SCTP) && !defined(NO_SCTP)
99# define NO_SCTP
100# endif
101# if defined(OPENSSL_NO_SEED) && !defined(NO_SEED)
102# define NO_SEED
103# endif
104# if defined(OPENSSL_NO_SRP) && !defined(NO_SRP)
105# define NO_SRP
106# endif
107# if defined(OPENSSL_NO_SSL2) && !defined(NO_SSL2)
108# define NO_SSL2
109# endif
110# if defined(OPENSSL_NO_STORE) && !defined(NO_STORE)
111# define NO_STORE
112# endif
113#endif
114
115/* crypto/opensslconf.h.in */
116
117/* Generate 80386 code? */
118#undef I386_ONLY
119
120#if !(defined(VMS) || defined(__VMS)) /* VMS uses logical names instead */
121#if defined(HEADER_CRYPTLIB_H) && !defined(OPENSSLDIR)
122#define ENGINESDIR "/usr/lib/engines"
123#define OPENSSLDIR "/etc/ssl"
124#endif
125#endif
126
127#undef OPENSSL_UNISTD
128#define OPENSSL_UNISTD <unistd.h>
129
130#undef OPENSSL_EXPORT_VAR_AS_FUNCTION
131
132#if defined(HEADER_IDEA_H) && !defined(IDEA_INT)
133#define IDEA_INT unsigned int
134#endif
135
136#if defined(HEADER_MD2_H) && !defined(MD2_INT)
137#define MD2_INT unsigned int
138#endif
139
140#if defined(HEADER_RC2_H) && !defined(RC2_INT)
141/* I need to put in a mod for the alpha - eay */
142#define RC2_INT unsigned int
143#endif
144
145#if defined(HEADER_RC4_H)
146#if !defined(RC4_INT)
147/* using int types make the structure larger but make the code faster
148 * on most boxes I have tested - up to %20 faster. */
149/*
150 * I don't know what does "most" mean, but declaring "int" is a must on:
151 * - Intel P6 because partial register stalls are very expensive;
152 * - elder Alpha because it lacks byte load/store instructions;
153 */
154#define RC4_INT unsigned int
155#endif
156#if !defined(RC4_CHUNK)
157/*
158 * This enables code handling data aligned at natural CPU word
159 * boundary. See crypto/rc4/rc4_enc.c for further details.
160 */
161#define RC4_CHUNK unsigned long
162#endif
163#endif
164
165#if (defined(HEADER_NEW_DES_H) || defined(HEADER_DES_H)) && !defined(DES_LONG)
166/* If this is set to 'unsigned int' on a DEC Alpha, this gives about a
167 * %20 speed up (longs are 8 bytes, int's are 4). */
168#ifndef DES_LONG
169#define DES_LONG unsigned int
170#endif
171#endif
172
173#if defined(HEADER_BN_H) && !defined(CONFIG_HEADER_BN_H)
174#define CONFIG_HEADER_BN_H
175#undef BN_LLONG
176
177/* Should we define BN_DIV2W here? */
178
179/* Only one for the following should be defined */
180#define SIXTY_FOUR_BIT_LONG
181#undef SIXTY_FOUR_BIT
182#undef THIRTY_TWO_BIT
183#endif
184
185#if defined(HEADER_RC4_LOCL_H) && !defined(CONFIG_HEADER_RC4_LOCL_H)
186#define CONFIG_HEADER_RC4_LOCL_H
187/* if this is defined data[i] is used instead of *data, this is a %20
188 * speedup on x86 */
189#undef RC4_INDEX
190#endif
191
192#if defined(HEADER_BF_LOCL_H) && !defined(CONFIG_HEADER_BF_LOCL_H)
193#define CONFIG_HEADER_BF_LOCL_H
194#undef BF_PTR
195#endif /* HEADER_BF_LOCL_H */
196
197#if defined(HEADER_DES_LOCL_H) && !defined(CONFIG_HEADER_DES_LOCL_H)
198#define CONFIG_HEADER_DES_LOCL_H
199#ifndef DES_DEFAULT_OPTIONS
200/* the following is tweaked from a config script, that is why it is a
201 * protected undef/define */
202#ifndef DES_PTR
203#undef DES_PTR
204#endif
205
206/* This helps C compiler generate the correct code for multiple functional
207 * units. It reduces register dependancies at the expense of 2 more
208 * registers */
209#ifndef DES_RISC1
210#undef DES_RISC1
211#endif
212
213#ifndef DES_RISC2
214#undef DES_RISC2
215#endif
216
217#if defined(DES_RISC1) && defined(DES_RISC2)
218YOU SHOULD NOT HAVE BOTH DES_RISC1 AND DES_RISC2 DEFINED!!!!!
219#endif
220
221/* Unroll the inner loop, this sometimes helps, sometimes hinders.
222 * Very mucy CPU dependant */
223#ifndef DES_UNROLL
224#define DES_UNROLL
225#endif
226
227/* These default values were supplied by
228 * Peter Gutman <pgut001@cs.auckland.ac.nz>
229 * They are only used if nothing else has been defined */
230#if !defined(DES_PTR) && !defined(DES_RISC1) && !defined(DES_RISC2) && !defined(DES_UNROLL)
231/* Special defines which change the way the code is built depending on the
232 CPU and OS. For SGI machines you can use _MIPS_SZLONG (32 or 64) to find
233 even newer MIPS CPU's, but at the moment one size fits all for
234 optimization options. Older Sparc's work better with only UNROLL, but
235 there's no way to tell at compile time what it is you're running on */
236
237#if defined( sun ) /* Newer Sparc's */
238# define DES_PTR
239# define DES_RISC1
240# define DES_UNROLL
241#elif defined( __ultrix ) /* Older MIPS */
242# define DES_PTR
243# define DES_RISC2
244# define DES_UNROLL
245#elif defined( __osf1__ ) /* Alpha */
246# define DES_PTR
247# define DES_RISC2
248#elif defined ( _AIX ) /* RS6000 */
249 /* Unknown */
250#elif defined( __hpux ) /* HP-PA */
251 /* Unknown */
252#elif defined( __aux ) /* 68K */
253 /* Unknown */
254#elif defined( __dgux ) /* 88K (but P6 in latest boxes) */
255# define DES_UNROLL
256#elif defined( __sgi ) /* Newer MIPS */
257# define DES_PTR
258# define DES_RISC2
259# define DES_UNROLL
260#elif defined(i386) || defined(__i386__) /* x86 boxes, should be gcc */
261# define DES_PTR
262# define DES_RISC1
263# define DES_UNROLL
264#endif /* Systems-specific speed defines */
265#endif
266
267#endif /* DES_DEFAULT_OPTIONS */
268#endif /* HEADER_DES_LOCL_H */
diff --git a/src/lib/libcrypto/crypto/arch/arm/opensslconf.h b/src/lib/libcrypto/crypto/arch/arm/opensslconf.h
new file mode 100644
index 0000000000..fc5ea38470
--- /dev/null
+++ b/src/lib/libcrypto/crypto/arch/arm/opensslconf.h
@@ -0,0 +1,273 @@
1/* opensslconf.h */
2/* WARNING: Generated automatically from opensslconf.h.in by Configure. */
3
4/* OpenSSL was configured with the following options: */
5#ifndef OPENSSL_DOING_MAKEDEPEND
6
7
8#ifndef OPENSSL_NO_CAMELLIA
9# define OPENSSL_NO_CAMELLIA
10#endif
11#ifndef OPENSSL_NO_EC_NISTP_64_GCC_128
12# define OPENSSL_NO_EC_NISTP_64_GCC_128
13#endif
14#ifndef OPENSSL_NO_CMS
15# define OPENSSL_NO_CMS
16#endif
17#ifndef OPENSSL_NO_GMP
18# define OPENSSL_NO_GMP
19#endif
20#ifndef OPENSSL_NO_GOST
21# define OPENSSL_NO_GOST
22#endif
23#ifndef OPENSSL_NO_JPAKE
24# define OPENSSL_NO_JPAKE
25#endif
26#ifndef OPENSSL_NO_KRB5
27# define OPENSSL_NO_KRB5
28#endif
29#ifndef OPENSSL_NO_MD2
30# define OPENSSL_NO_MD2
31#endif
32#ifndef OPENSSL_NO_RC5
33# define OPENSSL_NO_RC5
34#endif
35#ifndef OPENSSL_NO_RFC3779
36# define OPENSSL_NO_RFC3779
37#endif
38#ifndef OPENSSL_NO_SCTP
39# define OPENSSL_NO_SCTP
40#endif
41#ifndef OPENSSL_NO_SEED
42# define OPENSSL_NO_SEED
43#endif
44#ifndef OPENSSL_NO_SRP
45# define OPENSSL_NO_SRP
46#endif
47#ifndef OPENSSL_NO_SSL2
48# define OPENSSL_NO_SSL2
49#endif
50#ifndef OPENSSL_NO_STORE
51# define OPENSSL_NO_STORE
52#endif
53
54#endif /* OPENSSL_DOING_MAKEDEPEND */
55
56#ifndef OPENSSL_THREADS
57# define OPENSSL_THREADS
58#endif
59#ifndef OPENSSL_NO_DYNAMIC_ENGINE
60# define OPENSSL_NO_DYNAMIC_ENGINE
61#endif
62
63/* The OPENSSL_NO_* macros are also defined as NO_* if the application
64 asks for it. This is a transient feature that is provided for those
65 who haven't had the time to do the appropriate changes in their
66 applications. */
67#ifdef OPENSSL_ALGORITHM_DEFINES
68# if defined(OPENSSL_NO_CAMELLIA) && !defined(NO_CAMELLIA)
69# define NO_CAMELLIA
70# endif
71# if defined(OPENSSL_NO_EC_NISTP_64_GCC_128) && !defined(NO_EC_NISTP_64_GCC_128)
72# define NO_EC_NISTP_64_GCC_128
73# endif
74# if defined(OPENSSL_NO_CMS) && !defined(NO_CMS)
75# define NO_CMS
76# endif
77# if defined(OPENSSL_NO_GMP) && !defined(NO_GMP)
78# define NO_GMP
79# endif
80# if defined(OPENSSL_NO_GOST) && !defined(NO_GOST)
81# define NO_GOST
82# endif
83# if defined(OPENSSL_NO_JPAKE) && !defined(NO_JPAKE)
84# define NO_JPAKE
85# endif
86# if defined(OPENSSL_NO_KRB5) && !defined(NO_KRB5)
87# define NO_KRB5
88# endif
89# if defined(OPENSSL_NO_MD2) && !defined(NO_MD2)
90# define NO_MD2
91# endif
92# if defined(OPENSSL_NO_RC5) && !defined(NO_RC5)
93# define NO_RC5
94# endif
95# if defined(OPENSSL_NO_RFC3779) && !defined(NO_RFC3779)
96# define NO_RFC3779
97# endif
98# if defined(OPENSSL_NO_SCTP) && !defined(NO_SCTP)
99# define NO_SCTP
100# endif
101# if defined(OPENSSL_NO_SEED) && !defined(NO_SEED)
102# define NO_SEED
103# endif
104# if defined(OPENSSL_NO_SRP) && !defined(NO_SRP)
105# define NO_SRP
106# endif
107# if defined(OPENSSL_NO_SSL2) && !defined(NO_SSL2)
108# define NO_SSL2
109# endif
110# if defined(OPENSSL_NO_STORE) && !defined(NO_STORE)
111# define NO_STORE
112# endif
113#endif
114
115/* crypto/opensslconf.h.in */
116
117/* Generate 80386 code? */
118#undef I386_ONLY
119
120#if !(defined(VMS) || defined(__VMS)) /* VMS uses logical names instead */
121#if defined(HEADER_CRYPTLIB_H) && !defined(OPENSSLDIR)
122#define ENGINESDIR "/usr/lib/engines"
123#define OPENSSLDIR "/etc/ssl"
124#endif
125#endif
126
127#undef OPENSSL_UNISTD
128#define OPENSSL_UNISTD <unistd.h>
129
130#undef OPENSSL_EXPORT_VAR_AS_FUNCTION
131
132#if defined(HEADER_IDEA_H) && !defined(IDEA_INT)
133#define IDEA_INT unsigned int
134#endif
135
136#if defined(HEADER_MD2_H) && !defined(MD2_INT)
137#define MD2_INT unsigned int
138#endif
139
140#if defined(HEADER_RC2_H) && !defined(RC2_INT)
141/* I need to put in a mod for the alpha - eay */
142#define RC2_INT unsigned int
143#endif
144
145#if defined(HEADER_RC4_H)
146#if !defined(RC4_INT)
147/* using int types make the structure larger but make the code faster
148 * on most boxes I have tested - up to %20 faster. */
149/*
150 * I don't know what does "most" mean, but declaring "int" is a must on:
151 * - Intel P6 because partial register stalls are very expensive;
152 * - elder Alpha because it lacks byte load/store instructions;
153 */
154#define RC4_INT unsigned int
155#endif
156#if !defined(RC4_CHUNK)
157/*
158 * This enables code handling data aligned at natural CPU word
159 * boundary. See crypto/rc4/rc4_enc.c for further details.
160 */
161#undef RC4_CHUNK
162#endif
163#endif
164
165#if (defined(HEADER_NEW_DES_H) || defined(HEADER_DES_H)) && !defined(DES_LONG)
166/* If this is set to 'unsigned int' on a DEC Alpha, this gives about a
167 * %20 speed up (longs are 8 bytes, int's are 4). */
168#ifndef DES_LONG
169#define DES_LONG unsigned int
170#endif
171#endif
172
173#if defined(HEADER_BN_H) && !defined(CONFIG_HEADER_BN_H)
174#define CONFIG_HEADER_BN_H
175#define BN_LLONG
176
177/* Should we define BN_DIV2W here? */
178
179/* Only one for the following should be defined */
180/* The prime number generation stuff may not work when
181 * EIGHT_BIT but I don't care since I've only used this mode
182 * for debuging the bignum libraries */
183#undef SIXTY_FOUR_BIT_LONG
184#undef SIXTY_FOUR_BIT
185#define THIRTY_TWO_BIT
186#undef SIXTEEN_BIT
187#undef EIGHT_BIT
188#endif
189
190#if defined(HEADER_RC4_LOCL_H) && !defined(CONFIG_HEADER_RC4_LOCL_H)
191#define CONFIG_HEADER_RC4_LOCL_H
192/* if this is defined data[i] is used instead of *data, this is a %20
193 * speedup on x86 */
194#define RC4_INDEX
195#endif
196
197#if defined(HEADER_BF_LOCL_H) && !defined(CONFIG_HEADER_BF_LOCL_H)
198#define CONFIG_HEADER_BF_LOCL_H
199#undef BF_PTR
200#endif /* HEADER_BF_LOCL_H */
201
202#if defined(HEADER_DES_LOCL_H) && !defined(CONFIG_HEADER_DES_LOCL_H)
203#define CONFIG_HEADER_DES_LOCL_H
204#ifndef DES_DEFAULT_OPTIONS
205/* the following is tweaked from a config script, that is why it is a
206 * protected undef/define */
207#ifndef DES_PTR
208#undef DES_PTR
209#endif
210
211/* This helps C compiler generate the correct code for multiple functional
212 * units. It reduces register dependancies at the expense of 2 more
213 * registers */
214#ifndef DES_RISC1
215#undef DES_RISC1
216#endif
217
218#ifndef DES_RISC2
219#undef DES_RISC2
220#endif
221
222#if defined(DES_RISC1) && defined(DES_RISC2)
223YOU SHOULD NOT HAVE BOTH DES_RISC1 AND DES_RISC2 DEFINED!!!!!
224#endif
225
226/* Unroll the inner loop, this sometimes helps, sometimes hinders.
227 * Very mucy CPU dependant */
228#ifndef DES_UNROLL
229#define DES_UNROLL
230#endif
231
232/* These default values were supplied by
233 * Peter Gutman <pgut001@cs.auckland.ac.nz>
234 * They are only used if nothing else has been defined */
235#if !defined(DES_PTR) && !defined(DES_RISC1) && !defined(DES_RISC2) && !defined(DES_UNROLL)
236/* Special defines which change the way the code is built depending on the
237 CPU and OS. For SGI machines you can use _MIPS_SZLONG (32 or 64) to find
238 even newer MIPS CPU's, but at the moment one size fits all for
239 optimization options. Older Sparc's work better with only UNROLL, but
240 there's no way to tell at compile time what it is you're running on */
241
242#if defined( sun ) /* Newer Sparc's */
243# define DES_PTR
244# define DES_RISC1
245# define DES_UNROLL
246#elif defined( __ultrix ) /* Older MIPS */
247# define DES_PTR
248# define DES_RISC2
249# define DES_UNROLL
250#elif defined( __osf1__ ) /* Alpha */
251# define DES_PTR
252# define DES_RISC2
253#elif defined ( _AIX ) /* RS6000 */
254 /* Unknown */
255#elif defined( __hpux ) /* HP-PA */
256 /* Unknown */
257#elif defined( __aux ) /* 68K */
258 /* Unknown */
259#elif defined( __dgux ) /* 88K (but P6 in latest boxes) */
260# define DES_UNROLL
261#elif defined( __sgi ) /* Newer MIPS */
262# define DES_PTR
263# define DES_RISC2
264# define DES_UNROLL
265#elif defined(i386) || defined(__i386__) /* x86 boxes, should be gcc */
266# define DES_PTR
267# define DES_RISC1
268# define DES_UNROLL
269#endif /* Systems-specific speed defines */
270#endif
271
272#endif /* DES_DEFAULT_OPTIONS */
273#endif /* HEADER_DES_LOCL_H */
diff --git a/src/lib/libcrypto/crypto/arch/hppa/opensslconf.h b/src/lib/libcrypto/crypto/arch/hppa/opensslconf.h
new file mode 100644
index 0000000000..fc5ea38470
--- /dev/null
+++ b/src/lib/libcrypto/crypto/arch/hppa/opensslconf.h
@@ -0,0 +1,273 @@
1/* opensslconf.h */
2/* WARNING: Generated automatically from opensslconf.h.in by Configure. */
3
4/* OpenSSL was configured with the following options: */
5#ifndef OPENSSL_DOING_MAKEDEPEND
6
7
8#ifndef OPENSSL_NO_CAMELLIA
9# define OPENSSL_NO_CAMELLIA
10#endif
11#ifndef OPENSSL_NO_EC_NISTP_64_GCC_128
12# define OPENSSL_NO_EC_NISTP_64_GCC_128
13#endif
14#ifndef OPENSSL_NO_CMS
15# define OPENSSL_NO_CMS
16#endif
17#ifndef OPENSSL_NO_GMP
18# define OPENSSL_NO_GMP
19#endif
20#ifndef OPENSSL_NO_GOST
21# define OPENSSL_NO_GOST
22#endif
23#ifndef OPENSSL_NO_JPAKE
24# define OPENSSL_NO_JPAKE
25#endif
26#ifndef OPENSSL_NO_KRB5
27# define OPENSSL_NO_KRB5
28#endif
29#ifndef OPENSSL_NO_MD2
30# define OPENSSL_NO_MD2
31#endif
32#ifndef OPENSSL_NO_RC5
33# define OPENSSL_NO_RC5
34#endif
35#ifndef OPENSSL_NO_RFC3779
36# define OPENSSL_NO_RFC3779
37#endif
38#ifndef OPENSSL_NO_SCTP
39# define OPENSSL_NO_SCTP
40#endif
41#ifndef OPENSSL_NO_SEED
42# define OPENSSL_NO_SEED
43#endif
44#ifndef OPENSSL_NO_SRP
45# define OPENSSL_NO_SRP
46#endif
47#ifndef OPENSSL_NO_SSL2
48# define OPENSSL_NO_SSL2
49#endif
50#ifndef OPENSSL_NO_STORE
51# define OPENSSL_NO_STORE
52#endif
53
54#endif /* OPENSSL_DOING_MAKEDEPEND */
55
56#ifndef OPENSSL_THREADS
57# define OPENSSL_THREADS
58#endif
59#ifndef OPENSSL_NO_DYNAMIC_ENGINE
60# define OPENSSL_NO_DYNAMIC_ENGINE
61#endif
62
63/* The OPENSSL_NO_* macros are also defined as NO_* if the application
64 asks for it. This is a transient feature that is provided for those
65 who haven't had the time to do the appropriate changes in their
66 applications. */
67#ifdef OPENSSL_ALGORITHM_DEFINES
68# if defined(OPENSSL_NO_CAMELLIA) && !defined(NO_CAMELLIA)
69# define NO_CAMELLIA
70# endif
71# if defined(OPENSSL_NO_EC_NISTP_64_GCC_128) && !defined(NO_EC_NISTP_64_GCC_128)
72# define NO_EC_NISTP_64_GCC_128
73# endif
74# if defined(OPENSSL_NO_CMS) && !defined(NO_CMS)
75# define NO_CMS
76# endif
77# if defined(OPENSSL_NO_GMP) && !defined(NO_GMP)
78# define NO_GMP
79# endif
80# if defined(OPENSSL_NO_GOST) && !defined(NO_GOST)
81# define NO_GOST
82# endif
83# if defined(OPENSSL_NO_JPAKE) && !defined(NO_JPAKE)
84# define NO_JPAKE
85# endif
86# if defined(OPENSSL_NO_KRB5) && !defined(NO_KRB5)
87# define NO_KRB5
88# endif
89# if defined(OPENSSL_NO_MD2) && !defined(NO_MD2)
90# define NO_MD2
91# endif
92# if defined(OPENSSL_NO_RC5) && !defined(NO_RC5)
93# define NO_RC5
94# endif
95# if defined(OPENSSL_NO_RFC3779) && !defined(NO_RFC3779)
96# define NO_RFC3779
97# endif
98# if defined(OPENSSL_NO_SCTP) && !defined(NO_SCTP)
99# define NO_SCTP
100# endif
101# if defined(OPENSSL_NO_SEED) && !defined(NO_SEED)
102# define NO_SEED
103# endif
104# if defined(OPENSSL_NO_SRP) && !defined(NO_SRP)
105# define NO_SRP
106# endif
107# if defined(OPENSSL_NO_SSL2) && !defined(NO_SSL2)
108# define NO_SSL2
109# endif
110# if defined(OPENSSL_NO_STORE) && !defined(NO_STORE)
111# define NO_STORE
112# endif
113#endif
114
115/* crypto/opensslconf.h.in */
116
117/* Generate 80386 code? */
118#undef I386_ONLY
119
120#if !(defined(VMS) || defined(__VMS)) /* VMS uses logical names instead */
121#if defined(HEADER_CRYPTLIB_H) && !defined(OPENSSLDIR)
122#define ENGINESDIR "/usr/lib/engines"
123#define OPENSSLDIR "/etc/ssl"
124#endif
125#endif
126
127#undef OPENSSL_UNISTD
128#define OPENSSL_UNISTD <unistd.h>
129
130#undef OPENSSL_EXPORT_VAR_AS_FUNCTION
131
132#if defined(HEADER_IDEA_H) && !defined(IDEA_INT)
133#define IDEA_INT unsigned int
134#endif
135
136#if defined(HEADER_MD2_H) && !defined(MD2_INT)
137#define MD2_INT unsigned int
138#endif
139
140#if defined(HEADER_RC2_H) && !defined(RC2_INT)
141/* I need to put in a mod for the alpha - eay */
142#define RC2_INT unsigned int
143#endif
144
145#if defined(HEADER_RC4_H)
146#if !defined(RC4_INT)
147/* using int types make the structure larger but make the code faster
148 * on most boxes I have tested - up to %20 faster. */
149/*
150 * I don't know what does "most" mean, but declaring "int" is a must on:
151 * - Intel P6 because partial register stalls are very expensive;
152 * - elder Alpha because it lacks byte load/store instructions;
153 */
154#define RC4_INT unsigned int
155#endif
156#if !defined(RC4_CHUNK)
157/*
158 * This enables code handling data aligned at natural CPU word
159 * boundary. See crypto/rc4/rc4_enc.c for further details.
160 */
161#undef RC4_CHUNK
162#endif
163#endif
164
165#if (defined(HEADER_NEW_DES_H) || defined(HEADER_DES_H)) && !defined(DES_LONG)
166/* If this is set to 'unsigned int' on a DEC Alpha, this gives about a
167 * %20 speed up (longs are 8 bytes, int's are 4). */
168#ifndef DES_LONG
169#define DES_LONG unsigned int
170#endif
171#endif
172
173#if defined(HEADER_BN_H) && !defined(CONFIG_HEADER_BN_H)
174#define CONFIG_HEADER_BN_H
175#define BN_LLONG
176
177/* Should we define BN_DIV2W here? */
178
179/* Only one for the following should be defined */
180/* The prime number generation stuff may not work when
181 * EIGHT_BIT but I don't care since I've only used this mode
182 * for debuging the bignum libraries */
183#undef SIXTY_FOUR_BIT_LONG
184#undef SIXTY_FOUR_BIT
185#define THIRTY_TWO_BIT
186#undef SIXTEEN_BIT
187#undef EIGHT_BIT
188#endif
189
190#if defined(HEADER_RC4_LOCL_H) && !defined(CONFIG_HEADER_RC4_LOCL_H)
191#define CONFIG_HEADER_RC4_LOCL_H
192/* if this is defined data[i] is used instead of *data, this is a %20
193 * speedup on x86 */
194#define RC4_INDEX
195#endif
196
197#if defined(HEADER_BF_LOCL_H) && !defined(CONFIG_HEADER_BF_LOCL_H)
198#define CONFIG_HEADER_BF_LOCL_H
199#undef BF_PTR
200#endif /* HEADER_BF_LOCL_H */
201
202#if defined(HEADER_DES_LOCL_H) && !defined(CONFIG_HEADER_DES_LOCL_H)
203#define CONFIG_HEADER_DES_LOCL_H
204#ifndef DES_DEFAULT_OPTIONS
205/* the following is tweaked from a config script, that is why it is a
206 * protected undef/define */
207#ifndef DES_PTR
208#undef DES_PTR
209#endif
210
211/* This helps C compiler generate the correct code for multiple functional
212 * units. It reduces register dependancies at the expense of 2 more
213 * registers */
214#ifndef DES_RISC1
215#undef DES_RISC1
216#endif
217
218#ifndef DES_RISC2
219#undef DES_RISC2
220#endif
221
222#if defined(DES_RISC1) && defined(DES_RISC2)
223YOU SHOULD NOT HAVE BOTH DES_RISC1 AND DES_RISC2 DEFINED!!!!!
224#endif
225
226/* Unroll the inner loop, this sometimes helps, sometimes hinders.
227 * Very mucy CPU dependant */
228#ifndef DES_UNROLL
229#define DES_UNROLL
230#endif
231
232/* These default values were supplied by
233 * Peter Gutman <pgut001@cs.auckland.ac.nz>
234 * They are only used if nothing else has been defined */
235#if !defined(DES_PTR) && !defined(DES_RISC1) && !defined(DES_RISC2) && !defined(DES_UNROLL)
236/* Special defines which change the way the code is built depending on the
237 CPU and OS. For SGI machines you can use _MIPS_SZLONG (32 or 64) to find
238 even newer MIPS CPU's, but at the moment one size fits all for
239 optimization options. Older Sparc's work better with only UNROLL, but
240 there's no way to tell at compile time what it is you're running on */
241
242#if defined( sun ) /* Newer Sparc's */
243# define DES_PTR
244# define DES_RISC1
245# define DES_UNROLL
246#elif defined( __ultrix ) /* Older MIPS */
247# define DES_PTR
248# define DES_RISC2
249# define DES_UNROLL
250#elif defined( __osf1__ ) /* Alpha */
251# define DES_PTR
252# define DES_RISC2
253#elif defined ( _AIX ) /* RS6000 */
254 /* Unknown */
255#elif defined( __hpux ) /* HP-PA */
256 /* Unknown */
257#elif defined( __aux ) /* 68K */
258 /* Unknown */
259#elif defined( __dgux ) /* 88K (but P6 in latest boxes) */
260# define DES_UNROLL
261#elif defined( __sgi ) /* Newer MIPS */
262# define DES_PTR
263# define DES_RISC2
264# define DES_UNROLL
265#elif defined(i386) || defined(__i386__) /* x86 boxes, should be gcc */
266# define DES_PTR
267# define DES_RISC1
268# define DES_UNROLL
269#endif /* Systems-specific speed defines */
270#endif
271
272#endif /* DES_DEFAULT_OPTIONS */
273#endif /* HEADER_DES_LOCL_H */
diff --git a/src/lib/libcrypto/crypto/arch/hppa64/opensslconf.h b/src/lib/libcrypto/crypto/arch/hppa64/opensslconf.h
new file mode 100644
index 0000000000..f8f478ff52
--- /dev/null
+++ b/src/lib/libcrypto/crypto/arch/hppa64/opensslconf.h
@@ -0,0 +1,273 @@
1/* opensslconf.h */
2/* WARNING: Generated automatically from opensslconf.h.in by Configure. */
3
4/* OpenSSL was configured with the following options: */
5#ifndef OPENSSL_DOING_MAKEDEPEND
6
7
8#ifndef OPENSSL_NO_CAMELLIA
9# define OPENSSL_NO_CAMELLIA
10#endif
11#ifndef OPENSSL_NO_EC_NISTP_64_GCC_128
12# define OPENSSL_NO_EC_NISTP_64_GCC_128
13#endif
14#ifndef OPENSSL_NO_CMS
15# define OPENSSL_NO_CMS
16#endif
17#ifndef OPENSSL_NO_GMP
18# define OPENSSL_NO_GMP
19#endif
20#ifndef OPENSSL_NO_GOST
21# define OPENSSL_NO_GOST
22#endif
23#ifndef OPENSSL_NO_JPAKE
24# define OPENSSL_NO_JPAKE
25#endif
26#ifndef OPENSSL_NO_KRB5
27# define OPENSSL_NO_KRB5
28#endif
29#ifndef OPENSSL_NO_MD2
30# define OPENSSL_NO_MD2
31#endif
32#ifndef OPENSSL_NO_RC5
33# define OPENSSL_NO_RC5
34#endif
35#ifndef OPENSSL_NO_RFC3779
36# define OPENSSL_NO_RFC3779
37#endif
38#ifndef OPENSSL_NO_SCTP
39# define OPENSSL_NO_SCTP
40#endif
41#ifndef OPENSSL_NO_SEED
42# define OPENSSL_NO_SEED
43#endif
44#ifndef OPENSSL_NO_SRP
45# define OPENSSL_NO_SRP
46#endif
47#ifndef OPENSSL_NO_SSL2
48# define OPENSSL_NO_SSL2
49#endif
50#ifndef OPENSSL_NO_STORE
51# define OPENSSL_NO_STORE
52#endif
53
54#endif /* OPENSSL_DOING_MAKEDEPEND */
55
56#ifndef OPENSSL_THREADS
57# define OPENSSL_THREADS
58#endif
59#ifndef OPENSSL_NO_DYNAMIC_ENGINE
60# define OPENSSL_NO_DYNAMIC_ENGINE
61#endif
62
63/* The OPENSSL_NO_* macros are also defined as NO_* if the application
64 asks for it. This is a transient feature that is provided for those
65 who haven't had the time to do the appropriate changes in their
66 applications. */
67#ifdef OPENSSL_ALGORITHM_DEFINES
68# if defined(OPENSSL_NO_CAMELLIA) && !defined(NO_CAMELLIA)
69# define NO_CAMELLIA
70# endif
71# if defined(OPENSSL_NO_EC_NISTP_64_GCC_128) && !defined(NO_EC_NISTP_64_GCC_128)
72# define NO_EC_NISTP_64_GCC_128
73# endif
74# if defined(OPENSSL_NO_CMS) && !defined(NO_CMS)
75# define NO_CMS
76# endif
77# if defined(OPENSSL_NO_GMP) && !defined(NO_GMP)
78# define NO_GMP
79# endif
80# if defined(OPENSSL_NO_GOST) && !defined(NO_GOST)
81# define NO_GOST
82# endif
83# if defined(OPENSSL_NO_JPAKE) && !defined(NO_JPAKE)
84# define NO_JPAKE
85# endif
86# if defined(OPENSSL_NO_KRB5) && !defined(NO_KRB5)
87# define NO_KRB5
88# endif
89# if defined(OPENSSL_NO_MD2) && !defined(NO_MD2)
90# define NO_MD2
91# endif
92# if defined(OPENSSL_NO_RC5) && !defined(NO_RC5)
93# define NO_RC5
94# endif
95# if defined(OPENSSL_NO_RFC3779) && !defined(NO_RFC3779)
96# define NO_RFC3779
97# endif
98# if defined(OPENSSL_NO_SCTP) && !defined(NO_SCTP)
99# define NO_SCTP
100# endif
101# if defined(OPENSSL_NO_SEED) && !defined(NO_SEED)
102# define NO_SEED
103# endif
104# if defined(OPENSSL_NO_SRP) && !defined(NO_SRP)
105# define NO_SRP
106# endif
107# if defined(OPENSSL_NO_SSL2) && !defined(NO_SSL2)
108# define NO_SSL2
109# endif
110# if defined(OPENSSL_NO_STORE) && !defined(NO_STORE)
111# define NO_STORE
112# endif
113#endif
114
115/* crypto/opensslconf.h.in */
116
117/* Generate 80386 code? */
118#undef I386_ONLY
119
120#if !(defined(VMS) || defined(__VMS)) /* VMS uses logical names instead */
121#if defined(HEADER_CRYPTLIB_H) && !defined(OPENSSLDIR)
122#define ENGINESDIR "/usr/lib/engines"
123#define OPENSSLDIR "/etc/ssl"
124#endif
125#endif
126
127#undef OPENSSL_UNISTD
128#define OPENSSL_UNISTD <unistd.h>
129
130#undef OPENSSL_EXPORT_VAR_AS_FUNCTION
131
132#if defined(HEADER_IDEA_H) && !defined(IDEA_INT)
133#define IDEA_INT unsigned int
134#endif
135
136#if defined(HEADER_MD2_H) && !defined(MD2_INT)
137#define MD2_INT unsigned int
138#endif
139
140#if defined(HEADER_RC2_H) && !defined(RC2_INT)
141/* I need to put in a mod for the alpha - eay */
142#define RC2_INT unsigned int
143#endif
144
145#if defined(HEADER_RC4_H)
146#if !defined(RC4_INT)
147/* using int types make the structure larger but make the code faster
148 * on most boxes I have tested - up to %20 faster. */
149/*
150 * I don't know what does "most" mean, but declaring "int" is a must on:
151 * - Intel P6 because partial register stalls are very expensive;
152 * - elder Alpha because it lacks byte load/store instructions;
153 */
154#define RC4_INT unsigned int
155#endif
156#if !defined(RC4_CHUNK)
157/*
158 * This enables code handling data aligned at natural CPU word
159 * boundary. See crypto/rc4/rc4_enc.c for further details.
160 */
161#undef RC4_CHUNK
162#endif
163#endif
164
165#if (defined(HEADER_NEW_DES_H) || defined(HEADER_DES_H)) && !defined(DES_LONG)
166/* If this is set to 'unsigned int' on a DEC Alpha, this gives about a
167 * %20 speed up (longs are 8 bytes, int's are 4). */
168#ifndef DES_LONG
169#define DES_LONG unsigned int
170#endif
171#endif
172
173#if defined(HEADER_BN_H) && !defined(CONFIG_HEADER_BN_H)
174#define CONFIG_HEADER_BN_H
175#undef BN_LLONG
176
177/* Should we define BN_DIV2W here? */
178
179/* Only one for the following should be defined */
180/* The prime number generation stuff may not work when
181 * EIGHT_BIT but I don't care since I've only used this mode
182 * for debuging the bignum libraries */
183#define SIXTY_FOUR_BIT_LONG
184#undef SIXTY_FOUR_BIT
185#undef THIRTY_TWO_BIT
186#undef SIXTEEN_BIT
187#undef EIGHT_BIT
188#endif
189
190#if defined(HEADER_RC4_LOCL_H) && !defined(CONFIG_HEADER_RC4_LOCL_H)
191#define CONFIG_HEADER_RC4_LOCL_H
192/* if this is defined data[i] is used instead of *data, this is a %20
193 * speedup on x86 */
194#define RC4_INDEX
195#endif
196
197#if defined(HEADER_BF_LOCL_H) && !defined(CONFIG_HEADER_BF_LOCL_H)
198#define CONFIG_HEADER_BF_LOCL_H
199#undef BF_PTR
200#endif /* HEADER_BF_LOCL_H */
201
202#if defined(HEADER_DES_LOCL_H) && !defined(CONFIG_HEADER_DES_LOCL_H)
203#define CONFIG_HEADER_DES_LOCL_H
204#ifndef DES_DEFAULT_OPTIONS
205/* the following is tweaked from a config script, that is why it is a
206 * protected undef/define */
207#ifndef DES_PTR
208#undef DES_PTR
209#endif
210
211/* This helps C compiler generate the correct code for multiple functional
212 * units. It reduces register dependancies at the expense of 2 more
213 * registers */
214#ifndef DES_RISC1
215#define DES_RISC1
216#endif
217
218#ifndef DES_RISC2
219#undef DES_RISC2
220#endif
221
222#if defined(DES_RISC1) && defined(DES_RISC2)
223YOU SHOULD NOT HAVE BOTH DES_RISC1 AND DES_RISC2 DEFINED!!!!!
224#endif
225
226/* Unroll the inner loop, this sometimes helps, sometimes hinders.
227 * Very mucy CPU dependant */
228#ifndef DES_UNROLL
229#define DES_UNROLL
230#endif
231
232/* These default values were supplied by
233 * Peter Gutman <pgut001@cs.auckland.ac.nz>
234 * They are only used if nothing else has been defined */
235#if !defined(DES_PTR) && !defined(DES_RISC1) && !defined(DES_RISC2) && !defined(DES_UNROLL)
236/* Special defines which change the way the code is built depending on the
237 CPU and OS. For SGI machines you can use _MIPS_SZLONG (32 or 64) to find
238 even newer MIPS CPU's, but at the moment one size fits all for
239 optimization options. Older Sparc's work better with only UNROLL, but
240 there's no way to tell at compile time what it is you're running on */
241
242#if defined( sun ) /* Newer Sparc's */
243# define DES_PTR
244# define DES_RISC1
245# define DES_UNROLL
246#elif defined( __ultrix ) /* Older MIPS */
247# define DES_PTR
248# define DES_RISC2
249# define DES_UNROLL
250#elif defined( __osf1__ ) /* Alpha */
251# define DES_PTR
252# define DES_RISC2
253#elif defined ( _AIX ) /* RS6000 */
254 /* Unknown */
255#elif defined( __hpux ) /* HP-PA */
256 /* Unknown */
257#elif defined( __aux ) /* 68K */
258 /* Unknown */
259#elif defined( __dgux ) /* 88K (but P6 in latest boxes) */
260# define DES_UNROLL
261#elif defined( __sgi ) /* Newer MIPS */
262# define DES_PTR
263# define DES_RISC2
264# define DES_UNROLL
265#elif defined(i386) || defined(__i386__) /* x86 boxes, should be gcc */
266# define DES_PTR
267# define DES_RISC1
268# define DES_UNROLL
269#endif /* Systems-specific speed defines */
270#endif
271
272#endif /* DES_DEFAULT_OPTIONS */
273#endif /* HEADER_DES_LOCL_H */
diff --git a/src/lib/libcrypto/crypto/arch/i386/opensslconf.h b/src/lib/libcrypto/crypto/arch/i386/opensslconf.h
new file mode 100644
index 0000000000..f7b5a6dc38
--- /dev/null
+++ b/src/lib/libcrypto/crypto/arch/i386/opensslconf.h
@@ -0,0 +1,273 @@
1/* opensslconf.h */
2/* WARNING: Generated automatically from opensslconf.h.in by Configure. */
3
4/* OpenSSL was configured with the following options: */
5#ifndef OPENSSL_DOING_MAKEDEPEND
6
7
8#ifndef OPENSSL_NO_CAMELLIA
9# define OPENSSL_NO_CAMELLIA
10#endif
11#ifndef OPENSSL_NO_EC_NISTP_64_GCC_128
12# define OPENSSL_NO_EC_NISTP_64_GCC_128
13#endif
14#ifndef OPENSSL_NO_CMS
15# define OPENSSL_NO_CMS
16#endif
17#ifndef OPENSSL_NO_GMP
18# define OPENSSL_NO_GMP
19#endif
20#ifndef OPENSSL_NO_GOST
21# define OPENSSL_NO_GOST
22#endif
23#ifndef OPENSSL_NO_JPAKE
24# define OPENSSL_NO_JPAKE
25#endif
26#ifndef OPENSSL_NO_KRB5
27# define OPENSSL_NO_KRB5
28#endif
29#ifndef OPENSSL_NO_MD2
30# define OPENSSL_NO_MD2
31#endif
32#ifndef OPENSSL_NO_RC5
33# define OPENSSL_NO_RC5
34#endif
35#ifndef OPENSSL_NO_RFC3779
36# define OPENSSL_NO_RFC3779
37#endif
38#ifndef OPENSSL_NO_SCTP
39# define OPENSSL_NO_SCTP
40#endif
41#ifndef OPENSSL_NO_SEED
42# define OPENSSL_NO_SEED
43#endif
44#ifndef OPENSSL_NO_SRP
45# define OPENSSL_NO_SRP
46#endif
47#ifndef OPENSSL_NO_SSL2
48# define OPENSSL_NO_SSL2
49#endif
50#ifndef OPENSSL_NO_STORE
51# define OPENSSL_NO_STORE
52#endif
53
54#endif /* OPENSSL_DOING_MAKEDEPEND */
55
56#ifndef OPENSSL_THREADS
57# define OPENSSL_THREADS
58#endif
59#ifndef OPENSSL_NO_DYNAMIC_ENGINE
60# define OPENSSL_NO_DYNAMIC_ENGINE
61#endif
62
63/* The OPENSSL_NO_* macros are also defined as NO_* if the application
64 asks for it. This is a transient feature that is provided for those
65 who haven't had the time to do the appropriate changes in their
66 applications. */
67#ifdef OPENSSL_ALGORITHM_DEFINES
68# if defined(OPENSSL_NO_CAMELLIA) && !defined(NO_CAMELLIA)
69# define NO_CAMELLIA
70# endif
71# if defined(OPENSSL_NO_EC_NISTP_64_GCC_128) && !defined(NO_EC_NISTP_64_GCC_128)
72# define NO_EC_NISTP_64_GCC_128
73# endif
74# if defined(OPENSSL_NO_CMS) && !defined(NO_CMS)
75# define NO_CMS
76# endif
77# if defined(OPENSSL_NO_GMP) && !defined(NO_GMP)
78# define NO_GMP
79# endif
80# if defined(OPENSSL_NO_GOST) && !defined(NO_GOST)
81# define NO_GOST
82# endif
83# if defined(OPENSSL_NO_JPAKE) && !defined(NO_JPAKE)
84# define NO_JPAKE
85# endif
86# if defined(OPENSSL_NO_KRB5) && !defined(NO_KRB5)
87# define NO_KRB5
88# endif
89# if defined(OPENSSL_NO_MD2) && !defined(NO_MD2)
90# define NO_MD2
91# endif
92# if defined(OPENSSL_NO_RC5) && !defined(NO_RC5)
93# define NO_RC5
94# endif
95# if defined(OPENSSL_NO_RFC3779) && !defined(NO_RFC3779)
96# define NO_RFC3779
97# endif
98# if defined(OPENSSL_NO_SCTP) && !defined(NO_SCTP)
99# define NO_SCTP
100# endif
101# if defined(OPENSSL_NO_SEED) && !defined(NO_SEED)
102# define NO_SEED
103# endif
104# if defined(OPENSSL_NO_SRP) && !defined(NO_SRP)
105# define NO_SRP
106# endif
107# if defined(OPENSSL_NO_SSL2) && !defined(NO_SSL2)
108# define NO_SSL2
109# endif
110# if defined(OPENSSL_NO_STORE) && !defined(NO_STORE)
111# define NO_STORE
112# endif
113#endif
114
115/* crypto/opensslconf.h.in */
116
117/* Generate 80386 code? */
118#undef I386_ONLY
119
120#if !(defined(VMS) || defined(__VMS)) /* VMS uses logical names instead */
121#if defined(HEADER_CRYPTLIB_H) && !defined(OPENSSLDIR)
122#define ENGINESDIR "/usr/lib/engines"
123#define OPENSSLDIR "/etc/ssl"
124#endif
125#endif
126
127#undef OPENSSL_UNISTD
128#define OPENSSL_UNISTD <unistd.h>
129
130#undef OPENSSL_EXPORT_VAR_AS_FUNCTION
131
132#if defined(HEADER_IDEA_H) && !defined(IDEA_INT)
133#define IDEA_INT unsigned int
134#endif
135
136#if defined(HEADER_MD2_H) && !defined(MD2_INT)
137#define MD2_INT unsigned int
138#endif
139
140#if defined(HEADER_RC2_H) && !defined(RC2_INT)
141/* I need to put in a mod for the alpha - eay */
142#define RC2_INT unsigned int
143#endif
144
145#if defined(HEADER_RC4_H)
146#if !defined(RC4_INT)
147/* using int types make the structure larger but make the code faster
148 * on most boxes I have tested - up to %20 faster. */
149/*
150 * I don't know what does "most" mean, but declaring "int" is a must on:
151 * - Intel P6 because partial register stalls are very expensive;
152 * - elder Alpha because it lacks byte load/store instructions;
153 */
154#define RC4_INT unsigned int
155#endif
156#if !defined(RC4_CHUNK)
157/*
158 * This enables code handling data aligned at natural CPU word
159 * boundary. See crypto/rc4/rc4_enc.c for further details.
160 */
161#undef RC4_CHUNK
162#endif
163#endif
164
165#if (defined(HEADER_NEW_DES_H) || defined(HEADER_DES_H)) && !defined(DES_LONG)
166/* If this is set to 'unsigned int' on a DEC Alpha, this gives about a
167 * %20 speed up (longs are 8 bytes, int's are 4). */
168#ifndef DES_LONG
169#define DES_LONG unsigned long
170#endif
171#endif
172
173#if defined(HEADER_BN_H) && !defined(CONFIG_HEADER_BN_H)
174#define CONFIG_HEADER_BN_H
175#define BN_LLONG
176
177/* Should we define BN_DIV2W here? */
178
179/* Only one for the following should be defined */
180/* The prime number generation stuff may not work when
181 * EIGHT_BIT but I don't care since I've only used this mode
182 * for debuging the bignum libraries */
183#undef SIXTY_FOUR_BIT_LONG
184#undef SIXTY_FOUR_BIT
185#define THIRTY_TWO_BIT
186#undef SIXTEEN_BIT
187#undef EIGHT_BIT
188#endif
189
190#if defined(HEADER_RC4_LOCL_H) && !defined(CONFIG_HEADER_RC4_LOCL_H)
191#define CONFIG_HEADER_RC4_LOCL_H
192/* if this is defined data[i] is used instead of *data, this is a %20
193 * speedup on x86 */
194#define RC4_INDEX
195#endif
196
197#if defined(HEADER_BF_LOCL_H) && !defined(CONFIG_HEADER_BF_LOCL_H)
198#define CONFIG_HEADER_BF_LOCL_H
199#undef BF_PTR
200#endif /* HEADER_BF_LOCL_H */
201
202#if defined(HEADER_DES_LOCL_H) && !defined(CONFIG_HEADER_DES_LOCL_H)
203#define CONFIG_HEADER_DES_LOCL_H
204#ifndef DES_DEFAULT_OPTIONS
205/* the following is tweaked from a config script, that is why it is a
206 * protected undef/define */
207#ifndef DES_PTR
208#define DES_PTR
209#endif
210
211/* This helps C compiler generate the correct code for multiple functional
212 * units. It reduces register dependancies at the expense of 2 more
213 * registers */
214#ifndef DES_RISC1
215#define DES_RISC1
216#endif
217
218#ifndef DES_RISC2
219#undef DES_RISC2
220#endif
221
222#if defined(DES_RISC1) && defined(DES_RISC2)
223YOU SHOULD NOT HAVE BOTH DES_RISC1 AND DES_RISC2 DEFINED!!!!!
224#endif
225
226/* Unroll the inner loop, this sometimes helps, sometimes hinders.
227 * Very mucy CPU dependant */
228#ifndef DES_UNROLL
229#define DES_UNROLL
230#endif
231
232/* These default values were supplied by
233 * Peter Gutman <pgut001@cs.auckland.ac.nz>
234 * They are only used if nothing else has been defined */
235#if !defined(DES_PTR) && !defined(DES_RISC1) && !defined(DES_RISC2) && !defined(DES_UNROLL)
236/* Special defines which change the way the code is built depending on the
237 CPU and OS. For SGI machines you can use _MIPS_SZLONG (32 or 64) to find
238 even newer MIPS CPU's, but at the moment one size fits all for
239 optimization options. Older Sparc's work better with only UNROLL, but
240 there's no way to tell at compile time what it is you're running on */
241
242#if defined( sun ) /* Newer Sparc's */
243# define DES_PTR
244# define DES_RISC1
245# define DES_UNROLL
246#elif defined( __ultrix ) /* Older MIPS */
247# define DES_PTR
248# define DES_RISC2
249# define DES_UNROLL
250#elif defined( __osf1__ ) /* Alpha */
251# define DES_PTR
252# define DES_RISC2
253#elif defined ( _AIX ) /* RS6000 */
254 /* Unknown */
255#elif defined( __hpux ) /* HP-PA */
256 /* Unknown */
257#elif defined( __aux ) /* 68K */
258 /* Unknown */
259#elif defined( __dgux ) /* 88K (but P6 in latest boxes) */
260# define DES_UNROLL
261#elif defined( __sgi ) /* Newer MIPS */
262# define DES_PTR
263# define DES_RISC2
264# define DES_UNROLL
265#elif defined(i386) || defined(__i386__) /* x86 boxes, should be gcc */
266# define DES_PTR
267# define DES_RISC1
268# define DES_UNROLL
269#endif /* Systems-specific speed defines */
270#endif
271
272#endif /* DES_DEFAULT_OPTIONS */
273#endif /* HEADER_DES_LOCL_H */
diff --git a/src/lib/libcrypto/crypto/arch/m88k/opensslconf.h b/src/lib/libcrypto/crypto/arch/m88k/opensslconf.h
new file mode 100644
index 0000000000..fc5ea38470
--- /dev/null
+++ b/src/lib/libcrypto/crypto/arch/m88k/opensslconf.h
@@ -0,0 +1,273 @@
1/* opensslconf.h */
2/* WARNING: Generated automatically from opensslconf.h.in by Configure. */
3
4/* OpenSSL was configured with the following options: */
5#ifndef OPENSSL_DOING_MAKEDEPEND
6
7
8#ifndef OPENSSL_NO_CAMELLIA
9# define OPENSSL_NO_CAMELLIA
10#endif
11#ifndef OPENSSL_NO_EC_NISTP_64_GCC_128
12# define OPENSSL_NO_EC_NISTP_64_GCC_128
13#endif
14#ifndef OPENSSL_NO_CMS
15# define OPENSSL_NO_CMS
16#endif
17#ifndef OPENSSL_NO_GMP
18# define OPENSSL_NO_GMP
19#endif
20#ifndef OPENSSL_NO_GOST
21# define OPENSSL_NO_GOST
22#endif
23#ifndef OPENSSL_NO_JPAKE
24# define OPENSSL_NO_JPAKE
25#endif
26#ifndef OPENSSL_NO_KRB5
27# define OPENSSL_NO_KRB5
28#endif
29#ifndef OPENSSL_NO_MD2
30# define OPENSSL_NO_MD2
31#endif
32#ifndef OPENSSL_NO_RC5
33# define OPENSSL_NO_RC5
34#endif
35#ifndef OPENSSL_NO_RFC3779
36# define OPENSSL_NO_RFC3779
37#endif
38#ifndef OPENSSL_NO_SCTP
39# define OPENSSL_NO_SCTP
40#endif
41#ifndef OPENSSL_NO_SEED
42# define OPENSSL_NO_SEED
43#endif
44#ifndef OPENSSL_NO_SRP
45# define OPENSSL_NO_SRP
46#endif
47#ifndef OPENSSL_NO_SSL2
48# define OPENSSL_NO_SSL2
49#endif
50#ifndef OPENSSL_NO_STORE
51# define OPENSSL_NO_STORE
52#endif
53
54#endif /* OPENSSL_DOING_MAKEDEPEND */
55
56#ifndef OPENSSL_THREADS
57# define OPENSSL_THREADS
58#endif
59#ifndef OPENSSL_NO_DYNAMIC_ENGINE
60# define OPENSSL_NO_DYNAMIC_ENGINE
61#endif
62
63/* The OPENSSL_NO_* macros are also defined as NO_* if the application
64 asks for it. This is a transient feature that is provided for those
65 who haven't had the time to do the appropriate changes in their
66 applications. */
67#ifdef OPENSSL_ALGORITHM_DEFINES
68# if defined(OPENSSL_NO_CAMELLIA) && !defined(NO_CAMELLIA)
69# define NO_CAMELLIA
70# endif
71# if defined(OPENSSL_NO_EC_NISTP_64_GCC_128) && !defined(NO_EC_NISTP_64_GCC_128)
72# define NO_EC_NISTP_64_GCC_128
73# endif
74# if defined(OPENSSL_NO_CMS) && !defined(NO_CMS)
75# define NO_CMS
76# endif
77# if defined(OPENSSL_NO_GMP) && !defined(NO_GMP)
78# define NO_GMP
79# endif
80# if defined(OPENSSL_NO_GOST) && !defined(NO_GOST)
81# define NO_GOST
82# endif
83# if defined(OPENSSL_NO_JPAKE) && !defined(NO_JPAKE)
84# define NO_JPAKE
85# endif
86# if defined(OPENSSL_NO_KRB5) && !defined(NO_KRB5)
87# define NO_KRB5
88# endif
89# if defined(OPENSSL_NO_MD2) && !defined(NO_MD2)
90# define NO_MD2
91# endif
92# if defined(OPENSSL_NO_RC5) && !defined(NO_RC5)
93# define NO_RC5
94# endif
95# if defined(OPENSSL_NO_RFC3779) && !defined(NO_RFC3779)
96# define NO_RFC3779
97# endif
98# if defined(OPENSSL_NO_SCTP) && !defined(NO_SCTP)
99# define NO_SCTP
100# endif
101# if defined(OPENSSL_NO_SEED) && !defined(NO_SEED)
102# define NO_SEED
103# endif
104# if defined(OPENSSL_NO_SRP) && !defined(NO_SRP)
105# define NO_SRP
106# endif
107# if defined(OPENSSL_NO_SSL2) && !defined(NO_SSL2)
108# define NO_SSL2
109# endif
110# if defined(OPENSSL_NO_STORE) && !defined(NO_STORE)
111# define NO_STORE
112# endif
113#endif
114
115/* crypto/opensslconf.h.in */
116
117/* Generate 80386 code? */
118#undef I386_ONLY
119
120#if !(defined(VMS) || defined(__VMS)) /* VMS uses logical names instead */
121#if defined(HEADER_CRYPTLIB_H) && !defined(OPENSSLDIR)
122#define ENGINESDIR "/usr/lib/engines"
123#define OPENSSLDIR "/etc/ssl"
124#endif
125#endif
126
127#undef OPENSSL_UNISTD
128#define OPENSSL_UNISTD <unistd.h>
129
130#undef OPENSSL_EXPORT_VAR_AS_FUNCTION
131
132#if defined(HEADER_IDEA_H) && !defined(IDEA_INT)
133#define IDEA_INT unsigned int
134#endif
135
136#if defined(HEADER_MD2_H) && !defined(MD2_INT)
137#define MD2_INT unsigned int
138#endif
139
140#if defined(HEADER_RC2_H) && !defined(RC2_INT)
141/* I need to put in a mod for the alpha - eay */
142#define RC2_INT unsigned int
143#endif
144
145#if defined(HEADER_RC4_H)
146#if !defined(RC4_INT)
147/* using int types make the structure larger but make the code faster
148 * on most boxes I have tested - up to %20 faster. */
149/*
150 * I don't know what does "most" mean, but declaring "int" is a must on:
151 * - Intel P6 because partial register stalls are very expensive;
152 * - elder Alpha because it lacks byte load/store instructions;
153 */
154#define RC4_INT unsigned int
155#endif
156#if !defined(RC4_CHUNK)
157/*
158 * This enables code handling data aligned at natural CPU word
159 * boundary. See crypto/rc4/rc4_enc.c for further details.
160 */
161#undef RC4_CHUNK
162#endif
163#endif
164
165#if (defined(HEADER_NEW_DES_H) || defined(HEADER_DES_H)) && !defined(DES_LONG)
166/* If this is set to 'unsigned int' on a DEC Alpha, this gives about a
167 * %20 speed up (longs are 8 bytes, int's are 4). */
168#ifndef DES_LONG
169#define DES_LONG unsigned int
170#endif
171#endif
172
173#if defined(HEADER_BN_H) && !defined(CONFIG_HEADER_BN_H)
174#define CONFIG_HEADER_BN_H
175#define BN_LLONG
176
177/* Should we define BN_DIV2W here? */
178
179/* Only one for the following should be defined */
180/* The prime number generation stuff may not work when
181 * EIGHT_BIT but I don't care since I've only used this mode
182 * for debuging the bignum libraries */
183#undef SIXTY_FOUR_BIT_LONG
184#undef SIXTY_FOUR_BIT
185#define THIRTY_TWO_BIT
186#undef SIXTEEN_BIT
187#undef EIGHT_BIT
188#endif
189
190#if defined(HEADER_RC4_LOCL_H) && !defined(CONFIG_HEADER_RC4_LOCL_H)
191#define CONFIG_HEADER_RC4_LOCL_H
192/* if this is defined data[i] is used instead of *data, this is a %20
193 * speedup on x86 */
194#define RC4_INDEX
195#endif
196
197#if defined(HEADER_BF_LOCL_H) && !defined(CONFIG_HEADER_BF_LOCL_H)
198#define CONFIG_HEADER_BF_LOCL_H
199#undef BF_PTR
200#endif /* HEADER_BF_LOCL_H */
201
202#if defined(HEADER_DES_LOCL_H) && !defined(CONFIG_HEADER_DES_LOCL_H)
203#define CONFIG_HEADER_DES_LOCL_H
204#ifndef DES_DEFAULT_OPTIONS
205/* the following is tweaked from a config script, that is why it is a
206 * protected undef/define */
207#ifndef DES_PTR
208#undef DES_PTR
209#endif
210
211/* This helps C compiler generate the correct code for multiple functional
212 * units. It reduces register dependancies at the expense of 2 more
213 * registers */
214#ifndef DES_RISC1
215#undef DES_RISC1
216#endif
217
218#ifndef DES_RISC2
219#undef DES_RISC2
220#endif
221
222#if defined(DES_RISC1) && defined(DES_RISC2)
223YOU SHOULD NOT HAVE BOTH DES_RISC1 AND DES_RISC2 DEFINED!!!!!
224#endif
225
226/* Unroll the inner loop, this sometimes helps, sometimes hinders.
227 * Very mucy CPU dependant */
228#ifndef DES_UNROLL
229#define DES_UNROLL
230#endif
231
232/* These default values were supplied by
233 * Peter Gutman <pgut001@cs.auckland.ac.nz>
234 * They are only used if nothing else has been defined */
235#if !defined(DES_PTR) && !defined(DES_RISC1) && !defined(DES_RISC2) && !defined(DES_UNROLL)
236/* Special defines which change the way the code is built depending on the
237 CPU and OS. For SGI machines you can use _MIPS_SZLONG (32 or 64) to find
238 even newer MIPS CPU's, but at the moment one size fits all for
239 optimization options. Older Sparc's work better with only UNROLL, but
240 there's no way to tell at compile time what it is you're running on */
241
242#if defined( sun ) /* Newer Sparc's */
243# define DES_PTR
244# define DES_RISC1
245# define DES_UNROLL
246#elif defined( __ultrix ) /* Older MIPS */
247# define DES_PTR
248# define DES_RISC2
249# define DES_UNROLL
250#elif defined( __osf1__ ) /* Alpha */
251# define DES_PTR
252# define DES_RISC2
253#elif defined ( _AIX ) /* RS6000 */
254 /* Unknown */
255#elif defined( __hpux ) /* HP-PA */
256 /* Unknown */
257#elif defined( __aux ) /* 68K */
258 /* Unknown */
259#elif defined( __dgux ) /* 88K (but P6 in latest boxes) */
260# define DES_UNROLL
261#elif defined( __sgi ) /* Newer MIPS */
262# define DES_PTR
263# define DES_RISC2
264# define DES_UNROLL
265#elif defined(i386) || defined(__i386__) /* x86 boxes, should be gcc */
266# define DES_PTR
267# define DES_RISC1
268# define DES_UNROLL
269#endif /* Systems-specific speed defines */
270#endif
271
272#endif /* DES_DEFAULT_OPTIONS */
273#endif /* HEADER_DES_LOCL_H */
diff --git a/src/lib/libcrypto/crypto/arch/mips64/opensslconf.h b/src/lib/libcrypto/crypto/arch/mips64/opensslconf.h
new file mode 100644
index 0000000000..e55282fd63
--- /dev/null
+++ b/src/lib/libcrypto/crypto/arch/mips64/opensslconf.h
@@ -0,0 +1,273 @@
1/* opensslconf.h */
2/* WARNING: Generated automatically from opensslconf.h.in by Configure. */
3
4/* OpenSSL was configured with the following options: */
5#ifndef OPENSSL_DOING_MAKEDEPEND
6
7
8#ifndef OPENSSL_NO_CAMELLIA
9# define OPENSSL_NO_CAMELLIA
10#endif
11#ifndef OPENSSL_NO_EC_NISTP_64_GCC_128
12# define OPENSSL_NO_EC_NISTP_64_GCC_128
13#endif
14#ifndef OPENSSL_NO_CMS
15# define OPENSSL_NO_CMS
16#endif
17#ifndef OPENSSL_NO_GMP
18# define OPENSSL_NO_GMP
19#endif
20#ifndef OPENSSL_NO_GOST
21# define OPENSSL_NO_GOST
22#endif
23#ifndef OPENSSL_NO_JPAKE
24# define OPENSSL_NO_JPAKE
25#endif
26#ifndef OPENSSL_NO_KRB5
27# define OPENSSL_NO_KRB5
28#endif
29#ifndef OPENSSL_NO_MD2
30# define OPENSSL_NO_MD2
31#endif
32#ifndef OPENSSL_NO_RC5
33# define OPENSSL_NO_RC5
34#endif
35#ifndef OPENSSL_NO_RFC3779
36# define OPENSSL_NO_RFC3779
37#endif
38#ifndef OPENSSL_NO_SCTP
39# define OPENSSL_NO_SCTP
40#endif
41#ifndef OPENSSL_NO_SEED
42# define OPENSSL_NO_SEED
43#endif
44#ifndef OPENSSL_NO_SRP
45# define OPENSSL_NO_SRP
46#endif
47#ifndef OPENSSL_NO_SSL2
48# define OPENSSL_NO_SSL2
49#endif
50#ifndef OPENSSL_NO_STORE
51# define OPENSSL_NO_STORE
52#endif
53
54#endif /* OPENSSL_DOING_MAKEDEPEND */
55
56#ifndef OPENSSL_THREADS
57# define OPENSSL_THREADS
58#endif
59#ifndef OPENSSL_NO_DYNAMIC_ENGINE
60# define OPENSSL_NO_DYNAMIC_ENGINE
61#endif
62
63/* The OPENSSL_NO_* macros are also defined as NO_* if the application
64 asks for it. This is a transient feature that is provided for those
65 who haven't had the time to do the appropriate changes in their
66 applications. */
67#ifdef OPENSSL_ALGORITHM_DEFINES
68# if defined(OPENSSL_NO_CAMELLIA) && !defined(NO_CAMELLIA)
69# define NO_CAMELLIA
70# endif
71# if defined(OPENSSL_NO_EC_NISTP_64_GCC_128) && !defined(NO_EC_NISTP_64_GCC_128)
72# define NO_EC_NISTP_64_GCC_128
73# endif
74# if defined(OPENSSL_NO_CMS) && !defined(NO_CMS)
75# define NO_CMS
76# endif
77# if defined(OPENSSL_NO_GMP) && !defined(NO_GMP)
78# define NO_GMP
79# endif
80# if defined(OPENSSL_NO_GOST) && !defined(NO_GOST)
81# define NO_GOST
82# endif
83# if defined(OPENSSL_NO_JPAKE) && !defined(NO_JPAKE)
84# define NO_JPAKE
85# endif
86# if defined(OPENSSL_NO_KRB5) && !defined(NO_KRB5)
87# define NO_KRB5
88# endif
89# if defined(OPENSSL_NO_MD2) && !defined(NO_MD2)
90# define NO_MD2
91# endif
92# if defined(OPENSSL_NO_RC5) && !defined(NO_RC5)
93# define NO_RC5
94# endif
95# if defined(OPENSSL_NO_RFC3779) && !defined(NO_RFC3779)
96# define NO_RFC3779
97# endif
98# if defined(OPENSSL_NO_SCTP) && !defined(NO_SCTP)
99# define NO_SCTP
100# endif
101# if defined(OPENSSL_NO_SEED) && !defined(NO_SEED)
102# define NO_SEED
103# endif
104# if defined(OPENSSL_NO_SRP) && !defined(NO_SRP)
105# define NO_SRP
106# endif
107# if defined(OPENSSL_NO_SSL2) && !defined(NO_SSL2)
108# define NO_SSL2
109# endif
110# if defined(OPENSSL_NO_STORE) && !defined(NO_STORE)
111# define NO_STORE
112# endif
113#endif
114
115/* crypto/opensslconf.h.in */
116
117/* Generate 80386 code? */
118#undef I386_ONLY
119
120#if !(defined(VMS) || defined(__VMS)) /* VMS uses logical names instead */
121#if defined(HEADER_CRYPTLIB_H) && !defined(OPENSSLDIR)
122#define ENGINESDIR "/usr/lib/engines"
123#define OPENSSLDIR "/etc/ssl"
124#endif
125#endif
126
127#undef OPENSSL_UNISTD
128#define OPENSSL_UNISTD <unistd.h>
129
130#undef OPENSSL_EXPORT_VAR_AS_FUNCTION
131
132#if defined(HEADER_IDEA_H) && !defined(IDEA_INT)
133#define IDEA_INT unsigned int
134#endif
135
136#if defined(HEADER_MD2_H) && !defined(MD2_INT)
137#define MD2_INT unsigned int
138#endif
139
140#if defined(HEADER_RC2_H) && !defined(RC2_INT)
141/* I need to put in a mod for the alpha - eay */
142#define RC2_INT unsigned int
143#endif
144
145#if defined(HEADER_RC4_H)
146#if !defined(RC4_INT)
147/* using int types make the structure larger but make the code faster
148 * on most boxes I have tested - up to %20 faster. */
149/*
150 * I don't know what does "most" mean, but declaring "int" is a must on:
151 * - Intel P6 because partial register stalls are very expensive;
152 * - elder Alpha because it lacks byte load/store instructions;
153 */
154#define RC4_INT unsigned int
155#endif
156#if !defined(RC4_CHUNK)
157/*
158 * This enables code handling data aligned at natural CPU word
159 * boundary. See crypto/rc4/rc4_enc.c for further details.
160 */
161#define RC4_CHUNK unsigned long
162#endif
163#endif
164
165#if (defined(HEADER_NEW_DES_H) || defined(HEADER_DES_H)) && !defined(DES_LONG)
166/* If this is set to 'unsigned int' on a DEC Alpha, this gives about a
167 * %20 speed up (longs are 8 bytes, int's are 4). */
168#ifndef DES_LONG
169#define DES_LONG unsigned int
170#endif
171#endif
172
173#if defined(HEADER_BN_H) && !defined(CONFIG_HEADER_BN_H)
174#define CONFIG_HEADER_BN_H
175#undef BN_LLONG
176
177/* Should we define BN_DIV2W here? */
178
179/* Only one for the following should be defined */
180/* The prime number generation stuff may not work when
181 * EIGHT_BIT but I don't care since I've only used this mode
182 * for debuging the bignum libraries */
183#define SIXTY_FOUR_BIT_LONG
184#undef SIXTY_FOUR_BIT
185#undef THIRTY_TWO_BIT
186#undef SIXTEEN_BIT
187#undef EIGHT_BIT
188#endif
189
190#if defined(HEADER_RC4_LOCL_H) && !defined(CONFIG_HEADER_RC4_LOCL_H)
191#define CONFIG_HEADER_RC4_LOCL_H
192/* if this is defined data[i] is used instead of *data, this is a %20
193 * speedup on x86 */
194#undef RC4_INDEX
195#endif
196
197#if defined(HEADER_BF_LOCL_H) && !defined(CONFIG_HEADER_BF_LOCL_H)
198#define CONFIG_HEADER_BF_LOCL_H
199#define BF_PTR
200#endif /* HEADER_BF_LOCL_H */
201
202#if defined(HEADER_DES_LOCL_H) && !defined(CONFIG_HEADER_DES_LOCL_H)
203#define CONFIG_HEADER_DES_LOCL_H
204#ifndef DES_DEFAULT_OPTIONS
205/* the following is tweaked from a config script, that is why it is a
206 * protected undef/define */
207#ifndef DES_PTR
208#define DES_PTR
209#endif
210
211/* This helps C compiler generate the correct code for multiple functional
212 * units. It reduces register dependancies at the expense of 2 more
213 * registers */
214#ifndef DES_RISC1
215#undef DES_RISC1
216#endif
217
218#ifndef DES_RISC2
219#define DES_RISC2
220#endif
221
222#if defined(DES_RISC1) && defined(DES_RISC2)
223YOU SHOULD NOT HAVE BOTH DES_RISC1 AND DES_RISC2 DEFINED!!!!!
224#endif
225
226/* Unroll the inner loop, this sometimes helps, sometimes hinders.
227 * Very mucy CPU dependant */
228#ifndef DES_UNROLL
229#undef DES_UNROLL
230#endif
231
232/* These default values were supplied by
233 * Peter Gutman <pgut001@cs.auckland.ac.nz>
234 * They are only used if nothing else has been defined */
235#if !defined(DES_PTR) && !defined(DES_RISC1) && !defined(DES_RISC2) && !defined(DES_UNROLL)
236/* Special defines which change the way the code is built depending on the
237 CPU and OS. For SGI machines you can use _MIPS_SZLONG (32 or 64) to find
238 even newer MIPS CPU's, but at the moment one size fits all for
239 optimization options. Older Sparc's work better with only UNROLL, but
240 there's no way to tell at compile time what it is you're running on */
241
242#if defined( sun ) /* Newer Sparc's */
243# define DES_PTR
244# define DES_RISC1
245# define DES_UNROLL
246#elif defined( __ultrix ) /* Older MIPS */
247# define DES_PTR
248# define DES_RISC2
249# define DES_UNROLL
250#elif defined( __osf1__ ) /* Alpha */
251# define DES_PTR
252# define DES_RISC2
253#elif defined ( _AIX ) /* RS6000 */
254 /* Unknown */
255#elif defined( __hpux ) /* HP-PA */
256 /* Unknown */
257#elif defined( __aux ) /* 68K */
258 /* Unknown */
259#elif defined( __dgux ) /* 88K (but P6 in latest boxes) */
260# define DES_UNROLL
261#elif defined( __sgi ) /* Newer MIPS */
262# define DES_PTR
263# define DES_RISC2
264# define DES_UNROLL
265#elif defined(i386) || defined(__i386__) /* x86 boxes, should be gcc */
266# define DES_PTR
267# define DES_RISC1
268# define DES_UNROLL
269#endif /* Systems-specific speed defines */
270#endif
271
272#endif /* DES_DEFAULT_OPTIONS */
273#endif /* HEADER_DES_LOCL_H */
diff --git a/src/lib/libcrypto/crypto/arch/powerpc/opensslconf.h b/src/lib/libcrypto/crypto/arch/powerpc/opensslconf.h
new file mode 100644
index 0000000000..fc5ea38470
--- /dev/null
+++ b/src/lib/libcrypto/crypto/arch/powerpc/opensslconf.h
@@ -0,0 +1,273 @@
1/* opensslconf.h */
2/* WARNING: Generated automatically from opensslconf.h.in by Configure. */
3
4/* OpenSSL was configured with the following options: */
5#ifndef OPENSSL_DOING_MAKEDEPEND
6
7
8#ifndef OPENSSL_NO_CAMELLIA
9# define OPENSSL_NO_CAMELLIA
10#endif
11#ifndef OPENSSL_NO_EC_NISTP_64_GCC_128
12# define OPENSSL_NO_EC_NISTP_64_GCC_128
13#endif
14#ifndef OPENSSL_NO_CMS
15# define OPENSSL_NO_CMS
16#endif
17#ifndef OPENSSL_NO_GMP
18# define OPENSSL_NO_GMP
19#endif
20#ifndef OPENSSL_NO_GOST
21# define OPENSSL_NO_GOST
22#endif
23#ifndef OPENSSL_NO_JPAKE
24# define OPENSSL_NO_JPAKE
25#endif
26#ifndef OPENSSL_NO_KRB5
27# define OPENSSL_NO_KRB5
28#endif
29#ifndef OPENSSL_NO_MD2
30# define OPENSSL_NO_MD2
31#endif
32#ifndef OPENSSL_NO_RC5
33# define OPENSSL_NO_RC5
34#endif
35#ifndef OPENSSL_NO_RFC3779
36# define OPENSSL_NO_RFC3779
37#endif
38#ifndef OPENSSL_NO_SCTP
39# define OPENSSL_NO_SCTP
40#endif
41#ifndef OPENSSL_NO_SEED
42# define OPENSSL_NO_SEED
43#endif
44#ifndef OPENSSL_NO_SRP
45# define OPENSSL_NO_SRP
46#endif
47#ifndef OPENSSL_NO_SSL2
48# define OPENSSL_NO_SSL2
49#endif
50#ifndef OPENSSL_NO_STORE
51# define OPENSSL_NO_STORE
52#endif
53
54#endif /* OPENSSL_DOING_MAKEDEPEND */
55
56#ifndef OPENSSL_THREADS
57# define OPENSSL_THREADS
58#endif
59#ifndef OPENSSL_NO_DYNAMIC_ENGINE
60# define OPENSSL_NO_DYNAMIC_ENGINE
61#endif
62
63/* The OPENSSL_NO_* macros are also defined as NO_* if the application
64 asks for it. This is a transient feature that is provided for those
65 who haven't had the time to do the appropriate changes in their
66 applications. */
67#ifdef OPENSSL_ALGORITHM_DEFINES
68# if defined(OPENSSL_NO_CAMELLIA) && !defined(NO_CAMELLIA)
69# define NO_CAMELLIA
70# endif
71# if defined(OPENSSL_NO_EC_NISTP_64_GCC_128) && !defined(NO_EC_NISTP_64_GCC_128)
72# define NO_EC_NISTP_64_GCC_128
73# endif
74# if defined(OPENSSL_NO_CMS) && !defined(NO_CMS)
75# define NO_CMS
76# endif
77# if defined(OPENSSL_NO_GMP) && !defined(NO_GMP)
78# define NO_GMP
79# endif
80# if defined(OPENSSL_NO_GOST) && !defined(NO_GOST)
81# define NO_GOST
82# endif
83# if defined(OPENSSL_NO_JPAKE) && !defined(NO_JPAKE)
84# define NO_JPAKE
85# endif
86# if defined(OPENSSL_NO_KRB5) && !defined(NO_KRB5)
87# define NO_KRB5
88# endif
89# if defined(OPENSSL_NO_MD2) && !defined(NO_MD2)
90# define NO_MD2
91# endif
92# if defined(OPENSSL_NO_RC5) && !defined(NO_RC5)
93# define NO_RC5
94# endif
95# if defined(OPENSSL_NO_RFC3779) && !defined(NO_RFC3779)
96# define NO_RFC3779
97# endif
98# if defined(OPENSSL_NO_SCTP) && !defined(NO_SCTP)
99# define NO_SCTP
100# endif
101# if defined(OPENSSL_NO_SEED) && !defined(NO_SEED)
102# define NO_SEED
103# endif
104# if defined(OPENSSL_NO_SRP) && !defined(NO_SRP)
105# define NO_SRP
106# endif
107# if defined(OPENSSL_NO_SSL2) && !defined(NO_SSL2)
108# define NO_SSL2
109# endif
110# if defined(OPENSSL_NO_STORE) && !defined(NO_STORE)
111# define NO_STORE
112# endif
113#endif
114
115/* crypto/opensslconf.h.in */
116
117/* Generate 80386 code? */
118#undef I386_ONLY
119
120#if !(defined(VMS) || defined(__VMS)) /* VMS uses logical names instead */
121#if defined(HEADER_CRYPTLIB_H) && !defined(OPENSSLDIR)
122#define ENGINESDIR "/usr/lib/engines"
123#define OPENSSLDIR "/etc/ssl"
124#endif
125#endif
126
127#undef OPENSSL_UNISTD
128#define OPENSSL_UNISTD <unistd.h>
129
130#undef OPENSSL_EXPORT_VAR_AS_FUNCTION
131
132#if defined(HEADER_IDEA_H) && !defined(IDEA_INT)
133#define IDEA_INT unsigned int
134#endif
135
136#if defined(HEADER_MD2_H) && !defined(MD2_INT)
137#define MD2_INT unsigned int
138#endif
139
140#if defined(HEADER_RC2_H) && !defined(RC2_INT)
141/* I need to put in a mod for the alpha - eay */
142#define RC2_INT unsigned int
143#endif
144
145#if defined(HEADER_RC4_H)
146#if !defined(RC4_INT)
147/* using int types make the structure larger but make the code faster
148 * on most boxes I have tested - up to %20 faster. */
149/*
150 * I don't know what does "most" mean, but declaring "int" is a must on:
151 * - Intel P6 because partial register stalls are very expensive;
152 * - elder Alpha because it lacks byte load/store instructions;
153 */
154#define RC4_INT unsigned int
155#endif
156#if !defined(RC4_CHUNK)
157/*
158 * This enables code handling data aligned at natural CPU word
159 * boundary. See crypto/rc4/rc4_enc.c for further details.
160 */
161#undef RC4_CHUNK
162#endif
163#endif
164
165#if (defined(HEADER_NEW_DES_H) || defined(HEADER_DES_H)) && !defined(DES_LONG)
166/* If this is set to 'unsigned int' on a DEC Alpha, this gives about a
167 * %20 speed up (longs are 8 bytes, int's are 4). */
168#ifndef DES_LONG
169#define DES_LONG unsigned int
170#endif
171#endif
172
173#if defined(HEADER_BN_H) && !defined(CONFIG_HEADER_BN_H)
174#define CONFIG_HEADER_BN_H
175#define BN_LLONG
176
177/* Should we define BN_DIV2W here? */
178
179/* Only one for the following should be defined */
180/* The prime number generation stuff may not work when
181 * EIGHT_BIT but I don't care since I've only used this mode
182 * for debuging the bignum libraries */
183#undef SIXTY_FOUR_BIT_LONG
184#undef SIXTY_FOUR_BIT
185#define THIRTY_TWO_BIT
186#undef SIXTEEN_BIT
187#undef EIGHT_BIT
188#endif
189
190#if defined(HEADER_RC4_LOCL_H) && !defined(CONFIG_HEADER_RC4_LOCL_H)
191#define CONFIG_HEADER_RC4_LOCL_H
192/* if this is defined data[i] is used instead of *data, this is a %20
193 * speedup on x86 */
194#define RC4_INDEX
195#endif
196
197#if defined(HEADER_BF_LOCL_H) && !defined(CONFIG_HEADER_BF_LOCL_H)
198#define CONFIG_HEADER_BF_LOCL_H
199#undef BF_PTR
200#endif /* HEADER_BF_LOCL_H */
201
202#if defined(HEADER_DES_LOCL_H) && !defined(CONFIG_HEADER_DES_LOCL_H)
203#define CONFIG_HEADER_DES_LOCL_H
204#ifndef DES_DEFAULT_OPTIONS
205/* the following is tweaked from a config script, that is why it is a
206 * protected undef/define */
207#ifndef DES_PTR
208#undef DES_PTR
209#endif
210
211/* This helps C compiler generate the correct code for multiple functional
212 * units. It reduces register dependancies at the expense of 2 more
213 * registers */
214#ifndef DES_RISC1
215#undef DES_RISC1
216#endif
217
218#ifndef DES_RISC2
219#undef DES_RISC2
220#endif
221
222#if defined(DES_RISC1) && defined(DES_RISC2)
223YOU SHOULD NOT HAVE BOTH DES_RISC1 AND DES_RISC2 DEFINED!!!!!
224#endif
225
226/* Unroll the inner loop, this sometimes helps, sometimes hinders.
227 * Very mucy CPU dependant */
228#ifndef DES_UNROLL
229#define DES_UNROLL
230#endif
231
232/* These default values were supplied by
233 * Peter Gutman <pgut001@cs.auckland.ac.nz>
234 * They are only used if nothing else has been defined */
235#if !defined(DES_PTR) && !defined(DES_RISC1) && !defined(DES_RISC2) && !defined(DES_UNROLL)
236/* Special defines which change the way the code is built depending on the
237 CPU and OS. For SGI machines you can use _MIPS_SZLONG (32 or 64) to find
238 even newer MIPS CPU's, but at the moment one size fits all for
239 optimization options. Older Sparc's work better with only UNROLL, but
240 there's no way to tell at compile time what it is you're running on */
241
242#if defined( sun ) /* Newer Sparc's */
243# define DES_PTR
244# define DES_RISC1
245# define DES_UNROLL
246#elif defined( __ultrix ) /* Older MIPS */
247# define DES_PTR
248# define DES_RISC2
249# define DES_UNROLL
250#elif defined( __osf1__ ) /* Alpha */
251# define DES_PTR
252# define DES_RISC2
253#elif defined ( _AIX ) /* RS6000 */
254 /* Unknown */
255#elif defined( __hpux ) /* HP-PA */
256 /* Unknown */
257#elif defined( __aux ) /* 68K */
258 /* Unknown */
259#elif defined( __dgux ) /* 88K (but P6 in latest boxes) */
260# define DES_UNROLL
261#elif defined( __sgi ) /* Newer MIPS */
262# define DES_PTR
263# define DES_RISC2
264# define DES_UNROLL
265#elif defined(i386) || defined(__i386__) /* x86 boxes, should be gcc */
266# define DES_PTR
267# define DES_RISC1
268# define DES_UNROLL
269#endif /* Systems-specific speed defines */
270#endif
271
272#endif /* DES_DEFAULT_OPTIONS */
273#endif /* HEADER_DES_LOCL_H */
diff --git a/src/lib/libcrypto/crypto/arch/sh/opensslconf.h b/src/lib/libcrypto/crypto/arch/sh/opensslconf.h
new file mode 100644
index 0000000000..fc5ea38470
--- /dev/null
+++ b/src/lib/libcrypto/crypto/arch/sh/opensslconf.h
@@ -0,0 +1,273 @@
1/* opensslconf.h */
2/* WARNING: Generated automatically from opensslconf.h.in by Configure. */
3
4/* OpenSSL was configured with the following options: */
5#ifndef OPENSSL_DOING_MAKEDEPEND
6
7
8#ifndef OPENSSL_NO_CAMELLIA
9# define OPENSSL_NO_CAMELLIA
10#endif
11#ifndef OPENSSL_NO_EC_NISTP_64_GCC_128
12# define OPENSSL_NO_EC_NISTP_64_GCC_128
13#endif
14#ifndef OPENSSL_NO_CMS
15# define OPENSSL_NO_CMS
16#endif
17#ifndef OPENSSL_NO_GMP
18# define OPENSSL_NO_GMP
19#endif
20#ifndef OPENSSL_NO_GOST
21# define OPENSSL_NO_GOST
22#endif
23#ifndef OPENSSL_NO_JPAKE
24# define OPENSSL_NO_JPAKE
25#endif
26#ifndef OPENSSL_NO_KRB5
27# define OPENSSL_NO_KRB5
28#endif
29#ifndef OPENSSL_NO_MD2
30# define OPENSSL_NO_MD2
31#endif
32#ifndef OPENSSL_NO_RC5
33# define OPENSSL_NO_RC5
34#endif
35#ifndef OPENSSL_NO_RFC3779
36# define OPENSSL_NO_RFC3779
37#endif
38#ifndef OPENSSL_NO_SCTP
39# define OPENSSL_NO_SCTP
40#endif
41#ifndef OPENSSL_NO_SEED
42# define OPENSSL_NO_SEED
43#endif
44#ifndef OPENSSL_NO_SRP
45# define OPENSSL_NO_SRP
46#endif
47#ifndef OPENSSL_NO_SSL2
48# define OPENSSL_NO_SSL2
49#endif
50#ifndef OPENSSL_NO_STORE
51# define OPENSSL_NO_STORE
52#endif
53
54#endif /* OPENSSL_DOING_MAKEDEPEND */
55
56#ifndef OPENSSL_THREADS
57# define OPENSSL_THREADS
58#endif
59#ifndef OPENSSL_NO_DYNAMIC_ENGINE
60# define OPENSSL_NO_DYNAMIC_ENGINE
61#endif
62
63/* The OPENSSL_NO_* macros are also defined as NO_* if the application
64 asks for it. This is a transient feature that is provided for those
65 who haven't had the time to do the appropriate changes in their
66 applications. */
67#ifdef OPENSSL_ALGORITHM_DEFINES
68# if defined(OPENSSL_NO_CAMELLIA) && !defined(NO_CAMELLIA)
69# define NO_CAMELLIA
70# endif
71# if defined(OPENSSL_NO_EC_NISTP_64_GCC_128) && !defined(NO_EC_NISTP_64_GCC_128)
72# define NO_EC_NISTP_64_GCC_128
73# endif
74# if defined(OPENSSL_NO_CMS) && !defined(NO_CMS)
75# define NO_CMS
76# endif
77# if defined(OPENSSL_NO_GMP) && !defined(NO_GMP)
78# define NO_GMP
79# endif
80# if defined(OPENSSL_NO_GOST) && !defined(NO_GOST)
81# define NO_GOST
82# endif
83# if defined(OPENSSL_NO_JPAKE) && !defined(NO_JPAKE)
84# define NO_JPAKE
85# endif
86# if defined(OPENSSL_NO_KRB5) && !defined(NO_KRB5)
87# define NO_KRB5
88# endif
89# if defined(OPENSSL_NO_MD2) && !defined(NO_MD2)
90# define NO_MD2
91# endif
92# if defined(OPENSSL_NO_RC5) && !defined(NO_RC5)
93# define NO_RC5
94# endif
95# if defined(OPENSSL_NO_RFC3779) && !defined(NO_RFC3779)
96# define NO_RFC3779
97# endif
98# if defined(OPENSSL_NO_SCTP) && !defined(NO_SCTP)
99# define NO_SCTP
100# endif
101# if defined(OPENSSL_NO_SEED) && !defined(NO_SEED)
102# define NO_SEED
103# endif
104# if defined(OPENSSL_NO_SRP) && !defined(NO_SRP)
105# define NO_SRP
106# endif
107# if defined(OPENSSL_NO_SSL2) && !defined(NO_SSL2)
108# define NO_SSL2
109# endif
110# if defined(OPENSSL_NO_STORE) && !defined(NO_STORE)
111# define NO_STORE
112# endif
113#endif
114
115/* crypto/opensslconf.h.in */
116
117/* Generate 80386 code? */
118#undef I386_ONLY
119
120#if !(defined(VMS) || defined(__VMS)) /* VMS uses logical names instead */
121#if defined(HEADER_CRYPTLIB_H) && !defined(OPENSSLDIR)
122#define ENGINESDIR "/usr/lib/engines"
123#define OPENSSLDIR "/etc/ssl"
124#endif
125#endif
126
127#undef OPENSSL_UNISTD
128#define OPENSSL_UNISTD <unistd.h>
129
130#undef OPENSSL_EXPORT_VAR_AS_FUNCTION
131
132#if defined(HEADER_IDEA_H) && !defined(IDEA_INT)
133#define IDEA_INT unsigned int
134#endif
135
136#if defined(HEADER_MD2_H) && !defined(MD2_INT)
137#define MD2_INT unsigned int
138#endif
139
140#if defined(HEADER_RC2_H) && !defined(RC2_INT)
141/* I need to put in a mod for the alpha - eay */
142#define RC2_INT unsigned int
143#endif
144
145#if defined(HEADER_RC4_H)
146#if !defined(RC4_INT)
147/* using int types make the structure larger but make the code faster
148 * on most boxes I have tested - up to %20 faster. */
149/*
150 * I don't know what does "most" mean, but declaring "int" is a must on:
151 * - Intel P6 because partial register stalls are very expensive;
152 * - elder Alpha because it lacks byte load/store instructions;
153 */
154#define RC4_INT unsigned int
155#endif
156#if !defined(RC4_CHUNK)
157/*
158 * This enables code handling data aligned at natural CPU word
159 * boundary. See crypto/rc4/rc4_enc.c for further details.
160 */
161#undef RC4_CHUNK
162#endif
163#endif
164
165#if (defined(HEADER_NEW_DES_H) || defined(HEADER_DES_H)) && !defined(DES_LONG)
166/* If this is set to 'unsigned int' on a DEC Alpha, this gives about a
167 * %20 speed up (longs are 8 bytes, int's are 4). */
168#ifndef DES_LONG
169#define DES_LONG unsigned int
170#endif
171#endif
172
173#if defined(HEADER_BN_H) && !defined(CONFIG_HEADER_BN_H)
174#define CONFIG_HEADER_BN_H
175#define BN_LLONG
176
177/* Should we define BN_DIV2W here? */
178
179/* Only one for the following should be defined */
180/* The prime number generation stuff may not work when
181 * EIGHT_BIT but I don't care since I've only used this mode
182 * for debuging the bignum libraries */
183#undef SIXTY_FOUR_BIT_LONG
184#undef SIXTY_FOUR_BIT
185#define THIRTY_TWO_BIT
186#undef SIXTEEN_BIT
187#undef EIGHT_BIT
188#endif
189
190#if defined(HEADER_RC4_LOCL_H) && !defined(CONFIG_HEADER_RC4_LOCL_H)
191#define CONFIG_HEADER_RC4_LOCL_H
192/* if this is defined data[i] is used instead of *data, this is a %20
193 * speedup on x86 */
194#define RC4_INDEX
195#endif
196
197#if defined(HEADER_BF_LOCL_H) && !defined(CONFIG_HEADER_BF_LOCL_H)
198#define CONFIG_HEADER_BF_LOCL_H
199#undef BF_PTR
200#endif /* HEADER_BF_LOCL_H */
201
202#if defined(HEADER_DES_LOCL_H) && !defined(CONFIG_HEADER_DES_LOCL_H)
203#define CONFIG_HEADER_DES_LOCL_H
204#ifndef DES_DEFAULT_OPTIONS
205/* the following is tweaked from a config script, that is why it is a
206 * protected undef/define */
207#ifndef DES_PTR
208#undef DES_PTR
209#endif
210
211/* This helps C compiler generate the correct code for multiple functional
212 * units. It reduces register dependancies at the expense of 2 more
213 * registers */
214#ifndef DES_RISC1
215#undef DES_RISC1
216#endif
217
218#ifndef DES_RISC2
219#undef DES_RISC2
220#endif
221
222#if defined(DES_RISC1) && defined(DES_RISC2)
223YOU SHOULD NOT HAVE BOTH DES_RISC1 AND DES_RISC2 DEFINED!!!!!
224#endif
225
226/* Unroll the inner loop, this sometimes helps, sometimes hinders.
227 * Very mucy CPU dependant */
228#ifndef DES_UNROLL
229#define DES_UNROLL
230#endif
231
232/* These default values were supplied by
233 * Peter Gutman <pgut001@cs.auckland.ac.nz>
234 * They are only used if nothing else has been defined */
235#if !defined(DES_PTR) && !defined(DES_RISC1) && !defined(DES_RISC2) && !defined(DES_UNROLL)
236/* Special defines which change the way the code is built depending on the
237 CPU and OS. For SGI machines you can use _MIPS_SZLONG (32 or 64) to find
238 even newer MIPS CPU's, but at the moment one size fits all for
239 optimization options. Older Sparc's work better with only UNROLL, but
240 there's no way to tell at compile time what it is you're running on */
241
242#if defined( sun ) /* Newer Sparc's */
243# define DES_PTR
244# define DES_RISC1
245# define DES_UNROLL
246#elif defined( __ultrix ) /* Older MIPS */
247# define DES_PTR
248# define DES_RISC2
249# define DES_UNROLL
250#elif defined( __osf1__ ) /* Alpha */
251# define DES_PTR
252# define DES_RISC2
253#elif defined ( _AIX ) /* RS6000 */
254 /* Unknown */
255#elif defined( __hpux ) /* HP-PA */
256 /* Unknown */
257#elif defined( __aux ) /* 68K */
258 /* Unknown */
259#elif defined( __dgux ) /* 88K (but P6 in latest boxes) */
260# define DES_UNROLL
261#elif defined( __sgi ) /* Newer MIPS */
262# define DES_PTR
263# define DES_RISC2
264# define DES_UNROLL
265#elif defined(i386) || defined(__i386__) /* x86 boxes, should be gcc */
266# define DES_PTR
267# define DES_RISC1
268# define DES_UNROLL
269#endif /* Systems-specific speed defines */
270#endif
271
272#endif /* DES_DEFAULT_OPTIONS */
273#endif /* HEADER_DES_LOCL_H */
diff --git a/src/lib/libcrypto/crypto/arch/sparc/opensslconf.h b/src/lib/libcrypto/crypto/arch/sparc/opensslconf.h
new file mode 100644
index 0000000000..fc5ea38470
--- /dev/null
+++ b/src/lib/libcrypto/crypto/arch/sparc/opensslconf.h
@@ -0,0 +1,273 @@
1/* opensslconf.h */
2/* WARNING: Generated automatically from opensslconf.h.in by Configure. */
3
4/* OpenSSL was configured with the following options: */
5#ifndef OPENSSL_DOING_MAKEDEPEND
6
7
8#ifndef OPENSSL_NO_CAMELLIA
9# define OPENSSL_NO_CAMELLIA
10#endif
11#ifndef OPENSSL_NO_EC_NISTP_64_GCC_128
12# define OPENSSL_NO_EC_NISTP_64_GCC_128
13#endif
14#ifndef OPENSSL_NO_CMS
15# define OPENSSL_NO_CMS
16#endif
17#ifndef OPENSSL_NO_GMP
18# define OPENSSL_NO_GMP
19#endif
20#ifndef OPENSSL_NO_GOST
21# define OPENSSL_NO_GOST
22#endif
23#ifndef OPENSSL_NO_JPAKE
24# define OPENSSL_NO_JPAKE
25#endif
26#ifndef OPENSSL_NO_KRB5
27# define OPENSSL_NO_KRB5
28#endif
29#ifndef OPENSSL_NO_MD2
30# define OPENSSL_NO_MD2
31#endif
32#ifndef OPENSSL_NO_RC5
33# define OPENSSL_NO_RC5
34#endif
35#ifndef OPENSSL_NO_RFC3779
36# define OPENSSL_NO_RFC3779
37#endif
38#ifndef OPENSSL_NO_SCTP
39# define OPENSSL_NO_SCTP
40#endif
41#ifndef OPENSSL_NO_SEED
42# define OPENSSL_NO_SEED
43#endif
44#ifndef OPENSSL_NO_SRP
45# define OPENSSL_NO_SRP
46#endif
47#ifndef OPENSSL_NO_SSL2
48# define OPENSSL_NO_SSL2
49#endif
50#ifndef OPENSSL_NO_STORE
51# define OPENSSL_NO_STORE
52#endif
53
54#endif /* OPENSSL_DOING_MAKEDEPEND */
55
56#ifndef OPENSSL_THREADS
57# define OPENSSL_THREADS
58#endif
59#ifndef OPENSSL_NO_DYNAMIC_ENGINE
60# define OPENSSL_NO_DYNAMIC_ENGINE
61#endif
62
63/* The OPENSSL_NO_* macros are also defined as NO_* if the application
64 asks for it. This is a transient feature that is provided for those
65 who haven't had the time to do the appropriate changes in their
66 applications. */
67#ifdef OPENSSL_ALGORITHM_DEFINES
68# if defined(OPENSSL_NO_CAMELLIA) && !defined(NO_CAMELLIA)
69# define NO_CAMELLIA
70# endif
71# if defined(OPENSSL_NO_EC_NISTP_64_GCC_128) && !defined(NO_EC_NISTP_64_GCC_128)
72# define NO_EC_NISTP_64_GCC_128
73# endif
74# if defined(OPENSSL_NO_CMS) && !defined(NO_CMS)
75# define NO_CMS
76# endif
77# if defined(OPENSSL_NO_GMP) && !defined(NO_GMP)
78# define NO_GMP
79# endif
80# if defined(OPENSSL_NO_GOST) && !defined(NO_GOST)
81# define NO_GOST
82# endif
83# if defined(OPENSSL_NO_JPAKE) && !defined(NO_JPAKE)
84# define NO_JPAKE
85# endif
86# if defined(OPENSSL_NO_KRB5) && !defined(NO_KRB5)
87# define NO_KRB5
88# endif
89# if defined(OPENSSL_NO_MD2) && !defined(NO_MD2)
90# define NO_MD2
91# endif
92# if defined(OPENSSL_NO_RC5) && !defined(NO_RC5)
93# define NO_RC5
94# endif
95# if defined(OPENSSL_NO_RFC3779) && !defined(NO_RFC3779)
96# define NO_RFC3779
97# endif
98# if defined(OPENSSL_NO_SCTP) && !defined(NO_SCTP)
99# define NO_SCTP
100# endif
101# if defined(OPENSSL_NO_SEED) && !defined(NO_SEED)
102# define NO_SEED
103# endif
104# if defined(OPENSSL_NO_SRP) && !defined(NO_SRP)
105# define NO_SRP
106# endif
107# if defined(OPENSSL_NO_SSL2) && !defined(NO_SSL2)
108# define NO_SSL2
109# endif
110# if defined(OPENSSL_NO_STORE) && !defined(NO_STORE)
111# define NO_STORE
112# endif
113#endif
114
115/* crypto/opensslconf.h.in */
116
117/* Generate 80386 code? */
118#undef I386_ONLY
119
120#if !(defined(VMS) || defined(__VMS)) /* VMS uses logical names instead */
121#if defined(HEADER_CRYPTLIB_H) && !defined(OPENSSLDIR)
122#define ENGINESDIR "/usr/lib/engines"
123#define OPENSSLDIR "/etc/ssl"
124#endif
125#endif
126
127#undef OPENSSL_UNISTD
128#define OPENSSL_UNISTD <unistd.h>
129
130#undef OPENSSL_EXPORT_VAR_AS_FUNCTION
131
132#if defined(HEADER_IDEA_H) && !defined(IDEA_INT)
133#define IDEA_INT unsigned int
134#endif
135
136#if defined(HEADER_MD2_H) && !defined(MD2_INT)
137#define MD2_INT unsigned int
138#endif
139
140#if defined(HEADER_RC2_H) && !defined(RC2_INT)
141/* I need to put in a mod for the alpha - eay */
142#define RC2_INT unsigned int
143#endif
144
145#if defined(HEADER_RC4_H)
146#if !defined(RC4_INT)
147/* using int types make the structure larger but make the code faster
148 * on most boxes I have tested - up to %20 faster. */
149/*
150 * I don't know what does "most" mean, but declaring "int" is a must on:
151 * - Intel P6 because partial register stalls are very expensive;
152 * - elder Alpha because it lacks byte load/store instructions;
153 */
154#define RC4_INT unsigned int
155#endif
156#if !defined(RC4_CHUNK)
157/*
158 * This enables code handling data aligned at natural CPU word
159 * boundary. See crypto/rc4/rc4_enc.c for further details.
160 */
161#undef RC4_CHUNK
162#endif
163#endif
164
165#if (defined(HEADER_NEW_DES_H) || defined(HEADER_DES_H)) && !defined(DES_LONG)
166/* If this is set to 'unsigned int' on a DEC Alpha, this gives about a
167 * %20 speed up (longs are 8 bytes, int's are 4). */
168#ifndef DES_LONG
169#define DES_LONG unsigned int
170#endif
171#endif
172
173#if defined(HEADER_BN_H) && !defined(CONFIG_HEADER_BN_H)
174#define CONFIG_HEADER_BN_H
175#define BN_LLONG
176
177/* Should we define BN_DIV2W here? */
178
179/* Only one for the following should be defined */
180/* The prime number generation stuff may not work when
181 * EIGHT_BIT but I don't care since I've only used this mode
182 * for debuging the bignum libraries */
183#undef SIXTY_FOUR_BIT_LONG
184#undef SIXTY_FOUR_BIT
185#define THIRTY_TWO_BIT
186#undef SIXTEEN_BIT
187#undef EIGHT_BIT
188#endif
189
190#if defined(HEADER_RC4_LOCL_H) && !defined(CONFIG_HEADER_RC4_LOCL_H)
191#define CONFIG_HEADER_RC4_LOCL_H
192/* if this is defined data[i] is used instead of *data, this is a %20
193 * speedup on x86 */
194#define RC4_INDEX
195#endif
196
197#if defined(HEADER_BF_LOCL_H) && !defined(CONFIG_HEADER_BF_LOCL_H)
198#define CONFIG_HEADER_BF_LOCL_H
199#undef BF_PTR
200#endif /* HEADER_BF_LOCL_H */
201
202#if defined(HEADER_DES_LOCL_H) && !defined(CONFIG_HEADER_DES_LOCL_H)
203#define CONFIG_HEADER_DES_LOCL_H
204#ifndef DES_DEFAULT_OPTIONS
205/* the following is tweaked from a config script, that is why it is a
206 * protected undef/define */
207#ifndef DES_PTR
208#undef DES_PTR
209#endif
210
211/* This helps C compiler generate the correct code for multiple functional
212 * units. It reduces register dependancies at the expense of 2 more
213 * registers */
214#ifndef DES_RISC1
215#undef DES_RISC1
216#endif
217
218#ifndef DES_RISC2
219#undef DES_RISC2
220#endif
221
222#if defined(DES_RISC1) && defined(DES_RISC2)
223YOU SHOULD NOT HAVE BOTH DES_RISC1 AND DES_RISC2 DEFINED!!!!!
224#endif
225
226/* Unroll the inner loop, this sometimes helps, sometimes hinders.
227 * Very mucy CPU dependant */
228#ifndef DES_UNROLL
229#define DES_UNROLL
230#endif
231
232/* These default values were supplied by
233 * Peter Gutman <pgut001@cs.auckland.ac.nz>
234 * They are only used if nothing else has been defined */
235#if !defined(DES_PTR) && !defined(DES_RISC1) && !defined(DES_RISC2) && !defined(DES_UNROLL)
236/* Special defines which change the way the code is built depending on the
237 CPU and OS. For SGI machines you can use _MIPS_SZLONG (32 or 64) to find
238 even newer MIPS CPU's, but at the moment one size fits all for
239 optimization options. Older Sparc's work better with only UNROLL, but
240 there's no way to tell at compile time what it is you're running on */
241
242#if defined( sun ) /* Newer Sparc's */
243# define DES_PTR
244# define DES_RISC1
245# define DES_UNROLL
246#elif defined( __ultrix ) /* Older MIPS */
247# define DES_PTR
248# define DES_RISC2
249# define DES_UNROLL
250#elif defined( __osf1__ ) /* Alpha */
251# define DES_PTR
252# define DES_RISC2
253#elif defined ( _AIX ) /* RS6000 */
254 /* Unknown */
255#elif defined( __hpux ) /* HP-PA */
256 /* Unknown */
257#elif defined( __aux ) /* 68K */
258 /* Unknown */
259#elif defined( __dgux ) /* 88K (but P6 in latest boxes) */
260# define DES_UNROLL
261#elif defined( __sgi ) /* Newer MIPS */
262# define DES_PTR
263# define DES_RISC2
264# define DES_UNROLL
265#elif defined(i386) || defined(__i386__) /* x86 boxes, should be gcc */
266# define DES_PTR
267# define DES_RISC1
268# define DES_UNROLL
269#endif /* Systems-specific speed defines */
270#endif
271
272#endif /* DES_DEFAULT_OPTIONS */
273#endif /* HEADER_DES_LOCL_H */
diff --git a/src/lib/libcrypto/crypto/arch/sparc64/opensslconf.h b/src/lib/libcrypto/crypto/arch/sparc64/opensslconf.h
new file mode 100644
index 0000000000..e55282fd63
--- /dev/null
+++ b/src/lib/libcrypto/crypto/arch/sparc64/opensslconf.h
@@ -0,0 +1,273 @@
1/* opensslconf.h */
2/* WARNING: Generated automatically from opensslconf.h.in by Configure. */
3
4/* OpenSSL was configured with the following options: */
5#ifndef OPENSSL_DOING_MAKEDEPEND
6
7
8#ifndef OPENSSL_NO_CAMELLIA
9# define OPENSSL_NO_CAMELLIA
10#endif
11#ifndef OPENSSL_NO_EC_NISTP_64_GCC_128
12# define OPENSSL_NO_EC_NISTP_64_GCC_128
13#endif
14#ifndef OPENSSL_NO_CMS
15# define OPENSSL_NO_CMS
16#endif
17#ifndef OPENSSL_NO_GMP
18# define OPENSSL_NO_GMP
19#endif
20#ifndef OPENSSL_NO_GOST
21# define OPENSSL_NO_GOST
22#endif
23#ifndef OPENSSL_NO_JPAKE
24# define OPENSSL_NO_JPAKE
25#endif
26#ifndef OPENSSL_NO_KRB5
27# define OPENSSL_NO_KRB5
28#endif
29#ifndef OPENSSL_NO_MD2
30# define OPENSSL_NO_MD2
31#endif
32#ifndef OPENSSL_NO_RC5
33# define OPENSSL_NO_RC5
34#endif
35#ifndef OPENSSL_NO_RFC3779
36# define OPENSSL_NO_RFC3779
37#endif
38#ifndef OPENSSL_NO_SCTP
39# define OPENSSL_NO_SCTP
40#endif
41#ifndef OPENSSL_NO_SEED
42# define OPENSSL_NO_SEED
43#endif
44#ifndef OPENSSL_NO_SRP
45# define OPENSSL_NO_SRP
46#endif
47#ifndef OPENSSL_NO_SSL2
48# define OPENSSL_NO_SSL2
49#endif
50#ifndef OPENSSL_NO_STORE
51# define OPENSSL_NO_STORE
52#endif
53
54#endif /* OPENSSL_DOING_MAKEDEPEND */
55
56#ifndef OPENSSL_THREADS
57# define OPENSSL_THREADS
58#endif
59#ifndef OPENSSL_NO_DYNAMIC_ENGINE
60# define OPENSSL_NO_DYNAMIC_ENGINE
61#endif
62
63/* The OPENSSL_NO_* macros are also defined as NO_* if the application
64 asks for it. This is a transient feature that is provided for those
65 who haven't had the time to do the appropriate changes in their
66 applications. */
67#ifdef OPENSSL_ALGORITHM_DEFINES
68# if defined(OPENSSL_NO_CAMELLIA) && !defined(NO_CAMELLIA)
69# define NO_CAMELLIA
70# endif
71# if defined(OPENSSL_NO_EC_NISTP_64_GCC_128) && !defined(NO_EC_NISTP_64_GCC_128)
72# define NO_EC_NISTP_64_GCC_128
73# endif
74# if defined(OPENSSL_NO_CMS) && !defined(NO_CMS)
75# define NO_CMS
76# endif
77# if defined(OPENSSL_NO_GMP) && !defined(NO_GMP)
78# define NO_GMP
79# endif
80# if defined(OPENSSL_NO_GOST) && !defined(NO_GOST)
81# define NO_GOST
82# endif
83# if defined(OPENSSL_NO_JPAKE) && !defined(NO_JPAKE)
84# define NO_JPAKE
85# endif
86# if defined(OPENSSL_NO_KRB5) && !defined(NO_KRB5)
87# define NO_KRB5
88# endif
89# if defined(OPENSSL_NO_MD2) && !defined(NO_MD2)
90# define NO_MD2
91# endif
92# if defined(OPENSSL_NO_RC5) && !defined(NO_RC5)
93# define NO_RC5
94# endif
95# if defined(OPENSSL_NO_RFC3779) && !defined(NO_RFC3779)
96# define NO_RFC3779
97# endif
98# if defined(OPENSSL_NO_SCTP) && !defined(NO_SCTP)
99# define NO_SCTP
100# endif
101# if defined(OPENSSL_NO_SEED) && !defined(NO_SEED)
102# define NO_SEED
103# endif
104# if defined(OPENSSL_NO_SRP) && !defined(NO_SRP)
105# define NO_SRP
106# endif
107# if defined(OPENSSL_NO_SSL2) && !defined(NO_SSL2)
108# define NO_SSL2
109# endif
110# if defined(OPENSSL_NO_STORE) && !defined(NO_STORE)
111# define NO_STORE
112# endif
113#endif
114
115/* crypto/opensslconf.h.in */
116
117/* Generate 80386 code? */
118#undef I386_ONLY
119
120#if !(defined(VMS) || defined(__VMS)) /* VMS uses logical names instead */
121#if defined(HEADER_CRYPTLIB_H) && !defined(OPENSSLDIR)
122#define ENGINESDIR "/usr/lib/engines"
123#define OPENSSLDIR "/etc/ssl"
124#endif
125#endif
126
127#undef OPENSSL_UNISTD
128#define OPENSSL_UNISTD <unistd.h>
129
130#undef OPENSSL_EXPORT_VAR_AS_FUNCTION
131
132#if defined(HEADER_IDEA_H) && !defined(IDEA_INT)
133#define IDEA_INT unsigned int
134#endif
135
136#if defined(HEADER_MD2_H) && !defined(MD2_INT)
137#define MD2_INT unsigned int
138#endif
139
140#if defined(HEADER_RC2_H) && !defined(RC2_INT)
141/* I need to put in a mod for the alpha - eay */
142#define RC2_INT unsigned int
143#endif
144
145#if defined(HEADER_RC4_H)
146#if !defined(RC4_INT)
147/* using int types make the structure larger but make the code faster
148 * on most boxes I have tested - up to %20 faster. */
149/*
150 * I don't know what does "most" mean, but declaring "int" is a must on:
151 * - Intel P6 because partial register stalls are very expensive;
152 * - elder Alpha because it lacks byte load/store instructions;
153 */
154#define RC4_INT unsigned int
155#endif
156#if !defined(RC4_CHUNK)
157/*
158 * This enables code handling data aligned at natural CPU word
159 * boundary. See crypto/rc4/rc4_enc.c for further details.
160 */
161#define RC4_CHUNK unsigned long
162#endif
163#endif
164
165#if (defined(HEADER_NEW_DES_H) || defined(HEADER_DES_H)) && !defined(DES_LONG)
166/* If this is set to 'unsigned int' on a DEC Alpha, this gives about a
167 * %20 speed up (longs are 8 bytes, int's are 4). */
168#ifndef DES_LONG
169#define DES_LONG unsigned int
170#endif
171#endif
172
173#if defined(HEADER_BN_H) && !defined(CONFIG_HEADER_BN_H)
174#define CONFIG_HEADER_BN_H
175#undef BN_LLONG
176
177/* Should we define BN_DIV2W here? */
178
179/* Only one for the following should be defined */
180/* The prime number generation stuff may not work when
181 * EIGHT_BIT but I don't care since I've only used this mode
182 * for debuging the bignum libraries */
183#define SIXTY_FOUR_BIT_LONG
184#undef SIXTY_FOUR_BIT
185#undef THIRTY_TWO_BIT
186#undef SIXTEEN_BIT
187#undef EIGHT_BIT
188#endif
189
190#if defined(HEADER_RC4_LOCL_H) && !defined(CONFIG_HEADER_RC4_LOCL_H)
191#define CONFIG_HEADER_RC4_LOCL_H
192/* if this is defined data[i] is used instead of *data, this is a %20
193 * speedup on x86 */
194#undef RC4_INDEX
195#endif
196
197#if defined(HEADER_BF_LOCL_H) && !defined(CONFIG_HEADER_BF_LOCL_H)
198#define CONFIG_HEADER_BF_LOCL_H
199#define BF_PTR
200#endif /* HEADER_BF_LOCL_H */
201
202#if defined(HEADER_DES_LOCL_H) && !defined(CONFIG_HEADER_DES_LOCL_H)
203#define CONFIG_HEADER_DES_LOCL_H
204#ifndef DES_DEFAULT_OPTIONS
205/* the following is tweaked from a config script, that is why it is a
206 * protected undef/define */
207#ifndef DES_PTR
208#define DES_PTR
209#endif
210
211/* This helps C compiler generate the correct code for multiple functional
212 * units. It reduces register dependancies at the expense of 2 more
213 * registers */
214#ifndef DES_RISC1
215#undef DES_RISC1
216#endif
217
218#ifndef DES_RISC2
219#define DES_RISC2
220#endif
221
222#if defined(DES_RISC1) && defined(DES_RISC2)
223YOU SHOULD NOT HAVE BOTH DES_RISC1 AND DES_RISC2 DEFINED!!!!!
224#endif
225
226/* Unroll the inner loop, this sometimes helps, sometimes hinders.
227 * Very mucy CPU dependant */
228#ifndef DES_UNROLL
229#undef DES_UNROLL
230#endif
231
232/* These default values were supplied by
233 * Peter Gutman <pgut001@cs.auckland.ac.nz>
234 * They are only used if nothing else has been defined */
235#if !defined(DES_PTR) && !defined(DES_RISC1) && !defined(DES_RISC2) && !defined(DES_UNROLL)
236/* Special defines which change the way the code is built depending on the
237 CPU and OS. For SGI machines you can use _MIPS_SZLONG (32 or 64) to find
238 even newer MIPS CPU's, but at the moment one size fits all for
239 optimization options. Older Sparc's work better with only UNROLL, but
240 there's no way to tell at compile time what it is you're running on */
241
242#if defined( sun ) /* Newer Sparc's */
243# define DES_PTR
244# define DES_RISC1
245# define DES_UNROLL
246#elif defined( __ultrix ) /* Older MIPS */
247# define DES_PTR
248# define DES_RISC2
249# define DES_UNROLL
250#elif defined( __osf1__ ) /* Alpha */
251# define DES_PTR
252# define DES_RISC2
253#elif defined ( _AIX ) /* RS6000 */
254 /* Unknown */
255#elif defined( __hpux ) /* HP-PA */
256 /* Unknown */
257#elif defined( __aux ) /* 68K */
258 /* Unknown */
259#elif defined( __dgux ) /* 88K (but P6 in latest boxes) */
260# define DES_UNROLL
261#elif defined( __sgi ) /* Newer MIPS */
262# define DES_PTR
263# define DES_RISC2
264# define DES_UNROLL
265#elif defined(i386) || defined(__i386__) /* x86 boxes, should be gcc */
266# define DES_PTR
267# define DES_RISC1
268# define DES_UNROLL
269#endif /* Systems-specific speed defines */
270#endif
271
272#endif /* DES_DEFAULT_OPTIONS */
273#endif /* HEADER_DES_LOCL_H */
diff --git a/src/lib/libcrypto/crypto/arch/vax/bn_asm_vax.S b/src/lib/libcrypto/crypto/arch/vax/bn_asm_vax.S
new file mode 100644
index 0000000000..2969ae9dac
--- /dev/null
+++ b/src/lib/libcrypto/crypto/arch/vax/bn_asm_vax.S
@@ -0,0 +1,436 @@
1# $OpenBSD: bn_asm_vax.S,v 1.1 2014/04/11 22:51:53 miod Exp $
2# $NetBSD: bn_asm_vax.S,v 1.1 2003/11/03 10:22:28 ragge Exp $
3
4#include <machine/asm.h>
5
6# w.j.m. 15-jan-1999
7#
8# it's magic ...
9#
10# ULONG bn_mul_add_words(ULONG r[],ULONG a[],int n,ULONG w) {
11# ULONG c = 0;
12# int i;
13# for(i = 0; i < n; i++) <c,r[i]> := r[i] + c + a[i] * w ;
14# return c;
15# }
16
17ENTRY(bn_mul_add_words,R6)
18 movl 4(%ap),%r2 # *r
19 movl 8(%ap),%r3 # *a
20 movl 12(%ap),%r4 # n
21 movl 16(%ap),%r5 # w
22 clrl %r6 # return value ("carry")
23
240: emul %r5,(%r3),(%r2),%r0 # w * a[0] + r[0] -> r0
25
26 # fixup for "negative" r[]
27 tstl (%r2)
28 bgeq 1f
29 incl %r1 # add 1 to highword
30
311: # add saved carry to result
32 addl2 %r6,%r0
33 adwc $0,%r1
34
35 # combined fixup for "negative" w, a[]
36 tstl %r5 # if w is negative...
37 bgeq 1f
38 addl2 (%r3),%r1 # ...add a[0] again to highword
391: tstl (%r3) # if a[0] is negative...
40 bgeq 1f
41 addl2 %r5,%r1 # ...add w again to highword
421:
43 movl %r0,(%r2)+ # save low word in dest & advance *r
44 addl2 $4,%r3 # advance *a
45 movl %r1,%r6 # high word in r6 for return value
46
47 sobgtr %r4,0b # loop?
48
49 movl %r6,%r0
50 ret
51
52# .title vax_bn_mul_words unsigned multiply & add, 32*32+32=>64
53#;
54#; w.j.m. 15-jan-1999
55#;
56#; it's magic ...
57#;
58#; ULONG bn_mul_words(ULONG r[],ULONG a[],int n,ULONG w) {
59#; ULONG c = 0;
60#; int i;
61#; for(i = 0; i < num; i++) <c,r[i]> := a[i] * w + c ;
62#; return(c);
63#; }
64#
65
66ENTRY(bn_mul_words,R6)
67 movl 4(%ap),%r2 # *r
68 movl 8(%ap),%r3 # *a
69 movl 12(%ap),%r4 # n
70 movl 16(%ap),%r5 # w
71 clrl %r6 # carry
72
730: emul %r5,(%r3),%r6,%r0 # w * a[0] + carry -> r0
74
75 # fixup for "negative" carry
76 tstl %r6
77 bgeq 1f
78 incl %r1
79
801: # combined fixup for "negative" w, a[]
81 tstl %r5
82 bgeq 1f
83 addl2 (%r3),%r1
841: tstl (%r3)
85 bgeq 1f
86 addl2 %r5,%r1
87
881: movl %r0,(%r2)+
89 addl2 $4,%r3
90 movl %r1,%r6
91
92 sobgtr %r4,0b
93
94 movl %r6,%r0
95 ret
96
97
98
99# .title vax_bn_sqr_words unsigned square, 32*32=>64
100#;
101#; w.j.m. 15-jan-1999
102#;
103#; it's magic ...
104#;
105#; void bn_sqr_words(ULONG r[],ULONG a[],int n) {
106#; int i;
107#; for(i = 0; i < n; i++) <r[2*i+1],r[2*i]> := a[i] * a[i] ;
108#; }
109#
110
111ENTRY(bn_sqr_words,0)
112 movl 4(%ap),%r2 # r
113 movl 8(%ap),%r3 # a
114 movl 12(%ap),%r4 # n
115
1160: movl (%r3)+,%r5 # r5 = a[] & advance
117
118 emul %r5,%r5,$0,%r0 # a[0] * a[0] + 0 -> r0
119
120 # fixup for "negative" a[]
121 tstl %r5
122 bgeq 1f
123 addl2 %r5,%r1
124 addl2 %r5,%r1
125
1261: movq %r0,(%r2)+ # store 64-bit result
127
128 sobgtr %r4,0b # loop
129
130 ret
131
132
133# .title vax_bn_div_words unsigned divide
134#;
135#; Richard Levitte 20-Nov-2000
136#;
137#; ULONG bn_div_words(ULONG h, ULONG l, ULONG d)
138#; {
139#; return ((ULONG)((((ULLONG)h)<<32)|l) / (ULLONG)d);
140#; }
141#;
142#; Using EDIV would be very easy, if it didn't do signed calculations.
143#; Any time any of the input numbers are signed, there are problems,
144#; usually with integer overflow, at which point it returns useless
145#; data (the quotient gets the value of l, and the remainder becomes 0).
146#;
147#; If it was just for the dividend, it would be very easy, just divide
148#; it by 2 (unsigned), do the division, multiply the resulting quotient
149#; and remainder by 2, add the bit that was dropped when dividing by 2
150#; to the remainder, and do some adjustment so the remainder doesn't
151#; end up larger than the divisor. For some cases when the divisor is
152#; negative (from EDIV's point of view, i.e. when the highest bit is set),
153#; dividing the dividend by 2 isn't enough, and since some operations
154#; might generate integer overflows even when the dividend is divided by
155#; 4 (when the high part of the shifted down dividend ends up being exactly
156#; half of the divisor, the result is the quotient 0x80000000, which is
157#; negative...) it needs to be divided by 8. Furthermore, the divisor needs
158#; to be divided by 2 (unsigned) as well, to avoid more problems with the sign.
159#; In this case, a little extra fiddling with the remainder is required.
160#;
161#; So, the simplest way to handle this is always to divide the dividend
162#; by 8, and to divide the divisor by 2 if it's highest bit is set.
163#; After EDIV has been used, the quotient gets multiplied by 8 if the
164#; original divisor was positive, otherwise 4. The remainder, oddly
165#; enough, is *always* multiplied by 8.
166#; NOTE: in the case mentioned above, where the high part of the shifted
167#; down dividend ends up being exactly half the shifted down divisor, we
168#; end up with a 33 bit quotient. That's no problem however, it usually
169#; means we have ended up with a too large remainder as well, and the
170#; problem is fixed by the last part of the algorithm (next paragraph).
171#;
172#; The routine ends with comparing the resulting remainder with the
173#; original divisor and if the remainder is larger, subtract the
174#; original divisor from it, and increase the quotient by 1. This is
175#; done until the remainder is smaller than the divisor.
176#;
177#; The complete algorithm looks like this:
178#;
179#; d' = d
180#; l' = l & 7
181#; [h,l] = [h,l] >> 3
182#; [q,r] = floor([h,l] / d) # This is the EDIV operation
183#; if (q < 0) q = -q # I doubt this is necessary any more
184#;
185#; r' = r >> 29
186#; if (d' >= 0)
187#; q' = q >> 29
188#; q = q << 3
189#; else
190#; q' = q >> 30
191#; q = q << 2
192#; r = (r << 3) + l'
193#;
194#; if (d' < 0)
195#; {
196#; [r',r] = [r',r] - q
197#; while ([r',r] < 0)
198#; {
199#; [r',r] = [r',r] + d
200#; [q',q] = [q',q] - 1
201#; }
202#; }
203#;
204#; while ([r',r] >= d')
205#; {
206#; [r',r] = [r',r] - d'
207#; [q',q] = [q',q] + 1
208#; }
209#;
210#; return q
211#
212#;r2 = l, q
213#;r3 = h, r
214#;r4 = d
215#;r5 = l'
216#;r6 = r'
217#;r7 = d'
218#;r8 = q'
219#
220
221ENTRY(bn_div_words,R6|R7|R8)
222 movl 4(%ap),%r3 # h
223 movl 8(%ap),%r2 # l
224 movl 12(%ap),%r4 # d
225
226 bicl3 $-8,%r2,%r5 # l' = l & 7
227 bicl3 $7,%r2,%r2
228
229 bicl3 $-8,%r3,%r6
230 bicl3 $7,%r3,%r3
231
232 addl2 %r6,%r2
233
234 rotl $-3,%r2,%r2 # l = l >> 3
235 rotl $-3,%r3,%r3 # h = h >> 3
236
237 movl %r4,%r7 # d' = d
238
239 clrl %r6 # r' = 0
240 clrl %r8 # q' = 0
241
242 tstl %r4
243 beql 0f # Uh-oh, the divisor is 0...
244 bgtr 1f
245 rotl $-1,%r4,%r4 # If d is negative, shift it right.
246 bicl2 $0x80000000,%r4 # Since d is then a large number, the
247 # lowest bit is insignificant
248 # (contradict that, and I'll fix the problem!)
2491:
250 ediv %r4,%r2,%r2,%r3 # Do the actual division
251
252 tstl %r2
253 bgeq 1f
254 mnegl %r2,%r2 # if q < 0, negate it
2551:
256 tstl %r7
257 blss 1f
258 rotl $3,%r2,%r2 # q = q << 3
259 bicl3 $-8,%r2,%r8 # q' gets the high bits from q
260 bicl3 $7,%r2,%r2
261 brb 2f
262
2631: # else
264 rotl $2,%r2,%r2 # q = q << 2
265 bicl3 $-4,%r2,%r8 # q' gets the high bits from q
266 bicl3 $3,%r2,%r2
2672:
268 rotl $3,%r3,%r3 # r = r << 3
269 bicl3 $-8,%r3,%r6 # r' gets the high bits from r
270 bicl3 $7,%r3,%r3
271 addl2 %r5,%r3 # r = r + l'
272
273 tstl %r7
274 bgeq 5f
275 bitl $1,%r7
276 beql 5f # if d' < 0 && d' & 1
277 subl2 %r2,%r3 # [r',r] = [r',r] - [q',q]
278 sbwc %r8,%r6
2793:
280 bgeq 5f # while r < 0
281 decl %r2 # [q',q] = [q',q] - 1
282 sbwc $0,%r8
283 addl2 %r7,%r3 # [r',r] = [r',r] + d'
284 adwc $0,%r6
285 brb 3b
286
287# The return points are placed in the middle to keep a short distance from
288# all the branch points
2891:
290# movl %r3,%r1
291 movl %r2,%r0
292 ret
2930:
294 movl $-1,%r0
295 ret
2965:
297 tstl %r6
298 bneq 6f
299 cmpl %r3,%r7
300 blssu 1b # while [r',r] >= d'
3016:
302 subl2 %r7,%r3 # [r',r] = [r',r] - d'
303 sbwc $0,%r6
304 incl %r2 # [q',q] = [q',q] + 1
305 adwc $0,%r8
306 brb 5b
307
308
309
310# .title vax_bn_add_words unsigned add of two arrays
311#;
312#; Richard Levitte 20-Nov-2000
313#;
314#; ULONG bn_add_words(ULONG r[], ULONG a[], ULONG b[], int n) {
315#; ULONG c = 0;
316#; int i;
317#; for (i = 0; i < n; i++) <c,r[i]> = a[i] + b[i] + c;
318#; return(c);
319#; }
320#
321
322ENTRY(bn_add_words,0)
323 movl 4(%ap),%r2 # r
324 movl 8(%ap),%r3 # a
325 movl 12(%ap),%r4 # b
326 movl 16(%ap),%r5 # n
327 clrl %r0
328
329 tstl %r5
330 bleq 1f
331
3320: movl (%r3)+,%r1 # carry untouched
333 adwc (%r4)+,%r1 # carry used and touched
334 movl %r1,(%r2)+ # carry untouched
335 sobgtr %r5,0b # carry untouched
336
337 adwc $0,%r0
3381: ret
339
340#;
341#; Richard Levitte 20-Nov-2000
342#;
343#; ULONG bn_sub_words(ULONG r[], ULONG a[], ULONG b[], int n) {
344#; ULONG c = 0;
345#; int i;
346#; for (i = 0; i < n; i++) <c,r[i]> = a[i] - b[i] - c;
347#; return(c);
348#; }
349#
350
351ENTRY(bn_sub_words,R6)
352 movl 4(%ap),%r2 # r
353 movl 8(%ap),%r3 # a
354 movl 12(%ap),%r4 # b
355 movl 16(%ap),%r5 # n
356 clrl %r0
357
358 tstl %r5
359 bleq 1f
360
3610: movl (%r3)+,%r6 # carry untouched
362 sbwc (%r4)+,%r6 # carry used and touched
363 movl %r6,(%r2)+ # carry untouched
364 sobgtr %r5,0b # carry untouched
365
3661: adwc $0,%r0
367 ret
368
369#
370# Ragge 20-Sep-2003
371#
372# Multiply a vector of 4/8 longword by another.
373# Uses two loops and 16/64 emuls.
374#
375
376ENTRY(bn_mul_comba4,R6|R7|R8|R9)
377 movl $4,%r9 # 4*4
378 brb 6f
379
380ENTRY(bn_mul_comba8,R6|R7|R8|R9)
381 movl $8,%r9 # 8*8
382
3836: movl 8(%ap),%r3 # a[]
384 movl 12(%ap),%r7 # b[]
385 brb 5f
386
387ENTRY(bn_sqr_comba4,R6|R7|R8|R9)
388 movl $4,%r9 # 4*4
389 brb 0f
390
391ENTRY(bn_sqr_comba8,R6|R7|R8|R9)
392 movl $8,%r9 # 8*8
393
3940:
395 movl 8(%ap),%r3 # a[]
396 movl %r3,%r7 # a[]
397
3985: movl 4(%ap),%r5 # r[]
399 movl %r9,%r8
400
401 clrq (%r5) # clear destinatino, for add.
402 clrq 8(%r5)
403 clrq 16(%r5) # these only needed for comba8
404 clrq 24(%r5)
405
4062: clrl %r4 # carry
407 movl %r9,%r6 # inner loop count
408 movl (%r7)+,%r2 # value to multiply with
409
4101: emul %r2,(%r3),%r4,%r0
411 tstl %r4
412 bgeq 3f
413 incl %r1
4143: tstl %r2
415 bgeq 3f
416 addl2 (%r3),%r1
4173: tstl (%r3)
418 bgeq 3f
419 addl2 %r2,%r1
420
4213: addl2 %r0,(%r5)+ # add to destination
422 adwc $0,%r1 # remember carry
423 movl %r1,%r4 # add carry in next emul
424 addl2 $4,%r3
425 sobgtr %r6,1b
426
427 movl %r4,(%r5) # save highest add result
428
429 ashl $2,%r9,%r4
430 subl2 %r4,%r3
431 subl2 $4,%r4
432 subl2 %r4,%r5
433
434 sobgtr %r8,2b
435
436 ret
diff --git a/src/lib/libcrypto/crypto/arch/vax/opensslconf.h b/src/lib/libcrypto/crypto/arch/vax/opensslconf.h
new file mode 100644
index 0000000000..fc5ea38470
--- /dev/null
+++ b/src/lib/libcrypto/crypto/arch/vax/opensslconf.h
@@ -0,0 +1,273 @@
1/* opensslconf.h */
2/* WARNING: Generated automatically from opensslconf.h.in by Configure. */
3
4/* OpenSSL was configured with the following options: */
5#ifndef OPENSSL_DOING_MAKEDEPEND
6
7
8#ifndef OPENSSL_NO_CAMELLIA
9# define OPENSSL_NO_CAMELLIA
10#endif
11#ifndef OPENSSL_NO_EC_NISTP_64_GCC_128
12# define OPENSSL_NO_EC_NISTP_64_GCC_128
13#endif
14#ifndef OPENSSL_NO_CMS
15# define OPENSSL_NO_CMS
16#endif
17#ifndef OPENSSL_NO_GMP
18# define OPENSSL_NO_GMP
19#endif
20#ifndef OPENSSL_NO_GOST
21# define OPENSSL_NO_GOST
22#endif
23#ifndef OPENSSL_NO_JPAKE
24# define OPENSSL_NO_JPAKE
25#endif
26#ifndef OPENSSL_NO_KRB5
27# define OPENSSL_NO_KRB5
28#endif
29#ifndef OPENSSL_NO_MD2
30# define OPENSSL_NO_MD2
31#endif
32#ifndef OPENSSL_NO_RC5
33# define OPENSSL_NO_RC5
34#endif
35#ifndef OPENSSL_NO_RFC3779
36# define OPENSSL_NO_RFC3779
37#endif
38#ifndef OPENSSL_NO_SCTP
39# define OPENSSL_NO_SCTP
40#endif
41#ifndef OPENSSL_NO_SEED
42# define OPENSSL_NO_SEED
43#endif
44#ifndef OPENSSL_NO_SRP
45# define OPENSSL_NO_SRP
46#endif
47#ifndef OPENSSL_NO_SSL2
48# define OPENSSL_NO_SSL2
49#endif
50#ifndef OPENSSL_NO_STORE
51# define OPENSSL_NO_STORE
52#endif
53
54#endif /* OPENSSL_DOING_MAKEDEPEND */
55
56#ifndef OPENSSL_THREADS
57# define OPENSSL_THREADS
58#endif
59#ifndef OPENSSL_NO_DYNAMIC_ENGINE
60# define OPENSSL_NO_DYNAMIC_ENGINE
61#endif
62
63/* The OPENSSL_NO_* macros are also defined as NO_* if the application
64 asks for it. This is a transient feature that is provided for those
65 who haven't had the time to do the appropriate changes in their
66 applications. */
67#ifdef OPENSSL_ALGORITHM_DEFINES
68# if defined(OPENSSL_NO_CAMELLIA) && !defined(NO_CAMELLIA)
69# define NO_CAMELLIA
70# endif
71# if defined(OPENSSL_NO_EC_NISTP_64_GCC_128) && !defined(NO_EC_NISTP_64_GCC_128)
72# define NO_EC_NISTP_64_GCC_128
73# endif
74# if defined(OPENSSL_NO_CMS) && !defined(NO_CMS)
75# define NO_CMS
76# endif
77# if defined(OPENSSL_NO_GMP) && !defined(NO_GMP)
78# define NO_GMP
79# endif
80# if defined(OPENSSL_NO_GOST) && !defined(NO_GOST)
81# define NO_GOST
82# endif
83# if defined(OPENSSL_NO_JPAKE) && !defined(NO_JPAKE)
84# define NO_JPAKE
85# endif
86# if defined(OPENSSL_NO_KRB5) && !defined(NO_KRB5)
87# define NO_KRB5
88# endif
89# if defined(OPENSSL_NO_MD2) && !defined(NO_MD2)
90# define NO_MD2
91# endif
92# if defined(OPENSSL_NO_RC5) && !defined(NO_RC5)
93# define NO_RC5
94# endif
95# if defined(OPENSSL_NO_RFC3779) && !defined(NO_RFC3779)
96# define NO_RFC3779
97# endif
98# if defined(OPENSSL_NO_SCTP) && !defined(NO_SCTP)
99# define NO_SCTP
100# endif
101# if defined(OPENSSL_NO_SEED) && !defined(NO_SEED)
102# define NO_SEED
103# endif
104# if defined(OPENSSL_NO_SRP) && !defined(NO_SRP)
105# define NO_SRP
106# endif
107# if defined(OPENSSL_NO_SSL2) && !defined(NO_SSL2)
108# define NO_SSL2
109# endif
110# if defined(OPENSSL_NO_STORE) && !defined(NO_STORE)
111# define NO_STORE
112# endif
113#endif
114
115/* crypto/opensslconf.h.in */
116
117/* Generate 80386 code? */
118#undef I386_ONLY
119
120#if !(defined(VMS) || defined(__VMS)) /* VMS uses logical names instead */
121#if defined(HEADER_CRYPTLIB_H) && !defined(OPENSSLDIR)
122#define ENGINESDIR "/usr/lib/engines"
123#define OPENSSLDIR "/etc/ssl"
124#endif
125#endif
126
127#undef OPENSSL_UNISTD
128#define OPENSSL_UNISTD <unistd.h>
129
130#undef OPENSSL_EXPORT_VAR_AS_FUNCTION
131
132#if defined(HEADER_IDEA_H) && !defined(IDEA_INT)
133#define IDEA_INT unsigned int
134#endif
135
136#if defined(HEADER_MD2_H) && !defined(MD2_INT)
137#define MD2_INT unsigned int
138#endif
139
140#if defined(HEADER_RC2_H) && !defined(RC2_INT)
141/* I need to put in a mod for the alpha - eay */
142#define RC2_INT unsigned int
143#endif
144
145#if defined(HEADER_RC4_H)
146#if !defined(RC4_INT)
147/* using int types make the structure larger but make the code faster
148 * on most boxes I have tested - up to %20 faster. */
149/*
150 * I don't know what does "most" mean, but declaring "int" is a must on:
151 * - Intel P6 because partial register stalls are very expensive;
152 * - elder Alpha because it lacks byte load/store instructions;
153 */
154#define RC4_INT unsigned int
155#endif
156#if !defined(RC4_CHUNK)
157/*
158 * This enables code handling data aligned at natural CPU word
159 * boundary. See crypto/rc4/rc4_enc.c for further details.
160 */
161#undef RC4_CHUNK
162#endif
163#endif
164
165#if (defined(HEADER_NEW_DES_H) || defined(HEADER_DES_H)) && !defined(DES_LONG)
166/* If this is set to 'unsigned int' on a DEC Alpha, this gives about a
167 * %20 speed up (longs are 8 bytes, int's are 4). */
168#ifndef DES_LONG
169#define DES_LONG unsigned int
170#endif
171#endif
172
173#if defined(HEADER_BN_H) && !defined(CONFIG_HEADER_BN_H)
174#define CONFIG_HEADER_BN_H
175#define BN_LLONG
176
177/* Should we define BN_DIV2W here? */
178
179/* Only one for the following should be defined */
180/* The prime number generation stuff may not work when
181 * EIGHT_BIT but I don't care since I've only used this mode
182 * for debuging the bignum libraries */
183#undef SIXTY_FOUR_BIT_LONG
184#undef SIXTY_FOUR_BIT
185#define THIRTY_TWO_BIT
186#undef SIXTEEN_BIT
187#undef EIGHT_BIT
188#endif
189
190#if defined(HEADER_RC4_LOCL_H) && !defined(CONFIG_HEADER_RC4_LOCL_H)
191#define CONFIG_HEADER_RC4_LOCL_H
192/* if this is defined data[i] is used instead of *data, this is a %20
193 * speedup on x86 */
194#define RC4_INDEX
195#endif
196
197#if defined(HEADER_BF_LOCL_H) && !defined(CONFIG_HEADER_BF_LOCL_H)
198#define CONFIG_HEADER_BF_LOCL_H
199#undef BF_PTR
200#endif /* HEADER_BF_LOCL_H */
201
202#if defined(HEADER_DES_LOCL_H) && !defined(CONFIG_HEADER_DES_LOCL_H)
203#define CONFIG_HEADER_DES_LOCL_H
204#ifndef DES_DEFAULT_OPTIONS
205/* the following is tweaked from a config script, that is why it is a
206 * protected undef/define */
207#ifndef DES_PTR
208#undef DES_PTR
209#endif
210
211/* This helps C compiler generate the correct code for multiple functional
212 * units. It reduces register dependancies at the expense of 2 more
213 * registers */
214#ifndef DES_RISC1
215#undef DES_RISC1
216#endif
217
218#ifndef DES_RISC2
219#undef DES_RISC2
220#endif
221
222#if defined(DES_RISC1) && defined(DES_RISC2)
223YOU SHOULD NOT HAVE BOTH DES_RISC1 AND DES_RISC2 DEFINED!!!!!
224#endif
225
226/* Unroll the inner loop, this sometimes helps, sometimes hinders.
227 * Very mucy CPU dependant */
228#ifndef DES_UNROLL
229#define DES_UNROLL
230#endif
231
232/* These default values were supplied by
233 * Peter Gutman <pgut001@cs.auckland.ac.nz>
234 * They are only used if nothing else has been defined */
235#if !defined(DES_PTR) && !defined(DES_RISC1) && !defined(DES_RISC2) && !defined(DES_UNROLL)
236/* Special defines which change the way the code is built depending on the
237 CPU and OS. For SGI machines you can use _MIPS_SZLONG (32 or 64) to find
238 even newer MIPS CPU's, but at the moment one size fits all for
239 optimization options. Older Sparc's work better with only UNROLL, but
240 there's no way to tell at compile time what it is you're running on */
241
242#if defined( sun ) /* Newer Sparc's */
243# define DES_PTR
244# define DES_RISC1
245# define DES_UNROLL
246#elif defined( __ultrix ) /* Older MIPS */
247# define DES_PTR
248# define DES_RISC2
249# define DES_UNROLL
250#elif defined( __osf1__ ) /* Alpha */
251# define DES_PTR
252# define DES_RISC2
253#elif defined ( _AIX ) /* RS6000 */
254 /* Unknown */
255#elif defined( __hpux ) /* HP-PA */
256 /* Unknown */
257#elif defined( __aux ) /* 68K */
258 /* Unknown */
259#elif defined( __dgux ) /* 88K (but P6 in latest boxes) */
260# define DES_UNROLL
261#elif defined( __sgi ) /* Newer MIPS */
262# define DES_PTR
263# define DES_RISC2
264# define DES_UNROLL
265#elif defined(i386) || defined(__i386__) /* x86 boxes, should be gcc */
266# define DES_PTR
267# define DES_RISC1
268# define DES_UNROLL
269#endif /* Systems-specific speed defines */
270#endif
271
272#endif /* DES_DEFAULT_OPTIONS */
273#endif /* HEADER_DES_LOCL_H */
diff --git a/src/lib/libcrypto/crypto/shlib_version b/src/lib/libcrypto/crypto/shlib_version
new file mode 100644
index 0000000000..df4de0fc4d
--- /dev/null
+++ b/src/lib/libcrypto/crypto/shlib_version
@@ -0,0 +1,2 @@
1major=23
2minor=0
diff --git a/src/lib/libcrypto/des/DES.pm b/src/lib/libcrypto/des/DES.pm
new file mode 100644
index 0000000000..6a175b6ca4
--- /dev/null
+++ b/src/lib/libcrypto/des/DES.pm
@@ -0,0 +1,19 @@
1package DES;
2
3require Exporter;
4require DynaLoader;
5@ISA = qw(Exporter DynaLoader);
6# Items to export into callers namespace by default
7# (move infrequently used names to @EXPORT_OK below)
8@EXPORT = qw(
9);
10# Other items we are prepared to export if requested
11@EXPORT_OK = qw(
12crypt
13);
14
15# Preloaded methods go here. Autoload methods go after __END__, and are
16# processed by the autosplit program.
17bootstrap DES;
181;
19__END__
diff --git a/src/lib/libcrypto/des/DES.xs b/src/lib/libcrypto/des/DES.xs
new file mode 100644
index 0000000000..b8050b9edf
--- /dev/null
+++ b/src/lib/libcrypto/des/DES.xs
@@ -0,0 +1,268 @@
1#include "EXTERN.h"
2#include "perl.h"
3#include "XSUB.h"
4#include "des.h"
5
6#define deschar char
7static STRLEN len;
8
9static int
10not_here(s)
11char *s;
12{
13 croak("%s not implemented on this architecture", s);
14 return -1;
15}
16
17MODULE = DES PACKAGE = DES PREFIX = des_
18
19char *
20des_crypt(buf,salt)
21 char * buf
22 char * salt
23
24void
25des_set_odd_parity(key)
26 des_cblock * key
27PPCODE:
28 {
29 SV *s;
30
31 s=sv_newmortal();
32 sv_setpvn(s,(char *)key,8);
33 des_set_odd_parity((des_cblock *)SvPV(s,na));
34 PUSHs(s);
35 }
36
37int
38des_is_weak_key(key)
39 des_cblock * key
40
41des_key_schedule
42des_set_key(key)
43 des_cblock * key
44CODE:
45 des_set_key(key,RETVAL);
46OUTPUT:
47RETVAL
48
49des_cblock
50des_ecb_encrypt(input,ks,encrypt)
51 des_cblock * input
52 des_key_schedule * ks
53 int encrypt
54CODE:
55 des_ecb_encrypt(input,&RETVAL,*ks,encrypt);
56OUTPUT:
57RETVAL
58
59void
60des_cbc_encrypt(input,ks,ivec,encrypt)
61 char * input
62 des_key_schedule * ks
63 des_cblock * ivec
64 int encrypt
65PPCODE:
66 {
67 SV *s;
68 STRLEN len,l;
69 char *c;
70
71 l=SvCUR(ST(0));
72 len=((((unsigned long)l)+7)/8)*8;
73 s=sv_newmortal();
74 sv_setpvn(s,"",0);
75 SvGROW(s,len);
76 SvCUR_set(s,len);
77 c=(char *)SvPV(s,na);
78 des_cbc_encrypt((des_cblock *)input,(des_cblock *)c,
79 l,*ks,ivec,encrypt);
80 sv_setpvn(ST(2),(char *)c[len-8],8);
81 PUSHs(s);
82 }
83
84void
85des_cbc3_encrypt(input,ks1,ks2,ivec1,ivec2,encrypt)
86 char * input
87 des_key_schedule * ks1
88 des_key_schedule * ks2
89 des_cblock * ivec1
90 des_cblock * ivec2
91 int encrypt
92PPCODE:
93 {
94 SV *s;
95 STRLEN len,l;
96
97 l=SvCUR(ST(0));
98 len=((((unsigned long)l)+7)/8)*8;
99 s=sv_newmortal();
100 sv_setpvn(s,"",0);
101 SvGROW(s,len);
102 SvCUR_set(s,len);
103 des_3cbc_encrypt((des_cblock *)input,(des_cblock *)SvPV(s,na),
104 l,*ks1,*ks2,ivec1,ivec2,encrypt);
105 sv_setpvn(ST(3),(char *)ivec1,8);
106 sv_setpvn(ST(4),(char *)ivec2,8);
107 PUSHs(s);
108 }
109
110void
111des_cbc_cksum(input,ks,ivec)
112 char * input
113 des_key_schedule * ks
114 des_cblock * ivec
115PPCODE:
116 {
117 SV *s1,*s2;
118 STRLEN len,l;
119 des_cblock c;
120 unsigned long i1,i2;
121
122 s1=sv_newmortal();
123 s2=sv_newmortal();
124 l=SvCUR(ST(0));
125 des_cbc_cksum((des_cblock *)input,(des_cblock *)c,
126 l,*ks,ivec);
127 i1=c[4]|(c[5]<<8)|(c[6]<<16)|(c[7]<<24);
128 i2=c[0]|(c[1]<<8)|(c[2]<<16)|(c[3]<<24);
129 sv_setiv(s1,i1);
130 sv_setiv(s2,i2);
131 sv_setpvn(ST(2),(char *)c,8);
132 PUSHs(s1);
133 PUSHs(s2);
134 }
135
136void
137des_cfb_encrypt(input,numbits,ks,ivec,encrypt)
138 char * input
139 int numbits
140 des_key_schedule * ks
141 des_cblock * ivec
142 int encrypt
143PPCODE:
144 {
145 SV *s;
146 STRLEN len;
147 char *c;
148
149 len=SvCUR(ST(0));
150 s=sv_newmortal();
151 sv_setpvn(s,"",0);
152 SvGROW(s,len);
153 SvCUR_set(s,len);
154 c=(char *)SvPV(s,na);
155 des_cfb_encrypt((unsigned char *)input,(unsigned char *)c,
156 (int)numbits,(long)len,*ks,ivec,encrypt);
157 sv_setpvn(ST(3),(char *)ivec,8);
158 PUSHs(s);
159 }
160
161des_cblock *
162des_ecb3_encrypt(input,ks1,ks2,encrypt)
163 des_cblock * input
164 des_key_schedule * ks1
165 des_key_schedule * ks2
166 int encrypt
167CODE:
168 {
169 des_cblock c;
170
171 des_ecb3_encrypt((des_cblock *)input,(des_cblock *)&c,
172 *ks1,*ks2,encrypt);
173 RETVAL= &c;
174 }
175OUTPUT:
176RETVAL
177
178void
179des_ofb_encrypt(input,numbits,ks,ivec)
180 unsigned char * input
181 int numbits
182 des_key_schedule * ks
183 des_cblock * ivec
184PPCODE:
185 {
186 SV *s;
187 STRLEN len,l;
188 unsigned char *c;
189
190 len=SvCUR(ST(0));
191 s=sv_newmortal();
192 sv_setpvn(s,"",0);
193 SvGROW(s,len);
194 SvCUR_set(s,len);
195 c=(unsigned char *)SvPV(s,na);
196 des_ofb_encrypt((unsigned char *)input,(unsigned char *)c,
197 numbits,len,*ks,ivec);
198 sv_setpvn(ST(3),(char *)ivec,8);
199 PUSHs(s);
200 }
201
202void
203des_pcbc_encrypt(input,ks,ivec,encrypt)
204 char * input
205 des_key_schedule * ks
206 des_cblock * ivec
207 int encrypt
208PPCODE:
209 {
210 SV *s;
211 STRLEN len,l;
212 char *c;
213
214 l=SvCUR(ST(0));
215 len=((((unsigned long)l)+7)/8)*8;
216 s=sv_newmortal();
217 sv_setpvn(s,"",0);
218 SvGROW(s,len);
219 SvCUR_set(s,len);
220 c=(char *)SvPV(s,na);
221 des_pcbc_encrypt((des_cblock *)input,(des_cblock *)c,
222 l,*ks,ivec,encrypt);
223 sv_setpvn(ST(2),(char *)c[len-8],8);
224 PUSHs(s);
225 }
226
227des_cblock *
228des_random_key()
229CODE:
230 {
231 des_cblock c;
232
233 des_random_key(c);
234 RETVAL=&c;
235 }
236OUTPUT:
237RETVAL
238
239des_cblock *
240des_string_to_key(str)
241char * str
242CODE:
243 {
244 des_cblock c;
245
246 des_string_to_key(str,&c);
247 RETVAL=&c;
248 }
249OUTPUT:
250RETVAL
251
252void
253des_string_to_2keys(str)
254char * str
255PPCODE:
256 {
257 des_cblock c1,c2;
258 SV *s1,*s2;
259
260 des_string_to_2keys(str,&c1,&c2);
261 EXTEND(sp,2);
262 s1=sv_newmortal();
263 sv_setpvn(s1,(char *)c1,8);
264 s2=sv_newmortal();
265 sv_setpvn(s2,(char *)c2,8);
266 PUSHs(s1);
267 PUSHs(s2);
268 }
diff --git a/src/lib/libcrypto/des/FILES0 b/src/lib/libcrypto/des/FILES0
new file mode 100644
index 0000000000..4c7ea2de7a
--- /dev/null
+++ b/src/lib/libcrypto/des/FILES0
@@ -0,0 +1,96 @@
1/* General stuff */
2COPYRIGHT - Copyright info.
3MODES.DES - A description of the features of the different modes of DES.
4FILES - This file.
5INSTALL - How to make things compile.
6Imakefile - For use with kerberos.
7README - What this package is.
8VERSION - Which version this is and what was changed.
9KERBEROS - Kerberos version 4 notes.
10Makefile.PL - An old makefile to build with perl5, not current.
11Makefile.ssl - The SSLeay makefile
12Makefile.uni - The normal unix makefile.
13GNUmakefile - The makefile for use with glibc.
14makefile.bc - A Borland C makefile
15times - Some outputs from 'speed' on some machines.
16vms.com - For use when compiling under VMS
17
18/* My SunOS des(1) replacement */
19des.c - des(1) source code.
20des.man - des(1) manual.
21
22/* Testing and timing programs. */
23destest.c - Source for libdes.a test program.
24speed.c - Source for libdes.a timing program.
25rpw.c - Source for libdes.a testing password reading routines.
26
27/* libdes.a source code */
28des_crypt.man - libdes.a manual page.
29des.h - Public libdes.a header file.
30ecb_enc.c - des_ecb_encrypt() source, this contains the basic DES code.
31ecb3_enc.c - des_ecb3_encrypt() source.
32cbc_ckm.c - des_cbc_cksum() source.
33cbc_enc.c - des_cbc_encrypt() source.
34ncbc_enc.c - des_cbc_encrypt() that is 'normal' in that it copies
35 the new iv values back in the passed iv vector.
36ede_enc.c - des_ede3_cbc_encrypt() cbc mode des using triple DES.
37cbc3_enc.c - des_3cbc_encrypt() source, don't use this function.
38cfb_enc.c - des_cfb_encrypt() source.
39cfb64enc.c - des_cfb64_encrypt() cfb in 64 bit mode but setup to be
40 used as a stream cipher.
41cfb64ede.c - des_ede3_cfb64_encrypt() cfb in 64 bit mode but setup to be
42 used as a stream cipher and using triple DES.
43ofb_enc.c - des_cfb_encrypt() source.
44ofb64_enc.c - des_ofb_encrypt() ofb in 64 bit mode but setup to be
45 used as a stream cipher.
46ofb64ede.c - des_ede3_ofb64_encrypt() ofb in 64 bit mode but setup to be
47 used as a stream cipher and using triple DES.
48enc_read.c - des_enc_read() source.
49enc_writ.c - des_enc_write() source.
50pcbc_enc.c - des_pcbc_encrypt() source.
51qud_cksm.c - quad_cksum() source.
52rand_key.c - des_random_key() source.
53read_pwd.c - Source for des_read_password() plus related functions.
54set_key.c - Source for des_set_key().
55str2key.c - Covert a string of any length into a key.
56fcrypt.c - A small, fast version of crypt(3).
57des_locl.h - Internal libdes.a header file.
58podd.h - Odd parity tables - used in des_set_key().
59sk.h - Lookup tables used in des_set_key().
60spr.h - What is left of the S tables - used in ecb_encrypt().
61des_ver.h - header file for the external definition of the
62 version string.
63des.doc - SSLeay documentation for the library.
64
65/* The perl scripts - you can ignore these files they are only
66 * included for the curious */
67des.pl - des in perl anyone? des_set_key and des_ecb_encrypt
68 both done in a perl library.
69testdes.pl - Testing program for des.pl
70doIP - Perl script used to develop IP xor/shift code.
71doPC1 - Perl script used to develop PC1 xor/shift code.
72doPC2 - Generates sk.h.
73PC1 - Output of doPC1 should be the same as output from PC1.
74PC2 - used in development of doPC2.
75shifts.pl - Perl library used by my perl scripts.
76
77/* I started making a perl5 dynamic library for libdes
78 * but did not fully finish, these files are part of that effort. */
79DES.pm
80DES.pod
81DES.xs
82t
83typemap
84
85/* The following are for use with sun RPC implementaions. */
86rpc_des.h
87rpc_enc.c
88
89/* The following are contibuted by Mark Murray <mark@grondar.za>. They
90 * are not normally built into libdes due to machine specific routines
91 * contained in them. They are for use in the most recent incarnation of
92 * export kerberos v 4 (eBones). */
93supp.c
94new_rkey.c
95
96
diff --git a/src/lib/libcrypto/des/INSTALL b/src/lib/libcrypto/des/INSTALL
new file mode 100644
index 0000000000..8aebdfe110
--- /dev/null
+++ b/src/lib/libcrypto/des/INSTALL
@@ -0,0 +1,69 @@
1Check the CC and CFLAGS lines in the makefile
2
3If your C library does not support the times(3) function, change the
4#define TIMES to
5#undef TIMES in speed.c
6If it does, check the HZ value for the times(3) function.
7If your system does not define CLK_TCK it will be assumed to
8be 100.0.
9
10If possible use gcc v 2.7.?
11Turn on the maximum optimising (normally '-O3 -fomit-frame-pointer' for gcc)
12In recent times, some system compilers give better performace.
13
14type 'make'
15
16run './destest' to check things are ok.
17run './rpw' to check the tty code for reading passwords works.
18run './speed' to see how fast those optimisations make the library run :-)
19run './des_opts' to determin the best compile time options.
20
21The output from des_opts should be put in the makefile options and des_enc.c
22should be rebuilt. For 64 bit computers, do not use the DES_PTR option.
23For the DEC Alpha, edit des.h and change DES_LONG to 'unsigned int'
24and then you can use the 'DES_PTR' option.
25
26The file options.txt has the options listed for best speed on quite a
27few systems. Look and the options (UNROLL, PTR, RISC2 etc) and then
28turn on the relevant option in the Makefile.
29
30There are some special Makefile targets that make life easier.
31make cc - standard cc build
32make gcc - standard gcc build
33make x86-elf - x86 assembler (elf), linux-elf.
34make x86-out - x86 assembler (a.out), FreeBSD
35make x86-solaris- x86 assembler
36make x86-bsdi - x86 assembler (a.out with primative assembler).
37
38If at all possible use the assembler (for Windows NT/95, use
39asm/win32.obj to link with). The x86 assembler is very very fast.
40
41A make install will by default install
42libdes.a in /usr/local/lib/libdes.a
43des in /usr/local/bin/des
44des_crypt.man in /usr/local/man/man3/des_crypt.3
45des.man in /usr/local/man/man1/des.1
46des.h in /usr/include/des.h
47
48des(1) should be compatible with sunOS's but I have been unable to
49test it.
50
51These routines should compile on MSDOS, most 32bit and 64bit version
52of Unix (BSD and SYSV) and VMS, without modification.
53The only problems should be #include files that are in the wrong places.
54
55These routines can be compiled under MSDOS.
56I have successfully encrypted files using des(1) under MSDOS and then
57decrypted the files on a SparcStation.
58I have been able to compile and test the routines with
59Microsoft C v 5.1 and Turbo C v 2.0.
60The code in this library is in no way optimised for the 16bit
61operation of MSDOS.
62
63When building for glibc, ignore all of the above and just unpack into
64glibc-1.??/des and then gmake as per normal.
65
66As a final note on performace. Certain CPUs like sparcs and Alpha often give
67a %10 speed difference depending on the link order. It is rather anoying
68when one program reports 'x' DES encrypts a second and another reports
69'x*0.9' the speed.
diff --git a/src/lib/libcrypto/des/Imakefile b/src/lib/libcrypto/des/Imakefile
new file mode 100644
index 0000000000..1b9b5629e1
--- /dev/null
+++ b/src/lib/libcrypto/des/Imakefile
@@ -0,0 +1,35 @@
1# This Imakefile has not been tested for a while but it should still
2# work when placed in the correct directory in the kerberos v 4 distribution
3
4SRCS= cbc_cksm.c cbc_enc.c ecb_enc.c pcbc_enc.c \
5 qud_cksm.c rand_key.c read_pwd.c set_key.c str2key.c \
6 enc_read.c enc_writ.c fcrypt.c cfb_enc.c \
7 ecb3_enc.c ofb_enc.c ofb64enc.c
8
9OBJS= cbc_cksm.o cbc_enc.o ecb_enc.o pcbc_enc.o \
10 qud_cksm.o rand_key.o read_pwd.o set_key.o str2key.o \
11 enc_read.o enc_writ.o fcrypt.o cfb_enc.o \
12 ecb3_enc.o ofb_enc.o ofb64enc.o
13
14GENERAL=COPYRIGHT FILES INSTALL Imakefile README VERSION makefile times \
15 vms.com KERBEROS
16DES= des.c des.man
17TESTING=destest.c speed.c rpw.c
18LIBDES= des_crypt.man des.h des_locl.h podd.h sk.h spr.h
19
20PERL= des.pl testdes.pl doIP doPC1 doPC2 PC1 PC2 shifts.pl
21
22CODE= $(GENERAL) $(DES) $(TESTING) $(SRCS) $(LIBDES) $(PERL)
23
24SRCDIR=$(SRCTOP)/lib/des
25
26DBG= -O
27INCLUDE= -I$(SRCDIR)
28CC= cc
29
30library_obj_rule()
31
32install_library_target(des,$(OBJS),$(SRCS),)
33
34test(destest,libdes.a,)
35test(rpw,libdes.a,)
diff --git a/src/lib/libcrypto/des/KERBEROS b/src/lib/libcrypto/des/KERBEROS
new file mode 100644
index 0000000000..f401b10014
--- /dev/null
+++ b/src/lib/libcrypto/des/KERBEROS
@@ -0,0 +1,41 @@
1 [ This is an old file, I don't know if it is true anymore
2 but I will leave the file here - eay 21/11/95 ]
3
4To use this library with Bones (kerberos without DES):
51) Get my modified Bones - eBones. It can be found on
6 gondwana.ecr.mu.oz.au (128.250.1.63) /pub/athena/eBones-p9.tar.Z
7 and
8 nic.funet.fi (128.214.6.100) /pub/unix/security/Kerberos/eBones-p9.tar.Z
9
102) Unpack this library in src/lib/des, makeing sure it is version
11 3.00 or greater (libdes.tar.93-10-07.Z). This versions differences
12 from the version in comp.sources.misc volume 29 patchlevel2.
13 The primarily difference is that it should compile under kerberos :-).
14 It can be found at.
15 ftp.psy.uq.oz.au (130.102.32.1) /pub/DES/libdes.tar.93-10-07.Z
16
17Now do a normal kerberos build and things should work.
18
19One problem I found when I was build on my local sun.
20---
21For sunOS 4.1.1 apply the following patch to src/util/ss/make_commands.c
22
23*** make_commands.c.orig Fri Jul 3 04:18:35 1987
24--- make_commands.c Wed May 20 08:47:42 1992
25***************
26*** 98,104 ****
27 if (!rename(o_file, z_file)) {
28 if (!vfork()) {
29 chdir("/tmp");
30! execl("/bin/ld", "ld", "-o", o_file+5, "-s", "-r", "-n",
31 z_file+5, 0);
32 perror("/bin/ld");
33 _exit(1);
34--- 98,104 ----
35 if (!rename(o_file, z_file)) {
36 if (!vfork()) {
37 chdir("/tmp");
38! execl("/bin/ld", "ld", "-o", o_file+5, "-s", "-r",
39 z_file+5, 0);
40 perror("/bin/ld");
41 _exit(1);
diff --git a/src/lib/libcrypto/des/Makefile b/src/lib/libcrypto/des/Makefile
new file mode 100644
index 0000000000..a6e1001329
--- /dev/null
+++ b/src/lib/libcrypto/des/Makefile
@@ -0,0 +1,279 @@
1#
2# OpenSSL/crypto/des/Makefile
3#
4
5DIR= des
6TOP= ../..
7CC= cc
8CPP= $(CC) -E
9INCLUDES=-I$(TOP) -I../../include
10CFLAG=-g
11MAKEFILE= Makefile
12AR= ar r
13RANLIB= ranlib
14DES_ENC= des_enc.o fcrypt_b.o
15
16CFLAGS= $(INCLUDES) $(CFLAG)
17ASFLAGS= $(INCLUDES) $(ASFLAG)
18AFLAGS= $(ASFLAGS)
19
20GENERAL=Makefile
21TEST=destest.c
22APPS=
23
24LIB=$(TOP)/libcrypto.a
25LIBSRC= cbc_cksm.c cbc_enc.c cfb64enc.c cfb_enc.c \
26 ecb3_enc.c ecb_enc.c enc_read.c enc_writ.c \
27 fcrypt.c ofb64enc.c ofb_enc.c pcbc_enc.c \
28 qud_cksm.c rand_key.c rpc_enc.c set_key.c \
29 des_enc.c fcrypt_b.c \
30 xcbc_enc.c \
31 str2key.c cfb64ede.c ofb64ede.c ede_cbcm_enc.c des_old.c des_old2.c \
32 read2pwd.c
33
34LIBOBJ= set_key.o ecb_enc.o cbc_enc.o \
35 ecb3_enc.o cfb64enc.o cfb64ede.o cfb_enc.o ofb64ede.o \
36 enc_read.o enc_writ.o ofb64enc.o \
37 ofb_enc.o str2key.o pcbc_enc.o qud_cksm.o rand_key.o \
38 ${DES_ENC} \
39 fcrypt.o xcbc_enc.o rpc_enc.o cbc_cksm.o \
40 ede_cbcm_enc.o des_old.o des_old2.o read2pwd.o
41
42SRC= $(LIBSRC)
43
44EXHEADER= des.h des_old.h
45HEADER= des_locl.h rpc_des.h spr.h des_ver.h $(EXHEADER)
46
47ALL= $(GENERAL) $(SRC) $(HEADER)
48
49top:
50 (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all)
51
52all: lib
53
54lib: $(LIBOBJ)
55 $(AR) $(LIB) $(LIBOBJ)
56 $(RANLIB) $(LIB) || echo Never mind.
57 @touch lib
58
59des: des.o cbc3_enc.o lib
60 $(CC) $(CFLAGS) -o des des.o cbc3_enc.o $(LIB)
61
62des_enc-sparc.S: asm/des_enc.m4
63 m4 -B 8192 asm/des_enc.m4 > des_enc-sparc.S
64
65des-586.s: asm/des-586.pl ../perlasm/x86asm.pl ../perlasm/cbc.pl
66 $(PERL) asm/des-586.pl $(PERLASM_SCHEME) $(CFLAGS) > $@
67crypt586.s: asm/crypt586.pl ../perlasm/x86asm.pl ../perlasm/cbc.pl
68 $(PERL) asm/crypt586.pl $(PERLASM_SCHEME) $(CFLAGS) > $@
69
70files:
71 $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
72
73links:
74 @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
75 @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
76 @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
77
78# We need to use force because 'install' matches 'INSTALL' on case
79# insensitive systems
80FRC.install:
81install: FRC.install
82 @[ -n "$(INSTALLTOP)" ] # should be set by top Makefile...
83 @headerlist="$(EXHEADER)"; for i in $$headerlist ; \
84 do \
85 (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
86 chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
87 done;
88
89tags:
90 ctags $(SRC)
91
92tests:
93
94lint:
95 lint -DLINT $(INCLUDES) $(SRC)>fluff
96
97depend:
98 @[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile...
99 $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
100
101dclean:
102 $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
103 mv -f Makefile.new $(MAKEFILE)
104
105clean:
106 rm -f *.s *.o *.obj des lib tags core .pure .nfs* *.old *.bak fluff
107
108# DO NOT DELETE THIS LINE -- make depend depends on it.
109
110cbc_cksm.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
111cbc_cksm.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslconf.h
112cbc_cksm.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
113cbc_cksm.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
114cbc_cksm.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
115cbc_cksm.o: cbc_cksm.c des_locl.h
116cbc_enc.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
117cbc_enc.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslconf.h
118cbc_enc.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
119cbc_enc.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
120cbc_enc.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
121cbc_enc.o: cbc_enc.c des_locl.h ncbc_enc.c
122cfb64ede.o: ../../e_os.h ../../include/openssl/des.h
123cfb64ede.o: ../../include/openssl/des_old.h ../../include/openssl/e_os2.h
124cfb64ede.o: ../../include/openssl/opensslconf.h
125cfb64ede.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
126cfb64ede.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
127cfb64ede.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
128cfb64ede.o: cfb64ede.c des_locl.h
129cfb64enc.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
130cfb64enc.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslconf.h
131cfb64enc.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
132cfb64enc.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
133cfb64enc.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
134cfb64enc.o: cfb64enc.c des_locl.h
135cfb_enc.o: ../../e_os.h ../../include/openssl/des.h
136cfb_enc.o: ../../include/openssl/des_old.h ../../include/openssl/e_os2.h
137cfb_enc.o: ../../include/openssl/opensslconf.h ../../include/openssl/ossl_typ.h
138cfb_enc.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
139cfb_enc.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
140cfb_enc.o: ../../include/openssl/ui_compat.h cfb_enc.c des_locl.h
141des_enc.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
142des_enc.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslconf.h
143des_enc.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
144des_enc.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
145des_enc.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
146des_enc.o: des_enc.c des_locl.h ncbc_enc.c spr.h
147des_old.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
148des_old.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslconf.h
149des_old.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rand.h
150des_old.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
151des_old.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
152des_old.o: ../../include/openssl/ui_compat.h des_old.c
153des_old2.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
154des_old2.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslconf.h
155des_old2.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rand.h
156des_old2.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
157des_old2.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
158des_old2.o: ../../include/openssl/ui_compat.h des_old2.c
159ecb3_enc.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
160ecb3_enc.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslconf.h
161ecb3_enc.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
162ecb3_enc.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
163ecb3_enc.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
164ecb3_enc.o: des_locl.h ecb3_enc.c
165ecb_enc.o: ../../include/openssl/bio.h ../../include/openssl/crypto.h
166ecb_enc.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
167ecb_enc.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslconf.h
168ecb_enc.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
169ecb_enc.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
170ecb_enc.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
171ecb_enc.o: ../../include/openssl/ui_compat.h des_locl.h des_ver.h ecb_enc.c
172ede_cbcm_enc.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
173ede_cbcm_enc.o: ../../include/openssl/e_os2.h
174ede_cbcm_enc.o: ../../include/openssl/opensslconf.h
175ede_cbcm_enc.o: ../../include/openssl/ossl_typ.h
176ede_cbcm_enc.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
177ede_cbcm_enc.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
178ede_cbcm_enc.o: ../../include/openssl/ui_compat.h des_locl.h ede_cbcm_enc.c
179enc_read.o: ../../e_os.h ../../include/openssl/bio.h
180enc_read.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
181enc_read.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
182enc_read.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
183enc_read.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
184enc_read.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
185enc_read.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
186enc_read.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
187enc_read.o: ../../include/openssl/ui_compat.h ../cryptlib.h des_locl.h
188enc_read.o: enc_read.c
189enc_writ.o: ../../e_os.h ../../include/openssl/bio.h
190enc_writ.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
191enc_writ.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
192enc_writ.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
193enc_writ.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
194enc_writ.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
195enc_writ.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h
196enc_writ.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
197enc_writ.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
198enc_writ.o: ../cryptlib.h des_locl.h enc_writ.c
199fcrypt.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
200fcrypt.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslconf.h
201fcrypt.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
202fcrypt.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
203fcrypt.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
204fcrypt.o: des_locl.h fcrypt.c
205fcrypt_b.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
206fcrypt_b.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslconf.h
207fcrypt_b.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
208fcrypt_b.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
209fcrypt_b.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
210fcrypt_b.o: des_locl.h fcrypt_b.c
211ofb64ede.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
212ofb64ede.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslconf.h
213ofb64ede.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
214ofb64ede.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
215ofb64ede.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
216ofb64ede.o: des_locl.h ofb64ede.c
217ofb64enc.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
218ofb64enc.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslconf.h
219ofb64enc.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
220ofb64enc.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
221ofb64enc.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
222ofb64enc.o: des_locl.h ofb64enc.c
223ofb_enc.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
224ofb_enc.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslconf.h
225ofb_enc.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
226ofb_enc.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
227ofb_enc.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
228ofb_enc.o: des_locl.h ofb_enc.c
229pcbc_enc.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
230pcbc_enc.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslconf.h
231pcbc_enc.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
232pcbc_enc.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
233pcbc_enc.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
234pcbc_enc.o: des_locl.h pcbc_enc.c
235qud_cksm.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
236qud_cksm.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslconf.h
237qud_cksm.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
238qud_cksm.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
239qud_cksm.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
240qud_cksm.o: des_locl.h qud_cksm.c
241rand_key.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
242rand_key.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslconf.h
243rand_key.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rand.h
244rand_key.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
245rand_key.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
246rand_key.o: ../../include/openssl/ui_compat.h rand_key.c
247read2pwd.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
248read2pwd.o: ../../include/openssl/des_old.h ../../include/openssl/e_os2.h
249read2pwd.o: ../../include/openssl/opensslconf.h
250read2pwd.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
251read2pwd.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
252read2pwd.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
253read2pwd.o: ../../include/openssl/ui_compat.h read2pwd.c
254rpc_enc.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
255rpc_enc.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslconf.h
256rpc_enc.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
257rpc_enc.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
258rpc_enc.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
259rpc_enc.o: des_locl.h des_ver.h rpc_des.h rpc_enc.c
260set_key.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
261set_key.o: ../../include/openssl/des_old.h ../../include/openssl/e_os2.h
262set_key.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
263set_key.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
264set_key.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
265set_key.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
266set_key.o: des_locl.h set_key.c
267str2key.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
268str2key.o: ../../include/openssl/des_old.h ../../include/openssl/e_os2.h
269str2key.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
270str2key.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
271str2key.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
272str2key.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
273str2key.o: des_locl.h str2key.c
274xcbc_enc.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
275xcbc_enc.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslconf.h
276xcbc_enc.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
277xcbc_enc.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
278xcbc_enc.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
279xcbc_enc.o: des_locl.h xcbc_enc.c
diff --git a/src/lib/libcrypto/des/README b/src/lib/libcrypto/des/README
new file mode 100644
index 0000000000..621a5ab467
--- /dev/null
+++ b/src/lib/libcrypto/des/README
@@ -0,0 +1,54 @@
1
2 libdes, Version 4.01 10-Jan-97
3
4 Copyright (c) 1997, Eric Young
5 All rights reserved.
6
7 This program is free software; you can redistribute it and/or modify
8 it under the terms specified in COPYRIGHT.
9
10--
11The primary ftp site for this library is
12ftp://ftp.psy.uq.oz.au/pub/Crypto/DES/libdes-x.xx.tar.gz
13libdes is now also shipped with SSLeay. Primary ftp site of
14ftp://ftp.psy.uq.oz.au/pub/Crypto/SSL/SSLeay-x.x.x.tar.gz
15
16The best way to build this library is to build it as part of SSLeay.
17
18This kit builds a DES encryption library and a DES encryption program.
19It supports ecb, cbc, ofb, cfb, triple ecb, triple cbc, triple ofb,
20triple cfb, desx, and MIT's pcbc encryption modes and also has a fast
21implementation of crypt(3).
22It contains support routines to read keys from a terminal,
23generate a random key, generate a key from an arbitrary length string,
24read/write encrypted data from/to a file descriptor.
25
26The implementation was written so as to conform with the manual entry
27for the des_crypt(3) library routines from MIT's project Athena.
28
29destest should be run after compilation to test the des routines.
30rpw should be run after compilation to test the read password routines.
31The des program is a replacement for the sun des command. I believe it
32conforms to the sun version.
33
34The Imakefile is setup for use in the kerberos distribution.
35
36These routines are best compiled with gcc or any other good
37optimising compiler.
38Just turn you optimiser up to the highest settings and run destest
39after the build to make sure everything works.
40
41I believe these routines are close to the fastest and most portable DES
42routines that use small lookup tables (4.5k) that are publicly available.
43The fcrypt routine is faster than ufc's fcrypt (when compiling with
44gcc2 -O2) on the sparc 2 (1410 vs 1270) but is not so good on other machines
45(on a sun3/260 168 vs 336). It is a function of CPU on chip cache size.
46[ 10-Jan-97 and a function of an incorrect speed testing program in
47 ufc which gave much better test figures that reality ].
48
49It is worth noting that on sparc and Alpha CPUs, performance of the DES
50library can vary by upto %10 due to the positioning of files after application
51linkage.
52
53Eric Young (eay@cryptsoft.com)
54
diff --git a/src/lib/libcrypto/des/VERSION b/src/lib/libcrypto/des/VERSION
new file mode 100644
index 0000000000..c7d01542bc
--- /dev/null
+++ b/src/lib/libcrypto/des/VERSION
@@ -0,0 +1,412 @@
1 Fixed the weak key values which were wrong :-(
2 Defining SIGACTION causes sigaction() to be used instead of signal().
3 SIGUSR1/SIGUSR2 are no longer mapped in the read tty stuff because it
4 can cause problems. This should hopefully not affect normal
5 applications.
6
7Version 4.04
8 Fixed a few tests in destest. Also added x86 assember for
9 des_ncbc_encrypt() which is the standard cbc mode function.
10 This makes a very very large performace difference.
11 Ariel Glenn ariel@columbia.edu reports that the terminal
12 'turn echo off' can return (errno == EINVAL) under solaris
13 when redirection is used. So I now catch that as well as ENOTTY.
14
15
16Version 4.03
17 Left a static out of enc_write.c, which caused to buffer to be
18 continiously malloc()ed. Does anyone use these functions? I keep
19 on feeling like removing them since I only had these in there
20 for a version of kerberised login. Anyway, this was pointed out
21 by Theo de Raadt <deraadt@cvs.openbsd.org>
22 The 'n' bit ofb code was wrong, it was not shifting the shift
23 register. It worked correctly for n == 64. Thanks to
24 Gigi Ankeny <Gigi.Ankeny@Eng.Sun.COM> for pointing this one out.
25
26Version 4.02
27 I was doing 'if (memcmp(weak_keys[i],key,sizeof(key)) == 0)'
28 when checking for weak keys which is wrong :-(, pointed out by
29 Markus F.X.J. Oberhumer <markus.oberhumer@jk.uni-linz.ac.at>.
30
31Version 4.01
32 Even faster inner loop in the DES assembler for x86 and a modification
33 for IP/FP which is faster on x86. Both of these changes are
34 from Svend Olaf Mikkelsen <svolaf@inet.uni-c.dk>. His
35 changes make the assembler run %40 faster on a pentium. This is just
36 a case of getting the instruction sequence 'just right'.
37 All credit to 'Svend' :-)
38 Quite a few special x86 'make' targets.
39 A libdes-l (lite) distribution.
40
41Version 4.00
42 After a bit of a pause, I'll up the major version number since this
43 is mostly a performace release. I've added x86 assembler and
44 added more options for performance. A %28 speedup for gcc
45 on a pentium and the assembler is a %50 speedup.
46 MIPS CPU's, sparc and Alpha are the main CPU's with speedups.
47 Run des_opts to work out which options should be used.
48 DES_RISC1/DES_RISC2 use alternative inner loops which use
49 more registers but should give speedups on any CPU that does
50 dual issue (pentium). DES_UNROLL unrolls the inner loop,
51 which costs in code size.
52
53Version 3.26
54 I've finally removed one of the shifts in D_ENCRYPT. This
55 meant I've changed the des_SPtrans table (spr.h), the set_key()
56 function and some things in des_enc.c. This has definitly
57 made things faster :-). I've known about this one for some
58 time but I've been too lazy to follow it up :-).
59 Noticed that in the D_ENCRYPT() macro, we can just do L^=(..)^(..)^..
60 instead of L^=((..)|(..)|(..).. This should save a register at
61 least.
62 Assember for x86. The file to replace is des_enc.c, which is replaced
63 by one of the assembler files found in asm. Look at des/asm/readme
64 for more info.
65
66 /* Modification to fcrypt so it can be compiled to support
67 HPUX 10.x's long password format, define -DLONGCRYPT to use this.
68 Thanks to Jens Kupferschmidt <bt1cu@hpboot.rz.uni-leipzig.de>. */
69
70 SIGWINCH case put in des_read_passwd() so the function does not
71 'exit' if this function is recieved.
72
73Version 3.25 17/07/96
74 Modified read_pwd.c so that stdin can be read if not a tty.
75 Thanks to Jeff Barber <jeffb@issl.atl.hp.com> for the patches.
76 des_init_random_number_generator() shortened due to VMS linker
77 limits.
78 Added RSA's DESX cbc mode. It is a form of cbc encryption, with 2
79 8 byte quantites xored before and after encryption.
80 des_xcbc_encryption() - the name is funny to preserve the des_
81 prefix on all functions.
82
83Version 3.24 20/04/96
84 The DES_PTR macro option checked and used by SSLeay configuration
85
86Version 3.23 11/04/96
87 Added DES_LONG. If defined to 'unsigned int' on the DEC Alpha,
88 it gives a %20 speedup :-)
89 Fixed the problem with des.pl under perl5. The patches were
90 sent by Ed Kubaitis (ejk@uiuc.edu).
91 if fcrypt.c, changed values to handle illegal salt values the way
92 normal crypt() implementations do. Some programs apparently use
93 them :-(. The patch was sent by Bjorn Gronvall <bg@sics.se>
94
95Version 3.22 29/11/95
96 Bug in des(1), an error with the uuencoding stuff when the
97 'data' is small, thanks to Geoff Keating <keagchon@mehta.anu.edu.au>
98 for the patch.
99
100Version 3.21 22/11/95
101 After some emailing back and forth with
102 Colin Plumb <colin@nyx10.cs.du.edu>, I've tweaked a few things
103 and in a future version I will probably put in some of the
104 optimisation he suggested for use with the DES_USE_PTR option.
105 Extra routines from Mark Murray <mark@grondar.za> for use in
106 freeBSD. They mostly involve random number generation for use
107 with kerberos. They involve evil machine specific system calls
108 etc so I would normally suggest pushing this stuff into the
109 application and/or using RAND_seed()/RAND_bytes() if you are
110 using this DES library as part of SSLeay.
111 Redone the read_pw() function so that it is cleaner and
112 supports termios, thanks to Sameer Parekh <sameer@c2.org>
113 for the initial patches for this.
114 Renamed 3ecb_encrypt() to ecb3_encrypt(). This has been
115 done just to make things more consistent.
116 I have also now added triple DES versions of cfb and ofb.
117
118Version 3.20
119 Damn, Damn, Damn, as pointed out by Mike_Spreitzer.PARC@xerox.com,
120 my des_random_seed() function was only copying 4 bytes of the
121 passed seed into the init structure. It is now fixed to copy 8.
122 My own suggestion is to used something like MD5 :-)
123
124Version 3.19
125 While looking at my code one day, I though, why do I keep on
126 calling des_encrypt(in,out,ks,enc) when every function that
127 calls it has in and out the same. So I dropped the 'out'
128 parameter, people should not be using this function.
129
130Version 3.18 30/08/95
131 Fixed a few bit with the distribution and the filenames.
132 3.17 had been munged via a move to DOS and back again.
133 NO CODE CHANGES
134
135Version 3.17 14/07/95
136 Fixed ede3 cbc which I had broken in 3.16. I have also
137 removed some unneeded variables in 7-8 of the routines.
138
139Version 3.16 26/06/95
140 Added des_encrypt2() which does not use IP/FP, used by triple
141 des routines. Tweaked things a bit elsewhere. %13 speedup on
142 sparc and %6 on a R4400 for ede3 cbc mode.
143
144Version 3.15 06/06/95
145 Added des_ncbc_encrypt(), it is des_cbc mode except that it is
146 'normal' and copies the new iv value back over the top of the
147 passed parameter.
148 CHANGED des_ede3_cbc_encrypt() so that it too now overwrites
149 the iv. THIS WILL BREAK EXISTING CODE, but since this function
150 only new, I feel I can change it, not so with des_cbc_encrypt :-(.
151 I need to update the documentation.
152
153Version 3.14 31/05/95
154 New release upon the world, as part of my SSL implementation.
155 New copyright and usage stuff. Basically free for all to use
156 as long as you say it came from me :-)
157
158Version 3.13 31/05/95
159 A fix in speed.c, if HZ is not defined, I set it to 100.0
160 which is reasonable for most unixes except SunOS 4.x.
161 I now have a #ifdef sun but timing for SunOS 4.x looked very
162 good :-(. At my last job where I used SunOS 4.x, it was
163 defined to be 60.0 (look at the old INSTALL documentation), at
164 the last release had it changed to 100.0 since I now work with
165 Solaris2 and SVR4 boxes.
166 Thanks to Rory Chisholm <rchishol@math.ethz.ch> for pointing this
167 one out.
168
169Version 3.12 08/05/95
170 As pointed out by The Crypt Keeper <tck@bend.UCSD.EDU>,
171 my D_ENCRYPT macro in crypt() had an un-necessary variable.
172 It has been removed.
173
174Version 3.11 03/05/95
175 Added des_ede3_cbc_encrypt() which is cbc mode des with 3 keys
176 and one iv. It is a standard and I needed it for my SSL code.
177 It makes more sense to use this for triple DES than
178 3cbc_encrypt(). I have also added (or should I say tested :-)
179 cfb64_encrypt() which is cfb64 but it will encrypt a partial
180 number of bytes - 3 bytes in 3 bytes out. Again this is for
181 my SSL library, as a form of encryption to use with SSL
182 telnet.
183
184Version 3.10 22/03/95
185 Fixed a bug in 3cbc_encrypt() :-(. When making repeated calls
186 to cbc3_encrypt, the 2 iv values that were being returned to
187 be used in the next call were reversed :-(.
188 Many thanks to Bill Wade <wade@Stoner.COM> for pointing out
189 this error.
190
191Version 3.09 01/02/95
192 Fixed des_random_key to far more random, it was rather feeble
193 with regards to picking the initial seed. The problem was
194 pointed out by Olaf Kirch <okir@monad.swb.de>.
195
196Version 3.08 14/12/94
197 Added Makefile.PL so libdes can be built into perl5.
198 Changed des_locl.h so RAND is always defined.
199
200Version 3.07 05/12/94
201 Added GNUmake and stuff so the library can be build with
202 glibc.
203
204Version 3.06 30/08/94
205 Added rpc_enc.c which contains _des_crypt. This is for use in
206 secure_rpc v 4.0
207 Finally fixed the cfb_enc problems.
208 Fixed a few parameter parsing bugs in des (-3 and -b), thanks
209 to Rob McMillan <R.McMillan@its.gu.edu.au>
210
211Version 3.05 21/04/94
212 for unsigned long l; gcc does not produce ((l>>34) == 0)
213 This causes bugs in cfb_enc.
214 Thanks to Hadmut Danisch <danisch@ira.uka.de>
215
216Version 3.04 20/04/94
217 Added a version number to des.c and libdes.a
218
219Version 3.03 12/01/94
220 Fixed a bug in non zero iv in 3cbc_enc.
221
222Version 3.02 29/10/93
223 I now work in a place where there are 6+ architectures and 14+
224 OS versions :-).
225 Fixed TERMIO definition so the most sys V boxes will work :-)
226
227Release upon comp.sources.misc
228Version 3.01 08/10/93
229 Added des_3cbc_encrypt()
230
231Version 3.00 07/10/93
232 Fixed up documentation.
233 quad_cksum definitely compatible with MIT's now.
234
235Version 2.30 24/08/93
236 Triple DES now defaults to triple cbc but can do triple ecb
237 with the -b flag.
238 Fixed some MSDOS uuen/uudecoding problems, thanks to
239 Added prototypes.
240
241Version 2.22 29/06/93
242 Fixed a bug in des_is_weak_key() which stopped it working :-(
243 thanks to engineering@MorningStar.Com.
244
245Version 2.21 03/06/93
246 des(1) with no arguments gives quite a bit of help.
247 Added -c (generate ckecksum) flag to des(1).
248 Added -3 (triple DES) flag to des(1).
249 Added cfb and ofb routines to the library.
250
251Version 2.20 11/03/93
252 Added -u (uuencode) flag to des(1).
253 I have been playing with byte order in quad_cksum to make it
254 compatible with MIT's version. All I can say is avid this
255 function if possible since MIT's output is endian dependent.
256
257Version 2.12 14/10/92
258 Added MSDOS specific macro in ecb_encrypt which gives a %70
259 speed up when the code is compiled with turbo C.
260
261Version 2.11 12/10/92
262 Speedup in set_key (recoding of PC-1)
263 I now do it in 47 simple operations, down from 60.
264 Thanks to John Fletcher (john_fletcher@lccmail.ocf.llnl.gov)
265 for motivating me to look for a faster system :-)
266 The speedup is probably less that 1% but it is still 13
267 instructions less :-).
268
269Version 2.10 06/10/92
270 The code now works on the 64bit ETA10 and CRAY without modifications or
271 #defines. I believe the code should work on any machine that
272 defines long, int or short to be 8 bytes long.
273 Thanks to Shabbir J. Safdar (shabby@mentor.cc.purdue.edu)
274 for helping me fix the code to run on 64bit machines (he had
275 access to an ETA10).
276 Thanks also to John Fletcher <john_fletcher@lccmail.ocf.llnl.gov>
277 for testing the routines on a CRAY.
278 read_password.c has been renamed to read_passwd.c
279 string_to_key.c has been renamed to string2key.c
280
281Version 2.00 14/09/92
282 Made mods so that the library should work on 64bit CPU's.
283 Removed all my uchar and ulong defs. To many different
284 versions of unix define them in their header files in too many
285 different combinations :-)
286 IRIX - Sillicon Graphics mods (mostly in read_password.c).
287 Thanks to Andrew Daviel (advax@erich.triumf.ca)
288
289Version 1.99 26/08/92
290 Fixed a bug or 2 in enc_read.c
291 Fixed a bug in enc_write.c
292 Fixed a pseudo bug in fcrypt.c (very obscure).
293
294Version 1.98 31/07/92
295 Support for the ETA10. This is a strange machine that defines
296 longs and ints as 8 bytes and shorts as 4 bytes.
297 Since I do evil things with long * that assume that they are 4
298 bytes. Look in the Makefile for the option to compile for
299 this machine. quad_cksum appears to have problems but I
300 will don't have the time to fix it right now, and this is not
301 a function that uses DES and so will not effect the main uses
302 of the library.
303
304Version 1.97 20/05/92 eay
305 Fixed the Imakefile and made some changes to des.h to fix some
306 problems when building this package with Kerberos v 4.
307
308Version 1.96 18/05/92 eay
309 Fixed a small bug in string_to_key() where problems could
310 occur if des_check_key was set to true and the string
311 generated a weak key.
312
313Patch2 posted to comp.sources.misc
314Version 1.95 13/05/92 eay
315 Added an alternative version of the D_ENCRYPT macro in
316 ecb_encrypt and fcrypt. Depending on the compiler, one version or the
317 other will be faster. This was inspired by
318 Dana How <how@isl.stanford.edu>, and her pointers about doing the
319 *(ulong *)((uchar *)ptr+(value&0xfc))
320 vs
321 ptr[value&0x3f]
322 to stop the C compiler doing a <<2 to convert the long array index.
323
324Version 1.94 05/05/92 eay
325 Fixed an incompatibility between my string_to_key and the MIT
326 version. When the key is longer than 8 chars, I was wrapping
327 with a different method. To use the old version, define
328 OLD_STR_TO_KEY in the makefile. Thanks to
329 viktor@newsu.shearson.com (Viktor Dukhovni).
330
331Version 1.93 28/04/92 eay
332 Fixed the VMS mods so that echo is now turned off in
333 read_password. Thanks again to brennan@coco.cchs.su.oz.AU.
334 MSDOS support added. The routines can be compiled with
335 Turbo C (v2.0) and MSC (v5.1). Make sure MSDOS is defined.
336
337Patch1 posted to comp.sources.misc
338Version 1.92 13/04/92 eay
339 Changed D_ENCRYPT so that the rotation of R occurs outside of
340 the loop. This required rotating all the longs in sp.h (now
341 called spr.h). Thanks to Richard Outerbridge <71755.204@CompuServe.COM>
342 speed.c has been changed so it will work without SIGALRM. If
343 times(3) is not present it will try to use ftime() instead.
344
345Version 1.91 08/04/92 eay
346 Added -E/-D options to des(1) so it can use string_to_key.
347 Added SVR4 mods suggested by witr@rwwa.COM
348 Added VMS mods suggested by brennan@coco.cchs.su.oz.AU. If
349 anyone knows how to turn of tty echo in VMS please tell me or
350 implement it yourself :-).
351 Changed FILE *IN/*OUT to *DES_IN/*DES_OUT since it appears VMS
352 does not like IN/OUT being used.
353
354Libdes posted to comp.sources.misc
355Version 1.9 24/03/92 eay
356 Now contains a fast small crypt replacement.
357 Added des(1) command.
358 Added des_rw_mode so people can use cbc encryption with
359 enc_read and enc_write.
360
361Version 1.8 15/10/91 eay
362 Bug in cbc_cksum.
363 Many thanks to Keith Reynolds (keithr@sco.COM) for pointing this
364 one out.
365
366Version 1.7 24/09/91 eay
367 Fixed set_key :-)
368 set_key is 4 times faster and takes less space.
369 There are a few minor changes that could be made.
370
371Version 1.6 19/09/1991 eay
372 Finally go IP and FP finished.
373 Now I need to fix set_key.
374 This version is quite a bit faster that 1.51
375
376Version 1.52 15/06/1991 eay
377 20% speedup in ecb_encrypt by changing the E bit selection
378 to use 2 32bit words. This also required modification of the
379 sp table. There is still a way to speedup the IP and IP-1
380 (hints from outer@sq.com) still working on this one :-(.
381
382Version 1.51 07/06/1991 eay
383 Faster des_encrypt by loop unrolling
384 Fixed bug in quad_cksum.c (thanks to hughes@logos.ucs.indiana.edu)
385
386Version 1.50 28/05/1991 eay
387 Optimised the code a bit more for the sparc. I have improved the
388 speed of the inner des_encrypt by speeding up the initial and
389 final permutations.
390
391Version 1.40 23/10/1990 eay
392 Fixed des_random_key, it did not produce a random key :-(
393
394Version 1.30 2/10/1990 eay
395 Have made des_quad_cksum the same as MIT's, the full package
396 should be compatible with MIT's
397 Have tested on a DECstation 3100
398 Still need to fix des_set_key (make it faster).
399 Does des_cbc_encrypts at 70.5k/sec on a 3100.
400
401Version 1.20 18/09/1990 eay
402 Fixed byte order dependencies.
403 Fixed (I hope) all the word alignment problems.
404 Speedup in des_ecb_encrypt.
405
406Version 1.10 11/09/1990 eay
407 Added des_enc_read and des_enc_write.
408 Still need to fix des_quad_cksum.
409 Still need to document des_enc_read and des_enc_write.
410
411Version 1.00 27/08/1990 eay
412
diff --git a/src/lib/libcrypto/des/asm/readme b/src/lib/libcrypto/des/asm/readme
new file mode 100644
index 0000000000..1beafe253b
--- /dev/null
+++ b/src/lib/libcrypto/des/asm/readme
@@ -0,0 +1,131 @@
1First up, let me say I don't like writing in assembler. It is not portable,
2dependant on the particular CPU architecture release and is generally a pig
3to debug and get right. Having said that, the x86 architecture is probably
4the most important for speed due to number of boxes and since
5it appears to be the worst architecture to to get
6good C compilers for. So due to this, I have lowered myself to do
7assembler for the inner DES routines in libdes :-).
8
9The file to implement in assembler is des_enc.c. Replace the following
104 functions
11des_encrypt1(DES_LONG data[2],des_key_schedule ks, int encrypt);
12des_encrypt2(DES_LONG data[2],des_key_schedule ks, int encrypt);
13des_encrypt3(DES_LONG data[2],des_key_schedule ks1,ks2,ks3);
14des_decrypt3(DES_LONG data[2],des_key_schedule ks1,ks2,ks3);
15
16They encrypt/decrypt the 64 bits held in 'data' using
17the 'ks' key schedules. The only difference between the 4 functions is that
18des_encrypt2() does not perform IP() or FP() on the data (this is an
19optimization for when doing triple DES and des_encrypt3() and des_decrypt3()
20perform triple des. The triple DES routines are in here because it does
21make a big difference to have them located near the des_encrypt2 function
22at link time..
23
24Now as we all know, there are lots of different operating systems running on
25x86 boxes, and unfortunately they normally try to make sure their assembler
26formating is not the same as the other peoples.
27The 4 main formats I know of are
28Microsoft Windows 95/Windows NT
29Elf Includes Linux and FreeBSD(?).
30a.out The older Linux.
31Solaris Same as Elf but different comments :-(.
32
33Now I was not overly keen to write 4 different copies of the same code,
34so I wrote a few perl routines to output the correct assembler, given
35a target assembler type. This code is ugly and is just a hack.
36The libraries are x86unix.pl and x86ms.pl.
37des586.pl, des686.pl and des-som[23].pl are the programs to actually
38generate the assembler.
39
40So to generate elf assembler
41perl des-som3.pl elf >dx86-elf.s
42For Windows 95/NT
43perl des-som2.pl win32 >win32.asm
44
45[ update 4 Jan 1996 ]
46I have added another way to do things.
47perl des-som3.pl cpp >dx86-cpp.s
48generates a file that will be included by dx86unix.cpp when it is compiled.
49To build for elf, a.out, solaris, bsdi etc,
50cc -E -DELF asm/dx86unix.cpp | as -o asm/dx86-elf.o
51cc -E -DSOL asm/dx86unix.cpp | as -o asm/dx86-sol.o
52cc -E -DOUT asm/dx86unix.cpp | as -o asm/dx86-out.o
53cc -E -DBSDI asm/dx86unix.cpp | as -o asm/dx86bsdi.o
54This was done to cut down the number of files in the distribution.
55
56Now the ugly part. I acquired my copy of Intels
57"Optimization's For Intel's 32-Bit Processors" and found a few interesting
58things. First, the aim of the exersize is to 'extract' one byte at a time
59from a word and do an array lookup. This involves getting the byte from
60the 4 locations in the word and moving it to a new word and doing the lookup.
61The most obvious way to do this is
62xor eax, eax # clear word
63movb al, cl # get low byte
64xor edi DWORD PTR 0x100+des_SP[eax] # xor in word
65movb al, ch # get next byte
66xor edi DWORD PTR 0x300+des_SP[eax] # xor in word
67shr ecx 16
68which seems ok. For the pentium, this system appears to be the best.
69One has to do instruction interleaving to keep both functional units
70operating, but it is basically very efficient.
71
72Now the crunch. When a full register is used after a partial write, eg.
73mov al, cl
74xor edi, DWORD PTR 0x100+des_SP[eax]
75386 - 1 cycle stall
76486 - 1 cycle stall
77586 - 0 cycle stall
78686 - at least 7 cycle stall (page 22 of the above mentioned document).
79
80So the technique that produces the best results on a pentium, according to
81the documentation, will produce hideous results on a pentium pro.
82
83To get around this, des686.pl will generate code that is not as fast on
84a pentium, should be very good on a pentium pro.
85mov eax, ecx # copy word
86shr ecx, 8 # line up next byte
87and eax, 0fch # mask byte
88xor edi DWORD PTR 0x100+des_SP[eax] # xor in array lookup
89mov eax, ecx # get word
90shr ecx 8 # line up next byte
91and eax, 0fch # mask byte
92xor edi DWORD PTR 0x300+des_SP[eax] # xor in array lookup
93
94Due to the execution units in the pentium, this actually works quite well.
95For a pentium pro it should be very good. This is the type of output
96Visual C++ generates.
97
98There is a third option. instead of using
99mov al, ch
100which is bad on the pentium pro, one may be able to use
101movzx eax, ch
102which may not incur the partial write penalty. On the pentium,
103this instruction takes 4 cycles so is not worth using but on the
104pentium pro it appears it may be worth while. I need access to one to
105experiment :-).
106
107eric (20 Oct 1996)
108
10922 Nov 1996 - I have asked people to run the 2 different version on pentium
110pros and it appears that the intel documentation is wrong. The
111mov al,bh is still faster on a pentium pro, so just use the des586.pl
112install des686.pl
113
1143 Dec 1996 - I added des_encrypt3/des_decrypt3 because I have moved these
115functions into des_enc.c because it does make a massive performance
116difference on some boxes to have the functions code located close to
117the des_encrypt2() function.
118
1199 Jan 1997 - des-som2.pl is now the correct perl script to use for
120pentiums. It contains an inner loop from
121Svend Olaf Mikkelsen <svolaf@inet.uni-c.dk> which does raw ecb DES calls at
122273,000 per second. He had a previous version at 250,000 and the best
123I was able to get was 203,000. The content has not changed, this is all
124due to instruction sequencing (and actual instructions choice) which is able
125to keep both functional units of the pentium going.
126We may have lost the ugly register usage restrictions when x86 went 32 bit
127but for the pentium it has been replaced by evil instruction ordering tricks.
128
12913 Jan 1997 - des-som3.pl, more optimizations from Svend Olaf.
130raw DES at 281,000 per second on a pentium 100.
131
diff --git a/src/lib/libcrypto/des/cbc3_enc.c b/src/lib/libcrypto/des/cbc3_enc.c
new file mode 100644
index 0000000000..b5db4e14f7
--- /dev/null
+++ b/src/lib/libcrypto/des/cbc3_enc.c
@@ -0,0 +1,99 @@
1/* crypto/des/cbc3_enc.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
59#include "des_locl.h"
60
61/* HAS BUGS! DON'T USE - this is only present for use in des.c */
62void DES_3cbc_encrypt(DES_cblock *input, DES_cblock *output, long length,
63 DES_key_schedule ks1, DES_key_schedule ks2, DES_cblock *iv1,
64 DES_cblock *iv2, int enc)
65 {
66 int off=((int)length-1)/8;
67 long l8=((length+7)/8)*8;
68 DES_cblock niv1,niv2;
69
70 if (enc == DES_ENCRYPT)
71 {
72 DES_cbc_encrypt((unsigned char*)input,
73 (unsigned char*)output,length,&ks1,iv1,enc);
74 if (length >= sizeof(DES_cblock))
75 memcpy(niv1,output[off],sizeof(DES_cblock));
76 DES_cbc_encrypt((unsigned char*)output,
77 (unsigned char*)output,l8,&ks2,iv1,!enc);
78 DES_cbc_encrypt((unsigned char*)output,
79 (unsigned char*)output,l8,&ks1,iv2,enc);
80 if (length >= sizeof(DES_cblock))
81 memcpy(niv2,output[off],sizeof(DES_cblock));
82 }
83 else
84 {
85 if (length >= sizeof(DES_cblock))
86 memcpy(niv2,input[off],sizeof(DES_cblock));
87 DES_cbc_encrypt((unsigned char*)input,
88 (unsigned char*)output,l8,&ks1,iv2,enc);
89 DES_cbc_encrypt((unsigned char*)output,
90 (unsigned char*)output,l8,&ks2,iv1,!enc);
91 if (length >= sizeof(DES_cblock))
92 memcpy(niv1,output[off],sizeof(DES_cblock));
93 DES_cbc_encrypt((unsigned char*)output,
94 (unsigned char*)output,length,&ks1,iv1,enc);
95 }
96 memcpy(*iv1,niv1,sizeof(DES_cblock));
97 memcpy(*iv2,niv2,sizeof(DES_cblock));
98 }
99
diff --git a/src/lib/libcrypto/des/des-lib.com b/src/lib/libcrypto/des/des-lib.com
new file mode 100644
index 0000000000..348f1c0470
--- /dev/null
+++ b/src/lib/libcrypto/des/des-lib.com
@@ -0,0 +1,1005 @@
1$!
2$! DES-LIB.COM
3$! Written By: Robert Byer
4$! Vice-President
5$! A-Com Computing, Inc.
6$! byer@mail.all-net.net
7$!
8$! Changes by Richard Levitte <richard@levitte.org>
9$!
10$! This command files compiles and creates the
11$! "[.xxx.EXE.CRYPTO.DES]LIBDES.OLB" library. The "xxx" denotes the machine
12$! architecture of ALPHA, IA64 or VAX.
13$!
14$! It was re-written to try to determine which "C" compiler to try to use
15$! or the user can specify a compiler in P3.
16$!
17$! Specify one of the following to build just that part, specify "ALL" to
18$! just build everything.
19$!
20$! ALL To Just Build "Everything".
21$! LIBRARY To Just Build The [.xxx.EXE.CRYPTO.DES]LIBDES.OLB Library.
22$! DESTEST To Just Build The [.xxx.EXE.CRYPTO.DES]DESTEST.EXE Program.
23$! SPEED To Just Build The [.xxx.EXE.CRYPTO.DES]SPEED.EXE Program.
24$! RPW To Just Build The [.xxx.EXE.CRYPTO.DES]RPW.EXE Program.
25$! DES To Just Build The [.xxx.EXE.CRYPTO.DES]DES.EXE Program.
26$! DES_OPTS To Just Build The [.xxx.EXE.CRYPTO.DES]DES_OPTS.EXE Program.
27$!
28$! Specify either DEBUG or NODEBUG as P2 to compile with or without
29$! debugging information.
30$!
31$! Specify which compiler at P3 to try to compile under.
32$!
33$! VAXC For VAX C.
34$! DECC For DEC C.
35$! GNUC For GNU C.
36$!
37$! If you don't speficy a compiler, it will try to determine which
38$! "C" compiler to try to use.
39$!
40$! P4, if defined, sets a compiler thread NOT needed on OpenVMS 7.1 (and up)
41$!
42$!
43$! Make sure we know what architecture we run on.
44$!
45$!
46$! Check Which Architecture We Are Using.
47$!
48$ IF (F$GETSYI("CPU").LT.128)
49$ THEN
50$!
51$! The Architecture Is VAX
52$!
53$ ARCH := VAX
54$!
55$! Else...
56$!
57$ ELSE
58$!
59$! The Architecture Is Alpha, IA64 or whatever comes in the future.
60$!
61$ ARCH = F$EDIT( F$GETSYI( "ARCH_NAME"), "UPCASE")
62$ IF (ARCH .EQS. "") THEN ARCH = "UNK"
63$!
64$! End The Architecture Check.
65$!
66$ ENDIF
67$!
68$! Define The OBJ Directory Name.
69$!
70$ OBJ_DIR := SYS$DISK:[--.'ARCH'.OBJ.CRYPTO.DES]
71$!
72$! Define The EXE Directory Name.
73$!
74$ EXE_DIR :== SYS$DISK:[--.'ARCH'.EXE.CRYPTO.DES]
75$!
76$! Check To Make Sure We Have Valid Command Line Parameters.
77$!
78$ GOSUB CHECK_OPTIONS
79$!
80$! Tell The User What Kind of Machine We Run On.
81$!
82$ WRITE SYS$OUTPUT "Compiling On A ",ARCH," Machine."
83$!
84$! Check To See If The Architecture Specific OBJ Directory Exists.
85$!
86$ IF (F$PARSE(OBJ_DIR).EQS."")
87$ THEN
88$!
89$! It Dosen't Exist, So Create It.
90$!
91$ CREATE/DIR 'OBJ_DIR'
92$!
93$! End The Architecture Specific OBJ Directory Check.
94$!
95$ ENDIF
96$!
97$! Check To See If The Architecture Specific Directory Exists.
98$!
99$ IF (F$PARSE(EXE_DIR).EQS."")
100$ THEN
101$!
102$! It Dosen't Exist, So Create It.
103$!
104$ CREATE/DIR 'EXE_DIR'
105$!
106$! End The Architecture Specific Directory Check.
107$!
108$ ENDIF
109$!
110$! Define The Library Name.
111$!
112$ LIB_NAME := 'EXE_DIR'LIBDES.OLB
113$!
114$! Check To See What We Are To Do.
115$!
116$ IF (BUILDALL.EQS."TRUE")
117$ THEN
118$!
119$! Since Nothing Special Was Specified, Do Everything.
120$!
121$ GOSUB LIBRARY
122$ GOSUB DESTEST
123$ GOSUB SPEED
124$ GOSUB RPW
125$ GOSUB DES
126$ GOSUB DES_OPTS
127$!
128$! Else...
129$!
130$ ELSE
131$!
132$! Build Just What The User Wants Us To Build.
133$!
134$ GOSUB 'BUILDALL'
135$!
136$! End The BUILDALL Check.
137$!
138$ ENDIF
139$!
140$! Time To EXIT.
141$!
142$ EXIT
143$ LIBRARY:
144$!
145$! Tell The User That We Are Compiling.
146$!
147$ WRITE SYS$OUTPUT "Compiling The ",LIB_NAME," Files."
148$!
149$! Check To See If We Already Have A "[.xxx.EXE.CRYPTO.DES]LIBDES.OLB" Library...
150$!
151$ IF (F$SEARCH(LIB_NAME).EQS."")
152$ THEN
153$!
154$! Guess Not, Create The Library.
155$!
156$ LIBRARY/CREATE/OBJECT 'LIB_NAME'
157$!
158$! End The Library Exist Check.
159$!
160$ ENDIF
161$!
162$! Define The DES Library Files.
163$!
164$ LIB_DES = "set_key,ecb_enc,cbc_enc,"+ -
165 "ecb3_enc,cfb64enc,cfb64ede,cfb_enc,ofb64ede,"+ -
166 "enc_read,enc_writ,ofb64enc,"+ -
167 "ofb_enc,str2key,pcbc_enc,qud_cksm,rand_key,"+ -
168 "des_enc,fcrypt_b,read2pwd,"+ -
169 "fcrypt,xcbc_enc,read_pwd,rpc_enc,cbc_cksm,supp"
170$!
171$! Define A File Counter And Set It To "0".
172$!
173$ FILE_COUNTER = 0
174$!
175$! Top Of The File Loop.
176$!
177$ NEXT_FILE:
178$!
179$! O.K, Extract The File Name From The File List.
180$!
181$ FILE_NAME = F$ELEMENT(FILE_COUNTER,",",LIB_DES)
182$!
183$! Check To See If We Are At The End Of The File List.
184$!
185$ IF (FILE_NAME.EQS.",") THEN GOTO FILE_DONE
186$!
187$! Increment The Counter.
188$!
189$ FILE_COUNTER = FILE_COUNTER + 1
190$!
191$! Create The Source File Name.
192$!
193$ SOURCE_FILE = "SYS$DISK:[]" + FILE_NAME + ".C"
194$!
195$! Tell The User We Are Compiling The Source File.
196$!
197$ WRITE SYS$OUTPUT " ",FILE_NAME,".C"
198$!
199$! Create The Object File Name.
200$!
201$ OBJECT_FILE = OBJ_DIR + FILE_NAME + "." + ARCH + "OBJ"
202$ ON WARNING THEN GOTO NEXT_FILE
203$!
204$! Check To See If The File We Want To Compile Actually Exists.
205$!
206$ IF (F$SEARCH(SOURCE_FILE).EQS."")
207$ THEN
208$!
209$! Tell The User That The File Dosen't Exist.
210$!
211$ WRITE SYS$OUTPUT ""
212$ WRITE SYS$OUTPUT "The File ",SOURCE_FILE," Dosen't Exist."
213$ WRITE SYS$OUTPUT ""
214$!
215$! Exit The Build.
216$!
217$ EXIT
218$!
219$! End The File Exists Check.
220$!
221$ ENDIF
222$!
223$! Compile The File.
224$!
225$ ON ERROR THEN GOTO NEXT_FILE
226$ CC/OBJECT='OBJECT_FILE' 'SOURCE_FILE'
227$!
228$! Add It To The Library.
229$!
230$ LIBRARY/REPLACE/OBJECT 'LIB_NAME' 'OBJECT_FILE'
231$!
232$! Time To Clean Up The Object File.
233$!
234$ DELETE 'OBJECT_FILE';*
235$!
236$! Go Back And Do It Again.
237$!
238$ GOTO NEXT_FILE
239$!
240$! All Done With This Library Part.
241$!
242$ FILE_DONE:
243$!
244$! Tell The User That We Are All Done.
245$!
246$ WRITE SYS$OUTPUT "Library ",LIB_NAME," Built."
247$!
248$! All Done, Time To Return.
249$!
250$ RETURN
251$!
252$! Compile The DESTEST Program.
253$!
254$ DESTEST:
255$!
256$! Check To See If We Have The Proper Libraries.
257$!
258$ GOSUB LIB_CHECK
259$!
260$! Check To See If We Have A Linker Option File.
261$!
262$ GOSUB CHECK_OPT_FILE
263$!
264$! Check To See If The File We Want To Compile Actually Exists.
265$!
266$ IF (F$SEARCH("SYS$DISK:[]DESTEST.C").EQS."")
267$ THEN
268$!
269$! Tell The User That The File Dosen't Exist.
270$!
271$ WRITE SYS$OUTPUT ""
272$ WRITE SYS$OUTPUT "The File DESTEST.C Dosen't Exist."
273$ WRITE SYS$OUTPUT ""
274$!
275$! Exit The Build.
276$!
277$ EXIT
278$!
279$! End The DESTEST.C File Check.
280$!
281$ ENDIF
282$!
283$! Tell The User What We Are Building.
284$!
285$ WRITE SYS$OUTPUT "Building ",EXE_DIR,"DESTEST.EXE"
286$!
287$! Compile The DESTEST Program.
288$!
289$ CC/OBJECT='OBJ_DIR'DESTEST.OBJ SYS$DISK:[]DESTEST.C
290$!
291$! Link The DESTEST Program.
292$!
293$ LINK/'DEBUGGER'/'TRACEBACK'/CONTIGUOUS/EXE='EXE_DIR'DESTEST.EXE -
294 'OBJ_DIR'DESTEST.OBJ,'LIB_NAME'/LIBRARY,'OPT_FILE'/OPTION
295$!
296$! All Done, Time To Return.
297$!
298$ RETURN
299$!
300$! Compile The SPEED Program.
301$!
302$ SPEED:
303$!
304$! Check To See If We Have The Proper Libraries.
305$!
306$ GOSUB LIB_CHECK
307$!
308$! Check To See If We Have A Linker Option File.
309$!
310$ GOSUB CHECK_OPT_FILE
311$!
312$! Check To See If The File We Want To Compile Actually Exists.
313$!
314$ IF (F$SEARCH("SYS$DISK:[]SPEED.C").EQS."")
315$ THEN
316$!
317$! Tell The User That The File Dosen't Exist.
318$!
319$ WRITE SYS$OUTPUT ""
320$ WRITE SYS$OUTPUT "The File SPEED.C Dosen't Exist."
321$ WRITE SYS$OUTPUT ""
322$!
323$! Exit The Build.
324$!
325$ EXIT
326$!
327$! End The SPEED.C File Check.
328$!
329$ ENDIF
330$!
331$! Tell The User What We Are Building.
332$!
333$ WRITE SYS$OUTPUT "Building ",EXE_DIR,"SPEED.EXE"
334$!
335$! Compile The SPEED Program.
336$!
337$ CC/OBJECT='OBJ_DIR'SPEED.OBJ SYS$DISK:[]SPEED.C
338$!
339$! Link The SPEED Program.
340$!
341$ LINK/'DEBUGGER'/'TRACEBACK'/CONTIGUOUS/EXE='EXE_DIR'SPEED.EXE -
342 'OBJ_DIR'SPEED.OBJ,'LIB_NAME'/LIBRARY,'OPT_FILE'/OPTION
343$!
344$! All Done, Time To Return.
345$!
346$ RETURN
347$!
348$! Compile The RPW Program.
349$!
350$ RPW:
351$!
352$! Check To See If We Have The Proper Libraries.
353$!
354$ GOSUB LIB_CHECK
355$!
356$! Check To See If We Have A Linker Option File.
357$!
358$ GOSUB CHECK_OPT_FILE
359$!
360$! Check To See If The File We Want To Compile Actually Exists.
361$!
362$ IF (F$SEARCH("SYS$DISK:[]RPW.C").EQS."")
363$ THEN
364$!
365$! Tell The User That The File Dosen't Exist.
366$!
367$ WRITE SYS$OUTPUT ""
368$ WRITE SYS$OUTPUT "The File RPW.C Dosen't Exist."
369$ WRITE SYS$OUTPUT ""
370$!
371$! Exit The Build.
372$!
373$ EXIT
374$!
375$! End The RPW.C File Check.
376$!
377$ ENDIF
378$!
379$! Tell The User What We Are Building.
380$!
381$ WRITE SYS$OUTPUT "Building ",EXE_DIR,"RPW.EXE"
382$!
383$! Compile The RPW Program.
384$!
385$ CC/OBJECT='OBJ_DIR'RPW.OBJ SYS$DISK:[]RPW.C
386$!
387$! Link The RPW Program.
388$!
389$ LINK/'DEBUGGER'/'TRACEBACK'/CONTIGUOUS/EXE='EXE_DIR'RPW.EXE -
390 'OBJ_DIR'RPW.OBJ,'LIB_NAME'/LIBRARY,'OPT_FILE'/OPTION
391$!
392$! All Done, Time To Return.
393$!
394$ RETURN
395$!
396$! Compile The DES Program.
397$!
398$ DES:
399$!
400$! Check To See If We Have The Proper Libraries.
401$!
402$ GOSUB LIB_CHECK
403$!
404$! Check To See If We Have A Linker Option File.
405$!
406$ GOSUB CHECK_OPT_FILE
407$!
408$! Check To See If The File We Want To Compile Actually Exists.
409$!
410$ IF (F$SEARCH("SYS$DISK:[]DES.C").EQS."")
411$ THEN
412$!
413$! Tell The User That The File Dosen't Exist.
414$!
415$ WRITE SYS$OUTPUT ""
416$ WRITE SYS$OUTPUT "The File DES.C Dosen't Exist."
417$ WRITE SYS$OUTPUT ""
418$!
419$! Exit The Build.
420$!
421$ EXIT
422$!
423$! End The DES.C File Check.
424$!
425$ ENDIF
426$!
427$! Tell The User What We Are Building.
428$!
429$ WRITE SYS$OUTPUT "Building ",EXE_DIR,"DES.EXE"
430$!
431$! Compile The DES Program.
432$!
433$ CC/OBJECT='OBJ_DIR'DES.OBJ SYS$DISK:[]DES.C
434$ CC/OBJECT='OBJ_DIR'DES.OBJ SYS$DISK:[]CBC3_ENC.C
435$!
436$! Link The DES Program.
437$!
438$ LINK/'DEBUGGER'/'TRACEBACK'/CONTIGUOUS/EXE='EXE_DIR'DES.EXE -
439 'OBJ_DIR'DES.OBJ,'OBJ_DIR'CBC3_ENC.OBJ,-
440 'LIB_NAME'/LIBRARY,'OPT_FILE'/OPTION
441$!
442$! All Done, Time To Return.
443$!
444$ RETURN
445$!
446$! Compile The DES_OPTS Program.
447$!
448$ DES_OPTS:
449$!
450$! Check To See If We Have The Proper Libraries.
451$!
452$ GOSUB LIB_CHECK
453$!
454$! Check To See If We Have A Linker Option File.
455$!
456$ GOSUB CHECK_OPT_FILE
457$!
458$! Check To See If The File We Want To Compile Actually Exists.
459$!
460$ IF (F$SEARCH("SYS$DISK:[]DES_OPTS.C").EQS."")
461$ THEN
462$!
463$! Tell The User That The File Dosen't Exist.
464$!
465$ WRITE SYS$OUTPUT ""
466$ WRITE SYS$OUTPUT "The File DES_OPTS.C Dosen't Exist."
467$ WRITE SYS$OUTPUT ""
468$!
469$! Exit The Build.
470$!
471$ EXIT
472$!
473$! End The DES_OPTS.C File Check.
474$!
475$ ENDIF
476$!
477$! Tell The User What We Are Building.
478$!
479$ WRITE SYS$OUTPUT "Building ",EXE_DIR,"DES_OPTS.EXE"
480$!
481$! Compile The DES_OPTS Program.
482$!
483$ CC/OBJECT='OBJ_DIR'DES_OPTS.OBJ SYS$DISK:[]DES_OPTS.C
484$!
485$! Link The DES_OPTS Program.
486$!
487$ LINK/'DEBUGGER'/'TRACEBACK'/CONTIGUOUS/EXE='EXE_DIR'DES_OPTS.EXE -
488 'OBJ_DIR'DES_OPTS.OBJ,'LIB_NAME'/LIBRARY,'OPT_FILE'/OPTION
489$!
490$! All Done, Time To Return.
491$!
492$ RETURN
493$ EXIT
494$!
495$! Check For The Link Option FIle.
496$!
497$ CHECK_OPT_FILE:
498$!
499$! Check To See If We Need To Make A VAX C Option File.
500$!
501$ IF (COMPILER.EQS."VAXC")
502$ THEN
503$!
504$! Check To See If We Already Have A VAX C Linker Option File.
505$!
506$ IF (F$SEARCH(OPT_FILE).EQS."")
507$ THEN
508$!
509$! We Need A VAX C Linker Option File.
510$!
511$ CREATE 'OPT_FILE'
512$DECK
513!
514! Default System Options File To Link Agianst
515! The Sharable VAX C Runtime Library.
516!
517SYS$SHARE:VAXCRTL.EXE/SHARE
518$EOD
519$!
520$! End The Option File Check.
521$!
522$ ENDIF
523$!
524$! End The VAXC Check.
525$!
526$ ENDIF
527$!
528$! Check To See If We Need A GNU C Option File.
529$!
530$ IF (COMPILER.EQS."GNUC")
531$ THEN
532$!
533$! Check To See If We Already Have A GNU C Linker Option File.
534$!
535$ IF (F$SEARCH(OPT_FILE).EQS."")
536$ THEN
537$!
538$! We Need A GNU C Linker Option File.
539$!
540$ CREATE 'OPT_FILE'
541$DECK
542!
543! Default System Options File To Link Agianst
544! The Sharable C Runtime Library.
545!
546GNU_CC:[000000]GCCLIB/LIBRARY
547SYS$SHARE:VAXCRTL/SHARE
548$EOD
549$!
550$! End The Option File Check.
551$!
552$ ENDIF
553$!
554$! End The GNU C Check.
555$!
556$ ENDIF
557$!
558$! Check To See If We Need A DEC C Option File.
559$!
560$ IF (COMPILER.EQS."DECC")
561$ THEN
562$!
563$! Check To See If We Already Have A DEC C Linker Option File.
564$!
565$ IF (F$SEARCH(OPT_FILE).EQS."")
566$ THEN
567$!
568$! Figure Out If We Need An non-VAX Or A VAX Linker Option File.
569$!
570$ IF (F$GETSYI("CPU").LT.128)
571$ THEN
572$!
573$! We Need A DEC C Linker Option File For VAX.
574$!
575$ CREATE 'OPT_FILE'
576$DECK
577!
578! Default System Options File To Link Agianst
579! The Sharable DEC C Runtime Library.
580!
581SYS$SHARE:DECC$SHR.EXE/SHARE
582$EOD
583$!
584$! Else...
585$!
586$ ELSE
587$!
588$! Create The non-VAX Linker Option File.
589$!
590$ CREATE 'OPT_FILE'
591$DECK
592!
593! Default System Options File For non-VAX To Link Agianst
594! The Sharable C Runtime Library.
595!
596SYS$SHARE:CMA$OPEN_LIB_SHR/SHARE
597SYS$SHARE:CMA$OPEN_RTL/SHARE
598$EOD
599$!
600$! End The DEC C Option File Check.
601$!
602$ ENDIF
603$!
604$! End The Option File Search.
605$!
606$ ENDIF
607$!
608$! End The DEC C Check.
609$!
610$ ENDIF
611$!
612$! Tell The User What Linker Option File We Are Using.
613$!
614$ WRITE SYS$OUTPUT "Using Linker Option File ",OPT_FILE,"."
615$!
616$! Time To RETURN.
617$!
618$ RETURN
619$!
620$! Library Check.
621$!
622$ LIB_CHECK:
623$!
624$! Look For The Library LIBDES.OLB.
625$!
626$ IF (F$SEARCH(LIB_NAME).EQS."")
627$ THEN
628$!
629$! Tell The User We Can't Find The [.xxx.CRYPTO.DES]LIBDES.OLB Library.
630$!
631$ WRITE SYS$OUTPUT ""
632$ WRITE SYS$OUTPUT "Can't Find The Library ",LIB_NAME,"."
633$ WRITE SYS$OUTPUT "We Can't Link Without It."
634$ WRITE SYS$OUTPUT ""
635$!
636$! Since We Can't Link Without It, Exit.
637$!
638$ EXIT
639$ ENDIF
640$!
641$! Time To Return.
642$!
643$ RETURN
644$!
645$! Check The User's Options.
646$!
647$ CHECK_OPTIONS:
648$!
649$! Check To See If We Are To "Just Build Everything".
650$!
651$ IF (P1.EQS."ALL")
652$ THEN
653$!
654$! P1 Is "ALL", So Build Everything.
655$!
656$ BUILDALL = "TRUE"
657$!
658$! Else...
659$!
660$ ELSE
661$!
662$! Else, Check To See If P1 Has A Valid Argument.
663$!
664$ IF (P1.EQS."LIBRARY").OR.(P1.EQS."DESTEST").OR.(P1.EQS."SPEED") -
665 .OR.(P1.EQS."RPW").OR.(P1.EQS."DES").OR.(P1.EQS."DES_OPTS")
666$ THEN
667$!
668$! A Valid Argument.
669$!
670$ BUILDALL = P1
671$!
672$! Else...
673$!
674$ ELSE
675$!
676$! Tell The User We Don't Know What They Want.
677$!
678$ WRITE SYS$OUTPUT ""
679$ WRITE SYS$OUTPUT "The Option ",P1," Is Invalid. The Valid Options Are:"
680$ WRITE SYS$OUTPUT ""
681$ WRITE SYS$OUTPUT " ALL : Just Build Everything."
682$ WRITE SYS$OUTPUT " LIBRARY : To Compile Just The [.xxx.EXE.CRYPTO.DES]LIBDES.OLB Library."
683$ WRITE SYS$OUTPUT " DESTEST : To Compile Just The [.xxx.EXE.CRYPTO.DES]DESTEST.EXE Program."
684$ WRITE SYS$OUTPUT " SPEED : To Compile Just The [.xxx.EXE.CRYPTO.DES]SPEED.EXE Program."
685$ WRITE SYS$OUTPUT " RPW : To Compile Just The [.xxx.EXE.CRYPTO.DES]RPW.EXE Program."
686$ WRITE SYS$OUTPUT " DES : To Compile Just The [.xxx.EXE.CRYPTO.DES]DES.EXE Program."
687$ WRITE SYS$OUTPUT " DES_OPTS : To Compile Just The [.xxx.EXE.CRYTPO.DES]DES_OPTS.EXE Program."
688$ WRITE SYS$OUTPUT ""
689$ WRITE SYS$OUTPUT " Where 'xxx' Stands For: "
690$ WRITE SYS$OUTPUT ""
691$ WRITE SYS$OUTPUT " ALPHA : Alpha Architecture."
692$ WRITE SYS$OUTPUT " IA64 : IA64 Architecture."
693$ WRITE SYS$OUTPUT " VAX : VAX Architecture."
694$ WRITE SYS$OUTPUT ""
695$!
696$! Time To EXIT.
697$!
698$ EXIT
699$!
700$! End The Valid Argument Check.
701$!
702$ ENDIF
703$!
704$! End The P1 Check.
705$!
706$ ENDIF
707$!
708$! Check To See If We Are To Compile Without Debugger Information.
709$!
710$ IF (P2.EQS."NODEBUG")
711$ THEN
712$!
713$! P2 Is Blank, So Compile Without Debugger Information.
714$!
715$ DEBUGGER = "NODEBUG"
716$ TRACEBACK = "NOTRACEBACK"
717$ GCC_OPTIMIZE = "OPTIMIZE"
718$ CC_OPTIMIZE = "OPTIMIZE"
719$ WRITE SYS$OUTPUT "No Debugger Information Will Be Produced During Compile."
720$ WRITE SYS$OUTPUT "Compiling With Compiler Optimization."
721$!
722$! Else...
723$!
724$ ELSE
725$!
726$! Check To See If We Are To Compile With Debugger Information.
727$!
728$ IF (P2.EQS."DEBUG")
729$ THEN
730$!
731$! Compile With Debugger Information.
732$!
733$ DEBUGGER = "DEBUG"
734$ TRACEBACK = "TRACEBACK"
735$ GCC_OPTIMIZE = "NOOPTIMIZE"
736$ CC_OPTIMIZE = "NOOPTIMIZE"
737$ WRITE SYS$OUTPUT "Debugger Information Will Be Produced During Compile."
738$ WRITE SYS$OUTPUT "Compiling Without Compiler Optimization."
739$!
740$! Else...
741$!
742$ ELSE
743$!
744$! Tell The User Entered An Invalid Option..
745$!
746$ WRITE SYS$OUTPUT ""
747$ WRITE SYS$OUTPUT "The Option ",P2," Is Invalid. The Valid Options Are:"
748$ WRITE SYS$OUTPUT ""
749$ WRITE SYS$OUTPUT " DEBUG : Compile With The Debugger Information."
750$ WRITE SYS$OUTPUT " NODEBUG : Compile Without The Debugger Information."
751$ WRITE SYS$OUTPUT ""
752$!
753$! Time To EXIT.
754$!
755$ EXIT
756$!
757$! End The Valid Argument Check.
758$!
759$ ENDIF
760$!
761$! End The P2 Check.
762$!
763$ ENDIF
764$!
765$! Special Threads For OpenVMS v7.1 Or Later.
766$!
767$! Written By: Richard Levitte
768$! richard@levitte.org
769$!
770$!
771$! Check To See If We Have A Option For P4.
772$!
773$ IF (P4.EQS."")
774$ THEN
775$!
776$! Get The Version Of VMS We Are Using.
777$!
778$ ISSEVEN := ""
779$ TMP = F$ELEMENT(0,"-",F$EXTRACT(1,4,F$GETSYI("VERSION")))
780$ TMP = F$INTEGER(F$ELEMENT(0,".",TMP)+F$ELEMENT(1,".",TMP))
781$!
782$! Check To See If The VMS Version Is v7.1 Or Later.
783$!
784$ IF (TMP.GE.71)
785$ THEN
786$!
787$! We Have OpenVMS v7.1 Or Later, So Use The Special Threads.
788$!
789$ ISSEVEN := ,PTHREAD_USE_D4
790$!
791$! End The VMS Version Check.
792$!
793$ ENDIF
794$!
795$! End The P4 Check.
796$!
797$ ENDIF
798$!
799$! Check To See If P3 Is Blank.
800$!
801$ IF (P3.EQS."")
802$ THEN
803$!
804$! O.K., The User Didn't Specify A Compiler, Let's Try To
805$! Find Out Which One To Use.
806$!
807$! Check To See If We Have GNU C.
808$!
809$ IF (F$TRNLNM("GNU_CC").NES."")
810$ THEN
811$!
812$! Looks Like GNUC, Set To Use GNUC.
813$!
814$ P3 = "GNUC"
815$!
816$! Else...
817$!
818$ ELSE
819$!
820$! Check To See If We Have VAXC Or DECC.
821$!
822$ IF (ARCH.NES."VAX").OR.(F$TRNLNM("DECC$CC_DEFAULT").NES."")
823$ THEN
824$!
825$! Looks Like DECC, Set To Use DECC.
826$!
827$ P3 = "DECC"
828$!
829$! Else...
830$!
831$ ELSE
832$!
833$! Looks Like VAXC, Set To Use VAXC.
834$!
835$ P3 = "VAXC"
836$!
837$! End The VAXC Compiler Check.
838$!
839$ ENDIF
840$!
841$! End The DECC & VAXC Compiler Check.
842$!
843$ ENDIF
844$!
845$! End The Compiler Check.
846$!
847$ ENDIF
848$!
849$! Set Up Initial CC Definitions, Possibly With User Ones
850$!
851$ CCDEFS = ""
852$ IF F$TYPE(USER_CCDEFS) .NES. "" THEN CCDEFS = USER_CCDEFS
853$ CCEXTRAFLAGS = ""
854$ IF F$TYPE(USER_CCFLAGS) .NES. "" THEN CCEXTRAFLAGS = USER_CCFLAGS
855$ CCDISABLEWARNINGS = ""
856$ IF F$TYPE(USER_CCDISABLEWARNINGS) .NES. "" THEN -
857 CCDISABLEWARNINGS = USER_CCDISABLEWARNINGS
858$!
859$! Check To See If The User Entered A Valid Paramter.
860$!
861$ IF (P3.EQS."VAXC").OR.(P3.EQS."DECC").OR.(P3.EQS."GNUC")
862$ THEN
863$!
864$! Check To See If The User Wanted DECC.
865$!
866$ IF (P3.EQS."DECC")
867$ THEN
868$!
869$! Looks Like DECC, Set To Use DECC.
870$!
871$ COMPILER = "DECC"
872$!
873$! Tell The User We Are Using DECC.
874$!
875$ WRITE SYS$OUTPUT "Using DECC 'C' Compiler."
876$!
877$! Use DECC...
878$!
879$ CC = "CC"
880$ IF ARCH.EQS."VAX" .AND. F$TRNLNM("DECC$CC_DEFAULT").NES."/DECC" -
881 THEN CC = "CC/DECC"
882$ CC = CC + "/''CC_OPTIMIZE'/''DEBUGGER'/STANDARD=ANSI89" + -
883 "/NOLIST/PREFIX=ALL" + CCEXTRAFLAGS
884$!
885$! Define The Linker Options File Name.
886$!
887$ OPT_FILE = "''EXE_DIR'VAX_DECC_OPTIONS.OPT"
888$!
889$! End DECC Check.
890$!
891$ ENDIF
892$!
893$! Check To See If We Are To Use VAXC.
894$!
895$ IF (P3.EQS."VAXC")
896$ THEN
897$!
898$! Looks Like VAXC, Set To Use VAXC.
899$!
900$ COMPILER = "VAXC"
901$!
902$! Tell The User We Are Using VAX C.
903$!
904$ WRITE SYS$OUTPUT "Using VAXC 'C' Compiler."
905$!
906$! Compile Using VAXC.
907$!
908$ CC = "CC"
909$ IF ARCH.NES."VAX"
910$ THEN
911$ WRITE SYS$OUTPUT "There is no VAX C on ''ARCH'!"
912$ EXIT
913$ ENDIF
914$ IF F$TRNLNM("DECC$CC_DEFAULT").EQS."/DECC" THEN CC = "CC/VAXC"
915$ CC = CC + "/''CC_OPTIMIZE'/''DEBUGGER'/NOLIST" + CCEXTRAFLAGS
916$ CCDEFS = """VAXC""," + CCDEFS
917$!
918$! Define <sys> As SYS$COMMON:[SYSLIB]
919$!
920$ DEFINE/NOLOG SYS SYS$COMMON:[SYSLIB]
921$!
922$! Define The Linker Options File Name.
923$!
924$ OPT_FILE = "''EXE_DIR'VAX_VAXC_OPTIONS.OPT"
925$!
926$! End VAXC Check
927$!
928$ ENDIF
929$!
930$! Check To See If We Are To Use GNU C.
931$!
932$ IF (P3.EQS."GNUC")
933$ THEN
934$!
935$! Looks Like GNUC, Set To Use GNUC.
936$!
937$ COMPILER = "GNUC"
938$!
939$! Tell The User We Are Using GNUC.
940$!
941$ WRITE SYS$OUTPUT "Using GNU 'C' Compiler."
942$!
943$! Use GNU C...
944$!
945$ CC = "GCC/NOCASE_HACK/''GCC_OPTIMIZE'/''DEBUGGER'/NOLIST" + CCEXTRAFLAGS
946$!
947$! Define The Linker Options File Name.
948$!
949$ OPT_FILE = "''EXE_DIR'VAX_GNUC_OPTIONS.OPT"
950$!
951$! End The GNU C Check.
952$!
953$ ENDIF
954$!
955$! Set up default defines
956$!
957$ CCDEFS = """FLAT_INC=1""," + CCDEFS
958$!
959$! Finish up the definition of CC.
960$!
961$ IF COMPILER .EQS. "DECC"
962$ THEN
963$ IF CCDISABLEWARNINGS .EQS. ""
964$ THEN
965$ CC4DISABLEWARNINGS = "DOLLARID"
966$ ELSE
967$ CC4DISABLEWARNINGS = CCDISABLEWARNINGS + ",DOLLARID"
968$ CCDISABLEWARNINGS = "/WARNING=(DISABLE=(" + CCDISABLEWARNINGS + "))"
969$ ENDIF
970$ CC4DISABLEWARNINGS = "/WARNING=(DISABLE=(" + CC4DISABLEWARNINGS + "))"
971$ ELSE
972$ CCDISABLEWARNINGS = ""
973$ CC4DISABLEWARNINGS = ""
974$ ENDIF
975$ CC = CC + "/DEFINE=(" + CCDEFS + ")" + CCDISABLEWARNINGS
976$!
977$! Show user the result
978$!
979$ WRITE SYS$OUTPUT "Main Compiling Command: ",CC
980$!
981$! Else The User Entered An Invalid Argument.
982$!
983$ ELSE
984$!
985$! Tell The User We Don't Know What They Want.
986$!
987$ WRITE SYS$OUTPUT ""
988$ WRITE SYS$OUTPUT "The Option ",P3," Is Invalid. The Valid Options Are:"
989$ WRITE SYS$OUTPUT ""
990$ WRITE SYS$OUTPUT " VAXC : To Compile With VAX C."
991$ WRITE SYS$OUTPUT " DECC : To Compile With DEC C."
992$ WRITE SYS$OUTPUT " GNUC : To Compile With GNU C."
993$ WRITE SYS$OUTPUT ""
994$!
995$! Time To EXIT.
996$!
997$ EXIT
998$!
999$! End The P3 Check.
1000$!
1001$ ENDIF
1002$!
1003$! Time To RETURN...
1004$!
1005$ RETURN
diff --git a/src/lib/libcrypto/des/des.c b/src/lib/libcrypto/des/des.c
new file mode 100644
index 0000000000..343135ff9e
--- /dev/null
+++ b/src/lib/libcrypto/des/des.c
@@ -0,0 +1,932 @@
1/* crypto/des/des.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
59#include <stdio.h>
60#include <stdlib.h>
61#include <string.h>
62#include <openssl/opensslconf.h>
63#ifndef OPENSSL_SYS_MSDOS
64#ifndef OPENSSL_SYS_VMS
65#include OPENSSL_UNISTD
66#else /* OPENSSL_SYS_VMS */
67#ifdef __DECC
68#include <unistd.h>
69#else /* not __DECC */
70#include <math.h>
71#endif /* __DECC */
72#endif /* OPENSSL_SYS_VMS */
73#else /* OPENSSL_SYS_MSDOS */
74#include <io.h>
75#endif
76
77#include <time.h>
78#include "des_ver.h"
79
80#ifdef OPENSSL_SYS_VMS
81#include <types.h>
82#include <stat.h>
83#else
84#ifndef _IRIX
85#include <sys/types.h>
86#endif
87#include <sys/stat.h>
88#endif
89#include <openssl/des.h>
90#include <openssl/rand.h>
91#include <openssl/ui_compat.h>
92
93void usage(void);
94void doencryption(void);
95int uufwrite(unsigned char *data, int size, unsigned int num, FILE *fp);
96void uufwriteEnd(FILE *fp);
97int uufread(unsigned char *out,int size,unsigned int num,FILE *fp);
98int uuencode(unsigned char *in,int num,unsigned char *out);
99int uudecode(unsigned char *in,int num,unsigned char *out);
100void DES_3cbc_encrypt(DES_cblock *input,DES_cblock *output,long length,
101 DES_key_schedule sk1,DES_key_schedule sk2,
102 DES_cblock *ivec1,DES_cblock *ivec2,int enc);
103#ifdef OPENSSL_SYS_VMS
104#define EXIT(a) exit(a&0x10000000L)
105#else
106#define EXIT(a) exit(a)
107#endif
108
109#define BUFSIZE (8*1024)
110#define VERIFY 1
111#define KEYSIZ 8
112#define KEYSIZB 1024 /* should hit tty line limit first :-) */
113char key[KEYSIZB+1];
114int do_encrypt,longk=0;
115FILE *DES_IN,*DES_OUT,*CKSUM_OUT;
116char uuname[200];
117unsigned char uubuf[50];
118int uubufnum=0;
119#define INUUBUFN (45*100)
120#define OUTUUBUF (65*100)
121unsigned char b[OUTUUBUF];
122unsigned char bb[300];
123DES_cblock cksum={0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
124char cksumname[200]="";
125
126int vflag,cflag,eflag,dflag,kflag,bflag,fflag,sflag,uflag,flag3,hflag,error;
127
128int main(int argc, char **argv)
129 {
130 int i;
131 struct stat ins,outs;
132 char *p;
133 char *in=NULL,*out=NULL;
134
135 vflag=cflag=eflag=dflag=kflag=hflag=bflag=fflag=sflag=uflag=flag3=0;
136 error=0;
137 memset(key,0,sizeof(key));
138
139 for (i=1; i<argc; i++)
140 {
141 p=argv[i];
142 if ((p[0] == '-') && (p[1] != '\0'))
143 {
144 p++;
145 while (*p)
146 {
147 switch (*(p++))
148 {
149 case '3':
150 flag3=1;
151 longk=1;
152 break;
153 case 'c':
154 cflag=1;
155 strncpy(cksumname,p,200);
156 cksumname[sizeof(cksumname)-1]='\0';
157 p+=strlen(cksumname);
158 break;
159 case 'C':
160 cflag=1;
161 longk=1;
162 strncpy(cksumname,p,200);
163 cksumname[sizeof(cksumname)-1]='\0';
164 p+=strlen(cksumname);
165 break;
166 case 'e':
167 eflag=1;
168 break;
169 case 'v':
170 vflag=1;
171 break;
172 case 'E':
173 eflag=1;
174 longk=1;
175 break;
176 case 'd':
177 dflag=1;
178 break;
179 case 'D':
180 dflag=1;
181 longk=1;
182 break;
183 case 'b':
184 bflag=1;
185 break;
186 case 'f':
187 fflag=1;
188 break;
189 case 's':
190 sflag=1;
191 break;
192 case 'u':
193 uflag=1;
194 strncpy(uuname,p,200);
195 uuname[sizeof(uuname)-1]='\0';
196 p+=strlen(uuname);
197 break;
198 case 'h':
199 hflag=1;
200 break;
201 case 'k':
202 kflag=1;
203 if ((i+1) == argc)
204 {
205 fputs("must have a key with the -k option\n",stderr);
206 error=1;
207 }
208 else
209 {
210 int j;
211
212 i++;
213 strncpy(key,argv[i],KEYSIZB);
214 for (j=strlen(argv[i])-1; j>=0; j--)
215 argv[i][j]='\0';
216 }
217 break;
218 default:
219 fprintf(stderr,"'%c' unknown flag\n",p[-1]);
220 error=1;
221 break;
222 }
223 }
224 }
225 else
226 {
227 if (in == NULL)
228 in=argv[i];
229 else if (out == NULL)
230 out=argv[i];
231 else
232 error=1;
233 }
234 }
235 if (error) usage();
236 /* We either
237 * do checksum or
238 * do encrypt or
239 * do decrypt or
240 * do decrypt then ckecksum or
241 * do checksum then encrypt
242 */
243 if (((eflag+dflag) == 1) || cflag)
244 {
245 if (eflag) do_encrypt=DES_ENCRYPT;
246 if (dflag) do_encrypt=DES_DECRYPT;
247 }
248 else
249 {
250 if (vflag)
251 {
252#ifndef _Windows
253 fprintf(stderr,"des(1) built with %s\n",libdes_version);
254#endif
255 EXIT(1);
256 }
257 else usage();
258 }
259
260#ifndef _Windows
261 if (vflag) fprintf(stderr,"des(1) built with %s\n",libdes_version);
262#endif
263 if ( (in != NULL) &&
264 (out != NULL) &&
265#ifndef OPENSSL_SYS_MSDOS
266 (stat(in,&ins) != -1) &&
267 (stat(out,&outs) != -1) &&
268 (ins.st_dev == outs.st_dev) &&
269 (ins.st_ino == outs.st_ino))
270#else /* OPENSSL_SYS_MSDOS */
271 (strcmp(in,out) == 0))
272#endif
273 {
274 fputs("input and output file are the same\n",stderr);
275 EXIT(3);
276 }
277
278 if (!kflag)
279 if (des_read_pw_string(key,KEYSIZB+1,"Enter key:",eflag?VERIFY:0))
280 {
281 fputs("password error\n",stderr);
282 EXIT(2);
283 }
284
285 if (in == NULL)
286 DES_IN=stdin;
287 else if ((DES_IN=fopen(in,"r")) == NULL)
288 {
289 perror("opening input file");
290 EXIT(4);
291 }
292
293 CKSUM_OUT=stdout;
294 if (out == NULL)
295 {
296 DES_OUT=stdout;
297 CKSUM_OUT=stderr;
298 }
299 else if ((DES_OUT=fopen(out,"w")) == NULL)
300 {
301 perror("opening output file");
302 EXIT(5);
303 }
304
305#ifdef OPENSSL_SYS_MSDOS
306 /* This should set the file to binary mode. */
307 {
308#include <fcntl.h>
309 if (!(uflag && dflag))
310 setmode(fileno(DES_IN),O_BINARY);
311 if (!(uflag && eflag))
312 setmode(fileno(DES_OUT),O_BINARY);
313 }
314#endif
315
316 doencryption();
317 fclose(DES_IN);
318 fclose(DES_OUT);
319 EXIT(0);
320 }
321
322void usage(void)
323 {
324 char **u;
325 static const char *Usage[]={
326"des <options> [input-file [output-file]]",
327"options:",
328"-v : des(1) version number",
329"-e : encrypt using SunOS compatible user key to DES key conversion.",
330"-E : encrypt ",
331"-d : decrypt using SunOS compatible user key to DES key conversion.",
332"-D : decrypt ",
333"-c[ckname] : generate a cbc_cksum using SunOS compatible user key to",
334" DES key conversion and output to ckname (stdout default,",
335" stderr if data being output on stdout). The checksum is",
336" generated before encryption and after decryption if used",
337" in conjunction with -[eEdD].",
338"-C[ckname] : generate a cbc_cksum as for -c but compatible with -[ED].",
339"-k key : use key 'key'",
340"-h : the key that is entered will be a hexadecimal number",
341" that is used directly as the des key",
342"-u[uuname] : input file is uudecoded if -[dD] or output uuencoded data if -[eE]",
343" (uuname is the filename to put in the uuencode header).",
344"-b : encrypt using DES in ecb encryption mode, the default is cbc mode.",
345"-3 : encrypt using triple DES encryption. This uses 2 keys",
346" generated from the input key. If the input key is less",
347" than 8 characters long, this is equivalent to normal",
348" encryption. Default is triple cbc, -b makes it triple ecb.",
349NULL
350};
351 for (u=(char **)Usage; *u; u++)
352 {
353 fputs(*u,stderr);
354 fputc('\n',stderr);
355 }
356
357 EXIT(1);
358 }
359
360void doencryption(void)
361 {
362#ifdef _LIBC
363 extern unsigned long time();
364#endif
365
366 register int i;
367 DES_key_schedule ks,ks2;
368 DES_cblock iv,iv2;
369 char *p;
370 int num=0,j,k,l,rem,ll,len,last,ex=0;
371 DES_cblock kk,k2;
372 FILE *O;
373 int Exit=0;
374#ifndef OPENSSL_SYS_MSDOS
375 static unsigned char buf[BUFSIZE+8],obuf[BUFSIZE+8];
376#else
377 static unsigned char *buf=NULL,*obuf=NULL;
378
379 if (buf == NULL)
380 {
381 if ( (( buf=OPENSSL_malloc(BUFSIZE+8)) == NULL) ||
382 ((obuf=OPENSSL_malloc(BUFSIZE+8)) == NULL))
383 {
384 fputs("Not enough memory\n",stderr);
385 Exit=10;
386 goto problems;
387 }
388 }
389#endif
390
391 if (hflag)
392 {
393 j=(flag3?16:8);
394 p=key;
395 for (i=0; i<j; i++)
396 {
397 k=0;
398 if ((*p <= '9') && (*p >= '0'))
399 k=(*p-'0')<<4;
400 else if ((*p <= 'f') && (*p >= 'a'))
401 k=(*p-'a'+10)<<4;
402 else if ((*p <= 'F') && (*p >= 'A'))
403 k=(*p-'A'+10)<<4;
404 else
405 {
406 fputs("Bad hex key\n",stderr);
407 Exit=9;
408 goto problems;
409 }
410 p++;
411 if ((*p <= '9') && (*p >= '0'))
412 k|=(*p-'0');
413 else if ((*p <= 'f') && (*p >= 'a'))
414 k|=(*p-'a'+10);
415 else if ((*p <= 'F') && (*p >= 'A'))
416 k|=(*p-'A'+10);
417 else
418 {
419 fputs("Bad hex key\n",stderr);
420 Exit=9;
421 goto problems;
422 }
423 p++;
424 if (i < 8)
425 kk[i]=k;
426 else
427 k2[i-8]=k;
428 }
429 DES_set_key_unchecked(&k2,&ks2);
430 OPENSSL_cleanse(k2,sizeof(k2));
431 }
432 else if (longk || flag3)
433 {
434 if (flag3)
435 {
436 DES_string_to_2keys(key,&kk,&k2);
437 DES_set_key_unchecked(&k2,&ks2);
438 OPENSSL_cleanse(k2,sizeof(k2));
439 }
440 else
441 DES_string_to_key(key,&kk);
442 }
443 else
444 for (i=0; i<KEYSIZ; i++)
445 {
446 l=0;
447 k=key[i];
448 for (j=0; j<8; j++)
449 {
450 if (k&1) l++;
451 k>>=1;
452 }
453 if (l & 1)
454 kk[i]=key[i]&0x7f;
455 else
456 kk[i]=key[i]|0x80;
457 }
458
459 DES_set_key_unchecked(&kk,&ks);
460 OPENSSL_cleanse(key,sizeof(key));
461 OPENSSL_cleanse(kk,sizeof(kk));
462 /* woops - A bug that does not showup under unix :-( */
463 memset(iv,0,sizeof(iv));
464 memset(iv2,0,sizeof(iv2));
465
466 l=1;
467 rem=0;
468 /* first read */
469 if (eflag || (!dflag && cflag))
470 {
471 for (;;)
472 {
473 num=l=fread(&(buf[rem]),1,BUFSIZE,DES_IN);
474 l+=rem;
475 num+=rem;
476 if (l < 0)
477 {
478 perror("read error");
479 Exit=6;
480 goto problems;
481 }
482
483 rem=l%8;
484 len=l-rem;
485 if (feof(DES_IN))
486 {
487 for (i=7-rem; i>0; i--)
488 RAND_pseudo_bytes(buf + l++, 1);
489 buf[l++]=rem;
490 ex=1;
491 len+=rem;
492 }
493 else
494 l-=rem;
495
496 if (cflag)
497 {
498 DES_cbc_cksum(buf,&cksum,
499 (long)len,&ks,&cksum);
500 if (!eflag)
501 {
502 if (feof(DES_IN)) break;
503 else continue;
504 }
505 }
506
507 if (bflag && !flag3)
508 for (i=0; i<l; i+=8)
509 DES_ecb_encrypt(
510 (DES_cblock *)&(buf[i]),
511 (DES_cblock *)&(obuf[i]),
512 &ks,do_encrypt);
513 else if (flag3 && bflag)
514 for (i=0; i<l; i+=8)
515 DES_ecb2_encrypt(
516 (DES_cblock *)&(buf[i]),
517 (DES_cblock *)&(obuf[i]),
518 &ks,&ks2,do_encrypt);
519 else if (flag3 && !bflag)
520 {
521 char tmpbuf[8];
522
523 if (rem) memcpy(tmpbuf,&(buf[l]),
524 (unsigned int)rem);
525 DES_3cbc_encrypt(
526 (DES_cblock *)buf,(DES_cblock *)obuf,
527 (long)l,ks,ks2,&iv,
528 &iv2,do_encrypt);
529 if (rem) memcpy(&(buf[l]),tmpbuf,
530 (unsigned int)rem);
531 }
532 else
533 {
534 DES_cbc_encrypt(
535 buf,obuf,
536 (long)l,&ks,&iv,do_encrypt);
537 if (l >= 8) memcpy(iv,&(obuf[l-8]),8);
538 }
539 if (rem) memcpy(buf,&(buf[l]),(unsigned int)rem);
540
541 i=0;
542 while (i < l)
543 {
544 if (uflag)
545 j=uufwrite(obuf,1,(unsigned int)l-i,
546 DES_OUT);
547 else
548 j=fwrite(obuf,1,(unsigned int)l-i,
549 DES_OUT);
550 if (j == -1)
551 {
552 perror("Write error");
553 Exit=7;
554 goto problems;
555 }
556 i+=j;
557 }
558 if (feof(DES_IN))
559 {
560 if (uflag) uufwriteEnd(DES_OUT);
561 break;
562 }
563 }
564 }
565 else /* decrypt */
566 {
567 ex=1;
568 for (;;)
569 {
570 if (ex) {
571 if (uflag)
572 l=uufread(buf,1,BUFSIZE,DES_IN);
573 else
574 l=fread(buf,1,BUFSIZE,DES_IN);
575 ex=0;
576 rem=l%8;
577 l-=rem;
578 }
579 if (l < 0)
580 {
581 perror("read error");
582 Exit=6;
583 goto problems;
584 }
585
586 if (bflag && !flag3)
587 for (i=0; i<l; i+=8)
588 DES_ecb_encrypt(
589 (DES_cblock *)&(buf[i]),
590 (DES_cblock *)&(obuf[i]),
591 &ks,do_encrypt);
592 else if (flag3 && bflag)
593 for (i=0; i<l; i+=8)
594 DES_ecb2_encrypt(
595 (DES_cblock *)&(buf[i]),
596 (DES_cblock *)&(obuf[i]),
597 &ks,&ks2,do_encrypt);
598 else if (flag3 && !bflag)
599 {
600 DES_3cbc_encrypt(
601 (DES_cblock *)buf,(DES_cblock *)obuf,
602 (long)l,ks,ks2,&iv,
603 &iv2,do_encrypt);
604 }
605 else
606 {
607 DES_cbc_encrypt(
608 buf,obuf,
609 (long)l,&ks,&iv,do_encrypt);
610 if (l >= 8) memcpy(iv,&(buf[l-8]),8);
611 }
612
613 if (uflag)
614 ll=uufread(&(buf[rem]),1,BUFSIZE,DES_IN);
615 else
616 ll=fread(&(buf[rem]),1,BUFSIZE,DES_IN);
617 ll+=rem;
618 rem=ll%8;
619 ll-=rem;
620 if (feof(DES_IN) && (ll == 0))
621 {
622 last=obuf[l-1];
623
624 if ((last > 7) || (last < 0))
625 {
626 fputs("The file was not decrypted correctly.\n",
627 stderr);
628 Exit=8;
629 last=0;
630 }
631 l=l-8+last;
632 }
633 i=0;
634 if (cflag) DES_cbc_cksum(obuf,
635 (DES_cblock *)cksum,(long)l/8*8,&ks,
636 (DES_cblock *)cksum);
637 while (i != l)
638 {
639 j=fwrite(obuf,1,(unsigned int)l-i,DES_OUT);
640 if (j == -1)
641 {
642 perror("Write error");
643 Exit=7;
644 goto problems;
645 }
646 i+=j;
647 }
648 l=ll;
649 if ((l == 0) && feof(DES_IN)) break;
650 }
651 }
652 if (cflag)
653 {
654 l=0;
655 if (cksumname[0] != '\0')
656 {
657 if ((O=fopen(cksumname,"w")) != NULL)
658 {
659 CKSUM_OUT=O;
660 l=1;
661 }
662 }
663 for (i=0; i<8; i++)
664 fprintf(CKSUM_OUT,"%02X",cksum[i]);
665 fprintf(CKSUM_OUT,"\n");
666 if (l) fclose(CKSUM_OUT);
667 }
668problems:
669 OPENSSL_cleanse(buf,sizeof(buf));
670 OPENSSL_cleanse(obuf,sizeof(obuf));
671 OPENSSL_cleanse(&ks,sizeof(ks));
672 OPENSSL_cleanse(&ks2,sizeof(ks2));
673 OPENSSL_cleanse(iv,sizeof(iv));
674 OPENSSL_cleanse(iv2,sizeof(iv2));
675 OPENSSL_cleanse(kk,sizeof(kk));
676 OPENSSL_cleanse(k2,sizeof(k2));
677 OPENSSL_cleanse(uubuf,sizeof(uubuf));
678 OPENSSL_cleanse(b,sizeof(b));
679 OPENSSL_cleanse(bb,sizeof(bb));
680 OPENSSL_cleanse(cksum,sizeof(cksum));
681 if (Exit) EXIT(Exit);
682 }
683
684/* We ignore this parameter but it should be > ~50 I believe */
685int uufwrite(unsigned char *data, int size, unsigned int num, FILE *fp)
686 {
687 int i,j,left,rem,ret=num;
688 static int start=1;
689
690 if (start)
691 {
692 fprintf(fp,"begin 600 %s\n",
693 (uuname[0] == '\0')?"text.d":uuname);
694 start=0;
695 }
696
697 if (uubufnum)
698 {
699 if (uubufnum+num < 45)
700 {
701 memcpy(&(uubuf[uubufnum]),data,(unsigned int)num);
702 uubufnum+=num;
703 return(num);
704 }
705 else
706 {
707 i=45-uubufnum;
708 memcpy(&(uubuf[uubufnum]),data,(unsigned int)i);
709 j=uuencode((unsigned char *)uubuf,45,b);
710 fwrite(b,1,(unsigned int)j,fp);
711 uubufnum=0;
712 data+=i;
713 num-=i;
714 }
715 }
716
717 for (i=0; i<(((int)num)-INUUBUFN); i+=INUUBUFN)
718 {
719 j=uuencode(&(data[i]),INUUBUFN,b);
720 fwrite(b,1,(unsigned int)j,fp);
721 }
722 rem=(num-i)%45;
723 left=(num-i-rem);
724 if (left)
725 {
726 j=uuencode(&(data[i]),left,b);
727 fwrite(b,1,(unsigned int)j,fp);
728 i+=left;
729 }
730 if (i != num)
731 {
732 memcpy(uubuf,&(data[i]),(unsigned int)rem);
733 uubufnum=rem;
734 }
735 return(ret);
736 }
737
738void uufwriteEnd(FILE *fp)
739 {
740 int j;
741 static const char *end=" \nend\n";
742
743 if (uubufnum != 0)
744 {
745 uubuf[uubufnum]='\0';
746 uubuf[uubufnum+1]='\0';
747 uubuf[uubufnum+2]='\0';
748 j=uuencode(uubuf,uubufnum,b);
749 fwrite(b,1,(unsigned int)j,fp);
750 }
751 fwrite(end,1,strlen(end),fp);
752 }
753
754/* int size: should always be > ~ 60; I actually ignore this parameter :-) */
755int uufread(unsigned char *out, int size, unsigned int num, FILE *fp)
756 {
757 int i,j,tot;
758 static int done=0;
759 static int valid=0;
760 static int start=1;
761
762 if (start)
763 {
764 for (;;)
765 {
766 b[0]='\0';
767 fgets((char *)b,300,fp);
768 if (b[0] == '\0')
769 {
770 fprintf(stderr,"no 'begin' found in uuencoded input\n");
771 return(-1);
772 }
773 if (strncmp((char *)b,"begin ",6) == 0) break;
774 }
775 start=0;
776 }
777 if (done) return(0);
778 tot=0;
779 if (valid)
780 {
781 memcpy(out,bb,(unsigned int)valid);
782 tot=valid;
783 valid=0;
784 }
785 for (;;)
786 {
787 b[0]='\0';
788 fgets((char *)b,300,fp);
789 if (b[0] == '\0') break;
790 i=strlen((char *)b);
791 if ((b[0] == 'e') && (b[1] == 'n') && (b[2] == 'd'))
792 {
793 done=1;
794 while (!feof(fp))
795 {
796 fgets((char *)b,300,fp);
797 }
798 break;
799 }
800 i=uudecode(b,i,bb);
801 if (i < 0) break;
802 if ((i+tot+8) > num)
803 {
804 /* num to copy to make it a multiple of 8 */
805 j=(num/8*8)-tot-8;
806 memcpy(&(out[tot]),bb,(unsigned int)j);
807 tot+=j;
808 memcpy(bb,&(bb[j]),(unsigned int)i-j);
809 valid=i-j;
810 break;
811 }
812 memcpy(&(out[tot]),bb,(unsigned int)i);
813 tot+=i;
814 }
815 return(tot);
816 }
817
818#define ccc2l(c,l) (l =((DES_LONG)(*((c)++)))<<16, \
819 l|=((DES_LONG)(*((c)++)))<< 8, \
820 l|=((DES_LONG)(*((c)++))))
821
822#define l2ccc(l,c) (*((c)++)=(unsigned char)(((l)>>16)&0xff), \
823 *((c)++)=(unsigned char)(((l)>> 8)&0xff), \
824 *((c)++)=(unsigned char)(((l) )&0xff))
825
826
827int uuencode(unsigned char *in, int num, unsigned char *out)
828 {
829 int j,i,n,tot=0;
830 DES_LONG l;
831 register unsigned char *p;
832 p=out;
833
834 for (j=0; j<num; j+=45)
835 {
836 if (j+45 > num)
837 i=(num-j);
838 else i=45;
839 *(p++)=i+' ';
840 for (n=0; n<i; n+=3)
841 {
842 ccc2l(in,l);
843 *(p++)=((l>>18)&0x3f)+' ';
844 *(p++)=((l>>12)&0x3f)+' ';
845 *(p++)=((l>> 6)&0x3f)+' ';
846 *(p++)=((l )&0x3f)+' ';
847 tot+=4;
848 }
849 *(p++)='\n';
850 tot+=2;
851 }
852 *p='\0';
853 l=0;
854 return(tot);
855 }
856
857int uudecode(unsigned char *in, int num, unsigned char *out)
858 {
859 int j,i,k;
860 unsigned int n=0,space=0;
861 DES_LONG l;
862 DES_LONG w,x,y,z;
863 unsigned int blank=(unsigned int)'\n'-' ';
864
865 for (j=0; j<num; )
866 {
867 n= *(in++)-' ';
868 if (n == blank)
869 {
870 n=0;
871 in--;
872 }
873 if (n > 60)
874 {
875 fprintf(stderr,"uuencoded line length too long\n");
876 return(-1);
877 }
878 j++;
879
880 for (i=0; i<n; j+=4,i+=3)
881 {
882 /* the following is for cases where spaces are
883 * removed from lines.
884 */
885 if (space)
886 {
887 w=x=y=z=0;
888 }
889 else
890 {
891 w= *(in++)-' ';
892 x= *(in++)-' ';
893 y= *(in++)-' ';
894 z= *(in++)-' ';
895 }
896 if ((w > 63) || (x > 63) || (y > 63) || (z > 63))
897 {
898 k=0;
899 if (w == blank) k=1;
900 if (x == blank) k=2;
901 if (y == blank) k=3;
902 if (z == blank) k=4;
903 space=1;
904 switch (k) {
905 case 1: w=0; in--;
906 case 2: x=0; in--;
907 case 3: y=0; in--;
908 case 4: z=0; in--;
909 break;
910 case 0:
911 space=0;
912 fprintf(stderr,"bad uuencoded data values\n");
913 w=x=y=z=0;
914 return(-1);
915 break;
916 }
917 }
918 l=(w<<18)|(x<<12)|(y<< 6)|(z );
919 l2ccc(l,out);
920 }
921 if (*(in++) != '\n')
922 {
923 fprintf(stderr,"missing nl in uuencoded line\n");
924 w=x=y=z=0;
925 return(-1);
926 }
927 j++;
928 }
929 *out='\0';
930 w=x=y=z=0;
931 return(n);
932 }
diff --git a/src/lib/libcrypto/des/des.h b/src/lib/libcrypto/des/des.h
index 1eaedcbd24..23c8cfc901 100644
--- a/src/lib/libcrypto/des/des.h
+++ b/src/lib/libcrypto/des/des.h
@@ -56,8 +56,8 @@
56 * [including the GNU Public Licence.] 56 * [including the GNU Public Licence.]
57 */ 57 */
58 58
59#ifndef HEADER_NEW_DES_H 59#ifndef HEADER_DES_H
60#define HEADER_NEW_DES_H 60#define HEADER_DES_H
61 61
62#include <openssl/e_os2.h> /* OPENSSL_EXTERN, OPENSSL_NO_DES, 62#include <openssl/e_os2.h> /* OPENSSL_EXTERN, OPENSSL_NO_DES,
63 DES_LONG (via openssl/opensslconf.h */ 63 DES_LONG (via openssl/opensslconf.h */
@@ -71,6 +71,8 @@
71# define OPENSSL_EXTERN OPENSSL_EXPORT 71# define OPENSSL_EXTERN OPENSSL_EXPORT
72#endif 72#endif
73 73
74#define des_SPtrans DES_SPtrans
75
74#ifdef __cplusplus 76#ifdef __cplusplus
75extern "C" { 77extern "C" {
76#endif 78#endif
diff --git a/src/lib/libcrypto/des/des.pod b/src/lib/libcrypto/des/des.pod
new file mode 100644
index 0000000000..bf479e83d2
--- /dev/null
+++ b/src/lib/libcrypto/des/des.pod
@@ -0,0 +1,217 @@
1=pod
2
3=head1 NAME
4
5des - encrypt or decrypt data using Data Encryption Standard
6
7=head1 SYNOPSIS
8
9B<des>
10(
11B<-e>
12|
13B<-E>
14) | (
15B<-d>
16|
17B<-D>
18) | (
19B<->[B<cC>][B<ckname>]
20) |
21[
22B<-b3hfs>
23] [
24B<-k>
25I<key>
26]
27] [
28B<-u>[I<uuname>]
29[
30I<input-file>
31[
32I<output-file>
33] ]
34
35=head1 NOTE
36
37This page describes the B<des> stand-alone program, not the B<openssl des>
38command.
39
40=head1 DESCRIPTION
41
42B<des>
43encrypts and decrypts data using the
44Data Encryption Standard algorithm.
45One of
46B<-e>, B<-E>
47(for encrypt) or
48B<-d>, B<-D>
49(for decrypt) must be specified.
50It is also possible to use
51B<-c>
52or
53B<-C>
54in conjunction or instead of the a encrypt/decrypt option to generate
55a 16 character hexadecimal checksum, generated via the
56I<des_cbc_cksum>.
57
58Two standard encryption modes are supported by the
59B<des>
60program, Cipher Block Chaining (the default) and Electronic Code Book
61(specified with
62B<-b>).
63
64The key used for the DES
65algorithm is obtained by prompting the user unless the
66B<-k>
67I<key>
68option is given.
69If the key is an argument to the
70B<des>
71command, it is potentially visible to users executing
72ps(1)
73or a derivative. To minimise this possibility,
74B<des>
75takes care to destroy the key argument immediately upon entry.
76If your shell keeps a history file be careful to make sure it is not
77world readable.
78
79Since this program attempts to maintain compatibility with sunOS's
80des(1) command, there are 2 different methods used to convert the user
81supplied key to a des key.
82Whenever and one or more of
83B<-E>, B<-D>, B<-C>
84or
85B<-3>
86options are used, the key conversion procedure will not be compatible
87with the sunOS des(1) version but will use all the user supplied
88character to generate the des key.
89B<des>
90command reads from standard input unless
91I<input-file>
92is specified and writes to standard output unless
93I<output-file>
94is given.
95
96=head1 OPTIONS
97
98=over 4
99
100=item B<-b>
101
102Select ECB
103(eight bytes at a time) encryption mode.
104
105=item B<-3>
106
107Encrypt using triple encryption.
108By default triple cbc encryption is used but if the
109B<-b>
110option is used then triple ECB encryption is performed.
111If the key is less than 8 characters long, the flag has no effect.
112
113=item B<-e>
114
115Encrypt data using an 8 byte key in a manner compatible with sunOS
116des(1).
117
118=item B<-E>
119
120Encrypt data using a key of nearly unlimited length (1024 bytes).
121This will product a more secure encryption.
122
123=item B<-d>
124
125Decrypt data that was encrypted with the B<-e> option.
126
127=item B<-D>
128
129Decrypt data that was encrypted with the B<-E> option.
130
131=item B<-c>
132
133Generate a 16 character hexadecimal cbc checksum and output this to
134stderr.
135If a filename was specified after the
136B<-c>
137option, the checksum is output to that file.
138The checksum is generated using a key generated in a sunOS compatible
139manner.
140
141=item B<-C>
142
143A cbc checksum is generated in the same manner as described for the
144B<-c>
145option but the DES key is generated in the same manner as used for the
146B<-E>
147and
148B<-D>
149options
150
151=item B<-f>
152
153Does nothing - allowed for compatibility with sunOS des(1) command.
154
155=item B<-s>
156
157Does nothing - allowed for compatibility with sunOS des(1) command.
158
159=item B<-k> I<key>
160
161Use the encryption
162I<key>
163specified.
164
165=item B<-h>
166
167The
168I<key>
169is assumed to be a 16 character hexadecimal number.
170If the
171B<-3>
172option is used the key is assumed to be a 32 character hexadecimal
173number.
174
175=item B<-u>
176
177This flag is used to read and write uuencoded files. If decrypting,
178the input file is assumed to contain uuencoded, DES encrypted data.
179If encrypting, the characters following the B<-u> are used as the name of
180the uuencoded file to embed in the begin line of the uuencoded
181output. If there is no name specified after the B<-u>, the name text.des
182will be embedded in the header.
183
184=head1 SEE ALSO
185
186ps(1),
187L<des_crypt(3)|des_crypt(3)>
188
189=head1 BUGS
190
191The problem with using the
192B<-e>
193option is the short key length.
194It would be better to use a real 56-bit key rather than an
195ASCII-based 56-bit pattern. Knowing that the key was derived from ASCII
196radically reduces the time necessary for a brute-force cryptographic attack.
197My attempt to remove this problem is to add an alternative text-key to
198DES-key function. This alternative function (accessed via
199B<-E>, B<-D>, B<-S>
200and
201B<-3>)
202uses DES to help generate the key.
203
204Be carefully when using the B<-u> option. Doing B<des -ud> I<filename> will
205not decrypt filename (the B<-u> option will gobble the B<-d> option).
206
207The VMS operating system operates in a world where files are always a
208multiple of 512 bytes. This causes problems when encrypted data is
209send from Unix to VMS since a 88 byte file will suddenly be padded
210with 424 null bytes. To get around this problem, use the B<-u> option
211to uuencode the data before it is send to the VMS system.
212
213=head1 AUTHOR
214
215Eric Young (eay@cryptsoft.com)
216
217=cut
diff --git a/src/lib/libcrypto/des/des3s.cpp b/src/lib/libcrypto/des/des3s.cpp
new file mode 100644
index 0000000000..02d527c057
--- /dev/null
+++ b/src/lib/libcrypto/des/des3s.cpp
@@ -0,0 +1,67 @@
1//
2// gettsc.inl
3//
4// gives access to the Pentium's (secret) cycle counter
5//
6// This software was written by Leonard Janke (janke@unixg.ubc.ca)
7// in 1996-7 and is entered, by him, into the public domain.
8
9#if defined(__WATCOMC__)
10void GetTSC(unsigned long&);
11#pragma aux GetTSC = 0x0f 0x31 "mov [edi], eax" parm [edi] modify [edx eax];
12#elif defined(__GNUC__)
13inline
14void GetTSC(unsigned long& tsc)
15{
16 asm volatile(".byte 15, 49\n\t"
17 : "=eax" (tsc)
18 :
19 : "%edx", "%eax");
20}
21#elif defined(_MSC_VER)
22inline
23void GetTSC(unsigned long& tsc)
24{
25 unsigned long a;
26 __asm _emit 0fh
27 __asm _emit 31h
28 __asm mov a, eax;
29 tsc=a;
30}
31#endif
32
33#include <stdio.h>
34#include <stdlib.h>
35#include <openssl/des.h>
36
37void main(int argc,char *argv[])
38 {
39 des_key_schedule key1,key2,key3;
40 unsigned long s1,s2,e1,e2;
41 unsigned long data[2];
42 int i,j;
43
44 for (j=0; j<6; j++)
45 {
46 for (i=0; i<1000; i++) /**/
47 {
48 des_encrypt3(&data[0],key1,key2,key3);
49 GetTSC(s1);
50 des_encrypt3(&data[0],key1,key2,key3);
51 des_encrypt3(&data[0],key1,key2,key3);
52 des_encrypt3(&data[0],key1,key2,key3);
53 GetTSC(e1);
54 GetTSC(s2);
55 des_encrypt3(&data[0],key1,key2,key3);
56 des_encrypt3(&data[0],key1,key2,key3);
57 des_encrypt3(&data[0],key1,key2,key3);
58 des_encrypt3(&data[0],key1,key2,key3);
59 GetTSC(e2);
60 des_encrypt3(&data[0],key1,key2,key3);
61 }
62
63 printf("des %d %d (%d)\n",
64 e1-s1,e2-s2,((e2-s2)-(e1-s1)));
65 }
66 }
67
diff --git a/src/lib/libcrypto/des/des_enc.c b/src/lib/libcrypto/des/des_enc.c
index 828feba208..5c47553a5a 100644
--- a/src/lib/libcrypto/des/des_enc.c
+++ b/src/lib/libcrypto/des/des_enc.c
@@ -59,6 +59,8 @@
59#include "des_locl.h" 59#include "des_locl.h"
60#include "spr.h" 60#include "spr.h"
61 61
62#ifndef OPENBSD_DES_ASM
63
62void DES_encrypt1(DES_LONG *data, DES_key_schedule *ks, int enc) 64void DES_encrypt1(DES_LONG *data, DES_key_schedule *ks, int enc)
63 { 65 {
64 register DES_LONG l,r,t,u; 66 register DES_LONG l,r,t,u;
@@ -240,6 +242,8 @@ void DES_encrypt2(DES_LONG *data, DES_key_schedule *ks, int enc)
240 l=r=t=u=0; 242 l=r=t=u=0;
241 } 243 }
242 244
245#endif /* OPENBSD_DES_ASM */
246
243void DES_encrypt3(DES_LONG *data, DES_key_schedule *ks1, 247void DES_encrypt3(DES_LONG *data, DES_key_schedule *ks1,
244 DES_key_schedule *ks2, DES_key_schedule *ks3) 248 DES_key_schedule *ks2, DES_key_schedule *ks3)
245 { 249 {
diff --git a/src/lib/libcrypto/des/des_old.c b/src/lib/libcrypto/des/des_old.c
new file mode 100644
index 0000000000..7c33ed7a93
--- /dev/null
+++ b/src/lib/libcrypto/des/des_old.c
@@ -0,0 +1,273 @@
1/* crypto/des/des_old.c -*- mode:C; c-file-style: "eay" -*- */
2
3/* WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
4 *
5 * The function names in here are deprecated and are only present to
6 * provide an interface compatible with libdes. OpenSSL now provides
7 * functions where "des_" has been replaced with "DES_" in the names,
8 * to make it possible to make incompatible changes that are needed
9 * for C type security and other stuff.
10 *
11 * Please consider starting to use the DES_ functions rather than the
12 * des_ ones. The des_ functions will dissapear completely before
13 * OpenSSL 1.0!
14 *
15 * WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
16 */
17
18/* Written by Richard Levitte (richard@levitte.org) for the OpenSSL
19 * project 2001.
20 */
21/* ====================================================================
22 * Copyright (c) 1998-2001 The OpenSSL Project. All rights reserved.
23 *
24 * Redistribution and use in source and binary forms, with or without
25 * modification, are permitted provided that the following conditions
26 * are met:
27 *
28 * 1. Redistributions of source code must retain the above copyright
29 * notice, this list of conditions and the following disclaimer.
30 *
31 * 2. Redistributions in binary form must reproduce the above copyright
32 * notice, this list of conditions and the following disclaimer in
33 * the documentation and/or other materials provided with the
34 * distribution.
35 *
36 * 3. All advertising materials mentioning features or use of this
37 * software must display the following acknowledgment:
38 * "This product includes software developed by the OpenSSL Project
39 * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
40 *
41 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
42 * endorse or promote products derived from this software without
43 * prior written permission. For written permission, please contact
44 * openssl-core@openssl.org.
45 *
46 * 5. Products derived from this software may not be called "OpenSSL"
47 * nor may "OpenSSL" appear in their names without prior written
48 * permission of the OpenSSL Project.
49 *
50 * 6. Redistributions of any form whatsoever must retain the following
51 * acknowledgment:
52 * "This product includes software developed by the OpenSSL Project
53 * for use in the OpenSSL Toolkit (http://www.openssl.org/)"
54 *
55 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
56 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
57 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
58 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
59 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
60 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
61 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
62 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
63 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
64 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
65 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
66 * OF THE POSSIBILITY OF SUCH DAMAGE.
67 * ====================================================================
68 *
69 * This product includes cryptographic software written by Eric Young
70 * (eay@cryptsoft.com). This product includes software written by Tim
71 * Hudson (tjh@cryptsoft.com).
72 *
73 */
74
75#define OPENSSL_DES_LIBDES_COMPATIBILITY
76#include <openssl/des.h>
77#include <openssl/rand.h>
78
79const char *_ossl_old_des_options(void)
80 {
81 return DES_options();
82 }
83void _ossl_old_des_ecb3_encrypt(_ossl_old_des_cblock *input,_ossl_old_des_cblock *output,
84 des_key_schedule ks1,des_key_schedule ks2,
85 des_key_schedule ks3, int enc)
86 {
87 DES_ecb3_encrypt((const_DES_cblock *)input, output,
88 (DES_key_schedule *)ks1, (DES_key_schedule *)ks2,
89 (DES_key_schedule *)ks3, enc);
90 }
91DES_LONG _ossl_old_des_cbc_cksum(_ossl_old_des_cblock *input,_ossl_old_des_cblock *output,
92 long length,des_key_schedule schedule,_ossl_old_des_cblock *ivec)
93 {
94 return DES_cbc_cksum((unsigned char *)input, output, length,
95 (DES_key_schedule *)schedule, ivec);
96 }
97void _ossl_old_des_cbc_encrypt(_ossl_old_des_cblock *input,_ossl_old_des_cblock *output,long length,
98 des_key_schedule schedule,_ossl_old_des_cblock *ivec,int enc)
99 {
100 DES_cbc_encrypt((unsigned char *)input, (unsigned char *)output,
101 length, (DES_key_schedule *)schedule, ivec, enc);
102 }
103void _ossl_old_des_ncbc_encrypt(_ossl_old_des_cblock *input,_ossl_old_des_cblock *output,long length,
104 des_key_schedule schedule,_ossl_old_des_cblock *ivec,int enc)
105 {
106 DES_ncbc_encrypt((unsigned char *)input, (unsigned char *)output,
107 length, (DES_key_schedule *)schedule, ivec, enc);
108 }
109void _ossl_old_des_xcbc_encrypt(_ossl_old_des_cblock *input,_ossl_old_des_cblock *output,long length,
110 des_key_schedule schedule,_ossl_old_des_cblock *ivec,
111 _ossl_old_des_cblock *inw,_ossl_old_des_cblock *outw,int enc)
112 {
113 DES_xcbc_encrypt((unsigned char *)input, (unsigned char *)output,
114 length, (DES_key_schedule *)schedule, ivec, inw, outw, enc);
115 }
116void _ossl_old_des_cfb_encrypt(unsigned char *in,unsigned char *out,int numbits,
117 long length,des_key_schedule schedule,_ossl_old_des_cblock *ivec,int enc)
118 {
119 DES_cfb_encrypt(in, out, numbits, length,
120 (DES_key_schedule *)schedule, ivec, enc);
121 }
122void _ossl_old_des_ecb_encrypt(_ossl_old_des_cblock *input,_ossl_old_des_cblock *output,
123 des_key_schedule ks,int enc)
124 {
125 DES_ecb_encrypt(input, output, (DES_key_schedule *)ks, enc);
126 }
127void _ossl_old_des_encrypt(DES_LONG *data,des_key_schedule ks, int enc)
128 {
129 DES_encrypt1(data, (DES_key_schedule *)ks, enc);
130 }
131void _ossl_old_des_encrypt2(DES_LONG *data,des_key_schedule ks, int enc)
132 {
133 DES_encrypt2(data, (DES_key_schedule *)ks, enc);
134 }
135void _ossl_old_des_encrypt3(DES_LONG *data, des_key_schedule ks1,
136 des_key_schedule ks2, des_key_schedule ks3)
137 {
138 DES_encrypt3(data, (DES_key_schedule *)ks1, (DES_key_schedule *)ks2,
139 (DES_key_schedule *)ks3);
140 }
141void _ossl_old_des_decrypt3(DES_LONG *data, des_key_schedule ks1,
142 des_key_schedule ks2, des_key_schedule ks3)
143 {
144 DES_decrypt3(data, (DES_key_schedule *)ks1, (DES_key_schedule *)ks2,
145 (DES_key_schedule *)ks3);
146 }
147void _ossl_old_des_ede3_cbc_encrypt(_ossl_old_des_cblock *input, _ossl_old_des_cblock *output,
148 long length, des_key_schedule ks1, des_key_schedule ks2,
149 des_key_schedule ks3, _ossl_old_des_cblock *ivec, int enc)
150 {
151 DES_ede3_cbc_encrypt((unsigned char *)input, (unsigned char *)output,
152 length, (DES_key_schedule *)ks1, (DES_key_schedule *)ks2,
153 (DES_key_schedule *)ks3, ivec, enc);
154 }
155void _ossl_old_des_ede3_cfb64_encrypt(unsigned char *in, unsigned char *out,
156 long length, des_key_schedule ks1, des_key_schedule ks2,
157 des_key_schedule ks3, _ossl_old_des_cblock *ivec, int *num, int enc)
158 {
159 DES_ede3_cfb64_encrypt(in, out, length,
160 (DES_key_schedule *)ks1, (DES_key_schedule *)ks2,
161 (DES_key_schedule *)ks3, ivec, num, enc);
162 }
163void _ossl_old_des_ede3_ofb64_encrypt(unsigned char *in, unsigned char *out,
164 long length, des_key_schedule ks1, des_key_schedule ks2,
165 des_key_schedule ks3, _ossl_old_des_cblock *ivec, int *num)
166 {
167 DES_ede3_ofb64_encrypt(in, out, length,
168 (DES_key_schedule *)ks1, (DES_key_schedule *)ks2,
169 (DES_key_schedule *)ks3, ivec, num);
170 }
171
172#if 0 /* broken code, preserved just in case anyone specifically looks for this */
173void _ossl_old_des_xwhite_in2out(_ossl_old_des_cblock (*des_key), _ossl_old_des_cblock (*in_white),
174 _ossl_old_des_cblock (*out_white))
175 {
176 DES_xwhite_in2out(des_key, in_white, out_white);
177 }
178#endif
179
180int _ossl_old_des_enc_read(int fd,char *buf,int len,des_key_schedule sched,
181 _ossl_old_des_cblock *iv)
182 {
183 return DES_enc_read(fd, buf, len, (DES_key_schedule *)sched, iv);
184 }
185int _ossl_old_des_enc_write(int fd,char *buf,int len,des_key_schedule sched,
186 _ossl_old_des_cblock *iv)
187 {
188 return DES_enc_write(fd, buf, len, (DES_key_schedule *)sched, iv);
189 }
190char *_ossl_old_des_fcrypt(const char *buf,const char *salt, char *ret)
191 {
192 return DES_fcrypt(buf, salt, ret);
193 }
194char *_ossl_old_des_crypt(const char *buf,const char *salt)
195 {
196 return DES_crypt(buf, salt);
197 }
198char *_ossl_old_crypt(const char *buf,const char *salt)
199 {
200 return DES_crypt(buf, salt);
201 }
202void _ossl_old_des_ofb_encrypt(unsigned char *in,unsigned char *out,
203 int numbits,long length,des_key_schedule schedule,_ossl_old_des_cblock *ivec)
204 {
205 DES_ofb_encrypt(in, out, numbits, length, (DES_key_schedule *)schedule,
206 ivec);
207 }
208void _ossl_old_des_pcbc_encrypt(_ossl_old_des_cblock *input,_ossl_old_des_cblock *output,long length,
209 des_key_schedule schedule,_ossl_old_des_cblock *ivec,int enc)
210 {
211 DES_pcbc_encrypt((unsigned char *)input, (unsigned char *)output,
212 length, (DES_key_schedule *)schedule, ivec, enc);
213 }
214DES_LONG _ossl_old_des_quad_cksum(_ossl_old_des_cblock *input,_ossl_old_des_cblock *output,
215 long length,int out_count,_ossl_old_des_cblock *seed)
216 {
217 return DES_quad_cksum((unsigned char *)input, output, length,
218 out_count, seed);
219 }
220void _ossl_old_des_random_seed(_ossl_old_des_cblock key)
221 {
222 RAND_seed(key, sizeof(_ossl_old_des_cblock));
223 }
224void _ossl_old_des_random_key(_ossl_old_des_cblock ret)
225 {
226 DES_random_key((DES_cblock *)ret);
227 }
228int _ossl_old_des_read_password(_ossl_old_des_cblock *key, const char *prompt,
229 int verify)
230 {
231 return DES_read_password(key, prompt, verify);
232 }
233int _ossl_old_des_read_2passwords(_ossl_old_des_cblock *key1, _ossl_old_des_cblock *key2,
234 const char *prompt, int verify)
235 {
236 return DES_read_2passwords(key1, key2, prompt, verify);
237 }
238void _ossl_old_des_set_odd_parity(_ossl_old_des_cblock *key)
239 {
240 DES_set_odd_parity(key);
241 }
242int _ossl_old_des_is_weak_key(_ossl_old_des_cblock *key)
243 {
244 return DES_is_weak_key(key);
245 }
246int _ossl_old_des_set_key(_ossl_old_des_cblock *key,des_key_schedule schedule)
247 {
248 return DES_set_key(key, (DES_key_schedule *)schedule);
249 }
250int _ossl_old_des_key_sched(_ossl_old_des_cblock *key,des_key_schedule schedule)
251 {
252 return DES_key_sched(key, (DES_key_schedule *)schedule);
253 }
254void _ossl_old_des_string_to_key(char *str,_ossl_old_des_cblock *key)
255 {
256 DES_string_to_key(str, key);
257 }
258void _ossl_old_des_string_to_2keys(char *str,_ossl_old_des_cblock *key1,_ossl_old_des_cblock *key2)
259 {
260 DES_string_to_2keys(str, key1, key2);
261 }
262void _ossl_old_des_cfb64_encrypt(unsigned char *in, unsigned char *out, long length,
263 des_key_schedule schedule, _ossl_old_des_cblock *ivec, int *num, int enc)
264 {
265 DES_cfb64_encrypt(in, out, length, (DES_key_schedule *)schedule,
266 ivec, num, enc);
267 }
268void _ossl_old_des_ofb64_encrypt(unsigned char *in, unsigned char *out, long length,
269 des_key_schedule schedule, _ossl_old_des_cblock *ivec, int *num)
270 {
271 DES_ofb64_encrypt(in, out, length, (DES_key_schedule *)schedule,
272 ivec, num);
273 }
diff --git a/src/lib/libcrypto/des/des_old.h b/src/lib/libcrypto/des/des_old.h
new file mode 100644
index 0000000000..8665ba4e7e
--- /dev/null
+++ b/src/lib/libcrypto/des/des_old.h
@@ -0,0 +1,446 @@
1/* crypto/des/des_old.h -*- mode:C; c-file-style: "eay" -*- */
2
3/* WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
4 *
5 * The function names in here are deprecated and are only present to
6 * provide an interface compatible with openssl 0.9.6 and older as
7 * well as libdes. OpenSSL now provides functions where "des_" has
8 * been replaced with "DES_" in the names, to make it possible to
9 * make incompatible changes that are needed for C type security and
10 * other stuff.
11 *
12 * This include files has two compatibility modes:
13 *
14 * - If OPENSSL_DES_LIBDES_COMPATIBILITY is defined, you get an API
15 * that is compatible with libdes and SSLeay.
16 * - If OPENSSL_DES_LIBDES_COMPATIBILITY isn't defined, you get an
17 * API that is compatible with OpenSSL 0.9.5x to 0.9.6x.
18 *
19 * Note that these modes break earlier snapshots of OpenSSL, where
20 * libdes compatibility was the only available mode or (later on) the
21 * prefered compatibility mode. However, after much consideration
22 * (and more or less violent discussions with external parties), it
23 * was concluded that OpenSSL should be compatible with earlier versions
24 * of itself before anything else. Also, in all honesty, libdes is
25 * an old beast that shouldn't really be used any more.
26 *
27 * Please consider starting to use the DES_ functions rather than the
28 * des_ ones. The des_ functions will disappear completely before
29 * OpenSSL 1.0!
30 *
31 * WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
32 */
33
34/* Written by Richard Levitte (richard@levitte.org) for the OpenSSL
35 * project 2001.
36 */
37/* ====================================================================
38 * Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved.
39 *
40 * Redistribution and use in source and binary forms, with or without
41 * modification, are permitted provided that the following conditions
42 * are met:
43 *
44 * 1. Redistributions of source code must retain the above copyright
45 * notice, this list of conditions and the following disclaimer.
46 *
47 * 2. Redistributions in binary form must reproduce the above copyright
48 * notice, this list of conditions and the following disclaimer in
49 * the documentation and/or other materials provided with the
50 * distribution.
51 *
52 * 3. All advertising materials mentioning features or use of this
53 * software must display the following acknowledgment:
54 * "This product includes software developed by the OpenSSL Project
55 * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
56 *
57 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
58 * endorse or promote products derived from this software without
59 * prior written permission. For written permission, please contact
60 * openssl-core@openssl.org.
61 *
62 * 5. Products derived from this software may not be called "OpenSSL"
63 * nor may "OpenSSL" appear in their names without prior written
64 * permission of the OpenSSL Project.
65 *
66 * 6. Redistributions of any form whatsoever must retain the following
67 * acknowledgment:
68 * "This product includes software developed by the OpenSSL Project
69 * for use in the OpenSSL Toolkit (http://www.openssl.org/)"
70 *
71 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
72 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
73 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
74 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
75 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
76 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
77 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
78 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
79 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
80 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
81 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
82 * OF THE POSSIBILITY OF SUCH DAMAGE.
83 * ====================================================================
84 *
85 * This product includes cryptographic software written by Eric Young
86 * (eay@cryptsoft.com). This product includes software written by Tim
87 * Hudson (tjh@cryptsoft.com).
88 *
89 */
90
91#ifndef HEADER_DES_OLD_H
92#define HEADER_DES_OLD_H
93
94#include <openssl/e_os2.h> /* OPENSSL_EXTERN, OPENSSL_NO_DES, DES_LONG */
95
96#ifdef OPENSSL_NO_DES
97#error DES is disabled.
98#endif
99
100#ifndef HEADER_DES_H
101#error You must include des.h, not des_old.h directly.
102#endif
103
104#ifdef _KERBEROS_DES_H
105#error <openssl/des_old.h> replaces <kerberos/des.h>.
106#endif
107
108#include <openssl/symhacks.h>
109
110#ifdef OPENSSL_BUILD_SHLIBCRYPTO
111# undef OPENSSL_EXTERN
112# define OPENSSL_EXTERN OPENSSL_EXPORT
113#endif
114
115#ifdef __cplusplus
116extern "C" {
117#endif
118
119#ifdef _
120#undef _
121#endif
122
123typedef unsigned char _ossl_old_des_cblock[8];
124typedef struct _ossl_old_des_ks_struct
125 {
126 union {
127 _ossl_old_des_cblock _;
128 /* make sure things are correct size on machines with
129 * 8 byte longs */
130 DES_LONG pad[2];
131 } ks;
132 } _ossl_old_des_key_schedule[16];
133
134#ifndef OPENSSL_DES_LIBDES_COMPATIBILITY
135#define des_cblock DES_cblock
136#define const_des_cblock const_DES_cblock
137#define des_key_schedule DES_key_schedule
138#define des_ecb3_encrypt(i,o,k1,k2,k3,e)\
139 DES_ecb3_encrypt((i),(o),&(k1),&(k2),&(k3),(e))
140#define des_ede3_cbc_encrypt(i,o,l,k1,k2,k3,iv,e)\
141 DES_ede3_cbc_encrypt((i),(o),(l),&(k1),&(k2),&(k3),(iv),(e))
142#define des_ede3_cbcm_encrypt(i,o,l,k1,k2,k3,iv1,iv2,e)\
143 DES_ede3_cbcm_encrypt((i),(o),(l),&(k1),&(k2),&(k3),(iv1),(iv2),(e))
144#define des_ede3_cfb64_encrypt(i,o,l,k1,k2,k3,iv,n,e)\
145 DES_ede3_cfb64_encrypt((i),(o),(l),&(k1),&(k2),&(k3),(iv),(n),(e))
146#define des_ede3_ofb64_encrypt(i,o,l,k1,k2,k3,iv,n)\
147 DES_ede3_ofb64_encrypt((i),(o),(l),&(k1),&(k2),&(k3),(iv),(n))
148#define des_options()\
149 DES_options()
150#define des_cbc_cksum(i,o,l,k,iv)\
151 DES_cbc_cksum((i),(o),(l),&(k),(iv))
152#define des_cbc_encrypt(i,o,l,k,iv,e)\
153 DES_cbc_encrypt((i),(o),(l),&(k),(iv),(e))
154#define des_ncbc_encrypt(i,o,l,k,iv,e)\
155 DES_ncbc_encrypt((i),(o),(l),&(k),(iv),(e))
156#define des_xcbc_encrypt(i,o,l,k,iv,inw,outw,e)\
157 DES_xcbc_encrypt((i),(o),(l),&(k),(iv),(inw),(outw),(e))
158#define des_cfb_encrypt(i,o,n,l,k,iv,e)\
159 DES_cfb_encrypt((i),(o),(n),(l),&(k),(iv),(e))
160#define des_ecb_encrypt(i,o,k,e)\
161 DES_ecb_encrypt((i),(o),&(k),(e))
162#define des_encrypt1(d,k,e)\
163 DES_encrypt1((d),&(k),(e))
164#define des_encrypt2(d,k,e)\
165 DES_encrypt2((d),&(k),(e))
166#define des_encrypt3(d,k1,k2,k3)\
167 DES_encrypt3((d),&(k1),&(k2),&(k3))
168#define des_decrypt3(d,k1,k2,k3)\
169 DES_decrypt3((d),&(k1),&(k2),&(k3))
170#define des_xwhite_in2out(k,i,o)\
171 DES_xwhite_in2out((k),(i),(o))
172#define des_enc_read(f,b,l,k,iv)\
173 DES_enc_read((f),(b),(l),&(k),(iv))
174#define des_enc_write(f,b,l,k,iv)\
175 DES_enc_write((f),(b),(l),&(k),(iv))
176#define des_fcrypt(b,s,r)\
177 DES_fcrypt((b),(s),(r))
178#if 0
179#define des_crypt(b,s)\
180 DES_crypt((b),(s))
181#if !defined(PERL5) && !defined(__FreeBSD__) && !defined(NeXT) && !defined(__OpenBSD__)
182#define crypt(b,s)\
183 DES_crypt((b),(s))
184#endif
185#endif
186#define des_ofb_encrypt(i,o,n,l,k,iv)\
187 DES_ofb_encrypt((i),(o),(n),(l),&(k),(iv))
188#define des_pcbc_encrypt(i,o,l,k,iv,e)\
189 DES_pcbc_encrypt((i),(o),(l),&(k),(iv),(e))
190#define des_quad_cksum(i,o,l,c,s)\
191 DES_quad_cksum((i),(o),(l),(c),(s))
192#define des_random_seed(k)\
193 _ossl_096_des_random_seed((k))
194#define des_random_key(r)\
195 DES_random_key((r))
196#define des_read_password(k,p,v) \
197 DES_read_password((k),(p),(v))
198#define des_read_2passwords(k1,k2,p,v) \
199 DES_read_2passwords((k1),(k2),(p),(v))
200#define des_set_odd_parity(k)\
201 DES_set_odd_parity((k))
202#define des_check_key_parity(k)\
203 DES_check_key_parity((k))
204#define des_is_weak_key(k)\
205 DES_is_weak_key((k))
206#define des_set_key(k,ks)\
207 DES_set_key((k),&(ks))
208#define des_key_sched(k,ks)\
209 DES_key_sched((k),&(ks))
210#define des_set_key_checked(k,ks)\
211 DES_set_key_checked((k),&(ks))
212#define des_set_key_unchecked(k,ks)\
213 DES_set_key_unchecked((k),&(ks))
214#define des_string_to_key(s,k)\
215 DES_string_to_key((s),(k))
216#define des_string_to_2keys(s,k1,k2)\
217 DES_string_to_2keys((s),(k1),(k2))
218#define des_cfb64_encrypt(i,o,l,ks,iv,n,e)\
219 DES_cfb64_encrypt((i),(o),(l),&(ks),(iv),(n),(e))
220#define des_ofb64_encrypt(i,o,l,ks,iv,n)\
221 DES_ofb64_encrypt((i),(o),(l),&(ks),(iv),(n))
222
223
224#define des_ecb2_encrypt(i,o,k1,k2,e) \
225 des_ecb3_encrypt((i),(o),(k1),(k2),(k1),(e))
226
227#define des_ede2_cbc_encrypt(i,o,l,k1,k2,iv,e) \
228 des_ede3_cbc_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(e))
229
230#define des_ede2_cfb64_encrypt(i,o,l,k1,k2,iv,n,e) \
231 des_ede3_cfb64_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(n),(e))
232
233#define des_ede2_ofb64_encrypt(i,o,l,k1,k2,iv,n) \
234 des_ede3_ofb64_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(n))
235
236#define des_check_key DES_check_key
237#define des_rw_mode DES_rw_mode
238#else /* libdes compatibility */
239/* Map all symbol names to _ossl_old_des_* form, so we avoid all
240 clashes with libdes */
241#define des_cblock _ossl_old_des_cblock
242#define des_key_schedule _ossl_old_des_key_schedule
243#define des_ecb3_encrypt(i,o,k1,k2,k3,e)\
244 _ossl_old_des_ecb3_encrypt((i),(o),(k1),(k2),(k3),(e))
245#define des_ede3_cbc_encrypt(i,o,l,k1,k2,k3,iv,e)\
246 _ossl_old_des_ede3_cbc_encrypt((i),(o),(l),(k1),(k2),(k3),(iv),(e))
247#define des_ede3_cfb64_encrypt(i,o,l,k1,k2,k3,iv,n,e)\
248 _ossl_old_des_ede3_cfb64_encrypt((i),(o),(l),(k1),(k2),(k3),(iv),(n),(e))
249#define des_ede3_ofb64_encrypt(i,o,l,k1,k2,k3,iv,n)\
250 _ossl_old_des_ede3_ofb64_encrypt((i),(o),(l),(k1),(k2),(k3),(iv),(n))
251#define des_options()\
252 _ossl_old_des_options()
253#define des_cbc_cksum(i,o,l,k,iv)\
254 _ossl_old_des_cbc_cksum((i),(o),(l),(k),(iv))
255#define des_cbc_encrypt(i,o,l,k,iv,e)\
256 _ossl_old_des_cbc_encrypt((i),(o),(l),(k),(iv),(e))
257#define des_ncbc_encrypt(i,o,l,k,iv,e)\
258 _ossl_old_des_ncbc_encrypt((i),(o),(l),(k),(iv),(e))
259#define des_xcbc_encrypt(i,o,l,k,iv,inw,outw,e)\
260 _ossl_old_des_xcbc_encrypt((i),(o),(l),(k),(iv),(inw),(outw),(e))
261#define des_cfb_encrypt(i,o,n,l,k,iv,e)\
262 _ossl_old_des_cfb_encrypt((i),(o),(n),(l),(k),(iv),(e))
263#define des_ecb_encrypt(i,o,k,e)\
264 _ossl_old_des_ecb_encrypt((i),(o),(k),(e))
265#define des_encrypt(d,k,e)\
266 _ossl_old_des_encrypt((d),(k),(e))
267#define des_encrypt2(d,k,e)\
268 _ossl_old_des_encrypt2((d),(k),(e))
269#define des_encrypt3(d,k1,k2,k3)\
270 _ossl_old_des_encrypt3((d),(k1),(k2),(k3))
271#define des_decrypt3(d,k1,k2,k3)\
272 _ossl_old_des_decrypt3((d),(k1),(k2),(k3))
273#define des_xwhite_in2out(k,i,o)\
274 _ossl_old_des_xwhite_in2out((k),(i),(o))
275#define des_enc_read(f,b,l,k,iv)\
276 _ossl_old_des_enc_read((f),(b),(l),(k),(iv))
277#define des_enc_write(f,b,l,k,iv)\
278 _ossl_old_des_enc_write((f),(b),(l),(k),(iv))
279#define des_fcrypt(b,s,r)\
280 _ossl_old_des_fcrypt((b),(s),(r))
281#define des_crypt(b,s)\
282 _ossl_old_des_crypt((b),(s))
283#if 0
284#define crypt(b,s)\
285 _ossl_old_crypt((b),(s))
286#endif
287#define des_ofb_encrypt(i,o,n,l,k,iv)\
288 _ossl_old_des_ofb_encrypt((i),(o),(n),(l),(k),(iv))
289#define des_pcbc_encrypt(i,o,l,k,iv,e)\
290 _ossl_old_des_pcbc_encrypt((i),(o),(l),(k),(iv),(e))
291#define des_quad_cksum(i,o,l,c,s)\
292 _ossl_old_des_quad_cksum((i),(o),(l),(c),(s))
293#define des_random_seed(k)\
294 _ossl_old_des_random_seed((k))
295#define des_random_key(r)\
296 _ossl_old_des_random_key((r))
297#define des_read_password(k,p,v) \
298 _ossl_old_des_read_password((k),(p),(v))
299#define des_read_2passwords(k1,k2,p,v) \
300 _ossl_old_des_read_2passwords((k1),(k2),(p),(v))
301#define des_set_odd_parity(k)\
302 _ossl_old_des_set_odd_parity((k))
303#define des_is_weak_key(k)\
304 _ossl_old_des_is_weak_key((k))
305#define des_set_key(k,ks)\
306 _ossl_old_des_set_key((k),(ks))
307#define des_key_sched(k,ks)\
308 _ossl_old_des_key_sched((k),(ks))
309#define des_string_to_key(s,k)\
310 _ossl_old_des_string_to_key((s),(k))
311#define des_string_to_2keys(s,k1,k2)\
312 _ossl_old_des_string_to_2keys((s),(k1),(k2))
313#define des_cfb64_encrypt(i,o,l,ks,iv,n,e)\
314 _ossl_old_des_cfb64_encrypt((i),(o),(l),(ks),(iv),(n),(e))
315#define des_ofb64_encrypt(i,o,l,ks,iv,n)\
316 _ossl_old_des_ofb64_encrypt((i),(o),(l),(ks),(iv),(n))
317
318
319#define des_ecb2_encrypt(i,o,k1,k2,e) \
320 des_ecb3_encrypt((i),(o),(k1),(k2),(k1),(e))
321
322#define des_ede2_cbc_encrypt(i,o,l,k1,k2,iv,e) \
323 des_ede3_cbc_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(e))
324
325#define des_ede2_cfb64_encrypt(i,o,l,k1,k2,iv,n,e) \
326 des_ede3_cfb64_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(n),(e))
327
328#define des_ede2_ofb64_encrypt(i,o,l,k1,k2,iv,n) \
329 des_ede3_ofb64_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(n))
330
331#define des_check_key DES_check_key
332#define des_rw_mode DES_rw_mode
333#endif
334
335const char *_ossl_old_des_options(void);
336void _ossl_old_des_ecb3_encrypt(_ossl_old_des_cblock *input,_ossl_old_des_cblock *output,
337 _ossl_old_des_key_schedule ks1,_ossl_old_des_key_schedule ks2,
338 _ossl_old_des_key_schedule ks3, int enc);
339DES_LONG _ossl_old_des_cbc_cksum(_ossl_old_des_cblock *input,_ossl_old_des_cblock *output,
340 long length,_ossl_old_des_key_schedule schedule,_ossl_old_des_cblock *ivec);
341void _ossl_old_des_cbc_encrypt(_ossl_old_des_cblock *input,_ossl_old_des_cblock *output,long length,
342 _ossl_old_des_key_schedule schedule,_ossl_old_des_cblock *ivec,int enc);
343void _ossl_old_des_ncbc_encrypt(_ossl_old_des_cblock *input,_ossl_old_des_cblock *output,long length,
344 _ossl_old_des_key_schedule schedule,_ossl_old_des_cblock *ivec,int enc);
345void _ossl_old_des_xcbc_encrypt(_ossl_old_des_cblock *input,_ossl_old_des_cblock *output,long length,
346 _ossl_old_des_key_schedule schedule,_ossl_old_des_cblock *ivec,
347 _ossl_old_des_cblock *inw,_ossl_old_des_cblock *outw,int enc);
348void _ossl_old_des_cfb_encrypt(unsigned char *in,unsigned char *out,int numbits,
349 long length,_ossl_old_des_key_schedule schedule,_ossl_old_des_cblock *ivec,int enc);
350void _ossl_old_des_ecb_encrypt(_ossl_old_des_cblock *input,_ossl_old_des_cblock *output,
351 _ossl_old_des_key_schedule ks,int enc);
352void _ossl_old_des_encrypt(DES_LONG *data,_ossl_old_des_key_schedule ks, int enc);
353void _ossl_old_des_encrypt2(DES_LONG *data,_ossl_old_des_key_schedule ks, int enc);
354void _ossl_old_des_encrypt3(DES_LONG *data, _ossl_old_des_key_schedule ks1,
355 _ossl_old_des_key_schedule ks2, _ossl_old_des_key_schedule ks3);
356void _ossl_old_des_decrypt3(DES_LONG *data, _ossl_old_des_key_schedule ks1,
357 _ossl_old_des_key_schedule ks2, _ossl_old_des_key_schedule ks3);
358void _ossl_old_des_ede3_cbc_encrypt(_ossl_old_des_cblock *input, _ossl_old_des_cblock *output,
359 long length, _ossl_old_des_key_schedule ks1, _ossl_old_des_key_schedule ks2,
360 _ossl_old_des_key_schedule ks3, _ossl_old_des_cblock *ivec, int enc);
361void _ossl_old_des_ede3_cfb64_encrypt(unsigned char *in, unsigned char *out,
362 long length, _ossl_old_des_key_schedule ks1, _ossl_old_des_key_schedule ks2,
363 _ossl_old_des_key_schedule ks3, _ossl_old_des_cblock *ivec, int *num, int enc);
364void _ossl_old_des_ede3_ofb64_encrypt(unsigned char *in, unsigned char *out,
365 long length, _ossl_old_des_key_schedule ks1, _ossl_old_des_key_schedule ks2,
366 _ossl_old_des_key_schedule ks3, _ossl_old_des_cblock *ivec, int *num);
367#if 0
368void _ossl_old_des_xwhite_in2out(_ossl_old_des_cblock (*des_key), _ossl_old_des_cblock (*in_white),
369 _ossl_old_des_cblock (*out_white));
370#endif
371
372int _ossl_old_des_enc_read(int fd,char *buf,int len,_ossl_old_des_key_schedule sched,
373 _ossl_old_des_cblock *iv);
374int _ossl_old_des_enc_write(int fd,char *buf,int len,_ossl_old_des_key_schedule sched,
375 _ossl_old_des_cblock *iv);
376char *_ossl_old_des_fcrypt(const char *buf,const char *salt, char *ret);
377char *_ossl_old_des_crypt(const char *buf,const char *salt);
378#if !defined(PERL5) && !defined(NeXT)
379char *_ossl_old_crypt(const char *buf,const char *salt);
380#endif
381void _ossl_old_des_ofb_encrypt(unsigned char *in,unsigned char *out,
382 int numbits,long length,_ossl_old_des_key_schedule schedule,_ossl_old_des_cblock *ivec);
383void _ossl_old_des_pcbc_encrypt(_ossl_old_des_cblock *input,_ossl_old_des_cblock *output,long length,
384 _ossl_old_des_key_schedule schedule,_ossl_old_des_cblock *ivec,int enc);
385DES_LONG _ossl_old_des_quad_cksum(_ossl_old_des_cblock *input,_ossl_old_des_cblock *output,
386 long length,int out_count,_ossl_old_des_cblock *seed);
387void _ossl_old_des_random_seed(_ossl_old_des_cblock key);
388void _ossl_old_des_random_key(_ossl_old_des_cblock ret);
389int _ossl_old_des_read_password(_ossl_old_des_cblock *key,const char *prompt,int verify);
390int _ossl_old_des_read_2passwords(_ossl_old_des_cblock *key1,_ossl_old_des_cblock *key2,
391 const char *prompt,int verify);
392void _ossl_old_des_set_odd_parity(_ossl_old_des_cblock *key);
393int _ossl_old_des_is_weak_key(_ossl_old_des_cblock *key);
394int _ossl_old_des_set_key(_ossl_old_des_cblock *key,_ossl_old_des_key_schedule schedule);
395int _ossl_old_des_key_sched(_ossl_old_des_cblock *key,_ossl_old_des_key_schedule schedule);
396void _ossl_old_des_string_to_key(char *str,_ossl_old_des_cblock *key);
397void _ossl_old_des_string_to_2keys(char *str,_ossl_old_des_cblock *key1,_ossl_old_des_cblock *key2);
398void _ossl_old_des_cfb64_encrypt(unsigned char *in, unsigned char *out, long length,
399 _ossl_old_des_key_schedule schedule, _ossl_old_des_cblock *ivec, int *num, int enc);
400void _ossl_old_des_ofb64_encrypt(unsigned char *in, unsigned char *out, long length,
401 _ossl_old_des_key_schedule schedule, _ossl_old_des_cblock *ivec, int *num);
402
403void _ossl_096_des_random_seed(des_cblock *key);
404
405/* The following definitions provide compatibility with the MIT Kerberos
406 * library. The _ossl_old_des_key_schedule structure is not binary compatible. */
407
408#define _KERBEROS_DES_H
409
410#define KRBDES_ENCRYPT DES_ENCRYPT
411#define KRBDES_DECRYPT DES_DECRYPT
412
413#ifdef KERBEROS
414# define ENCRYPT DES_ENCRYPT
415# define DECRYPT DES_DECRYPT
416#endif
417
418#ifndef NCOMPAT
419# define C_Block des_cblock
420# define Key_schedule des_key_schedule
421# define KEY_SZ DES_KEY_SZ
422# define string_to_key des_string_to_key
423# define read_pw_string des_read_pw_string
424# define random_key des_random_key
425# define pcbc_encrypt des_pcbc_encrypt
426# define set_key des_set_key
427# define key_sched des_key_sched
428# define ecb_encrypt des_ecb_encrypt
429# define cbc_encrypt des_cbc_encrypt
430# define ncbc_encrypt des_ncbc_encrypt
431# define xcbc_encrypt des_xcbc_encrypt
432# define cbc_cksum des_cbc_cksum
433# define quad_cksum des_quad_cksum
434# define check_parity des_check_key_parity
435#endif
436
437#define des_fixup_key_parity DES_fixup_key_parity
438
439#ifdef __cplusplus
440}
441#endif
442
443/* for DES_read_pw_string et al */
444#include <openssl/ui_compat.h>
445
446#endif
diff --git a/src/lib/libcrypto/des/des_old2.c b/src/lib/libcrypto/des/des_old2.c
new file mode 100644
index 0000000000..c8fa3ee135
--- /dev/null
+++ b/src/lib/libcrypto/des/des_old2.c
@@ -0,0 +1,82 @@
1/* crypto/des/des_old.c -*- mode:C; c-file-style: "eay" -*- */
2
3/* WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
4 *
5 * The function names in here are deprecated and are only present to
6 * provide an interface compatible with OpenSSL 0.9.6c. OpenSSL now
7 * provides functions where "des_" has been replaced with "DES_" in
8 * the names, to make it possible to make incompatible changes that
9 * are needed for C type security and other stuff.
10 *
11 * Please consider starting to use the DES_ functions rather than the
12 * des_ ones. The des_ functions will dissapear completely before
13 * OpenSSL 1.0!
14 *
15 * WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
16 */
17
18/* Written by Richard Levitte (richard@levitte.org) for the OpenSSL
19 * project 2001.
20 */
21/* ====================================================================
22 * Copyright (c) 1998-2001 The OpenSSL Project. All rights reserved.
23 *
24 * Redistribution and use in source and binary forms, with or without
25 * modification, are permitted provided that the following conditions
26 * are met:
27 *
28 * 1. Redistributions of source code must retain the above copyright
29 * notice, this list of conditions and the following disclaimer.
30 *
31 * 2. Redistributions in binary form must reproduce the above copyright
32 * notice, this list of conditions and the following disclaimer in
33 * the documentation and/or other materials provided with the
34 * distribution.
35 *
36 * 3. All advertising materials mentioning features or use of this
37 * software must display the following acknowledgment:
38 * "This product includes software developed by the OpenSSL Project
39 * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
40 *
41 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
42 * endorse or promote products derived from this software without
43 * prior written permission. For written permission, please contact
44 * openssl-core@openssl.org.
45 *
46 * 5. Products derived from this software may not be called "OpenSSL"
47 * nor may "OpenSSL" appear in their names without prior written
48 * permission of the OpenSSL Project.
49 *
50 * 6. Redistributions of any form whatsoever must retain the following
51 * acknowledgment:
52 * "This product includes software developed by the OpenSSL Project
53 * for use in the OpenSSL Toolkit (http://www.openssl.org/)"
54 *
55 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
56 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
57 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
58 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
59 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
60 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
61 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
62 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
63 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
64 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
65 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
66 * OF THE POSSIBILITY OF SUCH DAMAGE.
67 * ====================================================================
68 *
69 * This product includes cryptographic software written by Eric Young
70 * (eay@cryptsoft.com). This product includes software written by Tim
71 * Hudson (tjh@cryptsoft.com).
72 *
73 */
74
75#undef OPENSSL_DES_LIBDES_COMPATIBILITY
76#include <openssl/des.h>
77#include <openssl/rand.h>
78
79void _ossl_096_des_random_seed(DES_cblock *key)
80 {
81 RAND_seed(key, sizeof(DES_cblock));
82 }
diff --git a/src/lib/libcrypto/des/des_opts.c b/src/lib/libcrypto/des/des_opts.c
new file mode 100644
index 0000000000..2df82962c5
--- /dev/null
+++ b/src/lib/libcrypto/des/des_opts.c
@@ -0,0 +1,608 @@
1/* crypto/des/des_opts.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
59/* define PART1, PART2, PART3 or PART4 to build only with a few of the options.
60 * This is for machines with 64k code segment size restrictions. */
61
62#if !defined(OPENSSL_SYS_MSDOS) && (!defined(OPENSSL_SYS_VMS) || defined(__DECC)) && !defined(OPENSSL_SYS_MACOSX)
63#define TIMES
64#endif
65
66#include <stdio.h>
67#ifndef OPENSSL_SYS_MSDOS
68#include <openssl/e_os2.h>
69#include OPENSSL_UNISTD
70#else
71#include <io.h>
72extern void exit();
73#endif
74
75#ifndef OPENSSL_SYS_NETWARE
76#include <signal.h>
77#endif
78
79#ifndef _IRIX
80#include <time.h>
81#endif
82#ifdef TIMES
83#include <sys/types.h>
84#include <sys/times.h>
85#endif
86
87/* Depending on the VMS version, the tms structure is perhaps defined.
88 The __TMS macro will show if it was. If it wasn't defined, we should
89 undefine TIMES, since that tells the rest of the program how things
90 should be handled. -- Richard Levitte */
91#if defined(OPENSSL_SYS_VMS_DECC) && !defined(__TMS)
92#undef TIMES
93#endif
94
95#ifndef TIMES
96#include <sys/timeb.h>
97#endif
98
99
100#if defined(sun) || defined(__ultrix)
101#define _POSIX_SOURCE
102#include <limits.h>
103#include <sys/param.h>
104#endif
105
106#include <openssl/des.h>
107#include "spr.h"
108
109#define DES_DEFAULT_OPTIONS
110
111#if !defined(PART1) && !defined(PART2) && !defined(PART3) && !defined(PART4)
112#define PART1
113#define PART2
114#define PART3
115#define PART4
116#endif
117
118#ifdef PART1
119
120#undef DES_UNROLL
121#undef DES_RISC1
122#undef DES_RISC2
123#undef DES_PTR
124#undef D_ENCRYPT
125#define DES_encrypt1 des_encrypt_u4_cisc_idx
126#define DES_encrypt2 des_encrypt2_u4_cisc_idx
127#define DES_encrypt3 des_encrypt3_u4_cisc_idx
128#define DES_decrypt3 des_decrypt3_u4_cisc_idx
129#undef HEADER_DES_LOCL_H
130#include "des_enc.c"
131
132#define DES_UNROLL
133#undef DES_RISC1
134#undef DES_RISC2
135#undef DES_PTR
136#undef D_ENCRYPT
137#undef DES_encrypt1
138#undef DES_encrypt2
139#undef DES_encrypt3
140#undef DES_decrypt3
141#define DES_encrypt1 des_encrypt_u16_cisc_idx
142#define DES_encrypt2 des_encrypt2_u16_cisc_idx
143#define DES_encrypt3 des_encrypt3_u16_cisc_idx
144#define DES_decrypt3 des_decrypt3_u16_cisc_idx
145#undef HEADER_DES_LOCL_H
146#include "des_enc.c"
147
148#undef DES_UNROLL
149#define DES_RISC1
150#undef DES_RISC2
151#undef DES_PTR
152#undef D_ENCRYPT
153#undef DES_encrypt1
154#undef DES_encrypt2
155#undef DES_encrypt3
156#undef DES_decrypt3
157#define DES_encrypt1 des_encrypt_u4_risc1_idx
158#define DES_encrypt2 des_encrypt2_u4_risc1_idx
159#define DES_encrypt3 des_encrypt3_u4_risc1_idx
160#define DES_decrypt3 des_decrypt3_u4_risc1_idx
161#undef HEADER_DES_LOCL_H
162#include "des_enc.c"
163
164#endif
165
166#ifdef PART2
167
168#undef DES_UNROLL
169#undef DES_RISC1
170#define DES_RISC2
171#undef DES_PTR
172#undef D_ENCRYPT
173#undef DES_encrypt1
174#undef DES_encrypt2
175#undef DES_encrypt3
176#undef DES_decrypt3
177#define DES_encrypt1 des_encrypt_u4_risc2_idx
178#define DES_encrypt2 des_encrypt2_u4_risc2_idx
179#define DES_encrypt3 des_encrypt3_u4_risc2_idx
180#define DES_decrypt3 des_decrypt3_u4_risc2_idx
181#undef HEADER_DES_LOCL_H
182#include "des_enc.c"
183
184#define DES_UNROLL
185#define DES_RISC1
186#undef DES_RISC2
187#undef DES_PTR
188#undef D_ENCRYPT
189#undef DES_encrypt1
190#undef DES_encrypt2
191#undef DES_encrypt3
192#undef DES_decrypt3
193#define DES_encrypt1 des_encrypt_u16_risc1_idx
194#define DES_encrypt2 des_encrypt2_u16_risc1_idx
195#define DES_encrypt3 des_encrypt3_u16_risc1_idx
196#define DES_decrypt3 des_decrypt3_u16_risc1_idx
197#undef HEADER_DES_LOCL_H
198#include "des_enc.c"
199
200#define DES_UNROLL
201#undef DES_RISC1
202#define DES_RISC2
203#undef DES_PTR
204#undef D_ENCRYPT
205#undef DES_encrypt1
206#undef DES_encrypt2
207#undef DES_encrypt3
208#undef DES_decrypt3
209#define DES_encrypt1 des_encrypt_u16_risc2_idx
210#define DES_encrypt2 des_encrypt2_u16_risc2_idx
211#define DES_encrypt3 des_encrypt3_u16_risc2_idx
212#define DES_decrypt3 des_decrypt3_u16_risc2_idx
213#undef HEADER_DES_LOCL_H
214#include "des_enc.c"
215
216#endif
217
218#ifdef PART3
219
220#undef DES_UNROLL
221#undef DES_RISC1
222#undef DES_RISC2
223#define DES_PTR
224#undef D_ENCRYPT
225#undef DES_encrypt1
226#undef DES_encrypt2
227#undef DES_encrypt3
228#undef DES_decrypt3
229#define DES_encrypt1 des_encrypt_u4_cisc_ptr
230#define DES_encrypt2 des_encrypt2_u4_cisc_ptr
231#define DES_encrypt3 des_encrypt3_u4_cisc_ptr
232#define DES_decrypt3 des_decrypt3_u4_cisc_ptr
233#undef HEADER_DES_LOCL_H
234#include "des_enc.c"
235
236#define DES_UNROLL
237#undef DES_RISC1
238#undef DES_RISC2
239#define DES_PTR
240#undef D_ENCRYPT
241#undef DES_encrypt1
242#undef DES_encrypt2
243#undef DES_encrypt3
244#undef DES_decrypt3
245#define DES_encrypt1 des_encrypt_u16_cisc_ptr
246#define DES_encrypt2 des_encrypt2_u16_cisc_ptr
247#define DES_encrypt3 des_encrypt3_u16_cisc_ptr
248#define DES_decrypt3 des_decrypt3_u16_cisc_ptr
249#undef HEADER_DES_LOCL_H
250#include "des_enc.c"
251
252#undef DES_UNROLL
253#define DES_RISC1
254#undef DES_RISC2
255#define DES_PTR
256#undef D_ENCRYPT
257#undef DES_encrypt1
258#undef DES_encrypt2
259#undef DES_encrypt3
260#undef DES_decrypt3
261#define DES_encrypt1 des_encrypt_u4_risc1_ptr
262#define DES_encrypt2 des_encrypt2_u4_risc1_ptr
263#define DES_encrypt3 des_encrypt3_u4_risc1_ptr
264#define DES_decrypt3 des_decrypt3_u4_risc1_ptr
265#undef HEADER_DES_LOCL_H
266#include "des_enc.c"
267
268#endif
269
270#ifdef PART4
271
272#undef DES_UNROLL
273#undef DES_RISC1
274#define DES_RISC2
275#define DES_PTR
276#undef D_ENCRYPT
277#undef DES_encrypt1
278#undef DES_encrypt2
279#undef DES_encrypt3
280#undef DES_decrypt3
281#define DES_encrypt1 des_encrypt_u4_risc2_ptr
282#define DES_encrypt2 des_encrypt2_u4_risc2_ptr
283#define DES_encrypt3 des_encrypt3_u4_risc2_ptr
284#define DES_decrypt3 des_decrypt3_u4_risc2_ptr
285#undef HEADER_DES_LOCL_H
286#include "des_enc.c"
287
288#define DES_UNROLL
289#define DES_RISC1
290#undef DES_RISC2
291#define DES_PTR
292#undef D_ENCRYPT
293#undef DES_encrypt1
294#undef DES_encrypt2
295#undef DES_encrypt3
296#undef DES_decrypt3
297#define DES_encrypt1 des_encrypt_u16_risc1_ptr
298#define DES_encrypt2 des_encrypt2_u16_risc1_ptr
299#define DES_encrypt3 des_encrypt3_u16_risc1_ptr
300#define DES_decrypt3 des_decrypt3_u16_risc1_ptr
301#undef HEADER_DES_LOCL_H
302#include "des_enc.c"
303
304#define DES_UNROLL
305#undef DES_RISC1
306#define DES_RISC2
307#define DES_PTR
308#undef D_ENCRYPT
309#undef DES_encrypt1
310#undef DES_encrypt2
311#undef DES_encrypt3
312#undef DES_decrypt3
313#define DES_encrypt1 des_encrypt_u16_risc2_ptr
314#define DES_encrypt2 des_encrypt2_u16_risc2_ptr
315#define DES_encrypt3 des_encrypt3_u16_risc2_ptr
316#define DES_decrypt3 des_decrypt3_u16_risc2_ptr
317#undef HEADER_DES_LOCL_H
318#include "des_enc.c"
319
320#endif
321
322/* The following if from times(3) man page. It may need to be changed */
323#ifndef HZ
324# ifndef CLK_TCK
325# ifndef _BSD_CLK_TCK_ /* FreeBSD fix */
326# define HZ 100.0
327# else /* _BSD_CLK_TCK_ */
328# define HZ ((double)_BSD_CLK_TCK_)
329# endif
330# else /* CLK_TCK */
331# define HZ ((double)CLK_TCK)
332# endif
333#endif
334
335#define BUFSIZE ((long)1024)
336long run=0;
337
338double Time_F(int s);
339#ifdef SIGALRM
340#if defined(__STDC__) || defined(sgi)
341#define SIGRETTYPE void
342#else
343#define SIGRETTYPE int
344#endif
345
346SIGRETTYPE sig_done(int sig);
347SIGRETTYPE sig_done(int sig)
348 {
349 signal(SIGALRM,sig_done);
350 run=0;
351#ifdef LINT
352 sig=sig;
353#endif
354 }
355#endif
356
357#define START 0
358#define STOP 1
359
360double Time_F(int s)
361 {
362 double ret;
363#ifdef TIMES
364 static struct tms tstart,tend;
365
366 if (s == START)
367 {
368 times(&tstart);
369 return(0);
370 }
371 else
372 {
373 times(&tend);
374 ret=((double)(tend.tms_utime-tstart.tms_utime))/HZ;
375 return((ret == 0.0)?1e-6:ret);
376 }
377#else /* !times() */
378 static struct timeb tstart,tend;
379 long i;
380
381 if (s == START)
382 {
383 ftime(&tstart);
384 return(0);
385 }
386 else
387 {
388 ftime(&tend);
389 i=(long)tend.millitm-(long)tstart.millitm;
390 ret=((double)(tend.time-tstart.time))+((double)i)/1000.0;
391 return((ret == 0.0)?1e-6:ret);
392 }
393#endif
394 }
395
396#ifdef SIGALRM
397#define print_name(name) fprintf(stderr,"Doing %s's for 10 seconds\n",name); alarm(10);
398#else
399#define print_name(name) fprintf(stderr,"Doing %s %ld times\n",name,cb);
400#endif
401
402#define time_it(func,name,index) \
403 print_name(name); \
404 Time_F(START); \
405 for (count=0,run=1; COND(cb); count++) \
406 { \
407 unsigned long d[2]; \
408 func(d,&sch,DES_ENCRYPT); \
409 } \
410 tm[index]=Time_F(STOP); \
411 fprintf(stderr,"%ld %s's in %.2f second\n",count,name,tm[index]); \
412 tm[index]=((double)COUNT(cb))/tm[index];
413
414#define print_it(name,index) \
415 fprintf(stderr,"%s bytes per sec = %12.2f (%5.1fuS)\n",name, \
416 tm[index]*8,1.0e6/tm[index]);
417
418int main(int argc, char **argv)
419 {
420 long count;
421 static unsigned char buf[BUFSIZE];
422 static DES_cblock key ={0x12,0x34,0x56,0x78,0x9a,0xbc,0xde,0xf0};
423 static DES_cblock key2={0x34,0x56,0x78,0x9a,0xbc,0xde,0xf0,0x12};
424 static DES_cblock key3={0x56,0x78,0x9a,0xbc,0xde,0xf0,0x12,0x34};
425 DES_key_schedule sch,sch2,sch3;
426 double d,tm[16],max=0;
427 int rank[16];
428 char *str[16];
429 int max_idx=0,i,num=0,j;
430#ifndef SIGALARM
431 long ca,cb,cc,cd,ce;
432#endif
433
434 for (i=0; i<12; i++)
435 {
436 tm[i]=0.0;
437 rank[i]=0;
438 }
439
440#ifndef TIMES
441 fprintf(stderr,"To get the most accurate results, try to run this\n");
442 fprintf(stderr,"program when this computer is idle.\n");
443#endif
444
445 DES_set_key_unchecked(&key,&sch);
446 DES_set_key_unchecked(&key2,&sch2);
447 DES_set_key_unchecked(&key3,&sch3);
448
449#ifndef SIGALRM
450 fprintf(stderr,"First we calculate the approximate speed ...\n");
451 DES_set_key_unchecked(&key,sch);
452 count=10;
453 do {
454 long i;
455 unsigned long data[2];
456
457 count*=2;
458 Time_F(START);
459 for (i=count; i; i--)
460 DES_encrypt1(data,&(sch[0]),DES_ENCRYPT);
461 d=Time_F(STOP);
462 } while (d < 3.0);
463 ca=count;
464 cb=count*3;
465 cc=count*3*8/BUFSIZE+1;
466 cd=count*8/BUFSIZE+1;
467
468 ce=count/20+1;
469#define COND(d) (count != (d))
470#define COUNT(d) (d)
471#else
472#define COND(c) (run)
473#define COUNT(d) (count)
474 signal(SIGALRM,sig_done);
475 alarm(10);
476#endif
477
478#ifdef PART1
479 time_it(des_encrypt_u4_cisc_idx, "des_encrypt_u4_cisc_idx ", 0);
480 time_it(des_encrypt_u16_cisc_idx, "des_encrypt_u16_cisc_idx ", 1);
481 time_it(des_encrypt_u4_risc1_idx, "des_encrypt_u4_risc1_idx ", 2);
482 num+=3;
483#endif
484#ifdef PART2
485 time_it(des_encrypt_u16_risc1_idx,"des_encrypt_u16_risc1_idx", 3);
486 time_it(des_encrypt_u4_risc2_idx, "des_encrypt_u4_risc2_idx ", 4);
487 time_it(des_encrypt_u16_risc2_idx,"des_encrypt_u16_risc2_idx", 5);
488 num+=3;
489#endif
490#ifdef PART3
491 time_it(des_encrypt_u4_cisc_ptr, "des_encrypt_u4_cisc_ptr ", 6);
492 time_it(des_encrypt_u16_cisc_ptr, "des_encrypt_u16_cisc_ptr ", 7);
493 time_it(des_encrypt_u4_risc1_ptr, "des_encrypt_u4_risc1_ptr ", 8);
494 num+=3;
495#endif
496#ifdef PART4
497 time_it(des_encrypt_u16_risc1_ptr,"des_encrypt_u16_risc1_ptr", 9);
498 time_it(des_encrypt_u4_risc2_ptr, "des_encrypt_u4_risc2_ptr ",10);
499 time_it(des_encrypt_u16_risc2_ptr,"des_encrypt_u16_risc2_ptr",11);
500 num+=3;
501#endif
502
503#ifdef PART1
504 str[0]=" 4 c i";
505 print_it("des_encrypt_u4_cisc_idx ",0);
506 max=tm[0];
507 max_idx=0;
508 str[1]="16 c i";
509 print_it("des_encrypt_u16_cisc_idx ",1);
510 if (max < tm[1]) { max=tm[1]; max_idx=1; }
511 str[2]=" 4 r1 i";
512 print_it("des_encrypt_u4_risc1_idx ",2);
513 if (max < tm[2]) { max=tm[2]; max_idx=2; }
514#endif
515#ifdef PART2
516 str[3]="16 r1 i";
517 print_it("des_encrypt_u16_risc1_idx",3);
518 if (max < tm[3]) { max=tm[3]; max_idx=3; }
519 str[4]=" 4 r2 i";
520 print_it("des_encrypt_u4_risc2_idx ",4);
521 if (max < tm[4]) { max=tm[4]; max_idx=4; }
522 str[5]="16 r2 i";
523 print_it("des_encrypt_u16_risc2_idx",5);
524 if (max < tm[5]) { max=tm[5]; max_idx=5; }
525#endif
526#ifdef PART3
527 str[6]=" 4 c p";
528 print_it("des_encrypt_u4_cisc_ptr ",6);
529 if (max < tm[6]) { max=tm[6]; max_idx=6; }
530 str[7]="16 c p";
531 print_it("des_encrypt_u16_cisc_ptr ",7);
532 if (max < tm[7]) { max=tm[7]; max_idx=7; }
533 str[8]=" 4 r1 p";
534 print_it("des_encrypt_u4_risc1_ptr ",8);
535 if (max < tm[8]) { max=tm[8]; max_idx=8; }
536#endif
537#ifdef PART4
538 str[9]="16 r1 p";
539 print_it("des_encrypt_u16_risc1_ptr",9);
540 if (max < tm[9]) { max=tm[9]; max_idx=9; }
541 str[10]=" 4 r2 p";
542 print_it("des_encrypt_u4_risc2_ptr ",10);
543 if (max < tm[10]) { max=tm[10]; max_idx=10; }
544 str[11]="16 r2 p";
545 print_it("des_encrypt_u16_risc2_ptr",11);
546 if (max < tm[11]) { max=tm[11]; max_idx=11; }
547#endif
548 printf("options des ecb/s\n");
549 printf("%s %12.2f 100.0%%\n",str[max_idx],tm[max_idx]);
550 d=tm[max_idx];
551 tm[max_idx]= -2.0;
552 max= -1.0;
553 for (;;)
554 {
555 for (i=0; i<12; i++)
556 {
557 if (max < tm[i]) { max=tm[i]; j=i; }
558 }
559 if (max < 0.0) break;
560 printf("%s %12.2f %4.1f%%\n",str[j],tm[j],tm[j]/d*100.0);
561 tm[j]= -2.0;
562 max= -1.0;
563 }
564
565 switch (max_idx)
566 {
567 case 0:
568 printf("-DDES_DEFAULT_OPTIONS\n");
569 break;
570 case 1:
571 printf("-DDES_UNROLL\n");
572 break;
573 case 2:
574 printf("-DDES_RISC1\n");
575 break;
576 case 3:
577 printf("-DDES_UNROLL -DDES_RISC1\n");
578 break;
579 case 4:
580 printf("-DDES_RISC2\n");
581 break;
582 case 5:
583 printf("-DDES_UNROLL -DDES_RISC2\n");
584 break;
585 case 6:
586 printf("-DDES_PTR\n");
587 break;
588 case 7:
589 printf("-DDES_UNROLL -DDES_PTR\n");
590 break;
591 case 8:
592 printf("-DDES_RISC1 -DDES_PTR\n");
593 break;
594 case 9:
595 printf("-DDES_UNROLL -DDES_RISC1 -DDES_PTR\n");
596 break;
597 case 10:
598 printf("-DDES_RISC2 -DDES_PTR\n");
599 break;
600 case 11:
601 printf("-DDES_UNROLL -DDES_RISC2 -DDES_PTR\n");
602 break;
603 }
604 exit(0);
605#if defined(LINT) || defined(OPENSSL_SYS_MSDOS)
606 return(0);
607#endif
608 }
diff --git a/src/lib/libcrypto/des/des_ver.h b/src/lib/libcrypto/des/des_ver.h
new file mode 100644
index 0000000000..d1ada258a6
--- /dev/null
+++ b/src/lib/libcrypto/des/des_ver.h
@@ -0,0 +1,71 @@
1/* crypto/des/des_ver.h */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
59#include <openssl/e_os2.h>
60
61#ifdef OPENSSL_BUILD_SHLIBCRYPTO
62# undef OPENSSL_EXTERN
63# define OPENSSL_EXTERN OPENSSL_EXPORT
64#endif
65
66/* The following macros make sure the names are different from libdes names */
67#define DES_version OSSL_DES_version
68#define libdes_version OSSL_libdes_version
69
70OPENSSL_EXTERN const char OSSL_DES_version[]; /* SSLeay version string */
71OPENSSL_EXTERN const char OSSL_libdes_version[]; /* old libdes version string */
diff --git a/src/lib/libcrypto/des/dess.cpp b/src/lib/libcrypto/des/dess.cpp
new file mode 100644
index 0000000000..5549bab90a
--- /dev/null
+++ b/src/lib/libcrypto/des/dess.cpp
@@ -0,0 +1,67 @@
1//
2// gettsc.inl
3//
4// gives access to the Pentium's (secret) cycle counter
5//
6// This software was written by Leonard Janke (janke@unixg.ubc.ca)
7// in 1996-7 and is entered, by him, into the public domain.
8
9#if defined(__WATCOMC__)
10void GetTSC(unsigned long&);
11#pragma aux GetTSC = 0x0f 0x31 "mov [edi], eax" parm [edi] modify [edx eax];
12#elif defined(__GNUC__)
13inline
14void GetTSC(unsigned long& tsc)
15{
16 asm volatile(".byte 15, 49\n\t"
17 : "=eax" (tsc)
18 :
19 : "%edx", "%eax");
20}
21#elif defined(_MSC_VER)
22inline
23void GetTSC(unsigned long& tsc)
24{
25 unsigned long a;
26 __asm _emit 0fh
27 __asm _emit 31h
28 __asm mov a, eax;
29 tsc=a;
30}
31#endif
32
33#include <stdio.h>
34#include <stdlib.h>
35#include <openssl/des.h>
36
37void main(int argc,char *argv[])
38 {
39 des_key_schedule key;
40 unsigned long s1,s2,e1,e2;
41 unsigned long data[2];
42 int i,j;
43
44 for (j=0; j<6; j++)
45 {
46 for (i=0; i<1000; i++) /**/
47 {
48 des_encrypt1(&data[0],key,1);
49 GetTSC(s1);
50 des_encrypt1(&data[0],key,1);
51 des_encrypt1(&data[0],key,1);
52 des_encrypt1(&data[0],key,1);
53 GetTSC(e1);
54 GetTSC(s2);
55 des_encrypt1(&data[0],key,1);
56 des_encrypt1(&data[0],key,1);
57 des_encrypt1(&data[0],key,1);
58 des_encrypt1(&data[0],key,1);
59 GetTSC(e2);
60 des_encrypt1(&data[0],key,1);
61 }
62
63 printf("des %d %d (%d)\n",
64 e1-s1,e2-s2,((e2-s2)-(e1-s1)));
65 }
66 }
67
diff --git a/src/lib/libcrypto/des/destest.c b/src/lib/libcrypto/des/destest.c
new file mode 100644
index 0000000000..64b92a34fe
--- /dev/null
+++ b/src/lib/libcrypto/des/destest.c
@@ -0,0 +1,952 @@
1/* crypto/des/destest.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
59#include <stdio.h>
60#include <stdlib.h>
61
62#include <openssl/e_os2.h>
63#if defined(OPENSSL_SYS_WIN32) || defined(OPENSSL_SYS_WIN16) || defined(OPENSSL_SYS_WINDOWS)
64#ifndef OPENSSL_SYS_MSDOS
65#define OPENSSL_SYS_MSDOS
66#endif
67#endif
68
69#ifndef OPENSSL_SYS_MSDOS
70#if !defined(OPENSSL_SYS_VMS) || defined(OPENSSL_SYS_VMS_DECC)
71#include OPENSSL_UNISTD
72#endif
73#else
74#include <io.h>
75#endif
76#include <string.h>
77
78#ifdef OPENSSL_NO_DES
79int main(int argc, char *argv[])
80{
81 printf("No DES support\n");
82 return(0);
83}
84#else
85#include <openssl/des.h>
86
87#define crypt(c,s) (DES_crypt((c),(s)))
88
89/* tisk tisk - the test keys don't all have odd parity :-( */
90/* test data */
91#define NUM_TESTS 34
92static unsigned char key_data[NUM_TESTS][8]={
93 {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
94 {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF},
95 {0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
96 {0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11},
97 {0x01,0x23,0x45,0x67,0x89,0xAB,0xCD,0xEF},
98 {0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11},
99 {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
100 {0xFE,0xDC,0xBA,0x98,0x76,0x54,0x32,0x10},
101 {0x7C,0xA1,0x10,0x45,0x4A,0x1A,0x6E,0x57},
102 {0x01,0x31,0xD9,0x61,0x9D,0xC1,0x37,0x6E},
103 {0x07,0xA1,0x13,0x3E,0x4A,0x0B,0x26,0x86},
104 {0x38,0x49,0x67,0x4C,0x26,0x02,0x31,0x9E},
105 {0x04,0xB9,0x15,0xBA,0x43,0xFE,0xB5,0xB6},
106 {0x01,0x13,0xB9,0x70,0xFD,0x34,0xF2,0xCE},
107 {0x01,0x70,0xF1,0x75,0x46,0x8F,0xB5,0xE6},
108 {0x43,0x29,0x7F,0xAD,0x38,0xE3,0x73,0xFE},
109 {0x07,0xA7,0x13,0x70,0x45,0xDA,0x2A,0x16},
110 {0x04,0x68,0x91,0x04,0xC2,0xFD,0x3B,0x2F},
111 {0x37,0xD0,0x6B,0xB5,0x16,0xCB,0x75,0x46},
112 {0x1F,0x08,0x26,0x0D,0x1A,0xC2,0x46,0x5E},
113 {0x58,0x40,0x23,0x64,0x1A,0xBA,0x61,0x76},
114 {0x02,0x58,0x16,0x16,0x46,0x29,0xB0,0x07},
115 {0x49,0x79,0x3E,0xBC,0x79,0xB3,0x25,0x8F},
116 {0x4F,0xB0,0x5E,0x15,0x15,0xAB,0x73,0xA7},
117 {0x49,0xE9,0x5D,0x6D,0x4C,0xA2,0x29,0xBF},
118 {0x01,0x83,0x10,0xDC,0x40,0x9B,0x26,0xD6},
119 {0x1C,0x58,0x7F,0x1C,0x13,0x92,0x4F,0xEF},
120 {0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01},
121 {0x1F,0x1F,0x1F,0x1F,0x0E,0x0E,0x0E,0x0E},
122 {0xE0,0xFE,0xE0,0xFE,0xF1,0xFE,0xF1,0xFE},
123 {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
124 {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF},
125 {0x01,0x23,0x45,0x67,0x89,0xAB,0xCD,0xEF},
126 {0xFE,0xDC,0xBA,0x98,0x76,0x54,0x32,0x10}};
127
128static unsigned char plain_data[NUM_TESTS][8]={
129 {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
130 {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF},
131 {0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x01},
132 {0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11},
133 {0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11},
134 {0x01,0x23,0x45,0x67,0x89,0xAB,0xCD,0xEF},
135 {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
136 {0x01,0x23,0x45,0x67,0x89,0xAB,0xCD,0xEF},
137 {0x01,0xA1,0xD6,0xD0,0x39,0x77,0x67,0x42},
138 {0x5C,0xD5,0x4C,0xA8,0x3D,0xEF,0x57,0xDA},
139 {0x02,0x48,0xD4,0x38,0x06,0xF6,0x71,0x72},
140 {0x51,0x45,0x4B,0x58,0x2D,0xDF,0x44,0x0A},
141 {0x42,0xFD,0x44,0x30,0x59,0x57,0x7F,0xA2},
142 {0x05,0x9B,0x5E,0x08,0x51,0xCF,0x14,0x3A},
143 {0x07,0x56,0xD8,0xE0,0x77,0x47,0x61,0xD2},
144 {0x76,0x25,0x14,0xB8,0x29,0xBF,0x48,0x6A},
145 {0x3B,0xDD,0x11,0x90,0x49,0x37,0x28,0x02},
146 {0x26,0x95,0x5F,0x68,0x35,0xAF,0x60,0x9A},
147 {0x16,0x4D,0x5E,0x40,0x4F,0x27,0x52,0x32},
148 {0x6B,0x05,0x6E,0x18,0x75,0x9F,0x5C,0xCA},
149 {0x00,0x4B,0xD6,0xEF,0x09,0x17,0x60,0x62},
150 {0x48,0x0D,0x39,0x00,0x6E,0xE7,0x62,0xF2},
151 {0x43,0x75,0x40,0xC8,0x69,0x8F,0x3C,0xFA},
152 {0x07,0x2D,0x43,0xA0,0x77,0x07,0x52,0x92},
153 {0x02,0xFE,0x55,0x77,0x81,0x17,0xF1,0x2A},
154 {0x1D,0x9D,0x5C,0x50,0x18,0xF7,0x28,0xC2},
155 {0x30,0x55,0x32,0x28,0x6D,0x6F,0x29,0x5A},
156 {0x01,0x23,0x45,0x67,0x89,0xAB,0xCD,0xEF},
157 {0x01,0x23,0x45,0x67,0x89,0xAB,0xCD,0xEF},
158 {0x01,0x23,0x45,0x67,0x89,0xAB,0xCD,0xEF},
159 {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF},
160 {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
161 {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
162 {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}};
163
164static unsigned char cipher_data[NUM_TESTS][8]={
165 {0x8C,0xA6,0x4D,0xE9,0xC1,0xB1,0x23,0xA7},
166 {0x73,0x59,0xB2,0x16,0x3E,0x4E,0xDC,0x58},
167 {0x95,0x8E,0x6E,0x62,0x7A,0x05,0x55,0x7B},
168 {0xF4,0x03,0x79,0xAB,0x9E,0x0E,0xC5,0x33},
169 {0x17,0x66,0x8D,0xFC,0x72,0x92,0x53,0x2D},
170 {0x8A,0x5A,0xE1,0xF8,0x1A,0xB8,0xF2,0xDD},
171 {0x8C,0xA6,0x4D,0xE9,0xC1,0xB1,0x23,0xA7},
172 {0xED,0x39,0xD9,0x50,0xFA,0x74,0xBC,0xC4},
173 {0x69,0x0F,0x5B,0x0D,0x9A,0x26,0x93,0x9B},
174 {0x7A,0x38,0x9D,0x10,0x35,0x4B,0xD2,0x71},
175 {0x86,0x8E,0xBB,0x51,0xCA,0xB4,0x59,0x9A},
176 {0x71,0x78,0x87,0x6E,0x01,0xF1,0x9B,0x2A},
177 {0xAF,0x37,0xFB,0x42,0x1F,0x8C,0x40,0x95},
178 {0x86,0xA5,0x60,0xF1,0x0E,0xC6,0xD8,0x5B},
179 {0x0C,0xD3,0xDA,0x02,0x00,0x21,0xDC,0x09},
180 {0xEA,0x67,0x6B,0x2C,0xB7,0xDB,0x2B,0x7A},
181 {0xDF,0xD6,0x4A,0x81,0x5C,0xAF,0x1A,0x0F},
182 {0x5C,0x51,0x3C,0x9C,0x48,0x86,0xC0,0x88},
183 {0x0A,0x2A,0xEE,0xAE,0x3F,0xF4,0xAB,0x77},
184 {0xEF,0x1B,0xF0,0x3E,0x5D,0xFA,0x57,0x5A},
185 {0x88,0xBF,0x0D,0xB6,0xD7,0x0D,0xEE,0x56},
186 {0xA1,0xF9,0x91,0x55,0x41,0x02,0x0B,0x56},
187 {0x6F,0xBF,0x1C,0xAF,0xCF,0xFD,0x05,0x56},
188 {0x2F,0x22,0xE4,0x9B,0xAB,0x7C,0xA1,0xAC},
189 {0x5A,0x6B,0x61,0x2C,0xC2,0x6C,0xCE,0x4A},
190 {0x5F,0x4C,0x03,0x8E,0xD1,0x2B,0x2E,0x41},
191 {0x63,0xFA,0xC0,0xD0,0x34,0xD9,0xF7,0x93},
192 {0x61,0x7B,0x3A,0x0C,0xE8,0xF0,0x71,0x00},
193 {0xDB,0x95,0x86,0x05,0xF8,0xC8,0xC6,0x06},
194 {0xED,0xBF,0xD1,0xC6,0x6C,0x29,0xCC,0xC7},
195 {0x35,0x55,0x50,0xB2,0x15,0x0E,0x24,0x51},
196 {0xCA,0xAA,0xAF,0x4D,0xEA,0xF1,0xDB,0xAE},
197 {0xD5,0xD4,0x4F,0xF7,0x20,0x68,0x3D,0x0D},
198 {0x2A,0x2B,0xB0,0x08,0xDF,0x97,0xC2,0xF2}};
199
200static unsigned char cipher_ecb2[NUM_TESTS-1][8]={
201 {0x92,0x95,0xB5,0x9B,0xB3,0x84,0x73,0x6E},
202 {0x19,0x9E,0x9D,0x6D,0xF3,0x9A,0xA8,0x16},
203 {0x2A,0x4B,0x4D,0x24,0x52,0x43,0x84,0x27},
204 {0x35,0x84,0x3C,0x01,0x9D,0x18,0xC5,0xB6},
205 {0x4A,0x5B,0x2F,0x42,0xAA,0x77,0x19,0x25},
206 {0xA0,0x6B,0xA9,0xB8,0xCA,0x5B,0x17,0x8A},
207 {0xAB,0x9D,0xB7,0xFB,0xED,0x95,0xF2,0x74},
208 {0x3D,0x25,0x6C,0x23,0xA7,0x25,0x2F,0xD6},
209 {0xB7,0x6F,0xAB,0x4F,0xBD,0xBD,0xB7,0x67},
210 {0x8F,0x68,0x27,0xD6,0x9C,0xF4,0x1A,0x10},
211 {0x82,0x57,0xA1,0xD6,0x50,0x5E,0x81,0x85},
212 {0xA2,0x0F,0x0A,0xCD,0x80,0x89,0x7D,0xFA},
213 {0xCD,0x2A,0x53,0x3A,0xDB,0x0D,0x7E,0xF3},
214 {0xD2,0xC2,0xBE,0x27,0xE8,0x1B,0x68,0xE3},
215 {0xE9,0x24,0xCF,0x4F,0x89,0x3C,0x5B,0x0A},
216 {0xA7,0x18,0xC3,0x9F,0xFA,0x9F,0xD7,0x69},
217 {0x77,0x2C,0x79,0xB1,0xD2,0x31,0x7E,0xB1},
218 {0x49,0xAB,0x92,0x7F,0xD0,0x22,0x00,0xB7},
219 {0xCE,0x1C,0x6C,0x7D,0x85,0xE3,0x4A,0x6F},
220 {0xBE,0x91,0xD6,0xE1,0x27,0xB2,0xE9,0x87},
221 {0x70,0x28,0xAE,0x8F,0xD1,0xF5,0x74,0x1A},
222 {0xAA,0x37,0x80,0xBB,0xF3,0x22,0x1D,0xDE},
223 {0xA6,0xC4,0xD2,0x5E,0x28,0x93,0xAC,0xB3},
224 {0x22,0x07,0x81,0x5A,0xE4,0xB7,0x1A,0xAD},
225 {0xDC,0xCE,0x05,0xE7,0x07,0xBD,0xF5,0x84},
226 {0x26,0x1D,0x39,0x2C,0xB3,0xBA,0xA5,0x85},
227 {0xB4,0xF7,0x0F,0x72,0xFB,0x04,0xF0,0xDC},
228 {0x95,0xBA,0xA9,0x4E,0x87,0x36,0xF2,0x89},
229 {0xD4,0x07,0x3A,0xF1,0x5A,0x17,0x82,0x0E},
230 {0xEF,0x6F,0xAF,0xA7,0x66,0x1A,0x7E,0x89},
231 {0xC1,0x97,0xF5,0x58,0x74,0x8A,0x20,0xE7},
232 {0x43,0x34,0xCF,0xDA,0x22,0xC4,0x86,0xC8},
233 {0x08,0xD7,0xB4,0xFB,0x62,0x9D,0x08,0x85}};
234
235static unsigned char cbc_key [8]={0x01,0x23,0x45,0x67,0x89,0xab,0xcd,0xef};
236static unsigned char cbc2_key[8]={0xf1,0xe0,0xd3,0xc2,0xb5,0xa4,0x97,0x86};
237static unsigned char cbc3_key[8]={0xfe,0xdc,0xba,0x98,0x76,0x54,0x32,0x10};
238static unsigned char cbc_iv [8]={0xfe,0xdc,0xba,0x98,0x76,0x54,0x32,0x10};
239/* Changed the following text constant to binary so it will work on ebcdic
240 * machines :-) */
241/* static char cbc_data[40]="7654321 Now is the time for \0001"; */
242static unsigned char cbc_data[40]={
243 0x37,0x36,0x35,0x34,0x33,0x32,0x31,0x20,
244 0x4E,0x6F,0x77,0x20,0x69,0x73,0x20,0x74,
245 0x68,0x65,0x20,0x74,0x69,0x6D,0x65,0x20,
246 0x66,0x6F,0x72,0x20,0x00,0x31,0x00,0x00,
247 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
248 };
249
250static unsigned char cbc_ok[32]={
251 0xcc,0xd1,0x73,0xff,0xab,0x20,0x39,0xf4,
252 0xac,0xd8,0xae,0xfd,0xdf,0xd8,0xa1,0xeb,
253 0x46,0x8e,0x91,0x15,0x78,0x88,0xba,0x68,
254 0x1d,0x26,0x93,0x97,0xf7,0xfe,0x62,0xb4};
255
256#ifdef SCREW_THE_PARITY
257#error "SCREW_THE_PARITY is not ment to be defined."
258#error "Original vectors are preserved for reference only."
259static unsigned char cbc2_key[8]={0xf0,0xe1,0xd2,0xc3,0xb4,0xa5,0x96,0x87};
260static unsigned char xcbc_ok[32]={
261 0x86,0x74,0x81,0x0D,0x61,0xA4,0xA5,0x48,
262 0xB9,0x93,0x03,0xE1,0xB8,0xBB,0xBD,0xBD,
263 0x64,0x30,0x0B,0xB9,0x06,0x65,0x81,0x76,
264 0x04,0x1D,0x77,0x62,0x17,0xCA,0x2B,0xD2,
265 };
266#else
267static unsigned char xcbc_ok[32]={
268 0x84,0x6B,0x29,0x14,0x85,0x1E,0x9A,0x29,
269 0x54,0x73,0x2F,0x8A,0xA0,0xA6,0x11,0xC1,
270 0x15,0xCD,0xC2,0xD7,0x95,0x1B,0x10,0x53,
271 0xA6,0x3C,0x5E,0x03,0xB2,0x1A,0xA3,0xC4,
272 };
273#endif
274
275static unsigned char cbc3_ok[32]={
276 0x3F,0xE3,0x01,0xC9,0x62,0xAC,0x01,0xD0,
277 0x22,0x13,0x76,0x3C,0x1C,0xBD,0x4C,0xDC,
278 0x79,0x96,0x57,0xC0,0x64,0xEC,0xF5,0xD4,
279 0x1C,0x67,0x38,0x12,0xCF,0xDE,0x96,0x75};
280
281static unsigned char pcbc_ok[32]={
282 0xcc,0xd1,0x73,0xff,0xab,0x20,0x39,0xf4,
283 0x6d,0xec,0xb4,0x70,0xa0,0xe5,0x6b,0x15,
284 0xae,0xa6,0xbf,0x61,0xed,0x7d,0x9c,0x9f,
285 0xf7,0x17,0x46,0x3b,0x8a,0xb3,0xcc,0x88};
286
287static unsigned char cfb_key[8]={0x01,0x23,0x45,0x67,0x89,0xab,0xcd,0xef};
288static unsigned char cfb_iv[8]={0x12,0x34,0x56,0x78,0x90,0xab,0xcd,0xef};
289static unsigned char cfb_buf1[40],cfb_buf2[40],cfb_tmp[8];
290static unsigned char plain[24]=
291 {
292 0x4e,0x6f,0x77,0x20,0x69,0x73,
293 0x20,0x74,0x68,0x65,0x20,0x74,
294 0x69,0x6d,0x65,0x20,0x66,0x6f,
295 0x72,0x20,0x61,0x6c,0x6c,0x20
296 };
297static unsigned char cfb_cipher8[24]= {
298 0xf3,0x1f,0xda,0x07,0x01,0x14, 0x62,0xee,0x18,0x7f,0x43,0xd8,
299 0x0a,0x7c,0xd9,0xb5,0xb0,0xd2, 0x90,0xda,0x6e,0x5b,0x9a,0x87 };
300static unsigned char cfb_cipher16[24]={
301 0xF3,0x09,0x87,0x87,0x7F,0x57, 0xF7,0x3C,0x36,0xB6,0xDB,0x70,
302 0xD8,0xD5,0x34,0x19,0xD3,0x86, 0xB2,0x23,0xB7,0xB2,0xAD,0x1B };
303static unsigned char cfb_cipher32[24]={
304 0xF3,0x09,0x62,0x49,0xA4,0xDF, 0xA4,0x9F,0x33,0xDC,0x7B,0xAD,
305 0x4C,0xC8,0x9F,0x64,0xE4,0x53, 0xE5,0xEC,0x67,0x20,0xDA,0xB6 };
306static unsigned char cfb_cipher48[24]={
307 0xF3,0x09,0x62,0x49,0xC7,0xF4, 0x30,0xB5,0x15,0xEC,0xBB,0x85,
308 0x97,0x5A,0x13,0x8C,0x68,0x60, 0xE2,0x38,0x34,0x3C,0xDC,0x1F };
309static unsigned char cfb_cipher64[24]={
310 0xF3,0x09,0x62,0x49,0xC7,0xF4, 0x6E,0x51,0xA6,0x9E,0x83,0x9B,
311 0x1A,0x92,0xF7,0x84,0x03,0x46, 0x71,0x33,0x89,0x8E,0xA6,0x22 };
312
313static unsigned char ofb_key[8]={0x01,0x23,0x45,0x67,0x89,0xab,0xcd,0xef};
314static unsigned char ofb_iv[8]={0x12,0x34,0x56,0x78,0x90,0xab,0xcd,0xef};
315static unsigned char ofb_buf1[24],ofb_buf2[24],ofb_tmp[8];
316static unsigned char ofb_cipher[24]=
317 {
318 0xf3,0x09,0x62,0x49,0xc7,0xf4,0x6e,0x51,
319 0x35,0xf2,0x4a,0x24,0x2e,0xeb,0x3d,0x3f,
320 0x3d,0x6d,0x5b,0xe3,0x25,0x5a,0xf8,0xc3
321 };
322
323#if 0
324static DES_LONG cbc_cksum_ret=0xB462FEF7L;
325#else
326static DES_LONG cbc_cksum_ret=0xF7FE62B4L;
327#endif
328static unsigned char cbc_cksum_data[8]={0x1D,0x26,0x93,0x97,0xf7,0xfe,0x62,0xb4};
329
330static char *pt(unsigned char *p);
331static int cfb_test(int bits, unsigned char *cfb_cipher);
332static int cfb64_test(unsigned char *cfb_cipher);
333static int ede_cfb64_test(unsigned char *cfb_cipher);
334int main(int argc, char *argv[])
335 {
336 int j,err=0;
337 unsigned int i;
338 des_cblock in,out,outin,iv3,iv2;
339 des_key_schedule ks,ks2,ks3;
340 unsigned char cbc_in[40];
341 unsigned char cbc_out[40];
342 DES_LONG cs;
343 unsigned char cret[8];
344#ifdef _CRAY
345 struct {
346 int a:32;
347 int b:32;
348 } lqret[2];
349#else
350 DES_LONG lqret[4];
351#endif
352 int num;
353 char *str;
354
355#ifndef OPENSSL_NO_DESCBCM
356 printf("Doing cbcm\n");
357 if ((j=DES_set_key_checked(&cbc_key,&ks)) != 0)
358 {
359 printf("Key error %d\n",j);
360 err=1;
361 }
362 if ((j=DES_set_key_checked(&cbc2_key,&ks2)) != 0)
363 {
364 printf("Key error %d\n",j);
365 err=1;
366 }
367 if ((j=DES_set_key_checked(&cbc3_key,&ks3)) != 0)
368 {
369 printf("Key error %d\n",j);
370 err=1;
371 }
372 memset(cbc_out,0,40);
373 memset(cbc_in,0,40);
374 i=strlen((char *)cbc_data)+1;
375 /* i=((i+7)/8)*8; */
376 memcpy(iv3,cbc_iv,sizeof(cbc_iv));
377 memset(iv2,'\0',sizeof iv2);
378
379 DES_ede3_cbcm_encrypt(cbc_data,cbc_out,16L,&ks,&ks2,&ks3,&iv3,&iv2,
380 DES_ENCRYPT);
381 DES_ede3_cbcm_encrypt(&cbc_data[16],&cbc_out[16],i-16,&ks,&ks2,&ks3,
382 &iv3,&iv2,DES_ENCRYPT);
383 /* if (memcmp(cbc_out,cbc3_ok,
384 (unsigned int)(strlen((char *)cbc_data)+1+7)/8*8) != 0)
385 {
386 printf("des_ede3_cbc_encrypt encrypt error\n");
387 err=1;
388 }
389 */
390 memcpy(iv3,cbc_iv,sizeof(cbc_iv));
391 memset(iv2,'\0',sizeof iv2);
392 DES_ede3_cbcm_encrypt(cbc_out,cbc_in,i,&ks,&ks2,&ks3,&iv3,&iv2,DES_DECRYPT);
393 if (memcmp(cbc_in,cbc_data,strlen((char *)cbc_data)+1) != 0)
394 {
395 unsigned int n;
396
397 printf("des_ede3_cbcm_encrypt decrypt error\n");
398 for(n=0 ; n < i ; ++n)
399 printf(" %02x",cbc_data[n]);
400 printf("\n");
401 for(n=0 ; n < i ; ++n)
402 printf(" %02x",cbc_in[n]);
403 printf("\n");
404 err=1;
405 }
406#endif
407
408 printf("Doing ecb\n");
409 for (i=0; i<NUM_TESTS; i++)
410 {
411 DES_set_key_unchecked(&key_data[i],&ks);
412 memcpy(in,plain_data[i],8);
413 memset(out,0,8);
414 memset(outin,0,8);
415 des_ecb_encrypt(&in,&out,ks,DES_ENCRYPT);
416 des_ecb_encrypt(&out,&outin,ks,DES_DECRYPT);
417
418 if (memcmp(out,cipher_data[i],8) != 0)
419 {
420 printf("Encryption error %2d\nk=%s p=%s o=%s act=%s\n",
421 i+1,pt(key_data[i]),pt(in),pt(cipher_data[i]),
422 pt(out));
423 err=1;
424 }
425 if (memcmp(in,outin,8) != 0)
426 {
427 printf("Decryption error %2d\nk=%s p=%s o=%s act=%s\n",
428 i+1,pt(key_data[i]),pt(out),pt(in),pt(outin));
429 err=1;
430 }
431 }
432
433#ifndef LIBDES_LIT
434 printf("Doing ede ecb\n");
435 for (i=0; i<(NUM_TESTS-2); i++)
436 {
437 DES_set_key_unchecked(&key_data[i],&ks);
438 DES_set_key_unchecked(&key_data[i+1],&ks2);
439 DES_set_key_unchecked(&key_data[i+2],&ks3);
440 memcpy(in,plain_data[i],8);
441 memset(out,0,8);
442 memset(outin,0,8);
443 des_ecb2_encrypt(&in,&out,ks,ks2,DES_ENCRYPT);
444 des_ecb2_encrypt(&out,&outin,ks,ks2,DES_DECRYPT);
445
446 if (memcmp(out,cipher_ecb2[i],8) != 0)
447 {
448 printf("Encryption error %2d\nk=%s p=%s o=%s act=%s\n",
449 i+1,pt(key_data[i]),pt(in),pt(cipher_ecb2[i]),
450 pt(out));
451 err=1;
452 }
453 if (memcmp(in,outin,8) != 0)
454 {
455 printf("Decryption error %2d\nk=%s p=%s o=%s act=%s\n",
456 i+1,pt(key_data[i]),pt(out),pt(in),pt(outin));
457 err=1;
458 }
459 }
460#endif
461
462 printf("Doing cbc\n");
463 if ((j=DES_set_key_checked(&cbc_key,&ks)) != 0)
464 {
465 printf("Key error %d\n",j);
466 err=1;
467 }
468 memset(cbc_out,0,40);
469 memset(cbc_in,0,40);
470 memcpy(iv3,cbc_iv,sizeof(cbc_iv));
471 des_ncbc_encrypt(cbc_data,cbc_out,strlen((char *)cbc_data)+1,ks,
472 &iv3,DES_ENCRYPT);
473 if (memcmp(cbc_out,cbc_ok,32) != 0)
474 {
475 printf("cbc_encrypt encrypt error\n");
476 err=1;
477 }
478
479 memcpy(iv3,cbc_iv,sizeof(cbc_iv));
480 des_ncbc_encrypt(cbc_out,cbc_in,strlen((char *)cbc_data)+1,ks,
481 &iv3,DES_DECRYPT);
482 if (memcmp(cbc_in,cbc_data,strlen((char *)cbc_data)) != 0)
483 {
484 printf("cbc_encrypt decrypt error\n");
485 err=1;
486 }
487
488#ifndef LIBDES_LIT
489 printf("Doing desx cbc\n");
490 if ((j=DES_set_key_checked(&cbc_key,&ks)) != 0)
491 {
492 printf("Key error %d\n",j);
493 err=1;
494 }
495 memset(cbc_out,0,40);
496 memset(cbc_in,0,40);
497 memcpy(iv3,cbc_iv,sizeof(cbc_iv));
498 des_xcbc_encrypt(cbc_data,cbc_out,strlen((char *)cbc_data)+1,ks,
499 &iv3,&cbc2_key,&cbc3_key, DES_ENCRYPT);
500 if (memcmp(cbc_out,xcbc_ok,32) != 0)
501 {
502 printf("des_xcbc_encrypt encrypt error\n");
503 err=1;
504 }
505 memcpy(iv3,cbc_iv,sizeof(cbc_iv));
506 des_xcbc_encrypt(cbc_out,cbc_in,strlen((char *)cbc_data)+1,ks,
507 &iv3,&cbc2_key,&cbc3_key, DES_DECRYPT);
508 if (memcmp(cbc_in,cbc_data,strlen((char *)cbc_data)+1) != 0)
509 {
510 printf("des_xcbc_encrypt decrypt error\n");
511 err=1;
512 }
513#endif
514
515 printf("Doing ede cbc\n");
516 if ((j=DES_set_key_checked(&cbc_key,&ks)) != 0)
517 {
518 printf("Key error %d\n",j);
519 err=1;
520 }
521 if ((j=DES_set_key_checked(&cbc2_key,&ks2)) != 0)
522 {
523 printf("Key error %d\n",j);
524 err=1;
525 }
526 if ((j=DES_set_key_checked(&cbc3_key,&ks3)) != 0)
527 {
528 printf("Key error %d\n",j);
529 err=1;
530 }
531 memset(cbc_out,0,40);
532 memset(cbc_in,0,40);
533 i=strlen((char *)cbc_data)+1;
534 /* i=((i+7)/8)*8; */
535 memcpy(iv3,cbc_iv,sizeof(cbc_iv));
536
537 des_ede3_cbc_encrypt(cbc_data,cbc_out,16L,ks,ks2,ks3,&iv3,
538 DES_ENCRYPT);
539 des_ede3_cbc_encrypt(&(cbc_data[16]),&(cbc_out[16]),i-16,ks,ks2,ks3,
540 &iv3,DES_ENCRYPT);
541 if (memcmp(cbc_out,cbc3_ok,
542 (unsigned int)(strlen((char *)cbc_data)+1+7)/8*8) != 0)
543 {
544 unsigned int n;
545
546 printf("des_ede3_cbc_encrypt encrypt error\n");
547 for(n=0 ; n < i ; ++n)
548 printf(" %02x",cbc_out[n]);
549 printf("\n");
550 for(n=0 ; n < i ; ++n)
551 printf(" %02x",cbc3_ok[n]);
552 printf("\n");
553 err=1;
554 }
555
556 memcpy(iv3,cbc_iv,sizeof(cbc_iv));
557 des_ede3_cbc_encrypt(cbc_out,cbc_in,i,ks,ks2,ks3,&iv3,DES_DECRYPT);
558 if (memcmp(cbc_in,cbc_data,strlen((char *)cbc_data)+1) != 0)
559 {
560 unsigned int n;
561
562 printf("des_ede3_cbc_encrypt decrypt error\n");
563 for(n=0 ; n < i ; ++n)
564 printf(" %02x",cbc_data[n]);
565 printf("\n");
566 for(n=0 ; n < i ; ++n)
567 printf(" %02x",cbc_in[n]);
568 printf("\n");
569 err=1;
570 }
571
572#ifndef LIBDES_LIT
573 printf("Doing pcbc\n");
574 if ((j=DES_set_key_checked(&cbc_key,&ks)) != 0)
575 {
576 printf("Key error %d\n",j);
577 err=1;
578 }
579 memset(cbc_out,0,40);
580 memset(cbc_in,0,40);
581 des_pcbc_encrypt(cbc_data,cbc_out,strlen((char *)cbc_data)+1,ks,
582 &cbc_iv,DES_ENCRYPT);
583 if (memcmp(cbc_out,pcbc_ok,32) != 0)
584 {
585 printf("pcbc_encrypt encrypt error\n");
586 err=1;
587 }
588 des_pcbc_encrypt(cbc_out,cbc_in,strlen((char *)cbc_data)+1,ks,&cbc_iv,
589 DES_DECRYPT);
590 if (memcmp(cbc_in,cbc_data,strlen((char *)cbc_data)+1) != 0)
591 {
592 printf("pcbc_encrypt decrypt error\n");
593 err=1;
594 }
595
596 printf("Doing ");
597 printf("cfb8 ");
598 err+=cfb_test(8,cfb_cipher8);
599 printf("cfb16 ");
600 err+=cfb_test(16,cfb_cipher16);
601 printf("cfb32 ");
602 err+=cfb_test(32,cfb_cipher32);
603 printf("cfb48 ");
604 err+=cfb_test(48,cfb_cipher48);
605 printf("cfb64 ");
606 err+=cfb_test(64,cfb_cipher64);
607
608 printf("cfb64() ");
609 err+=cfb64_test(cfb_cipher64);
610
611 memcpy(cfb_tmp,cfb_iv,sizeof(cfb_iv));
612 for (i=0; i<sizeof(plain); i++)
613 des_cfb_encrypt(&(plain[i]),&(cfb_buf1[i]),
614 8,1,ks,&cfb_tmp,DES_ENCRYPT);
615 if (memcmp(cfb_cipher8,cfb_buf1,sizeof(plain)) != 0)
616 {
617 printf("cfb_encrypt small encrypt error\n");
618 err=1;
619 }
620
621 memcpy(cfb_tmp,cfb_iv,sizeof(cfb_iv));
622 for (i=0; i<sizeof(plain); i++)
623 des_cfb_encrypt(&(cfb_buf1[i]),&(cfb_buf2[i]),
624 8,1,ks,&cfb_tmp,DES_DECRYPT);
625 if (memcmp(plain,cfb_buf2,sizeof(plain)) != 0)
626 {
627 printf("cfb_encrypt small decrypt error\n");
628 err=1;
629 }
630
631 printf("ede_cfb64() ");
632 err+=ede_cfb64_test(cfb_cipher64);
633
634 printf("done\n");
635
636 printf("Doing ofb\n");
637 DES_set_key_checked(&ofb_key,&ks);
638 memcpy(ofb_tmp,ofb_iv,sizeof(ofb_iv));
639 des_ofb_encrypt(plain,ofb_buf1,64,sizeof(plain)/8,ks,&ofb_tmp);
640 if (memcmp(ofb_cipher,ofb_buf1,sizeof(ofb_buf1)) != 0)
641 {
642 printf("ofb_encrypt encrypt error\n");
643printf("%02X %02X %02X %02X %02X %02X %02X %02X\n",
644ofb_buf1[8+0], ofb_buf1[8+1], ofb_buf1[8+2], ofb_buf1[8+3],
645ofb_buf1[8+4], ofb_buf1[8+5], ofb_buf1[8+6], ofb_buf1[8+7]);
646printf("%02X %02X %02X %02X %02X %02X %02X %02X\n",
647ofb_buf1[8+0], ofb_cipher[8+1], ofb_cipher[8+2], ofb_cipher[8+3],
648ofb_buf1[8+4], ofb_cipher[8+5], ofb_cipher[8+6], ofb_cipher[8+7]);
649 err=1;
650 }
651 memcpy(ofb_tmp,ofb_iv,sizeof(ofb_iv));
652 des_ofb_encrypt(ofb_buf1,ofb_buf2,64,sizeof(ofb_buf1)/8,ks,&ofb_tmp);
653 if (memcmp(plain,ofb_buf2,sizeof(ofb_buf2)) != 0)
654 {
655 printf("ofb_encrypt decrypt error\n");
656printf("%02X %02X %02X %02X %02X %02X %02X %02X\n",
657ofb_buf2[8+0], ofb_buf2[8+1], ofb_buf2[8+2], ofb_buf2[8+3],
658ofb_buf2[8+4], ofb_buf2[8+5], ofb_buf2[8+6], ofb_buf2[8+7]);
659printf("%02X %02X %02X %02X %02X %02X %02X %02X\n",
660plain[8+0], plain[8+1], plain[8+2], plain[8+3],
661plain[8+4], plain[8+5], plain[8+6], plain[8+7]);
662 err=1;
663 }
664
665 printf("Doing ofb64\n");
666 DES_set_key_checked(&ofb_key,&ks);
667 memcpy(ofb_tmp,ofb_iv,sizeof(ofb_iv));
668 memset(ofb_buf1,0,sizeof(ofb_buf1));
669 memset(ofb_buf2,0,sizeof(ofb_buf1));
670 num=0;
671 for (i=0; i<sizeof(plain); i++)
672 {
673 des_ofb64_encrypt(&(plain[i]),&(ofb_buf1[i]),1,ks,&ofb_tmp,
674 &num);
675 }
676 if (memcmp(ofb_cipher,ofb_buf1,sizeof(ofb_buf1)) != 0)
677 {
678 printf("ofb64_encrypt encrypt error\n");
679 err=1;
680 }
681 memcpy(ofb_tmp,ofb_iv,sizeof(ofb_iv));
682 num=0;
683 des_ofb64_encrypt(ofb_buf1,ofb_buf2,sizeof(ofb_buf1),ks,&ofb_tmp,
684 &num);
685 if (memcmp(plain,ofb_buf2,sizeof(ofb_buf2)) != 0)
686 {
687 printf("ofb64_encrypt decrypt error\n");
688 err=1;
689 }
690
691 printf("Doing ede_ofb64\n");
692 DES_set_key_checked(&ofb_key,&ks);
693 memcpy(ofb_tmp,ofb_iv,sizeof(ofb_iv));
694 memset(ofb_buf1,0,sizeof(ofb_buf1));
695 memset(ofb_buf2,0,sizeof(ofb_buf1));
696 num=0;
697 for (i=0; i<sizeof(plain); i++)
698 {
699 des_ede3_ofb64_encrypt(&(plain[i]),&(ofb_buf1[i]),1,ks,ks,
700 ks,&ofb_tmp,&num);
701 }
702 if (memcmp(ofb_cipher,ofb_buf1,sizeof(ofb_buf1)) != 0)
703 {
704 printf("ede_ofb64_encrypt encrypt error\n");
705 err=1;
706 }
707 memcpy(ofb_tmp,ofb_iv,sizeof(ofb_iv));
708 num=0;
709 des_ede3_ofb64_encrypt(ofb_buf1,ofb_buf2,sizeof(ofb_buf1),ks,ks,ks,
710 &ofb_tmp,&num);
711 if (memcmp(plain,ofb_buf2,sizeof(ofb_buf2)) != 0)
712 {
713 printf("ede_ofb64_encrypt decrypt error\n");
714 err=1;
715 }
716
717 printf("Doing cbc_cksum\n");
718 DES_set_key_checked(&cbc_key,&ks);
719 cs=des_cbc_cksum(cbc_data,&cret,strlen((char *)cbc_data),ks,&cbc_iv);
720 if (cs != cbc_cksum_ret)
721 {
722 printf("bad return value (%08lX), should be %08lX\n",
723 (unsigned long)cs,(unsigned long)cbc_cksum_ret);
724 err=1;
725 }
726 if (memcmp(cret,cbc_cksum_data,8) != 0)
727 {
728 printf("bad cbc_cksum block returned\n");
729 err=1;
730 }
731
732 printf("Doing quad_cksum\n");
733 cs=des_quad_cksum(cbc_data,(des_cblock *)lqret,
734 (long)strlen((char *)cbc_data),2,(des_cblock *)cbc_iv);
735 if (cs != 0x70d7a63aL)
736 {
737 printf("quad_cksum error, ret %08lx should be 70d7a63a\n",
738 (unsigned long)cs);
739 err=1;
740 }
741#ifdef _CRAY
742 if (lqret[0].a != 0x327eba8dL)
743 {
744 printf("quad_cksum error, out[0] %08lx is not %08lx\n",
745 (unsigned long)lqret[0].a,0x327eba8dUL);
746 err=1;
747 }
748 if (lqret[0].b != 0x201a49ccL)
749 {
750 printf("quad_cksum error, out[1] %08lx is not %08lx\n",
751 (unsigned long)lqret[0].b,0x201a49ccUL);
752 err=1;
753 }
754 if (lqret[1].a != 0x70d7a63aL)
755 {
756 printf("quad_cksum error, out[2] %08lx is not %08lx\n",
757 (unsigned long)lqret[1].a,0x70d7a63aUL);
758 err=1;
759 }
760 if (lqret[1].b != 0x501c2c26L)
761 {
762 printf("quad_cksum error, out[3] %08lx is not %08lx\n",
763 (unsigned long)lqret[1].b,0x501c2c26UL);
764 err=1;
765 }
766#else
767 if (lqret[0] != 0x327eba8dL)
768 {
769 printf("quad_cksum error, out[0] %08lx is not %08lx\n",
770 (unsigned long)lqret[0],0x327eba8dUL);
771 err=1;
772 }
773 if (lqret[1] != 0x201a49ccL)
774 {
775 printf("quad_cksum error, out[1] %08lx is not %08lx\n",
776 (unsigned long)lqret[1],0x201a49ccUL);
777 err=1;
778 }
779 if (lqret[2] != 0x70d7a63aL)
780 {
781 printf("quad_cksum error, out[2] %08lx is not %08lx\n",
782 (unsigned long)lqret[2],0x70d7a63aUL);
783 err=1;
784 }
785 if (lqret[3] != 0x501c2c26L)
786 {
787 printf("quad_cksum error, out[3] %08lx is not %08lx\n",
788 (unsigned long)lqret[3],0x501c2c26UL);
789 err=1;
790 }
791#endif
792#endif
793
794 printf("input word alignment test");
795 for (i=0; i<4; i++)
796 {
797 printf(" %d",i);
798 des_ncbc_encrypt(&(cbc_out[i]),cbc_in,
799 strlen((char *)cbc_data)+1,ks,
800 &cbc_iv,DES_ENCRYPT);
801 }
802 printf("\noutput word alignment test");
803 for (i=0; i<4; i++)
804 {
805 printf(" %d",i);
806 des_ncbc_encrypt(cbc_out,&(cbc_in[i]),
807 strlen((char *)cbc_data)+1,ks,
808 &cbc_iv,DES_ENCRYPT);
809 }
810 printf("\n");
811 printf("fast crypt test ");
812 str=crypt("testing","ef");
813 if (strcmp("efGnQx2725bI2",str) != 0)
814 {
815 printf("fast crypt error, %s should be efGnQx2725bI2\n",str);
816 err=1;
817 }
818 str=crypt("bca76;23","yA");
819 if (strcmp("yA1Rp/1hZXIJk",str) != 0)
820 {
821 printf("fast crypt error, %s should be yA1Rp/1hZXIJk\n",str);
822 err=1;
823 }
824#ifdef OPENSSL_SYS_NETWARE
825 if (err) printf("ERROR: %d\n", err);
826#endif
827 printf("\n");
828 return(err);
829 }
830
831static char *pt(unsigned char *p)
832 {
833 static char bufs[10][20];
834 static int bnum=0;
835 char *ret;
836 int i;
837 static char *f="0123456789ABCDEF";
838
839 ret= &(bufs[bnum++][0]);
840 bnum%=10;
841 for (i=0; i<8; i++)
842 {
843 ret[i*2]=f[(p[i]>>4)&0xf];
844 ret[i*2+1]=f[p[i]&0xf];
845 }
846 ret[16]='\0';
847 return(ret);
848 }
849
850#ifndef LIBDES_LIT
851
852static int cfb_test(int bits, unsigned char *cfb_cipher)
853 {
854 des_key_schedule ks;
855 int i,err=0;
856
857 DES_set_key_checked(&cfb_key,&ks);
858 memcpy(cfb_tmp,cfb_iv,sizeof(cfb_iv));
859 des_cfb_encrypt(plain,cfb_buf1,bits,sizeof(plain),ks,&cfb_tmp,
860 DES_ENCRYPT);
861 if (memcmp(cfb_cipher,cfb_buf1,sizeof(plain)) != 0)
862 {
863 err=1;
864 printf("cfb_encrypt encrypt error\n");
865 for (i=0; i<24; i+=8)
866 printf("%s\n",pt(&(cfb_buf1[i])));
867 }
868 memcpy(cfb_tmp,cfb_iv,sizeof(cfb_iv));
869 des_cfb_encrypt(cfb_buf1,cfb_buf2,bits,sizeof(plain),ks,&cfb_tmp,
870 DES_DECRYPT);
871 if (memcmp(plain,cfb_buf2,sizeof(plain)) != 0)
872 {
873 err=1;
874 printf("cfb_encrypt decrypt error\n");
875 for (i=0; i<24; i+=8)
876 printf("%s\n",pt(&(cfb_buf1[i])));
877 }
878 return(err);
879 }
880
881static int cfb64_test(unsigned char *cfb_cipher)
882 {
883 des_key_schedule ks;
884 int err=0,i,n;
885
886 DES_set_key_checked(&cfb_key,&ks);
887 memcpy(cfb_tmp,cfb_iv,sizeof(cfb_iv));
888 n=0;
889 des_cfb64_encrypt(plain,cfb_buf1,12,ks,&cfb_tmp,&n,DES_ENCRYPT);
890 des_cfb64_encrypt(&(plain[12]),&(cfb_buf1[12]),sizeof(plain)-12,ks,
891 &cfb_tmp,&n,DES_ENCRYPT);
892 if (memcmp(cfb_cipher,cfb_buf1,sizeof(plain)) != 0)
893 {
894 err=1;
895 printf("cfb_encrypt encrypt error\n");
896 for (i=0; i<24; i+=8)
897 printf("%s\n",pt(&(cfb_buf1[i])));
898 }
899 memcpy(cfb_tmp,cfb_iv,sizeof(cfb_iv));
900 n=0;
901 des_cfb64_encrypt(cfb_buf1,cfb_buf2,17,ks,&cfb_tmp,&n,DES_DECRYPT);
902 des_cfb64_encrypt(&(cfb_buf1[17]),&(cfb_buf2[17]),
903 sizeof(plain)-17,ks,&cfb_tmp,&n,DES_DECRYPT);
904 if (memcmp(plain,cfb_buf2,sizeof(plain)) != 0)
905 {
906 err=1;
907 printf("cfb_encrypt decrypt error\n");
908 for (i=0; i<24; i+=8)
909 printf("%s\n",pt(&(cfb_buf2[i])));
910 }
911 return(err);
912 }
913
914static int ede_cfb64_test(unsigned char *cfb_cipher)
915 {
916 des_key_schedule ks;
917 int err=0,i,n;
918
919 DES_set_key_checked(&cfb_key,&ks);
920 memcpy(cfb_tmp,cfb_iv,sizeof(cfb_iv));
921 n=0;
922 des_ede3_cfb64_encrypt(plain,cfb_buf1,12,ks,ks,ks,&cfb_tmp,&n,
923 DES_ENCRYPT);
924 des_ede3_cfb64_encrypt(&(plain[12]),&(cfb_buf1[12]),
925 sizeof(plain)-12,ks,ks,ks,
926 &cfb_tmp,&n,DES_ENCRYPT);
927 if (memcmp(cfb_cipher,cfb_buf1,sizeof(plain)) != 0)
928 {
929 err=1;
930 printf("ede_cfb_encrypt encrypt error\n");
931 for (i=0; i<24; i+=8)
932 printf("%s\n",pt(&(cfb_buf1[i])));
933 }
934 memcpy(cfb_tmp,cfb_iv,sizeof(cfb_iv));
935 n=0;
936 des_ede3_cfb64_encrypt(cfb_buf1,cfb_buf2,(long)17,ks,ks,ks,
937 &cfb_tmp,&n,DES_DECRYPT);
938 des_ede3_cfb64_encrypt(&(cfb_buf1[17]),&(cfb_buf2[17]),
939 sizeof(plain)-17,ks,ks,ks,
940 &cfb_tmp,&n,DES_DECRYPT);
941 if (memcmp(plain,cfb_buf2,sizeof(plain)) != 0)
942 {
943 err=1;
944 printf("ede_cfb_encrypt decrypt error\n");
945 for (i=0; i<24; i+=8)
946 printf("%s\n",pt(&(cfb_buf2[i])));
947 }
948 return(err);
949 }
950
951#endif
952#endif
diff --git a/src/lib/libcrypto/des/fcrypt_b.c b/src/lib/libcrypto/des/fcrypt_b.c
index 8822816938..87fc71eb26 100644
--- a/src/lib/libcrypto/des/fcrypt_b.c
+++ b/src/lib/libcrypto/des/fcrypt_b.c
@@ -68,6 +68,8 @@
68#include "des_locl.h" 68#include "des_locl.h"
69#undef DES_FCRYPT 69#undef DES_FCRYPT
70 70
71#ifndef OPENBSD_DES_ASM
72
71#undef PERM_OP 73#undef PERM_OP
72#define PERM_OP(a,b,t,n,m) ((t)=((((a)>>(n))^(b))&(m)),\ 74#define PERM_OP(a,b,t,n,m) ((t)=((((a)>>(n))^(b))&(m)),\
73 (b)^=(t),\ 75 (b)^=(t),\
@@ -141,3 +143,4 @@ void fcrypt_body(DES_LONG *out, DES_key_schedule *ks, DES_LONG Eswap0,
141 out[1]=l; 143 out[1]=l;
142 } 144 }
143 145
146#endif /* OPENBSD_DES_ASM */
diff --git a/src/lib/libcrypto/des/makefile.bc b/src/lib/libcrypto/des/makefile.bc
new file mode 100644
index 0000000000..1fe6d4915a
--- /dev/null
+++ b/src/lib/libcrypto/des/makefile.bc
@@ -0,0 +1,50 @@
1#
2# Origional BC Makefile from Teun <Teun.Nijssen@kub.nl>
3#
4#
5CC = bcc
6TLIB = tlib /0 /C
7# note: the -3 flag produces code for 386, 486, Pentium etc; omit it for 286s
8OPTIMIZE= -3 -O2
9#WINDOWS= -W
10CFLAGS = -c -ml -d $(OPTIMIZE) $(WINDOWS) -DMSDOS
11LFLAGS = -ml $(WINDOWS)
12
13.c.obj:
14 $(CC) $(CFLAGS) $*.c
15
16.obj.exe:
17 $(CC) $(LFLAGS) -e$*.exe $*.obj libdes.lib
18
19all: $(LIB) destest.exe rpw.exe des.exe speed.exe
20
21# "make clean": use a directory containing only libdes .exe and .obj files...
22clean:
23 del *.exe
24 del *.obj
25 del libdes.lib
26 del libdes.rsp
27
28OBJS= cbc_cksm.obj cbc_enc.obj ecb_enc.obj pcbc_enc.obj \
29 qud_cksm.obj rand_key.obj set_key.obj str2key.obj \
30 enc_read.obj enc_writ.obj fcrypt.obj cfb_enc.obj \
31 ecb3_enc.obj ofb_enc.obj cbc3_enc.obj read_pwd.obj\
32 cfb64enc.obj ofb64enc.obj ede_enc.obj cfb64ede.obj\
33 ofb64ede.obj supp.obj
34
35LIB= libdes.lib
36
37$(LIB): $(OBJS)
38 del $(LIB)
39 makersp "+%s &\n" &&|
40 $(OBJS)
41| >libdes.rsp
42 $(TLIB) libdes.lib @libdes.rsp,nul
43 del libdes.rsp
44
45destest.exe: destest.obj libdes.lib
46rpw.exe: rpw.obj libdes.lib
47speed.exe: speed.obj libdes.lib
48des.exe: des.obj libdes.lib
49
50
diff --git a/src/lib/libcrypto/des/options.txt b/src/lib/libcrypto/des/options.txt
new file mode 100644
index 0000000000..6e2b50f765
--- /dev/null
+++ b/src/lib/libcrypto/des/options.txt
@@ -0,0 +1,39 @@
1Note that the UNROLL option makes the 'inner' des loop unroll all 16 rounds
2instead of the default 4.
3RISC1 and RISC2 are 2 alternatives for the inner loop and
4PTR means to use pointers arithmatic instead of arrays.
5
6FreeBSD - Pentium Pro 200mhz - gcc 2.7.2.2 - assembler 577,000 4620k/s
7IRIX 6.2 - R10000 195mhz - cc (-O3 -n32) - UNROLL RISC2 PTR 496,000 3968k/s
8solaris 2.5.1 usparc 167mhz?? - SC4.0 - UNROLL RISC1 PTR [1] 459,400 3672k/s
9FreeBSD - Pentium Pro 200mhz - gcc 2.7.2.2 - UNROLL RISC1 433,000 3468k/s
10solaris 2.5.1 usparc 167mhz?? - gcc 2.7.2 - UNROLL 380,000 3041k/s
11linux - pentium 100mhz - gcc 2.7.0 - assembler 281,000 2250k/s
12NT 4.0 - pentium 100mhz - VC 4.2 - assembler 281,000 2250k/s
13AIX 4.1? - PPC604 100mhz - cc - UNROLL 275,000 2200k/s
14IRIX 5.3 - R4400 200mhz - gcc 2.6.3 - UNROLL RISC2 PTR 235,300 1882k/s
15IRIX 5.3 - R4400 200mhz - cc - UNROLL RISC2 PTR 233,700 1869k/s
16NT 4.0 - pentium 100mhz - VC 4.2 - UNROLL RISC1 PTR 191,000 1528k/s
17DEC Alpha 165mhz?? - cc - RISC2 PTR [2] 181,000 1448k/s
18linux - pentium 100mhz - gcc 2.7.0 - UNROLL RISC1 PTR 158,500 1268k/s
19HPUX 10 - 9000/887 - cc - UNROLL [3] 148,000 1190k/s
20solaris 2.5.1 - sparc 10 50mhz - gcc 2.7.2 - UNROLL 123,600 989k/s
21IRIX 5.3 - R4000 100mhz - cc - UNROLL RISC2 PTR 101,000 808k/s
22DGUX - 88100 50mhz(?) - gcc 2.6.3 - UNROLL 81,000 648k/s
23solaris 2.4 486 50mhz - gcc 2.6.3 - assembler 65,000 522k/s
24HPUX 10 - 9000/887 - k&r cc (default compiler) - UNROLL PTR 76,000 608k/s
25solaris 2.4 486 50mhz - gcc 2.6.3 - UNROLL RISC2 43,500 344k/s
26AIX - old slow one :-) - cc - 39,000 312k/s
27
28Notes.
29[1] For the ultra sparc, SunC 4.0
30 cc -xtarget=ultra -xarch=v8plus -Xa -xO5, running 'des_opts'
31 gives a speed of 344,000 des/s while 'speed' gives 459,000 des/s.
32 I'll record the higher since it is coming from the library but it
33 is all rather weird.
34[2] Similar to the ultra sparc ([1]), 181,000 for 'des_opts' vs 175,000.
35[3] I was unable to get access to this machine when it was not heavily loaded.
36 As such, my timing program was never able to get more that %30 of the CPU.
37 This would cause the program to give much lower speed numbers because
38 it would be 'fighting' to stay in the cache with the other CPU burning
39 processes.
diff --git a/src/lib/libcrypto/des/read2pwd.c b/src/lib/libcrypto/des/read2pwd.c
new file mode 100644
index 0000000000..ee6969f76e
--- /dev/null
+++ b/src/lib/libcrypto/des/read2pwd.c
@@ -0,0 +1,140 @@
1/* crypto/des/read2pwd.c */
2/* ====================================================================
3 * Copyright (c) 2001-2002 The OpenSSL Project. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 *
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in
14 * the documentation and/or other materials provided with the
15 * distribution.
16 *
17 * 3. All advertising materials mentioning features or use of this
18 * software must display the following acknowledgment:
19 * "This product includes software developed by the OpenSSL Project
20 * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
21 *
22 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
23 * endorse or promote products derived from this software without
24 * prior written permission. For written permission, please contact
25 * openssl-core@openssl.org.
26 *
27 * 5. Products derived from this software may not be called "OpenSSL"
28 * nor may "OpenSSL" appear in their names without prior written
29 * permission of the OpenSSL Project.
30 *
31 * 6. Redistributions of any form whatsoever must retain the following
32 * acknowledgment:
33 * "This product includes software developed by the OpenSSL Project
34 * for use in the OpenSSL Toolkit (http://www.openssl.org/)"
35 *
36 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
37 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
38 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
39 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
40 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
41 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
42 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
43 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
44 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
45 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
46 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
47 * OF THE POSSIBILITY OF SUCH DAMAGE.
48 * ====================================================================
49 *
50 * This product includes cryptographic software written by Eric Young
51 * (eay@cryptsoft.com). This product includes software written by Tim
52 * Hudson (tjh@cryptsoft.com).
53 *
54 */
55/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
56 * All rights reserved.
57 *
58 * This package is an SSL implementation written
59 * by Eric Young (eay@cryptsoft.com).
60 * The implementation was written so as to conform with Netscapes SSL.
61 *
62 * This library is free for commercial and non-commercial use as long as
63 * the following conditions are aheared to. The following conditions
64 * apply to all code found in this distribution, be it the RC4, RSA,
65 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
66 * included with this distribution is covered by the same copyright terms
67 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
68 *
69 * Copyright remains Eric Young's, and as such any Copyright notices in
70 * the code are not to be removed.
71 * If this package is used in a product, Eric Young should be given attribution
72 * as the author of the parts of the library used.
73 * This can be in the form of a textual message at program startup or
74 * in documentation (online or textual) provided with the package.
75 *
76 * Redistribution and use in source and binary forms, with or without
77 * modification, are permitted provided that the following conditions
78 * are met:
79 * 1. Redistributions of source code must retain the copyright
80 * notice, this list of conditions and the following disclaimer.
81 * 2. Redistributions in binary form must reproduce the above copyright
82 * notice, this list of conditions and the following disclaimer in the
83 * documentation and/or other materials provided with the distribution.
84 * 3. All advertising materials mentioning features or use of this software
85 * must display the following acknowledgement:
86 * "This product includes cryptographic software written by
87 * Eric Young (eay@cryptsoft.com)"
88 * The word 'cryptographic' can be left out if the rouines from the library
89 * being used are not cryptographic related :-).
90 * 4. If you include any Windows specific code (or a derivative thereof) from
91 * the apps directory (application code) you must include an acknowledgement:
92 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
93 *
94 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
95 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
96 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
97 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
98 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
99 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
100 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
101 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
102 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
103 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
104 * SUCH DAMAGE.
105 *
106 * The licence and distribution terms for any publically available version or
107 * derivative of this code cannot be changed. i.e. this code cannot simply be
108 * copied and put under another distribution licence
109 * [including the GNU Public Licence.]
110 */
111
112#include <string.h>
113#include <openssl/des.h>
114#include <openssl/ui.h>
115#include <openssl/crypto.h>
116
117int DES_read_password(DES_cblock *key, const char *prompt, int verify)
118 {
119 int ok;
120 char buf[BUFSIZ],buff[BUFSIZ];
121
122 if ((ok=UI_UTIL_read_pw(buf,buff,BUFSIZ,prompt,verify)) == 0)
123 DES_string_to_key(buf,key);
124 OPENSSL_cleanse(buf,BUFSIZ);
125 OPENSSL_cleanse(buff,BUFSIZ);
126 return(ok);
127 }
128
129int DES_read_2passwords(DES_cblock *key1, DES_cblock *key2, const char *prompt,
130 int verify)
131 {
132 int ok;
133 char buf[BUFSIZ],buff[BUFSIZ];
134
135 if ((ok=UI_UTIL_read_pw(buf,buff,BUFSIZ,prompt,verify)) == 0)
136 DES_string_to_2keys(buf,key1,key2);
137 OPENSSL_cleanse(buf,BUFSIZ);
138 OPENSSL_cleanse(buff,BUFSIZ);
139 return(ok);
140 }
diff --git a/src/lib/libcrypto/des/read_pwd.c b/src/lib/libcrypto/des/read_pwd.c
new file mode 100644
index 0000000000..ce5fa00a37
--- /dev/null
+++ b/src/lib/libcrypto/des/read_pwd.c
@@ -0,0 +1,521 @@
1/* crypto/des/read_pwd.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
59#include <openssl/e_os2.h>
60#if !defined(OPENSSL_SYS_MSDOS) && !defined(OPENSSL_SYS_VMS) && !defined(OPENSSL_SYS_WIN32)
61#ifdef OPENSSL_UNISTD
62# include OPENSSL_UNISTD
63#else
64# include <unistd.h>
65#endif
66/* If unistd.h defines _POSIX_VERSION, we conclude that we
67 * are on a POSIX system and have sigaction and termios. */
68#if defined(_POSIX_VERSION)
69
70# define SIGACTION
71# if !defined(TERMIOS) && !defined(TERMIO) && !defined(SGTTY)
72# define TERMIOS
73# endif
74
75#endif
76#endif
77
78/* #define SIGACTION */ /* Define this if you have sigaction() */
79
80#ifdef WIN16TTY
81#undef OPENSSL_SYS_WIN16
82#undef _WINDOWS
83#include <graph.h>
84#endif
85
86/* 06-Apr-92 Luke Brennan Support for VMS */
87#include "des_locl.h"
88#include "cryptlib.h"
89#include <signal.h>
90#include <stdio.h>
91#include <string.h>
92#include <setjmp.h>
93#include <errno.h>
94
95#ifdef OPENSSL_SYS_VMS /* prototypes for sys$whatever */
96#include <starlet.h>
97#ifdef __DECC
98#pragma message disable DOLLARID
99#endif
100#endif
101
102#ifdef WIN_CONSOLE_BUG
103#include <windows.h>
104#ifndef OPENSSL_SYS_WINCE
105#include <wincon.h>
106#endif
107#endif
108
109
110/* There are 5 types of terminal interface supported,
111 * TERMIO, TERMIOS, VMS, MSDOS and SGTTY
112 */
113
114#if defined(__sgi) && !defined(TERMIOS)
115#define TERMIOS
116#undef TERMIO
117#undef SGTTY
118#endif
119
120#if defined(linux) && !defined(TERMIO)
121#undef TERMIOS
122#define TERMIO
123#undef SGTTY
124#endif
125
126#ifdef _LIBC
127#undef TERMIOS
128#define TERMIO
129#undef SGTTY
130#endif
131
132#if !defined(TERMIO) && !defined(TERMIOS) && !defined(OPENSSL_SYS_VMS) && !defined(OPENSSL_SYS_MSDOS) && !defined(MAC_OS_pre_X) && !defined(MAC_OS_GUSI_SOURCE)
133#undef TERMIOS
134#undef TERMIO
135#define SGTTY
136#endif
137
138#if defined(OPENSSL_SYS_VXWORKS)
139#undef TERMIOS
140#undef TERMIO
141#undef SGTTY
142#endif
143
144#ifdef TERMIOS
145#include <termios.h>
146#define TTY_STRUCT struct termios
147#define TTY_FLAGS c_lflag
148#define TTY_get(tty,data) tcgetattr(tty,data)
149#define TTY_set(tty,data) tcsetattr(tty,TCSANOW,data)
150#endif
151
152#ifdef TERMIO
153#include <termio.h>
154#define TTY_STRUCT struct termio
155#define TTY_FLAGS c_lflag
156#define TTY_get(tty,data) ioctl(tty,TCGETA,data)
157#define TTY_set(tty,data) ioctl(tty,TCSETA,data)
158#endif
159
160#ifdef SGTTY
161#include <sgtty.h>
162#define TTY_STRUCT struct sgttyb
163#define TTY_FLAGS sg_flags
164#define TTY_get(tty,data) ioctl(tty,TIOCGETP,data)
165#define TTY_set(tty,data) ioctl(tty,TIOCSETP,data)
166#endif
167
168#if !defined(_LIBC) && !defined(OPENSSL_SYS_MSDOS) && !defined(OPENSSL_SYS_VMS) && !defined(MAC_OS_pre_X)
169#include <sys/ioctl.h>
170#endif
171
172#if defined(OPENSSL_SYS_MSDOS) && !defined(__CYGWIN32__) && !defined(OPENSSL_SYS_WINCE)
173#include <conio.h>
174#define fgets(a,b,c) noecho_fgets(a,b,c)
175#endif
176
177#ifdef OPENSSL_SYS_VMS
178#include <ssdef.h>
179#include <iodef.h>
180#include <ttdef.h>
181#include <descrip.h>
182struct IOSB {
183 short iosb$w_value;
184 short iosb$w_count;
185 long iosb$l_info;
186 };
187#endif
188
189#if defined(MAC_OS_pre_X) || defined(MAC_OS_GUSI_SOURCE)
190/*
191 * This one needs work. As a matter of fact the code is unoperational
192 * and this is only a trick to get it compiled.
193 * <appro@fy.chalmers.se>
194 */
195#define TTY_STRUCT int
196#endif
197
198#ifndef NX509_SIG
199#define NX509_SIG 32
200#endif
201
202static void read_till_nl(FILE *);
203static void recsig(int);
204static void pushsig(void);
205static void popsig(void);
206#if defined(OPENSSL_SYS_MSDOS) && !defined(OPENSSL_SYS_WIN16)
207static int noecho_fgets(char *buf, int size, FILE *tty);
208#endif
209#ifdef SIGACTION
210 static struct sigaction savsig[NX509_SIG];
211#else
212 static void (*savsig[NX509_SIG])(int );
213#endif
214static jmp_buf save;
215
216int des_read_pw_string(char *buf, int length, const char *prompt,
217 int verify)
218 {
219 char buff[BUFSIZ];
220 int ret;
221
222 ret=des_read_pw(buf,buff,(length>BUFSIZ)?BUFSIZ:length,prompt,verify);
223 OPENSSL_cleanse(buff,BUFSIZ);
224 return(ret);
225 }
226
227#ifdef OPENSSL_SYS_WINCE
228
229int des_read_pw(char *buf, char *buff, int size, const char *prompt, int verify)
230 {
231 memset(buf,0,size);
232 memset(buff,0,size);
233 return(0);
234 }
235
236#elif defined(OPENSSL_SYS_WIN16)
237
238int des_read_pw(char *buf, char *buff, int size, char *prompt, int verify)
239 {
240 memset(buf,0,size);
241 memset(buff,0,size);
242 return(0);
243 }
244
245#else /* !OPENSSL_SYS_WINCE && !OPENSSL_SYS_WIN16 */
246
247static void read_till_nl(FILE *in)
248 {
249#define SIZE 4
250 char buf[SIZE+1];
251
252 do {
253 fgets(buf,SIZE,in);
254 } while (strchr(buf,'\n') == NULL);
255 }
256
257
258/* return 0 if ok, 1 (or -1) otherwise */
259int des_read_pw(char *buf, char *buff, int size, const char *prompt,
260 int verify)
261 {
262#ifdef OPENSSL_SYS_VMS
263 struct IOSB iosb;
264 $DESCRIPTOR(terminal,"TT");
265 long tty_orig[3], tty_new[3];
266 long status;
267 unsigned short channel = 0;
268#else
269#if !defined(OPENSSL_SYS_MSDOS) || defined(__DJGPP__)
270 TTY_STRUCT tty_orig,tty_new;
271#endif
272#endif
273 int number;
274 int ok;
275 /* statics are simply to avoid warnings about longjmp clobbering
276 things */
277 static int ps;
278 int is_a_tty;
279 static FILE *tty;
280 char *p;
281
282 if (setjmp(save))
283 {
284 ok=0;
285 goto error;
286 }
287
288 number=5;
289 ok=0;
290 ps=0;
291 is_a_tty=1;
292 tty=NULL;
293
294#ifdef OPENSSL_SYS_MSDOS
295 if ((tty=fopen("con","r")) == NULL)
296 tty=stdin;
297#elif defined(MAC_OS_pre_X) || defined(OPENSSL_SYS_VXWORKS)
298 tty=stdin;
299#else
300#ifndef OPENSSL_SYS_MPE
301 if ((tty=fopen("/dev/tty","r")) == NULL)
302#endif
303 tty=stdin;
304#endif
305
306#if defined(TTY_get) && !defined(OPENSSL_SYS_VMS)
307 if (TTY_get(fileno(tty),&tty_orig) == -1)
308 {
309#ifdef ENOTTY
310 if (errno == ENOTTY)
311 is_a_tty=0;
312 else
313#endif
314#ifdef EINVAL
315 /* Ariel Glenn ariel@columbia.edu reports that solaris
316 * can return EINVAL instead. This should be ok */
317 if (errno == EINVAL)
318 is_a_tty=0;
319 else
320#endif
321 return(-1);
322 }
323 memcpy(&(tty_new),&(tty_orig),sizeof(tty_orig));
324#endif
325#ifdef OPENSSL_SYS_VMS
326 status = sys$assign(&terminal,&channel,0,0);
327 if (status != SS$_NORMAL)
328 return(-1);
329 status=sys$qiow(0,channel,IO$_SENSEMODE,&iosb,0,0,tty_orig,12,0,0,0,0);
330 if ((status != SS$_NORMAL) || (iosb.iosb$w_value != SS$_NORMAL))
331 return(-1);
332#endif
333
334 pushsig();
335 ps=1;
336
337#ifdef TTY_FLAGS
338 tty_new.TTY_FLAGS &= ~ECHO;
339#endif
340
341#if defined(TTY_set) && !defined(OPENSSL_SYS_VMS)
342 if (is_a_tty && (TTY_set(fileno(tty),&tty_new) == -1))
343#ifdef OPENSSL_SYS_MPE
344 ; /* MPE lies -- echo really has been disabled */
345#else
346 return(-1);
347#endif
348#endif
349#ifdef OPENSSL_SYS_VMS
350 tty_new[0] = tty_orig[0];
351 tty_new[1] = tty_orig[1] | TT$M_NOECHO;
352 tty_new[2] = tty_orig[2];
353 status = sys$qiow(0,channel,IO$_SETMODE,&iosb,0,0,tty_new,12,0,0,0,0);
354 if ((status != SS$_NORMAL) || (iosb.iosb$w_value != SS$_NORMAL))
355 return(-1);
356#endif
357 ps=2;
358
359 while ((!ok) && (number--))
360 {
361 fputs(prompt,stderr);
362 fflush(stderr);
363
364 buf[0]='\0';
365 fgets(buf,size,tty);
366 if (feof(tty)) goto error;
367 if (ferror(tty)) goto error;
368 if ((p=(char *)strchr(buf,'\n')) != NULL)
369 *p='\0';
370 else read_till_nl(tty);
371 if (verify)
372 {
373 fprintf(stderr,"\nVerifying password - %s",prompt);
374 fflush(stderr);
375 buff[0]='\0';
376 fgets(buff,size,tty);
377 if (feof(tty)) goto error;
378 if ((p=(char *)strchr(buff,'\n')) != NULL)
379 *p='\0';
380 else read_till_nl(tty);
381
382 if (strcmp(buf,buff) != 0)
383 {
384 fprintf(stderr,"\nVerify failure");
385 fflush(stderr);
386 break;
387 /* continue; */
388 }
389 }
390 ok=1;
391 }
392
393error:
394 fprintf(stderr,"\n");
395#if 0
396 perror("fgets(tty)");
397#endif
398 /* What can we do if there is an error? */
399#if defined(TTY_set) && !defined(OPENSSL_SYS_VMS)
400 if (ps >= 2) TTY_set(fileno(tty),&tty_orig);
401#endif
402#ifdef OPENSSL_SYS_VMS
403 if (ps >= 2)
404 status = sys$qiow(0,channel,IO$_SETMODE,&iosb,0,0
405 ,tty_orig,12,0,0,0,0);
406#endif
407
408 if (ps >= 1) popsig();
409 if (stdin != tty) fclose(tty);
410#ifdef OPENSSL_SYS_VMS
411 status = sys$dassgn(channel);
412#endif
413 return(!ok);
414 }
415
416static void pushsig(void)
417 {
418 int i;
419#ifdef SIGACTION
420 struct sigaction sa;
421
422 memset(&sa,0,sizeof sa);
423 sa.sa_handler=recsig;
424#endif
425
426 for (i=1; i<NX509_SIG; i++)
427 {
428#ifdef SIGUSR1
429 if (i == SIGUSR1)
430 continue;
431#endif
432#ifdef SIGUSR2
433 if (i == SIGUSR2)
434 continue;
435#endif
436#ifdef SIGACTION
437 sigaction(i,&sa,&savsig[i]);
438#else
439 savsig[i]=signal(i,recsig);
440#endif
441 }
442
443#ifdef SIGWINCH
444 signal(SIGWINCH,SIG_DFL);
445#endif
446 }
447
448static void popsig(void)
449 {
450 int i;
451
452 for (i=1; i<NX509_SIG; i++)
453 {
454#ifdef SIGUSR1
455 if (i == SIGUSR1)
456 continue;
457#endif
458#ifdef SIGUSR2
459 if (i == SIGUSR2)
460 continue;
461#endif
462#ifdef SIGACTION
463 sigaction(i,&savsig[i],NULL);
464#else
465 signal(i,savsig[i]);
466#endif
467 }
468 }
469
470static void recsig(int i)
471 {
472 longjmp(save,1);
473#ifdef LINT
474 i=i;
475#endif
476 }
477
478#ifdef OPENSSL_SYS_MSDOS
479static int noecho_fgets(char *buf, int size, FILE *tty)
480 {
481 int i;
482 char *p;
483
484 p=buf;
485 for (;;)
486 {
487 if (size == 0)
488 {
489 *p='\0';
490 break;
491 }
492 size--;
493#ifdef WIN16TTY
494 i=_inchar();
495#else
496 i=getch();
497#endif
498 if (i == '\r') i='\n';
499 *(p++)=i;
500 if (i == '\n')
501 {
502 *p='\0';
503 break;
504 }
505 }
506#ifdef WIN_CONSOLE_BUG
507/* Win95 has several evil console bugs: one of these is that the
508 * last character read using getch() is passed to the next read: this is
509 * usually a CR so this can be trouble. No STDIO fix seems to work but
510 * flushing the console appears to do the trick.
511 */
512 {
513 HANDLE inh;
514 inh = GetStdHandle(STD_INPUT_HANDLE);
515 FlushConsoleInputBuffer(inh);
516 }
517#endif
518 return(strlen(buf));
519 }
520#endif
521#endif /* !OPENSSL_SYS_WINCE && !WIN16 */
diff --git a/src/lib/libcrypto/des/rpc_des.h b/src/lib/libcrypto/des/rpc_des.h
new file mode 100644
index 0000000000..8263c512ab
--- /dev/null
+++ b/src/lib/libcrypto/des/rpc_des.h
@@ -0,0 +1,133 @@
1/* crypto/des/rpc_des.h */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
59/* @(#)des.h 2.2 88/08/10 4.0 RPCSRC; from 2.7 88/02/08 SMI */
60/*
61 * Copyright (c) 2010, Oracle America, Inc.
62 *
63 * Redistribution and use in source and binary forms, with or without
64 * modification, are permitted provided that the following conditions are
65 * met:
66 *
67 * * Redistributions of source code must retain the above copyright
68 * notice, this list of conditions and the following disclaimer.
69 * * Redistributions in binary form must reproduce the above
70 * copyright notice, this list of conditions and the following
71 * disclaimer in the documentation and/or other materials
72 * provided with the distribution.
73 * * Neither the name of the "Oracle America, Inc." nor the names of its
74 * contributors may be used to endorse or promote products derived
75 * from this software without specific prior written permission.
76 *
77 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
78 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
79 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
80 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
81 * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
82 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
83 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
84 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
85 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
86 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
87 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
88 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
89 */
90
91/*
92 * Generic DES driver interface
93 * Keep this file hardware independent!
94 */
95
96#define DES_MAXLEN 65536 /* maximum # of bytes to encrypt */
97#define DES_QUICKLEN 16 /* maximum # of bytes to encrypt quickly */
98
99#ifdef HEADER_DES_H
100#undef ENCRYPT
101#undef DECRYPT
102#endif
103
104enum desdir { ENCRYPT, DECRYPT };
105enum desmode { CBC, ECB };
106
107/*
108 * parameters to ioctl call
109 */
110struct desparams {
111 unsigned char des_key[8]; /* key (with low bit parity) */
112 enum desdir des_dir; /* direction */
113 enum desmode des_mode; /* mode */
114 unsigned char des_ivec[8]; /* input vector */
115 unsigned des_len; /* number of bytes to crypt */
116 union {
117 unsigned char UDES_data[DES_QUICKLEN];
118 unsigned char *UDES_buf;
119 } UDES;
120# define des_data UDES.UDES_data /* direct data here if quick */
121# define des_buf UDES.UDES_buf /* otherwise, pointer to data */
122};
123
124/*
125 * Encrypt an arbitrary sized buffer
126 */
127#define DESIOCBLOCK _IOWR('d', 6, struct desparams)
128
129/*
130 * Encrypt of small amount of data, quickly
131 */
132#define DESIOCQUICK _IOWR('d', 7, struct desparams)
133
diff --git a/src/lib/libcrypto/des/rpc_enc.c b/src/lib/libcrypto/des/rpc_enc.c
new file mode 100644
index 0000000000..d937d08da5
--- /dev/null
+++ b/src/lib/libcrypto/des/rpc_enc.c
@@ -0,0 +1,98 @@
1/* crypto/des/rpc_enc.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
59#include "rpc_des.h"
60#include "des_locl.h"
61#include "des_ver.h"
62
63int _des_crypt(char *buf,int len,struct desparams *desp);
64int _des_crypt(char *buf, int len, struct desparams *desp)
65 {
66 DES_key_schedule ks;
67 int enc;
68
69 DES_set_key_unchecked(&desp->des_key,&ks);
70 enc=(desp->des_dir == ENCRYPT)?DES_ENCRYPT:DES_DECRYPT;
71
72 if (desp->des_mode == CBC)
73 DES_ecb_encrypt((const_DES_cblock *)desp->UDES.UDES_buf,
74 (DES_cblock *)desp->UDES.UDES_buf,&ks,
75 enc);
76 else
77 {
78 DES_ncbc_encrypt(desp->UDES.UDES_buf,desp->UDES.UDES_buf,
79 len,&ks,&desp->des_ivec,enc);
80#ifdef undef
81 /* len will always be %8 if called from common_crypt
82 * in secure_rpc.
83 * Libdes's cbc encrypt does not copy back the iv,
84 * so we have to do it here. */
85 /* It does now :-) eay 20/09/95 */
86
87 a=(char *)&(desp->UDES.UDES_buf[len-8]);
88 b=(char *)&(desp->des_ivec[0]);
89
90 *(a++)= *(b++); *(a++)= *(b++);
91 *(a++)= *(b++); *(a++)= *(b++);
92 *(a++)= *(b++); *(a++)= *(b++);
93 *(a++)= *(b++); *(a++)= *(b++);
94#endif
95 }
96 return(1);
97 }
98
diff --git a/src/lib/libcrypto/des/rpw.c b/src/lib/libcrypto/des/rpw.c
new file mode 100644
index 0000000000..8a9473c4f9
--- /dev/null
+++ b/src/lib/libcrypto/des/rpw.c
@@ -0,0 +1,99 @@
1/* crypto/des/rpw.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
59#include <stdio.h>
60#include <openssl/des.h>
61
62int main(int argc, char *argv[])
63 {
64 DES_cblock k,k1;
65 int i;
66
67 printf("read passwd\n");
68 if ((i=des_read_password(&k,"Enter password:",0)) == 0)
69 {
70 printf("password = ");
71 for (i=0; i<8; i++)
72 printf("%02x ",k[i]);
73 }
74 else
75 printf("error %d\n",i);
76 printf("\n");
77 printf("read 2passwds and verify\n");
78 if ((i=des_read_2passwords(&k,&k1,
79 "Enter verified password:",1)) == 0)
80 {
81 printf("password1 = ");
82 for (i=0; i<8; i++)
83 printf("%02x ",k[i]);
84 printf("\n");
85 printf("password2 = ");
86 for (i=0; i<8; i++)
87 printf("%02x ",k1[i]);
88 printf("\n");
89 exit(1);
90 }
91 else
92 {
93 printf("error %d\n",i);
94 exit(0);
95 }
96#ifdef LINT
97 return(0);
98#endif
99 }
diff --git a/src/lib/libcrypto/des/set_key.c b/src/lib/libcrypto/des/set_key.c
index da4d62e112..d3e69ca8b5 100644
--- a/src/lib/libcrypto/des/set_key.c
+++ b/src/lib/libcrypto/des/set_key.c
@@ -63,9 +63,10 @@
63 * 1.1 added norm_expand_bits 63 * 1.1 added norm_expand_bits
64 * 1.0 First working version 64 * 1.0 First working version
65 */ 65 */
66#include <openssl/crypto.h>
67#include "des_locl.h" 66#include "des_locl.h"
68 67
68#include <openssl/crypto.h>
69
69OPENSSL_IMPLEMENT_GLOBAL(int,DES_check_key,0) /* defaults to false */ 70OPENSSL_IMPLEMENT_GLOBAL(int,DES_check_key,0) /* defaults to false */
70 71
71static const unsigned char odd_parity[256]={ 72static const unsigned char odd_parity[256]={
diff --git a/src/lib/libcrypto/des/speed.c b/src/lib/libcrypto/des/speed.c
new file mode 100644
index 0000000000..1616f4b7c9
--- /dev/null
+++ b/src/lib/libcrypto/des/speed.c
@@ -0,0 +1,314 @@
1/* crypto/des/speed.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
59/* 11-Sep-92 Andrew Daviel Support for Silicon Graphics IRIX added */
60/* 06-Apr-92 Luke Brennan Support for VMS and add extra signal calls */
61
62#if !defined(OPENSSL_SYS_MSDOS) && (!defined(OPENSSL_SYS_VMS) || defined(__DECC)) && !defined(OPENSSL_SYS_MACOSX)
63#define TIMES
64#endif
65
66#include <stdio.h>
67
68#include <openssl/e_os2.h>
69#include OPENSSL_UNISTD_IO
70OPENSSL_DECLARE_EXIT
71
72#ifndef OPENSSL_SYS_NETWARE
73#include <signal.h>
74#define crypt(c,s) (des_crypt((c),(s)))
75#endif
76
77#ifndef _IRIX
78#include <time.h>
79#endif
80#ifdef TIMES
81#include <sys/types.h>
82#include <sys/times.h>
83#endif
84
85/* Depending on the VMS version, the tms structure is perhaps defined.
86 The __TMS macro will show if it was. If it wasn't defined, we should
87 undefine TIMES, since that tells the rest of the program how things
88 should be handled. -- Richard Levitte */
89#if defined(OPENSSL_SYS_VMS_DECC) && !defined(__TMS)
90#undef TIMES
91#endif
92
93#ifndef TIMES
94#include <sys/timeb.h>
95#endif
96
97#if defined(sun) || defined(__ultrix)
98#define _POSIX_SOURCE
99#include <limits.h>
100#include <sys/param.h>
101#endif
102
103#include <openssl/des.h>
104
105/* The following if from times(3) man page. It may need to be changed */
106#ifndef HZ
107# ifndef CLK_TCK
108# ifndef _BSD_CLK_TCK_ /* FreeBSD fix */
109# define HZ 100.0
110# else /* _BSD_CLK_TCK_ */
111# define HZ ((double)_BSD_CLK_TCK_)
112# endif
113# else /* CLK_TCK */
114# define HZ ((double)CLK_TCK)
115# endif
116#endif
117
118#define BUFSIZE ((long)1024)
119long run=0;
120
121double Time_F(int s);
122#ifdef SIGALRM
123#if defined(__STDC__) || defined(sgi) || defined(_AIX)
124#define SIGRETTYPE void
125#else
126#define SIGRETTYPE int
127#endif
128
129SIGRETTYPE sig_done(int sig);
130SIGRETTYPE sig_done(int sig)
131 {
132 signal(SIGALRM,sig_done);
133 run=0;
134#ifdef LINT
135 sig=sig;
136#endif
137 }
138#endif
139
140#define START 0
141#define STOP 1
142
143double Time_F(int s)
144 {
145 double ret;
146#ifdef TIMES
147 static struct tms tstart,tend;
148
149 if (s == START)
150 {
151 times(&tstart);
152 return(0);
153 }
154 else
155 {
156 times(&tend);
157 ret=((double)(tend.tms_utime-tstart.tms_utime))/HZ;
158 return((ret == 0.0)?1e-6:ret);
159 }
160#else /* !times() */
161 static struct timeb tstart,tend;
162 long i;
163
164 if (s == START)
165 {
166 ftime(&tstart);
167 return(0);
168 }
169 else
170 {
171 ftime(&tend);
172 i=(long)tend.millitm-(long)tstart.millitm;
173 ret=((double)(tend.time-tstart.time))+((double)i)/1e3;
174 return((ret == 0.0)?1e-6:ret);
175 }
176#endif
177 }
178
179int main(int argc, char **argv)
180 {
181 long count;
182 static unsigned char buf[BUFSIZE];
183 static DES_cblock key ={0x12,0x34,0x56,0x78,0x9a,0xbc,0xde,0xf0};
184 static DES_cblock key2={0x34,0x56,0x78,0x9a,0xbc,0xde,0xf0,0x12};
185 static DES_cblock key3={0x56,0x78,0x9a,0xbc,0xde,0xf0,0x12,0x34};
186 DES_key_schedule sch,sch2,sch3;
187 double a,b,c,d,e;
188#ifndef SIGALRM
189 long ca,cb,cc,cd,ce;
190#endif
191
192#ifndef TIMES
193 printf("To get the most accurate results, try to run this\n");
194 printf("program when this computer is idle.\n");
195#endif
196
197 DES_set_key_unchecked(&key2,&sch2);
198 DES_set_key_unchecked(&key3,&sch3);
199
200#ifndef SIGALRM
201 printf("First we calculate the approximate speed ...\n");
202 DES_set_key_unchecked(&key,&sch);
203 count=10;
204 do {
205 long i;
206 DES_LONG data[2];
207
208 count*=2;
209 Time_F(START);
210 for (i=count; i; i--)
211 DES_encrypt1(data,&sch,DES_ENCRYPT);
212 d=Time_F(STOP);
213 } while (d < 3.0);
214 ca=count;
215 cb=count*3;
216 cc=count*3*8/BUFSIZE+1;
217 cd=count*8/BUFSIZE+1;
218 ce=count/20+1;
219 printf("Doing set_key %ld times\n",ca);
220#define COND(d) (count != (d))
221#define COUNT(d) (d)
222#else
223#define COND(c) (run)
224#define COUNT(d) (count)
225 signal(SIGALRM,sig_done);
226 printf("Doing set_key for 10 seconds\n");
227 alarm(10);
228#endif
229
230 Time_F(START);
231 for (count=0,run=1; COND(ca); count++)
232 DES_set_key_unchecked(&key,&sch);
233 d=Time_F(STOP);
234 printf("%ld set_key's in %.2f seconds\n",count,d);
235 a=((double)COUNT(ca))/d;
236
237#ifdef SIGALRM
238 printf("Doing DES_encrypt's for 10 seconds\n");
239 alarm(10);
240#else
241 printf("Doing DES_encrypt %ld times\n",cb);
242#endif
243 Time_F(START);
244 for (count=0,run=1; COND(cb); count++)
245 {
246 DES_LONG data[2];
247
248 DES_encrypt1(data,&sch,DES_ENCRYPT);
249 }
250 d=Time_F(STOP);
251 printf("%ld DES_encrypt's in %.2f second\n",count,d);
252 b=((double)COUNT(cb)*8)/d;
253
254#ifdef SIGALRM
255 printf("Doing DES_cbc_encrypt on %ld byte blocks for 10 seconds\n",
256 BUFSIZE);
257 alarm(10);
258#else
259 printf("Doing DES_cbc_encrypt %ld times on %ld byte blocks\n",cc,
260 BUFSIZE);
261#endif
262 Time_F(START);
263 for (count=0,run=1; COND(cc); count++)
264 DES_ncbc_encrypt(buf,buf,BUFSIZE,&sch,
265 &key,DES_ENCRYPT);
266 d=Time_F(STOP);
267 printf("%ld DES_cbc_encrypt's of %ld byte blocks in %.2f second\n",
268 count,BUFSIZE,d);
269 c=((double)COUNT(cc)*BUFSIZE)/d;
270
271#ifdef SIGALRM
272 printf("Doing DES_ede_cbc_encrypt on %ld byte blocks for 10 seconds\n",
273 BUFSIZE);
274 alarm(10);
275#else
276 printf("Doing DES_ede_cbc_encrypt %ld times on %ld byte blocks\n",cd,
277 BUFSIZE);
278#endif
279 Time_F(START);
280 for (count=0,run=1; COND(cd); count++)
281 DES_ede3_cbc_encrypt(buf,buf,BUFSIZE,
282 &sch,
283 &sch2,
284 &sch3,
285 &key,
286 DES_ENCRYPT);
287 d=Time_F(STOP);
288 printf("%ld DES_ede_cbc_encrypt's of %ld byte blocks in %.2f second\n",
289 count,BUFSIZE,d);
290 d=((double)COUNT(cd)*BUFSIZE)/d;
291
292#ifdef SIGALRM
293 printf("Doing crypt for 10 seconds\n");
294 alarm(10);
295#else
296 printf("Doing crypt %ld times\n",ce);
297#endif
298 Time_F(START);
299 for (count=0,run=1; COND(ce); count++)
300 crypt("testing1","ef");
301 e=Time_F(STOP);
302 printf("%ld crypts in %.2f second\n",count,e);
303 e=((double)COUNT(ce))/e;
304
305 printf("set_key per sec = %12.2f (%9.3fuS)\n",a,1.0e6/a);
306 printf("DES raw ecb bytes per sec = %12.2f (%9.3fuS)\n",b,8.0e6/b);
307 printf("DES cbc bytes per sec = %12.2f (%9.3fuS)\n",c,8.0e6/c);
308 printf("DES ede cbc bytes per sec = %12.2f (%9.3fuS)\n",d,8.0e6/d);
309 printf("crypt per sec = %12.2f (%9.3fuS)\n",e,1.0e6/e);
310 exit(0);
311#if defined(LINT) || defined(OPENSSL_SYS_MSDOS)
312 return(0);
313#endif
314 }
diff --git a/src/lib/libcrypto/des/str2key.c b/src/lib/libcrypto/des/str2key.c
index 1077f99d1b..9c2054bda6 100644
--- a/src/lib/libcrypto/des/str2key.c
+++ b/src/lib/libcrypto/des/str2key.c
@@ -56,8 +56,8 @@
56 * [including the GNU Public Licence.] 56 * [including the GNU Public Licence.]
57 */ 57 */
58 58
59#include <openssl/crypto.h>
60#include "des_locl.h" 59#include "des_locl.h"
60#include <openssl/crypto.h>
61 61
62void DES_string_to_key(const char *str, DES_cblock *key) 62void DES_string_to_key(const char *str, DES_cblock *key)
63 { 63 {
diff --git a/src/lib/libcrypto/des/t/test b/src/lib/libcrypto/des/t/test
new file mode 100644
index 0000000000..97acd0552e
--- /dev/null
+++ b/src/lib/libcrypto/des/t/test
@@ -0,0 +1,27 @@
1#!./perl
2
3BEGIN { push(@INC, qw(../../../lib ../../lib ../lib lib)); }
4
5use DES;
6
7$key='00000000';
8$ks=DES::set_key($key);
9@a=split(//,$ks);
10foreach (@a) { printf "%02x-",ord($_); }
11print "\n";
12
13
14$key=DES::random_key();
15print "($_)\n";
16@a=split(//,$key);
17foreach (@a) { printf "%02x-",ord($_); }
18print "\n";
19$str="this is and again into the breach";
20($k1,$k2)=DES::string_to_2keys($str);
21@a=split(//,$k1);
22foreach (@a) { printf "%02x-",ord($_); }
23print "\n";
24@a=split(//,$k2);
25foreach (@a) { printf "%02x-",ord($_); }
26print "\n";
27
diff --git a/src/lib/libcrypto/des/times/486-50.sol b/src/lib/libcrypto/des/times/486-50.sol
new file mode 100644
index 0000000000..0de62d6db3
--- /dev/null
+++ b/src/lib/libcrypto/des/times/486-50.sol
@@ -0,0 +1,16 @@
1Solaris 2.4, 486 50mhz, gcc 2.6.3
2options des ecb/s
316 r2 i 43552.51 100.0%
416 r1 i 43487.45 99.9%
516 c p 43003.23 98.7%
616 r2 p 42339.00 97.2%
716 c i 41900.91 96.2%
816 r1 p 41360.64 95.0%
9 4 c i 38728.48 88.9%
10 4 c p 38225.63 87.8%
11 4 r1 i 38085.79 87.4%
12 4 r2 i 37825.64 86.9%
13 4 r2 p 34611.00 79.5%
14 4 r1 p 31802.00 73.0%
15-DDES_UNROLL -DDES_RISC2
16
diff --git a/src/lib/libcrypto/des/times/586-100.lnx b/src/lib/libcrypto/des/times/586-100.lnx
new file mode 100644
index 0000000000..4323914a11
--- /dev/null
+++ b/src/lib/libcrypto/des/times/586-100.lnx
@@ -0,0 +1,20 @@
1Pentium 100
2Linux 2 kernel
3gcc 2.7.0 -O3 -fomit-frame-pointer
4No X server running, just a console, it makes the top speed jump from 151,000
5to 158,000 :-).
6options des ecb/s
7assember 281000.00 177.1%
816 r1 p 158667.40 100.0%
916 r1 i 148471.70 93.6%
1016 r2 p 143961.80 90.7%
1116 r2 i 141689.20 89.3%
12 4 r1 i 140100.00 88.3%
13 4 r2 i 134049.40 84.5%
1416 c i 124145.20 78.2%
1516 c p 121584.20 76.6%
16 4 c i 118116.00 74.4%
17 4 r2 p 117977.90 74.4%
18 4 c p 114971.40 72.5%
19 4 r1 p 114578.40 72.2%
20-DDES_UNROLL -DDES_RISC1 -DDES_PTR
diff --git a/src/lib/libcrypto/des/times/686-200.fre b/src/lib/libcrypto/des/times/686-200.fre
new file mode 100644
index 0000000000..7d83f6adee
--- /dev/null
+++ b/src/lib/libcrypto/des/times/686-200.fre
@@ -0,0 +1,18 @@
1Pentium 100
2Free BSD 2.1.5 kernel
3gcc 2.7.2.2 -O3 -fomit-frame-pointer
4options des ecb/s
5assember 578000.00 133.1%
616 r2 i 434454.80 100.0%
716 r1 i 433621.43 99.8%
816 r2 p 431375.69 99.3%
9 4 r1 i 423722.30 97.5%
10 4 r2 i 422399.40 97.2%
1116 r1 p 421739.40 97.1%
1216 c i 399027.94 91.8%
1316 c p 372251.70 85.7%
14 4 c i 365118.35 84.0%
15 4 c p 352880.51 81.2%
16 4 r2 p 255104.90 58.7%
17 4 r1 p 251289.18 57.8%
18-DDES_UNROLL -DDES_RISC2
diff --git a/src/lib/libcrypto/des/times/aix.cc b/src/lib/libcrypto/des/times/aix.cc
new file mode 100644
index 0000000000..d96b74e2ce
--- /dev/null
+++ b/src/lib/libcrypto/des/times/aix.cc
@@ -0,0 +1,26 @@
1From: Paco Garcia <pgarcia@cam.es>
2
3This machine is a Bull Estrella Minitower Model MT604-100
4Processor : PPC604
5P.Speed : 100Mhz
6Data/Instr Cache : 16 K
7L2 Cache : 256 K
8PCI BUS Speed : 33 Mhz
9TransfRate PCI : 132 MB/s
10Memory : 96 MB
11
12options des ecb/s
13 4 c p 275118.61 100.0%
14 4 c i 273545.07 99.4%
15 4 r2 p 270441.02 98.3%
16 4 r1 p 253052.15 92.0%
17 4 r2 i 240842.97 87.5%
18 4 r1 i 240556.66 87.4%
1916 c i 224603.99 81.6%
2016 c p 224483.98 81.6%
2116 r2 p 215691.19 78.4%
2216 r1 p 208332.83 75.7%
2316 r1 i 199206.50 72.4%
2416 r2 i 198963.70 72.3%
25-DDES_PTR
26
diff --git a/src/lib/libcrypto/des/times/alpha.cc b/src/lib/libcrypto/des/times/alpha.cc
new file mode 100644
index 0000000000..95c17efae7
--- /dev/null
+++ b/src/lib/libcrypto/des/times/alpha.cc
@@ -0,0 +1,18 @@
1cc -O2
2DES_LONG is 'unsigned int'
3
4options des ecb/s
5 4 r2 p 181146.14 100.0%
616 r2 p 172102.94 95.0%
7 4 r2 i 165424.11 91.3%
816 c p 160468.64 88.6%
9 4 c p 156653.59 86.5%
10 4 c i 155245.18 85.7%
11 4 r1 p 154729.68 85.4%
1216 r2 i 154137.69 85.1%
1316 r1 p 152357.96 84.1%
1416 c i 148743.91 82.1%
15 4 r1 i 146695.59 81.0%
1616 r1 i 144961.00 80.0%
17-DDES_RISC2 -DDES_PTR
18
diff --git a/src/lib/libcrypto/des/times/hpux.cc b/src/lib/libcrypto/des/times/hpux.cc
new file mode 100644
index 0000000000..3de856ddac
--- /dev/null
+++ b/src/lib/libcrypto/des/times/hpux.cc
@@ -0,0 +1,17 @@
1HPUX 10 - 9000/887 - cc -D_HPUX_SOURCE -Aa +ESlit +O2 -Wl,-a,archive
2
3options des ecb/s
416 c i 149448.90 100.0%
5 4 c i 145861.79 97.6%
616 r2 i 141710.96 94.8%
716 r1 i 139455.33 93.3%
8 4 r2 i 138800.00 92.9%
9 4 r1 i 136692.65 91.5%
1016 r2 p 110228.17 73.8%
1116 r1 p 109397.07 73.2%
1216 c p 109209.89 73.1%
13 4 c p 108014.71 72.3%
14 4 r2 p 107873.88 72.2%
15 4 r1 p 107685.83 72.1%
16-DDES_UNROLL
17
diff --git a/src/lib/libcrypto/des/times/sparc.gcc b/src/lib/libcrypto/des/times/sparc.gcc
new file mode 100644
index 0000000000..8eaa042104
--- /dev/null
+++ b/src/lib/libcrypto/des/times/sparc.gcc
@@ -0,0 +1,17 @@
1solaris 2.5.1 - sparc 10 50mhz - gcc 2.7.2
2
3options des ecb/s
416 c i 124382.70 100.0%
5 4 c i 118884.68 95.6%
616 c p 112261.20 90.3%
716 r2 i 111777.10 89.9%
816 r2 p 108896.30 87.5%
916 r1 p 108791.59 87.5%
10 4 c p 107290.10 86.3%
11 4 r1 p 104583.80 84.1%
1216 r1 i 104206.20 83.8%
13 4 r2 p 103709.80 83.4%
14 4 r2 i 98306.43 79.0%
15 4 r1 i 91525.80 73.6%
16-DDES_UNROLL
17
diff --git a/src/lib/libcrypto/des/times/usparc.cc b/src/lib/libcrypto/des/times/usparc.cc
new file mode 100644
index 0000000000..0864285ef6
--- /dev/null
+++ b/src/lib/libcrypto/des/times/usparc.cc
@@ -0,0 +1,31 @@
1solaris 2.5.1 usparc 167mhz?? - SC4.0 cc -fast -Xa -xO5
2
3For the ultra sparc, SunC 4.0 cc -fast -Xa -xO5, running 'des_opts'
4gives a speed of 475,000 des/s while 'speed' gives 417,000 des/s.
5I believe the difference is tied up in optimisation that the compiler
6is able to perform when the code is 'inlined'. For 'speed', the DES
7routines are being linked from a library. I'll record the higher
8speed since if performance is everything, you can always inline
9'des_enc.c'.
10
11[ 16-Jan-06 - I've been playing with the
12 '-xtarget=ultra -xarch=v8plus -Xa -xO5 -Xa'
13 and while it makes the des_opts numbers much slower, it makes the
14 actual 'speed' numbers look better which is a realistic version of
15 using the libraries. ]
16
17options des ecb/s
1816 r1 p 475516.90 100.0%
1916 r2 p 439388.10 92.4%
2016 c i 427001.40 89.8%
2116 c p 419516.50 88.2%
22 4 r2 p 409491.70 86.1%
23 4 r1 p 404266.90 85.0%
24 4 c p 398121.00 83.7%
25 4 c i 370588.40 77.9%
26 4 r1 i 362742.20 76.3%
2716 r2 i 331275.50 69.7%
2816 r1 i 324730.60 68.3%
29 4 r2 i 63535.10 13.4% <-- very very weird, must be cache problems.
30-DDES_UNROLL -DDES_RISC1 -DDES_PTR
31
diff --git a/src/lib/libcrypto/des/typemap b/src/lib/libcrypto/des/typemap
new file mode 100644
index 0000000000..a524f53634
--- /dev/null
+++ b/src/lib/libcrypto/des/typemap
@@ -0,0 +1,34 @@
1#
2# DES SECTION
3#
4deschar * T_DESCHARP
5des_cblock * T_CBLOCK
6des_cblock T_CBLOCK
7des_key_schedule T_SCHEDULE
8des_key_schedule * T_SCHEDULE
9
10INPUT
11T_CBLOCK
12 $var=(des_cblock *)SvPV($arg,len);
13 if (len < DES_KEY_SZ)
14 {
15 croak(\"$var needs to be at least %u bytes long\",DES_KEY_SZ);
16 }
17
18T_SCHEDULE
19 $var=(des_key_schedule *)SvPV($arg,len);
20 if (len < DES_SCHEDULE_SZ)
21 {
22 croak(\"$var needs to be at least %u bytes long\",
23 DES_SCHEDULE_SZ);
24 }
25
26OUTPUT
27T_CBLOCK
28 sv_setpvn($arg,(char *)$var,DES_KEY_SZ);
29
30T_SCHEDULE
31 sv_setpvn($arg,(char *)$var,DES_SCHEDULE_SZ);
32
33T_DESCHARP
34 sv_setpvn($arg,(char *)$var,len);
diff --git a/src/lib/libcrypto/dh/Makefile b/src/lib/libcrypto/dh/Makefile
new file mode 100644
index 0000000000..f23b4f7fde
--- /dev/null
+++ b/src/lib/libcrypto/dh/Makefile
@@ -0,0 +1,180 @@
1#
2# OpenSSL/crypto/dh/Makefile
3#
4
5DIR= dh
6TOP= ../..
7CC= cc
8INCLUDES= -I.. -I$(TOP) -I../../include
9CFLAG=-g
10MAKEFILE= Makefile
11AR= ar r
12
13CFLAGS= $(INCLUDES) $(CFLAG)
14
15GENERAL=Makefile
16TEST= dhtest.c
17APPS=
18
19LIB=$(TOP)/libcrypto.a
20LIBSRC= dh_asn1.c dh_gen.c dh_key.c dh_lib.c dh_check.c dh_err.c dh_depr.c \
21 dh_ameth.c dh_pmeth.c dh_prn.c
22LIBOBJ= dh_asn1.o dh_gen.o dh_key.o dh_lib.o dh_check.o dh_err.o dh_depr.o \
23 dh_ameth.o dh_pmeth.o dh_prn.o
24
25SRC= $(LIBSRC)
26
27EXHEADER= dh.h
28HEADER= $(EXHEADER)
29
30ALL= $(GENERAL) $(SRC) $(HEADER)
31
32top:
33 (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all)
34
35all: lib
36
37lib: $(LIBOBJ)
38 $(AR) $(LIB) $(LIBOBJ)
39 $(RANLIB) $(LIB) || echo Never mind.
40 @touch lib
41
42files:
43 $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
44
45links:
46 @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
47 @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
48 @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
49
50install:
51 @[ -n "$(INSTALLTOP)" ] # should be set by top Makefile...
52 @headerlist="$(EXHEADER)"; for i in $$headerlist ; \
53 do \
54 (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
55 chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
56 done;
57
58tags:
59 ctags $(SRC)
60
61tests:
62
63lint:
64 lint -DLINT $(INCLUDES) $(SRC)>fluff
65
66depend:
67 @[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile...
68 $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
69
70dclean:
71 $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
72 mv -f Makefile.new $(MAKEFILE)
73
74clean:
75 rm -f *.o */*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
76
77# DO NOT DELETE THIS LINE -- make depend depends on it.
78
79dh_ameth.o: ../../e_os.h ../../include/openssl/asn1.h
80dh_ameth.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
81dh_ameth.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
82dh_ameth.o: ../../include/openssl/dh.h ../../include/openssl/e_os2.h
83dh_ameth.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
84dh_ameth.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
85dh_ameth.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
86dh_ameth.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
87dh_ameth.o: ../../include/openssl/opensslconf.h
88dh_ameth.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
89dh_ameth.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
90dh_ameth.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
91dh_ameth.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
92dh_ameth.o: ../../include/openssl/x509_vfy.h ../asn1/asn1_locl.h ../cryptlib.h
93dh_ameth.o: dh_ameth.c
94dh_asn1.o: ../../e_os.h ../../include/openssl/asn1.h
95dh_asn1.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
96dh_asn1.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
97dh_asn1.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
98dh_asn1.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
99dh_asn1.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
100dh_asn1.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
101dh_asn1.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
102dh_asn1.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
103dh_asn1.o: ../../include/openssl/symhacks.h ../cryptlib.h dh_asn1.c
104dh_check.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h
105dh_check.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
106dh_check.o: ../../include/openssl/dh.h ../../include/openssl/e_os2.h
107dh_check.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
108dh_check.o: ../../include/openssl/opensslconf.h
109dh_check.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
110dh_check.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
111dh_check.o: ../../include/openssl/symhacks.h ../cryptlib.h dh_check.c
112dh_depr.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h
113dh_depr.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
114dh_depr.o: ../../include/openssl/dh.h ../../include/openssl/e_os2.h
115dh_depr.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
116dh_depr.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
117dh_depr.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
118dh_depr.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
119dh_depr.o: ../cryptlib.h dh_depr.c
120dh_err.o: ../../include/openssl/bio.h ../../include/openssl/crypto.h
121dh_err.o: ../../include/openssl/dh.h ../../include/openssl/e_os2.h
122dh_err.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
123dh_err.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
124dh_err.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
125dh_err.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
126dh_err.o: dh_err.c
127dh_gen.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h
128dh_gen.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
129dh_gen.o: ../../include/openssl/dh.h ../../include/openssl/e_os2.h
130dh_gen.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
131dh_gen.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
132dh_gen.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
133dh_gen.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
134dh_gen.o: ../cryptlib.h dh_gen.c
135dh_key.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h
136dh_key.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
137dh_key.o: ../../include/openssl/dh.h ../../include/openssl/e_os2.h
138dh_key.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
139dh_key.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
140dh_key.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rand.h
141dh_key.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
142dh_key.o: ../../include/openssl/symhacks.h ../cryptlib.h dh_key.c
143dh_lib.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
144dh_lib.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
145dh_lib.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
146dh_lib.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
147dh_lib.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
148dh_lib.o: ../../include/openssl/engine.h ../../include/openssl/err.h
149dh_lib.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
150dh_lib.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
151dh_lib.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
152dh_lib.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
153dh_lib.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
154dh_lib.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
155dh_lib.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
156dh_lib.o: ../cryptlib.h dh_lib.c
157dh_pmeth.o: ../../e_os.h ../../include/openssl/asn1.h
158dh_pmeth.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
159dh_pmeth.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
160dh_pmeth.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
161dh_pmeth.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
162dh_pmeth.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
163dh_pmeth.o: ../../include/openssl/err.h ../../include/openssl/evp.h
164dh_pmeth.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
165dh_pmeth.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
166dh_pmeth.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
167dh_pmeth.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
168dh_pmeth.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
169dh_pmeth.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
170dh_pmeth.o: ../../include/openssl/x509_vfy.h ../cryptlib.h ../evp/evp_locl.h
171dh_pmeth.o: dh_pmeth.c
172dh_prn.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
173dh_prn.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
174dh_prn.o: ../../include/openssl/dh.h ../../include/openssl/e_os2.h
175dh_prn.o: ../../include/openssl/err.h ../../include/openssl/evp.h
176dh_prn.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
177dh_prn.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
178dh_prn.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
179dh_prn.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
180dh_prn.o: ../../include/openssl/symhacks.h ../cryptlib.h dh_prn.c
diff --git a/src/lib/libcrypto/dh/dh1024.pem b/src/lib/libcrypto/dh/dh1024.pem
new file mode 100644
index 0000000000..81d43f6a3e
--- /dev/null
+++ b/src/lib/libcrypto/dh/dh1024.pem
@@ -0,0 +1,5 @@
1-----BEGIN DH PARAMETERS-----
2MIGHAoGBAJf2QmHKtQXdKCjhPx1ottPb0PMTBH9A6FbaWMsTuKG/K3g6TG1Z1fkq
3/Gz/PWk/eLI9TzFgqVAuPvr3q14a1aZeVUMTgo2oO5/y2UHe6VaJ+trqCTat3xlx
4/mNbIK9HA2RgPC3gWfVLZQrY+gz3ASHHR5nXWHEyvpuZm7m3h+irAgEC
5-----END DH PARAMETERS-----
diff --git a/src/lib/libcrypto/dh/dh192.pem b/src/lib/libcrypto/dh/dh192.pem
new file mode 100644
index 0000000000..521c07271d
--- /dev/null
+++ b/src/lib/libcrypto/dh/dh192.pem
@@ -0,0 +1,3 @@
1-----BEGIN DH PARAMETERS-----
2MB4CGQDUoLoCULb9LsYm5+/WN992xxbiLQlEuIsCAQM=
3-----END DH PARAMETERS-----
diff --git a/src/lib/libcrypto/dh/dh2048.pem b/src/lib/libcrypto/dh/dh2048.pem
new file mode 100644
index 0000000000..295460f508
--- /dev/null
+++ b/src/lib/libcrypto/dh/dh2048.pem
@@ -0,0 +1,16 @@
1-----BEGIN DH PARAMETERS-----
2MIIBCAKCAQEA7ZKJNYJFVcs7+6J2WmkEYb8h86tT0s0h2v94GRFS8Q7B4lW9aG9o
3AFO5Imov5Jo0H2XMWTKKvbHbSe3fpxJmw/0hBHAY8H/W91hRGXKCeyKpNBgdL8sh
4z22SrkO2qCnHJ6PLAMXy5fsKpFmFor2tRfCzrfnggTXu2YOzzK7q62bmqVdmufEo
5pT8igNcLpvZxk5uBDvhakObMym9mX3rAEBoe8PwttggMYiiw7NuJKO4MqD1llGkW
6aVM8U2ATsCun1IKHrRxynkE1/MJ86VHeYYX8GZt2YA8z+GuzylIOKcMH6JAWzMwA
7Gbatw6QwizOhr9iMjZ0B26TE3X8LvW84wwIBAg==
8-----END DH PARAMETERS-----
9-----BEGIN DH PARAMETERS-----
10MIIBCAKCAQEArtA3w73zP6Lu3EOQtwogiXt3AXXpuS6yD4BhzNS1pZFyPHk0/an5
118ydEkPhQZHKDW+BZJxxPLANaTudWo2YT8TgtvUdN6KSgMiEi6McwqDw+SADuvW+F
12SKUYFxG6VFIxyEP6xBdf+vhJxEDbRG2EYsHDRRtJ76gp9cSKTHusf2R+4AAVGqnt
13gRAbNqtcOar/7FSj+Pl8G3v0Bty0LcCSpbqgYlnv6z+rErQmmC6PPvSz97TDMCok
14yKpCE9hFA1zkqK3TH4FmFvGeIaXJUIBZf4mArWuBTjWFW3nmhESRUn1VK3K3x42N
15a5k6c2+EhrMFiLjxuH6JZoqL0/E93FF9SwIBAg==
16-----END DH PARAMETERS-----
diff --git a/src/lib/libcrypto/dh/dh4096.pem b/src/lib/libcrypto/dh/dh4096.pem
new file mode 100644
index 0000000000..390943a21d
--- /dev/null
+++ b/src/lib/libcrypto/dh/dh4096.pem
@@ -0,0 +1,14 @@
1-----BEGIN DH PARAMETERS-----
2MIICCAKCAgEA/urRnb6vkPYc/KEGXWnbCIOaKitq7ySIq9dTH7s+Ri59zs77zty7
3vfVlSe6VFTBWgYjD2XKUFmtqq6CqXMhVX5ElUDoYDpAyTH85xqNFLzFC7nKrff/H
4TFKNttp22cZE9V0IPpzedPfnQkE7aUdmF9JnDyv21Z/818O93u1B4r0szdnmEvEF
5bKuIxEHX+bp0ZR7RqE1AeifXGJX3d6tsd2PMAObxwwsv55RGkn50vHO4QxtTARr1
6rRUV5j3B3oPMgC7Offxx+98Xn45B1/G0Prp11anDsR1PGwtaCYipqsvMwQUSJtyE
7EOQWk+yFkeMe4vWv367eEi0Sd/wnC+TSXBE3pYvpYerJ8n1MceI5GQTdarJ77OW9
8bGTHmxRsLSCM1jpLdPja5jjb4siAa6EHc4qN9c/iFKS3PQPJEnX7pXKBRs5f7AF3
9W3RIGt+G9IVNZfXaS7Z/iCpgzgvKCs0VeqN38QsJGtC1aIkwOeyjPNy2G6jJ4yqH
10ovXYt/0mc00vCWeSNS1wren0pR2EiLxX0ypjjgsU1mk/Z3b/+zVf7fZSIB+nDLjb
11NPtUlJCVGnAeBK1J1nG3TQicqowOXoM6ISkdaXj5GPJdXHab2+S7cqhKGv5qC7rR
12jT6sx7RUr0CNTxzLI7muV2/a4tGmj0PSdXQdsZ7tw7gbXlaWT1+MM2MCAQI=
13-----END DH PARAMETERS-----
14
diff --git a/src/lib/libcrypto/dh/dh512.pem b/src/lib/libcrypto/dh/dh512.pem
new file mode 100644
index 0000000000..0a4d863ebe
--- /dev/null
+++ b/src/lib/libcrypto/dh/dh512.pem
@@ -0,0 +1,4 @@
1-----BEGIN DH PARAMETERS-----
2MEYCQQDaWDwW2YUiidDkr3VvTMqS3UvlM7gE+w/tlO+cikQD7VdGUNNpmdsp13Yn
3a6LT1BLiGPTdHghM9tgAPnxHdOgzAgEC
4-----END DH PARAMETERS-----
diff --git a/src/lib/libcrypto/dh/dhtest.c b/src/lib/libcrypto/dh/dhtest.c
new file mode 100644
index 0000000000..882f5c310a
--- /dev/null
+++ b/src/lib/libcrypto/dh/dhtest.c
@@ -0,0 +1,226 @@
1/* crypto/dh/dhtest.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
59/* Until the key-gen callbacks are modified to use newer prototypes, we allow
60 * deprecated functions for openssl-internal code */
61#ifdef OPENSSL_NO_DEPRECATED
62#undef OPENSSL_NO_DEPRECATED
63#endif
64
65#include <stdio.h>
66#include <stdlib.h>
67#include <string.h>
68
69#include "../e_os.h"
70
71#include <openssl/crypto.h>
72#include <openssl/bio.h>
73#include <openssl/bn.h>
74#include <openssl/rand.h>
75#include <openssl/err.h>
76
77#ifdef OPENSSL_NO_DH
78int main(int argc, char *argv[])
79{
80 printf("No DH support\n");
81 return(0);
82}
83#else
84#include <openssl/dh.h>
85
86#ifdef OPENSSL_SYS_WIN16
87#define MS_CALLBACK _far _loadds
88#else
89#define MS_CALLBACK
90#endif
91
92static int MS_CALLBACK cb(int p, int n, BN_GENCB *arg);
93
94static const char rnd_seed[] = "string to make the random number generator think it has entropy";
95
96int main(int argc, char *argv[])
97 {
98 BN_GENCB _cb;
99 DH *a;
100 DH *b=NULL;
101 char buf[12];
102 unsigned char *abuf=NULL,*bbuf=NULL;
103 int i,alen,blen,aout,bout,ret=1;
104 BIO *out;
105
106 CRYPTO_malloc_debug_init();
107 CRYPTO_dbg_set_options(V_CRYPTO_MDEBUG_ALL);
108 CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON);
109
110#ifdef OPENSSL_SYS_WIN32
111 CRYPTO_malloc_init();
112#endif
113
114 RAND_seed(rnd_seed, sizeof rnd_seed);
115
116 out=BIO_new(BIO_s_file());
117 if (out == NULL) EXIT(1);
118 BIO_set_fp(out,stdout,BIO_NOCLOSE);
119
120 BN_GENCB_set(&_cb, &cb, out);
121 if(((a = DH_new()) == NULL) || !DH_generate_parameters_ex(a, 64,
122 DH_GENERATOR_5, &_cb))
123 goto err;
124
125 if (!DH_check(a, &i)) goto err;
126 if (i & DH_CHECK_P_NOT_PRIME)
127 BIO_puts(out, "p value is not prime\n");
128 if (i & DH_CHECK_P_NOT_SAFE_PRIME)
129 BIO_puts(out, "p value is not a safe prime\n");
130 if (i & DH_UNABLE_TO_CHECK_GENERATOR)
131 BIO_puts(out, "unable to check the generator value\n");
132 if (i & DH_NOT_SUITABLE_GENERATOR)
133 BIO_puts(out, "the g value is not a generator\n");
134
135 BIO_puts(out,"\np =");
136 BN_print(out,a->p);
137 BIO_puts(out,"\ng =");
138 BN_print(out,a->g);
139 BIO_puts(out,"\n");
140
141 b=DH_new();
142 if (b == NULL) goto err;
143
144 b->p=BN_dup(a->p);
145 b->g=BN_dup(a->g);
146 if ((b->p == NULL) || (b->g == NULL)) goto err;
147
148 /* Set a to run with normal modexp and b to use constant time */
149 a->flags &= ~DH_FLAG_NO_EXP_CONSTTIME;
150 b->flags |= DH_FLAG_NO_EXP_CONSTTIME;
151
152 if (!DH_generate_key(a)) goto err;
153 BIO_puts(out,"pri 1=");
154 BN_print(out,a->priv_key);
155 BIO_puts(out,"\npub 1=");
156 BN_print(out,a->pub_key);
157 BIO_puts(out,"\n");
158
159 if (!DH_generate_key(b)) goto err;
160 BIO_puts(out,"pri 2=");
161 BN_print(out,b->priv_key);
162 BIO_puts(out,"\npub 2=");
163 BN_print(out,b->pub_key);
164 BIO_puts(out,"\n");
165
166 alen=DH_size(a);
167 abuf=(unsigned char *)OPENSSL_malloc(alen);
168 aout=DH_compute_key(abuf,b->pub_key,a);
169
170 BIO_puts(out,"key1 =");
171 for (i=0; i<aout; i++)
172 {
173 sprintf(buf,"%02X",abuf[i]);
174 BIO_puts(out,buf);
175 }
176 BIO_puts(out,"\n");
177
178 blen=DH_size(b);
179 bbuf=(unsigned char *)OPENSSL_malloc(blen);
180 bout=DH_compute_key(bbuf,a->pub_key,b);
181
182 BIO_puts(out,"key2 =");
183 for (i=0; i<bout; i++)
184 {
185 sprintf(buf,"%02X",bbuf[i]);
186 BIO_puts(out,buf);
187 }
188 BIO_puts(out,"\n");
189 if ((aout < 4) || (bout != aout) || (memcmp(abuf,bbuf,aout) != 0))
190 {
191 fprintf(stderr,"Error in DH routines\n");
192 ret=1;
193 }
194 else
195 ret=0;
196err:
197 ERR_print_errors_fp(stderr);
198
199 if (abuf != NULL) OPENSSL_free(abuf);
200 if (bbuf != NULL) OPENSSL_free(bbuf);
201 if(b != NULL) DH_free(b);
202 if(a != NULL) DH_free(a);
203 BIO_free(out);
204#ifdef OPENSSL_SYS_NETWARE
205 if (ret) printf("ERROR: %d\n", ret);
206#endif
207 EXIT(ret);
208 return(ret);
209 }
210
211static int MS_CALLBACK cb(int p, int n, BN_GENCB *arg)
212 {
213 char c='*';
214
215 if (p == 0) c='.';
216 if (p == 1) c='+';
217 if (p == 2) c='*';
218 if (p == 3) c='\n';
219 BIO_write(arg->arg,&c,1);
220 (void)BIO_flush(arg->arg);
221#ifdef LINT
222 p=n;
223#endif
224 return 1;
225 }
226#endif
diff --git a/src/lib/libcrypto/dh/example b/src/lib/libcrypto/dh/example
new file mode 100644
index 0000000000..16a33d2910
--- /dev/null
+++ b/src/lib/libcrypto/dh/example
@@ -0,0 +1,50 @@
1From owner-cypherpunks@toad.com Mon Sep 25 10:50:51 1995
2Received: from minbne.mincom.oz.au by orb.mincom.oz.au with SMTP id AA10562
3 (5.65c/IDA-1.4.4 for eay); Wed, 27 Sep 1995 19:41:55 +1000
4Received: by minbne.mincom.oz.au id AA19958
5 (5.65c/IDA-1.4.4 for eay@orb.mincom.oz.au); Wed, 27 Sep 1995 19:34:59 +1000
6Received: from relay3.UU.NET by bunyip.cc.uq.oz.au with SMTP (PP);
7 Wed, 27 Sep 1995 19:13:05 +1000
8Received: from toad.com by relay3.UU.NET with SMTP id QQzizb16156;
9 Wed, 27 Sep 1995 04:48:46 -0400
10Received: by toad.com id AA07905; Tue, 26 Sep 95 06:31:45 PDT
11Received: from by toad.com id AB07851; Tue, 26 Sep 95 06:31:40 PDT
12Received: from servo.qualcomm.com (servo.qualcomm.com [129.46.128.14])
13 by cygnus.com (8.6.12/8.6.9) with ESMTP id RAA18442
14 for <cypherpunks@toad.com>; Mon, 25 Sep 1995 17:52:47 -0700
15Received: (karn@localhost) by servo.qualcomm.com (8.6.12/QC-BSD-2.5.1)
16 id RAA14732; Mon, 25 Sep 1995 17:50:51 -0700
17Date: Mon, 25 Sep 1995 17:50:51 -0700
18From: Phil Karn <karn@qualcomm.com>
19Message-Id: <199509260050.RAA14732@servo.qualcomm.com>
20To: cypherpunks@toad.com, ipsec-dev@eit.com
21Subject: Primality verification needed
22Sender: owner-cypherpunks@toad.com
23Precedence: bulk
24Status: RO
25X-Status:
26
27Hi. I've generated a 2047-bit "strong" prime number that I would like to
28use with Diffie-Hellman key exchange. I assert that not only is this number
29'p' prime, but so is (p-1)/2.
30
31I've used the mpz_probab_prime() function in the Gnu Math Package (GMP) version
321.3.2 to test this number. This function uses the Miller-Rabin primality test.
33However, to increase my confidence that this number really is a strong prime,
34I'd like to ask others to confirm it with other tests. Here's the number in hex:
35
3672a925f760b2f954ed287f1b0953f3e6aef92e456172f9fe86fdd8822241b9c9788fbc289982743e
37fbcd2ccf062b242d7a567ba8bbb40d79bca7b8e0b6c05f835a5b938d985816bc648985adcff5402a
38a76756b36c845a840a1d059ce02707e19cf47af0b5a882f32315c19d1b86a56c5389c5e9bee16b65
39fde7b1a8d74a7675de9b707d4c5a4633c0290c95ff30a605aeb7ae864ff48370f13cf01d49adb9f2
403d19a439f753ee7703cf342d87f431105c843c78ca4df639931f3458fae8a94d1687e99a76ed99d0
41ba87189f42fd31ad8262c54a8cf5914ae6c28c540d714a5f6087a171fb74f4814c6f968d72386ef3
4256a05180c3bec7ddd5ef6fe76b1f717b
43
44The generator, g, for this prime is 2.
45
46Thanks!
47
48Phil Karn
49
50
diff --git a/src/lib/libcrypto/dh/generate b/src/lib/libcrypto/dh/generate
new file mode 100644
index 0000000000..5d407231df
--- /dev/null
+++ b/src/lib/libcrypto/dh/generate
@@ -0,0 +1,65 @@
1From: stewarts@ix.netcom.com (Bill Stewart)
2Newsgroups: sci.crypt
3Subject: Re: Diffie-Hellman key exchange
4Date: Wed, 11 Oct 1995 23:08:28 GMT
5Organization: Freelance Information Architect
6Lines: 32
7Message-ID: <45hir2$7l8@ixnews7.ix.netcom.com>
8References: <458rhn$76m$1@mhadf.production.compuserve.com>
9NNTP-Posting-Host: ix-pl4-16.ix.netcom.com
10X-NETCOM-Date: Wed Oct 11 4:09:22 PM PDT 1995
11X-Newsreader: Forte Free Agent 1.0.82
12
13Kent Briggs <72124.3234@CompuServe.COM> wrote:
14
15>I have a copy of the 1976 IEEE article describing the
16>Diffie-Hellman public key exchange algorithm: y=a^x mod q. I'm
17>looking for sources that give examples of secure a,q pairs and
18>possible some source code that I could examine.
19
20q should be prime, and ideally should be a "strong prime",
21which means it's of the form 2n+1 where n is also prime.
22q also needs to be long enough to prevent the attacks LaMacchia and
23Odlyzko described (some variant on a factoring attack which generates
24a large pile of simultaneous equations and then solves them);
25long enough is about the same size as factoring, so 512 bits may not
26be secure enough for most applications. (The 192 bits used by
27"secure NFS" was certainly not long enough.)
28
29a should be a generator for q, which means it needs to be
30relatively prime to q-1. Usually a small prime like 2, 3 or 5 will
31work.
32
33....
34
35Date: Tue, 26 Sep 1995 13:52:36 MST
36From: "Richard Schroeppel" <rcs@cs.arizona.edu>
37To: karn
38Cc: ho@cs.arizona.edu
39Subject: random large primes
40
41Since your prime is really random, proving it is hard.
42My personal limit on rigorously proved primes is ~350 digits.
43If you really want a proof, we should talk to Francois Morain,
44or the Australian group.
45
46If you want 2 to be a generator (mod P), then you need it
47to be a non-square. If (P-1)/2 is also prime, then
48non-square == primitive-root for bases << P.
49
50In the case at hand, this means 2 is a generator iff P = 11 (mod 24).
51If you want this, you should restrict your sieve accordingly.
52
533 is a generator iff P = 5 (mod 12).
54
555 is a generator iff P = 3 or 7 (mod 10).
56
572 is perfectly usable as a base even if it's a non-generator, since
58it still covers half the space of possible residues. And an
59eavesdropper can always determine the low-bit of your exponent for
60a generator anyway.
61
62Rich rcs@cs.arizona.edu
63
64
65
diff --git a/src/lib/libcrypto/dh/p1024.c b/src/lib/libcrypto/dh/p1024.c
new file mode 100644
index 0000000000..368ceca4eb
--- /dev/null
+++ b/src/lib/libcrypto/dh/p1024.c
@@ -0,0 +1,92 @@
1/* crypto/dh/p1024.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
59#include <stdio.h>
60#include <openssl/bn.h>
61#include <openssl/asn1.h>
62#include <openssl/dh.h>
63#include <openssl/pem.h>
64
65unsigned char data[]={0x97,0xF6,0x42,0x61,0xCA,0xB5,0x05,0xDD,
66 0x28,0x28,0xE1,0x3F,0x1D,0x68,0xB6,0xD3,
67 0xDB,0xD0,0xF3,0x13,0x04,0x7F,0x40,0xE8,
68 0x56,0xDA,0x58,0xCB,0x13,0xB8,0xA1,0xBF,
69 0x2B,0x78,0x3A,0x4C,0x6D,0x59,0xD5,0xF9,
70 0x2A,0xFC,0x6C,0xFF,0x3D,0x69,0x3F,0x78,
71 0xB2,0x3D,0x4F,0x31,0x60,0xA9,0x50,0x2E,
72 0x3E,0xFA,0xF7,0xAB,0x5E,0x1A,0xD5,0xA6,
73 0x5E,0x55,0x43,0x13,0x82,0x8D,0xA8,0x3B,
74 0x9F,0xF2,0xD9,0x41,0xDE,0xE9,0x56,0x89,
75 0xFA,0xDA,0xEA,0x09,0x36,0xAD,0xDF,0x19,
76 0x71,0xFE,0x63,0x5B,0x20,0xAF,0x47,0x03,
77 0x64,0x60,0x3C,0x2D,0xE0,0x59,0xF5,0x4B,
78 0x65,0x0A,0xD8,0xFA,0x0C,0xF7,0x01,0x21,
79 0xC7,0x47,0x99,0xD7,0x58,0x71,0x32,0xBE,
80 0x9B,0x99,0x9B,0xB9,0xB7,0x87,0xE8,0xAB,
81 };
82
83main()
84 {
85 DH *dh;
86
87 dh=DH_new();
88 dh->p=BN_bin2bn(data,sizeof(data),NULL);
89 dh->g=BN_new();
90 BN_set_word(dh->g,2);
91 PEM_write_DHparams(stdout,dh);
92 }
diff --git a/src/lib/libcrypto/dh/p192.c b/src/lib/libcrypto/dh/p192.c
new file mode 100644
index 0000000000..7bdf40410e
--- /dev/null
+++ b/src/lib/libcrypto/dh/p192.c
@@ -0,0 +1,80 @@
1/* crypto/dh/p192.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
59#include <stdio.h>
60#include <openssl/bn.h>
61#include <openssl/asn1.h>
62#include <openssl/dh.h>
63#include <openssl/pem.h>
64
65unsigned char data[]={
660xD4,0xA0,0xBA,0x02,0x50,0xB6,0xFD,0x2E,
670xC6,0x26,0xE7,0xEF,0xD6,0x37,0xDF,0x76,
680xC7,0x16,0xE2,0x2D,0x09,0x44,0xB8,0x8B,
69 };
70
71main()
72 {
73 DH *dh;
74
75 dh=DH_new();
76 dh->p=BN_bin2bn(data,sizeof(data),NULL);
77 dh->g=BN_new();
78 BN_set_word(dh->g,3);
79 PEM_write_DHparams(stdout,dh);
80 }
diff --git a/src/lib/libcrypto/dh/p512.c b/src/lib/libcrypto/dh/p512.c
new file mode 100644
index 0000000000..a9b6aa83f0
--- /dev/null
+++ b/src/lib/libcrypto/dh/p512.c
@@ -0,0 +1,85 @@
1/* crypto/dh/p512.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
59#include <stdio.h>
60#include <openssl/bn.h>
61#include <openssl/asn1.h>
62#include <openssl/dh.h>
63#include <openssl/pem.h>
64
65unsigned char data[]={
660xDA,0x58,0x3C,0x16,0xD9,0x85,0x22,0x89,
670xD0,0xE4,0xAF,0x75,0x6F,0x4C,0xCA,0x92,
680xDD,0x4B,0xE5,0x33,0xB8,0x04,0xFB,0x0F,
690xED,0x94,0xEF,0x9C,0x8A,0x44,0x03,0xED,
700x57,0x46,0x50,0xD3,0x69,0x99,0xDB,0x29,
710xD7,0x76,0x27,0x6B,0xA2,0xD3,0xD4,0x12,
720xE2,0x18,0xF4,0xDD,0x1E,0x08,0x4C,0xF6,
730xD8,0x00,0x3E,0x7C,0x47,0x74,0xE8,0x33,
74 };
75
76main()
77 {
78 DH *dh;
79
80 dh=DH_new();
81 dh->p=BN_bin2bn(data,sizeof(data),NULL);
82 dh->g=BN_new();
83 BN_set_word(dh->g,2);
84 PEM_write_DHparams(stdout,dh);
85 }
diff --git a/src/lib/libcrypto/doc/ERR_get_error.pod b/src/lib/libcrypto/doc/ERR_get_error.pod
index 828ecf529b..34443045fc 100644
--- a/src/lib/libcrypto/doc/ERR_get_error.pod
+++ b/src/lib/libcrypto/doc/ERR_get_error.pod
@@ -52,11 +52,8 @@ ERR_get_error_line_data(), ERR_peek_error_line_data() and
52ERR_get_last_error_line_data() store additional data and flags 52ERR_get_last_error_line_data() store additional data and flags
53associated with the error code in *B<data> 53associated with the error code in *B<data>
54and *B<flags>, unless these are B<NULL>. *B<data> contains a string 54and *B<flags>, unless these are B<NULL>. *B<data> contains a string
55if *B<flags>&B<ERR_TXT_STRING> is true. 55if *B<flags>&B<ERR_TXT_STRING>. If it has been allocated by OPENSSL_malloc(),
56 56*B<flags>&B<ERR_TXT_MALLOCED> is true.
57An application B<MUST NOT> free the *B<data> pointer (or any other pointers
58returned by these functions) with OPENSSL_free() as freeing is handled
59automatically by the error library.
60 57
61=head1 RETURN VALUES 58=head1 RETURN VALUES
62 59
diff --git a/src/lib/libcrypto/doc/EVP_BytesToKey.pod b/src/lib/libcrypto/doc/EVP_BytesToKey.pod
index 0ea7d55c0f..d375c46e03 100644
--- a/src/lib/libcrypto/doc/EVP_BytesToKey.pod
+++ b/src/lib/libcrypto/doc/EVP_BytesToKey.pod
@@ -17,7 +17,7 @@ EVP_BytesToKey - password based encryption routine
17 17
18EVP_BytesToKey() derives a key and IV from various parameters. B<type> is 18EVP_BytesToKey() derives a key and IV from various parameters. B<type> is
19the cipher to derive the key and IV for. B<md> is the message digest to use. 19the cipher to derive the key and IV for. B<md> is the message digest to use.
20The B<salt> parameter is used as a salt in the derivation: it should point to 20The B<salt> paramter is used as a salt in the derivation: it should point to
21an 8 byte buffer or NULL if no salt is used. B<data> is a buffer containing 21an 8 byte buffer or NULL if no salt is used. B<data> is a buffer containing
22B<datal> bytes which is used to derive the keying data. B<count> is the 22B<datal> bytes which is used to derive the keying data. B<count> is the
23iteration count to use. The derived key and IV will be written to B<key> 23iteration count to use. The derived key and IV will be written to B<key>
diff --git a/src/lib/libcrypto/doc/EVP_DigestInit.pod b/src/lib/libcrypto/doc/EVP_DigestInit.pod
index 367691cc7a..1aa15acb61 100644
--- a/src/lib/libcrypto/doc/EVP_DigestInit.pod
+++ b/src/lib/libcrypto/doc/EVP_DigestInit.pod
@@ -252,9 +252,9 @@ digest name passed on the command line.
252 252
253=head1 SEE ALSO 253=head1 SEE ALSO
254 254
255L<evp(3)|evp(3)>, L<hmac(3)|hmac(3)>, L<md2(3)|md2(3)>, 255L<evp(3)|evp(3)>, L<HMAC(3)|HMAC(3)>, L<MD2(3)|MD2(3)>,
256L<md5(3)|md5(3)>, L<mdc2(3)|mdc2(3)>, L<ripemd(3)|ripemd(3)>, 256L<MD5(3)|MD5(3)>, L<MDC2(3)|MDC2(3)>, L<RIPEMD160(3)|RIPEMD160(3)>,
257L<sha(3)|sha(3)>, L<dgst(1)|dgst(1)> 257L<SHA1(3)|SHA1(3)>
258 258
259=head1 HISTORY 259=head1 HISTORY
260 260
diff --git a/src/lib/libcrypto/doc/EVP_EncryptInit.pod b/src/lib/libcrypto/doc/EVP_EncryptInit.pod
index 1c4bf184a1..8271d3dfc4 100644
--- a/src/lib/libcrypto/doc/EVP_EncryptInit.pod
+++ b/src/lib/libcrypto/doc/EVP_EncryptInit.pod
@@ -152,7 +152,7 @@ does not remain in memory.
152 152
153EVP_EncryptInit(), EVP_DecryptInit() and EVP_CipherInit() behave in a 153EVP_EncryptInit(), EVP_DecryptInit() and EVP_CipherInit() behave in a
154similar way to EVP_EncryptInit_ex(), EVP_DecryptInit_ex and 154similar way to EVP_EncryptInit_ex(), EVP_DecryptInit_ex and
155EVP_CipherInit_ex() except the B<ctx> parameter does not need to be 155EVP_CipherInit_ex() except the B<ctx> paramter does not need to be
156initialized and they always use the default cipher implementation. 156initialized and they always use the default cipher implementation.
157 157
158EVP_EncryptFinal(), EVP_DecryptFinal() and EVP_CipherFinal() behave in a 158EVP_EncryptFinal(), EVP_DecryptFinal() and EVP_CipherFinal() behave in a
diff --git a/src/lib/libcrypto/doc/EVP_SignInit.pod b/src/lib/libcrypto/doc/EVP_SignInit.pod
index 620a623ab6..781d43e401 100644
--- a/src/lib/libcrypto/doc/EVP_SignInit.pod
+++ b/src/lib/libcrypto/doc/EVP_SignInit.pod
@@ -89,10 +89,10 @@ The previous two bugs are fixed in the newer EVP_SignDigest*() function.
89=head1 SEE ALSO 89=head1 SEE ALSO
90 90
91L<EVP_VerifyInit(3)|EVP_VerifyInit(3)>, 91L<EVP_VerifyInit(3)|EVP_VerifyInit(3)>,
92L<EVP_DigestInit(3)|EVP_DigestInit(3)>, L<err(3)|err(3)>, 92L<EVP_DigestInit(3)|EVP_DigestInit(3)>, L<ERR_get_error(3)|ERR_get_error(3)>,
93L<evp(3)|evp(3)>, L<hmac(3)|hmac(3)>, L<md2(3)|md2(3)>, 93L<evp(3)|evp(3)>, L<HMAC(3)|HMAC(3)>, L<MD2(3)|MD2(3)>,
94L<md5(3)|md5(3)>, L<mdc2(3)|mdc2(3)>, L<ripemd(3)|ripemd(3)>, 94L<MD5(3)|MD5(3)>, L<MDC2(3)|MDC2(3)>, L<RIPEMD(3)|RIPEMD(3)>,
95L<sha(3)|sha(3)>, L<dgst(1)|dgst(1)> 95L<SHA1(3)|SHA1(3)>, L<digest(1)|digest(1)>
96 96
97=head1 HISTORY 97=head1 HISTORY
98 98
diff --git a/src/lib/libcrypto/doc/dsa.pod b/src/lib/libcrypto/doc/dsa.pod
index da07d2b930..ae2e5d81f9 100644
--- a/src/lib/libcrypto/doc/dsa.pod
+++ b/src/lib/libcrypto/doc/dsa.pod
@@ -101,8 +101,7 @@ Standard, DSS), ANSI X9.30
101=head1 SEE ALSO 101=head1 SEE ALSO
102 102
103L<bn(3)|bn(3)>, L<dh(3)|dh(3)>, L<err(3)|err(3)>, L<rand(3)|rand(3)>, 103L<bn(3)|bn(3)>, L<dh(3)|dh(3)>, L<err(3)|err(3)>, L<rand(3)|rand(3)>,
104L<rsa(3)|rsa(3)>, L<sha(3)|sha(3)>, L<engine(3)|engine(3)>, 104L<rsa(3)|rsa(3)>, L<SHA1(3)|SHA1(3)>, L<DSA_new(3)|DSA_new(3)>,
105L<DSA_new(3)|DSA_new(3)>,
106L<DSA_size(3)|DSA_size(3)>, 105L<DSA_size(3)|DSA_size(3)>,
107L<DSA_generate_parameters(3)|DSA_generate_parameters(3)>, 106L<DSA_generate_parameters(3)|DSA_generate_parameters(3)>,
108L<DSA_dup_DH(3)|DSA_dup_DH(3)>, 107L<DSA_dup_DH(3)|DSA_dup_DH(3)>,
diff --git a/src/lib/libcrypto/dsa/Makefile b/src/lib/libcrypto/dsa/Makefile
new file mode 100644
index 0000000000..5fef4ca5ad
--- /dev/null
+++ b/src/lib/libcrypto/dsa/Makefile
@@ -0,0 +1,209 @@
1#
2# OpenSSL/crypto/dsa/Makefile
3#
4
5DIR= dsa
6TOP= ../..
7CC= cc
8INCLUDES= -I.. -I$(TOP) -I../../include
9CFLAG=-g
10MAKEFILE= Makefile
11AR= ar r
12
13CFLAGS= $(INCLUDES) $(CFLAG)
14
15GENERAL=Makefile
16TEST=dsatest.c
17APPS=
18
19LIB=$(TOP)/libcrypto.a
20LIBSRC= dsa_gen.c dsa_key.c dsa_lib.c dsa_asn1.c dsa_vrf.c dsa_sign.c \
21 dsa_err.c dsa_ossl.c dsa_depr.c dsa_ameth.c dsa_pmeth.c dsa_prn.c
22LIBOBJ= dsa_gen.o dsa_key.o dsa_lib.o dsa_asn1.o dsa_vrf.o dsa_sign.o \
23 dsa_err.o dsa_ossl.o dsa_depr.o dsa_ameth.o dsa_pmeth.o dsa_prn.o
24
25SRC= $(LIBSRC)
26
27EXHEADER= dsa.h
28HEADER= dsa_locl.h $(EXHEADER)
29
30ALL= $(GENERAL) $(SRC) $(HEADER)
31
32top:
33 (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all)
34
35all: lib
36
37lib: $(LIBOBJ)
38 $(AR) $(LIB) $(LIBOBJ)
39 $(RANLIB) $(LIB) || echo Never mind.
40 @touch lib
41
42files:
43 $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
44
45links:
46 @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
47 @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
48 @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
49
50install:
51 @[ -n "$(INSTALLTOP)" ] # should be set by top Makefile...
52 @headerlist="$(EXHEADER)"; for i in $$headerlist ; \
53 do \
54 (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
55 chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
56 done;
57
58tags:
59 ctags $(SRC)
60
61tests:
62
63lint:
64 lint -DLINT $(INCLUDES) $(SRC)>fluff
65
66depend:
67 @[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile...
68 $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
69
70dclean:
71 $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
72 mv -f Makefile.new $(MAKEFILE)
73
74clean:
75 rm -f *.o */*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
76
77# DO NOT DELETE THIS LINE -- make depend depends on it.
78
79dsa_ameth.o: ../../e_os.h ../../include/openssl/asn1.h
80dsa_ameth.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
81dsa_ameth.o: ../../include/openssl/buffer.h ../../include/openssl/cms.h
82dsa_ameth.o: ../../include/openssl/crypto.h ../../include/openssl/dsa.h
83dsa_ameth.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
84dsa_ameth.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
85dsa_ameth.o: ../../include/openssl/err.h ../../include/openssl/evp.h
86dsa_ameth.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
87dsa_ameth.o: ../../include/openssl/objects.h
88dsa_ameth.o: ../../include/openssl/opensslconf.h
89dsa_ameth.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
90dsa_ameth.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
91dsa_ameth.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
92dsa_ameth.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
93dsa_ameth.o: ../../include/openssl/x509_vfy.h ../asn1/asn1_locl.h ../cryptlib.h
94dsa_ameth.o: dsa_ameth.c
95dsa_asn1.o: ../../e_os.h ../../include/openssl/asn1.h
96dsa_asn1.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
97dsa_asn1.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
98dsa_asn1.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
99dsa_asn1.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
100dsa_asn1.o: ../../include/openssl/opensslconf.h
101dsa_asn1.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
102dsa_asn1.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h
103dsa_asn1.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
104dsa_asn1.o: ../cryptlib.h dsa_asn1.c
105dsa_depr.o: ../../e_os.h ../../include/openssl/asn1.h
106dsa_depr.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
107dsa_depr.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
108dsa_depr.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
109dsa_depr.o: ../../include/openssl/err.h ../../include/openssl/evp.h
110dsa_depr.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
111dsa_depr.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
112dsa_depr.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
113dsa_depr.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h
114dsa_depr.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
115dsa_depr.o: ../../include/openssl/symhacks.h ../cryptlib.h dsa_depr.c
116dsa_err.o: ../../include/openssl/bio.h ../../include/openssl/crypto.h
117dsa_err.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
118dsa_err.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
119dsa_err.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
120dsa_err.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
121dsa_err.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
122dsa_err.o: dsa_err.c
123dsa_gen.o: ../../e_os.h ../../include/openssl/asn1.h
124dsa_gen.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
125dsa_gen.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
126dsa_gen.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
127dsa_gen.o: ../../include/openssl/err.h ../../include/openssl/evp.h
128dsa_gen.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
129dsa_gen.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
130dsa_gen.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
131dsa_gen.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h
132dsa_gen.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
133dsa_gen.o: ../../include/openssl/symhacks.h ../cryptlib.h dsa_gen.c dsa_locl.h
134dsa_key.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h
135dsa_key.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
136dsa_key.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
137dsa_key.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
138dsa_key.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
139dsa_key.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rand.h
140dsa_key.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
141dsa_key.o: ../../include/openssl/symhacks.h ../cryptlib.h dsa_key.c
142dsa_lib.o: ../../e_os.h ../../include/openssl/asn1.h
143dsa_lib.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
144dsa_lib.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
145dsa_lib.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
146dsa_lib.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
147dsa_lib.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
148dsa_lib.o: ../../include/openssl/engine.h ../../include/openssl/err.h
149dsa_lib.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
150dsa_lib.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
151dsa_lib.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
152dsa_lib.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
153dsa_lib.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
154dsa_lib.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
155dsa_lib.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
156dsa_lib.o: ../cryptlib.h dsa_lib.c
157dsa_ossl.o: ../../e_os.h ../../include/openssl/asn1.h
158dsa_ossl.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
159dsa_ossl.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
160dsa_ossl.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
161dsa_ossl.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
162dsa_ossl.o: ../../include/openssl/opensslconf.h
163dsa_ossl.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
164dsa_ossl.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h
165dsa_ossl.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
166dsa_ossl.o: ../../include/openssl/symhacks.h ../cryptlib.h dsa_ossl.c
167dsa_pmeth.o: ../../e_os.h ../../include/openssl/asn1.h
168dsa_pmeth.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
169dsa_pmeth.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
170dsa_pmeth.o: ../../include/openssl/crypto.h ../../include/openssl/dsa.h
171dsa_pmeth.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
172dsa_pmeth.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
173dsa_pmeth.o: ../../include/openssl/err.h ../../include/openssl/evp.h
174dsa_pmeth.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
175dsa_pmeth.o: ../../include/openssl/objects.h
176dsa_pmeth.o: ../../include/openssl/opensslconf.h
177dsa_pmeth.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
178dsa_pmeth.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
179dsa_pmeth.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
180dsa_pmeth.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
181dsa_pmeth.o: ../../include/openssl/x509_vfy.h ../cryptlib.h ../evp/evp_locl.h
182dsa_pmeth.o: dsa_locl.h dsa_pmeth.c
183dsa_prn.o: ../../e_os.h ../../include/openssl/asn1.h
184dsa_prn.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
185dsa_prn.o: ../../include/openssl/crypto.h ../../include/openssl/dsa.h
186dsa_prn.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
187dsa_prn.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
188dsa_prn.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
189dsa_prn.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
190dsa_prn.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
191dsa_prn.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
192dsa_prn.o: ../cryptlib.h dsa_prn.c
193dsa_sign.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h
194dsa_sign.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
195dsa_sign.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
196dsa_sign.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
197dsa_sign.o: ../../include/openssl/opensslconf.h
198dsa_sign.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
199dsa_sign.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h
200dsa_sign.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
201dsa_sign.o: ../cryptlib.h dsa_sign.c
202dsa_vrf.o: ../../e_os.h ../../include/openssl/bio.h
203dsa_vrf.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
204dsa_vrf.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
205dsa_vrf.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
206dsa_vrf.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
207dsa_vrf.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
208dsa_vrf.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
209dsa_vrf.o: ../cryptlib.h dsa_vrf.c
diff --git a/src/lib/libcrypto/dsa/README b/src/lib/libcrypto/dsa/README
new file mode 100644
index 0000000000..6a7e9c170a
--- /dev/null
+++ b/src/lib/libcrypto/dsa/README
@@ -0,0 +1,4 @@
1The stuff in here is based on patches supplied to me by
2Steven Schoch <schoch@sheba.arc.nasa.gov> to do DSS.
3I have since modified a them a little but a debt of gratitude
4is due for doing the initial work.
diff --git a/src/lib/libcrypto/dsa/dsagen.c b/src/lib/libcrypto/dsa/dsagen.c
new file mode 100644
index 0000000000..1b6a1cca0f
--- /dev/null
+++ b/src/lib/libcrypto/dsa/dsagen.c
@@ -0,0 +1,111 @@
1/* crypto/dsa/dsagen.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
59#include <stdio.h>
60#include <openssl/dsa.h>
61
62#define TEST
63#define GENUINE_DSA
64
65#ifdef GENUINE_DSA
66#define LAST_VALUE 0xbd
67#else
68#define LAST_VALUE 0xd3
69#endif
70
71#ifdef TEST
72unsigned char seed[20]={
73 0xd5,0x01,0x4e,0x4b,
74 0x60,0xef,0x2b,0xa8,
75 0xb6,0x21,0x1b,0x40,
76 0x62,0xba,0x32,0x24,
77 0xe0,0x42,0x7d,LAST_VALUE};
78#endif
79
80int cb(int p, int n)
81 {
82 char c='*';
83
84 if (p == 0) c='.';
85 if (p == 1) c='+';
86 if (p == 2) c='*';
87 if (p == 3) c='\n';
88 printf("%c",c);
89 fflush(stdout);
90 }
91
92main()
93 {
94 int i;
95 BIGNUM *n;
96 BN_CTX *ctx;
97 unsigned char seed_buf[20];
98 DSA *dsa;
99 int counter,h;
100 BIO *bio_err=NULL;
101
102 if (bio_err == NULL)
103 bio_err=BIO_new_fp(stderr,BIO_NOCLOSE);
104
105 memcpy(seed_buf,seed,20);
106 dsa=DSA_generate_parameters(1024,seed,20,&counter,&h,cb,bio_err);
107
108 if (dsa == NULL)
109 DSA_print(bio_err,dsa,0);
110 }
111
diff --git a/src/lib/libcrypto/dsa/dsatest.c b/src/lib/libcrypto/dsa/dsatest.c
new file mode 100644
index 0000000000..edffd24e6b
--- /dev/null
+++ b/src/lib/libcrypto/dsa/dsatest.c
@@ -0,0 +1,259 @@
1/* crypto/dsa/dsatest.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
59/* Until the key-gen callbacks are modified to use newer prototypes, we allow
60 * deprecated functions for openssl-internal code */
61#ifdef OPENSSL_NO_DEPRECATED
62#undef OPENSSL_NO_DEPRECATED
63#endif
64
65#include <stdio.h>
66#include <stdlib.h>
67#include <string.h>
68#include <sys/types.h>
69#include <sys/stat.h>
70
71#include "../e_os.h"
72
73#include <openssl/crypto.h>
74#include <openssl/rand.h>
75#include <openssl/bio.h>
76#include <openssl/err.h>
77#include <openssl/bn.h>
78
79#ifdef OPENSSL_NO_DSA
80int main(int argc, char *argv[])
81{
82 printf("No DSA support\n");
83 return(0);
84}
85#else
86#include <openssl/dsa.h>
87
88#ifdef OPENSSL_SYS_WIN16
89#define MS_CALLBACK _far _loadds
90#else
91#define MS_CALLBACK
92#endif
93
94static int MS_CALLBACK dsa_cb(int p, int n, BN_GENCB *arg);
95
96/* seed, out_p, out_q, out_g are taken from the updated Appendix 5 to
97 * FIPS PUB 186 and also appear in Appendix 5 to FIPS PIB 186-1 */
98static unsigned char seed[20]={
99 0xd5,0x01,0x4e,0x4b,0x60,0xef,0x2b,0xa8,0xb6,0x21,0x1b,0x40,
100 0x62,0xba,0x32,0x24,0xe0,0x42,0x7d,0xd3,
101 };
102
103static unsigned char out_p[]={
104 0x8d,0xf2,0xa4,0x94,0x49,0x22,0x76,0xaa,
105 0x3d,0x25,0x75,0x9b,0xb0,0x68,0x69,0xcb,
106 0xea,0xc0,0xd8,0x3a,0xfb,0x8d,0x0c,0xf7,
107 0xcb,0xb8,0x32,0x4f,0x0d,0x78,0x82,0xe5,
108 0xd0,0x76,0x2f,0xc5,0xb7,0x21,0x0e,0xaf,
109 0xc2,0xe9,0xad,0xac,0x32,0xab,0x7a,0xac,
110 0x49,0x69,0x3d,0xfb,0xf8,0x37,0x24,0xc2,
111 0xec,0x07,0x36,0xee,0x31,0xc8,0x02,0x91,
112 };
113
114static unsigned char out_q[]={
115 0xc7,0x73,0x21,0x8c,0x73,0x7e,0xc8,0xee,
116 0x99,0x3b,0x4f,0x2d,0xed,0x30,0xf4,0x8e,
117 0xda,0xce,0x91,0x5f,
118 };
119
120static unsigned char out_g[]={
121 0x62,0x6d,0x02,0x78,0x39,0xea,0x0a,0x13,
122 0x41,0x31,0x63,0xa5,0x5b,0x4c,0xb5,0x00,
123 0x29,0x9d,0x55,0x22,0x95,0x6c,0xef,0xcb,
124 0x3b,0xff,0x10,0xf3,0x99,0xce,0x2c,0x2e,
125 0x71,0xcb,0x9d,0xe5,0xfa,0x24,0xba,0xbf,
126 0x58,0xe5,0xb7,0x95,0x21,0x92,0x5c,0x9c,
127 0xc4,0x2e,0x9f,0x6f,0x46,0x4b,0x08,0x8c,
128 0xc5,0x72,0xaf,0x53,0xe6,0xd7,0x88,0x02,
129 };
130
131static const unsigned char str1[]="12345678901234567890";
132
133static const char rnd_seed[] = "string to make the random number generator think it has entropy";
134
135static BIO *bio_err=NULL;
136
137int main(int argc, char **argv)
138 {
139 BN_GENCB cb;
140 DSA *dsa=NULL;
141 int counter,ret=0,i,j;
142 unsigned char buf[256];
143 unsigned long h;
144 unsigned char sig[256];
145 unsigned int siglen;
146
147 if (bio_err == NULL)
148 bio_err=BIO_new_fp(stderr,BIO_NOCLOSE);
149
150 CRYPTO_malloc_debug_init();
151 CRYPTO_dbg_set_options(V_CRYPTO_MDEBUG_ALL);
152 CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON);
153
154 ERR_load_crypto_strings();
155 RAND_seed(rnd_seed, sizeof rnd_seed);
156
157 BIO_printf(bio_err,"test generation of DSA parameters\n");
158
159 BN_GENCB_set(&cb, dsa_cb, bio_err);
160 if(((dsa = DSA_new()) == NULL) || !DSA_generate_parameters_ex(dsa, 512,
161 seed, 20, &counter, &h, &cb))
162 goto end;
163
164 BIO_printf(bio_err,"seed\n");
165 for (i=0; i<20; i+=4)
166 {
167 BIO_printf(bio_err,"%02X%02X%02X%02X ",
168 seed[i],seed[i+1],seed[i+2],seed[i+3]);
169 }
170 BIO_printf(bio_err,"\ncounter=%d h=%ld\n",counter,h);
171
172 DSA_print(bio_err,dsa,0);
173 if (counter != 105)
174 {
175 BIO_printf(bio_err,"counter should be 105\n");
176 goto end;
177 }
178 if (h != 2)
179 {
180 BIO_printf(bio_err,"h should be 2\n");
181 goto end;
182 }
183
184 i=BN_bn2bin(dsa->q,buf);
185 j=sizeof(out_q);
186 if ((i != j) || (memcmp(buf,out_q,i) != 0))
187 {
188 BIO_printf(bio_err,"q value is wrong\n");
189 goto end;
190 }
191
192 i=BN_bn2bin(dsa->p,buf);
193 j=sizeof(out_p);
194 if ((i != j) || (memcmp(buf,out_p,i) != 0))
195 {
196 BIO_printf(bio_err,"p value is wrong\n");
197 goto end;
198 }
199
200 i=BN_bn2bin(dsa->g,buf);
201 j=sizeof(out_g);
202 if ((i != j) || (memcmp(buf,out_g,i) != 0))
203 {
204 BIO_printf(bio_err,"g value is wrong\n");
205 goto end;
206 }
207
208 dsa->flags |= DSA_FLAG_NO_EXP_CONSTTIME;
209 DSA_generate_key(dsa);
210 DSA_sign(0, str1, 20, sig, &siglen, dsa);
211 if (DSA_verify(0, str1, 20, sig, siglen, dsa) == 1)
212 ret=1;
213
214 dsa->flags &= ~DSA_FLAG_NO_EXP_CONSTTIME;
215 DSA_generate_key(dsa);
216 DSA_sign(0, str1, 20, sig, &siglen, dsa);
217 if (DSA_verify(0, str1, 20, sig, siglen, dsa) == 1)
218 ret=1;
219
220end:
221 if (!ret)
222 ERR_print_errors(bio_err);
223 if (dsa != NULL) DSA_free(dsa);
224 CRYPTO_cleanup_all_ex_data();
225 ERR_remove_thread_state(NULL);
226 ERR_free_strings();
227 CRYPTO_mem_leaks(bio_err);
228 if (bio_err != NULL)
229 {
230 BIO_free(bio_err);
231 bio_err = NULL;
232 }
233#ifdef OPENSSL_SYS_NETWARE
234 if (!ret) printf("ERROR\n");
235#endif
236 EXIT(!ret);
237 return(0);
238 }
239
240static int MS_CALLBACK dsa_cb(int p, int n, BN_GENCB *arg)
241 {
242 char c='*';
243 static int ok=0,num=0;
244
245 if (p == 0) { c='.'; num++; };
246 if (p == 1) c='+';
247 if (p == 2) { c='*'; ok++; }
248 if (p == 3) c='\n';
249 BIO_write(arg->arg,&c,1);
250 (void)BIO_flush(arg->arg);
251
252 if (!ok && (p == 0) && (num > 1))
253 {
254 BIO_printf((BIO *)arg,"error in dsatest\n");
255 return 0;
256 }
257 return 1;
258 }
259#endif
diff --git a/src/lib/libcrypto/dsa/fips186a.txt b/src/lib/libcrypto/dsa/fips186a.txt
new file mode 100644
index 0000000000..3a2e0a0d51
--- /dev/null
+++ b/src/lib/libcrypto/dsa/fips186a.txt
@@ -0,0 +1,122 @@
1The origional FIPE 180 used SHA-0 (FIPS 180) for its appendix 5
2examples. This is an updated version that uses SHA-1 (FIPS 180-1)
3supplied to me by Wei Dai
4--
5 APPENDIX 5. EXAMPLE OF THE DSA
6
7
8This appendix is for informational purposes only and is not required to meet
9the standard.
10
11Let L = 512 (size of p). The values in this example are expressed in
12hexadecimal notation. The p and q given here were generated by the prime
13generation standard described in appendix 2 using the 160-bit SEED:
14
15 d5014e4b 60ef2ba8 b6211b40 62ba3224 e0427dd3
16
17With this SEED, the algorithm found p and q when the counter was at 105.
18
19x was generated by the algorithm described in appendix 3, section 3.1, using
20the SHA to construct G (as in appendix 3, section 3.3) and a 160-bit XSEED:
21
22XSEED =
23
24 bd029bbe 7f51960b cf9edb2b 61f06f0f eb5a38b6
25
26t =
27 67452301 EFCDAB89 98BADCFE 10325476 C3D2E1F0
28
29x = G(t,XSEED) mod q
30
31k was generated by the algorithm described in appendix 3, section 3.2, using
32the SHA to construct G (as in appendix 3, section 3.3) and a 160-bit KSEED:
33
34KSEED =
35
36 687a66d9 0648f993 867e121f 4ddf9ddb 01205584
37
38t =
39 EFCDAB89 98BADCFE 10325476 C3D2E1F0 67452301
40
41k = G(t,KSEED) mod q
42
43Finally:
44
45h = 2
46
47p =
48 8df2a494 492276aa 3d25759b b06869cb eac0d83a fb8d0cf7
49 cbb8324f 0d7882e5 d0762fc5 b7210eaf c2e9adac 32ab7aac
50 49693dfb f83724c2 ec0736ee 31c80291
51
52
53q =
54 c773218c 737ec8ee 993b4f2d ed30f48e dace915f
55
56
57g =
58 626d0278 39ea0a13 413163a5 5b4cb500 299d5522 956cefcb
59 3bff10f3 99ce2c2e 71cb9de5 fa24babf 58e5b795 21925c9c
60 c42e9f6f 464b088c c572af53 e6d78802
61
62
63x =
64 2070b322 3dba372f de1c0ffc 7b2e3b49 8b260614
65
66
67k =
68 358dad57 1462710f 50e254cf 1a376b2b deaadfbf
69
70
71kinv =
72
73 0d516729 8202e49b 4116ac10 4fc3f415 ae52f917
74
75M = ASCII form of "abc" (See FIPS PUB 180-1, Appendix A)
76
77SHA(M) =
78
79 a9993e36 4706816a ba3e2571 7850c26c 9cd0d89d
80
81
82y =
83
84 19131871 d75b1612 a819f29d 78d1b0d7 346f7aa7 7bb62a85
85 9bfd6c56 75da9d21 2d3a36ef 1672ef66 0b8c7c25 5cc0ec74
86 858fba33 f44c0669 9630a76b 030ee333
87
88
89r =
90 8bac1ab6 6410435c b7181f95 b16ab97c 92b341c0
91
92s =
93 41e2345f 1f56df24 58f426d1 55b4ba2d b6dcd8c8
94
95
96w =
97 9df4ece5 826be95f ed406d41 b43edc0b 1c18841b
98
99
100u1 =
101 bf655bd0 46f0b35e c791b004 804afcbb 8ef7d69d
102
103
104u2 =
105 821a9263 12e97ade abcc8d08 2b527897 8a2df4b0
106
107
108gu1 mod p =
109
110 51b1bf86 7888e5f3 af6fb476 9dd016bc fe667a65 aafc2753
111 9063bd3d 2b138b4c e02cc0c0 2ec62bb6 7306c63e 4db95bbf
112 6f96662a 1987a21b e4ec1071 010b6069
113
114
115yu2 mod p =
116
117 8b510071 2957e950 50d6b8fd 376a668e 4b0d633c 1e46e665
118 5c611a72 e2b28483 be52c74d 4b30de61 a668966e dc307a67
119 c19441f4 22bf3c34 08aeba1f 0a4dbec7
120
121v =
122 8bac1ab6 6410435c b7181f95 b16ab97c 92b341c0
diff --git a/src/lib/libcrypto/dso/Makefile b/src/lib/libcrypto/dso/Makefile
new file mode 100644
index 0000000000..fb2709ed63
--- /dev/null
+++ b/src/lib/libcrypto/dso/Makefile
@@ -0,0 +1,150 @@
1#
2# OpenSSL/crypto/dso/Makefile
3#
4
5DIR= dso
6TOP= ../..
7CC= cc
8INCLUDES= -I.. -I$(TOP) -I../../include
9CFLAG=-g
10MAKEFILE= Makefile
11AR= ar r
12
13CFLAGS= $(INCLUDES) $(CFLAG)
14
15GENERAL=Makefile
16TEST=
17APPS=
18
19LIB=$(TOP)/libcrypto.a
20LIBSRC= dso_dl.c dso_dlfcn.c dso_err.c dso_lib.c dso_null.c \
21 dso_openssl.c dso_win32.c dso_vms.c dso_beos.c
22LIBOBJ= dso_dl.o dso_dlfcn.o dso_err.o dso_lib.o dso_null.o \
23 dso_openssl.o dso_win32.o dso_vms.o dso_beos.o
24
25SRC= $(LIBSRC)
26
27EXHEADER= dso.h
28HEADER= $(EXHEADER)
29
30ALL= $(GENERAL) $(SRC) $(HEADER)
31
32top:
33 (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all)
34
35all: lib
36
37lib: $(LIBOBJ)
38 $(AR) $(LIB) $(LIBOBJ)
39 $(RANLIB) $(LIB) || echo Never mind.
40 @touch lib
41
42files:
43 $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
44
45links:
46 @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
47 @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
48 @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
49
50install:
51 @[ -n "$(INSTALLTOP)" ] # should be set by top Makefile...
52 @headerlist="$(EXHEADER)"; for i in $$headerlist ; \
53 do \
54 (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
55 chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
56 done;
57
58tags:
59 ctags $(SRC)
60
61tests:
62
63lint:
64 lint -DLINT $(INCLUDES) $(SRC)>fluff
65
66depend:
67 @[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile...
68 $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
69
70dclean:
71 $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
72 mv -f Makefile.new $(MAKEFILE)
73
74clean:
75 rm -f *.o */*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
76
77# DO NOT DELETE THIS LINE -- make depend depends on it.
78
79dso_beos.o: ../../e_os.h ../../include/openssl/bio.h
80dso_beos.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
81dso_beos.o: ../../include/openssl/dso.h ../../include/openssl/e_os2.h
82dso_beos.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
83dso_beos.o: ../../include/openssl/opensslconf.h
84dso_beos.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
85dso_beos.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
86dso_beos.o: ../../include/openssl/symhacks.h ../cryptlib.h dso_beos.c
87dso_dl.o: ../../e_os.h ../../include/openssl/bio.h
88dso_dl.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
89dso_dl.o: ../../include/openssl/dso.h ../../include/openssl/e_os2.h
90dso_dl.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
91dso_dl.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
92dso_dl.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
93dso_dl.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
94dso_dl.o: ../cryptlib.h dso_dl.c
95dso_dlfcn.o: ../../e_os.h ../../include/openssl/bio.h
96dso_dlfcn.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
97dso_dlfcn.o: ../../include/openssl/dso.h ../../include/openssl/e_os2.h
98dso_dlfcn.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
99dso_dlfcn.o: ../../include/openssl/opensslconf.h
100dso_dlfcn.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
101dso_dlfcn.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
102dso_dlfcn.o: ../../include/openssl/symhacks.h ../cryptlib.h dso_dlfcn.c
103dso_err.o: ../../include/openssl/bio.h ../../include/openssl/crypto.h
104dso_err.o: ../../include/openssl/dso.h ../../include/openssl/e_os2.h
105dso_err.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
106dso_err.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
107dso_err.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
108dso_err.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
109dso_err.o: dso_err.c
110dso_lib.o: ../../e_os.h ../../include/openssl/bio.h
111dso_lib.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
112dso_lib.o: ../../include/openssl/dso.h ../../include/openssl/e_os2.h
113dso_lib.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
114dso_lib.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
115dso_lib.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
116dso_lib.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
117dso_lib.o: ../cryptlib.h dso_lib.c
118dso_null.o: ../../e_os.h ../../include/openssl/bio.h
119dso_null.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
120dso_null.o: ../../include/openssl/dso.h ../../include/openssl/e_os2.h
121dso_null.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
122dso_null.o: ../../include/openssl/opensslconf.h
123dso_null.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
124dso_null.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
125dso_null.o: ../../include/openssl/symhacks.h ../cryptlib.h dso_null.c
126dso_openssl.o: ../../e_os.h ../../include/openssl/bio.h
127dso_openssl.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
128dso_openssl.o: ../../include/openssl/dso.h ../../include/openssl/e_os2.h
129dso_openssl.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
130dso_openssl.o: ../../include/openssl/opensslconf.h
131dso_openssl.o: ../../include/openssl/opensslv.h
132dso_openssl.o: ../../include/openssl/ossl_typ.h
133dso_openssl.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
134dso_openssl.o: ../../include/openssl/symhacks.h ../cryptlib.h dso_openssl.c
135dso_vms.o: ../../e_os.h ../../include/openssl/bio.h
136dso_vms.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
137dso_vms.o: ../../include/openssl/dso.h ../../include/openssl/e_os2.h
138dso_vms.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
139dso_vms.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
140dso_vms.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
141dso_vms.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
142dso_vms.o: ../cryptlib.h dso_vms.c
143dso_win32.o: ../../e_os.h ../../include/openssl/bio.h
144dso_win32.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
145dso_win32.o: ../../include/openssl/dso.h ../../include/openssl/e_os2.h
146dso_win32.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
147dso_win32.o: ../../include/openssl/opensslconf.h
148dso_win32.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
149dso_win32.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
150dso_win32.o: ../../include/openssl/symhacks.h ../cryptlib.h dso_win32.c
diff --git a/src/lib/libcrypto/dso/README b/src/lib/libcrypto/dso/README
new file mode 100644
index 0000000000..d0bc9a89fb
--- /dev/null
+++ b/src/lib/libcrypto/dso/README
@@ -0,0 +1,22 @@
1NOTES
2-----
3
4I've checked out HPUX (well, version 11 at least) and shl_t is
5a pointer type so it's safe to use in the way it has been in
6dso_dl.c. On the other hand, HPUX11 support dlfcn too and
7according to their man page, prefer developers to move to that.
8I'll leave Richard's changes there as I guess dso_dl is needed
9for HPUX10.20.
10
11There is now a callback scheme in place where filename conversion can
12(a) be turned off altogether through the use of the
13 DSO_FLAG_NO_NAME_TRANSLATION flag,
14(b) be handled by default using the default DSO_METHOD's converter
15(c) overriden per-DSO by setting the override callback
16(d) a mix of (b) and (c) - eg. implement an override callback that;
17 (i) checks if we're win32 (if(strstr(dso->meth->name, "win32")....)
18 and if so, convert "blah" into "blah32.dll" (the default is
19 otherwise to make it "blah.dll").
20 (ii) default to the normal behaviour - we're not on win32, eg.
21 finish with (return dso->meth->dso_name_converter(dso,NULL)).
22
diff --git a/src/lib/libcrypto/dso/dso_beos.c b/src/lib/libcrypto/dso/dso_beos.c
new file mode 100644
index 0000000000..553966e699
--- /dev/null
+++ b/src/lib/libcrypto/dso/dso_beos.c
@@ -0,0 +1,270 @@
1/* dso_beos.c */
2/* Written by Marcin Konicki (ahwayakchih@neoni.net) for the OpenSSL
3 * project 2000.
4 */
5/* ====================================================================
6 * Copyright (c) 2000 The OpenSSL Project. All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 *
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 *
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in
17 * the documentation and/or other materials provided with the
18 * distribution.
19 *
20 * 3. All advertising materials mentioning features or use of this
21 * software must display the following acknowledgment:
22 * "This product includes software developed by the OpenSSL Project
23 * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
24 *
25 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
26 * endorse or promote products derived from this software without
27 * prior written permission. For written permission, please contact
28 * licensing@OpenSSL.org.
29 *
30 * 5. Products derived from this software may not be called "OpenSSL"
31 * nor may "OpenSSL" appear in their names without prior written
32 * permission of the OpenSSL Project.
33 *
34 * 6. Redistributions of any form whatsoever must retain the following
35 * acknowledgment:
36 * "This product includes software developed by the OpenSSL Project
37 * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
38 *
39 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
40 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
41 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
42 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
43 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
44 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
45 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
46 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
47 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
48 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
49 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50 * OF THE POSSIBILITY OF SUCH DAMAGE.
51 * ====================================================================
52 *
53 * This product includes cryptographic software written by Eric Young
54 * (eay@cryptsoft.com). This product includes software written by Tim
55 * Hudson (tjh@cryptsoft.com).
56 *
57 */
58
59#include <stdio.h>
60#include <string.h>
61#include "cryptlib.h"
62#include <openssl/dso.h>
63
64#if !defined(OPENSSL_SYS_BEOS)
65DSO_METHOD *DSO_METHOD_beos(void)
66 {
67 return NULL;
68 }
69#else
70
71#include <kernel/image.h>
72
73static int beos_load(DSO *dso);
74static int beos_unload(DSO *dso);
75static void *beos_bind_var(DSO *dso, const char *symname);
76static DSO_FUNC_TYPE beos_bind_func(DSO *dso, const char *symname);
77#if 0
78static int beos_unbind_var(DSO *dso, char *symname, void *symptr);
79static int beos_unbind_func(DSO *dso, char *symname, DSO_FUNC_TYPE symptr);
80static int beos_init(DSO *dso);
81static int beos_finish(DSO *dso);
82static long beos_ctrl(DSO *dso, int cmd, long larg, void *parg);
83#endif
84static char *beos_name_converter(DSO *dso, const char *filename);
85
86static DSO_METHOD dso_meth_beos = {
87 "OpenSSL 'beos' shared library method",
88 beos_load,
89 beos_unload,
90 beos_bind_var,
91 beos_bind_func,
92/* For now, "unbind" doesn't exist */
93#if 0
94 NULL, /* unbind_var */
95 NULL, /* unbind_func */
96#endif
97 NULL, /* ctrl */
98 beos_name_converter,
99 NULL, /* init */
100 NULL /* finish */
101 };
102
103DSO_METHOD *DSO_METHOD_beos(void)
104 {
105 return(&dso_meth_beos);
106 }
107
108/* For this DSO_METHOD, our meth_data STACK will contain;
109 * (i) a pointer to the handle (image_id) returned from
110 * load_add_on().
111 */
112
113static int beos_load(DSO *dso)
114 {
115 image_id id;
116 /* See applicable comments from dso_dl.c */
117 char *filename = DSO_convert_filename(dso, NULL);
118
119 if(filename == NULL)
120 {
121 DSOerr(DSO_F_BEOS_LOAD,DSO_R_NO_FILENAME);
122 goto err;
123 }
124 id = load_add_on(filename);
125 if(id < 1)
126 {
127 DSOerr(DSO_F_BEOS_LOAD,DSO_R_LOAD_FAILED);
128 ERR_add_error_data(3, "filename(", filename, ")");
129 goto err;
130 }
131 if(!sk_push(dso->meth_data, (char *)id))
132 {
133 DSOerr(DSO_F_BEOS_LOAD,DSO_R_STACK_ERROR);
134 goto err;
135 }
136 /* Success */
137 dso->loaded_filename = filename;
138 return(1);
139err:
140 /* Cleanup !*/
141 if(filename != NULL)
142 OPENSSL_free(filename);
143 if(id > 0)
144 unload_add_on(id);
145 return(0);
146 }
147
148static int beos_unload(DSO *dso)
149 {
150 image_id id;
151 if(dso == NULL)
152 {
153 DSOerr(DSO_F_BEOS_UNLOAD,ERR_R_PASSED_NULL_PARAMETER);
154 return(0);
155 }
156 if(sk_num(dso->meth_data) < 1)
157 return(1);
158 id = (image_id)sk_pop(dso->meth_data);
159 if(id < 1)
160 {
161 DSOerr(DSO_F_BEOS_UNLOAD,DSO_R_NULL_HANDLE);
162 return(0);
163 }
164 if(unload_add_on(id) != B_OK)
165 {
166 DSOerr(DSO_F_BEOS_UNLOAD,DSO_R_UNLOAD_FAILED);
167 /* We should push the value back onto the stack in
168 * case of a retry. */
169 sk_push(dso->meth_data, (char *)id);
170 return(0);
171 }
172 return(1);
173 }
174
175static void *beos_bind_var(DSO *dso, const char *symname)
176 {
177 image_id id;
178 void *sym;
179
180 if((dso == NULL) || (symname == NULL))
181 {
182 DSOerr(DSO_F_BEOS_BIND_VAR,ERR_R_PASSED_NULL_PARAMETER);
183 return(NULL);
184 }
185 if(sk_num(dso->meth_data) < 1)
186 {
187 DSOerr(DSO_F_BEOS_BIND_VAR,DSO_R_STACK_ERROR);
188 return(NULL);
189 }
190 id = (image_id)sk_value(dso->meth_data, sk_num(dso->meth_data) - 1);
191 if(id < 1)
192 {
193 DSOerr(DSO_F_BEOS_BIND_VAR,DSO_R_NULL_HANDLE);
194 return(NULL);
195 }
196 if(get_image_symbol(id, symname, B_SYMBOL_TYPE_DATA, &sym) != B_OK)
197 {
198 DSOerr(DSO_F_BEOS_BIND_VAR,DSO_R_SYM_FAILURE);
199 ERR_add_error_data(3, "symname(", symname, ")");
200 return(NULL);
201 }
202 return(sym);
203 }
204
205static DSO_FUNC_TYPE beos_bind_func(DSO *dso, const char *symname)
206 {
207 image_id id;
208 void *sym;
209
210 if((dso == NULL) || (symname == NULL))
211 {
212 DSOerr(DSO_F_BEOS_BIND_FUNC,ERR_R_PASSED_NULL_PARAMETER);
213 return(NULL);
214 }
215 if(sk_num(dso->meth_data) < 1)
216 {
217 DSOerr(DSO_F_BEOS_BIND_FUNC,DSO_R_STACK_ERROR);
218 return(NULL);
219 }
220 id = (image_id)sk_value(dso->meth_data, sk_num(dso->meth_data) - 1);
221 if(id < 1)
222 {
223 DSOerr(DSO_F_BEOS_BIND_FUNC,DSO_R_NULL_HANDLE);
224 return(NULL);
225 }
226 if(get_image_symbol(id, symname, B_SYMBOL_TYPE_TEXT, &sym) != B_OK)
227 {
228 DSOerr(DSO_F_BEOS_BIND_FUNC,DSO_R_SYM_FAILURE);
229 ERR_add_error_data(3, "symname(", symname, ")");
230 return(NULL);
231 }
232 return((DSO_FUNC_TYPE)sym);
233 }
234
235/* This one is the same as the one in dlfcn */
236static char *beos_name_converter(DSO *dso, const char *filename)
237 {
238 char *translated;
239 int len, rsize, transform;
240
241 len = strlen(filename);
242 rsize = len + 1;
243 transform = (strstr(filename, "/") == NULL);
244 if(transform)
245 {
246 /* We will convert this to "%s.so" or "lib%s.so" */
247 rsize += 3; /* The length of ".so" */
248 if ((DSO_flags(dso) & DSO_FLAG_NAME_TRANSLATION_EXT_ONLY) == 0)
249 rsize += 3; /* The length of "lib" */
250 }
251 translated = OPENSSL_malloc(rsize);
252 if(translated == NULL)
253 {
254 DSOerr(DSO_F_BEOS_NAME_CONVERTER,
255 DSO_R_NAME_TRANSLATION_FAILED);
256 return(NULL);
257 }
258 if(transform)
259 {
260 if ((DSO_flags(dso) & DSO_FLAG_NAME_TRANSLATION_EXT_ONLY) == 0)
261 sprintf(translated, "lib%s.so", filename);
262 else
263 sprintf(translated, "%s.so", filename);
264 }
265 else
266 sprintf(translated, "%s", filename);
267 return(translated);
268 }
269
270#endif
diff --git a/src/lib/libcrypto/dso/dso_dl.c b/src/lib/libcrypto/dso/dso_dl.c
new file mode 100644
index 0000000000..c3b4f6cf45
--- /dev/null
+++ b/src/lib/libcrypto/dso/dso_dl.c
@@ -0,0 +1,395 @@
1/* dso_dl.c -*- mode:C; c-file-style: "eay" -*- */
2/* Written by Richard Levitte (richard@levitte.org) for the OpenSSL
3 * project 2000.
4 */
5/* ====================================================================
6 * Copyright (c) 2000 The OpenSSL Project. All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 *
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 *
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in
17 * the documentation and/or other materials provided with the
18 * distribution.
19 *
20 * 3. All advertising materials mentioning features or use of this
21 * software must display the following acknowledgment:
22 * "This product includes software developed by the OpenSSL Project
23 * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
24 *
25 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
26 * endorse or promote products derived from this software without
27 * prior written permission. For written permission, please contact
28 * licensing@OpenSSL.org.
29 *
30 * 5. Products derived from this software may not be called "OpenSSL"
31 * nor may "OpenSSL" appear in their names without prior written
32 * permission of the OpenSSL Project.
33 *
34 * 6. Redistributions of any form whatsoever must retain the following
35 * acknowledgment:
36 * "This product includes software developed by the OpenSSL Project
37 * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
38 *
39 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
40 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
41 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
42 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
43 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
44 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
45 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
46 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
47 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
48 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
49 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50 * OF THE POSSIBILITY OF SUCH DAMAGE.
51 * ====================================================================
52 *
53 * This product includes cryptographic software written by Eric Young
54 * (eay@cryptsoft.com). This product includes software written by Tim
55 * Hudson (tjh@cryptsoft.com).
56 *
57 */
58
59#include <stdio.h>
60#include "cryptlib.h"
61#include <openssl/dso.h>
62
63#ifndef DSO_DL
64DSO_METHOD *DSO_METHOD_dl(void)
65 {
66 return NULL;
67 }
68#else
69
70#include <dl.h>
71
72/* Part of the hack in "dl_load" ... */
73#define DSO_MAX_TRANSLATED_SIZE 256
74
75static int dl_load(DSO *dso);
76static int dl_unload(DSO *dso);
77static void *dl_bind_var(DSO *dso, const char *symname);
78static DSO_FUNC_TYPE dl_bind_func(DSO *dso, const char *symname);
79#if 0
80static int dl_unbind_var(DSO *dso, char *symname, void *symptr);
81static int dl_unbind_func(DSO *dso, char *symname, DSO_FUNC_TYPE symptr);
82static int dl_init(DSO *dso);
83static int dl_finish(DSO *dso);
84static int dl_ctrl(DSO *dso, int cmd, long larg, void *parg);
85#endif
86static char *dl_name_converter(DSO *dso, const char *filename);
87static char *dl_merger(DSO *dso, const char *filespec1, const char *filespec2);
88static int dl_pathbyaddr(void *addr,char *path,int sz);
89static void *dl_globallookup(const char *name);
90
91static DSO_METHOD dso_meth_dl = {
92 "OpenSSL 'dl' shared library method",
93 dl_load,
94 dl_unload,
95 dl_bind_var,
96 dl_bind_func,
97/* For now, "unbind" doesn't exist */
98#if 0
99 NULL, /* unbind_var */
100 NULL, /* unbind_func */
101#endif
102 NULL, /* ctrl */
103 dl_name_converter,
104 dl_merger,
105 NULL, /* init */
106 NULL, /* finish */
107 dl_pathbyaddr,
108 dl_globallookup
109 };
110
111DSO_METHOD *DSO_METHOD_dl(void)
112 {
113 return(&dso_meth_dl);
114 }
115
116/* For this DSO_METHOD, our meth_data STACK will contain;
117 * (i) the handle (shl_t) returned from shl_load().
118 * NB: I checked on HPUX11 and shl_t is itself a pointer
119 * type so the cast is safe.
120 */
121
122static int dl_load(DSO *dso)
123 {
124 shl_t ptr = NULL;
125 /* We don't do any fancy retries or anything, just take the method's
126 * (or DSO's if it has the callback set) best translation of the
127 * platform-independant filename and try once with that. */
128 char *filename= DSO_convert_filename(dso, NULL);
129
130 if(filename == NULL)
131 {
132 DSOerr(DSO_F_DL_LOAD,DSO_R_NO_FILENAME);
133 goto err;
134 }
135 ptr = shl_load(filename, BIND_IMMEDIATE |
136 (dso->flags&DSO_FLAG_NO_NAME_TRANSLATION?0:DYNAMIC_PATH), 0L);
137 if(ptr == NULL)
138 {
139 DSOerr(DSO_F_DL_LOAD,DSO_R_LOAD_FAILED);
140 ERR_add_error_data(4, "filename(", filename, "): ",
141 strerror(errno));
142 goto err;
143 }
144 if(!sk_push(dso->meth_data, (char *)ptr))
145 {
146 DSOerr(DSO_F_DL_LOAD,DSO_R_STACK_ERROR);
147 goto err;
148 }
149 /* Success, stick the converted filename we've loaded under into the DSO
150 * (it also serves as the indicator that we are currently loaded). */
151 dso->loaded_filename = filename;
152 return(1);
153err:
154 /* Cleanup! */
155 if(filename != NULL)
156 OPENSSL_free(filename);
157 if(ptr != NULL)
158 shl_unload(ptr);
159 return(0);
160 }
161
162static int dl_unload(DSO *dso)
163 {
164 shl_t ptr;
165 if(dso == NULL)
166 {
167 DSOerr(DSO_F_DL_UNLOAD,ERR_R_PASSED_NULL_PARAMETER);
168 return(0);
169 }
170 if(sk_num(dso->meth_data) < 1)
171 return(1);
172 /* Is this statement legal? */
173 ptr = (shl_t)sk_pop(dso->meth_data);
174 if(ptr == NULL)
175 {
176 DSOerr(DSO_F_DL_UNLOAD,DSO_R_NULL_HANDLE);
177 /* Should push the value back onto the stack in
178 * case of a retry. */
179 sk_push(dso->meth_data, (char *)ptr);
180 return(0);
181 }
182 shl_unload(ptr);
183 return(1);
184 }
185
186static void *dl_bind_var(DSO *dso, const char *symname)
187 {
188 shl_t ptr;
189 void *sym;
190
191 if((dso == NULL) || (symname == NULL))
192 {
193 DSOerr(DSO_F_DL_BIND_VAR,ERR_R_PASSED_NULL_PARAMETER);
194 return(NULL);
195 }
196 if(sk_num(dso->meth_data) < 1)
197 {
198 DSOerr(DSO_F_DL_BIND_VAR,DSO_R_STACK_ERROR);
199 return(NULL);
200 }
201 ptr = (shl_t)sk_value(dso->meth_data, sk_num(dso->meth_data) - 1);
202 if(ptr == NULL)
203 {
204 DSOerr(DSO_F_DL_BIND_VAR,DSO_R_NULL_HANDLE);
205 return(NULL);
206 }
207 if (shl_findsym(&ptr, symname, TYPE_UNDEFINED, &sym) < 0)
208 {
209 DSOerr(DSO_F_DL_BIND_VAR,DSO_R_SYM_FAILURE);
210 ERR_add_error_data(4, "symname(", symname, "): ",
211 strerror(errno));
212 return(NULL);
213 }
214 return(sym);
215 }
216
217static DSO_FUNC_TYPE dl_bind_func(DSO *dso, const char *symname)
218 {
219 shl_t ptr;
220 void *sym;
221
222 if((dso == NULL) || (symname == NULL))
223 {
224 DSOerr(DSO_F_DL_BIND_FUNC,ERR_R_PASSED_NULL_PARAMETER);
225 return(NULL);
226 }
227 if(sk_num(dso->meth_data) < 1)
228 {
229 DSOerr(DSO_F_DL_BIND_FUNC,DSO_R_STACK_ERROR);
230 return(NULL);
231 }
232 ptr = (shl_t)sk_value(dso->meth_data, sk_num(dso->meth_data) - 1);
233 if(ptr == NULL)
234 {
235 DSOerr(DSO_F_DL_BIND_FUNC,DSO_R_NULL_HANDLE);
236 return(NULL);
237 }
238 if (shl_findsym(&ptr, symname, TYPE_UNDEFINED, &sym) < 0)
239 {
240 DSOerr(DSO_F_DL_BIND_FUNC,DSO_R_SYM_FAILURE);
241 ERR_add_error_data(4, "symname(", symname, "): ",
242 strerror(errno));
243 return(NULL);
244 }
245 return((DSO_FUNC_TYPE)sym);
246 }
247
248static char *dl_merger(DSO *dso, const char *filespec1, const char *filespec2)
249 {
250 char *merged;
251
252 if(!filespec1 && !filespec2)
253 {
254 DSOerr(DSO_F_DL_MERGER,
255 ERR_R_PASSED_NULL_PARAMETER);
256 return(NULL);
257 }
258 /* If the first file specification is a rooted path, it rules.
259 same goes if the second file specification is missing. */
260 if (!filespec2 || filespec1[0] == '/')
261 {
262 size_t len = strlen(filespec1) + 1;
263 merged = OPENSSL_malloc(len);
264 if(!merged)
265 {
266 DSOerr(DSO_F_DL_MERGER,
267 ERR_R_MALLOC_FAILURE);
268 return(NULL);
269 }
270 memcpy(merged, filespec1, len);
271 }
272 /* If the first file specification is missing, the second one rules. */
273 else if (!filespec1)
274 {
275 size_t len = strlen(filespec2) + 1;
276 merged = OPENSSL_malloc(strlen(filespec2) + 1);
277 if(!merged)
278 {
279 DSOerr(DSO_F_DL_MERGER,
280 ERR_R_MALLOC_FAILURE);
281 return(NULL);
282 }
283 memcpy(merged, filespec2, len);
284 }
285 else
286 /* This part isn't as trivial as it looks. It assumes that
287 the second file specification really is a directory, and
288 makes no checks whatsoever. Therefore, the result becomes
289 the concatenation of filespec2 followed by a slash followed
290 by filespec1. */
291 {
292 size_t spec2len, len;
293
294 spec2len = (filespec2 ? strlen(filespec2) : 0);
295 len = spec2len + (filespec1 ? strlen(filespec1) : 0);
296
297 if(filespec2 && filespec2[spec2len - 1] == '/')
298 {
299 spec2len--;
300 len--;
301 }
302 merged = OPENSSL_malloc(len + 2);
303 if(!merged)
304 {
305 DSOerr(DSO_F_DL_MERGER,
306 ERR_R_MALLOC_FAILURE);
307 return(NULL);
308 }
309 strlcpy(merged, filespec2, len + 2);
310 merged[spec2len] = '/';
311 strlcpy(&merged[spec2len + 1], filespec1, 1 + len - spec2len);
312 }
313 return(merged);
314 }
315
316/* This function is identical to the one in dso_dlfcn.c, but as it is highly
317 * unlikely that both the "dl" *and* "dlfcn" variants are being compiled at the
318 * same time, there's no great duplicating the code. Figuring out an elegant
319 * way to share one copy of the code would be more difficult and would not
320 * leave the implementations independant. */
321#if defined(__hpux)
322static const char extension[] = ".sl";
323#else
324static const char extension[] = ".so";
325#endif
326static char *dl_name_converter(DSO *dso, const char *filename)
327 {
328 char *translated;
329 int len, rsize, transform;
330
331 len = strlen(filename);
332 rsize = len + 1;
333 transform = (strstr(filename, "/") == NULL);
334 {
335 /* We will convert this to "%s.s?" or "lib%s.s?" */
336 rsize += strlen(extension);/* The length of ".s?" */
337 if ((DSO_flags(dso) & DSO_FLAG_NAME_TRANSLATION_EXT_ONLY) == 0)
338 rsize += 3; /* The length of "lib" */
339 }
340 translated = OPENSSL_malloc(rsize);
341 if(translated == NULL)
342 {
343 DSOerr(DSO_F_DL_NAME_CONVERTER,
344 DSO_R_NAME_TRANSLATION_FAILED);
345 return(NULL);
346 }
347 if(transform)
348 {
349 if ((DSO_flags(dso) & DSO_FLAG_NAME_TRANSLATION_EXT_ONLY) == 0)
350 sprintf(translated, "lib%s%s", filename, extension);
351 else
352 sprintf(translated, "%s%s", filename, extension);
353 }
354 else
355 sprintf(translated, "%s", filename);
356 return(translated);
357 }
358
359static int dl_pathbyaddr(void *addr,char *path,int sz)
360 {
361 struct shl_descriptor inf;
362 int i,len;
363
364 if (addr == NULL)
365 {
366 union { int(*f)(void*,char*,int); void *p; } t =
367 { dl_pathbyaddr };
368 addr = t.p;
369 }
370
371 for (i=-1;shl_get_r(i,&inf)==0;i++)
372 {
373 if (((size_t)addr >= inf.tstart && (size_t)addr < inf.tend) ||
374 ((size_t)addr >= inf.dstart && (size_t)addr < inf.dend))
375 {
376 len = (int)strlen(inf.filename);
377 if (sz <= 0) return len+1;
378 if (len >= sz) len=sz-1;
379 memcpy(path,inf.filename,len);
380 path[len++] = 0;
381 return len;
382 }
383 }
384
385 return -1;
386 }
387
388static void *dl_globallookup(const char *name)
389 {
390 void *ret;
391 shl_t h = NULL;
392
393 return shl_findsym(&h,name,TYPE_UNDEFINED,&ret) ? NULL : ret;
394 }
395#endif /* DSO_DL */
diff --git a/src/lib/libcrypto/dso/dso_dlfcn.c b/src/lib/libcrypto/dso/dso_dlfcn.c
index 5f2254806c..e21b9f6dbc 100644
--- a/src/lib/libcrypto/dso/dso_dlfcn.c
+++ b/src/lib/libcrypto/dso/dso_dlfcn.c
@@ -86,7 +86,7 @@ DSO_METHOD *DSO_METHOD_dlfcn(void)
86# if defined(_AIX) || defined(__CYGWIN__) || \ 86# if defined(_AIX) || defined(__CYGWIN__) || \
87 defined(__SCO_VERSION__) || defined(_SCO_ELF) || \ 87 defined(__SCO_VERSION__) || defined(_SCO_ELF) || \
88 (defined(__osf__) && !defined(RTLD_NEXT)) || \ 88 (defined(__osf__) && !defined(RTLD_NEXT)) || \
89 (defined(__OpenBSD__) && !defined(RTLD_SELF)) || \ 89 (defined(__OpenBSD__) && (!defined(__ELF__) || !defined(RTLD_SELF))) || \
90 defined(__ANDROID__) 90 defined(__ANDROID__)
91# undef HAVE_DLINFO 91# undef HAVE_DLINFO
92# endif 92# endif
@@ -297,6 +297,7 @@ static char *dlfcn_merger(DSO *dso, const char *filespec1,
297 const char *filespec2) 297 const char *filespec2)
298 { 298 {
299 char *merged; 299 char *merged;
300 size_t len;
300 301
301 if(!filespec1 && !filespec2) 302 if(!filespec1 && !filespec2)
302 { 303 {
@@ -308,17 +309,19 @@ static char *dlfcn_merger(DSO *dso, const char *filespec1,
308 same goes if the second file specification is missing. */ 309 same goes if the second file specification is missing. */
309 if (!filespec2 || (filespec1 != NULL && filespec1[0] == '/')) 310 if (!filespec2 || (filespec1 != NULL && filespec1[0] == '/'))
310 { 311 {
311 merged = OPENSSL_malloc(strlen(filespec1) + 1); 312 len = strlen(filespec1) + 1;
313 merged = OPENSSL_malloc(len);
312 if(!merged) 314 if(!merged)
313 { 315 {
314 DSOerr(DSO_F_DLFCN_MERGER, ERR_R_MALLOC_FAILURE); 316 DSOerr(DSO_F_DLFCN_MERGER, ERR_R_MALLOC_FAILURE);
315 return(NULL); 317 return(NULL);
316 } 318 }
317 strcpy(merged, filespec1); 319 strlcpy(merged, filespec1, len);
318 } 320 }
319 /* If the first file specification is missing, the second one rules. */ 321 /* If the first file specification is missing, the second one rules. */
320 else if (!filespec1) 322 else if (!filespec1)
321 { 323 {
324 len = strlen(filespec2) + 1;
322 merged = OPENSSL_malloc(strlen(filespec2) + 1); 325 merged = OPENSSL_malloc(strlen(filespec2) + 1);
323 if(!merged) 326 if(!merged)
324 { 327 {
@@ -326,7 +329,7 @@ static char *dlfcn_merger(DSO *dso, const char *filespec1,
326 ERR_R_MALLOC_FAILURE); 329 ERR_R_MALLOC_FAILURE);
327 return(NULL); 330 return(NULL);
328 } 331 }
329 strcpy(merged, filespec2); 332 strlcpy(merged, filespec2, len);
330 } 333 }
331 else 334 else
332 /* This part isn't as trivial as it looks. It assumes that 335 /* This part isn't as trivial as it looks. It assumes that
@@ -352,9 +355,9 @@ static char *dlfcn_merger(DSO *dso, const char *filespec1,
352 ERR_R_MALLOC_FAILURE); 355 ERR_R_MALLOC_FAILURE);
353 return(NULL); 356 return(NULL);
354 } 357 }
355 strcpy(merged, filespec2); 358 strlcpy(merged, filespec2, len + 2);
356 merged[spec2len] = '/'; 359 merged[spec2len] = '/';
357 strcpy(&merged[spec2len + 1], filespec1); 360 strlcpy(&merged[spec2len + 1], filespec1, len + 1 - spec2len);
358 } 361 }
359 return(merged); 362 return(merged);
360 } 363 }
@@ -393,16 +396,16 @@ static char *dlfcn_name_converter(DSO *dso, const char *filename)
393 if(transform) 396 if(transform)
394 { 397 {
395 if ((DSO_flags(dso) & DSO_FLAG_NAME_TRANSLATION_EXT_ONLY) == 0) 398 if ((DSO_flags(dso) & DSO_FLAG_NAME_TRANSLATION_EXT_ONLY) == 0)
396 sprintf(translated, "lib%s" DSO_ext, filename); 399 snprintf(translated, rsize, "lib%s" DSO_ext, filename);
397 else 400 else
398 sprintf(translated, "%s" DSO_ext, filename); 401 snprintf(translated, rsize, "%s" DSO_ext, filename);
399 } 402 }
400 else 403 else
401 sprintf(translated, "%s", filename); 404 snprintf(translated, rsize, "%s", filename);
402 return(translated); 405 return(translated);
403 } 406 }
404 407
405#ifdef __sgi 408#if defined(__sgi) && !defined(__OpenBSD__)
406/* 409/*
407This is a quote from IRIX manual for dladdr(3c): 410This is a quote from IRIX manual for dladdr(3c):
408 411
diff --git a/src/lib/libcrypto/dso/dso_vms.c b/src/lib/libcrypto/dso/dso_vms.c
new file mode 100644
index 0000000000..eee20d14f1
--- /dev/null
+++ b/src/lib/libcrypto/dso/dso_vms.c
@@ -0,0 +1,525 @@
1/* dso_vms.c -*- mode:C; c-file-style: "eay" -*- */
2/* Written by Richard Levitte (richard@levitte.org) for the OpenSSL
3 * project 2000.
4 */
5/* ====================================================================
6 * Copyright (c) 2000 The OpenSSL Project. All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 *
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 *
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in
17 * the documentation and/or other materials provided with the
18 * distribution.
19 *
20 * 3. All advertising materials mentioning features or use of this
21 * software must display the following acknowledgment:
22 * "This product includes software developed by the OpenSSL Project
23 * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
24 *
25 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
26 * endorse or promote products derived from this software without
27 * prior written permission. For written permission, please contact
28 * licensing@OpenSSL.org.
29 *
30 * 5. Products derived from this software may not be called "OpenSSL"
31 * nor may "OpenSSL" appear in their names without prior written
32 * permission of the OpenSSL Project.
33 *
34 * 6. Redistributions of any form whatsoever must retain the following
35 * acknowledgment:
36 * "This product includes software developed by the OpenSSL Project
37 * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
38 *
39 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
40 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
41 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
42 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
43 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
44 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
45 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
46 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
47 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
48 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
49 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50 * OF THE POSSIBILITY OF SUCH DAMAGE.
51 * ====================================================================
52 *
53 * This product includes cryptographic software written by Eric Young
54 * (eay@cryptsoft.com). This product includes software written by Tim
55 * Hudson (tjh@cryptsoft.com).
56 *
57 */
58
59#include <stdio.h>
60#include <string.h>
61#include <errno.h>
62#include "cryptlib.h"
63#include <openssl/dso.h>
64#ifdef OPENSSL_SYS_VMS
65#pragma message disable DOLLARID
66#include <rms.h>
67#include <lib$routines.h>
68#include <stsdef.h>
69#include <descrip.h>
70#include <starlet.h>
71#include "vms_rms.h"
72#endif
73
74/* Some compiler options may mask the declaration of "_malloc32". */
75#if __INITIAL_POINTER_SIZE && defined _ANSI_C_SOURCE
76# if __INITIAL_POINTER_SIZE == 64
77# pragma pointer_size save
78# pragma pointer_size 32
79 void * _malloc32 (__size_t);
80# pragma pointer_size restore
81# endif /* __INITIAL_POINTER_SIZE == 64 */
82#endif /* __INITIAL_POINTER_SIZE && defined _ANSI_C_SOURCE */
83
84
85#ifndef OPENSSL_SYS_VMS
86DSO_METHOD *DSO_METHOD_vms(void)
87 {
88 return NULL;
89 }
90#else
91#pragma message disable DOLLARID
92
93static int vms_load(DSO *dso);
94static int vms_unload(DSO *dso);
95static void *vms_bind_var(DSO *dso, const char *symname);
96static DSO_FUNC_TYPE vms_bind_func(DSO *dso, const char *symname);
97#if 0
98static int vms_unbind_var(DSO *dso, char *symname, void *symptr);
99static int vms_unbind_func(DSO *dso, char *symname, DSO_FUNC_TYPE symptr);
100static int vms_init(DSO *dso);
101static int vms_finish(DSO *dso);
102static long vms_ctrl(DSO *dso, int cmd, long larg, void *parg);
103#endif
104static char *vms_name_converter(DSO *dso, const char *filename);
105static char *vms_merger(DSO *dso, const char *filespec1,
106 const char *filespec2);
107
108static DSO_METHOD dso_meth_vms = {
109 "OpenSSL 'VMS' shared library method",
110 vms_load,
111 NULL, /* unload */
112 vms_bind_var,
113 vms_bind_func,
114/* For now, "unbind" doesn't exist */
115#if 0
116 NULL, /* unbind_var */
117 NULL, /* unbind_func */
118#endif
119 NULL, /* ctrl */
120 vms_name_converter,
121 vms_merger,
122 NULL, /* init */
123 NULL /* finish */
124 };
125
126/* On VMS, the only "handle" is the file name. LIB$FIND_IMAGE_SYMBOL depends
127 * on the reference to the file name being the same for all calls regarding
128 * one shared image, so we'll just store it in an instance of the following
129 * structure and put a pointer to that instance in the meth_data stack.
130 */
131typedef struct dso_internal_st
132 {
133 /* This should contain the name only, no directory,
134 * no extension, nothing but a name. */
135 struct dsc$descriptor_s filename_dsc;
136 char filename[ NAMX_MAXRSS+ 1];
137 /* This contains whatever is not in filename, if needed.
138 * Normally not defined. */
139 struct dsc$descriptor_s imagename_dsc;
140 char imagename[ NAMX_MAXRSS+ 1];
141 } DSO_VMS_INTERNAL;
142
143DSO_METHOD *DSO_METHOD_vms(void)
144 {
145 return(&dso_meth_vms);
146 }
147
148static int vms_load(DSO *dso)
149 {
150 void *ptr = NULL;
151 /* See applicable comments in dso_dl.c */
152 char *filename = DSO_convert_filename(dso, NULL);
153
154/* Ensure 32-bit pointer for "p", and appropriate malloc() function. */
155#if __INITIAL_POINTER_SIZE == 64
156# define DSO_MALLOC _malloc32
157# pragma pointer_size save
158# pragma pointer_size 32
159#else /* __INITIAL_POINTER_SIZE == 64 */
160# define DSO_MALLOC OPENSSL_malloc
161#endif /* __INITIAL_POINTER_SIZE == 64 [else] */
162
163 DSO_VMS_INTERNAL *p = NULL;
164
165#if __INITIAL_POINTER_SIZE == 64
166# pragma pointer_size restore
167#endif /* __INITIAL_POINTER_SIZE == 64 */
168
169 const char *sp1, *sp2; /* Search result */
170
171 if(filename == NULL)
172 {
173 DSOerr(DSO_F_VMS_LOAD,DSO_R_NO_FILENAME);
174 goto err;
175 }
176
177 /* A file specification may look like this:
178 *
179 * node::dev:[dir-spec]name.type;ver
180 *
181 * or (for compatibility with TOPS-20):
182 *
183 * node::dev:<dir-spec>name.type;ver
184 *
185 * and the dir-spec uses '.' as separator. Also, a dir-spec
186 * may consist of several parts, with mixed use of [] and <>:
187 *
188 * [dir1.]<dir2>
189 *
190 * We need to split the file specification into the name and
191 * the rest (both before and after the name itself).
192 */
193 /* Start with trying to find the end of a dir-spec, and save the
194 position of the byte after in sp1 */
195 sp1 = strrchr(filename, ']');
196 sp2 = strrchr(filename, '>');
197 if (sp1 == NULL) sp1 = sp2;
198 if (sp2 != NULL && sp2 > sp1) sp1 = sp2;
199 if (sp1 == NULL) sp1 = strrchr(filename, ':');
200 if (sp1 == NULL)
201 sp1 = filename;
202 else
203 sp1++; /* The byte after the found character */
204 /* Now, let's see if there's a type, and save the position in sp2 */
205 sp2 = strchr(sp1, '.');
206 /* If we found it, that's where we'll cut. Otherwise, look for a
207 version number and save the position in sp2 */
208 if (sp2 == NULL) sp2 = strchr(sp1, ';');
209 /* If there was still nothing to find, set sp2 to point at the end of
210 the string */
211 if (sp2 == NULL) sp2 = sp1 + strlen(sp1);
212
213 /* Check that we won't get buffer overflows */
214 if (sp2 - sp1 > FILENAME_MAX
215 || (sp1 - filename) + strlen(sp2) > FILENAME_MAX)
216 {
217 DSOerr(DSO_F_VMS_LOAD,DSO_R_FILENAME_TOO_BIG);
218 goto err;
219 }
220
221 p = DSO_MALLOC(sizeof(DSO_VMS_INTERNAL));
222 if(p == NULL)
223 {
224 DSOerr(DSO_F_VMS_LOAD,ERR_R_MALLOC_FAILURE);
225 goto err;
226 }
227
228 strncpy(p->filename, sp1, sp2-sp1);
229 p->filename[sp2-sp1] = '\0';
230
231 strncpy(p->imagename, filename, sp1-filename);
232 p->imagename[sp1-filename] = '\0';
233 strcat(p->imagename, sp2);
234
235 p->filename_dsc.dsc$w_length = strlen(p->filename);
236 p->filename_dsc.dsc$b_dtype = DSC$K_DTYPE_T;
237 p->filename_dsc.dsc$b_class = DSC$K_CLASS_S;
238 p->filename_dsc.dsc$a_pointer = p->filename;
239 p->imagename_dsc.dsc$w_length = strlen(p->imagename);
240 p->imagename_dsc.dsc$b_dtype = DSC$K_DTYPE_T;
241 p->imagename_dsc.dsc$b_class = DSC$K_CLASS_S;
242 p->imagename_dsc.dsc$a_pointer = p->imagename;
243
244 if(!sk_void_push(dso->meth_data, (char *)p))
245 {
246 DSOerr(DSO_F_VMS_LOAD,DSO_R_STACK_ERROR);
247 goto err;
248 }
249
250 /* Success (for now, we lie. We actually do not know...) */
251 dso->loaded_filename = filename;
252 return(1);
253err:
254 /* Cleanup! */
255 if(p != NULL)
256 OPENSSL_free(p);
257 if(filename != NULL)
258 OPENSSL_free(filename);
259 return(0);
260 }
261
262/* Note that this doesn't actually unload the shared image, as there is no
263 * such thing in VMS. Next time it get loaded again, a new copy will
264 * actually be loaded.
265 */
266static int vms_unload(DSO *dso)
267 {
268 DSO_VMS_INTERNAL *p;
269 if(dso == NULL)
270 {
271 DSOerr(DSO_F_VMS_UNLOAD,ERR_R_PASSED_NULL_PARAMETER);
272 return(0);
273 }
274 if(sk_void_num(dso->meth_data) < 1)
275 return(1);
276 p = (DSO_VMS_INTERNAL *)sk_void_pop(dso->meth_data);
277 if(p == NULL)
278 {
279 DSOerr(DSO_F_VMS_UNLOAD,DSO_R_NULL_HANDLE);
280 return(0);
281 }
282 /* Cleanup */
283 OPENSSL_free(p);
284 return(1);
285 }
286
287/* We must do this in a separate function because of the way the exception
288 handler works (it makes this function return */
289static int do_find_symbol(DSO_VMS_INTERNAL *ptr,
290 struct dsc$descriptor_s *symname_dsc, void **sym,
291 unsigned long flags)
292 {
293 /* Make sure that signals are caught and returned instead of
294 aborting the program. The exception handler gets unestablished
295 automatically on return from this function. */
296 lib$establish(lib$sig_to_ret);
297
298 if(ptr->imagename_dsc.dsc$w_length)
299 return lib$find_image_symbol(&ptr->filename_dsc,
300 symname_dsc, sym,
301 &ptr->imagename_dsc, flags);
302 else
303 return lib$find_image_symbol(&ptr->filename_dsc,
304 symname_dsc, sym,
305 0, flags);
306 }
307
308void vms_bind_sym(DSO *dso, const char *symname, void **sym)
309 {
310 DSO_VMS_INTERNAL *ptr;
311 int status;
312#if 0
313 int flags = (1<<4); /* LIB$M_FIS_MIXEDCASE, but this symbol isn't
314 defined in VMS older than 7.0 or so */
315#else
316 int flags = 0;
317#endif
318 struct dsc$descriptor_s symname_dsc;
319
320/* Arrange 32-bit pointer to (copied) string storage, if needed. */
321#if __INITIAL_POINTER_SIZE == 64
322# define SYMNAME symname_32p
323# pragma pointer_size save
324# pragma pointer_size 32
325 char *symname_32p;
326# pragma pointer_size restore
327 char symname_32[ NAMX_MAXRSS+ 1];
328#else /* __INITIAL_POINTER_SIZE == 64 */
329# define SYMNAME ((char *) symname)
330#endif /* __INITIAL_POINTER_SIZE == 64 [else] */
331
332 *sym = NULL;
333
334 if((dso == NULL) || (symname == NULL))
335 {
336 DSOerr(DSO_F_VMS_BIND_SYM,ERR_R_PASSED_NULL_PARAMETER);
337 return;
338 }
339
340#if __INITIAL_POINTER_SIZE == 64
341 /* Copy the symbol name to storage with a 32-bit pointer. */
342 symname_32p = symname_32;
343 strcpy( symname_32p, symname);
344#endif /* __INITIAL_POINTER_SIZE == 64 [else] */
345
346 symname_dsc.dsc$w_length = strlen(SYMNAME);
347 symname_dsc.dsc$b_dtype = DSC$K_DTYPE_T;
348 symname_dsc.dsc$b_class = DSC$K_CLASS_S;
349 symname_dsc.dsc$a_pointer = SYMNAME;
350
351 if(sk_void_num(dso->meth_data) < 1)
352 {
353 DSOerr(DSO_F_VMS_BIND_SYM,DSO_R_STACK_ERROR);
354 return;
355 }
356 ptr = (DSO_VMS_INTERNAL *)sk_void_value(dso->meth_data,
357 sk_void_num(dso->meth_data) - 1);
358 if(ptr == NULL)
359 {
360 DSOerr(DSO_F_VMS_BIND_SYM,DSO_R_NULL_HANDLE);
361 return;
362 }
363
364 if(dso->flags & DSO_FLAG_UPCASE_SYMBOL) flags = 0;
365
366 status = do_find_symbol(ptr, &symname_dsc, sym, flags);
367
368 if(!$VMS_STATUS_SUCCESS(status))
369 {
370 unsigned short length;
371 char errstring[257];
372 struct dsc$descriptor_s errstring_dsc;
373
374 errstring_dsc.dsc$w_length = sizeof(errstring);
375 errstring_dsc.dsc$b_dtype = DSC$K_DTYPE_T;
376 errstring_dsc.dsc$b_class = DSC$K_CLASS_S;
377 errstring_dsc.dsc$a_pointer = errstring;
378
379 *sym = NULL;
380
381 status = sys$getmsg(status, &length, &errstring_dsc, 1, 0);
382
383 if (!$VMS_STATUS_SUCCESS(status))
384 lib$signal(status); /* This is really bad. Abort! */
385 else
386 {
387 errstring[length] = '\0';
388
389 DSOerr(DSO_F_VMS_BIND_SYM,DSO_R_SYM_FAILURE);
390 if (ptr->imagename_dsc.dsc$w_length)
391 ERR_add_error_data(9,
392 "Symbol ", symname,
393 " in ", ptr->filename,
394 " (", ptr->imagename, ")",
395 ": ", errstring);
396 else
397 ERR_add_error_data(6,
398 "Symbol ", symname,
399 " in ", ptr->filename,
400 ": ", errstring);
401 }
402 return;
403 }
404 return;
405 }
406
407static void *vms_bind_var(DSO *dso, const char *symname)
408 {
409 void *sym = 0;
410 vms_bind_sym(dso, symname, &sym);
411 return sym;
412 }
413
414static DSO_FUNC_TYPE vms_bind_func(DSO *dso, const char *symname)
415 {
416 DSO_FUNC_TYPE sym = 0;
417 vms_bind_sym(dso, symname, (void **)&sym);
418 return sym;
419 }
420
421
422static char *vms_merger(DSO *dso, const char *filespec1, const char *filespec2)
423 {
424 int status;
425 int filespec1len, filespec2len;
426 struct FAB fab;
427 struct NAMX_STRUCT nam;
428 char esa[ NAMX_MAXRSS+ 1];
429 char *merged;
430
431/* Arrange 32-bit pointer to (copied) string storage, if needed. */
432#if __INITIAL_POINTER_SIZE == 64
433# define FILESPEC1 filespec1_32p;
434# define FILESPEC2 filespec2_32p;
435# pragma pointer_size save
436# pragma pointer_size 32
437 char *filespec1_32p;
438 char *filespec2_32p;
439# pragma pointer_size restore
440 char filespec1_32[ NAMX_MAXRSS+ 1];
441 char filespec2_32[ NAMX_MAXRSS+ 1];
442#else /* __INITIAL_POINTER_SIZE == 64 */
443# define FILESPEC1 ((char *) filespec1)
444# define FILESPEC2 ((char *) filespec2)
445#endif /* __INITIAL_POINTER_SIZE == 64 [else] */
446
447 if (!filespec1) filespec1 = "";
448 if (!filespec2) filespec2 = "";
449 filespec1len = strlen(filespec1);
450 filespec2len = strlen(filespec2);
451
452#if __INITIAL_POINTER_SIZE == 64
453 /* Copy the file names to storage with a 32-bit pointer. */
454 filespec1_32p = filespec1_32;
455 filespec2_32p = filespec2_32;
456 strcpy( filespec1_32p, filespec1);
457 strcpy( filespec2_32p, filespec2);
458#endif /* __INITIAL_POINTER_SIZE == 64 [else] */
459
460 fab = cc$rms_fab;
461 nam = CC_RMS_NAMX;
462
463 FAB_OR_NAML( fab, nam).FAB_OR_NAML_FNA = FILESPEC1;
464 FAB_OR_NAML( fab, nam).FAB_OR_NAML_FNS = filespec1len;
465 FAB_OR_NAML( fab, nam).FAB_OR_NAML_DNA = FILESPEC2;
466 FAB_OR_NAML( fab, nam).FAB_OR_NAML_DNS = filespec2len;
467 NAMX_DNA_FNA_SET( fab)
468
469 nam.NAMX_ESA = esa;
470 nam.NAMX_ESS = NAMX_MAXRSS;
471 nam.NAMX_NOP = NAM$M_SYNCHK | NAM$M_PWD;
472 SET_NAMX_NO_SHORT_UPCASE( nam);
473
474 fab.FAB_NAMX = &nam;
475
476 status = sys$parse(&fab, 0, 0);
477
478 if(!$VMS_STATUS_SUCCESS(status))
479 {
480 unsigned short length;
481 char errstring[257];
482 struct dsc$descriptor_s errstring_dsc;
483
484 errstring_dsc.dsc$w_length = sizeof(errstring);
485 errstring_dsc.dsc$b_dtype = DSC$K_DTYPE_T;
486 errstring_dsc.dsc$b_class = DSC$K_CLASS_S;
487 errstring_dsc.dsc$a_pointer = errstring;
488
489 status = sys$getmsg(status, &length, &errstring_dsc, 1, 0);
490
491 if (!$VMS_STATUS_SUCCESS(status))
492 lib$signal(status); /* This is really bad. Abort! */
493 else
494 {
495 errstring[length] = '\0';
496
497 DSOerr(DSO_F_VMS_MERGER,DSO_R_FAILURE);
498 ERR_add_error_data(7,
499 "filespec \"", filespec1, "\", ",
500 "defaults \"", filespec2, "\": ",
501 errstring);
502 }
503 return(NULL);
504 }
505
506 merged = OPENSSL_malloc( nam.NAMX_ESL+ 1);
507 if(!merged)
508 goto malloc_err;
509 strncpy( merged, nam.NAMX_ESA, nam.NAMX_ESL);
510 merged[ nam.NAMX_ESL] = '\0';
511 return(merged);
512 malloc_err:
513 DSOerr(DSO_F_VMS_MERGER,
514 ERR_R_MALLOC_FAILURE);
515 }
516
517static char *vms_name_converter(DSO *dso, const char *filename)
518 {
519 int len = strlen(filename);
520 char *not_translated = OPENSSL_malloc(len+1);
521 strcpy(not_translated,filename);
522 return(not_translated);
523 }
524
525#endif /* OPENSSL_SYS_VMS */
diff --git a/src/lib/libcrypto/dso/dso_win32.c b/src/lib/libcrypto/dso/dso_win32.c
new file mode 100644
index 0000000000..6fb6c54181
--- /dev/null
+++ b/src/lib/libcrypto/dso/dso_win32.c
@@ -0,0 +1,844 @@
1/* dso_win32.c -*- mode:C; c-file-style: "eay" -*- */
2/* Written by Geoff Thorpe (geoff@geoffthorpe.net) for the OpenSSL
3 * project 2000.
4 */
5/* ====================================================================
6 * Copyright (c) 2000 The OpenSSL Project. All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 *
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 *
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in
17 * the documentation and/or other materials provided with the
18 * distribution.
19 *
20 * 3. All advertising materials mentioning features or use of this
21 * software must display the following acknowledgment:
22 * "This product includes software developed by the OpenSSL Project
23 * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
24 *
25 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
26 * endorse or promote products derived from this software without
27 * prior written permission. For written permission, please contact
28 * licensing@OpenSSL.org.
29 *
30 * 5. Products derived from this software may not be called "OpenSSL"
31 * nor may "OpenSSL" appear in their names without prior written
32 * permission of the OpenSSL Project.
33 *
34 * 6. Redistributions of any form whatsoever must retain the following
35 * acknowledgment:
36 * "This product includes software developed by the OpenSSL Project
37 * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
38 *
39 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
40 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
41 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
42 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
43 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
44 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
45 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
46 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
47 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
48 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
49 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50 * OF THE POSSIBILITY OF SUCH DAMAGE.
51 * ====================================================================
52 *
53 * This product includes cryptographic software written by Eric Young
54 * (eay@cryptsoft.com). This product includes software written by Tim
55 * Hudson (tjh@cryptsoft.com).
56 *
57 */
58
59#include <stdio.h>
60#include <string.h>
61#include "cryptlib.h"
62#include <openssl/dso.h>
63
64#if !defined(DSO_WIN32)
65DSO_METHOD *DSO_METHOD_win32(void)
66 {
67 return NULL;
68 }
69#else
70
71#ifdef _WIN32_WCE
72# if _WIN32_WCE < 300
73static FARPROC GetProcAddressA(HMODULE hModule,LPCSTR lpProcName)
74 {
75 WCHAR lpProcNameW[64];
76 int i;
77
78 for (i=0;lpProcName[i] && i<64;i++)
79 lpProcNameW[i] = (WCHAR)lpProcName[i];
80 if (i==64) return NULL;
81 lpProcNameW[i] = 0;
82
83 return GetProcAddressW(hModule,lpProcNameW);
84 }
85# endif
86# undef GetProcAddress
87# define GetProcAddress GetProcAddressA
88
89static HINSTANCE LoadLibraryA(LPCSTR lpLibFileName)
90 {
91 WCHAR *fnamw;
92 size_t len_0=strlen(lpLibFileName)+1,i;
93
94#ifdef _MSC_VER
95 fnamw = (WCHAR *)_alloca (len_0*sizeof(WCHAR));
96#else
97 fnamw = (WCHAR *)alloca (len_0*sizeof(WCHAR));
98#endif
99 if (fnamw == NULL)
100 {
101 SetLastError(ERROR_NOT_ENOUGH_MEMORY);
102 return NULL;
103 }
104
105#if defined(_WIN32_WCE) && _WIN32_WCE>=101
106 if (!MultiByteToWideChar(CP_ACP,0,lpLibFileName,len_0,fnamw,len_0))
107#endif
108 for (i=0;i<len_0;i++) fnamw[i]=(WCHAR)lpLibFileName[i];
109
110 return LoadLibraryW(fnamw);
111 }
112#endif
113
114/* Part of the hack in "win32_load" ... */
115#define DSO_MAX_TRANSLATED_SIZE 256
116
117static int win32_load(DSO *dso);
118static int win32_unload(DSO *dso);
119static void *win32_bind_var(DSO *dso, const char *symname);
120static DSO_FUNC_TYPE win32_bind_func(DSO *dso, const char *symname);
121#if 0
122static int win32_unbind_var(DSO *dso, char *symname, void *symptr);
123static int win32_unbind_func(DSO *dso, char *symname, DSO_FUNC_TYPE symptr);
124static int win32_init(DSO *dso);
125static int win32_finish(DSO *dso);
126static long win32_ctrl(DSO *dso, int cmd, long larg, void *parg);
127#endif
128static char *win32_name_converter(DSO *dso, const char *filename);
129static char *win32_merger(DSO *dso, const char *filespec1,
130 const char *filespec2);
131static int win32_pathbyaddr(void *addr,char *path,int sz);
132static void *win32_globallookup(const char *name);
133
134static const char *openssl_strnchr(const char *string, int c, size_t len);
135
136static DSO_METHOD dso_meth_win32 = {
137 "OpenSSL 'win32' shared library method",
138 win32_load,
139 win32_unload,
140 win32_bind_var,
141 win32_bind_func,
142/* For now, "unbind" doesn't exist */
143#if 0
144 NULL, /* unbind_var */
145 NULL, /* unbind_func */
146#endif
147 NULL, /* ctrl */
148 win32_name_converter,
149 win32_merger,
150 NULL, /* init */
151 NULL, /* finish */
152 win32_pathbyaddr,
153 win32_globallookup
154 };
155
156DSO_METHOD *DSO_METHOD_win32(void)
157 {
158 return(&dso_meth_win32);
159 }
160
161/* For this DSO_METHOD, our meth_data STACK will contain;
162 * (i) a pointer to the handle (HINSTANCE) returned from
163 * LoadLibrary(), and copied.
164 */
165
166static int win32_load(DSO *dso)
167 {
168 HINSTANCE h = NULL, *p = NULL;
169 /* See applicable comments from dso_dl.c */
170 char *filename = DSO_convert_filename(dso, NULL);
171
172 if(filename == NULL)
173 {
174 DSOerr(DSO_F_WIN32_LOAD,DSO_R_NO_FILENAME);
175 goto err;
176 }
177 h = LoadLibraryA(filename);
178 if(h == NULL)
179 {
180 DSOerr(DSO_F_WIN32_LOAD,DSO_R_LOAD_FAILED);
181 ERR_add_error_data(3, "filename(", filename, ")");
182 goto err;
183 }
184 p = (HINSTANCE *)OPENSSL_malloc(sizeof(HINSTANCE));
185 if(p == NULL)
186 {
187 DSOerr(DSO_F_WIN32_LOAD,ERR_R_MALLOC_FAILURE);
188 goto err;
189 }
190 *p = h;
191 if(!sk_void_push(dso->meth_data, p))
192 {
193 DSOerr(DSO_F_WIN32_LOAD,DSO_R_STACK_ERROR);
194 goto err;
195 }
196 /* Success */
197 dso->loaded_filename = filename;
198 return(1);
199err:
200 /* Cleanup !*/
201 if(filename != NULL)
202 OPENSSL_free(filename);
203 if(p != NULL)
204 OPENSSL_free(p);
205 if(h != NULL)
206 FreeLibrary(h);
207 return(0);
208 }
209
210static int win32_unload(DSO *dso)
211 {
212 HINSTANCE *p;
213 if(dso == NULL)
214 {
215 DSOerr(DSO_F_WIN32_UNLOAD,ERR_R_PASSED_NULL_PARAMETER);
216 return(0);
217 }
218 if(sk_void_num(dso->meth_data) < 1)
219 return(1);
220 p = sk_void_pop(dso->meth_data);
221 if(p == NULL)
222 {
223 DSOerr(DSO_F_WIN32_UNLOAD,DSO_R_NULL_HANDLE);
224 return(0);
225 }
226 if(!FreeLibrary(*p))
227 {
228 DSOerr(DSO_F_WIN32_UNLOAD,DSO_R_UNLOAD_FAILED);
229 /* We should push the value back onto the stack in
230 * case of a retry. */
231 sk_void_push(dso->meth_data, p);
232 return(0);
233 }
234 /* Cleanup */
235 OPENSSL_free(p);
236 return(1);
237 }
238
239/* Using GetProcAddress for variables? TODO: Check this out in
240 * the Win32 API docs, there's probably a variant for variables. */
241static void *win32_bind_var(DSO *dso, const char *symname)
242 {
243 HINSTANCE *ptr;
244 void *sym;
245
246 if((dso == NULL) || (symname == NULL))
247 {
248 DSOerr(DSO_F_WIN32_BIND_VAR,ERR_R_PASSED_NULL_PARAMETER);
249 return(NULL);
250 }
251 if(sk_void_num(dso->meth_data) < 1)
252 {
253 DSOerr(DSO_F_WIN32_BIND_VAR,DSO_R_STACK_ERROR);
254 return(NULL);
255 }
256 ptr = sk_void_value(dso->meth_data, sk_void_num(dso->meth_data) - 1);
257 if(ptr == NULL)
258 {
259 DSOerr(DSO_F_WIN32_BIND_VAR,DSO_R_NULL_HANDLE);
260 return(NULL);
261 }
262 sym = GetProcAddress(*ptr, symname);
263 if(sym == NULL)
264 {
265 DSOerr(DSO_F_WIN32_BIND_VAR,DSO_R_SYM_FAILURE);
266 ERR_add_error_data(3, "symname(", symname, ")");
267 return(NULL);
268 }
269 return(sym);
270 }
271
272static DSO_FUNC_TYPE win32_bind_func(DSO *dso, const char *symname)
273 {
274 HINSTANCE *ptr;
275 void *sym;
276
277 if((dso == NULL) || (symname == NULL))
278 {
279 DSOerr(DSO_F_WIN32_BIND_FUNC,ERR_R_PASSED_NULL_PARAMETER);
280 return(NULL);
281 }
282 if(sk_void_num(dso->meth_data) < 1)
283 {
284 DSOerr(DSO_F_WIN32_BIND_FUNC,DSO_R_STACK_ERROR);
285 return(NULL);
286 }
287 ptr = sk_void_value(dso->meth_data, sk_void_num(dso->meth_data) - 1);
288 if(ptr == NULL)
289 {
290 DSOerr(DSO_F_WIN32_BIND_FUNC,DSO_R_NULL_HANDLE);
291 return(NULL);
292 }
293 sym = GetProcAddress(*ptr, symname);
294 if(sym == NULL)
295 {
296 DSOerr(DSO_F_WIN32_BIND_FUNC,DSO_R_SYM_FAILURE);
297 ERR_add_error_data(3, "symname(", symname, ")");
298 return(NULL);
299 }
300 return((DSO_FUNC_TYPE)sym);
301 }
302
303struct file_st
304 {
305 const char *node; int nodelen;
306 const char *device; int devicelen;
307 const char *predir; int predirlen;
308 const char *dir; int dirlen;
309 const char *file; int filelen;
310 };
311
312static struct file_st *win32_splitter(DSO *dso, const char *filename,
313 int assume_last_is_dir)
314 {
315 struct file_st *result = NULL;
316 enum { IN_NODE, IN_DEVICE, IN_FILE } position;
317 const char *start = filename;
318 char last;
319
320 if (!filename)
321 {
322 DSOerr(DSO_F_WIN32_SPLITTER,DSO_R_NO_FILENAME);
323 /*goto err;*/
324 return(NULL);
325 }
326
327 result = OPENSSL_malloc(sizeof(struct file_st));
328 if(result == NULL)
329 {
330 DSOerr(DSO_F_WIN32_SPLITTER,
331 ERR_R_MALLOC_FAILURE);
332 return(NULL);
333 }
334
335 memset(result, 0, sizeof(struct file_st));
336 position = IN_DEVICE;
337
338 if((filename[0] == '\\' && filename[1] == '\\')
339 || (filename[0] == '/' && filename[1] == '/'))
340 {
341 position = IN_NODE;
342 filename += 2;
343 start = filename;
344 result->node = start;
345 }
346
347 do
348 {
349 last = filename[0];
350 switch(last)
351 {
352 case ':':
353 if(position != IN_DEVICE)
354 {
355 DSOerr(DSO_F_WIN32_SPLITTER,
356 DSO_R_INCORRECT_FILE_SYNTAX);
357 /*goto err;*/
358 OPENSSL_free(result);
359 return(NULL);
360 }
361 result->device = start;
362 result->devicelen = (int)(filename - start);
363 position = IN_FILE;
364 start = ++filename;
365 result->dir = start;
366 break;
367 case '\\':
368 case '/':
369 if(position == IN_NODE)
370 {
371 result->nodelen = (int)(filename - start);
372 position = IN_FILE;
373 start = ++filename;
374 result->dir = start;
375 }
376 else if(position == IN_DEVICE)
377 {
378 position = IN_FILE;
379 filename++;
380 result->dir = start;
381 result->dirlen = (int)(filename - start);
382 start = filename;
383 }
384 else
385 {
386 filename++;
387 result->dirlen += (int)(filename - start);
388 start = filename;
389 }
390 break;
391 case '\0':
392 if(position == IN_NODE)
393 {
394 result->nodelen = (int)(filename - start);
395 }
396 else
397 {
398 if(filename - start > 0)
399 {
400 if (assume_last_is_dir)
401 {
402 if (position == IN_DEVICE)
403 {
404 result->dir = start;
405 result->dirlen = 0;
406 }
407 result->dirlen +=
408 (int)(filename - start);
409 }
410 else
411 {
412 result->file = start;
413 result->filelen =
414 (int)(filename - start);
415 }
416 }
417 }
418 break;
419 default:
420 filename++;
421 break;
422 }
423 }
424 while(last);
425
426 if(!result->nodelen) result->node = NULL;
427 if(!result->devicelen) result->device = NULL;
428 if(!result->dirlen) result->dir = NULL;
429 if(!result->filelen) result->file = NULL;
430
431 return(result);
432 }
433
434static char *win32_joiner(DSO *dso, const struct file_st *file_split)
435 {
436 int len = 0, offset = 0;
437 char *result = NULL;
438 const char *start;
439
440 if(!file_split)
441 {
442 DSOerr(DSO_F_WIN32_JOINER,
443 ERR_R_PASSED_NULL_PARAMETER);
444 return(NULL);
445 }
446 if(file_split->node)
447 {
448 len += 2 + file_split->nodelen; /* 2 for starting \\ */
449 if(file_split->predir || file_split->dir || file_split->file)
450 len++; /* 1 for ending \ */
451 }
452 else if(file_split->device)
453 {
454 len += file_split->devicelen + 1; /* 1 for ending : */
455 }
456 len += file_split->predirlen;
457 if(file_split->predir && (file_split->dir || file_split->file))
458 {
459 len++; /* 1 for ending \ */
460 }
461 len += file_split->dirlen;
462 if(file_split->dir && file_split->file)
463 {
464 len++; /* 1 for ending \ */
465 }
466 len += file_split->filelen;
467
468 if(!len)
469 {
470 DSOerr(DSO_F_WIN32_JOINER, DSO_R_EMPTY_FILE_STRUCTURE);
471 return(NULL);
472 }
473
474 result = OPENSSL_malloc(len + 1);
475 if (!result)
476 {
477 DSOerr(DSO_F_WIN32_JOINER,
478 ERR_R_MALLOC_FAILURE);
479 return(NULL);
480 }
481
482 if(file_split->node)
483 {
484 strcpy(&result[offset], "\\\\"); offset += 2;
485 strncpy(&result[offset], file_split->node,
486 file_split->nodelen); offset += file_split->nodelen;
487 if(file_split->predir || file_split->dir || file_split->file)
488 {
489 result[offset] = '\\'; offset++;
490 }
491 }
492 else if(file_split->device)
493 {
494 strncpy(&result[offset], file_split->device,
495 file_split->devicelen); offset += file_split->devicelen;
496 result[offset] = ':'; offset++;
497 }
498 start = file_split->predir;
499 while(file_split->predirlen > (start - file_split->predir))
500 {
501 const char *end = openssl_strnchr(start, '/',
502 file_split->predirlen - (start - file_split->predir));
503 if(!end)
504 end = start
505 + file_split->predirlen
506 - (start - file_split->predir);
507 strncpy(&result[offset], start,
508 end - start); offset += (int)(end - start);
509 result[offset] = '\\'; offset++;
510 start = end + 1;
511 }
512#if 0 /* Not needed, since the directory converter above already appeneded
513 a backslash */
514 if(file_split->predir && (file_split->dir || file_split->file))
515 {
516 result[offset] = '\\'; offset++;
517 }
518#endif
519 start = file_split->dir;
520 while(file_split->dirlen > (start - file_split->dir))
521 {
522 const char *end = openssl_strnchr(start, '/',
523 file_split->dirlen - (start - file_split->dir));
524 if(!end)
525 end = start
526 + file_split->dirlen
527 - (start - file_split->dir);
528 strncpy(&result[offset], start,
529 end - start); offset += (int)(end - start);
530 result[offset] = '\\'; offset++;
531 start = end + 1;
532 }
533#if 0 /* Not needed, since the directory converter above already appeneded
534 a backslash */
535 if(file_split->dir && file_split->file)
536 {
537 result[offset] = '\\'; offset++;
538 }
539#endif
540 strncpy(&result[offset], file_split->file,
541 file_split->filelen); offset += file_split->filelen;
542 result[offset] = '\0';
543 return(result);
544 }
545
546static char *win32_merger(DSO *dso, const char *filespec1, const char *filespec2)
547 {
548 char *merged = NULL;
549 struct file_st *filespec1_split = NULL;
550 struct file_st *filespec2_split = NULL;
551
552 if(!filespec1 && !filespec2)
553 {
554 DSOerr(DSO_F_WIN32_MERGER,
555 ERR_R_PASSED_NULL_PARAMETER);
556 return(NULL);
557 }
558 if (!filespec2)
559 {
560 merged = OPENSSL_malloc(strlen(filespec1) + 1);
561 if(!merged)
562 {
563 DSOerr(DSO_F_WIN32_MERGER,
564 ERR_R_MALLOC_FAILURE);
565 return(NULL);
566 }
567 strcpy(merged, filespec1);
568 }
569 else if (!filespec1)
570 {
571 merged = OPENSSL_malloc(strlen(filespec2) + 1);
572 if(!merged)
573 {
574 DSOerr(DSO_F_WIN32_MERGER,
575 ERR_R_MALLOC_FAILURE);
576 return(NULL);
577 }
578 strcpy(merged, filespec2);
579 }
580 else
581 {
582 filespec1_split = win32_splitter(dso, filespec1, 0);
583 if (!filespec1_split)
584 {
585 DSOerr(DSO_F_WIN32_MERGER,
586 ERR_R_MALLOC_FAILURE);
587 return(NULL);
588 }
589 filespec2_split = win32_splitter(dso, filespec2, 1);
590 if (!filespec2_split)
591 {
592 DSOerr(DSO_F_WIN32_MERGER,
593 ERR_R_MALLOC_FAILURE);
594 OPENSSL_free(filespec1_split);
595 return(NULL);
596 }
597
598 /* Fill in into filespec1_split */
599 if (!filespec1_split->node && !filespec1_split->device)
600 {
601 filespec1_split->node = filespec2_split->node;
602 filespec1_split->nodelen = filespec2_split->nodelen;
603 filespec1_split->device = filespec2_split->device;
604 filespec1_split->devicelen = filespec2_split->devicelen;
605 }
606 if (!filespec1_split->dir)
607 {
608 filespec1_split->dir = filespec2_split->dir;
609 filespec1_split->dirlen = filespec2_split->dirlen;
610 }
611 else if (filespec1_split->dir[0] != '\\'
612 && filespec1_split->dir[0] != '/')
613 {
614 filespec1_split->predir = filespec2_split->dir;
615 filespec1_split->predirlen = filespec2_split->dirlen;
616 }
617 if (!filespec1_split->file)
618 {
619 filespec1_split->file = filespec2_split->file;
620 filespec1_split->filelen = filespec2_split->filelen;
621 }
622
623 merged = win32_joiner(dso, filespec1_split);
624 }
625 OPENSSL_free(filespec1_split);
626 OPENSSL_free(filespec2_split);
627 return(merged);
628 }
629
630static char *win32_name_converter(DSO *dso, const char *filename)
631 {
632 char *translated;
633 int len, transform;
634
635 len = strlen(filename);
636 transform = ((strstr(filename, "/") == NULL) &&
637 (strstr(filename, "\\") == NULL) &&
638 (strstr(filename, ":") == NULL));
639 if(transform)
640 /* We will convert this to "%s.dll" */
641 translated = OPENSSL_malloc(len + 5);
642 else
643 /* We will simply duplicate filename */
644 translated = OPENSSL_malloc(len + 1);
645 if(translated == NULL)
646 {
647 DSOerr(DSO_F_WIN32_NAME_CONVERTER,
648 DSO_R_NAME_TRANSLATION_FAILED);
649 return(NULL);
650 }
651 if(transform)
652 sprintf(translated, "%s.dll", filename);
653 else
654 sprintf(translated, "%s", filename);
655 return(translated);
656 }
657
658static const char *openssl_strnchr(const char *string, int c, size_t len)
659 {
660 size_t i;
661 const char *p;
662 for (i = 0, p = string; i < len && *p; i++, p++)
663 {
664 if (*p == c)
665 return p;
666 }
667 return NULL;
668 }
669
670#include <tlhelp32.h>
671#ifdef _WIN32_WCE
672# define DLLNAME "TOOLHELP.DLL"
673#else
674# ifdef MODULEENTRY32
675# undef MODULEENTRY32 /* unmask the ASCII version! */
676# endif
677# define DLLNAME "KERNEL32.DLL"
678#endif
679
680typedef HANDLE (WINAPI *CREATETOOLHELP32SNAPSHOT)(DWORD, DWORD);
681typedef BOOL (WINAPI *CLOSETOOLHELP32SNAPSHOT)(HANDLE);
682typedef BOOL (WINAPI *MODULE32)(HANDLE, MODULEENTRY32 *);
683
684static int win32_pathbyaddr(void *addr,char *path,int sz)
685 {
686 HMODULE dll;
687 HANDLE hModuleSnap = INVALID_HANDLE_VALUE;
688 MODULEENTRY32 me32;
689 CREATETOOLHELP32SNAPSHOT create_snap;
690 CLOSETOOLHELP32SNAPSHOT close_snap;
691 MODULE32 module_first, module_next;
692 int len;
693
694 if (addr == NULL)
695 {
696 union { int(*f)(void*,char*,int); void *p; } t =
697 { win32_pathbyaddr };
698 addr = t.p;
699 }
700
701 dll = LoadLibrary(TEXT(DLLNAME));
702 if (dll == NULL)
703 {
704 DSOerr(DSO_F_WIN32_PATHBYADDR,DSO_R_UNSUPPORTED);
705 return -1;
706 }
707
708 create_snap = (CREATETOOLHELP32SNAPSHOT)
709 GetProcAddress(dll,"CreateToolhelp32Snapshot");
710 if (create_snap == NULL)
711 {
712 FreeLibrary(dll);
713 DSOerr(DSO_F_WIN32_PATHBYADDR,DSO_R_UNSUPPORTED);
714 return -1;
715 }
716 /* We take the rest for granted... */
717#ifdef _WIN32_WCE
718 close_snap = (CLOSETOOLHELP32SNAPSHOT)
719 GetProcAddress(dll,"CloseToolhelp32Snapshot");
720#else
721 close_snap = (CLOSETOOLHELP32SNAPSHOT)CloseHandle;
722#endif
723 module_first = (MODULE32)GetProcAddress(dll,"Module32First");
724 module_next = (MODULE32)GetProcAddress(dll,"Module32Next");
725
726 hModuleSnap = (*create_snap)(TH32CS_SNAPMODULE,0);
727 if( hModuleSnap == INVALID_HANDLE_VALUE )
728 {
729 FreeLibrary(dll);
730 DSOerr(DSO_F_WIN32_PATHBYADDR,DSO_R_UNSUPPORTED);
731 return -1;
732 }
733
734 me32.dwSize = sizeof(me32);
735
736 if(!(*module_first)(hModuleSnap,&me32))
737 {
738 (*close_snap)(hModuleSnap);
739 FreeLibrary(dll);
740 DSOerr(DSO_F_WIN32_PATHBYADDR,DSO_R_FAILURE);
741 return -1;
742 }
743
744 do {
745 if ((BYTE *)addr >= me32.modBaseAddr &&
746 (BYTE *)addr < me32.modBaseAddr+me32.modBaseSize)
747 {
748 (*close_snap)(hModuleSnap);
749 FreeLibrary(dll);
750#ifdef _WIN32_WCE
751# if _WIN32_WCE >= 101
752 return WideCharToMultiByte(CP_ACP,0,me32.szExePath,-1,
753 path,sz,NULL,NULL);
754# else
755 len = (int)wcslen(me32.szExePath);
756 if (sz <= 0) return len+1;
757 if (len >= sz) len=sz-1;
758 for(i=0;i<len;i++)
759 path[i] = (char)me32.szExePath[i];
760 path[len++] = 0;
761 return len;
762# endif
763#else
764 len = (int)strlen(me32.szExePath);
765 if (sz <= 0) return len+1;
766 if (len >= sz) len=sz-1;
767 memcpy(path,me32.szExePath,len);
768 path[len++] = 0;
769 return len;
770#endif
771 }
772 } while((*module_next)(hModuleSnap, &me32));
773
774 (*close_snap)(hModuleSnap);
775 FreeLibrary(dll);
776 return 0;
777 }
778
779static void *win32_globallookup(const char *name)
780 {
781 HMODULE dll;
782 HANDLE hModuleSnap = INVALID_HANDLE_VALUE;
783 MODULEENTRY32 me32;
784 CREATETOOLHELP32SNAPSHOT create_snap;
785 CLOSETOOLHELP32SNAPSHOT close_snap;
786 MODULE32 module_first, module_next;
787 FARPROC ret=NULL;
788
789 dll = LoadLibrary(TEXT(DLLNAME));
790 if (dll == NULL)
791 {
792 DSOerr(DSO_F_WIN32_GLOBALLOOKUP,DSO_R_UNSUPPORTED);
793 return NULL;
794 }
795
796 create_snap = (CREATETOOLHELP32SNAPSHOT)
797 GetProcAddress(dll,"CreateToolhelp32Snapshot");
798 if (create_snap == NULL)
799 {
800 FreeLibrary(dll);
801 DSOerr(DSO_F_WIN32_GLOBALLOOKUP,DSO_R_UNSUPPORTED);
802 return NULL;
803 }
804 /* We take the rest for granted... */
805#ifdef _WIN32_WCE
806 close_snap = (CLOSETOOLHELP32SNAPSHOT)
807 GetProcAddress(dll,"CloseToolhelp32Snapshot");
808#else
809 close_snap = (CLOSETOOLHELP32SNAPSHOT)CloseHandle;
810#endif
811 module_first = (MODULE32)GetProcAddress(dll,"Module32First");
812 module_next = (MODULE32)GetProcAddress(dll,"Module32Next");
813
814 hModuleSnap = (*create_snap)(TH32CS_SNAPMODULE,0);
815 if( hModuleSnap == INVALID_HANDLE_VALUE )
816 {
817 FreeLibrary(dll);
818 DSOerr(DSO_F_WIN32_GLOBALLOOKUP,DSO_R_UNSUPPORTED);
819 return NULL;
820 }
821
822 me32.dwSize = sizeof(me32);
823
824 if (!(*module_first)(hModuleSnap,&me32))
825 {
826 (*close_snap)(hModuleSnap);
827 FreeLibrary(dll);
828 return NULL;
829 }
830
831 do {
832 if ((ret = GetProcAddress(me32.hModule,name)))
833 {
834 (*close_snap)(hModuleSnap);
835 FreeLibrary(dll);
836 return ret;
837 }
838 } while((*module_next)(hModuleSnap,&me32));
839
840 (*close_snap)(hModuleSnap);
841 FreeLibrary(dll);
842 return NULL;
843 }
844#endif /* DSO_WIN32 */
diff --git a/src/lib/libcrypto/ebcdic.c b/src/lib/libcrypto/ebcdic.c
new file mode 100644
index 0000000000..43e53bcaf7
--- /dev/null
+++ b/src/lib/libcrypto/ebcdic.c
@@ -0,0 +1,221 @@
1/* crypto/ebcdic.c */
2
3#ifndef CHARSET_EBCDIC
4
5#include <openssl/e_os2.h>
6#if defined(PEDANTIC) || defined(__DECC) || defined(OPENSSL_SYS_MACOSX)
7static void *dummy=&dummy;
8#endif
9
10#else /*CHARSET_EBCDIC*/
11
12#include "ebcdic.h"
13/* Initial Port for Apache-1.3 by <Martin.Kraemer@Mch.SNI.De>
14 * Adapted for OpenSSL-0.9.4 by <Martin.Kraemer@Mch.SNI.De>
15 */
16
17#ifdef _OSD_POSIX
18/*
19 "BS2000 OSD" is a POSIX subsystem on a main frame.
20 It is made by Siemens AG, Germany, for their BS2000 mainframe machines.
21 Within the POSIX subsystem, the same character set was chosen as in
22 "native BS2000", namely EBCDIC. (EDF04)
23
24 The name "ASCII" in these routines is misleading: actually, conversion
25 is not between EBCDIC and ASCII, but EBCDIC(EDF04) and ISO-8859.1;
26 that means that (western european) national characters are preserved.
27
28 This table is identical to the one used by rsh/rcp/ftp and other POSIX tools.
29*/
30
31/* Here's the bijective ebcdic-to-ascii table: */
32const unsigned char os_toascii[256] = {
33/*00*/ 0x00, 0x01, 0x02, 0x03, 0x85, 0x09, 0x86, 0x7f,
34 0x87, 0x8d, 0x8e, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /*................*/
35/*10*/ 0x10, 0x11, 0x12, 0x13, 0x8f, 0x0a, 0x08, 0x97,
36 0x18, 0x19, 0x9c, 0x9d, 0x1c, 0x1d, 0x1e, 0x1f, /*................*/
37/*20*/ 0x80, 0x81, 0x82, 0x83, 0x84, 0x92, 0x17, 0x1b,
38 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x05, 0x06, 0x07, /*................*/
39/*30*/ 0x90, 0x91, 0x16, 0x93, 0x94, 0x95, 0x96, 0x04,
40 0x98, 0x99, 0x9a, 0x9b, 0x14, 0x15, 0x9e, 0x1a, /*................*/
41/*40*/ 0x20, 0xa0, 0xe2, 0xe4, 0xe0, 0xe1, 0xe3, 0xe5,
42 0xe7, 0xf1, 0x60, 0x2e, 0x3c, 0x28, 0x2b, 0x7c, /* .........`.<(+|*/
43/*50*/ 0x26, 0xe9, 0xea, 0xeb, 0xe8, 0xed, 0xee, 0xef,
44 0xec, 0xdf, 0x21, 0x24, 0x2a, 0x29, 0x3b, 0x9f, /*&.........!$*);.*/
45/*60*/ 0x2d, 0x2f, 0xc2, 0xc4, 0xc0, 0xc1, 0xc3, 0xc5,
46 0xc7, 0xd1, 0x5e, 0x2c, 0x25, 0x5f, 0x3e, 0x3f, /*-/........^,%_>?*/
47/*70*/ 0xf8, 0xc9, 0xca, 0xcb, 0xc8, 0xcd, 0xce, 0xcf,
48 0xcc, 0xa8, 0x3a, 0x23, 0x40, 0x27, 0x3d, 0x22, /*..........:#@'="*/
49/*80*/ 0xd8, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
50 0x68, 0x69, 0xab, 0xbb, 0xf0, 0xfd, 0xfe, 0xb1, /*.abcdefghi......*/
51/*90*/ 0xb0, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70,
52 0x71, 0x72, 0xaa, 0xba, 0xe6, 0xb8, 0xc6, 0xa4, /*.jklmnopqr......*/
53/*a0*/ 0xb5, 0xaf, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78,
54 0x79, 0x7a, 0xa1, 0xbf, 0xd0, 0xdd, 0xde, 0xae, /*..stuvwxyz......*/
55/*b0*/ 0xa2, 0xa3, 0xa5, 0xb7, 0xa9, 0xa7, 0xb6, 0xbc,
56 0xbd, 0xbe, 0xac, 0x5b, 0x5c, 0x5d, 0xb4, 0xd7, /*...........[\]..*/
57/*c0*/ 0xf9, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,
58 0x48, 0x49, 0xad, 0xf4, 0xf6, 0xf2, 0xf3, 0xf5, /*.ABCDEFGHI......*/
59/*d0*/ 0xa6, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50,
60 0x51, 0x52, 0xb9, 0xfb, 0xfc, 0xdb, 0xfa, 0xff, /*.JKLMNOPQR......*/
61/*e0*/ 0xd9, 0xf7, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58,
62 0x59, 0x5a, 0xb2, 0xd4, 0xd6, 0xd2, 0xd3, 0xd5, /*..STUVWXYZ......*/
63/*f0*/ 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
64 0x38, 0x39, 0xb3, 0x7b, 0xdc, 0x7d, 0xda, 0x7e /*0123456789.{.}.~*/
65};
66
67
68/* The ascii-to-ebcdic table: */
69const unsigned char os_toebcdic[256] = {
70/*00*/ 0x00, 0x01, 0x02, 0x03, 0x37, 0x2d, 0x2e, 0x2f,
71 0x16, 0x05, 0x15, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /*................*/
72/*10*/ 0x10, 0x11, 0x12, 0x13, 0x3c, 0x3d, 0x32, 0x26,
73 0x18, 0x19, 0x3f, 0x27, 0x1c, 0x1d, 0x1e, 0x1f, /*................*/
74/*20*/ 0x40, 0x5a, 0x7f, 0x7b, 0x5b, 0x6c, 0x50, 0x7d,
75 0x4d, 0x5d, 0x5c, 0x4e, 0x6b, 0x60, 0x4b, 0x61, /* !"#$%&'()*+,-./ */
76/*30*/ 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7,
77 0xf8, 0xf9, 0x7a, 0x5e, 0x4c, 0x7e, 0x6e, 0x6f, /*0123456789:;<=>?*/
78/*40*/ 0x7c, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7,
79 0xc8, 0xc9, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, /*@ABCDEFGHIJKLMNO*/
80/*50*/ 0xd7, 0xd8, 0xd9, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6,
81 0xe7, 0xe8, 0xe9, 0xbb, 0xbc, 0xbd, 0x6a, 0x6d, /*PQRSTUVWXYZ[\]^_*/
82/*60*/ 0x4a, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
83 0x88, 0x89, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, /*`abcdefghijklmno*/
84/*70*/ 0x97, 0x98, 0x99, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6,
85 0xa7, 0xa8, 0xa9, 0xfb, 0x4f, 0xfd, 0xff, 0x07, /*pqrstuvwxyz{|}~.*/
86/*80*/ 0x20, 0x21, 0x22, 0x23, 0x24, 0x04, 0x06, 0x08,
87 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x09, 0x0a, 0x14, /*................*/
88/*90*/ 0x30, 0x31, 0x25, 0x33, 0x34, 0x35, 0x36, 0x17,
89 0x38, 0x39, 0x3a, 0x3b, 0x1a, 0x1b, 0x3e, 0x5f, /*................*/
90/*a0*/ 0x41, 0xaa, 0xb0, 0xb1, 0x9f, 0xb2, 0xd0, 0xb5,
91 0x79, 0xb4, 0x9a, 0x8a, 0xba, 0xca, 0xaf, 0xa1, /*................*/
92/*b0*/ 0x90, 0x8f, 0xea, 0xfa, 0xbe, 0xa0, 0xb6, 0xb3,
93 0x9d, 0xda, 0x9b, 0x8b, 0xb7, 0xb8, 0xb9, 0xab, /*................*/
94/*c0*/ 0x64, 0x65, 0x62, 0x66, 0x63, 0x67, 0x9e, 0x68,
95 0x74, 0x71, 0x72, 0x73, 0x78, 0x75, 0x76, 0x77, /*................*/
96/*d0*/ 0xac, 0x69, 0xed, 0xee, 0xeb, 0xef, 0xec, 0xbf,
97 0x80, 0xe0, 0xfe, 0xdd, 0xfc, 0xad, 0xae, 0x59, /*................*/
98/*e0*/ 0x44, 0x45, 0x42, 0x46, 0x43, 0x47, 0x9c, 0x48,
99 0x54, 0x51, 0x52, 0x53, 0x58, 0x55, 0x56, 0x57, /*................*/
100/*f0*/ 0x8c, 0x49, 0xcd, 0xce, 0xcb, 0xcf, 0xcc, 0xe1,
101 0x70, 0xc0, 0xde, 0xdb, 0xdc, 0x8d, 0x8e, 0xdf /*................*/
102};
103
104#else /*_OSD_POSIX*/
105
106/*
107This code does basic character mapping for IBM's TPF and OS/390 operating systems.
108It is a modified version of the BS2000 table.
109
110Bijective EBCDIC (character set IBM-1047) to US-ASCII table:
111This table is bijective - there are no ambigous or duplicate characters.
112*/
113const unsigned char os_toascii[256] = {
114 0x00, 0x01, 0x02, 0x03, 0x85, 0x09, 0x86, 0x7f, /* 00-0f: */
115 0x87, 0x8d, 0x8e, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* ................ */
116 0x10, 0x11, 0x12, 0x13, 0x8f, 0x0a, 0x08, 0x97, /* 10-1f: */
117 0x18, 0x19, 0x9c, 0x9d, 0x1c, 0x1d, 0x1e, 0x1f, /* ................ */
118 0x80, 0x81, 0x82, 0x83, 0x84, 0x92, 0x17, 0x1b, /* 20-2f: */
119 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x05, 0x06, 0x07, /* ................ */
120 0x90, 0x91, 0x16, 0x93, 0x94, 0x95, 0x96, 0x04, /* 30-3f: */
121 0x98, 0x99, 0x9a, 0x9b, 0x14, 0x15, 0x9e, 0x1a, /* ................ */
122 0x20, 0xa0, 0xe2, 0xe4, 0xe0, 0xe1, 0xe3, 0xe5, /* 40-4f: */
123 0xe7, 0xf1, 0xa2, 0x2e, 0x3c, 0x28, 0x2b, 0x7c, /* ...........<(+| */
124 0x26, 0xe9, 0xea, 0xeb, 0xe8, 0xed, 0xee, 0xef, /* 50-5f: */
125 0xec, 0xdf, 0x21, 0x24, 0x2a, 0x29, 0x3b, 0x5e, /* &.........!$*);^ */
126 0x2d, 0x2f, 0xc2, 0xc4, 0xc0, 0xc1, 0xc3, 0xc5, /* 60-6f: */
127 0xc7, 0xd1, 0xa6, 0x2c, 0x25, 0x5f, 0x3e, 0x3f, /* -/.........,%_>? */
128 0xf8, 0xc9, 0xca, 0xcb, 0xc8, 0xcd, 0xce, 0xcf, /* 70-7f: */
129 0xcc, 0x60, 0x3a, 0x23, 0x40, 0x27, 0x3d, 0x22, /* .........`:#@'=" */
130 0xd8, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 80-8f: */
131 0x68, 0x69, 0xab, 0xbb, 0xf0, 0xfd, 0xfe, 0xb1, /* .abcdefghi...... */
132 0xb0, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70, /* 90-9f: */
133 0x71, 0x72, 0xaa, 0xba, 0xe6, 0xb8, 0xc6, 0xa4, /* .jklmnopqr...... */
134 0xb5, 0x7e, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, /* a0-af: */
135 0x79, 0x7a, 0xa1, 0xbf, 0xd0, 0x5b, 0xde, 0xae, /* .~stuvwxyz...[.. */
136 0xac, 0xa3, 0xa5, 0xb7, 0xa9, 0xa7, 0xb6, 0xbc, /* b0-bf: */
137 0xbd, 0xbe, 0xdd, 0xa8, 0xaf, 0x5d, 0xb4, 0xd7, /* .............].. */
138 0x7b, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, /* c0-cf: */
139 0x48, 0x49, 0xad, 0xf4, 0xf6, 0xf2, 0xf3, 0xf5, /* {ABCDEFGHI...... */
140 0x7d, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, /* d0-df: */
141 0x51, 0x52, 0xb9, 0xfb, 0xfc, 0xf9, 0xfa, 0xff, /* }JKLMNOPQR...... */
142 0x5c, 0xf7, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, /* e0-ef: */
143 0x59, 0x5a, 0xb2, 0xd4, 0xd6, 0xd2, 0xd3, 0xd5, /* \.STUVWXYZ...... */
144 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* f0-ff: */
145 0x38, 0x39, 0xb3, 0xdb, 0xdc, 0xd9, 0xda, 0x9f /* 0123456789...... */
146};
147
148
149/*
150The US-ASCII to EBCDIC (character set IBM-1047) table:
151This table is bijective (no ambiguous or duplicate characters)
152*/
153const unsigned char os_toebcdic[256] = {
154 0x00, 0x01, 0x02, 0x03, 0x37, 0x2d, 0x2e, 0x2f, /* 00-0f: */
155 0x16, 0x05, 0x15, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* ................ */
156 0x10, 0x11, 0x12, 0x13, 0x3c, 0x3d, 0x32, 0x26, /* 10-1f: */
157 0x18, 0x19, 0x3f, 0x27, 0x1c, 0x1d, 0x1e, 0x1f, /* ................ */
158 0x40, 0x5a, 0x7f, 0x7b, 0x5b, 0x6c, 0x50, 0x7d, /* 20-2f: */
159 0x4d, 0x5d, 0x5c, 0x4e, 0x6b, 0x60, 0x4b, 0x61, /* !"#$%&'()*+,-./ */
160 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 30-3f: */
161 0xf8, 0xf9, 0x7a, 0x5e, 0x4c, 0x7e, 0x6e, 0x6f, /* 0123456789:;<=>? */
162 0x7c, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 40-4f: */
163 0xc8, 0xc9, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, /* @ABCDEFGHIJKLMNO */
164 0xd7, 0xd8, 0xd9, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, /* 50-5f: */
165 0xe7, 0xe8, 0xe9, 0xad, 0xe0, 0xbd, 0x5f, 0x6d, /* PQRSTUVWXYZ[\]^_ */
166 0x79, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, /* 60-6f: */
167 0x88, 0x89, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, /* `abcdefghijklmno */
168 0x97, 0x98, 0x99, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, /* 70-7f: */
169 0xa7, 0xa8, 0xa9, 0xc0, 0x4f, 0xd0, 0xa1, 0x07, /* pqrstuvwxyz{|}~. */
170 0x20, 0x21, 0x22, 0x23, 0x24, 0x04, 0x06, 0x08, /* 80-8f: */
171 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x09, 0x0a, 0x14, /* ................ */
172 0x30, 0x31, 0x25, 0x33, 0x34, 0x35, 0x36, 0x17, /* 90-9f: */
173 0x38, 0x39, 0x3a, 0x3b, 0x1a, 0x1b, 0x3e, 0xff, /* ................ */
174 0x41, 0xaa, 0x4a, 0xb1, 0x9f, 0xb2, 0x6a, 0xb5, /* a0-af: */
175 0xbb, 0xb4, 0x9a, 0x8a, 0xb0, 0xca, 0xaf, 0xbc, /* ................ */
176 0x90, 0x8f, 0xea, 0xfa, 0xbe, 0xa0, 0xb6, 0xb3, /* b0-bf: */
177 0x9d, 0xda, 0x9b, 0x8b, 0xb7, 0xb8, 0xb9, 0xab, /* ................ */
178 0x64, 0x65, 0x62, 0x66, 0x63, 0x67, 0x9e, 0x68, /* c0-cf: */
179 0x74, 0x71, 0x72, 0x73, 0x78, 0x75, 0x76, 0x77, /* ................ */
180 0xac, 0x69, 0xed, 0xee, 0xeb, 0xef, 0xec, 0xbf, /* d0-df: */
181 0x80, 0xfd, 0xfe, 0xfb, 0xfc, 0xba, 0xae, 0x59, /* ................ */
182 0x44, 0x45, 0x42, 0x46, 0x43, 0x47, 0x9c, 0x48, /* e0-ef: */
183 0x54, 0x51, 0x52, 0x53, 0x58, 0x55, 0x56, 0x57, /* ................ */
184 0x8c, 0x49, 0xcd, 0xce, 0xcb, 0xcf, 0xcc, 0xe1, /* f0-ff: */
185 0x70, 0xdd, 0xde, 0xdb, 0xdc, 0x8d, 0x8e, 0xdf /* ................ */
186};
187#endif /*_OSD_POSIX*/
188
189/* Translate a memory block from EBCDIC (host charset) to ASCII (net charset)
190 * dest and srce may be identical, or separate memory blocks, but
191 * should not overlap. These functions intentionally have an interface
192 * compatible to memcpy(3).
193 */
194
195void *
196ebcdic2ascii(void *dest, const void *srce, size_t count)
197{
198 unsigned char *udest = dest;
199 const unsigned char *usrce = srce;
200
201 while (count-- != 0) {
202 *udest++ = os_toascii[*usrce++];
203 }
204
205 return dest;
206}
207
208void *
209ascii2ebcdic(void *dest, const void *srce, size_t count)
210{
211 unsigned char *udest = dest;
212 const unsigned char *usrce = srce;
213
214 while (count-- != 0) {
215 *udest++ = os_toebcdic[*usrce++];
216 }
217
218 return dest;
219}
220
221#endif
diff --git a/src/lib/libcrypto/ebcdic.h b/src/lib/libcrypto/ebcdic.h
new file mode 100644
index 0000000000..6d65afcf9e
--- /dev/null
+++ b/src/lib/libcrypto/ebcdic.h
@@ -0,0 +1,19 @@
1/* crypto/ebcdic.h */
2
3#ifndef HEADER_EBCDIC_H
4#define HEADER_EBCDIC_H
5
6#include <sys/types.h>
7
8/* Avoid name clashes with other applications */
9#define os_toascii _openssl_os_toascii
10#define os_toebcdic _openssl_os_toebcdic
11#define ebcdic2ascii _openssl_ebcdic2ascii
12#define ascii2ebcdic _openssl_ascii2ebcdic
13
14extern const unsigned char os_toascii[256];
15extern const unsigned char os_toebcdic[256];
16void *ebcdic2ascii(void *dest, const void *srce, size_t count);
17void *ascii2ebcdic(void *dest, const void *srce, size_t count);
18
19#endif
diff --git a/src/lib/libcrypto/ec/Makefile b/src/lib/libcrypto/ec/Makefile
new file mode 100644
index 0000000000..f85fc845ca
--- /dev/null
+++ b/src/lib/libcrypto/ec/Makefile
@@ -0,0 +1,263 @@
1#
2# crypto/ec/Makefile
3#
4
5DIR= ec
6TOP= ../..
7CC= cc
8INCLUDES= -I.. -I$(TOP) -I../../include
9CFLAG=-g
10MAKEFILE= Makefile
11AR= ar r
12
13CFLAGS= $(INCLUDES) $(CFLAG)
14
15GENERAL=Makefile
16TEST=ectest.c
17APPS=
18
19LIB=$(TOP)/libcrypto.a
20LIBSRC= ec_lib.c ecp_smpl.c ecp_mont.c ecp_nist.c ec_cvt.c ec_mult.c\
21 ec_err.c ec_curve.c ec_check.c ec_print.c ec_asn1.c ec_key.c\
22 ec2_smpl.c ec2_mult.c ec_ameth.c ec_pmeth.c eck_prn.c \
23 ecp_nistp224.c ecp_nistp256.c ecp_nistp521.c ecp_nistputil.c \
24 ecp_oct.c ec2_oct.c ec_oct.c
25
26LIBOBJ= ec_lib.o ecp_smpl.o ecp_mont.o ecp_nist.o ec_cvt.o ec_mult.o\
27 ec_err.o ec_curve.o ec_check.o ec_print.o ec_asn1.o ec_key.o\
28 ec2_smpl.o ec2_mult.o ec_ameth.o ec_pmeth.o eck_prn.o \
29 ecp_nistp224.o ecp_nistp256.o ecp_nistp521.o ecp_nistputil.o \
30 ecp_oct.o ec2_oct.o ec_oct.o
31
32SRC= $(LIBSRC)
33
34EXHEADER= ec.h
35HEADER= ec_lcl.h $(EXHEADER)
36
37ALL= $(GENERAL) $(SRC) $(HEADER)
38
39top:
40 (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all)
41
42all: lib
43
44lib: $(LIBOBJ)
45 $(AR) $(LIB) $(LIBOBJ)
46 $(RANLIB) $(LIB) || echo Never mind.
47 @touch lib
48
49files:
50 $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
51
52links:
53 @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
54 @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
55 @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
56
57install:
58 @[ -n "$(INSTALLTOP)" ] # should be set by top Makefile...
59 @headerlist="$(EXHEADER)"; for i in $$headerlist ; \
60 do \
61 (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
62 chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
63 done;
64
65tags:
66 ctags $(SRC)
67
68tests:
69
70lint:
71 lint -DLINT $(INCLUDES) $(SRC)>fluff
72
73depend:
74 @[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile...
75 $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
76
77dclean:
78 $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
79 mv -f Makefile.new $(MAKEFILE)
80
81clean:
82 rm -f *.o */*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
83
84# DO NOT DELETE THIS LINE -- make depend depends on it.
85
86ec2_mult.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
87ec2_mult.o: ../../include/openssl/bn.h ../../include/openssl/crypto.h
88ec2_mult.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
89ec2_mult.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
90ec2_mult.o: ../../include/openssl/obj_mac.h ../../include/openssl/opensslconf.h
91ec2_mult.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
92ec2_mult.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
93ec2_mult.o: ../../include/openssl/symhacks.h ec2_mult.c ec_lcl.h
94ec2_oct.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
95ec2_oct.o: ../../include/openssl/bn.h ../../include/openssl/crypto.h
96ec2_oct.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
97ec2_oct.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
98ec2_oct.o: ../../include/openssl/obj_mac.h ../../include/openssl/opensslconf.h
99ec2_oct.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
100ec2_oct.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
101ec2_oct.o: ../../include/openssl/symhacks.h ec2_oct.c ec_lcl.h
102ec2_smpl.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
103ec2_smpl.o: ../../include/openssl/bn.h ../../include/openssl/crypto.h
104ec2_smpl.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
105ec2_smpl.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
106ec2_smpl.o: ../../include/openssl/obj_mac.h ../../include/openssl/opensslconf.h
107ec2_smpl.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
108ec2_smpl.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
109ec2_smpl.o: ../../include/openssl/symhacks.h ec2_smpl.c ec_lcl.h
110ec_ameth.o: ../../e_os.h ../../include/openssl/asn1.h
111ec_ameth.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
112ec_ameth.o: ../../include/openssl/buffer.h ../../include/openssl/cms.h
113ec_ameth.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
114ec_ameth.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
115ec_ameth.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
116ec_ameth.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
117ec_ameth.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
118ec_ameth.o: ../../include/openssl/opensslconf.h
119ec_ameth.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
120ec_ameth.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
121ec_ameth.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
122ec_ameth.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
123ec_ameth.o: ../../include/openssl/x509_vfy.h ../asn1/asn1_locl.h ../cryptlib.h
124ec_ameth.o: ec_ameth.c
125ec_asn1.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h
126ec_asn1.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
127ec_asn1.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
128ec_asn1.o: ../../include/openssl/ec.h ../../include/openssl/err.h
129ec_asn1.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
130ec_asn1.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
131ec_asn1.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
132ec_asn1.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
133ec_asn1.o: ../../include/openssl/symhacks.h ec_asn1.c ec_lcl.h
134ec_check.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
135ec_check.o: ../../include/openssl/bn.h ../../include/openssl/crypto.h
136ec_check.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
137ec_check.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
138ec_check.o: ../../include/openssl/obj_mac.h ../../include/openssl/opensslconf.h
139ec_check.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
140ec_check.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
141ec_check.o: ../../include/openssl/symhacks.h ec_check.c ec_lcl.h
142ec_curve.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
143ec_curve.o: ../../include/openssl/bn.h ../../include/openssl/crypto.h
144ec_curve.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
145ec_curve.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
146ec_curve.o: ../../include/openssl/obj_mac.h ../../include/openssl/opensslconf.h
147ec_curve.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
148ec_curve.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
149ec_curve.o: ../../include/openssl/symhacks.h ec_curve.c ec_lcl.h
150ec_cvt.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
151ec_cvt.o: ../../include/openssl/bn.h ../../include/openssl/crypto.h
152ec_cvt.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
153ec_cvt.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
154ec_cvt.o: ../../include/openssl/obj_mac.h ../../include/openssl/opensslconf.h
155ec_cvt.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
156ec_cvt.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
157ec_cvt.o: ../../include/openssl/symhacks.h ec_cvt.c ec_lcl.h
158ec_err.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
159ec_err.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
160ec_err.o: ../../include/openssl/ec.h ../../include/openssl/err.h
161ec_err.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
162ec_err.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
163ec_err.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
164ec_err.o: ../../include/openssl/symhacks.h ec_err.c
165ec_key.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
166ec_key.o: ../../include/openssl/bn.h ../../include/openssl/crypto.h
167ec_key.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
168ec_key.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
169ec_key.o: ../../include/openssl/obj_mac.h ../../include/openssl/opensslconf.h
170ec_key.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
171ec_key.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
172ec_key.o: ../../include/openssl/symhacks.h ec_key.c ec_lcl.h
173ec_lib.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
174ec_lib.o: ../../include/openssl/bn.h ../../include/openssl/crypto.h
175ec_lib.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
176ec_lib.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
177ec_lib.o: ../../include/openssl/obj_mac.h ../../include/openssl/opensslconf.h
178ec_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
179ec_lib.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
180ec_lib.o: ../../include/openssl/symhacks.h ec_lcl.h ec_lib.c
181ec_mult.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
182ec_mult.o: ../../include/openssl/bn.h ../../include/openssl/crypto.h
183ec_mult.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
184ec_mult.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
185ec_mult.o: ../../include/openssl/obj_mac.h ../../include/openssl/opensslconf.h
186ec_mult.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
187ec_mult.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
188ec_mult.o: ../../include/openssl/symhacks.h ec_lcl.h ec_mult.c
189ec_oct.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
190ec_oct.o: ../../include/openssl/bn.h ../../include/openssl/crypto.h
191ec_oct.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
192ec_oct.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
193ec_oct.o: ../../include/openssl/obj_mac.h ../../include/openssl/opensslconf.h
194ec_oct.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
195ec_oct.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
196ec_oct.o: ../../include/openssl/symhacks.h ec_lcl.h ec_oct.c
197ec_pmeth.o: ../../e_os.h ../../include/openssl/asn1.h
198ec_pmeth.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
199ec_pmeth.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
200ec_pmeth.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
201ec_pmeth.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
202ec_pmeth.o: ../../include/openssl/err.h ../../include/openssl/evp.h
203ec_pmeth.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
204ec_pmeth.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
205ec_pmeth.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
206ec_pmeth.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
207ec_pmeth.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
208ec_pmeth.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
209ec_pmeth.o: ../../include/openssl/x509_vfy.h ../cryptlib.h ../evp/evp_locl.h
210ec_pmeth.o: ec_pmeth.c
211ec_print.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
212ec_print.o: ../../include/openssl/bn.h ../../include/openssl/crypto.h
213ec_print.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
214ec_print.o: ../../include/openssl/obj_mac.h ../../include/openssl/opensslconf.h
215ec_print.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
216ec_print.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
217ec_print.o: ../../include/openssl/symhacks.h ec_lcl.h ec_print.c
218eck_prn.o: ../../e_os.h ../../include/openssl/asn1.h
219eck_prn.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
220eck_prn.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
221eck_prn.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
222eck_prn.o: ../../include/openssl/err.h ../../include/openssl/evp.h
223eck_prn.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
224eck_prn.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
225eck_prn.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
226eck_prn.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
227eck_prn.o: ../../include/openssl/symhacks.h ../cryptlib.h eck_prn.c
228ecp_mont.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
229ecp_mont.o: ../../include/openssl/bn.h ../../include/openssl/crypto.h
230ecp_mont.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
231ecp_mont.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
232ecp_mont.o: ../../include/openssl/obj_mac.h ../../include/openssl/opensslconf.h
233ecp_mont.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
234ecp_mont.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
235ecp_mont.o: ../../include/openssl/symhacks.h ec_lcl.h ecp_mont.c
236ecp_nist.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
237ecp_nist.o: ../../include/openssl/bn.h ../../include/openssl/crypto.h
238ecp_nist.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
239ecp_nist.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
240ecp_nist.o: ../../include/openssl/obj_mac.h ../../include/openssl/opensslconf.h
241ecp_nist.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
242ecp_nist.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
243ecp_nist.o: ../../include/openssl/symhacks.h ec_lcl.h ecp_nist.c
244ecp_nistp224.o: ../../include/openssl/opensslconf.h ecp_nistp224.c
245ecp_nistp256.o: ../../include/openssl/opensslconf.h ecp_nistp256.c
246ecp_nistp521.o: ../../include/openssl/opensslconf.h ecp_nistp521.c
247ecp_nistputil.o: ../../include/openssl/opensslconf.h ecp_nistputil.c
248ecp_oct.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
249ecp_oct.o: ../../include/openssl/bn.h ../../include/openssl/crypto.h
250ecp_oct.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
251ecp_oct.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
252ecp_oct.o: ../../include/openssl/obj_mac.h ../../include/openssl/opensslconf.h
253ecp_oct.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
254ecp_oct.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
255ecp_oct.o: ../../include/openssl/symhacks.h ec_lcl.h ecp_oct.c
256ecp_smpl.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
257ecp_smpl.o: ../../include/openssl/bn.h ../../include/openssl/crypto.h
258ecp_smpl.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
259ecp_smpl.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
260ecp_smpl.o: ../../include/openssl/obj_mac.h ../../include/openssl/opensslconf.h
261ecp_smpl.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
262ecp_smpl.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
263ecp_smpl.o: ../../include/openssl/symhacks.h ec_lcl.h ecp_smpl.c
diff --git a/src/lib/libcrypto/ec/ec.h b/src/lib/libcrypto/ec/ec.h
index dfe8710d33..9d01325af3 100644
--- a/src/lib/libcrypto/ec/ec.h
+++ b/src/lib/libcrypto/ec/ec.h
@@ -274,10 +274,10 @@ int EC_GROUP_get_curve_name(const EC_GROUP *group);
274void EC_GROUP_set_asn1_flag(EC_GROUP *group, int flag); 274void EC_GROUP_set_asn1_flag(EC_GROUP *group, int flag);
275int EC_GROUP_get_asn1_flag(const EC_GROUP *group); 275int EC_GROUP_get_asn1_flag(const EC_GROUP *group);
276 276
277void EC_GROUP_set_point_conversion_form(EC_GROUP *group, point_conversion_form_t form); 277void EC_GROUP_set_point_conversion_form(EC_GROUP *, point_conversion_form_t);
278point_conversion_form_t EC_GROUP_get_point_conversion_form(const EC_GROUP *); 278point_conversion_form_t EC_GROUP_get_point_conversion_form(const EC_GROUP *);
279 279
280unsigned char *EC_GROUP_get0_seed(const EC_GROUP *x); 280unsigned char *EC_GROUP_get0_seed(const EC_GROUP *);
281size_t EC_GROUP_get_seed_len(const EC_GROUP *); 281size_t EC_GROUP_get_seed_len(const EC_GROUP *);
282size_t EC_GROUP_set_seed(EC_GROUP *, const unsigned char *, size_t len); 282size_t EC_GROUP_set_seed(EC_GROUP *, const unsigned char *, size_t len);
283 283
@@ -626,8 +626,8 @@ int EC_POINT_is_on_curve(const EC_GROUP *group, const EC_POINT *point, BN_CTX *c
626 */ 626 */
627int EC_POINT_cmp(const EC_GROUP *group, const EC_POINT *a, const EC_POINT *b, BN_CTX *ctx); 627int EC_POINT_cmp(const EC_GROUP *group, const EC_POINT *a, const EC_POINT *b, BN_CTX *ctx);
628 628
629int EC_POINT_make_affine(const EC_GROUP *group, EC_POINT *point, BN_CTX *ctx); 629int EC_POINT_make_affine(const EC_GROUP *, EC_POINT *, BN_CTX *);
630int EC_POINTs_make_affine(const EC_GROUP *group, size_t num, EC_POINT *points[], BN_CTX *ctx); 630int EC_POINTs_make_affine(const EC_GROUP *, size_t num, EC_POINT *[], BN_CTX *);
631 631
632/** Computes r = generator * n sum_{i=0}^num p[i] * m[i] 632/** Computes r = generator * n sum_{i=0}^num p[i] * m[i]
633 * \param group underlying EC_GROUP object 633 * \param group underlying EC_GROUP object
@@ -800,24 +800,16 @@ const EC_POINT *EC_KEY_get0_public_key(const EC_KEY *key);
800int EC_KEY_set_public_key(EC_KEY *key, const EC_POINT *pub); 800int EC_KEY_set_public_key(EC_KEY *key, const EC_POINT *pub);
801 801
802unsigned EC_KEY_get_enc_flags(const EC_KEY *key); 802unsigned EC_KEY_get_enc_flags(const EC_KEY *key);
803void EC_KEY_set_enc_flags(EC_KEY *eckey, unsigned int flags); 803void EC_KEY_set_enc_flags(EC_KEY *, unsigned int);
804point_conversion_form_t EC_KEY_get_conv_form(const EC_KEY *key); 804point_conversion_form_t EC_KEY_get_conv_form(const EC_KEY *);
805void EC_KEY_set_conv_form(EC_KEY *eckey, point_conversion_form_t cform); 805void EC_KEY_set_conv_form(EC_KEY *, point_conversion_form_t);
806/* functions to set/get method specific data */ 806/* functions to set/get method specific data */
807void *EC_KEY_get_key_method_data(EC_KEY *key, 807void *EC_KEY_get_key_method_data(EC_KEY *,
808 void *(*dup_func)(void *), void (*free_func)(void *), void (*clear_free_func)(void *)); 808 void *(*dup_func)(void *), void (*free_func)(void *), void (*clear_free_func)(void *));
809/** Sets the key method data of an EC_KEY object, if none has yet been set. 809void EC_KEY_insert_key_method_data(EC_KEY *, void *data,
810 * \param key EC_KEY object
811 * \param data opaque data to install.
812 * \param dup_func a function that duplicates |data|.
813 * \param free_func a function that frees |data|.
814 * \param clear_free_func a function that wipes and frees |data|.
815 * \return the previously set data pointer, or NULL if |data| was inserted.
816 */
817void *EC_KEY_insert_key_method_data(EC_KEY *key, void *data,
818 void *(*dup_func)(void *), void (*free_func)(void *), void (*clear_free_func)(void *)); 810 void *(*dup_func)(void *), void (*free_func)(void *), void (*clear_free_func)(void *));
819/* wrapper functions for the underlying EC_GROUP object */ 811/* wrapper functions for the underlying EC_GROUP object */
820void EC_KEY_set_asn1_flag(EC_KEY *eckey, int asn1_flag); 812void EC_KEY_set_asn1_flag(EC_KEY *, int);
821 813
822/** Creates a table of pre-computed multiples of the generator to 814/** Creates a table of pre-computed multiples of the generator to
823 * accelerate further EC_KEY operations. 815 * accelerate further EC_KEY operations.
diff --git a/src/lib/libcrypto/ec/ec_lib.c b/src/lib/libcrypto/ec/ec_lib.c
index de9a0cc2b3..25247b5803 100644
--- a/src/lib/libcrypto/ec/ec_lib.c
+++ b/src/lib/libcrypto/ec/ec_lib.c
@@ -480,10 +480,10 @@ int EC_GROUP_cmp(const EC_GROUP *a, const EC_GROUP *b, BN_CTX *ctx)
480 if (EC_METHOD_get_field_type(EC_GROUP_method_of(a)) != 480 if (EC_METHOD_get_field_type(EC_GROUP_method_of(a)) !=
481 EC_METHOD_get_field_type(EC_GROUP_method_of(b))) 481 EC_METHOD_get_field_type(EC_GROUP_method_of(b)))
482 return 1; 482 return 1;
483 /* compare the curve name (if present in both) */ 483 /* compare the curve name (if present) */
484 if (EC_GROUP_get_curve_name(a) && EC_GROUP_get_curve_name(b) && 484 if (EC_GROUP_get_curve_name(a) && EC_GROUP_get_curve_name(b) &&
485 EC_GROUP_get_curve_name(a) != EC_GROUP_get_curve_name(b)) 485 EC_GROUP_get_curve_name(a) == EC_GROUP_get_curve_name(b))
486 return 1; 486 return 0;
487 487
488 if (!ctx) 488 if (!ctx)
489 ctx_new = ctx = BN_CTX_new(); 489 ctx_new = ctx = BN_CTX_new();
@@ -993,12 +993,12 @@ int EC_POINT_cmp(const EC_GROUP *group, const EC_POINT *a, const EC_POINT *b, BN
993 if (group->meth->point_cmp == 0) 993 if (group->meth->point_cmp == 0)
994 { 994 {
995 ECerr(EC_F_EC_POINT_CMP, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); 995 ECerr(EC_F_EC_POINT_CMP, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
996 return -1; 996 return 0;
997 } 997 }
998 if ((group->meth != a->meth) || (a->meth != b->meth)) 998 if ((group->meth != a->meth) || (a->meth != b->meth))
999 { 999 {
1000 ECerr(EC_F_EC_POINT_CMP, EC_R_INCOMPATIBLE_OBJECTS); 1000 ECerr(EC_F_EC_POINT_CMP, EC_R_INCOMPATIBLE_OBJECTS);
1001 return -1; 1001 return 0;
1002 } 1002 }
1003 return group->meth->point_cmp(group, a, b, ctx); 1003 return group->meth->point_cmp(group, a, b, ctx);
1004 } 1004 }
diff --git a/src/lib/libcrypto/ec/ecp_mont.c b/src/lib/libcrypto/ec/ecp_mont.c
index f04f132c7a..079e47431b 100644
--- a/src/lib/libcrypto/ec/ecp_mont.c
+++ b/src/lib/libcrypto/ec/ecp_mont.c
@@ -114,6 +114,7 @@ const EC_METHOD *EC_GFp_mont_method(void)
114 ec_GFp_mont_field_decode, 114 ec_GFp_mont_field_decode,
115 ec_GFp_mont_field_set_to_one }; 115 ec_GFp_mont_field_set_to_one };
116 116
117
117 return &ret; 118 return &ret;
118#endif 119#endif
119 } 120 }
diff --git a/src/lib/libcrypto/ec/ectest.c b/src/lib/libcrypto/ec/ectest.c
new file mode 100644
index 0000000000..f107782de0
--- /dev/null
+++ b/src/lib/libcrypto/ec/ectest.c
@@ -0,0 +1,1489 @@
1/* crypto/ec/ectest.c */
2/*
3 * Originally written by Bodo Moeller for the OpenSSL project.
4 */
5/* ====================================================================
6 * Copyright (c) 1998-2001 The OpenSSL Project. All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 *
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 *
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in
17 * the documentation and/or other materials provided with the
18 * distribution.
19 *
20 * 3. All advertising materials mentioning features or use of this
21 * software must display the following acknowledgment:
22 * "This product includes software developed by the OpenSSL Project
23 * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
24 *
25 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
26 * endorse or promote products derived from this software without
27 * prior written permission. For written permission, please contact
28 * openssl-core@openssl.org.
29 *
30 * 5. Products derived from this software may not be called "OpenSSL"
31 * nor may "OpenSSL" appear in their names without prior written
32 * permission of the OpenSSL Project.
33 *
34 * 6. Redistributions of any form whatsoever must retain the following
35 * acknowledgment:
36 * "This product includes software developed by the OpenSSL Project
37 * for use in the OpenSSL Toolkit (http://www.openssl.org/)"
38 *
39 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
40 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
41 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
42 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
43 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
44 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
45 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
46 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
47 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
48 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
49 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50 * OF THE POSSIBILITY OF SUCH DAMAGE.
51 * ====================================================================
52 *
53 * This product includes cryptographic software written by Eric Young
54 * (eay@cryptsoft.com). This product includes software written by Tim
55 * Hudson (tjh@cryptsoft.com).
56 *
57 */
58/* ====================================================================
59 * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED.
60 *
61 * Portions of the attached software ("Contribution") are developed by
62 * SUN MICROSYSTEMS, INC., and are contributed to the OpenSSL project.
63 *
64 * The Contribution is licensed pursuant to the OpenSSL open source
65 * license provided above.
66 *
67 * The elliptic curve binary polynomial software is originally written by
68 * Sheueling Chang Shantz and Douglas Stebila of Sun Microsystems Laboratories.
69 *
70 */
71
72#include <stdio.h>
73#include <stdlib.h>
74#ifdef FLAT_INC
75#include "e_os.h"
76#else
77#include "../e_os.h"
78#endif
79#include <string.h>
80#include <time.h>
81
82
83#ifdef OPENSSL_NO_EC
84int main(int argc, char * argv[]) { puts("Elliptic curves are disabled."); return 0; }
85#else
86
87
88#include <openssl/ec.h>
89#ifndef OPENSSL_NO_ENGINE
90#include <openssl/engine.h>
91#endif
92#include <openssl/err.h>
93#include <openssl/obj_mac.h>
94#include <openssl/objects.h>
95#include <openssl/rand.h>
96#include <openssl/bn.h>
97#include <openssl/opensslconf.h>
98
99#if defined(_MSC_VER) && defined(_MIPS_) && (_MSC_VER/100==12)
100/* suppress "too big too optimize" warning */
101#pragma warning(disable:4959)
102#endif
103
104#define ABORT do { \
105 fflush(stdout); \
106 fprintf(stderr, "%s:%d: ABORT\n", __FILE__, __LINE__); \
107 ERR_print_errors_fp(stderr); \
108 EXIT(1); \
109} while (0)
110
111#define TIMING_BASE_PT 0
112#define TIMING_RAND_PT 1
113#define TIMING_SIMUL 2
114
115#if 0
116static void timings(EC_GROUP *group, int type, BN_CTX *ctx)
117 {
118 clock_t clck;
119 int i, j;
120 BIGNUM *s;
121 BIGNUM *r[10], *r0[10];
122 EC_POINT *P;
123
124 s = BN_new();
125 if (s == NULL) ABORT;
126
127 fprintf(stdout, "Timings for %d-bit field, ", EC_GROUP_get_degree(group));
128 if (!EC_GROUP_get_order(group, s, ctx)) ABORT;
129 fprintf(stdout, "%d-bit scalars ", (int)BN_num_bits(s));
130 fflush(stdout);
131
132 P = EC_POINT_new(group);
133 if (P == NULL) ABORT;
134 EC_POINT_copy(P, EC_GROUP_get0_generator(group));
135
136 for (i = 0; i < 10; i++)
137 {
138 if ((r[i] = BN_new()) == NULL) ABORT;
139 if (!BN_pseudo_rand(r[i], BN_num_bits(s), 0, 0)) ABORT;
140 if (type != TIMING_BASE_PT)
141 {
142 if ((r0[i] = BN_new()) == NULL) ABORT;
143 if (!BN_pseudo_rand(r0[i], BN_num_bits(s), 0, 0)) ABORT;
144 }
145 }
146
147 clck = clock();
148 for (i = 0; i < 10; i++)
149 {
150 for (j = 0; j < 10; j++)
151 {
152 if (!EC_POINT_mul(group, P, (type != TIMING_RAND_PT) ? r[i] : NULL,
153 (type != TIMING_BASE_PT) ? P : NULL, (type != TIMING_BASE_PT) ? r0[i] : NULL, ctx)) ABORT;
154 }
155 }
156 clck = clock() - clck;
157
158 fprintf(stdout, "\n");
159
160#ifdef CLOCKS_PER_SEC
161 /* "To determine the time in seconds, the value returned
162 * by the clock function should be divided by the value
163 * of the macro CLOCKS_PER_SEC."
164 * -- ISO/IEC 9899 */
165# define UNIT "s"
166#else
167 /* "`CLOCKS_PER_SEC' undeclared (first use this function)"
168 * -- cc on NeXTstep/OpenStep */
169# define UNIT "units"
170# define CLOCKS_PER_SEC 1
171#endif
172
173 if (type == TIMING_BASE_PT) {
174 fprintf(stdout, "%i %s in %.2f " UNIT "\n", i*j,
175 "base point multiplications", (double)clck/CLOCKS_PER_SEC);
176 } else if (type == TIMING_RAND_PT) {
177 fprintf(stdout, "%i %s in %.2f " UNIT "\n", i*j,
178 "random point multiplications", (double)clck/CLOCKS_PER_SEC);
179 } else if (type == TIMING_SIMUL) {
180 fprintf(stdout, "%i %s in %.2f " UNIT "\n", i*j,
181 "s*P+t*Q operations", (double)clck/CLOCKS_PER_SEC);
182 }
183 fprintf(stdout, "average: %.4f " UNIT "\n", (double)clck/(CLOCKS_PER_SEC*i*j));
184
185 EC_POINT_free(P);
186 BN_free(s);
187 for (i = 0; i < 10; i++)
188 {
189 BN_free(r[i]);
190 if (type != TIMING_BASE_PT) BN_free(r0[i]);
191 }
192 }
193#endif
194
195/* test multiplication with group order, long and negative scalars */
196static void group_order_tests(EC_GROUP *group)
197 {
198 BIGNUM *n1, *n2, *order;
199 EC_POINT *P = EC_POINT_new(group);
200 EC_POINT *Q = EC_POINT_new(group);
201 BN_CTX *ctx = BN_CTX_new();
202
203 n1 = BN_new(); n2 = BN_new(); order = BN_new();
204 fprintf(stdout, "verify group order ...");
205 fflush(stdout);
206 if (!EC_GROUP_get_order(group, order, ctx)) ABORT;
207 if (!EC_POINT_mul(group, Q, order, NULL, NULL, ctx)) ABORT;
208 if (!EC_POINT_is_at_infinity(group, Q)) ABORT;
209 fprintf(stdout, ".");
210 fflush(stdout);
211 if (!EC_GROUP_precompute_mult(group, ctx)) ABORT;
212 if (!EC_POINT_mul(group, Q, order, NULL, NULL, ctx)) ABORT;
213 if (!EC_POINT_is_at_infinity(group, Q)) ABORT;
214 fprintf(stdout, " ok\n");
215 fprintf(stdout, "long/negative scalar tests ... ");
216 if (!BN_one(n1)) ABORT;
217 /* n1 = 1 - order */
218 if (!BN_sub(n1, n1, order)) ABORT;
219 if(!EC_POINT_mul(group, Q, NULL, P, n1, ctx)) ABORT;
220 if (0 != EC_POINT_cmp(group, Q, P, ctx)) ABORT;
221 /* n2 = 1 + order */
222 if (!BN_add(n2, order, BN_value_one())) ABORT;
223 if(!EC_POINT_mul(group, Q, NULL, P, n2, ctx)) ABORT;
224 if (0 != EC_POINT_cmp(group, Q, P, ctx)) ABORT;
225 /* n2 = (1 - order) * (1 + order) */
226 if (!BN_mul(n2, n1, n2, ctx)) ABORT;
227 if(!EC_POINT_mul(group, Q, NULL, P, n2, ctx)) ABORT;
228 if (0 != EC_POINT_cmp(group, Q, P, ctx)) ABORT;
229 fprintf(stdout, "ok\n");
230 EC_POINT_free(P);
231 EC_POINT_free(Q);
232 BN_free(n1);
233 BN_free(n2);
234 BN_free(order);
235 BN_CTX_free(ctx);
236 }
237
238static void prime_field_tests(void)
239 {
240 BN_CTX *ctx = NULL;
241 BIGNUM *p, *a, *b;
242 EC_GROUP *group;
243 EC_GROUP *P_160 = NULL, *P_192 = NULL, *P_224 = NULL, *P_256 = NULL, *P_384 = NULL, *P_521 = NULL;
244 EC_POINT *P, *Q, *R;
245 BIGNUM *x, *y, *z;
246 unsigned char buf[100];
247 size_t i, len;
248 int k;
249
250#if 1 /* optional */
251 ctx = BN_CTX_new();
252 if (!ctx) ABORT;
253#endif
254
255 p = BN_new();
256 a = BN_new();
257 b = BN_new();
258 if (!p || !a || !b) ABORT;
259
260 if (!BN_hex2bn(&p, "17")) ABORT;
261 if (!BN_hex2bn(&a, "1")) ABORT;
262 if (!BN_hex2bn(&b, "1")) ABORT;
263
264 group = EC_GROUP_new(EC_GFp_mont_method()); /* applications should use EC_GROUP_new_curve_GFp
265 * so that the library gets to choose the EC_METHOD */
266 if (!group) ABORT;
267
268 if (!EC_GROUP_set_curve_GFp(group, p, a, b, ctx)) ABORT;
269
270 {
271 EC_GROUP *tmp;
272 tmp = EC_GROUP_new(EC_GROUP_method_of(group));
273 if (!tmp) ABORT;
274 if (!EC_GROUP_copy(tmp, group)) ABORT;
275 EC_GROUP_free(group);
276 group = tmp;
277 }
278
279 if (!EC_GROUP_get_curve_GFp(group, p, a, b, ctx)) ABORT;
280
281 fprintf(stdout, "Curve defined by Weierstrass equation\n y^2 = x^3 + a*x + b (mod 0x");
282 BN_print_fp(stdout, p);
283 fprintf(stdout, ")\n a = 0x");
284 BN_print_fp(stdout, a);
285 fprintf(stdout, "\n b = 0x");
286 BN_print_fp(stdout, b);
287 fprintf(stdout, "\n");
288
289 P = EC_POINT_new(group);
290 Q = EC_POINT_new(group);
291 R = EC_POINT_new(group);
292 if (!P || !Q || !R) ABORT;
293
294 if (!EC_POINT_set_to_infinity(group, P)) ABORT;
295 if (!EC_POINT_is_at_infinity(group, P)) ABORT;
296
297 buf[0] = 0;
298 if (!EC_POINT_oct2point(group, Q, buf, 1, ctx)) ABORT;
299
300 if (!EC_POINT_add(group, P, P, Q, ctx)) ABORT;
301 if (!EC_POINT_is_at_infinity(group, P)) ABORT;
302
303 x = BN_new();
304 y = BN_new();
305 z = BN_new();
306 if (!x || !y || !z) ABORT;
307
308 if (!BN_hex2bn(&x, "D")) ABORT;
309 if (!EC_POINT_set_compressed_coordinates_GFp(group, Q, x, 1, ctx)) ABORT;
310 if (!EC_POINT_is_on_curve(group, Q, ctx))
311 {
312 if (!EC_POINT_get_affine_coordinates_GFp(group, Q, x, y, ctx)) ABORT;
313 fprintf(stderr, "Point is not on curve: x = 0x");
314 BN_print_fp(stderr, x);
315 fprintf(stderr, ", y = 0x");
316 BN_print_fp(stderr, y);
317 fprintf(stderr, "\n");
318 ABORT;
319 }
320
321 fprintf(stdout, "A cyclic subgroup:\n");
322 k = 100;
323 do
324 {
325 if (k-- == 0) ABORT;
326
327 if (EC_POINT_is_at_infinity(group, P))
328 fprintf(stdout, " point at infinity\n");
329 else
330 {
331 if (!EC_POINT_get_affine_coordinates_GFp(group, P, x, y, ctx)) ABORT;
332
333 fprintf(stdout, " x = 0x");
334 BN_print_fp(stdout, x);
335 fprintf(stdout, ", y = 0x");
336 BN_print_fp(stdout, y);
337 fprintf(stdout, "\n");
338 }
339
340 if (!EC_POINT_copy(R, P)) ABORT;
341 if (!EC_POINT_add(group, P, P, Q, ctx)) ABORT;
342
343#if 0 /* optional */
344 {
345 EC_POINT *points[3];
346
347 points[0] = R;
348 points[1] = Q;
349 points[2] = P;
350 if (!EC_POINTs_make_affine(group, 2, points, ctx)) ABORT;
351 }
352#endif
353
354 }
355 while (!EC_POINT_is_at_infinity(group, P));
356
357 if (!EC_POINT_add(group, P, Q, R, ctx)) ABORT;
358 if (!EC_POINT_is_at_infinity(group, P)) ABORT;
359
360 len = EC_POINT_point2oct(group, Q, POINT_CONVERSION_COMPRESSED, buf, sizeof buf, ctx);
361 if (len == 0) ABORT;
362 if (!EC_POINT_oct2point(group, P, buf, len, ctx)) ABORT;
363 if (0 != EC_POINT_cmp(group, P, Q, ctx)) ABORT;
364 fprintf(stdout, "Generator as octet string, compressed form:\n ");
365 for (i = 0; i < len; i++) fprintf(stdout, "%02X", buf[i]);
366
367 len = EC_POINT_point2oct(group, Q, POINT_CONVERSION_UNCOMPRESSED, buf, sizeof buf, ctx);
368 if (len == 0) ABORT;
369 if (!EC_POINT_oct2point(group, P, buf, len, ctx)) ABORT;
370 if (0 != EC_POINT_cmp(group, P, Q, ctx)) ABORT;
371 fprintf(stdout, "\nGenerator as octet string, uncompressed form:\n ");
372 for (i = 0; i < len; i++) fprintf(stdout, "%02X", buf[i]);
373
374 len = EC_POINT_point2oct(group, Q, POINT_CONVERSION_HYBRID, buf, sizeof buf, ctx);
375 if (len == 0) ABORT;
376 if (!EC_POINT_oct2point(group, P, buf, len, ctx)) ABORT;
377 if (0 != EC_POINT_cmp(group, P, Q, ctx)) ABORT;
378 fprintf(stdout, "\nGenerator as octet string, hybrid form:\n ");
379 for (i = 0; i < len; i++) fprintf(stdout, "%02X", buf[i]);
380
381 if (!EC_POINT_get_Jprojective_coordinates_GFp(group, R, x, y, z, ctx)) ABORT;
382 fprintf(stdout, "\nA representation of the inverse of that generator in\nJacobian projective coordinates:\n X = 0x");
383 BN_print_fp(stdout, x);
384 fprintf(stdout, ", Y = 0x");
385 BN_print_fp(stdout, y);
386 fprintf(stdout, ", Z = 0x");
387 BN_print_fp(stdout, z);
388 fprintf(stdout, "\n");
389
390 if (!EC_POINT_invert(group, P, ctx)) ABORT;
391 if (0 != EC_POINT_cmp(group, P, R, ctx)) ABORT;
392
393
394 /* Curve secp160r1 (Certicom Research SEC 2 Version 1.0, section 2.4.2, 2000)
395 * -- not a NIST curve, but commonly used */
396
397 if (!BN_hex2bn(&p, "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7FFFFFFF")) ABORT;
398 if (1 != BN_is_prime_ex(p, BN_prime_checks, ctx, NULL)) ABORT;
399 if (!BN_hex2bn(&a, "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7FFFFFFC")) ABORT;
400 if (!BN_hex2bn(&b, "1C97BEFC54BD7A8B65ACF89F81D4D4ADC565FA45")) ABORT;
401 if (!EC_GROUP_set_curve_GFp(group, p, a, b, ctx)) ABORT;
402
403 if (!BN_hex2bn(&x, "4A96B5688EF573284664698968C38BB913CBFC82")) ABORT;
404 if (!BN_hex2bn(&y, "23a628553168947d59dcc912042351377ac5fb32")) ABORT;
405 if (!EC_POINT_set_affine_coordinates_GFp(group, P, x, y, ctx)) ABORT;
406 if (!EC_POINT_is_on_curve(group, P, ctx)) ABORT;
407 if (!BN_hex2bn(&z, "0100000000000000000001F4C8F927AED3CA752257")) ABORT;
408 if (!EC_GROUP_set_generator(group, P, z, BN_value_one())) ABORT;
409
410 if (!EC_POINT_get_affine_coordinates_GFp(group, P, x, y, ctx)) ABORT;
411 fprintf(stdout, "\nSEC2 curve secp160r1 -- Generator:\n x = 0x");
412 BN_print_fp(stdout, x);
413 fprintf(stdout, "\n y = 0x");
414 BN_print_fp(stdout, y);
415 fprintf(stdout, "\n");
416 /* G_y value taken from the standard: */
417 if (!BN_hex2bn(&z, "23a628553168947d59dcc912042351377ac5fb32")) ABORT;
418 if (0 != BN_cmp(y, z)) ABORT;
419
420 fprintf(stdout, "verify degree ...");
421 if (EC_GROUP_get_degree(group) != 160) ABORT;
422 fprintf(stdout, " ok\n");
423
424 group_order_tests(group);
425
426 if (!(P_160 = EC_GROUP_new(EC_GROUP_method_of(group)))) ABORT;
427 if (!EC_GROUP_copy(P_160, group)) ABORT;
428
429
430 /* Curve P-192 (FIPS PUB 186-2, App. 6) */
431
432 if (!BN_hex2bn(&p, "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFF")) ABORT;
433 if (1 != BN_is_prime_ex(p, BN_prime_checks, ctx, NULL)) ABORT;
434 if (!BN_hex2bn(&a, "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFC")) ABORT;
435 if (!BN_hex2bn(&b, "64210519E59C80E70FA7E9AB72243049FEB8DEECC146B9B1")) ABORT;
436 if (!EC_GROUP_set_curve_GFp(group, p, a, b, ctx)) ABORT;
437
438 if (!BN_hex2bn(&x, "188DA80EB03090F67CBF20EB43A18800F4FF0AFD82FF1012")) ABORT;
439 if (!EC_POINT_set_compressed_coordinates_GFp(group, P, x, 1, ctx)) ABORT;
440 if (!EC_POINT_is_on_curve(group, P, ctx)) ABORT;
441 if (!BN_hex2bn(&z, "FFFFFFFFFFFFFFFFFFFFFFFF99DEF836146BC9B1B4D22831")) ABORT;
442 if (!EC_GROUP_set_generator(group, P, z, BN_value_one())) ABORT;
443
444 if (!EC_POINT_get_affine_coordinates_GFp(group, P, x, y, ctx)) ABORT;
445 fprintf(stdout, "\nNIST curve P-192 -- Generator:\n x = 0x");
446 BN_print_fp(stdout, x);
447 fprintf(stdout, "\n y = 0x");
448 BN_print_fp(stdout, y);
449 fprintf(stdout, "\n");
450 /* G_y value taken from the standard: */
451 if (!BN_hex2bn(&z, "07192B95FFC8DA78631011ED6B24CDD573F977A11E794811")) ABORT;
452 if (0 != BN_cmp(y, z)) ABORT;
453
454 fprintf(stdout, "verify degree ...");
455 if (EC_GROUP_get_degree(group) != 192) ABORT;
456 fprintf(stdout, " ok\n");
457
458 group_order_tests(group);
459
460 if (!(P_192 = EC_GROUP_new(EC_GROUP_method_of(group)))) ABORT;
461 if (!EC_GROUP_copy(P_192, group)) ABORT;
462
463
464 /* Curve P-224 (FIPS PUB 186-2, App. 6) */
465
466 if (!BN_hex2bn(&p, "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000001")) ABORT;
467 if (1 != BN_is_prime_ex(p, BN_prime_checks, ctx, NULL)) ABORT;
468 if (!BN_hex2bn(&a, "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFE")) ABORT;
469 if (!BN_hex2bn(&b, "B4050A850C04B3ABF54132565044B0B7D7BFD8BA270B39432355FFB4")) ABORT;
470 if (!EC_GROUP_set_curve_GFp(group, p, a, b, ctx)) ABORT;
471
472 if (!BN_hex2bn(&x, "B70E0CBD6BB4BF7F321390B94A03C1D356C21122343280D6115C1D21")) ABORT;
473 if (!EC_POINT_set_compressed_coordinates_GFp(group, P, x, 0, ctx)) ABORT;
474 if (!EC_POINT_is_on_curve(group, P, ctx)) ABORT;
475 if (!BN_hex2bn(&z, "FFFFFFFFFFFFFFFFFFFFFFFFFFFF16A2E0B8F03E13DD29455C5C2A3D")) ABORT;
476 if (!EC_GROUP_set_generator(group, P, z, BN_value_one())) ABORT;
477
478 if (!EC_POINT_get_affine_coordinates_GFp(group, P, x, y, ctx)) ABORT;
479 fprintf(stdout, "\nNIST curve P-224 -- Generator:\n x = 0x");
480 BN_print_fp(stdout, x);
481 fprintf(stdout, "\n y = 0x");
482 BN_print_fp(stdout, y);
483 fprintf(stdout, "\n");
484 /* G_y value taken from the standard: */
485 if (!BN_hex2bn(&z, "BD376388B5F723FB4C22DFE6CD4375A05A07476444D5819985007E34")) ABORT;
486 if (0 != BN_cmp(y, z)) ABORT;
487
488 fprintf(stdout, "verify degree ...");
489 if (EC_GROUP_get_degree(group) != 224) ABORT;
490 fprintf(stdout, " ok\n");
491
492 group_order_tests(group);
493
494 if (!(P_224 = EC_GROUP_new(EC_GROUP_method_of(group)))) ABORT;
495 if (!EC_GROUP_copy(P_224, group)) ABORT;
496
497
498 /* Curve P-256 (FIPS PUB 186-2, App. 6) */
499
500 if (!BN_hex2bn(&p, "FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFF")) ABORT;
501 if (1 != BN_is_prime_ex(p, BN_prime_checks, ctx, NULL)) ABORT;
502 if (!BN_hex2bn(&a, "FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFC")) ABORT;
503 if (!BN_hex2bn(&b, "5AC635D8AA3A93E7B3EBBD55769886BC651D06B0CC53B0F63BCE3C3E27D2604B")) ABORT;
504 if (!EC_GROUP_set_curve_GFp(group, p, a, b, ctx)) ABORT;
505
506 if (!BN_hex2bn(&x, "6B17D1F2E12C4247F8BCE6E563A440F277037D812DEB33A0F4A13945D898C296")) ABORT;
507 if (!EC_POINT_set_compressed_coordinates_GFp(group, P, x, 1, ctx)) ABORT;
508 if (!EC_POINT_is_on_curve(group, P, ctx)) ABORT;
509 if (!BN_hex2bn(&z, "FFFFFFFF00000000FFFFFFFFFFFFFFFFBCE6FAADA7179E"
510 "84F3B9CAC2FC632551")) ABORT;
511 if (!EC_GROUP_set_generator(group, P, z, BN_value_one())) ABORT;
512
513 if (!EC_POINT_get_affine_coordinates_GFp(group, P, x, y, ctx)) ABORT;
514 fprintf(stdout, "\nNIST curve P-256 -- Generator:\n x = 0x");
515 BN_print_fp(stdout, x);
516 fprintf(stdout, "\n y = 0x");
517 BN_print_fp(stdout, y);
518 fprintf(stdout, "\n");
519 /* G_y value taken from the standard: */
520 if (!BN_hex2bn(&z, "4FE342E2FE1A7F9B8EE7EB4A7C0F9E162BCE33576B315ECECBB6406837BF51F5")) ABORT;
521 if (0 != BN_cmp(y, z)) ABORT;
522
523 fprintf(stdout, "verify degree ...");
524 if (EC_GROUP_get_degree(group) != 256) ABORT;
525 fprintf(stdout, " ok\n");
526
527 group_order_tests(group);
528
529 if (!(P_256 = EC_GROUP_new(EC_GROUP_method_of(group)))) ABORT;
530 if (!EC_GROUP_copy(P_256, group)) ABORT;
531
532
533 /* Curve P-384 (FIPS PUB 186-2, App. 6) */
534
535 if (!BN_hex2bn(&p, "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
536 "FFFFFFFFFFFFFFFFFEFFFFFFFF0000000000000000FFFFFFFF")) ABORT;
537 if (1 != BN_is_prime_ex(p, BN_prime_checks, ctx, NULL)) ABORT;
538 if (!BN_hex2bn(&a, "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
539 "FFFFFFFFFFFFFFFFFEFFFFFFFF0000000000000000FFFFFFFC")) ABORT;
540 if (!BN_hex2bn(&b, "B3312FA7E23EE7E4988E056BE3F82D19181D9C6EFE8141"
541 "120314088F5013875AC656398D8A2ED19D2A85C8EDD3EC2AEF")) ABORT;
542 if (!EC_GROUP_set_curve_GFp(group, p, a, b, ctx)) ABORT;
543
544 if (!BN_hex2bn(&x, "AA87CA22BE8B05378EB1C71EF320AD746E1D3B628BA79B"
545 "9859F741E082542A385502F25DBF55296C3A545E3872760AB7")) ABORT;
546 if (!EC_POINT_set_compressed_coordinates_GFp(group, P, x, 1, ctx)) ABORT;
547 if (!EC_POINT_is_on_curve(group, P, ctx)) ABORT;
548 if (!BN_hex2bn(&z, "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
549 "FFC7634D81F4372DDF581A0DB248B0A77AECEC196ACCC52973")) ABORT;
550 if (!EC_GROUP_set_generator(group, P, z, BN_value_one())) ABORT;
551
552 if (!EC_POINT_get_affine_coordinates_GFp(group, P, x, y, ctx)) ABORT;
553 fprintf(stdout, "\nNIST curve P-384 -- Generator:\n x = 0x");
554 BN_print_fp(stdout, x);
555 fprintf(stdout, "\n y = 0x");
556 BN_print_fp(stdout, y);
557 fprintf(stdout, "\n");
558 /* G_y value taken from the standard: */
559 if (!BN_hex2bn(&z, "3617DE4A96262C6F5D9E98BF9292DC29F8F41DBD289A14"
560 "7CE9DA3113B5F0B8C00A60B1CE1D7E819D7A431D7C90EA0E5F")) ABORT;
561 if (0 != BN_cmp(y, z)) ABORT;
562
563 fprintf(stdout, "verify degree ...");
564 if (EC_GROUP_get_degree(group) != 384) ABORT;
565 fprintf(stdout, " ok\n");
566
567 group_order_tests(group);
568
569 if (!(P_384 = EC_GROUP_new(EC_GROUP_method_of(group)))) ABORT;
570 if (!EC_GROUP_copy(P_384, group)) ABORT;
571
572
573 /* Curve P-521 (FIPS PUB 186-2, App. 6) */
574
575 if (!BN_hex2bn(&p, "1FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
576 "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
577 "FFFFFFFFFFFFFFFFFFFFFFFFFFFF")) ABORT;
578 if (1 != BN_is_prime_ex(p, BN_prime_checks, ctx, NULL)) ABORT;
579 if (!BN_hex2bn(&a, "1FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
580 "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
581 "FFFFFFFFFFFFFFFFFFFFFFFFFFFC")) ABORT;
582 if (!BN_hex2bn(&b, "051953EB9618E1C9A1F929A21A0B68540EEA2DA725B99B"
583 "315F3B8B489918EF109E156193951EC7E937B1652C0BD3BB1BF073573"
584 "DF883D2C34F1EF451FD46B503F00")) ABORT;
585 if (!EC_GROUP_set_curve_GFp(group, p, a, b, ctx)) ABORT;
586
587 if (!BN_hex2bn(&x, "C6858E06B70404E9CD9E3ECB662395B4429C648139053F"
588 "B521F828AF606B4D3DBAA14B5E77EFE75928FE1DC127A2FFA8DE3348B"
589 "3C1856A429BF97E7E31C2E5BD66")) ABORT;
590 if (!EC_POINT_set_compressed_coordinates_GFp(group, P, x, 0, ctx)) ABORT;
591 if (!EC_POINT_is_on_curve(group, P, ctx)) ABORT;
592 if (!BN_hex2bn(&z, "1FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
593 "FFFFFFFFFFFFFFFFFFFFA51868783BF2F966B7FCC0148F709A5D03BB5"
594 "C9B8899C47AEBB6FB71E91386409")) ABORT;
595 if (!EC_GROUP_set_generator(group, P, z, BN_value_one())) ABORT;
596
597 if (!EC_POINT_get_affine_coordinates_GFp(group, P, x, y, ctx)) ABORT;
598 fprintf(stdout, "\nNIST curve P-521 -- Generator:\n x = 0x");
599 BN_print_fp(stdout, x);
600 fprintf(stdout, "\n y = 0x");
601 BN_print_fp(stdout, y);
602 fprintf(stdout, "\n");
603 /* G_y value taken from the standard: */
604 if (!BN_hex2bn(&z, "11839296A789A3BC0045C8A5FB42C7D1BD998F54449579"
605 "B446817AFBD17273E662C97EE72995EF42640C550B9013FAD0761353C"
606 "7086A272C24088BE94769FD16650")) ABORT;
607 if (0 != BN_cmp(y, z)) ABORT;
608
609 fprintf(stdout, "verify degree ...");
610 if (EC_GROUP_get_degree(group) != 521) ABORT;
611 fprintf(stdout, " ok\n");
612
613 group_order_tests(group);
614
615 if (!(P_521 = EC_GROUP_new(EC_GROUP_method_of(group)))) ABORT;
616 if (!EC_GROUP_copy(P_521, group)) ABORT;
617
618
619 /* more tests using the last curve */
620
621 if (!EC_POINT_copy(Q, P)) ABORT;
622 if (EC_POINT_is_at_infinity(group, Q)) ABORT;
623 if (!EC_POINT_dbl(group, P, P, ctx)) ABORT;
624 if (!EC_POINT_is_on_curve(group, P, ctx)) ABORT;
625 if (!EC_POINT_invert(group, Q, ctx)) ABORT; /* P = -2Q */
626
627 if (!EC_POINT_add(group, R, P, Q, ctx)) ABORT;
628 if (!EC_POINT_add(group, R, R, Q, ctx)) ABORT;
629 if (!EC_POINT_is_at_infinity(group, R)) ABORT; /* R = P + 2Q */
630
631 {
632 const EC_POINT *points[4];
633 const BIGNUM *scalars[4];
634 BIGNUM scalar3;
635
636 if (EC_POINT_is_at_infinity(group, Q)) ABORT;
637 points[0] = Q;
638 points[1] = Q;
639 points[2] = Q;
640 points[3] = Q;
641
642 if (!EC_GROUP_get_order(group, z, ctx)) ABORT;
643 if (!BN_add(y, z, BN_value_one())) ABORT;
644 if (BN_is_odd(y)) ABORT;
645 if (!BN_rshift1(y, y)) ABORT;
646 scalars[0] = y; /* (group order + 1)/2, so y*Q + y*Q = Q */
647 scalars[1] = y;
648
649 fprintf(stdout, "combined multiplication ...");
650 fflush(stdout);
651
652 /* z is still the group order */
653 if (!EC_POINTs_mul(group, P, NULL, 2, points, scalars, ctx)) ABORT;
654 if (!EC_POINTs_mul(group, R, z, 2, points, scalars, ctx)) ABORT;
655 if (0 != EC_POINT_cmp(group, P, R, ctx)) ABORT;
656 if (0 != EC_POINT_cmp(group, R, Q, ctx)) ABORT;
657
658 fprintf(stdout, ".");
659 fflush(stdout);
660
661 if (!BN_pseudo_rand(y, BN_num_bits(y), 0, 0)) ABORT;
662 if (!BN_add(z, z, y)) ABORT;
663 BN_set_negative(z, 1);
664 scalars[0] = y;
665 scalars[1] = z; /* z = -(order + y) */
666
667 if (!EC_POINTs_mul(group, P, NULL, 2, points, scalars, ctx)) ABORT;
668 if (!EC_POINT_is_at_infinity(group, P)) ABORT;
669
670 fprintf(stdout, ".");
671 fflush(stdout);
672
673 if (!BN_pseudo_rand(x, BN_num_bits(y) - 1, 0, 0)) ABORT;
674 if (!BN_add(z, x, y)) ABORT;
675 BN_set_negative(z, 1);
676 scalars[0] = x;
677 scalars[1] = y;
678 scalars[2] = z; /* z = -(x+y) */
679
680 BN_init(&scalar3);
681 BN_zero(&scalar3);
682 scalars[3] = &scalar3;
683
684 if (!EC_POINTs_mul(group, P, NULL, 4, points, scalars, ctx)) ABORT;
685 if (!EC_POINT_is_at_infinity(group, P)) ABORT;
686
687 fprintf(stdout, " ok\n\n");
688
689 BN_free(&scalar3);
690 }
691
692
693#if 0
694 timings(P_160, TIMING_BASE_PT, ctx);
695 timings(P_160, TIMING_RAND_PT, ctx);
696 timings(P_160, TIMING_SIMUL, ctx);
697 timings(P_192, TIMING_BASE_PT, ctx);
698 timings(P_192, TIMING_RAND_PT, ctx);
699 timings(P_192, TIMING_SIMUL, ctx);
700 timings(P_224, TIMING_BASE_PT, ctx);
701 timings(P_224, TIMING_RAND_PT, ctx);
702 timings(P_224, TIMING_SIMUL, ctx);
703 timings(P_256, TIMING_BASE_PT, ctx);
704 timings(P_256, TIMING_RAND_PT, ctx);
705 timings(P_256, TIMING_SIMUL, ctx);
706 timings(P_384, TIMING_BASE_PT, ctx);
707 timings(P_384, TIMING_RAND_PT, ctx);
708 timings(P_384, TIMING_SIMUL, ctx);
709 timings(P_521, TIMING_BASE_PT, ctx);
710 timings(P_521, TIMING_RAND_PT, ctx);
711 timings(P_521, TIMING_SIMUL, ctx);
712#endif
713
714
715 if (ctx)
716 BN_CTX_free(ctx);
717 BN_free(p); BN_free(a); BN_free(b);
718 EC_GROUP_free(group);
719 EC_POINT_free(P);
720 EC_POINT_free(Q);
721 EC_POINT_free(R);
722 BN_free(x); BN_free(y); BN_free(z);
723
724 if (P_160) EC_GROUP_free(P_160);
725 if (P_192) EC_GROUP_free(P_192);
726 if (P_224) EC_GROUP_free(P_224);
727 if (P_256) EC_GROUP_free(P_256);
728 if (P_384) EC_GROUP_free(P_384);
729 if (P_521) EC_GROUP_free(P_521);
730
731 }
732
733/* Change test based on whether binary point compression is enabled or not. */
734#ifdef OPENSSL_EC_BIN_PT_COMP
735#define CHAR2_CURVE_TEST_INTERNAL(_name, _p, _a, _b, _x, _y, _y_bit, _order, _cof, _degree, _variable) \
736 if (!BN_hex2bn(&x, _x)) ABORT; \
737 if (!EC_POINT_set_compressed_coordinates_GF2m(group, P, x, _y_bit, ctx)) ABORT; \
738 if (!EC_POINT_is_on_curve(group, P, ctx)) ABORT; \
739 if (!BN_hex2bn(&z, _order)) ABORT; \
740 if (!BN_hex2bn(&cof, _cof)) ABORT; \
741 if (!EC_GROUP_set_generator(group, P, z, cof)) ABORT; \
742 if (!EC_POINT_get_affine_coordinates_GF2m(group, P, x, y, ctx)) ABORT; \
743 fprintf(stdout, "\n%s -- Generator:\n x = 0x", _name); \
744 BN_print_fp(stdout, x); \
745 fprintf(stdout, "\n y = 0x"); \
746 BN_print_fp(stdout, y); \
747 fprintf(stdout, "\n"); \
748 /* G_y value taken from the standard: */ \
749 if (!BN_hex2bn(&z, _y)) ABORT; \
750 if (0 != BN_cmp(y, z)) ABORT;
751#else
752#define CHAR2_CURVE_TEST_INTERNAL(_name, _p, _a, _b, _x, _y, _y_bit, _order, _cof, _degree, _variable) \
753 if (!BN_hex2bn(&x, _x)) ABORT; \
754 if (!BN_hex2bn(&y, _y)) ABORT; \
755 if (!EC_POINT_set_affine_coordinates_GF2m(group, P, x, y, ctx)) ABORT; \
756 if (!EC_POINT_is_on_curve(group, P, ctx)) ABORT; \
757 if (!BN_hex2bn(&z, _order)) ABORT; \
758 if (!BN_hex2bn(&cof, _cof)) ABORT; \
759 if (!EC_GROUP_set_generator(group, P, z, cof)) ABORT; \
760 fprintf(stdout, "\n%s -- Generator:\n x = 0x", _name); \
761 BN_print_fp(stdout, x); \
762 fprintf(stdout, "\n y = 0x"); \
763 BN_print_fp(stdout, y); \
764 fprintf(stdout, "\n");
765#endif
766
767#define CHAR2_CURVE_TEST(_name, _p, _a, _b, _x, _y, _y_bit, _order, _cof, _degree, _variable) \
768 if (!BN_hex2bn(&p, _p)) ABORT; \
769 if (!BN_hex2bn(&a, _a)) ABORT; \
770 if (!BN_hex2bn(&b, _b)) ABORT; \
771 if (!EC_GROUP_set_curve_GF2m(group, p, a, b, ctx)) ABORT; \
772 CHAR2_CURVE_TEST_INTERNAL(_name, _p, _a, _b, _x, _y, _y_bit, _order, _cof, _degree, _variable) \
773 fprintf(stdout, "verify degree ..."); \
774 if (EC_GROUP_get_degree(group) != _degree) ABORT; \
775 fprintf(stdout, " ok\n"); \
776 group_order_tests(group); \
777 if (!(_variable = EC_GROUP_new(EC_GROUP_method_of(group)))) ABORT; \
778 if (!EC_GROUP_copy(_variable, group)) ABORT; \
779
780#ifndef OPENSSL_NO_EC2M
781
782static void char2_field_tests(void)
783 {
784 BN_CTX *ctx = NULL;
785 BIGNUM *p, *a, *b;
786 EC_GROUP *group;
787 EC_GROUP *C2_K163 = NULL, *C2_K233 = NULL, *C2_K283 = NULL, *C2_K409 = NULL, *C2_K571 = NULL;
788 EC_GROUP *C2_B163 = NULL, *C2_B233 = NULL, *C2_B283 = NULL, *C2_B409 = NULL, *C2_B571 = NULL;
789 EC_POINT *P, *Q, *R;
790 BIGNUM *x, *y, *z, *cof;
791 unsigned char buf[100];
792 size_t i, len;
793 int k;
794
795#if 1 /* optional */
796 ctx = BN_CTX_new();
797 if (!ctx) ABORT;
798#endif
799
800 p = BN_new();
801 a = BN_new();
802 b = BN_new();
803 if (!p || !a || !b) ABORT;
804
805 if (!BN_hex2bn(&p, "13")) ABORT;
806 if (!BN_hex2bn(&a, "3")) ABORT;
807 if (!BN_hex2bn(&b, "1")) ABORT;
808
809 group = EC_GROUP_new(EC_GF2m_simple_method()); /* applications should use EC_GROUP_new_curve_GF2m
810 * so that the library gets to choose the EC_METHOD */
811 if (!group) ABORT;
812 if (!EC_GROUP_set_curve_GF2m(group, p, a, b, ctx)) ABORT;
813
814 {
815 EC_GROUP *tmp;
816 tmp = EC_GROUP_new(EC_GROUP_method_of(group));
817 if (!tmp) ABORT;
818 if (!EC_GROUP_copy(tmp, group)) ABORT;
819 EC_GROUP_free(group);
820 group = tmp;
821 }
822
823 if (!EC_GROUP_get_curve_GF2m(group, p, a, b, ctx)) ABORT;
824
825 fprintf(stdout, "Curve defined by Weierstrass equation\n y^2 + x*y = x^3 + a*x^2 + b (mod 0x");
826 BN_print_fp(stdout, p);
827 fprintf(stdout, ")\n a = 0x");
828 BN_print_fp(stdout, a);
829 fprintf(stdout, "\n b = 0x");
830 BN_print_fp(stdout, b);
831 fprintf(stdout, "\n(0x... means binary polynomial)\n");
832
833 P = EC_POINT_new(group);
834 Q = EC_POINT_new(group);
835 R = EC_POINT_new(group);
836 if (!P || !Q || !R) ABORT;
837
838 if (!EC_POINT_set_to_infinity(group, P)) ABORT;
839 if (!EC_POINT_is_at_infinity(group, P)) ABORT;
840
841 buf[0] = 0;
842 if (!EC_POINT_oct2point(group, Q, buf, 1, ctx)) ABORT;
843
844 if (!EC_POINT_add(group, P, P, Q, ctx)) ABORT;
845 if (!EC_POINT_is_at_infinity(group, P)) ABORT;
846
847 x = BN_new();
848 y = BN_new();
849 z = BN_new();
850 cof = BN_new();
851 if (!x || !y || !z || !cof) ABORT;
852
853 if (!BN_hex2bn(&x, "6")) ABORT;
854/* Change test based on whether binary point compression is enabled or not. */
855#ifdef OPENSSL_EC_BIN_PT_COMP
856 if (!EC_POINT_set_compressed_coordinates_GF2m(group, Q, x, 1, ctx)) ABORT;
857#else
858 if (!BN_hex2bn(&y, "8")) ABORT;
859 if (!EC_POINT_set_affine_coordinates_GF2m(group, Q, x, y, ctx)) ABORT;
860#endif
861 if (!EC_POINT_is_on_curve(group, Q, ctx))
862 {
863/* Change test based on whether binary point compression is enabled or not. */
864#ifdef OPENSSL_EC_BIN_PT_COMP
865 if (!EC_POINT_get_affine_coordinates_GF2m(group, Q, x, y, ctx)) ABORT;
866#endif
867 fprintf(stderr, "Point is not on curve: x = 0x");
868 BN_print_fp(stderr, x);
869 fprintf(stderr, ", y = 0x");
870 BN_print_fp(stderr, y);
871 fprintf(stderr, "\n");
872 ABORT;
873 }
874
875 fprintf(stdout, "A cyclic subgroup:\n");
876 k = 100;
877 do
878 {
879 if (k-- == 0) ABORT;
880
881 if (EC_POINT_is_at_infinity(group, P))
882 fprintf(stdout, " point at infinity\n");
883 else
884 {
885 if (!EC_POINT_get_affine_coordinates_GF2m(group, P, x, y, ctx)) ABORT;
886
887 fprintf(stdout, " x = 0x");
888 BN_print_fp(stdout, x);
889 fprintf(stdout, ", y = 0x");
890 BN_print_fp(stdout, y);
891 fprintf(stdout, "\n");
892 }
893
894 if (!EC_POINT_copy(R, P)) ABORT;
895 if (!EC_POINT_add(group, P, P, Q, ctx)) ABORT;
896 }
897 while (!EC_POINT_is_at_infinity(group, P));
898
899 if (!EC_POINT_add(group, P, Q, R, ctx)) ABORT;
900 if (!EC_POINT_is_at_infinity(group, P)) ABORT;
901
902/* Change test based on whether binary point compression is enabled or not. */
903#ifdef OPENSSL_EC_BIN_PT_COMP
904 len = EC_POINT_point2oct(group, Q, POINT_CONVERSION_COMPRESSED, buf, sizeof buf, ctx);
905 if (len == 0) ABORT;
906 if (!EC_POINT_oct2point(group, P, buf, len, ctx)) ABORT;
907 if (0 != EC_POINT_cmp(group, P, Q, ctx)) ABORT;
908 fprintf(stdout, "Generator as octet string, compressed form:\n ");
909 for (i = 0; i < len; i++) fprintf(stdout, "%02X", buf[i]);
910#endif
911
912 len = EC_POINT_point2oct(group, Q, POINT_CONVERSION_UNCOMPRESSED, buf, sizeof buf, ctx);
913 if (len == 0) ABORT;
914 if (!EC_POINT_oct2point(group, P, buf, len, ctx)) ABORT;
915 if (0 != EC_POINT_cmp(group, P, Q, ctx)) ABORT;
916 fprintf(stdout, "\nGenerator as octet string, uncompressed form:\n ");
917 for (i = 0; i < len; i++) fprintf(stdout, "%02X", buf[i]);
918
919/* Change test based on whether binary point compression is enabled or not. */
920#ifdef OPENSSL_EC_BIN_PT_COMP
921 len = EC_POINT_point2oct(group, Q, POINT_CONVERSION_HYBRID, buf, sizeof buf, ctx);
922 if (len == 0) ABORT;
923 if (!EC_POINT_oct2point(group, P, buf, len, ctx)) ABORT;
924 if (0 != EC_POINT_cmp(group, P, Q, ctx)) ABORT;
925 fprintf(stdout, "\nGenerator as octet string, hybrid form:\n ");
926 for (i = 0; i < len; i++) fprintf(stdout, "%02X", buf[i]);
927#endif
928
929 fprintf(stdout, "\n");
930
931 if (!EC_POINT_invert(group, P, ctx)) ABORT;
932 if (0 != EC_POINT_cmp(group, P, R, ctx)) ABORT;
933
934
935 /* Curve K-163 (FIPS PUB 186-2, App. 6) */
936 CHAR2_CURVE_TEST
937 (
938 "NIST curve K-163",
939 "0800000000000000000000000000000000000000C9",
940 "1",
941 "1",
942 "02FE13C0537BBC11ACAA07D793DE4E6D5E5C94EEE8",
943 "0289070FB05D38FF58321F2E800536D538CCDAA3D9",
944 1,
945 "04000000000000000000020108A2E0CC0D99F8A5EF",
946 "2",
947 163,
948 C2_K163
949 );
950
951 /* Curve B-163 (FIPS PUB 186-2, App. 6) */
952 CHAR2_CURVE_TEST
953 (
954 "NIST curve B-163",
955 "0800000000000000000000000000000000000000C9",
956 "1",
957 "020A601907B8C953CA1481EB10512F78744A3205FD",
958 "03F0EBA16286A2D57EA0991168D4994637E8343E36",
959 "00D51FBC6C71A0094FA2CDD545B11C5C0C797324F1",
960 1,
961 "040000000000000000000292FE77E70C12A4234C33",
962 "2",
963 163,
964 C2_B163
965 );
966
967 /* Curve K-233 (FIPS PUB 186-2, App. 6) */
968 CHAR2_CURVE_TEST
969 (
970 "NIST curve K-233",
971 "020000000000000000000000000000000000000004000000000000000001",
972 "0",
973 "1",
974 "017232BA853A7E731AF129F22FF4149563A419C26BF50A4C9D6EEFAD6126",
975 "01DB537DECE819B7F70F555A67C427A8CD9BF18AEB9B56E0C11056FAE6A3",
976 0,
977 "008000000000000000000000000000069D5BB915BCD46EFB1AD5F173ABDF",
978 "4",
979 233,
980 C2_K233
981 );
982
983 /* Curve B-233 (FIPS PUB 186-2, App. 6) */
984 CHAR2_CURVE_TEST
985 (
986 "NIST curve B-233",
987 "020000000000000000000000000000000000000004000000000000000001",
988 "000000000000000000000000000000000000000000000000000000000001",
989 "0066647EDE6C332C7F8C0923BB58213B333B20E9CE4281FE115F7D8F90AD",
990 "00FAC9DFCBAC8313BB2139F1BB755FEF65BC391F8B36F8F8EB7371FD558B",
991 "01006A08A41903350678E58528BEBF8A0BEFF867A7CA36716F7E01F81052",
992 1,
993 "01000000000000000000000000000013E974E72F8A6922031D2603CFE0D7",
994 "2",
995 233,
996 C2_B233
997 );
998
999 /* Curve K-283 (FIPS PUB 186-2, App. 6) */
1000 CHAR2_CURVE_TEST
1001 (
1002 "NIST curve K-283",
1003 "0800000000000000000000000000000000000000000000000000000000000000000010A1",
1004 "0",
1005 "1",
1006 "0503213F78CA44883F1A3B8162F188E553CD265F23C1567A16876913B0C2AC2458492836",
1007 "01CCDA380F1C9E318D90F95D07E5426FE87E45C0E8184698E45962364E34116177DD2259",
1008 0,
1009 "01FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE9AE2ED07577265DFF7F94451E061E163C61",
1010 "4",
1011 283,
1012 C2_K283
1013 );
1014
1015 /* Curve B-283 (FIPS PUB 186-2, App. 6) */
1016 CHAR2_CURVE_TEST
1017 (
1018 "NIST curve B-283",
1019 "0800000000000000000000000000000000000000000000000000000000000000000010A1",
1020 "000000000000000000000000000000000000000000000000000000000000000000000001",
1021 "027B680AC8B8596DA5A4AF8A19A0303FCA97FD7645309FA2A581485AF6263E313B79A2F5",
1022 "05F939258DB7DD90E1934F8C70B0DFEC2EED25B8557EAC9C80E2E198F8CDBECD86B12053",
1023 "03676854FE24141CB98FE6D4B20D02B4516FF702350EDDB0826779C813F0DF45BE8112F4",
1024 1,
1025 "03FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEF90399660FC938A90165B042A7CEFADB307",
1026 "2",
1027 283,
1028 C2_B283
1029 );
1030
1031 /* Curve K-409 (FIPS PUB 186-2, App. 6) */
1032 CHAR2_CURVE_TEST
1033 (
1034 "NIST curve K-409",
1035 "02000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000001",
1036 "0",
1037 "1",
1038 "0060F05F658F49C1AD3AB1890F7184210EFD0987E307C84C27ACCFB8F9F67CC2C460189EB5AAAA62EE222EB1B35540CFE9023746",
1039 "01E369050B7C4E42ACBA1DACBF04299C3460782F918EA427E6325165E9EA10E3DA5F6C42E9C55215AA9CA27A5863EC48D8E0286B",
1040 1,
1041 "007FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE5F83B2D4EA20400EC4557D5ED3E3E7CA5B4B5C83B8E01E5FCF",
1042 "4",
1043 409,
1044 C2_K409
1045 );
1046
1047 /* Curve B-409 (FIPS PUB 186-2, App. 6) */
1048 CHAR2_CURVE_TEST
1049 (
1050 "NIST curve B-409",
1051 "02000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000001",
1052 "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001",
1053 "0021A5C2C8EE9FEB5C4B9A753B7B476B7FD6422EF1F3DD674761FA99D6AC27C8A9A197B272822F6CD57A55AA4F50AE317B13545F",
1054 "015D4860D088DDB3496B0C6064756260441CDE4AF1771D4DB01FFE5B34E59703DC255A868A1180515603AEAB60794E54BB7996A7",
1055 "0061B1CFAB6BE5F32BBFA78324ED106A7636B9C5A7BD198D0158AA4F5488D08F38514F1FDF4B4F40D2181B3681C364BA0273C706",
1056 1,
1057 "010000000000000000000000000000000000000000000000000001E2AAD6A612F33307BE5FA47C3C9E052F838164CD37D9A21173",
1058 "2",
1059 409,
1060 C2_B409
1061 );
1062
1063 /* Curve K-571 (FIPS PUB 186-2, App. 6) */
1064 CHAR2_CURVE_TEST
1065 (
1066 "NIST curve K-571",
1067 "80000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000425",
1068 "0",
1069 "1",
1070 "026EB7A859923FBC82189631F8103FE4AC9CA2970012D5D46024804801841CA44370958493B205E647DA304DB4CEB08CBBD1BA39494776FB988B47174DCA88C7E2945283A01C8972",
1071 "0349DC807F4FBF374F4AEADE3BCA95314DD58CEC9F307A54FFC61EFC006D8A2C9D4979C0AC44AEA74FBEBBB9F772AEDCB620B01A7BA7AF1B320430C8591984F601CD4C143EF1C7A3",
1072 0,
1073 "020000000000000000000000000000000000000000000000000000000000000000000000131850E1F19A63E4B391A8DB917F4138B630D84BE5D639381E91DEB45CFE778F637C1001",
1074 "4",
1075 571,
1076 C2_K571
1077 );
1078
1079 /* Curve B-571 (FIPS PUB 186-2, App. 6) */
1080 CHAR2_CURVE_TEST
1081 (
1082 "NIST curve B-571",
1083 "80000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000425",
1084 "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001",
1085 "02F40E7E2221F295DE297117B7F3D62F5C6A97FFCB8CEFF1CD6BA8CE4A9A18AD84FFABBD8EFA59332BE7AD6756A66E294AFD185A78FF12AA520E4DE739BACA0C7FFEFF7F2955727A",
1086 "0303001D34B856296C16C0D40D3CD7750A93D1D2955FA80AA5F40FC8DB7B2ABDBDE53950F4C0D293CDD711A35B67FB1499AE60038614F1394ABFA3B4C850D927E1E7769C8EEC2D19",
1087 "037BF27342DA639B6DCCFFFEB73D69D78C6C27A6009CBBCA1980F8533921E8A684423E43BAB08A576291AF8F461BB2A8B3531D2F0485C19B16E2F1516E23DD3C1A4827AF1B8AC15B",
1088 1,
1089 "03FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE661CE18FF55987308059B186823851EC7DD9CA1161DE93D5174D66E8382E9BB2FE84E47",
1090 "2",
1091 571,
1092 C2_B571
1093 );
1094
1095 /* more tests using the last curve */
1096
1097 if (!EC_POINT_copy(Q, P)) ABORT;
1098 if (EC_POINT_is_at_infinity(group, Q)) ABORT;
1099 if (!EC_POINT_dbl(group, P, P, ctx)) ABORT;
1100 if (!EC_POINT_is_on_curve(group, P, ctx)) ABORT;
1101 if (!EC_POINT_invert(group, Q, ctx)) ABORT; /* P = -2Q */
1102
1103 if (!EC_POINT_add(group, R, P, Q, ctx)) ABORT;
1104 if (!EC_POINT_add(group, R, R, Q, ctx)) ABORT;
1105 if (!EC_POINT_is_at_infinity(group, R)) ABORT; /* R = P + 2Q */
1106
1107 {
1108 const EC_POINT *points[3];
1109 const BIGNUM *scalars[3];
1110
1111 if (EC_POINT_is_at_infinity(group, Q)) ABORT;
1112 points[0] = Q;
1113 points[1] = Q;
1114 points[2] = Q;
1115
1116 if (!BN_add(y, z, BN_value_one())) ABORT;
1117 if (BN_is_odd(y)) ABORT;
1118 if (!BN_rshift1(y, y)) ABORT;
1119 scalars[0] = y; /* (group order + 1)/2, so y*Q + y*Q = Q */
1120 scalars[1] = y;
1121
1122 fprintf(stdout, "combined multiplication ...");
1123 fflush(stdout);
1124
1125 /* z is still the group order */
1126 if (!EC_POINTs_mul(group, P, NULL, 2, points, scalars, ctx)) ABORT;
1127 if (!EC_POINTs_mul(group, R, z, 2, points, scalars, ctx)) ABORT;
1128 if (0 != EC_POINT_cmp(group, P, R, ctx)) ABORT;
1129 if (0 != EC_POINT_cmp(group, R, Q, ctx)) ABORT;
1130
1131 fprintf(stdout, ".");
1132 fflush(stdout);
1133
1134 if (!BN_pseudo_rand(y, BN_num_bits(y), 0, 0)) ABORT;
1135 if (!BN_add(z, z, y)) ABORT;
1136 BN_set_negative(z, 1);
1137 scalars[0] = y;
1138 scalars[1] = z; /* z = -(order + y) */
1139
1140 if (!EC_POINTs_mul(group, P, NULL, 2, points, scalars, ctx)) ABORT;
1141 if (!EC_POINT_is_at_infinity(group, P)) ABORT;
1142
1143 fprintf(stdout, ".");
1144 fflush(stdout);
1145
1146 if (!BN_pseudo_rand(x, BN_num_bits(y) - 1, 0, 0)) ABORT;
1147 if (!BN_add(z, x, y)) ABORT;
1148 BN_set_negative(z, 1);
1149 scalars[0] = x;
1150 scalars[1] = y;
1151 scalars[2] = z; /* z = -(x+y) */
1152
1153 if (!EC_POINTs_mul(group, P, NULL, 3, points, scalars, ctx)) ABORT;
1154 if (!EC_POINT_is_at_infinity(group, P)) ABORT;
1155
1156 fprintf(stdout, " ok\n\n");
1157 }
1158
1159
1160#if 0
1161 timings(C2_K163, TIMING_BASE_PT, ctx);
1162 timings(C2_K163, TIMING_RAND_PT, ctx);
1163 timings(C2_K163, TIMING_SIMUL, ctx);
1164 timings(C2_B163, TIMING_BASE_PT, ctx);
1165 timings(C2_B163, TIMING_RAND_PT, ctx);
1166 timings(C2_B163, TIMING_SIMUL, ctx);
1167 timings(C2_K233, TIMING_BASE_PT, ctx);
1168 timings(C2_K233, TIMING_RAND_PT, ctx);
1169 timings(C2_K233, TIMING_SIMUL, ctx);
1170 timings(C2_B233, TIMING_BASE_PT, ctx);
1171 timings(C2_B233, TIMING_RAND_PT, ctx);
1172 timings(C2_B233, TIMING_SIMUL, ctx);
1173 timings(C2_K283, TIMING_BASE_PT, ctx);
1174 timings(C2_K283, TIMING_RAND_PT, ctx);
1175 timings(C2_K283, TIMING_SIMUL, ctx);
1176 timings(C2_B283, TIMING_BASE_PT, ctx);
1177 timings(C2_B283, TIMING_RAND_PT, ctx);
1178 timings(C2_B283, TIMING_SIMUL, ctx);
1179 timings(C2_K409, TIMING_BASE_PT, ctx);
1180 timings(C2_K409, TIMING_RAND_PT, ctx);
1181 timings(C2_K409, TIMING_SIMUL, ctx);
1182 timings(C2_B409, TIMING_BASE_PT, ctx);
1183 timings(C2_B409, TIMING_RAND_PT, ctx);
1184 timings(C2_B409, TIMING_SIMUL, ctx);
1185 timings(C2_K571, TIMING_BASE_PT, ctx);
1186 timings(C2_K571, TIMING_RAND_PT, ctx);
1187 timings(C2_K571, TIMING_SIMUL, ctx);
1188 timings(C2_B571, TIMING_BASE_PT, ctx);
1189 timings(C2_B571, TIMING_RAND_PT, ctx);
1190 timings(C2_B571, TIMING_SIMUL, ctx);
1191#endif
1192
1193
1194 if (ctx)
1195 BN_CTX_free(ctx);
1196 BN_free(p); BN_free(a); BN_free(b);
1197 EC_GROUP_free(group);
1198 EC_POINT_free(P);
1199 EC_POINT_free(Q);
1200 EC_POINT_free(R);
1201 BN_free(x); BN_free(y); BN_free(z); BN_free(cof);
1202
1203 if (C2_K163) EC_GROUP_free(C2_K163);
1204 if (C2_B163) EC_GROUP_free(C2_B163);
1205 if (C2_K233) EC_GROUP_free(C2_K233);
1206 if (C2_B233) EC_GROUP_free(C2_B233);
1207 if (C2_K283) EC_GROUP_free(C2_K283);
1208 if (C2_B283) EC_GROUP_free(C2_B283);
1209 if (C2_K409) EC_GROUP_free(C2_K409);
1210 if (C2_B409) EC_GROUP_free(C2_B409);
1211 if (C2_K571) EC_GROUP_free(C2_K571);
1212 if (C2_B571) EC_GROUP_free(C2_B571);
1213
1214 }
1215#endif
1216
1217static void internal_curve_test(void)
1218 {
1219 EC_builtin_curve *curves = NULL;
1220 size_t crv_len = 0, n = 0;
1221 int ok = 1;
1222
1223 crv_len = EC_get_builtin_curves(NULL, 0);
1224
1225 curves = OPENSSL_malloc(sizeof(EC_builtin_curve) * crv_len);
1226
1227 if (curves == NULL)
1228 return;
1229
1230 if (!EC_get_builtin_curves(curves, crv_len))
1231 {
1232 OPENSSL_free(curves);
1233 return;
1234 }
1235
1236 fprintf(stdout, "testing internal curves: ");
1237
1238 for (n = 0; n < crv_len; n++)
1239 {
1240 EC_GROUP *group = NULL;
1241 int nid = curves[n].nid;
1242 if ((group = EC_GROUP_new_by_curve_name(nid)) == NULL)
1243 {
1244 ok = 0;
1245 fprintf(stdout, "\nEC_GROUP_new_curve_name() failed with"
1246 " curve %s\n", OBJ_nid2sn(nid));
1247 /* try next curve */
1248 continue;
1249 }
1250 if (!EC_GROUP_check(group, NULL))
1251 {
1252 ok = 0;
1253 fprintf(stdout, "\nEC_GROUP_check() failed with"
1254 " curve %s\n", OBJ_nid2sn(nid));
1255 EC_GROUP_free(group);
1256 /* try the next curve */
1257 continue;
1258 }
1259 fprintf(stdout, ".");
1260 fflush(stdout);
1261 EC_GROUP_free(group);
1262 }
1263 if (ok)
1264 fprintf(stdout, " ok\n\n");
1265 else
1266 {
1267 fprintf(stdout, " failed\n\n");
1268 ABORT;
1269 }
1270 OPENSSL_free(curves);
1271 return;
1272 }
1273
1274#ifndef OPENSSL_NO_EC_NISTP_64_GCC_128
1275/* nistp_test_params contains magic numbers for testing our optimized
1276 * implementations of several NIST curves with characteristic > 3. */
1277struct nistp_test_params
1278 {
1279 const EC_METHOD* (*meth) ();
1280 int degree;
1281 /* Qx, Qy and D are taken from
1282 * http://csrc.nist.gov/groups/ST/toolkit/documents/Examples/ECDSA_Prime.pdf
1283 * Otherwise, values are standard curve parameters from FIPS 180-3 */
1284 const char *p, *a, *b, *Qx, *Qy, *Gx, *Gy, *order, *d;
1285 };
1286
1287static const struct nistp_test_params nistp_tests_params[] =
1288 {
1289 {
1290 /* P-224 */
1291 EC_GFp_nistp224_method,
1292 224,
1293 "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000001", /* p */
1294 "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFE", /* a */
1295 "B4050A850C04B3ABF54132565044B0B7D7BFD8BA270B39432355FFB4", /* b */
1296 "E84FB0B8E7000CB657D7973CF6B42ED78B301674276DF744AF130B3E", /* Qx */
1297 "4376675C6FC5612C21A0FF2D2A89D2987DF7A2BC52183B5982298555", /* Qy */
1298 "B70E0CBD6BB4BF7F321390B94A03C1D356C21122343280D6115C1D21", /* Gx */
1299 "BD376388B5F723FB4C22DFE6CD4375A05A07476444D5819985007E34", /* Gy */
1300 "FFFFFFFFFFFFFFFFFFFFFFFFFFFF16A2E0B8F03E13DD29455C5C2A3D", /* order */
1301 "3F0C488E987C80BE0FEE521F8D90BE6034EC69AE11CA72AA777481E8", /* d */
1302 },
1303 {
1304 /* P-256 */
1305 EC_GFp_nistp256_method,
1306 256,
1307 "ffffffff00000001000000000000000000000000ffffffffffffffffffffffff", /* p */
1308 "ffffffff00000001000000000000000000000000fffffffffffffffffffffffc", /* a */
1309 "5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b", /* b */
1310 "b7e08afdfe94bad3f1dc8c734798ba1c62b3a0ad1e9ea2a38201cd0889bc7a19", /* Qx */
1311 "3603f747959dbf7a4bb226e41928729063adc7ae43529e61b563bbc606cc5e09", /* Qy */
1312 "6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296", /* Gx */
1313 "4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5", /* Gy */
1314 "ffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551", /* order */
1315 "c477f9f65c22cce20657faa5b2d1d8122336f851a508a1ed04e479c34985bf96", /* d */
1316 },
1317 {
1318 /* P-521 */
1319 EC_GFp_nistp521_method,
1320 521,
1321 "1ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", /* p */
1322 "1fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc", /* a */
1323 "051953eb9618e1c9a1f929a21a0b68540eea2da725b99b315f3b8b489918ef109e156193951ec7e937b1652c0bd3bb1bf073573df883d2c34f1ef451fd46b503f00", /* b */
1324 "0098e91eef9a68452822309c52fab453f5f117c1da8ed796b255e9ab8f6410cca16e59df403a6bdc6ca467a37056b1e54b3005d8ac030decfeb68df18b171885d5c4", /* Qx */
1325 "0164350c321aecfc1cca1ba4364c9b15656150b4b78d6a48d7d28e7f31985ef17be8554376b72900712c4b83ad668327231526e313f5f092999a4632fd50d946bc2e", /* Qy */
1326 "c6858e06b70404e9cd9e3ecb662395b4429c648139053fb521f828af606b4d3dbaa14b5e77efe75928fe1dc127a2ffa8de3348b3c1856a429bf97e7e31c2e5bd66", /* Gx */
1327 "11839296a789a3bc0045c8a5fb42c7d1bd998f54449579b446817afbd17273e662c97ee72995ef42640c550b9013fad0761353c7086a272c24088be94769fd16650", /* Gy */
1328 "1fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa51868783bf2f966b7fcc0148f709a5d03bb5c9b8899c47aebb6fb71e91386409", /* order */
1329 "0100085f47b8e1b8b11b7eb33028c0b2888e304bfc98501955b45bba1478dc184eeedf09b86a5f7c21994406072787205e69a63709fe35aa93ba333514b24f961722", /* d */
1330 },
1331 };
1332
1333void nistp_single_test(const struct nistp_test_params *test)
1334 {
1335 BN_CTX *ctx;
1336 BIGNUM *p, *a, *b, *x, *y, *n, *m, *order;
1337 EC_GROUP *NISTP;
1338 EC_POINT *G, *P, *Q, *Q_CHECK;
1339
1340 fprintf(stdout, "\nNIST curve P-%d (optimised implementation):\n", test->degree);
1341 ctx = BN_CTX_new();
1342 p = BN_new();
1343 a = BN_new();
1344 b = BN_new();
1345 x = BN_new(); y = BN_new();
1346 m = BN_new(); n = BN_new(); order = BN_new();
1347
1348 NISTP = EC_GROUP_new(test->meth());
1349 if(!NISTP) ABORT;
1350 if (!BN_hex2bn(&p, test->p)) ABORT;
1351 if (1 != BN_is_prime_ex(p, BN_prime_checks, ctx, NULL)) ABORT;
1352 if (!BN_hex2bn(&a, test->a)) ABORT;
1353 if (!BN_hex2bn(&b, test->b)) ABORT;
1354 if (!EC_GROUP_set_curve_GFp(NISTP, p, a, b, ctx)) ABORT;
1355 G = EC_POINT_new(NISTP);
1356 P = EC_POINT_new(NISTP);
1357 Q = EC_POINT_new(NISTP);
1358 Q_CHECK = EC_POINT_new(NISTP);
1359 if(!BN_hex2bn(&x, test->Qx)) ABORT;
1360 if(!BN_hex2bn(&y, test->Qy)) ABORT;
1361 if(!EC_POINT_set_affine_coordinates_GFp(NISTP, Q_CHECK, x, y, ctx)) ABORT;
1362 if (!BN_hex2bn(&x, test->Gx)) ABORT;
1363 if (!BN_hex2bn(&y, test->Gy)) ABORT;
1364 if (!EC_POINT_set_affine_coordinates_GFp(NISTP, G, x, y, ctx)) ABORT;
1365 if (!BN_hex2bn(&order, test->order)) ABORT;
1366 if (!EC_GROUP_set_generator(NISTP, G, order, BN_value_one())) ABORT;
1367
1368 fprintf(stdout, "verify degree ... ");
1369 if (EC_GROUP_get_degree(NISTP) != test->degree) ABORT;
1370 fprintf(stdout, "ok\n");
1371
1372 fprintf(stdout, "NIST test vectors ... ");
1373 if (!BN_hex2bn(&n, test->d)) ABORT;
1374 /* fixed point multiplication */
1375 EC_POINT_mul(NISTP, Q, n, NULL, NULL, ctx);
1376 if (0 != EC_POINT_cmp(NISTP, Q, Q_CHECK, ctx)) ABORT;
1377 /* random point multiplication */
1378 EC_POINT_mul(NISTP, Q, NULL, G, n, ctx);
1379 if (0 != EC_POINT_cmp(NISTP, Q, Q_CHECK, ctx)) ABORT;
1380
1381 /* set generator to P = 2*G, where G is the standard generator */
1382 if (!EC_POINT_dbl(NISTP, P, G, ctx)) ABORT;
1383 if (!EC_GROUP_set_generator(NISTP, P, order, BN_value_one())) ABORT;
1384 /* set the scalar to m=n/2, where n is the NIST test scalar */
1385 if (!BN_rshift(m, n, 1)) ABORT;
1386
1387 /* test the non-standard generator */
1388 /* fixed point multiplication */
1389 EC_POINT_mul(NISTP, Q, m, NULL, NULL, ctx);
1390 if (0 != EC_POINT_cmp(NISTP, Q, Q_CHECK, ctx)) ABORT;
1391 /* random point multiplication */
1392 EC_POINT_mul(NISTP, Q, NULL, P, m, ctx);
1393 if (0 != EC_POINT_cmp(NISTP, Q, Q_CHECK, ctx)) ABORT;
1394
1395 /* now repeat all tests with precomputation */
1396 if (!EC_GROUP_precompute_mult(NISTP, ctx)) ABORT;
1397
1398 /* fixed point multiplication */
1399 EC_POINT_mul(NISTP, Q, m, NULL, NULL, ctx);
1400 if (0 != EC_POINT_cmp(NISTP, Q, Q_CHECK, ctx)) ABORT;
1401 /* random point multiplication */
1402 EC_POINT_mul(NISTP, Q, NULL, P, m, ctx);
1403 if (0 != EC_POINT_cmp(NISTP, Q, Q_CHECK, ctx)) ABORT;
1404
1405 /* reset generator */
1406 if (!EC_GROUP_set_generator(NISTP, G, order, BN_value_one())) ABORT;
1407 /* fixed point multiplication */
1408 EC_POINT_mul(NISTP, Q, n, NULL, NULL, ctx);
1409 if (0 != EC_POINT_cmp(NISTP, Q, Q_CHECK, ctx)) ABORT;
1410 /* random point multiplication */
1411 EC_POINT_mul(NISTP, Q, NULL, G, n, ctx);
1412 if (0 != EC_POINT_cmp(NISTP, Q, Q_CHECK, ctx)) ABORT;
1413
1414 fprintf(stdout, "ok\n");
1415 group_order_tests(NISTP);
1416#if 0
1417 timings(NISTP, TIMING_BASE_PT, ctx);
1418 timings(NISTP, TIMING_RAND_PT, ctx);
1419#endif
1420 EC_GROUP_free(NISTP);
1421 EC_POINT_free(G);
1422 EC_POINT_free(P);
1423 EC_POINT_free(Q);
1424 EC_POINT_free(Q_CHECK);
1425 BN_free(n);
1426 BN_free(m);
1427 BN_free(p);
1428 BN_free(a);
1429 BN_free(b);
1430 BN_free(x);
1431 BN_free(y);
1432 BN_free(order);
1433 BN_CTX_free(ctx);
1434 }
1435
1436void nistp_tests()
1437 {
1438 unsigned i;
1439
1440 for (i = 0; i < sizeof(nistp_tests_params) / sizeof(struct nistp_test_params); i++)
1441 {
1442 nistp_single_test(&nistp_tests_params[i]);
1443 }
1444 }
1445#endif
1446
1447static const char rnd_seed[] = "string to make the random number generator think it has entropy";
1448
1449int main(int argc, char *argv[])
1450 {
1451
1452 /* enable memory leak checking unless explicitly disabled */
1453 if (!((getenv("OPENSSL_DEBUG_MEMORY") != NULL) && (0 == strcmp(getenv("OPENSSL_DEBUG_MEMORY"), "off"))))
1454 {
1455 CRYPTO_malloc_debug_init();
1456 CRYPTO_set_mem_debug_options(V_CRYPTO_MDEBUG_ALL);
1457 }
1458 else
1459 {
1460 /* OPENSSL_DEBUG_MEMORY=off */
1461 CRYPTO_set_mem_debug_functions(0, 0, 0, 0, 0);
1462 }
1463 CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON);
1464 ERR_load_crypto_strings();
1465
1466 RAND_seed(rnd_seed, sizeof rnd_seed); /* or BN_generate_prime may fail */
1467
1468 prime_field_tests();
1469 puts("");
1470#ifndef OPENSSL_NO_EC2M
1471 char2_field_tests();
1472#endif
1473#ifndef OPENSSL_NO_EC_NISTP_64_GCC_128
1474 nistp_tests();
1475#endif
1476 /* test the internal curves */
1477 internal_curve_test();
1478
1479#ifndef OPENSSL_NO_ENGINE
1480 ENGINE_cleanup();
1481#endif
1482 CRYPTO_cleanup_all_ex_data();
1483 ERR_free_strings();
1484 ERR_remove_thread_state(NULL);
1485 CRYPTO_mem_leaks_fp(stderr);
1486
1487 return 0;
1488 }
1489#endif
diff --git a/src/lib/libcrypto/ecdh/Makefile b/src/lib/libcrypto/ecdh/Makefile
new file mode 100644
index 0000000000..65d8904ee8
--- /dev/null
+++ b/src/lib/libcrypto/ecdh/Makefile
@@ -0,0 +1,121 @@
1#
2# crypto/ecdh/Makefile
3#
4
5DIR= ecdh
6TOP= ../..
7CC= cc
8INCLUDES= -I.. -I$(TOP) -I../../include
9CFLAG=-g -Wall
10MAKEFILE= Makefile
11AR= ar r
12
13CFLAGS= $(INCLUDES) $(CFLAG)
14
15GENERAL=Makefile
16TEST=ecdhtest.c
17APPS=
18
19LIB=$(TOP)/libcrypto.a
20LIBSRC= ech_lib.c ech_ossl.c ech_key.c ech_err.c
21
22LIBOBJ= ech_lib.o ech_ossl.o ech_key.o ech_err.o
23
24SRC= $(LIBSRC)
25
26EXHEADER= ecdh.h
27HEADER= ech_locl.h $(EXHEADER)
28
29ALL= $(GENERAL) $(SRC) $(HEADER)
30
31top:
32 (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all)
33
34all: lib
35
36lib: $(LIBOBJ)
37 $(AR) $(LIB) $(LIBOBJ)
38 $(RANLIB) $(LIB) || echo Never mind.
39 @touch lib
40
41files:
42 $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
43
44links:
45 @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
46 @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
47 @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
48
49install:
50 @[ -n "$(INSTALLTOP)" ] # should be set by top Makefile...
51 @headerlist="$(EXHEADER)"; for i in $$headerlist; \
52 do \
53 (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
54 chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
55 done;
56
57tags:
58 ctags $(SRC)
59
60tests:
61
62lint:
63 lint -DLINT $(INCLUDES) $(SRC)>fluff
64
65depend:
66 @[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile...
67 $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
68
69dclean:
70 $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
71 mv -f Makefile.new $(MAKEFILE)
72
73clean:
74 rm -f *.o */*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
75
76# DO NOT DELETE THIS LINE -- make depend depends on it.
77
78ech_err.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
79ech_err.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
80ech_err.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
81ech_err.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
82ech_err.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
83ech_err.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
84ech_err.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
85ech_err.o: ech_err.c
86ech_key.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
87ech_key.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
88ech_key.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
89ech_key.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
90ech_key.o: ../../include/openssl/engine.h ../../include/openssl/evp.h
91ech_key.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
92ech_key.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
93ech_key.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
94ech_key.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
95ech_key.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
96ech_key.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
97ech_key.o: ../../include/openssl/x509_vfy.h ech_key.c ech_locl.h
98ech_lib.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
99ech_lib.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
100ech_lib.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
101ech_lib.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
102ech_lib.o: ../../include/openssl/engine.h ../../include/openssl/err.h
103ech_lib.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
104ech_lib.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
105ech_lib.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
106ech_lib.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
107ech_lib.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
108ech_lib.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
109ech_lib.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
110ech_lib.o: ech_lib.c ech_locl.h
111ech_ossl.o: ../../e_os.h ../../include/openssl/asn1.h
112ech_ossl.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
113ech_ossl.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
114ech_ossl.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
115ech_ossl.o: ../../include/openssl/ecdh.h ../../include/openssl/err.h
116ech_ossl.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
117ech_ossl.o: ../../include/openssl/opensslconf.h
118ech_ossl.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
119ech_ossl.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
120ech_ossl.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
121ech_ossl.o: ../cryptlib.h ech_locl.h ech_ossl.c
diff --git a/src/lib/libcrypto/ecdh/ecdhtest.c b/src/lib/libcrypto/ecdh/ecdhtest.c
new file mode 100644
index 0000000000..823d7baa65
--- /dev/null
+++ b/src/lib/libcrypto/ecdh/ecdhtest.c
@@ -0,0 +1,374 @@
1/* crypto/ecdh/ecdhtest.c */
2/* ====================================================================
3 * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED.
4 *
5 * The Elliptic Curve Public-Key Crypto Library (ECC Code) included
6 * herein is developed by SUN MICROSYSTEMS, INC., and is contributed
7 * to the OpenSSL project.
8 *
9 * The ECC Code is licensed pursuant to the OpenSSL open source
10 * license provided below.
11 *
12 * The ECDH software is originally written by Douglas Stebila of
13 * Sun Microsystems Laboratories.
14 *
15 */
16/* ====================================================================
17 * Copyright (c) 1998-2003 The OpenSSL Project. All rights reserved.
18 *
19 * Redistribution and use in source and binary forms, with or without
20 * modification, are permitted provided that the following conditions
21 * are met:
22 *
23 * 1. Redistributions of source code must retain the above copyright
24 * notice, this list of conditions and the following disclaimer.
25 *
26 * 2. Redistributions in binary form must reproduce the above copyright
27 * notice, this list of conditions and the following disclaimer in
28 * the documentation and/or other materials provided with the
29 * distribution.
30 *
31 * 3. All advertising materials mentioning features or use of this
32 * software must display the following acknowledgment:
33 * "This product includes software developed by the OpenSSL Project
34 * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
35 *
36 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
37 * endorse or promote products derived from this software without
38 * prior written permission. For written permission, please contact
39 * openssl-core@openssl.org.
40 *
41 * 5. Products derived from this software may not be called "OpenSSL"
42 * nor may "OpenSSL" appear in their names without prior written
43 * permission of the OpenSSL Project.
44 *
45 * 6. Redistributions of any form whatsoever must retain the following
46 * acknowledgment:
47 * "This product includes software developed by the OpenSSL Project
48 * for use in the OpenSSL Toolkit (http://www.openssl.org/)"
49 *
50 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
51 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
52 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
53 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
54 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
55 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
56 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
57 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
58 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
59 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
60 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
61 * OF THE POSSIBILITY OF SUCH DAMAGE.
62 * ====================================================================
63 *
64 * This product includes cryptographic software written by Eric Young
65 * (eay@cryptsoft.com). This product includes software written by Tim
66 * Hudson (tjh@cryptsoft.com).
67 *
68 */
69
70#include <stdio.h>
71#include <stdlib.h>
72#include <string.h>
73
74#include "../e_os.h"
75
76#include <openssl/opensslconf.h> /* for OPENSSL_NO_ECDH */
77#include <openssl/crypto.h>
78#include <openssl/bio.h>
79#include <openssl/bn.h>
80#include <openssl/objects.h>
81#include <openssl/rand.h>
82#include <openssl/sha.h>
83#include <openssl/err.h>
84
85#ifdef OPENSSL_NO_ECDH
86int main(int argc, char *argv[])
87{
88 printf("No ECDH support\n");
89 return(0);
90}
91#else
92#include <openssl/ec.h>
93#include <openssl/ecdh.h>
94
95#ifdef OPENSSL_SYS_WIN16
96#define MS_CALLBACK _far _loadds
97#else
98#define MS_CALLBACK
99#endif
100
101#if 0
102static void MS_CALLBACK cb(int p, int n, void *arg);
103#endif
104
105static const char rnd_seed[] = "string to make the random number generator think it has entropy";
106
107
108static const int KDF1_SHA1_len = 20;
109static void *KDF1_SHA1(const void *in, size_t inlen, void *out, size_t *outlen)
110 {
111#ifndef OPENSSL_NO_SHA
112 if (*outlen < SHA_DIGEST_LENGTH)
113 return NULL;
114 else
115 *outlen = SHA_DIGEST_LENGTH;
116 return SHA1(in, inlen, out);
117#else
118 return NULL;
119#endif
120 }
121
122
123static int test_ecdh_curve(int nid, const char *text, BN_CTX *ctx, BIO *out)
124 {
125 EC_KEY *a=NULL;
126 EC_KEY *b=NULL;
127 BIGNUM *x_a=NULL, *y_a=NULL,
128 *x_b=NULL, *y_b=NULL;
129 char buf[12];
130 unsigned char *abuf=NULL,*bbuf=NULL;
131 int i,alen,blen,aout,bout,ret=0;
132 const EC_GROUP *group;
133
134 a = EC_KEY_new_by_curve_name(nid);
135 b = EC_KEY_new_by_curve_name(nid);
136 if (a == NULL || b == NULL)
137 goto err;
138
139 group = EC_KEY_get0_group(a);
140
141 if ((x_a=BN_new()) == NULL) goto err;
142 if ((y_a=BN_new()) == NULL) goto err;
143 if ((x_b=BN_new()) == NULL) goto err;
144 if ((y_b=BN_new()) == NULL) goto err;
145
146 BIO_puts(out,"Testing key generation with ");
147 BIO_puts(out,text);
148#ifdef NOISY
149 BIO_puts(out,"\n");
150#else
151 (void)BIO_flush(out);
152#endif
153
154 if (!EC_KEY_generate_key(a)) goto err;
155
156 if (EC_METHOD_get_field_type(EC_GROUP_method_of(group)) == NID_X9_62_prime_field)
157 {
158 if (!EC_POINT_get_affine_coordinates_GFp(group,
159 EC_KEY_get0_public_key(a), x_a, y_a, ctx)) goto err;
160 }
161#ifndef OPENSSL_NO_EC2M
162 else
163 {
164 if (!EC_POINT_get_affine_coordinates_GF2m(group,
165 EC_KEY_get0_public_key(a), x_a, y_a, ctx)) goto err;
166 }
167#endif
168#ifdef NOISY
169 BIO_puts(out," pri 1=");
170 BN_print(out,a->priv_key);
171 BIO_puts(out,"\n pub 1=");
172 BN_print(out,x_a);
173 BIO_puts(out,",");
174 BN_print(out,y_a);
175 BIO_puts(out,"\n");
176#else
177 BIO_printf(out," .");
178 (void)BIO_flush(out);
179#endif
180
181 if (!EC_KEY_generate_key(b)) goto err;
182
183 if (EC_METHOD_get_field_type(EC_GROUP_method_of(group)) == NID_X9_62_prime_field)
184 {
185 if (!EC_POINT_get_affine_coordinates_GFp(group,
186 EC_KEY_get0_public_key(b), x_b, y_b, ctx)) goto err;
187 }
188#ifndef OPENSSL_NO_EC2M
189 else
190 {
191 if (!EC_POINT_get_affine_coordinates_GF2m(group,
192 EC_KEY_get0_public_key(b), x_b, y_b, ctx)) goto err;
193 }
194#endif
195
196#ifdef NOISY
197 BIO_puts(out," pri 2=");
198 BN_print(out,b->priv_key);
199 BIO_puts(out,"\n pub 2=");
200 BN_print(out,x_b);
201 BIO_puts(out,",");
202 BN_print(out,y_b);
203 BIO_puts(out,"\n");
204#else
205 BIO_printf(out,".");
206 (void)BIO_flush(out);
207#endif
208
209 alen=KDF1_SHA1_len;
210 abuf=(unsigned char *)OPENSSL_malloc(alen);
211 aout=ECDH_compute_key(abuf,alen,EC_KEY_get0_public_key(b),a,KDF1_SHA1);
212
213#ifdef NOISY
214 BIO_puts(out," key1 =");
215 for (i=0; i<aout; i++)
216 {
217 sprintf(buf,"%02X",abuf[i]);
218 BIO_puts(out,buf);
219 }
220 BIO_puts(out,"\n");
221#else
222 BIO_printf(out,".");
223 (void)BIO_flush(out);
224#endif
225
226 blen=KDF1_SHA1_len;
227 bbuf=(unsigned char *)OPENSSL_malloc(blen);
228 bout=ECDH_compute_key(bbuf,blen,EC_KEY_get0_public_key(a),b,KDF1_SHA1);
229
230#ifdef NOISY
231 BIO_puts(out," key2 =");
232 for (i=0; i<bout; i++)
233 {
234 sprintf(buf,"%02X",bbuf[i]);
235 BIO_puts(out,buf);
236 }
237 BIO_puts(out,"\n");
238#else
239 BIO_printf(out,".");
240 (void)BIO_flush(out);
241#endif
242
243 if ((aout < 4) || (bout != aout) || (memcmp(abuf,bbuf,aout) != 0))
244 {
245#ifndef NOISY
246 BIO_printf(out, " failed\n\n");
247 BIO_printf(out, "key a:\n");
248 BIO_printf(out, "private key: ");
249 BN_print(out, EC_KEY_get0_private_key(a));
250 BIO_printf(out, "\n");
251 BIO_printf(out, "public key (x,y): ");
252 BN_print(out, x_a);
253 BIO_printf(out, ",");
254 BN_print(out, y_a);
255 BIO_printf(out, "\nkey b:\n");
256 BIO_printf(out, "private key: ");
257 BN_print(out, EC_KEY_get0_private_key(b));
258 BIO_printf(out, "\n");
259 BIO_printf(out, "public key (x,y): ");
260 BN_print(out, x_b);
261 BIO_printf(out, ",");
262 BN_print(out, y_b);
263 BIO_printf(out, "\n");
264 BIO_printf(out, "generated key a: ");
265 for (i=0; i<bout; i++)
266 {
267 sprintf(buf, "%02X", bbuf[i]);
268 BIO_puts(out, buf);
269 }
270 BIO_printf(out, "\n");
271 BIO_printf(out, "generated key b: ");
272 for (i=0; i<aout; i++)
273 {
274 sprintf(buf, "%02X", abuf[i]);
275 BIO_puts(out,buf);
276 }
277 BIO_printf(out, "\n");
278#endif
279 fprintf(stderr,"Error in ECDH routines\n");
280 ret=0;
281 }
282 else
283 {
284#ifndef NOISY
285 BIO_printf(out, " ok\n");
286#endif
287 ret=1;
288 }
289err:
290 ERR_print_errors_fp(stderr);
291
292 if (abuf != NULL) OPENSSL_free(abuf);
293 if (bbuf != NULL) OPENSSL_free(bbuf);
294 if (x_a) BN_free(x_a);
295 if (y_a) BN_free(y_a);
296 if (x_b) BN_free(x_b);
297 if (y_b) BN_free(y_b);
298 if (b) EC_KEY_free(b);
299 if (a) EC_KEY_free(a);
300 return(ret);
301 }
302
303int main(int argc, char *argv[])
304 {
305 BN_CTX *ctx=NULL;
306 int ret=1;
307 BIO *out;
308
309 CRYPTO_malloc_debug_init();
310 CRYPTO_dbg_set_options(V_CRYPTO_MDEBUG_ALL);
311 CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON);
312
313#ifdef OPENSSL_SYS_WIN32
314 CRYPTO_malloc_init();
315#endif
316
317 RAND_seed(rnd_seed, sizeof rnd_seed);
318
319 out=BIO_new(BIO_s_file());
320 if (out == NULL) EXIT(1);
321 BIO_set_fp(out,stdout,BIO_NOCLOSE);
322
323 if ((ctx=BN_CTX_new()) == NULL) goto err;
324
325 /* NIST PRIME CURVES TESTS */
326 if (!test_ecdh_curve(NID_X9_62_prime192v1, "NIST Prime-Curve P-192", ctx, out)) goto err;
327 if (!test_ecdh_curve(NID_secp224r1, "NIST Prime-Curve P-224", ctx, out)) goto err;
328 if (!test_ecdh_curve(NID_X9_62_prime256v1, "NIST Prime-Curve P-256", ctx, out)) goto err;
329 if (!test_ecdh_curve(NID_secp384r1, "NIST Prime-Curve P-384", ctx, out)) goto err;
330 if (!test_ecdh_curve(NID_secp521r1, "NIST Prime-Curve P-521", ctx, out)) goto err;
331#ifndef OPENSSL_NO_EC2M
332 /* NIST BINARY CURVES TESTS */
333 if (!test_ecdh_curve(NID_sect163k1, "NIST Binary-Curve K-163", ctx, out)) goto err;
334 if (!test_ecdh_curve(NID_sect163r2, "NIST Binary-Curve B-163", ctx, out)) goto err;
335 if (!test_ecdh_curve(NID_sect233k1, "NIST Binary-Curve K-233", ctx, out)) goto err;
336 if (!test_ecdh_curve(NID_sect233r1, "NIST Binary-Curve B-233", ctx, out)) goto err;
337 if (!test_ecdh_curve(NID_sect283k1, "NIST Binary-Curve K-283", ctx, out)) goto err;
338 if (!test_ecdh_curve(NID_sect283r1, "NIST Binary-Curve B-283", ctx, out)) goto err;
339 if (!test_ecdh_curve(NID_sect409k1, "NIST Binary-Curve K-409", ctx, out)) goto err;
340 if (!test_ecdh_curve(NID_sect409r1, "NIST Binary-Curve B-409", ctx, out)) goto err;
341 if (!test_ecdh_curve(NID_sect571k1, "NIST Binary-Curve K-571", ctx, out)) goto err;
342 if (!test_ecdh_curve(NID_sect571r1, "NIST Binary-Curve B-571", ctx, out)) goto err;
343#endif
344
345 ret = 0;
346
347err:
348 ERR_print_errors_fp(stderr);
349 if (ctx) BN_CTX_free(ctx);
350 BIO_free(out);
351 CRYPTO_cleanup_all_ex_data();
352 ERR_remove_thread_state(NULL);
353 CRYPTO_mem_leaks_fp(stderr);
354 EXIT(ret);
355 return(ret);
356 }
357
358#if 0
359static void MS_CALLBACK cb(int p, int n, void *arg)
360 {
361 char c='*';
362
363 if (p == 0) c='.';
364 if (p == 1) c='+';
365 if (p == 2) c='*';
366 if (p == 3) c='\n';
367 BIO_write((BIO *)arg,&c,1);
368 (void)BIO_flush((BIO *)arg);
369#ifdef LINT
370 p=n;
371#endif
372 }
373#endif
374#endif
diff --git a/src/lib/libcrypto/ecdh/ech_ossl.c b/src/lib/libcrypto/ecdh/ech_ossl.c
new file mode 100644
index 0000000000..4a30628fbc
--- /dev/null
+++ b/src/lib/libcrypto/ecdh/ech_ossl.c
@@ -0,0 +1,215 @@
1/* crypto/ecdh/ech_ossl.c */
2/* ====================================================================
3 * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED.
4 *
5 * The Elliptic Curve Public-Key Crypto Library (ECC Code) included
6 * herein is developed by SUN MICROSYSTEMS, INC., and is contributed
7 * to the OpenSSL project.
8 *
9 * The ECC Code is licensed pursuant to the OpenSSL open source
10 * license provided below.
11 *
12 * The ECDH software is originally written by Douglas Stebila of
13 * Sun Microsystems Laboratories.
14 *
15 */
16/* ====================================================================
17 * Copyright (c) 1998-2003 The OpenSSL Project. All rights reserved.
18 *
19 * Redistribution and use in source and binary forms, with or without
20 * modification, are permitted provided that the following conditions
21 * are met:
22 *
23 * 1. Redistributions of source code must retain the above copyright
24 * notice, this list of conditions and the following disclaimer.
25 *
26 * 2. Redistributions in binary form must reproduce the above copyright
27 * notice, this list of conditions and the following disclaimer in
28 * the documentation and/or other materials provided with the
29 * distribution.
30 *
31 * 3. All advertising materials mentioning features or use of this
32 * software must display the following acknowledgment:
33 * "This product includes software developed by the OpenSSL Project
34 * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
35 *
36 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
37 * endorse or promote products derived from this software without
38 * prior written permission. For written permission, please contact
39 * openssl-core@OpenSSL.org.
40 *
41 * 5. Products derived from this software may not be called "OpenSSL"
42 * nor may "OpenSSL" appear in their names without prior written
43 * permission of the OpenSSL Project.
44 *
45 * 6. Redistributions of any form whatsoever must retain the following
46 * acknowledgment:
47 * "This product includes software developed by the OpenSSL Project
48 * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
49 *
50 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
51 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
52 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
53 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
54 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
55 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
56 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
57 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
58 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
59 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
60 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
61 * OF THE POSSIBILITY OF SUCH DAMAGE.
62 * ====================================================================
63 *
64 * This product includes cryptographic software written by Eric Young
65 * (eay@cryptsoft.com). This product includes software written by Tim
66 * Hudson (tjh@cryptsoft.com).
67 *
68 */
69
70
71#include <string.h>
72#include <limits.h>
73
74#include "cryptlib.h"
75
76#include "ech_locl.h"
77#include <openssl/err.h>
78#include <openssl/sha.h>
79#include <openssl/obj_mac.h>
80#include <openssl/bn.h>
81
82static int ecdh_compute_key(void *out, size_t len, const EC_POINT *pub_key,
83 EC_KEY *ecdh,
84 void *(*KDF)(const void *in, size_t inlen, void *out, size_t *outlen));
85
86static ECDH_METHOD openssl_ecdh_meth = {
87 "OpenSSL ECDH method",
88 ecdh_compute_key,
89#if 0
90 NULL, /* init */
91 NULL, /* finish */
92#endif
93 0, /* flags */
94 NULL /* app_data */
95};
96
97const ECDH_METHOD *ECDH_OpenSSL(void)
98 {
99 return &openssl_ecdh_meth;
100 }
101
102
103/* This implementation is based on the following primitives in the IEEE 1363 standard:
104 * - ECKAS-DH1
105 * - ECSVDP-DH
106 * Finally an optional KDF is applied.
107 */
108static int ecdh_compute_key(void *out, size_t outlen, const EC_POINT *pub_key,
109 EC_KEY *ecdh,
110 void *(*KDF)(const void *in, size_t inlen, void *out, size_t *outlen))
111 {
112 BN_CTX *ctx;
113 EC_POINT *tmp=NULL;
114 BIGNUM *x=NULL, *y=NULL;
115 const BIGNUM *priv_key;
116 const EC_GROUP* group;
117 int ret= -1;
118 size_t buflen, len;
119 unsigned char *buf=NULL;
120
121 if (outlen > INT_MAX)
122 {
123 ECDHerr(ECDH_F_ECDH_COMPUTE_KEY,ERR_R_MALLOC_FAILURE); /* sort of, anyway */
124 return -1;
125 }
126
127 if ((ctx = BN_CTX_new()) == NULL) goto err;
128 BN_CTX_start(ctx);
129 x = BN_CTX_get(ctx);
130 y = BN_CTX_get(ctx);
131
132 priv_key = EC_KEY_get0_private_key(ecdh);
133 if (priv_key == NULL)
134 {
135 ECDHerr(ECDH_F_ECDH_COMPUTE_KEY,ECDH_R_NO_PRIVATE_VALUE);
136 goto err;
137 }
138
139 group = EC_KEY_get0_group(ecdh);
140 if ((tmp=EC_POINT_new(group)) == NULL)
141 {
142 ECDHerr(ECDH_F_ECDH_COMPUTE_KEY,ERR_R_MALLOC_FAILURE);
143 goto err;
144 }
145
146 if (!EC_POINT_mul(group, tmp, NULL, pub_key, priv_key, ctx))
147 {
148 ECDHerr(ECDH_F_ECDH_COMPUTE_KEY,ECDH_R_POINT_ARITHMETIC_FAILURE);
149 goto err;
150 }
151
152 if (EC_METHOD_get_field_type(EC_GROUP_method_of(group)) == NID_X9_62_prime_field)
153 {
154 if (!EC_POINT_get_affine_coordinates_GFp(group, tmp, x, y, ctx))
155 {
156 ECDHerr(ECDH_F_ECDH_COMPUTE_KEY,ECDH_R_POINT_ARITHMETIC_FAILURE);
157 goto err;
158 }
159 }
160#ifndef OPENSSL_NO_EC2M
161 else
162 {
163 if (!EC_POINT_get_affine_coordinates_GF2m(group, tmp, x, y, ctx))
164 {
165 ECDHerr(ECDH_F_ECDH_COMPUTE_KEY,ECDH_R_POINT_ARITHMETIC_FAILURE);
166 goto err;
167 }
168 }
169#endif
170
171 buflen = (EC_GROUP_get_degree(group) + 7)/8;
172 len = BN_num_bytes(x);
173 if (len > buflen)
174 {
175 ECDHerr(ECDH_F_ECDH_COMPUTE_KEY,ERR_R_INTERNAL_ERROR);
176 goto err;
177 }
178 if ((buf = OPENSSL_malloc(buflen)) == NULL)
179 {
180 ECDHerr(ECDH_F_ECDH_COMPUTE_KEY,ERR_R_MALLOC_FAILURE);
181 goto err;
182 }
183
184 memset(buf, 0, buflen - len);
185 if (len != (size_t)BN_bn2bin(x, buf + buflen - len))
186 {
187 ECDHerr(ECDH_F_ECDH_COMPUTE_KEY,ERR_R_BN_LIB);
188 goto err;
189 }
190
191 if (KDF != 0)
192 {
193 if (KDF(buf, buflen, out, &outlen) == NULL)
194 {
195 ECDHerr(ECDH_F_ECDH_COMPUTE_KEY,ECDH_R_KDF_FAILED);
196 goto err;
197 }
198 ret = outlen;
199 }
200 else
201 {
202 /* no KDF, just copy as much as we can */
203 if (outlen > buflen)
204 outlen = buflen;
205 memcpy(out, buf, outlen);
206 ret = outlen;
207 }
208
209err:
210 if (tmp) EC_POINT_free(tmp);
211 if (ctx) BN_CTX_end(ctx);
212 if (ctx) BN_CTX_free(ctx);
213 if (buf) OPENSSL_free(buf);
214 return(ret);
215 }
diff --git a/src/lib/libcrypto/ecdsa/Makefile b/src/lib/libcrypto/ecdsa/Makefile
new file mode 100644
index 0000000000..e89e0c010c
--- /dev/null
+++ b/src/lib/libcrypto/ecdsa/Makefile
@@ -0,0 +1,140 @@
1#
2# crypto/ecdsa/Makefile
3#
4
5DIR= ecdsa
6TOP= ../..
7CC= cc
8INCLUDES= -I.. -I$(TOP) -I../../include
9CFLAG=-g -Wall
10MAKEFILE= Makefile
11AR= ar r
12
13CFLAGS= $(INCLUDES) $(CFLAG)
14
15GENERAL=Makefile
16TEST=ecdsatest.c
17APPS=
18
19LIB=$(TOP)/libcrypto.a
20LIBSRC= ecs_lib.c ecs_asn1.c ecs_ossl.c ecs_sign.c ecs_vrf.c ecs_err.c
21
22LIBOBJ= ecs_lib.o ecs_asn1.o ecs_ossl.o ecs_sign.o ecs_vrf.o ecs_err.o
23
24SRC= $(LIBSRC)
25
26EXHEADER= ecdsa.h
27HEADER= ecs_locl.h $(EXHEADER)
28
29ALL= $(GENERAL) $(SRC) $(HEADER)
30
31top:
32 (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all)
33
34all: lib
35
36lib: $(LIBOBJ)
37 $(AR) $(LIB) $(LIBOBJ)
38 $(RANLIB) $(LIB) || echo Never mind.
39 @touch lib
40
41files:
42 $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
43
44links:
45 @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
46 @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
47 @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
48
49install:
50 @[ -n "$(INSTALLTOP)" ] # should be set by top Makefile...
51 @headerlist="$(EXHEADER)"; for i in $$headerlist; \
52 do \
53 (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
54 chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
55 done;
56
57tags:
58 ctags $(SRC)
59
60tests:
61
62lint:
63 lint -DLINT $(INCLUDES) $(SRC)>fluff
64
65depend:
66 @[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile...
67 $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
68
69dclean:
70 $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
71 mv -f Makefile.new $(MAKEFILE)
72
73clean:
74 rm -f *.o */*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
75
76# DO NOT DELETE THIS LINE -- make depend depends on it.
77
78ecs_asn1.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h
79ecs_asn1.o: ../../include/openssl/bio.h ../../include/openssl/crypto.h
80ecs_asn1.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
81ecs_asn1.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
82ecs_asn1.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
83ecs_asn1.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
84ecs_asn1.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
85ecs_asn1.o: ../../include/openssl/symhacks.h ecs_asn1.c ecs_locl.h
86ecs_err.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
87ecs_err.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
88ecs_err.o: ../../include/openssl/ec.h ../../include/openssl/ecdsa.h
89ecs_err.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
90ecs_err.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
91ecs_err.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
92ecs_err.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
93ecs_err.o: ecs_err.c
94ecs_lib.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
95ecs_lib.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
96ecs_lib.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
97ecs_lib.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
98ecs_lib.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h
99ecs_lib.o: ../../include/openssl/err.h ../../include/openssl/evp.h
100ecs_lib.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
101ecs_lib.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
102ecs_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
103ecs_lib.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
104ecs_lib.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
105ecs_lib.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
106ecs_lib.o: ../../include/openssl/x509_vfy.h ecs_lib.c ecs_locl.h
107ecs_ossl.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
108ecs_ossl.o: ../../include/openssl/bn.h ../../include/openssl/crypto.h
109ecs_ossl.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
110ecs_ossl.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
111ecs_ossl.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
112ecs_ossl.o: ../../include/openssl/opensslconf.h
113ecs_ossl.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
114ecs_ossl.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
115ecs_ossl.o: ../../include/openssl/symhacks.h ecs_locl.h ecs_ossl.c
116ecs_sign.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
117ecs_sign.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
118ecs_sign.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
119ecs_sign.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
120ecs_sign.o: ../../include/openssl/engine.h ../../include/openssl/evp.h
121ecs_sign.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
122ecs_sign.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
123ecs_sign.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
124ecs_sign.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h
125ecs_sign.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
126ecs_sign.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
127ecs_sign.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
128ecs_sign.o: ecs_locl.h ecs_sign.c
129ecs_vrf.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
130ecs_vrf.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
131ecs_vrf.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
132ecs_vrf.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
133ecs_vrf.o: ../../include/openssl/engine.h ../../include/openssl/evp.h
134ecs_vrf.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
135ecs_vrf.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
136ecs_vrf.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
137ecs_vrf.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
138ecs_vrf.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
139ecs_vrf.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
140ecs_vrf.o: ../../include/openssl/x509_vfy.h ecs_locl.h ecs_vrf.c
diff --git a/src/lib/libcrypto/ecdsa/ecdsatest.c b/src/lib/libcrypto/ecdsa/ecdsatest.c
new file mode 100644
index 0000000000..537bb30362
--- /dev/null
+++ b/src/lib/libcrypto/ecdsa/ecdsatest.c
@@ -0,0 +1,572 @@
1/* crypto/ecdsa/ecdsatest.c */
2/*
3 * Written by Nils Larsch for the OpenSSL project.
4 */
5/* ====================================================================
6 * Copyright (c) 2000-2005 The OpenSSL Project. All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 *
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 *
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in
17 * the documentation and/or other materials provided with the
18 * distribution.
19 *
20 * 3. All advertising materials mentioning features or use of this
21 * software must display the following acknowledgment:
22 * "This product includes software developed by the OpenSSL Project
23 * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
24 *
25 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
26 * endorse or promote products derived from this software without
27 * prior written permission. For written permission, please contact
28 * licensing@OpenSSL.org.
29 *
30 * 5. Products derived from this software may not be called "OpenSSL"
31 * nor may "OpenSSL" appear in their names without prior written
32 * permission of the OpenSSL Project.
33 *
34 * 6. Redistributions of any form whatsoever must retain the following
35 * acknowledgment:
36 * "This product includes software developed by the OpenSSL Project
37 * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
38 *
39 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
40 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
41 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
42 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
43 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
44 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
45 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
46 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
47 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
48 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
49 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50 * OF THE POSSIBILITY OF SUCH DAMAGE.
51 * ====================================================================
52 *
53 * This product includes cryptographic software written by Eric Young
54 * (eay@cryptsoft.com). This product includes software written by Tim
55 * Hudson (tjh@cryptsoft.com).
56 *
57 */
58/* ====================================================================
59 * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED.
60 *
61 * Portions of the attached software ("Contribution") are developed by
62 * SUN MICROSYSTEMS, INC., and are contributed to the OpenSSL project.
63 *
64 * The Contribution is licensed pursuant to the OpenSSL open source
65 * license provided above.
66 *
67 * The elliptic curve binary polynomial software is originally written by
68 * Sheueling Chang Shantz and Douglas Stebila of Sun Microsystems Laboratories.
69 *
70 */
71
72#include <stdio.h>
73#include <stdlib.h>
74#include <string.h>
75
76#include <openssl/opensslconf.h> /* To see if OPENSSL_NO_ECDSA is defined */
77
78#ifdef OPENSSL_NO_ECDSA
79int main(int argc, char * argv[])
80 {
81 puts("Elliptic curves are disabled.");
82 return 0;
83 }
84#else
85
86#include <openssl/crypto.h>
87#include <openssl/bio.h>
88#include <openssl/evp.h>
89#include <openssl/bn.h>
90#include <openssl/ecdsa.h>
91#ifndef OPENSSL_NO_ENGINE
92#include <openssl/engine.h>
93#endif
94#include <openssl/err.h>
95#include <openssl/rand.h>
96
97static const char rnd_seed[] = "string to make the random number generator "
98 "think it has entropy";
99
100/* declaration of the test functions */
101int x9_62_tests(BIO *);
102int x9_62_test_internal(BIO *out, int nid, const char *r, const char *s);
103int test_builtin(BIO *);
104
105/* functions to change the RAND_METHOD */
106int change_rand(void);
107int restore_rand(void);
108int fbytes(unsigned char *buf, int num);
109
110RAND_METHOD fake_rand;
111const RAND_METHOD *old_rand;
112
113int change_rand(void)
114 {
115 /* save old rand method */
116 if ((old_rand = RAND_get_rand_method()) == NULL)
117 return 0;
118
119 fake_rand.seed = old_rand->seed;
120 fake_rand.cleanup = old_rand->cleanup;
121 fake_rand.add = old_rand->add;
122 fake_rand.status = old_rand->status;
123 /* use own random function */
124 fake_rand.bytes = fbytes;
125 fake_rand.pseudorand = old_rand->bytes;
126 /* set new RAND_METHOD */
127 if (!RAND_set_rand_method(&fake_rand))
128 return 0;
129 return 1;
130 }
131
132int restore_rand(void)
133 {
134 if (!RAND_set_rand_method(old_rand))
135 return 0;
136 else
137 return 1;
138 }
139
140static int fbytes_counter = 0;
141static const char *numbers[8] = {
142 "651056770906015076056810763456358567190100156695615665659",
143 "6140507067065001063065065565667405560006161556565665656654",
144 "8763001015071075675010661307616710783570106710677817767166"
145 "71676178726717",
146 "7000000175690566466555057817571571075705015757757057795755"
147 "55657156756655",
148 "1275552191113212300012030439187146164646146646466749494799",
149 "1542725565216523985789236956265265265235675811949404040041",
150 "1456427555219115346513212300075341203043918714616464614664"
151 "64667494947990",
152 "1712787255652165239672857892369562652652652356758119494040"
153 "40041670216363"};
154
155int fbytes(unsigned char *buf, int num)
156 {
157 int ret;
158 BIGNUM *tmp = NULL;
159
160 if (fbytes_counter >= 8)
161 return 0;
162 tmp = BN_new();
163 if (!tmp)
164 return 0;
165 if (!BN_dec2bn(&tmp, numbers[fbytes_counter]))
166 {
167 BN_free(tmp);
168 return 0;
169 }
170 fbytes_counter ++;
171 if (num != BN_num_bytes(tmp) || !BN_bn2bin(tmp, buf))
172 ret = 0;
173 else
174 ret = 1;
175 if (tmp)
176 BN_free(tmp);
177 return ret;
178 }
179
180/* some tests from the X9.62 draft */
181int x9_62_test_internal(BIO *out, int nid, const char *r_in, const char *s_in)
182 {
183 int ret = 0;
184 const char message[] = "abc";
185 unsigned char digest[20];
186 unsigned int dgst_len = 0;
187 EVP_MD_CTX md_ctx;
188 EC_KEY *key = NULL;
189 ECDSA_SIG *signature = NULL;
190 BIGNUM *r = NULL, *s = NULL;
191
192 EVP_MD_CTX_init(&md_ctx);
193 /* get the message digest */
194 EVP_DigestInit(&md_ctx, EVP_ecdsa());
195 EVP_DigestUpdate(&md_ctx, (const void*)message, 3);
196 EVP_DigestFinal(&md_ctx, digest, &dgst_len);
197
198 BIO_printf(out, "testing %s: ", OBJ_nid2sn(nid));
199 /* create the key */
200 if ((key = EC_KEY_new_by_curve_name(nid)) == NULL)
201 goto x962_int_err;
202 if (!EC_KEY_generate_key(key))
203 goto x962_int_err;
204 BIO_printf(out, ".");
205 (void)BIO_flush(out);
206 /* create the signature */
207 signature = ECDSA_do_sign(digest, 20, key);
208 if (signature == NULL)
209 goto x962_int_err;
210 BIO_printf(out, ".");
211 (void)BIO_flush(out);
212 /* compare the created signature with the expected signature */
213 if ((r = BN_new()) == NULL || (s = BN_new()) == NULL)
214 goto x962_int_err;
215 if (!BN_dec2bn(&r, r_in) ||
216 !BN_dec2bn(&s, s_in))
217 goto x962_int_err;
218 if (BN_cmp(signature->r ,r) || BN_cmp(signature->s, s))
219 goto x962_int_err;
220 BIO_printf(out, ".");
221 (void)BIO_flush(out);
222 /* verify the signature */
223 if (ECDSA_do_verify(digest, 20, signature, key) != 1)
224 goto x962_int_err;
225 BIO_printf(out, ".");
226 (void)BIO_flush(out);
227
228 BIO_printf(out, " ok\n");
229 ret = 1;
230x962_int_err:
231 if (!ret)
232 BIO_printf(out, " failed\n");
233 if (key)
234 EC_KEY_free(key);
235 if (signature)
236 ECDSA_SIG_free(signature);
237 if (r)
238 BN_free(r);
239 if (s)
240 BN_free(s);
241 EVP_MD_CTX_cleanup(&md_ctx);
242 return ret;
243 }
244
245int x9_62_tests(BIO *out)
246 {
247 int ret = 0;
248
249 BIO_printf(out, "some tests from X9.62:\n");
250
251 /* set own rand method */
252 if (!change_rand())
253 goto x962_err;
254
255 if (!x9_62_test_internal(out, NID_X9_62_prime192v1,
256 "3342403536405981729393488334694600415596881826869351677613",
257 "5735822328888155254683894997897571951568553642892029982342"))
258 goto x962_err;
259 if (!x9_62_test_internal(out, NID_X9_62_prime239v1,
260 "3086361431751678114926225473006680188549593787585317781474"
261 "62058306432176",
262 "3238135532097973577080787768312505059318910517550078427819"
263 "78505179448783"))
264 goto x962_err;
265#ifndef OPENSSL_NO_EC2M
266 if (!x9_62_test_internal(out, NID_X9_62_c2tnb191v1,
267 "87194383164871543355722284926904419997237591535066528048",
268 "308992691965804947361541664549085895292153777025772063598"))
269 goto x962_err;
270 if (!x9_62_test_internal(out, NID_X9_62_c2tnb239v1,
271 "2159633321041961198501834003903461262881815148684178964245"
272 "5876922391552",
273 "1970303740007316867383349976549972270528498040721988191026"
274 "49413465737174"))
275 goto x962_err;
276#endif
277 ret = 1;
278x962_err:
279 if (!restore_rand())
280 ret = 0;
281 return ret;
282 }
283
284int test_builtin(BIO *out)
285 {
286 EC_builtin_curve *curves = NULL;
287 size_t crv_len = 0, n = 0;
288 EC_KEY *eckey = NULL, *wrong_eckey = NULL;
289 EC_GROUP *group;
290 ECDSA_SIG *ecdsa_sig = NULL;
291 unsigned char digest[20], wrong_digest[20];
292 unsigned char *signature = NULL;
293 const unsigned char *sig_ptr;
294 unsigned char *sig_ptr2;
295 unsigned char *raw_buf = NULL;
296 unsigned int sig_len, degree, r_len, s_len, bn_len, buf_len;
297 int nid, ret = 0;
298
299 /* fill digest values with some random data */
300 if (!RAND_pseudo_bytes(digest, 20) ||
301 !RAND_pseudo_bytes(wrong_digest, 20))
302 {
303 BIO_printf(out, "ERROR: unable to get random data\n");
304 goto builtin_err;
305 }
306
307 /* create and verify a ecdsa signature with every availble curve
308 * (with ) */
309 BIO_printf(out, "\ntesting ECDSA_sign() and ECDSA_verify() "
310 "with some internal curves:\n");
311
312 /* get a list of all internal curves */
313 crv_len = EC_get_builtin_curves(NULL, 0);
314
315 curves = OPENSSL_malloc(sizeof(EC_builtin_curve) * crv_len);
316
317 if (curves == NULL)
318 {
319 BIO_printf(out, "malloc error\n");
320 goto builtin_err;
321 }
322
323 if (!EC_get_builtin_curves(curves, crv_len))
324 {
325 BIO_printf(out, "unable to get internal curves\n");
326 goto builtin_err;
327 }
328
329 /* now create and verify a signature for every curve */
330 for (n = 0; n < crv_len; n++)
331 {
332 unsigned char dirt, offset;
333
334 nid = curves[n].nid;
335 if (nid == NID_ipsec4)
336 continue;
337 /* create new ecdsa key (== EC_KEY) */
338 if ((eckey = EC_KEY_new()) == NULL)
339 goto builtin_err;
340 group = EC_GROUP_new_by_curve_name(nid);
341 if (group == NULL)
342 goto builtin_err;
343 if (EC_KEY_set_group(eckey, group) == 0)
344 goto builtin_err;
345 EC_GROUP_free(group);
346 degree = EC_GROUP_get_degree(EC_KEY_get0_group(eckey));
347 if (degree < 160)
348 /* drop the curve */
349 {
350 EC_KEY_free(eckey);
351 eckey = NULL;
352 continue;
353 }
354 BIO_printf(out, "%s: ", OBJ_nid2sn(nid));
355 /* create key */
356 if (!EC_KEY_generate_key(eckey))
357 {
358 BIO_printf(out, " failed\n");
359 goto builtin_err;
360 }
361 /* create second key */
362 if ((wrong_eckey = EC_KEY_new()) == NULL)
363 goto builtin_err;
364 group = EC_GROUP_new_by_curve_name(nid);
365 if (group == NULL)
366 goto builtin_err;
367 if (EC_KEY_set_group(wrong_eckey, group) == 0)
368 goto builtin_err;
369 EC_GROUP_free(group);
370 if (!EC_KEY_generate_key(wrong_eckey))
371 {
372 BIO_printf(out, " failed\n");
373 goto builtin_err;
374 }
375
376 BIO_printf(out, ".");
377 (void)BIO_flush(out);
378 /* check key */
379 if (!EC_KEY_check_key(eckey))
380 {
381 BIO_printf(out, " failed\n");
382 goto builtin_err;
383 }
384 BIO_printf(out, ".");
385 (void)BIO_flush(out);
386 /* create signature */
387 sig_len = ECDSA_size(eckey);
388 if ((signature = OPENSSL_malloc(sig_len)) == NULL)
389 goto builtin_err;
390 if (!ECDSA_sign(0, digest, 20, signature, &sig_len, eckey))
391 {
392 BIO_printf(out, " failed\n");
393 goto builtin_err;
394 }
395 BIO_printf(out, ".");
396 (void)BIO_flush(out);
397 /* verify signature */
398 if (ECDSA_verify(0, digest, 20, signature, sig_len, eckey) != 1)
399 {
400 BIO_printf(out, " failed\n");
401 goto builtin_err;
402 }
403 BIO_printf(out, ".");
404 (void)BIO_flush(out);
405 /* verify signature with the wrong key */
406 if (ECDSA_verify(0, digest, 20, signature, sig_len,
407 wrong_eckey) == 1)
408 {
409 BIO_printf(out, " failed\n");
410 goto builtin_err;
411 }
412 BIO_printf(out, ".");
413 (void)BIO_flush(out);
414 /* wrong digest */
415 if (ECDSA_verify(0, wrong_digest, 20, signature, sig_len,
416 eckey) == 1)
417 {
418 BIO_printf(out, " failed\n");
419 goto builtin_err;
420 }
421 BIO_printf(out, ".");
422 (void)BIO_flush(out);
423 /* wrong length */
424 if (ECDSA_verify(0, digest, 20, signature, sig_len - 1,
425 eckey) == 1)
426 {
427 BIO_printf(out, " failed\n");
428 goto builtin_err;
429 }
430 BIO_printf(out, ".");
431 (void)BIO_flush(out);
432
433 /* Modify a single byte of the signature: to ensure we don't
434 * garble the ASN1 structure, we read the raw signature and
435 * modify a byte in one of the bignums directly. */
436 sig_ptr = signature;
437 if ((ecdsa_sig = d2i_ECDSA_SIG(NULL, &sig_ptr, sig_len)) == NULL)
438 {
439 BIO_printf(out, " failed\n");
440 goto builtin_err;
441 }
442
443 /* Store the two BIGNUMs in raw_buf. */
444 r_len = BN_num_bytes(ecdsa_sig->r);
445 s_len = BN_num_bytes(ecdsa_sig->s);
446 bn_len = (degree + 7) / 8;
447 if ((r_len > bn_len) || (s_len > bn_len))
448 {
449 BIO_printf(out, " failed\n");
450 goto builtin_err;
451 }
452 buf_len = 2 * bn_len;
453 if ((raw_buf = OPENSSL_malloc(buf_len)) == NULL)
454 goto builtin_err;
455 /* Pad the bignums with leading zeroes. */
456 memset(raw_buf, 0, buf_len);
457 BN_bn2bin(ecdsa_sig->r, raw_buf + bn_len - r_len);
458 BN_bn2bin(ecdsa_sig->s, raw_buf + buf_len - s_len);
459
460 /* Modify a single byte in the buffer. */
461 offset = raw_buf[10] % buf_len;
462 dirt = raw_buf[11] ? raw_buf[11] : 1;
463 raw_buf[offset] ^= dirt;
464 /* Now read the BIGNUMs back in from raw_buf. */
465 if ((BN_bin2bn(raw_buf, bn_len, ecdsa_sig->r) == NULL) ||
466 (BN_bin2bn(raw_buf + bn_len, bn_len, ecdsa_sig->s) == NULL))
467 goto builtin_err;
468
469 sig_ptr2 = signature;
470 sig_len = i2d_ECDSA_SIG(ecdsa_sig, &sig_ptr2);
471 if (ECDSA_verify(0, digest, 20, signature, sig_len, eckey) == 1)
472 {
473 BIO_printf(out, " failed\n");
474 goto builtin_err;
475 }
476 /* Sanity check: undo the modification and verify signature. */
477 raw_buf[offset] ^= dirt;
478 if ((BN_bin2bn(raw_buf, bn_len, ecdsa_sig->r) == NULL) ||
479 (BN_bin2bn(raw_buf + bn_len, bn_len, ecdsa_sig->s) == NULL))
480 goto builtin_err;
481
482 sig_ptr2 = signature;
483 sig_len = i2d_ECDSA_SIG(ecdsa_sig, &sig_ptr2);
484 if (ECDSA_verify(0, digest, 20, signature, sig_len, eckey) != 1)
485 {
486 BIO_printf(out, " failed\n");
487 goto builtin_err;
488 }
489 BIO_printf(out, ".");
490 (void)BIO_flush(out);
491
492 BIO_printf(out, " ok\n");
493 /* cleanup */
494 /* clean bogus errors */
495 ERR_clear_error();
496 OPENSSL_free(signature);
497 signature = NULL;
498 EC_KEY_free(eckey);
499 eckey = NULL;
500 EC_KEY_free(wrong_eckey);
501 wrong_eckey = NULL;
502 ECDSA_SIG_free(ecdsa_sig);
503 ecdsa_sig = NULL;
504 OPENSSL_free(raw_buf);
505 raw_buf = NULL;
506 }
507
508 ret = 1;
509builtin_err:
510 if (eckey)
511 EC_KEY_free(eckey);
512 if (wrong_eckey)
513 EC_KEY_free(wrong_eckey);
514 if (ecdsa_sig)
515 ECDSA_SIG_free(ecdsa_sig);
516 if (signature)
517 OPENSSL_free(signature);
518 if (raw_buf)
519 OPENSSL_free(raw_buf);
520 if (curves)
521 OPENSSL_free(curves);
522
523 return ret;
524 }
525
526int main(void)
527 {
528 int ret = 1;
529 BIO *out;
530
531 out = BIO_new_fp(stdout, BIO_NOCLOSE);
532
533 /* enable memory leak checking unless explicitly disabled */
534 if (!((getenv("OPENSSL_DEBUG_MEMORY") != NULL) &&
535 (0 == strcmp(getenv("OPENSSL_DEBUG_MEMORY"), "off"))))
536 {
537 CRYPTO_malloc_debug_init();
538 CRYPTO_set_mem_debug_options(V_CRYPTO_MDEBUG_ALL);
539 }
540 else
541 {
542 /* OPENSSL_DEBUG_MEMORY=off */
543 CRYPTO_set_mem_debug_functions(0, 0, 0, 0, 0);
544 }
545 CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON);
546
547 ERR_load_crypto_strings();
548
549 /* initialize the prng */
550 RAND_seed(rnd_seed, sizeof(rnd_seed));
551
552 /* the tests */
553 if (!x9_62_tests(out)) goto err;
554 if (!test_builtin(out)) goto err;
555
556 ret = 0;
557err:
558 if (ret)
559 BIO_printf(out, "\nECDSA test failed\n");
560 else
561 BIO_printf(out, "\nECDSA test passed\n");
562 if (ret)
563 ERR_print_errors(out);
564 CRYPTO_cleanup_all_ex_data();
565 ERR_remove_thread_state(NULL);
566 ERR_free_strings();
567 CRYPTO_mem_leaks(out);
568 if (out != NULL)
569 BIO_free(out);
570 return ret;
571 }
572#endif
diff --git a/src/lib/libcrypto/engine/Makefile b/src/lib/libcrypto/engine/Makefile
new file mode 100644
index 0000000000..d29bdd09a0
--- /dev/null
+++ b/src/lib/libcrypto/engine/Makefile
@@ -0,0 +1,447 @@
1#
2# OpenSSL/crypto/engine/Makefile
3#
4
5DIR= engine
6TOP= ../..
7CC= cc
8INCLUDES= -I.. -I$(TOP) -I../../include
9CFLAG=-g
10MAKEFILE= Makefile
11AR= ar r
12
13CFLAGS= $(INCLUDES) $(CFLAG)
14
15GENERAL=Makefile
16TEST= enginetest.c
17APPS=
18
19LIB=$(TOP)/libcrypto.a
20LIBSRC= eng_err.c eng_lib.c eng_list.c eng_init.c eng_ctrl.c \
21 eng_table.c eng_pkey.c eng_fat.c eng_all.c \
22 tb_rsa.c tb_dsa.c tb_ecdsa.c tb_dh.c tb_ecdh.c tb_rand.c tb_store.c \
23 tb_cipher.c tb_digest.c tb_pkmeth.c tb_asnmth.c \
24 eng_openssl.c eng_cnf.c eng_dyn.c eng_cryptodev.c \
25 eng_rsax.c eng_rdrand.c
26LIBOBJ= eng_err.o eng_lib.o eng_list.o eng_init.o eng_ctrl.o \
27 eng_table.o eng_pkey.o eng_fat.o eng_all.o \
28 tb_rsa.o tb_dsa.o tb_ecdsa.o tb_dh.o tb_ecdh.o tb_rand.o tb_store.o \
29 tb_cipher.o tb_digest.o tb_pkmeth.o tb_asnmth.o \
30 eng_openssl.o eng_cnf.o eng_dyn.o eng_cryptodev.o \
31 eng_rsax.o eng_rdrand.o
32
33SRC= $(LIBSRC)
34
35EXHEADER= engine.h
36HEADER= $(EXHEADER)
37
38ALL= $(GENERAL) $(SRC) $(HEADER)
39
40top:
41 (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all)
42
43all: lib
44
45lib: $(LIBOBJ)
46 $(AR) $(LIB) $(LIBOBJ)
47 $(RANLIB) $(LIB) || echo Never mind.
48 @touch lib
49
50files:
51 $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
52
53links:
54 @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
55 @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
56 @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
57
58install:
59 @[ -n "$(INSTALLTOP)" ] # should be set by top Makefile...
60 @headerlist="$(EXHEADER)"; for i in $$headerlist ; \
61 do \
62 (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
63 chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
64 done;
65
66tags:
67 ctags $(SRC)
68
69tests:
70
71lint:
72 lint -DLINT $(INCLUDES) $(SRC)>fluff
73
74depend:
75 @[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile...
76 $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
77
78dclean:
79 $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
80 mv -f Makefile.new $(MAKEFILE)
81
82clean:
83 rm -f *.o */*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
84
85# DO NOT DELETE THIS LINE -- make depend depends on it.
86
87eng_all.o: ../../e_os.h ../../include/openssl/asn1.h
88eng_all.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
89eng_all.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
90eng_all.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
91eng_all.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h
92eng_all.o: ../../include/openssl/err.h ../../include/openssl/evp.h
93eng_all.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
94eng_all.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
95eng_all.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
96eng_all.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
97eng_all.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
98eng_all.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
99eng_all.o: ../../include/openssl/x509_vfy.h ../cryptlib.h eng_all.c eng_int.h
100eng_cnf.o: ../../e_os.h ../../include/openssl/asn1.h
101eng_cnf.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
102eng_cnf.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
103eng_cnf.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
104eng_cnf.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
105eng_cnf.o: ../../include/openssl/engine.h ../../include/openssl/err.h
106eng_cnf.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
107eng_cnf.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
108eng_cnf.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
109eng_cnf.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
110eng_cnf.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
111eng_cnf.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
112eng_cnf.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
113eng_cnf.o: ../cryptlib.h eng_cnf.c eng_int.h
114eng_cryptodev.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
115eng_cryptodev.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
116eng_cryptodev.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
117eng_cryptodev.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
118eng_cryptodev.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h
119eng_cryptodev.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
120eng_cryptodev.o: ../../include/openssl/obj_mac.h
121eng_cryptodev.o: ../../include/openssl/objects.h
122eng_cryptodev.o: ../../include/openssl/opensslconf.h
123eng_cryptodev.o: ../../include/openssl/opensslv.h
124eng_cryptodev.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
125eng_cryptodev.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
126eng_cryptodev.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
127eng_cryptodev.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
128eng_cryptodev.o: eng_cryptodev.c
129eng_ctrl.o: ../../e_os.h ../../include/openssl/asn1.h
130eng_ctrl.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
131eng_ctrl.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
132eng_ctrl.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
133eng_ctrl.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h
134eng_ctrl.o: ../../include/openssl/err.h ../../include/openssl/evp.h
135eng_ctrl.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
136eng_ctrl.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
137eng_ctrl.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
138eng_ctrl.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
139eng_ctrl.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
140eng_ctrl.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
141eng_ctrl.o: ../../include/openssl/x509_vfy.h ../cryptlib.h eng_ctrl.c eng_int.h
142eng_dyn.o: ../../e_os.h ../../include/openssl/asn1.h
143eng_dyn.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
144eng_dyn.o: ../../include/openssl/crypto.h ../../include/openssl/dso.h
145eng_dyn.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
146eng_dyn.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
147eng_dyn.o: ../../include/openssl/engine.h ../../include/openssl/err.h
148eng_dyn.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
149eng_dyn.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
150eng_dyn.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
151eng_dyn.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
152eng_dyn.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
153eng_dyn.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
154eng_dyn.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
155eng_dyn.o: ../cryptlib.h eng_dyn.c eng_int.h
156eng_err.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
157eng_err.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
158eng_err.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
159eng_err.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
160eng_err.o: ../../include/openssl/engine.h ../../include/openssl/err.h
161eng_err.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
162eng_err.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
163eng_err.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
164eng_err.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
165eng_err.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
166eng_err.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
167eng_err.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
168eng_err.o: eng_err.c
169eng_fat.o: ../../e_os.h ../../include/openssl/asn1.h
170eng_fat.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
171eng_fat.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
172eng_fat.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
173eng_fat.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
174eng_fat.o: ../../include/openssl/engine.h ../../include/openssl/err.h
175eng_fat.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
176eng_fat.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
177eng_fat.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
178eng_fat.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
179eng_fat.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
180eng_fat.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
181eng_fat.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
182eng_fat.o: ../cryptlib.h eng_fat.c eng_int.h
183eng_init.o: ../../e_os.h ../../include/openssl/asn1.h
184eng_init.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
185eng_init.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
186eng_init.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
187eng_init.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h
188eng_init.o: ../../include/openssl/err.h ../../include/openssl/evp.h
189eng_init.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
190eng_init.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
191eng_init.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
192eng_init.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
193eng_init.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
194eng_init.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
195eng_init.o: ../../include/openssl/x509_vfy.h ../cryptlib.h eng_init.c eng_int.h
196eng_lib.o: ../../e_os.h ../../include/openssl/asn1.h
197eng_lib.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
198eng_lib.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
199eng_lib.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
200eng_lib.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h
201eng_lib.o: ../../include/openssl/err.h ../../include/openssl/evp.h
202eng_lib.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
203eng_lib.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
204eng_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
205eng_lib.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h
206eng_lib.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
207eng_lib.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
208eng_lib.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
209eng_lib.o: ../cryptlib.h eng_int.h eng_lib.c
210eng_list.o: ../../e_os.h ../../include/openssl/asn1.h
211eng_list.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
212eng_list.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
213eng_list.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
214eng_list.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h
215eng_list.o: ../../include/openssl/err.h ../../include/openssl/evp.h
216eng_list.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
217eng_list.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
218eng_list.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
219eng_list.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
220eng_list.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
221eng_list.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
222eng_list.o: ../../include/openssl/x509_vfy.h ../cryptlib.h eng_int.h eng_list.c
223eng_openssl.o: ../../e_os.h ../../include/openssl/asn1.h
224eng_openssl.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
225eng_openssl.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
226eng_openssl.o: ../../include/openssl/dsa.h ../../include/openssl/dso.h
227eng_openssl.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
228eng_openssl.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
229eng_openssl.o: ../../include/openssl/engine.h ../../include/openssl/err.h
230eng_openssl.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
231eng_openssl.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
232eng_openssl.o: ../../include/openssl/opensslconf.h
233eng_openssl.o: ../../include/openssl/opensslv.h
234eng_openssl.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pem.h
235eng_openssl.o: ../../include/openssl/pem2.h ../../include/openssl/pkcs7.h
236eng_openssl.o: ../../include/openssl/rand.h ../../include/openssl/rc4.h
237eng_openssl.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
238eng_openssl.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
239eng_openssl.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
240eng_openssl.o: ../../include/openssl/x509_vfy.h ../cryptlib.h eng_openssl.c
241eng_pkey.o: ../../e_os.h ../../include/openssl/asn1.h
242eng_pkey.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
243eng_pkey.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
244eng_pkey.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
245eng_pkey.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h
246eng_pkey.o: ../../include/openssl/err.h ../../include/openssl/evp.h
247eng_pkey.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
248eng_pkey.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
249eng_pkey.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
250eng_pkey.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
251eng_pkey.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
252eng_pkey.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
253eng_pkey.o: ../../include/openssl/x509_vfy.h ../cryptlib.h eng_int.h eng_pkey.c
254eng_rdrand.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
255eng_rdrand.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
256eng_rdrand.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
257eng_rdrand.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
258eng_rdrand.o: ../../include/openssl/engine.h ../../include/openssl/err.h
259eng_rdrand.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
260eng_rdrand.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
261eng_rdrand.o: ../../include/openssl/opensslconf.h
262eng_rdrand.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
263eng_rdrand.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h
264eng_rdrand.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
265eng_rdrand.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
266eng_rdrand.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
267eng_rdrand.o: eng_rdrand.c
268eng_rsax.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
269eng_rsax.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
270eng_rsax.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
271eng_rsax.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
272eng_rsax.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h
273eng_rsax.o: ../../include/openssl/err.h ../../include/openssl/evp.h
274eng_rsax.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
275eng_rsax.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
276eng_rsax.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
277eng_rsax.o: ../../include/openssl/pkcs7.h ../../include/openssl/rsa.h
278eng_rsax.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
279eng_rsax.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
280eng_rsax.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
281eng_rsax.o: eng_rsax.c
282eng_table.o: ../../e_os.h ../../include/openssl/asn1.h
283eng_table.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
284eng_table.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
285eng_table.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
286eng_table.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h
287eng_table.o: ../../include/openssl/err.h ../../include/openssl/evp.h
288eng_table.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
289eng_table.o: ../../include/openssl/objects.h
290eng_table.o: ../../include/openssl/opensslconf.h
291eng_table.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
292eng_table.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
293eng_table.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
294eng_table.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
295eng_table.o: ../../include/openssl/x509_vfy.h ../cryptlib.h eng_int.h
296eng_table.o: eng_table.c
297tb_asnmth.o: ../../e_os.h ../../include/openssl/asn1.h
298tb_asnmth.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
299tb_asnmth.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
300tb_asnmth.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
301tb_asnmth.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h
302tb_asnmth.o: ../../include/openssl/err.h ../../include/openssl/evp.h
303tb_asnmth.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
304tb_asnmth.o: ../../include/openssl/objects.h
305tb_asnmth.o: ../../include/openssl/opensslconf.h
306tb_asnmth.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
307tb_asnmth.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
308tb_asnmth.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
309tb_asnmth.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
310tb_asnmth.o: ../../include/openssl/x509_vfy.h ../asn1/asn1_locl.h ../cryptlib.h
311tb_asnmth.o: eng_int.h tb_asnmth.c
312tb_cipher.o: ../../e_os.h ../../include/openssl/asn1.h
313tb_cipher.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
314tb_cipher.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
315tb_cipher.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
316tb_cipher.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h
317tb_cipher.o: ../../include/openssl/err.h ../../include/openssl/evp.h
318tb_cipher.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
319tb_cipher.o: ../../include/openssl/objects.h
320tb_cipher.o: ../../include/openssl/opensslconf.h
321tb_cipher.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
322tb_cipher.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
323tb_cipher.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
324tb_cipher.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
325tb_cipher.o: ../../include/openssl/x509_vfy.h ../cryptlib.h eng_int.h
326tb_cipher.o: tb_cipher.c
327tb_dh.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
328tb_dh.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
329tb_dh.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
330tb_dh.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
331tb_dh.o: ../../include/openssl/engine.h ../../include/openssl/err.h
332tb_dh.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
333tb_dh.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
334tb_dh.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
335tb_dh.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
336tb_dh.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
337tb_dh.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
338tb_dh.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
339tb_dh.o: ../cryptlib.h eng_int.h tb_dh.c
340tb_digest.o: ../../e_os.h ../../include/openssl/asn1.h
341tb_digest.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
342tb_digest.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
343tb_digest.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
344tb_digest.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h
345tb_digest.o: ../../include/openssl/err.h ../../include/openssl/evp.h
346tb_digest.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
347tb_digest.o: ../../include/openssl/objects.h
348tb_digest.o: ../../include/openssl/opensslconf.h
349tb_digest.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
350tb_digest.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
351tb_digest.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
352tb_digest.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
353tb_digest.o: ../../include/openssl/x509_vfy.h ../cryptlib.h eng_int.h
354tb_digest.o: tb_digest.c
355tb_dsa.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
356tb_dsa.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
357tb_dsa.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
358tb_dsa.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
359tb_dsa.o: ../../include/openssl/engine.h ../../include/openssl/err.h
360tb_dsa.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
361tb_dsa.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
362tb_dsa.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
363tb_dsa.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
364tb_dsa.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
365tb_dsa.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
366tb_dsa.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
367tb_dsa.o: ../cryptlib.h eng_int.h tb_dsa.c
368tb_ecdh.o: ../../e_os.h ../../include/openssl/asn1.h
369tb_ecdh.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
370tb_ecdh.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
371tb_ecdh.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
372tb_ecdh.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h
373tb_ecdh.o: ../../include/openssl/err.h ../../include/openssl/evp.h
374tb_ecdh.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
375tb_ecdh.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
376tb_ecdh.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
377tb_ecdh.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
378tb_ecdh.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
379tb_ecdh.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
380tb_ecdh.o: ../../include/openssl/x509_vfy.h ../cryptlib.h eng_int.h tb_ecdh.c
381tb_ecdsa.o: ../../e_os.h ../../include/openssl/asn1.h
382tb_ecdsa.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
383tb_ecdsa.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
384tb_ecdsa.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
385tb_ecdsa.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h
386tb_ecdsa.o: ../../include/openssl/err.h ../../include/openssl/evp.h
387tb_ecdsa.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
388tb_ecdsa.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
389tb_ecdsa.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
390tb_ecdsa.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
391tb_ecdsa.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
392tb_ecdsa.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
393tb_ecdsa.o: ../../include/openssl/x509_vfy.h ../cryptlib.h eng_int.h tb_ecdsa.c
394tb_pkmeth.o: ../../e_os.h ../../include/openssl/asn1.h
395tb_pkmeth.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
396tb_pkmeth.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
397tb_pkmeth.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
398tb_pkmeth.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h
399tb_pkmeth.o: ../../include/openssl/err.h ../../include/openssl/evp.h
400tb_pkmeth.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
401tb_pkmeth.o: ../../include/openssl/objects.h
402tb_pkmeth.o: ../../include/openssl/opensslconf.h
403tb_pkmeth.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
404tb_pkmeth.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
405tb_pkmeth.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
406tb_pkmeth.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
407tb_pkmeth.o: ../../include/openssl/x509_vfy.h ../cryptlib.h eng_int.h
408tb_pkmeth.o: tb_pkmeth.c
409tb_rand.o: ../../e_os.h ../../include/openssl/asn1.h
410tb_rand.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
411tb_rand.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
412tb_rand.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
413tb_rand.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h
414tb_rand.o: ../../include/openssl/err.h ../../include/openssl/evp.h
415tb_rand.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
416tb_rand.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
417tb_rand.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
418tb_rand.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
419tb_rand.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
420tb_rand.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
421tb_rand.o: ../../include/openssl/x509_vfy.h ../cryptlib.h eng_int.h tb_rand.c
422tb_rsa.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
423tb_rsa.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
424tb_rsa.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
425tb_rsa.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
426tb_rsa.o: ../../include/openssl/engine.h ../../include/openssl/err.h
427tb_rsa.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
428tb_rsa.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
429tb_rsa.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
430tb_rsa.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
431tb_rsa.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
432tb_rsa.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
433tb_rsa.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
434tb_rsa.o: ../cryptlib.h eng_int.h tb_rsa.c
435tb_store.o: ../../e_os.h ../../include/openssl/asn1.h
436tb_store.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
437tb_store.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
438tb_store.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
439tb_store.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h
440tb_store.o: ../../include/openssl/err.h ../../include/openssl/evp.h
441tb_store.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
442tb_store.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
443tb_store.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
444tb_store.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
445tb_store.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
446tb_store.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
447tb_store.o: ../../include/openssl/x509_vfy.h ../cryptlib.h eng_int.h tb_store.c
diff --git a/src/lib/libcrypto/engine/eng_aesni.c b/src/lib/libcrypto/engine/eng_aesni.c
new file mode 100644
index 0000000000..5fdb33bfde
--- /dev/null
+++ b/src/lib/libcrypto/engine/eng_aesni.c
@@ -0,0 +1,570 @@
1/*
2 * Support for Intel AES-NI intruction set
3 * Author: Huang Ying <ying.huang@intel.com>
4 *
5 * Intel AES-NI is a new set of Single Instruction Multiple Data
6 * (SIMD) instructions that are going to be introduced in the next
7 * generation of Intel processor, as of 2009. These instructions
8 * enable fast and secure data encryption and decryption, using the
9 * Advanced Encryption Standard (AES), defined by FIPS Publication
10 * number 197. The architecture introduces six instructions that
11 * offer full hardware support for AES. Four of them support high
12 * performance data encryption and decryption, and the other two
13 * instructions support the AES key expansion procedure.
14 *
15 * The white paper can be downloaded from:
16 * http://softwarecommunity.intel.com/isn/downloads/intelavx/AES-Instructions-Set_WP.pdf
17 *
18 * This file is based on engines/e_padlock.c
19 */
20
21/* ====================================================================
22 * Copyright (c) 1999-2001 The OpenSSL Project. All rights reserved.
23 *
24 * Redistribution and use in source and binary forms, with or without
25 * modification, are permitted provided that the following conditions
26 * are met:
27 *
28 * 1. Redistributions of source code must retain the above copyright
29 * notice, this list of conditions and the following disclaimer.
30 *
31 * 2. Redistributions in binary form must reproduce the above copyright
32 * notice, this list of conditions and the following disclaimer in
33 * the documentation and/or other materials provided with the
34 * distribution.
35 *
36 * 3. All advertising materials mentioning features or use of this
37 * software must display the following acknowledgment:
38 * "This product includes software developed by the OpenSSL Project
39 * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
40 *
41 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
42 * endorse or promote products derived from this software without
43 * prior written permission. For written permission, please contact
44 * licensing@OpenSSL.org.
45 *
46 * 5. Products derived from this software may not be called "OpenSSL"
47 * nor may "OpenSSL" appear in their names without prior written
48 * permission of the OpenSSL Project.
49 *
50 * 6. Redistributions of any form whatsoever must retain the following
51 * acknowledgment:
52 * "This product includes software developed by the OpenSSL Project
53 * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
54 *
55 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
56 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
57 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
58 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
59 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
60 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
61 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
62 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
63 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
64 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
65 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
66 * OF THE POSSIBILITY OF SUCH DAMAGE.
67 * ====================================================================
68 *
69 * This product includes cryptographic software written by Eric Young
70 * (eay@cryptsoft.com). This product includes software written by Tim
71 * Hudson (tjh@cryptsoft.com).
72 *
73 */
74
75
76#include <openssl/opensslconf.h>
77
78#if !defined(OPENSSL_NO_HW) && !defined(OPENSSL_NO_HW_AES_NI) && !defined(OPENSSL_NO_AES)
79
80#include <stdio.h>
81#include <assert.h>
82#include "cryptlib.h"
83#include <openssl/dso.h>
84#include <openssl/engine.h>
85#include <openssl/evp.h>
86#include <openssl/aes.h>
87#include <openssl/err.h>
88
89/* AES-NI is available *ONLY* on some x86 CPUs. Not only that it
90 doesn't exist elsewhere, but it even can't be compiled on other
91 platforms! */
92#undef COMPILE_HW_AESNI
93#if (defined(__x86_64) || defined(__x86_64__) || \
94 defined(_M_AMD64) || defined(_M_X64) || \
95 defined(OPENSSL_IA32_SSE2)) && !defined(OPENSSL_NO_ASM) && !defined(__i386__)
96#define COMPILE_HW_AESNI
97#endif
98static ENGINE *ENGINE_aesni (void);
99
100void ENGINE_load_aesni (void)
101{
102/* On non-x86 CPUs it just returns. */
103#ifdef COMPILE_HW_AESNI
104 ENGINE *toadd = ENGINE_aesni();
105 if (!toadd) return;
106 ENGINE_add (toadd);
107 ENGINE_register_complete (toadd);
108 ENGINE_free (toadd);
109 ERR_clear_error ();
110#endif
111}
112
113#ifdef COMPILE_HW_AESNI
114int aesni_set_encrypt_key(const unsigned char *userKey, int bits,
115 AES_KEY *key);
116int aesni_set_decrypt_key(const unsigned char *userKey, int bits,
117 AES_KEY *key);
118
119void aesni_encrypt(const unsigned char *in, unsigned char *out,
120 const AES_KEY *key);
121void aesni_decrypt(const unsigned char *in, unsigned char *out,
122 const AES_KEY *key);
123
124void aesni_ecb_encrypt(const unsigned char *in,
125 unsigned char *out,
126 size_t length,
127 const AES_KEY *key,
128 int enc);
129void aesni_cbc_encrypt(const unsigned char *in,
130 unsigned char *out,
131 size_t length,
132 const AES_KEY *key,
133 unsigned char *ivec, int enc);
134
135/* Function for ENGINE detection and control */
136static int aesni_init(ENGINE *e);
137
138/* Cipher Stuff */
139static int aesni_ciphers(ENGINE *e, const EVP_CIPHER **cipher,
140 const int **nids, int nid);
141
142#define AESNI_MIN_ALIGN 16
143#define AESNI_ALIGN(x) \
144 ((void *)(((unsigned long)(x)+AESNI_MIN_ALIGN-1)&~(AESNI_MIN_ALIGN-1)))
145
146/* Engine names */
147static const char aesni_id[] = "aesni",
148 aesni_name[] = "Intel AES-NI engine",
149 no_aesni_name[] = "Intel AES-NI engine (no-aesni)";
150
151
152/* The input and output encrypted as though 128bit cfb mode is being
153 * used. The extra state information to record how much of the
154 * 128bit block we have used is contained in *num;
155 */
156static void aesni_cfb128_encrypt(const unsigned char *in, unsigned char *out,
157 unsigned int len, const void *key,
158 unsigned char ivec[16], int *num,
159 int enc)
160{
161 unsigned int n;
162 size_t l = 0;
163
164 assert(in && out && key && ivec && num);
165
166 n = *num;
167
168 if (enc) {
169#if !defined(OPENSSL_SMALL_FOOTPRINT)
170 if (16%sizeof(size_t) == 0) do { /* always true actually */
171 while (n && len) {
172 *(out++) = ivec[n] ^= *(in++);
173 --len;
174 n = (n+1) % 16;
175 }
176 while (len>=16) {
177 aesni_encrypt(ivec, ivec, key);
178 for (n=0; n<16; n+=sizeof(size_t)) {
179 *(size_t*)(out+n) =
180 *(size_t*)(ivec+n) ^= *(size_t*)(in+n);
181 }
182 len -= 16;
183 out += 16;
184 in += 16;
185 }
186 n = 0;
187 if (len) {
188 aesni_encrypt(ivec, ivec, key);
189 while (len--) {
190 out[n] = ivec[n] ^= in[n];
191 ++n;
192 }
193 }
194 *num = n;
195 return;
196 } while (0);
197 /* the rest would be commonly eliminated by x86* compiler */
198#endif
199 while (l<len) {
200 if (n == 0) {
201 aesni_encrypt(ivec, ivec, key);
202 }
203 out[l] = ivec[n] ^= in[l];
204 ++l;
205 n = (n+1) % 16;
206 }
207 *num = n;
208 } else {
209#if !defined(OPENSSL_SMALL_FOOTPRINT)
210 if (16%sizeof(size_t) == 0) do { /* always true actually */
211 while (n && len) {
212 unsigned char c;
213 *(out++) = ivec[n] ^ (c = *(in++)); ivec[n] = c;
214 --len;
215 n = (n+1) % 16;
216 }
217 while (len>=16) {
218 aesni_encrypt(ivec, ivec, key);
219 for (n=0; n<16; n+=sizeof(size_t)) {
220 size_t t = *(size_t*)(in+n);
221 *(size_t*)(out+n) = *(size_t*)(ivec+n) ^ t;
222 *(size_t*)(ivec+n) = t;
223 }
224 len -= 16;
225 out += 16;
226 in += 16;
227 }
228 n = 0;
229 if (len) {
230 aesni_encrypt(ivec, ivec, key);
231 while (len--) {
232 unsigned char c;
233 out[n] = ivec[n] ^ (c = in[n]); ivec[n] = c;
234 ++n;
235 }
236 }
237 *num = n;
238 return;
239 } while (0);
240 /* the rest would be commonly eliminated by x86* compiler */
241#endif
242 while (l<len) {
243 unsigned char c;
244 if (n == 0) {
245 aesni_encrypt(ivec, ivec, key);
246 }
247 out[l] = ivec[n] ^ (c = in[l]); ivec[n] = c;
248 ++l;
249 n = (n+1) % 16;
250 }
251 *num=n;
252 }
253}
254
255/* The input and output encrypted as though 128bit ofb mode is being
256 * used. The extra state information to record how much of the
257 * 128bit block we have used is contained in *num;
258 */
259static void aesni_ofb128_encrypt(const unsigned char *in, unsigned char *out,
260 unsigned int len, const void *key,
261 unsigned char ivec[16], int *num)
262{
263 unsigned int n;
264 size_t l=0;
265
266 assert(in && out && key && ivec && num);
267
268 n = *num;
269
270#if !defined(OPENSSL_SMALL_FOOTPRINT)
271 if (16%sizeof(size_t) == 0) do { /* always true actually */
272 while (n && len) {
273 *(out++) = *(in++) ^ ivec[n];
274 --len;
275 n = (n+1) % 16;
276 }
277 while (len>=16) {
278 aesni_encrypt(ivec, ivec, key);
279 for (n=0; n<16; n+=sizeof(size_t))
280 *(size_t*)(out+n) =
281 *(size_t*)(in+n) ^ *(size_t*)(ivec+n);
282 len -= 16;
283 out += 16;
284 in += 16;
285 }
286 n = 0;
287 if (len) {
288 aesni_encrypt(ivec, ivec, key);
289 while (len--) {
290 out[n] = in[n] ^ ivec[n];
291 ++n;
292 }
293 }
294 *num = n;
295 return;
296 } while(0);
297 /* the rest would be commonly eliminated by x86* compiler */
298#endif
299 while (l<len) {
300 if (n==0) {
301 aesni_encrypt(ivec, ivec, key);
302 }
303 out[l] = in[l] ^ ivec[n];
304 ++l;
305 n = (n+1) % 16;
306 }
307
308 *num=n;
309}
310/* ===== Engine "management" functions ===== */
311
312#if defined(_WIN32)
313typedef unsigned __int64 IA32CAP;
314#else
315typedef unsigned long long IA32CAP;
316#endif
317
318/* Prepare the ENGINE structure for registration */
319static int
320aesni_bind_helper(ENGINE *e)
321{
322 int engage;
323 if (sizeof(OPENSSL_ia32cap_P) > 4) {
324 engage = ((IA32CAP)OPENSSL_ia32cap_P >> 57) & 1;
325 } else {
326 IA32CAP OPENSSL_ia32_cpuid(void);
327 engage = (OPENSSL_ia32_cpuid() >> 57) & 1;
328 }
329
330 /* Register everything or return with an error */
331 if (!ENGINE_set_id(e, aesni_id) ||
332 !ENGINE_set_name(e, engage ? aesni_name : no_aesni_name) ||
333
334 !ENGINE_set_init_function(e, aesni_init) ||
335 (engage && !ENGINE_set_ciphers (e, aesni_ciphers))
336 )
337 return 0;
338
339 /* Everything looks good */
340 return 1;
341}
342
343/* Constructor */
344static ENGINE *
345ENGINE_aesni(void)
346{
347 ENGINE *eng = ENGINE_new();
348
349 if (!eng) {
350 return NULL;
351 }
352
353 if (!aesni_bind_helper(eng)) {
354 ENGINE_free(eng);
355 return NULL;
356 }
357
358 return eng;
359}
360
361/* Check availability of the engine */
362static int
363aesni_init(ENGINE *e)
364{
365 return 1;
366}
367
368#if defined(NID_aes_128_cfb128) && ! defined (NID_aes_128_cfb)
369#define NID_aes_128_cfb NID_aes_128_cfb128
370#endif
371
372#if defined(NID_aes_128_ofb128) && ! defined (NID_aes_128_ofb)
373#define NID_aes_128_ofb NID_aes_128_ofb128
374#endif
375
376#if defined(NID_aes_192_cfb128) && ! defined (NID_aes_192_cfb)
377#define NID_aes_192_cfb NID_aes_192_cfb128
378#endif
379
380#if defined(NID_aes_192_ofb128) && ! defined (NID_aes_192_ofb)
381#define NID_aes_192_ofb NID_aes_192_ofb128
382#endif
383
384#if defined(NID_aes_256_cfb128) && ! defined (NID_aes_256_cfb)
385#define NID_aes_256_cfb NID_aes_256_cfb128
386#endif
387
388#if defined(NID_aes_256_ofb128) && ! defined (NID_aes_256_ofb)
389#define NID_aes_256_ofb NID_aes_256_ofb128
390#endif
391
392/* List of supported ciphers. */
393static int aesni_cipher_nids[] = {
394 NID_aes_128_ecb,
395 NID_aes_128_cbc,
396 NID_aes_128_cfb,
397 NID_aes_128_ofb,
398
399 NID_aes_192_ecb,
400 NID_aes_192_cbc,
401 NID_aes_192_cfb,
402 NID_aes_192_ofb,
403
404 NID_aes_256_ecb,
405 NID_aes_256_cbc,
406 NID_aes_256_cfb,
407 NID_aes_256_ofb,
408};
409static int aesni_cipher_nids_num =
410 (sizeof(aesni_cipher_nids)/sizeof(aesni_cipher_nids[0]));
411
412typedef struct
413{
414 AES_KEY ks;
415 unsigned int _pad1[3];
416} AESNI_KEY;
417
418static int
419aesni_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *user_key,
420 const unsigned char *iv, int enc)
421{
422 int ret;
423 AES_KEY *key = AESNI_ALIGN(ctx->cipher_data);
424
425 if ((ctx->cipher->flags & EVP_CIPH_MODE) == EVP_CIPH_CFB_MODE
426 || (ctx->cipher->flags & EVP_CIPH_MODE) == EVP_CIPH_OFB_MODE
427 || enc)
428 ret=aesni_set_encrypt_key(user_key, ctx->key_len * 8, key);
429 else
430 ret=aesni_set_decrypt_key(user_key, ctx->key_len * 8, key);
431
432 if(ret < 0) {
433 EVPerr(EVP_F_AESNI_INIT_KEY,EVP_R_AES_KEY_SETUP_FAILED);
434 return 0;
435 }
436
437 return 1;
438}
439
440static int aesni_cipher_ecb(EVP_CIPHER_CTX *ctx, unsigned char *out,
441 const unsigned char *in, size_t inl)
442{ AES_KEY *key = AESNI_ALIGN(ctx->cipher_data);
443 aesni_ecb_encrypt(in, out, inl, key, ctx->encrypt);
444 return 1;
445}
446static int aesni_cipher_cbc(EVP_CIPHER_CTX *ctx, unsigned char *out,
447 const unsigned char *in, size_t inl)
448{ AES_KEY *key = AESNI_ALIGN(ctx->cipher_data);
449 aesni_cbc_encrypt(in, out, inl, key,
450 ctx->iv, ctx->encrypt);
451 return 1;
452}
453static int aesni_cipher_cfb(EVP_CIPHER_CTX *ctx, unsigned char *out,
454 const unsigned char *in, size_t inl)
455{ AES_KEY *key = AESNI_ALIGN(ctx->cipher_data);
456
457 aesni_cfb128_encrypt(in, out, inl, key, ctx->iv,
458 &ctx->num, ctx->encrypt);
459 return 1;
460}
461static int aesni_cipher_ofb(EVP_CIPHER_CTX *ctx, unsigned char *out,
462 const unsigned char *in, size_t inl)
463{ AES_KEY *key = AESNI_ALIGN(ctx->cipher_data);
464 aesni_ofb128_encrypt(in, out, inl, key, ctx->iv, &ctx->num);
465 return 1;
466}
467
468#define AES_BLOCK_SIZE 16
469
470#define EVP_CIPHER_block_size_ECB AES_BLOCK_SIZE
471#define EVP_CIPHER_block_size_CBC AES_BLOCK_SIZE
472#define EVP_CIPHER_block_size_OFB 1
473#define EVP_CIPHER_block_size_CFB 1
474
475/* Declaring so many ciphers by hand would be a pain.
476 Instead introduce a bit of preprocessor magic :-) */
477#define DECLARE_AES_EVP(ksize,lmode,umode) \
478static const EVP_CIPHER aesni_##ksize##_##lmode = { \
479 NID_aes_##ksize##_##lmode, \
480 EVP_CIPHER_block_size_##umode, \
481 ksize / 8, \
482 AES_BLOCK_SIZE, \
483 0 | EVP_CIPH_##umode##_MODE, \
484 aesni_init_key, \
485 aesni_cipher_##lmode, \
486 NULL, \
487 sizeof(AESNI_KEY), \
488 EVP_CIPHER_set_asn1_iv, \
489 EVP_CIPHER_get_asn1_iv, \
490 NULL, \
491 NULL \
492}
493
494DECLARE_AES_EVP(128,ecb,ECB);
495DECLARE_AES_EVP(128,cbc,CBC);
496DECLARE_AES_EVP(128,cfb,CFB);
497DECLARE_AES_EVP(128,ofb,OFB);
498
499DECLARE_AES_EVP(192,ecb,ECB);
500DECLARE_AES_EVP(192,cbc,CBC);
501DECLARE_AES_EVP(192,cfb,CFB);
502DECLARE_AES_EVP(192,ofb,OFB);
503
504DECLARE_AES_EVP(256,ecb,ECB);
505DECLARE_AES_EVP(256,cbc,CBC);
506DECLARE_AES_EVP(256,cfb,CFB);
507DECLARE_AES_EVP(256,ofb,OFB);
508
509static int
510aesni_ciphers (ENGINE *e, const EVP_CIPHER **cipher,
511 const int **nids, int nid)
512{
513 /* No specific cipher => return a list of supported nids ... */
514 if (!cipher) {
515 *nids = aesni_cipher_nids;
516 return aesni_cipher_nids_num;
517 }
518
519 /* ... or the requested "cipher" otherwise */
520 switch (nid) {
521 case NID_aes_128_ecb:
522 *cipher = &aesni_128_ecb;
523 break;
524 case NID_aes_128_cbc:
525 *cipher = &aesni_128_cbc;
526 break;
527 case NID_aes_128_cfb:
528 *cipher = &aesni_128_cfb;
529 break;
530 case NID_aes_128_ofb:
531 *cipher = &aesni_128_ofb;
532 break;
533
534 case NID_aes_192_ecb:
535 *cipher = &aesni_192_ecb;
536 break;
537 case NID_aes_192_cbc:
538 *cipher = &aesni_192_cbc;
539 break;
540 case NID_aes_192_cfb:
541 *cipher = &aesni_192_cfb;
542 break;
543 case NID_aes_192_ofb:
544 *cipher = &aesni_192_ofb;
545 break;
546
547 case NID_aes_256_ecb:
548 *cipher = &aesni_256_ecb;
549 break;
550 case NID_aes_256_cbc:
551 *cipher = &aesni_256_cbc;
552 break;
553 case NID_aes_256_cfb:
554 *cipher = &aesni_256_cfb;
555 break;
556 case NID_aes_256_ofb:
557 *cipher = &aesni_256_ofb;
558 break;
559
560 default:
561 /* Sorry, we don't support this NID */
562 *cipher = NULL;
563 return 0;
564 }
565 return 1;
566}
567
568#endif /* COMPILE_HW_AESNI */
569#endif /* !defined(OPENSSL_NO_HW) && !defined(OPENSSL_NO_HW_AESNI) && !defined(OPENSSL_NO_AES) */
570
diff --git a/src/lib/libcrypto/engine/eng_all.c b/src/lib/libcrypto/engine/eng_all.c
index 6093376df4..0ae5d672b1 100644
--- a/src/lib/libcrypto/engine/eng_all.c
+++ b/src/lib/libcrypto/engine/eng_all.c
@@ -73,6 +73,7 @@ void ENGINE_load_builtin_engines(void)
73#if !defined(OPENSSL_NO_HW) && (defined(__OpenBSD__) || defined(__FreeBSD__) || defined(HAVE_CRYPTODEV)) 73#if !defined(OPENSSL_NO_HW) && (defined(__OpenBSD__) || defined(__FreeBSD__) || defined(HAVE_CRYPTODEV))
74 ENGINE_load_cryptodev(); 74 ENGINE_load_cryptodev();
75#endif 75#endif
76
76#ifndef OPENSSL_NO_RSAX 77#ifndef OPENSSL_NO_RSAX
77 ENGINE_load_rsax(); 78 ENGINE_load_rsax();
78#endif 79#endif
diff --git a/src/lib/libcrypto/engine/eng_cryptodev.c b/src/lib/libcrypto/engine/eng_cryptodev.c
new file mode 100644
index 0000000000..a7abac1a7b
--- /dev/null
+++ b/src/lib/libcrypto/engine/eng_cryptodev.c
@@ -0,0 +1,1449 @@
1/*
2 * Copyright (c) 2002 Bob Beck <beck@openbsd.org>
3 * Copyright (c) 2002 Theo de Raadt
4 * Copyright (c) 2002 Markus Friedl
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 *
27 */
28
29#include <openssl/objects.h>
30#include <openssl/engine.h>
31#include <openssl/evp.h>
32#include <openssl/bn.h>
33
34#if (defined(__unix__) || defined(unix)) && !defined(USG) && \
35 (defined(__OpenBSD__) || defined(__FreeBSD__))
36#include <sys/param.h>
37# if (OpenBSD >= 200112) || ((__FreeBSD_version >= 470101 && __FreeBSD_version < 500000) || __FreeBSD_version >= 500041)
38# define HAVE_CRYPTODEV
39# endif
40# if (OpenBSD >= 200110)
41# define HAVE_SYSLOG_R
42# endif
43#endif
44
45#ifndef HAVE_CRYPTODEV
46
47void
48ENGINE_load_cryptodev(void)
49{
50 /* This is a NOP on platforms without /dev/crypto */
51 return;
52}
53
54#else
55
56#include <sys/types.h>
57#include <crypto/cryptodev.h>
58#include <crypto/dh/dh.h>
59#include <crypto/dsa/dsa.h>
60#include <crypto/err/err.h>
61#include <crypto/rsa/rsa.h>
62#include <sys/ioctl.h>
63#include <errno.h>
64#include <stdio.h>
65#include <unistd.h>
66#include <fcntl.h>
67#include <stdarg.h>
68#include <syslog.h>
69#include <errno.h>
70#include <string.h>
71
72struct dev_crypto_state {
73 struct session_op d_sess;
74 int d_fd;
75
76#ifdef USE_CRYPTODEV_DIGESTS
77 char dummy_mac_key[HASH_MAX_LEN];
78
79 unsigned char digest_res[HASH_MAX_LEN];
80 char *mac_data;
81 int mac_len;
82#endif
83};
84
85static u_int32_t cryptodev_asymfeat = 0;
86
87static int get_asym_dev_crypto(void);
88static int open_dev_crypto(void);
89static int get_dev_crypto(void);
90static int get_cryptodev_ciphers(const int **cnids);
91#ifdef USE_CRYPTODEV_DIGESTS
92static int get_cryptodev_digests(const int **cnids);
93#endif
94static int cryptodev_usable_ciphers(const int **nids);
95static int cryptodev_usable_digests(const int **nids);
96static int cryptodev_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
97 const unsigned char *in, size_t inl);
98static int cryptodev_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
99 const unsigned char *iv, int enc);
100static int cryptodev_cleanup(EVP_CIPHER_CTX *ctx);
101static int cryptodev_engine_ciphers(ENGINE *e, const EVP_CIPHER **cipher,
102 const int **nids, int nid);
103static int cryptodev_engine_digests(ENGINE *e, const EVP_MD **digest,
104 const int **nids, int nid);
105static int bn2crparam(const BIGNUM *a, struct crparam *crp);
106static int crparam2bn(struct crparam *crp, BIGNUM *a);
107static void zapparams(struct crypt_kop *kop);
108static int cryptodev_asym(struct crypt_kop *kop, int rlen, BIGNUM *r,
109 int slen, BIGNUM *s);
110
111static int cryptodev_bn_mod_exp(BIGNUM *r, const BIGNUM *a,
112 const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx);
113static int cryptodev_rsa_nocrt_mod_exp(BIGNUM *r0, const BIGNUM *I,
114 RSA *rsa, BN_CTX *ctx);
115static int cryptodev_rsa_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa, BN_CTX *ctx);
116static int cryptodev_dsa_bn_mod_exp(DSA *dsa, BIGNUM *r, BIGNUM *a,
117 const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx);
118static int cryptodev_dsa_dsa_mod_exp(DSA *dsa, BIGNUM *t1, BIGNUM *g,
119 BIGNUM *u1, BIGNUM *pub_key, BIGNUM *u2, BIGNUM *p,
120 BN_CTX *ctx, BN_MONT_CTX *mont);
121static DSA_SIG *cryptodev_dsa_do_sign(const unsigned char *dgst,
122 int dlen, DSA *dsa);
123static int cryptodev_dsa_verify(const unsigned char *dgst, int dgst_len,
124 DSA_SIG *sig, DSA *dsa);
125static int cryptodev_mod_exp_dh(const DH *dh, BIGNUM *r, const BIGNUM *a,
126 const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx,
127 BN_MONT_CTX *m_ctx);
128static int cryptodev_dh_compute_key(unsigned char *key,
129 const BIGNUM *pub_key, DH *dh);
130static int cryptodev_ctrl(ENGINE *e, int cmd, long i, void *p,
131 void (*f)(void));
132void ENGINE_load_cryptodev(void);
133
134static const ENGINE_CMD_DEFN cryptodev_defns[] = {
135 { 0, NULL, NULL, 0 }
136};
137
138static struct {
139 int id;
140 int nid;
141 int ivmax;
142 int keylen;
143} ciphers[] = {
144 { CRYPTO_ARC4, NID_rc4, 0, 16, },
145 { CRYPTO_DES_CBC, NID_des_cbc, 8, 8, },
146 { CRYPTO_3DES_CBC, NID_des_ede3_cbc, 8, 24, },
147 { CRYPTO_AES_CBC, NID_aes_128_cbc, 16, 16, },
148 { CRYPTO_AES_CBC, NID_aes_192_cbc, 16, 24, },
149 { CRYPTO_AES_CBC, NID_aes_256_cbc, 16, 32, },
150 { CRYPTO_BLF_CBC, NID_bf_cbc, 8, 16, },
151 { CRYPTO_CAST_CBC, NID_cast5_cbc, 8, 16, },
152 { 0, NID_undef, 0, 0, },
153};
154
155#ifdef USE_CRYPTODEV_DIGESTS
156static struct {
157 int id;
158 int nid;
159 int keylen;
160} digests[] = {
161 { CRYPTO_MD5_HMAC, NID_hmacWithMD5, 16},
162 { CRYPTO_SHA1_HMAC, NID_hmacWithSHA1, 20},
163 { CRYPTO_RIPEMD160_HMAC, NID_ripemd160, 16/*?*/},
164 { CRYPTO_MD5_KPDK, NID_undef, 0},
165 { CRYPTO_SHA1_KPDK, NID_undef, 0},
166 { CRYPTO_MD5, NID_md5, 16},
167 { CRYPTO_SHA1, NID_sha1, 20},
168 { 0, NID_undef, 0},
169};
170#endif
171
172/*
173 * Return a fd if /dev/crypto seems usable, 0 otherwise.
174 */
175static int
176open_dev_crypto(void)
177{
178 static int fd = -1;
179
180 if (fd == -1) {
181 if ((fd = open("/dev/crypto", O_RDWR, 0)) == -1)
182 return (-1);
183 /* close on exec */
184 if (fcntl(fd, F_SETFD, 1) == -1) {
185 close(fd);
186 fd = -1;
187 return (-1);
188 }
189 }
190 return (fd);
191}
192
193static int
194get_dev_crypto(void)
195{
196 int fd, retfd;
197
198 if ((fd = open_dev_crypto()) == -1)
199 return (-1);
200#ifndef CRIOGET_NOT_NEEDED
201 if (ioctl(fd, CRIOGET, &retfd) == -1)
202 return (-1);
203
204 /* close on exec */
205 if (fcntl(retfd, F_SETFD, 1) == -1) {
206 close(retfd);
207 return (-1);
208 }
209#else
210 retfd = fd;
211#endif
212 return (retfd);
213}
214
215static void put_dev_crypto(int fd)
216{
217#ifndef CRIOGET_NOT_NEEDED
218 close(fd);
219#endif
220}
221
222/* Caching version for asym operations */
223static int
224get_asym_dev_crypto(void)
225{
226 static int fd = -1;
227
228 if (fd == -1)
229 fd = get_dev_crypto();
230 return fd;
231}
232
233/*
234 * Find out what ciphers /dev/crypto will let us have a session for.
235 * XXX note, that some of these openssl doesn't deal with yet!
236 * returning them here is harmless, as long as we return NULL
237 * when asked for a handler in the cryptodev_engine_ciphers routine
238 */
239static int
240get_cryptodev_ciphers(const int **cnids)
241{
242 static int nids[CRYPTO_ALGORITHM_MAX];
243 struct session_op sess;
244 int fd, i, count = 0;
245
246 if ((fd = get_dev_crypto()) < 0) {
247 *cnids = NULL;
248 return (0);
249 }
250 memset(&sess, 0, sizeof(sess));
251 sess.key = (caddr_t)"123456789abcdefghijklmno";
252
253 for (i = 0; ciphers[i].id && count < CRYPTO_ALGORITHM_MAX; i++) {
254 if (ciphers[i].nid == NID_undef)
255 continue;
256 sess.cipher = ciphers[i].id;
257 sess.keylen = ciphers[i].keylen;
258 sess.mac = 0;
259 if (ioctl(fd, CIOCGSESSION, &sess) != -1 &&
260 ioctl(fd, CIOCFSESSION, &sess.ses) != -1)
261 nids[count++] = ciphers[i].nid;
262 }
263 put_dev_crypto(fd);
264
265 if (count > 0)
266 *cnids = nids;
267 else
268 *cnids = NULL;
269 return (count);
270}
271
272#ifdef USE_CRYPTODEV_DIGESTS
273/*
274 * Find out what digests /dev/crypto will let us have a session for.
275 * XXX note, that some of these openssl doesn't deal with yet!
276 * returning them here is harmless, as long as we return NULL
277 * when asked for a handler in the cryptodev_engine_digests routine
278 */
279static int
280get_cryptodev_digests(const int **cnids)
281{
282 static int nids[CRYPTO_ALGORITHM_MAX];
283 struct session_op sess;
284 int fd, i, count = 0;
285
286 if ((fd = get_dev_crypto()) < 0) {
287 *cnids = NULL;
288 return (0);
289 }
290 memset(&sess, 0, sizeof(sess));
291 sess.mackey = (caddr_t)"123456789abcdefghijklmno";
292 for (i = 0; digests[i].id && count < CRYPTO_ALGORITHM_MAX; i++) {
293 if (digests[i].nid == NID_undef)
294 continue;
295 sess.mac = digests[i].id;
296 sess.mackeylen = digests[i].keylen;
297 sess.cipher = 0;
298 if (ioctl(fd, CIOCGSESSION, &sess) != -1 &&
299 ioctl(fd, CIOCFSESSION, &sess.ses) != -1)
300 nids[count++] = digests[i].nid;
301 }
302 put_dev_crypto(fd);
303
304 if (count > 0)
305 *cnids = nids;
306 else
307 *cnids = NULL;
308 return (count);
309}
310#endif /* 0 */
311
312/*
313 * Find the useable ciphers|digests from dev/crypto - this is the first
314 * thing called by the engine init crud which determines what it
315 * can use for ciphers from this engine. We want to return
316 * only what we can do, anythine else is handled by software.
317 *
318 * If we can't initialize the device to do anything useful for
319 * any reason, we want to return a NULL array, and 0 length,
320 * which forces everything to be done is software. By putting
321 * the initalization of the device in here, we ensure we can
322 * use this engine as the default, and if for whatever reason
323 * /dev/crypto won't do what we want it will just be done in
324 * software
325 *
326 * This can (should) be greatly expanded to perhaps take into
327 * account speed of the device, and what we want to do.
328 * (although the disabling of particular alg's could be controlled
329 * by the device driver with sysctl's.) - this is where we
330 * want most of the decisions made about what we actually want
331 * to use from /dev/crypto.
332 */
333static int
334cryptodev_usable_ciphers(const int **nids)
335{
336 return (get_cryptodev_ciphers(nids));
337}
338
339static int
340cryptodev_usable_digests(const int **nids)
341{
342#ifdef USE_CRYPTODEV_DIGESTS
343 return (get_cryptodev_digests(nids));
344#else
345 /*
346 * XXXX just disable all digests for now, because it sucks.
347 * we need a better way to decide this - i.e. I may not
348 * want digests on slow cards like hifn on fast machines,
349 * but might want them on slow or loaded machines, etc.
350 * will also want them when using crypto cards that don't
351 * suck moose gonads - would be nice to be able to decide something
352 * as reasonable default without having hackery that's card dependent.
353 * of course, the default should probably be just do everything,
354 * with perhaps a sysctl to turn algoritms off (or have them off
355 * by default) on cards that generally suck like the hifn.
356 */
357 *nids = NULL;
358 return (0);
359#endif
360}
361
362static int
363cryptodev_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
364 const unsigned char *in, size_t inl)
365{
366 struct crypt_op cryp;
367 struct dev_crypto_state *state = ctx->cipher_data;
368 struct session_op *sess = &state->d_sess;
369 const void *iiv;
370 unsigned char save_iv[EVP_MAX_IV_LENGTH];
371
372 if (state->d_fd < 0)
373 return (0);
374 if (!inl)
375 return (1);
376 if ((inl % ctx->cipher->block_size) != 0)
377 return (0);
378
379 memset(&cryp, 0, sizeof(cryp));
380
381 cryp.ses = sess->ses;
382 cryp.flags = 0;
383 cryp.len = inl;
384 cryp.src = (caddr_t) in;
385 cryp.dst = (caddr_t) out;
386 cryp.mac = 0;
387
388 cryp.op = ctx->encrypt ? COP_ENCRYPT : COP_DECRYPT;
389
390 if (ctx->cipher->iv_len) {
391 cryp.iv = (caddr_t) ctx->iv;
392 if (!ctx->encrypt) {
393 iiv = in + inl - ctx->cipher->iv_len;
394 memcpy(save_iv, iiv, ctx->cipher->iv_len);
395 }
396 } else
397 cryp.iv = NULL;
398
399 if (ioctl(state->d_fd, CIOCCRYPT, &cryp) == -1) {
400 /* XXX need better errror handling
401 * this can fail for a number of different reasons.
402 */
403 return (0);
404 }
405
406 if (ctx->cipher->iv_len) {
407 if (ctx->encrypt)
408 iiv = out + inl - ctx->cipher->iv_len;
409 else
410 iiv = save_iv;
411 memcpy(ctx->iv, iiv, ctx->cipher->iv_len);
412 }
413 return (1);
414}
415
416static int
417cryptodev_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
418 const unsigned char *iv, int enc)
419{
420 struct dev_crypto_state *state = ctx->cipher_data;
421 struct session_op *sess = &state->d_sess;
422 int cipher = -1, i;
423
424 for (i = 0; ciphers[i].id; i++)
425 if (ctx->cipher->nid == ciphers[i].nid &&
426 ctx->cipher->iv_len <= ciphers[i].ivmax &&
427 ctx->key_len == ciphers[i].keylen) {
428 cipher = ciphers[i].id;
429 break;
430 }
431
432 if (!ciphers[i].id) {
433 state->d_fd = -1;
434 return (0);
435 }
436
437 memset(sess, 0, sizeof(struct session_op));
438
439 if ((state->d_fd = get_dev_crypto()) < 0)
440 return (0);
441
442 sess->key = (caddr_t)key;
443 sess->keylen = ctx->key_len;
444 sess->cipher = cipher;
445
446 if (ioctl(state->d_fd, CIOCGSESSION, sess) == -1) {
447 put_dev_crypto(state->d_fd);
448 state->d_fd = -1;
449 return (0);
450 }
451 return (1);
452}
453
454/*
455 * free anything we allocated earlier when initting a
456 * session, and close the session.
457 */
458static int
459cryptodev_cleanup(EVP_CIPHER_CTX *ctx)
460{
461 int ret = 0;
462 struct dev_crypto_state *state = ctx->cipher_data;
463 struct session_op *sess = &state->d_sess;
464
465 if (state->d_fd < 0)
466 return (0);
467
468 /* XXX if this ioctl fails, someting's wrong. the invoker
469 * may have called us with a bogus ctx, or we could
470 * have a device that for whatever reason just doesn't
471 * want to play ball - it's not clear what's right
472 * here - should this be an error? should it just
473 * increase a counter, hmm. For right now, we return
474 * 0 - I don't believe that to be "right". we could
475 * call the gorpy openssl lib error handlers that
476 * print messages to users of the library. hmm..
477 */
478
479 if (ioctl(state->d_fd, CIOCFSESSION, &sess->ses) == -1) {
480 ret = 0;
481 } else {
482 ret = 1;
483 }
484 put_dev_crypto(state->d_fd);
485 state->d_fd = -1;
486
487 return (ret);
488}
489
490/*
491 * libcrypto EVP stuff - this is how we get wired to EVP so the engine
492 * gets called when libcrypto requests a cipher NID.
493 */
494
495/* RC4 */
496const EVP_CIPHER cryptodev_rc4 = {
497 NID_rc4,
498 1, 16, 0,
499 EVP_CIPH_VARIABLE_LENGTH,
500 cryptodev_init_key,
501 cryptodev_cipher,
502 cryptodev_cleanup,
503 sizeof(struct dev_crypto_state),
504 NULL,
505 NULL,
506 NULL
507};
508
509/* DES CBC EVP */
510const EVP_CIPHER cryptodev_des_cbc = {
511 NID_des_cbc,
512 8, 8, 8,
513 EVP_CIPH_CBC_MODE,
514 cryptodev_init_key,
515 cryptodev_cipher,
516 cryptodev_cleanup,
517 sizeof(struct dev_crypto_state),
518 EVP_CIPHER_set_asn1_iv,
519 EVP_CIPHER_get_asn1_iv,
520 NULL
521};
522
523/* 3DES CBC EVP */
524const EVP_CIPHER cryptodev_3des_cbc = {
525 NID_des_ede3_cbc,
526 8, 24, 8,
527 EVP_CIPH_CBC_MODE,
528 cryptodev_init_key,
529 cryptodev_cipher,
530 cryptodev_cleanup,
531 sizeof(struct dev_crypto_state),
532 EVP_CIPHER_set_asn1_iv,
533 EVP_CIPHER_get_asn1_iv,
534 NULL
535};
536
537const EVP_CIPHER cryptodev_bf_cbc = {
538 NID_bf_cbc,
539 8, 16, 8,
540 EVP_CIPH_CBC_MODE,
541 cryptodev_init_key,
542 cryptodev_cipher,
543 cryptodev_cleanup,
544 sizeof(struct dev_crypto_state),
545 EVP_CIPHER_set_asn1_iv,
546 EVP_CIPHER_get_asn1_iv,
547 NULL
548};
549
550const EVP_CIPHER cryptodev_cast_cbc = {
551 NID_cast5_cbc,
552 8, 16, 8,
553 EVP_CIPH_CBC_MODE,
554 cryptodev_init_key,
555 cryptodev_cipher,
556 cryptodev_cleanup,
557 sizeof(struct dev_crypto_state),
558 EVP_CIPHER_set_asn1_iv,
559 EVP_CIPHER_get_asn1_iv,
560 NULL
561};
562
563const EVP_CIPHER cryptodev_aes_cbc = {
564 NID_aes_128_cbc,
565 16, 16, 16,
566 EVP_CIPH_CBC_MODE,
567 cryptodev_init_key,
568 cryptodev_cipher,
569 cryptodev_cleanup,
570 sizeof(struct dev_crypto_state),
571 EVP_CIPHER_set_asn1_iv,
572 EVP_CIPHER_get_asn1_iv,
573 NULL
574};
575
576const EVP_CIPHER cryptodev_aes_192_cbc = {
577 NID_aes_192_cbc,
578 16, 24, 16,
579 EVP_CIPH_CBC_MODE,
580 cryptodev_init_key,
581 cryptodev_cipher,
582 cryptodev_cleanup,
583 sizeof(struct dev_crypto_state),
584 EVP_CIPHER_set_asn1_iv,
585 EVP_CIPHER_get_asn1_iv,
586 NULL
587};
588
589const EVP_CIPHER cryptodev_aes_256_cbc = {
590 NID_aes_256_cbc,
591 16, 32, 16,
592 EVP_CIPH_CBC_MODE,
593 cryptodev_init_key,
594 cryptodev_cipher,
595 cryptodev_cleanup,
596 sizeof(struct dev_crypto_state),
597 EVP_CIPHER_set_asn1_iv,
598 EVP_CIPHER_get_asn1_iv,
599 NULL
600};
601
602/*
603 * Registered by the ENGINE when used to find out how to deal with
604 * a particular NID in the ENGINE. this says what we'll do at the
605 * top level - note, that list is restricted by what we answer with
606 */
607static int
608cryptodev_engine_ciphers(ENGINE *e, const EVP_CIPHER **cipher,
609 const int **nids, int nid)
610{
611 if (!cipher)
612 return (cryptodev_usable_ciphers(nids));
613
614 switch (nid) {
615 case NID_rc4:
616 *cipher = &cryptodev_rc4;
617 break;
618 case NID_des_ede3_cbc:
619 *cipher = &cryptodev_3des_cbc;
620 break;
621 case NID_des_cbc:
622 *cipher = &cryptodev_des_cbc;
623 break;
624 case NID_bf_cbc:
625 *cipher = &cryptodev_bf_cbc;
626 break;
627 case NID_cast5_cbc:
628 *cipher = &cryptodev_cast_cbc;
629 break;
630 case NID_aes_128_cbc:
631 *cipher = &cryptodev_aes_cbc;
632 break;
633 case NID_aes_192_cbc:
634 *cipher = &cryptodev_aes_192_cbc;
635 break;
636 case NID_aes_256_cbc:
637 *cipher = &cryptodev_aes_256_cbc;
638 break;
639 default:
640 *cipher = NULL;
641 break;
642 }
643 return (*cipher != NULL);
644}
645
646
647#ifdef USE_CRYPTODEV_DIGESTS
648
649/* convert digest type to cryptodev */
650static int
651digest_nid_to_cryptodev(int nid)
652{
653 int i;
654
655 for (i = 0; digests[i].id; i++)
656 if (digests[i].nid == nid)
657 return (digests[i].id);
658 return (0);
659}
660
661
662static int
663digest_key_length(int nid)
664{
665 int i;
666
667 for (i = 0; digests[i].id; i++)
668 if (digests[i].nid == nid)
669 return digests[i].keylen;
670 return (0);
671}
672
673
674static int cryptodev_digest_init(EVP_MD_CTX *ctx)
675{
676 struct dev_crypto_state *state = ctx->md_data;
677 struct session_op *sess = &state->d_sess;
678 int digest;
679
680 if ((digest = digest_nid_to_cryptodev(ctx->digest->type)) == NID_undef){
681 printf("cryptodev_digest_init: Can't get digest \n");
682 return (0);
683 }
684
685 memset(state, 0, sizeof(struct dev_crypto_state));
686
687 if ((state->d_fd = get_dev_crypto()) < 0) {
688 printf("cryptodev_digest_init: Can't get Dev \n");
689 return (0);
690 }
691
692 sess->mackey = state->dummy_mac_key;
693 sess->mackeylen = digest_key_length(ctx->digest->type);
694 sess->mac = digest;
695
696 if (ioctl(state->d_fd, CIOCGSESSION, sess) < 0) {
697 put_dev_crypto(state->d_fd);
698 state->d_fd = -1;
699 printf("cryptodev_digest_init: Open session failed\n");
700 return (0);
701 }
702
703 return (1);
704}
705
706static int cryptodev_digest_update(EVP_MD_CTX *ctx, const void *data,
707 size_t count)
708{
709 struct crypt_op cryp;
710 struct dev_crypto_state *state = ctx->md_data;
711 struct session_op *sess = &state->d_sess;
712
713 if (!data || state->d_fd < 0) {
714 printf("cryptodev_digest_update: illegal inputs \n");
715 return (0);
716 }
717
718 if (!count) {
719 return (0);
720 }
721
722 if (!(ctx->flags & EVP_MD_CTX_FLAG_ONESHOT)) {
723 /* if application doesn't support one buffer */
724 state->mac_data = OPENSSL_realloc(state->mac_data, state->mac_len + count);
725
726 if (!state->mac_data) {
727 printf("cryptodev_digest_update: realloc failed\n");
728 return (0);
729 }
730
731 memcpy(state->mac_data + state->mac_len, data, count);
732 state->mac_len += count;
733
734 return (1);
735 }
736
737 memset(&cryp, 0, sizeof(cryp));
738
739 cryp.ses = sess->ses;
740 cryp.flags = 0;
741 cryp.len = count;
742 cryp.src = (caddr_t) data;
743 cryp.dst = NULL;
744 cryp.mac = (caddr_t) state->digest_res;
745 if (ioctl(state->d_fd, CIOCCRYPT, &cryp) < 0) {
746 printf("cryptodev_digest_update: digest failed\n");
747 return (0);
748 }
749 return (1);
750}
751
752
753static int cryptodev_digest_final(EVP_MD_CTX *ctx, unsigned char *md)
754{
755 struct crypt_op cryp;
756 struct dev_crypto_state *state = ctx->md_data;
757 struct session_op *sess = &state->d_sess;
758
759 int ret = 1;
760
761 if (!md || state->d_fd < 0) {
762 printf("cryptodev_digest_final: illegal input\n");
763 return(0);
764 }
765
766 if (! (ctx->flags & EVP_MD_CTX_FLAG_ONESHOT) ) {
767 /* if application doesn't support one buffer */
768 memset(&cryp, 0, sizeof(cryp));
769 cryp.ses = sess->ses;
770 cryp.flags = 0;
771 cryp.len = state->mac_len;
772 cryp.src = state->mac_data;
773 cryp.dst = NULL;
774 cryp.mac = (caddr_t)md;
775 if (ioctl(state->d_fd, CIOCCRYPT, &cryp) < 0) {
776 printf("cryptodev_digest_final: digest failed\n");
777 return (0);
778 }
779
780 return 1;
781 }
782
783 memcpy(md, state->digest_res, ctx->digest->md_size);
784
785 return (ret);
786}
787
788
789static int cryptodev_digest_cleanup(EVP_MD_CTX *ctx)
790{
791 int ret = 1;
792 struct dev_crypto_state *state = ctx->md_data;
793 struct session_op *sess = &state->d_sess;
794
795 if (state == NULL)
796 return 0;
797
798 if (state->d_fd < 0) {
799 printf("cryptodev_digest_cleanup: illegal input\n");
800 return (0);
801 }
802
803 if (state->mac_data) {
804 OPENSSL_free(state->mac_data);
805 state->mac_data = NULL;
806 state->mac_len = 0;
807 }
808
809 if (ioctl(state->d_fd, CIOCFSESSION, &sess->ses) < 0) {
810 printf("cryptodev_digest_cleanup: failed to close session\n");
811 ret = 0;
812 } else {
813 ret = 1;
814 }
815 put_dev_crypto(state->d_fd);
816 state->d_fd = -1;
817
818 return (ret);
819}
820
821static int cryptodev_digest_copy(EVP_MD_CTX *to,const EVP_MD_CTX *from)
822{
823 struct dev_crypto_state *fstate = from->md_data;
824 struct dev_crypto_state *dstate = to->md_data;
825 struct session_op *sess;
826 int digest;
827
828 if (dstate == NULL || fstate == NULL)
829 return 1;
830
831 memcpy(dstate, fstate, sizeof(struct dev_crypto_state));
832
833 sess = &dstate->d_sess;
834
835 digest = digest_nid_to_cryptodev(to->digest->type);
836
837 sess->mackey = dstate->dummy_mac_key;
838 sess->mackeylen = digest_key_length(to->digest->type);
839 sess->mac = digest;
840
841 dstate->d_fd = get_dev_crypto();
842
843 if (ioctl(dstate->d_fd, CIOCGSESSION, sess) < 0) {
844 put_dev_crypto(dstate->d_fd);
845 dstate->d_fd = -1;
846 printf("cryptodev_digest_init: Open session failed\n");
847 return (0);
848 }
849
850 if (fstate->mac_len != 0) {
851 if (fstate->mac_data != NULL)
852 {
853 dstate->mac_data = OPENSSL_malloc(fstate->mac_len);
854 memcpy(dstate->mac_data, fstate->mac_data, fstate->mac_len);
855 dstate->mac_len = fstate->mac_len;
856 }
857 }
858
859 return 1;
860}
861
862
863const EVP_MD cryptodev_sha1 = {
864 NID_sha1,
865 NID_undef,
866 SHA_DIGEST_LENGTH,
867 EVP_MD_FLAG_ONESHOT,
868 cryptodev_digest_init,
869 cryptodev_digest_update,
870 cryptodev_digest_final,
871 cryptodev_digest_copy,
872 cryptodev_digest_cleanup,
873 EVP_PKEY_NULL_method,
874 SHA_CBLOCK,
875 sizeof(struct dev_crypto_state),
876};
877
878const EVP_MD cryptodev_md5 = {
879 NID_md5,
880 NID_undef,
881 16 /* MD5_DIGEST_LENGTH */,
882 EVP_MD_FLAG_ONESHOT,
883 cryptodev_digest_init,
884 cryptodev_digest_update,
885 cryptodev_digest_final,
886 cryptodev_digest_copy,
887 cryptodev_digest_cleanup,
888 EVP_PKEY_NULL_method,
889 64 /* MD5_CBLOCK */,
890 sizeof(struct dev_crypto_state),
891};
892
893#endif /* USE_CRYPTODEV_DIGESTS */
894
895
896static int
897cryptodev_engine_digests(ENGINE *e, const EVP_MD **digest,
898 const int **nids, int nid)
899{
900 if (!digest)
901 return (cryptodev_usable_digests(nids));
902
903 switch (nid) {
904#ifdef USE_CRYPTODEV_DIGESTS
905 case NID_md5:
906 *digest = &cryptodev_md5;
907 break;
908 case NID_sha1:
909 *digest = &cryptodev_sha1;
910 break;
911 default:
912#endif /* USE_CRYPTODEV_DIGESTS */
913 *digest = NULL;
914 break;
915 }
916 return (*digest != NULL);
917}
918
919/*
920 * Convert a BIGNUM to the representation that /dev/crypto needs.
921 * Upon completion of use, the caller is responsible for freeing
922 * crp->crp_p.
923 */
924static int
925bn2crparam(const BIGNUM *a, struct crparam *crp)
926{
927 int i, j, k;
928 ssize_t bytes, bits;
929 u_char *b;
930
931 crp->crp_p = NULL;
932 crp->crp_nbits = 0;
933
934 bits = BN_num_bits(a);
935 bytes = (bits + 7) / 8;
936
937 b = malloc(bytes);
938 if (b == NULL)
939 return (1);
940 memset(b, 0, bytes);
941
942 crp->crp_p = (caddr_t) b;
943 crp->crp_nbits = bits;
944
945 for (i = 0, j = 0; i < a->top; i++) {
946 for (k = 0; k < BN_BITS2 / 8; k++) {
947 if ((j + k) >= bytes)
948 return (0);
949 b[j + k] = a->d[i] >> (k * 8);
950 }
951 j += BN_BITS2 / 8;
952 }
953 return (0);
954}
955
956/* Convert a /dev/crypto parameter to a BIGNUM */
957static int
958crparam2bn(struct crparam *crp, BIGNUM *a)
959{
960 u_int8_t *pd;
961 int i, bytes;
962
963 bytes = (crp->crp_nbits + 7) / 8;
964
965 if (bytes == 0)
966 return (-1);
967
968 if ((pd = (u_int8_t *) malloc(bytes)) == NULL)
969 return (-1);
970
971 for (i = 0; i < bytes; i++)
972 pd[i] = crp->crp_p[bytes - i - 1];
973
974 BN_bin2bn(pd, bytes, a);
975 free(pd);
976
977 return (0);
978}
979
980static void
981zapparams(struct crypt_kop *kop)
982{
983 int i;
984
985 for (i = 0; i < kop->crk_iparams + kop->crk_oparams; i++) {
986 if (kop->crk_param[i].crp_p)
987 free(kop->crk_param[i].crp_p);
988 kop->crk_param[i].crp_p = NULL;
989 kop->crk_param[i].crp_nbits = 0;
990 }
991}
992
993static int
994cryptodev_asym(struct crypt_kop *kop, int rlen, BIGNUM *r, int slen, BIGNUM *s)
995{
996 int fd, ret = -1;
997
998 if ((fd = get_asym_dev_crypto()) < 0)
999 return (ret);
1000
1001 if (r) {
1002 kop->crk_param[kop->crk_iparams].crp_p = calloc(rlen, sizeof(char));
1003 kop->crk_param[kop->crk_iparams].crp_nbits = rlen * 8;
1004 kop->crk_oparams++;
1005 }
1006 if (s) {
1007 kop->crk_param[kop->crk_iparams+1].crp_p = calloc(slen, sizeof(char));
1008 kop->crk_param[kop->crk_iparams+1].crp_nbits = slen * 8;
1009 kop->crk_oparams++;
1010 }
1011
1012 if (ioctl(fd, CIOCKEY, kop) == 0) {
1013 if (r)
1014 crparam2bn(&kop->crk_param[kop->crk_iparams], r);
1015 if (s)
1016 crparam2bn(&kop->crk_param[kop->crk_iparams+1], s);
1017 ret = 0;
1018 }
1019
1020 return (ret);
1021}
1022
1023static int
1024cryptodev_bn_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
1025 const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *in_mont)
1026{
1027 struct crypt_kop kop;
1028 int ret = 1;
1029
1030 /* Currently, we know we can do mod exp iff we can do any
1031 * asymmetric operations at all.
1032 */
1033 if (cryptodev_asymfeat == 0) {
1034 ret = BN_mod_exp(r, a, p, m, ctx);
1035 return (ret);
1036 }
1037
1038 memset(&kop, 0, sizeof kop);
1039 kop.crk_op = CRK_MOD_EXP;
1040
1041 /* inputs: a^p % m */
1042 if (bn2crparam(a, &kop.crk_param[0]))
1043 goto err;
1044 if (bn2crparam(p, &kop.crk_param[1]))
1045 goto err;
1046 if (bn2crparam(m, &kop.crk_param[2]))
1047 goto err;
1048 kop.crk_iparams = 3;
1049
1050 if (cryptodev_asym(&kop, BN_num_bytes(m), r, 0, NULL)) {
1051 const RSA_METHOD *meth = RSA_PKCS1_SSLeay();
1052 printf("OCF asym process failed, Running in software\n");
1053 ret = meth->bn_mod_exp(r, a, p, m, ctx, in_mont);
1054
1055 } else if (ECANCELED == kop.crk_status) {
1056 const RSA_METHOD *meth = RSA_PKCS1_SSLeay();
1057 printf("OCF hardware operation cancelled. Running in Software\n");
1058 ret = meth->bn_mod_exp(r, a, p, m, ctx, in_mont);
1059 }
1060 /* else cryptodev operation worked ok ==> ret = 1*/
1061
1062err:
1063 zapparams(&kop);
1064 return (ret);
1065}
1066
1067static int
1068cryptodev_rsa_nocrt_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa, BN_CTX *ctx)
1069{
1070 int r;
1071 ctx = BN_CTX_new();
1072 r = cryptodev_bn_mod_exp(r0, I, rsa->d, rsa->n, ctx, NULL);
1073 BN_CTX_free(ctx);
1074 return (r);
1075}
1076
1077static int
1078cryptodev_rsa_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa, BN_CTX *ctx)
1079{
1080 struct crypt_kop kop;
1081 int ret = 1;
1082
1083 if (!rsa->p || !rsa->q || !rsa->dmp1 || !rsa->dmq1 || !rsa->iqmp) {
1084 /* XXX 0 means failure?? */
1085 return (0);
1086 }
1087
1088 memset(&kop, 0, sizeof kop);
1089 kop.crk_op = CRK_MOD_EXP_CRT;
1090 /* inputs: rsa->p rsa->q I rsa->dmp1 rsa->dmq1 rsa->iqmp */
1091 if (bn2crparam(rsa->p, &kop.crk_param[0]))
1092 goto err;
1093 if (bn2crparam(rsa->q, &kop.crk_param[1]))
1094 goto err;
1095 if (bn2crparam(I, &kop.crk_param[2]))
1096 goto err;
1097 if (bn2crparam(rsa->dmp1, &kop.crk_param[3]))
1098 goto err;
1099 if (bn2crparam(rsa->dmq1, &kop.crk_param[4]))
1100 goto err;
1101 if (bn2crparam(rsa->iqmp, &kop.crk_param[5]))
1102 goto err;
1103 kop.crk_iparams = 6;
1104
1105 if (cryptodev_asym(&kop, BN_num_bytes(rsa->n), r0, 0, NULL)) {
1106 const RSA_METHOD *meth = RSA_PKCS1_SSLeay();
1107 printf("OCF asym process failed, running in Software\n");
1108 ret = (*meth->rsa_mod_exp)(r0, I, rsa, ctx);
1109
1110 } else if (ECANCELED == kop.crk_status) {
1111 const RSA_METHOD *meth = RSA_PKCS1_SSLeay();
1112 printf("OCF hardware operation cancelled. Running in Software\n");
1113 ret = (*meth->rsa_mod_exp)(r0, I, rsa, ctx);
1114 }
1115 /* else cryptodev operation worked ok ==> ret = 1*/
1116
1117err:
1118 zapparams(&kop);
1119 return (ret);
1120}
1121
1122static RSA_METHOD cryptodev_rsa = {
1123 "cryptodev RSA method",
1124 NULL, /* rsa_pub_enc */
1125 NULL, /* rsa_pub_dec */
1126 NULL, /* rsa_priv_enc */
1127 NULL, /* rsa_priv_dec */
1128 NULL,
1129 NULL,
1130 NULL, /* init */
1131 NULL, /* finish */
1132 0, /* flags */
1133 NULL, /* app_data */
1134 NULL, /* rsa_sign */
1135 NULL /* rsa_verify */
1136};
1137
1138static int
1139cryptodev_dsa_bn_mod_exp(DSA *dsa, BIGNUM *r, BIGNUM *a, const BIGNUM *p,
1140 const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx)
1141{
1142 return (cryptodev_bn_mod_exp(r, a, p, m, ctx, m_ctx));
1143}
1144
1145static int
1146cryptodev_dsa_dsa_mod_exp(DSA *dsa, BIGNUM *t1, BIGNUM *g,
1147 BIGNUM *u1, BIGNUM *pub_key, BIGNUM *u2, BIGNUM *p,
1148 BN_CTX *ctx, BN_MONT_CTX *mont)
1149{
1150 BIGNUM t2;
1151 int ret = 0;
1152
1153 BN_init(&t2);
1154
1155 /* v = ( g^u1 * y^u2 mod p ) mod q */
1156 /* let t1 = g ^ u1 mod p */
1157 ret = 0;
1158
1159 if (!dsa->meth->bn_mod_exp(dsa,t1,dsa->g,u1,dsa->p,ctx,mont))
1160 goto err;
1161
1162 /* let t2 = y ^ u2 mod p */
1163 if (!dsa->meth->bn_mod_exp(dsa,&t2,dsa->pub_key,u2,dsa->p,ctx,mont))
1164 goto err;
1165 /* let u1 = t1 * t2 mod p */
1166 if (!BN_mod_mul(u1,t1,&t2,dsa->p,ctx))
1167 goto err;
1168
1169 BN_copy(t1,u1);
1170
1171 ret = 1;
1172err:
1173 BN_free(&t2);
1174 return(ret);
1175}
1176
1177static DSA_SIG *
1178cryptodev_dsa_do_sign(const unsigned char *dgst, int dlen, DSA *dsa)
1179{
1180 struct crypt_kop kop;
1181 BIGNUM *r = NULL, *s = NULL;
1182 DSA_SIG *dsaret = NULL;
1183
1184 if ((r = BN_new()) == NULL)
1185 goto err;
1186 if ((s = BN_new()) == NULL) {
1187 BN_free(r);
1188 goto err;
1189 }
1190
1191 memset(&kop, 0, sizeof kop);
1192 kop.crk_op = CRK_DSA_SIGN;
1193
1194 /* inputs: dgst dsa->p dsa->q dsa->g dsa->priv_key */
1195 kop.crk_param[0].crp_p = (caddr_t)dgst;
1196 kop.crk_param[0].crp_nbits = dlen * 8;
1197 if (bn2crparam(dsa->p, &kop.crk_param[1]))
1198 goto err;
1199 if (bn2crparam(dsa->q, &kop.crk_param[2]))
1200 goto err;
1201 if (bn2crparam(dsa->g, &kop.crk_param[3]))
1202 goto err;
1203 if (bn2crparam(dsa->priv_key, &kop.crk_param[4]))
1204 goto err;
1205 kop.crk_iparams = 5;
1206
1207 if (cryptodev_asym(&kop, BN_num_bytes(dsa->q), r,
1208 BN_num_bytes(dsa->q), s) == 0) {
1209 dsaret = DSA_SIG_new();
1210 dsaret->r = r;
1211 dsaret->s = s;
1212 } else {
1213 const DSA_METHOD *meth = DSA_OpenSSL();
1214 BN_free(r);
1215 BN_free(s);
1216 dsaret = (meth->dsa_do_sign)(dgst, dlen, dsa);
1217 }
1218err:
1219 kop.crk_param[0].crp_p = NULL;
1220 zapparams(&kop);
1221 return (dsaret);
1222}
1223
1224static int
1225cryptodev_dsa_verify(const unsigned char *dgst, int dlen,
1226 DSA_SIG *sig, DSA *dsa)
1227{
1228 struct crypt_kop kop;
1229 int dsaret = 1;
1230
1231 memset(&kop, 0, sizeof kop);
1232 kop.crk_op = CRK_DSA_VERIFY;
1233
1234 /* inputs: dgst dsa->p dsa->q dsa->g dsa->pub_key sig->r sig->s */
1235 kop.crk_param[0].crp_p = (caddr_t)dgst;
1236 kop.crk_param[0].crp_nbits = dlen * 8;
1237 if (bn2crparam(dsa->p, &kop.crk_param[1]))
1238 goto err;
1239 if (bn2crparam(dsa->q, &kop.crk_param[2]))
1240 goto err;
1241 if (bn2crparam(dsa->g, &kop.crk_param[3]))
1242 goto err;
1243 if (bn2crparam(dsa->pub_key, &kop.crk_param[4]))
1244 goto err;
1245 if (bn2crparam(sig->r, &kop.crk_param[5]))
1246 goto err;
1247 if (bn2crparam(sig->s, &kop.crk_param[6]))
1248 goto err;
1249 kop.crk_iparams = 7;
1250
1251 if (cryptodev_asym(&kop, 0, NULL, 0, NULL) == 0) {
1252/*OCF success value is 0, if not zero, change dsaret to fail*/
1253 if(0 != kop.crk_status) dsaret = 0;
1254 } else {
1255 const DSA_METHOD *meth = DSA_OpenSSL();
1256
1257 dsaret = (meth->dsa_do_verify)(dgst, dlen, sig, dsa);
1258 }
1259err:
1260 kop.crk_param[0].crp_p = NULL;
1261 zapparams(&kop);
1262 return (dsaret);
1263}
1264
1265static DSA_METHOD cryptodev_dsa = {
1266 "cryptodev DSA method",
1267 NULL,
1268 NULL, /* dsa_sign_setup */
1269 NULL,
1270 NULL, /* dsa_mod_exp */
1271 NULL,
1272 NULL, /* init */
1273 NULL, /* finish */
1274 0, /* flags */
1275 NULL /* app_data */
1276};
1277
1278static int
1279cryptodev_mod_exp_dh(const DH *dh, BIGNUM *r, const BIGNUM *a,
1280 const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx,
1281 BN_MONT_CTX *m_ctx)
1282{
1283 return (cryptodev_bn_mod_exp(r, a, p, m, ctx, m_ctx));
1284}
1285
1286static int
1287cryptodev_dh_compute_key(unsigned char *key, const BIGNUM *pub_key, DH *dh)
1288{
1289 struct crypt_kop kop;
1290 int dhret = 1;
1291 int fd, keylen;
1292
1293 if ((fd = get_asym_dev_crypto()) < 0) {
1294 const DH_METHOD *meth = DH_OpenSSL();
1295
1296 return ((meth->compute_key)(key, pub_key, dh));
1297 }
1298
1299 keylen = BN_num_bits(dh->p);
1300
1301 memset(&kop, 0, sizeof kop);
1302 kop.crk_op = CRK_DH_COMPUTE_KEY;
1303
1304 /* inputs: dh->priv_key pub_key dh->p key */
1305 if (bn2crparam(dh->priv_key, &kop.crk_param[0]))
1306 goto err;
1307 if (bn2crparam(pub_key, &kop.crk_param[1]))
1308 goto err;
1309 if (bn2crparam(dh->p, &kop.crk_param[2]))
1310 goto err;
1311 kop.crk_iparams = 3;
1312
1313 kop.crk_param[3].crp_p = (caddr_t) key;
1314 kop.crk_param[3].crp_nbits = keylen * 8;
1315 kop.crk_oparams = 1;
1316
1317 if (ioctl(fd, CIOCKEY, &kop) == -1) {
1318 const DH_METHOD *meth = DH_OpenSSL();
1319
1320 dhret = (meth->compute_key)(key, pub_key, dh);
1321 }
1322err:
1323 kop.crk_param[3].crp_p = NULL;
1324 zapparams(&kop);
1325 return (dhret);
1326}
1327
1328static DH_METHOD cryptodev_dh = {
1329 "cryptodev DH method",
1330 NULL, /* cryptodev_dh_generate_key */
1331 NULL,
1332 NULL,
1333 NULL,
1334 NULL,
1335 0, /* flags */
1336 NULL /* app_data */
1337};
1338
1339/*
1340 * ctrl right now is just a wrapper that doesn't do much
1341 * but I expect we'll want some options soon.
1342 */
1343static int
1344cryptodev_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f)(void))
1345{
1346#ifdef HAVE_SYSLOG_R
1347 struct syslog_data sd = SYSLOG_DATA_INIT;
1348#endif
1349
1350 switch (cmd) {
1351 default:
1352#ifdef HAVE_SYSLOG_R
1353 syslog_r(LOG_ERR, &sd,
1354 "cryptodev_ctrl: unknown command %d", cmd);
1355#else
1356 syslog(LOG_ERR, "cryptodev_ctrl: unknown command %d", cmd);
1357#endif
1358 break;
1359 }
1360 return (1);
1361}
1362
1363void
1364ENGINE_load_cryptodev(void)
1365{
1366 ENGINE *engine = ENGINE_new();
1367 int fd;
1368
1369 if (engine == NULL)
1370 return;
1371 if ((fd = get_dev_crypto()) < 0) {
1372 ENGINE_free(engine);
1373 return;
1374 }
1375
1376 /*
1377 * find out what asymmetric crypto algorithms we support
1378 */
1379 if (ioctl(fd, CIOCASYMFEAT, &cryptodev_asymfeat) == -1) {
1380 put_dev_crypto(fd);
1381 ENGINE_free(engine);
1382 return;
1383 }
1384 put_dev_crypto(fd);
1385
1386 if (!ENGINE_set_id(engine, "cryptodev") ||
1387 !ENGINE_set_name(engine, "BSD cryptodev engine") ||
1388 !ENGINE_set_ciphers(engine, cryptodev_engine_ciphers) ||
1389 !ENGINE_set_digests(engine, cryptodev_engine_digests) ||
1390 !ENGINE_set_ctrl_function(engine, cryptodev_ctrl) ||
1391 !ENGINE_set_cmd_defns(engine, cryptodev_defns)) {
1392 ENGINE_free(engine);
1393 return;
1394 }
1395
1396 if (ENGINE_set_RSA(engine, &cryptodev_rsa)) {
1397 const RSA_METHOD *rsa_meth = RSA_PKCS1_SSLeay();
1398
1399 cryptodev_rsa.bn_mod_exp = rsa_meth->bn_mod_exp;
1400 cryptodev_rsa.rsa_mod_exp = rsa_meth->rsa_mod_exp;
1401 cryptodev_rsa.rsa_pub_enc = rsa_meth->rsa_pub_enc;
1402 cryptodev_rsa.rsa_pub_dec = rsa_meth->rsa_pub_dec;
1403 cryptodev_rsa.rsa_priv_enc = rsa_meth->rsa_priv_enc;
1404 cryptodev_rsa.rsa_priv_dec = rsa_meth->rsa_priv_dec;
1405 if (cryptodev_asymfeat & CRF_MOD_EXP) {
1406 cryptodev_rsa.bn_mod_exp = cryptodev_bn_mod_exp;
1407 if (cryptodev_asymfeat & CRF_MOD_EXP_CRT)
1408 cryptodev_rsa.rsa_mod_exp =
1409 cryptodev_rsa_mod_exp;
1410 else
1411 cryptodev_rsa.rsa_mod_exp =
1412 cryptodev_rsa_nocrt_mod_exp;
1413 }
1414 }
1415
1416 if (ENGINE_set_DSA(engine, &cryptodev_dsa)) {
1417 const DSA_METHOD *meth = DSA_OpenSSL();
1418
1419 memcpy(&cryptodev_dsa, meth, sizeof(DSA_METHOD));
1420 if (cryptodev_asymfeat & CRF_DSA_SIGN)
1421 cryptodev_dsa.dsa_do_sign = cryptodev_dsa_do_sign;
1422 if (cryptodev_asymfeat & CRF_MOD_EXP) {
1423 cryptodev_dsa.bn_mod_exp = cryptodev_dsa_bn_mod_exp;
1424 cryptodev_dsa.dsa_mod_exp = cryptodev_dsa_dsa_mod_exp;
1425 }
1426 if (cryptodev_asymfeat & CRF_DSA_VERIFY)
1427 cryptodev_dsa.dsa_do_verify = cryptodev_dsa_verify;
1428 }
1429
1430 if (ENGINE_set_DH(engine, &cryptodev_dh)){
1431 const DH_METHOD *dh_meth = DH_OpenSSL();
1432
1433 cryptodev_dh.generate_key = dh_meth->generate_key;
1434 cryptodev_dh.compute_key = dh_meth->compute_key;
1435 cryptodev_dh.bn_mod_exp = dh_meth->bn_mod_exp;
1436 if (cryptodev_asymfeat & CRF_MOD_EXP) {
1437 cryptodev_dh.bn_mod_exp = cryptodev_mod_exp_dh;
1438 if (cryptodev_asymfeat & CRF_DH_COMPUTE_KEY)
1439 cryptodev_dh.compute_key =
1440 cryptodev_dh_compute_key;
1441 }
1442 }
1443
1444 ENGINE_add(engine);
1445 ENGINE_free(engine);
1446 ERR_clear_error();
1447}
1448
1449#endif /* HAVE_CRYPTODEV */
diff --git a/src/lib/libcrypto/engine/eng_list.c b/src/lib/libcrypto/engine/eng_list.c
index 95c858960b..27846edb1e 100644
--- a/src/lib/libcrypto/engine/eng_list.c
+++ b/src/lib/libcrypto/engine/eng_list.c
@@ -408,7 +408,6 @@ ENGINE *ENGINE_by_id(const char *id)
408 !ENGINE_ctrl_cmd_string(iterator, "DIR_LOAD", "2", 0) || 408 !ENGINE_ctrl_cmd_string(iterator, "DIR_LOAD", "2", 0) ||
409 !ENGINE_ctrl_cmd_string(iterator, "DIR_ADD", 409 !ENGINE_ctrl_cmd_string(iterator, "DIR_ADD",
410 load_dir, 0) || 410 load_dir, 0) ||
411 !ENGINE_ctrl_cmd_string(iterator, "LIST_ADD", "1", 0) ||
412 !ENGINE_ctrl_cmd_string(iterator, "LOAD", NULL, 0)) 411 !ENGINE_ctrl_cmd_string(iterator, "LOAD", NULL, 0))
413 goto notfound; 412 goto notfound;
414 return iterator; 413 return iterator;
diff --git a/src/lib/libcrypto/engine/eng_rdrand.c b/src/lib/libcrypto/engine/eng_rdrand.c
new file mode 100644
index 0000000000..4e9e91d54b
--- /dev/null
+++ b/src/lib/libcrypto/engine/eng_rdrand.c
@@ -0,0 +1,143 @@
1/* ====================================================================
2 * Copyright (c) 2011 The OpenSSL Project. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 *
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 *
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in
13 * the documentation and/or other materials provided with the
14 * distribution.
15 *
16 * 3. All advertising materials mentioning features or use of this
17 * software must display the following acknowledgment:
18 * "This product includes software developed by the OpenSSL Project
19 * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
20 *
21 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
22 * endorse or promote products derived from this software without
23 * prior written permission. For written permission, please contact
24 * licensing@OpenSSL.org.
25 *
26 * 5. Products derived from this software may not be called "OpenSSL"
27 * nor may "OpenSSL" appear in their names without prior written
28 * permission of the OpenSSL Project.
29 *
30 * 6. Redistributions of any form whatsoever must retain the following
31 * acknowledgment:
32 * "This product includes software developed by the OpenSSL Project
33 * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
34 *
35 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
36 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
37 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
38 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
39 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
40 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
41 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
42 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
43 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
44 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
45 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
46 * OF THE POSSIBILITY OF SUCH DAMAGE.
47 * ====================================================================
48 */
49
50#include <openssl/opensslconf.h>
51
52#include <stdio.h>
53#include <string.h>
54#include <openssl/engine.h>
55#include <openssl/rand.h>
56#include <openssl/err.h>
57
58#if (defined(__i386) || defined(__i386__) || defined(_M_IX86) || \
59 defined(__x86_64) || defined(__x86_64__) || \
60 defined(_M_AMD64) || defined (_M_X64)) && defined(OPENSSL_CPUID_OBJ)
61
62size_t OPENSSL_ia32_rdrand(void);
63
64static int get_random_bytes (unsigned char *buf, int num)
65 {
66 size_t rnd;
67
68 while (num>=(int)sizeof(size_t)) {
69 if ((rnd = OPENSSL_ia32_rdrand()) == 0) return 0;
70
71 *((size_t *)buf) = rnd;
72 buf += sizeof(size_t);
73 num -= sizeof(size_t);
74 }
75 if (num) {
76 if ((rnd = OPENSSL_ia32_rdrand()) == 0) return 0;
77
78 memcpy (buf,&rnd,num);
79 }
80
81 return 1;
82 }
83
84static int random_status (void)
85{ return 1; }
86
87static RAND_METHOD rdrand_meth =
88 {
89 NULL, /* seed */
90 get_random_bytes,
91 NULL, /* cleanup */
92 NULL, /* add */
93 get_random_bytes,
94 random_status,
95 };
96
97static int rdrand_init(ENGINE *e)
98{ return 1; }
99
100static const char *engine_e_rdrand_id = "rdrand";
101static const char *engine_e_rdrand_name = "Intel RDRAND engine";
102
103static int bind_helper(ENGINE *e)
104 {
105 if (!ENGINE_set_id(e, engine_e_rdrand_id) ||
106 !ENGINE_set_name(e, engine_e_rdrand_name) ||
107 !ENGINE_set_flags(e, ENGINE_FLAGS_NO_REGISTER_ALL) ||
108 !ENGINE_set_init_function(e, rdrand_init) ||
109 !ENGINE_set_RAND(e, &rdrand_meth) )
110 return 0;
111
112 return 1;
113 }
114
115static ENGINE *ENGINE_rdrand(void)
116 {
117 ENGINE *ret = ENGINE_new();
118 if(!ret)
119 return NULL;
120 if(!bind_helper(ret))
121 {
122 ENGINE_free(ret);
123 return NULL;
124 }
125 return ret;
126 }
127
128void ENGINE_load_rdrand (void)
129 {
130 extern unsigned int OPENSSL_ia32cap_P[];
131
132 if (OPENSSL_ia32cap_P[1] & (1<<(62-32)))
133 {
134 ENGINE *toadd = ENGINE_rdrand();
135 if(!toadd) return;
136 ENGINE_add(toadd);
137 ENGINE_free(toadd);
138 ERR_clear_error();
139 }
140 }
141#else
142void ENGINE_load_rdrand (void) {}
143#endif
diff --git a/src/lib/libcrypto/engine/eng_rsax.c b/src/lib/libcrypto/engine/eng_rsax.c
new file mode 100644
index 0000000000..96e63477ee
--- /dev/null
+++ b/src/lib/libcrypto/engine/eng_rsax.c
@@ -0,0 +1,668 @@
1/* crypto/engine/eng_rsax.c */
2/* Copyright (c) 2010-2010 Intel Corp.
3 * Author: Vinodh.Gopal@intel.com
4 * Jim Guilford
5 * Erdinc.Ozturk@intel.com
6 * Maxim.Perminov@intel.com
7 * Ying.Huang@intel.com
8 *
9 * More information about algorithm used can be found at:
10 * http://www.cse.buffalo.edu/srds2009/escs2009_submission_Gopal.pdf
11 */
12/* ====================================================================
13 * Copyright (c) 1999-2001 The OpenSSL Project. All rights reserved.
14 *
15 * Redistribution and use in source and binary forms, with or without
16 * modification, are permitted provided that the following conditions
17 * are met:
18 *
19 * 1. Redistributions of source code must retain the above copyright
20 * notice, this list of conditions and the following disclaimer.
21 *
22 * 2. Redistributions in binary form must reproduce the above copyright
23 * notice, this list of conditions and the following disclaimer in
24 * the documentation and/or other materials provided with the
25 * distribution.
26 *
27 * 3. All advertising materials mentioning features or use of this
28 * software must display the following acknowledgment:
29 * "This product includes software developed by the OpenSSL Project
30 * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
31 *
32 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
33 * endorse or promote products derived from this software without
34 * prior written permission. For written permission, please contact
35 * licensing@OpenSSL.org.
36 *
37 * 5. Products derived from this software may not be called "OpenSSL"
38 * nor may "OpenSSL" appear in their names without prior written
39 * permission of the OpenSSL Project.
40 *
41 * 6. Redistributions of any form whatsoever must retain the following
42 * acknowledgment:
43 * "This product includes software developed by the OpenSSL Project
44 * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
45 *
46 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
47 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
48 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
49 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
50 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
51 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
52 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
53 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
54 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
55 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
56 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
57 * OF THE POSSIBILITY OF SUCH DAMAGE.
58 * ====================================================================
59 *
60 * This product includes cryptographic software written by Eric Young
61 * (eay@cryptsoft.com). This product includes software written by Tim
62 * Hudson (tjh@cryptsoft.com).
63 */
64
65#include <openssl/opensslconf.h>
66
67#include <stdio.h>
68#include <string.h>
69#include <openssl/crypto.h>
70#include <openssl/buffer.h>
71#include <openssl/engine.h>
72#ifndef OPENSSL_NO_RSA
73#include <openssl/rsa.h>
74#endif
75#include <openssl/bn.h>
76#include <openssl/err.h>
77
78/* RSAX is available **ONLY* on x86_64 CPUs */
79#undef COMPILE_RSAX
80
81#if (defined(__x86_64) || defined(__x86_64__) || \
82 defined(_M_AMD64) || defined (_M_X64)) && !defined(OPENSSL_NO_ASM)
83#define COMPILE_RSAX
84static ENGINE *ENGINE_rsax (void);
85#endif
86
87void ENGINE_load_rsax (void)
88 {
89/* On non-x86 CPUs it just returns. */
90#ifdef COMPILE_RSAX
91 ENGINE *toadd = ENGINE_rsax();
92 if(!toadd) return;
93 ENGINE_add(toadd);
94 ENGINE_free(toadd);
95 ERR_clear_error();
96#endif
97 }
98
99#ifdef COMPILE_RSAX
100#define E_RSAX_LIB_NAME "rsax engine"
101
102static int e_rsax_destroy(ENGINE *e);
103static int e_rsax_init(ENGINE *e);
104static int e_rsax_finish(ENGINE *e);
105static int e_rsax_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f)(void));
106
107#ifndef OPENSSL_NO_RSA
108/* RSA stuff */
109static int e_rsax_rsa_mod_exp(BIGNUM *r, const BIGNUM *I, RSA *rsa, BN_CTX *ctx);
110static int e_rsax_rsa_finish(RSA *r);
111#endif
112
113static const ENGINE_CMD_DEFN e_rsax_cmd_defns[] = {
114 {0, NULL, NULL, 0}
115 };
116
117#ifndef OPENSSL_NO_RSA
118/* Our internal RSA_METHOD that we provide pointers to */
119static RSA_METHOD e_rsax_rsa =
120 {
121 "Intel RSA-X method",
122 NULL,
123 NULL,
124 NULL,
125 NULL,
126 e_rsax_rsa_mod_exp,
127 NULL,
128 NULL,
129 e_rsax_rsa_finish,
130 RSA_FLAG_CACHE_PUBLIC|RSA_FLAG_CACHE_PRIVATE,
131 NULL,
132 NULL,
133 NULL
134 };
135#endif
136
137/* Constants used when creating the ENGINE */
138static const char *engine_e_rsax_id = "rsax";
139static const char *engine_e_rsax_name = "RSAX engine support";
140
141/* This internal function is used by ENGINE_rsax() */
142static int bind_helper(ENGINE *e)
143 {
144#ifndef OPENSSL_NO_RSA
145 const RSA_METHOD *meth1;
146#endif
147 if(!ENGINE_set_id(e, engine_e_rsax_id) ||
148 !ENGINE_set_name(e, engine_e_rsax_name) ||
149#ifndef OPENSSL_NO_RSA
150 !ENGINE_set_RSA(e, &e_rsax_rsa) ||
151#endif
152 !ENGINE_set_destroy_function(e, e_rsax_destroy) ||
153 !ENGINE_set_init_function(e, e_rsax_init) ||
154 !ENGINE_set_finish_function(e, e_rsax_finish) ||
155 !ENGINE_set_ctrl_function(e, e_rsax_ctrl) ||
156 !ENGINE_set_cmd_defns(e, e_rsax_cmd_defns))
157 return 0;
158
159#ifndef OPENSSL_NO_RSA
160 meth1 = RSA_PKCS1_SSLeay();
161 e_rsax_rsa.rsa_pub_enc = meth1->rsa_pub_enc;
162 e_rsax_rsa.rsa_pub_dec = meth1->rsa_pub_dec;
163 e_rsax_rsa.rsa_priv_enc = meth1->rsa_priv_enc;
164 e_rsax_rsa.rsa_priv_dec = meth1->rsa_priv_dec;
165 e_rsax_rsa.bn_mod_exp = meth1->bn_mod_exp;
166#endif
167 return 1;
168 }
169
170static ENGINE *ENGINE_rsax(void)
171 {
172 ENGINE *ret = ENGINE_new();
173 if(!ret)
174 return NULL;
175 if(!bind_helper(ret))
176 {
177 ENGINE_free(ret);
178 return NULL;
179 }
180 return ret;
181 }
182
183#ifndef OPENSSL_NO_RSA
184/* Used to attach our own key-data to an RSA structure */
185static int rsax_ex_data_idx = -1;
186#endif
187
188static int e_rsax_destroy(ENGINE *e)
189 {
190 return 1;
191 }
192
193/* (de)initialisation functions. */
194static int e_rsax_init(ENGINE *e)
195 {
196#ifndef OPENSSL_NO_RSA
197 if (rsax_ex_data_idx == -1)
198 rsax_ex_data_idx = RSA_get_ex_new_index(0,
199 NULL,
200 NULL, NULL, NULL);
201#endif
202 if (rsax_ex_data_idx == -1)
203 return 0;
204 return 1;
205 }
206
207static int e_rsax_finish(ENGINE *e)
208 {
209 return 1;
210 }
211
212static int e_rsax_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f)(void))
213 {
214 int to_return = 1;
215
216 switch(cmd)
217 {
218 /* The command isn't understood by this engine */
219 default:
220 to_return = 0;
221 break;
222 }
223
224 return to_return;
225 }
226
227
228#ifndef OPENSSL_NO_RSA
229
230#ifdef _WIN32
231typedef unsigned __int64 UINT64;
232#else
233typedef unsigned long long UINT64;
234#endif
235typedef unsigned short UINT16;
236
237/* Table t is interleaved in the following manner:
238 * The order in memory is t[0][0], t[0][1], ..., t[0][7], t[1][0], ...
239 * A particular 512-bit value is stored in t[][index] rather than the more
240 * normal t[index][]; i.e. the qwords of a particular entry in t are not
241 * adjacent in memory
242 */
243
244/* Init BIGNUM b from the interleaved UINT64 array */
245static int interleaved_array_to_bn_512(BIGNUM* b, UINT64 *array);
246
247/* Extract array elements from BIGNUM b
248 * To set the whole array from b, call with n=8
249 */
250static int bn_extract_to_array_512(const BIGNUM* b, unsigned int n, UINT64 *array);
251
252struct mod_ctx_512 {
253 UINT64 t[8][8];
254 UINT64 m[8];
255 UINT64 m1[8]; /* 2^278 % m */
256 UINT64 m2[8]; /* 2^640 % m */
257 UINT64 k1[2]; /* (- 1/m) % 2^128 */
258};
259
260static int mod_exp_pre_compute_data_512(UINT64 *m, struct mod_ctx_512 *data);
261
262void mod_exp_512(UINT64 *result, /* 512 bits, 8 qwords */
263 UINT64 *g, /* 512 bits, 8 qwords */
264 UINT64 *exp, /* 512 bits, 8 qwords */
265 struct mod_ctx_512 *data);
266
267typedef struct st_e_rsax_mod_ctx
268{
269 UINT64 type;
270 union {
271 struct mod_ctx_512 b512;
272 } ctx;
273
274} E_RSAX_MOD_CTX;
275
276static E_RSAX_MOD_CTX *e_rsax_get_ctx(RSA *rsa, int idx, BIGNUM* m)
277{
278 E_RSAX_MOD_CTX *hptr;
279
280 if (idx < 0 || idx > 2)
281 return NULL;
282
283 hptr = RSA_get_ex_data(rsa, rsax_ex_data_idx);
284 if (!hptr) {
285 hptr = OPENSSL_malloc(3*sizeof(E_RSAX_MOD_CTX));
286 if (!hptr) return NULL;
287 hptr[2].type = hptr[1].type= hptr[0].type = 0;
288 RSA_set_ex_data(rsa, rsax_ex_data_idx, hptr);
289 }
290
291 if (hptr[idx].type == (UINT64)BN_num_bits(m))
292 return hptr+idx;
293
294 if (BN_num_bits(m) == 512) {
295 UINT64 _m[8];
296 bn_extract_to_array_512(m, 8, _m);
297 memset( &hptr[idx].ctx.b512, 0, sizeof(struct mod_ctx_512));
298 mod_exp_pre_compute_data_512(_m, &hptr[idx].ctx.b512);
299 }
300
301 hptr[idx].type = BN_num_bits(m);
302 return hptr+idx;
303}
304
305static int e_rsax_rsa_finish(RSA *rsa)
306 {
307 E_RSAX_MOD_CTX *hptr = RSA_get_ex_data(rsa, rsax_ex_data_idx);
308 if(hptr)
309 {
310 OPENSSL_free(hptr);
311 RSA_set_ex_data(rsa, rsax_ex_data_idx, NULL);
312 }
313 if (rsa->_method_mod_n)
314 BN_MONT_CTX_free(rsa->_method_mod_n);
315 if (rsa->_method_mod_p)
316 BN_MONT_CTX_free(rsa->_method_mod_p);
317 if (rsa->_method_mod_q)
318 BN_MONT_CTX_free(rsa->_method_mod_q);
319 return 1;
320 }
321
322
323static int e_rsax_bn_mod_exp(BIGNUM *r, const BIGNUM *g, const BIGNUM *e,
324 const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *in_mont, E_RSAX_MOD_CTX* rsax_mod_ctx )
325{
326 if (rsax_mod_ctx && BN_get_flags(e, BN_FLG_CONSTTIME) != 0) {
327 if (BN_num_bits(m) == 512) {
328 UINT64 _r[8];
329 UINT64 _g[8];
330 UINT64 _e[8];
331
332 /* Init the arrays from the BIGNUMs */
333 bn_extract_to_array_512(g, 8, _g);
334 bn_extract_to_array_512(e, 8, _e);
335
336 mod_exp_512(_r, _g, _e, &rsax_mod_ctx->ctx.b512);
337 /* Return the result in the BIGNUM */
338 interleaved_array_to_bn_512(r, _r);
339 return 1;
340 }
341 }
342
343 return BN_mod_exp_mont(r, g, e, m, ctx, in_mont);
344}
345
346/* Declares for the Intel CIAP 512-bit / CRT / 1024 bit RSA modular
347 * exponentiation routine precalculations and a structure to hold the
348 * necessary values. These files are meant to live in crypto/rsa/ in
349 * the target openssl.
350 */
351
352/*
353 * Local method: extracts a piece from a BIGNUM, to fit it into
354 * an array. Call with n=8 to extract an entire 512-bit BIGNUM
355 */
356static int bn_extract_to_array_512(const BIGNUM* b, unsigned int n, UINT64 *array)
357{
358 int i;
359 UINT64 tmp;
360 unsigned char bn_buff[64];
361 memset(bn_buff, 0, 64);
362 if (BN_num_bytes(b) > 64) {
363 printf ("Can't support this byte size\n");
364 return 0; }
365 if (BN_num_bytes(b)!=0) {
366 if (!BN_bn2bin(b, bn_buff+(64-BN_num_bytes(b)))) {
367 printf ("Error's in bn2bin\n");
368 /* We have to error, here */
369 return 0; } }
370 while (n-- > 0) {
371 array[n] = 0;
372 for (i=7; i>=0; i--) {
373 tmp = bn_buff[63-(n*8+i)];
374 array[n] |= tmp << (8*i); } }
375 return 1;
376}
377
378/* Init a 512-bit BIGNUM from the UINT64*_ (8 * 64) interleaved array */
379static int interleaved_array_to_bn_512(BIGNUM* b, UINT64 *array)
380{
381 unsigned char tmp[64];
382 int n=8;
383 int i;
384 while (n-- > 0) {
385 for (i = 7; i>=0; i--) {
386 tmp[63-(n*8+i)] = (unsigned char)(array[n]>>(8*i)); } }
387 BN_bin2bn(tmp, 64, b);
388 return 0;
389}
390
391
392/* The main 512bit precompute call */
393static int mod_exp_pre_compute_data_512(UINT64 *m, struct mod_ctx_512 *data)
394 {
395 BIGNUM two_768, two_640, two_128, two_512, tmp, _m, tmp2;
396
397 /* We need a BN_CTX for the modulo functions */
398 BN_CTX* ctx;
399 /* Some tmps */
400 UINT64 _t[8];
401 int i, j, ret = 0;
402
403 /* Init _m with m */
404 BN_init(&_m);
405 interleaved_array_to_bn_512(&_m, m);
406 memset(_t, 0, 64);
407
408 /* Inits */
409 BN_init(&two_768);
410 BN_init(&two_640);
411 BN_init(&two_128);
412 BN_init(&two_512);
413 BN_init(&tmp);
414 BN_init(&tmp2);
415
416 /* Create our context */
417 if ((ctx=BN_CTX_new()) == NULL) { goto err; }
418 BN_CTX_start(ctx);
419
420 /*
421 * For production, if you care, these only need to be set once,
422 * and may be made constants.
423 */
424 BN_lshift(&two_768, BN_value_one(), 768);
425 BN_lshift(&two_640, BN_value_one(), 640);
426 BN_lshift(&two_128, BN_value_one(), 128);
427 BN_lshift(&two_512, BN_value_one(), 512);
428
429 if (0 == (m[7] & 0x8000000000000000)) {
430 exit(1);
431 }
432 if (0 == (m[0] & 0x1)) { /* Odd modulus required for Mont */
433 exit(1);
434 }
435
436 /* Precompute m1 */
437 BN_mod(&tmp, &two_768, &_m, ctx);
438 if (!bn_extract_to_array_512(&tmp, 8, &data->m1[0])) {
439 goto err; }
440
441 /* Precompute m2 */
442 BN_mod(&tmp, &two_640, &_m, ctx);
443 if (!bn_extract_to_array_512(&tmp, 8, &data->m2[0])) {
444 goto err;
445 }
446
447 /*
448 * Precompute k1, a 128b number = ((-1)* m-1 ) mod 2128; k1 should
449 * be non-negative.
450 */
451 BN_mod_inverse(&tmp, &_m, &two_128, ctx);
452 if (!BN_is_zero(&tmp)) { BN_sub(&tmp, &two_128, &tmp); }
453 if (!bn_extract_to_array_512(&tmp, 2, &data->k1[0])) {
454 goto err; }
455
456 /* Precompute t */
457 for (i=0; i<8; i++) {
458 BN_zero(&tmp);
459 if (i & 1) { BN_add(&tmp, &two_512, &tmp); }
460 if (i & 2) { BN_add(&tmp, &two_512, &tmp); }
461 if (i & 4) { BN_add(&tmp, &two_640, &tmp); }
462
463 BN_nnmod(&tmp2, &tmp, &_m, ctx);
464 if (!bn_extract_to_array_512(&tmp2, 8, _t)) {
465 goto err; }
466 for (j=0; j<8; j++) data->t[j][i] = _t[j]; }
467
468 /* Precompute m */
469 for (i=0; i<8; i++) {
470 data->m[i] = m[i]; }
471
472 ret = 1;
473
474err:
475 /* Cleanup */
476 if (ctx != NULL) {
477 BN_CTX_end(ctx); BN_CTX_free(ctx); }
478 BN_free(&two_768);
479 BN_free(&two_640);
480 BN_free(&two_128);
481 BN_free(&two_512);
482 BN_free(&tmp);
483 BN_free(&tmp2);
484 BN_free(&_m);
485
486 return ret;
487}
488
489
490static int e_rsax_rsa_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa, BN_CTX *ctx)
491 {
492 BIGNUM *r1,*m1,*vrfy;
493 BIGNUM local_dmp1,local_dmq1,local_c,local_r1;
494 BIGNUM *dmp1,*dmq1,*c,*pr1;
495 int ret=0;
496
497 BN_CTX_start(ctx);
498 r1 = BN_CTX_get(ctx);
499 m1 = BN_CTX_get(ctx);
500 vrfy = BN_CTX_get(ctx);
501
502 {
503 BIGNUM local_p, local_q;
504 BIGNUM *p = NULL, *q = NULL;
505 int error = 0;
506
507 /* Make sure BN_mod_inverse in Montgomery
508 * intialization uses the BN_FLG_CONSTTIME flag
509 * (unless RSA_FLAG_NO_CONSTTIME is set)
510 */
511 if (!(rsa->flags & RSA_FLAG_NO_CONSTTIME))
512 {
513 BN_init(&local_p);
514 p = &local_p;
515 BN_with_flags(p, rsa->p, BN_FLG_CONSTTIME);
516
517 BN_init(&local_q);
518 q = &local_q;
519 BN_with_flags(q, rsa->q, BN_FLG_CONSTTIME);
520 }
521 else
522 {
523 p = rsa->p;
524 q = rsa->q;
525 }
526
527 if (rsa->flags & RSA_FLAG_CACHE_PRIVATE)
528 {
529 if (!BN_MONT_CTX_set_locked(&rsa->_method_mod_p, CRYPTO_LOCK_RSA, p, ctx))
530 error = 1;
531 if (!BN_MONT_CTX_set_locked(&rsa->_method_mod_q, CRYPTO_LOCK_RSA, q, ctx))
532 error = 1;
533 }
534
535 /* clean up */
536 if (!(rsa->flags & RSA_FLAG_NO_CONSTTIME))
537 {
538 BN_free(&local_p);
539 BN_free(&local_q);
540 }
541 if ( error )
542 goto err;
543 }
544
545 if (rsa->flags & RSA_FLAG_CACHE_PUBLIC)
546 if (!BN_MONT_CTX_set_locked(&rsa->_method_mod_n, CRYPTO_LOCK_RSA, rsa->n, ctx))
547 goto err;
548
549 /* compute I mod q */
550 if (!(rsa->flags & RSA_FLAG_NO_CONSTTIME))
551 {
552 c = &local_c;
553 BN_with_flags(c, I, BN_FLG_CONSTTIME);
554 if (!BN_mod(r1,c,rsa->q,ctx)) goto err;
555 }
556 else
557 {
558 if (!BN_mod(r1,I,rsa->q,ctx)) goto err;
559 }
560
561 /* compute r1^dmq1 mod q */
562 if (!(rsa->flags & RSA_FLAG_NO_CONSTTIME))
563 {
564 dmq1 = &local_dmq1;
565 BN_with_flags(dmq1, rsa->dmq1, BN_FLG_CONSTTIME);
566 }
567 else
568 dmq1 = rsa->dmq1;
569
570 if (!e_rsax_bn_mod_exp(m1,r1,dmq1,rsa->q,ctx,
571 rsa->_method_mod_q, e_rsax_get_ctx(rsa, 0, rsa->q) )) goto err;
572
573 /* compute I mod p */
574 if (!(rsa->flags & RSA_FLAG_NO_CONSTTIME))
575 {
576 c = &local_c;
577 BN_with_flags(c, I, BN_FLG_CONSTTIME);
578 if (!BN_mod(r1,c,rsa->p,ctx)) goto err;
579 }
580 else
581 {
582 if (!BN_mod(r1,I,rsa->p,ctx)) goto err;
583 }
584
585 /* compute r1^dmp1 mod p */
586 if (!(rsa->flags & RSA_FLAG_NO_CONSTTIME))
587 {
588 dmp1 = &local_dmp1;
589 BN_with_flags(dmp1, rsa->dmp1, BN_FLG_CONSTTIME);
590 }
591 else
592 dmp1 = rsa->dmp1;
593
594 if (!e_rsax_bn_mod_exp(r0,r1,dmp1,rsa->p,ctx,
595 rsa->_method_mod_p, e_rsax_get_ctx(rsa, 1, rsa->p) )) goto err;
596
597 if (!BN_sub(r0,r0,m1)) goto err;
598 /* This will help stop the size of r0 increasing, which does
599 * affect the multiply if it optimised for a power of 2 size */
600 if (BN_is_negative(r0))
601 if (!BN_add(r0,r0,rsa->p)) goto err;
602
603 if (!BN_mul(r1,r0,rsa->iqmp,ctx)) goto err;
604
605 /* Turn BN_FLG_CONSTTIME flag on before division operation */
606 if (!(rsa->flags & RSA_FLAG_NO_CONSTTIME))
607 {
608 pr1 = &local_r1;
609 BN_with_flags(pr1, r1, BN_FLG_CONSTTIME);
610 }
611 else
612 pr1 = r1;
613 if (!BN_mod(r0,pr1,rsa->p,ctx)) goto err;
614
615 /* If p < q it is occasionally possible for the correction of
616 * adding 'p' if r0 is negative above to leave the result still
617 * negative. This can break the private key operations: the following
618 * second correction should *always* correct this rare occurrence.
619 * This will *never* happen with OpenSSL generated keys because
620 * they ensure p > q [steve]
621 */
622 if (BN_is_negative(r0))
623 if (!BN_add(r0,r0,rsa->p)) goto err;
624 if (!BN_mul(r1,r0,rsa->q,ctx)) goto err;
625 if (!BN_add(r0,r1,m1)) goto err;
626
627 if (rsa->e && rsa->n)
628 {
629 if (!e_rsax_bn_mod_exp(vrfy,r0,rsa->e,rsa->n,ctx,rsa->_method_mod_n, e_rsax_get_ctx(rsa, 2, rsa->n) ))
630 goto err;
631
632 /* If 'I' was greater than (or equal to) rsa->n, the operation
633 * will be equivalent to using 'I mod n'. However, the result of
634 * the verify will *always* be less than 'n' so we don't check
635 * for absolute equality, just congruency. */
636 if (!BN_sub(vrfy, vrfy, I)) goto err;
637 if (!BN_mod(vrfy, vrfy, rsa->n, ctx)) goto err;
638 if (BN_is_negative(vrfy))
639 if (!BN_add(vrfy, vrfy, rsa->n)) goto err;
640 if (!BN_is_zero(vrfy))
641 {
642 /* 'I' and 'vrfy' aren't congruent mod n. Don't leak
643 * miscalculated CRT output, just do a raw (slower)
644 * mod_exp and return that instead. */
645
646 BIGNUM local_d;
647 BIGNUM *d = NULL;
648
649 if (!(rsa->flags & RSA_FLAG_NO_CONSTTIME))
650 {
651 d = &local_d;
652 BN_with_flags(d, rsa->d, BN_FLG_CONSTTIME);
653 }
654 else
655 d = rsa->d;
656 if (!e_rsax_bn_mod_exp(r0,I,d,rsa->n,ctx,
657 rsa->_method_mod_n, e_rsax_get_ctx(rsa, 2, rsa->n) )) goto err;
658 }
659 }
660 ret=1;
661
662err:
663 BN_CTX_end(ctx);
664
665 return ret;
666 }
667#endif /* !OPENSSL_NO_RSA */
668#endif /* !COMPILE_RSAX */
diff --git a/src/lib/libcrypto/engine/enginetest.c b/src/lib/libcrypto/engine/enginetest.c
new file mode 100644
index 0000000000..f4d70e7e0a
--- /dev/null
+++ b/src/lib/libcrypto/engine/enginetest.c
@@ -0,0 +1,283 @@
1/* crypto/engine/enginetest.c */
2/* Written by Geoff Thorpe (geoff@geoffthorpe.net) for the OpenSSL
3 * project 2000.
4 */
5/* ====================================================================
6 * Copyright (c) 1999-2001 The OpenSSL Project. All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 *
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 *
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in
17 * the documentation and/or other materials provided with the
18 * distribution.
19 *
20 * 3. All advertising materials mentioning features or use of this
21 * software must display the following acknowledgment:
22 * "This product includes software developed by the OpenSSL Project
23 * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
24 *
25 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
26 * endorse or promote products derived from this software without
27 * prior written permission. For written permission, please contact
28 * licensing@OpenSSL.org.
29 *
30 * 5. Products derived from this software may not be called "OpenSSL"
31 * nor may "OpenSSL" appear in their names without prior written
32 * permission of the OpenSSL Project.
33 *
34 * 6. Redistributions of any form whatsoever must retain the following
35 * acknowledgment:
36 * "This product includes software developed by the OpenSSL Project
37 * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
38 *
39 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
40 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
41 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
42 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
43 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
44 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
45 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
46 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
47 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
48 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
49 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50 * OF THE POSSIBILITY OF SUCH DAMAGE.
51 * ====================================================================
52 *
53 * This product includes cryptographic software written by Eric Young
54 * (eay@cryptsoft.com). This product includes software written by Tim
55 * Hudson (tjh@cryptsoft.com).
56 *
57 */
58
59#include <stdio.h>
60#include <string.h>
61#include <openssl/e_os2.h>
62
63#ifdef OPENSSL_NO_ENGINE
64int main(int argc, char *argv[])
65{
66 printf("No ENGINE support\n");
67 return(0);
68}
69#else
70#include <openssl/buffer.h>
71#include <openssl/crypto.h>
72#include <openssl/engine.h>
73#include <openssl/err.h>
74
75static void display_engine_list(void)
76 {
77 ENGINE *h;
78 int loop;
79
80 h = ENGINE_get_first();
81 loop = 0;
82 printf("listing available engine types\n");
83 while(h)
84 {
85 printf("engine %i, id = \"%s\", name = \"%s\"\n",
86 loop++, ENGINE_get_id(h), ENGINE_get_name(h));
87 h = ENGINE_get_next(h);
88 }
89 printf("end of list\n");
90 /* ENGINE_get_first() increases the struct_ref counter, so we
91 must call ENGINE_free() to decrease it again */
92 ENGINE_free(h);
93 }
94
95int main(int argc, char *argv[])
96 {
97 ENGINE *block[512];
98 char buf[256];
99 const char *id, *name;
100 ENGINE *ptr;
101 int loop;
102 int to_return = 1;
103 ENGINE *new_h1 = NULL;
104 ENGINE *new_h2 = NULL;
105 ENGINE *new_h3 = NULL;
106 ENGINE *new_h4 = NULL;
107
108 /* enable memory leak checking unless explicitly disabled */
109 if (!((getenv("OPENSSL_DEBUG_MEMORY") != NULL) && (0 == strcmp(getenv("OPENSSL_DEBUG_MEMORY"), "off"))))
110 {
111 CRYPTO_malloc_debug_init();
112 CRYPTO_set_mem_debug_options(V_CRYPTO_MDEBUG_ALL);
113 }
114 else
115 {
116 /* OPENSSL_DEBUG_MEMORY=off */
117 CRYPTO_set_mem_debug_functions(0, 0, 0, 0, 0);
118 }
119 CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON);
120 ERR_load_crypto_strings();
121
122 memset(block, 0, 512 * sizeof(ENGINE *));
123 if(((new_h1 = ENGINE_new()) == NULL) ||
124 !ENGINE_set_id(new_h1, "test_id0") ||
125 !ENGINE_set_name(new_h1, "First test item") ||
126 ((new_h2 = ENGINE_new()) == NULL) ||
127 !ENGINE_set_id(new_h2, "test_id1") ||
128 !ENGINE_set_name(new_h2, "Second test item") ||
129 ((new_h3 = ENGINE_new()) == NULL) ||
130 !ENGINE_set_id(new_h3, "test_id2") ||
131 !ENGINE_set_name(new_h3, "Third test item") ||
132 ((new_h4 = ENGINE_new()) == NULL) ||
133 !ENGINE_set_id(new_h4, "test_id3") ||
134 !ENGINE_set_name(new_h4, "Fourth test item"))
135 {
136 printf("Couldn't set up test ENGINE structures\n");
137 goto end;
138 }
139 printf("\nenginetest beginning\n\n");
140 display_engine_list();
141 if(!ENGINE_add(new_h1))
142 {
143 printf("Add failed!\n");
144 goto end;
145 }
146 display_engine_list();
147 ptr = ENGINE_get_first();
148 if(!ENGINE_remove(ptr))
149 {
150 printf("Remove failed!\n");
151 goto end;
152 }
153 if (ptr)
154 ENGINE_free(ptr);
155 display_engine_list();
156 if(!ENGINE_add(new_h3) || !ENGINE_add(new_h2))
157 {
158 printf("Add failed!\n");
159 goto end;
160 }
161 display_engine_list();
162 if(!ENGINE_remove(new_h2))
163 {
164 printf("Remove failed!\n");
165 goto end;
166 }
167 display_engine_list();
168 if(!ENGINE_add(new_h4))
169 {
170 printf("Add failed!\n");
171 goto end;
172 }
173 display_engine_list();
174 if(ENGINE_add(new_h3))
175 {
176 printf("Add *should* have failed but didn't!\n");
177 goto end;
178 }
179 else
180 printf("Add that should fail did.\n");
181 ERR_clear_error();
182 if(ENGINE_remove(new_h2))
183 {
184 printf("Remove *should* have failed but didn't!\n");
185 goto end;
186 }
187 else
188 printf("Remove that should fail did.\n");
189 ERR_clear_error();
190 if(!ENGINE_remove(new_h3))
191 {
192 printf("Remove failed!\n");
193 goto end;
194 }
195 display_engine_list();
196 if(!ENGINE_remove(new_h4))
197 {
198 printf("Remove failed!\n");
199 goto end;
200 }
201 display_engine_list();
202 /* Depending on whether there's any hardware support compiled
203 * in, this remove may be destined to fail. */
204 ptr = ENGINE_get_first();
205 if(ptr)
206 if(!ENGINE_remove(ptr))
207 printf("Remove failed!i - probably no hardware "
208 "support present.\n");
209 if (ptr)
210 ENGINE_free(ptr);
211 display_engine_list();
212 if(!ENGINE_add(new_h1) || !ENGINE_remove(new_h1))
213 {
214 printf("Couldn't add and remove to an empty list!\n");
215 goto end;
216 }
217 else
218 printf("Successfully added and removed to an empty list!\n");
219 printf("About to beef up the engine-type list\n");
220 for(loop = 0; loop < 512; loop++)
221 {
222 sprintf(buf, "id%i", loop);
223 id = BUF_strdup(buf);
224 sprintf(buf, "Fake engine type %i", loop);
225 name = BUF_strdup(buf);
226 if(((block[loop] = ENGINE_new()) == NULL) ||
227 !ENGINE_set_id(block[loop], id) ||
228 !ENGINE_set_name(block[loop], name))
229 {
230 printf("Couldn't create block of ENGINE structures.\n"
231 "I'll probably also core-dump now, damn.\n");
232 goto end;
233 }
234 }
235 for(loop = 0; loop < 512; loop++)
236 {
237 if(!ENGINE_add(block[loop]))
238 {
239 printf("\nAdding stopped at %i, (%s,%s)\n",
240 loop, ENGINE_get_id(block[loop]),
241 ENGINE_get_name(block[loop]));
242 goto cleanup_loop;
243 }
244 else
245 printf("."); fflush(stdout);
246 }
247cleanup_loop:
248 printf("\nAbout to empty the engine-type list\n");
249 while((ptr = ENGINE_get_first()) != NULL)
250 {
251 if(!ENGINE_remove(ptr))
252 {
253 printf("\nRemove failed!\n");
254 goto end;
255 }
256 ENGINE_free(ptr);
257 printf("."); fflush(stdout);
258 }
259 for(loop = 0; loop < 512; loop++)
260 {
261 OPENSSL_free((void *)ENGINE_get_id(block[loop]));
262 OPENSSL_free((void *)ENGINE_get_name(block[loop]));
263 }
264 printf("\nTests completed happily\n");
265 to_return = 0;
266end:
267 if(to_return)
268 ERR_print_errors_fp(stderr);
269 if(new_h1) ENGINE_free(new_h1);
270 if(new_h2) ENGINE_free(new_h2);
271 if(new_h3) ENGINE_free(new_h3);
272 if(new_h4) ENGINE_free(new_h4);
273 for(loop = 0; loop < 512; loop++)
274 if(block[loop])
275 ENGINE_free(block[loop]);
276 ENGINE_cleanup();
277 CRYPTO_cleanup_all_ex_data();
278 ERR_free_strings();
279 ERR_remove_thread_state(NULL);
280 CRYPTO_mem_leaks_fp(stderr);
281 return to_return;
282 }
283#endif
diff --git a/src/lib/libcrypto/engine/hw_cryptodev.c b/src/lib/libcrypto/engine/hw_cryptodev.c
new file mode 100644
index 0000000000..bc953872dd
--- /dev/null
+++ b/src/lib/libcrypto/engine/hw_cryptodev.c
@@ -0,0 +1,1367 @@
1/*
2 * Copyright (c) 2002-2004 Theo de Raadt
3 * Copyright (c) 2002 Bob Beck <beck@openbsd.org>
4 * Copyright (c) 2002 Markus Friedl
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 *
27 */
28
29#include <openssl/objects.h>
30#include <openssl/engine.h>
31#include <openssl/evp.h>
32
33#if (defined(__unix__) || defined(unix)) && !defined(USG)
34#include <sys/param.h>
35# if (OpenBSD >= 200112) || ((__FreeBSD_version >= 470101 && __FreeBSD_version < 500000) || __FreeBSD_version >= 500041)
36# define HAVE_CRYPTODEV
37# endif
38# if (OpenBSD >= 200110)
39# define HAVE_SYSLOG_R
40# endif
41#endif
42
43#ifndef HAVE_CRYPTODEV
44
45void
46ENGINE_load_cryptodev(void)
47{
48 /* This is a NOP on platforms without /dev/crypto */
49 return;
50}
51
52#else
53
54#include <sys/types.h>
55#include <crypto/cryptodev.h>
56#include <sys/ioctl.h>
57
58#include <errno.h>
59#include <fcntl.h>
60#include <limits.h>
61#include <stdarg.h>
62#include <stdio.h>
63#include <string.h>
64#include <syslog.h>
65#include <unistd.h>
66
67#if defined(__i386__) || defined(__amd64__)
68#include <sys/sysctl.h>
69#include <machine/cpu.h>
70#include <machine/specialreg.h>
71
72#include <ssl/aes.h>
73
74static int check_viac3aes(void);
75#endif
76
77#define CRYPTO_VIAC3_MAX 3
78
79struct dev_crypto_state {
80 struct session_op d_sess;
81 int d_fd;
82};
83
84struct dev_crypto_cipher {
85 int c_id;
86 int c_nid;
87 int c_ivmax;
88 int c_keylen;
89};
90
91static u_int32_t cryptodev_asymfeat = 0;
92
93static int get_asym_dev_crypto(void);
94static int open_dev_crypto(void);
95static int get_dev_crypto(void);
96static struct dev_crypto_cipher *cipher_nid_to_cryptodev(int nid);
97static int get_cryptodev_ciphers(const int **cnids);
98/*static int get_cryptodev_digests(const int **cnids);*/
99static int cryptodev_usable_ciphers(const int **nids);
100static int cryptodev_usable_digests(const int **nids);
101static int cryptodev_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
102 const unsigned char *in, size_t inl);
103static int cryptodev_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
104 const unsigned char *iv, int enc);
105static int cryptodev_cleanup(EVP_CIPHER_CTX *ctx);
106static int cryptodev_engine_ciphers(ENGINE *e, const EVP_CIPHER **cipher,
107 const int **nids, int nid);
108static int cryptodev_engine_digests(ENGINE *e, const EVP_MD **digest,
109 const int **nids, int nid);
110static int bn2crparam(const BIGNUM *a, struct crparam *crp);
111static int crparam2bn(struct crparam *crp, BIGNUM *a);
112static void zapparams(struct crypt_kop *kop);
113static int cryptodev_asym(struct crypt_kop *kop, int rlen, BIGNUM *r,
114 int slen, BIGNUM *s);
115
116static int cryptodev_bn_mod_exp(BIGNUM *r, const BIGNUM *a,
117 const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx);
118static int cryptodev_rsa_nocrt_mod_exp(BIGNUM *r0, const BIGNUM *I,
119 RSA *rsa, BN_CTX *ctx);
120static int cryptodev_rsa_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa,
121 BN_CTX *ctx);
122static int cryptodev_dsa_bn_mod_exp(DSA *dsa, BIGNUM *r, BIGNUM *a,
123 const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx);
124static int cryptodev_dsa_dsa_mod_exp(DSA *dsa, BIGNUM *t1, BIGNUM *g,
125 BIGNUM *u1, BIGNUM *pub_key, BIGNUM *u2, BIGNUM *p,
126 BN_CTX *ctx, BN_MONT_CTX *mont);
127static DSA_SIG *cryptodev_dsa_do_sign(const unsigned char *dgst,
128 int dlen, DSA *dsa);
129static int cryptodev_dsa_verify(const unsigned char *dgst, int dgst_len,
130 DSA_SIG *sig, DSA *dsa);
131static int cryptodev_mod_exp_dh(const DH *dh, BIGNUM *r, const BIGNUM *a,
132 const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx,
133 BN_MONT_CTX *m_ctx);
134static int cryptodev_dh_compute_key(unsigned char *key,
135 const BIGNUM *pub_key, DH *dh);
136static int cryptodev_ctrl(ENGINE *e, int cmd, long i, void *p,
137 void (*f)());
138void ENGINE_load_cryptodev(void);
139
140static const ENGINE_CMD_DEFN cryptodev_defns[] = {
141 { 0, NULL, NULL, 0 }
142};
143
144static struct dev_crypto_cipher ciphers[] = {
145 { CRYPTO_DES_CBC, NID_des_cbc, 8, 8, },
146 { CRYPTO_3DES_CBC, NID_des_ede3_cbc, 8, 24, },
147 { CRYPTO_AES_CBC, NID_aes_128_cbc, 16, 16, },
148 { CRYPTO_AES_CBC, NID_aes_192_cbc, 16, 24, },
149 { CRYPTO_AES_CBC, NID_aes_256_cbc, 16, 32, },
150 { CRYPTO_BLF_CBC, NID_bf_cbc, 8, 16, },
151 { CRYPTO_CAST_CBC, NID_cast5_cbc, 8, 16, },
152 { 0, NID_undef, 0, 0, },
153};
154
155#if 0 /* UNUSED */
156static struct {
157 int id;
158 int nid;
159} digests[] = {
160 { CRYPTO_SHA1_HMAC, NID_hmacWithSHA1, },
161 { CRYPTO_RIPEMD160_HMAC, NID_ripemd160, },
162 { CRYPTO_MD5_KPDK, NID_undef, },
163 { CRYPTO_SHA1_KPDK, NID_undef, },
164 { CRYPTO_MD5, NID_md5, },
165 { CRYPTO_SHA1, NID_undef, },
166 { 0, NID_undef, },
167};
168#endif
169
170/*
171 * Return a fd if /dev/crypto seems usable, -1 otherwise.
172 */
173static int
174open_dev_crypto(void)
175{
176 static int fd = -1;
177
178 if (fd == -1) {
179 if ((fd = open("/dev/crypto", O_RDWR, 0)) == -1)
180 return (-1);
181 /* close on exec */
182 if (fcntl(fd, F_SETFD, 1) == -1) {
183 close(fd);
184 fd = -1;
185 return (-1);
186 }
187 }
188 return (fd);
189}
190
191static int
192get_dev_crypto(void)
193{
194 int fd, retfd;
195
196 if ((fd = open_dev_crypto()) == -1)
197 return (-1);
198 if (ioctl(fd, CRIOGET, &retfd) == -1) {
199 close(fd);
200 return (-1);
201 }
202
203 /* close on exec */
204 if (fcntl(retfd, F_SETFD, 1) == -1) {
205 close(retfd);
206 return (-1);
207 }
208 return (retfd);
209}
210
211/* Caching version for asym operations */
212static int
213get_asym_dev_crypto(void)
214{
215 static int fd = -1;
216
217 if (fd == -1)
218 fd = get_dev_crypto();
219 return fd;
220}
221
222/* convert libcrypto nids to cryptodev */
223static struct dev_crypto_cipher *
224cipher_nid_to_cryptodev(int nid)
225{
226 int i;
227
228 for (i = 0; ciphers[i].c_id; i++)
229 if (ciphers[i].c_nid == nid)
230 return (&ciphers[i]);
231 return (NULL);
232}
233
234/*
235 * Find out what ciphers /dev/crypto will let us have a session for.
236 * XXX note, that some of these openssl doesn't deal with yet!
237 * returning them here is harmless, as long as we return NULL
238 * when asked for a handler in the cryptodev_engine_ciphers routine
239 */
240static int
241get_cryptodev_ciphers(const int **cnids)
242{
243 static int nids[CRYPTO_ALGORITHM_MAX + CRYPTO_VIAC3_MAX + 1];
244 struct session_op sess;
245 int fd, i, count = 0;
246
247 if ((fd = get_dev_crypto()) < 0) {
248 *cnids = NULL;
249 return (0);
250 }
251 memset(&sess, 0, sizeof(sess));
252 sess.key = (caddr_t)"123456781234567812345678";
253
254 for (i = 0; ciphers[i].c_id && count <= CRYPTO_ALGORITHM_MAX; i++) {
255 if (ciphers[i].c_nid == NID_undef)
256 continue;
257 sess.cipher = ciphers[i].c_id;
258 sess.keylen = ciphers[i].c_keylen;
259 sess.mac = 0;
260 if (ioctl(fd, CIOCGSESSION, &sess) != -1 &&
261 ioctl(fd, CIOCFSESSION, &sess.ses) != -1)
262 nids[count++] = ciphers[i].c_nid;
263 }
264 close(fd);
265
266#if defined(__i386__) || defined(__amd64__)
267 /*
268 * Always check for the VIA C3 AES instructions;
269 * even if /dev/crypto is disabled.
270 */
271 if (check_viac3aes() >= 1) {
272 int have_NID_aes_128_cbc = 0;
273 int have_NID_aes_192_cbc = 0;
274 int have_NID_aes_256_cbc = 0;
275
276 for (i = 0; i < count; i++) {
277 if (nids[i] == NID_aes_128_cbc)
278 have_NID_aes_128_cbc = 1;
279 if (nids[i] == NID_aes_192_cbc)
280 have_NID_aes_192_cbc = 1;
281 if (nids[i] == NID_aes_256_cbc)
282 have_NID_aes_256_cbc = 1;
283 }
284 if (!have_NID_aes_128_cbc)
285 nids[count++] = NID_aes_128_cbc;
286 if (!have_NID_aes_192_cbc)
287 nids[count++] = NID_aes_192_cbc;
288 if (!have_NID_aes_256_cbc)
289 nids[count++] = NID_aes_256_cbc;
290 }
291#endif
292
293 if (count > 0)
294 *cnids = nids;
295 else
296 *cnids = NULL;
297 return (count);
298}
299
300/*
301 * Find out what digests /dev/crypto will let us have a session for.
302 * XXX note, that some of these openssl doesn't deal with yet!
303 * returning them here is harmless, as long as we return NULL
304 * when asked for a handler in the cryptodev_engine_digests routine
305 */
306#if 0 /* UNUSED */
307static int
308get_cryptodev_digests(const int **cnids)
309{
310 static int nids[CRYPTO_ALGORITHM_MAX];
311 struct session_op sess;
312 int fd, i, count = 0;
313
314 if ((fd = get_dev_crypto()) < 0) {
315 *cnids = NULL;
316 return (0);
317 }
318 memset(&sess, 0, sizeof(sess));
319 for (i = 0; digests[i].id && count < CRYPTO_ALGORITHM_MAX; i++) {
320 if (digests[i].nid == NID_undef)
321 continue;
322 sess.mac = digests[i].id;
323 sess.cipher = 0;
324 if (ioctl(fd, CIOCGSESSION, &sess) != -1 &&
325 ioctl(fd, CIOCFSESSION, &sess.ses) != -1)
326 nids[count++] = digests[i].nid;
327 }
328 close(fd);
329
330 if (count > 0)
331 *cnids = nids;
332 else
333 *cnids = NULL;
334 return (count);
335}
336#endif
337
338/*
339 * Find the useable ciphers|digests from dev/crypto - this is the first
340 * thing called by the engine init crud which determines what it
341 * can use for ciphers from this engine. We want to return
342 * only what we can do, anythine else is handled by software.
343 *
344 * If we can't initialize the device to do anything useful for
345 * any reason, we want to return a NULL array, and 0 length,
346 * which forces everything to be done is software. By putting
347 * the initalization of the device in here, we ensure we can
348 * use this engine as the default, and if for whatever reason
349 * /dev/crypto won't do what we want it will just be done in
350 * software
351 *
352 * This can (should) be greatly expanded to perhaps take into
353 * account speed of the device, and what we want to do.
354 * (although the disabling of particular alg's could be controlled
355 * by the device driver with sysctl's.) - this is where we
356 * want most of the decisions made about what we actually want
357 * to use from /dev/crypto.
358 */
359static int
360cryptodev_usable_ciphers(const int **nids)
361{
362 return (get_cryptodev_ciphers(nids));
363}
364
365static int
366cryptodev_usable_digests(const int **nids)
367{
368 /*
369 * XXXX just disable all digests for now, because it sucks.
370 * we need a better way to decide this - i.e. I may not
371 * want digests on slow cards like hifn on fast machines,
372 * but might want them on slow or loaded machines, etc.
373 * will also want them when using crypto cards that don't
374 * suck moose gonads - would be nice to be able to decide something
375 * as reasonable default without having hackery that's card dependent.
376 * of course, the default should probably be just do everything,
377 * with perhaps a sysctl to turn algoritms off (or have them off
378 * by default) on cards that generally suck like the hifn.
379 */
380 *nids = NULL;
381 return (0);
382}
383
384static int
385cryptodev_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
386 const unsigned char *in, size_t inl)
387{
388 struct crypt_op cryp;
389 struct dev_crypto_state *state = ctx->cipher_data;
390 struct session_op *sess = &state->d_sess;
391 void *iiv;
392 unsigned char save_iv[EVP_MAX_IV_LENGTH];
393
394 if (state->d_fd < 0)
395 return (0);
396 if (!inl)
397 return (1);
398 if ((inl % ctx->cipher->block_size) != 0)
399 return (0);
400
401 memset(&cryp, 0, sizeof(cryp));
402
403 cryp.ses = sess->ses;
404 cryp.flags = 0;
405 cryp.len = inl;
406 cryp.src = (caddr_t) in;
407 cryp.dst = (caddr_t) out;
408 cryp.mac = 0;
409
410 cryp.op = ctx->encrypt ? COP_ENCRYPT : COP_DECRYPT;
411
412 if (ctx->cipher->iv_len) {
413 cryp.iv = (caddr_t) ctx->iv;
414 if (!ctx->encrypt) {
415 iiv = (void *) in + inl - ctx->cipher->iv_len;
416 memcpy(save_iv, iiv, ctx->cipher->iv_len);
417 }
418 } else
419 cryp.iv = NULL;
420
421 if (ioctl(state->d_fd, CIOCCRYPT, &cryp) == -1) {
422 /* XXX need better errror handling
423 * this can fail for a number of different reasons.
424 */
425 return (0);
426 }
427
428 if (ctx->cipher->iv_len) {
429 if (ctx->encrypt)
430 iiv = (void *) out + inl - ctx->cipher->iv_len;
431 else
432 iiv = save_iv;
433 memcpy(ctx->iv, iiv, ctx->cipher->iv_len);
434 }
435 return (1);
436}
437
438static int
439cryptodev_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
440 const unsigned char *iv, int enc)
441{
442 struct dev_crypto_state *state = ctx->cipher_data;
443 struct session_op *sess = &state->d_sess;
444 struct dev_crypto_cipher *cipher;
445
446 if ((cipher = cipher_nid_to_cryptodev(ctx->cipher->nid)) == NULL)
447 return (0);
448
449 if (ctx->cipher->iv_len > cipher->c_ivmax)
450 return (0);
451
452 if (ctx->key_len != cipher->c_keylen)
453 return (0);
454
455 memset(sess, 0, sizeof(struct session_op));
456
457 if ((state->d_fd = get_dev_crypto()) < 0)
458 return (0);
459
460 sess->key = (unsigned char *)key;
461 sess->keylen = ctx->key_len;
462 sess->cipher = cipher->c_id;
463
464 if (ioctl(state->d_fd, CIOCGSESSION, sess) == -1) {
465 close(state->d_fd);
466 state->d_fd = -1;
467 return (0);
468 }
469 return (1);
470}
471
472/*
473 * free anything we allocated earlier when initting a
474 * session, and close the session.
475 */
476static int
477cryptodev_cleanup(EVP_CIPHER_CTX *ctx)
478{
479 int ret = 0;
480 struct dev_crypto_state *state = ctx->cipher_data;
481 struct session_op *sess = &state->d_sess;
482
483 if (state->d_fd < 0)
484 return (0);
485
486 /* XXX if this ioctl fails, someting's wrong. the invoker
487 * may have called us with a bogus ctx, or we could
488 * have a device that for whatever reason just doesn't
489 * want to play ball - it's not clear what's right
490 * here - should this be an error? should it just
491 * increase a counter, hmm. For right now, we return
492 * 0 - I don't believe that to be "right". we could
493 * call the gorpy openssl lib error handlers that
494 * print messages to users of the library. hmm..
495 */
496
497 if (ioctl(state->d_fd, CIOCFSESSION, &sess->ses) == -1) {
498 ret = 0;
499 } else {
500 ret = 1;
501 }
502 close(state->d_fd);
503 state->d_fd = -1;
504
505 return (ret);
506}
507
508/*
509 * libcrypto EVP stuff - this is how we get wired to EVP so the engine
510 * gets called when libcrypto requests a cipher NID.
511 */
512
513/* DES CBC EVP */
514const EVP_CIPHER cryptodev_des_cbc = {
515 NID_des_cbc,
516 8, 8, 8,
517 EVP_CIPH_CBC_MODE,
518 cryptodev_init_key,
519 cryptodev_cipher,
520 cryptodev_cleanup,
521 sizeof(struct dev_crypto_state),
522 EVP_CIPHER_set_asn1_iv,
523 EVP_CIPHER_get_asn1_iv,
524 NULL
525};
526
527/* 3DES CBC EVP */
528const EVP_CIPHER cryptodev_3des_cbc = {
529 NID_des_ede3_cbc,
530 8, 24, 8,
531 EVP_CIPH_CBC_MODE,
532 cryptodev_init_key,
533 cryptodev_cipher,
534 cryptodev_cleanup,
535 sizeof(struct dev_crypto_state),
536 EVP_CIPHER_set_asn1_iv,
537 EVP_CIPHER_get_asn1_iv,
538 NULL
539};
540
541const EVP_CIPHER cryptodev_bf_cbc = {
542 NID_bf_cbc,
543 8, 16, 8,
544 EVP_CIPH_CBC_MODE,
545 cryptodev_init_key,
546 cryptodev_cipher,
547 cryptodev_cleanup,
548 sizeof(struct dev_crypto_state),
549 EVP_CIPHER_set_asn1_iv,
550 EVP_CIPHER_get_asn1_iv,
551 NULL
552};
553
554const EVP_CIPHER cryptodev_cast_cbc = {
555 NID_cast5_cbc,
556 8, 16, 8,
557 EVP_CIPH_CBC_MODE,
558 cryptodev_init_key,
559 cryptodev_cipher,
560 cryptodev_cleanup,
561 sizeof(struct dev_crypto_state),
562 EVP_CIPHER_set_asn1_iv,
563 EVP_CIPHER_get_asn1_iv,
564 NULL
565};
566
567EVP_CIPHER cryptodev_aes_128_cbc = {
568 NID_aes_128_cbc,
569 16, 16, 16,
570 EVP_CIPH_CBC_MODE,
571 cryptodev_init_key,
572 cryptodev_cipher,
573 cryptodev_cleanup,
574 sizeof(struct dev_crypto_state),
575 EVP_CIPHER_set_asn1_iv,
576 EVP_CIPHER_get_asn1_iv,
577 NULL
578};
579
580EVP_CIPHER cryptodev_aes_192_cbc = {
581 NID_aes_192_cbc,
582 16, 24, 16,
583 EVP_CIPH_CBC_MODE,
584 cryptodev_init_key,
585 cryptodev_cipher,
586 cryptodev_cleanup,
587 sizeof(struct dev_crypto_state),
588 EVP_CIPHER_set_asn1_iv,
589 EVP_CIPHER_get_asn1_iv,
590 NULL
591};
592
593EVP_CIPHER cryptodev_aes_256_cbc = {
594 NID_aes_256_cbc,
595 16, 32, 16,
596 EVP_CIPH_CBC_MODE,
597 cryptodev_init_key,
598 cryptodev_cipher,
599 cryptodev_cleanup,
600 sizeof(struct dev_crypto_state),
601 EVP_CIPHER_set_asn1_iv,
602 EVP_CIPHER_get_asn1_iv,
603 NULL
604};
605
606#if defined(__i386__) || defined(__amd64__)
607
608static inline void
609viac3_xcrypt_cbc(int *cw, const void *src, void *dst, void *key, int rep,
610 void *iv)
611{
612#ifdef notdef
613 printf("cw %p[%x %x %x %x] src %p dst %p key %p rep %x iv %p\n",
614 cw, cw[0], cw[1], cw[2], cw[3],
615 src, dst, key, rep, iv);
616#endif
617#if defined(__i386__)
618
619 /*
620 * Clear bit 30 of EFLAGS.
621 */
622 __asm __volatile("pushfl; popfl");
623
624 /*
625 * Cannot simply place key into "b" register, since the compiler
626 * -pic mode uses that register; so instead we must dance a little.
627 */
628 __asm __volatile("pushl %%ebx; movl %0, %%ebx; rep xcryptcbc; popl %%ebx" :
629 : "m" (key), "a" (iv), "c" (rep), "d" (cw), "S" (src), "D" (dst)
630 : "memory", "cc");
631#else
632
633 /*
634 * Clear bit 30 of EFLAGS.
635 */
636 __asm __volatile("pushfq; popfq");
637 __asm __volatile("rep xcryptcbc" :
638 : "b" (key), "a" (iv), "c" (rep), "d" (cw), "S" (src), "D" (dst)
639 : "memory", "cc");
640#endif
641
642}
643
644#define ISUNALIGNED(x) ((long)(x)) & 15
645#define DOALIGN(v) ((void *)(((long)(v) + 15) & ~15))
646
647static int
648xcrypt_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
649 const unsigned char *in, size_t inl)
650{
651 unsigned char *save_iv_store[EVP_MAX_IV_LENGTH + 15];
652 unsigned char *save_iv = DOALIGN(save_iv_store);
653 unsigned char *ivs_store[EVP_MAX_IV_LENGTH + 15];
654 unsigned char *ivs = DOALIGN(ivs_store);
655 void *iiv, *iv = NULL, *ivp = NULL;
656 const void *usein = in;
657 void *useout = out, *spare;
658 int cws[4 + 3], *cw = DOALIGN(cws);
659
660 if (!inl)
661 return (1);
662 if ((inl % ctx->cipher->block_size) != 0)
663 return (0);
664 if (inl > UINT_MAX)
665 return (0);
666
667 if (ISUNALIGNED(in) || ISUNALIGNED(out)) {
668 spare = malloc(inl);
669 if (spare == NULL)
670 return (0);
671
672 if (ISUNALIGNED(in)) {
673 bcopy(in, spare, inl);
674 usein = spare;
675 }
676 if (ISUNALIGNED(out))
677 useout = spare;
678 }
679
680 cw[0] = C3_CRYPT_CWLO_ALG_AES | C3_CRYPT_CWLO_KEYGEN_SW |
681 C3_CRYPT_CWLO_NORMAL;
682 cw[0] |= ctx->encrypt ? C3_CRYPT_CWLO_ENCRYPT : C3_CRYPT_CWLO_DECRYPT;
683 cw[1] = cw[2] = cw[3] = 0;
684
685 switch (ctx->key_len * 8) {
686 case 128:
687 cw[0] |= C3_CRYPT_CWLO_KEY128;
688 break;
689 case 192:
690 cw[0] |= C3_CRYPT_CWLO_KEY192;
691 break;
692 case 256:
693 cw[0] |= C3_CRYPT_CWLO_KEY256;
694 break;
695 }
696
697 if (ctx->cipher->iv_len) {
698 iv = (caddr_t) ctx->iv;
699 if (!ctx->encrypt) {
700 iiv = (void *) in + inl - ctx->cipher->iv_len;
701 memcpy(save_iv, iiv, ctx->cipher->iv_len);
702 }
703 }
704
705 ivp = iv;
706 if (ISUNALIGNED(iv)) {
707 bcopy(iv, ivs, ctx->cipher->iv_len);
708 ivp = ivs;
709 }
710
711 viac3_xcrypt_cbc(cw, usein, useout, ctx->cipher_data, inl / 16, ivp);
712
713 if (ISUNALIGNED(in) || ISUNALIGNED(out)) {
714 if (ISUNALIGNED(out))
715 bcopy(spare, out, inl);
716 free(spare);
717 }
718
719 if (ivp == ivs)
720 bcopy(ivp, iv, ctx->cipher->iv_len);
721
722 if (ctx->cipher->iv_len) {
723 if (ctx->encrypt)
724 iiv = (void *) out + inl - ctx->cipher->iv_len;
725 else
726 iiv = save_iv;
727 memcpy(ctx->iv, iiv, ctx->cipher->iv_len);
728 }
729 return (1);
730}
731
732static int
733xcrypt_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
734 const unsigned char *iv, int enc)
735{
736 AES_KEY *k = ctx->cipher_data;
737#ifndef AES_ASM
738 int i;
739#endif
740
741 bzero(k, sizeof *k);
742 if (enc)
743 AES_set_encrypt_key(key, ctx->key_len * 8, k);
744 else
745 AES_set_decrypt_key(key, ctx->key_len * 8, k);
746
747#ifndef AES_ASM
748 /*
749 * XXX Damn OpenSSL byte swaps the expanded key!!
750 *
751 * XXX But only if we're using the C implementation of AES
752 */
753 for (i = 0; i < 4 * (AES_MAXNR + 1); i++)
754 k->rd_key[i] = htonl(k->rd_key[i]);
755#endif
756
757 return (1);
758}
759
760static int
761xcrypt_cleanup(EVP_CIPHER_CTX *ctx)
762{
763 bzero(ctx->cipher_data, ctx->cipher->ctx_size);
764 return (1);
765}
766
767static int
768check_viac3aes(void)
769{
770 int mib[2] = { CTL_MACHDEP, CPU_XCRYPT }, value;
771 size_t size = sizeof(value);
772
773 if (sysctl(mib, sizeof(mib)/sizeof(mib[0]), &value, &size,
774 NULL, 0) < 0)
775 return (0);
776 if (value == 0)
777 return (0);
778
779 if (value & C3_HAS_AES) {
780 cryptodev_aes_128_cbc.init = xcrypt_init_key;
781 cryptodev_aes_128_cbc.do_cipher = xcrypt_cipher;
782 cryptodev_aes_128_cbc.cleanup = xcrypt_cleanup;
783 cryptodev_aes_128_cbc.ctx_size = sizeof(AES_KEY);
784
785 cryptodev_aes_192_cbc.init = xcrypt_init_key;
786 cryptodev_aes_192_cbc.do_cipher = xcrypt_cipher;
787 cryptodev_aes_192_cbc.cleanup = xcrypt_cleanup;
788 cryptodev_aes_192_cbc.ctx_size = sizeof(AES_KEY);
789
790 cryptodev_aes_256_cbc.init = xcrypt_init_key;
791 cryptodev_aes_256_cbc.do_cipher = xcrypt_cipher;
792 cryptodev_aes_256_cbc.cleanup = xcrypt_cleanup;
793 cryptodev_aes_256_cbc.ctx_size = sizeof(AES_KEY);
794 }
795 return (value);
796}
797#endif /* __i386__ || __amd64__ */
798
799/*
800 * Registered by the ENGINE when used to find out how to deal with
801 * a particular NID in the ENGINE. this says what we'll do at the
802 * top level - note, that list is restricted by what we answer with
803 */
804static int
805cryptodev_engine_ciphers(ENGINE *e, const EVP_CIPHER **cipher,
806 const int **nids, int nid)
807{
808 if (!cipher)
809 return (cryptodev_usable_ciphers(nids));
810
811 switch (nid) {
812 case NID_des_ede3_cbc:
813 *cipher = &cryptodev_3des_cbc;
814 break;
815 case NID_des_cbc:
816 *cipher = &cryptodev_des_cbc;
817 break;
818 case NID_bf_cbc:
819 *cipher = &cryptodev_bf_cbc;
820 break;
821 case NID_cast5_cbc:
822 *cipher = &cryptodev_cast_cbc;
823 break;
824 case NID_aes_128_cbc:
825 *cipher = &cryptodev_aes_128_cbc;
826 break;
827 case NID_aes_192_cbc:
828 *cipher = &cryptodev_aes_192_cbc;
829 break;
830 case NID_aes_256_cbc:
831 *cipher = &cryptodev_aes_256_cbc;
832 break;
833 default:
834 *cipher = NULL;
835 break;
836 }
837 return (*cipher != NULL);
838}
839
840static int
841cryptodev_engine_digests(ENGINE *e, const EVP_MD **digest,
842 const int **nids, int nid)
843{
844 if (!digest)
845 return (cryptodev_usable_digests(nids));
846
847 switch (nid) {
848 case NID_md5:
849 *digest = NULL; /* need to make a clean md5 critter */
850 break;
851 default:
852 *digest = NULL;
853 break;
854 }
855 return (*digest != NULL);
856}
857
858/*
859 * Convert a BIGNUM to the representation that /dev/crypto needs.
860 * Upon completion of use, the caller is responsible for freeing
861 * crp->crp_p.
862 */
863static int
864bn2crparam(const BIGNUM *a, struct crparam *crp)
865{
866 int i, j, k;
867 ssize_t bytes, bits;
868 u_char *b;
869
870 crp->crp_p = NULL;
871 crp->crp_nbits = 0;
872
873 bits = BN_num_bits(a);
874 bytes = (bits + 7) / 8;
875
876 b = malloc(bytes);
877 if (b == NULL)
878 return (1);
879
880 crp->crp_p = b;
881 crp->crp_nbits = bits;
882
883 for (i = 0, j = 0; i < a->top; i++) {
884 for (k = 0; k < BN_BITS2 / 8; k++) {
885 if ((j + k) >= bytes)
886 return (0);
887 b[j + k] = a->d[i] >> (k * 8);
888 }
889 j += BN_BITS2 / 8;
890 }
891 return (0);
892}
893
894/* Convert a /dev/crypto parameter to a BIGNUM */
895static int
896crparam2bn(struct crparam *crp, BIGNUM *a)
897{
898 u_int8_t *pd;
899 int i, bytes;
900
901 bytes = (crp->crp_nbits + 7) / 8;
902
903 if (bytes == 0)
904 return (-1);
905
906 if ((pd = (u_int8_t *) malloc(bytes)) == NULL)
907 return (-1);
908
909 for (i = 0; i < bytes; i++)
910 pd[i] = crp->crp_p[bytes - i - 1];
911
912 BN_bin2bn(pd, bytes, a);
913 free(pd);
914
915 return (0);
916}
917
918static void
919zapparams(struct crypt_kop *kop)
920{
921 int i;
922
923 for (i = 0; i <= kop->crk_iparams + kop->crk_oparams; i++) {
924 if (kop->crk_param[i].crp_p)
925 free(kop->crk_param[i].crp_p);
926 kop->crk_param[i].crp_p = NULL;
927 kop->crk_param[i].crp_nbits = 0;
928 }
929}
930
931static int
932cryptodev_asym(struct crypt_kop *kop, int rlen, BIGNUM *r, int slen, BIGNUM *s)
933{
934 int fd, ret = -1;
935
936 if ((fd = get_asym_dev_crypto()) < 0)
937 return (ret);
938
939 if (r) {
940 kop->crk_param[kop->crk_iparams].crp_p = calloc(rlen, sizeof(char));
941 kop->crk_param[kop->crk_iparams].crp_nbits = rlen * 8;
942 kop->crk_oparams++;
943 }
944 if (s) {
945 kop->crk_param[kop->crk_iparams+1].crp_p = calloc(slen, sizeof(char));
946 kop->crk_param[kop->crk_iparams+1].crp_nbits = slen * 8;
947 kop->crk_oparams++;
948 }
949
950 if (ioctl(fd, CIOCKEY, kop) == 0) {
951 if (r)
952 crparam2bn(&kop->crk_param[kop->crk_iparams], r);
953 if (s)
954 crparam2bn(&kop->crk_param[kop->crk_iparams+1], s);
955 ret = 0;
956 }
957
958 return (ret);
959}
960
961static int
962cryptodev_bn_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
963 const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *in_mont)
964{
965 struct crypt_kop kop;
966 int ret = 1;
967
968 /* Currently, we know we can do mod exp iff we can do any
969 * asymmetric operations at all.
970 */
971 if (cryptodev_asymfeat == 0) {
972 ret = BN_mod_exp(r, a, p, m, ctx);
973 return (ret);
974 }
975
976 memset(&kop, 0, sizeof kop);
977 kop.crk_op = CRK_MOD_EXP;
978
979 /* inputs: a^p % m */
980 if (bn2crparam(a, &kop.crk_param[0]))
981 goto err;
982 if (bn2crparam(p, &kop.crk_param[1]))
983 goto err;
984 if (bn2crparam(m, &kop.crk_param[2]))
985 goto err;
986 kop.crk_iparams = 3;
987
988 if (cryptodev_asym(&kop, BN_num_bytes(m), r, 0, NULL) == -1) {
989 const RSA_METHOD *meth = RSA_PKCS1_SSLeay();
990 ret = meth->bn_mod_exp(r, a, p, m, ctx, in_mont);
991 }
992err:
993 zapparams(&kop);
994 return (ret);
995}
996
997static int
998cryptodev_rsa_nocrt_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa,
999 BN_CTX *ctx)
1000{
1001 return (RSA_PKCS1_SSLeay()->rsa_mod_exp)(r0, I, rsa, ctx);
1002}
1003
1004static int
1005cryptodev_rsa_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa, BN_CTX *ctx)
1006{
1007 struct crypt_kop kop;
1008 int ret = 1;
1009
1010 if (!rsa->p || !rsa->q || !rsa->dmp1 || !rsa->dmq1 || !rsa->iqmp) {
1011 /* XXX 0 means failure?? */
1012 return (0);
1013 }
1014
1015 memset(&kop, 0, sizeof kop);
1016 kop.crk_op = CRK_MOD_EXP_CRT;
1017 /* inputs: rsa->p rsa->q I rsa->dmp1 rsa->dmq1 rsa->iqmp */
1018 if (bn2crparam(rsa->p, &kop.crk_param[0]))
1019 goto err;
1020 if (bn2crparam(rsa->q, &kop.crk_param[1]))
1021 goto err;
1022 if (bn2crparam(I, &kop.crk_param[2]))
1023 goto err;
1024 if (bn2crparam(rsa->dmp1, &kop.crk_param[3]))
1025 goto err;
1026 if (bn2crparam(rsa->dmq1, &kop.crk_param[4]))
1027 goto err;
1028 if (bn2crparam(rsa->iqmp, &kop.crk_param[5]))
1029 goto err;
1030 kop.crk_iparams = 6;
1031
1032 if (cryptodev_asym(&kop, BN_num_bytes(rsa->n), r0, 0, NULL) == -1) {
1033 const RSA_METHOD *meth = RSA_PKCS1_SSLeay();
1034 ret = (*meth->rsa_mod_exp)(r0, I, rsa, ctx);
1035 }
1036err:
1037 zapparams(&kop);
1038 return (ret);
1039}
1040
1041static RSA_METHOD cryptodev_rsa = {
1042 "cryptodev RSA method",
1043 NULL, /* rsa_pub_enc */
1044 NULL, /* rsa_pub_dec */
1045 NULL, /* rsa_priv_enc */
1046 NULL, /* rsa_priv_dec */
1047 NULL,
1048 NULL,
1049 NULL, /* init */
1050 NULL, /* finish */
1051 0, /* flags */
1052 NULL, /* app_data */
1053 NULL, /* rsa_sign */
1054 NULL /* rsa_verify */
1055};
1056
1057static int
1058cryptodev_dsa_bn_mod_exp(DSA *dsa, BIGNUM *r, BIGNUM *a, const BIGNUM *p,
1059 const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx)
1060{
1061 return (cryptodev_bn_mod_exp(r, a, p, m, ctx, m_ctx));
1062}
1063
1064static int
1065cryptodev_dsa_dsa_mod_exp(DSA *dsa, BIGNUM *t1, BIGNUM *g,
1066 BIGNUM *u1, BIGNUM *pub_key, BIGNUM *u2, BIGNUM *p,
1067 BN_CTX *ctx, BN_MONT_CTX *mont)
1068{
1069 BIGNUM t2;
1070 int ret = 0;
1071
1072 BN_init(&t2);
1073
1074 /* v = ( g^u1 * y^u2 mod p ) mod q */
1075 /* let t1 = g ^ u1 mod p */
1076 ret = 0;
1077
1078 if (!dsa->meth->bn_mod_exp(dsa,t1,dsa->g,u1,dsa->p,ctx,mont))
1079 goto err;
1080
1081 /* let t2 = y ^ u2 mod p */
1082 if (!dsa->meth->bn_mod_exp(dsa,&t2,dsa->pub_key,u2,dsa->p,ctx,mont))
1083 goto err;
1084 /* let u1 = t1 * t2 mod p */
1085 if (!BN_mod_mul(u1,t1,&t2,dsa->p,ctx))
1086 goto err;
1087
1088 BN_copy(t1,u1);
1089
1090 ret = 1;
1091err:
1092 BN_free(&t2);
1093 return(ret);
1094}
1095
1096static DSA_SIG *
1097cryptodev_dsa_do_sign(const unsigned char *dgst, int dlen, DSA *dsa)
1098{
1099 struct crypt_kop kop;
1100 BIGNUM *r = NULL, *s = NULL;
1101 DSA_SIG *dsaret = NULL;
1102
1103 if ((r = BN_new()) == NULL)
1104 goto err;
1105 if ((s = BN_new()) == NULL) {
1106 BN_free(r);
1107 goto err;
1108 }
1109
1110 memset(&kop, 0, sizeof kop);
1111 kop.crk_op = CRK_DSA_SIGN;
1112
1113 /* inputs: dgst dsa->p dsa->q dsa->g dsa->priv_key */
1114 kop.crk_param[0].crp_p = (caddr_t)dgst;
1115 kop.crk_param[0].crp_nbits = dlen * 8;
1116 if (bn2crparam(dsa->p, &kop.crk_param[1]))
1117 goto err;
1118 if (bn2crparam(dsa->q, &kop.crk_param[2]))
1119 goto err;
1120 if (bn2crparam(dsa->g, &kop.crk_param[3]))
1121 goto err;
1122 if (bn2crparam(dsa->priv_key, &kop.crk_param[4]))
1123 goto err;
1124 kop.crk_iparams = 5;
1125
1126 if (cryptodev_asym(&kop, BN_num_bytes(dsa->q), r,
1127 BN_num_bytes(dsa->q), s) == 0) {
1128 dsaret = DSA_SIG_new();
1129 dsaret->r = r;
1130 dsaret->s = s;
1131 } else {
1132 const DSA_METHOD *meth = DSA_OpenSSL();
1133 BN_free(r);
1134 BN_free(s);
1135 dsaret = (meth->dsa_do_sign)(dgst, dlen, dsa);
1136 }
1137err:
1138 kop.crk_param[0].crp_p = NULL;
1139 zapparams(&kop);
1140 return (dsaret);
1141}
1142
1143static int
1144cryptodev_dsa_verify(const unsigned char *dgst, int dlen,
1145 DSA_SIG *sig, DSA *dsa)
1146{
1147 struct crypt_kop kop;
1148 int dsaret = 1;
1149
1150 memset(&kop, 0, sizeof kop);
1151 kop.crk_op = CRK_DSA_VERIFY;
1152
1153 /* inputs: dgst dsa->p dsa->q dsa->g dsa->pub_key sig->r sig->s */
1154 kop.crk_param[0].crp_p = (caddr_t)dgst;
1155 kop.crk_param[0].crp_nbits = dlen * 8;
1156 if (bn2crparam(dsa->p, &kop.crk_param[1]))
1157 goto err;
1158 if (bn2crparam(dsa->q, &kop.crk_param[2]))
1159 goto err;
1160 if (bn2crparam(dsa->g, &kop.crk_param[3]))
1161 goto err;
1162 if (bn2crparam(dsa->pub_key, &kop.crk_param[4]))
1163 goto err;
1164 if (bn2crparam(sig->r, &kop.crk_param[5]))
1165 goto err;
1166 if (bn2crparam(sig->s, &kop.crk_param[6]))
1167 goto err;
1168 kop.crk_iparams = 7;
1169
1170 if (cryptodev_asym(&kop, 0, NULL, 0, NULL) == 0) {
1171 dsaret = kop.crk_status;
1172 } else {
1173 const DSA_METHOD *meth = DSA_OpenSSL();
1174
1175 dsaret = (meth->dsa_do_verify)(dgst, dlen, sig, dsa);
1176 }
1177err:
1178 kop.crk_param[0].crp_p = NULL;
1179 zapparams(&kop);
1180 return (dsaret);
1181}
1182
1183static DSA_METHOD cryptodev_dsa = {
1184 "cryptodev DSA method",
1185 NULL,
1186 NULL, /* dsa_sign_setup */
1187 NULL,
1188 NULL, /* dsa_mod_exp */
1189 NULL,
1190 NULL, /* init */
1191 NULL, /* finish */
1192 0, /* flags */
1193 NULL /* app_data */
1194};
1195
1196static int
1197cryptodev_mod_exp_dh(const DH *dh, BIGNUM *r, const BIGNUM *a,
1198 const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx,
1199 BN_MONT_CTX *m_ctx)
1200{
1201 return (cryptodev_bn_mod_exp(r, a, p, m, ctx, m_ctx));
1202}
1203
1204static int
1205cryptodev_dh_compute_key(unsigned char *key, const BIGNUM *pub_key, DH *dh)
1206{
1207 struct crypt_kop kop;
1208 int dhret = 1;
1209 int fd, keylen;
1210
1211 if ((fd = get_asym_dev_crypto()) < 0) {
1212 const DH_METHOD *meth = DH_OpenSSL();
1213
1214 return ((meth->compute_key)(key, pub_key, dh));
1215 }
1216
1217 keylen = BN_num_bits(dh->p);
1218
1219 memset(&kop, 0, sizeof kop);
1220 kop.crk_op = CRK_DH_COMPUTE_KEY;
1221
1222 /* inputs: dh->priv_key pub_key dh->p key */
1223 if (bn2crparam(dh->priv_key, &kop.crk_param[0]))
1224 goto err;
1225 if (bn2crparam(pub_key, &kop.crk_param[1]))
1226 goto err;
1227 if (bn2crparam(dh->p, &kop.crk_param[2]))
1228 goto err;
1229 kop.crk_iparams = 3;
1230
1231 kop.crk_param[3].crp_p = key;
1232 kop.crk_param[3].crp_nbits = keylen * 8;
1233 kop.crk_oparams = 1;
1234
1235 if (ioctl(fd, CIOCKEY, &kop) == -1) {
1236 const DH_METHOD *meth = DH_OpenSSL();
1237
1238 dhret = (meth->compute_key)(key, pub_key, dh);
1239 }
1240err:
1241 kop.crk_param[3].crp_p = NULL;
1242 zapparams(&kop);
1243 return (dhret);
1244}
1245
1246static DH_METHOD cryptodev_dh = {
1247 "cryptodev DH method",
1248 NULL, /* cryptodev_dh_generate_key */
1249 NULL,
1250 NULL,
1251 NULL,
1252 NULL,
1253 0, /* flags */
1254 NULL /* app_data */
1255};
1256
1257/*
1258 * ctrl right now is just a wrapper that doesn't do much
1259 * but I expect we'll want some options soon.
1260 */
1261static int
1262cryptodev_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f)())
1263{
1264#ifdef HAVE_SYSLOG_R
1265 struct syslog_data sd = SYSLOG_DATA_INIT;
1266#endif
1267
1268 switch (cmd) {
1269 default:
1270#ifdef HAVE_SYSLOG_R
1271 syslog_r(LOG_ERR, &sd,
1272 "cryptodev_ctrl: unknown command %d", cmd);
1273#else
1274 syslog(LOG_ERR, "cryptodev_ctrl: unknown command %d", cmd);
1275#endif
1276 break;
1277 }
1278 return (1);
1279}
1280
1281void
1282ENGINE_load_cryptodev(void)
1283{
1284 ENGINE *engine = ENGINE_new();
1285 int fd;
1286
1287 if (engine == NULL)
1288 return;
1289 if ((fd = get_dev_crypto()) < 0) {
1290 ENGINE_free(engine);
1291 return;
1292 }
1293
1294 /*
1295 * find out what asymmetric crypto algorithms we support
1296 */
1297 if (ioctl(fd, CIOCASYMFEAT, &cryptodev_asymfeat) == -1) {
1298 close(fd);
1299 ENGINE_free(engine);
1300 return;
1301 }
1302 close(fd);
1303
1304 if (!ENGINE_set_id(engine, "cryptodev") ||
1305 !ENGINE_set_name(engine, "BSD cryptodev engine") ||
1306 !ENGINE_set_ciphers(engine, cryptodev_engine_ciphers) ||
1307 !ENGINE_set_digests(engine, cryptodev_engine_digests) ||
1308 !ENGINE_set_ctrl_function(engine, cryptodev_ctrl) ||
1309 !ENGINE_set_cmd_defns(engine, cryptodev_defns)) {
1310 ENGINE_free(engine);
1311 return;
1312 }
1313
1314 if (ENGINE_set_RSA(engine, &cryptodev_rsa)) {
1315 const RSA_METHOD *rsa_meth = RSA_PKCS1_SSLeay();
1316
1317 cryptodev_rsa.bn_mod_exp = rsa_meth->bn_mod_exp;
1318 cryptodev_rsa.rsa_mod_exp = rsa_meth->rsa_mod_exp;
1319 cryptodev_rsa.rsa_pub_enc = rsa_meth->rsa_pub_enc;
1320 cryptodev_rsa.rsa_pub_dec = rsa_meth->rsa_pub_dec;
1321 cryptodev_rsa.rsa_priv_enc = rsa_meth->rsa_priv_enc;
1322 cryptodev_rsa.rsa_priv_dec = rsa_meth->rsa_priv_dec;
1323 if (cryptodev_asymfeat & CRF_MOD_EXP) {
1324 cryptodev_rsa.bn_mod_exp = cryptodev_bn_mod_exp;
1325 if (cryptodev_asymfeat & CRF_MOD_EXP_CRT)
1326 cryptodev_rsa.rsa_mod_exp =
1327 cryptodev_rsa_mod_exp;
1328 else
1329 cryptodev_rsa.rsa_mod_exp =
1330 cryptodev_rsa_nocrt_mod_exp;
1331 }
1332 }
1333
1334 if (ENGINE_set_DSA(engine, &cryptodev_dsa)) {
1335 const DSA_METHOD *meth = DSA_OpenSSL();
1336
1337 memcpy(&cryptodev_dsa, meth, sizeof(DSA_METHOD));
1338 if (cryptodev_asymfeat & CRF_DSA_SIGN)
1339 cryptodev_dsa.dsa_do_sign = cryptodev_dsa_do_sign;
1340 if (cryptodev_asymfeat & CRF_MOD_EXP) {
1341 cryptodev_dsa.bn_mod_exp = cryptodev_dsa_bn_mod_exp;
1342 cryptodev_dsa.dsa_mod_exp = cryptodev_dsa_dsa_mod_exp;
1343 }
1344 if (cryptodev_asymfeat & CRF_DSA_VERIFY)
1345 cryptodev_dsa.dsa_do_verify = cryptodev_dsa_verify;
1346 }
1347
1348 if (ENGINE_set_DH(engine, &cryptodev_dh)){
1349 const DH_METHOD *dh_meth = DH_OpenSSL();
1350
1351 cryptodev_dh.generate_key = dh_meth->generate_key;
1352 cryptodev_dh.compute_key = dh_meth->compute_key;
1353 cryptodev_dh.bn_mod_exp = dh_meth->bn_mod_exp;
1354 if (cryptodev_asymfeat & CRF_MOD_EXP) {
1355 cryptodev_dh.bn_mod_exp = cryptodev_mod_exp_dh;
1356 if (cryptodev_asymfeat & CRF_DH_COMPUTE_KEY)
1357 cryptodev_dh.compute_key =
1358 cryptodev_dh_compute_key;
1359 }
1360 }
1361
1362 ENGINE_add(engine);
1363 ENGINE_free(engine);
1364 ERR_clear_error();
1365}
1366
1367#endif /* HAVE_CRYPTODEV */
diff --git a/src/lib/libcrypto/err/Makefile b/src/lib/libcrypto/err/Makefile
new file mode 100644
index 0000000000..862b23ba17
--- /dev/null
+++ b/src/lib/libcrypto/err/Makefile
@@ -0,0 +1,110 @@
1#
2# OpenSSL/crypto/err/Makefile
3#
4
5DIR= err
6TOP= ../..
7CC= cc
8INCLUDES= -I.. -I$(TOP) -I../../include
9CFLAG=-g
10MAKEFILE= Makefile
11AR= ar r
12
13CFLAGS= $(INCLUDES) $(CFLAG)
14
15GENERAL=Makefile
16TEST=
17APPS=
18
19LIB=$(TOP)/libcrypto.a
20LIBSRC=err.c err_all.c err_prn.c
21LIBOBJ=err.o err_all.o err_prn.o
22
23SRC= $(LIBSRC)
24
25EXHEADER= err.h
26HEADER= $(EXHEADER)
27
28ALL= $(GENERAL) $(SRC) $(HEADER)
29
30top:
31 (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all)
32
33all: lib
34
35lib: $(LIBOBJ)
36 $(AR) $(LIB) $(LIBOBJ)
37 $(RANLIB) $(LIB) || echo Never mind.
38 @touch lib
39
40files:
41 $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
42
43links:
44 @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
45 @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
46 @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
47
48install:
49 @[ -n "$(INSTALLTOP)" ] # should be set by top Makefile...
50 @headerlist="$(EXHEADER)"; for i in $$headerlist ; \
51 do \
52 (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
53 chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
54 done;
55
56tags:
57 ctags $(SRC)
58
59tests:
60
61lint:
62 lint -DLINT $(INCLUDES) $(SRC)>fluff
63
64depend:
65 @[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile...
66 $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
67
68dclean:
69 $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
70 mv -f Makefile.new $(MAKEFILE)
71
72clean:
73 rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
74
75# DO NOT DELETE THIS LINE -- make depend depends on it.
76
77err.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/buffer.h
78err.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
79err.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
80err.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
81err.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
82err.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
83err.o: ../cryptlib.h err.c
84err_all.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
85err_all.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
86err_all.o: ../../include/openssl/cms.h ../../include/openssl/comp.h
87err_all.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
88err_all.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
89err_all.o: ../../include/openssl/dso.h ../../include/openssl/e_os2.h
90err_all.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
91err_all.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h
92err_all.o: ../../include/openssl/err.h ../../include/openssl/evp.h
93err_all.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
94err_all.o: ../../include/openssl/objects.h ../../include/openssl/ocsp.h
95err_all.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
96err_all.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pem2.h
97err_all.o: ../../include/openssl/pkcs12.h ../../include/openssl/pkcs7.h
98err_all.o: ../../include/openssl/rand.h ../../include/openssl/rsa.h
99err_all.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
100err_all.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
101err_all.o: ../../include/openssl/ts.h ../../include/openssl/ui.h
102err_all.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
103err_all.o: ../../include/openssl/x509v3.h err_all.c
104err_prn.o: ../../e_os.h ../../include/openssl/bio.h
105err_prn.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
106err_prn.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
107err_prn.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
108err_prn.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
109err_prn.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
110err_prn.o: ../../include/openssl/symhacks.h ../cryptlib.h err_prn.c
diff --git a/src/lib/libcrypto/err/err_all.c b/src/lib/libcrypto/err/err_all.c
index 8eb547d98d..bd8946d8ba 100644
--- a/src/lib/libcrypto/err/err_all.c
+++ b/src/lib/libcrypto/err/err_all.c
@@ -64,9 +64,7 @@
64#endif 64#endif
65#include <openssl/buffer.h> 65#include <openssl/buffer.h>
66#include <openssl/bio.h> 66#include <openssl/bio.h>
67#ifndef OPENSSL_NO_COMP
68#include <openssl/comp.h> 67#include <openssl/comp.h>
69#endif
70#ifndef OPENSSL_NO_RSA 68#ifndef OPENSSL_NO_RSA
71#include <openssl/rsa.h> 69#include <openssl/rsa.h>
72#endif 70#endif
@@ -97,9 +95,6 @@
97#include <openssl/ui.h> 95#include <openssl/ui.h>
98#include <openssl/ocsp.h> 96#include <openssl/ocsp.h>
99#include <openssl/err.h> 97#include <openssl/err.h>
100#ifdef OPENSSL_FIPS
101#include <openssl/fips.h>
102#endif
103#include <openssl/ts.h> 98#include <openssl/ts.h>
104#ifndef OPENSSL_NO_CMS 99#ifndef OPENSSL_NO_CMS
105#include <openssl/cms.h> 100#include <openssl/cms.h>
@@ -107,6 +102,11 @@
107#ifndef OPENSSL_NO_JPAKE 102#ifndef OPENSSL_NO_JPAKE
108#include <openssl/jpake.h> 103#include <openssl/jpake.h>
109#endif 104#endif
105#include <openssl/comp.h>
106
107#ifdef OPENSSL_FIPS
108#include <openssl/fips.h>
109#endif
110 110
111void ERR_load_crypto_strings(void) 111void ERR_load_crypto_strings(void)
112 { 112 {
@@ -130,9 +130,7 @@ void ERR_load_crypto_strings(void)
130 ERR_load_ASN1_strings(); 130 ERR_load_ASN1_strings();
131 ERR_load_CONF_strings(); 131 ERR_load_CONF_strings();
132 ERR_load_CRYPTO_strings(); 132 ERR_load_CRYPTO_strings();
133#ifndef OPENSSL_NO_COMP
134 ERR_load_COMP_strings(); 133 ERR_load_COMP_strings();
135#endif
136#ifndef OPENSSL_NO_EC 134#ifndef OPENSSL_NO_EC
137 ERR_load_EC_strings(); 135 ERR_load_EC_strings();
138#endif 136#endif
@@ -155,14 +153,15 @@ void ERR_load_crypto_strings(void)
155#endif 153#endif
156 ERR_load_OCSP_strings(); 154 ERR_load_OCSP_strings();
157 ERR_load_UI_strings(); 155 ERR_load_UI_strings();
158#ifdef OPENSSL_FIPS
159 ERR_load_FIPS_strings();
160#endif
161#ifndef OPENSSL_NO_CMS 156#ifndef OPENSSL_NO_CMS
162 ERR_load_CMS_strings(); 157 ERR_load_CMS_strings();
163#endif 158#endif
164#ifndef OPENSSL_NO_JPAKE 159#ifndef OPENSSL_NO_JPAKE
165 ERR_load_JPAKE_strings(); 160 ERR_load_JPAKE_strings();
166#endif 161#endif
162 ERR_load_COMP_strings();
163#endif
164#ifdef OPENSSL_FIPS
165 ERR_load_FIPS_strings();
167#endif 166#endif
168 } 167 }
diff --git a/src/lib/libcrypto/evp/Makefile b/src/lib/libcrypto/evp/Makefile
new file mode 100644
index 0000000000..0fe1b96bff
--- /dev/null
+++ b/src/lib/libcrypto/evp/Makefile
@@ -0,0 +1,771 @@
1#
2# OpenSSL/crypto/evp/Makefile
3#
4
5DIR= evp
6TOP= ../..
7CC= cc
8INCLUDES= -I.. -I$(TOP) -I../../include
9CFLAG=-g
10MAKEFILE= Makefile
11AR= ar r
12
13CFLAGS= $(INCLUDES) $(CFLAG)
14
15GENERAL=Makefile
16TEST=evp_test.c
17TESTDATA=evptests.txt
18APPS=
19
20LIB=$(TOP)/libcrypto.a
21LIBSRC= encode.c digest.c evp_enc.c evp_key.c evp_acnf.c \
22 e_des.c e_bf.c e_idea.c e_des3.c e_camellia.c\
23 e_rc4.c e_aes.c names.c e_seed.c \
24 e_xcbc_d.c e_rc2.c e_cast.c e_rc5.c \
25 m_null.c m_md2.c m_md4.c m_md5.c m_sha.c m_sha1.c m_wp.c \
26 m_dss.c m_dss1.c m_mdc2.c m_ripemd.c m_ecdsa.c\
27 p_open.c p_seal.c p_sign.c p_verify.c p_lib.c p_enc.c p_dec.c \
28 bio_md.c bio_b64.c bio_enc.c evp_err.c e_null.c \
29 c_all.c c_allc.c c_alld.c evp_lib.c bio_ok.c \
30 evp_pkey.c evp_pbe.c p5_crpt.c p5_crpt2.c \
31 e_old.c pmeth_lib.c pmeth_fn.c pmeth_gn.c m_sigver.c evp_fips.c \
32 e_aes_cbc_hmac_sha1.c e_rc4_hmac_md5.c
33
34LIBOBJ= encode.o digest.o evp_enc.o evp_key.o evp_acnf.o \
35 e_des.o e_bf.o e_idea.o e_des3.o e_camellia.o\
36 e_rc4.o e_aes.o names.o e_seed.o \
37 e_xcbc_d.o e_rc2.o e_cast.o e_rc5.o \
38 m_null.o m_md2.o m_md4.o m_md5.o m_sha.o m_sha1.o m_wp.o \
39 m_dss.o m_dss1.o m_mdc2.o m_ripemd.o m_ecdsa.o\
40 p_open.o p_seal.o p_sign.o p_verify.o p_lib.o p_enc.o p_dec.o \
41 bio_md.o bio_b64.o bio_enc.o evp_err.o e_null.o \
42 c_all.o c_allc.o c_alld.o evp_lib.o bio_ok.o \
43 evp_pkey.o evp_pbe.o p5_crpt.o p5_crpt2.o \
44 e_old.o pmeth_lib.o pmeth_fn.o pmeth_gn.o m_sigver.o evp_fips.o \
45 e_aes_cbc_hmac_sha1.o e_rc4_hmac_md5.o
46
47SRC= $(LIBSRC)
48
49EXHEADER= evp.h
50HEADER= evp_locl.h $(EXHEADER)
51
52ALL= $(GENERAL) $(SRC) $(HEADER)
53
54top:
55 (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all)
56
57all: lib
58
59lib: $(LIBOBJ)
60 $(AR) $(LIB) $(LIBOBJ)
61 $(RANLIB) $(LIB) || echo Never mind.
62 @touch lib
63
64files:
65 $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
66
67links:
68 @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
69 @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
70 cp $(TESTDATA) ../../test
71 @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
72
73install:
74 @[ -n "$(INSTALLTOP)" ] # should be set by top Makefile...
75 @headerlist="$(EXHEADER)"; for i in $$headerlist ; \
76 do \
77 (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
78 chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
79 done;
80
81tags:
82 ctags $(SRC)
83
84tests:
85
86lint:
87 lint -DLINT $(INCLUDES) $(SRC)>fluff
88
89depend:
90 @[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile...
91 $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(LIBSRC)
92
93dclean:
94 $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
95 mv -f Makefile.new $(MAKEFILE)
96
97clean:
98 rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
99
100# DO NOT DELETE THIS LINE -- make depend depends on it.
101
102bio_b64.o: ../../e_os.h ../../include/openssl/asn1.h
103bio_b64.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
104bio_b64.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
105bio_b64.o: ../../include/openssl/err.h ../../include/openssl/evp.h
106bio_b64.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
107bio_b64.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
108bio_b64.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
109bio_b64.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
110bio_b64.o: ../../include/openssl/symhacks.h ../cryptlib.h bio_b64.c
111bio_enc.o: ../../e_os.h ../../include/openssl/asn1.h
112bio_enc.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
113bio_enc.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
114bio_enc.o: ../../include/openssl/err.h ../../include/openssl/evp.h
115bio_enc.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
116bio_enc.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
117bio_enc.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
118bio_enc.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
119bio_enc.o: ../../include/openssl/symhacks.h ../cryptlib.h bio_enc.c
120bio_md.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
121bio_md.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
122bio_md.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
123bio_md.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
124bio_md.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
125bio_md.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
126bio_md.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
127bio_md.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
128bio_md.o: ../cryptlib.h bio_md.c
129bio_ok.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
130bio_ok.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
131bio_ok.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
132bio_ok.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
133bio_ok.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
134bio_ok.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
135bio_ok.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rand.h
136bio_ok.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
137bio_ok.o: ../../include/openssl/symhacks.h ../cryptlib.h bio_ok.c
138c_all.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
139c_all.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
140c_all.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
141c_all.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
142c_all.o: ../../include/openssl/engine.h ../../include/openssl/err.h
143c_all.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
144c_all.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
145c_all.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
146c_all.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
147c_all.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
148c_all.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
149c_all.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
150c_all.o: ../cryptlib.h c_all.c
151c_allc.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
152c_allc.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
153c_allc.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
154c_allc.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
155c_allc.o: ../../include/openssl/err.h ../../include/openssl/evp.h
156c_allc.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
157c_allc.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
158c_allc.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
159c_allc.o: ../../include/openssl/pkcs12.h ../../include/openssl/pkcs7.h
160c_allc.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
161c_allc.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
162c_allc.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
163c_allc.o: ../cryptlib.h c_allc.c
164c_alld.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
165c_alld.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
166c_alld.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
167c_alld.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
168c_alld.o: ../../include/openssl/err.h ../../include/openssl/evp.h
169c_alld.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
170c_alld.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
171c_alld.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
172c_alld.o: ../../include/openssl/pkcs12.h ../../include/openssl/pkcs7.h
173c_alld.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
174c_alld.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
175c_alld.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
176c_alld.o: ../cryptlib.h c_alld.c
177digest.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
178digest.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
179digest.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
180digest.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
181digest.o: ../../include/openssl/engine.h ../../include/openssl/err.h
182digest.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
183digest.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
184digest.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
185digest.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
186digest.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
187digest.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
188digest.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
189digest.o: ../cryptlib.h digest.c
190e_aes.o: ../../include/openssl/aes.h ../../include/openssl/asn1.h
191e_aes.o: ../../include/openssl/bio.h ../../include/openssl/crypto.h
192e_aes.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
193e_aes.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
194e_aes.o: ../../include/openssl/modes.h ../../include/openssl/obj_mac.h
195e_aes.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
196e_aes.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
197e_aes.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h
198e_aes.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
199e_aes.o: ../modes/modes_lcl.h e_aes.c evp_locl.h
200e_aes_cbc_hmac_sha1.o: ../../include/openssl/aes.h ../../include/openssl/asn1.h
201e_aes_cbc_hmac_sha1.o: ../../include/openssl/bio.h
202e_aes_cbc_hmac_sha1.o: ../../include/openssl/crypto.h
203e_aes_cbc_hmac_sha1.o: ../../include/openssl/e_os2.h
204e_aes_cbc_hmac_sha1.o: ../../include/openssl/evp.h
205e_aes_cbc_hmac_sha1.o: ../../include/openssl/obj_mac.h
206e_aes_cbc_hmac_sha1.o: ../../include/openssl/objects.h
207e_aes_cbc_hmac_sha1.o: ../../include/openssl/opensslconf.h
208e_aes_cbc_hmac_sha1.o: ../../include/openssl/opensslv.h
209e_aes_cbc_hmac_sha1.o: ../../include/openssl/ossl_typ.h
210e_aes_cbc_hmac_sha1.o: ../../include/openssl/safestack.h
211e_aes_cbc_hmac_sha1.o: ../../include/openssl/sha.h
212e_aes_cbc_hmac_sha1.o: ../../include/openssl/stack.h
213e_aes_cbc_hmac_sha1.o: ../../include/openssl/symhacks.h e_aes_cbc_hmac_sha1.c
214e_aes_cbc_hmac_sha1.o: evp_locl.h
215e_bf.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
216e_bf.o: ../../include/openssl/blowfish.h ../../include/openssl/buffer.h
217e_bf.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
218e_bf.o: ../../include/openssl/err.h ../../include/openssl/evp.h
219e_bf.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
220e_bf.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
221e_bf.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
222e_bf.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
223e_bf.o: ../../include/openssl/symhacks.h ../cryptlib.h e_bf.c evp_locl.h
224e_camellia.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
225e_camellia.o: ../../include/openssl/camellia.h ../../include/openssl/crypto.h
226e_camellia.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
227e_camellia.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
228e_camellia.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
229e_camellia.o: ../../include/openssl/opensslconf.h
230e_camellia.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
231e_camellia.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
232e_camellia.o: ../../include/openssl/symhacks.h e_camellia.c evp_locl.h
233e_cast.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
234e_cast.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
235e_cast.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
236e_cast.o: ../../include/openssl/err.h ../../include/openssl/evp.h
237e_cast.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
238e_cast.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
239e_cast.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
240e_cast.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
241e_cast.o: ../../include/openssl/symhacks.h ../cryptlib.h e_cast.c evp_locl.h
242e_des.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
243e_des.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
244e_des.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
245e_des.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
246e_des.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
247e_des.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
248e_des.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
249e_des.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rand.h
250e_des.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
251e_des.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
252e_des.o: ../../include/openssl/ui_compat.h ../cryptlib.h e_des.c evp_locl.h
253e_des3.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
254e_des3.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
255e_des3.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
256e_des3.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
257e_des3.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
258e_des3.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
259e_des3.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
260e_des3.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rand.h
261e_des3.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
262e_des3.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
263e_des3.o: ../../include/openssl/ui_compat.h ../cryptlib.h e_des3.c evp_locl.h
264e_idea.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
265e_idea.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
266e_idea.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
267e_idea.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
268e_idea.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
269e_idea.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
270e_idea.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
271e_idea.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
272e_idea.o: ../../include/openssl/symhacks.h ../cryptlib.h e_idea.c evp_locl.h
273e_null.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
274e_null.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
275e_null.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
276e_null.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
277e_null.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
278e_null.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
279e_null.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
280e_null.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
281e_null.o: ../cryptlib.h e_null.c
282e_old.o: e_old.c
283e_rc2.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
284e_rc2.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
285e_rc2.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
286e_rc2.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
287e_rc2.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
288e_rc2.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
289e_rc2.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rc2.h
290e_rc2.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
291e_rc2.o: ../../include/openssl/symhacks.h ../cryptlib.h e_rc2.c evp_locl.h
292e_rc4.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
293e_rc4.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
294e_rc4.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
295e_rc4.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
296e_rc4.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
297e_rc4.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
298e_rc4.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rc4.h
299e_rc4.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
300e_rc4.o: ../../include/openssl/symhacks.h ../cryptlib.h e_rc4.c evp_locl.h
301e_rc4_hmac_md5.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
302e_rc4_hmac_md5.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
303e_rc4_hmac_md5.o: ../../include/openssl/evp.h ../../include/openssl/md5.h
304e_rc4_hmac_md5.o: ../../include/openssl/obj_mac.h
305e_rc4_hmac_md5.o: ../../include/openssl/objects.h
306e_rc4_hmac_md5.o: ../../include/openssl/opensslconf.h
307e_rc4_hmac_md5.o: ../../include/openssl/opensslv.h
308e_rc4_hmac_md5.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rc4.h
309e_rc4_hmac_md5.o: ../../include/openssl/safestack.h
310e_rc4_hmac_md5.o: ../../include/openssl/stack.h
311e_rc4_hmac_md5.o: ../../include/openssl/symhacks.h e_rc4_hmac_md5.c
312e_rc5.o: ../../e_os.h ../../include/openssl/bio.h
313e_rc5.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
314e_rc5.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
315e_rc5.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
316e_rc5.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
317e_rc5.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
318e_rc5.o: ../../include/openssl/symhacks.h ../cryptlib.h e_rc5.c
319e_seed.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
320e_seed.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
321e_seed.o: ../../include/openssl/err.h ../../include/openssl/evp.h
322e_seed.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
323e_seed.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
324e_seed.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
325e_seed.o: ../../include/openssl/safestack.h ../../include/openssl/seed.h
326e_seed.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
327e_seed.o: e_seed.c evp_locl.h
328e_xcbc_d.o: ../../e_os.h ../../include/openssl/asn1.h
329e_xcbc_d.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
330e_xcbc_d.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
331e_xcbc_d.o: ../../include/openssl/des_old.h ../../include/openssl/e_os2.h
332e_xcbc_d.o: ../../include/openssl/err.h ../../include/openssl/evp.h
333e_xcbc_d.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
334e_xcbc_d.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
335e_xcbc_d.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
336e_xcbc_d.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
337e_xcbc_d.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
338e_xcbc_d.o: ../../include/openssl/ui_compat.h ../cryptlib.h e_xcbc_d.c
339e_xcbc_d.o: evp_locl.h
340encode.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
341encode.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
342encode.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
343encode.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
344encode.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
345encode.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
346encode.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
347encode.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
348encode.o: ../cryptlib.h encode.c
349evp_acnf.o: ../../e_os.h ../../include/openssl/asn1.h
350evp_acnf.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
351evp_acnf.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
352evp_acnf.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
353evp_acnf.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
354evp_acnf.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
355evp_acnf.o: ../../include/openssl/opensslconf.h
356evp_acnf.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
357evp_acnf.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
358evp_acnf.o: ../../include/openssl/symhacks.h ../cryptlib.h evp_acnf.c
359evp_enc.o: ../../e_os.h ../../include/openssl/asn1.h
360evp_enc.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
361evp_enc.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
362evp_enc.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
363evp_enc.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h
364evp_enc.o: ../../include/openssl/err.h ../../include/openssl/evp.h
365evp_enc.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
366evp_enc.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
367evp_enc.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
368evp_enc.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h
369evp_enc.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
370evp_enc.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
371evp_enc.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
372evp_enc.o: ../cryptlib.h evp_enc.c evp_locl.h
373evp_err.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
374evp_err.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
375evp_err.o: ../../include/openssl/err.h ../../include/openssl/evp.h
376evp_err.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
377evp_err.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
378evp_err.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
379evp_err.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
380evp_err.o: ../../include/openssl/symhacks.h evp_err.c
381evp_fips.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
382evp_fips.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
383evp_fips.o: ../../include/openssl/evp.h ../../include/openssl/obj_mac.h
384evp_fips.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
385evp_fips.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
386evp_fips.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
387evp_fips.o: ../../include/openssl/symhacks.h evp_fips.c
388evp_key.o: ../../e_os.h ../../include/openssl/asn1.h
389evp_key.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
390evp_key.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
391evp_key.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
392evp_key.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
393evp_key.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
394evp_key.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
395evp_key.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
396evp_key.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
397evp_key.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
398evp_key.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
399evp_key.o: ../../include/openssl/ui.h ../../include/openssl/x509.h
400evp_key.o: ../../include/openssl/x509_vfy.h ../cryptlib.h evp_key.c
401evp_lib.o: ../../e_os.h ../../include/openssl/asn1.h
402evp_lib.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
403evp_lib.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
404evp_lib.o: ../../include/openssl/err.h ../../include/openssl/evp.h
405evp_lib.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
406evp_lib.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
407evp_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
408evp_lib.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
409evp_lib.o: ../../include/openssl/symhacks.h ../cryptlib.h evp_lib.c
410evp_pbe.o: ../../e_os.h ../../include/openssl/asn1.h
411evp_pbe.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
412evp_pbe.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
413evp_pbe.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
414evp_pbe.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
415evp_pbe.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
416evp_pbe.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
417evp_pbe.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
418evp_pbe.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs12.h
419evp_pbe.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
420evp_pbe.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
421evp_pbe.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
422evp_pbe.o: ../../include/openssl/x509_vfy.h ../cryptlib.h evp_locl.h evp_pbe.c
423evp_pkey.o: ../../e_os.h ../../include/openssl/asn1.h
424evp_pkey.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
425evp_pkey.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
426evp_pkey.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
427evp_pkey.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
428evp_pkey.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
429evp_pkey.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
430evp_pkey.o: ../../include/openssl/opensslconf.h
431evp_pkey.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
432evp_pkey.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h
433evp_pkey.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
434evp_pkey.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
435evp_pkey.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
436evp_pkey.o: ../asn1/asn1_locl.h ../cryptlib.h evp_pkey.c
437m_dss.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
438m_dss.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
439m_dss.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
440m_dss.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
441m_dss.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
442m_dss.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
443m_dss.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
444m_dss.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
445m_dss.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
446m_dss.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
447m_dss.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
448m_dss.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
449m_dss.o: ../cryptlib.h m_dss.c
450m_dss1.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
451m_dss1.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
452m_dss1.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
453m_dss1.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
454m_dss1.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
455m_dss1.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
456m_dss1.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
457m_dss1.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
458m_dss1.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
459m_dss1.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
460m_dss1.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
461m_dss1.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
462m_dss1.o: ../cryptlib.h m_dss1.c
463m_ecdsa.o: ../../e_os.h ../../include/openssl/asn1.h
464m_ecdsa.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
465m_ecdsa.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
466m_ecdsa.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
467m_ecdsa.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
468m_ecdsa.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
469m_ecdsa.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
470m_ecdsa.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
471m_ecdsa.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
472m_ecdsa.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
473m_ecdsa.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
474m_ecdsa.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
475m_ecdsa.o: ../cryptlib.h m_ecdsa.c
476m_md2.o: ../../e_os.h ../../include/openssl/bio.h
477m_md2.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
478m_md2.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
479m_md2.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
480m_md2.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
481m_md2.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
482m_md2.o: ../../include/openssl/symhacks.h ../cryptlib.h m_md2.c
483m_md4.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
484m_md4.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
485m_md4.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
486m_md4.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
487m_md4.o: ../../include/openssl/err.h ../../include/openssl/evp.h
488m_md4.o: ../../include/openssl/lhash.h ../../include/openssl/md4.h
489m_md4.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
490m_md4.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
491m_md4.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
492m_md4.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
493m_md4.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
494m_md4.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
495m_md4.o: ../../include/openssl/x509_vfy.h ../cryptlib.h evp_locl.h m_md4.c
496m_md5.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
497m_md5.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
498m_md5.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
499m_md5.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
500m_md5.o: ../../include/openssl/err.h ../../include/openssl/evp.h
501m_md5.o: ../../include/openssl/lhash.h ../../include/openssl/md5.h
502m_md5.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
503m_md5.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
504m_md5.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
505m_md5.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
506m_md5.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
507m_md5.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
508m_md5.o: ../../include/openssl/x509_vfy.h ../cryptlib.h evp_locl.h m_md5.c
509m_mdc2.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
510m_mdc2.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
511m_mdc2.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
512m_mdc2.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
513m_mdc2.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
514m_mdc2.o: ../../include/openssl/err.h ../../include/openssl/evp.h
515m_mdc2.o: ../../include/openssl/lhash.h ../../include/openssl/mdc2.h
516m_mdc2.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
517m_mdc2.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
518m_mdc2.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
519m_mdc2.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
520m_mdc2.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
521m_mdc2.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
522m_mdc2.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h
523m_mdc2.o: ../../include/openssl/x509_vfy.h ../cryptlib.h evp_locl.h m_mdc2.c
524m_null.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
525m_null.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
526m_null.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
527m_null.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
528m_null.o: ../../include/openssl/err.h ../../include/openssl/evp.h
529m_null.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
530m_null.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
531m_null.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
532m_null.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
533m_null.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
534m_null.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
535m_null.o: ../../include/openssl/x509_vfy.h ../cryptlib.h m_null.c
536m_ripemd.o: ../../e_os.h ../../include/openssl/asn1.h
537m_ripemd.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
538m_ripemd.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
539m_ripemd.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
540m_ripemd.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
541m_ripemd.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
542m_ripemd.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
543m_ripemd.o: ../../include/openssl/opensslconf.h
544m_ripemd.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
545m_ripemd.o: ../../include/openssl/pkcs7.h ../../include/openssl/ripemd.h
546m_ripemd.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
547m_ripemd.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
548m_ripemd.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
549m_ripemd.o: ../../include/openssl/x509_vfy.h ../cryptlib.h evp_locl.h
550m_ripemd.o: m_ripemd.c
551m_sha.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
552m_sha.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
553m_sha.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
554m_sha.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
555m_sha.o: ../../include/openssl/err.h ../../include/openssl/evp.h
556m_sha.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
557m_sha.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
558m_sha.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
559m_sha.o: ../../include/openssl/pkcs7.h ../../include/openssl/rsa.h
560m_sha.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
561m_sha.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
562m_sha.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
563m_sha.o: ../cryptlib.h evp_locl.h m_sha.c
564m_sha1.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
565m_sha1.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
566m_sha1.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
567m_sha1.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
568m_sha1.o: ../../include/openssl/err.h ../../include/openssl/evp.h
569m_sha1.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
570m_sha1.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
571m_sha1.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
572m_sha1.o: ../../include/openssl/pkcs7.h ../../include/openssl/rsa.h
573m_sha1.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
574m_sha1.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
575m_sha1.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
576m_sha1.o: ../cryptlib.h m_sha1.c
577m_sigver.o: ../../e_os.h ../../include/openssl/asn1.h
578m_sigver.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
579m_sigver.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
580m_sigver.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
581m_sigver.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
582m_sigver.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
583m_sigver.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
584m_sigver.o: ../../include/openssl/opensslconf.h
585m_sigver.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
586m_sigver.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
587m_sigver.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
588m_sigver.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
589m_sigver.o: ../../include/openssl/x509_vfy.h ../cryptlib.h evp_locl.h
590m_sigver.o: m_sigver.c
591m_wp.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
592m_wp.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
593m_wp.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
594m_wp.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
595m_wp.o: ../../include/openssl/err.h ../../include/openssl/evp.h
596m_wp.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
597m_wp.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
598m_wp.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
599m_wp.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
600m_wp.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
601m_wp.o: ../../include/openssl/symhacks.h ../../include/openssl/whrlpool.h
602m_wp.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
603m_wp.o: ../cryptlib.h evp_locl.h m_wp.c
604names.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
605names.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
606names.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
607names.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
608names.o: ../../include/openssl/err.h ../../include/openssl/evp.h
609names.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
610names.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
611names.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
612names.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
613names.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
614names.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
615names.o: ../../include/openssl/x509_vfy.h ../cryptlib.h names.c
616p5_crpt.o: ../../e_os.h ../../include/openssl/asn1.h
617p5_crpt.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
618p5_crpt.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
619p5_crpt.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
620p5_crpt.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
621p5_crpt.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
622p5_crpt.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
623p5_crpt.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
624p5_crpt.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
625p5_crpt.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
626p5_crpt.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
627p5_crpt.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
628p5_crpt.o: ../cryptlib.h p5_crpt.c
629p5_crpt2.o: ../../e_os.h ../../include/openssl/asn1.h
630p5_crpt2.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
631p5_crpt2.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
632p5_crpt2.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
633p5_crpt2.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
634p5_crpt2.o: ../../include/openssl/evp.h ../../include/openssl/hmac.h
635p5_crpt2.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
636p5_crpt2.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
637p5_crpt2.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
638p5_crpt2.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
639p5_crpt2.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
640p5_crpt2.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
641p5_crpt2.o: ../../include/openssl/x509_vfy.h ../cryptlib.h evp_locl.h
642p5_crpt2.o: p5_crpt2.c
643p_dec.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
644p_dec.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
645p_dec.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
646p_dec.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
647p_dec.o: ../../include/openssl/err.h ../../include/openssl/evp.h
648p_dec.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
649p_dec.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
650p_dec.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
651p_dec.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h
652p_dec.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
653p_dec.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
654p_dec.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
655p_dec.o: ../../include/openssl/x509_vfy.h ../cryptlib.h p_dec.c
656p_enc.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
657p_enc.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
658p_enc.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
659p_enc.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
660p_enc.o: ../../include/openssl/err.h ../../include/openssl/evp.h
661p_enc.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
662p_enc.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
663p_enc.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
664p_enc.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h
665p_enc.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
666p_enc.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
667p_enc.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
668p_enc.o: ../../include/openssl/x509_vfy.h ../cryptlib.h p_enc.c
669p_lib.o: ../../e_os.h ../../include/openssl/asn1.h
670p_lib.o: ../../include/openssl/asn1_mac.h ../../include/openssl/bio.h
671p_lib.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
672p_lib.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
673p_lib.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
674p_lib.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
675p_lib.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h
676p_lib.o: ../../include/openssl/err.h ../../include/openssl/evp.h
677p_lib.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
678p_lib.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
679p_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
680p_lib.o: ../../include/openssl/pkcs7.h ../../include/openssl/rsa.h
681p_lib.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
682p_lib.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
683p_lib.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
684p_lib.o: ../asn1/asn1_locl.h ../cryptlib.h p_lib.c
685p_open.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
686p_open.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
687p_open.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
688p_open.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
689p_open.o: ../../include/openssl/err.h ../../include/openssl/evp.h
690p_open.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
691p_open.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
692p_open.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
693p_open.o: ../../include/openssl/pkcs7.h ../../include/openssl/rsa.h
694p_open.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
695p_open.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
696p_open.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
697p_open.o: ../cryptlib.h p_open.c
698p_seal.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
699p_seal.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
700p_seal.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
701p_seal.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
702p_seal.o: ../../include/openssl/err.h ../../include/openssl/evp.h
703p_seal.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
704p_seal.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
705p_seal.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
706p_seal.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h
707p_seal.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
708p_seal.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
709p_seal.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
710p_seal.o: ../../include/openssl/x509_vfy.h ../cryptlib.h p_seal.c
711p_sign.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
712p_sign.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
713p_sign.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
714p_sign.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
715p_sign.o: ../../include/openssl/err.h ../../include/openssl/evp.h
716p_sign.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
717p_sign.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
718p_sign.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
719p_sign.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
720p_sign.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
721p_sign.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
722p_sign.o: ../../include/openssl/x509_vfy.h ../cryptlib.h p_sign.c
723p_verify.o: ../../e_os.h ../../include/openssl/asn1.h
724p_verify.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
725p_verify.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
726p_verify.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
727p_verify.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
728p_verify.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
729p_verify.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
730p_verify.o: ../../include/openssl/opensslconf.h
731p_verify.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
732p_verify.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
733p_verify.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
734p_verify.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
735p_verify.o: ../../include/openssl/x509_vfy.h ../cryptlib.h p_verify.c
736pmeth_fn.o: ../../e_os.h ../../include/openssl/asn1.h
737pmeth_fn.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
738pmeth_fn.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
739pmeth_fn.o: ../../include/openssl/err.h ../../include/openssl/evp.h
740pmeth_fn.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
741pmeth_fn.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
742pmeth_fn.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
743pmeth_fn.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
744pmeth_fn.o: ../../include/openssl/symhacks.h ../cryptlib.h evp_locl.h
745pmeth_fn.o: pmeth_fn.c
746pmeth_gn.o: ../../e_os.h ../../include/openssl/asn1.h
747pmeth_gn.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
748pmeth_gn.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
749pmeth_gn.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
750pmeth_gn.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
751pmeth_gn.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
752pmeth_gn.o: ../../include/openssl/opensslconf.h
753pmeth_gn.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
754pmeth_gn.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
755pmeth_gn.o: ../../include/openssl/symhacks.h ../cryptlib.h evp_locl.h
756pmeth_gn.o: pmeth_gn.c
757pmeth_lib.o: ../../e_os.h ../../include/openssl/asn1.h
758pmeth_lib.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
759pmeth_lib.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
760pmeth_lib.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
761pmeth_lib.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h
762pmeth_lib.o: ../../include/openssl/err.h ../../include/openssl/evp.h
763pmeth_lib.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
764pmeth_lib.o: ../../include/openssl/objects.h
765pmeth_lib.o: ../../include/openssl/opensslconf.h
766pmeth_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
767pmeth_lib.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
768pmeth_lib.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
769pmeth_lib.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
770pmeth_lib.o: ../../include/openssl/x509_vfy.h ../asn1/asn1_locl.h ../cryptlib.h
771pmeth_lib.o: evp_locl.h pmeth_lib.c
diff --git a/src/lib/libcrypto/evp/bio_b64.c b/src/lib/libcrypto/evp/bio_b64.c
index ac6d441aad..72a2a67277 100644
--- a/src/lib/libcrypto/evp/bio_b64.c
+++ b/src/lib/libcrypto/evp/bio_b64.c
@@ -264,7 +264,7 @@ static int b64_read(BIO *b, char *out, int outl)
264 } 264 }
265 265
266 /* we fell off the end without starting */ 266 /* we fell off the end without starting */
267 if ((j == i) && (num == 0)) 267 if (j == i)
268 { 268 {
269 /* Is this is one long chunk?, if so, keep on 269 /* Is this is one long chunk?, if so, keep on
270 * reading until a new line. */ 270 * reading until a new line. */
diff --git a/src/lib/libcrypto/evp/bio_ok.c b/src/lib/libcrypto/evp/bio_ok.c
new file mode 100644
index 0000000000..e64335353f
--- /dev/null
+++ b/src/lib/libcrypto/evp/bio_ok.c
@@ -0,0 +1,624 @@
1/* crypto/evp/bio_ok.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
59/*
60 From: Arne Ansper <arne@cyber.ee>
61
62 Why BIO_f_reliable?
63
64 I wrote function which took BIO* as argument, read data from it
65 and processed it. Then I wanted to store the input file in
66 encrypted form. OK I pushed BIO_f_cipher to the BIO stack
67 and everything was OK. BUT if user types wrong password
68 BIO_f_cipher outputs only garbage and my function crashes. Yes
69 I can and I should fix my function, but BIO_f_cipher is
70 easy way to add encryption support to many existing applications
71 and it's hard to debug and fix them all.
72
73 So I wanted another BIO which would catch the incorrect passwords and
74 file damages which cause garbage on BIO_f_cipher's output.
75
76 The easy way is to push the BIO_f_md and save the checksum at
77 the end of the file. However there are several problems with this
78 approach:
79
80 1) you must somehow separate checksum from actual data.
81 2) you need lot's of memory when reading the file, because you
82 must read to the end of the file and verify the checksum before
83 letting the application to read the data.
84
85 BIO_f_reliable tries to solve both problems, so that you can
86 read and write arbitrary long streams using only fixed amount
87 of memory.
88
89 BIO_f_reliable splits data stream into blocks. Each block is prefixed
90 with it's length and suffixed with it's digest. So you need only
91 several Kbytes of memory to buffer single block before verifying
92 it's digest.
93
94 BIO_f_reliable goes further and adds several important capabilities:
95
96 1) the digest of the block is computed over the whole stream
97 -- so nobody can rearrange the blocks or remove or replace them.
98
99 2) to detect invalid passwords right at the start BIO_f_reliable
100 adds special prefix to the stream. In order to avoid known plain-text
101 attacks this prefix is generated as follows:
102
103 *) digest is initialized with random seed instead of
104 standardized one.
105 *) same seed is written to output
106 *) well-known text is then hashed and the output
107 of the digest is also written to output.
108
109 reader can now read the seed from stream, hash the same string
110 and then compare the digest output.
111
112 Bad things: BIO_f_reliable knows what's going on in EVP_Digest. I
113 initially wrote and tested this code on x86 machine and wrote the
114 digests out in machine-dependent order :( There are people using
115 this code and I cannot change this easily without making existing
116 data files unreadable.
117
118*/
119
120#include <stdio.h>
121#include <errno.h>
122#include <assert.h>
123#include "cryptlib.h"
124#include <openssl/buffer.h>
125#include <openssl/bio.h>
126#include <openssl/evp.h>
127#include <openssl/rand.h>
128
129static int ok_write(BIO *h, const char *buf, int num);
130static int ok_read(BIO *h, char *buf, int size);
131static long ok_ctrl(BIO *h, int cmd, long arg1, void *arg2);
132static int ok_new(BIO *h);
133static int ok_free(BIO *data);
134static long ok_callback_ctrl(BIO *h, int cmd, bio_info_cb *fp);
135
136static int sig_out(BIO* b);
137static int sig_in(BIO* b);
138static int block_out(BIO* b);
139static int block_in(BIO* b);
140#define OK_BLOCK_SIZE (1024*4)
141#define OK_BLOCK_BLOCK 4
142#define IOBS (OK_BLOCK_SIZE+ OK_BLOCK_BLOCK+ 3*EVP_MAX_MD_SIZE)
143#define WELLKNOWN "The quick brown fox jumped over the lazy dog's back."
144
145typedef struct ok_struct
146 {
147 size_t buf_len;
148 size_t buf_off;
149 size_t buf_len_save;
150 size_t buf_off_save;
151 int cont; /* <= 0 when finished */
152 int finished;
153 EVP_MD_CTX md;
154 int blockout; /* output block is ready */
155 int sigio; /* must process signature */
156 unsigned char buf[IOBS];
157 } BIO_OK_CTX;
158
159static BIO_METHOD methods_ok=
160 {
161 BIO_TYPE_CIPHER,"reliable",
162 ok_write,
163 ok_read,
164 NULL, /* ok_puts, */
165 NULL, /* ok_gets, */
166 ok_ctrl,
167 ok_new,
168 ok_free,
169 ok_callback_ctrl,
170 };
171
172BIO_METHOD *BIO_f_reliable(void)
173 {
174 return(&methods_ok);
175 }
176
177static int ok_new(BIO *bi)
178 {
179 BIO_OK_CTX *ctx;
180
181 ctx=(BIO_OK_CTX *)OPENSSL_malloc(sizeof(BIO_OK_CTX));
182 if (ctx == NULL) return(0);
183
184 ctx->buf_len=0;
185 ctx->buf_off=0;
186 ctx->buf_len_save=0;
187 ctx->buf_off_save=0;
188 ctx->cont=1;
189 ctx->finished=0;
190 ctx->blockout= 0;
191 ctx->sigio=1;
192
193 EVP_MD_CTX_init(&ctx->md);
194
195 bi->init=0;
196 bi->ptr=(char *)ctx;
197 bi->flags=0;
198 return(1);
199 }
200
201static int ok_free(BIO *a)
202 {
203 if (a == NULL) return(0);
204 EVP_MD_CTX_cleanup(&((BIO_OK_CTX *)a->ptr)->md);
205 OPENSSL_cleanse(a->ptr,sizeof(BIO_OK_CTX));
206 OPENSSL_free(a->ptr);
207 a->ptr=NULL;
208 a->init=0;
209 a->flags=0;
210 return(1);
211 }
212
213static int ok_read(BIO *b, char *out, int outl)
214 {
215 int ret=0,i,n;
216 BIO_OK_CTX *ctx;
217
218 if (out == NULL) return(0);
219 ctx=(BIO_OK_CTX *)b->ptr;
220
221 if ((ctx == NULL) || (b->next_bio == NULL) || (b->init == 0)) return(0);
222
223 while(outl > 0)
224 {
225
226 /* copy clean bytes to output buffer */
227 if (ctx->blockout)
228 {
229 i=ctx->buf_len-ctx->buf_off;
230 if (i > outl) i=outl;
231 memcpy(out,&(ctx->buf[ctx->buf_off]),i);
232 ret+=i;
233 out+=i;
234 outl-=i;
235 ctx->buf_off+=i;
236
237 /* all clean bytes are out */
238 if (ctx->buf_len == ctx->buf_off)
239 {
240 ctx->buf_off=0;
241
242 /* copy start of the next block into proper place */
243 if(ctx->buf_len_save- ctx->buf_off_save > 0)
244 {
245 ctx->buf_len= ctx->buf_len_save- ctx->buf_off_save;
246 memmove(ctx->buf, &(ctx->buf[ctx->buf_off_save]),
247 ctx->buf_len);
248 }
249 else
250 {
251 ctx->buf_len=0;
252 }
253 ctx->blockout= 0;
254 }
255 }
256
257 /* output buffer full -- cancel */
258 if (outl == 0) break;
259
260 /* no clean bytes in buffer -- fill it */
261 n=IOBS- ctx->buf_len;
262 i=BIO_read(b->next_bio,&(ctx->buf[ctx->buf_len]),n);
263
264 if (i <= 0) break; /* nothing new */
265
266 ctx->buf_len+= i;
267
268 /* no signature yet -- check if we got one */
269 if (ctx->sigio == 1)
270 {
271 if (!sig_in(b))
272 {
273 BIO_clear_retry_flags(b);
274 return 0;
275 }
276 }
277
278 /* signature ok -- check if we got block */
279 if (ctx->sigio == 0)
280 {
281 if (!block_in(b))
282 {
283 BIO_clear_retry_flags(b);
284 return 0;
285 }
286 }
287
288 /* invalid block -- cancel */
289 if (ctx->cont <= 0) break;
290
291 }
292
293 BIO_clear_retry_flags(b);
294 BIO_copy_next_retry(b);
295 return(ret);
296 }
297
298static int ok_write(BIO *b, const char *in, int inl)
299 {
300 int ret=0,n,i;
301 BIO_OK_CTX *ctx;
302
303 if (inl <= 0) return inl;
304
305 ctx=(BIO_OK_CTX *)b->ptr;
306 ret=inl;
307
308 if ((ctx == NULL) || (b->next_bio == NULL) || (b->init == 0)) return(0);
309
310 if(ctx->sigio && !sig_out(b))
311 return 0;
312
313 do{
314 BIO_clear_retry_flags(b);
315 n=ctx->buf_len-ctx->buf_off;
316 while (ctx->blockout && n > 0)
317 {
318 i=BIO_write(b->next_bio,&(ctx->buf[ctx->buf_off]),n);
319 if (i <= 0)
320 {
321 BIO_copy_next_retry(b);
322 if(!BIO_should_retry(b))
323 ctx->cont= 0;
324 return(i);
325 }
326 ctx->buf_off+=i;
327 n-=i;
328 }
329
330 /* at this point all pending data has been written */
331 ctx->blockout= 0;
332 if (ctx->buf_len == ctx->buf_off)
333 {
334 ctx->buf_len=OK_BLOCK_BLOCK;
335 ctx->buf_off=0;
336 }
337
338 if ((in == NULL) || (inl <= 0)) return(0);
339
340 n= (inl+ ctx->buf_len > OK_BLOCK_SIZE+ OK_BLOCK_BLOCK) ?
341 (int)(OK_BLOCK_SIZE+OK_BLOCK_BLOCK-ctx->buf_len) : inl;
342
343 memcpy((unsigned char *)(&(ctx->buf[ctx->buf_len])),(unsigned char *)in,n);
344 ctx->buf_len+= n;
345 inl-=n;
346 in+=n;
347
348 if(ctx->buf_len >= OK_BLOCK_SIZE+ OK_BLOCK_BLOCK)
349 {
350 if (!block_out(b))
351 {
352 BIO_clear_retry_flags(b);
353 return 0;
354 }
355 }
356 }while(inl > 0);
357
358 BIO_clear_retry_flags(b);
359 BIO_copy_next_retry(b);
360 return(ret);
361 }
362
363static long ok_ctrl(BIO *b, int cmd, long num, void *ptr)
364 {
365 BIO_OK_CTX *ctx;
366 EVP_MD *md;
367 const EVP_MD **ppmd;
368 long ret=1;
369 int i;
370
371 ctx=b->ptr;
372
373 switch (cmd)
374 {
375 case BIO_CTRL_RESET:
376 ctx->buf_len=0;
377 ctx->buf_off=0;
378 ctx->buf_len_save=0;
379 ctx->buf_off_save=0;
380 ctx->cont=1;
381 ctx->finished=0;
382 ctx->blockout= 0;
383 ctx->sigio=1;
384 ret=BIO_ctrl(b->next_bio,cmd,num,ptr);
385 break;
386 case BIO_CTRL_EOF: /* More to read */
387 if (ctx->cont <= 0)
388 ret=1;
389 else
390 ret=BIO_ctrl(b->next_bio,cmd,num,ptr);
391 break;
392 case BIO_CTRL_PENDING: /* More to read in buffer */
393 case BIO_CTRL_WPENDING: /* More to read in buffer */
394 ret=ctx->blockout ? ctx->buf_len-ctx->buf_off : 0;
395 if (ret <= 0)
396 ret=BIO_ctrl(b->next_bio,cmd,num,ptr);
397 break;
398 case BIO_CTRL_FLUSH:
399 /* do a final write */
400 if(ctx->blockout == 0)
401 if (!block_out(b))
402 return 0;
403
404 while (ctx->blockout)
405 {
406 i=ok_write(b,NULL,0);
407 if (i < 0)
408 {
409 ret=i;
410 break;
411 }
412 }
413
414 ctx->finished=1;
415 ctx->buf_off=ctx->buf_len=0;
416 ctx->cont=(int)ret;
417
418 /* Finally flush the underlying BIO */
419 ret=BIO_ctrl(b->next_bio,cmd,num,ptr);
420 break;
421 case BIO_C_DO_STATE_MACHINE:
422 BIO_clear_retry_flags(b);
423 ret=BIO_ctrl(b->next_bio,cmd,num,ptr);
424 BIO_copy_next_retry(b);
425 break;
426 case BIO_CTRL_INFO:
427 ret=(long)ctx->cont;
428 break;
429 case BIO_C_SET_MD:
430 md=ptr;
431 if (!EVP_DigestInit_ex(&ctx->md, md, NULL))
432 return 0;
433 b->init=1;
434 break;
435 case BIO_C_GET_MD:
436 if (b->init)
437 {
438 ppmd=ptr;
439 *ppmd=ctx->md.digest;
440 }
441 else
442 ret=0;
443 break;
444 default:
445 ret=BIO_ctrl(b->next_bio,cmd,num,ptr);
446 break;
447 }
448 return(ret);
449 }
450
451static long ok_callback_ctrl(BIO *b, int cmd, bio_info_cb *fp)
452 {
453 long ret=1;
454
455 if (b->next_bio == NULL) return(0);
456 switch (cmd)
457 {
458 default:
459 ret=BIO_callback_ctrl(b->next_bio,cmd,fp);
460 break;
461 }
462 return(ret);
463 }
464
465static void longswap(void *_ptr, size_t len)
466{ const union { long one; char little; } is_endian = {1};
467
468 if (is_endian.little) {
469 size_t i;
470 unsigned char *p=_ptr,c;
471
472 for(i= 0;i < len;i+= 4) {
473 c=p[0],p[0]=p[3],p[3]=c;
474 c=p[1],p[1]=p[2],p[2]=c;
475 }
476 }
477}
478
479static int sig_out(BIO* b)
480 {
481 BIO_OK_CTX *ctx;
482 EVP_MD_CTX *md;
483
484 ctx=b->ptr;
485 md=&ctx->md;
486
487 if(ctx->buf_len+ 2* md->digest->md_size > OK_BLOCK_SIZE) return 1;
488
489 if (!EVP_DigestInit_ex(md, md->digest, NULL))
490 goto berr;
491 /* FIXME: there's absolutely no guarantee this makes any sense at all,
492 * particularly now EVP_MD_CTX has been restructured.
493 */
494 RAND_pseudo_bytes(md->md_data, md->digest->md_size);
495 memcpy(&(ctx->buf[ctx->buf_len]), md->md_data, md->digest->md_size);
496 longswap(&(ctx->buf[ctx->buf_len]), md->digest->md_size);
497 ctx->buf_len+= md->digest->md_size;
498
499 if (!EVP_DigestUpdate(md, WELLKNOWN, strlen(WELLKNOWN)))
500 goto berr;
501 if (!EVP_DigestFinal_ex(md, &(ctx->buf[ctx->buf_len]), NULL))
502 goto berr;
503 ctx->buf_len+= md->digest->md_size;
504 ctx->blockout= 1;
505 ctx->sigio= 0;
506 return 1;
507 berr:
508 BIO_clear_retry_flags(b);
509 return 0;
510 }
511
512static int sig_in(BIO* b)
513 {
514 BIO_OK_CTX *ctx;
515 EVP_MD_CTX *md;
516 unsigned char tmp[EVP_MAX_MD_SIZE];
517 int ret= 0;
518
519 ctx=b->ptr;
520 md=&ctx->md;
521
522 if((int)(ctx->buf_len-ctx->buf_off) < 2*md->digest->md_size) return 1;
523
524 if (!EVP_DigestInit_ex(md, md->digest, NULL))
525 goto berr;
526 memcpy(md->md_data, &(ctx->buf[ctx->buf_off]), md->digest->md_size);
527 longswap(md->md_data, md->digest->md_size);
528 ctx->buf_off+= md->digest->md_size;
529
530 if (!EVP_DigestUpdate(md, WELLKNOWN, strlen(WELLKNOWN)))
531 goto berr;
532 if (!EVP_DigestFinal_ex(md, tmp, NULL))
533 goto berr;
534 ret= memcmp(&(ctx->buf[ctx->buf_off]), tmp, md->digest->md_size) == 0;
535 ctx->buf_off+= md->digest->md_size;
536 if(ret == 1)
537 {
538 ctx->sigio= 0;
539 if(ctx->buf_len != ctx->buf_off)
540 {
541 memmove(ctx->buf, &(ctx->buf[ctx->buf_off]), ctx->buf_len- ctx->buf_off);
542 }
543 ctx->buf_len-= ctx->buf_off;
544 ctx->buf_off= 0;
545 }
546 else
547 {
548 ctx->cont= 0;
549 }
550 return 1;
551 berr:
552 BIO_clear_retry_flags(b);
553 return 0;
554 }
555
556static int block_out(BIO* b)
557 {
558 BIO_OK_CTX *ctx;
559 EVP_MD_CTX *md;
560 unsigned long tl;
561
562 ctx=b->ptr;
563 md=&ctx->md;
564
565 tl= ctx->buf_len- OK_BLOCK_BLOCK;
566 ctx->buf[0]=(unsigned char)(tl>>24);
567 ctx->buf[1]=(unsigned char)(tl>>16);
568 ctx->buf[2]=(unsigned char)(tl>>8);
569 ctx->buf[3]=(unsigned char)(tl);
570 if (!EVP_DigestUpdate(md,
571 (unsigned char*) &(ctx->buf[OK_BLOCK_BLOCK]), tl))
572 goto berr;
573 if (!EVP_DigestFinal_ex(md, &(ctx->buf[ctx->buf_len]), NULL))
574 goto berr;
575 ctx->buf_len+= md->digest->md_size;
576 ctx->blockout= 1;
577 return 1;
578 berr:
579 BIO_clear_retry_flags(b);
580 return 0;
581 }
582
583static int block_in(BIO* b)
584 {
585 BIO_OK_CTX *ctx;
586 EVP_MD_CTX *md;
587 unsigned long tl= 0;
588 unsigned char tmp[EVP_MAX_MD_SIZE];
589
590 ctx=b->ptr;
591 md=&ctx->md;
592
593 assert(sizeof(tl)>=OK_BLOCK_BLOCK); /* always true */
594 tl =ctx->buf[0]; tl<<=8;
595 tl|=ctx->buf[1]; tl<<=8;
596 tl|=ctx->buf[2]; tl<<=8;
597 tl|=ctx->buf[3];
598
599 if (ctx->buf_len < tl+ OK_BLOCK_BLOCK+ md->digest->md_size) return 1;
600
601 if (!EVP_DigestUpdate(md,
602 (unsigned char*) &(ctx->buf[OK_BLOCK_BLOCK]), tl))
603 goto berr;
604 if (!EVP_DigestFinal_ex(md, tmp, NULL))
605 goto berr;
606 if(memcmp(&(ctx->buf[tl+ OK_BLOCK_BLOCK]), tmp, md->digest->md_size) == 0)
607 {
608 /* there might be parts from next block lurking around ! */
609 ctx->buf_off_save= tl+ OK_BLOCK_BLOCK+ md->digest->md_size;
610 ctx->buf_len_save= ctx->buf_len;
611 ctx->buf_off= OK_BLOCK_BLOCK;
612 ctx->buf_len= tl+ OK_BLOCK_BLOCK;
613 ctx->blockout= 1;
614 }
615 else
616 {
617 ctx->cont= 0;
618 }
619 return 1;
620 berr:
621 BIO_clear_retry_flags(b);
622 return 0;
623 }
624
diff --git a/src/lib/libcrypto/evp/c_allc.c b/src/lib/libcrypto/evp/c_allc.c
new file mode 100644
index 0000000000..2a45d435e5
--- /dev/null
+++ b/src/lib/libcrypto/evp/c_allc.c
@@ -0,0 +1,230 @@
1/* crypto/evp/c_allc.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
59#include <stdio.h>
60#include "cryptlib.h"
61#include <openssl/evp.h>
62#include <openssl/pkcs12.h>
63#include <openssl/objects.h>
64
65void OpenSSL_add_all_ciphers(void)
66 {
67
68#ifndef OPENSSL_NO_DES
69 EVP_add_cipher(EVP_des_cfb());
70 EVP_add_cipher(EVP_des_cfb1());
71 EVP_add_cipher(EVP_des_cfb8());
72 EVP_add_cipher(EVP_des_ede_cfb());
73 EVP_add_cipher(EVP_des_ede3_cfb());
74 EVP_add_cipher(EVP_des_ede3_cfb1());
75 EVP_add_cipher(EVP_des_ede3_cfb8());
76
77 EVP_add_cipher(EVP_des_ofb());
78 EVP_add_cipher(EVP_des_ede_ofb());
79 EVP_add_cipher(EVP_des_ede3_ofb());
80
81 EVP_add_cipher(EVP_desx_cbc());
82 EVP_add_cipher_alias(SN_desx_cbc,"DESX");
83 EVP_add_cipher_alias(SN_desx_cbc,"desx");
84
85 EVP_add_cipher(EVP_des_cbc());
86 EVP_add_cipher_alias(SN_des_cbc,"DES");
87 EVP_add_cipher_alias(SN_des_cbc,"des");
88 EVP_add_cipher(EVP_des_ede_cbc());
89 EVP_add_cipher(EVP_des_ede3_cbc());
90 EVP_add_cipher_alias(SN_des_ede3_cbc,"DES3");
91 EVP_add_cipher_alias(SN_des_ede3_cbc,"des3");
92
93 EVP_add_cipher(EVP_des_ecb());
94 EVP_add_cipher(EVP_des_ede());
95 EVP_add_cipher(EVP_des_ede3());
96#endif
97
98#ifndef OPENSSL_NO_RC4
99 EVP_add_cipher(EVP_rc4());
100 EVP_add_cipher(EVP_rc4_40());
101#ifndef OPENSSL_NO_MD5
102 EVP_add_cipher(EVP_rc4_hmac_md5());
103#endif
104#endif
105
106#ifndef OPENSSL_NO_IDEA
107 EVP_add_cipher(EVP_idea_ecb());
108 EVP_add_cipher(EVP_idea_cfb());
109 EVP_add_cipher(EVP_idea_ofb());
110 EVP_add_cipher(EVP_idea_cbc());
111 EVP_add_cipher_alias(SN_idea_cbc,"IDEA");
112 EVP_add_cipher_alias(SN_idea_cbc,"idea");
113#endif
114
115#ifndef OPENSSL_NO_SEED
116 EVP_add_cipher(EVP_seed_ecb());
117 EVP_add_cipher(EVP_seed_cfb());
118 EVP_add_cipher(EVP_seed_ofb());
119 EVP_add_cipher(EVP_seed_cbc());
120 EVP_add_cipher_alias(SN_seed_cbc,"SEED");
121 EVP_add_cipher_alias(SN_seed_cbc,"seed");
122#endif
123
124#ifndef OPENSSL_NO_RC2
125 EVP_add_cipher(EVP_rc2_ecb());
126 EVP_add_cipher(EVP_rc2_cfb());
127 EVP_add_cipher(EVP_rc2_ofb());
128 EVP_add_cipher(EVP_rc2_cbc());
129 EVP_add_cipher(EVP_rc2_40_cbc());
130 EVP_add_cipher(EVP_rc2_64_cbc());
131 EVP_add_cipher_alias(SN_rc2_cbc,"RC2");
132 EVP_add_cipher_alias(SN_rc2_cbc,"rc2");
133#endif
134
135#ifndef OPENSSL_NO_BF
136 EVP_add_cipher(EVP_bf_ecb());
137 EVP_add_cipher(EVP_bf_cfb());
138 EVP_add_cipher(EVP_bf_ofb());
139 EVP_add_cipher(EVP_bf_cbc());
140 EVP_add_cipher_alias(SN_bf_cbc,"BF");
141 EVP_add_cipher_alias(SN_bf_cbc,"bf");
142 EVP_add_cipher_alias(SN_bf_cbc,"blowfish");
143#endif
144
145#ifndef OPENSSL_NO_CAST
146 EVP_add_cipher(EVP_cast5_ecb());
147 EVP_add_cipher(EVP_cast5_cfb());
148 EVP_add_cipher(EVP_cast5_ofb());
149 EVP_add_cipher(EVP_cast5_cbc());
150 EVP_add_cipher_alias(SN_cast5_cbc,"CAST");
151 EVP_add_cipher_alias(SN_cast5_cbc,"cast");
152 EVP_add_cipher_alias(SN_cast5_cbc,"CAST-cbc");
153 EVP_add_cipher_alias(SN_cast5_cbc,"cast-cbc");
154#endif
155
156#ifndef OPENSSL_NO_RC5
157 EVP_add_cipher(EVP_rc5_32_12_16_ecb());
158 EVP_add_cipher(EVP_rc5_32_12_16_cfb());
159 EVP_add_cipher(EVP_rc5_32_12_16_ofb());
160 EVP_add_cipher(EVP_rc5_32_12_16_cbc());
161 EVP_add_cipher_alias(SN_rc5_cbc,"rc5");
162 EVP_add_cipher_alias(SN_rc5_cbc,"RC5");
163#endif
164
165#ifndef OPENSSL_NO_AES
166 EVP_add_cipher(EVP_aes_128_ecb());
167 EVP_add_cipher(EVP_aes_128_cbc());
168 EVP_add_cipher(EVP_aes_128_cfb());
169 EVP_add_cipher(EVP_aes_128_cfb1());
170 EVP_add_cipher(EVP_aes_128_cfb8());
171 EVP_add_cipher(EVP_aes_128_ofb());
172 EVP_add_cipher(EVP_aes_128_ctr());
173 EVP_add_cipher(EVP_aes_128_gcm());
174 EVP_add_cipher(EVP_aes_128_xts());
175 EVP_add_cipher_alias(SN_aes_128_cbc,"AES128");
176 EVP_add_cipher_alias(SN_aes_128_cbc,"aes128");
177 EVP_add_cipher(EVP_aes_192_ecb());
178 EVP_add_cipher(EVP_aes_192_cbc());
179 EVP_add_cipher(EVP_aes_192_cfb());
180 EVP_add_cipher(EVP_aes_192_cfb1());
181 EVP_add_cipher(EVP_aes_192_cfb8());
182 EVP_add_cipher(EVP_aes_192_ofb());
183 EVP_add_cipher(EVP_aes_192_ctr());
184 EVP_add_cipher(EVP_aes_192_gcm());
185 EVP_add_cipher_alias(SN_aes_192_cbc,"AES192");
186 EVP_add_cipher_alias(SN_aes_192_cbc,"aes192");
187 EVP_add_cipher(EVP_aes_256_ecb());
188 EVP_add_cipher(EVP_aes_256_cbc());
189 EVP_add_cipher(EVP_aes_256_cfb());
190 EVP_add_cipher(EVP_aes_256_cfb1());
191 EVP_add_cipher(EVP_aes_256_cfb8());
192 EVP_add_cipher(EVP_aes_256_ofb());
193 EVP_add_cipher(EVP_aes_256_ctr());
194 EVP_add_cipher(EVP_aes_256_gcm());
195 EVP_add_cipher(EVP_aes_256_xts());
196 EVP_add_cipher_alias(SN_aes_256_cbc,"AES256");
197 EVP_add_cipher_alias(SN_aes_256_cbc,"aes256");
198#if !defined(OPENSSL_NO_SHA) && !defined(OPENSSL_NO_SHA1)
199 EVP_add_cipher(EVP_aes_128_cbc_hmac_sha1());
200 EVP_add_cipher(EVP_aes_256_cbc_hmac_sha1());
201#endif
202#endif
203
204#ifndef OPENSSL_NO_CAMELLIA
205 EVP_add_cipher(EVP_camellia_128_ecb());
206 EVP_add_cipher(EVP_camellia_128_cbc());
207 EVP_add_cipher(EVP_camellia_128_cfb());
208 EVP_add_cipher(EVP_camellia_128_cfb1());
209 EVP_add_cipher(EVP_camellia_128_cfb8());
210 EVP_add_cipher(EVP_camellia_128_ofb());
211 EVP_add_cipher_alias(SN_camellia_128_cbc,"CAMELLIA128");
212 EVP_add_cipher_alias(SN_camellia_128_cbc,"camellia128");
213 EVP_add_cipher(EVP_camellia_192_ecb());
214 EVP_add_cipher(EVP_camellia_192_cbc());
215 EVP_add_cipher(EVP_camellia_192_cfb());
216 EVP_add_cipher(EVP_camellia_192_cfb1());
217 EVP_add_cipher(EVP_camellia_192_cfb8());
218 EVP_add_cipher(EVP_camellia_192_ofb());
219 EVP_add_cipher_alias(SN_camellia_192_cbc,"CAMELLIA192");
220 EVP_add_cipher_alias(SN_camellia_192_cbc,"camellia192");
221 EVP_add_cipher(EVP_camellia_256_ecb());
222 EVP_add_cipher(EVP_camellia_256_cbc());
223 EVP_add_cipher(EVP_camellia_256_cfb());
224 EVP_add_cipher(EVP_camellia_256_cfb1());
225 EVP_add_cipher(EVP_camellia_256_cfb8());
226 EVP_add_cipher(EVP_camellia_256_ofb());
227 EVP_add_cipher_alias(SN_camellia_256_cbc,"CAMELLIA256");
228 EVP_add_cipher_alias(SN_camellia_256_cbc,"camellia256");
229#endif
230 }
diff --git a/src/lib/libcrypto/evp/c_alld.c b/src/lib/libcrypto/evp/c_alld.c
new file mode 100644
index 0000000000..311e1fe2f8
--- /dev/null
+++ b/src/lib/libcrypto/evp/c_alld.c
@@ -0,0 +1,114 @@
1/* crypto/evp/c_alld.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
59#include <stdio.h>
60#include "cryptlib.h"
61#include <openssl/evp.h>
62#include <openssl/pkcs12.h>
63#include <openssl/objects.h>
64
65void OpenSSL_add_all_digests(void)
66 {
67#ifndef OPENSSL_NO_MD4
68 EVP_add_digest(EVP_md4());
69#endif
70#ifndef OPENSSL_NO_MD5
71 EVP_add_digest(EVP_md5());
72 EVP_add_digest_alias(SN_md5,"ssl2-md5");
73 EVP_add_digest_alias(SN_md5,"ssl3-md5");
74#endif
75#if !defined(OPENSSL_NO_SHA) && !defined(OPENSSL_NO_SHA0)
76 EVP_add_digest(EVP_sha());
77#ifndef OPENSSL_NO_DSA
78 EVP_add_digest(EVP_dss());
79#endif
80#endif
81#if !defined(OPENSSL_NO_SHA) && !defined(OPENSSL_NO_SHA1)
82 EVP_add_digest(EVP_sha1());
83 EVP_add_digest_alias(SN_sha1,"ssl3-sha1");
84 EVP_add_digest_alias(SN_sha1WithRSAEncryption,SN_sha1WithRSA);
85#ifndef OPENSSL_NO_DSA
86 EVP_add_digest(EVP_dss1());
87 EVP_add_digest_alias(SN_dsaWithSHA1,SN_dsaWithSHA1_2);
88 EVP_add_digest_alias(SN_dsaWithSHA1,"DSS1");
89 EVP_add_digest_alias(SN_dsaWithSHA1,"dss1");
90#endif
91#ifndef OPENSSL_NO_ECDSA
92 EVP_add_digest(EVP_ecdsa());
93#endif
94#endif
95#if !defined(OPENSSL_NO_MDC2) && !defined(OPENSSL_NO_DES)
96 EVP_add_digest(EVP_mdc2());
97#endif
98#ifndef OPENSSL_NO_RIPEMD
99 EVP_add_digest(EVP_ripemd160());
100 EVP_add_digest_alias(SN_ripemd160,"ripemd");
101 EVP_add_digest_alias(SN_ripemd160,"rmd160");
102#endif
103#ifndef OPENSSL_NO_SHA256
104 EVP_add_digest(EVP_sha224());
105 EVP_add_digest(EVP_sha256());
106#endif
107#ifndef OPENSSL_NO_SHA512
108 EVP_add_digest(EVP_sha384());
109 EVP_add_digest(EVP_sha512());
110#endif
111#ifndef OPENSSL_NO_WHIRLPOOL
112 EVP_add_digest(EVP_whirlpool());
113#endif
114 }
diff --git a/src/lib/libcrypto/evp/digest.c b/src/lib/libcrypto/evp/digest.c
index d14e8e48d5..467e6b5ae9 100644
--- a/src/lib/libcrypto/evp/digest.c
+++ b/src/lib/libcrypto/evp/digest.c
@@ -267,7 +267,6 @@ int EVP_DigestFinal_ex(EVP_MD_CTX *ctx, unsigned char *md, unsigned int *size)
267 return FIPS_digestfinal(ctx, md, size); 267 return FIPS_digestfinal(ctx, md, size);
268#else 268#else
269 int ret; 269 int ret;
270
271 OPENSSL_assert(ctx->digest->md_size <= EVP_MAX_MD_SIZE); 270 OPENSSL_assert(ctx->digest->md_size <= EVP_MAX_MD_SIZE);
272 ret=ctx->digest->final(ctx,md); 271 ret=ctx->digest->final(ctx,md);
273 if (size != NULL) 272 if (size != NULL)
@@ -366,11 +365,8 @@ int EVP_Digest(const void *data, size_t count,
366 365
367void EVP_MD_CTX_destroy(EVP_MD_CTX *ctx) 366void EVP_MD_CTX_destroy(EVP_MD_CTX *ctx)
368 { 367 {
369 if (ctx) 368 EVP_MD_CTX_cleanup(ctx);
370 { 369 OPENSSL_free(ctx);
371 EVP_MD_CTX_cleanup(ctx);
372 OPENSSL_free(ctx);
373 }
374 } 370 }
375 371
376/* This call frees resources associated with the context */ 372/* This call frees resources associated with the context */
diff --git a/src/lib/libcrypto/evp/e_aes.c b/src/lib/libcrypto/evp/e_aes.c
index c7869b69ef..1e4af0cb75 100644
--- a/src/lib/libcrypto/evp/e_aes.c
+++ b/src/lib/libcrypto/evp/e_aes.c
@@ -842,10 +842,7 @@ static int aes_gcm_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
842 gctx->ctr = NULL; 842 gctx->ctr = NULL;
843 break; 843 break;
844 } 844 }
845 else
846#endif 845#endif
847 (void)0; /* terminate potentially open 'else' */
848
849 AES_set_encrypt_key(key, ctx->key_len * 8, &gctx->ks); 846 AES_set_encrypt_key(key, ctx->key_len * 8, &gctx->ks);
850 CRYPTO_gcm128_init(&gctx->gcm, &gctx->ks, (block128_f)AES_encrypt); 847 CRYPTO_gcm128_init(&gctx->gcm, &gctx->ks, (block128_f)AES_encrypt);
851#ifdef AES_CTR_ASM 848#ifdef AES_CTR_ASM
@@ -972,6 +969,8 @@ static int aes_gcm_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
972 969
973 if (!gctx->iv_set) 970 if (!gctx->iv_set)
974 return -1; 971 return -1;
972 if (!ctx->encrypt && gctx->taglen < 0)
973 return -1;
975 if (in) 974 if (in)
976 { 975 {
977 if (out == NULL) 976 if (out == NULL)
@@ -1013,8 +1012,6 @@ static int aes_gcm_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
1013 { 1012 {
1014 if (!ctx->encrypt) 1013 if (!ctx->encrypt)
1015 { 1014 {
1016 if (gctx->taglen < 0)
1017 return -1;
1018 if (CRYPTO_gcm128_finish(&gctx->gcm, 1015 if (CRYPTO_gcm128_finish(&gctx->gcm,
1019 ctx->buf, gctx->taglen) != 0) 1016 ctx->buf, gctx->taglen) != 0)
1020 return -1; 1017 return -1;
@@ -1086,17 +1083,14 @@ static int aes_xts_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
1086 xctx->xts.block1 = (block128_f)vpaes_decrypt; 1083 xctx->xts.block1 = (block128_f)vpaes_decrypt;
1087 } 1084 }
1088 1085
1089 vpaes_set_encrypt_key(key + ctx->key_len/2, 1086 vpaes_set_encrypt_key(key + ctx->key_len/2,
1090 ctx->key_len * 4, &xctx->ks2); 1087 ctx->key_len * 4, &xctx->ks2);
1091 xctx->xts.block2 = (block128_f)vpaes_encrypt; 1088 xctx->xts.block2 = (block128_f)vpaes_encrypt;
1092 1089
1093 xctx->xts.key1 = &xctx->ks1; 1090 xctx->xts.key1 = &xctx->ks1;
1094 break; 1091 break;
1095 } 1092 }
1096 else
1097#endif 1093#endif
1098 (void)0; /* terminate potentially open 'else' */
1099
1100 if (enc) 1094 if (enc)
1101 { 1095 {
1102 AES_set_encrypt_key(key, ctx->key_len * 4, &xctx->ks1); 1096 AES_set_encrypt_key(key, ctx->key_len * 4, &xctx->ks1);
@@ -1223,7 +1217,6 @@ static int aes_ccm_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
1223 vpaes_set_encrypt_key(key, ctx->key_len*8, &cctx->ks); 1217 vpaes_set_encrypt_key(key, ctx->key_len*8, &cctx->ks);
1224 CRYPTO_ccm128_init(&cctx->ccm, cctx->M, cctx->L, 1218 CRYPTO_ccm128_init(&cctx->ccm, cctx->M, cctx->L,
1225 &cctx->ks, (block128_f)vpaes_encrypt); 1219 &cctx->ks, (block128_f)vpaes_encrypt);
1226 cctx->str = NULL;
1227 cctx->key_set = 1; 1220 cctx->key_set = 1;
1228 break; 1221 break;
1229 } 1222 }
diff --git a/src/lib/libcrypto/evp/e_aes_cbc_hmac_sha1.c b/src/lib/libcrypto/evp/e_aes_cbc_hmac_sha1.c
index fb2c884a78..483e04b605 100644
--- a/src/lib/libcrypto/evp/e_aes_cbc_hmac_sha1.c
+++ b/src/lib/libcrypto/evp/e_aes_cbc_hmac_sha1.c
@@ -328,11 +328,10 @@ static int aesni_cbc_hmac_sha1_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
328 328
329 if (res!=SHA_CBLOCK) continue; 329 if (res!=SHA_CBLOCK) continue;
330 330
331 /* j is not incremented yet */ 331 mask = 0-((inp_len+8-j)>>(sizeof(j)*8-1));
332 mask = 0-((inp_len+7-j)>>(sizeof(j)*8-1));
333 data->u[SHA_LBLOCK-1] |= bitlen&mask; 332 data->u[SHA_LBLOCK-1] |= bitlen&mask;
334 sha1_block_data_order(&key->md,data,1); 333 sha1_block_data_order(&key->md,data,1);
335 mask &= 0-((j-inp_len-72)>>(sizeof(j)*8-1)); 334 mask &= 0-((j-inp_len-73)>>(sizeof(j)*8-1));
336 pmac->u[0] |= key->md.h0 & mask; 335 pmac->u[0] |= key->md.h0 & mask;
337 pmac->u[1] |= key->md.h1 & mask; 336 pmac->u[1] |= key->md.h1 & mask;
338 pmac->u[2] |= key->md.h2 & mask; 337 pmac->u[2] |= key->md.h2 & mask;
diff --git a/src/lib/libcrypto/evp/e_des3.c b/src/lib/libcrypto/evp/e_des3.c
index 8d7b7de292..1e69972662 100644
--- a/src/lib/libcrypto/evp/e_des3.c
+++ b/src/lib/libcrypto/evp/e_des3.c
@@ -101,7 +101,7 @@ static int des_ede_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
101static int des_ede_ofb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, 101static int des_ede_ofb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
102 const unsigned char *in, size_t inl) 102 const unsigned char *in, size_t inl)
103{ 103{
104 while (inl>=EVP_MAXCHUNK) 104 if (inl>=EVP_MAXCHUNK)
105 { 105 {
106 DES_ede3_ofb64_encrypt(in, out, (long)EVP_MAXCHUNK, 106 DES_ede3_ofb64_encrypt(in, out, (long)EVP_MAXCHUNK,
107 &data(ctx)->ks1, &data(ctx)->ks2, &data(ctx)->ks3, 107 &data(ctx)->ks1, &data(ctx)->ks2, &data(ctx)->ks3,
@@ -132,7 +132,7 @@ static int des_ede_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
132 printf("\n"); 132 printf("\n");
133 } 133 }
134#endif /* KSSL_DEBUG */ 134#endif /* KSSL_DEBUG */
135 while (inl>=EVP_MAXCHUNK) 135 if (inl>=EVP_MAXCHUNK)
136 { 136 {
137 DES_ede3_cbc_encrypt(in, out, (long)EVP_MAXCHUNK, 137 DES_ede3_cbc_encrypt(in, out, (long)EVP_MAXCHUNK,
138 &data(ctx)->ks1, &data(ctx)->ks2, &data(ctx)->ks3, 138 &data(ctx)->ks1, &data(ctx)->ks2, &data(ctx)->ks3,
@@ -151,7 +151,7 @@ static int des_ede_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
151static int des_ede_cfb64_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, 151static int des_ede_cfb64_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
152 const unsigned char *in, size_t inl) 152 const unsigned char *in, size_t inl)
153{ 153{
154 while (inl>=EVP_MAXCHUNK) 154 if (inl>=EVP_MAXCHUNK)
155 { 155 {
156 DES_ede3_cfb64_encrypt(in, out, (long)EVP_MAXCHUNK, 156 DES_ede3_cfb64_encrypt(in, out, (long)EVP_MAXCHUNK,
157 &data(ctx)->ks1, &data(ctx)->ks2, &data(ctx)->ks3, 157 &data(ctx)->ks1, &data(ctx)->ks2, &data(ctx)->ks3,
diff --git a/src/lib/libcrypto/evp/e_dsa.c b/src/lib/libcrypto/evp/e_dsa.c
new file mode 100644
index 0000000000..b96f2738b3
--- /dev/null
+++ b/src/lib/libcrypto/evp/e_dsa.c
@@ -0,0 +1,71 @@
1/* crypto/evp/e_dsa.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
59#include <stdio.h>
60#include "cryptlib.h"
61#include <openssl/evp.h>
62#include <openssl/objects.h>
63#include <openssl/x509.h>
64
65static EVP_PKEY_METHOD dss_method=
66 {
67 DSA_sign,
68 DSA_verify,
69 {EVP_PKEY_DSA,EVP_PKEY_DSA2,EVP_PKEY_DSA3,NULL},
70 };
71
diff --git a/src/lib/libcrypto/evp/e_rc5.c b/src/lib/libcrypto/evp/e_rc5.c
new file mode 100644
index 0000000000..19a10c6402
--- /dev/null
+++ b/src/lib/libcrypto/evp/e_rc5.c
@@ -0,0 +1,126 @@
1/* crypto/evp/e_rc5.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
59#include <stdio.h>
60#include "cryptlib.h"
61
62#ifndef OPENSSL_NO_RC5
63
64#include <openssl/evp.h>
65#include <openssl/objects.h>
66#include "evp_locl.h"
67#include <openssl/rc5.h>
68
69static int r_32_12_16_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
70 const unsigned char *iv,int enc);
71static int rc5_ctrl(EVP_CIPHER_CTX *c, int type, int arg, void *ptr);
72
73typedef struct
74 {
75 int rounds; /* number of rounds */
76 RC5_32_KEY ks; /* key schedule */
77 } EVP_RC5_KEY;
78
79#define data(ctx) EVP_C_DATA(EVP_RC5_KEY,ctx)
80
81IMPLEMENT_BLOCK_CIPHER(rc5_32_12_16, ks, RC5_32, EVP_RC5_KEY, NID_rc5,
82 8, RC5_32_KEY_LENGTH, 8, 64,
83 EVP_CIPH_VARIABLE_LENGTH | EVP_CIPH_CTRL_INIT,
84 r_32_12_16_init_key, NULL,
85 NULL, NULL, rc5_ctrl)
86
87static int rc5_ctrl(EVP_CIPHER_CTX *c, int type, int arg, void *ptr)
88 {
89 switch(type)
90 {
91 case EVP_CTRL_INIT:
92 data(c)->rounds = RC5_12_ROUNDS;
93 return 1;
94
95 case EVP_CTRL_GET_RC5_ROUNDS:
96 *(int *)ptr = data(c)->rounds;
97 return 1;
98
99 case EVP_CTRL_SET_RC5_ROUNDS:
100 switch(arg)
101 {
102 case RC5_8_ROUNDS:
103 case RC5_12_ROUNDS:
104 case RC5_16_ROUNDS:
105 data(c)->rounds = arg;
106 return 1;
107
108 default:
109 EVPerr(EVP_F_RC5_CTRL, EVP_R_UNSUPORTED_NUMBER_OF_ROUNDS);
110 return 0;
111 }
112
113 default:
114 return -1;
115 }
116 }
117
118static int r_32_12_16_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
119 const unsigned char *iv, int enc)
120 {
121 RC5_32_set_key(&data(ctx)->ks,EVP_CIPHER_CTX_key_length(ctx),
122 key,data(ctx)->rounds);
123 return 1;
124 }
125
126#endif
diff --git a/src/lib/libcrypto/evp/e_seed.c b/src/lib/libcrypto/evp/e_seed.c
new file mode 100644
index 0000000000..2d1759d276
--- /dev/null
+++ b/src/lib/libcrypto/evp/e_seed.c
@@ -0,0 +1,83 @@
1/* crypto/evp/e_seed.c -*- mode:C; c-file-style: "eay" -*- */
2/* ====================================================================
3 * Copyright (c) 2007 The OpenSSL Project. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 *
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in
14 * the documentation and/or other materials provided with the
15 * distribution.
16 *
17 * 3. All advertising materials mentioning features or use of this
18 * software must display the following acknowledgment:
19 * "This product includes software developed by the OpenSSL Project
20 * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
21 *
22 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
23 * endorse or promote products derived from this software without
24 * prior written permission. For written permission, please contact
25 * openssl-core@openssl.org.
26 *
27 * 5. Products derived from this software may not be called "OpenSSL"
28 * nor may "OpenSSL" appear in their names without prior written
29 * permission of the OpenSSL Project.
30 *
31 * 6. Redistributions of any form whatsoever must retain the following
32 * acknowledgment:
33 * "This product includes software developed by the OpenSSL Project
34 * for use in the OpenSSL Toolkit (http://www.openssl.org/)"
35 *
36 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
37 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
38 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
39 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
40 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
41 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
42 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
43 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
44 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
45 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
46 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
47 * OF THE POSSIBILITY OF SUCH DAMAGE.
48 * ====================================================================
49 *
50 * This product includes cryptographic software written by Eric Young
51 * (eay@cryptsoft.com). This product includes software written by Tim
52 * Hudson (tjh@cryptsoft.com).
53 *
54 */
55
56#include <openssl/opensslconf.h>
57#ifndef OPENSSL_NO_SEED
58#include <openssl/evp.h>
59#include <openssl/err.h>
60#include <string.h>
61#include <assert.h>
62#include <openssl/seed.h>
63#include "evp_locl.h"
64
65static int seed_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, const unsigned char *iv, int enc);
66
67typedef struct
68 {
69 SEED_KEY_SCHEDULE ks;
70 } EVP_SEED_KEY;
71
72IMPLEMENT_BLOCK_CIPHER(seed, ks, SEED, EVP_SEED_KEY, NID_seed,
73 16, 16, 16, 128,
74 0, seed_init_key, 0, 0, 0, 0)
75
76static int seed_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
77 const unsigned char *iv, int enc)
78 {
79 SEED_set_key(key, ctx->cipher_data);
80 return 1;
81 }
82
83#endif
diff --git a/src/lib/libcrypto/evp/evp.h b/src/lib/libcrypto/evp/evp.h
index faeb3c24e6..3b1fa87576 100644
--- a/src/lib/libcrypto/evp/evp.h
+++ b/src/lib/libcrypto/evp/evp.h
@@ -788,8 +788,8 @@ const EVP_CIPHER *EVP_aes_128_cfb128(void);
788# define EVP_aes_128_cfb EVP_aes_128_cfb128 788# define EVP_aes_128_cfb EVP_aes_128_cfb128
789const EVP_CIPHER *EVP_aes_128_ofb(void); 789const EVP_CIPHER *EVP_aes_128_ofb(void);
790const EVP_CIPHER *EVP_aes_128_ctr(void); 790const EVP_CIPHER *EVP_aes_128_ctr(void);
791const EVP_CIPHER *EVP_aes_128_ccm(void);
792const EVP_CIPHER *EVP_aes_128_gcm(void); 791const EVP_CIPHER *EVP_aes_128_gcm(void);
792const EVP_CIPHER *EVP_aes_128_ccm(void);
793const EVP_CIPHER *EVP_aes_128_xts(void); 793const EVP_CIPHER *EVP_aes_128_xts(void);
794const EVP_CIPHER *EVP_aes_192_ecb(void); 794const EVP_CIPHER *EVP_aes_192_ecb(void);
795const EVP_CIPHER *EVP_aes_192_cbc(void); 795const EVP_CIPHER *EVP_aes_192_cbc(void);
@@ -799,8 +799,8 @@ const EVP_CIPHER *EVP_aes_192_cfb128(void);
799# define EVP_aes_192_cfb EVP_aes_192_cfb128 799# define EVP_aes_192_cfb EVP_aes_192_cfb128
800const EVP_CIPHER *EVP_aes_192_ofb(void); 800const EVP_CIPHER *EVP_aes_192_ofb(void);
801const EVP_CIPHER *EVP_aes_192_ctr(void); 801const EVP_CIPHER *EVP_aes_192_ctr(void);
802const EVP_CIPHER *EVP_aes_192_ccm(void);
803const EVP_CIPHER *EVP_aes_192_gcm(void); 802const EVP_CIPHER *EVP_aes_192_gcm(void);
803const EVP_CIPHER *EVP_aes_192_ccm(void);
804const EVP_CIPHER *EVP_aes_256_ecb(void); 804const EVP_CIPHER *EVP_aes_256_ecb(void);
805const EVP_CIPHER *EVP_aes_256_cbc(void); 805const EVP_CIPHER *EVP_aes_256_cbc(void);
806const EVP_CIPHER *EVP_aes_256_cfb1(void); 806const EVP_CIPHER *EVP_aes_256_cfb1(void);
@@ -809,8 +809,8 @@ const EVP_CIPHER *EVP_aes_256_cfb128(void);
809# define EVP_aes_256_cfb EVP_aes_256_cfb128 809# define EVP_aes_256_cfb EVP_aes_256_cfb128
810const EVP_CIPHER *EVP_aes_256_ofb(void); 810const EVP_CIPHER *EVP_aes_256_ofb(void);
811const EVP_CIPHER *EVP_aes_256_ctr(void); 811const EVP_CIPHER *EVP_aes_256_ctr(void);
812const EVP_CIPHER *EVP_aes_256_ccm(void);
813const EVP_CIPHER *EVP_aes_256_gcm(void); 812const EVP_CIPHER *EVP_aes_256_gcm(void);
813const EVP_CIPHER *EVP_aes_256_ccm(void);
814const EVP_CIPHER *EVP_aes_256_xts(void); 814const EVP_CIPHER *EVP_aes_256_xts(void);
815#if !defined(OPENSSL_NO_SHA) && !defined(OPENSSL_NO_SHA1) 815#if !defined(OPENSSL_NO_SHA) && !defined(OPENSSL_NO_SHA1)
816const EVP_CIPHER *EVP_aes_128_cbc_hmac_sha1(void); 816const EVP_CIPHER *EVP_aes_128_cbc_hmac_sha1(void);
@@ -1242,8 +1242,6 @@ void EVP_PKEY_meth_set_ctrl(EVP_PKEY_METHOD *pmeth,
1242 int (*ctrl_str)(EVP_PKEY_CTX *ctx, 1242 int (*ctrl_str)(EVP_PKEY_CTX *ctx,
1243 const char *type, const char *value)); 1243 const char *type, const char *value));
1244 1244
1245void EVP_add_alg_module(void);
1246
1247/* BEGIN ERROR CODES */ 1245/* BEGIN ERROR CODES */
1248/* The following lines are auto generated by the script mkerr.pl. Any changes 1246/* The following lines are auto generated by the script mkerr.pl. Any changes
1249 * made after this point may be overwritten when the script is next run. 1247 * made after this point may be overwritten when the script is next run.
@@ -1258,7 +1256,6 @@ void ERR_load_EVP_strings(void);
1258#define EVP_F_AES_INIT_KEY 133 1256#define EVP_F_AES_INIT_KEY 133
1259#define EVP_F_AES_XTS 172 1257#define EVP_F_AES_XTS 172
1260#define EVP_F_AES_XTS_CIPHER 175 1258#define EVP_F_AES_XTS_CIPHER 175
1261#define EVP_F_ALG_MODULE_INIT 177
1262#define EVP_F_CAMELLIA_INIT_KEY 159 1259#define EVP_F_CAMELLIA_INIT_KEY 159
1263#define EVP_F_CMAC_INIT 173 1260#define EVP_F_CMAC_INIT 173
1264#define EVP_F_D2I_PKEY 100 1261#define EVP_F_D2I_PKEY 100
@@ -1352,19 +1349,15 @@ void ERR_load_EVP_strings(void);
1352#define EVP_R_DIFFERENT_PARAMETERS 153 1349#define EVP_R_DIFFERENT_PARAMETERS 153
1353#define EVP_R_DISABLED_FOR_FIPS 163 1350#define EVP_R_DISABLED_FOR_FIPS 163
1354#define EVP_R_ENCODE_ERROR 115 1351#define EVP_R_ENCODE_ERROR 115
1355#define EVP_R_ERROR_LOADING_SECTION 165
1356#define EVP_R_ERROR_SETTING_FIPS_MODE 166
1357#define EVP_R_EVP_PBE_CIPHERINIT_ERROR 119 1352#define EVP_R_EVP_PBE_CIPHERINIT_ERROR 119
1358#define EVP_R_EXPECTING_AN_RSA_KEY 127 1353#define EVP_R_EXPECTING_AN_RSA_KEY 127
1359#define EVP_R_EXPECTING_A_DH_KEY 128 1354#define EVP_R_EXPECTING_A_DH_KEY 128
1360#define EVP_R_EXPECTING_A_DSA_KEY 129 1355#define EVP_R_EXPECTING_A_DSA_KEY 129
1361#define EVP_R_EXPECTING_A_ECDSA_KEY 141 1356#define EVP_R_EXPECTING_A_ECDSA_KEY 141
1362#define EVP_R_EXPECTING_A_EC_KEY 142 1357#define EVP_R_EXPECTING_A_EC_KEY 142
1363#define EVP_R_FIPS_MODE_NOT_SUPPORTED 167
1364#define EVP_R_INITIALIZATION_ERROR 134 1358#define EVP_R_INITIALIZATION_ERROR 134
1365#define EVP_R_INPUT_NOT_INITIALIZED 111 1359#define EVP_R_INPUT_NOT_INITIALIZED 111
1366#define EVP_R_INVALID_DIGEST 152 1360#define EVP_R_INVALID_DIGEST 152
1367#define EVP_R_INVALID_FIPS_MODE 168
1368#define EVP_R_INVALID_KEY_LENGTH 130 1361#define EVP_R_INVALID_KEY_LENGTH 130
1369#define EVP_R_INVALID_OPERATION 148 1362#define EVP_R_INVALID_OPERATION 148
1370#define EVP_R_IV_TOO_LARGE 102 1363#define EVP_R_IV_TOO_LARGE 102
@@ -1389,7 +1382,6 @@ void ERR_load_EVP_strings(void);
1389#define EVP_R_TOO_LARGE 164 1382#define EVP_R_TOO_LARGE 164
1390#define EVP_R_UNKNOWN_CIPHER 160 1383#define EVP_R_UNKNOWN_CIPHER 160
1391#define EVP_R_UNKNOWN_DIGEST 161 1384#define EVP_R_UNKNOWN_DIGEST 161
1392#define EVP_R_UNKNOWN_OPTION 169
1393#define EVP_R_UNKNOWN_PBE_ALGORITHM 121 1385#define EVP_R_UNKNOWN_PBE_ALGORITHM 121
1394#define EVP_R_UNSUPORTED_NUMBER_OF_ROUNDS 135 1386#define EVP_R_UNSUPORTED_NUMBER_OF_ROUNDS 135
1395#define EVP_R_UNSUPPORTED_ALGORITHM 156 1387#define EVP_R_UNSUPPORTED_ALGORITHM 156
diff --git a/src/lib/libcrypto/evp/evp_acnf.c b/src/lib/libcrypto/evp/evp_acnf.c
new file mode 100644
index 0000000000..643a1864e8
--- /dev/null
+++ b/src/lib/libcrypto/evp/evp_acnf.c
@@ -0,0 +1,73 @@
1/* evp_acnf.c */
2/* Written by Stephen Henson (steve@openssl.org) for the OpenSSL
3 * project 2001.
4 */
5/* ====================================================================
6 * Copyright (c) 2001 The OpenSSL Project. All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 *
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 *
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in
17 * the documentation and/or other materials provided with the
18 * distribution.
19 *
20 * 3. All advertising materials mentioning features or use of this
21 * software must display the following acknowledgment:
22 * "This product includes software developed by the OpenSSL Project
23 * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
24 *
25 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
26 * endorse or promote products derived from this software without
27 * prior written permission. For written permission, please contact
28 * licensing@OpenSSL.org.
29 *
30 * 5. Products derived from this software may not be called "OpenSSL"
31 * nor may "OpenSSL" appear in their names without prior written
32 * permission of the OpenSSL Project.
33 *
34 * 6. Redistributions of any form whatsoever must retain the following
35 * acknowledgment:
36 * "This product includes software developed by the OpenSSL Project
37 * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
38 *
39 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
40 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
41 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
42 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
43 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
44 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
45 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
46 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
47 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
48 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
49 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50 * OF THE POSSIBILITY OF SUCH DAMAGE.
51 * ====================================================================
52 *
53 * This product includes cryptographic software written by Eric Young
54 * (eay@cryptsoft.com). This product includes software written by Tim
55 * Hudson (tjh@cryptsoft.com).
56 *
57 */
58
59#include "cryptlib.h"
60#include <openssl/evp.h>
61#include <openssl/conf.h>
62
63
64/* Load all algorithms and configure OpenSSL.
65 * This function is called automatically when
66 * OPENSSL_LOAD_CONF is set.
67 */
68
69void OPENSSL_add_all_algorithms_conf(void)
70 {
71 OPENSSL_add_all_algorithms_noconf();
72 OPENSSL_config(NULL);
73 }
diff --git a/src/lib/libcrypto/evp/evp_err.c b/src/lib/libcrypto/evp/evp_err.c
index 08eab9882f..db0f76d59b 100644
--- a/src/lib/libcrypto/evp/evp_err.c
+++ b/src/lib/libcrypto/evp/evp_err.c
@@ -75,7 +75,6 @@ static ERR_STRING_DATA EVP_str_functs[]=
75{ERR_FUNC(EVP_F_AES_INIT_KEY), "AES_INIT_KEY"}, 75{ERR_FUNC(EVP_F_AES_INIT_KEY), "AES_INIT_KEY"},
76{ERR_FUNC(EVP_F_AES_XTS), "AES_XTS"}, 76{ERR_FUNC(EVP_F_AES_XTS), "AES_XTS"},
77{ERR_FUNC(EVP_F_AES_XTS_CIPHER), "AES_XTS_CIPHER"}, 77{ERR_FUNC(EVP_F_AES_XTS_CIPHER), "AES_XTS_CIPHER"},
78{ERR_FUNC(EVP_F_ALG_MODULE_INIT), "ALG_MODULE_INIT"},
79{ERR_FUNC(EVP_F_CAMELLIA_INIT_KEY), "CAMELLIA_INIT_KEY"}, 78{ERR_FUNC(EVP_F_CAMELLIA_INIT_KEY), "CAMELLIA_INIT_KEY"},
80{ERR_FUNC(EVP_F_CMAC_INIT), "CMAC_INIT"}, 79{ERR_FUNC(EVP_F_CMAC_INIT), "CMAC_INIT"},
81{ERR_FUNC(EVP_F_D2I_PKEY), "D2I_PKEY"}, 80{ERR_FUNC(EVP_F_D2I_PKEY), "D2I_PKEY"},
@@ -172,19 +171,15 @@ static ERR_STRING_DATA EVP_str_reasons[]=
172{ERR_REASON(EVP_R_DIFFERENT_PARAMETERS) ,"different parameters"}, 171{ERR_REASON(EVP_R_DIFFERENT_PARAMETERS) ,"different parameters"},
173{ERR_REASON(EVP_R_DISABLED_FOR_FIPS) ,"disabled for fips"}, 172{ERR_REASON(EVP_R_DISABLED_FOR_FIPS) ,"disabled for fips"},
174{ERR_REASON(EVP_R_ENCODE_ERROR) ,"encode error"}, 173{ERR_REASON(EVP_R_ENCODE_ERROR) ,"encode error"},
175{ERR_REASON(EVP_R_ERROR_LOADING_SECTION) ,"error loading section"},
176{ERR_REASON(EVP_R_ERROR_SETTING_FIPS_MODE),"error setting fips mode"},
177{ERR_REASON(EVP_R_EVP_PBE_CIPHERINIT_ERROR),"evp pbe cipherinit error"}, 174{ERR_REASON(EVP_R_EVP_PBE_CIPHERINIT_ERROR),"evp pbe cipherinit error"},
178{ERR_REASON(EVP_R_EXPECTING_AN_RSA_KEY) ,"expecting an rsa key"}, 175{ERR_REASON(EVP_R_EXPECTING_AN_RSA_KEY) ,"expecting an rsa key"},
179{ERR_REASON(EVP_R_EXPECTING_A_DH_KEY) ,"expecting a dh key"}, 176{ERR_REASON(EVP_R_EXPECTING_A_DH_KEY) ,"expecting a dh key"},
180{ERR_REASON(EVP_R_EXPECTING_A_DSA_KEY) ,"expecting a dsa key"}, 177{ERR_REASON(EVP_R_EXPECTING_A_DSA_KEY) ,"expecting a dsa key"},
181{ERR_REASON(EVP_R_EXPECTING_A_ECDSA_KEY) ,"expecting a ecdsa key"}, 178{ERR_REASON(EVP_R_EXPECTING_A_ECDSA_KEY) ,"expecting a ecdsa key"},
182{ERR_REASON(EVP_R_EXPECTING_A_EC_KEY) ,"expecting a ec key"}, 179{ERR_REASON(EVP_R_EXPECTING_A_EC_KEY) ,"expecting a ec key"},
183{ERR_REASON(EVP_R_FIPS_MODE_NOT_SUPPORTED),"fips mode not supported"},
184{ERR_REASON(EVP_R_INITIALIZATION_ERROR) ,"initialization error"}, 180{ERR_REASON(EVP_R_INITIALIZATION_ERROR) ,"initialization error"},
185{ERR_REASON(EVP_R_INPUT_NOT_INITIALIZED) ,"input not initialized"}, 181{ERR_REASON(EVP_R_INPUT_NOT_INITIALIZED) ,"input not initialized"},
186{ERR_REASON(EVP_R_INVALID_DIGEST) ,"invalid digest"}, 182{ERR_REASON(EVP_R_INVALID_DIGEST) ,"invalid digest"},
187{ERR_REASON(EVP_R_INVALID_FIPS_MODE) ,"invalid fips mode"},
188{ERR_REASON(EVP_R_INVALID_KEY_LENGTH) ,"invalid key length"}, 183{ERR_REASON(EVP_R_INVALID_KEY_LENGTH) ,"invalid key length"},
189{ERR_REASON(EVP_R_INVALID_OPERATION) ,"invalid operation"}, 184{ERR_REASON(EVP_R_INVALID_OPERATION) ,"invalid operation"},
190{ERR_REASON(EVP_R_IV_TOO_LARGE) ,"iv too large"}, 185{ERR_REASON(EVP_R_IV_TOO_LARGE) ,"iv too large"},
@@ -209,7 +204,6 @@ static ERR_STRING_DATA EVP_str_reasons[]=
209{ERR_REASON(EVP_R_TOO_LARGE) ,"too large"}, 204{ERR_REASON(EVP_R_TOO_LARGE) ,"too large"},
210{ERR_REASON(EVP_R_UNKNOWN_CIPHER) ,"unknown cipher"}, 205{ERR_REASON(EVP_R_UNKNOWN_CIPHER) ,"unknown cipher"},
211{ERR_REASON(EVP_R_UNKNOWN_DIGEST) ,"unknown digest"}, 206{ERR_REASON(EVP_R_UNKNOWN_DIGEST) ,"unknown digest"},
212{ERR_REASON(EVP_R_UNKNOWN_OPTION) ,"unknown option"},
213{ERR_REASON(EVP_R_UNKNOWN_PBE_ALGORITHM) ,"unknown pbe algorithm"}, 207{ERR_REASON(EVP_R_UNKNOWN_PBE_ALGORITHM) ,"unknown pbe algorithm"},
214{ERR_REASON(EVP_R_UNSUPORTED_NUMBER_OF_ROUNDS),"unsuported number of rounds"}, 208{ERR_REASON(EVP_R_UNSUPORTED_NUMBER_OF_ROUNDS),"unsuported number of rounds"},
215{ERR_REASON(EVP_R_UNSUPPORTED_ALGORITHM) ,"unsupported algorithm"}, 209{ERR_REASON(EVP_R_UNSUPPORTED_ALGORITHM) ,"unsupported algorithm"},
diff --git a/src/lib/libcrypto/evp/evp_fips.c b/src/lib/libcrypto/evp/evp_fips.c
new file mode 100644
index 0000000000..cb7f4fc0fa
--- /dev/null
+++ b/src/lib/libcrypto/evp/evp_fips.c
@@ -0,0 +1,113 @@
1/* crypto/evp/evp_fips.c */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project.
4 */
5/* ====================================================================
6 * Copyright (c) 2011 The OpenSSL Project. All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 *
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 *
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in
17 * the documentation and/or other materials provided with the
18 * distribution.
19 *
20 * 3. All advertising materials mentioning features or use of this
21 * software must display the following acknowledgment:
22 * "This product includes software developed by the OpenSSL Project
23 * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
24 *
25 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
26 * endorse or promote products derived from this software without
27 * prior written permission. For written permission, please contact
28 * licensing@OpenSSL.org.
29 *
30 * 5. Products derived from this software may not be called "OpenSSL"
31 * nor may "OpenSSL" appear in their names without prior written
32 * permission of the OpenSSL Project.
33 *
34 * 6. Redistributions of any form whatsoever must retain the following
35 * acknowledgment:
36 * "This product includes software developed by the OpenSSL Project
37 * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
38 *
39 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
40 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
41 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
42 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
43 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
44 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
45 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
46 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
47 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
48 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
49 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50 * OF THE POSSIBILITY OF SUCH DAMAGE.
51 * ====================================================================
52 */
53
54
55#include <openssl/evp.h>
56
57#ifdef OPENSSL_FIPS
58#include <openssl/fips.h>
59
60const EVP_CIPHER *EVP_aes_128_cbc(void) { return FIPS_evp_aes_128_cbc(); }
61const EVP_CIPHER *EVP_aes_128_ccm(void) { return FIPS_evp_aes_128_ccm(); }
62const EVP_CIPHER *EVP_aes_128_cfb1(void) { return FIPS_evp_aes_128_cfb1(); }
63const EVP_CIPHER *EVP_aes_128_cfb128(void) { return FIPS_evp_aes_128_cfb128(); }
64const EVP_CIPHER *EVP_aes_128_cfb8(void) { return FIPS_evp_aes_128_cfb8(); }
65const EVP_CIPHER *EVP_aes_128_ctr(void) { return FIPS_evp_aes_128_ctr(); }
66const EVP_CIPHER *EVP_aes_128_ecb(void) { return FIPS_evp_aes_128_ecb(); }
67const EVP_CIPHER *EVP_aes_128_gcm(void) { return FIPS_evp_aes_128_gcm(); }
68const EVP_CIPHER *EVP_aes_128_ofb(void) { return FIPS_evp_aes_128_ofb(); }
69const EVP_CIPHER *EVP_aes_128_xts(void) { return FIPS_evp_aes_128_xts(); }
70const EVP_CIPHER *EVP_aes_192_cbc(void) { return FIPS_evp_aes_192_cbc(); }
71const EVP_CIPHER *EVP_aes_192_ccm(void) { return FIPS_evp_aes_192_ccm(); }
72const EVP_CIPHER *EVP_aes_192_cfb1(void) { return FIPS_evp_aes_192_cfb1(); }
73const EVP_CIPHER *EVP_aes_192_cfb128(void) { return FIPS_evp_aes_192_cfb128(); }
74const EVP_CIPHER *EVP_aes_192_cfb8(void) { return FIPS_evp_aes_192_cfb8(); }
75const EVP_CIPHER *EVP_aes_192_ctr(void) { return FIPS_evp_aes_192_ctr(); }
76const EVP_CIPHER *EVP_aes_192_ecb(void) { return FIPS_evp_aes_192_ecb(); }
77const EVP_CIPHER *EVP_aes_192_gcm(void) { return FIPS_evp_aes_192_gcm(); }
78const EVP_CIPHER *EVP_aes_192_ofb(void) { return FIPS_evp_aes_192_ofb(); }
79const EVP_CIPHER *EVP_aes_256_cbc(void) { return FIPS_evp_aes_256_cbc(); }
80const EVP_CIPHER *EVP_aes_256_ccm(void) { return FIPS_evp_aes_256_ccm(); }
81const EVP_CIPHER *EVP_aes_256_cfb1(void) { return FIPS_evp_aes_256_cfb1(); }
82const EVP_CIPHER *EVP_aes_256_cfb128(void) { return FIPS_evp_aes_256_cfb128(); }
83const EVP_CIPHER *EVP_aes_256_cfb8(void) { return FIPS_evp_aes_256_cfb8(); }
84const EVP_CIPHER *EVP_aes_256_ctr(void) { return FIPS_evp_aes_256_ctr(); }
85const EVP_CIPHER *EVP_aes_256_ecb(void) { return FIPS_evp_aes_256_ecb(); }
86const EVP_CIPHER *EVP_aes_256_gcm(void) { return FIPS_evp_aes_256_gcm(); }
87const EVP_CIPHER *EVP_aes_256_ofb(void) { return FIPS_evp_aes_256_ofb(); }
88const EVP_CIPHER *EVP_aes_256_xts(void) { return FIPS_evp_aes_256_xts(); }
89const EVP_CIPHER *EVP_des_ede(void) { return FIPS_evp_des_ede(); }
90const EVP_CIPHER *EVP_des_ede3(void) { return FIPS_evp_des_ede3(); }
91const EVP_CIPHER *EVP_des_ede3_cbc(void) { return FIPS_evp_des_ede3_cbc(); }
92const EVP_CIPHER *EVP_des_ede3_cfb1(void) { return FIPS_evp_des_ede3_cfb1(); }
93const EVP_CIPHER *EVP_des_ede3_cfb64(void) { return FIPS_evp_des_ede3_cfb64(); }
94const EVP_CIPHER *EVP_des_ede3_cfb8(void) { return FIPS_evp_des_ede3_cfb8(); }
95const EVP_CIPHER *EVP_des_ede3_ecb(void) { return FIPS_evp_des_ede3_ecb(); }
96const EVP_CIPHER *EVP_des_ede3_ofb(void) { return FIPS_evp_des_ede3_ofb(); }
97const EVP_CIPHER *EVP_des_ede_cbc(void) { return FIPS_evp_des_ede_cbc(); }
98const EVP_CIPHER *EVP_des_ede_cfb64(void) { return FIPS_evp_des_ede_cfb64(); }
99const EVP_CIPHER *EVP_des_ede_ecb(void) { return FIPS_evp_des_ede_ecb(); }
100const EVP_CIPHER *EVP_des_ede_ofb(void) { return FIPS_evp_des_ede_ofb(); }
101const EVP_CIPHER *EVP_enc_null(void) { return FIPS_evp_enc_null(); }
102
103const EVP_MD *EVP_sha1(void) { return FIPS_evp_sha1(); }
104const EVP_MD *EVP_sha224(void) { return FIPS_evp_sha224(); }
105const EVP_MD *EVP_sha256(void) { return FIPS_evp_sha256(); }
106const EVP_MD *EVP_sha384(void) { return FIPS_evp_sha384(); }
107const EVP_MD *EVP_sha512(void) { return FIPS_evp_sha512(); }
108
109const EVP_MD *EVP_dss(void) { return FIPS_evp_dss(); }
110const EVP_MD *EVP_dss1(void) { return FIPS_evp_dss1(); }
111const EVP_MD *EVP_ecdsa(void) { return FIPS_evp_ecdsa(); }
112
113#endif
diff --git a/src/lib/libcrypto/evp/evp_test.c b/src/lib/libcrypto/evp/evp_test.c
new file mode 100644
index 0000000000..55c7cdfdcc
--- /dev/null
+++ b/src/lib/libcrypto/evp/evp_test.c
@@ -0,0 +1,450 @@
1/* Written by Ben Laurie, 2001 */
2/*
3 * Copyright (c) 2001 The OpenSSL Project. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 *
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in
14 * the documentation and/or other materials provided with the
15 * distribution.
16 *
17 * 3. All advertising materials mentioning features or use of this
18 * software must display the following acknowledgment:
19 * "This product includes software developed by the OpenSSL Project
20 * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
21 *
22 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
23 * endorse or promote products derived from this software without
24 * prior written permission. For written permission, please contact
25 * openssl-core@openssl.org.
26 *
27 * 5. Products derived from this software may not be called "OpenSSL"
28 * nor may "OpenSSL" appear in their names without prior written
29 * permission of the OpenSSL Project.
30 *
31 * 6. Redistributions of any form whatsoever must retain the following
32 * acknowledgment:
33 * "This product includes software developed by the OpenSSL Project
34 * for use in the OpenSSL Toolkit (http://www.openssl.org/)"
35 *
36 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
37 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
38 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
39 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
40 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
41 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
42 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
43 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
44 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
45 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
46 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
47 * OF THE POSSIBILITY OF SUCH DAMAGE.
48 */
49
50#include <stdio.h>
51#include <string.h>
52
53#include "../e_os.h"
54
55#include <openssl/opensslconf.h>
56#include <openssl/evp.h>
57#ifndef OPENSSL_NO_ENGINE
58#include <openssl/engine.h>
59#endif
60#include <openssl/err.h>
61#include <openssl/conf.h>
62
63static void hexdump(FILE *f,const char *title,const unsigned char *s,int l)
64 {
65 int n=0;
66
67 fprintf(f,"%s",title);
68 for( ; n < l ; ++n)
69 {
70 if((n%16) == 0)
71 fprintf(f,"\n%04x",n);
72 fprintf(f," %02x",s[n]);
73 }
74 fprintf(f,"\n");
75 }
76
77static int convert(unsigned char *s)
78 {
79 unsigned char *d;
80
81 for(d=s ; *s ; s+=2,++d)
82 {
83 unsigned int n;
84
85 if(!s[1])
86 {
87 fprintf(stderr,"Odd number of hex digits!");
88 EXIT(4);
89 }
90 sscanf((char *)s,"%2x",&n);
91 *d=(unsigned char)n;
92 }
93 return s-d;
94 }
95
96static char *sstrsep(char **string, const char *delim)
97 {
98 char isdelim[256];
99 char *token = *string;
100
101 if (**string == 0)
102 return NULL;
103
104 memset(isdelim, 0, 256);
105 isdelim[0] = 1;
106
107 while (*delim)
108 {
109 isdelim[(unsigned char)(*delim)] = 1;
110 delim++;
111 }
112
113 while (!isdelim[(unsigned char)(**string)])
114 {
115 (*string)++;
116 }
117
118 if (**string)
119 {
120 **string = 0;
121 (*string)++;
122 }
123
124 return token;
125 }
126
127static unsigned char *ustrsep(char **p,const char *sep)
128 { return (unsigned char *)sstrsep(p,sep); }
129
130static int test1_exit(int ec)
131 {
132 EXIT(ec);
133 return(0); /* To keep some compilers quiet */
134 }
135
136static void test1(const EVP_CIPHER *c,const unsigned char *key,int kn,
137 const unsigned char *iv,int in,
138 const unsigned char *plaintext,int pn,
139 const unsigned char *ciphertext,int cn,
140 int encdec)
141 {
142 EVP_CIPHER_CTX ctx;
143 unsigned char out[4096];
144 int outl,outl2;
145
146 printf("Testing cipher %s%s\n",EVP_CIPHER_name(c),
147 (encdec == 1 ? "(encrypt)" : (encdec == 0 ? "(decrypt)" : "(encrypt/decrypt)")));
148 hexdump(stdout,"Key",key,kn);
149 if(in)
150 hexdump(stdout,"IV",iv,in);
151 hexdump(stdout,"Plaintext",plaintext,pn);
152 hexdump(stdout,"Ciphertext",ciphertext,cn);
153
154 if(kn != c->key_len)
155 {
156 fprintf(stderr,"Key length doesn't match, got %d expected %lu\n",kn,
157 (unsigned long)c->key_len);
158 test1_exit(5);
159 }
160 EVP_CIPHER_CTX_init(&ctx);
161 if (encdec != 0)
162 {
163 if(!EVP_EncryptInit_ex(&ctx,c,NULL,key,iv))
164 {
165 fprintf(stderr,"EncryptInit failed\n");
166 ERR_print_errors_fp(stderr);
167 test1_exit(10);
168 }
169 EVP_CIPHER_CTX_set_padding(&ctx,0);
170
171 if(!EVP_EncryptUpdate(&ctx,out,&outl,plaintext,pn))
172 {
173 fprintf(stderr,"Encrypt failed\n");
174 ERR_print_errors_fp(stderr);
175 test1_exit(6);
176 }
177 if(!EVP_EncryptFinal_ex(&ctx,out+outl,&outl2))
178 {
179 fprintf(stderr,"EncryptFinal failed\n");
180 ERR_print_errors_fp(stderr);
181 test1_exit(7);
182 }
183
184 if(outl+outl2 != cn)
185 {
186 fprintf(stderr,"Ciphertext length mismatch got %d expected %d\n",
187 outl+outl2,cn);
188 test1_exit(8);
189 }
190
191 if(memcmp(out,ciphertext,cn))
192 {
193 fprintf(stderr,"Ciphertext mismatch\n");
194 hexdump(stderr,"Got",out,cn);
195 hexdump(stderr,"Expected",ciphertext,cn);
196 test1_exit(9);
197 }
198 }
199
200 if (encdec <= 0)
201 {
202 if(!EVP_DecryptInit_ex(&ctx,c,NULL,key,iv))
203 {
204 fprintf(stderr,"DecryptInit failed\n");
205 ERR_print_errors_fp(stderr);
206 test1_exit(11);
207 }
208 EVP_CIPHER_CTX_set_padding(&ctx,0);
209
210 if(!EVP_DecryptUpdate(&ctx,out,&outl,ciphertext,cn))
211 {
212 fprintf(stderr,"Decrypt failed\n");
213 ERR_print_errors_fp(stderr);
214 test1_exit(6);
215 }
216 if(!EVP_DecryptFinal_ex(&ctx,out+outl,&outl2))
217 {
218 fprintf(stderr,"DecryptFinal failed\n");
219 ERR_print_errors_fp(stderr);
220 test1_exit(7);
221 }
222
223 if(outl+outl2 != pn)
224 {
225 fprintf(stderr,"Plaintext length mismatch got %d expected %d\n",
226 outl+outl2,pn);
227 test1_exit(8);
228 }
229
230 if(memcmp(out,plaintext,pn))
231 {
232 fprintf(stderr,"Plaintext mismatch\n");
233 hexdump(stderr,"Got",out,pn);
234 hexdump(stderr,"Expected",plaintext,pn);
235 test1_exit(9);
236 }
237 }
238
239 EVP_CIPHER_CTX_cleanup(&ctx);
240
241 printf("\n");
242 }
243
244static int test_cipher(const char *cipher,const unsigned char *key,int kn,
245 const unsigned char *iv,int in,
246 const unsigned char *plaintext,int pn,
247 const unsigned char *ciphertext,int cn,
248 int encdec)
249 {
250 const EVP_CIPHER *c;
251
252 c=EVP_get_cipherbyname(cipher);
253 if(!c)
254 return 0;
255
256 test1(c,key,kn,iv,in,plaintext,pn,ciphertext,cn,encdec);
257
258 return 1;
259 }
260
261static int test_digest(const char *digest,
262 const unsigned char *plaintext,int pn,
263 const unsigned char *ciphertext, unsigned int cn)
264 {
265 const EVP_MD *d;
266 EVP_MD_CTX ctx;
267 unsigned char md[EVP_MAX_MD_SIZE];
268 unsigned int mdn;
269
270 d=EVP_get_digestbyname(digest);
271 if(!d)
272 return 0;
273
274 printf("Testing digest %s\n",EVP_MD_name(d));
275 hexdump(stdout,"Plaintext",plaintext,pn);
276 hexdump(stdout,"Digest",ciphertext,cn);
277
278 EVP_MD_CTX_init(&ctx);
279 if(!EVP_DigestInit_ex(&ctx,d, NULL))
280 {
281 fprintf(stderr,"DigestInit failed\n");
282 ERR_print_errors_fp(stderr);
283 EXIT(100);
284 }
285 if(!EVP_DigestUpdate(&ctx,plaintext,pn))
286 {
287 fprintf(stderr,"DigestUpdate failed\n");
288 ERR_print_errors_fp(stderr);
289 EXIT(101);
290 }
291 if(!EVP_DigestFinal_ex(&ctx,md,&mdn))
292 {
293 fprintf(stderr,"DigestFinal failed\n");
294 ERR_print_errors_fp(stderr);
295 EXIT(101);
296 }
297 EVP_MD_CTX_cleanup(&ctx);
298
299 if(mdn != cn)
300 {
301 fprintf(stderr,"Digest length mismatch, got %d expected %d\n",mdn,cn);
302 EXIT(102);
303 }
304
305 if(memcmp(md,ciphertext,cn))
306 {
307 fprintf(stderr,"Digest mismatch\n");
308 hexdump(stderr,"Got",md,cn);
309 hexdump(stderr,"Expected",ciphertext,cn);
310 EXIT(103);
311 }
312
313 printf("\n");
314
315 EVP_MD_CTX_cleanup(&ctx);
316
317 return 1;
318 }
319
320int main(int argc,char **argv)
321 {
322 const char *szTestFile;
323 FILE *f;
324
325 if(argc != 2)
326 {
327 fprintf(stderr,"%s <test file>\n",argv[0]);
328 EXIT(1);
329 }
330 CRYPTO_malloc_debug_init();
331 CRYPTO_set_mem_debug_options(V_CRYPTO_MDEBUG_ALL);
332 CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON);
333
334 szTestFile=argv[1];
335
336 f=fopen(szTestFile,"r");
337 if(!f)
338 {
339 perror(szTestFile);
340 EXIT(2);
341 }
342
343 /* Load up the software EVP_CIPHER and EVP_MD definitions */
344 OpenSSL_add_all_ciphers();
345 OpenSSL_add_all_digests();
346#ifndef OPENSSL_NO_ENGINE
347 /* Load all compiled-in ENGINEs */
348 ENGINE_load_builtin_engines();
349#endif
350#if 0
351 OPENSSL_config();
352#endif
353#ifndef OPENSSL_NO_ENGINE
354 /* Register all available ENGINE implementations of ciphers and digests.
355 * This could perhaps be changed to "ENGINE_register_all_complete()"? */
356 ENGINE_register_all_ciphers();
357 ENGINE_register_all_digests();
358 /* If we add command-line options, this statement should be switchable.
359 * It'll prevent ENGINEs being ENGINE_init()ialised for cipher/digest use if
360 * they weren't already initialised. */
361 /* ENGINE_set_cipher_flags(ENGINE_CIPHER_FLAG_NOINIT); */
362#endif
363
364 for( ; ; )
365 {
366 char line[4096];
367 char *p;
368 char *cipher;
369 unsigned char *iv,*key,*plaintext,*ciphertext;
370 int encdec;
371 int kn,in,pn,cn;
372
373 if(!fgets((char *)line,sizeof line,f))
374 break;
375 if(line[0] == '#' || line[0] == '\n')
376 continue;
377 p=line;
378 cipher=sstrsep(&p,":");
379 key=ustrsep(&p,":");
380 iv=ustrsep(&p,":");
381 plaintext=ustrsep(&p,":");
382 ciphertext=ustrsep(&p,":");
383 if (p[-1] == '\n') {
384 p[-1] = '\0';
385 encdec = -1;
386 } else {
387 encdec = atoi(sstrsep(&p,"\n"));
388 }
389
390
391 kn=convert(key);
392 in=convert(iv);
393 pn=convert(plaintext);
394 cn=convert(ciphertext);
395
396 if(!test_cipher(cipher,key,kn,iv,in,plaintext,pn,ciphertext,cn,encdec)
397 && !test_digest(cipher,plaintext,pn,ciphertext,cn))
398 {
399#ifdef OPENSSL_NO_AES
400 if (strstr(cipher, "AES") == cipher)
401 {
402 fprintf(stdout, "Cipher disabled, skipping %s\n", cipher);
403 continue;
404 }
405#endif
406#ifdef OPENSSL_NO_DES
407 if (strstr(cipher, "DES") == cipher)
408 {
409 fprintf(stdout, "Cipher disabled, skipping %s\n", cipher);
410 continue;
411 }
412#endif
413#ifdef OPENSSL_NO_RC4
414 if (strstr(cipher, "RC4") == cipher)
415 {
416 fprintf(stdout, "Cipher disabled, skipping %s\n", cipher);
417 continue;
418 }
419#endif
420#ifdef OPENSSL_NO_CAMELLIA
421 if (strstr(cipher, "CAMELLIA") == cipher)
422 {
423 fprintf(stdout, "Cipher disabled, skipping %s\n", cipher);
424 continue;
425 }
426#endif
427#ifdef OPENSSL_NO_SEED
428 if (strstr(cipher, "SEED") == cipher)
429 {
430 fprintf(stdout, "Cipher disabled, skipping %s\n", cipher);
431 continue;
432 }
433#endif
434 fprintf(stderr,"Can't find %s\n",cipher);
435 EXIT(3);
436 }
437 }
438 fclose(f);
439
440#ifndef OPENSSL_NO_ENGINE
441 ENGINE_cleanup();
442#endif
443 EVP_cleanup();
444 CRYPTO_cleanup_all_ex_data();
445 ERR_remove_thread_state(NULL);
446 ERR_free_strings();
447 CRYPTO_mem_leaks_fp(stderr);
448
449 return 0;
450 }
diff --git a/src/lib/libcrypto/evp/evptests.txt b/src/lib/libcrypto/evp/evptests.txt
new file mode 100644
index 0000000000..c273707c14
--- /dev/null
+++ b/src/lib/libcrypto/evp/evptests.txt
@@ -0,0 +1,334 @@
1#cipher:key:iv:plaintext:ciphertext:0/1(decrypt/encrypt)
2#digest:::input:output
3
4# SHA(1) tests (from shatest.c)
5SHA1:::616263:a9993e364706816aba3e25717850c26c9cd0d89d
6
7# MD5 tests (from md5test.c)
8MD5::::d41d8cd98f00b204e9800998ecf8427e
9MD5:::61:0cc175b9c0f1b6a831c399e269772661
10MD5:::616263:900150983cd24fb0d6963f7d28e17f72
11MD5:::6d65737361676520646967657374:f96b697d7cb7938d525a2f31aaf161d0
12MD5:::6162636465666768696a6b6c6d6e6f707172737475767778797a:c3fcd3d76192e4007dfb496cca67e13b
13MD5:::4142434445464748494a4b4c4d4e4f505152535455565758595a6162636465666768696a6b6c6d6e6f707172737475767778797a30313233343536373839:d174ab98d277d9f5a5611c2c9f419d9f
14MD5:::3132333435363738393031323334353637383930313233343536373839303132333435363738393031323334353637383930313233343536373839303132333435363738393031323334353637383930:57edf4a22be3c955ac49da2e2107b67a
15
16# AES 128 ECB tests (from FIPS-197 test vectors, encrypt)
17
18AES-128-ECB:000102030405060708090A0B0C0D0E0F::00112233445566778899AABBCCDDEEFF:69C4E0D86A7B0430D8CDB78070B4C55A:1
19
20# AES 192 ECB tests (from FIPS-197 test vectors, encrypt)
21
22AES-192-ECB:000102030405060708090A0B0C0D0E0F1011121314151617::00112233445566778899AABBCCDDEEFF:DDA97CA4864CDFE06EAF70A0EC0D7191:1
23
24# AES 256 ECB tests (from FIPS-197 test vectors, encrypt)
25
26AES-256-ECB:000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F::00112233445566778899AABBCCDDEEFF:8EA2B7CA516745BFEAFC49904B496089:1
27
28# AES 128 ECB tests (from NIST test vectors, encrypt)
29
30#AES-128-ECB:00000000000000000000000000000000::00000000000000000000000000000000:C34C052CC0DA8D73451AFE5F03BE297F:1
31
32# AES 128 ECB tests (from NIST test vectors, decrypt)
33
34#AES-128-ECB:00000000000000000000000000000000::44416AC2D1F53C583303917E6BE9EBE0:00000000000000000000000000000000:0
35
36# AES 192 ECB tests (from NIST test vectors, decrypt)
37
38#AES-192-ECB:000000000000000000000000000000000000000000000000::48E31E9E256718F29229319C19F15BA4:00000000000000000000000000000000:0
39
40# AES 256 ECB tests (from NIST test vectors, decrypt)
41
42#AES-256-ECB:0000000000000000000000000000000000000000000000000000000000000000::058CCFFDBBCB382D1F6F56585D8A4ADE:00000000000000000000000000000000:0
43
44# AES 128 CBC tests (from NIST test vectors, encrypt)
45
46#AES-128-CBC:00000000000000000000000000000000:00000000000000000000000000000000:00000000000000000000000000000000:8A05FC5E095AF4848A08D328D3688E3D:1
47
48# AES 192 CBC tests (from NIST test vectors, encrypt)
49
50#AES-192-CBC:000000000000000000000000000000000000000000000000:00000000000000000000000000000000:00000000000000000000000000000000:7BD966D53AD8C1BB85D2ADFAE87BB104:1
51
52# AES 256 CBC tests (from NIST test vectors, encrypt)
53
54#AES-256-CBC:0000000000000000000000000000000000000000000000000000000000000000:00000000000000000000000000000000:00000000000000000000000000000000:FE3C53653E2F45B56FCD88B2CC898FF0:1
55
56# AES 128 CBC tests (from NIST test vectors, decrypt)
57
58#AES-128-CBC:00000000000000000000000000000000:00000000000000000000000000000000:FACA37E0B0C85373DF706E73F7C9AF86:00000000000000000000000000000000:0
59
60# AES tests from NIST document SP800-38A
61# For all ECB encrypts and decrypts, the transformed sequence is
62# AES-bits-ECB:key::plaintext:ciphertext:encdec
63# ECB-AES128.Encrypt and ECB-AES128.Decrypt
64AES-128-ECB:2B7E151628AED2A6ABF7158809CF4F3C::6BC1BEE22E409F96E93D7E117393172A:3AD77BB40D7A3660A89ECAF32466EF97
65AES-128-ECB:2B7E151628AED2A6ABF7158809CF4F3C::AE2D8A571E03AC9C9EB76FAC45AF8E51:F5D3D58503B9699DE785895A96FDBAAF
66AES-128-ECB:2B7E151628AED2A6ABF7158809CF4F3C::30C81C46A35CE411E5FBC1191A0A52EF:43B1CD7F598ECE23881B00E3ED030688
67AES-128-ECB:2B7E151628AED2A6ABF7158809CF4F3C::F69F2445DF4F9B17AD2B417BE66C3710:7B0C785E27E8AD3F8223207104725DD4
68# ECB-AES192.Encrypt and ECB-AES192.Decrypt
69AES-192-ECB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B::6BC1BEE22E409F96E93D7E117393172A:BD334F1D6E45F25FF712A214571FA5CC
70AES-192-ECB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B::AE2D8A571E03AC9C9EB76FAC45AF8E51:974104846D0AD3AD7734ECB3ECEE4EEF
71AES-192-ECB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B::30C81C46A35CE411E5FBC1191A0A52EF:EF7AFD2270E2E60ADCE0BA2FACE6444E
72AES-192-ECB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B::F69F2445DF4F9B17AD2B417BE66C3710:9A4B41BA738D6C72FB16691603C18E0E
73# ECB-AES256.Encrypt and ECB-AES256.Decrypt
74AES-256-ECB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4::6BC1BEE22E409F96E93D7E117393172A:F3EED1BDB5D2A03C064B5A7E3DB181F8
75AES-256-ECB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4::AE2D8A571E03AC9C9EB76FAC45AF8E51:591CCB10D410ED26DC5BA74A31362870
76AES-256-ECB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4::30C81C46A35CE411E5FBC1191A0A52EF:B6ED21B99CA6F4F9F153E7B1BEAFED1D
77AES-256-ECB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4::F69F2445DF4F9B17AD2B417BE66C3710:23304B7A39F9F3FF067D8D8F9E24ECC7
78# For all CBC encrypts and decrypts, the transformed sequence is
79# AES-bits-CBC:key:IV/ciphertext':plaintext:ciphertext:encdec
80# CBC-AES128.Encrypt and CBC-AES128.Decrypt
81AES-128-CBC:2B7E151628AED2A6ABF7158809CF4F3C:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:7649ABAC8119B246CEE98E9B12E9197D
82AES-128-CBC:2B7E151628AED2A6ABF7158809CF4F3C:7649ABAC8119B246CEE98E9B12E9197D:AE2D8A571E03AC9C9EB76FAC45AF8E51:5086CB9B507219EE95DB113A917678B2
83AES-128-CBC:2B7E151628AED2A6ABF7158809CF4F3C:5086CB9B507219EE95DB113A917678B2:30C81C46A35CE411E5FBC1191A0A52EF:73BED6B8E3C1743B7116E69E22229516
84AES-128-CBC:2B7E151628AED2A6ABF7158809CF4F3C:73BED6B8E3C1743B7116E69E22229516:F69F2445DF4F9B17AD2B417BE66C3710:3FF1CAA1681FAC09120ECA307586E1A7
85# CBC-AES192.Encrypt and CBC-AES192.Decrypt
86AES-192-CBC:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:4F021DB243BC633D7178183A9FA071E8
87AES-192-CBC:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:4F021DB243BC633D7178183A9FA071E8:AE2D8A571E03AC9C9EB76FAC45AF8E51:B4D9ADA9AD7DEDF4E5E738763F69145A
88AES-192-CBC:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:B4D9ADA9AD7DEDF4E5E738763F69145A:30C81C46A35CE411E5FBC1191A0A52EF:571B242012FB7AE07FA9BAAC3DF102E0
89AES-192-CBC:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:571B242012FB7AE07FA9BAAC3DF102E0:F69F2445DF4F9B17AD2B417BE66C3710:08B0E27988598881D920A9E64F5615CD
90# CBC-AES256.Encrypt and CBC-AES256.Decrypt
91AES-256-CBC:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:F58C4C04D6E5F1BA779EABFB5F7BFBD6
92AES-256-CBC:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:F58C4C04D6E5F1BA779EABFB5F7BFBD6:AE2D8A571E03AC9C9EB76FAC45AF8E51:9CFC4E967EDB808D679F777BC6702C7D
93AES-256-CBC:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:9CFC4E967EDB808D679F777BC6702C7D:30C81C46A35CE411E5FBC1191A0A52EF:39F23369A9D9BACFA530E26304231461
94AES-256-CBC:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:39F23369A9D9BACFA530E26304231461:F69F2445DF4F9B17AD2B417BE66C3710:B2EB05E2C39BE9FCDA6C19078C6A9D1B
95# We don't support CFB{1,8}-AESxxx.{En,De}crypt
96# For all CFB128 encrypts and decrypts, the transformed sequence is
97# AES-bits-CFB:key:IV/ciphertext':plaintext:ciphertext:encdec
98# CFB128-AES128.Encrypt
99AES-128-CFB:2B7E151628AED2A6ABF7158809CF4F3C:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:3B3FD92EB72DAD20333449F8E83CFB4A:1
100AES-128-CFB:2B7E151628AED2A6ABF7158809CF4F3C:3B3FD92EB72DAD20333449F8E83CFB4A:AE2D8A571E03AC9C9EB76FAC45AF8E51:C8A64537A0B3A93FCDE3CDAD9F1CE58B:1
101AES-128-CFB:2B7E151628AED2A6ABF7158809CF4F3C:C8A64537A0B3A93FCDE3CDAD9F1CE58B:30C81C46A35CE411E5FBC1191A0A52EF:26751F67A3CBB140B1808CF187A4F4DF:1
102AES-128-CFB:2B7E151628AED2A6ABF7158809CF4F3C:26751F67A3CBB140B1808CF187A4F4DF:F69F2445DF4F9B17AD2B417BE66C3710:C04B05357C5D1C0EEAC4C66F9FF7F2E6:1
103# CFB128-AES128.Decrypt
104AES-128-CFB:2B7E151628AED2A6ABF7158809CF4F3C:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:3B3FD92EB72DAD20333449F8E83CFB4A:0
105AES-128-CFB:2B7E151628AED2A6ABF7158809CF4F3C:3B3FD92EB72DAD20333449F8E83CFB4A:AE2D8A571E03AC9C9EB76FAC45AF8E51:C8A64537A0B3A93FCDE3CDAD9F1CE58B:0
106AES-128-CFB:2B7E151628AED2A6ABF7158809CF4F3C:C8A64537A0B3A93FCDE3CDAD9F1CE58B:30C81C46A35CE411E5FBC1191A0A52EF:26751F67A3CBB140B1808CF187A4F4DF:0
107AES-128-CFB:2B7E151628AED2A6ABF7158809CF4F3C:26751F67A3CBB140B1808CF187A4F4DF:F69F2445DF4F9B17AD2B417BE66C3710:C04B05357C5D1C0EEAC4C66F9FF7F2E6:0
108# CFB128-AES192.Encrypt
109AES-192-CFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:CDC80D6FDDF18CAB34C25909C99A4174:1
110AES-192-CFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:CDC80D6FDDF18CAB34C25909C99A4174:AE2D8A571E03AC9C9EB76FAC45AF8E51:67CE7F7F81173621961A2B70171D3D7A:1
111AES-192-CFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:67CE7F7F81173621961A2B70171D3D7A:30C81C46A35CE411E5FBC1191A0A52EF:2E1E8A1DD59B88B1C8E60FED1EFAC4C9:1
112AES-192-CFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:2E1E8A1DD59B88B1C8E60FED1EFAC4C9:F69F2445DF4F9B17AD2B417BE66C3710:C05F9F9CA9834FA042AE8FBA584B09FF:1
113# CFB128-AES192.Decrypt
114AES-192-CFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:CDC80D6FDDF18CAB34C25909C99A4174:0
115AES-192-CFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:CDC80D6FDDF18CAB34C25909C99A4174:AE2D8A571E03AC9C9EB76FAC45AF8E51:67CE7F7F81173621961A2B70171D3D7A:0
116AES-192-CFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:67CE7F7F81173621961A2B70171D3D7A:30C81C46A35CE411E5FBC1191A0A52EF:2E1E8A1DD59B88B1C8E60FED1EFAC4C9:0
117AES-192-CFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:2E1E8A1DD59B88B1C8E60FED1EFAC4C9:F69F2445DF4F9B17AD2B417BE66C3710:C05F9F9CA9834FA042AE8FBA584B09FF:0
118# CFB128-AES256.Encrypt
119AES-256-CFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:DC7E84BFDA79164B7ECD8486985D3860:1
120AES-256-CFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:DC7E84BFDA79164B7ECD8486985D3860:AE2D8A571E03AC9C9EB76FAC45AF8E51:39FFED143B28B1C832113C6331E5407B:1
121AES-256-CFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:39FFED143B28B1C832113C6331E5407B:30C81C46A35CE411E5FBC1191A0A52EF:DF10132415E54B92A13ED0A8267AE2F9:1
122AES-256-CFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:DF10132415E54B92A13ED0A8267AE2F9:F69F2445DF4F9B17AD2B417BE66C3710:75A385741AB9CEF82031623D55B1E471:1
123# CFB128-AES256.Decrypt
124AES-256-CFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:DC7E84BFDA79164B7ECD8486985D3860:0
125AES-256-CFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:DC7E84BFDA79164B7ECD8486985D3860:AE2D8A571E03AC9C9EB76FAC45AF8E51:39FFED143B28B1C832113C6331E5407B:0
126AES-256-CFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:39FFED143B28B1C832113C6331E5407B:30C81C46A35CE411E5FBC1191A0A52EF:DF10132415E54B92A13ED0A8267AE2F9:0
127AES-256-CFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:DF10132415E54B92A13ED0A8267AE2F9:F69F2445DF4F9B17AD2B417BE66C3710:75A385741AB9CEF82031623D55B1E471:0
128# For all OFB encrypts and decrypts, the transformed sequence is
129# AES-bits-CFB:key:IV/output':plaintext:ciphertext:encdec
130# OFB-AES128.Encrypt
131AES-128-OFB:2B7E151628AED2A6ABF7158809CF4F3C:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:3B3FD92EB72DAD20333449F8E83CFB4A:1
132AES-128-OFB:2B7E151628AED2A6ABF7158809CF4F3C:50FE67CC996D32B6DA0937E99BAFEC60:AE2D8A571E03AC9C9EB76FAC45AF8E51:7789508D16918F03F53C52DAC54ED825:1
133AES-128-OFB:2B7E151628AED2A6ABF7158809CF4F3C:D9A4DADA0892239F6B8B3D7680E15674:30C81C46A35CE411E5FBC1191A0A52EF:9740051E9C5FECF64344F7A82260EDCC:1
134AES-128-OFB:2B7E151628AED2A6ABF7158809CF4F3C:A78819583F0308E7A6BF36B1386ABF23:F69F2445DF4F9B17AD2B417BE66C3710:304C6528F659C77866A510D9C1D6AE5E:1
135# OFB-AES128.Decrypt
136AES-128-OFB:2B7E151628AED2A6ABF7158809CF4F3C:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:3B3FD92EB72DAD20333449F8E83CFB4A:0
137AES-128-OFB:2B7E151628AED2A6ABF7158809CF4F3C:50FE67CC996D32B6DA0937E99BAFEC60:AE2D8A571E03AC9C9EB76FAC45AF8E51:7789508D16918F03F53C52DAC54ED825:0
138AES-128-OFB:2B7E151628AED2A6ABF7158809CF4F3C:D9A4DADA0892239F6B8B3D7680E15674:30C81C46A35CE411E5FBC1191A0A52EF:9740051E9C5FECF64344F7A82260EDCC:0
139AES-128-OFB:2B7E151628AED2A6ABF7158809CF4F3C:A78819583F0308E7A6BF36B1386ABF23:F69F2445DF4F9B17AD2B417BE66C3710:304C6528F659C77866A510D9C1D6AE5E:0
140# OFB-AES192.Encrypt
141AES-192-OFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:CDC80D6FDDF18CAB34C25909C99A4174:1
142AES-192-OFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:A609B38DF3B1133DDDFF2718BA09565E:AE2D8A571E03AC9C9EB76FAC45AF8E51:FCC28B8D4C63837C09E81700C1100401:1
143AES-192-OFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:52EF01DA52602FE0975F78AC84BF8A50:30C81C46A35CE411E5FBC1191A0A52EF:8D9A9AEAC0F6596F559C6D4DAF59A5F2:1
144AES-192-OFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:BD5286AC63AABD7EB067AC54B553F71D:F69F2445DF4F9B17AD2B417BE66C3710:6D9F200857CA6C3E9CAC524BD9ACC92A:1
145# OFB-AES192.Decrypt
146AES-192-OFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:CDC80D6FDDF18CAB34C25909C99A4174:0
147AES-192-OFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:A609B38DF3B1133DDDFF2718BA09565E:AE2D8A571E03AC9C9EB76FAC45AF8E51:FCC28B8D4C63837C09E81700C1100401:0
148AES-192-OFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:52EF01DA52602FE0975F78AC84BF8A50:30C81C46A35CE411E5FBC1191A0A52EF:8D9A9AEAC0F6596F559C6D4DAF59A5F2:0
149AES-192-OFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:BD5286AC63AABD7EB067AC54B553F71D:F69F2445DF4F9B17AD2B417BE66C3710:6D9F200857CA6C3E9CAC524BD9ACC92A:0
150# OFB-AES256.Encrypt
151AES-256-OFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:DC7E84BFDA79164B7ECD8486985D3860:1
152AES-256-OFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:B7BF3A5DF43989DD97F0FA97EBCE2F4A:AE2D8A571E03AC9C9EB76FAC45AF8E51:4FEBDC6740D20B3AC88F6AD82A4FB08D:1
153AES-256-OFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:E1C656305ED1A7A6563805746FE03EDC:30C81C46A35CE411E5FBC1191A0A52EF:71AB47A086E86EEDF39D1C5BBA97C408:1
154AES-256-OFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:41635BE625B48AFC1666DD42A09D96E7:F69F2445DF4F9B17AD2B417BE66C3710:0126141D67F37BE8538F5A8BE740E484:1
155# OFB-AES256.Decrypt
156AES-256-OFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:DC7E84BFDA79164B7ECD8486985D3860:0
157AES-256-OFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:B7BF3A5DF43989DD97F0FA97EBCE2F4A:AE2D8A571E03AC9C9EB76FAC45AF8E51:4FEBDC6740D20B3AC88F6AD82A4FB08D:0
158AES-256-OFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:E1C656305ED1A7A6563805746FE03EDC:30C81C46A35CE411E5FBC1191A0A52EF:71AB47A086E86EEDF39D1C5BBA97C408:0
159AES-256-OFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:41635BE625B48AFC1666DD42A09D96E7:F69F2445DF4F9B17AD2B417BE66C3710:0126141D67F37BE8538F5A8BE740E484:0
160
161# AES Counter test vectors from RFC3686
162aes-128-ctr:AE6852F8121067CC4BF7A5765577F39E:00000030000000000000000000000001:53696E676C6520626C6F636B206D7367:E4095D4FB7A7B3792D6175A3261311B8:1
163aes-128-ctr:7E24067817FAE0D743D6CE1F32539163:006CB6DBC0543B59DA48D90B00000001:000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F:5104A106168A72D9790D41EE8EDAD388EB2E1EFC46DA57C8FCE630DF9141BE28:1
164aes-128-ctr:7691BE035E5020A8AC6E618529F9A0DC:00E0017B27777F3F4A1786F000000001:000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F20212223:C1CF48A89F2FFDD9CF4652E9EFDB72D74540A42BDE6D7836D59A5CEAAEF3105325B2072F:1
165
166aes-192-ctr:16AF5B145FC9F579C175F93E3BFB0EED863D06CCFDB78515:0000004836733C147D6D93CB00000001:53696E676C6520626C6F636B206D7367:4B55384FE259C9C84E7935A003CBE928:1
167aes-192-ctr:7C5CB2401B3DC33C19E7340819E0F69C678C3DB8E6F6A91A:0096B03B020C6EADC2CB500D00000001:000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F:453243FC609B23327EDFAAFA7131CD9F8490701C5AD4A79CFC1FE0FF42F4FB00:1
168aes-192-ctr:02BF391EE8ECB159B959617B0965279BF59B60A786D3E0FE:0007BDFD5CBD60278DCC091200000001:000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F20212223:96893FC55E5C722F540B7DD1DDF7E758D288BC95C69165884536C811662F2188ABEE0935:1
169
170aes-256-ctr:776BEFF2851DB06F4C8A0542C8696F6C6A81AF1EEC96B4D37FC1D689E6C1C104:00000060DB5672C97AA8F0B200000001:53696E676C6520626C6F636B206D7367:145AD01DBF824EC7560863DC71E3E0C0:1
171aes-256-ctr:F6D66D6BD52D59BB0796365879EFF886C66DD51A5B6A99744B50590C87A23884:00FAAC24C1585EF15A43D87500000001:000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F:F05E231B3894612C49EE000B804EB2A9B8306B508F839D6A5530831D9344AF1C:1
172aes-256-ctr:FF7A617CE69148E4F1726E2F43581DE2AA62D9F805532EDFF1EED687FB54153D:001CC5B751A51D70A1C1114800000001:000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F20212223:EB6C52821D0BBBF7CE7594462ACA4FAAB407DF866569FD07F48CC0B583D6071F1EC0E6B8:1
173
174# DES ECB tests (from destest)
175
176DES-ECB:0000000000000000::0000000000000000:8CA64DE9C1B123A7
177DES-ECB:FFFFFFFFFFFFFFFF::FFFFFFFFFFFFFFFF:7359B2163E4EDC58
178DES-ECB:3000000000000000::1000000000000001:958E6E627A05557B
179DES-ECB:1111111111111111::1111111111111111:F40379AB9E0EC533
180DES-ECB:0123456789ABCDEF::1111111111111111:17668DFC7292532D
181DES-ECB:1111111111111111::0123456789ABCDEF:8A5AE1F81AB8F2DD
182DES-ECB:FEDCBA9876543210::0123456789ABCDEF:ED39D950FA74BCC4
183
184# DESX-CBC tests (from destest)
185DESX-CBC:0123456789abcdeff1e0d3c2b5a49786fedcba9876543210:fedcba9876543210:37363534333231204E6F77206973207468652074696D6520666F722000000000:846B2914851E9A2954732F8AA0A611C115CDC2D7951B1053A63C5E03B21AA3C4
186
187# DES EDE3 CBC tests (from destest)
188DES-EDE3-CBC:0123456789abcdeff1e0d3c2b5a49786fedcba9876543210:fedcba9876543210:37363534333231204E6F77206973207468652074696D6520666F722000000000:3FE301C962AC01D02213763C1CBD4CDC799657C064ECF5D41C673812CFDE9675
189
190# RC4 tests (from rc4test)
191RC4:0123456789abcdef0123456789abcdef::0123456789abcdef:75b7878099e0c596
192RC4:0123456789abcdef0123456789abcdef::0000000000000000:7494c2e7104b0879
193RC4:00000000000000000000000000000000::0000000000000000:de188941a3375d3a
194RC4:ef012345ef012345ef012345ef012345::0000000000000000000000000000000000000000:d6a141a7ec3c38dfbd615a1162e1c7ba36b67858
195RC4:0123456789abcdef0123456789abcdef::123456789ABCDEF0123456789ABCDEF0123456789ABCDEF012345678:66a0949f8af7d6891f7f832ba833c00c892ebe30143ce28740011ecf
196RC4:ef012345ef012345ef012345ef012345::00000000000000000000:d6a141a7ec3c38dfbd61
197
198
199# Camellia tests from RFC3713
200# For all ECB encrypts and decrypts, the transformed sequence is
201# CAMELLIA-bits-ECB:key::plaintext:ciphertext:encdec
202CAMELLIA-128-ECB:0123456789abcdeffedcba9876543210::0123456789abcdeffedcba9876543210:67673138549669730857065648eabe43
203CAMELLIA-192-ECB:0123456789abcdeffedcba98765432100011223344556677::0123456789abcdeffedcba9876543210:b4993401b3e996f84ee5cee7d79b09b9
204CAMELLIA-256-ECB:0123456789abcdeffedcba987654321000112233445566778899aabbccddeeff::0123456789abcdeffedcba9876543210:9acc237dff16d76c20ef7c919e3a7509
205
206# ECB-CAMELLIA128.Encrypt
207CAMELLIA-128-ECB:000102030405060708090A0B0C0D0E0F::00112233445566778899AABBCCDDEEFF:77CF412067AF8270613529149919546F:1
208CAMELLIA-192-ECB:000102030405060708090A0B0C0D0E0F1011121314151617::00112233445566778899AABBCCDDEEFF:B22F3C36B72D31329EEE8ADDC2906C68:1
209CAMELLIA-256-ECB:000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F::00112233445566778899AABBCCDDEEFF:2EDF1F3418D53B88841FC8985FB1ECF2:1
210
211# ECB-CAMELLIA128.Encrypt and ECB-CAMELLIA128.Decrypt
212CAMELLIA-128-ECB:2B7E151628AED2A6ABF7158809CF4F3C::6BC1BEE22E409F96E93D7E117393172A:432FC5DCD628115B7C388D770B270C96
213CAMELLIA-128-ECB:2B7E151628AED2A6ABF7158809CF4F3C::AE2D8A571E03AC9C9EB76FAC45AF8E51:0BE1F14023782A22E8384C5ABB7FAB2B
214CAMELLIA-128-ECB:2B7E151628AED2A6ABF7158809CF4F3C::30C81C46A35CE411E5FBC1191A0A52EF:A0A1ABCD1893AB6FE0FE5B65DF5F8636
215CAMELLIA-128-ECB:2B7E151628AED2A6ABF7158809CF4F3C::F69F2445DF4F9B17AD2B417BE66C3710:E61925E0D5DFAA9BB29F815B3076E51A
216
217# ECB-CAMELLIA192.Encrypt and ECB-CAMELLIA192.Decrypt
218CAMELLIA-192-ECB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B::6BC1BEE22E409F96E93D7E117393172A:CCCC6C4E138B45848514D48D0D3439D3
219CAMELLIA-192-ECB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B::AE2D8A571E03AC9C9EB76FAC45AF8E51:5713C62C14B2EC0F8393B6AFD6F5785A
220CAMELLIA-192-ECB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B::30C81C46A35CE411E5FBC1191A0A52EF:B40ED2B60EB54D09D030CF511FEEF366
221CAMELLIA-192-ECB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B::F69F2445DF4F9B17AD2B417BE66C3710:909DBD95799096748CB27357E73E1D26
222
223# ECB-CAMELLIA256.Encrypt and ECB-CAMELLIA256.Decrypt
224CAMELLIA-256-ECB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4::6BC1BEE22E409F96E93D7E117393172A:BEFD219B112FA00098919CD101C9CCFA
225CAMELLIA-256-ECB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4::AE2D8A571E03AC9C9EB76FAC45AF8E51:C91D3A8F1AEA08A9386CF4B66C0169EA
226CAMELLIA-256-ECB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4::30C81C46A35CE411E5FBC1191A0A52EF:A623D711DC5F25A51BB8A80D56397D28
227CAMELLIA-256-ECB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4::F69F2445DF4F9B17AD2B417BE66C3710:7960109FB6DC42947FCFE59EA3C5EB6B
228
229# For all CBC encrypts and decrypts, the transformed sequence is
230# CAMELLIA-bits-CBC:key:IV/ciphertext':plaintext:ciphertext:encdec
231# CBC-CAMELLIA128.Encrypt and CBC-CAMELLIA128.Decrypt
232CAMELLIA-128-CBC:2B7E151628AED2A6ABF7158809CF4F3C:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:1607CF494B36BBF00DAEB0B503C831AB
233CAMELLIA-128-CBC:2B7E151628AED2A6ABF7158809CF4F3C:1607CF494B36BBF00DAEB0B503C831AB:AE2D8A571E03AC9C9EB76FAC45AF8E51:A2F2CF671629EF7840C5A5DFB5074887
234CAMELLIA-128-CBC:2B7E151628AED2A6ABF7158809CF4F3C:A2F2CF671629EF7840C5A5DFB5074887:30C81C46A35CE411E5FBC1191A0A52EF:0F06165008CF8B8B5A63586362543E54
235CAMELLIA-128-CBC:2B7E151628AED2A6ABF7158809CF4F3C:36A84CDAFD5F9A85ADA0F0A993D6D577:F69F2445DF4F9B17AD2B417BE66C3710:74C64268CDB8B8FAF5B34E8AF3732980
236
237# CBC-CAMELLIA192.Encrypt and CBC-CAMELLIA192.Decrypt
238CAMELLIA-192-CBC:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:2A4830AB5AC4A1A2405955FD2195CF93
239CAMELLIA-192-CBC:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:2A4830AB5AC4A1A2405955FD2195CF93:AE2D8A571E03AC9C9EB76FAC45AF8E51:5D5A869BD14CE54264F892A6DD2EC3D5
240CAMELLIA-192-CBC:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:5D5A869BD14CE54264F892A6DD2EC3D5:30C81C46A35CE411E5FBC1191A0A52EF:37D359C3349836D884E310ADDF68C449
241CAMELLIA-192-CBC:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:37D359C3349836D884E310ADDF68C449:F69F2445DF4F9B17AD2B417BE66C3710:01FAAA930B4AB9916E9668E1428C6B08
242
243# CBC-CAMELLIA256.Encrypt and CBC-CAMELLIA256.Decrypt
244CAMELLIA-256-CBC:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:E6CFA35FC02B134A4D2C0B6737AC3EDA
245CAMELLIA-256-CBC:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:E6CFA35FC02B134A4D2C0B6737AC3EDA:AE2D8A571E03AC9C9EB76FAC45AF8E51:36CBEB73BD504B4070B1B7DE2B21EB50
246CAMELLIA-256-CBC:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:36CBEB73BD504B4070B1B7DE2B21EB50:30C81C46A35CE411E5FBC1191A0A52EF:E31A6055297D96CA3330CDF1B1860A83
247CAMELLIA-256-CBC:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:E31A6055297D96CA3330CDF1B1860A83:F69F2445DF4F9B17AD2B417BE66C3710:5D563F6D1CCCF236051C0C5C1C58F28F
248
249# We don't support CFB{1,8}-CAMELLIAxxx.{En,De}crypt
250# For all CFB128 encrypts and decrypts, the transformed sequence is
251# CAMELLIA-bits-CFB:key:IV/ciphertext':plaintext:ciphertext:encdec
252# CFB128-CAMELLIA128.Encrypt
253CAMELLIA-128-CFB:2B7E151628AED2A6ABF7158809CF4F3C:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:14F7646187817EB586599146B82BD719:1
254CAMELLIA-128-CFB:2B7E151628AED2A6ABF7158809CF4F3C:14F7646187817EB586599146B82BD719:AE2D8A571E03AC9C9EB76FAC45AF8E51:A53D28BB82DF741103EA4F921A44880B:1
255CAMELLIA-128-CFB:2B7E151628AED2A6ABF7158809CF4F3C:A53D28BB82DF741103EA4F921A44880B:30C81C46A35CE411E5FBC1191A0A52EF:9C2157A664626D1DEF9EA420FDE69B96:1
256CAMELLIA-128-CFB:2B7E151628AED2A6ABF7158809CF4F3C:9C2157A664626D1DEF9EA420FDE69B96:F69F2445DF4F9B17AD2B417BE66C3710:742A25F0542340C7BAEF24CA8482BB09:1
257
258# CFB128-CAMELLIA128.Decrypt
259CAMELLIA-128-CFB:2B7E151628AED2A6ABF7158809CF4F3C:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:14F7646187817EB586599146B82BD719:0
260CAMELLIA-128-CFB:2B7E151628AED2A6ABF7158809CF4F3C:14F7646187817EB586599146B82BD719:AE2D8A571E03AC9C9EB76FAC45AF8E51:A53D28BB82DF741103EA4F921A44880B:0
261CAMELLIA-128-CFB:2B7E151628AED2A6ABF7158809CF4F3C:A53D28BB82DF741103EA4F921A44880B:30C81C46A35CE411E5FBC1191A0A52EF:9C2157A664626D1DEF9EA420FDE69B96:0
262CAMELLIA-128-CFB:2B7E151628AED2A6ABF7158809CF4F3C:9C2157A664626D1DEF9EA420FDE69B96:F69F2445DF4F9B17AD2B417BE66C3710:742A25F0542340C7BAEF24CA8482BB09:0
263
264# CFB128-CAMELLIA192.Encrypt
265CAMELLIA-192-CFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:C832BB9780677DAA82D9B6860DCD565E:1
266CAMELLIA-192-CFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:C832BB9780677DAA82D9B6860DCD565E:AE2D8A571E03AC9C9EB76FAC45AF8E51:86F8491627906D780C7A6D46EA331F98:1
267CAMELLIA-192-CFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:86F8491627906D780C7A6D46EA331F98:30C81C46A35CE411E5FBC1191A0A52EF:69511CCE594CF710CB98BB63D7221F01:1
268CAMELLIA-192-CFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:69511CCE594CF710CB98BB63D7221F01:F69F2445DF4F9B17AD2B417BE66C3710:D5B5378A3ABED55803F25565D8907B84:1
269
270# CFB128-CAMELLIA192.Decrypt
271CAMELLIA-192-CFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:C832BB9780677DAA82D9B6860DCD565E:0
272CAMELLIA-192-CFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:C832BB9780677DAA82D9B6860DCD565E:AE2D8A571E03AC9C9EB76FAC45AF8E51:86F8491627906D780C7A6D46EA331F98:0
273CAMELLIA-192-CFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:86F8491627906D780C7A6D46EA331F98:30C81C46A35CE411E5FBC1191A0A52EF:69511CCE594CF710CB98BB63D7221F01:0
274CAMELLIA-192-CFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:69511CCE594CF710CB98BB63D7221F01:F69F2445DF4F9B17AD2B417BE66C3710:D5B5378A3ABED55803F25565D8907B84:0
275
276# CFB128-CAMELLIA256.Encrypt
277CAMELLIA-256-CFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:CF6107BB0CEA7D7FB1BD31F5E7B06C93:1
278CAMELLIA-256-CFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:CF6107BB0CEA7D7FB1BD31F5E7B06C93:AE2D8A571E03AC9C9EB76FAC45AF8E51:89BEDB4CCDD864EA11BA4CBE849B5E2B:1
279CAMELLIA-256-CFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:89BEDB4CCDD864EA11BA4CBE849B5E2B:30C81C46A35CE411E5FBC1191A0A52EF:555FC3F34BDD2D54C62D9E3BF338C1C4:1
280CAMELLIA-256-CFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:555FC3F34BDD2D54C62D9E3BF338C1C4:F69F2445DF4F9B17AD2B417BE66C3710:5953ADCE14DB8C7F39F1BD39F359BFFA:1
281
282# CFB128-CAMELLIA256.Decrypt
283CAMELLIA-256-CFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:CF6107BB0CEA7D7FB1BD31F5E7B06C93:0
284CAMELLIA-256-CFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:CF6107BB0CEA7D7FB1BD31F5E7B06C93:AE2D8A571E03AC9C9EB76FAC45AF8E51:89BEDB4CCDD864EA11BA4CBE849B5E2B:0
285CAMELLIA-256-CFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:89BEDB4CCDD864EA11BA4CBE849B5E2B:30C81C46A35CE411E5FBC1191A0A52EF:555FC3F34BDD2D54C62D9E3BF338C1C4:0
286CAMELLIA-256-CFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:555FC3F34BDD2D54C62D9E3BF338C1C4:F69F2445DF4F9B17AD2B417BE66C3710:5953ADCE14DB8C7F39F1BD39F359BFFA:0
287
288# For all OFB encrypts and decrypts, the transformed sequence is
289# CAMELLIA-bits-OFB:key:IV/output':plaintext:ciphertext:encdec
290# OFB-CAMELLIA128.Encrypt
291CAMELLIA-128-OFB:2B7E151628AED2A6ABF7158809CF4F3C:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:14F7646187817EB586599146B82BD719:1
292CAMELLIA-128-OFB:2B7E151628AED2A6ABF7158809CF4F3C:50FE67CC996D32B6DA0937E99BAFEC60:AE2D8A571E03AC9C9EB76FAC45AF8E51:25623DB569CA51E01482649977E28D84:1
293CAMELLIA-128-OFB:2B7E151628AED2A6ABF7158809CF4F3C:D9A4DADA0892239F6B8B3D7680E15674:30C81C46A35CE411E5FBC1191A0A52EF:C776634A60729DC657D12B9FCA801E98:1
294CAMELLIA-128-OFB:2B7E151628AED2A6ABF7158809CF4F3C:A78819583F0308E7A6BF36B1386ABF23:F69F2445DF4F9B17AD2B417BE66C3710:D776379BE0E50825E681DA1A4C980E8E:1
295
296# OFB-CAMELLIA128.Decrypt
297CAMELLIA-128-OFB:2B7E151628AED2A6ABF7158809CF4F3C:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:14F7646187817EB586599146B82BD719:0
298CAMELLIA-128-OFB:2B7E151628AED2A6ABF7158809CF4F3C:50FE67CC996D32B6DA0937E99BAFEC60:AE2D8A571E03AC9C9EB76FAC45AF8E51:25623DB569CA51E01482649977E28D84:0
299CAMELLIA-128-OFB:2B7E151628AED2A6ABF7158809CF4F3C:D9A4DADA0892239F6B8B3D7680E15674:30C81C46A35CE411E5FBC1191A0A52EF:C776634A60729DC657D12B9FCA801E98:0
300CAMELLIA-128-OFB:2B7E151628AED2A6ABF7158809CF4F3C:A78819583F0308E7A6BF36B1386ABF23:F69F2445DF4F9B17AD2B417BE66C3710:D776379BE0E50825E681DA1A4C980E8E:0
301
302# OFB-CAMELLIA192.Encrypt
303CAMELLIA-192-OFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:C832BB9780677DAA82D9B6860DCD565E:1
304CAMELLIA-192-OFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:A609B38DF3B1133DDDFF2718BA09565E:AE2D8A571E03AC9C9EB76FAC45AF8E51:8ECEB7D0350D72C7F78562AEBDF99339:1
305CAMELLIA-192-OFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:52EF01DA52602FE0975F78AC84BF8A50:30C81C46A35CE411E5FBC1191A0A52EF:BDD62DBBB9700846C53B507F544696F0:1
306CAMELLIA-192-OFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:BD5286AC63AABD7EB067AC54B553F71D:F69F2445DF4F9B17AD2B417BE66C3710:E28014E046B802F385C4C2E13EAD4A72:1
307
308# OFB-CAMELLIA192.Decrypt
309CAMELLIA-192-OFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:C832BB9780677DAA82D9B6860DCD565E:0
310CAMELLIA-192-OFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:A609B38DF3B1133DDDFF2718BA09565E:AE2D8A571E03AC9C9EB76FAC45AF8E51:8ECEB7D0350D72C7F78562AEBDF99339:0
311CAMELLIA-192-OFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:52EF01DA52602FE0975F78AC84BF8A50:30C81C46A35CE411E5FBC1191A0A52EF:BDD62DBBB9700846C53B507F544696F0:0
312CAMELLIA-192-OFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:BD5286AC63AABD7EB067AC54B553F71D:F69F2445DF4F9B17AD2B417BE66C3710:E28014E046B802F385C4C2E13EAD4A72:0
313
314# OFB-CAMELLIA256.Encrypt
315CAMELLIA-256-OFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:CF6107BB0CEA7D7FB1BD31F5E7B06C93:1
316CAMELLIA-256-OFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:B7BF3A5DF43989DD97F0FA97EBCE2F4A:AE2D8A571E03AC9C9EB76FAC45AF8E51:127AD97E8E3994E4820027D7BA109368:1
317CAMELLIA-256-OFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:E1C656305ED1A7A6563805746FE03EDC:30C81C46A35CE411E5FBC1191A0A52EF:6BFF6265A6A6B7A535BC65A80B17214E:1
318CAMELLIA-256-OFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:41635BE625B48AFC1666DD42A09D96E7:F69F2445DF4F9B17AD2B417BE66C3710:0A4A0404E26AA78A27CB271E8BF3CF20:1
319
320# OFB-CAMELLIA256.Decrypt
321CAMELLIA-256-OFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:CF6107BB0CEA7D7FB1BD31F5E7B06C93:0
322CAMELLIA-256-OFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:B7BF3A5DF43989DD97F0FA97EBCE2F4A:AE2D8A571E03AC9C9EB76FAC45AF8E51:127AD97E8E3994E4820027D7BA109368:0
323CAMELLIA-256-OFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:E1C656305ED1A7A6563805746FE03EDC:30C81C46A35CE411E5FBC1191A0A52EF:6BFF6265A6A6B7A535BC65A80B17214E:0
324CAMELLIA-256-OFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:41635BE625B48AFC1666DD42A09D96E7:F69F2445DF4F9B17AD2B417BE66C3710:0A4A0404E26AA78A27CB271E8BF3CF20:0
325
326# SEED test vectors from RFC4269
327SEED-ECB:00000000000000000000000000000000::000102030405060708090A0B0C0D0E0F:5EBAC6E0054E166819AFF1CC6D346CDB:0
328SEED-ECB:000102030405060708090A0B0C0D0E0F::00000000000000000000000000000000:C11F22F20140505084483597E4370F43:0
329SEED-ECB:4706480851E61BE85D74BFB3FD956185::83A2F8A288641FB9A4E9A5CC2F131C7D:EE54D13EBCAE706D226BC3142CD40D4A:0
330SEED-ECB:28DBC3BC49FFD87DCFA509B11D422BE7::B41E6BE2EBA84A148E2EED84593C5EC7:9B9B7BFCD1813CB95D0B3618F40F5122:0
331SEED-ECB:00000000000000000000000000000000::000102030405060708090A0B0C0D0E0F:5EBAC6E0054E166819AFF1CC6D346CDB:1
332SEED-ECB:000102030405060708090A0B0C0D0E0F::00000000000000000000000000000000:C11F22F20140505084483597E4370F43:1
333SEED-ECB:4706480851E61BE85D74BFB3FD956185::83A2F8A288641FB9A4E9A5CC2F131C7D:EE54D13EBCAE706D226BC3142CD40D4A:1
334SEED-ECB:28DBC3BC49FFD87DCFA509B11D422BE7::B41E6BE2EBA84A148E2EED84593C5EC7:9B9B7BFCD1813CB95D0B3618F40F5122:1
diff --git a/src/lib/libcrypto/evp/m_dss.c b/src/lib/libcrypto/evp/m_dss.c
index 6fb7e9a861..4ad63ada6f 100644
--- a/src/lib/libcrypto/evp/m_dss.c
+++ b/src/lib/libcrypto/evp/m_dss.c
@@ -60,7 +60,7 @@
60#include "cryptlib.h" 60#include "cryptlib.h"
61#include <openssl/evp.h> 61#include <openssl/evp.h>
62#include <openssl/objects.h> 62#include <openssl/objects.h>
63#include <openssl/sha.h> 63#include <openssl/x509.h>
64#ifndef OPENSSL_NO_DSA 64#ifndef OPENSSL_NO_DSA
65#include <openssl/dsa.h> 65#include <openssl/dsa.h>
66#endif 66#endif
diff --git a/src/lib/libcrypto/evp/m_dss1.c b/src/lib/libcrypto/evp/m_dss1.c
index 2df362a670..f80170efeb 100644
--- a/src/lib/libcrypto/evp/m_dss1.c
+++ b/src/lib/libcrypto/evp/m_dss1.c
@@ -63,7 +63,7 @@
63 63
64#include <openssl/evp.h> 64#include <openssl/evp.h>
65#include <openssl/objects.h> 65#include <openssl/objects.h>
66#include <openssl/sha.h> 66#include <openssl/x509.h>
67#ifndef OPENSSL_NO_DSA 67#ifndef OPENSSL_NO_DSA
68#include <openssl/dsa.h> 68#include <openssl/dsa.h>
69#endif 69#endif
diff --git a/src/lib/libcrypto/evp/m_md2.c b/src/lib/libcrypto/evp/m_md2.c
new file mode 100644
index 0000000000..5ce849f161
--- /dev/null
+++ b/src/lib/libcrypto/evp/m_md2.c
@@ -0,0 +1,101 @@
1/* crypto/evp/m_md2.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
59#include <stdio.h>
60#include "cryptlib.h"
61
62#ifndef OPENSSL_NO_MD2
63
64#include <openssl/evp.h>
65#include <openssl/objects.h>
66#include <openssl/x509.h>
67#include <openssl/md2.h>
68#ifndef OPENSSL_NO_RSA
69#include <openssl/rsa.h>
70#endif
71
72static int init(EVP_MD_CTX *ctx)
73 { return MD2_Init(ctx->md_data); }
74
75static int update(EVP_MD_CTX *ctx,const void *data,size_t count)
76 { return MD2_Update(ctx->md_data,data,count); }
77
78static int final(EVP_MD_CTX *ctx,unsigned char *md)
79 { return MD2_Final(md,ctx->md_data); }
80
81static const EVP_MD md2_md=
82 {
83 NID_md2,
84 NID_md2WithRSAEncryption,
85 MD2_DIGEST_LENGTH,
86 0,
87 init,
88 update,
89 final,
90 NULL,
91 NULL,
92 EVP_PKEY_RSA_method,
93 MD2_BLOCK,
94 sizeof(EVP_MD *)+sizeof(MD2_CTX),
95 };
96
97const EVP_MD *EVP_md2(void)
98 {
99 return(&md2_md);
100 }
101#endif
diff --git a/src/lib/libcrypto/evp/m_mdc2.c b/src/lib/libcrypto/evp/m_mdc2.c
new file mode 100644
index 0000000000..3602bed316
--- /dev/null
+++ b/src/lib/libcrypto/evp/m_mdc2.c
@@ -0,0 +1,103 @@
1/* crypto/evp/m_mdc2.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
59#include <stdio.h>
60#include "cryptlib.h"
61
62#ifndef OPENSSL_NO_MDC2
63
64#include <openssl/evp.h>
65#include <openssl/objects.h>
66#include <openssl/x509.h>
67#include <openssl/mdc2.h>
68#ifndef OPENSSL_NO_RSA
69#include <openssl/rsa.h>
70#endif
71
72#include "evp_locl.h"
73
74static int init(EVP_MD_CTX *ctx)
75 { return MDC2_Init(ctx->md_data); }
76
77static int update(EVP_MD_CTX *ctx,const void *data,size_t count)
78 { return MDC2_Update(ctx->md_data,data,count); }
79
80static int final(EVP_MD_CTX *ctx,unsigned char *md)
81 { return MDC2_Final(md,ctx->md_data); }
82
83static const EVP_MD mdc2_md=
84 {
85 NID_mdc2,
86 NID_mdc2WithRSA,
87 MDC2_DIGEST_LENGTH,
88 0,
89 init,
90 update,
91 final,
92 NULL,
93 NULL,
94 EVP_PKEY_RSA_ASN1_OCTET_STRING_method,
95 MDC2_BLOCK,
96 sizeof(EVP_MD *)+sizeof(MDC2_CTX),
97 };
98
99const EVP_MD *EVP_mdc2(void)
100 {
101 return(&mdc2_md);
102 }
103#endif
diff --git a/src/lib/libcrypto/evp/m_sha.c b/src/lib/libcrypto/evp/m_sha.c
new file mode 100644
index 0000000000..8769cdd42f
--- /dev/null
+++ b/src/lib/libcrypto/evp/m_sha.c
@@ -0,0 +1,101 @@
1/* crypto/evp/m_sha.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
59#include <stdio.h>
60#include "cryptlib.h"
61
62#if !defined(OPENSSL_NO_SHA) && !defined(OPENSSL_NO_SHA0)
63
64#include <openssl/evp.h>
65#include <openssl/objects.h>
66#include <openssl/x509.h>
67#ifndef OPENSSL_NO_RSA
68#include <openssl/rsa.h>
69#endif
70#include "evp_locl.h"
71
72static int init(EVP_MD_CTX *ctx)
73 { return SHA_Init(ctx->md_data); }
74
75static int update(EVP_MD_CTX *ctx,const void *data,size_t count)
76 { return SHA_Update(ctx->md_data,data,count); }
77
78static int final(EVP_MD_CTX *ctx,unsigned char *md)
79 { return SHA_Final(md,ctx->md_data); }
80
81static const EVP_MD sha_md=
82 {
83 NID_sha,
84 NID_shaWithRSAEncryption,
85 SHA_DIGEST_LENGTH,
86 0,
87 init,
88 update,
89 final,
90 NULL,
91 NULL,
92 EVP_PKEY_RSA_method,
93 SHA_CBLOCK,
94 sizeof(EVP_MD *)+sizeof(SHA_CTX),
95 };
96
97const EVP_MD *EVP_sha(void)
98 {
99 return(&sha_md);
100 }
101#endif
diff --git a/src/lib/libcrypto/evp/m_sha1.c b/src/lib/libcrypto/evp/m_sha1.c
index bd0c01ad3c..3cb11f1ebb 100644
--- a/src/lib/libcrypto/evp/m_sha1.c
+++ b/src/lib/libcrypto/evp/m_sha1.c
@@ -65,7 +65,7 @@
65 65
66#include <openssl/evp.h> 66#include <openssl/evp.h>
67#include <openssl/objects.h> 67#include <openssl/objects.h>
68#include <openssl/sha.h> 68#include <openssl/x509.h>
69#ifndef OPENSSL_NO_RSA 69#ifndef OPENSSL_NO_RSA
70#include <openssl/rsa.h> 70#include <openssl/rsa.h>
71#endif 71#endif
diff --git a/src/lib/libcrypto/evp/openbsd_hw.c b/src/lib/libcrypto/evp/openbsd_hw.c
new file mode 100644
index 0000000000..3831a5731e
--- /dev/null
+++ b/src/lib/libcrypto/evp/openbsd_hw.c
@@ -0,0 +1,446 @@
1/* Written by Ben Laurie, 2001 */
2/*
3 * Copyright (c) 2001 The OpenSSL Project. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 *
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in
14 * the documentation and/or other materials provided with the
15 * distribution.
16 *
17 * 3. All advertising materials mentioning features or use of this
18 * software must display the following acknowledgment:
19 * "This product includes software developed by the OpenSSL Project
20 * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
21 *
22 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
23 * endorse or promote products derived from this software without
24 * prior written permission. For written permission, please contact
25 * openssl-core@openssl.org.
26 *
27 * 5. Products derived from this software may not be called "OpenSSL"
28 * nor may "OpenSSL" appear in their names without prior written
29 * permission of the OpenSSL Project.
30 *
31 * 6. Redistributions of any form whatsoever must retain the following
32 * acknowledgment:
33 * "This product includes software developed by the OpenSSL Project
34 * for use in the OpenSSL Toolkit (http://www.openssl.org/)"
35 *
36 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
37 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
38 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
39 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
40 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
41 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
42 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
43 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
44 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
45 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
46 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
47 * OF THE POSSIBILITY OF SUCH DAMAGE.
48 */
49
50#include <openssl/evp.h>
51#include <openssl/objects.h>
52#include <openssl/rsa.h>
53#include "evp_locl.h"
54
55/* This stuff should now all be supported through
56 * crypto/engine/hw_openbsd_dev_crypto.c unless I botched it up */
57static void *dummy=&dummy;
58
59#if 0
60
61/* check flag after OpenSSL headers to ensure make depend works */
62#ifdef OPENSSL_OPENBSD_DEV_CRYPTO
63
64#include <fcntl.h>
65#include <stdio.h>
66#include <errno.h>
67#include <sys/ioctl.h>
68#include <crypto/cryptodev.h>
69#include <unistd.h>
70#include <assert.h>
71
72/* longest key supported in hardware */
73#define MAX_HW_KEY 24
74#define MAX_HW_IV 8
75
76#define MD5_DIGEST_LENGTH 16
77#define MD5_CBLOCK 64
78
79static int fd;
80static int dev_failed;
81
82typedef struct session_op session_op;
83
84#define CDATA(ctx) EVP_C_DATA(session_op,ctx)
85
86static void err(const char *str)
87 {
88 fprintf(stderr,"%s: errno %d\n",str,errno);
89 }
90
91static int dev_crypto_init(session_op *ses)
92 {
93 if(dev_failed)
94 return 0;
95 if(!fd)
96 {
97 int cryptodev_fd;
98
99 if ((cryptodev_fd=open("/dev/crypto",O_RDWR,0)) < 0)
100 {
101 err("/dev/crypto");
102 dev_failed=1;
103 return 0;
104 }
105 if (ioctl(cryptodev_fd,CRIOGET,&fd) == -1)
106 {
107 err("CRIOGET failed");
108 close(cryptodev_fd);
109 dev_failed=1;
110 return 0;
111 }
112 close(cryptodev_fd);
113 }
114 assert(ses);
115 memset(ses,'\0',sizeof *ses);
116
117 return 1;
118 }
119
120static int dev_crypto_cleanup(EVP_CIPHER_CTX *ctx)
121 {
122 if(ioctl(fd,CIOCFSESSION,&CDATA(ctx)->ses) == -1)
123 err("CIOCFSESSION failed");
124
125 OPENSSL_free(CDATA(ctx)->key);
126
127 return 1;
128 }
129
130static int dev_crypto_init_key(EVP_CIPHER_CTX *ctx,int cipher,
131 const unsigned char *key,int klen)
132 {
133 if(!dev_crypto_init(CDATA(ctx)))
134 return 0;
135
136 CDATA(ctx)->key=OPENSSL_malloc(MAX_HW_KEY);
137
138 assert(ctx->cipher->iv_len <= MAX_HW_IV);
139
140 memcpy(CDATA(ctx)->key,key,klen);
141
142 CDATA(ctx)->cipher=cipher;
143 CDATA(ctx)->keylen=klen;
144
145 if (ioctl(fd,CIOCGSESSION,CDATA(ctx)) == -1)
146 {
147 err("CIOCGSESSION failed");
148 return 0;
149 }
150 return 1;
151 }
152
153static int dev_crypto_cipher(EVP_CIPHER_CTX *ctx,unsigned char *out,
154 const unsigned char *in,unsigned int inl)
155 {
156 struct crypt_op cryp;
157 unsigned char lb[MAX_HW_IV];
158
159 if(!inl)
160 return 1;
161
162 assert(CDATA(ctx));
163 assert(!dev_failed);
164
165 memset(&cryp,'\0',sizeof cryp);
166 cryp.ses=CDATA(ctx)->ses;
167 cryp.op=ctx->encrypt ? COP_ENCRYPT : COP_DECRYPT;
168 cryp.flags=0;
169 cryp.len=inl;
170 assert((inl&(ctx->cipher->block_size-1)) == 0);
171 cryp.src=(caddr_t)in;
172 cryp.dst=(caddr_t)out;
173 cryp.mac=0;
174 if(ctx->cipher->iv_len)
175 cryp.iv=(caddr_t)ctx->iv;
176
177 if(!ctx->encrypt)
178 memcpy(lb,&in[cryp.len-ctx->cipher->iv_len],ctx->cipher->iv_len);
179
180 if(ioctl(fd, CIOCCRYPT, &cryp) == -1)
181 {
182 if(errno == EINVAL) /* buffers are misaligned */
183 {
184 unsigned int cinl=0;
185 char *cin=NULL;
186 char *cout=NULL;
187
188 /* NB: this can only make cinl != inl with stream ciphers */
189 cinl=(inl+3)/4*4;
190
191 if(((unsigned long)in&3) || cinl != inl)
192 {
193 cin=OPENSSL_malloc(cinl);
194 memcpy(cin,in,inl);
195 cryp.src=cin;
196 }
197
198 if(((unsigned long)out&3) || cinl != inl)
199 {
200 cout=OPENSSL_malloc(cinl);
201 cryp.dst=cout;
202 }
203
204 cryp.len=cinl;
205
206 if(ioctl(fd, CIOCCRYPT, &cryp) == -1)
207 {
208 err("CIOCCRYPT(2) failed");
209 printf("src=%p dst=%p\n",cryp.src,cryp.dst);
210 abort();
211 return 0;
212 }
213
214 if(cout)
215 {
216 memcpy(out,cout,inl);
217 OPENSSL_free(cout);
218 }
219 if(cin)
220 OPENSSL_free(cin);
221 }
222 else
223 {
224 err("CIOCCRYPT failed");
225 abort();
226 return 0;
227 }
228 }
229
230 if(ctx->encrypt)
231 memcpy(ctx->iv,&out[cryp.len-ctx->cipher->iv_len],ctx->cipher->iv_len);
232 else
233 memcpy(ctx->iv,lb,ctx->cipher->iv_len);
234
235 return 1;
236 }
237
238static int dev_crypto_des_ede3_init_key(EVP_CIPHER_CTX *ctx,
239 const unsigned char *key,
240 const unsigned char *iv, int enc)
241 { return dev_crypto_init_key(ctx,CRYPTO_3DES_CBC,key,24); }
242
243#define dev_crypto_des_ede3_cbc_cipher dev_crypto_cipher
244
245BLOCK_CIPHER_def_cbc(dev_crypto_des_ede3, session_op, NID_des_ede3, 8, 24, 8,
246 0, dev_crypto_des_ede3_init_key,
247 dev_crypto_cleanup,
248 EVP_CIPHER_set_asn1_iv,
249 EVP_CIPHER_get_asn1_iv,
250 NULL)
251
252static int dev_crypto_rc4_init_key(EVP_CIPHER_CTX *ctx,
253 const unsigned char *key,
254 const unsigned char *iv, int enc)
255 { return dev_crypto_init_key(ctx,CRYPTO_ARC4,key,16); }
256
257static const EVP_CIPHER r4_cipher=
258 {
259 NID_rc4,
260 1,16,0, /* FIXME: key should be up to 256 bytes */
261 EVP_CIPH_VARIABLE_LENGTH,
262 dev_crypto_rc4_init_key,
263 dev_crypto_cipher,
264 dev_crypto_cleanup,
265 sizeof(session_op),
266 NULL,
267 NULL,
268 NULL
269 };
270
271const EVP_CIPHER *EVP_dev_crypto_rc4(void)
272 { return &r4_cipher; }
273
274typedef struct
275 {
276 session_op sess;
277 char *data;
278 int len;
279 unsigned char md[EVP_MAX_MD_SIZE];
280 } MD_DATA;
281
282static int dev_crypto_init_digest(MD_DATA *md_data,int mac)
283 {
284 if(!dev_crypto_init(&md_data->sess))
285 return 0;
286
287 md_data->len=0;
288 md_data->data=NULL;
289
290 md_data->sess.mac=mac;
291
292 if (ioctl(fd,CIOCGSESSION,&md_data->sess) == -1)
293 {
294 err("CIOCGSESSION failed");
295 return 0;
296 }
297 return 1;
298 }
299
300static int dev_crypto_cleanup_digest(MD_DATA *md_data)
301 {
302 if (ioctl(fd,CIOCFSESSION,&md_data->sess.ses) == -1)
303 {
304 err("CIOCFSESSION failed");
305 return 0;
306 }
307
308 return 1;
309 }
310
311/* FIXME: if device can do chained MACs, then don't accumulate */
312/* FIXME: move accumulation to the framework */
313static int dev_crypto_md5_init(EVP_MD_CTX *ctx)
314 { return dev_crypto_init_digest(ctx->md_data,CRYPTO_MD5); }
315
316static int do_digest(int ses,unsigned char *md,const void *data,int len)
317 {
318 struct crypt_op cryp;
319 static unsigned char md5zero[16]=
320 {
321 0xd4,0x1d,0x8c,0xd9,0x8f,0x00,0xb2,0x04,
322 0xe9,0x80,0x09,0x98,0xec,0xf8,0x42,0x7e
323 };
324
325 /* some cards can't do zero length */
326 if(!len)
327 {
328 memcpy(md,md5zero,16);
329 return 1;
330 }
331
332 memset(&cryp,'\0',sizeof cryp);
333 cryp.ses=ses;
334 cryp.op=COP_ENCRYPT;/* required to do the MAC rather than check it */
335 cryp.len=len;
336 cryp.src=(caddr_t)data;
337 cryp.dst=(caddr_t)data; // FIXME!!!
338 cryp.mac=(caddr_t)md;
339
340 if(ioctl(fd, CIOCCRYPT, &cryp) == -1)
341 {
342 if(errno == EINVAL) /* buffer is misaligned */
343 {
344 char *dcopy;
345
346 dcopy=OPENSSL_malloc(len);
347 memcpy(dcopy,data,len);
348 cryp.src=dcopy;
349 cryp.dst=cryp.src; // FIXME!!!
350
351 if(ioctl(fd, CIOCCRYPT, &cryp) == -1)
352 {
353 err("CIOCCRYPT(MAC2) failed");
354 abort();
355 return 0;
356 }
357 OPENSSL_free(dcopy);
358 }
359 else
360 {
361 err("CIOCCRYPT(MAC) failed");
362 abort();
363 return 0;
364 }
365 }
366 // printf("done\n");
367
368 return 1;
369 }
370
371static int dev_crypto_md5_update(EVP_MD_CTX *ctx,const void *data,
372 unsigned long len)
373 {
374 MD_DATA *md_data=ctx->md_data;
375
376 if(ctx->flags&EVP_MD_CTX_FLAG_ONESHOT)
377 return do_digest(md_data->sess.ses,md_data->md,data,len);
378
379 md_data->data=OPENSSL_realloc(md_data->data,md_data->len+len);
380 memcpy(md_data->data+md_data->len,data,len);
381 md_data->len+=len;
382
383 return 1;
384 }
385
386static int dev_crypto_md5_final(EVP_MD_CTX *ctx,unsigned char *md)
387 {
388 int ret;
389 MD_DATA *md_data=ctx->md_data;
390
391 if(ctx->flags&EVP_MD_CTX_FLAG_ONESHOT)
392 {
393 memcpy(md,md_data->md,MD5_DIGEST_LENGTH);
394 ret=1;
395 }
396 else
397 {
398 ret=do_digest(md_data->sess.ses,md,md_data->data,md_data->len);
399 OPENSSL_free(md_data->data);
400 md_data->data=NULL;
401 md_data->len=0;
402 }
403
404 return ret;
405 }
406
407static int dev_crypto_md5_copy(EVP_MD_CTX *to,const EVP_MD_CTX *from)
408 {
409 const MD_DATA *from_md=from->md_data;
410 MD_DATA *to_md=to->md_data;
411
412 // How do we copy sessions?
413 assert(from->digest->flags&EVP_MD_FLAG_ONESHOT);
414
415 to_md->data=OPENSSL_malloc(from_md->len);
416 memcpy(to_md->data,from_md->data,from_md->len);
417
418 return 1;
419 }
420
421static int dev_crypto_md5_cleanup(EVP_MD_CTX *ctx)
422 {
423 return dev_crypto_cleanup_digest(ctx->md_data);
424 }
425
426static const EVP_MD md5_md=
427 {
428 NID_md5,
429 NID_md5WithRSAEncryption,
430 MD5_DIGEST_LENGTH,
431 EVP_MD_FLAG_ONESHOT, // XXX: set according to device info...
432 dev_crypto_md5_init,
433 dev_crypto_md5_update,
434 dev_crypto_md5_final,
435 dev_crypto_md5_copy,
436 dev_crypto_md5_cleanup,
437 EVP_PKEY_RSA_method,
438 MD5_CBLOCK,
439 sizeof(MD_DATA),
440 };
441
442const EVP_MD *EVP_dev_crypto_md5(void)
443 { return &md5_md; }
444
445#endif
446#endif
diff --git a/src/lib/libcrypto/evp/p5_crpt2.c b/src/lib/libcrypto/evp/p5_crpt2.c
index fe3c6c8813..975d004df4 100644
--- a/src/lib/libcrypto/evp/p5_crpt2.c
+++ b/src/lib/libcrypto/evp/p5_crpt2.c
@@ -85,24 +85,19 @@ int PKCS5_PBKDF2_HMAC(const char *pass, int passlen,
85 unsigned char digtmp[EVP_MAX_MD_SIZE], *p, itmp[4]; 85 unsigned char digtmp[EVP_MAX_MD_SIZE], *p, itmp[4];
86 int cplen, j, k, tkeylen, mdlen; 86 int cplen, j, k, tkeylen, mdlen;
87 unsigned long i = 1; 87 unsigned long i = 1;
88 HMAC_CTX hctx_tpl, hctx; 88 HMAC_CTX hctx;
89 89
90 mdlen = EVP_MD_size(digest); 90 mdlen = EVP_MD_size(digest);
91 if (mdlen < 0) 91 if (mdlen < 0)
92 return 0; 92 return 0;
93 93
94 HMAC_CTX_init(&hctx_tpl); 94 HMAC_CTX_init(&hctx);
95 p = out; 95 p = out;
96 tkeylen = keylen; 96 tkeylen = keylen;
97 if(!pass) 97 if(!pass)
98 passlen = 0; 98 passlen = 0;
99 else if(passlen == -1) 99 else if(passlen == -1)
100 passlen = strlen(pass); 100 passlen = strlen(pass);
101 if (!HMAC_Init_ex(&hctx_tpl, pass, passlen, digest, NULL))
102 {
103 HMAC_CTX_cleanup(&hctx_tpl);
104 return 0;
105 }
106 while(tkeylen) 101 while(tkeylen)
107 { 102 {
108 if(tkeylen > mdlen) 103 if(tkeylen > mdlen)
@@ -116,36 +111,19 @@ int PKCS5_PBKDF2_HMAC(const char *pass, int passlen,
116 itmp[1] = (unsigned char)((i >> 16) & 0xff); 111 itmp[1] = (unsigned char)((i >> 16) & 0xff);
117 itmp[2] = (unsigned char)((i >> 8) & 0xff); 112 itmp[2] = (unsigned char)((i >> 8) & 0xff);
118 itmp[3] = (unsigned char)(i & 0xff); 113 itmp[3] = (unsigned char)(i & 0xff);
119 if (!HMAC_CTX_copy(&hctx, &hctx_tpl)) 114 if (!HMAC_Init_ex(&hctx, pass, passlen, digest, NULL)
115 || !HMAC_Update(&hctx, salt, saltlen)
116 || !HMAC_Update(&hctx, itmp, 4)
117 || !HMAC_Final(&hctx, digtmp, NULL))
120 { 118 {
121 HMAC_CTX_cleanup(&hctx_tpl);
122 return 0;
123 }
124 if (!HMAC_Update(&hctx, salt, saltlen)
125 || !HMAC_Update(&hctx, itmp, 4)
126 || !HMAC_Final(&hctx, digtmp, NULL))
127 {
128 HMAC_CTX_cleanup(&hctx_tpl);
129 HMAC_CTX_cleanup(&hctx); 119 HMAC_CTX_cleanup(&hctx);
130 return 0; 120 return 0;
131 } 121 }
132 HMAC_CTX_cleanup(&hctx);
133 memcpy(p, digtmp, cplen); 122 memcpy(p, digtmp, cplen);
134 for(j = 1; j < iter; j++) 123 for(j = 1; j < iter; j++)
135 { 124 {
136 if (!HMAC_CTX_copy(&hctx, &hctx_tpl)) 125 HMAC(digest, pass, passlen,
137 { 126 digtmp, mdlen, digtmp, NULL);
138 HMAC_CTX_cleanup(&hctx_tpl);
139 return 0;
140 }
141 if (!HMAC_Update(&hctx, digtmp, mdlen)
142 || !HMAC_Final(&hctx, digtmp, NULL))
143 {
144 HMAC_CTX_cleanup(&hctx_tpl);
145 HMAC_CTX_cleanup(&hctx);
146 return 0;
147 }
148 HMAC_CTX_cleanup(&hctx);
149 for(k = 0; k < cplen; k++) 127 for(k = 0; k < cplen; k++)
150 p[k] ^= digtmp[k]; 128 p[k] ^= digtmp[k];
151 } 129 }
@@ -153,7 +131,7 @@ int PKCS5_PBKDF2_HMAC(const char *pass, int passlen,
153 i++; 131 i++;
154 p+= cplen; 132 p+= cplen;
155 } 133 }
156 HMAC_CTX_cleanup(&hctx_tpl); 134 HMAC_CTX_cleanup(&hctx);
157#ifdef DEBUG_PKCS5V2 135#ifdef DEBUG_PKCS5V2
158 fprintf(stderr, "Password:\n"); 136 fprintf(stderr, "Password:\n");
159 h__dump (pass, passlen); 137 h__dump (pass, passlen);
diff --git a/src/lib/libcrypto/evp/p_sign.c b/src/lib/libcrypto/evp/p_sign.c
index 8afb664306..dfa48c157c 100644
--- a/src/lib/libcrypto/evp/p_sign.c
+++ b/src/lib/libcrypto/evp/p_sign.c
@@ -80,7 +80,7 @@ int EVP_SignFinal(EVP_MD_CTX *ctx, unsigned char *sigret, unsigned int *siglen,
80 { 80 {
81 unsigned char m[EVP_MAX_MD_SIZE]; 81 unsigned char m[EVP_MAX_MD_SIZE];
82 unsigned int m_len; 82 unsigned int m_len;
83 int i = 0,ok = 0,v; 83 int i=0,ok=0,v;
84 EVP_MD_CTX tmp_ctx; 84 EVP_MD_CTX tmp_ctx;
85 EVP_PKEY_CTX *pkctx = NULL; 85 EVP_PKEY_CTX *pkctx = NULL;
86 86
diff --git a/src/lib/libcrypto/evp/p_verify.c b/src/lib/libcrypto/evp/p_verify.c
index c66d63ccf8..5f5c409f45 100644
--- a/src/lib/libcrypto/evp/p_verify.c
+++ b/src/lib/libcrypto/evp/p_verify.c
@@ -67,7 +67,7 @@ int EVP_VerifyFinal(EVP_MD_CTX *ctx, const unsigned char *sigbuf,
67 { 67 {
68 unsigned char m[EVP_MAX_MD_SIZE]; 68 unsigned char m[EVP_MAX_MD_SIZE];
69 unsigned int m_len; 69 unsigned int m_len;
70 int i = 0,ok = 0,v; 70 int i=-1,ok=0,v;
71 EVP_MD_CTX tmp_ctx; 71 EVP_MD_CTX tmp_ctx;
72 EVP_PKEY_CTX *pkctx = NULL; 72 EVP_PKEY_CTX *pkctx = NULL;
73 73
diff --git a/src/lib/libcrypto/fips_ers.c b/src/lib/libcrypto/fips_ers.c
new file mode 100644
index 0000000000..09f11748f6
--- /dev/null
+++ b/src/lib/libcrypto/fips_ers.c
@@ -0,0 +1,7 @@
1#include <openssl/opensslconf.h>
2
3#ifdef OPENSSL_FIPS
4# include "fips_err.h"
5#else
6static void *dummy=&dummy;
7#endif
diff --git a/src/lib/libcrypto/generate_pkgconfig.sh b/src/lib/libcrypto/generate_pkgconfig.sh
new file mode 100644
index 0000000000..d0660d3c57
--- /dev/null
+++ b/src/lib/libcrypto/generate_pkgconfig.sh
@@ -0,0 +1,75 @@
1#!/bin/sh
2#
3# $OpenBSD: generate_pkgconfig.sh,v 1.1 2014/04/11 22:51:53 miod Exp $
4#
5# Copyright (c) 2010,2011 Jasper Lievisse Adriaanse <jasper@openbsd.org>
6#
7# Permission to use, copy, modify, and distribute this software for any
8# purpose with or without fee is hereby granted, provided that the above
9# copyright notice and this permission notice appear in all copies.
10#
11# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18#
19# Generate pkg-config files for OpenSSL.
20
21usage() {
22 echo "usage: ${0##*/} -c current_directory -o obj_directory"
23 exit 1
24}
25
26curdir=
27objdir=
28while getopts "c:o:" flag; do
29 case "$flag" in
30 c)
31 curdir=$OPTARG
32 ;;
33 o)
34 objdir=$OPTARG
35 ;;
36 *)
37 usage
38 ;;
39 esac
40done
41
42[ -n "${curdir}" ] || usage
43if [ ! -d "${curdir}" ]; then
44 echo "${0##*/}: ${curdir}: not found"
45 exit 1
46fi
47[ -n "${objdir}" ] || usage
48if [ ! -w "${objdir}" ]; then
49 echo "${0##*/}: ${objdir}: not found or not writable"
50 exit 1
51fi
52
53version_re="s/^#define[[:blank:]]+SHLIB_VERSION_NUMBER[[:blank:]]+\"(.*)\".*/\1/p"
54#version_file=${curdir}/src/crypto/opensslv.h
55version_file=${curdir}/../libssl/src/crypto/opensslv.h
56lib_version=$(sed -nE ${version_re} ${version_file})
57
58# Put -I${includedir} into Cflags so configure script tests like
59# test -n "`pkg-config --cflags openssl`"
60# don't assume that OpenSSL isn't available.
61
62pc_file="${objdir}/libcrypto.pc"
63cat > ${pc_file} << __EOF__
64prefix=/usr
65exec_prefix=\${prefix}
66libdir=\${exec_prefix}/lib
67includedir=\${prefix}/include
68
69Name: OpenSSL-libcrypto
70Description: OpenSSL cryptography library
71Version: ${lib_version}
72Requires:
73Libs: -L\${libdir} -lcrypto
74Cflags: -I\${includedir}
75__EOF__
diff --git a/src/lib/libcrypto/hmac/Makefile b/src/lib/libcrypto/hmac/Makefile
new file mode 100644
index 0000000000..0e91709f64
--- /dev/null
+++ b/src/lib/libcrypto/hmac/Makefile
@@ -0,0 +1,110 @@
1#
2# OpenSSL/crypto/md/Makefile
3#
4
5DIR= hmac
6TOP= ../..
7CC= cc
8INCLUDES=
9CFLAG=-g
10MAKEFILE= Makefile
11AR= ar r
12
13CFLAGS= $(INCLUDES) $(CFLAG)
14
15GENERAL=Makefile
16TEST=hmactest.c
17APPS=
18
19LIB=$(TOP)/libcrypto.a
20LIBSRC=hmac.c hm_ameth.c hm_pmeth.c
21LIBOBJ=hmac.o hm_ameth.o hm_pmeth.o
22
23SRC= $(LIBSRC)
24
25EXHEADER= hmac.h
26HEADER= $(EXHEADER)
27
28ALL= $(GENERAL) $(SRC) $(HEADER)
29
30top:
31 (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all)
32
33all: lib
34
35lib: $(LIBOBJ)
36 $(AR) $(LIB) $(LIBOBJ)
37 $(RANLIB) $(LIB) || echo Never mind.
38 @touch lib
39
40files:
41 $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
42
43links:
44 @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
45 @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
46 @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
47
48install:
49 @[ -n "$(INSTALLTOP)" ] # should be set by top Makefile...
50 @headerlist="$(EXHEADER)"; for i in $$headerlist ; \
51 do \
52 (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
53 chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
54 done;
55
56tags:
57 ctags $(SRC)
58
59tests:
60
61lint:
62 lint -DLINT $(INCLUDES) $(SRC)>fluff
63
64depend:
65 @[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile...
66 $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
67
68dclean:
69 $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
70 mv -f Makefile.new $(MAKEFILE)
71
72clean:
73 rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
74
75# DO NOT DELETE THIS LINE -- make depend depends on it.
76
77hm_ameth.o: ../../e_os.h ../../include/openssl/asn1.h
78hm_ameth.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
79hm_ameth.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
80hm_ameth.o: ../../include/openssl/err.h ../../include/openssl/evp.h
81hm_ameth.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
82hm_ameth.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
83hm_ameth.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
84hm_ameth.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
85hm_ameth.o: ../../include/openssl/symhacks.h ../asn1/asn1_locl.h ../cryptlib.h
86hm_ameth.o: hm_ameth.c
87hm_pmeth.o: ../../e_os.h ../../include/openssl/asn1.h
88hm_pmeth.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
89hm_pmeth.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
90hm_pmeth.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
91hm_pmeth.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
92hm_pmeth.o: ../../include/openssl/err.h ../../include/openssl/evp.h
93hm_pmeth.o: ../../include/openssl/hmac.h ../../include/openssl/lhash.h
94hm_pmeth.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
95hm_pmeth.o: ../../include/openssl/opensslconf.h
96hm_pmeth.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
97hm_pmeth.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
98hm_pmeth.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
99hm_pmeth.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
100hm_pmeth.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
101hm_pmeth.o: ../cryptlib.h ../evp/evp_locl.h hm_pmeth.c
102hmac.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
103hmac.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
104hmac.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
105hmac.o: ../../include/openssl/evp.h ../../include/openssl/hmac.h
106hmac.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
107hmac.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
108hmac.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
109hmac.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
110hmac.o: ../../include/openssl/symhacks.h ../cryptlib.h hmac.c
diff --git a/src/lib/libcrypto/hmac/hmactest.c b/src/lib/libcrypto/hmac/hmactest.c
new file mode 100644
index 0000000000..1b906b81af
--- /dev/null
+++ b/src/lib/libcrypto/hmac/hmactest.c
@@ -0,0 +1,175 @@
1/* crypto/hmac/hmactest.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
59#include <stdio.h>
60#include <string.h>
61#include <stdlib.h>
62
63#include "../e_os.h"
64
65#ifdef OPENSSL_NO_HMAC
66int main(int argc, char *argv[])
67{
68 printf("No HMAC support\n");
69 return(0);
70}
71#else
72#include <openssl/hmac.h>
73#ifndef OPENSSL_NO_MD5
74#include <openssl/md5.h>
75#endif
76
77#ifdef CHARSET_EBCDIC
78#include <openssl/ebcdic.h>
79#endif
80
81#ifndef OPENSSL_NO_MD5
82static struct test_st
83 {
84 unsigned char key[16];
85 int key_len;
86 unsigned char data[64];
87 int data_len;
88 unsigned char *digest;
89 } test[4]={
90 { "",
91 0,
92 "More text test vectors to stuff up EBCDIC machines :-)",
93 54,
94 (unsigned char *)"e9139d1e6ee064ef8cf514fc7dc83e86",
95 },{ {0x0b,0x0b,0x0b,0x0b,0x0b,0x0b,0x0b,0x0b,
96 0x0b,0x0b,0x0b,0x0b,0x0b,0x0b,0x0b,0x0b,},
97 16,
98 "Hi There",
99 8,
100 (unsigned char *)"9294727a3638bb1c13f48ef8158bfc9d",
101 },{ "Jefe",
102 4,
103 "what do ya want for nothing?",
104 28,
105 (unsigned char *)"750c783e6ab0b503eaa86e310a5db738",
106 },{
107 {0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,
108 0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,},
109 16,
110 {0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,
111 0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,
112 0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,
113 0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,
114 0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,
115 0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,
116 0xdd,0xdd},
117 50,
118 (unsigned char *)"56be34521d144c88dbb8c733f0e8b3f6",
119 },
120 };
121#endif
122
123static char *pt(unsigned char *md);
124int main(int argc, char *argv[])
125 {
126#ifndef OPENSSL_NO_MD5
127 int i;
128 char *p;
129#endif
130 int err=0;
131
132#ifdef OPENSSL_NO_MD5
133 printf("test skipped: MD5 disabled\n");
134#else
135
136#ifdef CHARSET_EBCDIC
137 ebcdic2ascii(test[0].data, test[0].data, test[0].data_len);
138 ebcdic2ascii(test[1].data, test[1].data, test[1].data_len);
139 ebcdic2ascii(test[2].key, test[2].key, test[2].key_len);
140 ebcdic2ascii(test[2].data, test[2].data, test[2].data_len);
141#endif
142
143 for (i=0; i<4; i++)
144 {
145 p=pt(HMAC(EVP_md5(),
146 test[i].key, test[i].key_len,
147 test[i].data, test[i].data_len,
148 NULL,NULL));
149
150 if (strcmp(p,(char *)test[i].digest) != 0)
151 {
152 printf("error calculating HMAC on %d entry'\n",i);
153 printf("got %s instead of %s\n",p,test[i].digest);
154 err++;
155 }
156 else
157 printf("test %d ok\n",i);
158 }
159#endif /* OPENSSL_NO_MD5 */
160 EXIT(err);
161 return(0);
162 }
163
164#ifndef OPENSSL_NO_MD5
165static char *pt(unsigned char *md)
166 {
167 int i;
168 static char buf[80];
169
170 for (i=0; i<MD5_DIGEST_LENGTH; i++)
171 sprintf(&(buf[i*2]),"%02x",md[i]);
172 return(buf);
173 }
174#endif
175#endif
diff --git a/src/lib/libcrypto/idea/Makefile b/src/lib/libcrypto/idea/Makefile
new file mode 100644
index 0000000000..8af0acdad9
--- /dev/null
+++ b/src/lib/libcrypto/idea/Makefile
@@ -0,0 +1,89 @@
1#
2# OpenSSL/crypto/idea/Makefile
3#
4
5DIR= idea
6TOP= ../..
7CC= cc
8INCLUDES=
9CFLAG=-g
10MAKEFILE= Makefile
11AR= ar r
12
13CFLAGS= $(INCLUDES) $(CFLAG)
14
15GENERAL=Makefile
16TEST=ideatest.c
17APPS=
18
19LIB=$(TOP)/libcrypto.a
20LIBSRC=i_cbc.c i_cfb64.c i_ofb64.c i_ecb.c i_skey.c
21LIBOBJ=i_cbc.o i_cfb64.o i_ofb64.o i_ecb.o i_skey.o
22
23SRC= $(LIBSRC)
24
25EXHEADER= idea.h
26HEADER= idea_lcl.h $(EXHEADER)
27
28ALL= $(GENERAL) $(SRC) $(HEADER)
29
30top:
31 (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all)
32
33all: lib
34
35lib: $(LIBOBJ)
36 $(AR) $(LIB) $(LIBOBJ)
37 $(RANLIB) $(LIB) || echo Never mind.
38 @touch lib
39
40files:
41 $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
42
43links:
44 @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
45 @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
46 @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
47
48install:
49 @[ -n "$(INSTALLTOP)" ] # should be set by top Makefile...
50 @headerlist="$(EXHEADER)"; for i in $$headerlist ; \
51 do \
52 (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
53 chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
54 done;
55
56tags:
57 ctags $(SRC)
58
59tests:
60
61lint:
62 lint -DLINT $(INCLUDES) $(SRC)>fluff
63
64depend:
65 @[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile...
66 $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
67
68dclean:
69 $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
70 mv -f Makefile.new $(MAKEFILE)
71
72clean:
73 rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
74
75# DO NOT DELETE THIS LINE -- make depend depends on it.
76
77i_cbc.o: ../../include/openssl/idea.h ../../include/openssl/opensslconf.h
78i_cbc.o: i_cbc.c idea_lcl.h
79i_cfb64.o: ../../include/openssl/idea.h ../../include/openssl/opensslconf.h
80i_cfb64.o: i_cfb64.c idea_lcl.h
81i_ecb.o: ../../include/openssl/idea.h ../../include/openssl/opensslconf.h
82i_ecb.o: ../../include/openssl/opensslv.h i_ecb.c idea_lcl.h
83i_ofb64.o: ../../include/openssl/idea.h ../../include/openssl/opensslconf.h
84i_ofb64.o: i_ofb64.c idea_lcl.h
85i_skey.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
86i_skey.o: ../../include/openssl/idea.h ../../include/openssl/opensslconf.h
87i_skey.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
88i_skey.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
89i_skey.o: ../../include/openssl/symhacks.h i_skey.c idea_lcl.h
diff --git a/src/lib/libcrypto/idea/idea_spd.c b/src/lib/libcrypto/idea/idea_spd.c
new file mode 100644
index 0000000000..699353e871
--- /dev/null
+++ b/src/lib/libcrypto/idea/idea_spd.c
@@ -0,0 +1,299 @@
1/* crypto/idea/idea_spd.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
59/* 11-Sep-92 Andrew Daviel Support for Silicon Graphics IRIX added */
60/* 06-Apr-92 Luke Brennan Support for VMS and add extra signal calls */
61
62#if !defined(OPENSSL_SYS_MSDOS) && (!defined(OPENSSL_SYS_VMS) || defined(__DECC)) && !defined(OPENSSL_SYS_MACOSX)
63#define TIMES
64#endif
65
66#include <stdio.h>
67
68#include <openssl/e_os2.h>
69#include OPENSSL_UNISTD_IO
70OPENSSL_DECLARE_EXIT
71
72#ifndef OPENSSL_SYS_NETWARE
73#include <signal.h>
74#endif
75
76#ifndef _IRIX
77#include <time.h>
78#endif
79#ifdef TIMES
80#include <sys/types.h>
81#include <sys/times.h>
82#endif
83
84/* Depending on the VMS version, the tms structure is perhaps defined.
85 The __TMS macro will show if it was. If it wasn't defined, we should
86 undefine TIMES, since that tells the rest of the program how things
87 should be handled. -- Richard Levitte */
88#if defined(OPENSSL_SYS_VMS_DECC) && !defined(__TMS)
89#undef TIMES
90#endif
91
92#ifndef TIMES
93#include <sys/timeb.h>
94#endif
95
96#if defined(sun) || defined(__ultrix)
97#define _POSIX_SOURCE
98#include <limits.h>
99#include <sys/param.h>
100#endif
101
102#include <openssl/idea.h>
103
104/* The following if from times(3) man page. It may need to be changed */
105#ifndef HZ
106#ifndef CLK_TCK
107#define HZ 100.0
108#else /* CLK_TCK */
109#define HZ ((double)CLK_TCK)
110#endif
111#endif
112
113#define BUFSIZE ((long)1024)
114long run=0;
115
116double Time_F(int s);
117#ifdef SIGALRM
118#if defined(__STDC__) || defined(sgi) || defined(_AIX)
119#define SIGRETTYPE void
120#else
121#define SIGRETTYPE int
122#endif
123
124SIGRETTYPE sig_done(int sig);
125SIGRETTYPE sig_done(int sig)
126 {
127 signal(SIGALRM,sig_done);
128 run=0;
129#ifdef LINT
130 sig=sig;
131#endif
132 }
133#endif
134
135#define START 0
136#define STOP 1
137
138double Time_F(int s)
139 {
140 double ret;
141#ifdef TIMES
142 static struct tms tstart,tend;
143
144 if (s == START)
145 {
146 times(&tstart);
147 return(0);
148 }
149 else
150 {
151 times(&tend);
152 ret=((double)(tend.tms_utime-tstart.tms_utime))/HZ;
153 return((ret == 0.0)?1e-6:ret);
154 }
155#else /* !times() */
156 static struct timeb tstart,tend;
157 long i;
158
159 if (s == START)
160 {
161 ftime(&tstart);
162 return(0);
163 }
164 else
165 {
166 ftime(&tend);
167 i=(long)tend.millitm-(long)tstart.millitm;
168 ret=((double)(tend.time-tstart.time))+((double)i)/1e3;
169 return((ret == 0.0)?1e-6:ret);
170 }
171#endif
172 }
173
174int main(int argc, char **argv)
175 {
176 long count;
177 static unsigned char buf[BUFSIZE];
178 static unsigned char key[] ={
179 0x12,0x34,0x56,0x78,0x9a,0xbc,0xde,0xf0,
180 0xfe,0xdc,0xba,0x98,0x76,0x54,0x32,0x10,
181 };
182 IDEA_KEY_SCHEDULE sch;
183 double a,aa,b,c,d;
184#ifndef SIGALRM
185 long ca,cca,cb,cc;
186#endif
187
188#ifndef TIMES
189 printf("To get the most accurate results, try to run this\n");
190 printf("program when this computer is idle.\n");
191#endif
192
193#ifndef SIGALRM
194 printf("First we calculate the approximate speed ...\n");
195 idea_set_encrypt_key(key,&sch);
196 count=10;
197 do {
198 long i;
199 IDEA_INT data[2];
200
201 count*=2;
202 Time_F(START);
203 for (i=count; i; i--)
204 idea_encrypt(data,&sch);
205 d=Time_F(STOP);
206 } while (d < 3.0);
207 ca=count/4;
208 cca=count/200;
209 cb=count;
210 cc=count*8/BUFSIZE+1;
211 printf("idea_set_encrypt_key %ld times\n",ca);
212#define COND(d) (count <= (d))
213#define COUNT(d) (d)
214#else
215#define COND(c) (run)
216#define COUNT(d) (count)
217 signal(SIGALRM,sig_done);
218 printf("Doing idea_set_encrypt_key for 10 seconds\n");
219 alarm(10);
220#endif
221
222 Time_F(START);
223 for (count=0,run=1; COND(ca); count+=4)
224 {
225 idea_set_encrypt_key(key,&sch);
226 idea_set_encrypt_key(key,&sch);
227 idea_set_encrypt_key(key,&sch);
228 idea_set_encrypt_key(key,&sch);
229 }
230 d=Time_F(STOP);
231 printf("%ld idea idea_set_encrypt_key's in %.2f seconds\n",count,d);
232 a=((double)COUNT(ca))/d;
233
234#ifdef SIGALRM
235 printf("Doing idea_set_decrypt_key for 10 seconds\n");
236 alarm(10);
237#else
238 printf("Doing idea_set_decrypt_key %ld times\n",cca);
239#endif
240
241 Time_F(START);
242 for (count=0,run=1; COND(cca); count+=4)
243 {
244 idea_set_decrypt_key(&sch,&sch);
245 idea_set_decrypt_key(&sch,&sch);
246 idea_set_decrypt_key(&sch,&sch);
247 idea_set_decrypt_key(&sch,&sch);
248 }
249 d=Time_F(STOP);
250 printf("%ld idea idea_set_decrypt_key's in %.2f seconds\n",count,d);
251 aa=((double)COUNT(cca))/d;
252
253#ifdef SIGALRM
254 printf("Doing idea_encrypt's for 10 seconds\n");
255 alarm(10);
256#else
257 printf("Doing idea_encrypt %ld times\n",cb);
258#endif
259 Time_F(START);
260 for (count=0,run=1; COND(cb); count+=4)
261 {
262 unsigned long data[2];
263
264 idea_encrypt(data,&sch);
265 idea_encrypt(data,&sch);
266 idea_encrypt(data,&sch);
267 idea_encrypt(data,&sch);
268 }
269 d=Time_F(STOP);
270 printf("%ld idea_encrypt's in %.2f second\n",count,d);
271 b=((double)COUNT(cb)*8)/d;
272
273#ifdef SIGALRM
274 printf("Doing idea_cbc_encrypt on %ld byte blocks for 10 seconds\n",
275 BUFSIZE);
276 alarm(10);
277#else
278 printf("Doing idea_cbc_encrypt %ld times on %ld byte blocks\n",cc,
279 BUFSIZE);
280#endif
281 Time_F(START);
282 for (count=0,run=1; COND(cc); count++)
283 idea_cbc_encrypt(buf,buf,BUFSIZE,&sch,
284 &(key[0]),IDEA_ENCRYPT);
285 d=Time_F(STOP);
286 printf("%ld idea_cbc_encrypt's of %ld byte blocks in %.2f second\n",
287 count,BUFSIZE,d);
288 c=((double)COUNT(cc)*BUFSIZE)/d;
289
290 printf("IDEA set_encrypt_key per sec = %12.2f (%9.3fuS)\n",a,1.0e6/a);
291 printf("IDEA set_decrypt_key per sec = %12.2f (%9.3fuS)\n",aa,1.0e6/aa);
292 printf("IDEA raw ecb bytes per sec = %12.2f (%9.3fuS)\n",b,8.0e6/b);
293 printf("IDEA cbc bytes per sec = %12.2f (%9.3fuS)\n",c,8.0e6/c);
294 exit(0);
295#if defined(LINT) || defined(OPENSSL_SYS_MSDOS)
296 return(0);
297#endif
298 }
299
diff --git a/src/lib/libcrypto/idea/ideatest.c b/src/lib/libcrypto/idea/ideatest.c
new file mode 100644
index 0000000000..e6ffc7025e
--- /dev/null
+++ b/src/lib/libcrypto/idea/ideatest.c
@@ -0,0 +1,235 @@
1/* crypto/idea/ideatest.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
59#include <stdio.h>
60#include <string.h>
61#include <stdlib.h>
62
63#include "../e_os.h"
64
65#ifdef OPENSSL_NO_IDEA
66int main(int argc, char *argv[])
67{
68 printf("No IDEA support\n");
69 return(0);
70}
71#else
72#include <openssl/idea.h>
73
74unsigned char k[16]={
75 0x00,0x01,0x00,0x02,0x00,0x03,0x00,0x04,
76 0x00,0x05,0x00,0x06,0x00,0x07,0x00,0x08};
77
78unsigned char in[8]={0x00,0x00,0x00,0x01,0x00,0x02,0x00,0x03};
79unsigned char c[8]={0x11,0xFB,0xED,0x2B,0x01,0x98,0x6D,0xE5};
80unsigned char out[80];
81
82char *text="Hello to all people out there";
83
84static unsigned char cfb_key[16]={
85 0xe1,0xf0,0xc3,0xd2,0xa5,0xb4,0x87,0x96,
86 0x69,0x78,0x4b,0x5a,0x2d,0x3c,0x0f,0x1e,
87 };
88static unsigned char cfb_iv[80]={0x34,0x12,0x78,0x56,0xab,0x90,0xef,0xcd};
89static unsigned char cfb_buf1[40],cfb_buf2[40],cfb_tmp[8];
90#define CFB_TEST_SIZE 24
91static unsigned char plain[CFB_TEST_SIZE]=
92 {
93 0x4e,0x6f,0x77,0x20,0x69,0x73,
94 0x20,0x74,0x68,0x65,0x20,0x74,
95 0x69,0x6d,0x65,0x20,0x66,0x6f,
96 0x72,0x20,0x61,0x6c,0x6c,0x20
97 };
98static unsigned char cfb_cipher64[CFB_TEST_SIZE]={
99 0x59,0xD8,0xE2,0x65,0x00,0x58,0x6C,0x3F,
100 0x2C,0x17,0x25,0xD0,0x1A,0x38,0xB7,0x2A,
101 0x39,0x61,0x37,0xDC,0x79,0xFB,0x9F,0x45
102
103/* 0xF9,0x78,0x32,0xB5,0x42,0x1A,0x6B,0x38,
104 0x9A,0x44,0xD6,0x04,0x19,0x43,0xC4,0xD9,
105 0x3D,0x1E,0xAE,0x47,0xFC,0xCF,0x29,0x0B,*/
106 };
107
108static int cfb64_test(unsigned char *cfb_cipher);
109static char *pt(unsigned char *p);
110int main(int argc, char *argv[])
111 {
112 int i,err=0;
113 IDEA_KEY_SCHEDULE key,dkey;
114 unsigned char iv[8];
115
116 idea_set_encrypt_key(k,&key);
117 idea_ecb_encrypt(in,out,&key);
118 if (memcmp(out,c,8) != 0)
119 {
120 printf("ecb idea error encrypting\n");
121 printf("got :");
122 for (i=0; i<8; i++)
123 printf("%02X ",out[i]);
124 printf("\n");
125 printf("expected:");
126 for (i=0; i<8; i++)
127 printf("%02X ",c[i]);
128 err=20;
129 printf("\n");
130 }
131
132 idea_set_decrypt_key(&key,&dkey);
133 idea_ecb_encrypt(c,out,&dkey);
134 if (memcmp(out,in,8) != 0)
135 {
136 printf("ecb idea error decrypting\n");
137 printf("got :");
138 for (i=0; i<8; i++)
139 printf("%02X ",out[i]);
140 printf("\n");
141 printf("expected:");
142 for (i=0; i<8; i++)
143 printf("%02X ",in[i]);
144 printf("\n");
145 err=3;
146 }
147
148 if (err == 0) printf("ecb idea ok\n");
149
150 memcpy(iv,k,8);
151 idea_cbc_encrypt((unsigned char *)text,out,strlen(text)+1,&key,iv,1);
152 memcpy(iv,k,8);
153 idea_cbc_encrypt(out,out,8,&dkey,iv,0);
154 idea_cbc_encrypt(&(out[8]),&(out[8]),strlen(text)+1-8,&dkey,iv,0);
155 if (memcmp(text,out,strlen(text)+1) != 0)
156 {
157 printf("cbc idea bad\n");
158 err=4;
159 }
160 else
161 printf("cbc idea ok\n");
162
163 printf("cfb64 idea ");
164 if (cfb64_test(cfb_cipher64))
165 {
166 printf("bad\n");
167 err=5;
168 }
169 else
170 printf("ok\n");
171
172#ifdef OPENSSL_SYS_NETWARE
173 if (err) printf("ERROR: %d\n", err);
174#endif
175 EXIT(err);
176 return(err);
177 }
178
179static int cfb64_test(unsigned char *cfb_cipher)
180 {
181 IDEA_KEY_SCHEDULE eks,dks;
182 int err=0,i,n;
183
184 idea_set_encrypt_key(cfb_key,&eks);
185 idea_set_decrypt_key(&eks,&dks);
186 memcpy(cfb_tmp,cfb_iv,8);
187 n=0;
188 idea_cfb64_encrypt(plain,cfb_buf1,(long)12,&eks,
189 cfb_tmp,&n,IDEA_ENCRYPT);
190 idea_cfb64_encrypt(&(plain[12]),&(cfb_buf1[12]),
191 (long)CFB_TEST_SIZE-12,&eks,
192 cfb_tmp,&n,IDEA_ENCRYPT);
193 if (memcmp(cfb_cipher,cfb_buf1,CFB_TEST_SIZE) != 0)
194 {
195 err=1;
196 printf("idea_cfb64_encrypt encrypt error\n");
197 for (i=0; i<CFB_TEST_SIZE; i+=8)
198 printf("%s\n",pt(&(cfb_buf1[i])));
199 }
200 memcpy(cfb_tmp,cfb_iv,8);
201 n=0;
202 idea_cfb64_encrypt(cfb_buf1,cfb_buf2,(long)17,&eks,
203 cfb_tmp,&n,IDEA_DECRYPT);
204 idea_cfb64_encrypt(&(cfb_buf1[17]),&(cfb_buf2[17]),
205 (long)CFB_TEST_SIZE-17,&dks,
206 cfb_tmp,&n,IDEA_DECRYPT);
207 if (memcmp(plain,cfb_buf2,CFB_TEST_SIZE) != 0)
208 {
209 err=1;
210 printf("idea_cfb_encrypt decrypt error\n");
211 for (i=0; i<24; i+=8)
212 printf("%s\n",pt(&(cfb_buf2[i])));
213 }
214 return(err);
215 }
216
217static char *pt(unsigned char *p)
218 {
219 static char bufs[10][20];
220 static int bnum=0;
221 char *ret;
222 int i;
223 static char *f="0123456789ABCDEF";
224
225 ret= &(bufs[bnum++][0]);
226 bnum%=10;
227 for (i=0; i<8; i++)
228 {
229 ret[i*2]=f[(p[i]>>4)&0xf];
230 ret[i*2+1]=f[p[i]&0xf];
231 }
232 ret[16]='\0';
233 return(ret);
234 }
235#endif
diff --git a/src/lib/libcrypto/idea/version b/src/lib/libcrypto/idea/version
new file mode 100644
index 0000000000..3f22293795
--- /dev/null
+++ b/src/lib/libcrypto/idea/version
@@ -0,0 +1,12 @@
11.1 07/12/95 - eay
2 Many thanks to Rhys Weatherley <rweather@us.oracle.com>
3 for pointing out that I was assuming little endian byte
4 order for all quantities what idea actually used
5 bigendian. No where in the spec does it mention
6 this, it is all in terms of 16 bit numbers and even the example
7 does not use byte streams for the input example :-(.
8 If you byte swap each pair of input, keys and iv, the functions
9 would produce the output as the old version :-(.
10
111.0 ??/??/95 - eay
12 First version.
diff --git a/src/lib/libcrypto/install-crypto.com b/src/lib/libcrypto/install-crypto.com
new file mode 100755
index 0000000000..85b3d583cf
--- /dev/null
+++ b/src/lib/libcrypto/install-crypto.com
@@ -0,0 +1,196 @@
1$! INSTALL.COM -- Installs the files in a given directory tree
2$!
3$! Author: Richard Levitte <richard@levitte.org>
4$! Time of creation: 22-MAY-1998 10:13
5$!
6$! Changes by Zoltan Arpadffy <zoli@polarhome.com>
7$!
8$! P1 root of the directory tree
9$! P2 "64" for 64-bit pointers.
10$!
11$!
12$! Announce/identify.
13$!
14$ proc = f$environment( "procedure")
15$ write sys$output "@@@ "+ -
16 f$parse( proc, , , "name")+ f$parse( proc, , , "type")
17$!
18$ on error then goto tidy
19$ on control_c then goto tidy
20$!
21$ if (p1 .eqs. "")
22$ then
23$ write sys$output "First argument missing."
24$ write sys$output -
25 "It should be the directory where you want things installed."
26$ exit
27$ endif
28$!
29$ if (f$getsyi( "cpu") .lt. 128)
30$ then
31$ arch = "VAX"
32$ else
33$ arch = f$edit( f$getsyi( "arch_name"), "upcase")
34$ if (arch .eqs. "") then arch = "UNK"
35$ endif
36$!
37$ archd = arch
38$ lib32 = "32"
39$ shr = "_SHR32"
40$!
41$ if (p2 .nes. "")
42$ then
43$ if (p2 .eqs. "64")
44$ then
45$ archd = arch+ "_64"
46$ lib32 = ""
47$ shr = "_SHR"
48$ else
49$ if (p2 .nes. "32")
50$ then
51$ write sys$output "Second argument invalid."
52$ write sys$output "It should be "32", "64", or nothing."
53$ exit
54$ endif
55$ endif
56$ endif
57$!
58$ root = f$parse( p1, "[]A.;0", , , "syntax_only, no_conceal") - "A.;0"
59$ root_dev = f$parse( root, , , "device", "syntax_only")
60$ root_dir = f$parse( root, , , "directory", "syntax_only") - -
61 "[000000." - "][" - "[" - "]"
62$ root = root_dev + "[" + root_dir
63$!
64$ define /nolog wrk_sslroot 'root'.] /trans=conc
65$ define /nolog wrk_sslinclude wrk_sslroot:[include]
66$ define /nolog wrk_sslxlib wrk_sslroot:['arch'_lib]
67$!
68$ if f$parse("wrk_sslroot:[000000]") .eqs. "" then -
69 create /directory /log wrk_sslroot:[000000]
70$ if f$parse("wrk_sslinclude:") .eqs. "" then -
71 create /directory /log wrk_sslinclude:
72$ if f$parse("wrk_sslxlib:") .eqs. "" then -
73 create /directory /log wrk_sslxlib:
74$!
75$ sdirs := , -
76 'archd', -
77 objects, -
78 md2, md4, md5, sha, mdc2, hmac, ripemd, whrlpool, -
79 des, aes, rc2, rc4, rc5, idea, bf, cast, camellia, seed, -
80 bn, ec, rsa, dsa, ecdsa, dh, ecdh, dso, engine, -
81 buffer, bio, stack, lhash, rand, err, -
82 evp, asn1, pem, x509, x509v3, conf, txt_db, pkcs7, pkcs12, comp, ocsp, -
83 ui, krb5, -
84 store, cms, pqueue, ts, jpake
85$!
86$ exheader_ := crypto.h, opensslv.h, ebcdic.h, symhacks.h, ossl_typ.h
87$ exheader_'archd' := opensslconf.h
88$ exheader_objects := objects.h, obj_mac.h
89$ exheader_md2 := md2.h
90$ exheader_md4 := md4.h
91$ exheader_md5 := md5.h
92$ exheader_sha := sha.h
93$ exheader_mdc2 := mdc2.h
94$ exheader_hmac := hmac.h
95$ exheader_ripemd := ripemd.h
96$ exheader_whrlpool := whrlpool.h
97$ exheader_des := des.h, des_old.h
98$ exheader_aes := aes.h
99$ exheader_rc2 := rc2.h
100$ exheader_rc4 := rc4.h
101$ exheader_rc5 := rc5.h
102$ exheader_idea := idea.h
103$ exheader_bf := blowfish.h
104$ exheader_cast := cast.h
105$ exheader_camellia := camellia.h
106$ exheader_seed := seed.h
107$ exheader_modes := modes.h
108$ exheader_bn := bn.h
109$ exheader_ec := ec.h
110$ exheader_rsa := rsa.h
111$ exheader_dsa := dsa.h
112$ exheader_ecdsa := ecdsa.h
113$ exheader_dh := dh.h
114$ exheader_ecdh := ecdh.h
115$ exheader_dso := dso.h
116$ exheader_engine := engine.h
117$ exheader_buffer := buffer.h
118$ exheader_bio := bio.h
119$ exheader_stack := stack.h, safestack.h
120$ exheader_lhash := lhash.h
121$ exheader_rand := rand.h
122$ exheader_err := err.h
123$ exheader_evp := evp.h
124$ exheader_asn1 := asn1.h, asn1_mac.h, asn1t.h
125$ exheader_pem := pem.h, pem2.h
126$ exheader_x509 := x509.h, x509_vfy.h
127$ exheader_x509v3 := x509v3.h
128$ exheader_conf := conf.h, conf_api.h
129$ exheader_txt_db := txt_db.h
130$ exheader_pkcs7 := pkcs7.h
131$ exheader_pkcs12 := pkcs12.h
132$ exheader_comp := comp.h
133$ exheader_ocsp := ocsp.h
134$ exheader_ui := ui.h, ui_compat.h
135$ exheader_krb5 := krb5_asn.h
136$! exheader_store := store.h, str_compat.h
137$ exheader_store := store.h
138$ exheader_cms := cms.h
139$ exheader_pqueue := pqueue.h
140$ exheader_ts := ts.h
141$ exheader_jpake := jpake.h
142$ libs := ssl_libcrypto
143$!
144$ exe_dir := [-.'archd'.exe.crypto]
145$!
146$! Header files.
147$!
148$ i = 0
149$ loop_sdirs:
150$ d = f$edit( f$element( i, ",", sdirs), "trim")
151$ i = i + 1
152$ if d .eqs. "," then goto loop_sdirs_end
153$ tmp = exheader_'d'
154$ if (d .nes. "") then d = "."+ d
155$ copy /protection = w:re ['d']'tmp' wrk_sslinclude: /log
156$ goto loop_sdirs
157$ loop_sdirs_end:
158$!
159$! Object libraries, shareable images.
160$!
161$ i = 0
162$ loop_lib:
163$ e = f$edit( f$element( i, ",", libs), "trim")
164$ i = i + 1
165$ if e .eqs. "," then goto loop_lib_end
166$ set noon
167$ file = exe_dir+ e+ lib32+ ".olb"
168$ if f$search( file) .nes. ""
169$ then
170$ copy /protection = w:re 'file' wrk_sslxlib: /log
171$ endif
172$!
173$ file = exe_dir+ e+ shr+ ".exe"
174$ if f$search( file) .nes. ""
175$ then
176$ copy /protection = w:re 'file' wrk_sslxlib: /log
177$ endif
178$ set on
179$ goto loop_lib
180$ loop_lib_end:
181$!
182$ tidy:
183$!
184$ call deass wrk_sslroot
185$ call deass wrk_sslinclude
186$ call deass wrk_sslxlib
187$!
188$ exit
189$!
190$ deass: subroutine
191$ if (f$trnlnm( p1, "LNM$PROCESS") .nes. "")
192$ then
193$ deassign /process 'p1'
194$ endif
195$ endsubroutine
196$!
diff --git a/src/lib/libcrypto/install.com b/src/lib/libcrypto/install.com
new file mode 100644
index 0000000000..ad3e4d48c7
--- /dev/null
+++ b/src/lib/libcrypto/install.com
@@ -0,0 +1,155 @@
1$! INSTALL.COM -- Installs the files in a given directory tree
2$!
3$! Author: Richard Levitte <richard@levitte.org>
4$! Time of creation: 22-MAY-1998 10:13
5$!
6$! Changes by Zoltan Arpadffy <zoli@polarhome.com>
7$!
8$! P1 root of the directory tree
9$!
10$ IF P1 .EQS. ""
11$ THEN
12$ WRITE SYS$OUTPUT "First argument missing."
13$ WRITE SYS$OUTPUT -
14 "It should be the directory where you want things installed."
15$ EXIT
16$ ENDIF
17$
18$ IF (F$GETSYI("CPU").LT.128)
19$ THEN
20$ ARCH := VAX
21$ ELSE
22$ ARCH = F$EDIT( F$GETSYI( "ARCH_NAME"), "UPCASE")
23$ IF (ARCH .EQS. "") THEN ARCH = "UNK"
24$ ENDIF
25$
26$ ROOT = F$PARSE(P1,"[]A.;0",,,"SYNTAX_ONLY,NO_CONCEAL") - "A.;0"
27$ ROOT_DEV = F$PARSE(ROOT,,,"DEVICE","SYNTAX_ONLY")
28$ ROOT_DIR = F$PARSE(ROOT,,,"DIRECTORY","SYNTAX_ONLY") -
29 - "[000000." - "][" - "[" - "]"
30$ ROOT = ROOT_DEV + "[" + ROOT_DIR
31$
32$ DEFINE/NOLOG WRK_SSLROOT 'ROOT'.] /TRANS=CONC
33$ DEFINE/NOLOG WRK_SSLLIB WRK_SSLROOT:['ARCH'_LIB]
34$ DEFINE/NOLOG WRK_SSLINCLUDE WRK_SSLROOT:[INCLUDE]
35$
36$ IF F$PARSE("WRK_SSLROOT:[000000]") .EQS. "" THEN -
37 CREATE/DIR/LOG WRK_SSLROOT:[000000]
38$ IF F$PARSE("WRK_SSLLIB:") .EQS. "" THEN -
39 CREATE/DIR/LOG WRK_SSLLIB:
40$ IF F$PARSE("WRK_SSLINCLUDE:") .EQS. "" THEN -
41 CREATE/DIR/LOG WRK_SSLINCLUDE:
42$
43$ SDIRS := ,-
44 _'ARCH',-
45 OBJECTS,-
46 MD2,MD4,MD5,SHA,MDC2,HMAC,RIPEMD,WHRLPOOL,-
47 DES,AES,RC2,RC4,RC5,IDEA,BF,CAST,CAMELLIA,SEED,-
48 BN,EC,RSA,DSA,ECDSA,DH,ECDH,DSO,ENGINE,-
49 BUFFER,BIO,STACK,LHASH,RAND,ERR,-
50 EVP,ASN1,PEM,X509,X509V3,CONF,TXT_DB,PKCS7,PKCS12,COMP,OCSP,-
51 UI,KRB5,-
52 STORE,CMS,PQUEUE,TS,JPAKE
53$ EXHEADER_ := crypto.h,opensslv.h,ebcdic.h,symhacks.h,ossl_typ.h
54$ EXHEADER__'ARCH' := opensslconf.h
55$ EXHEADER_OBJECTS := objects.h,obj_mac.h
56$ EXHEADER_MD2 := md2.h
57$ EXHEADER_MD4 := md4.h
58$ EXHEADER_MD5 := md5.h
59$ EXHEADER_SHA := sha.h
60$ EXHEADER_MDC2 := mdc2.h
61$ EXHEADER_HMAC := hmac.h
62$ EXHEADER_RIPEMD := ripemd.h
63$ EXHEADER_WHRLPOOL := whrlpool.h
64$ EXHEADER_DES := des.h,des_old.h
65$ EXHEADER_AES := aes.h
66$ EXHEADER_RC2 := rc2.h
67$ EXHEADER_RC4 := rc4.h
68$ EXHEADER_RC5 := rc5.h
69$ EXHEADER_IDEA := idea.h
70$ EXHEADER_BF := blowfish.h
71$ EXHEADER_CAST := cast.h
72$ EXHEADER_CAMELLIA := camellia.h
73$ EXHEADER_SEED := seed.h
74$ EXHEADER_MODES := modes.h
75$ EXHEADER_BN := bn.h
76$ EXHEADER_EC := ec.h
77$ EXHEADER_RSA := rsa.h
78$ EXHEADER_DSA := dsa.h
79$ EXHEADER_ECDSA := ecdsa.h
80$ EXHEADER_DH := dh.h
81$ EXHEADER_ECDH := ecdh.h
82$ EXHEADER_DSO := dso.h
83$ EXHEADER_ENGINE := engine.h
84$ EXHEADER_BUFFER := buffer.h
85$ EXHEADER_BIO := bio.h
86$ EXHEADER_STACK := stack.h,safestack.h
87$ EXHEADER_LHASH := lhash.h
88$ EXHEADER_RAND := rand.h
89$ EXHEADER_ERR := err.h
90$ EXHEADER_EVP := evp.h
91$ EXHEADER_ASN1 := asn1.h,asn1_mac.h,asn1t.h
92$ EXHEADER_PEM := pem.h,pem2.h
93$ EXHEADER_X509 := x509.h,x509_vfy.h
94$ EXHEADER_X509V3 := x509v3.h
95$ EXHEADER_CONF := conf.h,conf_api.h
96$ EXHEADER_TXT_DB := txt_db.h
97$ EXHEADER_PKCS7 := pkcs7.h
98$ EXHEADER_PKCS12 := pkcs12.h
99$ EXHEADER_COMP := comp.h
100$ EXHEADER_OCSP := ocsp.h
101$ EXHEADER_UI := ui.h,ui_compat.h
102$ EXHEADER_KRB5 := krb5_asn.h
103$! EXHEADER_STORE := store.h,str_compat.h
104$ EXHEADER_STORE := store.h
105$ EXHEADER_CMS := cms.h
106$ EXHEADER_PQUEUE := pqueue.h
107$ EXHEADER_TS := ts.h
108$ EXHEADER_JPAKE := jpake.h
109$ LIBS := LIBCRYPTO
110$
111$ EXE_DIR := [-.'ARCH'.EXE.CRYPTO]
112$
113$ I = 0
114$ LOOP_SDIRS:
115$ D = F$EDIT(F$ELEMENT(I, ",", SDIRS),"TRIM")
116$ I = I + 1
117$ IF D .EQS. "," THEN GOTO LOOP_SDIRS_END
118$ tmp = EXHEADER_'D'
119$ IF D .EQS. ""
120$ THEN
121$ COPY 'tmp' WRK_SSLINCLUDE: /LOG
122$ ELSE
123$ IF D .EQS. "_''ARCH'"
124$ THEN
125$ COPY [-.'ARCH'.CRYPTO]'tmp' WRK_SSLINCLUDE: /LOG
126$ ELSE
127$ COPY [.'D']'tmp' WRK_SSLINCLUDE: /LOG
128$ ENDIF
129$ ENDIF
130$ SET FILE/PROT=WORLD:RE WRK_SSLINCLUDE:'tmp'
131$ GOTO LOOP_SDIRS
132$ LOOP_SDIRS_END:
133$
134$ I = 0
135$ LOOP_LIB:
136$ E = F$EDIT(F$ELEMENT(I, ",", LIBS),"TRIM")
137$ I = I + 1
138$ IF E .EQS. "," THEN GOTO LOOP_LIB_END
139$ SET NOON
140$ IF F$SEARCH(EXE_DIR+E+".OLB") .NES. ""
141$ THEN
142$ COPY 'EXE_DIR''E'.OLB WRK_SSLLIB:'E'.OLB/log
143$ SET FILE/PROT=W:RE WRK_SSLLIB:'E'.OLB
144$ ENDIF
145$ ! Preparing for the time when we have shareable images
146$ IF F$SEARCH(EXE_DIR+E+".EXE") .NES. ""
147$ THEN
148$ COPY 'EXE_DIR''E'.EXE WRK_SSLLIB:'E'.EXE/log
149$ SET FILE/PROT=W:RE WRK_SSLLIB:'E'.EXE
150$ ENDIF
151$ SET ON
152$ GOTO LOOP_LIB
153$ LOOP_LIB_END:
154$
155$ EXIT
diff --git a/src/lib/libcrypto/jpake/Makefile b/src/lib/libcrypto/jpake/Makefile
new file mode 100644
index 0000000000..110c49ce0b
--- /dev/null
+++ b/src/lib/libcrypto/jpake/Makefile
@@ -0,0 +1,64 @@
1DIR=jpake
2TOP=../..
3
4CFLAGS= $(INCLUDES) $(CFLAG)
5
6LIB=$(TOP)/libcrypto.a
7LIBOBJ=jpake.o jpake_err.o
8LIBSRC=jpake.c jpake_err.c
9
10EXHEADER=jpake.h
11TEST=jpaketest.c
12
13top:
14 (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all)
15
16all: lib
17
18lib: $(LIBOBJ)
19 $(AR) $(LIB) $(LIBOBJ)
20 $(RANLIB) $(LIB) || echo Never mind.
21 @touch lib
22
23links:
24 @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
25 @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
26
27install:
28 @[ -n "$(INSTALLTOP)" ] # should be set by top Makefile...
29 @headerlist="$(EXHEADER)"; for i in $$headerlist ; \
30 do \
31 (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
32 chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
33 done;
34
35depend:
36 @[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile...
37 $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
38
39dclean:
40 $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
41 mv -f Makefile.new $(MAKEFILE)
42
43clean:
44 rm -f *.s *.o *.obj des lib tags core .pure .nfs* *.old *.bak fluff
45
46jpaketest: top jpaketest.c $(LIB)
47 $(CC) $(CFLAGS) -Wall -Werror -g -o jpaketest jpaketest.c $(LIB)
48# DO NOT DELETE THIS LINE -- make depend depends on it.
49
50jpake.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
51jpake.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
52jpake.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
53jpake.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
54jpake.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
55jpake.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
56jpake.o: ../../include/openssl/symhacks.h jpake.c jpake.h
57jpake_err.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
58jpake_err.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
59jpake_err.o: ../../include/openssl/err.h ../../include/openssl/jpake.h
60jpake_err.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
61jpake_err.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
62jpake_err.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
63jpake_err.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
64jpake_err.o: jpake_err.c
diff --git a/src/lib/libcrypto/jpake/jpake.c b/src/lib/libcrypto/jpake/jpake.c
new file mode 100644
index 0000000000..8e4b633ccc
--- /dev/null
+++ b/src/lib/libcrypto/jpake/jpake.c
@@ -0,0 +1,511 @@
1#include "jpake.h"
2
3#include <openssl/crypto.h>
4#include <openssl/sha.h>
5#include <openssl/err.h>
6#include <memory.h>
7
8/*
9 * In the definition, (xa, xb, xc, xd) are Alice's (x1, x2, x3, x4) or
10 * Bob's (x3, x4, x1, x2). If you see what I mean.
11 */
12
13typedef struct
14 {
15 char *name; /* Must be unique */
16 char *peer_name;
17 BIGNUM *p;
18 BIGNUM *g;
19 BIGNUM *q;
20 BIGNUM *gxc; /* Alice's g^{x3} or Bob's g^{x1} */
21 BIGNUM *gxd; /* Alice's g^{x4} or Bob's g^{x2} */
22 } JPAKE_CTX_PUBLIC;
23
24struct JPAKE_CTX
25 {
26 JPAKE_CTX_PUBLIC p;
27 BIGNUM *secret; /* The shared secret */
28 BN_CTX *ctx;
29 BIGNUM *xa; /* Alice's x1 or Bob's x3 */
30 BIGNUM *xb; /* Alice's x2 or Bob's x4 */
31 BIGNUM *key; /* The calculated (shared) key */
32 };
33
34static void JPAKE_ZKP_init(JPAKE_ZKP *zkp)
35 {
36 zkp->gr = BN_new();
37 zkp->b = BN_new();
38 }
39
40static void JPAKE_ZKP_release(JPAKE_ZKP *zkp)
41 {
42 BN_free(zkp->b);
43 BN_free(zkp->gr);
44 }
45
46/* Two birds with one stone - make the global name as expected */
47#define JPAKE_STEP_PART_init JPAKE_STEP2_init
48#define JPAKE_STEP_PART_release JPAKE_STEP2_release
49
50void JPAKE_STEP_PART_init(JPAKE_STEP_PART *p)
51 {
52 p->gx = BN_new();
53 JPAKE_ZKP_init(&p->zkpx);
54 }
55
56void JPAKE_STEP_PART_release(JPAKE_STEP_PART *p)
57 {
58 JPAKE_ZKP_release(&p->zkpx);
59 BN_free(p->gx);
60 }
61
62void JPAKE_STEP1_init(JPAKE_STEP1 *s1)
63 {
64 JPAKE_STEP_PART_init(&s1->p1);
65 JPAKE_STEP_PART_init(&s1->p2);
66 }
67
68void JPAKE_STEP1_release(JPAKE_STEP1 *s1)
69 {
70 JPAKE_STEP_PART_release(&s1->p2);
71 JPAKE_STEP_PART_release(&s1->p1);
72 }
73
74static void JPAKE_CTX_init(JPAKE_CTX *ctx, const char *name,
75 const char *peer_name, const BIGNUM *p,
76 const BIGNUM *g, const BIGNUM *q,
77 const BIGNUM *secret)
78 {
79 ctx->p.name = OPENSSL_strdup(name);
80 ctx->p.peer_name = OPENSSL_strdup(peer_name);
81 ctx->p.p = BN_dup(p);
82 ctx->p.g = BN_dup(g);
83 ctx->p.q = BN_dup(q);
84 ctx->secret = BN_dup(secret);
85
86 ctx->p.gxc = BN_new();
87 ctx->p.gxd = BN_new();
88
89 ctx->xa = BN_new();
90 ctx->xb = BN_new();
91 ctx->key = BN_new();
92 ctx->ctx = BN_CTX_new();
93 }
94
95static void JPAKE_CTX_release(JPAKE_CTX *ctx)
96 {
97 BN_CTX_free(ctx->ctx);
98 BN_clear_free(ctx->key);
99 BN_clear_free(ctx->xb);
100 BN_clear_free(ctx->xa);
101
102 BN_free(ctx->p.gxd);
103 BN_free(ctx->p.gxc);
104
105 BN_clear_free(ctx->secret);
106 BN_free(ctx->p.q);
107 BN_free(ctx->p.g);
108 BN_free(ctx->p.p);
109 OPENSSL_free(ctx->p.peer_name);
110 OPENSSL_free(ctx->p.name);
111
112 memset(ctx, '\0', sizeof *ctx);
113 }
114
115JPAKE_CTX *JPAKE_CTX_new(const char *name, const char *peer_name,
116 const BIGNUM *p, const BIGNUM *g, const BIGNUM *q,
117 const BIGNUM *secret)
118 {
119 JPAKE_CTX *ctx = OPENSSL_malloc(sizeof *ctx);
120
121 JPAKE_CTX_init(ctx, name, peer_name, p, g, q, secret);
122
123 return ctx;
124 }
125
126void JPAKE_CTX_free(JPAKE_CTX *ctx)
127 {
128 JPAKE_CTX_release(ctx);
129 OPENSSL_free(ctx);
130 }
131
132static void hashlength(SHA_CTX *sha, size_t l)
133 {
134 unsigned char b[2];
135
136 OPENSSL_assert(l <= 0xffff);
137 b[0] = l >> 8;
138 b[1] = l&0xff;
139 SHA1_Update(sha, b, 2);
140 }
141
142static void hashstring(SHA_CTX *sha, const char *string)
143 {
144 size_t l = strlen(string);
145
146 hashlength(sha, l);
147 SHA1_Update(sha, string, l);
148 }
149
150static void hashbn(SHA_CTX *sha, const BIGNUM *bn)
151 {
152 size_t l = BN_num_bytes(bn);
153 unsigned char *bin = OPENSSL_malloc(l);
154
155 hashlength(sha, l);
156 BN_bn2bin(bn, bin);
157 SHA1_Update(sha, bin, l);
158 OPENSSL_free(bin);
159 }
160
161/* h=hash(g, g^r, g^x, name) */
162static void zkp_hash(BIGNUM *h, const BIGNUM *zkpg, const JPAKE_STEP_PART *p,
163 const char *proof_name)
164 {
165 unsigned char md[SHA_DIGEST_LENGTH];
166 SHA_CTX sha;
167
168 /*
169 * XXX: hash should not allow moving of the boundaries - Java code
170 * is flawed in this respect. Length encoding seems simplest.
171 */
172 SHA1_Init(&sha);
173 hashbn(&sha, zkpg);
174 OPENSSL_assert(!BN_is_zero(p->zkpx.gr));
175 hashbn(&sha, p->zkpx.gr);
176 hashbn(&sha, p->gx);
177 hashstring(&sha, proof_name);
178 SHA1_Final(md, &sha);
179 BN_bin2bn(md, SHA_DIGEST_LENGTH, h);
180 }
181
182/*
183 * Prove knowledge of x
184 * Note that p->gx has already been calculated
185 */
186static void generate_zkp(JPAKE_STEP_PART *p, const BIGNUM *x,
187 const BIGNUM *zkpg, JPAKE_CTX *ctx)
188 {
189 BIGNUM *r = BN_new();
190 BIGNUM *h = BN_new();
191 BIGNUM *t = BN_new();
192
193 /*
194 * r in [0,q)
195 * XXX: Java chooses r in [0, 2^160) - i.e. distribution not uniform
196 */
197 BN_rand_range(r, ctx->p.q);
198 /* g^r */
199 BN_mod_exp(p->zkpx.gr, zkpg, r, ctx->p.p, ctx->ctx);
200
201 /* h=hash... */
202 zkp_hash(h, zkpg, p, ctx->p.name);
203
204 /* b = r - x*h */
205 BN_mod_mul(t, x, h, ctx->p.q, ctx->ctx);
206 BN_mod_sub(p->zkpx.b, r, t, ctx->p.q, ctx->ctx);
207
208 /* cleanup */
209 BN_free(t);
210 BN_free(h);
211 BN_free(r);
212 }
213
214static int verify_zkp(const JPAKE_STEP_PART *p, const BIGNUM *zkpg,
215 JPAKE_CTX *ctx)
216 {
217 BIGNUM *h = BN_new();
218 BIGNUM *t1 = BN_new();
219 BIGNUM *t2 = BN_new();
220 BIGNUM *t3 = BN_new();
221 int ret = 0;
222
223 zkp_hash(h, zkpg, p, ctx->p.peer_name);
224
225 /* t1 = g^b */
226 BN_mod_exp(t1, zkpg, p->zkpx.b, ctx->p.p, ctx->ctx);
227 /* t2 = (g^x)^h = g^{hx} */
228 BN_mod_exp(t2, p->gx, h, ctx->p.p, ctx->ctx);
229 /* t3 = t1 * t2 = g^{hx} * g^b = g^{hx+b} = g^r (allegedly) */
230 BN_mod_mul(t3, t1, t2, ctx->p.p, ctx->ctx);
231
232 /* verify t3 == g^r */
233 if(BN_cmp(t3, p->zkpx.gr) == 0)
234 ret = 1;
235 else
236 JPAKEerr(JPAKE_F_VERIFY_ZKP, JPAKE_R_ZKP_VERIFY_FAILED);
237
238 /* cleanup */
239 BN_free(t3);
240 BN_free(t2);
241 BN_free(t1);
242 BN_free(h);
243
244 return ret;
245 }
246
247static void generate_step_part(JPAKE_STEP_PART *p, const BIGNUM *x,
248 const BIGNUM *g, JPAKE_CTX *ctx)
249 {
250 BN_mod_exp(p->gx, g, x, ctx->p.p, ctx->ctx);
251 generate_zkp(p, x, g, ctx);
252 }
253
254/* Generate each party's random numbers. xa is in [0, q), xb is in [1, q). */
255static void genrand(JPAKE_CTX *ctx)
256 {
257 BIGNUM *qm1;
258
259 /* xa in [0, q) */
260 BN_rand_range(ctx->xa, ctx->p.q);
261
262 /* q-1 */
263 qm1 = BN_new();
264 BN_copy(qm1, ctx->p.q);
265 BN_sub_word(qm1, 1);
266
267 /* ... and xb in [0, q-1) */
268 BN_rand_range(ctx->xb, qm1);
269 /* [1, q) */
270 BN_add_word(ctx->xb, 1);
271
272 /* cleanup */
273 BN_free(qm1);
274 }
275
276int JPAKE_STEP1_generate(JPAKE_STEP1 *send, JPAKE_CTX *ctx)
277 {
278 genrand(ctx);
279 generate_step_part(&send->p1, ctx->xa, ctx->p.g, ctx);
280 generate_step_part(&send->p2, ctx->xb, ctx->p.g, ctx);
281
282 return 1;
283 }
284
285/* g^x is a legal value */
286static int is_legal(const BIGNUM *gx, const JPAKE_CTX *ctx)
287 {
288 BIGNUM *t;
289 int res;
290
291 if(BN_is_negative(gx) || BN_is_zero(gx) || BN_cmp(gx, ctx->p.p) >= 0)
292 return 0;
293
294 t = BN_new();
295 BN_mod_exp(t, gx, ctx->p.q, ctx->p.p, ctx->ctx);
296 res = BN_is_one(t);
297 BN_free(t);
298
299 return res;
300 }
301
302int JPAKE_STEP1_process(JPAKE_CTX *ctx, const JPAKE_STEP1 *received)
303 {
304 if(!is_legal(received->p1.gx, ctx))
305 {
306 JPAKEerr(JPAKE_F_JPAKE_STEP1_PROCESS, JPAKE_R_G_TO_THE_X3_IS_NOT_LEGAL);
307 return 0;
308 }
309
310 if(!is_legal(received->p2.gx, ctx))
311 {
312 JPAKEerr(JPAKE_F_JPAKE_STEP1_PROCESS, JPAKE_R_G_TO_THE_X4_IS_NOT_LEGAL);
313 return 0;
314 }
315
316 /* verify their ZKP(xc) */
317 if(!verify_zkp(&received->p1, ctx->p.g, ctx))
318 {
319 JPAKEerr(JPAKE_F_JPAKE_STEP1_PROCESS, JPAKE_R_VERIFY_X3_FAILED);
320 return 0;
321 }
322
323 /* verify their ZKP(xd) */
324 if(!verify_zkp(&received->p2, ctx->p.g, ctx))
325 {
326 JPAKEerr(JPAKE_F_JPAKE_STEP1_PROCESS, JPAKE_R_VERIFY_X4_FAILED);
327 return 0;
328 }
329
330 /* g^xd != 1 */
331 if(BN_is_one(received->p2.gx))
332 {
333 JPAKEerr(JPAKE_F_JPAKE_STEP1_PROCESS, JPAKE_R_G_TO_THE_X4_IS_ONE);
334 return 0;
335 }
336
337 /* Save the bits we need for later */
338 BN_copy(ctx->p.gxc, received->p1.gx);
339 BN_copy(ctx->p.gxd, received->p2.gx);
340
341 return 1;
342 }
343
344
345int JPAKE_STEP2_generate(JPAKE_STEP2 *send, JPAKE_CTX *ctx)
346 {
347 BIGNUM *t1 = BN_new();
348 BIGNUM *t2 = BN_new();
349
350 /*
351 * X = g^{(xa + xc + xd) * xb * s}
352 * t1 = g^xa
353 */
354 BN_mod_exp(t1, ctx->p.g, ctx->xa, ctx->p.p, ctx->ctx);
355 /* t2 = t1 * g^{xc} = g^{xa} * g^{xc} = g^{xa + xc} */
356 BN_mod_mul(t2, t1, ctx->p.gxc, ctx->p.p, ctx->ctx);
357 /* t1 = t2 * g^{xd} = g^{xa + xc + xd} */
358 BN_mod_mul(t1, t2, ctx->p.gxd, ctx->p.p, ctx->ctx);
359 /* t2 = xb * s */
360 BN_mod_mul(t2, ctx->xb, ctx->secret, ctx->p.q, ctx->ctx);
361
362 /*
363 * ZKP(xb * s)
364 * XXX: this is kinda funky, because we're using
365 *
366 * g' = g^{xa + xc + xd}
367 *
368 * as the generator, which means X is g'^{xb * s}
369 * X = t1^{t2} = t1^{xb * s} = g^{(xa + xc + xd) * xb * s}
370 */
371 generate_step_part(send, t2, t1, ctx);
372
373 /* cleanup */
374 BN_free(t1);
375 BN_free(t2);
376
377 return 1;
378 }
379
380/* gx = g^{xc + xa + xb} * xd * s */
381static int compute_key(JPAKE_CTX *ctx, const BIGNUM *gx)
382 {
383 BIGNUM *t1 = BN_new();
384 BIGNUM *t2 = BN_new();
385 BIGNUM *t3 = BN_new();
386
387 /*
388 * K = (gx/g^{xb * xd * s})^{xb}
389 * = (g^{(xc + xa + xb) * xd * s - xb * xd *s})^{xb}
390 * = (g^{(xa + xc) * xd * s})^{xb}
391 * = g^{(xa + xc) * xb * xd * s}
392 * [which is the same regardless of who calculates it]
393 */
394
395 /* t1 = (g^{xd})^{xb} = g^{xb * xd} */
396 BN_mod_exp(t1, ctx->p.gxd, ctx->xb, ctx->p.p, ctx->ctx);
397 /* t2 = -s = q-s */
398 BN_sub(t2, ctx->p.q, ctx->secret);
399 /* t3 = t1^t2 = g^{-xb * xd * s} */
400 BN_mod_exp(t3, t1, t2, ctx->p.p, ctx->ctx);
401 /* t1 = gx * t3 = X/g^{xb * xd * s} */
402 BN_mod_mul(t1, gx, t3, ctx->p.p, ctx->ctx);
403 /* K = t1^{xb} */
404 BN_mod_exp(ctx->key, t1, ctx->xb, ctx->p.p, ctx->ctx);
405
406 /* cleanup */
407 BN_free(t3);
408 BN_free(t2);
409 BN_free(t1);
410
411 return 1;
412 }
413
414int JPAKE_STEP2_process(JPAKE_CTX *ctx, const JPAKE_STEP2 *received)
415 {
416 BIGNUM *t1 = BN_new();
417 BIGNUM *t2 = BN_new();
418 int ret = 0;
419
420 /*
421 * g' = g^{xc + xa + xb} [from our POV]
422 * t1 = xa + xb
423 */
424 BN_mod_add(t1, ctx->xa, ctx->xb, ctx->p.q, ctx->ctx);
425 /* t2 = g^{t1} = g^{xa+xb} */
426 BN_mod_exp(t2, ctx->p.g, t1, ctx->p.p, ctx->ctx);
427 /* t1 = g^{xc} * t2 = g^{xc + xa + xb} */
428 BN_mod_mul(t1, ctx->p.gxc, t2, ctx->p.p, ctx->ctx);
429
430 if(verify_zkp(received, t1, ctx))
431 ret = 1;
432 else
433 JPAKEerr(JPAKE_F_JPAKE_STEP2_PROCESS, JPAKE_R_VERIFY_B_FAILED);
434
435 compute_key(ctx, received->gx);
436
437 /* cleanup */
438 BN_free(t2);
439 BN_free(t1);
440
441 return ret;
442 }
443
444static void quickhashbn(unsigned char *md, const BIGNUM *bn)
445 {
446 SHA_CTX sha;
447
448 SHA1_Init(&sha);
449 hashbn(&sha, bn);
450 SHA1_Final(md, &sha);
451 }
452
453void JPAKE_STEP3A_init(JPAKE_STEP3A *s3a)
454 {}
455
456int JPAKE_STEP3A_generate(JPAKE_STEP3A *send, JPAKE_CTX *ctx)
457 {
458 quickhashbn(send->hhk, ctx->key);
459 SHA1(send->hhk, sizeof send->hhk, send->hhk);
460
461 return 1;
462 }
463
464int JPAKE_STEP3A_process(JPAKE_CTX *ctx, const JPAKE_STEP3A *received)
465 {
466 unsigned char hhk[SHA_DIGEST_LENGTH];
467
468 quickhashbn(hhk, ctx->key);
469 SHA1(hhk, sizeof hhk, hhk);
470 if(memcmp(hhk, received->hhk, sizeof hhk))
471 {
472 JPAKEerr(JPAKE_F_JPAKE_STEP3A_PROCESS, JPAKE_R_HASH_OF_HASH_OF_KEY_MISMATCH);
473 return 0;
474 }
475 return 1;
476 }
477
478void JPAKE_STEP3A_release(JPAKE_STEP3A *s3a)
479 {}
480
481void JPAKE_STEP3B_init(JPAKE_STEP3B *s3b)
482 {}
483
484int JPAKE_STEP3B_generate(JPAKE_STEP3B *send, JPAKE_CTX *ctx)
485 {
486 quickhashbn(send->hk, ctx->key);
487
488 return 1;
489 }
490
491int JPAKE_STEP3B_process(JPAKE_CTX *ctx, const JPAKE_STEP3B *received)
492 {
493 unsigned char hk[SHA_DIGEST_LENGTH];
494
495 quickhashbn(hk, ctx->key);
496 if(memcmp(hk, received->hk, sizeof hk))
497 {
498 JPAKEerr(JPAKE_F_JPAKE_STEP3B_PROCESS, JPAKE_R_HASH_OF_KEY_MISMATCH);
499 return 0;
500 }
501 return 1;
502 }
503
504void JPAKE_STEP3B_release(JPAKE_STEP3B *s3b)
505 {}
506
507const BIGNUM *JPAKE_get_shared_key(JPAKE_CTX *ctx)
508 {
509 return ctx->key;
510 }
511
diff --git a/src/lib/libcrypto/jpake/jpake.h b/src/lib/libcrypto/jpake/jpake.h
new file mode 100644
index 0000000000..fd143b4d9b
--- /dev/null
+++ b/src/lib/libcrypto/jpake/jpake.h
@@ -0,0 +1,131 @@
1/*
2 * Implement J-PAKE, as described in
3 * http://grouper.ieee.org/groups/1363/Research/contributions/hao-ryan-2008.pdf
4 *
5 * With hints from http://www.cl.cam.ac.uk/~fh240/software/JPAKE2.java.
6 */
7
8#ifndef HEADER_JPAKE_H
9#define HEADER_JPAKE_H
10
11#include <openssl/opensslconf.h>
12
13#ifdef OPENSSL_NO_JPAKE
14#error JPAKE is disabled.
15#endif
16
17#ifdef __cplusplus
18extern "C" {
19#endif
20
21#include <openssl/bn.h>
22#include <openssl/sha.h>
23
24typedef struct JPAKE_CTX JPAKE_CTX;
25
26/* Note that "g" in the ZKPs is not necessarily the J-PAKE g. */
27typedef struct
28 {
29 BIGNUM *gr; /* g^r (r random) */
30 BIGNUM *b; /* b = r - x*h, h=hash(g, g^r, g^x, name) */
31 } JPAKE_ZKP;
32
33typedef struct
34 {
35 BIGNUM *gx; /* g^x in step 1, g^(xa + xc + xd) * xb * s in step 2 */
36 JPAKE_ZKP zkpx; /* ZKP(x) or ZKP(xb * s) */
37 } JPAKE_STEP_PART;
38
39typedef struct
40 {
41 JPAKE_STEP_PART p1; /* g^x3, ZKP(x3) or g^x1, ZKP(x1) */
42 JPAKE_STEP_PART p2; /* g^x4, ZKP(x4) or g^x2, ZKP(x2) */
43 } JPAKE_STEP1;
44
45typedef JPAKE_STEP_PART JPAKE_STEP2;
46
47typedef struct
48 {
49 unsigned char hhk[SHA_DIGEST_LENGTH];
50 } JPAKE_STEP3A;
51
52typedef struct
53 {
54 unsigned char hk[SHA_DIGEST_LENGTH];
55 } JPAKE_STEP3B;
56
57/* Parameters are copied */
58JPAKE_CTX *JPAKE_CTX_new(const char *name, const char *peer_name,
59 const BIGNUM *p, const BIGNUM *g, const BIGNUM *q,
60 const BIGNUM *secret);
61void JPAKE_CTX_free(JPAKE_CTX *ctx);
62
63/*
64 * Note that JPAKE_STEP1 can be used multiple times before release
65 * without another init.
66 */
67void JPAKE_STEP1_init(JPAKE_STEP1 *s1);
68int JPAKE_STEP1_generate(JPAKE_STEP1 *send, JPAKE_CTX *ctx);
69int JPAKE_STEP1_process(JPAKE_CTX *ctx, const JPAKE_STEP1 *received);
70void JPAKE_STEP1_release(JPAKE_STEP1 *s1);
71
72/*
73 * Note that JPAKE_STEP2 can be used multiple times before release
74 * without another init.
75 */
76void JPAKE_STEP2_init(JPAKE_STEP2 *s2);
77int JPAKE_STEP2_generate(JPAKE_STEP2 *send, JPAKE_CTX *ctx);
78int JPAKE_STEP2_process(JPAKE_CTX *ctx, const JPAKE_STEP2 *received);
79void JPAKE_STEP2_release(JPAKE_STEP2 *s2);
80
81/*
82 * Optionally verify the shared key. If the shared secrets do not
83 * match, the two ends will disagree about the shared key, but
84 * otherwise the protocol will succeed.
85 */
86void JPAKE_STEP3A_init(JPAKE_STEP3A *s3a);
87int JPAKE_STEP3A_generate(JPAKE_STEP3A *send, JPAKE_CTX *ctx);
88int JPAKE_STEP3A_process(JPAKE_CTX *ctx, const JPAKE_STEP3A *received);
89void JPAKE_STEP3A_release(JPAKE_STEP3A *s3a);
90
91void JPAKE_STEP3B_init(JPAKE_STEP3B *s3b);
92int JPAKE_STEP3B_generate(JPAKE_STEP3B *send, JPAKE_CTX *ctx);
93int JPAKE_STEP3B_process(JPAKE_CTX *ctx, const JPAKE_STEP3B *received);
94void JPAKE_STEP3B_release(JPAKE_STEP3B *s3b);
95
96/*
97 * the return value belongs to the library and will be released when
98 * ctx is released, and will change when a new handshake is performed.
99 */
100const BIGNUM *JPAKE_get_shared_key(JPAKE_CTX *ctx);
101
102/* BEGIN ERROR CODES */
103/* The following lines are auto generated by the script mkerr.pl. Any changes
104 * made after this point may be overwritten when the script is next run.
105 */
106void ERR_load_JPAKE_strings(void);
107
108/* Error codes for the JPAKE functions. */
109
110/* Function codes. */
111#define JPAKE_F_JPAKE_STEP1_PROCESS 101
112#define JPAKE_F_JPAKE_STEP2_PROCESS 102
113#define JPAKE_F_JPAKE_STEP3A_PROCESS 103
114#define JPAKE_F_JPAKE_STEP3B_PROCESS 104
115#define JPAKE_F_VERIFY_ZKP 100
116
117/* Reason codes. */
118#define JPAKE_R_G_TO_THE_X3_IS_NOT_LEGAL 108
119#define JPAKE_R_G_TO_THE_X4_IS_NOT_LEGAL 109
120#define JPAKE_R_G_TO_THE_X4_IS_ONE 105
121#define JPAKE_R_HASH_OF_HASH_OF_KEY_MISMATCH 106
122#define JPAKE_R_HASH_OF_KEY_MISMATCH 107
123#define JPAKE_R_VERIFY_B_FAILED 102
124#define JPAKE_R_VERIFY_X3_FAILED 103
125#define JPAKE_R_VERIFY_X4_FAILED 104
126#define JPAKE_R_ZKP_VERIFY_FAILED 100
127
128#ifdef __cplusplus
129}
130#endif
131#endif
diff --git a/src/lib/libcrypto/jpake/jpake_err.c b/src/lib/libcrypto/jpake/jpake_err.c
new file mode 100644
index 0000000000..a9a9dee75c
--- /dev/null
+++ b/src/lib/libcrypto/jpake/jpake_err.c
@@ -0,0 +1,107 @@
1/* crypto/jpake/jpake_err.c */
2/* ====================================================================
3 * Copyright (c) 1999-2010 The OpenSSL Project. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 *
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in
14 * the documentation and/or other materials provided with the
15 * distribution.
16 *
17 * 3. All advertising materials mentioning features or use of this
18 * software must display the following acknowledgment:
19 * "This product includes software developed by the OpenSSL Project
20 * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
21 *
22 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
23 * endorse or promote products derived from this software without
24 * prior written permission. For written permission, please contact
25 * openssl-core@OpenSSL.org.
26 *
27 * 5. Products derived from this software may not be called "OpenSSL"
28 * nor may "OpenSSL" appear in their names without prior written
29 * permission of the OpenSSL Project.
30 *
31 * 6. Redistributions of any form whatsoever must retain the following
32 * acknowledgment:
33 * "This product includes software developed by the OpenSSL Project
34 * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
35 *
36 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
37 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
38 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
39 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
40 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
41 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
42 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
43 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
44 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
45 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
46 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
47 * OF THE POSSIBILITY OF SUCH DAMAGE.
48 * ====================================================================
49 *
50 * This product includes cryptographic software written by Eric Young
51 * (eay@cryptsoft.com). This product includes software written by Tim
52 * Hudson (tjh@cryptsoft.com).
53 *
54 */
55
56/* NOTE: this file was auto generated by the mkerr.pl script: any changes
57 * made to it will be overwritten when the script next updates this file,
58 * only reason strings will be preserved.
59 */
60
61#include <stdio.h>
62#include <openssl/err.h>
63#include <openssl/jpake.h>
64
65/* BEGIN ERROR CODES */
66#ifndef OPENSSL_NO_ERR
67
68#define ERR_FUNC(func) ERR_PACK(ERR_LIB_JPAKE,func,0)
69#define ERR_REASON(reason) ERR_PACK(ERR_LIB_JPAKE,0,reason)
70
71static ERR_STRING_DATA JPAKE_str_functs[]=
72 {
73{ERR_FUNC(JPAKE_F_JPAKE_STEP1_PROCESS), "JPAKE_STEP1_process"},
74{ERR_FUNC(JPAKE_F_JPAKE_STEP2_PROCESS), "JPAKE_STEP2_process"},
75{ERR_FUNC(JPAKE_F_JPAKE_STEP3A_PROCESS), "JPAKE_STEP3A_process"},
76{ERR_FUNC(JPAKE_F_JPAKE_STEP3B_PROCESS), "JPAKE_STEP3B_process"},
77{ERR_FUNC(JPAKE_F_VERIFY_ZKP), "VERIFY_ZKP"},
78{0,NULL}
79 };
80
81static ERR_STRING_DATA JPAKE_str_reasons[]=
82 {
83{ERR_REASON(JPAKE_R_G_TO_THE_X3_IS_NOT_LEGAL),"g to the x3 is not legal"},
84{ERR_REASON(JPAKE_R_G_TO_THE_X4_IS_NOT_LEGAL),"g to the x4 is not legal"},
85{ERR_REASON(JPAKE_R_G_TO_THE_X4_IS_ONE) ,"g to the x4 is one"},
86{ERR_REASON(JPAKE_R_HASH_OF_HASH_OF_KEY_MISMATCH),"hash of hash of key mismatch"},
87{ERR_REASON(JPAKE_R_HASH_OF_KEY_MISMATCH),"hash of key mismatch"},
88{ERR_REASON(JPAKE_R_VERIFY_B_FAILED) ,"verify b failed"},
89{ERR_REASON(JPAKE_R_VERIFY_X3_FAILED) ,"verify x3 failed"},
90{ERR_REASON(JPAKE_R_VERIFY_X4_FAILED) ,"verify x4 failed"},
91{ERR_REASON(JPAKE_R_ZKP_VERIFY_FAILED) ,"zkp verify failed"},
92{0,NULL}
93 };
94
95#endif
96
97void ERR_load_JPAKE_strings(void)
98 {
99#ifndef OPENSSL_NO_ERR
100
101 if (ERR_func_error_string(JPAKE_str_functs[0].error) == NULL)
102 {
103 ERR_load_strings(0,JPAKE_str_functs);
104 ERR_load_strings(0,JPAKE_str_reasons);
105 }
106#endif
107 }
diff --git a/src/lib/libcrypto/jpake/jpaketest.c b/src/lib/libcrypto/jpake/jpaketest.c
new file mode 100644
index 0000000000..eaba75ed8a
--- /dev/null
+++ b/src/lib/libcrypto/jpake/jpaketest.c
@@ -0,0 +1,192 @@
1#include <openssl/opensslconf.h>
2
3#ifdef OPENSSL_NO_JPAKE
4
5#include <stdio.h>
6
7int main(int argc, char *argv[])
8{
9 printf("No J-PAKE support\n");
10 return(0);
11}
12
13#else
14
15#include <openssl/jpake.h>
16#include <openssl/err.h>
17
18static void showbn(const char *name, const BIGNUM *bn)
19 {
20 fputs(name, stdout);
21 fputs(" = ", stdout);
22 BN_print_fp(stdout, bn);
23 putc('\n', stdout);
24 }
25
26static int run_jpake(JPAKE_CTX *alice, JPAKE_CTX *bob)
27 {
28 JPAKE_STEP1 alice_s1;
29 JPAKE_STEP1 bob_s1;
30 JPAKE_STEP2 alice_s2;
31 JPAKE_STEP2 bob_s2;
32 JPAKE_STEP3A alice_s3a;
33 JPAKE_STEP3B bob_s3b;
34
35 /* Alice -> Bob: step 1 */
36 puts("A->B s1");
37 JPAKE_STEP1_init(&alice_s1);
38 JPAKE_STEP1_generate(&alice_s1, alice);
39 if(!JPAKE_STEP1_process(bob, &alice_s1))
40 {
41 printf("Bob fails to process Alice's step 1\n");
42 ERR_print_errors_fp(stdout);
43 return 1;
44 }
45 JPAKE_STEP1_release(&alice_s1);
46
47 /* Bob -> Alice: step 1 */
48 puts("B->A s1");
49 JPAKE_STEP1_init(&bob_s1);
50 JPAKE_STEP1_generate(&bob_s1, bob);
51 if(!JPAKE_STEP1_process(alice, &bob_s1))
52 {
53 printf("Alice fails to process Bob's step 1\n");
54 ERR_print_errors_fp(stdout);
55 return 2;
56 }
57 JPAKE_STEP1_release(&bob_s1);
58
59 /* Alice -> Bob: step 2 */
60 puts("A->B s2");
61 JPAKE_STEP2_init(&alice_s2);
62 JPAKE_STEP2_generate(&alice_s2, alice);
63 if(!JPAKE_STEP2_process(bob, &alice_s2))
64 {
65 printf("Bob fails to process Alice's step 2\n");
66 ERR_print_errors_fp(stdout);
67 return 3;
68 }
69 JPAKE_STEP2_release(&alice_s2);
70
71 /* Bob -> Alice: step 2 */
72 puts("B->A s2");
73 JPAKE_STEP2_init(&bob_s2);
74 JPAKE_STEP2_generate(&bob_s2, bob);
75 if(!JPAKE_STEP2_process(alice, &bob_s2))
76 {
77 printf("Alice fails to process Bob's step 2\n");
78 ERR_print_errors_fp(stdout);
79 return 4;
80 }
81 JPAKE_STEP2_release(&bob_s2);
82
83 showbn("Alice's key", JPAKE_get_shared_key(alice));
84 showbn("Bob's key ", JPAKE_get_shared_key(bob));
85
86 /* Alice -> Bob: step 3a */
87 puts("A->B s3a");
88 JPAKE_STEP3A_init(&alice_s3a);
89 JPAKE_STEP3A_generate(&alice_s3a, alice);
90 if(!JPAKE_STEP3A_process(bob, &alice_s3a))
91 {
92 printf("Bob fails to process Alice's step 3a\n");
93 ERR_print_errors_fp(stdout);
94 return 5;
95 }
96 JPAKE_STEP3A_release(&alice_s3a);
97
98 /* Bob -> Alice: step 3b */
99 puts("B->A s3b");
100 JPAKE_STEP3B_init(&bob_s3b);
101 JPAKE_STEP3B_generate(&bob_s3b, bob);
102 if(!JPAKE_STEP3B_process(alice, &bob_s3b))
103 {
104 printf("Alice fails to process Bob's step 3b\n");
105 ERR_print_errors_fp(stdout);
106 return 6;
107 }
108 JPAKE_STEP3B_release(&bob_s3b);
109
110 return 0;
111 }
112
113int main(int argc, char **argv)
114 {
115 JPAKE_CTX *alice;
116 JPAKE_CTX *bob;
117 BIGNUM *p = NULL;
118 BIGNUM *g = NULL;
119 BIGNUM *q = NULL;
120 BIGNUM *secret = BN_new();
121 BIO *bio_err;
122
123 bio_err = BIO_new_fp(stderr, BIO_NOCLOSE);
124
125 CRYPTO_malloc_debug_init();
126 CRYPTO_dbg_set_options(V_CRYPTO_MDEBUG_ALL);
127 CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON);
128
129 ERR_load_crypto_strings();
130
131 /*
132 BN_hex2bn(&p, "fd7f53811d75122952df4a9c2eece4e7f611b7523cef4400c31e3f80b6512669455d402251fb593d8d58fabfc5f5ba30f6cb9b556cd7813b801d346ff26660b76b9950a5a49f9fe8047b1022c24fbba9d7feb7c61bf83b57e7c6a8a6150f04fb83f6d3c51ec3023554135a169132f675f3ae2b61d72aeff22203199dd14801c7");
133 BN_hex2bn(&g, "f7e1a085d69b3ddecbbcab5c36b857b97994afbbfa3aea82f9574c0b3d0782675159578ebad4594fe67107108180b449167123e84c281613b7cf09328cc8a6e13c167a8b547c8d28e0a3ae1e2bb3a675916ea37f0bfa213562f1fb627a01243bcca4f1bea8519089a883dfe15ae59f06928b665e807b552564014c3bfecf492a");
134 BN_hex2bn(&q, "9760508f15230bccb292b982a2eb840bf0581cf5");
135 */
136 /*
137 p = BN_new();
138 BN_generate_prime(p, 1024, 1, NULL, NULL, NULL, NULL);
139 */
140 /* Use a safe prime for p (that we found earlier) */
141 BN_hex2bn(&p, "F9E5B365665EA7A05A9C534502780FEE6F1AB5BD4F49947FD036DBD7E905269AF46EF28B0FC07487EE4F5D20FB3C0AF8E700F3A2FA3414970CBED44FEDFF80CE78D800F184BB82435D137AADA2C6C16523247930A63B85661D1FC817A51ACD96168E95898A1F83A79FFB529368AA7833ABD1B0C3AEDDB14D2E1A2F71D99F763F");
142 showbn("p", p);
143 g = BN_new();
144 BN_set_word(g, 2);
145 showbn("g", g);
146 q = BN_new();
147 BN_rshift1(q, p);
148 showbn("q", q);
149
150 BN_rand(secret, 32, -1, 0);
151
152 /* A normal run, expect this to work... */
153 alice = JPAKE_CTX_new("Alice", "Bob", p, g, q, secret);
154 bob = JPAKE_CTX_new("Bob", "Alice", p, g, q, secret);
155
156 if(run_jpake(alice, bob) != 0)
157 {
158 fprintf(stderr, "Plain JPAKE run failed\n");
159 return 1;
160 }
161
162 JPAKE_CTX_free(bob);
163 JPAKE_CTX_free(alice);
164
165 /* Now give Alice and Bob different secrets */
166 alice = JPAKE_CTX_new("Alice", "Bob", p, g, q, secret);
167 BN_add_word(secret, 1);
168 bob = JPAKE_CTX_new("Bob", "Alice", p, g, q, secret);
169
170 if(run_jpake(alice, bob) != 5)
171 {
172 fprintf(stderr, "Mismatched secret JPAKE run failed\n");
173 return 1;
174 }
175
176 JPAKE_CTX_free(bob);
177 JPAKE_CTX_free(alice);
178
179 BN_free(secret);
180 BN_free(q);
181 BN_free(g);
182 BN_free(p);
183
184 CRYPTO_cleanup_all_ex_data();
185 ERR_remove_thread_state(NULL);
186 ERR_free_strings();
187 CRYPTO_mem_leaks(bio_err);
188
189 return 0;
190 }
191
192#endif
diff --git a/src/lib/libcrypto/krb5/Makefile b/src/lib/libcrypto/krb5/Makefile
new file mode 100644
index 0000000000..14077390d6
--- /dev/null
+++ b/src/lib/libcrypto/krb5/Makefile
@@ -0,0 +1,84 @@
1#
2# OpenSSL/krb5/Makefile
3#
4
5DIR= krb5
6TOP= ../..
7CC= cc
8INCLUDES= -I.. -I$(TOP) -I../../include
9CFLAG=-g
10MAKEFILE= Makefile
11AR= ar r
12
13CFLAGS= $(INCLUDES) $(CFLAG)
14
15GENERAL=Makefile README
16TEST=
17APPS=
18
19LIB=$(TOP)/libcrypto.a
20LIBSRC= krb5_asn.c
21
22LIBOBJ= krb5_asn.o
23
24SRC= $(LIBSRC)
25
26EXHEADER= krb5_asn.h
27HEADER= $(EXHEADER)
28
29ALL= $(GENERAL) $(SRC) $(HEADER)
30
31top:
32 (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all)
33
34all: lib
35
36lib: $(LIBOBJ)
37 $(AR) $(LIB) $(LIBOBJ)
38 $(RANLIB) $(LIB) || echo Never mind.
39 @touch lib
40
41files:
42 $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
43
44links:
45 @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
46 @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
47 @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
48
49install:
50 @[ -n "$(INSTALLTOP)" ] # should be set by top Makefile...
51 @headerlist="$(EXHEADER)"; for i in $$headerlist ; \
52 do \
53 (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
54 chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
55 done;
56
57tags:
58 ctags $(SRC)
59
60tests:
61
62lint:
63 lint -DLINT $(INCLUDES) $(SRC)>fluff
64
65depend:
66 @[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile...
67 $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(LIBSRC)
68
69dclean:
70 $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
71 mv -f Makefile.new $(MAKEFILE)
72
73clean:
74 rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
75
76# DO NOT DELETE THIS LINE -- make depend depends on it.
77
78krb5_asn.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h
79krb5_asn.o: ../../include/openssl/bio.h ../../include/openssl/crypto.h
80krb5_asn.o: ../../include/openssl/e_os2.h ../../include/openssl/krb5_asn.h
81krb5_asn.o: ../../include/openssl/opensslconf.h
82krb5_asn.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
83krb5_asn.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
84krb5_asn.o: ../../include/openssl/symhacks.h krb5_asn.c
diff --git a/src/lib/libcrypto/lhash/Makefile b/src/lib/libcrypto/lhash/Makefile
new file mode 100644
index 0000000000..82bddac474
--- /dev/null
+++ b/src/lib/libcrypto/lhash/Makefile
@@ -0,0 +1,88 @@
1#
2# OpenSSL/crypto/lhash/Makefile
3#
4
5DIR= lhash
6TOP= ../..
7CC= cc
8INCLUDES=
9CFLAG=-g
10MAKEFILE= Makefile
11AR= ar r
12
13CFLAGS= $(INCLUDES) $(CFLAG)
14
15GENERAL=Makefile
16TEST=
17APPS=
18
19LIB=$(TOP)/libcrypto.a
20LIBSRC=lhash.c lh_stats.c
21LIBOBJ=lhash.o lh_stats.o
22
23SRC= $(LIBSRC)
24
25EXHEADER= lhash.h
26HEADER= $(EXHEADER)
27
28ALL= $(GENERAL) $(SRC) $(HEADER)
29
30top:
31 (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all)
32
33all: lib
34
35lib: $(LIBOBJ)
36 $(AR) $(LIB) $(LIBOBJ)
37 $(RANLIB) $(LIB) || echo Never mind.
38 @touch lib
39
40files:
41 $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
42
43links:
44 @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
45 @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
46 @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
47
48install:
49 @[ -n "$(INSTALLTOP)" ] # should be set by top Makefile...
50 @headerlist="$(EXHEADER)"; for i in $$headerlist ; \
51 do \
52 (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
53 chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
54 done;
55
56tags:
57 ctags $(SRC)
58
59tests:
60
61lint:
62 lint -DLINT $(INCLUDES) $(SRC)>fluff
63
64depend:
65 @[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile...
66 $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
67
68dclean:
69 $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
70 mv -f Makefile.new $(MAKEFILE)
71
72clean:
73 rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
74
75# DO NOT DELETE THIS LINE -- make depend depends on it.
76
77lh_stats.o: ../../e_os.h ../../include/openssl/bio.h
78lh_stats.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
79lh_stats.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
80lh_stats.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
81lh_stats.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
82lh_stats.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
83lh_stats.o: ../../include/openssl/symhacks.h ../cryptlib.h lh_stats.c
84lhash.o: ../../include/openssl/bio.h ../../include/openssl/crypto.h
85lhash.o: ../../include/openssl/e_os2.h ../../include/openssl/lhash.h
86lhash.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
87lhash.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
88lhash.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h lhash.c
diff --git a/src/lib/libcrypto/lhash/lh_test.c b/src/lib/libcrypto/lhash/lh_test.c
new file mode 100644
index 0000000000..85700c859b
--- /dev/null
+++ b/src/lib/libcrypto/lhash/lh_test.c
@@ -0,0 +1,88 @@
1/* crypto/lhash/lh_test.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
59#include <stdio.h>
60#include <stdlib.h>
61#include <string.h>
62#include <openssl/lhash.h>
63
64main()
65 {
66 LHASH *conf;
67 char buf[256];
68 int i;
69
70 conf=lh_new(lh_strhash,strcmp);
71 for (;;)
72 {
73 char *p;
74
75 buf[0]='\0';
76 fgets(buf,256,stdin);
77 if (buf[0] == '\0') break;
78 i=strlen(buf);
79 p=OPENSSL_malloc(i+1);
80 memcpy(p,buf,i+1);
81 lh_insert(conf,p);
82 }
83
84 lh_node_stats(conf,stdout);
85 lh_stats(conf,stdout);
86 lh_node_usage_stats(conf,stdout);
87 exit(0);
88 }
diff --git a/src/lib/libcrypto/lhash/num.pl b/src/lib/libcrypto/lhash/num.pl
new file mode 100644
index 0000000000..30fedf9cd5
--- /dev/null
+++ b/src/lib/libcrypto/lhash/num.pl
@@ -0,0 +1,17 @@
1#!/usr/local/bin/perl
2
3#node 10 -> 4
4
5while (<>)
6 {
7 next unless /^node/;
8 chop;
9 @a=split;
10 $num{$a[3]}++;
11 }
12
13@a=sort {$a <=> $b } keys %num;
14foreach (0 .. $a[$#a])
15 {
16 printf "%4d:%4d\n",$_,$num{$_};
17 }
diff --git a/src/lib/libcrypto/man/Makefile b/src/lib/libcrypto/man/Makefile
new file mode 100644
index 0000000000..503829ae8d
--- /dev/null
+++ b/src/lib/libcrypto/man/Makefile
@@ -0,0 +1,903 @@
1# $OpenBSD: Makefile,v 1.1 2014/04/11 22:51:53 miod Exp $
2
3.include <bsd.own.mk> # for NOMAN
4
5POD2MAN=pod2man --official --release="OpenBSD ${OSREV}" --center=OpenSSL
6
7.ifndef NOMAN
8MAN= \
9 ASN1_OBJECT_new.3 \
10 ASN1_STRING_length.3 \
11 ASN1_STRING_new.3 \
12 ASN1_STRING_print_ex.3 \
13 ASN1_generate_nconf.3 \
14 BIO_ctrl.3 \
15 BIO_f_base64.3 \
16 BIO_f_buffer.3 \
17 BIO_f_cipher.3 \
18 BIO_f_md.3 \
19 BIO_f_null.3 \
20 BIO_find_type.3 \
21 BIO_new.3 \
22 BIO_push.3 \
23 BIO_read.3 \
24 BIO_s_accept.3 \
25 BIO_s_bio.3 \
26 BIO_s_connect.3 \
27 BIO_s_fd.3 \
28 BIO_s_file.3 \
29 BIO_s_mem.3 \
30 BIO_s_null.3 \
31 BIO_s_socket.3 \
32 BIO_set_callback.3 \
33 BIO_should_retry.3 \
34 BN_BLINDING_new.3 \
35 BN_CTX_new.3 \
36 BN_CTX_start.3 \
37 BN_add.3 \
38 BN_add_word.3 \
39 BN_bn2bin.3 \
40 BN_cmp.3 \
41 BN_copy.3 \
42 BN_generate_prime.3 \
43 BN_mod_inverse.3 \
44 BN_mod_mul_montgomery.3 \
45 BN_mod_mul_reciprocal.3 \
46 BN_new.3 \
47 BN_num_bytes.3 \
48 BN_rand.3 \
49 BN_set_bit.3 \
50 BN_swap.3 \
51 BN_zero.3 \
52 CONF_modules_free.3 \
53 CONF_modules_load_file.3 \
54 CRYPTO_set_ex_data.3 \
55 DH_generate_key.3 \
56 DH_generate_parameters.3 \
57 DH_get_ex_new_index.3 \
58 DH_new.3 \
59 DH_set_method.3 \
60 DH_size.3 \
61 DSA_SIG_new.3 \
62 DSA_do_sign.3 \
63 DSA_dup_DH.3 \
64 DSA_generate_key.3 \
65 DSA_generate_parameters.3 \
66 DSA_get_ex_new_index.3 \
67 DSA_new.3 \
68 DSA_set_method.3 \
69 DSA_sign.3 \
70 DSA_size.3 \
71 ERR_GET_LIB.3 \
72 ERR_clear_error.3 \
73 ERR_error_string.3 \
74 ERR_get_error.3 \
75 ERR_load_crypto_strings.3 \
76 ERR_load_strings.3 \
77 ERR_print_errors.3 \
78 ERR_put_error.3 \
79 ERR_remove_state.3 \
80 ERR_set_mark.3 \
81 EVP_BytesToKey.3 \
82 EVP_DigestInit.3 \
83 EVP_DigestSignInit.3 \
84 EVP_DigestVerifyInit.3 \
85 EVP_EncryptInit.3 \
86 EVP_OpenInit.3 \
87 EVP_PKEY_new.3 \
88 EVP_PKEY_set1_RSA.3 \
89 EVP_SealInit.3 \
90 EVP_SignInit.3 \
91 EVP_VerifyInit.3 \
92 OBJ_nid2obj.3 \
93 OPENSSL_VERSION_NUMBER.3 \
94 OPENSSL_config.3 \
95 OPENSSL_load_builtin_modules.3 \
96 OpenSSL_add_all_algorithms.3 \
97 PKCS12_create.3 \
98 PKCS12_parse.3 \
99 PKCS7_decrypt.3 \
100 PKCS7_encrypt.3 \
101 PKCS7_sign.3 \
102 PKCS7_verify.3 \
103 RAND_add.3 \
104 RAND_bytes.3 \
105 RAND_cleanup.3 \
106 RAND_egd.3 \
107 RAND_load_file.3 \
108 RAND_set_rand_method.3 \
109 RSA_blinding_on.3 \
110 RSA_check_key.3 \
111 RSA_generate_key.3 \
112 RSA_get_ex_new_index.3 \
113 RSA_new.3 \
114 RSA_padding_add_PKCS1_type_1.3 \
115 RSA_print.3 \
116 RSA_private_encrypt.3 \
117 RSA_public_encrypt.3 \
118 RSA_set_method.3 \
119 RSA_sign.3 \
120 RSA_sign_ASN1_OCTET_STRING.3 \
121 RSA_size.3 \
122 SMIME_read_PKCS7.3 \
123 SMIME_write_PKCS7.3 \
124 X509_NAME_ENTRY_get_object.3 \
125 X509_NAME_add_entry_by_txt.3 \
126 X509_NAME_get_index_by_NID.3 \
127 X509_NAME_print_ex.3 \
128 X509_new.3 \
129 X509_STORE_CTX_get_error.3 \
130 X509_STORE_CTX_get_ex_new_index.3 \
131 X509_STORE_CTX_new.3 \
132 X509_STORE_CTX_set_verify_cb.3 \
133 X509_STORE_set_verify_cb_func.3 \
134 X509_VERIFY_PARAM_set_flags.3 \
135 X509_verify_cert.3 \
136 bn.3 \
137 bn_internal.3 \
138 crypto.3 \
139 d2i_ASN1_OBJECT.3 \
140 d2i_DHparams.3 \
141 d2i_DSAPublicKey.3 \
142 d2i_PKCS8PrivateKey.3 \
143 d2i_RSAPublicKey.3 \
144 d2i_X509.3 \
145 d2i_X509_ALGOR.3 \
146 d2i_X509_CRL.3 \
147 d2i_X509_NAME.3 \
148 d2i_X509_REQ.3 \
149 d2i_X509_SIG.3 \
150 dh.3 \
151 dsa.3 \
152 ecdsa.3 \
153 engine.3 \
154 evp.3 \
155 lh_stats.3 \
156 lhash.3 \
157 pem.3 \
158 rsa.3 \
159 ui.3 \
160 ui_compat.3 \
161 x509.3 \
162 BF_set_key.3 \
163 BIO.3 \
164 BUF_MEM_new.3 \
165 CRYPTO_set_locking_callback.3 \
166 DES_set_key.3 \
167 ERR.3 \
168 HMAC.3 \
169 MD5.3 \
170 PEM_read_bio_PrivateKey.3 \
171 RAND.3 \
172 RC4.3 \
173 RIPEMD160.3 \
174 SHA1.3
175
176# These pages removed/renamed
177# OPENSSL_ia32cap.cat3 \ # i386-only, internal API
178# OPENSSL_Applink.cat3 \ # Win32 only
179# bio.cat3 \ # conflict; see below
180# blowfish.cat3 \ # conflict; see below
181# buffer.cat3 \ # conflict; see below
182# des.cat3 \ # conflict; see below
183# des_modes.cat3 \ # fairly pointless
184# hmac.cat3 \ # conflict; see below
185# md5.cat3 \ # conflict; see below
186# mdc2.cat3 \ # patents; removed
187# rand.cat3 \ # conflict; see below
188# rc4.cat3 \ # conflict; see below
189# ripemd.cat3 \ # conflict; see below
190# sha.cat3 \ # conflict; see below
191
192
193# these are a real problem, since they re-document functions described in
194# other pages.
195
196.for page src in \
197 BF_set_key blowfish \
198 BIO bio \
199 BUF_MEM_new buffer \
200 CRYPTO_set_locking_callback threads \
201 DES_set_key des \
202 ERR err \
203 HMAC hmac \
204 MD5 md5 \
205 PEM_read_bio_PrivateKey pem \
206 RAND rand \
207 RC4 rc4 \
208 RIPEMD160 ripemd \
209 SHA1 sha
210
211${page}.3: ${src}.pod
212 @echo '${POD2MAN} --section=3 --name=${page:U} $? > $@'
213 @${POD2MAN} --section=3 --name=${page:U} $? > $@.tmp && mv $@.tmp $@
214.endfor
215
216MLINKS+=\
217 ASN1_OBJECT_new.3 ASN1_OBJECT_free.3 \
218 ASN1_STRING_length.3 ASN1_STRING_cmp.3 \
219 ASN1_STRING_length.3 ASN1_STRING_data.3 \
220 ASN1_STRING_length.3 ASN1_STRING_dup.3 \
221 ASN1_STRING_length.3 ASN1_STRING_set.3 \
222 ASN1_STRING_length.3 ASN1_STRING_to_UTF8.3 \
223 ASN1_STRING_length.3 ASN1_STRING_type.3 \
224 ASN1_STRING_new.3 ASN1_STRING_free.3 \
225 ASN1_STRING_new.3 ASN1_STRING_type_new.3 \
226 ASN1_STRING_print_ex.3 ASN1_STRING_print.3 \
227 ASN1_STRING_print_ex.3 ASN1_STRING_print_ex_fp.3 \
228 ASN1_generate_nconf.3 ASN1_generate_v3.3 \
229 BF_set_key.3 BF_cbc_encrypt.3 \
230 BF_set_key.3 BF_cfb64_encrypt.3 \
231 BF_set_key.3 BF_decrypt.3 \
232 BF_set_key.3 BF_ecb_encrypt.3 \
233 BF_set_key.3 BF_encrypt.3 \
234 BF_set_key.3 BF_ofb64_encrypt.3 \
235 BF_set_key.3 BF_options.3 \
236 BIO_ctrl.3 BIO_callback_ctrl.3 \
237 BIO_ctrl.3 BIO_ctrl_pending.3 \
238 BIO_ctrl.3 BIO_ctrl_wpending.3 \
239 BIO_ctrl.3 BIO_eof.3 \
240 BIO_ctrl.3 BIO_flush.3 \
241 BIO_ctrl.3 BIO_get_close.3 \
242 BIO_ctrl.3 BIO_get_info_callback.3 \
243 BIO_ctrl.3 BIO_int_ctrl.3 \
244 BIO_ctrl.3 BIO_pending.3 \
245 BIO_ctrl.3 BIO_ptr_ctrl.3 \
246 BIO_ctrl.3 BIO_reset.3 \
247 BIO_ctrl.3 BIO_seek.3 \
248 BIO_ctrl.3 BIO_set_close.3 \
249 BIO_ctrl.3 BIO_set_info_callback.3 \
250 BIO_ctrl.3 BIO_tell.3 \
251 BIO_f_buffer.3 BIO_get_buffer_num_lines.3 \
252 BIO_f_buffer.3 BIO_set_buffer_read_data.3 \
253 BIO_f_buffer.3 BIO_set_buffer_size.3 \
254 BIO_f_buffer.3 BIO_set_read_buffer_size.3 \
255 BIO_f_buffer.3 BIO_set_write_buffer_size.3 \
256 BIO_f_cipher.3 BIO_get_cipher_ctx.3 \
257 BIO_f_cipher.3 BIO_get_cipher_status.3 \
258 BIO_f_cipher.3 BIO_set_cipher.3 \
259 BIO_f_md.3 BIO_get_md.3 \
260 BIO_f_md.3 BIO_get_md_ctx.3 \
261 BIO_f_md.3 BIO_set_md.3 \
262 BIO_find_type.3 BIO_method_type.3 \
263 BIO_find_type.3 BIO_next.3 \
264 BIO_new.3 BIO_free.3 \
265 BIO_new.3 BIO_free_all.3 \
266 BIO_new.3 BIO_set.3 \
267 BIO_new.3 BIO_vfree.3 \
268 BIO_push.3 BIO_pop.3 \
269 BIO_read.3 BIO_gets.3 \
270 BIO_read.3 BIO_puts.3 \
271 BIO_read.3 BIO_write.3 \
272 BIO_s_accept.3 BIO_do_accept.3 \
273 BIO_s_accept.3 BIO_get_accept_port.3 \
274 BIO_s_accept.3 BIO_get_bind_mode.3 \
275 BIO_s_accept.3 BIO_set_accept_bios.3 \
276 BIO_s_accept.3 BIO_set_accept_port.3 \
277 BIO_s_accept.3 BIO_set_bind_mode.3 \
278 BIO_s_accept.3 BIO_set_nbio_accept.3 \
279 BIO_s_bio.3 BIO_ctrl_get_read_request.3 \
280 BIO_s_bio.3 BIO_ctrl_get_write_guarantee.3 \
281 BIO_s_bio.3 BIO_ctrl_reset_read_request.3 \
282 BIO_s_bio.3 BIO_destroy_bio_pair.3 \
283 BIO_s_bio.3 BIO_get_read_request.3 \
284 BIO_s_bio.3 BIO_get_write_buf_size.3 \
285 BIO_s_bio.3 BIO_get_write_guarantee.3 \
286 BIO_s_bio.3 BIO_make_bio_pair.3 \
287 BIO_s_bio.3 BIO_new_bio_pair.3 \
288 BIO_s_bio.3 BIO_set_write_buf_size.3 \
289 BIO_s_bio.3 BIO_shutdown_wr.3 \
290 BIO_s_connect.3 BIO_do_connect.3 \
291 BIO_s_connect.3 BIO_get_conn_hostname.3 \
292 BIO_s_connect.3 BIO_get_conn_int_port.3 \
293 BIO_s_connect.3 BIO_get_conn_ip.3 \
294 BIO_s_connect.3 BIO_get_conn_port.3 \
295 BIO_s_connect.3 BIO_set_conn_hostname.3 \
296 BIO_s_connect.3 BIO_set_conn_int_port.3 \
297 BIO_s_connect.3 BIO_set_conn_ip.3 \
298 BIO_s_connect.3 BIO_set_conn_port.3 \
299 BIO_s_connect.3 BIO_set_nbio.3 \
300 BIO_s_fd.3 BIO_get_fd.3 \
301 BIO_s_fd.3 BIO_new_fd.3 \
302 BIO_s_fd.3 BIO_set_fd.3 \
303 BIO_s_file.3 BIO_append_filename.3 \
304 BIO_s_file.3 BIO_get_fp.3 \
305 BIO_s_file.3 BIO_new_file.3 \
306 BIO_s_file.3 BIO_new_fp.3 \
307 BIO_s_file.3 BIO_read_filename.3 \
308 BIO_s_file.3 BIO_rw_filename.3 \
309 BIO_s_file.3 BIO_set_fp.3 \
310 BIO_s_file.3 BIO_write_filename.3 \
311 BIO_s_mem.3 BIO_get_mem_data.3 \
312 BIO_s_mem.3 BIO_get_mem_ptr.3 \
313 BIO_s_mem.3 BIO_new_mem_buf.3 \
314 BIO_s_mem.3 BIO_set_mem_buf.3 \
315 BIO_s_mem.3 BIO_set_mem_eof_return.3 \
316 BIO_s_socket.3 BIO_get_fd.3 \
317 BIO_s_socket.3 BIO_new_socket.3 \
318 BIO_s_socket.3 BIO_set_fd.3 \
319 BIO_set_callback.3 BIO_debug_callback.3 \
320 BIO_set_callback.3 BIO_get_callback.3 \
321 BIO_set_callback.3 BIO_get_callback_arg.3 \
322 BIO_set_callback.3 BIO_set_callback_arg.3 \
323 BIO_should_retry.3 BIO_get_retry_BIO.3 \
324 BIO_should_retry.3 BIO_get_retry_reason.3 \
325 BIO_should_retry.3 BIO_retry_type.3 \
326 BIO_should_retry.3 BIO_should_io_special.3 \
327 BIO_should_retry.3 BIO_should_read.3 \
328 BIO_should_retry.3 BIO_should_write.3 \
329 BN_BLINDING_new.3 BN_BLINDING_convert.3 \
330 BN_BLINDING_new.3 BN_BLINDING_convert_ex.3 \
331 BN_BLINDING_new.3 BN_BLINDING_create_param.3 \
332 BN_BLINDING_new.3 BN_BLINDING_free.3 \
333 BN_BLINDING_new.3 BN_BLINDING_get_thread_id.3 \
334 BN_BLINDING_new.3 BN_BLINDING_invert.3 \
335 BN_BLINDING_new.3 BN_BLINDING_invert_ex.3 \
336 BN_BLINDING_new.3 BN_BLINDING_get_flags.3 \
337 BN_BLINDING_new.3 BN_BLINDING_set_flags.3 \
338 BN_BLINDING_new.3 BN_BLINDING_set_thread_id.3 \
339 BN_BLINDING_new.3 BN_BLINDING_update.3 \
340 BN_CTX_new.3 BN_CTX_free.3 \
341 BN_CTX_new.3 BN_CTX_init.3 \
342 BN_CTX_start.3 BN_CTX_end.3 \
343 BN_CTX_start.3 BN_CTX_get.3 \
344 BN_add.3 BN_div.3 \
345 BN_add.3 BN_exp.3 \
346 BN_add.3 BN_gcd.3 \
347 BN_add.3 BN_mod.3 \
348 BN_add.3 BN_mod_exp.3 \
349 BN_add.3 BN_mod_mul.3 \
350 BN_add.3 BN_mul.3 \
351 BN_add.3 BN_sqr.3 \
352 BN_add.3 BN_sub.3 \
353 BN_add_word.3 BN_div_word.3 \
354 BN_add_word.3 BN_mod_word.3 \
355 BN_add_word.3 BN_mul_word.3 \
356 BN_add_word.3 BN_sub_word.3 \
357 BN_bn2bin.3 BN_bin2bn.3 \
358 BN_bn2bin.3 BN_bn2dec.3 \
359 BN_bn2bin.3 BN_bn2hex.3 \
360 BN_bn2bin.3 BN_bn2mpi.3 \
361 BN_bn2bin.3 BN_dec2bn.3 \
362 BN_bn2bin.3 BN_hex2bn.3 \
363 BN_bn2bin.3 BN_mpi2bn.3 \
364 BN_bn2bin.3 BN_print.3 \
365 BN_bn2bin.3 BN_print_fp.3 \
366 BN_cmp.3 BN_is_odd.3 \
367 BN_cmp.3 BN_is_one.3 \
368 BN_cmp.3 BN_is_word.3 \
369 BN_cmp.3 BN_is_zero.3 \
370 BN_cmp.3 BN_ucmp.3 \
371 BN_copy.3 BN_dup.3 \
372 BN_generate_prime.3 BN_is_prime.3 \
373 BN_generate_prime.3 BN_is_prime_fasttest.3 \
374 BN_mod_mul_montgomery.3 BN_MONT_CTX_copy.3 \
375 BN_mod_mul_montgomery.3 BN_MONT_CTX_free.3 \
376 BN_mod_mul_montgomery.3 BN_MONT_CTX_init.3 \
377 BN_mod_mul_montgomery.3 BN_MONT_CTX_new.3 \
378 BN_mod_mul_montgomery.3 BN_MONT_CTX_set.3 \
379 BN_mod_mul_montgomery.3 BN_from_montgomery.3 \
380 BN_mod_mul_montgomery.3 BN_to_montgomery.3 \
381 BN_mod_mul_reciprocal.3 BN_RECP_CTX_free.3 \
382 BN_mod_mul_reciprocal.3 BN_RECP_CTX_init.3 \
383 BN_mod_mul_reciprocal.3 BN_RECP_CTX_new.3 \
384 BN_mod_mul_reciprocal.3 BN_RECP_CTX_set.3 \
385 BN_mod_mul_reciprocal.3 BN_div_recp.3 \
386 BN_new.3 BN_clear.3 \
387 BN_new.3 BN_clear_free.3 \
388 BN_new.3 BN_free.3 \
389 BN_new.3 BN_init.3 \
390 BN_num_bytes.3 BN_num_bits.3 \
391 BN_num_bytes.3 BN_num_bits_word.3 \
392 BN_rand.3 BN_pseudo_rand.3 \
393 BN_rand.3 BN_rand_range.3 \
394 BN_set_bit.3 BN_clear_bit.3 \
395 BN_set_bit.3 BN_is_bit_set.3 \
396 BN_set_bit.3 BN_lshift.3 \
397 BN_set_bit.3 BN_lshift1.3 \
398 BN_set_bit.3 BN_mask_bits.3 \
399 BN_set_bit.3 BN_rshift.3 \
400 BN_set_bit.3 BN_rshift1.3 \
401 BN_zero.3 BN_get_word.3 \
402 BN_zero.3 BN_one.3 \
403 BN_zero.3 BN_set_word.3 \
404 BN_zero.3 BN_value_one.3 \
405 BUF_MEM_new.3 BUF_MEM_free.3 \
406 BUF_MEM_new.3 BUF_MEM_grow.3 \
407 BUF_MEM_new.3 BUF_strdup.3 \
408 CONF_modules_free.3 CONF_modules_finish.3 \
409 CONF_modules_free.3 CONF_modules_unload.3 \
410 CONF_modules_load_file.3 CONF_modules_load.3 \
411 CRYPTO_set_ex_data.3 CRYPTO_get_ex_data.3 \
412 CRYPTO_set_locking_callback.3 CRYPTO_add.3 \
413 CRYPTO_set_locking_callback.3 CRYPTO_add_lock.3 \
414 CRYPTO_set_locking_callback.3 CRYPTO_destroy_dynlockid.3 \
415 CRYPTO_set_locking_callback.3 CRYPTO_get_new_dynlockid.3 \
416 CRYPTO_set_locking_callback.3 CRYPTO_lock.3 \
417 CRYPTO_set_locking_callback.3 CRYPTO_num_locks.3 \
418 CRYPTO_set_locking_callback.3 CRYPTO_r_lock.3 \
419 CRYPTO_set_locking_callback.3 CRYPTO_r_unlock.3 \
420 CRYPTO_set_locking_callback.3 CRYPTO_set_dynlock_create_callback.3 \
421 CRYPTO_set_locking_callback.3 CRYPTO_set_dynlock_destroy_callback.3 \
422 CRYPTO_set_locking_callback.3 CRYPTO_set_dynlock_lock_callback.3 \
423 CRYPTO_set_locking_callback.3 CRYPTO_set_id_callback.3 \
424 CRYPTO_set_locking_callback.3 CRYPTO_w_lock.3 \
425 CRYPTO_set_locking_callback.3 CRYPTO_w_unlock.3 \
426 DH_generate_key.3 DH_compute_key.3 \
427 DH_generate_parameters.3 DH_check.3 \
428 DH_get_ex_new_index.3 DH_get_ex_data.3 \
429 DH_get_ex_new_index.3 DH_set_ex_data.3 \
430 DH_new.3 DH_free.3 \
431 DH_set_method.3 DH_OpenSSL.3 \
432 DH_set_method.3 DH_get_default_method.3 \
433 DH_set_method.3 DH_get_default_openssl_method.3 \
434 DH_set_method.3 DH_new_method.3 \
435 DH_set_method.3 DH_set_default_method.3 \
436 DH_set_method.3 DH_set_default_openssl_method.3 \
437 DSA_new.3 DSA_free.3 \
438 DSA_set_method.3 DSA_OpenSSL.3 \
439 DSA_set_method.3 DSA_get_default_method.3 \
440 DSA_set_method.3 DSA_get_default_openssl_method.3 \
441 DSA_set_method.3 DSA_new_method.3 \
442 DSA_set_method.3 DSA_set_default_method.3 \
443 DSA_set_method.3 DSA_set_default_openssl_method.3 \
444 DSA_sign.3 DSA_sign_setup.3 \
445 DSA_sign.3 DSA_verify.3 \
446 ERR_GET_LIB.3 ERR_GET_FUNC.3 \
447 ERR_GET_LIB.3 ERR_GET_REASON.3 \
448 ERR_error_string.3 ERR_error_string_n.3 \
449 ERR_error_string.3 ERR_func_error_string.3 \
450 ERR_error_string.3 ERR_lib_error_string.3 \
451 ERR_error_string.3 ERR_reason_error_string.3 \
452 ERR_get_error.3 ERR_get_error_line.3 \
453 ERR_get_error.3 ERR_get_error_line_data.3 \
454 ERR_get_error.3 ERR_peek_error.3 \
455 ERR_get_error.3 ERR_peek_error_line.3 \
456 ERR_get_error.3 ERR_peek_error_line_data.3 \
457 ERR_load_crypto_strings.3 ERR_free_strings.3 \
458 ERR_load_strings.3 ERR_PACK.3 \
459 ERR_load_strings.3 ERR_get_next_error_library.3 \
460 ERR_print_errors.3 ERR_print_errors_fp.3 \
461 ERR_put_error.3 ERR_add_error_data.3 \
462 ERR_set_mark.3 ERR_pop_to_mark.3 \
463 EVP_DigestInit.3 EVP_DigestFinal.3 \
464 EVP_DigestInit.3 EVP_DigestUpdate.3 \
465 EVP_DigestInit.3 EVP_MD_CTX_block_size.3 \
466 EVP_DigestInit.3 EVP_MD_CTX_copy.3 \
467 EVP_DigestInit.3 EVP_MD_CTX_md.3 \
468 EVP_DigestInit.3 EVP_MD_CTX_size.3 \
469 EVP_DigestInit.3 EVP_MD_CTX_type.3 \
470 EVP_DigestInit.3 EVP_MD_block_size.3 \
471 EVP_DigestInit.3 EVP_MD_pkey_type.3 \
472 EVP_DigestInit.3 EVP_MD_size.3 \
473 EVP_DigestInit.3 EVP_MD_type.3 \
474 EVP_DigestInit.3 EVP_dss.3 \
475 EVP_DigestInit.3 EVP_dss1.3 \
476 EVP_DigestInit.3 EVP_get_digestbyname.3 \
477 EVP_DigestInit.3 EVP_get_digestbynid.3 \
478 EVP_DigestInit.3 EVP_get_digestbyobj.3 \
479 EVP_DigestInit.3 EVP_md2.3 \
480 EVP_DigestInit.3 EVP_md5.3 \
481 EVP_DigestInit.3 EVP_md_null.3 \
482 EVP_DigestInit.3 EVP_mdc2.3 \
483 EVP_DigestInit.3 EVP_ripemd160.3 \
484 EVP_DigestInit.3 EVP_sha.3 \
485 EVP_DigestInit.3 EVP_sha1.3 \
486 EVP_DigestInit.3 OBJ_nid2sn.3 \
487 EVP_DigestInit.3 OBJ_obj2nid.3 \
488 EVP_DigestSignInit.3 EVP_DigestSignUpdate.3 \
489 EVP_DigestSignInit.3 EVP_DigestSignFinal.3 \
490 EVP_DigestVerifyInit.3 EVP_DigestVerifyUpdate.3 \
491 EVP_DigestVerifyInit.3 EVP_DigestVerifyFinal.3 \
492 EVP_EncryptInit.3 EVP_CIPHER_CTX_block_size.3 \
493 EVP_EncryptInit.3 EVP_CIPHER_CTX_cipher.3 \
494 EVP_EncryptInit.3 EVP_CIPHER_CTX_cleanup.3 \
495 EVP_EncryptInit.3 EVP_CIPHER_CTX_ctrl.3 \
496 EVP_EncryptInit.3 EVP_CIPHER_CTX_iv_length.3 \
497 EVP_EncryptInit.3 EVP_CIPHER_CTX_key_length.3 \
498 EVP_EncryptInit.3 EVP_CIPHER_CTX_nid.3 \
499 EVP_EncryptInit.3 EVP_CIPHER_CTX_set_key_length.3 \
500 EVP_EncryptInit.3 EVP_CIPHER_CTX_type.3 \
501 EVP_EncryptInit.3 EVP_CIPHER_asn1_to_param.3 \
502 EVP_EncryptInit.3 EVP_CIPHER_block_size.3 \
503 EVP_EncryptInit.3 EVP_CIPHER_iv_length.3 \
504 EVP_EncryptInit.3 EVP_CIPHER_key_length.3 \
505 EVP_EncryptInit.3 EVP_CIPHER_nid.3 \
506 EVP_EncryptInit.3 EVP_CIPHER_param_to_asn1.3 \
507 EVP_EncryptInit.3 EVP_CIPHER_type.3 \
508 EVP_EncryptInit.3 EVP_CipherFinal.3 \
509 EVP_EncryptInit.3 EVP_CipherInit.3 \
510 EVP_EncryptInit.3 EVP_CipherUpdate.3 \
511 EVP_EncryptInit.3 EVP_DecryptFinal.3 \
512 EVP_EncryptInit.3 EVP_DecryptInit.3 \
513 EVP_EncryptInit.3 EVP_DecryptUpdate.3 \
514 EVP_EncryptInit.3 EVP_EncryptFinal.3 \
515 EVP_EncryptInit.3 EVP_EncryptUpdate.3 \
516 EVP_EncryptInit.3 EVP_get_cipherbyname.3 \
517 EVP_EncryptInit.3 EVP_get_cipherbynid.3 \
518 EVP_EncryptInit.3 EVP_get_cipherbyobj.3 \
519 EVP_EncryptInit.3 OBJ_nid2sn.3 \
520 EVP_EncryptInit.3 OBJ_obj2nid.3 \
521 EVP_OpenInit.3 EVP_OpenFinal.3 \
522 EVP_OpenInit.3 EVP_OpenUpdate.3 \
523 EVP_PKEY_new.3 EVP_PKEY_free.3 \
524 EVP_PKEY_set1_RSA.3 EVP_PKEY_assign_DH.3 \
525 EVP_PKEY_set1_RSA.3 EVP_PKEY_assign_DSA.3 \
526 EVP_PKEY_set1_RSA.3 EVP_PKEY_assign_EC_KEY.3 \
527 EVP_PKEY_set1_RSA.3 EVP_PKEY_assign_RSA.3 \
528 EVP_PKEY_set1_RSA.3 EVP_PKEY_get1_DH.3 \
529 EVP_PKEY_set1_RSA.3 EVP_PKEY_get1_DSA.3 \
530 EVP_PKEY_set1_RSA.3 EVP_PKEY_get1_EC_KEY.3 \
531 EVP_PKEY_set1_RSA.3 EVP_PKEY_get1_RSA.3 \
532 EVP_PKEY_set1_RSA.3 EVP_PKEY_set1_DH.3 \
533 EVP_PKEY_set1_RSA.3 EVP_PKEY_set1_DSA.3 \
534 EVP_PKEY_set1_RSA.3 EVP_PKEY_set1_EC_KEY.3 \
535 EVP_PKEY_set1_RSA.3 EVP_PKEY_type.3 \
536 EVP_SealInit.3 EVP_SealFinal.3 \
537 EVP_SealInit.3 EVP_SealUpdate.3 \
538 EVP_SignInit.3 EVP_PKEY_size.3 \
539 EVP_SignInit.3 EVP_SignFinal.3 \
540 EVP_SignInit.3 EVP_SignUpdate.3 \
541 EVP_VerifyInit.3 EVP_VerifyFinal.3 \
542 EVP_VerifyInit.3 EVP_VerifyUpdate.3 \
543 HMAC.3 HMAC_Final.3 \
544 HMAC.3 HMAC_Init.3 \
545 HMAC.3 HMAC_Update.3 \
546 HMAC.3 HMAC_cleanup.3 \
547 MD5.3 MD2.3 \
548 MD5.3 MD2_Final.3 \
549 MD5.3 MD2_Init.3 \
550 MD5.3 MD2_Update.3 \
551 MD5.3 MD4.3 \
552 MD5.3 MD4_Final.3 \
553 MD5.3 MD4_Init.3 \
554 MD5.3 MD4_Update.3 \
555 MD5.3 MD5_Final.3 \
556 MD5.3 MD5_Init.3 \
557 MD5.3 MD5_Update.3 \
558 OBJ_nid2obj.3 OBJ_cleanup.3 \
559 OBJ_nid2obj.3 OBJ_cmp.3 \
560 OBJ_nid2obj.3 OBJ_create.3 \
561 OBJ_nid2obj.3 OBJ_dup.3 \
562 OBJ_nid2obj.3 OBJ_ln2nid.3 \
563 OBJ_nid2obj.3 OBJ_nid2ln.3 \
564 OBJ_nid2obj.3 OBJ_nid2sn.3 \
565 OBJ_nid2obj.3 OBJ_obj2nid.3 \
566 OBJ_nid2obj.3 OBJ_obj2txt.3 \
567 OBJ_nid2obj.3 OBJ_sn2nid.3 \
568 OBJ_nid2obj.3 OBJ_txt2nid.3 \
569 OBJ_nid2obj.3 OBJ_txt2obj.3 \
570 OPENSSL_VERSION_NUMBER.3 SSLeay.3 \
571 OPENSSL_VERSION_NUMBER.3 SSLeay_version.3 \
572 OPENSSL_config.3 OPENSSL_no_config.3 \
573 OPENSSL_load_builtin_modules.3 ASN1_add_oid_module.3 \
574 OPENSSL_load_builtin_modules.3 ENGINE_add_conf_module.3 \
575 OpenSSL_add_all_algorithms.3 EVP_cleanup.3 \
576 OpenSSL_add_all_algorithms.3 OpenSSL_add_all_ciphers.3 \
577 OpenSSL_add_all_algorithms.3 OpenSSL_add_all_digests.3 \
578 PEM_read_bio_PrivateKey.3 PEM_read_DHparams.3 \
579 PEM_read_bio_PrivateKey.3 PEM_read_DSAPrivateKey.3 \
580 PEM_read_bio_PrivateKey.3 PEM_read_DSA_PUBKEY.3 \
581 PEM_read_bio_PrivateKey.3 PEM_read_DSAparams.3 \
582 PEM_read_bio_PrivateKey.3 PEM_read_NETSCAPE_CERT_SEQUENCE.3 \
583 PEM_read_bio_PrivateKey.3 PEM_read_PKCS7.3 \
584 PEM_read_bio_PrivateKey.3 PEM_read_PUBKEY.3 \
585 PEM_read_bio_PrivateKey.3 PEM_read_PrivateKey.3 \
586 PEM_read_bio_PrivateKey.3 PEM_read_RSAPrivateKey.3 \
587 PEM_read_bio_PrivateKey.3 PEM_read_RSAPublicKey.3 \
588 PEM_read_bio_PrivateKey.3 PEM_read_RSA_PUBKEY.3 \
589 PEM_read_bio_PrivateKey.3 PEM_read_X509.3 \
590 PEM_read_bio_PrivateKey.3 PEM_read_X509_AUX.3 \
591 PEM_read_bio_PrivateKey.3 PEM_read_X509_CRL.3 \
592 PEM_read_bio_PrivateKey.3 PEM_read_X509_REQ.3 \
593 PEM_read_bio_PrivateKey.3 PEM_read_bio_DHparams.3 \
594 PEM_read_bio_PrivateKey.3 PEM_read_bio_DSAPrivateKey.3 \
595 PEM_read_bio_PrivateKey.3 PEM_read_bio_DSA_PUBKEY.3 \
596 PEM_read_bio_PrivateKey.3 PEM_read_bio_DSAparams.3 \
597 PEM_read_bio_PrivateKey.3 PEM_read_bio_NETSCAPE_CERT_SEQUENCE.3 \
598 PEM_read_bio_PrivateKey.3 PEM_read_bio_PKCS7.3 \
599 PEM_read_bio_PrivateKey.3 PEM_read_bio_PUBKEY.3 \
600 PEM_read_bio_PrivateKey.3 PEM_read_bio_RSAPrivateKey.3 \
601 PEM_read_bio_PrivateKey.3 PEM_read_bio_RSAPublicKey.3 \
602 PEM_read_bio_PrivateKey.3 PEM_read_bio_RSA_PUBKEY.3 \
603 PEM_read_bio_PrivateKey.3 PEM_read_bio_X509.3 \
604 PEM_read_bio_PrivateKey.3 PEM_read_bio_X509_AUX.3 \
605 PEM_read_bio_PrivateKey.3 PEM_read_bio_X509_CRL.3 \
606 PEM_read_bio_PrivateKey.3 PEM_read_bio_X509_REQ.3 \
607 PEM_read_bio_PrivateKey.3 PEM_write_DHparams.3 \
608 PEM_read_bio_PrivateKey.3 PEM_write_DSAPrivateKey.3 \
609 PEM_read_bio_PrivateKey.3 PEM_write_DSA_PUBKEY.3 \
610 PEM_read_bio_PrivateKey.3 PEM_write_DSAparams.3 \
611 PEM_read_bio_PrivateKey.3 PEM_write_NETSCAPE_CERT_SEQUENCE.3 \
612 PEM_read_bio_PrivateKey.3 PEM_write_PKCS7.3 \
613 PEM_read_bio_PrivateKey.3 PEM_write_PKCS8PrivateKey.3 \
614 PEM_read_bio_PrivateKey.3 PEM_write_PKCS8PrivateKey_nid.3 \
615 PEM_read_bio_PrivateKey.3 PEM_write_PUBKEY.3 \
616 PEM_read_bio_PrivateKey.3 PEM_write_PrivateKey.3 \
617 PEM_read_bio_PrivateKey.3 PEM_write_RSAPrivateKey.3 \
618 PEM_read_bio_PrivateKey.3 PEM_write_RSAPublicKey.3 \
619 PEM_read_bio_PrivateKey.3 PEM_write_RSA_PUBKEY.3 \
620 PEM_read_bio_PrivateKey.3 PEM_write_X509.3 \
621 PEM_read_bio_PrivateKey.3 PEM_write_X509_AUX.3 \
622 PEM_read_bio_PrivateKey.3 PEM_write_X509_CRL.3 \
623 PEM_read_bio_PrivateKey.3 PEM_write_X509_REQ.3 \
624 PEM_read_bio_PrivateKey.3 PEM_write_X509_REQ_NEW.3 \
625 PEM_read_bio_PrivateKey.3 PEM_write_bio_DHparams.3 \
626 PEM_read_bio_PrivateKey.3 PEM_write_bio_DSAPrivateKey.3 \
627 PEM_read_bio_PrivateKey.3 PEM_write_bio_DSA_PUBKEY.3 \
628 PEM_read_bio_PrivateKey.3 PEM_write_bio_DSAparams.3 \
629 PEM_read_bio_PrivateKey.3 PEM_write_bio_NETSCAPE_CERT_SEQUENCE.3 \
630 PEM_read_bio_PrivateKey.3 PEM_write_bio_PKCS7.3 \
631 PEM_read_bio_PrivateKey.3 PEM_write_bio_PKCS8PrivateKey.3 \
632 PEM_read_bio_PrivateKey.3 PEM_write_bio_PKCS8PrivateKey_nid.3 \
633 PEM_read_bio_PrivateKey.3 PEM_write_bio_PUBKEY.3 \
634 PEM_read_bio_PrivateKey.3 PEM_write_bio_PrivateKey.3 \
635 PEM_read_bio_PrivateKey.3 PEM_write_bio_RSAPrivateKey.3 \
636 PEM_read_bio_PrivateKey.3 PEM_write_bio_RSAPublicKey.3 \
637 PEM_read_bio_PrivateKey.3 PEM_write_bio_RSA_PUBKEY.3 \
638 PEM_read_bio_PrivateKey.3 PEM_write_bio_X509.3 \
639 PEM_read_bio_PrivateKey.3 PEM_write_bio_X509_AUX.3 \
640 PEM_read_bio_PrivateKey.3 PEM_write_bio_X509_CRL.3 \
641 PEM_read_bio_PrivateKey.3 PEM_write_bio_X509_REQ.3 \
642 PEM_read_bio_PrivateKey.3 PEM_write_bio_X509_REQ_NEW.3 \
643 RAND_add.3 RAND_event.3 \
644 RAND_add.3 RAND_screen.3 \
645 RAND_add.3 RAND_seed.3 \
646 RAND_add.3 RAND_status.3 \
647 RAND_bytes.3 RAND_pseudo_bytes.3 \
648 RAND_egd.3 RAND_egd_bytes.3 \
649 RAND_load_file.3 RAND_file_name.3 \
650 RAND_load_file.3 RAND_write_file.3 \
651 RAND_set_rand_method.3 RAND_SSLeay.3 \
652 RAND_set_rand_method.3 RAND_get_rand_method.3 \
653 RC4.3 RC4_set_key.3 \
654 RIPEMD160.3 RIPEMD160_Final.3 \
655 RIPEMD160.3 RIPEMD160_Init.3 \
656 RIPEMD160.3 RIPEMD160_Update.3 \
657 RSA_blinding_on.3 RSA_blinding_off.3 \
658 RSA_get_ex_new_index.3 RSA_get_ex_data.3 \
659 RSA_get_ex_new_index.3 RSA_set_ex_data.3 \
660 RSA_new.3 RSA_free.3 \
661 RSA_padding_add_PKCS1_type_1.3 RSA_padding_add_PKCS1_OAEP.3 \
662 RSA_padding_add_PKCS1_type_1.3 RSA_padding_add_PKCS1_type_2.3 \
663 RSA_padding_add_PKCS1_type_1.3 RSA_padding_add_SSLv23.3 \
664 RSA_padding_add_PKCS1_type_1.3 RSA_padding_add_none.3 \
665 RSA_padding_add_PKCS1_type_1.3 RSA_padding_check_PKCS1_OAEP.3 \
666 RSA_padding_add_PKCS1_type_1.3 RSA_padding_check_PKCS1_type_1.3 \
667 RSA_padding_add_PKCS1_type_1.3 RSA_padding_check_PKCS1_type_2.3 \
668 RSA_padding_add_PKCS1_type_1.3 RSA_padding_check_SSLv23.3 \
669 RSA_padding_add_PKCS1_type_1.3 RSA_padding_check_none.3 \
670 RSA_print.3 DHparams_print.3 \
671 RSA_print.3 DHparams_print_fp.3 \
672 RSA_print.3 DSA_print.3 \
673 RSA_print.3 DSA_print_fp.3 \
674 RSA_print.3 DSAparams_print.3 \
675 RSA_print.3 DSAparams_print_fp.3 \
676 RSA_print.3 RSA_print_fp.3 \
677 RSA_private_encrypt.3 RSA_public_decrypt.3 \
678 RSA_public_encrypt.3 RSA_private_decrypt.3 \
679 RSA_set_method.3 RSA_PKCS1_RSAref.3 \
680 RSA_set_method.3 RSA_PKCS1_SSLeay.3 \
681 RSA_set_method.3 RSA_flags.3 \
682 RSA_set_method.3 RSA_get_default_method.3 \
683 RSA_set_method.3 RSA_get_default_openssl_method.3 \
684 RSA_set_method.3 RSA_get_method.3 \
685 RSA_set_method.3 RSA_new_method.3 \
686 RSA_set_method.3 RSA_null_method.3 \
687 RSA_set_method.3 RSA_set_default_method.3 \
688 RSA_set_method.3 RSA_set_default_openssl_method.3 \
689 RSA_sign.3 RSA_verify.3 \
690 RSA_sign_ASN1_OCTET_STRING.3 RSA_verify_ASN1_OCTET_STRING.3 \
691 SHA1.3 SHA1_Final.3 \
692 SHA1.3 SHA1_Init.3 \
693 SHA1.3 SHA1_Update.3 \
694 X509_NAME_ENTRY_get_object.3 X509_NAME_ENTRY_create_by_NID.3 \
695 X509_NAME_ENTRY_get_object.3 X509_NAME_ENTRY_create_by_OBJ.3 \
696 X509_NAME_ENTRY_get_object.3 X509_NAME_ENTRY_create_by_txt.3 \
697 X509_NAME_ENTRY_get_object.3 X509_NAME_ENTRY_get_data.3 \
698 X509_NAME_ENTRY_get_object.3 X509_NAME_ENTRY_set_data.3 \
699 X509_NAME_ENTRY_get_object.3 X509_NAME_ENTRY_set_object.3 \
700 X509_NAME_add_entry_by_txt.3 X509_NAME_add_entry.3 \
701 X509_NAME_add_entry_by_txt.3 X509_NAME_add_entry_by_NID.3 \
702 X509_NAME_add_entry_by_txt.3 X509_NAME_add_entry_by_OBJ.3 \
703 X509_NAME_add_entry_by_txt.3 X509_NAME_delete_entry.3 \
704 X509_new.3 X509_free.3 \
705 X509_STORE_CTX_get_error.3 X509_STORE_CTX_get1_chain.3 \
706 X509_STORE_CTX_get_error.3 X509_STORE_CTX_get_current_cert.3 \
707 X509_STORE_CTX_get_error.3 X509_STORE_CTX_get_error_depth.3 \
708 X509_STORE_CTX_get_error.3 X509_STORE_CTX_set_error.3 \
709 X509_STORE_CTX_get_error.3 X509_verify_cert_error_string.3 \
710 X509_STORE_CTX_get_ex_new_index.3 X509_STORE_CTX_get_ex_data.3 \
711 X509_STORE_CTX_get_ex_new_index.3 X509_STORE_CTX_set_ex_data.3 \
712 X509_STORE_CTX_new.3 X509_STORE_CTX_cleanup.3 \
713 X509_STORE_CTX_new.3 X509_STORE_CTX_free.3 \
714 X509_STORE_CTX_new.3 X509_STORE_CTX_get0_param.3 \
715 X509_STORE_CTX_new.3 X509_STORE_CTX_init.3 \
716 X509_STORE_CTX_new.3 X509_STORE_CTX_set0_crls.3 \
717 X509_STORE_CTX_new.3 X509_STORE_CTX_set0_param.3 \
718 X509_STORE_CTX_new.3 X509_STORE_CTX_set_cert.3 \
719 X509_STORE_CTX_new.3 X509_STORE_CTX_set_chain.3 \
720 X509_STORE_CTX_new.3 X509_STORE_CTX_set_default.3 \
721 X509_STORE_CTX_new.3 X509_STORE_CTX_trusted_stack.3 \
722 X509_STORE_set_verify_cb_func.3 X509_STORE_set_verify_cb.3 \
723 X509_VERIFY_PARAM_set_flags.3 X509_VERIFY_PARAM_add0_policy.3 \
724 X509_VERIFY_PARAM_set_flags.3 X509_VERIFY_PARAM_clear_flags.3 \
725 X509_VERIFY_PARAM_set_flags.3 X509_VERIFY_PARAM_get_depth.3 \
726 X509_VERIFY_PARAM_set_flags.3 X509_VERIFY_PARAM_get_flags.3 \
727 X509_VERIFY_PARAM_set_flags.3 X509_VERIFY_PARAM_set1_policies.3 \
728 X509_VERIFY_PARAM_set_flags.3 X509_VERIFY_PARAM_set_depth.3 \
729 X509_VERIFY_PARAM_set_flags.3 X509_VERIFY_PARAM_set_purpose.3 \
730 X509_VERIFY_PARAM_set_flags.3 X509_VERIFY_PARAM_set_time.3 \
731 X509_VERIFY_PARAM_set_flags.3 X509_VERIFY_PARAM_set_trust.3 \
732 bn_internal.3 bn_add_words.3 \
733 bn_internal.3 bn_check_top.3 \
734 bn_internal.3 bn_cmp_words.3 \
735 bn_internal.3 bn_div_words.3 \
736 bn_internal.3 bn_dump.3 \
737 bn_internal.3 bn_expand.3 \
738 bn_internal.3 bn_expand2.3 \
739 bn_internal.3 bn_fix_top.3 \
740 bn_internal.3 bn_mul_add_words.3 \
741 bn_internal.3 bn_mul_comba4.3 \
742 bn_internal.3 bn_mul_comba8.3 \
743 bn_internal.3 bn_mul_high.3 \
744 bn_internal.3 bn_mul_low_normal.3 \
745 bn_internal.3 bn_mul_low_recursive.3 \
746 bn_internal.3 bn_mul_normal.3 \
747 bn_internal.3 bn_mul_part_recursive.3 \
748 bn_internal.3 bn_mul_recursive.3 \
749 bn_internal.3 bn_mul_words.3 \
750 bn_internal.3 bn_print.3 \
751 bn_internal.3 bn_set_high.3 \
752 bn_internal.3 bn_set_low.3 \
753 bn_internal.3 bn_set_max.3 \
754 bn_internal.3 bn_sqr_comba4.3 \
755 bn_internal.3 bn_sqr_comba8.3 \
756 bn_internal.3 bn_sqr_normal.3 \
757 bn_internal.3 bn_sqr_recursive.3 \
758 bn_internal.3 bn_sqr_words.3 \
759 bn_internal.3 bn_sub_words.3 \
760 bn_internal.3 bn_wexpand.3 \
761 bn_internal.3 mul.3 \
762 bn_internal.3 mul_add.3 \
763 bn_internal.3 sqr.3 \
764 d2i_ASN1_OBJECT.3 i2d_ASN1_OBJECT.3 \
765 d2i_DHparams.3 i2d_DHparams.3 \
766 d2i_DSAPublicKey.3 d2i_DSAPrivateKey.3 \
767 d2i_DSAPublicKey.3 d2i_DSA_PUBKEY.3 \
768 d2i_DSAPublicKey.3 d2i_DSA_SIG.3 \
769 d2i_DSAPublicKey.3 d2i_DSAparams.3 \
770 d2i_DSAPublicKey.3 i2d_DSAPrivateKey.3 \
771 d2i_DSAPublicKey.3 i2d_DSAPublicKey.3 \
772 d2i_DSAPublicKey.3 i2d_DSA_PUBKEY.3 \
773 d2i_DSAPublicKey.3 i2d_DSA_SIG.3 \
774 d2i_DSAPublicKey.3 i2d_DSAparams.3 \
775 d2i_PKCS8PrivateKey.3 d2i_PKCS8PrivateKey_bio.3 \
776 d2i_PKCS8PrivateKey.3 d2i_PKCS8PrivateKey_fp.3 \
777 d2i_PKCS8PrivateKey.3 i2d_PKCS8PrivateKey_bio.3 \
778 d2i_PKCS8PrivateKey.3 i2d_PKCS8PrivateKey_fp.3 \
779 d2i_PKCS8PrivateKey.3 i2d_PKCS8PrivateKey_nid_bio.3 \
780 d2i_PKCS8PrivateKey.3 i2d_PKCS8PrivateKey_nid_fp.3 \
781 d2i_RSAPublicKey.3 d2i_Netscape_RSA.3 \
782 d2i_RSAPublicKey.3 d2i_RSAPrivateKey.3 \
783 d2i_RSAPublicKey.3 i2d_Netscape_RSA.3 \
784 d2i_RSAPublicKey.3 i2d_RSAPrivateKey.3 \
785 d2i_RSAPublicKey.3 i2d_RSAPublicKey.3 \
786 d2i_X509.3 d2i_X509_bio.3 \
787 d2i_X509.3 d2i_X509_fp.3 \
788 d2i_X509.3 i2d_X509.3 \
789 d2i_X509.3 i2d_X509_bio.3 \
790 d2i_X509.3 i2d_X509_fp.3 \
791 d2i_X509_ALGOR.3 i2d_X509_ALGOR.3 \
792 d2i_X509_CRL.3 d2i_X509_CRL_bio.3 \
793 d2i_X509_CRL.3 d2i_X509_CRL_fp.3 \
794 d2i_X509_CRL.3 i2d_X509_CRL.3 \
795 d2i_X509_CRL.3 i2d_X509_CRL_bio.3 \
796 d2i_X509_CRL.3 i2d_X509_CRL_fp.3 \
797 d2i_X509_NAME.3 i2d_X509_NAME.3 \
798 d2i_X509_REQ.3 d2i_X509_REQ_bio.3 \
799 d2i_X509_REQ.3 d2i_X509_REQ_fp.3 \
800 d2i_X509_REQ.3 i2d_X509_REQ.3 \
801 d2i_X509_REQ.3 i2d_X509_REQ_bio.3 \
802 d2i_X509_REQ.3 i2d_X509_REQ_fp.3 \
803 dsa.3 DSA_OpenSSL.3 \
804 dsa.3 DSA_SIG_free.3 \
805 dsa.3 DSA_do_verify.3 \
806 dsa.3 DSA_free.3 \
807 dsa.3 DSA_get_default_method.3 \
808 dsa.3 DSA_get_ex_data.3 \
809 dsa.3 DSA_new_method.3 \
810 dsa.3 DSA_set_default_method.3 \
811 dsa.3 DSA_set_ex_data.3 \
812 dsa.3 DSA_sign_setup.3 \
813 dsa.3 DSA_verify.3 \
814 ecdsa.3 ECDSA_OpenSSL.3 \
815 ecdsa.3 ECDSA_SIG_free.3 \
816 ecdsa.3 ECDSA_SIG_new.3 \
817 ecdsa.3 ECDSA_do_sign.3 \
818 ecdsa.3 ECDSA_do_sign_ex.3 \
819 ecdsa.3 ECDSA_do_verify.3 \
820 ecdsa.3 ECDSA_get_default_method.3 \
821 ecdsa.3 ECDSA_get_ex_data.3 \
822 ecdsa.3 ECDSA_get_ex_new_index.3 \
823 ecdsa.3 ECDSA_set_default_method.3 \
824 ecdsa.3 ECDSA_set_ex_data.3 \
825 ecdsa.3 ECDSA_set_method.3 \
826 ecdsa.3 ECDSA_sign.3 \
827 ecdsa.3 ECDSA_sign_ex.3 \
828 ecdsa.3 ECDSA_sign_setup.3 \
829 ecdsa.3 ECDSA_verify.3 \
830 ecdsa.3 d2i_ECDSA_SIG.3 \
831 ecdsa.3 i2d_ECDSA_SIG.3 \
832 engine.3 ENGINE_add.3 \
833 engine.3 ENGINE_by_id.3 \
834 engine.3 ENGINE_finish.3 \
835 engine.3 ENGINE_get_first.3 \
836 engine.3 ENGINE_get_last.3 \
837 engine.3 ENGINE_get_next.3 \
838 engine.3 ENGINE_get_prev.3 \
839 engine.3 ENGINE_init.3 \
840 engine.3 ENGINE_load_builtin_engines.3 \
841 engine.3 ENGINE_remove.3 \
842 lh_stats.3 lh_node_stats.3 \
843 lh_stats.3 lh_node_stats_bio.3 \
844 lh_stats.3 lh_node_usage_stats.3 \
845 lh_stats.3 lh_node_usage_stats_bio.3 \
846 lh_stats.3 lh_stats_bio.3 \
847 lhash.3 lh_delete.3 \
848 lhash.3 lh_doall.3 \
849 lhash.3 lh_doall_arg.3 \
850 lhash.3 lh_error.3 \
851 lhash.3 lh_free.3 \
852 lhash.3 lh_insert.3 \
853 lhash.3 lh_new.3 \
854 lhash.3 lh_retrieve.3 \
855 ui.3 UI_OpenSSL.3 \
856 ui.3 UI_add_error_string.3 \
857 ui.3 UI_add_info_string.3 \
858 ui.3 UI_add_input_boolean.3 \
859 ui.3 UI_add_input_string.3 \
860 ui.3 UI_add_user_data.3 \
861 ui.3 UI_add_verify_string.3 \
862 ui.3 UI_construct_prompt.3 \
863 ui.3 UI_ctrl.3 \
864 ui.3 UI_dup_error_string.3 \
865 ui.3 UI_dup_info_string.3 \
866 ui.3 UI_dup_input_boolean.3 \
867 ui.3 UI_dup_input_string.3 \
868 ui.3 UI_dup_verify_string.3 \
869 ui.3 UI_free.3 \
870 ui.3 UI_get0_result.3 \
871 ui.3 UI_get0_user_data.3 \
872 ui.3 UI_get_default_method.3 \
873 ui.3 UI_get_method.3 \
874 ui.3 UI_new.3 \
875 ui.3 UI_new_method.3 \
876 ui.3 UI_process.3 \
877 ui.3 UI_set_default_method.3 \
878 ui.3 UI_set_method.3 \
879 ui_compat.3 des_read_2passwords.3 \
880 ui_compat.3 des_read_password.3 \
881 ui_compat.3 des_read_pw.3 \
882 ui_compat.3 des_read_pw_string.3
883
884.include <bsd.man.mk>
885.else
886maninstall:
887
888.endif
889
890# XXX .PATH order is critical because of non-unique filenames
891.PATH: ${.CURDIR}/../../libssl/src/doc/crypto
892.SUFFIXES: .pod .1 .3 .7
893.for sect in 1 3 7
894.pod.${sect}:
895 @echo '${POD2MAN} --section=${sect} --name=${*:U} $< > $@'
896 @${POD2MAN} --section=${sect} --name=${*:U} $< > $@.tmp && mv $@.tmp $@
897.endfor
898
899.include <bsd.obj.mk>
900.include <bsd.subdir.mk>
901
902clean cleandir:
903 rm -f ${MAN} ${MANLINT}
diff --git a/src/lib/libcrypto/md2/Makefile b/src/lib/libcrypto/md2/Makefile
new file mode 100644
index 0000000000..17f878aeb7
--- /dev/null
+++ b/src/lib/libcrypto/md2/Makefile
@@ -0,0 +1,89 @@
1#
2# OpenSSL/crypto/md/Makefile
3#
4
5DIR= md2
6TOP= ../..
7CC= cc
8INCLUDES=
9CFLAG=-g
10MAKEFILE= Makefile
11AR= ar r
12
13CFLAGS= $(INCLUDES) $(CFLAG)
14
15GENERAL=Makefile
16TEST=md2test.c
17APPS=
18
19LIB=$(TOP)/libcrypto.a
20LIBSRC=md2_dgst.c md2_one.c
21LIBOBJ=md2_dgst.o md2_one.o
22
23SRC= $(LIBSRC)
24
25EXHEADER= md2.h
26HEADER= $(EXHEADER)
27
28ALL= $(GENERAL) $(SRC) $(HEADER)
29
30top:
31 (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all)
32
33all: lib
34
35lib: $(LIBOBJ)
36 $(AR) $(LIB) $(LIBOBJ)
37 $(RANLIB) $(LIB) || echo Never mind.
38 @touch lib
39
40files:
41 $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
42
43links:
44 @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
45 @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
46 @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
47
48install:
49 @[ -n "$(INSTALLTOP)" ] # should be set by top Makefile...
50 @headerlist="$(EXHEADER)"; for i in $$headerlist ; \
51 do \
52 (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
53 chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
54 done;
55
56tags:
57 ctags $(SRC)
58
59tests:
60
61lint:
62 lint -DLINT $(INCLUDES) $(SRC)>fluff
63
64depend:
65 @[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile...
66 $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
67
68dclean:
69 $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
70 mv -f Makefile.new $(MAKEFILE)
71
72clean:
73 rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
74
75# DO NOT DELETE THIS LINE -- make depend depends on it.
76
77md2_dgst.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
78md2_dgst.o: ../../include/openssl/md2.h ../../include/openssl/opensslconf.h
79md2_dgst.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
80md2_dgst.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
81md2_dgst.o: ../../include/openssl/symhacks.h md2_dgst.c
82md2_one.o: ../../e_os.h ../../include/openssl/bio.h
83md2_one.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
84md2_one.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
85md2_one.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
86md2_one.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
87md2_one.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
88md2_one.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
89md2_one.o: ../cryptlib.h md2_one.c
diff --git a/src/lib/libcrypto/md2/md2.c b/src/lib/libcrypto/md2/md2.c
new file mode 100644
index 0000000000..f4d6f62264
--- /dev/null
+++ b/src/lib/libcrypto/md2/md2.c
@@ -0,0 +1,124 @@
1/* crypto/md2/md2.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
59#include <stdio.h>
60#include <stdlib.h>
61#include <openssl/md2.h>
62
63#define BUFSIZE 1024*16
64
65void do_fp(FILE *f);
66void pt(unsigned char *md);
67int read(int, void *, unsigned int);
68void exit(int);
69int main(int argc, char *argv[])
70 {
71 int i,err=0;
72 FILE *IN;
73
74 if (argc == 1)
75 {
76 do_fp(stdin);
77 }
78 else
79 {
80 for (i=1; i<argc; i++)
81 {
82 IN=fopen(argv[i],"r");
83 if (IN == NULL)
84 {
85 perror(argv[i]);
86 err++;
87 continue;
88 }
89 printf("MD2(%s)= ",argv[i]);
90 do_fp(IN);
91 fclose(IN);
92 }
93 }
94 exit(err);
95 return(err);
96 }
97
98void do_fp(FILE *f)
99 {
100 MD2_CTX c;
101 unsigned char md[MD2_DIGEST_LENGTH];
102 int fd,i;
103 static unsigned char buf[BUFSIZE];
104
105 fd=fileno(f);
106 MD2_Init(&c);
107 for (;;)
108 {
109 i=read(fd,buf,BUFSIZE);
110 if (i <= 0) break;
111 MD2_Update(&c,buf,(unsigned long)i);
112 }
113 MD2_Final(&(md[0]),&c);
114 pt(md);
115 }
116
117void pt(unsigned char *md)
118 {
119 int i;
120
121 for (i=0; i<MD2_DIGEST_LENGTH; i++)
122 printf("%02x",md[i]);
123 printf("\n");
124 }
diff --git a/src/lib/libcrypto/md2/md2.h b/src/lib/libcrypto/md2/md2.h
new file mode 100644
index 0000000000..d59c9f2593
--- /dev/null
+++ b/src/lib/libcrypto/md2/md2.h
@@ -0,0 +1,95 @@
1/* crypto/md/md2.h */
2/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
59#ifndef HEADER_MD2_H
60#define HEADER_MD2_H
61
62#include <openssl/opensslconf.h> /* OPENSSL_NO_MD2, MD2_INT */
63#ifdef OPENSSL_NO_MD2
64#error MD2 is disabled.
65#endif
66#include <stddef.h>
67
68#define MD2_DIGEST_LENGTH 16
69#define MD2_BLOCK 16
70
71#ifdef __cplusplus
72extern "C" {
73#endif
74
75typedef struct MD2state_st
76 {
77 unsigned int num;
78 unsigned char data[MD2_BLOCK];
79 MD2_INT cksm[MD2_BLOCK];
80 MD2_INT state[MD2_BLOCK];
81 } MD2_CTX;
82
83const char *MD2_options(void);
84#ifdef OPENSSL_FIPS
85int private_MD2_Init(MD2_CTX *c);
86#endif
87int MD2_Init(MD2_CTX *c);
88int MD2_Update(MD2_CTX *c, const unsigned char *data, size_t len);
89int MD2_Final(unsigned char *md, MD2_CTX *c);
90unsigned char *MD2(const unsigned char *d, size_t n,unsigned char *md);
91#ifdef __cplusplus
92}
93#endif
94
95#endif
diff --git a/src/lib/libcrypto/md2/md2_dgst.c b/src/lib/libcrypto/md2/md2_dgst.c
new file mode 100644
index 0000000000..bf89def73e
--- /dev/null
+++ b/src/lib/libcrypto/md2/md2_dgst.c
@@ -0,0 +1,227 @@
1/* crypto/md2/md2_dgst.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
59#include <stdio.h>
60#include <stdlib.h>
61#include <string.h>
62#include <openssl/md2.h>
63#include <openssl/opensslv.h>
64#include <openssl/crypto.h>
65
66const char MD2_version[]="MD2" OPENSSL_VERSION_PTEXT;
67
68/* Implemented from RFC1319 The MD2 Message-Digest Algorithm
69 */
70
71#define UCHAR unsigned char
72
73static void md2_block(MD2_CTX *c, const unsigned char *d);
74/* The magic S table - I have converted it to hex since it is
75 * basically just a random byte string. */
76static const MD2_INT S[256]={
77 0x29, 0x2E, 0x43, 0xC9, 0xA2, 0xD8, 0x7C, 0x01,
78 0x3D, 0x36, 0x54, 0xA1, 0xEC, 0xF0, 0x06, 0x13,
79 0x62, 0xA7, 0x05, 0xF3, 0xC0, 0xC7, 0x73, 0x8C,
80 0x98, 0x93, 0x2B, 0xD9, 0xBC, 0x4C, 0x82, 0xCA,
81 0x1E, 0x9B, 0x57, 0x3C, 0xFD, 0xD4, 0xE0, 0x16,
82 0x67, 0x42, 0x6F, 0x18, 0x8A, 0x17, 0xE5, 0x12,
83 0xBE, 0x4E, 0xC4, 0xD6, 0xDA, 0x9E, 0xDE, 0x49,
84 0xA0, 0xFB, 0xF5, 0x8E, 0xBB, 0x2F, 0xEE, 0x7A,
85 0xA9, 0x68, 0x79, 0x91, 0x15, 0xB2, 0x07, 0x3F,
86 0x94, 0xC2, 0x10, 0x89, 0x0B, 0x22, 0x5F, 0x21,
87 0x80, 0x7F, 0x5D, 0x9A, 0x5A, 0x90, 0x32, 0x27,
88 0x35, 0x3E, 0xCC, 0xE7, 0xBF, 0xF7, 0x97, 0x03,
89 0xFF, 0x19, 0x30, 0xB3, 0x48, 0xA5, 0xB5, 0xD1,
90 0xD7, 0x5E, 0x92, 0x2A, 0xAC, 0x56, 0xAA, 0xC6,
91 0x4F, 0xB8, 0x38, 0xD2, 0x96, 0xA4, 0x7D, 0xB6,
92 0x76, 0xFC, 0x6B, 0xE2, 0x9C, 0x74, 0x04, 0xF1,
93 0x45, 0x9D, 0x70, 0x59, 0x64, 0x71, 0x87, 0x20,
94 0x86, 0x5B, 0xCF, 0x65, 0xE6, 0x2D, 0xA8, 0x02,
95 0x1B, 0x60, 0x25, 0xAD, 0xAE, 0xB0, 0xB9, 0xF6,
96 0x1C, 0x46, 0x61, 0x69, 0x34, 0x40, 0x7E, 0x0F,
97 0x55, 0x47, 0xA3, 0x23, 0xDD, 0x51, 0xAF, 0x3A,
98 0xC3, 0x5C, 0xF9, 0xCE, 0xBA, 0xC5, 0xEA, 0x26,
99 0x2C, 0x53, 0x0D, 0x6E, 0x85, 0x28, 0x84, 0x09,
100 0xD3, 0xDF, 0xCD, 0xF4, 0x41, 0x81, 0x4D, 0x52,
101 0x6A, 0xDC, 0x37, 0xC8, 0x6C, 0xC1, 0xAB, 0xFA,
102 0x24, 0xE1, 0x7B, 0x08, 0x0C, 0xBD, 0xB1, 0x4A,
103 0x78, 0x88, 0x95, 0x8B, 0xE3, 0x63, 0xE8, 0x6D,
104 0xE9, 0xCB, 0xD5, 0xFE, 0x3B, 0x00, 0x1D, 0x39,
105 0xF2, 0xEF, 0xB7, 0x0E, 0x66, 0x58, 0xD0, 0xE4,
106 0xA6, 0x77, 0x72, 0xF8, 0xEB, 0x75, 0x4B, 0x0A,
107 0x31, 0x44, 0x50, 0xB4, 0x8F, 0xED, 0x1F, 0x1A,
108 0xDB, 0x99, 0x8D, 0x33, 0x9F, 0x11, 0x83, 0x14,
109 };
110
111const char *MD2_options(void)
112 {
113 if (sizeof(MD2_INT) == 1)
114 return("md2(char)");
115 else
116 return("md2(int)");
117 }
118
119fips_md_init(MD2)
120 {
121 c->num=0;
122 memset(c->state,0,sizeof c->state);
123 memset(c->cksm,0,sizeof c->cksm);
124 memset(c->data,0,sizeof c->data);
125 return 1;
126 }
127
128int MD2_Update(MD2_CTX *c, const unsigned char *data, size_t len)
129 {
130 register UCHAR *p;
131
132 if (len == 0) return 1;
133
134 p=c->data;
135 if (c->num != 0)
136 {
137 if ((c->num+len) >= MD2_BLOCK)
138 {
139 memcpy(&(p[c->num]),data,MD2_BLOCK-c->num);
140 md2_block(c,c->data);
141 data+=(MD2_BLOCK - c->num);
142 len-=(MD2_BLOCK - c->num);
143 c->num=0;
144 /* drop through and do the rest */
145 }
146 else
147 {
148 memcpy(&(p[c->num]),data,len);
149 /* data+=len; */
150 c->num+=(int)len;
151 return 1;
152 }
153 }
154 /* we now can process the input data in blocks of MD2_BLOCK
155 * chars and save the leftovers to c->data. */
156 while (len >= MD2_BLOCK)
157 {
158 md2_block(c,data);
159 data+=MD2_BLOCK;
160 len-=MD2_BLOCK;
161 }
162 memcpy(p,data,len);
163 c->num=(int)len;
164 return 1;
165 }
166
167static void md2_block(MD2_CTX *c, const unsigned char *d)
168 {
169 register MD2_INT t,*sp1,*sp2;
170 register int i,j;
171 MD2_INT state[48];
172
173 sp1=c->state;
174 sp2=c->cksm;
175 j=sp2[MD2_BLOCK-1];
176 for (i=0; i<16; i++)
177 {
178 state[i]=sp1[i];
179 state[i+16]=t=d[i];
180 state[i+32]=(t^sp1[i]);
181 j=sp2[i]^=S[t^j];
182 }
183 t=0;
184 for (i=0; i<18; i++)
185 {
186 for (j=0; j<48; j+=8)
187 {
188 t= state[j+ 0]^=S[t];
189 t= state[j+ 1]^=S[t];
190 t= state[j+ 2]^=S[t];
191 t= state[j+ 3]^=S[t];
192 t= state[j+ 4]^=S[t];
193 t= state[j+ 5]^=S[t];
194 t= state[j+ 6]^=S[t];
195 t= state[j+ 7]^=S[t];
196 }
197 t=(t+i)&0xff;
198 }
199 memcpy(sp1,state,16*sizeof(MD2_INT));
200 OPENSSL_cleanse(state,48*sizeof(MD2_INT));
201 }
202
203int MD2_Final(unsigned char *md, MD2_CTX *c)
204 {
205 int i,v;
206 register UCHAR *cp;
207 register MD2_INT *p1,*p2;
208
209 cp=c->data;
210 p1=c->state;
211 p2=c->cksm;
212 v=MD2_BLOCK-c->num;
213 for (i=c->num; i<MD2_BLOCK; i++)
214 cp[i]=(UCHAR)v;
215
216 md2_block(c,cp);
217
218 for (i=0; i<MD2_BLOCK; i++)
219 cp[i]=(UCHAR)p2[i];
220 md2_block(c,cp);
221
222 for (i=0; i<16; i++)
223 md[i]=(UCHAR)(p1[i]&0xff);
224 memset((char *)&c,0,sizeof(c));
225 return 1;
226 }
227
diff --git a/src/lib/libcrypto/md2/md2_one.c b/src/lib/libcrypto/md2/md2_one.c
new file mode 100644
index 0000000000..f7fef5cc0a
--- /dev/null
+++ b/src/lib/libcrypto/md2/md2_one.c
@@ -0,0 +1,94 @@
1/* crypto/md2/md2_one.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
59#include <stdio.h>
60#include "cryptlib.h"
61#include <openssl/md2.h>
62
63/* This is a separate file so that #defines in cryptlib.h can
64 * map my MD functions to different names */
65
66unsigned char *MD2(const unsigned char *d, size_t n, unsigned char *md)
67 {
68 MD2_CTX c;
69 static unsigned char m[MD2_DIGEST_LENGTH];
70
71 if (md == NULL) md=m;
72 if (!MD2_Init(&c))
73 return NULL;
74#ifndef CHARSET_EBCDIC
75 MD2_Update(&c,d,n);
76#else
77 {
78 char temp[1024];
79 unsigned long chunk;
80
81 while (n > 0)
82 {
83 chunk = (n > sizeof(temp)) ? sizeof(temp) : n;
84 ebcdic2ascii(temp, d, chunk);
85 MD2_Update(&c,temp,chunk);
86 n -= chunk;
87 d += chunk;
88 }
89 }
90#endif
91 MD2_Final(md,&c);
92 OPENSSL_cleanse(&c,sizeof(c)); /* Security consideration */
93 return(md);
94 }
diff --git a/src/lib/libcrypto/md2/md2test.c b/src/lib/libcrypto/md2/md2test.c
new file mode 100644
index 0000000000..db5f5bc6d2
--- /dev/null
+++ b/src/lib/libcrypto/md2/md2test.c
@@ -0,0 +1,143 @@
1/* crypto/md2/md2test.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
59#include <stdio.h>
60#include <stdlib.h>
61#include <string.h>
62
63#include "../e_os.h"
64
65#ifdef OPENSSL_NO_MD2
66int main(int argc, char *argv[])
67{
68 printf("No MD2 support\n");
69 return(0);
70}
71#else
72#include <openssl/evp.h>
73#include <openssl/md2.h>
74
75#ifdef CHARSET_EBCDIC
76#include <openssl/ebcdic.h>
77#endif
78
79static char *test[]={
80 "",
81 "a",
82 "abc",
83 "message digest",
84 "abcdefghijklmnopqrstuvwxyz",
85 "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",
86 "12345678901234567890123456789012345678901234567890123456789012345678901234567890",
87 NULL,
88 };
89
90static char *ret[]={
91 "8350e5a3e24c153df2275c9f80692773",
92 "32ec01ec4a6dac72c0ab96fb34c0b5d1",
93 "da853b0d3f88d99b30283a69e6ded6bb",
94 "ab4f496bfb2a530b219ff33031fe06b0",
95 "4e8ddff3650292ab5a4108c3aa47940b",
96 "da33def2a42df13975352846c30338cd",
97 "d5976f79d83d3a0dc9806c3c66f3efd8",
98 };
99
100static char *pt(unsigned char *md);
101int main(int argc, char *argv[])
102 {
103 int i,err=0;
104 char **P,**R;
105 char *p;
106 unsigned char md[MD2_DIGEST_LENGTH];
107
108 P=test;
109 R=ret;
110 i=1;
111 while (*P != NULL)
112 {
113 EVP_Digest((unsigned char *)*P,strlen(*P),md,NULL,EVP_md2(), NULL);
114 p=pt(md);
115 if (strcmp(p,*R) != 0)
116 {
117 printf("error calculating MD2 on '%s'\n",*P);
118 printf("got %s instead of %s\n",p,*R);
119 err++;
120 }
121 else
122 printf("test %d ok\n",i);
123 i++;
124 R++;
125 P++;
126 }
127#ifdef OPENSSL_SYS_NETWARE
128 if (err) printf("ERROR: %d\n", err);
129#endif
130 EXIT(err);
131 return err;
132 }
133
134static char *pt(unsigned char *md)
135 {
136 int i;
137 static char buf[80];
138
139 for (i=0; i<MD2_DIGEST_LENGTH; i++)
140 sprintf(&(buf[i*2]),"%02x",md[i]);
141 return(buf);
142 }
143#endif
diff --git a/src/lib/libcrypto/md4/Makefile b/src/lib/libcrypto/md4/Makefile
new file mode 100644
index 0000000000..e6f1e4478c
--- /dev/null
+++ b/src/lib/libcrypto/md4/Makefile
@@ -0,0 +1,89 @@
1#
2# OpenSSL/crypto/md4/Makefile
3#
4
5DIR= md4
6TOP= ../..
7CC= cc
8CPP= $(CC) -E
9INCLUDES=
10CFLAG=-g
11MAKEFILE= Makefile
12AR= ar r
13
14CFLAGS= $(INCLUDES) $(CFLAG)
15
16GENERAL=Makefile
17TEST=md4test.c
18APPS=md4.c
19
20LIB=$(TOP)/libcrypto.a
21LIBSRC=md4_dgst.c md4_one.c
22LIBOBJ=md4_dgst.o md4_one.o
23
24SRC= $(LIBSRC)
25
26EXHEADER= md4.h
27HEADER= md4_locl.h $(EXHEADER)
28
29ALL= $(GENERAL) $(SRC) $(HEADER)
30
31top:
32 (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all)
33
34all: lib
35
36lib: $(LIBOBJ)
37 $(AR) $(LIB) $(LIBOBJ)
38 $(RANLIB) $(LIB) || echo Never mind.
39 @touch lib
40
41files:
42 $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
43
44links:
45 @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
46 @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
47 @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
48
49install:
50 @[ -n "$(INSTALLTOP)" ] # should be set by top Makefile...
51 @headerlist="$(EXHEADER)"; for i in $$headerlist ; \
52 do \
53 (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
54 chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
55 done;
56
57tags:
58 ctags $(SRC)
59
60tests:
61
62lint:
63 lint -DLINT $(INCLUDES) $(SRC)>fluff
64
65depend:
66 @[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile...
67 $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
68
69dclean:
70 $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
71 mv -f Makefile.new $(MAKEFILE)
72 rm -f ../../include/openssl/$(EXHEADER) ../../test/$(TEST) ../../apps/$(APPS)
73
74clean:
75 rm -f asm/mx86unix.cpp *.o asm/*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
76
77# DO NOT DELETE THIS LINE -- make depend depends on it.
78
79md4_dgst.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
80md4_dgst.o: ../../include/openssl/md4.h ../../include/openssl/opensslconf.h
81md4_dgst.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
82md4_dgst.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
83md4_dgst.o: ../../include/openssl/symhacks.h ../md32_common.h md4_dgst.c
84md4_dgst.o: md4_locl.h
85md4_one.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
86md4_one.o: ../../include/openssl/md4.h ../../include/openssl/opensslconf.h
87md4_one.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
88md4_one.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
89md4_one.o: ../../include/openssl/symhacks.h md4_one.c
diff --git a/src/lib/libcrypto/md4/md4.c b/src/lib/libcrypto/md4/md4.c
new file mode 100644
index 0000000000..141415ad4d
--- /dev/null
+++ b/src/lib/libcrypto/md4/md4.c
@@ -0,0 +1,127 @@
1/* crypto/md4/md4.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
59#include <stdio.h>
60#include <stdlib.h>
61#include <openssl/md4.h>
62
63#define BUFSIZE 1024*16
64
65void do_fp(FILE *f);
66void pt(unsigned char *md);
67#if !defined(_OSD_POSIX) && !defined(__DJGPP__)
68int read(int, void *, unsigned int);
69#endif
70
71int main(int argc, char **argv)
72 {
73 int i,err=0;
74 FILE *IN;
75
76 if (argc == 1)
77 {
78 do_fp(stdin);
79 }
80 else
81 {
82 for (i=1; i<argc; i++)
83 {
84 IN=fopen(argv[i],"r");
85 if (IN == NULL)
86 {
87 perror(argv[i]);
88 err++;
89 continue;
90 }
91 printf("MD4(%s)= ",argv[i]);
92 do_fp(IN);
93 fclose(IN);
94 }
95 }
96 exit(err);
97 }
98
99void do_fp(FILE *f)
100 {
101 MD4_CTX c;
102 unsigned char md[MD4_DIGEST_LENGTH];
103 int fd;
104 int i;
105 static unsigned char buf[BUFSIZE];
106
107 fd=fileno(f);
108 MD4_Init(&c);
109 for (;;)
110 {
111 i=read(fd,buf,sizeof buf);
112 if (i <= 0) break;
113 MD4_Update(&c,buf,(unsigned long)i);
114 }
115 MD4_Final(&(md[0]),&c);
116 pt(md);
117 }
118
119void pt(unsigned char *md)
120 {
121 int i;
122
123 for (i=0; i<MD4_DIGEST_LENGTH; i++)
124 printf("%02x",md[i]);
125 printf("\n");
126 }
127
diff --git a/src/lib/libcrypto/md4/md4_dgst.c b/src/lib/libcrypto/md4/md4_dgst.c
index b5b165b052..82c2cb2d98 100644
--- a/src/lib/libcrypto/md4/md4_dgst.c
+++ b/src/lib/libcrypto/md4/md4_dgst.c
@@ -106,23 +106,22 @@ void md4_block_data_order (MD4_CTX *c, const void *data_, size_t num)
106 106
107 for (;num--;) 107 for (;num--;)
108 { 108 {
109 (void)HOST_c2l(data,l); X( 0)=l; 109 HOST_c2l(data,l); X( 0)=l; HOST_c2l(data,l); X( 1)=l;
110 (void)HOST_c2l(data,l); X( 1)=l;
111 /* Round 0 */ 110 /* Round 0 */
112 R0(A,B,C,D,X( 0), 3,0); (void)HOST_c2l(data,l); X( 2)=l; 111 R0(A,B,C,D,X( 0), 3,0); HOST_c2l(data,l); X( 2)=l;
113 R0(D,A,B,C,X( 1), 7,0); (void)HOST_c2l(data,l); X( 3)=l; 112 R0(D,A,B,C,X( 1), 7,0); HOST_c2l(data,l); X( 3)=l;
114 R0(C,D,A,B,X( 2),11,0); (void)HOST_c2l(data,l); X( 4)=l; 113 R0(C,D,A,B,X( 2),11,0); HOST_c2l(data,l); X( 4)=l;
115 R0(B,C,D,A,X( 3),19,0); (void)HOST_c2l(data,l); X( 5)=l; 114 R0(B,C,D,A,X( 3),19,0); HOST_c2l(data,l); X( 5)=l;
116 R0(A,B,C,D,X( 4), 3,0); (void)HOST_c2l(data,l); X( 6)=l; 115 R0(A,B,C,D,X( 4), 3,0); HOST_c2l(data,l); X( 6)=l;
117 R0(D,A,B,C,X( 5), 7,0); (void)HOST_c2l(data,l); X( 7)=l; 116 R0(D,A,B,C,X( 5), 7,0); HOST_c2l(data,l); X( 7)=l;
118 R0(C,D,A,B,X( 6),11,0); (void)HOST_c2l(data,l); X( 8)=l; 117 R0(C,D,A,B,X( 6),11,0); HOST_c2l(data,l); X( 8)=l;
119 R0(B,C,D,A,X( 7),19,0); (void)HOST_c2l(data,l); X( 9)=l; 118 R0(B,C,D,A,X( 7),19,0); HOST_c2l(data,l); X( 9)=l;
120 R0(A,B,C,D,X( 8), 3,0); (void)HOST_c2l(data,l); X(10)=l; 119 R0(A,B,C,D,X( 8), 3,0); HOST_c2l(data,l); X(10)=l;
121 R0(D,A,B,C,X( 9), 7,0); (void)HOST_c2l(data,l); X(11)=l; 120 R0(D,A,B,C,X( 9), 7,0); HOST_c2l(data,l); X(11)=l;
122 R0(C,D,A,B,X(10),11,0); (void)HOST_c2l(data,l); X(12)=l; 121 R0(C,D,A,B,X(10),11,0); HOST_c2l(data,l); X(12)=l;
123 R0(B,C,D,A,X(11),19,0); (void)HOST_c2l(data,l); X(13)=l; 122 R0(B,C,D,A,X(11),19,0); HOST_c2l(data,l); X(13)=l;
124 R0(A,B,C,D,X(12), 3,0); (void)HOST_c2l(data,l); X(14)=l; 123 R0(A,B,C,D,X(12), 3,0); HOST_c2l(data,l); X(14)=l;
125 R0(D,A,B,C,X(13), 7,0); (void)HOST_c2l(data,l); X(15)=l; 124 R0(D,A,B,C,X(13), 7,0); HOST_c2l(data,l); X(15)=l;
126 R0(C,D,A,B,X(14),11,0); 125 R0(C,D,A,B,X(14),11,0);
127 R0(B,C,D,A,X(15),19,0); 126 R0(B,C,D,A,X(15),19,0);
128 /* Round 1 */ 127 /* Round 1 */
diff --git a/src/lib/libcrypto/md4/md4_locl.h b/src/lib/libcrypto/md4/md4_locl.h
index 99c3e5004c..c8085b0ead 100644
--- a/src/lib/libcrypto/md4/md4_locl.h
+++ b/src/lib/libcrypto/md4/md4_locl.h
@@ -77,10 +77,10 @@ void md4_block_data_order (MD4_CTX *c, const void *p,size_t num);
77#define HASH_FINAL MD4_Final 77#define HASH_FINAL MD4_Final
78#define HASH_MAKE_STRING(c,s) do { \ 78#define HASH_MAKE_STRING(c,s) do { \
79 unsigned long ll; \ 79 unsigned long ll; \
80 ll=(c)->A; (void)HOST_l2c(ll,(s)); \ 80 ll=(c)->A; HOST_l2c(ll,(s)); \
81 ll=(c)->B; (void)HOST_l2c(ll,(s)); \ 81 ll=(c)->B; HOST_l2c(ll,(s)); \
82 ll=(c)->C; (void)HOST_l2c(ll,(s)); \ 82 ll=(c)->C; HOST_l2c(ll,(s)); \
83 ll=(c)->D; (void)HOST_l2c(ll,(s)); \ 83 ll=(c)->D; HOST_l2c(ll,(s)); \
84 } while (0) 84 } while (0)
85#define HASH_BLOCK_DATA_ORDER md4_block_data_order 85#define HASH_BLOCK_DATA_ORDER md4_block_data_order
86 86
diff --git a/src/lib/libcrypto/md4/md4s.cpp b/src/lib/libcrypto/md4/md4s.cpp
new file mode 100644
index 0000000000..c0ec97fc9f
--- /dev/null
+++ b/src/lib/libcrypto/md4/md4s.cpp
@@ -0,0 +1,78 @@
1//
2// gettsc.inl
3//
4// gives access to the Pentium's (secret) cycle counter
5//
6// This software was written by Leonard Janke (janke@unixg.ubc.ca)
7// in 1996-7 and is entered, by him, into the public domain.
8
9#if defined(__WATCOMC__)
10void GetTSC(unsigned long&);
11#pragma aux GetTSC = 0x0f 0x31 "mov [edi], eax" parm [edi] modify [edx eax];
12#elif defined(__GNUC__)
13inline
14void GetTSC(unsigned long& tsc)
15{
16 asm volatile(".byte 15, 49\n\t"
17 : "=eax" (tsc)
18 :
19 : "%edx", "%eax");
20}
21#elif defined(_MSC_VER)
22inline
23void GetTSC(unsigned long& tsc)
24{
25 unsigned long a;
26 __asm _emit 0fh
27 __asm _emit 31h
28 __asm mov a, eax;
29 tsc=a;
30}
31#endif
32
33#include <stdio.h>
34#include <stdlib.h>
35#include <openssl/md4.h>
36
37extern "C" {
38void md4_block_x86(MD4_CTX *ctx, unsigned char *buffer,int num);
39}
40
41void main(int argc,char *argv[])
42 {
43 unsigned char buffer[64*256];
44 MD4_CTX ctx;
45 unsigned long s1,s2,e1,e2;
46 unsigned char k[16];
47 unsigned long data[2];
48 unsigned char iv[8];
49 int i,num=0,numm;
50 int j=0;
51
52 if (argc >= 2)
53 num=atoi(argv[1]);
54
55 if (num == 0) num=16;
56 if (num > 250) num=16;
57 numm=num+2;
58 num*=64;
59 numm*=64;
60
61 for (j=0; j<6; j++)
62 {
63 for (i=0; i<10; i++) /**/
64 {
65 md4_block_x86(&ctx,buffer,numm);
66 GetTSC(s1);
67 md4_block_x86(&ctx,buffer,numm);
68 GetTSC(e1);
69 GetTSC(s2);
70 md4_block_x86(&ctx,buffer,num);
71 GetTSC(e2);
72 md4_block_x86(&ctx,buffer,num);
73 }
74 printf("md4 (%d bytes) %d %d (%.2f)\n",num,
75 e1-s1,e2-s2,(double)((e1-s1)-(e2-s2))/2);
76 }
77 }
78
diff --git a/src/lib/libcrypto/md4/md4test.c b/src/lib/libcrypto/md4/md4test.c
new file mode 100644
index 0000000000..56591728a1
--- /dev/null
+++ b/src/lib/libcrypto/md4/md4test.c
@@ -0,0 +1,136 @@
1/* crypto/md4/md4test.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
59#include <stdio.h>
60#include <string.h>
61#include <stdlib.h>
62
63#include "../e_os.h"
64
65#ifdef OPENSSL_NO_MD4
66int main(int argc, char *argv[])
67{
68 printf("No MD4 support\n");
69 return(0);
70}
71#else
72#include <openssl/evp.h>
73#include <openssl/md4.h>
74
75static char *test[]={
76 "",
77 "a",
78 "abc",
79 "message digest",
80 "abcdefghijklmnopqrstuvwxyz",
81 "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",
82 "12345678901234567890123456789012345678901234567890123456789012345678901234567890",
83 NULL,
84 };
85
86static char *ret[]={
87"31d6cfe0d16ae931b73c59d7e0c089c0",
88"bde52cb31de33e46245e05fbdbd6fb24",
89"a448017aaf21d8525fc10ae87aa6729d",
90"d9130a8164549fe818874806e1c7014b",
91"d79e1c308aa5bbcdeea8ed63df412da9",
92"043f8582f241db351ce627e153e7f0e4",
93"e33b4ddc9c38f2199c3e7b164fcc0536",
94};
95
96static char *pt(unsigned char *md);
97int main(int argc, char *argv[])
98 {
99 int i,err=0;
100 char **P,**R;
101 char *p;
102 unsigned char md[MD4_DIGEST_LENGTH];
103
104 P=test;
105 R=ret;
106 i=1;
107 while (*P != NULL)
108 {
109 EVP_Digest(&(P[0][0]),strlen((char *)*P),md,NULL,EVP_md4(), NULL);
110 p=pt(md);
111 if (strcmp(p,(char *)*R) != 0)
112 {
113 printf("error calculating MD4 on '%s'\n",*P);
114 printf("got %s instead of %s\n",p,*R);
115 err++;
116 }
117 else
118 printf("test %d ok\n",i);
119 i++;
120 R++;
121 P++;
122 }
123 EXIT(err);
124 return(0);
125 }
126
127static char *pt(unsigned char *md)
128 {
129 int i;
130 static char buf[80];
131
132 for (i=0; i<MD4_DIGEST_LENGTH; i++)
133 sprintf(&(buf[i*2]),"%02x",md[i]);
134 return(buf);
135 }
136#endif
diff --git a/src/lib/libcrypto/md5/Makefile b/src/lib/libcrypto/md5/Makefile
new file mode 100644
index 0000000000..b9e2ce9a38
--- /dev/null
+++ b/src/lib/libcrypto/md5/Makefile
@@ -0,0 +1,102 @@
1#
2# OpenSSL/crypto/md5/Makefile
3#
4
5DIR= md5
6TOP= ../..
7CC= cc
8CPP= $(CC) -E
9INCLUDES=-I.. -I$(TOP) -I../../include
10CFLAG=-g
11MAKEFILE= Makefile
12AR= ar r
13
14MD5_ASM_OBJ=
15
16CFLAGS= $(INCLUDES) $(CFLAG)
17ASFLAGS= $(INCLUDES) $(ASFLAG)
18AFLAGS= $(ASFLAGS)
19
20GENERAL=Makefile
21TEST=md5test.c
22APPS=
23
24LIB=$(TOP)/libcrypto.a
25LIBSRC=md5_dgst.c md5_one.c
26LIBOBJ=md5_dgst.o md5_one.o $(MD5_ASM_OBJ)
27
28SRC= $(LIBSRC)
29
30EXHEADER= md5.h
31HEADER= md5_locl.h $(EXHEADER)
32
33ALL= $(GENERAL) $(SRC) $(HEADER)
34
35top:
36 (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all)
37
38all: lib
39
40lib: $(LIBOBJ)
41 $(AR) $(LIB) $(LIBOBJ)
42 $(RANLIB) $(LIB) || echo Never mind.
43 @touch lib
44
45md5-586.s: asm/md5-586.pl ../perlasm/x86asm.pl
46 $(PERL) asm/md5-586.pl $(PERLASM_SCHEME) $(CFLAGS) > $@
47
48md5-x86_64.s: asm/md5-x86_64.pl
49 $(PERL) asm/md5-x86_64.pl $(PERLASM_SCHEME) > $@
50
51md5-ia64.s: asm/md5-ia64.S
52 $(CC) $(CFLAGS) -E asm/md5-ia64.S | \
53 $(PERL) -ne 's/;\s+/;\n/g; print;' > $@
54
55files:
56 $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
57
58links:
59 @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
60 @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
61 @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
62
63install:
64 @[ -n "$(INSTALLTOP)" ] # should be set by top Makefile...
65 @headerlist="$(EXHEADER)"; for i in $$headerlist ; \
66 do \
67 (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
68 chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
69 done;
70
71tags:
72 ctags $(SRC)
73
74tests:
75
76lint:
77 lint -DLINT $(INCLUDES) $(SRC)>fluff
78
79depend:
80 @[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile...
81 $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
82
83dclean:
84 $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
85 mv -f Makefile.new $(MAKEFILE)
86
87clean:
88 rm -f *.s *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
89
90# DO NOT DELETE THIS LINE -- make depend depends on it.
91
92md5_dgst.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
93md5_dgst.o: ../../include/openssl/md5.h ../../include/openssl/opensslconf.h
94md5_dgst.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
95md5_dgst.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
96md5_dgst.o: ../../include/openssl/symhacks.h ../md32_common.h md5_dgst.c
97md5_dgst.o: md5_locl.h
98md5_one.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
99md5_one.o: ../../include/openssl/md5.h ../../include/openssl/opensslconf.h
100md5_one.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
101md5_one.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
102md5_one.o: ../../include/openssl/symhacks.h md5_one.c
diff --git a/src/lib/libcrypto/md5/md5.c b/src/lib/libcrypto/md5/md5.c
new file mode 100644
index 0000000000..563733abc5
--- /dev/null
+++ b/src/lib/libcrypto/md5/md5.c
@@ -0,0 +1,127 @@
1/* crypto/md5/md5.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
59#include <stdio.h>
60#include <stdlib.h>
61#include <openssl/md5.h>
62
63#define BUFSIZE 1024*16
64
65void do_fp(FILE *f);
66void pt(unsigned char *md);
67#if !defined(_OSD_POSIX) && !defined(__DJGPP__)
68int read(int, void *, unsigned int);
69#endif
70
71int main(int argc, char **argv)
72 {
73 int i,err=0;
74 FILE *IN;
75
76 if (argc == 1)
77 {
78 do_fp(stdin);
79 }
80 else
81 {
82 for (i=1; i<argc; i++)
83 {
84 IN=fopen(argv[i],"r");
85 if (IN == NULL)
86 {
87 perror(argv[i]);
88 err++;
89 continue;
90 }
91 printf("MD5(%s)= ",argv[i]);
92 do_fp(IN);
93 fclose(IN);
94 }
95 }
96 exit(err);
97 }
98
99void do_fp(FILE *f)
100 {
101 MD5_CTX c;
102 unsigned char md[MD5_DIGEST_LENGTH];
103 int fd;
104 int i;
105 static unsigned char buf[BUFSIZE];
106
107 fd=fileno(f);
108 MD5_Init(&c);
109 for (;;)
110 {
111 i=read(fd,buf,BUFSIZE);
112 if (i <= 0) break;
113 MD5_Update(&c,buf,(unsigned long)i);
114 }
115 MD5_Final(&(md[0]),&c);
116 pt(md);
117 }
118
119void pt(unsigned char *md)
120 {
121 int i;
122
123 for (i=0; i<MD5_DIGEST_LENGTH; i++)
124 printf("%02x",md[i]);
125 printf("\n");
126 }
127
diff --git a/src/lib/libcrypto/md5/md5_locl.h b/src/lib/libcrypto/md5/md5_locl.h
index 74d63d1f9c..968d577995 100644
--- a/src/lib/libcrypto/md5/md5_locl.h
+++ b/src/lib/libcrypto/md5/md5_locl.h
@@ -86,10 +86,10 @@ void md5_block_data_order (MD5_CTX *c, const void *p,size_t num);
86#define HASH_FINAL MD5_Final 86#define HASH_FINAL MD5_Final
87#define HASH_MAKE_STRING(c,s) do { \ 87#define HASH_MAKE_STRING(c,s) do { \
88 unsigned long ll; \ 88 unsigned long ll; \
89 ll=(c)->A; (void)HOST_l2c(ll,(s)); \ 89 ll=(c)->A; HOST_l2c(ll,(s)); \
90 ll=(c)->B; (void)HOST_l2c(ll,(s)); \ 90 ll=(c)->B; HOST_l2c(ll,(s)); \
91 ll=(c)->C; (void)HOST_l2c(ll,(s)); \ 91 ll=(c)->C; HOST_l2c(ll,(s)); \
92 ll=(c)->D; (void)HOST_l2c(ll,(s)); \ 92 ll=(c)->D; HOST_l2c(ll,(s)); \
93 } while (0) 93 } while (0)
94#define HASH_BLOCK_DATA_ORDER md5_block_data_order 94#define HASH_BLOCK_DATA_ORDER md5_block_data_order
95 95
diff --git a/src/lib/libcrypto/md5/md5s.cpp b/src/lib/libcrypto/md5/md5s.cpp
new file mode 100644
index 0000000000..dd343fd4e6
--- /dev/null
+++ b/src/lib/libcrypto/md5/md5s.cpp
@@ -0,0 +1,78 @@
1//
2// gettsc.inl
3//
4// gives access to the Pentium's (secret) cycle counter
5//
6// This software was written by Leonard Janke (janke@unixg.ubc.ca)
7// in 1996-7 and is entered, by him, into the public domain.
8
9#if defined(__WATCOMC__)
10void GetTSC(unsigned long&);
11#pragma aux GetTSC = 0x0f 0x31 "mov [edi], eax" parm [edi] modify [edx eax];
12#elif defined(__GNUC__)
13inline
14void GetTSC(unsigned long& tsc)
15{
16 asm volatile(".byte 15, 49\n\t"
17 : "=eax" (tsc)
18 :
19 : "%edx", "%eax");
20}
21#elif defined(_MSC_VER)
22inline
23void GetTSC(unsigned long& tsc)
24{
25 unsigned long a;
26 __asm _emit 0fh
27 __asm _emit 31h
28 __asm mov a, eax;
29 tsc=a;
30}
31#endif
32
33#include <stdio.h>
34#include <stdlib.h>
35#include <openssl/md5.h>
36
37extern "C" {
38void md5_block_x86(MD5_CTX *ctx, unsigned char *buffer,int num);
39}
40
41void main(int argc,char *argv[])
42 {
43 unsigned char buffer[64*256];
44 MD5_CTX ctx;
45 unsigned long s1,s2,e1,e2;
46 unsigned char k[16];
47 unsigned long data[2];
48 unsigned char iv[8];
49 int i,num=0,numm;
50 int j=0;
51
52 if (argc >= 2)
53 num=atoi(argv[1]);
54
55 if (num == 0) num=16;
56 if (num > 250) num=16;
57 numm=num+2;
58 num*=64;
59 numm*=64;
60
61 for (j=0; j<6; j++)
62 {
63 for (i=0; i<10; i++) /**/
64 {
65 md5_block_x86(&ctx,buffer,numm);
66 GetTSC(s1);
67 md5_block_x86(&ctx,buffer,numm);
68 GetTSC(e1);
69 GetTSC(s2);
70 md5_block_x86(&ctx,buffer,num);
71 GetTSC(e2);
72 md5_block_x86(&ctx,buffer,num);
73 }
74 printf("md5 (%d bytes) %d %d (%.2f)\n",num,
75 e1-s1,e2-s2,(double)((e1-s1)-(e2-s2))/2);
76 }
77 }
78
diff --git a/src/lib/libcrypto/md5/md5test.c b/src/lib/libcrypto/md5/md5test.c
new file mode 100644
index 0000000000..2b37190e32
--- /dev/null
+++ b/src/lib/libcrypto/md5/md5test.c
@@ -0,0 +1,140 @@
1/* crypto/md5/md5test.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
59#include <stdio.h>
60#include <string.h>
61#include <stdlib.h>
62
63#include "../e_os.h"
64
65#ifdef OPENSSL_NO_MD5
66int main(int argc, char *argv[])
67{
68 printf("No MD5 support\n");
69 return(0);
70}
71#else
72#include <openssl/evp.h>
73#include <openssl/md5.h>
74
75static char *test[]={
76 "",
77 "a",
78 "abc",
79 "message digest",
80 "abcdefghijklmnopqrstuvwxyz",
81 "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",
82 "12345678901234567890123456789012345678901234567890123456789012345678901234567890",
83 NULL,
84 };
85
86static char *ret[]={
87 "d41d8cd98f00b204e9800998ecf8427e",
88 "0cc175b9c0f1b6a831c399e269772661",
89 "900150983cd24fb0d6963f7d28e17f72",
90 "f96b697d7cb7938d525a2f31aaf161d0",
91 "c3fcd3d76192e4007dfb496cca67e13b",
92 "d174ab98d277d9f5a5611c2c9f419d9f",
93 "57edf4a22be3c955ac49da2e2107b67a",
94 };
95
96static char *pt(unsigned char *md);
97int main(int argc, char *argv[])
98 {
99 int i,err=0;
100 char **P,**R;
101 char *p;
102 unsigned char md[MD5_DIGEST_LENGTH];
103
104 P=test;
105 R=ret;
106 i=1;
107 while (*P != NULL)
108 {
109 EVP_Digest(&(P[0][0]),strlen((char *)*P),md,NULL,EVP_md5(), NULL);
110 p=pt(md);
111 if (strcmp(p,(char *)*R) != 0)
112 {
113 printf("error calculating MD5 on '%s'\n",*P);
114 printf("got %s instead of %s\n",p,*R);
115 err++;
116 }
117 else
118 printf("test %d ok\n",i);
119 i++;
120 R++;
121 P++;
122 }
123
124#ifdef OPENSSL_SYS_NETWARE
125 if (err) printf("ERROR: %d\n", err);
126#endif
127 EXIT(err);
128 return(0);
129 }
130
131static char *pt(unsigned char *md)
132 {
133 int i;
134 static char buf[80];
135
136 for (i=0; i<MD5_DIGEST_LENGTH; i++)
137 sprintf(&(buf[i*2]),"%02x",md[i]);
138 return(buf);
139 }
140#endif
diff --git a/src/lib/libcrypto/mdc2/Makefile b/src/lib/libcrypto/mdc2/Makefile
new file mode 100644
index 0000000000..141553149d
--- /dev/null
+++ b/src/lib/libcrypto/mdc2/Makefile
@@ -0,0 +1,93 @@
1#
2# OpenSSL/crypto/mdc2/Makefile
3#
4
5DIR= mdc2
6TOP= ../..
7CC= cc
8INCLUDES=
9CFLAG=-g
10MAKEFILE= Makefile
11AR= ar r
12
13CFLAGS= $(INCLUDES) $(CFLAG)
14
15GENERAL=Makefile
16TEST= mdc2test.c
17APPS=
18
19LIB=$(TOP)/libcrypto.a
20LIBSRC=mdc2dgst.c mdc2_one.c
21LIBOBJ=mdc2dgst.o mdc2_one.o
22
23SRC= $(LIBSRC)
24
25EXHEADER= mdc2.h
26HEADER= $(EXHEADER)
27
28ALL= $(GENERAL) $(SRC) $(HEADER)
29
30top:
31 (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all)
32
33all: lib
34
35lib: $(LIBOBJ)
36 $(AR) $(LIB) $(LIBOBJ)
37 $(RANLIB) $(LIB) || echo Never mind.
38 @touch lib
39
40files:
41 $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
42
43links:
44 @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
45 @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
46 @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
47
48install:
49 @[ -n "$(INSTALLTOP)" ] # should be set by top Makefile...
50 @headerlist="$(EXHEADER)"; for i in $$headerlist ; \
51 do \
52 (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
53 chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
54 done;
55
56tags:
57 ctags $(SRC)
58
59tests:
60
61lint:
62 lint -DLINT $(INCLUDES) $(SRC)>fluff
63
64depend:
65 @[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile...
66 $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
67
68dclean:
69 $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
70 mv -f Makefile.new $(MAKEFILE)
71
72clean:
73 rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
74
75# DO NOT DELETE THIS LINE -- make depend depends on it.
76
77mdc2_one.o: ../../e_os.h ../../include/openssl/bio.h
78mdc2_one.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
79mdc2_one.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
80mdc2_one.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
81mdc2_one.o: ../../include/openssl/lhash.h ../../include/openssl/mdc2.h
82mdc2_one.o: ../../include/openssl/opensslconf.h
83mdc2_one.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
84mdc2_one.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
85mdc2_one.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
86mdc2_one.o: ../../include/openssl/ui_compat.h ../cryptlib.h mdc2_one.c
87mdc2dgst.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
88mdc2dgst.o: ../../include/openssl/des_old.h ../../include/openssl/e_os2.h
89mdc2dgst.o: ../../include/openssl/mdc2.h ../../include/openssl/opensslconf.h
90mdc2dgst.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
91mdc2dgst.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
92mdc2dgst.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
93mdc2dgst.o: ../../include/openssl/ui_compat.h mdc2dgst.c
diff --git a/src/lib/libcrypto/mdc2/mdc2.h b/src/lib/libcrypto/mdc2/mdc2.h
new file mode 100644
index 0000000000..f3e8e579d2
--- /dev/null
+++ b/src/lib/libcrypto/mdc2/mdc2.h
@@ -0,0 +1,98 @@
1/* crypto/mdc2/mdc2.h */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
59#ifndef HEADER_MDC2_H
60#define HEADER_MDC2_H
61
62#include <openssl/des.h>
63
64#ifdef __cplusplus
65extern "C" {
66#endif
67
68#ifdef OPENSSL_NO_MDC2
69#error MDC2 is disabled.
70#endif
71
72#define MDC2_BLOCK 8
73#define MDC2_DIGEST_LENGTH 16
74
75typedef struct mdc2_ctx_st
76 {
77 unsigned int num;
78 unsigned char data[MDC2_BLOCK];
79 DES_cblock h,hh;
80 int pad_type; /* either 1 or 2, default 1 */
81 } MDC2_CTX;
82
83
84#ifdef OPENSSL_FIPS
85int private_MDC2_Init(MDC2_CTX *c);
86#endif
87int MDC2_Init(MDC2_CTX *c);
88int MDC2_Update(MDC2_CTX *c, const unsigned char *data, size_t len);
89int MDC2_Final(unsigned char *md, MDC2_CTX *c);
90unsigned char *MDC2(const unsigned char *d, size_t n,
91 unsigned char *md);
92
93#ifdef __cplusplus
94}
95#endif
96
97#endif
98
diff --git a/src/lib/libcrypto/mdc2/mdc2_one.c b/src/lib/libcrypto/mdc2/mdc2_one.c
new file mode 100644
index 0000000000..72647f67ed
--- /dev/null
+++ b/src/lib/libcrypto/mdc2/mdc2_one.c
@@ -0,0 +1,76 @@
1/* crypto/mdc2/mdc2_one.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
59#include <stdio.h>
60#include "cryptlib.h"
61#include <openssl/mdc2.h>
62
63unsigned char *MDC2(const unsigned char *d, size_t n, unsigned char *md)
64 {
65 MDC2_CTX c;
66 static unsigned char m[MDC2_DIGEST_LENGTH];
67
68 if (md == NULL) md=m;
69 if (!MDC2_Init(&c))
70 return NULL;
71 MDC2_Update(&c,d,n);
72 MDC2_Final(md,&c);
73 OPENSSL_cleanse(&c,sizeof(c)); /* security consideration */
74 return(md);
75 }
76
diff --git a/src/lib/libcrypto/mdc2/mdc2dgst.c b/src/lib/libcrypto/mdc2/mdc2dgst.c
new file mode 100644
index 0000000000..b74bb1a759
--- /dev/null
+++ b/src/lib/libcrypto/mdc2/mdc2dgst.c
@@ -0,0 +1,200 @@
1/* crypto/mdc2/mdc2dgst.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
59#include <stdio.h>
60#include <stdlib.h>
61#include <string.h>
62#include <openssl/des.h>
63#include <openssl/mdc2.h>
64#include <openssl/crypto.h>
65
66#undef c2l
67#define c2l(c,l) (l =((DES_LONG)(*((c)++))) , \
68 l|=((DES_LONG)(*((c)++)))<< 8L, \
69 l|=((DES_LONG)(*((c)++)))<<16L, \
70 l|=((DES_LONG)(*((c)++)))<<24L)
71
72#undef l2c
73#define l2c(l,c) (*((c)++)=(unsigned char)(((l) )&0xff), \
74 *((c)++)=(unsigned char)(((l)>> 8L)&0xff), \
75 *((c)++)=(unsigned char)(((l)>>16L)&0xff), \
76 *((c)++)=(unsigned char)(((l)>>24L)&0xff))
77
78static void mdc2_body(MDC2_CTX *c, const unsigned char *in, size_t len);
79fips_md_init(MDC2)
80 {
81 c->num=0;
82 c->pad_type=1;
83 memset(&(c->h[0]),0x52,MDC2_BLOCK);
84 memset(&(c->hh[0]),0x25,MDC2_BLOCK);
85 return 1;
86 }
87
88int MDC2_Update(MDC2_CTX *c, const unsigned char *in, size_t len)
89 {
90 size_t i,j;
91
92 i=c->num;
93 if (i != 0)
94 {
95 if (i+len < MDC2_BLOCK)
96 {
97 /* partial block */
98 memcpy(&(c->data[i]),in,len);
99 c->num+=(int)len;
100 return 1;
101 }
102 else
103 {
104 /* filled one */
105 j=MDC2_BLOCK-i;
106 memcpy(&(c->data[i]),in,j);
107 len-=j;
108 in+=j;
109 c->num=0;
110 mdc2_body(c,&(c->data[0]),MDC2_BLOCK);
111 }
112 }
113 i=len&~((size_t)MDC2_BLOCK-1);
114 if (i > 0) mdc2_body(c,in,i);
115 j=len-i;
116 if (j > 0)
117 {
118 memcpy(&(c->data[0]),&(in[i]),j);
119 c->num=(int)j;
120 }
121 return 1;
122 }
123
124static void mdc2_body(MDC2_CTX *c, const unsigned char *in, size_t len)
125 {
126 register DES_LONG tin0,tin1;
127 register DES_LONG ttin0,ttin1;
128 DES_LONG d[2],dd[2];
129 DES_key_schedule k;
130 unsigned char *p;
131 size_t i;
132
133 for (i=0; i<len; i+=8)
134 {
135 c2l(in,tin0); d[0]=dd[0]=tin0;
136 c2l(in,tin1); d[1]=dd[1]=tin1;
137 c->h[0]=(c->h[0]&0x9f)|0x40;
138 c->hh[0]=(c->hh[0]&0x9f)|0x20;
139
140 DES_set_odd_parity(&c->h);
141 DES_set_key_unchecked(&c->h,&k);
142 DES_encrypt1(d,&k,1);
143
144 DES_set_odd_parity(&c->hh);
145 DES_set_key_unchecked(&c->hh,&k);
146 DES_encrypt1(dd,&k,1);
147
148 ttin0=tin0^dd[0];
149 ttin1=tin1^dd[1];
150 tin0^=d[0];
151 tin1^=d[1];
152
153 p=c->h;
154 l2c(tin0,p);
155 l2c(ttin1,p);
156 p=c->hh;
157 l2c(ttin0,p);
158 l2c(tin1,p);
159 }
160 }
161
162int MDC2_Final(unsigned char *md, MDC2_CTX *c)
163 {
164 unsigned int i;
165 int j;
166
167 i=c->num;
168 j=c->pad_type;
169 if ((i > 0) || (j == 2))
170 {
171 if (j == 2)
172 c->data[i++]=0x80;
173 memset(&(c->data[i]),0,MDC2_BLOCK-i);
174 mdc2_body(c,c->data,MDC2_BLOCK);
175 }
176 memcpy(md,(char *)c->h,MDC2_BLOCK);
177 memcpy(&(md[MDC2_BLOCK]),(char *)c->hh,MDC2_BLOCK);
178 return 1;
179 }
180
181#undef TEST
182
183#ifdef TEST
184main()
185 {
186 unsigned char md[MDC2_DIGEST_LENGTH];
187 int i;
188 MDC2_CTX c;
189 static char *text="Now is the time for all ";
190
191 MDC2_Init(&c);
192 MDC2_Update(&c,text,strlen(text));
193 MDC2_Final(&(md[0]),&c);
194
195 for (i=0; i<MDC2_DIGEST_LENGTH; i++)
196 printf("%02X",md[i]);
197 printf("\n");
198 }
199
200#endif
diff --git a/src/lib/libcrypto/mdc2/mdc2test.c b/src/lib/libcrypto/mdc2/mdc2test.c
new file mode 100644
index 0000000000..017b31add2
--- /dev/null
+++ b/src/lib/libcrypto/mdc2/mdc2test.c
@@ -0,0 +1,149 @@
1/* crypto/mdc2/mdc2test.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
59#include <stdio.h>
60#include <stdlib.h>
61#include <string.h>
62
63#include "../e_os.h"
64
65#if defined(OPENSSL_NO_DES) && !defined(OPENSSL_NO_MDC2)
66#define OPENSSL_NO_MDC2
67#endif
68
69#ifdef OPENSSL_NO_MDC2
70int main(int argc, char *argv[])
71{
72 printf("No MDC2 support\n");
73 return(0);
74}
75#else
76#include <openssl/evp.h>
77#include <openssl/mdc2.h>
78
79#ifdef CHARSET_EBCDIC
80#include <openssl/ebcdic.h>
81#endif
82
83static unsigned char pad1[16]={
84 0x42,0xE5,0x0C,0xD2,0x24,0xBA,0xCE,0xBA,
85 0x76,0x0B,0xDD,0x2B,0xD4,0x09,0x28,0x1A
86 };
87
88static unsigned char pad2[16]={
89 0x2E,0x46,0x79,0xB5,0xAD,0xD9,0xCA,0x75,
90 0x35,0xD8,0x7A,0xFE,0xAB,0x33,0xBE,0xE2
91 };
92
93int main(int argc, char *argv[])
94 {
95 int ret=0;
96 unsigned char md[MDC2_DIGEST_LENGTH];
97 int i;
98 EVP_MD_CTX c;
99 static char *text="Now is the time for all ";
100
101#ifdef CHARSET_EBCDIC
102 ebcdic2ascii(text,text,strlen(text));
103#endif
104
105 EVP_MD_CTX_init(&c);
106 EVP_DigestInit_ex(&c,EVP_mdc2(), NULL);
107 EVP_DigestUpdate(&c,(unsigned char *)text,strlen(text));
108 EVP_DigestFinal_ex(&c,&(md[0]),NULL);
109
110 if (memcmp(md,pad1,MDC2_DIGEST_LENGTH) != 0)
111 {
112 for (i=0; i<MDC2_DIGEST_LENGTH; i++)
113 printf("%02X",md[i]);
114 printf(" <- generated\n");
115 for (i=0; i<MDC2_DIGEST_LENGTH; i++)
116 printf("%02X",pad1[i]);
117 printf(" <- correct\n");
118 ret=1;
119 }
120 else
121 printf("pad1 - ok\n");
122
123 EVP_DigestInit_ex(&c,EVP_mdc2(), NULL);
124 /* FIXME: use a ctl function? */
125 ((MDC2_CTX *)c.md_data)->pad_type=2;
126 EVP_DigestUpdate(&c,(unsigned char *)text,strlen(text));
127 EVP_DigestFinal_ex(&c,&(md[0]),NULL);
128
129 if (memcmp(md,pad2,MDC2_DIGEST_LENGTH) != 0)
130 {
131 for (i=0; i<MDC2_DIGEST_LENGTH; i++)
132 printf("%02X",md[i]);
133 printf(" <- generated\n");
134 for (i=0; i<MDC2_DIGEST_LENGTH; i++)
135 printf("%02X",pad2[i]);
136 printf(" <- correct\n");
137 ret=1;
138 }
139 else
140 printf("pad2 - ok\n");
141
142 EVP_MD_CTX_cleanup(&c);
143#ifdef OPENSSL_SYS_NETWARE
144 if (ret) printf("ERROR: %d\n", ret);
145#endif
146 EXIT(ret);
147 return(ret);
148 }
149#endif
diff --git a/src/lib/libcrypto/mem.c b/src/lib/libcrypto/mem.c
new file mode 100644
index 0000000000..24ccf729ca
--- /dev/null
+++ b/src/lib/libcrypto/mem.c
@@ -0,0 +1,421 @@
1/* crypto/mem.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
59#include <stdio.h>
60#include <stdlib.h>
61#include <openssl/crypto.h>
62#include "cryptlib.h"
63
64
65static int allow_customize = 1; /* we provide flexible functions for */
66static int allow_customize_debug = 1;/* exchanging memory-related functions at
67 * run-time, but this must be done
68 * before any blocks are actually
69 * allocated; or we'll run into huge
70 * problems when malloc/free pairs
71 * don't match etc. */
72
73
74
75/* the following pointers may be changed as long as 'allow_customize' is set */
76
77static void *(*malloc_func)(size_t) = malloc;
78static void *default_malloc_ex(size_t num, const char *file, int line)
79 { return malloc_func(num); }
80static void *(*malloc_ex_func)(size_t, const char *file, int line)
81 = default_malloc_ex;
82
83static void *(*realloc_func)(void *, size_t)= realloc;
84static void *default_realloc_ex(void *str, size_t num,
85 const char *file, int line)
86 { return realloc_func(str,num); }
87static void *(*realloc_ex_func)(void *, size_t, const char *file, int line)
88 = default_realloc_ex;
89
90static void (*free_func)(void *) = free;
91
92static void *(*malloc_locked_func)(size_t) = malloc;
93static void *default_malloc_locked_ex(size_t num, const char *file, int line)
94 { return malloc_locked_func(num); }
95static void *(*malloc_locked_ex_func)(size_t, const char *file, int line)
96 = default_malloc_locked_ex;
97
98static void (*free_locked_func)(void *) = free;
99
100
101
102/* may be changed as long as 'allow_customize_debug' is set */
103/* XXX use correct function pointer types */
104#ifdef CRYPTO_MDEBUG
105/* use default functions from mem_dbg.c */
106static void (*malloc_debug_func)(void *,int,const char *,int,int)
107 = CRYPTO_dbg_malloc;
108static void (*realloc_debug_func)(void *,void *,int,const char *,int,int)
109 = CRYPTO_dbg_realloc;
110static void (*free_debug_func)(void *,int) = CRYPTO_dbg_free;
111static void (*set_debug_options_func)(long) = CRYPTO_dbg_set_options;
112static long (*get_debug_options_func)(void) = CRYPTO_dbg_get_options;
113#else
114/* applications can use CRYPTO_malloc_debug_init() to select above case
115 * at run-time */
116static void (*malloc_debug_func)(void *,int,const char *,int,int) = NULL;
117static void (*realloc_debug_func)(void *,void *,int,const char *,int,int)
118 = NULL;
119static void (*free_debug_func)(void *,int) = NULL;
120static void (*set_debug_options_func)(long) = NULL;
121static long (*get_debug_options_func)(void) = NULL;
122#endif
123
124
125int CRYPTO_set_mem_functions(void *(*m)(size_t), void *(*r)(void *, size_t),
126 void (*f)(void *))
127 {
128 OPENSSL_init();
129 if (!allow_customize)
130 return 0;
131 if ((m == 0) || (r == 0) || (f == 0))
132 return 0;
133 malloc_func=m; malloc_ex_func=default_malloc_ex;
134 realloc_func=r; realloc_ex_func=default_realloc_ex;
135 free_func=f;
136 malloc_locked_func=m; malloc_locked_ex_func=default_malloc_locked_ex;
137 free_locked_func=f;
138 return 1;
139 }
140
141int CRYPTO_set_mem_ex_functions(
142 void *(*m)(size_t,const char *,int),
143 void *(*r)(void *, size_t,const char *,int),
144 void (*f)(void *))
145 {
146 if (!allow_customize)
147 return 0;
148 if ((m == 0) || (r == 0) || (f == 0))
149 return 0;
150 malloc_func=0; malloc_ex_func=m;
151 realloc_func=0; realloc_ex_func=r;
152 free_func=f;
153 malloc_locked_func=0; malloc_locked_ex_func=m;
154 free_locked_func=f;
155 return 1;
156 }
157
158int CRYPTO_set_locked_mem_functions(void *(*m)(size_t), void (*f)(void *))
159 {
160 if (!allow_customize)
161 return 0;
162 if ((m == NULL) || (f == NULL))
163 return 0;
164 malloc_locked_func=m; malloc_locked_ex_func=default_malloc_locked_ex;
165 free_locked_func=f;
166 return 1;
167 }
168
169int CRYPTO_set_locked_mem_ex_functions(
170 void *(*m)(size_t,const char *,int),
171 void (*f)(void *))
172 {
173 if (!allow_customize)
174 return 0;
175 if ((m == NULL) || (f == NULL))
176 return 0;
177 malloc_locked_func=0; malloc_locked_ex_func=m;
178 free_func=f;
179 return 1;
180 }
181
182int CRYPTO_set_mem_debug_functions(void (*m)(void *,int,const char *,int,int),
183 void (*r)(void *,void *,int,const char *,int,int),
184 void (*f)(void *,int),
185 void (*so)(long),
186 long (*go)(void))
187 {
188 if (!allow_customize_debug)
189 return 0;
190 OPENSSL_init();
191 malloc_debug_func=m;
192 realloc_debug_func=r;
193 free_debug_func=f;
194 set_debug_options_func=so;
195 get_debug_options_func=go;
196 return 1;
197 }
198
199
200void CRYPTO_get_mem_functions(void *(**m)(size_t), void *(**r)(void *, size_t),
201 void (**f)(void *))
202 {
203 if (m != NULL) *m = (malloc_ex_func == default_malloc_ex) ?
204 malloc_func : 0;
205 if (r != NULL) *r = (realloc_ex_func == default_realloc_ex) ?
206 realloc_func : 0;
207 if (f != NULL) *f=free_func;
208 }
209
210void CRYPTO_get_mem_ex_functions(
211 void *(**m)(size_t,const char *,int),
212 void *(**r)(void *, size_t,const char *,int),
213 void (**f)(void *))
214 {
215 if (m != NULL) *m = (malloc_ex_func != default_malloc_ex) ?
216 malloc_ex_func : 0;
217 if (r != NULL) *r = (realloc_ex_func != default_realloc_ex) ?
218 realloc_ex_func : 0;
219 if (f != NULL) *f=free_func;
220 }
221
222void CRYPTO_get_locked_mem_functions(void *(**m)(size_t), void (**f)(void *))
223 {
224 if (m != NULL) *m = (malloc_locked_ex_func == default_malloc_locked_ex) ?
225 malloc_locked_func : 0;
226 if (f != NULL) *f=free_locked_func;
227 }
228
229void CRYPTO_get_locked_mem_ex_functions(
230 void *(**m)(size_t,const char *,int),
231 void (**f)(void *))
232 {
233 if (m != NULL) *m = (malloc_locked_ex_func != default_malloc_locked_ex) ?
234 malloc_locked_ex_func : 0;
235 if (f != NULL) *f=free_locked_func;
236 }
237
238void CRYPTO_get_mem_debug_functions(void (**m)(void *,int,const char *,int,int),
239 void (**r)(void *,void *,int,const char *,int,int),
240 void (**f)(void *,int),
241 void (**so)(long),
242 long (**go)(void))
243 {
244 if (m != NULL) *m=malloc_debug_func;
245 if (r != NULL) *r=realloc_debug_func;
246 if (f != NULL) *f=free_debug_func;
247 if (so != NULL) *so=set_debug_options_func;
248 if (go != NULL) *go=get_debug_options_func;
249 }
250
251
252void *CRYPTO_malloc_locked(int num, const char *file, int line)
253 {
254 void *ret = NULL;
255
256 if (num <= 0) return NULL;
257
258 allow_customize = 0;
259 if (malloc_debug_func != NULL)
260 {
261 allow_customize_debug = 0;
262 malloc_debug_func(NULL, num, file, line, 0);
263 }
264 ret = malloc_locked_ex_func(num,file,line);
265#ifdef LEVITTE_DEBUG_MEM
266 fprintf(stderr, "LEVITTE_DEBUG_MEM: > 0x%p (%d)\n", ret, num);
267#endif
268 if (malloc_debug_func != NULL)
269 malloc_debug_func(ret, num, file, line, 1);
270
271#ifndef OPENSSL_CPUID_OBJ
272 /* Create a dependency on the value of 'cleanse_ctr' so our memory
273 * sanitisation function can't be optimised out. NB: We only do
274 * this for >2Kb so the overhead doesn't bother us. */
275 if(ret && (num > 2048))
276 { extern unsigned char cleanse_ctr;
277 ((unsigned char *)ret)[0] = cleanse_ctr;
278 }
279#endif
280
281 return ret;
282 }
283
284void CRYPTO_free_locked(void *str)
285 {
286 if (free_debug_func != NULL)
287 free_debug_func(str, 0);
288#ifdef LEVITTE_DEBUG_MEM
289 fprintf(stderr, "LEVITTE_DEBUG_MEM: < 0x%p\n", str);
290#endif
291 free_locked_func(str);
292 if (free_debug_func != NULL)
293 free_debug_func(NULL, 1);
294 }
295
296void *CRYPTO_malloc(int num, const char *file, int line)
297 {
298 void *ret = NULL;
299
300 if (num <= 0) return NULL;
301
302 allow_customize = 0;
303 if (malloc_debug_func != NULL)
304 {
305 allow_customize_debug = 0;
306 malloc_debug_func(NULL, num, file, line, 0);
307 }
308 ret = malloc_ex_func(num,file,line);
309#ifdef LEVITTE_DEBUG_MEM
310 fprintf(stderr, "LEVITTE_DEBUG_MEM: > 0x%p (%d)\n", ret, num);
311#endif
312 if (malloc_debug_func != NULL)
313 malloc_debug_func(ret, num, file, line, 1);
314
315#ifndef OPENSSL_CPUID_OBJ
316 /* Create a dependency on the value of 'cleanse_ctr' so our memory
317 * sanitisation function can't be optimised out. NB: We only do
318 * this for >2Kb so the overhead doesn't bother us. */
319 if(ret && (num > 2048))
320 { extern unsigned char cleanse_ctr;
321 ((unsigned char *)ret)[0] = cleanse_ctr;
322 }
323#endif
324
325 return ret;
326 }
327char *CRYPTO_strdup(const char *str, const char *file, int line)
328 {
329 size_t len = strlen(str)+1;
330 char *ret = CRYPTO_malloc(len, file, line);
331
332 memcpy(ret, str, len);
333 return ret;
334 }
335
336void *CRYPTO_realloc(void *str, int num, const char *file, int line)
337 {
338 void *ret = NULL;
339
340 if (str == NULL)
341 return CRYPTO_malloc(num, file, line);
342
343 if (num <= 0) return NULL;
344
345 if (realloc_debug_func != NULL)
346 realloc_debug_func(str, NULL, num, file, line, 0);
347 ret = realloc_ex_func(str,num,file,line);
348#ifdef LEVITTE_DEBUG_MEM
349 fprintf(stderr, "LEVITTE_DEBUG_MEM: | 0x%p -> 0x%p (%d)\n", str, ret, num);
350#endif
351 if (realloc_debug_func != NULL)
352 realloc_debug_func(str, ret, num, file, line, 1);
353
354 return ret;
355 }
356
357void *CRYPTO_realloc_clean(void *str, int old_len, int num, const char *file,
358 int line)
359 {
360 void *ret = NULL;
361
362 if (str == NULL)
363 return CRYPTO_malloc(num, file, line);
364
365 if (num <= 0) return NULL;
366
367 /* We don't support shrinking the buffer. Note the memcpy that copies
368 * |old_len| bytes to the new buffer, below. */
369 if (num < old_len) return NULL;
370
371 if (realloc_debug_func != NULL)
372 realloc_debug_func(str, NULL, num, file, line, 0);
373 ret=malloc_ex_func(num,file,line);
374 if(ret)
375 {
376 memcpy(ret,str,old_len);
377 OPENSSL_cleanse(str,old_len);
378 free_func(str);
379 }
380#ifdef LEVITTE_DEBUG_MEM
381 fprintf(stderr,
382 "LEVITTE_DEBUG_MEM: | 0x%p -> 0x%p (%d)\n",
383 str, ret, num);
384#endif
385 if (realloc_debug_func != NULL)
386 realloc_debug_func(str, ret, num, file, line, 1);
387
388 return ret;
389 }
390
391void CRYPTO_free(void *str)
392 {
393 if (free_debug_func != NULL)
394 free_debug_func(str, 0);
395#ifdef LEVITTE_DEBUG_MEM
396 fprintf(stderr, "LEVITTE_DEBUG_MEM: < 0x%p\n", str);
397#endif
398 free_func(str);
399 if (free_debug_func != NULL)
400 free_debug_func(NULL, 1);
401 }
402
403void *CRYPTO_remalloc(void *a, int num, const char *file, int line)
404 {
405 if (a != NULL) OPENSSL_free(a);
406 a=(char *)OPENSSL_malloc(num);
407 return(a);
408 }
409
410void CRYPTO_set_mem_debug_options(long bits)
411 {
412 if (set_debug_options_func != NULL)
413 set_debug_options_func(bits);
414 }
415
416long CRYPTO_get_mem_debug_options(void)
417 {
418 if (get_debug_options_func != NULL)
419 return get_debug_options_func();
420 return 0;
421 }
diff --git a/src/lib/libcrypto/modes/Makefile b/src/lib/libcrypto/modes/Makefile
new file mode 100644
index 0000000000..3d8bafd571
--- /dev/null
+++ b/src/lib/libcrypto/modes/Makefile
@@ -0,0 +1,144 @@
1#
2# OpenSSL/crypto/modes/Makefile
3#
4
5DIR= modes
6TOP= ../..
7CC= cc
8INCLUDES= -I.. -I$(TOP) -I../../include
9CFLAG=-g
10MAKEFILE= Makefile
11AR= ar r
12
13MODES_ASM_OBJ=
14
15CFLAGS= $(INCLUDES) $(CFLAG)
16ASFLAGS= $(INCLUDES) $(ASFLAG)
17AFLAGS= $(ASFLAGS)
18
19GENERAL=Makefile
20TEST=
21APPS=
22
23LIB=$(TOP)/libcrypto.a
24LIBSRC= cbc128.c ctr128.c cts128.c cfb128.c ofb128.c gcm128.c \
25 ccm128.c xts128.c
26LIBOBJ= cbc128.o ctr128.o cts128.o cfb128.o ofb128.o gcm128.o \
27 ccm128.o xts128.o $(MODES_ASM_OBJ)
28
29SRC= $(LIBSRC)
30
31#EXHEADER= store.h str_compat.h
32EXHEADER= modes.h
33HEADER= modes_lcl.h $(EXHEADER)
34
35ALL= $(GENERAL) $(SRC) $(HEADER)
36
37top:
38 (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all)
39
40all: lib
41
42lib: $(LIBOBJ)
43 $(AR) $(LIB) $(LIBOBJ)
44 $(RANLIB) $(LIB) || echo Never mind.
45 @touch lib
46
47ghash-ia64.s: asm/ghash-ia64.pl
48 $(PERL) asm/ghash-ia64.pl $@ $(CFLAGS)
49ghash-x86.s: asm/ghash-x86.pl
50 $(PERL) asm/ghash-x86.pl $(PERLASM_SCHEME) $(CFLAGS) $(PROCESSOR) > $@
51ghash-x86_64.s: asm/ghash-x86_64.pl
52 $(PERL) asm/ghash-x86_64.pl $(PERLASM_SCHEME) > $@
53ghash-sparcv9.s: asm/ghash-sparcv9.pl
54 $(PERL) asm/ghash-sparcv9.pl $@ $(CFLAGS)
55ghash-alpha.s: asm/ghash-alpha.pl
56 (preproc=/tmp/$$$$.$@; trap "rm $$preproc" INT; \
57 $(PERL) asm/ghash-alpha.pl > $$preproc && \
58 $(CC) -E $$preproc > $@ && rm $$preproc)
59
60ghash-parisc.s: asm/ghash-parisc.pl
61 $(PERL) asm/ghash-parisc.pl $(PERLASM_SCHEME) $@
62
63# GNU make "catch all"
64ghash-%.S: asm/ghash-%.pl; $(PERL) $< $(PERLASM_SCHEME) $@
65
66ghash-armv4.o: ghash-armv4.S
67
68files:
69 $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
70
71links:
72 @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
73 @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
74 @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
75
76install:
77 @[ -n "$(INSTALLTOP)" ] # should be set by top Makefile...
78 @headerlist="$(EXHEADER)"; for i in $$headerlist; \
79 do \
80 (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
81 chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
82 done;
83
84tags:
85 ctags $(SRC)
86
87tests:
88
89lint:
90 lint -DLINT $(INCLUDES) $(SRC)>fluff
91
92depend:
93 @[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile...
94 $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
95
96dclean:
97 $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
98 mv -f Makefile.new $(MAKEFILE)
99
100clean:
101 rm -f *.s *.o */*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
102
103# DO NOT DELETE THIS LINE -- make depend depends on it.
104
105cbc128.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
106cbc128.o: ../../include/openssl/modes.h ../../include/openssl/opensslconf.h
107cbc128.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
108cbc128.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
109cbc128.o: ../../include/openssl/symhacks.h cbc128.c modes_lcl.h
110ccm128.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
111ccm128.o: ../../include/openssl/modes.h ../../include/openssl/opensslconf.h
112ccm128.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
113ccm128.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
114ccm128.o: ../../include/openssl/symhacks.h ccm128.c modes_lcl.h
115cfb128.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
116cfb128.o: ../../include/openssl/modes.h ../../include/openssl/opensslconf.h
117cfb128.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
118cfb128.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
119cfb128.o: ../../include/openssl/symhacks.h cfb128.c modes_lcl.h
120ctr128.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
121ctr128.o: ../../include/openssl/modes.h ../../include/openssl/opensslconf.h
122ctr128.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
123ctr128.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
124ctr128.o: ../../include/openssl/symhacks.h ctr128.c modes_lcl.h
125cts128.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
126cts128.o: ../../include/openssl/modes.h ../../include/openssl/opensslconf.h
127cts128.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
128cts128.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
129cts128.o: ../../include/openssl/symhacks.h cts128.c modes_lcl.h
130gcm128.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
131gcm128.o: ../../include/openssl/modes.h ../../include/openssl/opensslconf.h
132gcm128.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
133gcm128.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
134gcm128.o: ../../include/openssl/symhacks.h gcm128.c modes_lcl.h
135ofb128.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
136ofb128.o: ../../include/openssl/modes.h ../../include/openssl/opensslconf.h
137ofb128.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
138ofb128.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
139ofb128.o: ../../include/openssl/symhacks.h modes_lcl.h ofb128.c
140xts128.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
141xts128.o: ../../include/openssl/modes.h ../../include/openssl/opensslconf.h
142xts128.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
143xts128.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
144xts128.o: ../../include/openssl/symhacks.h modes_lcl.h xts128.c
diff --git a/src/lib/libcrypto/o_dir.c b/src/lib/libcrypto/o_dir.c
new file mode 100644
index 0000000000..42891ea459
--- /dev/null
+++ b/src/lib/libcrypto/o_dir.c
@@ -0,0 +1,83 @@
1/* crypto/o_dir.c -*- mode:C; c-file-style: "eay" -*- */
2/* Written by Richard Levitte (richard@levitte.org) for the OpenSSL
3 * project 2004.
4 */
5/* ====================================================================
6 * Copyright (c) 2004 The OpenSSL Project. All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 *
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 *
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in
17 * the documentation and/or other materials provided with the
18 * distribution.
19 *
20 * 3. All advertising materials mentioning features or use of this
21 * software must display the following acknowledgment:
22 * "This product includes software developed by the OpenSSL Project
23 * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
24 *
25 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
26 * endorse or promote products derived from this software without
27 * prior written permission. For written permission, please contact
28 * openssl-core@openssl.org.
29 *
30 * 5. Products derived from this software may not be called "OpenSSL"
31 * nor may "OpenSSL" appear in their names without prior written
32 * permission of the OpenSSL Project.
33 *
34 * 6. Redistributions of any form whatsoever must retain the following
35 * acknowledgment:
36 * "This product includes software developed by the OpenSSL Project
37 * for use in the OpenSSL Toolkit (http://www.openssl.org/)"
38 *
39 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
40 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
41 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
42 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
43 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
44 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
45 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
46 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
47 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
48 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
49 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50 * OF THE POSSIBILITY OF SUCH DAMAGE.
51 * ====================================================================
52 *
53 * This product includes cryptographic software written by Eric Young
54 * (eay@cryptsoft.com). This product includes software written by Tim
55 * Hudson (tjh@cryptsoft.com).
56 *
57 */
58
59#include <errno.h>
60#include <e_os.h>
61
62/* The routines really come from the Levitte Programming, so to make
63 life simple, let's just use the raw files and hack the symbols to
64 fit our namespace. */
65#define LP_DIR_CTX OPENSSL_DIR_CTX
66#define LP_dir_context_st OPENSSL_dir_context_st
67#define LP_find_file OPENSSL_DIR_read
68#define LP_find_file_end OPENSSL_DIR_end
69
70#include "o_dir.h"
71
72#define LPDIR_H
73#if defined OPENSSL_SYS_UNIX || defined DJGPP
74#include "LPdir_unix.c"
75#elif defined OPENSSL_SYS_VMS
76#include "LPdir_vms.c"
77#elif defined OPENSSL_SYS_WIN32
78#include "LPdir_win32.c"
79#elif defined OPENSSL_SYS_WINCE
80#include "LPdir_wince.c"
81#else
82#include "LPdir_nyi.c"
83#endif
diff --git a/src/lib/libcrypto/o_dir.h b/src/lib/libcrypto/o_dir.h
new file mode 100644
index 0000000000..4b725c0312
--- /dev/null
+++ b/src/lib/libcrypto/o_dir.h
@@ -0,0 +1,53 @@
1/* crypto/o_dir.h -*- mode:C; c-file-style: "eay" -*- */
2/* Copied from Richard Levitte's (richard@levitte.org) LP library. All
3 * symbol names have been changed, with permission from the author.
4 */
5
6/* $LP: LPlib/source/LPdir.h,v 1.1 2004/06/14 08:56:04 _cvs_levitte Exp $ */
7/*
8 * Copyright (c) 2004, Richard Levitte <richard@levitte.org>
9 * All rights reserved.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions and the following disclaimer.
16 * 2. Redistributions in binary form must reproduce the above copyright
17 * notice, this list of conditions and the following disclaimer in the
18 * documentation and/or other materials provided with the distribution.
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 * SUCH DAMAGE.
31 */
32
33
34#ifndef O_DIR_H
35#define O_DIR_H
36
37#ifdef __cplusplus
38extern "C" {
39#endif
40
41 typedef struct OPENSSL_dir_context_st OPENSSL_DIR_CTX;
42
43 /* returns NULL on error or end-of-directory.
44 If it is end-of-directory, errno will be zero */
45 const char *OPENSSL_DIR_read(OPENSSL_DIR_CTX **ctx, const char *directory);
46 /* returns 1 on success, 0 on error */
47 int OPENSSL_DIR_end(OPENSSL_DIR_CTX **ctx);
48
49#ifdef __cplusplus
50}
51#endif
52
53#endif /* LPDIR_H */
diff --git a/src/lib/libcrypto/o_dir_test.c b/src/lib/libcrypto/o_dir_test.c
new file mode 100644
index 0000000000..3d75ecb005
--- /dev/null
+++ b/src/lib/libcrypto/o_dir_test.c
@@ -0,0 +1,70 @@
1/* crypto/o_dir.h -*- mode:C; c-file-style: "eay" -*- */
2/* Copied from Richard Levitte's (richard@levitte.org) LP library. All
3 * symbol names have been changed, with permission from the author.
4 */
5
6/* $LP: LPlib/test/test_dir.c,v 1.1 2004/06/16 22:59:47 _cvs_levitte Exp $ */
7/*
8 * Copyright (c) 2004, Richard Levitte <richard@levitte.org>
9 * All rights reserved.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions and the following disclaimer.
16 * 2. Redistributions in binary form must reproduce the above copyright
17 * notice, this list of conditions and the following disclaimer in the
18 * documentation and/or other materials provided with the distribution.
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 * SUCH DAMAGE.
31 */
32
33#include <stddef.h>
34#include <stdlib.h>
35#include <stdio.h>
36#include <errno.h>
37#include "e_os2.h"
38#include "o_dir.h"
39
40#if defined OPENSSL_SYS_UNIX || defined OPENSSL_SYS_WIN32 || defined OPENSSL_SYS_WINCE
41#define CURRDIR "."
42#elif defined OPENSSL_SYS_VMS
43#define CURRDIR "SYS$DISK:[]"
44#else
45#error "No supported platform defined!"
46#endif
47
48int main()
49{
50 OPENSSL_DIR_CTX *ctx = NULL;
51 const char *result;
52
53 while((result = OPENSSL_DIR_read(&ctx, CURRDIR)) != NULL)
54 {
55 printf("%s\n", result);
56 }
57
58 if (errno)
59 {
60 perror("test_dir");
61 exit(1);
62 }
63
64 if (!OPENSSL_DIR_end(&ctx))
65 {
66 perror("test_dir");
67 exit(2);
68 }
69 exit(0);
70}
diff --git a/src/lib/libcrypto/o_fips.c b/src/lib/libcrypto/o_fips.c
new file mode 100644
index 0000000000..f6d1b21855
--- /dev/null
+++ b/src/lib/libcrypto/o_fips.c
@@ -0,0 +1,96 @@
1/* Written by Stephen henson (steve@openssl.org) for the OpenSSL
2 * project 2011.
3 */
4/* ====================================================================
5 * Copyright (c) 2011 The OpenSSL Project. All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 *
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 *
14 * 2. Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in
16 * the documentation and/or other materials provided with the
17 * distribution.
18 *
19 * 3. All advertising materials mentioning features or use of this
20 * software must display the following acknowledgment:
21 * "This product includes software developed by the OpenSSL Project
22 * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
23 *
24 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
25 * endorse or promote products derived from this software without
26 * prior written permission. For written permission, please contact
27 * openssl-core@openssl.org.
28 *
29 * 5. Products derived from this software may not be called "OpenSSL"
30 * nor may "OpenSSL" appear in their names without prior written
31 * permission of the OpenSSL Project.
32 *
33 * 6. Redistributions of any form whatsoever must retain the following
34 * acknowledgment:
35 * "This product includes software developed by the OpenSSL Project
36 * for use in the OpenSSL Toolkit (http://www.openssl.org/)"
37 *
38 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
39 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
40 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
41 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
42 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
43 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
44 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
45 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
46 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
47 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
48 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49 * OF THE POSSIBILITY OF SUCH DAMAGE.
50 * ====================================================================
51 *
52 * This product includes cryptographic software written by Eric Young
53 * (eay@cryptsoft.com). This product includes software written by Tim
54 * Hudson (tjh@cryptsoft.com).
55 *
56 */
57
58#include "cryptlib.h"
59#ifdef OPENSSL_FIPS
60#include <openssl/fips.h>
61#include <openssl/fips_rand.h>
62#include <openssl/rand.h>
63#endif
64
65int FIPS_mode(void)
66 {
67 OPENSSL_init();
68#ifdef OPENSSL_FIPS
69 return FIPS_module_mode();
70#else
71 return 0;
72#endif
73 }
74
75int FIPS_mode_set(int r)
76 {
77 OPENSSL_init();
78#ifdef OPENSSL_FIPS
79#ifndef FIPS_AUTH_USER_PASS
80#define FIPS_AUTH_USER_PASS "Default FIPS Crypto User Password"
81#endif
82 if (!FIPS_module_mode_set(r, FIPS_AUTH_USER_PASS))
83 return 0;
84 if (r)
85 RAND_set_rand_method(FIPS_rand_get_method());
86 else
87 RAND_set_rand_method(NULL);
88 return 1;
89#else
90 if (r == 0)
91 return 1;
92 CRYPTOerr(CRYPTO_F_FIPS_MODE_SET, CRYPTO_R_FIPS_MODE_NOT_SUPPORTED);
93 return 0;
94#endif
95 }
96
diff --git a/src/lib/libcrypto/o_str.h b/src/lib/libcrypto/o_str.h
new file mode 100644
index 0000000000..dfc98494c6
--- /dev/null
+++ b/src/lib/libcrypto/o_str.h
@@ -0,0 +1,68 @@
1/* crypto/o_str.h -*- mode:C; c-file-style: "eay" -*- */
2/* Written by Richard Levitte (richard@levitte.org) for the OpenSSL
3 * project 2003.
4 */
5/* ====================================================================
6 * Copyright (c) 2003 The OpenSSL Project. All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 *
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 *
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in
17 * the documentation and/or other materials provided with the
18 * distribution.
19 *
20 * 3. All advertising materials mentioning features or use of this
21 * software must display the following acknowledgment:
22 * "This product includes software developed by the OpenSSL Project
23 * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
24 *
25 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
26 * endorse or promote products derived from this software without
27 * prior written permission. For written permission, please contact
28 * licensing@OpenSSL.org.
29 *
30 * 5. Products derived from this software may not be called "OpenSSL"
31 * nor may "OpenSSL" appear in their names without prior written
32 * permission of the OpenSSL Project.
33 *
34 * 6. Redistributions of any form whatsoever must retain the following
35 * acknowledgment:
36 * "This product includes software developed by the OpenSSL Project
37 * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
38 *
39 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
40 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
41 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
42 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
43 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
44 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
45 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
46 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
47 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
48 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
49 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50 * OF THE POSSIBILITY OF SUCH DAMAGE.
51 * ====================================================================
52 *
53 * This product includes cryptographic software written by Eric Young
54 * (eay@cryptsoft.com). This product includes software written by Tim
55 * Hudson (tjh@cryptsoft.com).
56 *
57 */
58
59#ifndef HEADER_O_STR_H
60#define HEADER_O_STR_H
61
62#include <stddef.h> /* to get size_t */
63
64int OPENSSL_strcasecmp(const char *str1, const char *str2);
65int OPENSSL_strncasecmp(const char *str1, const char *str2, size_t n);
66int OPENSSL_memcmp(const void *p1,const void *p2,size_t n);
67
68#endif
diff --git a/src/lib/libcrypto/objects/Makefile b/src/lib/libcrypto/objects/Makefile
new file mode 100644
index 0000000000..a8aedbd422
--- /dev/null
+++ b/src/lib/libcrypto/objects/Makefile
@@ -0,0 +1,130 @@
1#
2# OpenSSL/crypto/objects/Makefile
3#
4
5DIR= objects
6TOP= ../..
7CC= cc
8INCLUDES= -I.. -I$(TOP) -I../../include
9CFLAG=-g
10MAKEFILE= Makefile
11AR= ar r
12PERL= perl
13
14CFLAGS= $(INCLUDES) $(CFLAG)
15
16GENERAL=Makefile README
17TEST=
18APPS=
19
20LIB=$(TOP)/libcrypto.a
21LIBSRC= o_names.c obj_dat.c obj_lib.c obj_err.c obj_xref.c
22LIBOBJ= o_names.o obj_dat.o obj_lib.o obj_err.o obj_xref.o
23
24SRC= $(LIBSRC)
25
26EXHEADER= objects.h obj_mac.h
27HEADER= $(EXHEADER) obj_dat.h obj_xref.h
28
29ALL= $(GENERAL) $(SRC) $(HEADER)
30
31top:
32 (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all)
33
34all: obj_dat.h obj_xref.h lib
35
36lib: $(LIBOBJ)
37 $(AR) $(LIB) $(LIBOBJ)
38 $(RANLIB) $(LIB) || echo Never mind.
39 @touch lib
40
41obj_dat.h: obj_dat.pl obj_mac.h
42 $(PERL) obj_dat.pl obj_mac.h obj_dat.h
43
44# objects.pl both reads and writes obj_mac.num
45obj_mac.h: objects.pl objects.txt obj_mac.num
46 $(PERL) objects.pl objects.txt obj_mac.num obj_mac.h
47 @sleep 1; touch obj_mac.h; sleep 1
48
49obj_xref.h: objxref.pl obj_xref.txt obj_mac.num
50 $(PERL) objxref.pl obj_mac.num obj_xref.txt > obj_xref.h
51 @sleep 1; touch obj_xref.h; sleep 1
52
53files:
54 $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
55
56links:
57 @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
58 @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
59 @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
60
61install:
62 @[ -n "$(INSTALLTOP)" ] # should be set by top Makefile...
63 @headerlist="$(EXHEADER)"; for i in $$headerlist ; \
64 do \
65 (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
66 chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
67 done;
68
69tags:
70 ctags $(SRC)
71
72tests:
73
74lint:
75 lint -DLINT $(INCLUDES) $(SRC)>fluff
76
77depend:
78 @[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile...
79 $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
80
81dclean:
82 $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
83 mv -f Makefile.new $(MAKEFILE)
84
85clean:
86 rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
87
88# DO NOT DELETE THIS LINE -- make depend depends on it.
89
90o_names.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
91o_names.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
92o_names.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
93o_names.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
94o_names.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
95o_names.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
96o_names.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
97o_names.o: o_names.c
98obj_dat.o: ../../e_os.h ../../include/openssl/asn1.h
99obj_dat.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
100obj_dat.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
101obj_dat.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
102obj_dat.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
103obj_dat.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
104obj_dat.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
105obj_dat.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
106obj_dat.o: ../../include/openssl/symhacks.h ../cryptlib.h obj_dat.c obj_dat.h
107obj_err.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
108obj_err.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
109obj_err.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
110obj_err.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
111obj_err.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
112obj_err.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
113obj_err.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
114obj_err.o: obj_err.c
115obj_lib.o: ../../e_os.h ../../include/openssl/asn1.h
116obj_lib.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
117obj_lib.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
118obj_lib.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
119obj_lib.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
120obj_lib.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
121obj_lib.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
122obj_lib.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
123obj_lib.o: ../cryptlib.h obj_lib.c
124obj_xref.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
125obj_xref.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
126obj_xref.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
127obj_xref.o: ../../include/openssl/opensslconf.h
128obj_xref.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
129obj_xref.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
130obj_xref.o: ../../include/openssl/symhacks.h obj_xref.c obj_xref.h
diff --git a/src/lib/libcrypto/objects/o_names.c b/src/lib/libcrypto/objects/o_names.c
index 4a548c2ed4..84380a96a9 100644
--- a/src/lib/libcrypto/objects/o_names.c
+++ b/src/lib/libcrypto/objects/o_names.c
@@ -73,7 +73,7 @@ int OBJ_NAME_new_index(unsigned long (*hash_func)(const char *),
73 name_funcs_stack=sk_NAME_FUNCS_new_null(); 73 name_funcs_stack=sk_NAME_FUNCS_new_null();
74 MemCheck_on(); 74 MemCheck_on();
75 } 75 }
76 if (name_funcs_stack == NULL) 76 if ((name_funcs_stack == NULL))
77 { 77 {
78 /* ERROR */ 78 /* ERROR */
79 return(0); 79 return(0);
diff --git a/src/lib/libcrypto/objects/objects.pl b/src/lib/libcrypto/objects/objects.pl
index 15c00bbd52..d2bf659d88 100644
--- a/src/lib/libcrypto/objects/objects.pl
+++ b/src/lib/libcrypto/objects/objects.pl
@@ -110,12 +110,13 @@ print STDERR "Added OID $Cname\n";
110 } 110 }
111close IN; 111close IN;
112 112
113open (NUMOUT,">$ARGV[1]") || die "Can't open output file $ARGV[1]"; 113#XXX don't modify input files
114foreach (sort { $a <=> $b } keys %nidn) 114#open (NUMOUT,">$ARGV[1]") || die "Can't open output file $ARGV[1]";
115 { 115#foreach (sort { $a <=> $b } keys %nidn)
116 print NUMOUT $nidn{$_},"\t\t",$_,"\n"; 116# {
117 } 117# print NUMOUT $nidn{$_},"\t\t",$_,"\n";
118close NUMOUT; 118# }
119#close NUMOUT;
119 120
120open (OUT,">$ARGV[2]") || die "Can't open output file $ARGV[2]"; 121open (OUT,">$ARGV[2]") || die "Can't open output file $ARGV[2]";
121print OUT <<'EOF'; 122print OUT <<'EOF';
diff --git a/src/lib/libcrypto/ocsp/Makefile b/src/lib/libcrypto/ocsp/Makefile
new file mode 100644
index 0000000000..60c414cf4d
--- /dev/null
+++ b/src/lib/libcrypto/ocsp/Makefile
@@ -0,0 +1,213 @@
1#
2# OpenSSL/ocsp/Makefile
3#
4
5DIR= ocsp
6TOP= ../..
7CC= cc
8INCLUDES= -I.. -I$(TOP) -I../../include
9CFLAG=-g
10MAKEFILE= Makefile
11AR= ar r
12
13CFLAGS= $(INCLUDES) $(CFLAG)
14
15GENERAL=Makefile README
16TEST=
17APPS=
18
19LIB=$(TOP)/libcrypto.a
20LIBSRC= ocsp_asn.c ocsp_ext.c ocsp_ht.c ocsp_lib.c ocsp_cl.c \
21 ocsp_srv.c ocsp_prn.c ocsp_vfy.c ocsp_err.c
22
23LIBOBJ= ocsp_asn.o ocsp_ext.o ocsp_ht.o ocsp_lib.o ocsp_cl.o \
24 ocsp_srv.o ocsp_prn.o ocsp_vfy.o ocsp_err.o
25
26SRC= $(LIBSRC)
27
28EXHEADER= ocsp.h
29HEADER= $(EXHEADER)
30
31ALL= $(GENERAL) $(SRC) $(HEADER)
32
33top:
34 (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all)
35
36all: lib
37
38lib: $(LIBOBJ)
39 $(AR) $(LIB) $(LIBOBJ)
40 $(RANLIB) $(LIB) || echo Never mind.
41 @touch lib
42
43files:
44 $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
45
46links:
47 @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
48 @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
49 @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
50
51install:
52 @[ -n "$(INSTALLTOP)" ] # should be set by top Makefile...
53 @headerlist="$(EXHEADER)"; for i in $$headerlist ; \
54 do \
55 (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
56 chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
57 done;
58
59tags:
60 ctags $(SRC)
61
62tests:
63
64lint:
65 lint -DLINT $(INCLUDES) $(SRC)>fluff
66
67depend:
68 @[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile...
69 $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(LIBSRC)
70
71dclean:
72 $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
73 mv -f Makefile.new $(MAKEFILE)
74
75clean:
76 rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
77
78# DO NOT DELETE THIS LINE -- make depend depends on it.
79
80ocsp_asn.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h
81ocsp_asn.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
82ocsp_asn.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
83ocsp_asn.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
84ocsp_asn.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
85ocsp_asn.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
86ocsp_asn.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
87ocsp_asn.o: ../../include/openssl/ocsp.h ../../include/openssl/opensslconf.h
88ocsp_asn.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
89ocsp_asn.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
90ocsp_asn.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
91ocsp_asn.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
92ocsp_asn.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
93ocsp_asn.o: ocsp_asn.c
94ocsp_cl.o: ../../e_os.h ../../include/openssl/asn1.h
95ocsp_cl.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
96ocsp_cl.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
97ocsp_cl.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
98ocsp_cl.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
99ocsp_cl.o: ../../include/openssl/err.h ../../include/openssl/evp.h
100ocsp_cl.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
101ocsp_cl.o: ../../include/openssl/objects.h ../../include/openssl/ocsp.h
102ocsp_cl.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
103ocsp_cl.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pem.h
104ocsp_cl.o: ../../include/openssl/pem2.h ../../include/openssl/pkcs7.h
105ocsp_cl.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h
106ocsp_cl.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
107ocsp_cl.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
108ocsp_cl.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
109ocsp_cl.o: ../cryptlib.h ocsp_cl.c
110ocsp_err.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
111ocsp_err.o: ../../include/openssl/buffer.h ../../include/openssl/conf.h
112ocsp_err.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
113ocsp_err.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
114ocsp_err.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
115ocsp_err.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
116ocsp_err.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
117ocsp_err.o: ../../include/openssl/ocsp.h ../../include/openssl/opensslconf.h
118ocsp_err.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
119ocsp_err.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
120ocsp_err.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
121ocsp_err.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
122ocsp_err.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
123ocsp_err.o: ocsp_err.c
124ocsp_ext.o: ../../e_os.h ../../include/openssl/asn1.h
125ocsp_ext.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
126ocsp_ext.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
127ocsp_ext.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
128ocsp_ext.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
129ocsp_ext.o: ../../include/openssl/err.h ../../include/openssl/evp.h
130ocsp_ext.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
131ocsp_ext.o: ../../include/openssl/objects.h ../../include/openssl/ocsp.h
132ocsp_ext.o: ../../include/openssl/opensslconf.h
133ocsp_ext.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
134ocsp_ext.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h
135ocsp_ext.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
136ocsp_ext.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
137ocsp_ext.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
138ocsp_ext.o: ../../include/openssl/x509v3.h ../cryptlib.h ocsp_ext.c
139ocsp_ht.o: ../../e_os.h ../../include/openssl/asn1.h
140ocsp_ht.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
141ocsp_ht.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
142ocsp_ht.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
143ocsp_ht.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
144ocsp_ht.o: ../../include/openssl/err.h ../../include/openssl/evp.h
145ocsp_ht.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
146ocsp_ht.o: ../../include/openssl/objects.h ../../include/openssl/ocsp.h
147ocsp_ht.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
148ocsp_ht.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
149ocsp_ht.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
150ocsp_ht.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
151ocsp_ht.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
152ocsp_ht.o: ../../include/openssl/x509v3.h ocsp_ht.c
153ocsp_lib.o: ../../e_os.h ../../include/openssl/asn1.h
154ocsp_lib.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
155ocsp_lib.o: ../../include/openssl/buffer.h ../../include/openssl/conf.h
156ocsp_lib.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
157ocsp_lib.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
158ocsp_lib.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
159ocsp_lib.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
160ocsp_lib.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
161ocsp_lib.o: ../../include/openssl/ocsp.h ../../include/openssl/opensslconf.h
162ocsp_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
163ocsp_lib.o: ../../include/openssl/pem.h ../../include/openssl/pem2.h
164ocsp_lib.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h
165ocsp_lib.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
166ocsp_lib.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
167ocsp_lib.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
168ocsp_lib.o: ../../include/openssl/x509v3.h ../cryptlib.h ocsp_lib.c
169ocsp_prn.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
170ocsp_prn.o: ../../include/openssl/buffer.h ../../include/openssl/conf.h
171ocsp_prn.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
172ocsp_prn.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
173ocsp_prn.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
174ocsp_prn.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
175ocsp_prn.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
176ocsp_prn.o: ../../include/openssl/ocsp.h ../../include/openssl/opensslconf.h
177ocsp_prn.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
178ocsp_prn.o: ../../include/openssl/pem.h ../../include/openssl/pem2.h
179ocsp_prn.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
180ocsp_prn.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
181ocsp_prn.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
182ocsp_prn.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
183ocsp_prn.o: ocsp_prn.c
184ocsp_srv.o: ../../e_os.h ../../include/openssl/asn1.h
185ocsp_srv.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
186ocsp_srv.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
187ocsp_srv.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
188ocsp_srv.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
189ocsp_srv.o: ../../include/openssl/err.h ../../include/openssl/evp.h
190ocsp_srv.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
191ocsp_srv.o: ../../include/openssl/objects.h ../../include/openssl/ocsp.h
192ocsp_srv.o: ../../include/openssl/opensslconf.h
193ocsp_srv.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
194ocsp_srv.o: ../../include/openssl/pem.h ../../include/openssl/pem2.h
195ocsp_srv.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h
196ocsp_srv.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
197ocsp_srv.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
198ocsp_srv.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
199ocsp_srv.o: ../../include/openssl/x509v3.h ../cryptlib.h ocsp_srv.c
200ocsp_vfy.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
201ocsp_vfy.o: ../../include/openssl/buffer.h ../../include/openssl/conf.h
202ocsp_vfy.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
203ocsp_vfy.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
204ocsp_vfy.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
205ocsp_vfy.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
206ocsp_vfy.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
207ocsp_vfy.o: ../../include/openssl/ocsp.h ../../include/openssl/opensslconf.h
208ocsp_vfy.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
209ocsp_vfy.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
210ocsp_vfy.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
211ocsp_vfy.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
212ocsp_vfy.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
213ocsp_vfy.o: ocsp_vfy.c
diff --git a/src/lib/libcrypto/ocsp/ocsp_vfy.c b/src/lib/libcrypto/ocsp/ocsp_vfy.c
index 276718304d..91a45c9133 100644
--- a/src/lib/libcrypto/ocsp/ocsp_vfy.c
+++ b/src/lib/libcrypto/ocsp/ocsp_vfy.c
@@ -111,7 +111,6 @@ int OCSP_basic_verify(OCSP_BASICRESP *bs, STACK_OF(X509) *certs,
111 init_res = X509_STORE_CTX_init(&ctx, st, signer, bs->certs); 111 init_res = X509_STORE_CTX_init(&ctx, st, signer, bs->certs);
112 if(!init_res) 112 if(!init_res)
113 { 113 {
114 ret = -1;
115 OCSPerr(OCSP_F_OCSP_BASIC_VERIFY,ERR_R_X509_LIB); 114 OCSPerr(OCSP_F_OCSP_BASIC_VERIFY,ERR_R_X509_LIB);
116 goto end; 115 goto end;
117 } 116 }
diff --git a/src/lib/libcrypto/openssl.cnf b/src/lib/libcrypto/openssl.cnf
new file mode 100644
index 0000000000..bb97b155b8
--- /dev/null
+++ b/src/lib/libcrypto/openssl.cnf
@@ -0,0 +1,65 @@
1#
2# OpenSSL example configuration file.
3# This is mostly being used for generation of certificate requests.
4#
5
6RANDFILE = /dev/arandom
7
8####################################################################
9[ req ]
10default_bits = 1024
11default_keyfile = privkey.pem
12distinguished_name = req_distinguished_name
13attributes = req_attributes
14
15[ req_distinguished_name ]
16countryName = Country Name (2 letter code)
17#countryName_default = AU
18countryName_min = 2
19countryName_max = 2
20
21stateOrProvinceName = State or Province Name (full name)
22#stateOrProvinceName_default = Some-State
23
24localityName = Locality Name (eg, city)
25
260.organizationName = Organization Name (eg, company)
27#0.organizationName_default = Internet Widgits Pty Ltd
28
29# we can do this but it is not needed normally :-)
30#1.organizationName = Second Organization Name (eg, company)
31#1.organizationName_default = CryptSoft Pty Ltd
32
33organizationalUnitName = Organizational Unit Name (eg, section)
34#organizationalUnitName_default =
35
36commonName = Common Name (eg, fully qualified host name)
37commonName_max = 64
38
39emailAddress = Email Address
40emailAddress_max = 64
41
42[ req_attributes ]
43challengePassword = A challenge password
44challengePassword_min = 4
45challengePassword_max = 20
46
47unstructuredName = An optional company name
48
49[ x509v3_extensions ]
50
51nsCaRevocationUrl = http://www.cryptsoft.com/ca-crl.pem
52nsComment = "This is a comment"
53
54# under ASN.1, the 0 bit would be encoded as 80
55nsCertType = 0x40
56
57#nsBaseUrl
58#nsRevocationUrl
59#nsRenewalUrl
60#nsCaPolicyUrl
61#nsSslServerName
62#nsCertSequence
63#nsCertExt
64#nsDataType
65
diff --git a/src/lib/libcrypto/opensslconf.h.in b/src/lib/libcrypto/opensslconf.h.in
new file mode 100644
index 0000000000..97e3745563
--- /dev/null
+++ b/src/lib/libcrypto/opensslconf.h.in
@@ -0,0 +1,154 @@
1/* crypto/opensslconf.h.in */
2
3/* Generate 80386 code? */
4#undef I386_ONLY
5
6#if !(defined(VMS) || defined(__VMS)) /* VMS uses logical names instead */
7#if defined(HEADER_CRYPTLIB_H) && !defined(OPENSSLDIR)
8#define ENGINESDIR "/usr/local/lib/engines"
9#define OPENSSLDIR "/usr/local/ssl"
10#endif
11#endif
12
13#undef OPENSSL_UNISTD
14#define OPENSSL_UNISTD <unistd.h>
15
16#undef OPENSSL_EXPORT_VAR_AS_FUNCTION
17
18#if defined(HEADER_IDEA_H) && !defined(IDEA_INT)
19#define IDEA_INT unsigned int
20#endif
21
22#if defined(HEADER_MD2_H) && !defined(MD2_INT)
23#define MD2_INT unsigned int
24#endif
25
26#if defined(HEADER_RC2_H) && !defined(RC2_INT)
27/* I need to put in a mod for the alpha - eay */
28#define RC2_INT unsigned int
29#endif
30
31#if defined(HEADER_RC4_H)
32#if !defined(RC4_INT)
33/* using int types make the structure larger but make the code faster
34 * on most boxes I have tested - up to %20 faster. */
35/*
36 * I don't know what does "most" mean, but declaring "int" is a must on:
37 * - Intel P6 because partial register stalls are very expensive;
38 * - elder Alpha because it lacks byte load/store instructions;
39 */
40#define RC4_INT unsigned int
41#endif
42#if !defined(RC4_CHUNK)
43/*
44 * This enables code handling data aligned at natural CPU word
45 * boundary. See crypto/rc4/rc4_enc.c for further details.
46 */
47#undef RC4_CHUNK
48#endif
49#endif
50
51#if (defined(HEADER_NEW_DES_H) || defined(HEADER_DES_H)) && !defined(DES_LONG)
52/* If this is set to 'unsigned int' on a DEC Alpha, this gives about a
53 * %20 speed up (longs are 8 bytes, int's are 4). */
54#ifndef DES_LONG
55#define DES_LONG unsigned long
56#endif
57#endif
58
59#if defined(HEADER_BN_H) && !defined(CONFIG_HEADER_BN_H)
60#define CONFIG_HEADER_BN_H
61#undef BN_LLONG
62
63/* Should we define BN_DIV2W here? */
64
65/* Only one for the following should be defined */
66#undef SIXTY_FOUR_BIT_LONG
67#undef SIXTY_FOUR_BIT
68#define THIRTY_TWO_BIT
69#endif
70
71#if defined(HEADER_RC4_LOCL_H) && !defined(CONFIG_HEADER_RC4_LOCL_H)
72#define CONFIG_HEADER_RC4_LOCL_H
73/* if this is defined data[i] is used instead of *data, this is a %20
74 * speedup on x86 */
75#undef RC4_INDEX
76#endif
77
78#if defined(HEADER_BF_LOCL_H) && !defined(CONFIG_HEADER_BF_LOCL_H)
79#define CONFIG_HEADER_BF_LOCL_H
80#undef BF_PTR
81#endif /* HEADER_BF_LOCL_H */
82
83#if defined(HEADER_DES_LOCL_H) && !defined(CONFIG_HEADER_DES_LOCL_H)
84#define CONFIG_HEADER_DES_LOCL_H
85#ifndef DES_DEFAULT_OPTIONS
86/* the following is tweaked from a config script, that is why it is a
87 * protected undef/define */
88#ifndef DES_PTR
89#undef DES_PTR
90#endif
91
92/* This helps C compiler generate the correct code for multiple functional
93 * units. It reduces register dependancies at the expense of 2 more
94 * registers */
95#ifndef DES_RISC1
96#undef DES_RISC1
97#endif
98
99#ifndef DES_RISC2
100#undef DES_RISC2
101#endif
102
103#if defined(DES_RISC1) && defined(DES_RISC2)
104YOU SHOULD NOT HAVE BOTH DES_RISC1 AND DES_RISC2 DEFINED!!!!!
105#endif
106
107/* Unroll the inner loop, this sometimes helps, sometimes hinders.
108 * Very mucy CPU dependant */
109#ifndef DES_UNROLL
110#undef DES_UNROLL
111#endif
112
113/* These default values were supplied by
114 * Peter Gutman <pgut001@cs.auckland.ac.nz>
115 * They are only used if nothing else has been defined */
116#if !defined(DES_PTR) && !defined(DES_RISC1) && !defined(DES_RISC2) && !defined(DES_UNROLL)
117/* Special defines which change the way the code is built depending on the
118 CPU and OS. For SGI machines you can use _MIPS_SZLONG (32 or 64) to find
119 even newer MIPS CPU's, but at the moment one size fits all for
120 optimization options. Older Sparc's work better with only UNROLL, but
121 there's no way to tell at compile time what it is you're running on */
122
123#if defined( sun ) /* Newer Sparc's */
124# define DES_PTR
125# define DES_RISC1
126# define DES_UNROLL
127#elif defined( __ultrix ) /* Older MIPS */
128# define DES_PTR
129# define DES_RISC2
130# define DES_UNROLL
131#elif defined( __osf1__ ) /* Alpha */
132# define DES_PTR
133# define DES_RISC2
134#elif defined ( _AIX ) /* RS6000 */
135 /* Unknown */
136#elif defined( __hpux ) /* HP-PA */
137 /* Unknown */
138#elif defined( __aux ) /* 68K */
139 /* Unknown */
140#elif defined( __dgux ) /* 88K (but P6 in latest boxes) */
141# define DES_UNROLL
142#elif defined( __sgi ) /* Newer MIPS */
143# define DES_PTR
144# define DES_RISC2
145# define DES_UNROLL
146#elif defined(i386) || defined(__i386__) /* x86 boxes, should be gcc */
147# define DES_PTR
148# define DES_RISC1
149# define DES_UNROLL
150#endif /* Systems-specific speed defines */
151#endif
152
153#endif /* DES_DEFAULT_OPTIONS */
154#endif /* HEADER_DES_LOCL_H */
diff --git a/src/lib/libcrypto/opensslv.h b/src/lib/libcrypto/opensslv.h
index ebe7180723..71be3590af 100644
--- a/src/lib/libcrypto/opensslv.h
+++ b/src/lib/libcrypto/opensslv.h
@@ -25,11 +25,11 @@
25 * (Prior to 0.9.5a beta1, a different scheme was used: MMNNFFRBB for 25 * (Prior to 0.9.5a beta1, a different scheme was used: MMNNFFRBB for
26 * major minor fix final patch/beta) 26 * major minor fix final patch/beta)
27 */ 27 */
28#define OPENSSL_VERSION_NUMBER 0x1000107fL 28#define OPENSSL_VERSION_NUMBER 0x1000103fL
29#ifdef OPENSSL_FIPS 29#ifdef OPENSSL_FIPS
30#define OPENSSL_VERSION_TEXT "OpenSSL 1.0.1g-fips 7 Apr 2014" 30#define OPENSSL_VERSION_TEXT "OpenSSL 1.0.1c-fips 10 May 2012"
31#else 31#else
32#define OPENSSL_VERSION_TEXT "OpenSSL 1.0.1g 7 Apr 2014" 32#define OPENSSL_VERSION_TEXT "OpenSSL 1.0.1c 10 May 2012"
33#endif 33#endif
34#define OPENSSL_VERSION_PTEXT " part of " OPENSSL_VERSION_TEXT 34#define OPENSSL_VERSION_PTEXT " part of " OPENSSL_VERSION_TEXT
35 35
diff --git a/src/lib/libcrypto/pem/Makefile b/src/lib/libcrypto/pem/Makefile
new file mode 100644
index 0000000000..2cc7801529
--- /dev/null
+++ b/src/lib/libcrypto/pem/Makefile
@@ -0,0 +1,258 @@
1#
2# OpenSSL/crypto/pem/Makefile
3#
4
5DIR= pem
6TOP= ../..
7CC= cc
8INCLUDES= -I.. -I$(TOP) -I../../include
9CFLAG=-g
10MAKEFILE= Makefile
11AR= ar r
12
13CFLAGS= $(INCLUDES) $(CFLAG)
14
15GENERAL=Makefile
16TEST=
17APPS=
18
19LIB=$(TOP)/libcrypto.a
20LIBSRC= pem_sign.c pem_seal.c pem_info.c pem_lib.c pem_all.c pem_err.c \
21 pem_x509.c pem_xaux.c pem_oth.c pem_pk8.c pem_pkey.c pvkfmt.c
22
23LIBOBJ= pem_sign.o pem_seal.o pem_info.o pem_lib.o pem_all.o pem_err.o \
24 pem_x509.o pem_xaux.o pem_oth.o pem_pk8.o pem_pkey.o pvkfmt.o
25
26SRC= $(LIBSRC)
27
28EXHEADER= pem.h pem2.h
29HEADER= $(EXHEADER)
30
31ALL= $(GENERAL) $(SRC) $(HEADER)
32
33top:
34 (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all)
35
36all: lib
37
38lib: $(LIBOBJ)
39 $(AR) $(LIB) $(LIBOBJ)
40 $(RANLIB) $(LIB) || echo Never mind.
41 @touch lib
42
43files:
44 $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
45
46links: $(EXHEADER)
47 @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
48 @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
49 @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
50
51install:
52 @[ -n "$(INSTALLTOP)" ] # should be set by top Makefile...
53 @headerlist="$(EXHEADER)"; for i in $$headerlist ; \
54 do \
55 (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
56 chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
57 done;
58
59tags:
60 ctags $(SRC)
61
62tests:
63
64lint:
65 lint -DLINT $(INCLUDES) $(SRC)>fluff
66
67depend:
68 @[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile...
69 $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(LIBSRC)
70
71dclean:
72 $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
73 mv -f Makefile.new $(MAKEFILE)
74
75clean:
76 rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
77
78# DO NOT DELETE THIS LINE -- make depend depends on it.
79
80pem_all.o: ../../e_os.h ../../include/openssl/asn1.h
81pem_all.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
82pem_all.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
83pem_all.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
84pem_all.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
85pem_all.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
86pem_all.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
87pem_all.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
88pem_all.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
89pem_all.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pem.h
90pem_all.o: ../../include/openssl/pem2.h ../../include/openssl/pkcs7.h
91pem_all.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
92pem_all.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
93pem_all.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
94pem_all.o: ../../include/openssl/x509_vfy.h ../cryptlib.h pem_all.c
95pem_err.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
96pem_err.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
97pem_err.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
98pem_err.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
99pem_err.o: ../../include/openssl/err.h ../../include/openssl/evp.h
100pem_err.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
101pem_err.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
102pem_err.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
103pem_err.o: ../../include/openssl/pem.h ../../include/openssl/pem2.h
104pem_err.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
105pem_err.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
106pem_err.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
107pem_err.o: ../../include/openssl/x509_vfy.h pem_err.c
108pem_info.o: ../../e_os.h ../../include/openssl/asn1.h
109pem_info.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
110pem_info.o: ../../include/openssl/crypto.h ../../include/openssl/dsa.h
111pem_info.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
112pem_info.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
113pem_info.o: ../../include/openssl/err.h ../../include/openssl/evp.h
114pem_info.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
115pem_info.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
116pem_info.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
117pem_info.o: ../../include/openssl/pem.h ../../include/openssl/pem2.h
118pem_info.o: ../../include/openssl/pkcs7.h ../../include/openssl/rsa.h
119pem_info.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
120pem_info.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
121pem_info.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
122pem_info.o: ../cryptlib.h pem_info.c
123pem_lib.o: ../../e_os.h ../../include/openssl/asn1.h
124pem_lib.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
125pem_lib.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
126pem_lib.o: ../../include/openssl/des_old.h ../../include/openssl/e_os2.h
127pem_lib.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
128pem_lib.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h
129pem_lib.o: ../../include/openssl/err.h ../../include/openssl/evp.h
130pem_lib.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
131pem_lib.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
132pem_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
133pem_lib.o: ../../include/openssl/pem.h ../../include/openssl/pem2.h
134pem_lib.o: ../../include/openssl/pkcs12.h ../../include/openssl/pkcs7.h
135pem_lib.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h
136pem_lib.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
137pem_lib.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
138pem_lib.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h
139pem_lib.o: ../../include/openssl/x509_vfy.h ../asn1/asn1_locl.h ../cryptlib.h
140pem_lib.o: pem_lib.c
141pem_oth.o: ../../e_os.h ../../include/openssl/asn1.h
142pem_oth.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
143pem_oth.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
144pem_oth.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
145pem_oth.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
146pem_oth.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
147pem_oth.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
148pem_oth.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
149pem_oth.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pem.h
150pem_oth.o: ../../include/openssl/pem2.h ../../include/openssl/pkcs7.h
151pem_oth.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h
152pem_oth.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
153pem_oth.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
154pem_oth.o: ../../include/openssl/x509_vfy.h ../cryptlib.h pem_oth.c
155pem_pk8.o: ../../e_os.h ../../include/openssl/asn1.h
156pem_pk8.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
157pem_pk8.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
158pem_pk8.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
159pem_pk8.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
160pem_pk8.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
161pem_pk8.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
162pem_pk8.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
163pem_pk8.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pem.h
164pem_pk8.o: ../../include/openssl/pem2.h ../../include/openssl/pkcs12.h
165pem_pk8.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h
166pem_pk8.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
167pem_pk8.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
168pem_pk8.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
169pem_pk8.o: ../cryptlib.h pem_pk8.c
170pem_pkey.o: ../../e_os.h ../../include/openssl/asn1.h
171pem_pkey.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
172pem_pkey.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
173pem_pkey.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
174pem_pkey.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h
175pem_pkey.o: ../../include/openssl/err.h ../../include/openssl/evp.h
176pem_pkey.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
177pem_pkey.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
178pem_pkey.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
179pem_pkey.o: ../../include/openssl/pem.h ../../include/openssl/pem2.h
180pem_pkey.o: ../../include/openssl/pkcs12.h ../../include/openssl/pkcs7.h
181pem_pkey.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h
182pem_pkey.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
183pem_pkey.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
184pem_pkey.o: ../../include/openssl/x509_vfy.h ../asn1/asn1_locl.h ../cryptlib.h
185pem_pkey.o: pem_pkey.c
186pem_seal.o: ../../e_os.h ../../include/openssl/asn1.h
187pem_seal.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
188pem_seal.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
189pem_seal.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
190pem_seal.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
191pem_seal.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
192pem_seal.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
193pem_seal.o: ../../include/openssl/opensslconf.h
194pem_seal.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
195pem_seal.o: ../../include/openssl/pem.h ../../include/openssl/pem2.h
196pem_seal.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h
197pem_seal.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
198pem_seal.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
199pem_seal.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
200pem_seal.o: ../../include/openssl/x509_vfy.h ../cryptlib.h pem_seal.c
201pem_sign.o: ../../e_os.h ../../include/openssl/asn1.h
202pem_sign.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
203pem_sign.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
204pem_sign.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
205pem_sign.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
206pem_sign.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
207pem_sign.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
208pem_sign.o: ../../include/openssl/opensslconf.h
209pem_sign.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
210pem_sign.o: ../../include/openssl/pem.h ../../include/openssl/pem2.h
211pem_sign.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h
212pem_sign.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
213pem_sign.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
214pem_sign.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
215pem_sign.o: ../cryptlib.h pem_sign.c
216pem_x509.o: ../../e_os.h ../../include/openssl/asn1.h
217pem_x509.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
218pem_x509.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
219pem_x509.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
220pem_x509.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
221pem_x509.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
222pem_x509.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
223pem_x509.o: ../../include/openssl/opensslconf.h
224pem_x509.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
225pem_x509.o: ../../include/openssl/pem.h ../../include/openssl/pem2.h
226pem_x509.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
227pem_x509.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
228pem_x509.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
229pem_x509.o: ../../include/openssl/x509_vfy.h ../cryptlib.h pem_x509.c
230pem_xaux.o: ../../e_os.h ../../include/openssl/asn1.h
231pem_xaux.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
232pem_xaux.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
233pem_xaux.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
234pem_xaux.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
235pem_xaux.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
236pem_xaux.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
237pem_xaux.o: ../../include/openssl/opensslconf.h
238pem_xaux.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
239pem_xaux.o: ../../include/openssl/pem.h ../../include/openssl/pem2.h
240pem_xaux.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
241pem_xaux.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
242pem_xaux.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
243pem_xaux.o: ../../include/openssl/x509_vfy.h ../cryptlib.h pem_xaux.c
244pvkfmt.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
245pvkfmt.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
246pvkfmt.o: ../../include/openssl/crypto.h ../../include/openssl/dsa.h
247pvkfmt.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
248pvkfmt.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
249pvkfmt.o: ../../include/openssl/err.h ../../include/openssl/evp.h
250pvkfmt.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
251pvkfmt.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
252pvkfmt.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
253pvkfmt.o: ../../include/openssl/pem.h ../../include/openssl/pem2.h
254pvkfmt.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h
255pvkfmt.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
256pvkfmt.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
257pvkfmt.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
258pvkfmt.o: ../../include/openssl/x509_vfy.h ../cryptlib.h pvkfmt.c
diff --git a/src/lib/libcrypto/pem/pem_all.c b/src/lib/libcrypto/pem/pem_all.c
index eac0460e3e..3e7a6093ad 100644
--- a/src/lib/libcrypto/pem/pem_all.c
+++ b/src/lib/libcrypto/pem/pem_all.c
@@ -193,61 +193,7 @@ RSA *PEM_read_RSAPrivateKey(FILE *fp, RSA **rsa, pem_password_cb *cb,
193 193
194#endif 194#endif
195 195
196#ifdef OPENSSL_FIPS
197
198int PEM_write_bio_RSAPrivateKey(BIO *bp, RSA *x, const EVP_CIPHER *enc,
199 unsigned char *kstr, int klen,
200 pem_password_cb *cb, void *u)
201{
202 if (FIPS_mode())
203 {
204 EVP_PKEY *k;
205 int ret;
206 k = EVP_PKEY_new();
207 if (!k)
208 return 0;
209 EVP_PKEY_set1_RSA(k, x);
210
211 ret = PEM_write_bio_PrivateKey(bp, k, enc, kstr, klen, cb, u);
212 EVP_PKEY_free(k);
213 return ret;
214 }
215 else
216 return PEM_ASN1_write_bio((i2d_of_void *)i2d_RSAPrivateKey,
217 PEM_STRING_RSA,bp,x,enc,kstr,klen,cb,u);
218}
219
220#ifndef OPENSSL_NO_FP_API
221int PEM_write_RSAPrivateKey(FILE *fp, RSA *x, const EVP_CIPHER *enc,
222 unsigned char *kstr, int klen,
223 pem_password_cb *cb, void *u)
224{
225 if (FIPS_mode())
226 {
227 EVP_PKEY *k;
228 int ret;
229 k = EVP_PKEY_new();
230 if (!k)
231 return 0;
232
233 EVP_PKEY_set1_RSA(k, x);
234
235 ret = PEM_write_PrivateKey(fp, k, enc, kstr, klen, cb, u);
236 EVP_PKEY_free(k);
237 return ret;
238 }
239 else
240 return PEM_ASN1_write((i2d_of_void *)i2d_RSAPrivateKey,
241 PEM_STRING_RSA,fp,x,enc,kstr,klen,cb,u);
242}
243#endif
244
245#else
246
247IMPLEMENT_PEM_write_cb_const(RSAPrivateKey, RSA, PEM_STRING_RSA, RSAPrivateKey) 196IMPLEMENT_PEM_write_cb_const(RSAPrivateKey, RSA, PEM_STRING_RSA, RSAPrivateKey)
248
249#endif
250
251IMPLEMENT_PEM_rw_const(RSAPublicKey, RSA, PEM_STRING_RSA_PUBLIC, RSAPublicKey) 197IMPLEMENT_PEM_rw_const(RSAPublicKey, RSA, PEM_STRING_RSA_PUBLIC, RSAPublicKey)
252IMPLEMENT_PEM_rw(RSA_PUBKEY, RSA, PEM_STRING_PUBLIC, RSA_PUBKEY) 198IMPLEMENT_PEM_rw(RSA_PUBKEY, RSA, PEM_STRING_PUBLIC, RSA_PUBKEY)
253 199
@@ -277,59 +223,7 @@ DSA *PEM_read_bio_DSAPrivateKey(BIO *bp, DSA **dsa, pem_password_cb *cb,
277 return pkey_get_dsa(pktmp, dsa); /* will free pktmp */ 223 return pkey_get_dsa(pktmp, dsa); /* will free pktmp */
278} 224}
279 225
280#ifdef OPENSSL_FIPS
281
282int PEM_write_bio_DSAPrivateKey(BIO *bp, DSA *x, const EVP_CIPHER *enc,
283 unsigned char *kstr, int klen,
284 pem_password_cb *cb, void *u)
285{
286 if (FIPS_mode())
287 {
288 EVP_PKEY *k;
289 int ret;
290 k = EVP_PKEY_new();
291 if (!k)
292 return 0;
293 EVP_PKEY_set1_DSA(k, x);
294
295 ret = PEM_write_bio_PrivateKey(bp, k, enc, kstr, klen, cb, u);
296 EVP_PKEY_free(k);
297 return ret;
298 }
299 else
300 return PEM_ASN1_write_bio((i2d_of_void *)i2d_DSAPrivateKey,
301 PEM_STRING_DSA,bp,x,enc,kstr,klen,cb,u);
302}
303
304#ifndef OPENSSL_NO_FP_API
305int PEM_write_DSAPrivateKey(FILE *fp, DSA *x, const EVP_CIPHER *enc,
306 unsigned char *kstr, int klen,
307 pem_password_cb *cb, void *u)
308{
309 if (FIPS_mode())
310 {
311 EVP_PKEY *k;
312 int ret;
313 k = EVP_PKEY_new();
314 if (!k)
315 return 0;
316 EVP_PKEY_set1_DSA(k, x);
317 ret = PEM_write_PrivateKey(fp, k, enc, kstr, klen, cb, u);
318 EVP_PKEY_free(k);
319 return ret;
320 }
321 else
322 return PEM_ASN1_write((i2d_of_void *)i2d_DSAPrivateKey,
323 PEM_STRING_DSA,fp,x,enc,kstr,klen,cb,u);
324}
325#endif
326
327#else
328
329IMPLEMENT_PEM_write_cb_const(DSAPrivateKey, DSA, PEM_STRING_DSA, DSAPrivateKey) 226IMPLEMENT_PEM_write_cb_const(DSAPrivateKey, DSA, PEM_STRING_DSA, DSAPrivateKey)
330
331#endif
332
333IMPLEMENT_PEM_rw(DSA_PUBKEY, DSA, PEM_STRING_PUBLIC, DSA_PUBKEY) 227IMPLEMENT_PEM_rw(DSA_PUBKEY, DSA, PEM_STRING_PUBLIC, DSA_PUBKEY)
334 228
335#ifndef OPENSSL_NO_FP_API 229#ifndef OPENSSL_NO_FP_API
@@ -375,63 +269,8 @@ EC_KEY *PEM_read_bio_ECPrivateKey(BIO *bp, EC_KEY **key, pem_password_cb *cb,
375 269
376IMPLEMENT_PEM_rw_const(ECPKParameters, EC_GROUP, PEM_STRING_ECPARAMETERS, ECPKParameters) 270IMPLEMENT_PEM_rw_const(ECPKParameters, EC_GROUP, PEM_STRING_ECPARAMETERS, ECPKParameters)
377 271
378
379
380#ifdef OPENSSL_FIPS
381
382int PEM_write_bio_ECPrivateKey(BIO *bp, EC_KEY *x, const EVP_CIPHER *enc,
383 unsigned char *kstr, int klen,
384 pem_password_cb *cb, void *u)
385{
386 if (FIPS_mode())
387 {
388 EVP_PKEY *k;
389 int ret;
390 k = EVP_PKEY_new();
391 if (!k)
392 return 0;
393 EVP_PKEY_set1_EC_KEY(k, x);
394
395 ret = PEM_write_bio_PrivateKey(bp, k, enc, kstr, klen, cb, u);
396 EVP_PKEY_free(k);
397 return ret;
398 }
399 else
400 return PEM_ASN1_write_bio((i2d_of_void *)i2d_ECPrivateKey,
401 PEM_STRING_ECPRIVATEKEY,
402 bp,x,enc,kstr,klen,cb,u);
403}
404
405#ifndef OPENSSL_NO_FP_API
406int PEM_write_ECPrivateKey(FILE *fp, EC_KEY *x, const EVP_CIPHER *enc,
407 unsigned char *kstr, int klen,
408 pem_password_cb *cb, void *u)
409{
410 if (FIPS_mode())
411 {
412 EVP_PKEY *k;
413 int ret;
414 k = EVP_PKEY_new();
415 if (!k)
416 return 0;
417 EVP_PKEY_set1_EC_KEY(k, x);
418 ret = PEM_write_PrivateKey(fp, k, enc, kstr, klen, cb, u);
419 EVP_PKEY_free(k);
420 return ret;
421 }
422 else
423 return PEM_ASN1_write((i2d_of_void *)i2d_ECPrivateKey,
424 PEM_STRING_ECPRIVATEKEY,
425 fp,x,enc,kstr,klen,cb,u);
426}
427#endif
428
429#else
430
431IMPLEMENT_PEM_write_cb(ECPrivateKey, EC_KEY, PEM_STRING_ECPRIVATEKEY, ECPrivateKey) 272IMPLEMENT_PEM_write_cb(ECPrivateKey, EC_KEY, PEM_STRING_ECPRIVATEKEY, ECPrivateKey)
432 273
433#endif
434
435IMPLEMENT_PEM_rw(EC_PUBKEY, EC_KEY, PEM_STRING_PUBLIC, EC_PUBKEY) 274IMPLEMENT_PEM_rw(EC_PUBKEY, EC_KEY, PEM_STRING_PUBLIC, EC_PUBKEY)
436 275
437#ifndef OPENSSL_NO_FP_API 276#ifndef OPENSSL_NO_FP_API
diff --git a/src/lib/libcrypto/pem/pem_info.c b/src/lib/libcrypto/pem/pem_info.c
index cc7f24a9c1..1b2be527ed 100644
--- a/src/lib/libcrypto/pem/pem_info.c
+++ b/src/lib/libcrypto/pem/pem_info.c
@@ -167,7 +167,6 @@ start:
167#ifndef OPENSSL_NO_RSA 167#ifndef OPENSSL_NO_RSA
168 if (strcmp(name,PEM_STRING_RSA) == 0) 168 if (strcmp(name,PEM_STRING_RSA) == 0)
169 { 169 {
170 d2i=(D2I_OF(void))d2i_RSAPrivateKey;
171 if (xi->x_pkey != NULL) 170 if (xi->x_pkey != NULL)
172 { 171 {
173 if (!sk_X509_INFO_push(ret,xi)) goto err; 172 if (!sk_X509_INFO_push(ret,xi)) goto err;
diff --git a/src/lib/libcrypto/pem/pem_lib.c b/src/lib/libcrypto/pem/pem_lib.c
index 5a421fc4b6..cfc89a9921 100644
--- a/src/lib/libcrypto/pem/pem_lib.c
+++ b/src/lib/libcrypto/pem/pem_lib.c
@@ -394,8 +394,7 @@ int PEM_ASN1_write_bio(i2d_of_void *i2d, const char *name, BIO *bp,
394 goto err; 394 goto err;
395 /* The 'iv' is used as the iv and as a salt. It is 395 /* The 'iv' is used as the iv and as a salt. It is
396 * NOT taken from the BytesToKey function */ 396 * NOT taken from the BytesToKey function */
397 if (!EVP_BytesToKey(enc,EVP_md5(),iv,kstr,klen,1,key,NULL)) 397 EVP_BytesToKey(enc,EVP_md5(),iv,kstr,klen,1,key,NULL);
398 goto err;
399 398
400 if (kstr == (unsigned char *)buf) OPENSSL_cleanse(buf,PEM_BUFSIZE); 399 if (kstr == (unsigned char *)buf) OPENSSL_cleanse(buf,PEM_BUFSIZE);
401 400
@@ -407,15 +406,12 @@ int PEM_ASN1_write_bio(i2d_of_void *i2d, const char *name, BIO *bp,
407 /* k=strlen(buf); */ 406 /* k=strlen(buf); */
408 407
409 EVP_CIPHER_CTX_init(&ctx); 408 EVP_CIPHER_CTX_init(&ctx);
410 ret = 1; 409 EVP_EncryptInit_ex(&ctx,enc,NULL,key,iv);
411 if (!EVP_EncryptInit_ex(&ctx,enc,NULL,key,iv) 410 EVP_EncryptUpdate(&ctx,data,&j,data,i);
412 || !EVP_EncryptUpdate(&ctx,data,&j,data,i) 411 EVP_EncryptFinal_ex(&ctx,&(data[j]),&i);
413 || !EVP_EncryptFinal_ex(&ctx,&(data[j]),&i))
414 ret = 0;
415 EVP_CIPHER_CTX_cleanup(&ctx); 412 EVP_CIPHER_CTX_cleanup(&ctx);
416 if (ret == 0)
417 goto err;
418 i+=j; 413 i+=j;
414 ret=1;
419 } 415 }
420 else 416 else
421 { 417 {
@@ -463,17 +459,14 @@ int PEM_do_header(EVP_CIPHER_INFO *cipher, unsigned char *data, long *plen,
463 ebcdic2ascii(buf, buf, klen); 459 ebcdic2ascii(buf, buf, klen);
464#endif 460#endif
465 461
466 if (!EVP_BytesToKey(cipher->cipher,EVP_md5(),&(cipher->iv[0]), 462 EVP_BytesToKey(cipher->cipher,EVP_md5(),&(cipher->iv[0]),
467 (unsigned char *)buf,klen,1,key,NULL)) 463 (unsigned char *)buf,klen,1,key,NULL);
468 return 0;
469 464
470 j=(int)len; 465 j=(int)len;
471 EVP_CIPHER_CTX_init(&ctx); 466 EVP_CIPHER_CTX_init(&ctx);
472 o = EVP_DecryptInit_ex(&ctx,cipher->cipher,NULL, key,&(cipher->iv[0])); 467 EVP_DecryptInit_ex(&ctx,cipher->cipher,NULL, key,&(cipher->iv[0]));
473 if (o) 468 EVP_DecryptUpdate(&ctx,data,&i,data,j);
474 o = EVP_DecryptUpdate(&ctx,data,&i,data,j); 469 o=EVP_DecryptFinal_ex(&ctx,&(data[i]),&j);
475 if (o)
476 o = EVP_DecryptFinal_ex(&ctx,&(data[i]),&j);
477 EVP_CIPHER_CTX_cleanup(&ctx); 470 EVP_CIPHER_CTX_cleanup(&ctx);
478 OPENSSL_cleanse((char *)buf,sizeof(buf)); 471 OPENSSL_cleanse((char *)buf,sizeof(buf));
479 OPENSSL_cleanse((char *)key,sizeof(key)); 472 OPENSSL_cleanse((char *)key,sizeof(key));
diff --git a/src/lib/libcrypto/pem/pem_seal.c b/src/lib/libcrypto/pem/pem_seal.c
index b6b4e13498..59690b56ae 100644
--- a/src/lib/libcrypto/pem/pem_seal.c
+++ b/src/lib/libcrypto/pem/pem_seal.c
@@ -96,8 +96,7 @@ int PEM_SealInit(PEM_ENCODE_SEAL_CTX *ctx, EVP_CIPHER *type, EVP_MD *md_type,
96 EVP_EncodeInit(&ctx->encode); 96 EVP_EncodeInit(&ctx->encode);
97 97
98 EVP_MD_CTX_init(&ctx->md); 98 EVP_MD_CTX_init(&ctx->md);
99 if (!EVP_SignInit(&ctx->md,md_type)) 99 EVP_SignInit(&ctx->md,md_type);
100 goto err;
101 100
102 EVP_CIPHER_CTX_init(&ctx->cipher); 101 EVP_CIPHER_CTX_init(&ctx->cipher);
103 ret=EVP_SealInit(&ctx->cipher,type,ek,ekl,iv,pubk,npubk); 102 ret=EVP_SealInit(&ctx->cipher,type,ek,ekl,iv,pubk,npubk);
@@ -164,8 +163,7 @@ int PEM_SealFinal(PEM_ENCODE_SEAL_CTX *ctx, unsigned char *sig, int *sigl,
164 goto err; 163 goto err;
165 } 164 }
166 165
167 if (!EVP_EncryptFinal_ex(&ctx->cipher,s,(int *)&i)) 166 EVP_EncryptFinal_ex(&ctx->cipher,s,(int *)&i);
168 goto err;
169 EVP_EncodeUpdate(&ctx->encode,out,&j,s,i); 167 EVP_EncodeUpdate(&ctx->encode,out,&j,s,i);
170 *outl=j; 168 *outl=j;
171 out+=j; 169 out+=j;
diff --git a/src/lib/libcrypto/perlasm/cbc.pl b/src/lib/libcrypto/perlasm/cbc.pl
index 24561e759a..6fc2510905 100644
--- a/src/lib/libcrypto/perlasm/cbc.pl
+++ b/src/lib/libcrypto/perlasm/cbc.pl
@@ -150,7 +150,7 @@ sub cbc
150&set_label("PIC_point"); 150&set_label("PIC_point");
151 &blindpop("edx"); 151 &blindpop("edx");
152 &lea("ecx",&DWP(&label("cbc_enc_jmp_table")."-".&label("PIC_point"),"edx")); 152 &lea("ecx",&DWP(&label("cbc_enc_jmp_table")."-".&label("PIC_point"),"edx"));
153 &mov($count,&DWP(0,"ecx",$count,4)); 153 &mov($count,&DWP(0,"ecx",$count,4))
154 &add($count,"edx"); 154 &add($count,"edx");
155 &xor("ecx","ecx"); 155 &xor("ecx","ecx");
156 &xor("edx","edx"); 156 &xor("edx","edx");
diff --git a/src/lib/libcrypto/perlasm/x86asm.pl b/src/lib/libcrypto/perlasm/x86asm.pl
index eb543db2f6..bf783cff26 100644
--- a/src/lib/libcrypto/perlasm/x86asm.pl
+++ b/src/lib/libcrypto/perlasm/x86asm.pl
@@ -33,6 +33,13 @@ sub ::emit
33 else { push(@out,"\t$opcode\t".join(',',@_)."\n"); } 33 else { push(@out,"\t$opcode\t".join(',',@_)."\n"); }
34} 34}
35 35
36sub ::emitraw
37{ my $opcode=shift;
38
39 if ($#_==-1) { push(@out,"$opcode\n"); }
40 else { push(@out,"$opcode\t".join(',',@_)."\n"); }
41}
42
36sub ::LB 43sub ::LB
37{ $_[0] =~ m/^e?([a-d])x$/o or die "$_[0] does not have a 'low byte'"; 44{ $_[0] =~ m/^e?([a-d])x$/o or die "$_[0] does not have a 'low byte'";
38 $1."l"; 45 $1."l";
@@ -218,7 +225,7 @@ sub ::asm_init
218 $filename=$fn; 225 $filename=$fn;
219 $i386=$cpu; 226 $i386=$cpu;
220 227
221 $elf=$cpp=$coff=$aout=$macosx=$win32=$netware=$mwerks=$android=0; 228 $elf=$cpp=$coff=$aout=$macosx=$win32=$netware=$mwerks=$openbsd=$android=0;
222 if (($type eq "elf")) 229 if (($type eq "elf"))
223 { $elf=1; require "x86gas.pl"; } 230 { $elf=1; require "x86gas.pl"; }
224 elsif (($type eq "a\.out")) 231 elsif (($type eq "a\.out"))
@@ -235,6 +242,10 @@ sub ::asm_init
235 { $win32=1; require "x86masm.pl"; } 242 { $win32=1; require "x86masm.pl"; }
236 elsif (($type eq "macosx")) 243 elsif (($type eq "macosx"))
237 { $aout=1; $macosx=1; require "x86gas.pl"; } 244 { $aout=1; $macosx=1; require "x86gas.pl"; }
245 elsif (($type eq "openbsd-elf"))
246 { $openbsd=$elf=1; require "x86gas.pl"; }
247 elsif (($type eq "openbsd-a.out"))
248 { $openbsd=1; require "x86gas.pl"; }
238 elsif (($type eq "android")) 249 elsif (($type eq "android"))
239 { $elf=1; $android=1; require "x86gas.pl"; } 250 { $elf=1; $android=1; require "x86gas.pl"; }
240 else 251 else
@@ -244,6 +255,8 @@ Pick one target type from
244 a.out - DJGPP, elder OpenBSD, etc. 255 a.out - DJGPP, elder OpenBSD, etc.
245 coff - GAS/COFF such as Win32 targets 256 coff - GAS/COFF such as Win32 targets
246 win32n - Windows 95/Windows NT NASM format 257 win32n - Windows 95/Windows NT NASM format
258 openbsd-elf - OpenBSD elf
259 openbsd-a.out - OpenBSD a.out
247 nw-nasm - NetWare NASM format 260 nw-nasm - NetWare NASM format
248 macosx - Mac OS X 261 macosx - Mac OS X
249EOF 262EOF
@@ -253,6 +266,7 @@ EOF
253 $pic=0; 266 $pic=0;
254 for (@ARGV) { $pic=1 if (/\-[fK]PIC/i); } 267 for (@ARGV) { $pic=1 if (/\-[fK]PIC/i); }
255 268
269 ::emitraw("#include <machine/asm.h>\n") if $openbsd;
256 $filename =~ s/\.pl$//; 270 $filename =~ s/\.pl$//;
257 &file($filename); 271 &file($filename);
258} 272}
diff --git a/src/lib/libcrypto/perlasm/x86gas.pl b/src/lib/libcrypto/perlasm/x86gas.pl
index 682a3a3163..d4baea514b 100644
--- a/src/lib/libcrypto/perlasm/x86gas.pl
+++ b/src/lib/libcrypto/perlasm/x86gas.pl
@@ -182,6 +182,15 @@ sub ::align
182sub ::picmeup 182sub ::picmeup
183{ my($dst,$sym,$base,$reflabel)=@_; 183{ my($dst,$sym,$base,$reflabel)=@_;
184 184
185 if ($::openbsd)
186 { &::emitraw("#if defined(PIC) || defined(__PIC__)");
187 &::emitraw("PIC_PROLOGUE");
188 &::mov($dst, &::DWP("PIC_GOT($sym)"));
189 &::emitraw("PIC_EPILOGUE");
190 &::emitraw("#else /* PIC */");
191 &::lea($dst,&::DWP($sym));
192 &::emitraw("#endif /* PIC */");
193 }
185 if (($::pic && ($::elf || $::aout)) || $::macosx) 194 if (($::pic && ($::elf || $::aout)) || $::macosx)
186 { if (!defined($base)) 195 { if (!defined($base))
187 { &::call(&::label("PIC_me_up")); 196 { &::call(&::label("PIC_me_up"));
@@ -208,7 +217,17 @@ sub ::picmeup
208sub ::initseg 217sub ::initseg
209{ my $f=$nmdecor.shift; 218{ my $f=$nmdecor.shift;
210 219
211 if ($::android) 220 if ($::openbsd)
221 { $initseg.=<<___;
222.section .init
223PIC_PROLOGUE
224 call PIC_PLT($f)
225PIC_EPILOGUE
226 jmp .Linitalign
227.align $align
228.Linitalign:
229___
230 } elsif ($::android)
212 { $initseg.=<<___; 231 { $initseg.=<<___;
213.section .init_array 232.section .init_array
214.align 4 233.align 4
diff --git a/src/lib/libcrypto/perlasm/x86masm.pl b/src/lib/libcrypto/perlasm/x86masm.pl
new file mode 100644
index 0000000000..f937d07c87
--- /dev/null
+++ b/src/lib/libcrypto/perlasm/x86masm.pl
@@ -0,0 +1,198 @@
1#!/usr/bin/env perl
2
3package x86masm;
4
5*out=\@::out;
6
7$::lbdecor="\$L"; # local label decoration
8$nmdecor="_"; # external name decoration
9
10$initseg="";
11$segment="";
12
13sub ::generic
14{ my ($opcode,@arg)=@_;
15
16 # fix hexadecimal constants
17 for (@arg) { s/(?<![\w\$\.])0x([0-9a-f]+)/0$1h/oi; }
18
19 if ($opcode =~ /lea/ && @arg[1] =~ s/.*PTR\s+(\(.*\))$/OFFSET $1/) # no []
20 { $opcode="mov"; }
21 elsif ($opcode !~ /movq/)
22 { # fix xmm references
23 $arg[0] =~ s/\b[A-Z]+WORD\s+PTR/XMMWORD PTR/i if ($arg[1]=~/\bxmm[0-7]\b/i);
24 $arg[1] =~ s/\b[A-Z]+WORD\s+PTR/XMMWORD PTR/i if ($arg[0]=~/\bxmm[0-7]\b/i);
25 }
26
27 &::emit($opcode,@arg);
28 1;
29}
30#
31# opcodes not covered by ::generic above, mostly inconsistent namings...
32#
33sub ::call { &::emit("call",(&::islabel($_[0]) or "$nmdecor$_[0]")); }
34sub ::call_ptr { &::emit("call",@_); }
35sub ::jmp_ptr { &::emit("jmp",@_); }
36sub ::lock { &::data_byte(0xf0); }
37
38sub get_mem
39{ my($size,$addr,$reg1,$reg2,$idx)=@_;
40 my($post,$ret);
41
42 $ret .= "$size PTR " if ($size ne "");
43
44 $addr =~ s/^\s+//;
45 # prepend global references with optional underscore
46 $addr =~ s/^([^\+\-0-9][^\+\-]*)/&::islabel($1) or "$nmdecor$1"/ige;
47 # put address arithmetic expression in parenthesis
48 $addr="($addr)" if ($addr =~ /^.+[\-\+].+$/);
49
50 if (($addr ne "") && ($addr ne 0))
51 { if ($addr !~ /^-/) { $ret .= "$addr"; }
52 else { $post=$addr; }
53 }
54 $ret .= "[";
55
56 if ($reg2 ne "")
57 { $idx!=0 or $idx=1;
58 $ret .= "$reg2*$idx";
59 $ret .= "+$reg1" if ($reg1 ne "");
60 }
61 else
62 { $ret .= "$reg1"; }
63
64 $ret .= "$post]";
65 $ret =~ s/\+\]/]/; # in case $addr was the only argument
66 $ret =~ s/\[\s*\]//;
67
68 $ret;
69}
70sub ::BP { &get_mem("BYTE",@_); }
71sub ::WP { &get_mem("WORD",@_); }
72sub ::DWP { &get_mem("DWORD",@_); }
73sub ::QWP { &get_mem("QWORD",@_); }
74sub ::BC { "@_"; }
75sub ::DWC { "@_"; }
76
77sub ::file
78{ my $tmp=<<___;
79TITLE $_[0].asm
80IF \@Version LT 800
81ECHO MASM version 8.00 or later is strongly recommended.
82ENDIF
83.486
84.MODEL FLAT
85OPTION DOTNAME
86IF \@Version LT 800
87.text\$ SEGMENT PAGE 'CODE'
88ELSE
89.text\$ SEGMENT ALIGN(64) 'CODE'
90ENDIF
91___
92 push(@out,$tmp);
93 $segment = ".text\$";
94}
95
96sub ::function_begin_B
97{ my $func=shift;
98 my $global=($func !~ /^_/);
99 my $begin="${::lbdecor}_${func}_begin";
100
101 &::LABEL($func,$global?"$begin":"$nmdecor$func");
102 $func="ALIGN\t16\n".$nmdecor.$func."\tPROC";
103
104 if ($global) { $func.=" PUBLIC\n${begin}::\n"; }
105 else { $func.=" PRIVATE\n"; }
106 push(@out,$func);
107 $::stack=4;
108}
109sub ::function_end_B
110{ my $func=shift;
111
112 push(@out,"$nmdecor$func ENDP\n");
113 $::stack=0;
114 &::wipe_labels();
115}
116
117sub ::file_end
118{ my $xmmheader=<<___;
119.686
120.XMM
121IF \@Version LT 800
122XMMWORD STRUCT 16
123DQ 2 dup (?)
124XMMWORD ENDS
125ENDIF
126___
127 if (grep {/\b[x]?mm[0-7]\b/i} @out) {
128 grep {s/\.[3-7]86/$xmmheader/} @out;
129 }
130
131 push(@out,"$segment ENDS\n");
132
133 if (grep {/\b${nmdecor}OPENSSL_ia32cap_P\b/i} @out)
134 { my $comm=<<___;
135.bss SEGMENT 'BSS'
136COMM ${nmdecor}OPENSSL_ia32cap_P:QWORD
137.bss ENDS
138___
139 # comment out OPENSSL_ia32cap_P declarations
140 grep {s/(^EXTERN\s+${nmdecor}OPENSSL_ia32cap_P)/\;$1/} @out;
141 push (@out,$comm);
142 }
143 push (@out,$initseg) if ($initseg);
144 push (@out,"END\n");
145}
146
147sub ::comment { foreach (@_) { push(@out,"\t; $_\n"); } }
148
149*::set_label_B = sub
150{ my $l=shift; push(@out,$l.($l=~/^\Q${::lbdecor}\E[0-9]{3}/?":\n":"::\n")); };
151
152sub ::external_label
153{ foreach(@_)
154 { push(@out, "EXTERN\t".&::LABEL($_,$nmdecor.$_).":NEAR\n"); }
155}
156
157sub ::public_label
158{ push(@out,"PUBLIC\t".&::LABEL($_[0],$nmdecor.$_[0])."\n"); }
159
160sub ::data_byte
161{ push(@out,("DB\t").join(',',@_)."\n"); }
162
163sub ::data_short
164{ push(@out,("DW\t").join(',',@_)."\n"); }
165
166sub ::data_word
167{ push(@out,("DD\t").join(',',@_)."\n"); }
168
169sub ::align
170{ push(@out,"ALIGN\t$_[0]\n"); }
171
172sub ::picmeup
173{ my($dst,$sym)=@_;
174 &::lea($dst,&::DWP($sym));
175}
176
177sub ::initseg
178{ my $f=$nmdecor.shift;
179
180 $initseg.=<<___;
181.CRT\$XCU SEGMENT DWORD PUBLIC 'DATA'
182EXTERN $f:NEAR
183DD $f
184.CRT\$XCU ENDS
185___
186}
187
188sub ::dataseg
189{ push(@out,"$segment\tENDS\n_DATA\tSEGMENT\n"); $segment="_DATA"; }
190
191sub ::safeseh
192{ my $nm=shift;
193 push(@out,"IF \@Version GE 710\n");
194 push(@out,".SAFESEH ".&::LABEL($nm,$nmdecor.$nm)."\n");
195 push(@out,"ENDIF\n");
196}
197
1981;
diff --git a/src/lib/libcrypto/perlasm/x86nasm.pl b/src/lib/libcrypto/perlasm/x86nasm.pl
new file mode 100644
index 0000000000..ca2511c9eb
--- /dev/null
+++ b/src/lib/libcrypto/perlasm/x86nasm.pl
@@ -0,0 +1,177 @@
1#!/usr/bin/env perl
2
3package x86nasm;
4
5*out=\@::out;
6
7$::lbdecor="L\$"; # local label decoration
8$nmdecor=$::netware?"":"_"; # external name decoration
9$drdecor=$::mwerks?".":""; # directive decoration
10
11$initseg="";
12
13sub ::generic
14{ my $opcode=shift;
15 my $tmp;
16
17 if (!$::mwerks)
18 { if ($opcode =~ m/^j/o && $#_==0) # optimize jumps
19 { $_[0] = "NEAR $_[0]"; }
20 elsif ($opcode eq "lea" && $#_==1) # wipe storage qualifier from lea
21 { $_[1] =~ s/^[^\[]*\[/\[/o; }
22 elsif ($opcode eq "clflush" && $#_==0)
23 { $_[0] =~ s/^[^\[]*\[/\[/o; }
24 }
25 &::emit($opcode,@_);
26 1;
27}
28#
29# opcodes not covered by ::generic above, mostly inconsistent namings...
30#
31sub ::call { &::emit("call",(&::islabel($_[0]) or "$nmdecor$_[0]")); }
32sub ::call_ptr { &::emit("call",@_); }
33sub ::jmp_ptr { &::emit("jmp",@_); }
34
35sub get_mem
36{ my($size,$addr,$reg1,$reg2,$idx)=@_;
37 my($post,$ret);
38
39 if ($size ne "")
40 { $ret .= "$size";
41 $ret .= " PTR" if ($::mwerks);
42 $ret .= " ";
43 }
44 $ret .= "[";
45
46 $addr =~ s/^\s+//;
47 # prepend global references with optional underscore
48 $addr =~ s/^([^\+\-0-9][^\+\-]*)/::islabel($1) or "$nmdecor$1"/ige;
49 # put address arithmetic expression in parenthesis
50 $addr="($addr)" if ($addr =~ /^.+[\-\+].+$/);
51
52 if (($addr ne "") && ($addr ne 0))
53 { if ($addr !~ /^-/) { $ret .= "$addr+"; }
54 else { $post=$addr; }
55 }
56
57 if ($reg2 ne "")
58 { $idx!=0 or $idx=1;
59 $ret .= "$reg2*$idx";
60 $ret .= "+$reg1" if ($reg1 ne "");
61 }
62 else
63 { $ret .= "$reg1"; }
64
65 $ret .= "$post]";
66 $ret =~ s/\+\]/]/; # in case $addr was the only argument
67
68 $ret;
69}
70sub ::BP { &get_mem("BYTE",@_); }
71sub ::DWP { &get_mem("DWORD",@_); }
72sub ::WP { &get_mem("WORD",@_); }
73sub ::QWP { &get_mem("",@_); }
74sub ::BC { (($::mwerks)?"":"BYTE ")."@_"; }
75sub ::DWC { (($::mwerks)?"":"DWORD ")."@_"; }
76
77sub ::file
78{ if ($::mwerks) { push(@out,".section\t.text,64\n"); }
79 else
80 { my $tmp=<<___;
81%ifidn __OUTPUT_FORMAT__,obj
82section code use32 class=code align=64
83%elifidn __OUTPUT_FORMAT__,win32
84\$\@feat.00 equ 1
85section .text code align=64
86%else
87section .text code
88%endif
89___
90 push(@out,$tmp);
91 }
92}
93
94sub ::function_begin_B
95{ my $func=shift;
96 my $global=($func !~ /^_/);
97 my $begin="${::lbdecor}_${func}_begin";
98
99 $begin =~ s/^\@/./ if ($::mwerks); # the torture never stops
100
101 &::LABEL($func,$global?"$begin":"$nmdecor$func");
102 $func=$nmdecor.$func;
103
104 push(@out,"${drdecor}global $func\n") if ($global);
105 push(@out,"${drdecor}align 16\n");
106 push(@out,"$func:\n");
107 push(@out,"$begin:\n") if ($global);
108 $::stack=4;
109}
110
111sub ::function_end_B
112{ $::stack=0;
113 &::wipe_labels();
114}
115
116sub ::file_end
117{ if (grep {/\b${nmdecor}OPENSSL_ia32cap_P\b/i} @out)
118 { my $comm=<<___;
119${drdecor}segment .bss
120${drdecor}common ${nmdecor}OPENSSL_ia32cap_P 8
121___
122 # comment out OPENSSL_ia32cap_P declarations
123 grep {s/(^extern\s+${nmdecor}OPENSSL_ia32cap_P)/\;$1/} @out;
124 push (@out,$comm)
125 }
126 push (@out,$initseg) if ($initseg);
127}
128
129sub ::comment { foreach (@_) { push(@out,"\t; $_\n"); } }
130
131sub ::external_label
132{ foreach(@_)
133 { push(@out,"${drdecor}extern\t".&::LABEL($_,$nmdecor.$_)."\n"); }
134}
135
136sub ::public_label
137{ push(@out,"${drdecor}global\t".&::LABEL($_[0],$nmdecor.$_[0])."\n"); }
138
139sub ::data_byte
140{ push(@out,(($::mwerks)?".byte\t":"db\t").join(',',@_)."\n"); }
141sub ::data_short
142{ push(@out,(($::mwerks)?".word\t":"dw\t").join(',',@_)."\n"); }
143sub ::data_word
144{ push(@out,(($::mwerks)?".long\t":"dd\t").join(',',@_)."\n"); }
145
146sub ::align
147{ push(@out,"${drdecor}align\t$_[0]\n"); }
148
149sub ::picmeup
150{ my($dst,$sym)=@_;
151 &::lea($dst,&::DWP($sym));
152}
153
154sub ::initseg
155{ my $f=$nmdecor.shift;
156 if ($::win32)
157 { $initseg=<<___;
158segment .CRT\$XCU data align=4
159extern $f
160dd $f
161___
162 }
163}
164
165sub ::dataseg
166{ if ($mwerks) { push(@out,".section\t.data,4\n"); }
167 else { push(@out,"section\t.data align=4\n"); }
168}
169
170sub ::safeseh
171{ my $nm=shift;
172 push(@out,"%if __NASM_VERSION_ID__ >= 0x02030000\n");
173 push(@out,"safeseh ".&::LABEL($nm,$nmdecor.$nm)."\n");
174 push(@out,"%endif\n");
175}
176
1771;
diff --git a/src/lib/libcrypto/pkcs12/Makefile b/src/lib/libcrypto/pkcs12/Makefile
new file mode 100644
index 0000000000..3a7498fe7a
--- /dev/null
+++ b/src/lib/libcrypto/pkcs12/Makefile
@@ -0,0 +1,286 @@
1#
2# OpenSSL/crypto/pkcs12/Makefile
3#
4
5DIR= pkcs12
6TOP= ../..
7CC= cc
8INCLUDES= -I.. -I$(TOP) -I../../include
9CFLAG=-g
10MAKEFILE= Makefile
11AR= ar r
12
13CFLAGS= $(INCLUDES) $(CFLAG)
14
15GENERAL=Makefile
16TEST=
17APPS=
18
19LIB=$(TOP)/libcrypto.a
20LIBSRC= p12_add.c p12_asn.c p12_attr.c p12_crpt.c p12_crt.c p12_decr.c \
21 p12_init.c p12_key.c p12_kiss.c p12_mutl.c\
22 p12_utl.c p12_npas.c pk12err.c p12_p8d.c p12_p8e.c
23LIBOBJ= p12_add.o p12_asn.o p12_attr.o p12_crpt.o p12_crt.o p12_decr.o \
24 p12_init.o p12_key.o p12_kiss.o p12_mutl.o\
25 p12_utl.o p12_npas.o pk12err.o p12_p8d.o p12_p8e.o
26
27SRC= $(LIBSRC)
28
29EXHEADER= pkcs12.h
30HEADER= $(EXHEADER)
31
32ALL= $(GENERAL) $(SRC) $(HEADER)
33
34top:
35 (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all)
36
37test:
38
39all: lib
40
41lib: $(LIBOBJ)
42 $(AR) $(LIB) $(LIBOBJ)
43 $(RANLIB) $(LIB) || echo Never mind.
44 @touch lib
45
46files:
47 $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
48
49links:
50 @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
51 @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
52 @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
53
54install:
55 @[ -n "$(INSTALLTOP)" ] # should be set by top Makefile...
56 @headerlist="$(EXHEADER)"; for i in $$headerlist ; \
57 do \
58 (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
59 chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
60 done;
61
62tags:
63 ctags $(SRC)
64
65tests:
66
67lint:
68 lint -DLINT $(INCLUDES) $(SRC)>fluff
69
70depend:
71 @[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile...
72 $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
73
74dclean:
75 $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
76 mv -f Makefile.new $(MAKEFILE)
77
78clean:
79 rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
80
81# DO NOT DELETE THIS LINE -- make depend depends on it.
82
83p12_add.o: ../../e_os.h ../../include/openssl/asn1.h
84p12_add.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
85p12_add.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
86p12_add.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
87p12_add.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
88p12_add.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
89p12_add.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
90p12_add.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
91p12_add.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs12.h
92p12_add.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
93p12_add.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
94p12_add.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
95p12_add.o: ../../include/openssl/x509_vfy.h ../cryptlib.h p12_add.c
96p12_asn.o: ../../e_os.h ../../include/openssl/asn1.h
97p12_asn.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
98p12_asn.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
99p12_asn.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
100p12_asn.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
101p12_asn.o: ../../include/openssl/err.h ../../include/openssl/evp.h
102p12_asn.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
103p12_asn.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
104p12_asn.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
105p12_asn.o: ../../include/openssl/pkcs12.h ../../include/openssl/pkcs7.h
106p12_asn.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
107p12_asn.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
108p12_asn.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
109p12_asn.o: ../cryptlib.h p12_asn.c
110p12_attr.o: ../../e_os.h ../../include/openssl/asn1.h
111p12_attr.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
112p12_attr.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
113p12_attr.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
114p12_attr.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
115p12_attr.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
116p12_attr.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
117p12_attr.o: ../../include/openssl/opensslconf.h
118p12_attr.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
119p12_attr.o: ../../include/openssl/pkcs12.h ../../include/openssl/pkcs7.h
120p12_attr.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
121p12_attr.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
122p12_attr.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
123p12_attr.o: ../cryptlib.h p12_attr.c
124p12_crpt.o: ../../e_os.h ../../include/openssl/asn1.h
125p12_crpt.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
126p12_crpt.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
127p12_crpt.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
128p12_crpt.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
129p12_crpt.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
130p12_crpt.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
131p12_crpt.o: ../../include/openssl/opensslconf.h
132p12_crpt.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
133p12_crpt.o: ../../include/openssl/pkcs12.h ../../include/openssl/pkcs7.h
134p12_crpt.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
135p12_crpt.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
136p12_crpt.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
137p12_crpt.o: ../cryptlib.h p12_crpt.c
138p12_crt.o: ../../e_os.h ../../include/openssl/asn1.h
139p12_crt.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
140p12_crt.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
141p12_crt.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
142p12_crt.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
143p12_crt.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
144p12_crt.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
145p12_crt.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
146p12_crt.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs12.h
147p12_crt.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
148p12_crt.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
149p12_crt.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
150p12_crt.o: ../../include/openssl/x509_vfy.h ../cryptlib.h p12_crt.c
151p12_decr.o: ../../e_os.h ../../include/openssl/asn1.h
152p12_decr.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
153p12_decr.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
154p12_decr.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
155p12_decr.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
156p12_decr.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
157p12_decr.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
158p12_decr.o: ../../include/openssl/opensslconf.h
159p12_decr.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
160p12_decr.o: ../../include/openssl/pkcs12.h ../../include/openssl/pkcs7.h
161p12_decr.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
162p12_decr.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
163p12_decr.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
164p12_decr.o: ../cryptlib.h p12_decr.c
165p12_init.o: ../../e_os.h ../../include/openssl/asn1.h
166p12_init.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
167p12_init.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
168p12_init.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
169p12_init.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
170p12_init.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
171p12_init.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
172p12_init.o: ../../include/openssl/opensslconf.h
173p12_init.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
174p12_init.o: ../../include/openssl/pkcs12.h ../../include/openssl/pkcs7.h
175p12_init.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
176p12_init.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
177p12_init.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
178p12_init.o: ../cryptlib.h p12_init.c
179p12_key.o: ../../e_os.h ../../include/openssl/asn1.h
180p12_key.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
181p12_key.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
182p12_key.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
183p12_key.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
184p12_key.o: ../../include/openssl/err.h ../../include/openssl/evp.h
185p12_key.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
186p12_key.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
187p12_key.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
188p12_key.o: ../../include/openssl/pkcs12.h ../../include/openssl/pkcs7.h
189p12_key.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
190p12_key.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
191p12_key.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
192p12_key.o: ../cryptlib.h p12_key.c
193p12_kiss.o: ../../e_os.h ../../include/openssl/asn1.h
194p12_kiss.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
195p12_kiss.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
196p12_kiss.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
197p12_kiss.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
198p12_kiss.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
199p12_kiss.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
200p12_kiss.o: ../../include/openssl/opensslconf.h
201p12_kiss.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
202p12_kiss.o: ../../include/openssl/pkcs12.h ../../include/openssl/pkcs7.h
203p12_kiss.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
204p12_kiss.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
205p12_kiss.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
206p12_kiss.o: ../cryptlib.h p12_kiss.c
207p12_mutl.o: ../../e_os.h ../../include/openssl/asn1.h
208p12_mutl.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
209p12_mutl.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
210p12_mutl.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
211p12_mutl.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
212p12_mutl.o: ../../include/openssl/evp.h ../../include/openssl/hmac.h
213p12_mutl.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
214p12_mutl.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
215p12_mutl.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
216p12_mutl.o: ../../include/openssl/pkcs12.h ../../include/openssl/pkcs7.h
217p12_mutl.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h
218p12_mutl.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
219p12_mutl.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
220p12_mutl.o: ../../include/openssl/x509_vfy.h ../cryptlib.h p12_mutl.c
221p12_npas.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
222p12_npas.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
223p12_npas.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
224p12_npas.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
225p12_npas.o: ../../include/openssl/err.h ../../include/openssl/evp.h
226p12_npas.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
227p12_npas.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
228p12_npas.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
229p12_npas.o: ../../include/openssl/pem.h ../../include/openssl/pem2.h
230p12_npas.o: ../../include/openssl/pkcs12.h ../../include/openssl/pkcs7.h
231p12_npas.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
232p12_npas.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
233p12_npas.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
234p12_npas.o: p12_npas.c
235p12_p8d.o: ../../e_os.h ../../include/openssl/asn1.h
236p12_p8d.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
237p12_p8d.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
238p12_p8d.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
239p12_p8d.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
240p12_p8d.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
241p12_p8d.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
242p12_p8d.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
243p12_p8d.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs12.h
244p12_p8d.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
245p12_p8d.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
246p12_p8d.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
247p12_p8d.o: ../../include/openssl/x509_vfy.h ../cryptlib.h p12_p8d.c
248p12_p8e.o: ../../e_os.h ../../include/openssl/asn1.h
249p12_p8e.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
250p12_p8e.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
251p12_p8e.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
252p12_p8e.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
253p12_p8e.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
254p12_p8e.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
255p12_p8e.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
256p12_p8e.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs12.h
257p12_p8e.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
258p12_p8e.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
259p12_p8e.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
260p12_p8e.o: ../../include/openssl/x509_vfy.h ../cryptlib.h p12_p8e.c
261p12_utl.o: ../../e_os.h ../../include/openssl/asn1.h
262p12_utl.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
263p12_utl.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
264p12_utl.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
265p12_utl.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
266p12_utl.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
267p12_utl.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
268p12_utl.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
269p12_utl.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs12.h
270p12_utl.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
271p12_utl.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
272p12_utl.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
273p12_utl.o: ../../include/openssl/x509_vfy.h ../cryptlib.h p12_utl.c
274pk12err.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
275pk12err.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
276pk12err.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
277pk12err.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
278pk12err.o: ../../include/openssl/err.h ../../include/openssl/evp.h
279pk12err.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
280pk12err.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
281pk12err.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
282pk12err.o: ../../include/openssl/pkcs12.h ../../include/openssl/pkcs7.h
283pk12err.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
284pk12err.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
285pk12err.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
286pk12err.o: pk12err.c
diff --git a/src/lib/libcrypto/pkcs12/p12_crt.c b/src/lib/libcrypto/pkcs12/p12_crt.c
index a34915d02d..96b131defa 100644
--- a/src/lib/libcrypto/pkcs12/p12_crt.c
+++ b/src/lib/libcrypto/pkcs12/p12_crt.c
@@ -90,14 +90,7 @@ PKCS12 *PKCS12_create(char *pass, char *name, EVP_PKEY *pkey, X509 *cert,
90 90
91 /* Set defaults */ 91 /* Set defaults */
92 if (!nid_cert) 92 if (!nid_cert)
93 {
94#ifdef OPENSSL_FIPS
95 if (FIPS_mode())
96 nid_cert = NID_pbe_WithSHA1And3_Key_TripleDES_CBC;
97 else
98#endif
99 nid_cert = NID_pbe_WithSHA1And40BitRC2_CBC; 93 nid_cert = NID_pbe_WithSHA1And40BitRC2_CBC;
100 }
101 if (!nid_key) 94 if (!nid_key)
102 nid_key = NID_pbe_WithSHA1And3_Key_TripleDES_CBC; 95 nid_key = NID_pbe_WithSHA1And3_Key_TripleDES_CBC;
103 if (!iter) 96 if (!iter)
diff --git a/src/lib/libcrypto/pkcs12/p12_key.c b/src/lib/libcrypto/pkcs12/p12_key.c
index 61d58502fd..c55c7b60b3 100644
--- a/src/lib/libcrypto/pkcs12/p12_key.c
+++ b/src/lib/libcrypto/pkcs12/p12_key.c
@@ -176,32 +176,24 @@ int PKCS12_key_gen_uni(unsigned char *pass, int passlen, unsigned char *salt,
176 out += u; 176 out += u;
177 for (j = 0; j < v; j++) B[j] = Ai[j % u]; 177 for (j = 0; j < v; j++) B[j] = Ai[j % u];
178 /* Work out B + 1 first then can use B as tmp space */ 178 /* Work out B + 1 first then can use B as tmp space */
179 if (!BN_bin2bn (B, v, Bpl1)) 179 if (!BN_bin2bn (B, v, Bpl1)) goto err;
180 goto err; 180 if (!BN_add_word (Bpl1, 1)) goto err;
181 if (!BN_add_word (Bpl1, 1))
182 goto err;
183 for (j = 0; j < Ilen ; j+=v) { 181 for (j = 0; j < Ilen ; j+=v) {
184 if (!BN_bin2bn(I + j, v, Ij)) 182 if (!BN_bin2bn (I + j, v, Ij)) goto err;
185 goto err; 183 if (!BN_add (Ij, Ij, Bpl1)) goto err;
186 if (!BN_add(Ij, Ij, Bpl1)) 184 BN_bn2bin (Ij, B);
187 goto err;
188 if (!BN_bn2bin(Ij, B))
189 goto err;
190 Ijlen = BN_num_bytes (Ij); 185 Ijlen = BN_num_bytes (Ij);
191 /* If more than 2^(v*8) - 1 cut off MSB */ 186 /* If more than 2^(v*8) - 1 cut off MSB */
192 if (Ijlen > v) { 187 if (Ijlen > v) {
193 if (!BN_bn2bin (Ij, B)) 188 BN_bn2bin (Ij, B);
194 goto err;
195 memcpy (I + j, B + 1, v); 189 memcpy (I + j, B + 1, v);
196#ifndef PKCS12_BROKEN_KEYGEN 190#ifndef PKCS12_BROKEN_KEYGEN
197 /* If less than v bytes pad with zeroes */ 191 /* If less than v bytes pad with zeroes */
198 } else if (Ijlen < v) { 192 } else if (Ijlen < v) {
199 memset(I + j, 0, v - Ijlen); 193 memset(I + j, 0, v - Ijlen);
200 if (!BN_bn2bin(Ij, I + j + v - Ijlen)) 194 BN_bn2bin(Ij, I + j + v - Ijlen);
201 goto err;
202#endif 195#endif
203 } else if (!BN_bn2bin (Ij, I + j)) 196 } else BN_bn2bin (Ij, I + j);
204 goto err;
205 } 197 }
206 } 198 }
207 199
diff --git a/src/lib/libcrypto/pkcs7/Makefile b/src/lib/libcrypto/pkcs7/Makefile
new file mode 100644
index 0000000000..56dc6823d1
--- /dev/null
+++ b/src/lib/libcrypto/pkcs7/Makefile
@@ -0,0 +1,194 @@
1#
2# OpenSSL/crypto/pkcs7/Makefile
3#
4
5DIR= pkcs7
6TOP= ../..
7CC= cc
8INCLUDES= -I.. -I$(TOP) -I../../include
9CFLAG=-g
10MAKEFILE= Makefile
11AR= ar r
12
13PEX_LIBS=
14EX_LIBS=
15
16CFLAGS= $(INCLUDES) $(CFLAG)
17
18GENERAL=Makefile README
19TEST=
20APPS=
21
22LIB=$(TOP)/libcrypto.a
23LIBSRC= pk7_asn1.c pk7_lib.c pkcs7err.c pk7_doit.c pk7_smime.c pk7_attr.c \
24 pk7_mime.c bio_pk7.c
25LIBOBJ= pk7_asn1.o pk7_lib.o pkcs7err.o pk7_doit.o pk7_smime.o pk7_attr.o \
26 pk7_mime.o bio_pk7.o
27
28SRC= $(LIBSRC)
29
30EXHEADER= pkcs7.h
31HEADER= $(EXHEADER)
32
33ALL= $(GENERAL) $(SRC) $(HEADER)
34
35top:
36 (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all)
37
38test:
39
40all: lib
41
42testapps: enc dec sign verify
43
44enc: enc.o lib
45 $(CC) $(CFLAGS) -o enc enc.o $(PEX_LIBS) $(LIB) $(EX_LIBS)
46
47dec: dec.o lib
48 $(CC) $(CFLAGS) -o dec dec.o $(PEX_LIBS) $(LIB) $(EX_LIBS)
49
50sign: sign.o lib
51 $(CC) $(CFLAGS) -o sign sign.o $(PEX_LIBS) $(LIB) $(EX_LIBS)
52
53verify: verify.o example.o lib
54 $(CC) $(CFLAGS) -o verify verify.o $(PEX_LIBS) example.o $(LIB) $(EX_LIBS)
55
56lib: $(LIBOBJ)
57 $(AR) $(LIB) $(LIBOBJ)
58 $(RANLIB) $(LIB) || echo Never mind.
59 @touch lib
60
61files:
62 $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
63
64links:
65 @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
66 @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
67 @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
68
69install:
70 @[ -n "$(INSTALLTOP)" ] # should be set by top Makefile...
71 @headerlist="$(EXHEADER)"; for i in $$headerlist ; \
72 do \
73 (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
74 chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
75 done;
76
77tags:
78 ctags $(SRC)
79
80tests:
81
82lint:
83 lint -DLINT $(INCLUDES) $(SRC)>fluff
84
85depend:
86 @[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile...
87 $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
88
89dclean:
90 $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
91 mv -f Makefile.new $(MAKEFILE)
92
93clean:
94 rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff enc dec sign verify
95
96# DO NOT DELETE THIS LINE -- make depend depends on it.
97
98bio_pk7.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
99bio_pk7.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
100bio_pk7.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
101bio_pk7.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
102bio_pk7.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
103bio_pk7.o: ../../include/openssl/symhacks.h bio_pk7.c
104pk7_asn1.o: ../../e_os.h ../../include/openssl/asn1.h
105pk7_asn1.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
106pk7_asn1.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
107pk7_asn1.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
108pk7_asn1.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
109pk7_asn1.o: ../../include/openssl/err.h ../../include/openssl/evp.h
110pk7_asn1.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
111pk7_asn1.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
112pk7_asn1.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
113pk7_asn1.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
114pk7_asn1.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
115pk7_asn1.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
116pk7_asn1.o: ../../include/openssl/x509_vfy.h ../cryptlib.h pk7_asn1.c
117pk7_attr.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h
118pk7_attr.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
119pk7_attr.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
120pk7_attr.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
121pk7_attr.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
122pk7_attr.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
123pk7_attr.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
124pk7_attr.o: ../../include/openssl/opensslconf.h
125pk7_attr.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
126pk7_attr.o: ../../include/openssl/pem.h ../../include/openssl/pem2.h
127pk7_attr.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
128pk7_attr.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
129pk7_attr.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
130pk7_attr.o: ../../include/openssl/x509_vfy.h pk7_attr.c
131pk7_doit.o: ../../e_os.h ../../include/openssl/asn1.h
132pk7_doit.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
133pk7_doit.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
134pk7_doit.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
135pk7_doit.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
136pk7_doit.o: ../../include/openssl/err.h ../../include/openssl/evp.h
137pk7_doit.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
138pk7_doit.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
139pk7_doit.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
140pk7_doit.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h
141pk7_doit.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
142pk7_doit.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
143pk7_doit.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
144pk7_doit.o: ../../include/openssl/x509v3.h ../cryptlib.h pk7_doit.c
145pk7_lib.o: ../../e_os.h ../../include/openssl/asn1.h
146pk7_lib.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
147pk7_lib.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
148pk7_lib.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
149pk7_lib.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
150pk7_lib.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
151pk7_lib.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
152pk7_lib.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
153pk7_lib.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
154pk7_lib.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
155pk7_lib.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
156pk7_lib.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
157pk7_lib.o: ../asn1/asn1_locl.h ../cryptlib.h pk7_lib.c
158pk7_mime.o: ../../e_os.h ../../include/openssl/asn1.h
159pk7_mime.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
160pk7_mime.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
161pk7_mime.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
162pk7_mime.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
163pk7_mime.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
164pk7_mime.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
165pk7_mime.o: ../../include/openssl/opensslconf.h
166pk7_mime.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
167pk7_mime.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h
168pk7_mime.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
169pk7_mime.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
170pk7_mime.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
171pk7_mime.o: ../cryptlib.h pk7_mime.c
172pk7_smime.o: ../../e_os.h ../../include/openssl/asn1.h
173pk7_smime.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
174pk7_smime.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
175pk7_smime.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
176pk7_smime.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
177pk7_smime.o: ../../include/openssl/err.h ../../include/openssl/evp.h
178pk7_smime.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
179pk7_smime.o: ../../include/openssl/objects.h
180pk7_smime.o: ../../include/openssl/opensslconf.h
181pk7_smime.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
182pk7_smime.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
183pk7_smime.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
184pk7_smime.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
185pk7_smime.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
186pk7_smime.o: ../cryptlib.h pk7_smime.c
187pkcs7err.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
188pkcs7err.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
189pkcs7err.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
190pkcs7err.o: ../../include/openssl/opensslconf.h
191pkcs7err.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
192pkcs7err.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
193pkcs7err.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
194pkcs7err.o: pkcs7err.c
diff --git a/src/lib/libcrypto/pkcs7/bio_ber.c b/src/lib/libcrypto/pkcs7/bio_ber.c
new file mode 100644
index 0000000000..31973fcd1f
--- /dev/null
+++ b/src/lib/libcrypto/pkcs7/bio_ber.c
@@ -0,0 +1,466 @@
1/* crypto/evp/bio_ber.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
59#include <stdio.h>
60#include <errno.h>
61#include "cryptlib.h"
62#include <openssl/buffer.h>
63#include <openssl/evp.h>
64
65static int ber_write(BIO *h,char *buf,int num);
66static int ber_read(BIO *h,char *buf,int size);
67/*static int ber_puts(BIO *h,char *str); */
68/*static int ber_gets(BIO *h,char *str,int size); */
69static long ber_ctrl(BIO *h,int cmd,long arg1,char *arg2);
70static int ber_new(BIO *h);
71static int ber_free(BIO *data);
72static long ber_callback_ctrl(BIO *h,int cmd,void *(*fp)());
73#define BER_BUF_SIZE (32)
74
75/* This is used to hold the state of the BER objects being read. */
76typedef struct ber_struct
77 {
78 int tag;
79 int class;
80 long length;
81 int inf;
82 int num_left;
83 int depth;
84 } BER_CTX;
85
86typedef struct bio_ber_struct
87 {
88 int tag;
89 int class;
90 long length;
91 int inf;
92
93 /* most of the following are used when doing non-blocking IO */
94 /* reading */
95 long num_left; /* number of bytes still to read/write in block */
96 int depth; /* used with indefinite encoding. */
97 int finished; /* No more read data */
98
99 /* writting */
100 char *w_addr;
101 int w_offset;
102 int w_left;
103
104 int buf_len;
105 int buf_off;
106 unsigned char buf[BER_BUF_SIZE];
107 } BIO_BER_CTX;
108
109static BIO_METHOD methods_ber=
110 {
111 BIO_TYPE_CIPHER,"cipher",
112 ber_write,
113 ber_read,
114 NULL, /* ber_puts, */
115 NULL, /* ber_gets, */
116 ber_ctrl,
117 ber_new,
118 ber_free,
119 ber_callback_ctrl,
120 };
121
122BIO_METHOD *BIO_f_ber(void)
123 {
124 return(&methods_ber);
125 }
126
127static int ber_new(BIO *bi)
128 {
129 BIO_BER_CTX *ctx;
130
131 ctx=(BIO_BER_CTX *)OPENSSL_malloc(sizeof(BIO_BER_CTX));
132 if (ctx == NULL) return(0);
133
134 memset((char *)ctx,0,sizeof(BIO_BER_CTX));
135
136 bi->init=0;
137 bi->ptr=(char *)ctx;
138 bi->flags=0;
139 return(1);
140 }
141
142static int ber_free(BIO *a)
143 {
144 BIO_BER_CTX *b;
145
146 if (a == NULL) return(0);
147 b=(BIO_BER_CTX *)a->ptr;
148 OPENSSL_cleanse(a->ptr,sizeof(BIO_BER_CTX));
149 OPENSSL_free(a->ptr);
150 a->ptr=NULL;
151 a->init=0;
152 a->flags=0;
153 return(1);
154 }
155
156int bio_ber_get_header(BIO *bio, BIO_BER_CTX *ctx)
157 {
158 char buf[64];
159 int i,j,n;
160 int ret;
161 unsigned char *p;
162 unsigned long length
163 int tag;
164 int class;
165 long max;
166
167 BIO_clear_retry_flags(b);
168
169 /* Pack the buffer down if there is a hole at the front */
170 if (ctx->buf_off != 0)
171 {
172 p=ctx->buf;
173 j=ctx->buf_off;
174 n=ctx->buf_len-j;
175 for (i=0; i<n; i++)
176 {
177 p[0]=p[j];
178 p++;
179 }
180 ctx->buf_len-j;
181 ctx->buf_off=0;
182 }
183
184 /* If there is more room, read some more data */
185 i=BER_BUF_SIZE-ctx->buf_len;
186 if (i)
187 {
188 i=BIO_read(bio->next_bio,&(ctx->buf[ctx->buf_len]),i);
189 if (i <= 0)
190 {
191 BIO_copy_next_retry(b);
192 return(i);
193 }
194 else
195 ctx->buf_len+=i;
196 }
197
198 max=ctx->buf_len;
199 p=ctx->buf;
200 ret=ASN1_get_object(&p,&length,&tag,&class,max);
201
202 if (ret & 0x80)
203 {
204 if ((ctx->buf_len < BER_BUF_SIZE) &&
205 (ERR_GET_REASON(ERR_peek_error()) == ASN1_R_TOO_LONG))
206 {
207 ERR_clear_error(); /* clear the error */
208 BIO_set_retry_read(b);
209 }
210 return(-1);
211 }
212
213 /* We have no error, we have a header, so make use of it */
214
215 if ((ctx->tag >= 0) && (ctx->tag != tag))
216 {
217 BIOerr(BIO_F_BIO_BER_GET_HEADER,BIO_R_TAG_MISMATCH);
218 sprintf(buf,"tag=%d, got %d",ctx->tag,tag);
219 ERR_add_error_data(1,buf);
220 return(-1);
221 }
222 if (ret & 0x01)
223 if (ret & V_ASN1_CONSTRUCTED)
224 }
225
226static int ber_read(BIO *b, char *out, int outl)
227 {
228 int ret=0,i,n;
229 BIO_BER_CTX *ctx;
230
231 BIO_clear_retry_flags(b);
232
233 if (out == NULL) return(0);
234 ctx=(BIO_BER_CTX *)b->ptr;
235
236 if ((ctx == NULL) || (b->next_bio == NULL)) return(0);
237
238 if (ctx->finished) return(0);
239
240again:
241 /* First see if we are half way through reading a block */
242 if (ctx->num_left > 0)
243 {
244 if (ctx->num_left < outl)
245 n=ctx->num_left;
246 else
247 n=outl;
248 i=BIO_read(b->next_bio,out,n);
249 if (i <= 0)
250 {
251 BIO_copy_next_retry(b);
252 return(i);
253 }
254 ctx->num_left-=i;
255 outl-=i;
256 ret+=i;
257 if (ctx->num_left <= 0)
258 {
259 ctx->depth--;
260 if (ctx->depth <= 0)
261 ctx->finished=1;
262 }
263 if (outl <= 0)
264 return(ret);
265 else
266 goto again;
267 }
268 else /* we need to read another BER header */
269 {
270 }
271 }
272
273static int ber_write(BIO *b, char *in, int inl)
274 {
275 int ret=0,n,i;
276 BIO_ENC_CTX *ctx;
277
278 ctx=(BIO_ENC_CTX *)b->ptr;
279 ret=inl;
280
281 BIO_clear_retry_flags(b);
282 n=ctx->buf_len-ctx->buf_off;
283 while (n > 0)
284 {
285 i=BIO_write(b->next_bio,&(ctx->buf[ctx->buf_off]),n);
286 if (i <= 0)
287 {
288 BIO_copy_next_retry(b);
289 return(i);
290 }
291 ctx->buf_off+=i;
292 n-=i;
293 }
294 /* at this point all pending data has been written */
295
296 if ((in == NULL) || (inl <= 0)) return(0);
297
298 ctx->buf_off=0;
299 while (inl > 0)
300 {
301 n=(inl > ENC_BLOCK_SIZE)?ENC_BLOCK_SIZE:inl;
302 EVP_CipherUpdate(&(ctx->cipher),
303 (unsigned char *)ctx->buf,&ctx->buf_len,
304 (unsigned char *)in,n);
305 inl-=n;
306 in+=n;
307
308 ctx->buf_off=0;
309 n=ctx->buf_len;
310 while (n > 0)
311 {
312 i=BIO_write(b->next_bio,&(ctx->buf[ctx->buf_off]),n);
313 if (i <= 0)
314 {
315 BIO_copy_next_retry(b);
316 return(i);
317 }
318 n-=i;
319 ctx->buf_off+=i;
320 }
321 ctx->buf_len=0;
322 ctx->buf_off=0;
323 }
324 BIO_copy_next_retry(b);
325 return(ret);
326 }
327
328static long ber_ctrl(BIO *b, int cmd, long num, char *ptr)
329 {
330 BIO *dbio;
331 BIO_ENC_CTX *ctx,*dctx;
332 long ret=1;
333 int i;
334
335 ctx=(BIO_ENC_CTX *)b->ptr;
336
337 switch (cmd)
338 {
339 case BIO_CTRL_RESET:
340 ctx->ok=1;
341 ctx->finished=0;
342 EVP_CipherInit_ex(&(ctx->cipher),NULL,NULL,NULL,NULL,
343 ctx->cipher.berrypt);
344 ret=BIO_ctrl(b->next_bio,cmd,num,ptr);
345 break;
346 case BIO_CTRL_EOF: /* More to read */
347 if (ctx->cont <= 0)
348 ret=1;
349 else
350 ret=BIO_ctrl(b->next_bio,cmd,num,ptr);
351 break;
352 case BIO_CTRL_WPENDING:
353 ret=ctx->buf_len-ctx->buf_off;
354 if (ret <= 0)
355 ret=BIO_ctrl(b->next_bio,cmd,num,ptr);
356 break;
357 case BIO_CTRL_PENDING: /* More to read in buffer */
358 ret=ctx->buf_len-ctx->buf_off;
359 if (ret <= 0)
360 ret=BIO_ctrl(b->next_bio,cmd,num,ptr);
361 break;
362 case BIO_CTRL_FLUSH:
363 /* do a final write */
364again:
365 while (ctx->buf_len != ctx->buf_off)
366 {
367 i=ber_write(b,NULL,0);
368 if (i < 0)
369 {
370 ret=i;
371 break;
372 }
373 }
374
375 if (!ctx->finished)
376 {
377 ctx->finished=1;
378 ctx->buf_off=0;
379 ret=EVP_CipherFinal_ex(&(ctx->cipher),
380 (unsigned char *)ctx->buf,
381 &(ctx->buf_len));
382 ctx->ok=(int)ret;
383 if (ret <= 0) break;
384
385 /* push out the bytes */
386 goto again;
387 }
388
389 /* Finally flush the underlying BIO */
390 ret=BIO_ctrl(b->next_bio,cmd,num,ptr);
391 break;
392 case BIO_C_GET_CIPHER_STATUS:
393 ret=(long)ctx->ok;
394 break;
395 case BIO_C_DO_STATE_MACHINE:
396 BIO_clear_retry_flags(b);
397 ret=BIO_ctrl(b->next_bio,cmd,num,ptr);
398 BIO_copy_next_retry(b);
399 break;
400
401 case BIO_CTRL_DUP:
402 dbio=(BIO *)ptr;
403 dctx=(BIO_ENC_CTX *)dbio->ptr;
404 memcpy(&(dctx->cipher),&(ctx->cipher),sizeof(ctx->cipher));
405 dbio->init=1;
406 break;
407 default:
408 ret=BIO_ctrl(b->next_bio,cmd,num,ptr);
409 break;
410 }
411 return(ret);
412 }
413
414static long ber_callback_ctrl(BIO *b, int cmd, void *(*fp)())
415 {
416 long ret=1;
417
418 if (b->next_bio == NULL) return(0);
419 switch (cmd)
420 {
421 default:
422 ret=BIO_callback_ctrl(b->next_bio,cmd,fp);
423 break;
424 }
425 return(ret);
426 }
427
428/*
429void BIO_set_cipher_ctx(b,c)
430BIO *b;
431EVP_CIPHER_ctx *c;
432 {
433 if (b == NULL) return;
434
435 if ((b->callback != NULL) &&
436 (b->callback(b,BIO_CB_CTRL,(char *)c,BIO_CTRL_SET,e,0L) <= 0))
437 return;
438
439 b->init=1;
440 ctx=(BIO_ENC_CTX *)b->ptr;
441 memcpy(ctx->cipher,c,sizeof(EVP_CIPHER_CTX));
442
443 if (b->callback != NULL)
444 b->callback(b,BIO_CB_CTRL,(char *)c,BIO_CTRL_SET,e,1L);
445 }
446*/
447
448void BIO_set_cipher(BIO *b, EVP_CIPHER *c, unsigned char *k, unsigned char *i,
449 int e)
450 {
451 BIO_ENC_CTX *ctx;
452
453 if (b == NULL) return;
454
455 if ((b->callback != NULL) &&
456 (b->callback(b,BIO_CB_CTRL,(char *)c,BIO_CTRL_SET,e,0L) <= 0))
457 return;
458
459 b->init=1;
460 ctx=(BIO_ENC_CTX *)b->ptr;
461 EVP_CipherInit_ex(&(ctx->cipher),c,NULL,k,i,e);
462
463 if (b->callback != NULL)
464 b->callback(b,BIO_CB_CTRL,(char *)c,BIO_CTRL_SET,e,1L);
465 }
466
diff --git a/src/lib/libcrypto/pkcs7/dec.c b/src/lib/libcrypto/pkcs7/dec.c
new file mode 100644
index 0000000000..6752ec568a
--- /dev/null
+++ b/src/lib/libcrypto/pkcs7/dec.c
@@ -0,0 +1,248 @@
1/* crypto/pkcs7/verify.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58#include <stdio.h>
59#include <stdlib.h>
60#include <string.h>
61#include <openssl/bio.h>
62#include <openssl/x509.h>
63#include <openssl/pem.h>
64#include <openssl/err.h>
65#include <openssl/asn1.h>
66
67int verify_callback(int ok, X509_STORE_CTX *ctx);
68
69BIO *bio_err=NULL;
70
71int main(argc,argv)
72int argc;
73char *argv[];
74 {
75 char *keyfile=NULL;
76 BIO *in;
77 EVP_PKEY *pkey;
78 X509 *x509;
79 PKCS7 *p7;
80 PKCS7_SIGNER_INFO *si;
81 X509_STORE_CTX cert_ctx;
82 X509_STORE *cert_store=NULL;
83 BIO *data,*detached=NULL,*p7bio=NULL;
84 char buf[1024*4];
85 unsigned char *pp;
86 int i,printit=0;
87 STACK_OF(PKCS7_SIGNER_INFO) *sk;
88
89 OpenSSL_add_all_algorithms();
90 bio_err=BIO_new_fp(stderr,BIO_NOCLOSE);
91
92 data=BIO_new(BIO_s_file());
93 pp=NULL;
94 while (argc > 1)
95 {
96 argc--;
97 argv++;
98 if (strcmp(argv[0],"-p") == 0)
99 {
100 printit=1;
101 }
102 else if ((strcmp(argv[0],"-k") == 0) && (argc >= 2)) {
103 keyfile = argv[1];
104 argc-=1;
105 argv+=1;
106 } else if ((strcmp(argv[0],"-d") == 0) && (argc >= 2))
107 {
108 detached=BIO_new(BIO_s_file());
109 if (!BIO_read_filename(detached,argv[1]))
110 goto err;
111 argc-=1;
112 argv+=1;
113 }
114 else break;
115 }
116
117 if (!BIO_read_filename(data,argv[0])) goto err;
118
119 if(!keyfile) {
120 fprintf(stderr, "No private key file specified\n");
121 goto err;
122 }
123
124 if ((in=BIO_new_file(keyfile,"r")) == NULL) goto err;
125 if ((x509=PEM_read_bio_X509(in,NULL,NULL,NULL)) == NULL) goto err;
126 BIO_reset(in);
127 if ((pkey=PEM_read_bio_PrivateKey(in,NULL,NULL,NULL)) == NULL)
128 goto err;
129 BIO_free(in);
130
131 if (pp == NULL)
132 BIO_set_fp(data,stdin,BIO_NOCLOSE);
133
134
135 /* Load the PKCS7 object from a file */
136 if ((p7=PEM_read_bio_PKCS7(data,NULL,NULL,NULL)) == NULL) goto err;
137
138
139
140 /* This stuff is being setup for certificate verification.
141 * When using SSL, it could be replaced with a
142 * cert_stre=SSL_CTX_get_cert_store(ssl_ctx); */
143 cert_store=X509_STORE_new();
144 X509_STORE_set_default_paths(cert_store);
145 X509_STORE_load_locations(cert_store,NULL,"../../certs");
146 X509_STORE_set_verify_cb_func(cert_store,verify_callback);
147
148 ERR_clear_error();
149
150 /* We need to process the data */
151 /* We cannot support detached encryption */
152 p7bio=PKCS7_dataDecode(p7,pkey,detached,x509);
153
154 if (p7bio == NULL)
155 {
156 printf("problems decoding\n");
157 goto err;
158 }
159
160 /* We now have to 'read' from p7bio to calculate digests etc. */
161 for (;;)
162 {
163 i=BIO_read(p7bio,buf,sizeof(buf));
164 /* print it? */
165 if (i <= 0) break;
166 fwrite(buf,1, i, stdout);
167 }
168
169 /* We can now verify signatures */
170 sk=PKCS7_get_signer_info(p7);
171 if (sk == NULL)
172 {
173 fprintf(stderr, "there are no signatures on this data\n");
174 }
175 else
176 {
177 /* Ok, first we need to, for each subject entry,
178 * see if we can verify */
179 ERR_clear_error();
180 for (i=0; i<sk_PKCS7_SIGNER_INFO_num(sk); i++)
181 {
182 si=sk_PKCS7_SIGNER_INFO_value(sk,i);
183 i=PKCS7_dataVerify(cert_store,&cert_ctx,p7bio,p7,si);
184 if (i <= 0)
185 goto err;
186 else
187 fprintf(stderr,"Signature verified\n");
188 }
189 }
190 X509_STORE_free(cert_store);
191
192 exit(0);
193err:
194 ERR_load_crypto_strings();
195 ERR_print_errors_fp(stderr);
196 exit(1);
197 }
198
199/* should be X509 * but we can just have them as char *. */
200int verify_callback(int ok, X509_STORE_CTX *ctx)
201 {
202 char buf[256];
203 X509 *err_cert;
204 int err,depth;
205
206 err_cert=X509_STORE_CTX_get_current_cert(ctx);
207 err= X509_STORE_CTX_get_error(ctx);
208 depth= X509_STORE_CTX_get_error_depth(ctx);
209
210 X509_NAME_oneline(X509_get_subject_name(err_cert),buf,256);
211 BIO_printf(bio_err,"depth=%d %s\n",depth,buf);
212 if (!ok)
213 {
214 BIO_printf(bio_err,"verify error:num=%d:%s\n",err,
215 X509_verify_cert_error_string(err));
216 if (depth < 6)
217 {
218 ok=1;
219 X509_STORE_CTX_set_error(ctx,X509_V_OK);
220 }
221 else
222 {
223 ok=0;
224 X509_STORE_CTX_set_error(ctx,X509_V_ERR_CERT_CHAIN_TOO_LONG);
225 }
226 }
227 switch (ctx->error)
228 {
229 case X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT:
230 X509_NAME_oneline(X509_get_issuer_name(ctx->current_cert),buf,256);
231 BIO_printf(bio_err,"issuer= %s\n",buf);
232 break;
233 case X509_V_ERR_CERT_NOT_YET_VALID:
234 case X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD:
235 BIO_printf(bio_err,"notBefore=");
236 ASN1_UTCTIME_print(bio_err,X509_get_notBefore(ctx->current_cert));
237 BIO_printf(bio_err,"\n");
238 break;
239 case X509_V_ERR_CERT_HAS_EXPIRED:
240 case X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD:
241 BIO_printf(bio_err,"notAfter=");
242 ASN1_UTCTIME_print(bio_err,X509_get_notAfter(ctx->current_cert));
243 BIO_printf(bio_err,"\n");
244 break;
245 }
246 BIO_printf(bio_err,"verify return:%d\n",ok);
247 return(ok);
248 }
diff --git a/src/lib/libcrypto/pkcs7/des.pem b/src/lib/libcrypto/pkcs7/des.pem
new file mode 100644
index 0000000000..62d1657e3e
--- /dev/null
+++ b/src/lib/libcrypto/pkcs7/des.pem
@@ -0,0 +1,15 @@
1
2MIAGCSqGSIb3DQEHA6CAMIACAQAxggHmMIHwAgEAMIGZMIGSMQswCQYDVQQGEwJBVTETMBEG
3A1UECBMKUXVlZW5zbGFuZDERMA8GA1UEBxMIQnJpc2JhbmUxGjAYBgNVBAoTEUNyeXB0c29m
4dCBQdHkgTHRkMSIwIAYDVQQLExlERU1PTlNUUkFUSU9OIEFORCBURVNUSU5HMRswGQYDVQQD
5ExJERU1PIFpFUk8gVkFMVUUgQ0ECAgR+MA0GCSqGSIb3DQEBAQUABEC2vXI1xQDW6lUHM3zQ
6/9uBEBOO5A3TtkrklAXq7v01gsIC21t52qSk36REXY+slhNZ0OQ349tgkTsoETHFLoEwMIHw
7AgEAMIGZMIGSMQswCQYDVQQGEwJBVTETMBEGA1UECBMKUXVlZW5zbGFuZDERMA8GA1UEBxMI
8QnJpc2JhbmUxGjAYBgNVBAoTEUNyeXB0c29mdCBQdHkgTHRkMSIwIAYDVQQLExlERU1PTlNU
9UkFUSU9OIEFORCBURVNUSU5HMRswGQYDVQQDExJERU1PIFpFUk8gVkFMVUUgQ0ECAgR9MA0G
10CSqGSIb3DQEBAQUABEB8ujxbabxXUYJhopuDm3oDq4JNqX6Io4p3ro+ShqfIndsXTZ1v5a2N
11WtLLCWlHn/habjBwZ/DgQgcKASbZ7QxNMIAGCSqGSIb3DQEHATAaBggqhkiG9w0DAjAOAgIA
12oAQIbsL5v1wX98KggAQoAaJ4WHm68fXY1WE5OIjfVBIDpO1K+i8dmKhjnAjrjoyZ9Bwc8rDL
13lgQg4CXb805h5xl+GfvSwUaHJayte1m2mcOhs3J2YyqbQ+MEIMIiJQccmhO3oDKm36CFvYR8
145PjpclVcZyX2ngbwPFMnBAgy0clOAE6UKAAAAAAAAAAAAAA=
15
diff --git a/src/lib/libcrypto/pkcs7/doc b/src/lib/libcrypto/pkcs7/doc
new file mode 100644
index 0000000000..d2e8b7b2a3
--- /dev/null
+++ b/src/lib/libcrypto/pkcs7/doc
@@ -0,0 +1,24 @@
1int PKCS7_set_content_type(PKCS7 *p7, int type);
2Call to set the type of PKCS7 object we are working on
3
4int PKCS7_SIGNER_INFO_set(PKCS7_SIGNER_INFO *p7i, X509 *x509, EVP_PKEY *pkey,
5 EVP_MD *dgst);
6Use this to setup a signer info
7There will also be functions to add signed and unsigned attributes.
8
9int PKCS7_add_signer(PKCS7 *p7, PKCS7_SIGNER_INFO *p7i);
10Add a signer info to the content.
11
12int PKCS7_add_certificae(PKCS7 *p7, X509 *x509);
13int PKCS7_add_crl(PKCS7 *p7, X509_CRL *x509);
14
15----
16
17p7=PKCS7_new();
18PKCS7_set_content_type(p7,NID_pkcs7_signed);
19
20signer=PKCS7_SINGNER_INFO_new();
21PKCS7_SIGNER_INFO_set(signer,x509,pkey,EVP_md5());
22PKCS7_add_signer(py,signer);
23
24we are now setup.
diff --git a/src/lib/libcrypto/pkcs7/enc.c b/src/lib/libcrypto/pkcs7/enc.c
new file mode 100644
index 0000000000..7417f8a4e0
--- /dev/null
+++ b/src/lib/libcrypto/pkcs7/enc.c
@@ -0,0 +1,174 @@
1/* crypto/pkcs7/enc.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58#include <stdio.h>
59#include <string.h>
60#include <openssl/bio.h>
61#include <openssl/x509.h>
62#include <openssl/pem.h>
63#include <openssl/err.h>
64
65int main(argc,argv)
66int argc;
67char *argv[];
68 {
69 X509 *x509;
70 PKCS7 *p7;
71 BIO *in;
72 BIO *data,*p7bio;
73 char buf[1024*4];
74 int i;
75 int nodetach=1;
76 char *keyfile = NULL;
77 const EVP_CIPHER *cipher=NULL;
78 STACK_OF(X509) *recips=NULL;
79
80 OpenSSL_add_all_algorithms();
81
82 data=BIO_new(BIO_s_file());
83 while(argc > 1)
84 {
85 if (strcmp(argv[1],"-nd") == 0)
86 {
87 nodetach=1;
88 argv++; argc--;
89 }
90 else if ((strcmp(argv[1],"-c") == 0) && (argc >= 2)) {
91 if(!(cipher = EVP_get_cipherbyname(argv[2]))) {
92 fprintf(stderr, "Unknown cipher %s\n", argv[2]);
93 goto err;
94 }
95 argc-=2;
96 argv+=2;
97 } else if ((strcmp(argv[1],"-k") == 0) && (argc >= 2)) {
98 keyfile = argv[2];
99 argc-=2;
100 argv+=2;
101 if (!(in=BIO_new_file(keyfile,"r"))) goto err;
102 if (!(x509=PEM_read_bio_X509(in,NULL,NULL,NULL)))
103 goto err;
104 if(!recips) recips = sk_X509_new_null();
105 sk_X509_push(recips, x509);
106 BIO_free(in);
107 } else break;
108 }
109
110 if(!recips) {
111 fprintf(stderr, "No recipients\n");
112 goto err;
113 }
114
115 if (!BIO_read_filename(data,argv[1])) goto err;
116
117 p7=PKCS7_new();
118#if 0
119 BIO_reset(in);
120 if ((pkey=PEM_read_bio_PrivateKey(in,NULL,NULL)) == NULL) goto err;
121 BIO_free(in);
122 PKCS7_set_type(p7,NID_pkcs7_signedAndEnveloped);
123
124 if (PKCS7_add_signature(p7,x509,pkey,EVP_sha1()) == NULL) goto err;
125 /* we may want to add more */
126 PKCS7_add_certificate(p7,x509);
127#else
128 PKCS7_set_type(p7,NID_pkcs7_enveloped);
129#endif
130 if(!cipher) {
131#ifndef OPENSSL_NO_DES
132 cipher = EVP_des_ede3_cbc();
133#else
134 fprintf(stderr, "No cipher selected\n");
135 goto err;
136#endif
137 }
138
139 if (!PKCS7_set_cipher(p7,cipher)) goto err;
140 for(i = 0; i < sk_X509_num(recips); i++) {
141 if (!PKCS7_add_recipient(p7,sk_X509_value(recips, i))) goto err;
142 }
143 sk_X509_pop_free(recips, X509_free);
144
145 /* Set the content of the signed to 'data' */
146 /* PKCS7_content_new(p7,NID_pkcs7_data); not used in envelope */
147
148 /* could be used, but not in this version :-)
149 if (!nodetach) PKCS7_set_detached(p7,1);
150 */
151
152 if ((p7bio=PKCS7_dataInit(p7,NULL)) == NULL) goto err;
153
154 for (;;)
155 {
156 i=BIO_read(data,buf,sizeof(buf));
157 if (i <= 0) break;
158 BIO_write(p7bio,buf,i);
159 }
160 BIO_flush(p7bio);
161
162 if (!PKCS7_dataFinal(p7,p7bio)) goto err;
163 BIO_free(p7bio);
164
165 PEM_write_PKCS7(stdout,p7);
166 PKCS7_free(p7);
167
168 exit(0);
169err:
170 ERR_load_crypto_strings();
171 ERR_print_errors_fp(stderr);
172 exit(1);
173 }
174
diff --git a/src/lib/libcrypto/pkcs7/es1.pem b/src/lib/libcrypto/pkcs7/es1.pem
new file mode 100644
index 0000000000..47112a238f
--- /dev/null
+++ b/src/lib/libcrypto/pkcs7/es1.pem
@@ -0,0 +1,66 @@
1-----BEGIN PKCS7-----
2MIAGCSqGSIb3DQEHA6CAMIACAQAxggHmMIHwAgEAMIGZMIGSMQswCQYDVQQGEwJBVTETMBEG
3A1UECBMKUXVlZW5zbGFuZDERMA8GA1UEBxMIQnJpc2JhbmUxGjAYBgNVBAoTEUNyeXB0c29m
4dCBQdHkgTHRkMSIwIAYDVQQLExlERU1PTlNUUkFUSU9OIEFORCBURVNUSU5HMRswGQYDVQQD
5ExJERU1PIFpFUk8gVkFMVUUgQ0ECAgRuMA0GCSqGSIb3DQEBAQUABEDWak0y/5XZJhQJeCLo
6KECcHXkTEbjzYkYNHIinbiPmRK4QbNfs9z2mA3z/c2ykQ4eAqFR2jyNrUMN/+I5XEiv6MIHw
7AgEAMIGZMIGSMQswCQYDVQQGEwJBVTETMBEGA1UECBMKUXVlZW5zbGFuZDERMA8GA1UEBxMI
8QnJpc2JhbmUxGjAYBgNVBAoTEUNyeXB0c29mdCBQdHkgTHRkMSIwIAYDVQQLExlERU1PTlNU
9UkFUSU9OIEFORCBURVNUSU5HMRswGQYDVQQDExJERU1PIFpFUk8gVkFMVUUgQ0ECAgR9MA0G
10CSqGSIb3DQEBAQUABEAWg9+KgtCjc77Jdj1Ve4wGgHjVHbbSYEA1ZqKFDoi15vSr9hfpHmC4
11ycZzcRo16JkTfolefiHZzmyjVz94vSN6MIAGCSqGSIb3DQEHATAaBggqhkiG9w0DAjAOAgIA
12oAQI7X4Tk4mcbV6ggASBsHl1mCaJ3RhXWlNPCgCRU53d7M5x6TDZRkvwdtdvW96m1lupT03F
13XtonkBqk7oMkH7kGfs5/REQOPjx0QE2Ixmgt1W3szum82EZwA7pZNppcraK7W/odw/7bYZO+
14II3HPmRklE2N9qiu1LPaPUsnYogkO6SennyeL5tZ382vBweL/8pnG0qsbT1OBb65v+llnsjT
15pa1T/p+fIx/iJJGE6K9fYFokC6gXLQ6ozXRdOu5oBDB8mPCYYvAqKycidM/MrGGUkpEtS4f0
16lS31PwQi5YTim8Ig3/TOwVpPX32i46FTuEIEIMHkD/OvpfwCCzXUHHJnKnKUAUvIsSY3vGBs
178ezpUDfBBBj9LHDy32hZ2tQilkDefP5VM2LLdrWgamYEgfiyITQvn08Ul5lQOQxbFKBheFq5
18otCCN4MR+w5eq12xQu6y+f9z0159ag2ru87D0lLtUtXXtCELbO1nUkT2sJ0k/iDs9TOXr6Cx
19go1XKYho83hlkXYiCteVizdAbgVGNsNRD4wtIdajsorET/LuJECgp11YeL9w1dlDB0HLEZfi
20XCsUphH4jGagba3hDeUSibnjSiJlN0ukfuQurBBbI2UkBAujiEAubKPn7C1FZJRSw6CPPX5t
21KEpmcqT1JNk6LO8Js6/1sCmmBh1VGCy1+EuTI9J1p7Dagf4nQ8cHitoCRpHuKZlFHnZyv7tw
22Rn/KOhHaYP2VzAh40gQIvKMAAWh9oFsEEIMwIoOmLwLH5wf+8QdbDhoECH8HwZt9a12dBAjL
23r4j2zlvtfgQIt7nmEM3wz1EECKlc3EIy1irCBBCAKINcermK3A+jI6ISN2RzBFA3dsh/xwMu
24l61aWMBBZzEz/SF92k6n35KZhCC0d6fIVC/1WMv0fnCwQ8oEDynSre216VEFiYKBaQLJe5o/
25mTAxC7Ht3goXnuc+i1FItOkLrgRI/wyvTICEn2WsNZiMADnGaee2bqPnUopo+VMGexJEtCPk
26l0ZNlDJGquPDkpUwaEtecVZzCNyVPYyyF4J/l8rmGDhDdYUIC8IKBEg/ip/E0BuubBLWVbv+
27HRl4QrnGpyCyeXRXXK603QP3sT1Zbbm1v5pI/loOhVHi724LmtXHSyp5qv9MDcxE1PoX10LY
28gBRtlwwESPeCF8bK5jk4xIQMhK5NMHj1Y1KQWTZ9NGITBL4hjRq2qp4Qk5GIpGgOVPopAuCo
29TIyPikpqBRNtLSPRSsDs6QPUPzWBh6JgxwRQblnDKKUkxUcnJiD4i9QtGa/ZabMn4KxtNOBL
305JSh1nJkaLXCZY070131WWPAByLcd5TiXq8x84pmzV5NNk4tiMpoXhJNsx8e4rskQQlKd6ME
31SCe2eYDHKcKPX3WJbUzhrJSQ92/aWnI2iUY8WQ+kSNyiZ2QUjyuUg9Z66g/0d2STlvPOBHT/
32y5ODP2CwbcWX4QmCbUc9TT66fQRIrRVuwvtOfnUueyGgYhJ3HpAJfVaB/7kap5bj7Fi/azW4
339JDfd1bC/W9h0Kyk7RO2gxvE0hIHc26mZJHTm9MNP5D328MnM2MdBEjKjQBtgrp+lFIii7MP
34nGHFTKUkG4WAIZJCf/CsT+p6/SW0qG71Me/YcSw5STB24j+a+HgMV8RVIeUlkP4z0IWWrSoB
35Gh4d/Z0EUMCVHs/HZ/bWgiyhtHpvuVAzidm8D81p1LJ5BQX5/5f/m+q5+fS/npL27dTEbNqs
36LSB6ij3MZAi7LwHWpTn9zWnDajCMEj9vlaV7mcKtHK5iBEg85agFi1h3MvicqLtoFe5hVv9T
37tG0j6CRkjkixPzivltlrf44KHv14gLM0XJxCGyq7vd3l8QYr3+9at0zNnX/yqTiBnsnE5dUE
38SIgrYuz87M2gi/ER9PcDoTtONH3+CkcqVy03q/Sj8cVWD/b1KgEhqnNOfc8Ak9PctyR/ItcR
398Me5XVn1GJKkQJk4O29fxvgNoAQIrIESvUWGshAEQByXiFoFTDUByjTlgjcy77H1lrH+y3P/
40wAInJjJAut9kCNyGJV0PA4kdPB5USWltuO6t8gk4Pd2YBMl09zqUWkAEUCjFrtZ3mapjcGZI
41uQTASKR5LSjXoWxTT5gae/+64MerF/oCEeO3ehRTpjnPrsiRDo0rWIQTaj9+Nro8Z2xtWstw
42RnfoAHIxV1lEamPwjsceBEi2SD9hiifFeO5ECiVoaE1FdXUXhU+jwYAMx6jHWO9hMkYzS9pM
43Y3IyWR5ybtOjiQgkUdvRJPUPGf5DVVMPnymGX25aDh5PYpIESPbsM9akCpOOVuscywcUswmU
44o7dXvlB48WWCfg/al3BQKAZbn5ZXtWNwpUZkrEdHsrxAVv3rxRcdkT3Z1fzUbIuYkLJN200o
45WgRIJvn6RO8KEj7/HOg2sYuuM8nz1kR0TSgwX7/0y/7JfjBa0JIlP7o75sNJscE8oyoIMzuy
46Dvn6/U9g3BCDXn83A/s+ke60qn9gBFC6NAeLOlXal1YVWYhMQNOqCyUfAjiXBTawaysQb1Mk
47YgeNlF8xuEFcUQWIP+vNG7FJ5JPMaMRL4YEoaQ3sVFhYOERJR1cSb+8xt4QCYtBKQgRIUOmJ
48CHW5o1hXJWJiTkZK2qWFcEMzTINSj5EpYFySr8aVBjkRnI7vxegRT/+XZZXoYedQ3UNsnGI3
49DdkWii5VzX0PNF6C60pfBEiVpausYuX7Wjb3Lfm8cBj7GgN69i6Pm2gxtobVcmpo2nS4D714
50ePyhlX9n8kJ6QAcqWMRj22smDPrHVGNTizfzHBh5zNllK9gESJizILOWI327og3ZWp+qUht5
51kNDJCzMK7Z09UAy+h+vq0VTQuEo3FgLzVdqkJujjSL4Nx97lXg51AovrEn3nd4evydwcjKLX
521wRIo72NaeWuUEQ+rt1SlCsOJ7k1ioJSqhrPOfvwcaFcb4beVet1JWiy4yvowTjLDGbUje2s
53xjrlVt4BJWI/uA6jbQsrxSe89ADZBAi5YAlR4qszeAQIXD3VSBVKbRUECNTtyvw9vvqXBAhb
54IZNn4H4cxgQI+XW7GkfL+ekECCCCg2reMyGDBAh1PYqkg3lw3gQQkNlggEPU+BH8eh7Gm7n7
557AQIjC5EWbkil5cEEKcpuqwTWww/X89KnQAg8TcECJPomqHvrlZFBBiRSuIiHpmN+PaujXpv
56qZV2VhjkB2j09GEECOIdv8AVOJgKBAjlHgIqAD9jZQQIXHbs44+wogcEIGGqTACRJxrhMcMG
57X8drNjksIPt+snxTXUBIkTVpZWoABAh6unXPTyIr8QQgBF8xKoX27MWk7iTNmkSNZggZXa2a
58DWCGHSYLngbSOHIECD9XmO6VsvTgBAjfqB70CEW4WwQIVIBkbCocznUEEHB/zFXy/sR4OYHe
59UfbNPnIEEDWBB/NTCLMGE+o8BfyujcAECFik7GQnnF9VBBAhLXExQeWAofZNc6NtN7qZBCC1
60gVIS3ruTwKltmcrgx3heT3M8ZJhCfWa+6KzchnmKygQQ+1NL5sSzR4m/fdrqxHFyUAQYCT2x
61PamQr3wK3h0lyZER+4H0zPM86AhFBBC3CkmvL2vjflMfujnzPBVpBBge9rMbI5+0q9DLrTiT
625F3AIgXLpD8PQWAECHkHVo6RomV3BAgMbi8E271UeAQIqtS8wnI3XngECG3TWmOMb3/iBEha
63y+mvCS6I3n3JfL8e1B5P4qX9/czJRaERLuKpGNjLiL4A+zxN0LZ0UHd0qfmJjwOTxAx3iJAC
64lGXX4nB9ATYPUT5EU+o1Y4sECN01pP6vWNIdBDAsiE0Ts8/9ltJlqX2B3AoOM4qOt9EaCjXf
65lB+aEmrhtjUwuZ6GqS5Ke7P6XnakTk4ECCLIMatNdootAAAAAAAAAAAAAA==
66-----END PKCS7-----
diff --git a/src/lib/libcrypto/pkcs7/example.c b/src/lib/libcrypto/pkcs7/example.c
new file mode 100644
index 0000000000..2953d04b5c
--- /dev/null
+++ b/src/lib/libcrypto/pkcs7/example.c
@@ -0,0 +1,329 @@
1#include <stdio.h>
2#include <stdlib.h>
3#include <string.h>
4#include <openssl/pkcs7.h>
5#include <openssl/asn1_mac.h>
6#include <openssl/x509.h>
7
8int add_signed_time(PKCS7_SIGNER_INFO *si)
9 {
10 ASN1_UTCTIME *sign_time;
11
12 /* The last parameter is the amount to add/subtract from the current
13 * time (in seconds) */
14 sign_time=X509_gmtime_adj(NULL,0);
15 PKCS7_add_signed_attribute(si,NID_pkcs9_signingTime,
16 V_ASN1_UTCTIME,(char *)sign_time);
17 return(1);
18 }
19
20ASN1_UTCTIME *get_signed_time(PKCS7_SIGNER_INFO *si)
21 {
22 ASN1_TYPE *so;
23
24 so=PKCS7_get_signed_attribute(si,NID_pkcs9_signingTime);
25 if (so->type == V_ASN1_UTCTIME)
26 return so->value.utctime;
27 return NULL;
28 }
29
30static int signed_string_nid= -1;
31
32void add_signed_string(PKCS7_SIGNER_INFO *si, char *str)
33 {
34 ASN1_OCTET_STRING *os;
35
36 /* To a an object of OID 1.2.3.4.5, which is an octet string */
37 if (signed_string_nid == -1)
38 signed_string_nid=
39 OBJ_create("1.2.3.4.5","OID_example","Our example OID");
40 os=ASN1_OCTET_STRING_new();
41 ASN1_OCTET_STRING_set(os,(unsigned char*)str,strlen(str));
42 /* When we add, we do not free */
43 PKCS7_add_signed_attribute(si,signed_string_nid,
44 V_ASN1_OCTET_STRING,(char *)os);
45 }
46
47int get_signed_string(PKCS7_SIGNER_INFO *si, char *buf, int len)
48 {
49 ASN1_TYPE *so;
50 ASN1_OCTET_STRING *os;
51 int i;
52
53 if (signed_string_nid == -1)
54 signed_string_nid=
55 OBJ_create("1.2.3.4.5","OID_example","Our example OID");
56 /* To retrieve */
57 so=PKCS7_get_signed_attribute(si,signed_string_nid);
58 if (so != NULL)
59 {
60 if (so->type == V_ASN1_OCTET_STRING)
61 {
62 os=so->value.octet_string;
63 i=os->length;
64 if ((i+1) > len)
65 i=len-1;
66 memcpy(buf,os->data,i);
67 return(i);
68 }
69 }
70 return(0);
71 }
72
73static int signed_seq2string_nid= -1;
74/* ########################################### */
75int add_signed_seq2string(PKCS7_SIGNER_INFO *si, char *str1, char *str2)
76 {
77 /* To add an object of OID 1.9.999, which is a sequence containing
78 * 2 octet strings */
79 unsigned char *p;
80 ASN1_OCTET_STRING *os1,*os2;
81 ASN1_STRING *seq;
82 unsigned char *data;
83 int i,total;
84
85 if (signed_seq2string_nid == -1)
86 signed_seq2string_nid=
87 OBJ_create("1.9.9999","OID_example","Our example OID");
88
89 os1=ASN1_OCTET_STRING_new();
90 os2=ASN1_OCTET_STRING_new();
91 ASN1_OCTET_STRING_set(os1,(unsigned char*)str1,strlen(str1));
92 ASN1_OCTET_STRING_set(os2,(unsigned char*)str1,strlen(str1));
93 i =i2d_ASN1_OCTET_STRING(os1,NULL);
94 i+=i2d_ASN1_OCTET_STRING(os2,NULL);
95 total=ASN1_object_size(1,i,V_ASN1_SEQUENCE);
96
97 data=malloc(total);
98 p=data;
99 ASN1_put_object(&p,1,i,V_ASN1_SEQUENCE,V_ASN1_UNIVERSAL);
100 i2d_ASN1_OCTET_STRING(os1,&p);
101 i2d_ASN1_OCTET_STRING(os2,&p);
102
103 seq=ASN1_STRING_new();
104 ASN1_STRING_set(seq,data,total);
105 free(data);
106 ASN1_OCTET_STRING_free(os1);
107 ASN1_OCTET_STRING_free(os2);
108
109 PKCS7_add_signed_attribute(si,signed_seq2string_nid,
110 V_ASN1_SEQUENCE,(char *)seq);
111 return(1);
112 }
113
114/* For this case, I will malloc the return strings */
115int get_signed_seq2string(PKCS7_SIGNER_INFO *si, char **str1, char **str2)
116 {
117 ASN1_TYPE *so;
118
119 if (signed_seq2string_nid == -1)
120 signed_seq2string_nid=
121 OBJ_create("1.9.9999","OID_example","Our example OID");
122 /* To retrieve */
123 so=PKCS7_get_signed_attribute(si,signed_seq2string_nid);
124 if (so && (so->type == V_ASN1_SEQUENCE))
125 {
126 ASN1_const_CTX c;
127 ASN1_STRING *s;
128 long length;
129 ASN1_OCTET_STRING *os1,*os2;
130
131 s=so->value.sequence;
132 c.p=ASN1_STRING_data(s);
133 c.max=c.p+ASN1_STRING_length(s);
134 if (!asn1_GetSequence(&c,&length)) goto err;
135 /* Length is the length of the seqence */
136
137 c.q=c.p;
138 if ((os1=d2i_ASN1_OCTET_STRING(NULL,&c.p,c.slen)) == NULL)
139 goto err;
140 c.slen-=(c.p-c.q);
141
142 c.q=c.p;
143 if ((os2=d2i_ASN1_OCTET_STRING(NULL,&c.p,c.slen)) == NULL)
144 goto err;
145 c.slen-=(c.p-c.q);
146
147 if (!asn1_const_Finish(&c)) goto err;
148 *str1=malloc(os1->length+1);
149 *str2=malloc(os2->length+1);
150 memcpy(*str1,os1->data,os1->length);
151 memcpy(*str2,os2->data,os2->length);
152 (*str1)[os1->length]='\0';
153 (*str2)[os2->length]='\0';
154 ASN1_OCTET_STRING_free(os1);
155 ASN1_OCTET_STRING_free(os2);
156 return(1);
157 }
158err:
159 return(0);
160 }
161
162
163/* #######################################
164 * THE OTHER WAY TO DO THINGS
165 * #######################################
166 */
167X509_ATTRIBUTE *create_time(void)
168 {
169 ASN1_UTCTIME *sign_time;
170 X509_ATTRIBUTE *ret;
171
172 /* The last parameter is the amount to add/subtract from the current
173 * time (in seconds) */
174 sign_time=X509_gmtime_adj(NULL,0);
175 ret=X509_ATTRIBUTE_create(NID_pkcs9_signingTime,
176 V_ASN1_UTCTIME,(char *)sign_time);
177 return(ret);
178 }
179
180ASN1_UTCTIME *sk_get_time(STACK_OF(X509_ATTRIBUTE) *sk)
181 {
182 ASN1_TYPE *so;
183 PKCS7_SIGNER_INFO si;
184
185 si.auth_attr=sk;
186 so=PKCS7_get_signed_attribute(&si,NID_pkcs9_signingTime);
187 if (so->type == V_ASN1_UTCTIME)
188 return so->value.utctime;
189 return NULL;
190 }
191
192X509_ATTRIBUTE *create_string(char *str)
193 {
194 ASN1_OCTET_STRING *os;
195 X509_ATTRIBUTE *ret;
196
197 /* To a an object of OID 1.2.3.4.5, which is an octet string */
198 if (signed_string_nid == -1)
199 signed_string_nid=
200 OBJ_create("1.2.3.4.5","OID_example","Our example OID");
201 os=ASN1_OCTET_STRING_new();
202 ASN1_OCTET_STRING_set(os,(unsigned char*)str,strlen(str));
203 /* When we add, we do not free */
204 ret=X509_ATTRIBUTE_create(signed_string_nid,
205 V_ASN1_OCTET_STRING,(char *)os);
206 return(ret);
207 }
208
209int sk_get_string(STACK_OF(X509_ATTRIBUTE) *sk, char *buf, int len)
210 {
211 ASN1_TYPE *so;
212 ASN1_OCTET_STRING *os;
213 int i;
214 PKCS7_SIGNER_INFO si;
215
216 si.auth_attr=sk;
217
218 if (signed_string_nid == -1)
219 signed_string_nid=
220 OBJ_create("1.2.3.4.5","OID_example","Our example OID");
221 /* To retrieve */
222 so=PKCS7_get_signed_attribute(&si,signed_string_nid);
223 if (so != NULL)
224 {
225 if (so->type == V_ASN1_OCTET_STRING)
226 {
227 os=so->value.octet_string;
228 i=os->length;
229 if ((i+1) > len)
230 i=len-1;
231 memcpy(buf,os->data,i);
232 return(i);
233 }
234 }
235 return(0);
236 }
237
238X509_ATTRIBUTE *add_seq2string(PKCS7_SIGNER_INFO *si, char *str1, char *str2)
239 {
240 /* To add an object of OID 1.9.999, which is a sequence containing
241 * 2 octet strings */
242 unsigned char *p;
243 ASN1_OCTET_STRING *os1,*os2;
244 ASN1_STRING *seq;
245 X509_ATTRIBUTE *ret;
246 unsigned char *data;
247 int i,total;
248
249 if (signed_seq2string_nid == -1)
250 signed_seq2string_nid=
251 OBJ_create("1.9.9999","OID_example","Our example OID");
252
253 os1=ASN1_OCTET_STRING_new();
254 os2=ASN1_OCTET_STRING_new();
255 ASN1_OCTET_STRING_set(os1,(unsigned char*)str1,strlen(str1));
256 ASN1_OCTET_STRING_set(os2,(unsigned char*)str1,strlen(str1));
257 i =i2d_ASN1_OCTET_STRING(os1,NULL);
258 i+=i2d_ASN1_OCTET_STRING(os2,NULL);
259 total=ASN1_object_size(1,i,V_ASN1_SEQUENCE);
260
261 data=malloc(total);
262 p=data;
263 ASN1_put_object(&p,1,i,V_ASN1_SEQUENCE,V_ASN1_UNIVERSAL);
264 i2d_ASN1_OCTET_STRING(os1,&p);
265 i2d_ASN1_OCTET_STRING(os2,&p);
266
267 seq=ASN1_STRING_new();
268 ASN1_STRING_set(seq,data,total);
269 free(data);
270 ASN1_OCTET_STRING_free(os1);
271 ASN1_OCTET_STRING_free(os2);
272
273 ret=X509_ATTRIBUTE_create(signed_seq2string_nid,
274 V_ASN1_SEQUENCE,(char *)seq);
275 return(ret);
276 }
277
278/* For this case, I will malloc the return strings */
279int sk_get_seq2string(STACK_OF(X509_ATTRIBUTE) *sk, char **str1, char **str2)
280 {
281 ASN1_TYPE *so;
282 PKCS7_SIGNER_INFO si;
283
284 if (signed_seq2string_nid == -1)
285 signed_seq2string_nid=
286 OBJ_create("1.9.9999","OID_example","Our example OID");
287
288 si.auth_attr=sk;
289 /* To retrieve */
290 so=PKCS7_get_signed_attribute(&si,signed_seq2string_nid);
291 if (so->type == V_ASN1_SEQUENCE)
292 {
293 ASN1_const_CTX c;
294 ASN1_STRING *s;
295 long length;
296 ASN1_OCTET_STRING *os1,*os2;
297
298 s=so->value.sequence;
299 c.p=ASN1_STRING_data(s);
300 c.max=c.p+ASN1_STRING_length(s);
301 if (!asn1_GetSequence(&c,&length)) goto err;
302 /* Length is the length of the seqence */
303
304 c.q=c.p;
305 if ((os1=d2i_ASN1_OCTET_STRING(NULL,&c.p,c.slen)) == NULL)
306 goto err;
307 c.slen-=(c.p-c.q);
308
309 c.q=c.p;
310 if ((os2=d2i_ASN1_OCTET_STRING(NULL,&c.p,c.slen)) == NULL)
311 goto err;
312 c.slen-=(c.p-c.q);
313
314 if (!asn1_const_Finish(&c)) goto err;
315 *str1=malloc(os1->length+1);
316 *str2=malloc(os2->length+1);
317 memcpy(*str1,os1->data,os1->length);
318 memcpy(*str2,os2->data,os2->length);
319 (*str1)[os1->length]='\0';
320 (*str2)[os2->length]='\0';
321 ASN1_OCTET_STRING_free(os1);
322 ASN1_OCTET_STRING_free(os2);
323 return(1);
324 }
325err:
326 return(0);
327 }
328
329
diff --git a/src/lib/libcrypto/pkcs7/example.h b/src/lib/libcrypto/pkcs7/example.h
new file mode 100644
index 0000000000..96167de188
--- /dev/null
+++ b/src/lib/libcrypto/pkcs7/example.h
@@ -0,0 +1,57 @@
1/* ====================================================================
2 * Copyright (c) 1999 The OpenSSL Project. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 *
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 *
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in
13 * the documentation and/or other materials provided with the
14 * distribution.
15 *
16 * 3. All advertising materials mentioning features or use of this
17 * software must display the following acknowledgment:
18 * "This product includes software developed by the OpenSSL Project
19 * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
20 *
21 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
22 * endorse or promote products derived from this software without
23 * prior written permission. For written permission, please contact
24 * openssl-core@openssl.org.
25 *
26 * 5. Products derived from this software may not be called "OpenSSL"
27 * nor may "OpenSSL" appear in their names without prior written
28 * permission of the OpenSSL Project.
29 *
30 * 6. Redistributions of any form whatsoever must retain the following
31 * acknowledgment:
32 * "This product includes software developed by the OpenSSL Project
33 * for use in the OpenSSL Toolkit (http://www.openssl.org/)"
34 *
35 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
36 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
37 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
38 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
39 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
40 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
41 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
42 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
43 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
44 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
45 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
46 * OF THE POSSIBILITY OF SUCH DAMAGE.
47 * ====================================================================
48 *
49 * This product includes cryptographic software written by Eric Young
50 * (eay@cryptsoft.com). This product includes software written by Tim
51 * Hudson (tjh@cryptsoft.com).
52 *
53 */
54
55int add_signed_time(PKCS7_SIGNER_INFO *si);
56ASN1_UTCTIME *get_signed_time(PKCS7_SIGNER_INFO *si);
57int get_signed_seq2string(PKCS7_SIGNER_INFO *si, char **str1, char **str2);
diff --git a/src/lib/libcrypto/pkcs7/info.pem b/src/lib/libcrypto/pkcs7/info.pem
new file mode 100644
index 0000000000..989baf8709
--- /dev/null
+++ b/src/lib/libcrypto/pkcs7/info.pem
@@ -0,0 +1,57 @@
1issuer :/C=AU/SP=Queensland/L=Brisbane/O=Cryptsoft Pty Ltd/OU=DEMONSTRATION AND TESTING/CN=DEMO ZERO VALUE CA
2subject:/C=AU/SP=Queensland/L=Brisbane/O=Cryptsoft Pty Ltd/OU=SMIME 003/CN=Information/Email=info@cryptsoft.com
3serial :047D
4
5Certificate:
6 Data:
7 Version: 3 (0x2)
8 Serial Number: 1149 (0x47d)
9 Signature Algorithm: md5withRSAEncryption
10 Issuer: C=AU, SP=Queensland, L=Brisbane, O=Cryptsoft Pty Ltd, OU=DEMONSTRATION AND TESTING, CN=DEMO ZERO VALUE CA
11 Validity
12 Not Before: May 13 05:40:58 1998 GMT
13 Not After : May 12 05:40:58 2000 GMT
14 Subject: C=AU, SP=Queensland, L=Brisbane, O=Cryptsoft Pty Ltd, OU=SMIME 003, CN=Information/Email=info@cryptsoft.com
15 Subject Public Key Info:
16 Public Key Algorithm: rsaEncryption
17 Modulus:
18 00:ad:e7:23:89:ee:0d:87:b7:9c:32:44:4b:95:81:
19 73:dd:22:80:4b:2d:c5:60:b8:fe:1e:18:63:ef:dc:
20 89:89:22:df:95:3c:7a:db:3d:9a:06:a8:08:d6:29:
21 fd:ef:41:09:91:ed:bc:ad:98:f9:f6:28:90:62:6f:
22 e7:e7:0c:4d:0b
23 Exponent: 65537 (0x10001)
24 X509v3 extensions:
25 Netscape Comment:
26 Generated with SSLeay
27 Signature Algorithm: md5withRSAEncryption
28 52:15:ea:88:f4:f0:f9:0b:ef:ce:d5:f8:83:40:61:16:5e:55:
29 f9:ce:2d:d1:8b:31:5c:03:c6:2d:10:7c:61:d5:5c:0a:42:97:
30 d1:fd:65:b6:b6:84:a5:39:ec:46:ec:fc:e0:0d:d9:22:da:1b:
31 50:74:ad:92:cb:4e:90:e5:fa:7d
32
33-----BEGIN CERTIFICATE-----
34MIICTDCCAfagAwIBAgICBH0wDQYJKoZIhvcNAQEEBQAwgZIxCzAJBgNVBAYTAkFV
35MRMwEQYDVQQIEwpRdWVlbnNsYW5kMREwDwYDVQQHEwhCcmlzYmFuZTEaMBgGA1UE
36ChMRQ3J5cHRzb2Z0IFB0eSBMdGQxIjAgBgNVBAsTGURFTU9OU1RSQVRJT04gQU5E
37IFRFU1RJTkcxGzAZBgNVBAMTEkRFTU8gWkVSTyBWQUxVRSBDQTAeFw05ODA1MTMw
38NTQwNThaFw0wMDA1MTIwNTQwNThaMIGeMQswCQYDVQQGEwJBVTETMBEGA1UECBMK
39UXVlZW5zbGFuZDERMA8GA1UEBxMIQnJpc2JhbmUxGjAYBgNVBAoTEUNyeXB0c29m
40dCBQdHkgTHRkMRIwEAYDVQQLEwlTTUlNRSAwMDMxFDASBgNVBAMTC0luZm9ybWF0
41aW9uMSEwHwYJKoZIhvcNAQkBFhJpbmZvQGNyeXB0c29mdC5jb20wXDANBgkqhkiG
429w0BAQEFAANLADBIAkEArecjie4Nh7ecMkRLlYFz3SKASy3FYLj+Hhhj79yJiSLf
43lTx62z2aBqgI1in970EJke28rZj59iiQYm/n5wxNCwIDAQABoygwJjAkBglghkgB
44hvhCAQ0EFxYVR2VuZXJhdGVkIHdpdGggU1NMZWF5MA0GCSqGSIb3DQEBBAUAA0EA
45UhXqiPTw+QvvztX4g0BhFl5V+c4t0YsxXAPGLRB8YdVcCkKX0f1ltraEpTnsRuz8
464A3ZItobUHStkstOkOX6fQ==
47-----END CERTIFICATE-----
48
49-----BEGIN RSA PRIVATE KEY-----
50MIIBOgIBAAJBAK3nI4nuDYe3nDJES5WBc90igEstxWC4/h4YY+/ciYki35U8ets9
51mgaoCNYp/e9BCZHtvK2Y+fYokGJv5+cMTQsCAwEAAQJBAIHpvXvqEcOEoDRRHuIG
52fkcB4jPHcr9KE9TpxabH6xs9beN6OJnkePXAHwaz5MnUgSnbpOKq+cw8miKjXwe/
53zVECIQDVLwncT2lRmXarEYHzb+q/0uaSvKhWKKt3kJasLNTrAwIhANDUc/ghut29
54p3jJYjurzUKuG774/5eLjPLsxPPIZzNZAiA/10hSq41UnGqHLEUIS9m2/EeEZe7b
55bm567dfRU9OnVQIgDo8ROrZXSchEGbaog5J5r/Fle83uO8l93R3GqVxKXZkCIFfk
56IPD5PIYQAyyod3hyKKza7ZP4CGY4oOfZetbkSGGG
57-----END RSA PRIVATE KEY-----
diff --git a/src/lib/libcrypto/pkcs7/infokey.pem b/src/lib/libcrypto/pkcs7/infokey.pem
new file mode 100644
index 0000000000..1e2acc954d
--- /dev/null
+++ b/src/lib/libcrypto/pkcs7/infokey.pem
@@ -0,0 +1,9 @@
1-----BEGIN RSA PRIVATE KEY-----
2MIIBOgIBAAJBAK3nI4nuDYe3nDJES5WBc90igEstxWC4/h4YY+/ciYki35U8ets9
3mgaoCNYp/e9BCZHtvK2Y+fYokGJv5+cMTQsCAwEAAQJBAIHpvXvqEcOEoDRRHuIG
4fkcB4jPHcr9KE9TpxabH6xs9beN6OJnkePXAHwaz5MnUgSnbpOKq+cw8miKjXwe/
5zVECIQDVLwncT2lRmXarEYHzb+q/0uaSvKhWKKt3kJasLNTrAwIhANDUc/ghut29
6p3jJYjurzUKuG774/5eLjPLsxPPIZzNZAiA/10hSq41UnGqHLEUIS9m2/EeEZe7b
7bm567dfRU9OnVQIgDo8ROrZXSchEGbaog5J5r/Fle83uO8l93R3GqVxKXZkCIFfk
8IPD5PIYQAyyod3hyKKza7ZP4CGY4oOfZetbkSGGG
9-----END RSA PRIVATE KEY-----
diff --git a/src/lib/libcrypto/pkcs7/p7/a1 b/src/lib/libcrypto/pkcs7/p7/a1
new file mode 100644
index 0000000000..56ca943762
--- /dev/null
+++ b/src/lib/libcrypto/pkcs7/p7/a1
@@ -0,0 +1,2 @@
1j,H>_æá_­DôzEîLœ VJ³ß觬¤””E3ûáYäx%_Àk
23ê)DLScñ8% ôM \ No newline at end of file
diff --git a/src/lib/libcrypto/pkcs7/p7/a2 b/src/lib/libcrypto/pkcs7/p7/a2
new file mode 100644
index 0000000000..23d8fb5e93
--- /dev/null
+++ b/src/lib/libcrypto/pkcs7/p7/a2
@@ -0,0 +1 @@
k~@a”,NâM͹¼ <O( KP—騠¤K²>­×U¿o_½BqrmÎ?Ù t?t÷ÏéId2‰Š \ No newline at end of file
diff --git a/src/lib/libcrypto/pkcs7/p7/cert.p7c b/src/lib/libcrypto/pkcs7/p7/cert.p7c
new file mode 100644
index 0000000000..2b75ec05f7
--- /dev/null
+++ b/src/lib/libcrypto/pkcs7/p7/cert.p7c
Binary files differ
diff --git a/src/lib/libcrypto/pkcs7/p7/smime.p7m b/src/lib/libcrypto/pkcs7/p7/smime.p7m
new file mode 100644
index 0000000000..2b6e6f82ba
--- /dev/null
+++ b/src/lib/libcrypto/pkcs7/p7/smime.p7m
Binary files differ
diff --git a/src/lib/libcrypto/pkcs7/p7/smime.p7s b/src/lib/libcrypto/pkcs7/p7/smime.p7s
new file mode 100644
index 0000000000..2b5d4fb0e3
--- /dev/null
+++ b/src/lib/libcrypto/pkcs7/p7/smime.p7s
Binary files differ
diff --git a/src/lib/libcrypto/pkcs7/pk7_dgst.c b/src/lib/libcrypto/pkcs7/pk7_dgst.c
new file mode 100644
index 0000000000..90edfa5001
--- /dev/null
+++ b/src/lib/libcrypto/pkcs7/pk7_dgst.c
@@ -0,0 +1,66 @@
1/* crypto/pkcs7/pk7_dgst.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
59#include <stdio.h>
60#include "cryptlib.h"
61#include <openssl/evp.h>
62#include <openssl/rand.h>
63#include <openssl/objects.h>
64#include <openssl/x509.h>
65#include <openssl/pkcs7.h>
66
diff --git a/src/lib/libcrypto/pkcs7/pk7_enc.c b/src/lib/libcrypto/pkcs7/pk7_enc.c
new file mode 100644
index 0000000000..acbb189c59
--- /dev/null
+++ b/src/lib/libcrypto/pkcs7/pk7_enc.c
@@ -0,0 +1,76 @@
1/* crypto/pkcs7/pk7_enc.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
59#include <stdio.h>
60#include "cryptlib.h"
61#include <openssl/evp.h>
62#include <openssl/rand.h>
63#include <openssl/objects.h>
64#include <openssl/x509.h>
65#include <openssl/pkcs7.h>
66
67PKCS7_in_bio(PKCS7 *p7,BIO *in);
68PKCS7_out_bio(PKCS7 *p7,BIO *out);
69
70PKCS7_add_signer(PKCS7 *p7,X509 *cert,EVP_PKEY *key);
71PKCS7_cipher(PKCS7 *p7,EVP_CIPHER *cipher);
72
73PKCS7_Init(PKCS7 *p7);
74PKCS7_Update(PKCS7 *p7);
75PKCS7_Finish(PKCS7 *p7);
76
diff --git a/src/lib/libcrypto/pkcs7/server.pem b/src/lib/libcrypto/pkcs7/server.pem
new file mode 100644
index 0000000000..750aac2094
--- /dev/null
+++ b/src/lib/libcrypto/pkcs7/server.pem
@@ -0,0 +1,24 @@
1issuer= /C=AU/ST=Queensland/O=CryptSoft Pty Ltd/CN=Test CA (1024 bit)
2subject=/C=AU/ST=Queensland/O=CryptSoft Pty Ltd/CN=Server test cert (512 bit)
3-----BEGIN CERTIFICATE-----
4MIIB6TCCAVICAQAwDQYJKoZIhvcNAQEEBQAwWzELMAkGA1UEBhMCQVUxEzARBgNV
5BAgTClF1ZWVuc2xhbmQxGjAYBgNVBAoTEUNyeXB0U29mdCBQdHkgTHRkMRswGQYD
6VQQDExJUZXN0IENBICgxMDI0IGJpdCkwHhcNOTcwNjA5MTM1NzQ2WhcNOTgwNjA5
7MTM1NzQ2WjBjMQswCQYDVQQGEwJBVTETMBEGA1UECBMKUXVlZW5zbGFuZDEaMBgG
8A1UEChMRQ3J5cHRTb2Z0IFB0eSBMdGQxIzAhBgNVBAMTGlNlcnZlciB0ZXN0IGNl
9cnQgKDUxMiBiaXQpMFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAJ+zw4Qnlf8SMVIP
10Fe9GEcStgOY2Ww/dgNdhjeD8ckUJNP5VZkVDTGiXav6ooKXfX3j/7tdkuD8Ey2//
11Kv7+ue0CAwEAATANBgkqhkiG9w0BAQQFAAOBgQB4TMR2CvacKE9wAsu9jyCX8YiW
12mgCM+YoP6kt4Zkj2z5IRfm7WrycKsnpnOR+tGeqAjkCeZ6/36o9l91RvPnN1VJ/i
13xQv2df0KFeMr00IkDdTNAdIWqFkSsZTAY2QAdgenb7MB1joejquYzO2DQIO7+wpH
14irObpESxAZLySCmPPg==
15-----END CERTIFICATE-----
16-----BEGIN RSA PRIVATE KEY-----
17MIIBPAIBAAJBAJ+zw4Qnlf8SMVIPFe9GEcStgOY2Ww/dgNdhjeD8ckUJNP5VZkVD
18TGiXav6ooKXfX3j/7tdkuD8Ey2//Kv7+ue0CAwEAAQJAN6W31vDEP2DjdqhzCDDu
19OA4NACqoiFqyblo7yc2tM4h4xMbC3Yx5UKMN9ZkCtX0gzrz6DyF47bdKcWBzNWCj
20gQIhANEoojVt7hq+SQ6MCN6FTAysGgQf56Q3TYoJMoWvdiXVAiEAw3e3rc+VJpOz
21rHuDo6bgpjUAAXM+v3fcpsfZSNO6V7kCIQCtbVjanpUwvZkMI9by02oUk9taki3b
22PzPfAfNPYAbCJQIhAJXNQDWyqwn/lGmR11cqY2y9nZ1+5w3yHGatLrcDnQHxAiEA
23vnlEGo8K85u+KwIOimM48ZG8oTk7iFdkqLJR1utT3aU=
24-----END RSA PRIVATE KEY-----
diff --git a/src/lib/libcrypto/pkcs7/sign.c b/src/lib/libcrypto/pkcs7/sign.c
new file mode 100644
index 0000000000..8b59885f7e
--- /dev/null
+++ b/src/lib/libcrypto/pkcs7/sign.c
@@ -0,0 +1,154 @@
1/* crypto/pkcs7/sign.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58#include <stdio.h>
59#include <string.h>
60#include <openssl/bio.h>
61#include <openssl/x509.h>
62#include <openssl/pem.h>
63#include <openssl/err.h>
64
65int main(argc,argv)
66int argc;
67char *argv[];
68 {
69 X509 *x509;
70 EVP_PKEY *pkey;
71 PKCS7 *p7;
72 PKCS7_SIGNER_INFO *si;
73 BIO *in;
74 BIO *data,*p7bio;
75 char buf[1024*4];
76 int i;
77 int nodetach=0;
78
79#ifndef OPENSSL_NO_MD2
80 EVP_add_digest(EVP_md2());
81#endif
82#ifndef OPENSSL_NO_MD5
83 EVP_add_digest(EVP_md5());
84#endif
85#ifndef OPENSSL_NO_SHA1
86 EVP_add_digest(EVP_sha1());
87#endif
88#ifndef OPENSSL_NO_MDC2
89 EVP_add_digest(EVP_mdc2());
90#endif
91
92 data=BIO_new(BIO_s_file());
93again:
94 if (argc > 1)
95 {
96 if (strcmp(argv[1],"-nd") == 0)
97 {
98 nodetach=1;
99 argv++; argc--;
100 goto again;
101 }
102 if (!BIO_read_filename(data,argv[1]))
103 goto err;
104 }
105 else
106 BIO_set_fp(data,stdin,BIO_NOCLOSE);
107
108 if ((in=BIO_new_file("server.pem","r")) == NULL) goto err;
109 if ((x509=PEM_read_bio_X509(in,NULL,NULL,NULL)) == NULL) goto err;
110 BIO_reset(in);
111 if ((pkey=PEM_read_bio_PrivateKey(in,NULL,NULL,NULL)) == NULL) goto err;
112 BIO_free(in);
113
114 p7=PKCS7_new();
115 PKCS7_set_type(p7,NID_pkcs7_signed);
116
117 si=PKCS7_add_signature(p7,x509,pkey,EVP_sha1());
118 if (si == NULL) goto err;
119
120 /* If you do this then you get signing time automatically added */
121 PKCS7_add_signed_attribute(si, NID_pkcs9_contentType, V_ASN1_OBJECT,
122 OBJ_nid2obj(NID_pkcs7_data));
123
124 /* we may want to add more */
125 PKCS7_add_certificate(p7,x509);
126
127 /* Set the content of the signed to 'data' */
128 PKCS7_content_new(p7,NID_pkcs7_data);
129
130 if (!nodetach)
131 PKCS7_set_detached(p7,1);
132
133 if ((p7bio=PKCS7_dataInit(p7,NULL)) == NULL) goto err;
134
135 for (;;)
136 {
137 i=BIO_read(data,buf,sizeof(buf));
138 if (i <= 0) break;
139 BIO_write(p7bio,buf,i);
140 }
141
142 if (!PKCS7_dataFinal(p7,p7bio)) goto err;
143 BIO_free(p7bio);
144
145 PEM_write_PKCS7(stdout,p7);
146 PKCS7_free(p7);
147
148 exit(0);
149err:
150 ERR_load_crypto_strings();
151 ERR_print_errors_fp(stderr);
152 exit(1);
153 }
154
diff --git a/src/lib/libcrypto/pkcs7/t/3des.pem b/src/lib/libcrypto/pkcs7/t/3des.pem
new file mode 100644
index 0000000000..b2b5081a10
--- /dev/null
+++ b/src/lib/libcrypto/pkcs7/t/3des.pem
@@ -0,0 +1,16 @@
1-----BEGIN PKCS7-----
2MIAGCSqGSIb3DQEHA6CAMIACAQAxggHmMIHwAgEAMIGZMIGSMQswCQYDVQQGEwJBVTETMBEG
3A1UECBMKUXVlZW5zbGFuZDERMA8GA1UEBxMIQnJpc2JhbmUxGjAYBgNVBAoTEUNyeXB0c29m
4dCBQdHkgTHRkMSIwIAYDVQQLExlERU1PTlNUUkFUSU9OIEFORCBURVNUSU5HMRswGQYDVQQD
5ExJERU1PIFpFUk8gVkFMVUUgQ0ECAgR+MA0GCSqGSIb3DQEBAQUABEC2vXI1xQDW6lUHM3zQ
6/9uBEBOO5A3TtkrklAXq7v01gsIC21t52qSk36REXY+slhNZ0OQ349tgkTsoETHFLoEwMIHw
7AgEAMIGZMIGSMQswCQYDVQQGEwJBVTETMBEGA1UECBMKUXVlZW5zbGFuZDERMA8GA1UEBxMI
8QnJpc2JhbmUxGjAYBgNVBAoTEUNyeXB0c29mdCBQdHkgTHRkMSIwIAYDVQQLExlERU1PTlNU
9UkFUSU9OIEFORCBURVNUSU5HMRswGQYDVQQDExJERU1PIFpFUk8gVkFMVUUgQ0ECAgR9MA0G
10CSqGSIb3DQEBAQUABEB8ujxbabxXUYJhopuDm3oDq4JNqX6Io4p3ro+ShqfIndsXTZ1v5a2N
11WtLLCWlHn/habjBwZ/DgQgcKASbZ7QxNMIAGCSqGSIb3DQEHATAaBggqhkiG9w0DAjAOAgIA
12oAQIbsL5v1wX98KggAQoAaJ4WHm68fXY1WE5OIjfVBIDpO1K+i8dmKhjnAjrjoyZ9Bwc8rDL
13lgQg4CXb805h5xl+GfvSwUaHJayte1m2mcOhs3J2YyqbQ+MEIMIiJQccmhO3oDKm36CFvYR8
145PjpclVcZyX2ngbwPFMnBAgy0clOAE6UKAAAAAAAAAAAAAA=
15-----END PKCS7-----
16
diff --git a/src/lib/libcrypto/pkcs7/t/3dess.pem b/src/lib/libcrypto/pkcs7/t/3dess.pem
new file mode 100644
index 0000000000..23f013516a
--- /dev/null
+++ b/src/lib/libcrypto/pkcs7/t/3dess.pem
@@ -0,0 +1,32 @@
1-----BEGIN PKCS7-----
2MIIGHgYJKoZIhvcNAQcCoIIGDzCCBgsCAQExCzAJBgUrDgMCGgUAMAsGCSqGSIb3DQEHAaCC
3BGswggJTMIIB/aADAgECAgIEfjANBgkqhkiG9w0BAQQFADCBkjELMAkGA1UEBhMCQVUxEzAR
4BgNVBAgTClF1ZWVuc2xhbmQxETAPBgNVBAcTCEJyaXNiYW5lMRowGAYDVQQKExFDcnlwdHNv
5ZnQgUHR5IEx0ZDEiMCAGA1UECxMZREVNT05TVFJBVElPTiBBTkQgVEVTVElORzEbMBkGA1UE
6AxMSREVNTyBaRVJPIFZBTFVFIENBMB4XDTk4MDUxMzA2MjY1NloXDTAwMDUxMjA2MjY1Nlow
7gaUxCzAJBgNVBAYTAkFVMRMwEQYDVQQIEwpRdWVlbnNsYW5kMREwDwYDVQQHEwhCcmlzYmFu
8ZTEaMBgGA1UEChMRQ3J5cHRzb2Z0IFB0eSBMdGQxEjAQBgNVBAsTCVNNSU1FIDAwMzEZMBcG
9A1UEAxMQQW5nZWxhIHZhbiBMZWVudDEjMCEGCSqGSIb3DQEJARYUYW5nZWxhQGNyeXB0c29m
10dC5jb20wXDANBgkqhkiG9w0BAQEFAANLADBIAkEAuC3+7dAb2LhuO7gt2cTM8vsNjhG5JfDh
11hX1Vl/wVGbKEEj0MA6vWEolvefQlxB+EzwCtR0YZ7eEC/T/4JoCyeQIDAQABoygwJjAkBglg
12hkgBhvhCAQ0EFxYVR2VuZXJhdGVkIHdpdGggU1NMZWF5MA0GCSqGSIb3DQEBBAUAA0EAUnSP
13igs6TMFISTjw8cBtJYb98czgAVkVFjKyJQwYMH8FbDnCyx6NocM555nsyDstaw8fKR11Khds
14syd3ikkrhDCCAhAwggG6AgEDMA0GCSqGSIb3DQEBBAUAMIGSMQswCQYDVQQGEwJBVTETMBEG
15A1UECBMKUXVlZW5zbGFuZDERMA8GA1UEBxMIQnJpc2JhbmUxGjAYBgNVBAoTEUNyeXB0c29m
16dCBQdHkgTHRkMSIwIAYDVQQLExlERU1PTlNUUkFUSU9OIEFORCBURVNUSU5HMRswGQYDVQQD
17ExJERU1PIFpFUk8gVkFMVUUgQ0EwHhcNOTgwMzAzMDc0MTMyWhcNMDgwMjI5MDc0MTMyWjCB
18kjELMAkGA1UEBhMCQVUxEzARBgNVBAgTClF1ZWVuc2xhbmQxETAPBgNVBAcTCEJyaXNiYW5l
19MRowGAYDVQQKExFDcnlwdHNvZnQgUHR5IEx0ZDEiMCAGA1UECxMZREVNT05TVFJBVElPTiBB
20TkQgVEVTVElORzEbMBkGA1UEAxMSREVNTyBaRVJPIFZBTFVFIENBMFwwDQYJKoZIhvcNAQEB
21BQADSwAwSAJBAL+0E2fLej3FSCwe2A2iRnMuC3z12qHIp6Ky1wo2zZcxft7AI+RfkrWrSGtf
22mfzBEuPrLdfulncC5Y1pNcM8RTUCAwEAATANBgkqhkiG9w0BAQQFAANBAGSbLMphL6F5pp3s
238o0Xyh86FHFdpVOwYx09ELLkuG17V/P9pgIc0Eo/gDMbN+KT3IdgECf8S//pCRA6RrNjcXIx
24ggF7MIIBdwIBATCBmTCBkjELMAkGA1UEBhMCQVUxEzARBgNVBAgTClF1ZWVuc2xhbmQxETAP
25BgNVBAcTCEJyaXNiYW5lMRowGAYDVQQKExFDcnlwdHNvZnQgUHR5IEx0ZDEiMCAGA1UECxMZ
26REVNT05TVFJBVElPTiBBTkQgVEVTVElORzEbMBkGA1UEAxMSREVNTyBaRVJPIFZBTFVFIENB
27AgIEfjAJBgUrDgMCGgUAoHowGAYJKoZIhvcNAQkDMQsGCSqGSIb3DQEHATAbBgkqhkiG9w0B
28CQ8xDjAMMAoGCCqGSIb3DQMHMBwGCSqGSIb3DQEJBTEPFw05ODA1MTQwMzM5MzdaMCMGCSqG
29SIb3DQEJBDEWBBQstNMnSV26ba8PapQEDhO21yNFrjANBgkqhkiG9w0BAQEFAARAW9Xb9YXv
30BfcNkutgFX9Gr8iXhBVsNtGEVrjrpkQwpKa7jHI8SjAlLhk/4RFwDHf+ISB9Np3Z1WDWnLcA
319CWR6g==
32-----END PKCS7-----
diff --git a/src/lib/libcrypto/pkcs7/t/c.pem b/src/lib/libcrypto/pkcs7/t/c.pem
new file mode 100644
index 0000000000..a4b55e321a
--- /dev/null
+++ b/src/lib/libcrypto/pkcs7/t/c.pem
@@ -0,0 +1,48 @@
1issuer :/C=AU/SP=Queensland/L=Brisbane/O=Cryptsoft Pty Ltd/OU=DEMONSTRATION AND TESTING/CN=DEMO ZERO VALUE CA
2subject:/C=AU/SP=Queensland/L=Brisbane/O=Cryptsoft Pty Ltd/OU=SMIME 003/CN=Information/Email=info@cryptsoft.com
3serial :047D
4
5Certificate:
6 Data:
7 Version: 3 (0x2)
8 Serial Number: 1149 (0x47d)
9 Signature Algorithm: md5withRSAEncryption
10 Issuer: C=AU, SP=Queensland, L=Brisbane, O=Cryptsoft Pty Ltd, OU=DEMONSTRATION AND TESTING, CN=DEMO ZERO VALUE CA
11 Validity
12 Not Before: May 13 05:40:58 1998 GMT
13 Not After : May 12 05:40:58 2000 GMT
14 Subject: C=AU, SP=Queensland, L=Brisbane, O=Cryptsoft Pty Ltd, OU=SMIME 003, CN=Information/Email=info@cryptsoft.com
15 Subject Public Key Info:
16 Public Key Algorithm: rsaEncryption
17 Modulus:
18 00:ad:e7:23:89:ee:0d:87:b7:9c:32:44:4b:95:81:
19 73:dd:22:80:4b:2d:c5:60:b8:fe:1e:18:63:ef:dc:
20 89:89:22:df:95:3c:7a:db:3d:9a:06:a8:08:d6:29:
21 fd:ef:41:09:91:ed:bc:ad:98:f9:f6:28:90:62:6f:
22 e7:e7:0c:4d:0b
23 Exponent: 65537 (0x10001)
24 X509v3 extensions:
25 Netscape Comment:
26 Generated with SSLeay
27 Signature Algorithm: md5withRSAEncryption
28 52:15:ea:88:f4:f0:f9:0b:ef:ce:d5:f8:83:40:61:16:5e:55:
29 f9:ce:2d:d1:8b:31:5c:03:c6:2d:10:7c:61:d5:5c:0a:42:97:
30 d1:fd:65:b6:b6:84:a5:39:ec:46:ec:fc:e0:0d:d9:22:da:1b:
31 50:74:ad:92:cb:4e:90:e5:fa:7d
32
33-----BEGIN CERTIFICATE-----
34MIICTDCCAfagAwIBAgICBH0wDQYJKoZIhvcNAQEEBQAwgZIxCzAJBgNVBAYTAkFV
35MRMwEQYDVQQIEwpRdWVlbnNsYW5kMREwDwYDVQQHEwhCcmlzYmFuZTEaMBgGA1UE
36ChMRQ3J5cHRzb2Z0IFB0eSBMdGQxIjAgBgNVBAsTGURFTU9OU1RSQVRJT04gQU5E
37IFRFU1RJTkcxGzAZBgNVBAMTEkRFTU8gWkVSTyBWQUxVRSBDQTAeFw05ODA1MTMw
38NTQwNThaFw0wMDA1MTIwNTQwNThaMIGeMQswCQYDVQQGEwJBVTETMBEGA1UECBMK
39UXVlZW5zbGFuZDERMA8GA1UEBxMIQnJpc2JhbmUxGjAYBgNVBAoTEUNyeXB0c29m
40dCBQdHkgTHRkMRIwEAYDVQQLEwlTTUlNRSAwMDMxFDASBgNVBAMTC0luZm9ybWF0
41aW9uMSEwHwYJKoZIhvcNAQkBFhJpbmZvQGNyeXB0c29mdC5jb20wXDANBgkqhkiG
429w0BAQEFAANLADBIAkEArecjie4Nh7ecMkRLlYFz3SKASy3FYLj+Hhhj79yJiSLf
43lTx62z2aBqgI1in970EJke28rZj59iiQYm/n5wxNCwIDAQABoygwJjAkBglghkgB
44hvhCAQ0EFxYVR2VuZXJhdGVkIHdpdGggU1NMZWF5MA0GCSqGSIb3DQEBBAUAA0EA
45UhXqiPTw+QvvztX4g0BhFl5V+c4t0YsxXAPGLRB8YdVcCkKX0f1ltraEpTnsRuz8
464A3ZItobUHStkstOkOX6fQ==
47-----END CERTIFICATE-----
48
diff --git a/src/lib/libcrypto/pkcs7/t/ff b/src/lib/libcrypto/pkcs7/t/ff
new file mode 100644
index 0000000000..23f013516a
--- /dev/null
+++ b/src/lib/libcrypto/pkcs7/t/ff
@@ -0,0 +1,32 @@
1-----BEGIN PKCS7-----
2MIIGHgYJKoZIhvcNAQcCoIIGDzCCBgsCAQExCzAJBgUrDgMCGgUAMAsGCSqGSIb3DQEHAaCC
3BGswggJTMIIB/aADAgECAgIEfjANBgkqhkiG9w0BAQQFADCBkjELMAkGA1UEBhMCQVUxEzAR
4BgNVBAgTClF1ZWVuc2xhbmQxETAPBgNVBAcTCEJyaXNiYW5lMRowGAYDVQQKExFDcnlwdHNv
5ZnQgUHR5IEx0ZDEiMCAGA1UECxMZREVNT05TVFJBVElPTiBBTkQgVEVTVElORzEbMBkGA1UE
6AxMSREVNTyBaRVJPIFZBTFVFIENBMB4XDTk4MDUxMzA2MjY1NloXDTAwMDUxMjA2MjY1Nlow
7gaUxCzAJBgNVBAYTAkFVMRMwEQYDVQQIEwpRdWVlbnNsYW5kMREwDwYDVQQHEwhCcmlzYmFu
8ZTEaMBgGA1UEChMRQ3J5cHRzb2Z0IFB0eSBMdGQxEjAQBgNVBAsTCVNNSU1FIDAwMzEZMBcG
9A1UEAxMQQW5nZWxhIHZhbiBMZWVudDEjMCEGCSqGSIb3DQEJARYUYW5nZWxhQGNyeXB0c29m
10dC5jb20wXDANBgkqhkiG9w0BAQEFAANLADBIAkEAuC3+7dAb2LhuO7gt2cTM8vsNjhG5JfDh
11hX1Vl/wVGbKEEj0MA6vWEolvefQlxB+EzwCtR0YZ7eEC/T/4JoCyeQIDAQABoygwJjAkBglg
12hkgBhvhCAQ0EFxYVR2VuZXJhdGVkIHdpdGggU1NMZWF5MA0GCSqGSIb3DQEBBAUAA0EAUnSP
13igs6TMFISTjw8cBtJYb98czgAVkVFjKyJQwYMH8FbDnCyx6NocM555nsyDstaw8fKR11Khds
14syd3ikkrhDCCAhAwggG6AgEDMA0GCSqGSIb3DQEBBAUAMIGSMQswCQYDVQQGEwJBVTETMBEG
15A1UECBMKUXVlZW5zbGFuZDERMA8GA1UEBxMIQnJpc2JhbmUxGjAYBgNVBAoTEUNyeXB0c29m
16dCBQdHkgTHRkMSIwIAYDVQQLExlERU1PTlNUUkFUSU9OIEFORCBURVNUSU5HMRswGQYDVQQD
17ExJERU1PIFpFUk8gVkFMVUUgQ0EwHhcNOTgwMzAzMDc0MTMyWhcNMDgwMjI5MDc0MTMyWjCB
18kjELMAkGA1UEBhMCQVUxEzARBgNVBAgTClF1ZWVuc2xhbmQxETAPBgNVBAcTCEJyaXNiYW5l
19MRowGAYDVQQKExFDcnlwdHNvZnQgUHR5IEx0ZDEiMCAGA1UECxMZREVNT05TVFJBVElPTiBB
20TkQgVEVTVElORzEbMBkGA1UEAxMSREVNTyBaRVJPIFZBTFVFIENBMFwwDQYJKoZIhvcNAQEB
21BQADSwAwSAJBAL+0E2fLej3FSCwe2A2iRnMuC3z12qHIp6Ky1wo2zZcxft7AI+RfkrWrSGtf
22mfzBEuPrLdfulncC5Y1pNcM8RTUCAwEAATANBgkqhkiG9w0BAQQFAANBAGSbLMphL6F5pp3s
238o0Xyh86FHFdpVOwYx09ELLkuG17V/P9pgIc0Eo/gDMbN+KT3IdgECf8S//pCRA6RrNjcXIx
24ggF7MIIBdwIBATCBmTCBkjELMAkGA1UEBhMCQVUxEzARBgNVBAgTClF1ZWVuc2xhbmQxETAP
25BgNVBAcTCEJyaXNiYW5lMRowGAYDVQQKExFDcnlwdHNvZnQgUHR5IEx0ZDEiMCAGA1UECxMZ
26REVNT05TVFJBVElPTiBBTkQgVEVTVElORzEbMBkGA1UEAxMSREVNTyBaRVJPIFZBTFVFIENB
27AgIEfjAJBgUrDgMCGgUAoHowGAYJKoZIhvcNAQkDMQsGCSqGSIb3DQEHATAbBgkqhkiG9w0B
28CQ8xDjAMMAoGCCqGSIb3DQMHMBwGCSqGSIb3DQEJBTEPFw05ODA1MTQwMzM5MzdaMCMGCSqG
29SIb3DQEJBDEWBBQstNMnSV26ba8PapQEDhO21yNFrjANBgkqhkiG9w0BAQEFAARAW9Xb9YXv
30BfcNkutgFX9Gr8iXhBVsNtGEVrjrpkQwpKa7jHI8SjAlLhk/4RFwDHf+ISB9Np3Z1WDWnLcA
319CWR6g==
32-----END PKCS7-----
diff --git a/src/lib/libcrypto/pkcs7/t/msie-e b/src/lib/libcrypto/pkcs7/t/msie-e
new file mode 100644
index 0000000000..aafae69fc9
--- /dev/null
+++ b/src/lib/libcrypto/pkcs7/t/msie-e
@@ -0,0 +1,20 @@
1
2MIAGCSqGSIb3DQEHA6CAMIACAQAxggHCMIHMAgEAMHYwYjERMA8GA1UEBxMISW50ZXJuZXQxFzAV
3BgNVBAoTDlZlcmlTaWduLCBJbmMuMTQwMgYDVQQLEytWZXJpU2lnbiBDbGFzcyAxIENBIC0gSW5k
4aXZpZHVhbCBTdWJzY3JpYmVyAhBgQJiC3qfbCbjdj5INYLnKMA0GCSqGSIb3DQEBAQUABECMzu8y
5wQ/qZbO8cAGMRBF+mPruv3+Dvb9aWNZ2k8njUgqF6mcdhVB2MkGcsG3memRXJBixvMYWVkU3qK4Z
6VuKsMIHwAgEAMIGZMIGSMQswCQYDVQQGEwJBVTETMBEGA1UECBMKUXVlZW5zbGFuZDERMA8GA1UE
7BxMIQnJpc2JhbmUxGjAYBgNVBAoTEUNyeXB0c29mdCBQdHkgTHRkMSIwIAYDVQQLExlERU1PTlNU
8UkFUSU9OIEFORCBURVNUSU5HMRswGQYDVQQDExJERU1PIFpFUk8gVkFMVUUgQ0ECAgRuMA0GCSqG
9SIb3DQEBAQUABEBcWwYFHJbJGhiztt7lzue3Lc9CH5WAbyR+2BZ3uv+JxZfRs1PuaWPOwRa0Vgs3
10YwSJoRfxQj2Gk0wFqG1qt6d1MIAGCSqGSIb3DQEHATAaBggqhkiG9w0DAjAOAgIAoAQI8vRlP/Nx
112iSggASCAZhR5srxyspy7DfomRJ9ff8eMCtaNwEoEx7G25PZRonC57hBvGoScLtEPU3Wp9FEbPN7
12oJESeC+AqMTyTLNy8aQsyC5s53E9UkoIvg62ekYZBbXZqXsrxx4PhiiX3NH8GVh42phB0Chjw0nK
13HZeRDmxGY3Cmk+J+l0uVKxbNIfJIKOguLBnhqmnKH/PrnzDt591u0ULy2aTLqRm+4/1Yat/QPb6J
14eoKGwNPBbS9ogBdrCNCp9ZFg3Xar2AtQHzyTQIfYeH3SRQUpKmRm5U5o9p5emgEdT+ZfJm/J4tSH
15OmbgAFsbHQakA4MBZ4J5qfDJhOA2g5lWk1hIeu5Dn/AaLRZd0yz3oY0Ieo/erPWx/bCqtBzYbMe9
16qSFTedKlbc9EGe3opOTdBZVzK8KH3w3zsy5luxKdOUG59YYb5F1IZiWGiDyuo/HuacX+griu5LeD
17bEzOtZnko+TZXvWIko30fD79j3T4MRRhWXbgj2HKza+4vJ0mzcC/1+GPsJjAEAA/JgIEDU4w6/DI
18/HQHhLAO3G+9xKD7MvmrzkoAAAAAAAAAAAAA
19
20
diff --git a/src/lib/libcrypto/pkcs7/t/msie-e.pem b/src/lib/libcrypto/pkcs7/t/msie-e.pem
new file mode 100644
index 0000000000..a2a5e24e74
--- /dev/null
+++ b/src/lib/libcrypto/pkcs7/t/msie-e.pem
@@ -0,0 +1,22 @@
1-----BEGIN PKCS7-----
2MIAGCSqGSIb3DQEHA6CAMIIDkAIBADGCAcIwgcwCAQAwdjBiMREwDwYDVQQHEwhJ
3bnRlcm5ldDEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xNDAyBgNVBAsTK1ZlcmlT
4aWduIENsYXNzIDEgQ0EgLSBJbmRpdmlkdWFsIFN1YnNjcmliZXICEGBAmILep9sJ
5uN2Pkg1gucowDQYJKoZIhvcNAQEBBQAEQIzO7zLBD+pls7xwAYxEEX6Y+u6/f4O9
6v1pY1naTyeNSCoXqZx2FUHYyQZywbeZ6ZFckGLG8xhZWRTeorhlW4qwwgfACAQAw
7gZkwgZIxCzAJBgNVBAYTAkFVMRMwEQYDVQQIEwpRdWVlbnNsYW5kMREwDwYDVQQH
8EwhCcmlzYmFuZTEaMBgGA1UEChMRQ3J5cHRzb2Z0IFB0eSBMdGQxIjAgBgNVBAsT
9GURFTU9OU1RSQVRJT04gQU5EIFRFU1RJTkcxGzAZBgNVBAMTEkRFTU8gWkVSTyBW
10QUxVRSBDQQICBG4wDQYJKoZIhvcNAQEBBQAEQFxbBgUclskaGLO23uXO57ctz0If
11lYBvJH7YFne6/4nFl9GzU+5pY87BFrRWCzdjBImhF/FCPYaTTAWobWq3p3UwggHD
12BgkqhkiG9w0BBwEwGgYIKoZIhvcNAwIwDgICAKAECPL0ZT/zcdokgIIBmFHmyvHK
13ynLsN+iZEn19/x4wK1o3ASgTHsbbk9lGicLnuEG8ahJwu0Q9Tdan0URs83ugkRJ4
14L4CoxPJMs3LxpCzILmzncT1SSgi+DrZ6RhkFtdmpeyvHHg+GKJfc0fwZWHjamEHQ
15KGPDScodl5EObEZjcKaT4n6XS5UrFs0h8kgo6C4sGeGqacof8+ufMO3n3W7RQvLZ
16pMupGb7j/Vhq39A9vol6gobA08FtL2iAF2sI0Kn1kWDddqvYC1AfPJNAh9h4fdJF
17BSkqZGblTmj2nl6aAR1P5l8mb8ni1Ic6ZuAAWxsdBqQDgwFngnmp8MmE4DaDmVaT
18WEh67kOf8BotFl3TLPehjQh6j96s9bH9sKq0HNhsx72pIVN50qVtz0QZ7eik5N0F
19lXMrwoffDfOzLmW7Ep05Qbn1hhvkXUhmJYaIPK6j8e5pxf6CuK7kt4NsTM61meSj
205Nle9YiSjfR8Pv2PdPgxFGFZduCPYcrNr7i8nSbNwL/X4Y+wmMAQAD8mAgQNTjDr
218Mj8dAeEsA7cb73EoPsy+avOSgAAAAA=
22-----END PKCS7-----
diff --git a/src/lib/libcrypto/pkcs7/t/msie-enc-01 b/src/lib/libcrypto/pkcs7/t/msie-enc-01
new file mode 100644
index 0000000000..2c93ab6462
--- /dev/null
+++ b/src/lib/libcrypto/pkcs7/t/msie-enc-01
@@ -0,0 +1,62 @@
1
2MIAGCSqGSIb3DQEHA6CAMIACAQAxgfMwgfACAQAwgZkwgZIxCzAJBgNVBAYTAkFVMRMwEQYD
3VQQIEwpRdWVlbnNsYW5kMREwDwYDVQQHEwhCcmlzYmFuZTEaMBgGA1UEChMRQ3J5cHRzb2Z0
4IFB0eSBMdGQxIjAgBgNVBAsTGURFTU9OU1RSQVRJT04gQU5EIFRFU1RJTkcxGzAZBgNVBAMT
5EkRFTU8gWkVSTyBWQUxVRSBDQQICBG4wDQYJKoZIhvcNAQEBBQAEQKvMaW8xh6oF/X+CJivz
6IZV7yHxlp4O3NHQtWG0A8MOZB+CtKlU7/6g5e/a9Du/TOqxRMqtYRp63pa2Q/mM4IYMwgAYJ
7KoZIhvcNAQcBMBoGCCqGSIb3DQMCMA4CAgCgBAifz6RvzOPYlKCABIGwxtGA/FLBBRs1wbBP
8gDCbSG0yCwjJNsFg89/k6xuXo8c5YTwsw8+XlIVq03navpew6XxxzY090rD2OJ0t6HA6GqrI
9pd8WiSh/Atqn0yfLFmkLqgIAPRfzxUxqUocxLpQsLIFp2YNUGE+yps+UZmIjw/WHfdqrcWTm
10STSvKuy3UkIJZCkGDBpTvqk4BFaHh4oTXEpgpNY+GKxjf9TDN9GQPqQZR7sgQki4t2g4/Saq
11Kl4EMISgluk6swdND0tiHY7v5d6YR29ePCl2/STJ98eJpWkEEC22GNNvOy7ru/Rv2He4MgQg
12optd7sk9MMd9xhJppg7CcH/yDx//HrtgpOcWmn6VxpgECFqon4uXkQtIBIH4PaNclFn7/hLx
13Pw2VmBGaC0SYF3U1jyN96EBxdjqy8Aa6ByMXYDW5BcfqniD5mYXfw+b81lh1kutxaPaV4YJ9
14ZlRUW752N7VHo/fG0/fukoe5W9a8kIhgLpygllb/GP4oSF4wM6n1/OgRzZj2IWFiobKO4d/t
15Mnh+C+PoEVAuFZcxQwi9GqvsK5OoIjVwNx0XcVSOl1TTYS9SwC7ugMBCab73JiruC24pL78Y
16M+NaIpIQ3On4DokJA2ZHtjBjZIxF4tKA144RvFN6pBd6TVE5XM6KD/Vh9bjSmujtEAfdQ3Te
17dvKJsbZuu0stErbvWcRy11I328l557EECAJT7d44OJ3rBBBj6bnnx6dDU2SRqp2CEoQaBAhK
18RBuyhNxkygQIOY9/NhwqAJAECOvX0Zd0DqgoBAjobPpMHhVV3gQQWLU2vEoZ51BwzxdzCmxO
19wwQI4oKfudaNqoAESKzBNAqv5kGumHOlMKsRfrs7jZCcSaOuEj97pYx08FLEgF23cav39MOQ
20NUEM1dNU+EYslL4o3RoSHRjUgPU+2t9c0prS9A/bPARIEOP94PynaTNxwHi3VTK7SzuQmgzA
214n942E9joSiqsQPlsKAb3sPUaLC3SuUxSjNBgfpvD0bmrA/5h+WZoYXvIogFpwjkSmnFBEie
220lh5Ov1aRrvCw5/j3Q/W/4ZtN5U+aeVBJMtA8n0Mxd5kPxHbNVh4oGprZ6wEegV8ht3voyZa
23mZ5Cyxc8ffMYnM/JJI6/oEYEUEMyyiS5FnYyvxKzfMtyn2lZ2st9nZGNNgMc9N62r5HgNbdD
24FHuRdKKzV+8kQfuMc3mOPpK1t9TFY+QgrxiB5p6S7VooI97YtP3PbfknszCEBEh4PdXYbbaR
253AacN3Q5kYYmWsq3WW6xgrg0mmEGosGvwSQxBBuiXZrxScCa4ivEq05UZwyShePvKduOvnUE
262zDO6IXFLZxhTZAESEm9/FovLgGAiJ7iMGmYvsISLJScwG4n+wrSaQNQXizs9N3ykys54wBN
27d/+BQ4F7pncHhDQ2Dyt5MekB8Y8iNOocUTFCu524vQRIaWCXmXP3vU7D21dp0XnAMzRQJ565
28JV3aHRoY7XDa4LePa7PP9ywyafOE5yCW7ndqx3J+2JhTDvSFsW8/q3H3iyeFhykuJVS6BFDK
296CmKbnyyjOfE2iLGJmTFa905V2KrVDCmlEu/xyGMs80yTyZC+ySzM83FMVvLEQmSzcTNUZVp
30DfA1kNXbXkPouBXXT6g8r8JCRljaKKABmgRIlMheOJQRUUU4cgvhMreXPayhq5Ao4VMSCkA5
31hYRCBczm4Di/MMohF0SxIsdRY6gY9CPnrBXAsY6h1RbR7Tw0iQZmeXi52DCiBEj0by+SYMAa
329z0CReIzl8JLL6EVIFz8kFxlkGWjr4dnOzhhPOq/mCpp0WxbavDfdhE87MdXJZBnLwoT62QG
33955HlAoEQBOGJbcESCgd5XSirZ9Y3AbCfuKOqoMBvEUGn+w/pMaqnGvnr5FZhuBDKrhRXqtx
34QsxA//drGUxsrZOuSL/0+fbvo7n2h1Z8Ny86jOvVZAQIAjw2l1Yc5RAESNc9i3I8pKEOVQf/
35UBczJ0NR9aTEF80dRg2lpXwD0ho4N0AvSiVbgxC7cPZHQwIqvq9LHRUs/4n+Vu3SVYU3cAxo
36lUTiCGUSlARIF+TD57SI5+RI+MNtnD9rs4E1ml51YoHGWFj3UPriDmY0FKEwIgqtMXMY3fZ9
37Kq8d83bjDzxwbDX7WwR7KbSeJWT42pCz7kM+BEjjPsOnZHuusXT3x2rrsBnYtYsbt98mSFiS
38KzTtFmXfkOBbCQdit1P76QnYJ1aXMGs6zP6GypQTadK/zYWvlm38QkVwueaJ0woESKW2pqKA
3970h2UMDHOrpepU1lj0YMzmotDHSTU3L909VvUMNg9uqfrQ6mSkb9j5Tl8oF2otOw5EzA1Yda
40KPmgsv62RWLYl80wXQRQwG0e/mgG75jp9lOhJdVXqcYbQpS9viwVaVkwH+69mu/bQI4gjoEs
41UYX6O71Re2z+cYhcm9UrK+DXuSFBXQOIlAFxKMW4B0apd6fU84FsZLMESOorXE5OE0A2B2ji
42J8QI0Exk4hUvWrMNJfUZwFyS7E05xV9ORuX1xmsKqkT4tVR5Nqln4vhvAY860VBoloz0CDkd
438seSBEjeMgRI9FvpYuflIeHg9urkwp6N+1f0DrJJhJY9ZQ0HTQhziJmIfvbEjNqCl7hEC28+
44F8I5tuViLgfSwcFFCvnS6WFoN4X6QdFdqMCbBEjdlI1c+IQGA/IuTDMJYCuQ/v+8BG5ZeWVH
45icPZmXfRat9eFK1dGKAJef6+Tf9HPuDjSpDyffrifsp7Dc34lmm7GN1+ON3ZMtwEUNm6epb8
461RKWjoI7jIKUV/M2p/0eeGSqs4b06KF/VR6dBwsJVL5DpnTsp3MV4j/CAOlRdSPZ5++tsKbM
47aplk+ceqQtpEFz1MYTtVV4+rlrWaBEA1okJyNZ5/tNOwM7B+XfOZ0xw+uyVi9v4byTZM2Qds
48J+d3YGYLAugTGHISLqQEerD8/gGK+/SL06b2gNedXPHtBAiBKX+Mdy3wFQQIqE9gVgvrFNUE
49CKKoTFoMGqnPBAjDPgLCklNfrwQI3Ek1vSq68w8ECBodu2FOZJVkBAgzwjfSr2N9WQQQTCoQ
50KkAbrS9tnjXn1I3+ZwQIrPx3eINo/YUECIeYWCFskxlYBAiDUdvZXwD3vgQIkEyZbbZWbUUE
51CH4+odl1Isk3BBj68fkqJ0fKJRWVLWuW/O3VE4BOPKwFlaIECFseVTdDUho8BAj+cOKvV2WA
52hgQgaXr+wwq+ItblG0Qxz8IVUXX6PV2mIdHwz4SCCvnCsaIECJhBYxdfLI/XBCDswamPn9MR
53yXi2HVQBineV+GtWVkIoZ2dCLFB9mQRMoAQI0nUR5a5AOJoECA+AunKlAlx8BAi5RtFeF4g1
54FQQIz/ie+16LlQcECOmNuVg5DXjMBAjH2nkfpXZgWwQIVdLuO/+kuHAECO/5rEHmyI9vBBD4
5516BU4Rd3YerDQnHtrwOQBCCkho1XxK5Maz8KLCNi20wvcGt8wsIXlj2h5q9ITBq7IgQQvKVY
564OfJ7bKbItP2dylwQgQYPIGxwkkbRXNraONYvN19G8UdF35rFOuIBAjf0sKz/618ZQQIxObr
57xJkRe0sECIC+ssnjEb2NBBBI+XM4OntVWGsRV9Td3sFgBAinGwIroo8O0gQQMGAwgc9PaLaG
58gBCiwSTrYQQIVHjfCQgOtygEUIoraFoANfhZgIShpOd/RRxFU4/7xZR5tMdGoYz/g0thR0lM
59+Hi88FtFD4mAh/Oat4Ri8B7bv04aokjN2UHz6nPbHHjZ8zIqpbYTCy043GNZBAhOqjyB2JbD
60NwQoR23XCYD9x6E20ChHJRXmaHwyMdYXKl5CUxypl7ois+sy2D7jDukS3wQIsTyyPgJi0GsA
61AAAAAAAAAAAA
62
diff --git a/src/lib/libcrypto/pkcs7/t/msie-enc-01.pem b/src/lib/libcrypto/pkcs7/t/msie-enc-01.pem
new file mode 100644
index 0000000000..9abf00b2f2
--- /dev/null
+++ b/src/lib/libcrypto/pkcs7/t/msie-enc-01.pem
@@ -0,0 +1,66 @@
1-----BEGIN PKCS7-----
2MIAGCSqGSIb3DQEHA6CAMIILyAIBADGB8zCB8AIBADCBmTCBkjELMAkGA1UEBhMC
3QVUxEzARBgNVBAgTClF1ZWVuc2xhbmQxETAPBgNVBAcTCEJyaXNiYW5lMRowGAYD
4VQQKExFDcnlwdHNvZnQgUHR5IEx0ZDEiMCAGA1UECxMZREVNT05TVFJBVElPTiBB
5TkQgVEVTVElORzEbMBkGA1UEAxMSREVNTyBaRVJPIFZBTFVFIENBAgIEbjANBgkq
6hkiG9w0BAQEFAARAq8xpbzGHqgX9f4ImK/MhlXvIfGWng7c0dC1YbQDww5kH4K0q
7VTv/qDl79r0O79M6rFEyq1hGnrelrZD+YzghgzCCCssGCSqGSIb3DQEHATAaBggq
8hkiG9w0DAjAOAgIAoAQIn8+kb8zj2JSAggqgxtGA/FLBBRs1wbBPgDCbSG0yCwjJ
9NsFg89/k6xuXo8c5YTwsw8+XlIVq03navpew6XxxzY090rD2OJ0t6HA6GqrIpd8W
10iSh/Atqn0yfLFmkLqgIAPRfzxUxqUocxLpQsLIFp2YNUGE+yps+UZmIjw/WHfdqr
11cWTmSTSvKuy3UkIJZCkGDBpTvqk4BFaHh4oTXEpgpNY+GKxjf9TDN9GQPqQZR7sg
12Qki4t2g4/SaqKl6EoJbpOrMHTQ9LYh2O7+XemEdvXjwpdv0kyffHiaVpBBAtthjT
13bzsu67v0b9h3uDKim13uyT0wx33GEmmmDsJwf/IPH/8eu2Ck5xaafpXGmFqon4uX
14kQtIPaNclFn7/hLxPw2VmBGaC0SYF3U1jyN96EBxdjqy8Aa6ByMXYDW5BcfqniD5
15mYXfw+b81lh1kutxaPaV4YJ9ZlRUW752N7VHo/fG0/fukoe5W9a8kIhgLpygllb/
16GP4oSF4wM6n1/OgRzZj2IWFiobKO4d/tMnh+C+PoEVAuFZcxQwi9GqvsK5OoIjVw
17Nx0XcVSOl1TTYS9SwC7ugMBCab73JiruC24pL78YM+NaIpIQ3On4DokJA2ZHtjBj
18ZIxF4tKA144RvFN6pBd6TVE5XM6KD/Vh9bjSmujtEAfdQ3TedvKJsbZuu0stErbv
19WcRy11I328l557ECU+3eODid62PpuefHp0NTZJGqnYIShBpKRBuyhNxkyjmPfzYc
20KgCQ69fRl3QOqCjobPpMHhVV3li1NrxKGedQcM8XcwpsTsPigp+51o2qgKzBNAqv
215kGumHOlMKsRfrs7jZCcSaOuEj97pYx08FLEgF23cav39MOQNUEM1dNU+EYslL4o
223RoSHRjUgPU+2t9c0prS9A/bPBDj/eD8p2kzccB4t1Uyu0s7kJoMwOJ/eNhPY6Eo
23qrED5bCgG97D1Giwt0rlMUozQYH6bw9G5qwP+YflmaGF7yKIBacI5EppxZ7SWHk6
24/VpGu8LDn+PdD9b/hm03lT5p5UEky0DyfQzF3mQ/Eds1WHigamtnrAR6BXyG3e+j
25JlqZnkLLFzx98xicz8kkjr+gRkMyyiS5FnYyvxKzfMtyn2lZ2st9nZGNNgMc9N62
26r5HgNbdDFHuRdKKzV+8kQfuMc3mOPpK1t9TFY+QgrxiB5p6S7VooI97YtP3Pbfkn
27szCEeD3V2G22kdwGnDd0OZGGJlrKt1lusYK4NJphBqLBr8EkMQQbol2a8UnAmuIr
28xKtOVGcMkoXj7ynbjr51BNswzuiFxS2cYU2QSb38Wi8uAYCInuIwaZi+whIslJzA
29bif7CtJpA1BeLOz03fKTKznjAE13/4FDgXumdweENDYPK3kx6QHxjyI06hxRMUK7
30nbi9aWCXmXP3vU7D21dp0XnAMzRQJ565JV3aHRoY7XDa4LePa7PP9ywyafOE5yCW
317ndqx3J+2JhTDvSFsW8/q3H3iyeFhykuJVS6yugpim58soznxNoixiZkxWvdOVdi
32q1QwppRLv8chjLPNMk8mQvskszPNxTFbyxEJks3EzVGVaQ3wNZDV215D6LgV10+o
33PK/CQkZY2iigAZqUyF44lBFRRThyC+Eyt5c9rKGrkCjhUxIKQDmFhEIFzObgOL8w
34yiEXRLEix1FjqBj0I+esFcCxjqHVFtHtPDSJBmZ5eLnYMKL0by+SYMAa9z0CReIz
35l8JLL6EVIFz8kFxlkGWjr4dnOzhhPOq/mCpp0WxbavDfdhE87MdXJZBnLwoT62QG
36955HlAoEQBOGJbcoHeV0oq2fWNwGwn7ijqqDAbxFBp/sP6TGqpxr56+RWYbgQyq4
37UV6rcULMQP/3axlMbK2Trki/9Pn276O59odWfDcvOozr1WQCPDaXVhzlENc9i3I8
38pKEOVQf/UBczJ0NR9aTEF80dRg2lpXwD0ho4N0AvSiVbgxC7cPZHQwIqvq9LHRUs
39/4n+Vu3SVYU3cAxolUTiCGUSlBfkw+e0iOfkSPjDbZw/a7OBNZpedWKBxlhY91D6
404g5mNBShMCIKrTFzGN32fSqvHfN24w88cGw1+1sEeym0niVk+NqQs+5DPuM+w6dk
41e66xdPfHauuwGdi1ixu33yZIWJIrNO0WZd+Q4FsJB2K3U/vpCdgnVpcwazrM/obK
42lBNp0r/Nha+WbfxCRXC55onTCqW2pqKA70h2UMDHOrpepU1lj0YMzmotDHSTU3L9
4309VvUMNg9uqfrQ6mSkb9j5Tl8oF2otOw5EzA1YdaKPmgsv62RWLYl80wXcBtHv5o
44Bu+Y6fZToSXVV6nGG0KUvb4sFWlZMB/uvZrv20COII6BLFGF+ju9UXts/nGIXJvV
45Kyvg17khQV0DiJQBcSjFuAdGqXen1POBbGSz6itcTk4TQDYHaOInxAjQTGTiFS9a
46sw0l9RnAXJLsTTnFX05G5fXGawqqRPi1VHk2qWfi+G8BjzrRUGiWjPQIOR3yx5IE
47SN4y9FvpYuflIeHg9urkwp6N+1f0DrJJhJY9ZQ0HTQhziJmIfvbEjNqCl7hEC28+
48F8I5tuViLgfSwcFFCvnS6WFoN4X6QdFdqMCb3ZSNXPiEBgPyLkwzCWArkP7/vARu
49WXllR4nD2Zl30WrfXhStXRigCXn+vk3/Rz7g40qQ8n364n7Kew3N+JZpuxjdfjjd
502TLc2bp6lvzVEpaOgjuMgpRX8zan/R54ZKqzhvTooX9VHp0HCwlUvkOmdOyncxXi
51P8IA6VF1I9nn762wpsxqmWT5x6pC2kQXPUxhO1VXj6uWtZo1okJyNZ5/tNOwM7B+
52XfOZ0xw+uyVi9v4byTZM2QdsJ+d3YGYLAugTGHISLqQEerD8/gGK+/SL06b2gNed
53XPHtgSl/jHct8BWoT2BWC+sU1aKoTFoMGqnPwz4CwpJTX6/cSTW9KrrzDxodu2FO
54ZJVkM8I30q9jfVlMKhAqQButL22eNefUjf5nrPx3eINo/YWHmFghbJMZWINR29lf
55APe+kEyZbbZWbUV+PqHZdSLJN/rx+SonR8olFZUta5b87dUTgE48rAWVolseVTdD
56Uho8/nDir1dlgIZpev7DCr4i1uUbRDHPwhVRdfo9XaYh0fDPhIIK+cKxophBYxdf
57LI/X7MGpj5/TEcl4th1UAYp3lfhrVlZCKGdnQixQfZkETKDSdRHlrkA4mg+AunKl
58Alx8uUbRXheINRXP+J77XouVB+mNuVg5DXjMx9p5H6V2YFtV0u47/6S4cO/5rEHm
59yI9v+NegVOEXd2Hqw0Jx7a8DkKSGjVfErkxrPwosI2LbTC9wa3zCwheWPaHmr0hM
60GrsivKVY4OfJ7bKbItP2dylwQjyBscJJG0Vza2jjWLzdfRvFHRd+axTriN/SwrP/
61rXxlxObrxJkRe0uAvrLJ4xG9jUj5czg6e1VYaxFX1N3ewWCnGwIroo8O0jBgMIHP
62T2i2hoAQosEk62FUeN8JCA63KIoraFoANfhZgIShpOd/RRxFU4/7xZR5tMdGoYz/
63g0thR0lM+Hi88FtFD4mAh/Oat4Ri8B7bv04aokjN2UHz6nPbHHjZ8zIqpbYTCy04
643GNZTqo8gdiWwzdHbdcJgP3HoTbQKEclFeZofDIx1hcqXkJTHKmXuiKz6zLYPuMO
656RLfsTyyPgJi0GsAAAAA
66-----END PKCS7-----
diff --git a/src/lib/libcrypto/pkcs7/t/msie-enc-02 b/src/lib/libcrypto/pkcs7/t/msie-enc-02
new file mode 100644
index 0000000000..7017055965
--- /dev/null
+++ b/src/lib/libcrypto/pkcs7/t/msie-enc-02
@@ -0,0 +1,90 @@
1
2MIAGCSqGSIb3DQEHA6CAMIACAQAxggHCMIHMAgEAMHYwYjERMA8GA1UEBxMISW50ZXJuZXQxFzAV
3BgNVBAoTDlZlcmlTaWduLCBJbmMuMTQwMgYDVQQLEytWZXJpU2lnbiBDbGFzcyAxIENBIC0gSW5k
4aXZpZHVhbCBTdWJzY3JpYmVyAhBgQJiC3qfbCbjdj5INYLnKMA0GCSqGSIb3DQEBAQUABEACr4tn
5kSzvo3aIlHfJLGbfokNCV6FjdDP1vQhL+kdXONqcFCEf9ReETCvaHslIr/Wepc5j2hjZselzgqLn
6rM1ZMIHwAgEAMIGZMIGSMQswCQYDVQQGEwJBVTETMBEGA1UECBMKUXVlZW5zbGFuZDERMA8GA1UE
7BxMIQnJpc2JhbmUxGjAYBgNVBAoTEUNyeXB0c29mdCBQdHkgTHRkMSIwIAYDVQQLExlERU1PTlNU
8UkFUSU9OIEFORCBURVNUSU5HMRswGQYDVQQDExJERU1PIFpFUk8gVkFMVUUgQ0ECAgRuMA0GCSqG
9SIb3DQEBAQUABEBanBxKOvUoRn3DiFY55lly2TPu2Cv+dI/GLrzW6qvnUMZPWGPGaUlPyWLMZrXJ
10xGXZUiRJKTBwDu91fnodUEK9MIAGCSqGSIb3DQEHATAaBggqhkiG9w0DAjAOAgIAoAQImxKZEDWP
11EuOggASCBACBi1bX/qc3geqFyfRpX7JyIo/g4CDr62GlwvassAGlIO8zJ5Z/UDIIooeV6QS4D4OW
12PymKd0WXhwcJI0yBcJTWEoxND27LM7CWFJpA07AoxVCRHTOPgm794NynLecNUOqVTFyS4CRuLhVG
13PAk0nFZG/RE2yMtx4rAkSiVgOexES7wq/xWuoDSSmuTMNQOTbKfkEKqdFLkM/d62gD2wnaph7vKk
14PPK82wdZP8rF3nUUC5c4ahbNoa8g+5B3tIF/Jz3ZZK3vGLU0IWO+i7W451dna13MglDDjXOeikNl
15XLsQdAVo0nsjfGu+f66besJojPzysNA+IEZl6gNWUetl9lim4SqrxubUExdS2rmXnXXmEuEW/HC7
16dlTAeYq5Clqx5id6slhC2C2oegMww3XH9yxHw6OqzvXY6pVPEScEtBMQLgaKFQT+m2SRtbTVFG7c
17QcnUODyVB1IbpQTF1DHeeOX1W/HfpWZym8dzkti6SCyeumHmqO406xDiIMVKtHOqM86nEHuAMZsr
18cLy+ey6TEJvR6S4N8QRzng8JJDZDTJXQN6q84aEudsnOrw2KyOVwPpI6ey4qBsHUgQ8kAFy5lsQa
19WV45h6exgUwbBcKLgPZGFj+OdD2RKJsTb83/UqbJS5Q/lGXhzBlnaYucyJxEprRxbntmcnOEPFJe
20+tRDUwOTd7qlJljdhIJL+uDcooL9Ahgo6Cwep6tduekv2cSEohJeTE8Dvy34YRhMbLvnFNdmnpNy
21rNZDYVVxxaKoyd2AfB8NPFZh1VdAYfI3R1QAQ2kXEef5NNIfVQfMzD9akJn4RP+Kv32Qaxm4FrnK
22xmwRyGJShavIBc2ax+F1r1+NZXuSBHn5vfoRTxOk0ST4dXsw74dnlYUMRaSu4qqUdM9jsXSyeX4Z
23gQgkR2bkaYO6ezFgenFIa7QWVw8rXZAEZ5aibCxbnY1VE41PYIvhlLdbFJhH9gY22s+fFAuwnzyA
24SRjC40A9aAEItRlaPStWSGiqlLRgNkBBwdpv2l2YPBd2QzHx6ek6XGrvRJuAC+Nh62rtQKwpNH54
25YAOHW55maBFW2SQ3TF+cZ6NbbqhCmHTyyR7mcSYc9sXSVDWEhYKQ1iyU870zhHWVpvglZizZetJC
26ZFjYex3b1ngVdcgargOvpPq9urCKKi2mbkqv/EFpzSWGXkKSpfCG/XfMnEOtkNrB8S06vnk2JcJB
27OBqJot+uuSH5hOg0vTpxX2DuONJSiWSWyfRE/lTfJJFXwhod7SXclUyXPeSyibcSic2hVAzDmwjD
2831js/j2k02PI/agPhr3UQ8cMgcNAiaoCKbNaWfn6BGbCAbTchxzUlo2cSJiLlrX2IDZmfXbXmZCo
29m1smWIG+BIIEALiuAxDb6dWLAYyVBoN9hYI4AiPeZAY9MtvQ6AV8o2/EFm6PvYGXy3Hei5830CH0
30PBeX7Kdd6ff1y33TW/l5qSkIL1ULTGR7okFfJePHDmq1dFt6/JOMptiQ8WSu7CsJQvZ9VTFXeYFc
31ZqCPPZc1NrPegNK70Zf9QxWIbDAevJ5KLBf1c6j8pU2/6LnvDY6VjaTvYSgr7vTR8eVzH4Rm77W0
32iOHxg5VcODv6cGSVyuvbX8UAGo8Cmb58ERDtBDJBQXVpWKLNAuDJ9GX8n2zNkpjZLbPSkcmuhqGa
33BJBE/BaCTkUQWlY9dIbRtEnxIU1mfbPPdx1Ppa8DqGDjSOsQdKcKYNNZtayEw++EIpmpdBNsKphC
34fB8UEK2Wkk4ZVW+qyGoi/r0MFsvO1NmSOOZ0o/jy/YHmoeURHhPy97AO3eVTkEAa5CfJEJybmo56
357CDw/FwoGAUCgsoz7rlxzMudr/IhHIH+APinncxXlHO2ecvHD9i8DaHGA8tVifgsUhqQoZieULut
36eF94O5UAxOkv41UZssYTwN4nYrN1QkesZl3BX4ORS4EE30/PQ23ARf3WZptZrCJevGm2ZYzGeh8x
37g17mCDfiLO+bff4qP/4mC96Pu4ia6j4to5BwKIJS/+DCuoD8WeSKF4pugXQkMUiHdQnNnVP9Sp2O
38/4ly5mO8JzrQC59V2bnTNBqPhpno8kfJvK5TypPSVC+bTzern3rJ6UceB3srcn9zxKx9GdNydJQj
39yWjv8ec3n3d1nuQwhz5Q053NBhIjwoGg3Go7LO6i78ZOlpF7dcoAO13NfHLyNjnyHCaiWtVRTct9
40rLf5vN00urSn8YJngHk1eTKK8nHGIcOg6YdYDOD2nE5XwRijKmieG8Xa3eKRzfbL06GrBQENle6J
41mC131bp3cRVxpjq+o6RAbGoMm4yICsL4eTarCQrsyHmoPHqr91UHo91avyxU7knWmEhX27ybmsrs
428aeZwPHixL14TeyhruCqRVvkf1Ks7P+z8MPUboGNqQe2WLN8ktCGEr15O8MJR/em86G03Jfo4oaw
43/DVUH5RwLT6acedOGuzMh/2r8BcmemhVQ8/cWvV4YJ0tOW4hzyVHC5hQf8sZ3LzxXLH6Ohnrbprh
44xvrdbaSdChWZDDP0bCCbxEhkwuBkBeKZrMbwRTP+TPTPYLVTH/CmKLzKh/114tkGkyO3hHS4qExU
45V39F2Sj4mylx+hD0+20D9pntpNi7htccGlOm6yNM69at/3+kLgJJyoIlaxLcCUYHNMifDt+T3p/t
465U4XmD53uUQ6M8dvj/udqPekNSUfse15yrd9pjOt5PcJuqW28q0sFHf9pHIgz3XZFMe5PD7ppw6r
47S+C6Ir4PrYIEggQA7ZDVtiCm+BbtNNB/UJm79/OQ5mp5bTI0kPmDeycaWTa0Ojpum+c/dpG/iJOB
48DICj7jHOXSHT7JlGyX6aSFJUltucAnZvwzhPDmdDaIDiKSk85GqgdDWVfGosSCX9Ph/T3WpIxnwf
49WSDRtIHkWTjly+pe4yy5K6/XISy/L5Zh/fhiI5fjHjgzmlibs2ru4nVw6hBhUvlSSe2BEs5d9h/y
50NH8Wy3qvb2D3jh7hkepFtZJGNTHp8ZUC7Ns2JIpQYObsaxdI65i3mMOu7fRwI+0/4ejsWhP6KCEi
51LgwvLg0qM82ma6YB7qHAHboaczRVEffDcJUG4a5uycB0DoZFn+uEaEFyili20hCn4hVfsqUQk2PT
528Mo1tSl5e30xI1YJZrRgiJm9nHRX6fLizngP+ILJLPHZsPvlSVIfY+/v/FR8feKOjaGhyGF51BAx
53aM2NIQ4jMP5/X+U5gQybi0E6u7rroDhaHsKmCMgXqszwXWCpedA/sEbeHpiTC59YlPPSlIOMc9vP
54Ko/mQCfWy/9icUaIfKQldvkllUxxNkqu6AbIpHVscbAEzSPs5xbQXU8EZNNCDisFnnpY3nQ3eLnl
55m89saTJxRb7NWHRMlmPv7qgD7uMIq3vdOGA7i5wT9MeoNIgK1/DsgH30s6RWjJy4YyyLmRTXPzbj
56hbQVpEmiMRbEidIvUx2OjKVxVQIcgtLsa2lvHQ4XL1cpLr5GVtOgy0fMg5OCDUUDsvjgjgLQ3P2U
57p2nVY5FM6/QpPc5DTLuuR9ekI2/c9Biz09RtcYDUQK2ajdo8h1IyKqHFoB7h48OXxXKKY94DY0TG
58x6PonB/epj8orAw4QKmm5M0vXYwBOqRymCTHTqOJGObdLx1euFFyqguzHJOU2gAGZI0z9Lg1yRuF
59yhdPZyuniIcmtLNxRZ1duYHErcAyX56qndmLXt7UVkATai/rIMuoJLfAsUnVuTUS5p7tJM754UZT
607lTcXvDJgOUNnBRaIcxC3pxvbrYDJ2iFJ72xkxUP2p74gucqg25XnCVmQuLg6zDDxF6CLuw9isxy
61Xg4pkneMN//7fpp8GYl9nyZm2yqYYM+jcw0fcVc64L+X4w/gL3H2UMGgxIHSJp7HIG7VKHtXrNyj
62dPXXPVUsMsAAimqOr0Lr2sZWirfuivLaPTqhbkvG5PF7K3gT80AOIcd/6EIHBy2hZ7ukfjHmdP4L
63yQOhTQklaKzGHI0mypq0uFLWJOUlZnVrMiLP1xrWkpC8Ro9eo6mfjjQ45z8adC43a47klwTEzvod
643rNEFIGJJUEjAN3mbqie7IxoSJknBBJK0D9lZEQ8lZWlq7vuN8JdqPM6xh155jMVsPwjLK6Tzkj5
65BpRD9Tgm3u6HPQSCBADgkWEN75Mu9TGosXY0xm1k6K6sPv8L949CrLWo4r1I2LA072bTGvQP28Vs
66hUA76jgcT1ocC++9PoktIK10YCq5w+FfMAQ04KeCXuAdmiY2iAT4Slea61PMCMta3mVGyLUZCLEm
67P+I0UKR5mlO0fGEcjU9j8TmbjZqxNFqloLsU7oSi7Os0EtYHkdAVrExUyOc/ZDie6fBjdLTmLdCm
68bE9JNwjlbXypdTZupGgLNhKGDIskUAAMwZYayI6YfSIMkNCeAYTnjOuGZZ1msCXGXsfMBR1sfUIj
699UeGjwD8gq+UVVHX/oeoH/m0eJ5ppqi3+nUlgc9DvpYsC/Fg0G2KuYb9B+VJ+a4GMzQSPREoFtQp
70B9dtLkBb7Ha/hpGWTIdqzW0eAo5llyN8FNvl2Fu2IcLaNmWFO69gLjRKQopp0dvFOuwAVI6fvGDj
71p1WigoNbFZl8N+iiWmzKOjoG2ZLbez1clZCms/JPJrXhEMMOxWpVzkQyN336VWHmGgMcjaKCGSeA
722nnESIGuiCXMrkHlGfabYIsKcHFCo2t13uXyZPf0zSPTkuD0Eh92wqC9pvA3gvrrCUfo9Mn3bs+e
73KWKmDlpcs8mDn032oIg+zrQhIduMqXVn3evzeVM3B5MBOGMvg51/SXg7R+MC/463juQQEb9IVe/I
74YGnO//oWm9lw/377Af/qH+FnN02obJw1FvesQIs9e5RHNQykKbO+vmVJQl1nd9DZWrHDNO7/80Yz
752hCm7Tws5nSRN2iFlyRaYJHr7ypxkU2rCak2r6ua7XDwu1qU2RT3+qPjT1RuxQ2oTlHyGkKPMZGC
76Rc+CSWz5aeeCmHZVwdb3nC8YpfsujMiYqygLeuQ82pjKuR7DIKGmnfcOLdv5F+Ek2Wyy0D98iSgk
77+aoQGYLhL9llU13pn21uRsDY5uGcXiIw1IETFlTdgENEv8futZuJsegrp7fmFXyNoNyFNyypeDrM
786ZqR4vKxFjg3tKKeVpkw/W4EAklzMxmNiazGNDBHsnYV3rwPlKa+HeeE2YxnsKwGLCNgRYUXTaJk
79461vS160z3dvh/mLfdZ7MYCkmO3bNE3ELUDAw7YQkSuo9ujzdFKte9LC34sjg9fOex3ThAg5Y50n
80wYm4zBmGM7yEqL8O6QgnM6tIDFS9XryDaLNzcGhMWqMvhzO6sC/AA2WfLgwS517Cp03IkJQWqG9q
81w52+E+GAtpioJfczEhlv9BrhjttdugRSjJrG8SYVYE4zG3Aur5eNBoGaALIOHOtPw8+JovQmIWcF
82oaJ/WQuglFrWtew51IK6F8RiHAOBVavZOuZcO7tV+5enVfreOd0rX8ZOy4hYmHhmF1hOrrWOn+Ee
83E0SYKonXN01BM9xMBIIBSLCvNAppnGPTUGjwbMJRg1VJ2KMiBWH5oJp8tyfIAxMuWFdtaLYbRSOD
84XbOAshPVK8JAY8DQDkzqaCTAkLTfSRAt9yY6SbUpMsRv7xa8nMZNJBJzJT9b/wNjgiOJgaGuJMkV
852g/DX2jfP3PrMM/Sbnz7edORXHj1Pa5XTT8nG5MS0FuZgvevdq3o/gVVAz+ZCKOH3ShMzZvfp01l
86SX5gaJTflmU6cdNwtn2yZ6IScF7OrjUeA9iEoSVR9dQcA+4lB3RAG3LMwcnxXY35D7+PMJzHIZdF
87cSnq+n03ACY2/E/T31iijRH29rvYHGI+mP/ieYs45iq4fTWo6i1HofeWLdP0fX7xW3XO0/hWYFiw
88BxKu66whAbRhaib3XJNvetVs25ToYXyiDpjG+cd5rCMei8sGQwTBj9Zeh0URoeMW1inTP0JvCmMU
89rZgAAAAAAAAAAAAA
90
diff --git a/src/lib/libcrypto/pkcs7/t/msie-enc-02.pem b/src/lib/libcrypto/pkcs7/t/msie-enc-02.pem
new file mode 100644
index 0000000000..279c5d830b
--- /dev/null
+++ b/src/lib/libcrypto/pkcs7/t/msie-enc-02.pem
@@ -0,0 +1,106 @@
1-----BEGIN PKCS7-----
2MIAGCSqGSIb3DQEHA6CAMIITQAIBADGCAcIwgcwCAQAwdjBiMREwDwYDVQQHEwhJ
3bnRlcm5ldDEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xNDAyBgNVBAsTK1ZlcmlT
4aWduIENsYXNzIDEgQ0EgLSBJbmRpdmlkdWFsIFN1YnNjcmliZXICEGBAmILep9sJ
5uN2Pkg1gucowDQYJKoZIhvcNAQEBBQAEQAKvi2eRLO+jdoiUd8ksZt+iQ0JXoWN0
6M/W9CEv6R1c42pwUIR/1F4RMK9oeyUiv9Z6lzmPaGNmx6XOCoueszVkwgfACAQAw
7gZkwgZIxCzAJBgNVBAYTAkFVMRMwEQYDVQQIEwpRdWVlbnNsYW5kMREwDwYDVQQH
8EwhCcmlzYmFuZTEaMBgGA1UEChMRQ3J5cHRzb2Z0IFB0eSBMdGQxIjAgBgNVBAsT
9GURFTU9OU1RSQVRJT04gQU5EIFRFU1RJTkcxGzAZBgNVBAMTEkRFTU8gWkVSTyBW
10QUxVRSBDQQICBG4wDQYJKoZIhvcNAQEBBQAEQFqcHEo69ShGfcOIVjnmWXLZM+7Y
11K/50j8YuvNbqq+dQxk9YY8ZpSU/JYsxmtcnEZdlSJEkpMHAO73V+eh1QQr0wghFz
12BgkqhkiG9w0BBwEwGgYIKoZIhvcNAwIwDgICAKAECJsSmRA1jxLjgIIRSIGLVtf+
13pzeB6oXJ9GlfsnIij+DgIOvrYaXC9qywAaUg7zMnln9QMgiih5XpBLgPg5Y/KYp3
14RZeHBwkjTIFwlNYSjE0PbsszsJYUmkDTsCjFUJEdM4+Cbv3g3Kct5w1Q6pVMXJLg
15JG4uFUY8CTScVkb9ETbIy3HisCRKJWA57ERLvCr/Fa6gNJKa5Mw1A5Nsp+QQqp0U
16uQz93raAPbCdqmHu8qQ88rzbB1k/ysXedRQLlzhqFs2hryD7kHe0gX8nPdlkre8Y
17tTQhY76LtbjnV2drXcyCUMONc56KQ2VcuxB0BWjSeyN8a75/rpt6wmiM/PKw0D4g
18RmXqA1ZR62X2WKbhKqvG5tQTF1LauZeddeYS4Rb8cLt2VMB5irkKWrHmJ3qyWELY
19Lah6AzDDdcf3LEfDo6rO9djqlU8RJwS0ExAuBooVBP6bZJG1tNUUbtxBydQ4PJUH
20UhulBMXUMd545fVb8d+lZnKbx3OS2LpILJ66Yeao7jTrEOIgxUq0c6ozzqcQe4Ax
21mytwvL57LpMQm9HpLg3xBHOeDwkkNkNMldA3qrzhoS52yc6vDYrI5XA+kjp7LioG
22wdSBDyQAXLmWxBpZXjmHp7GBTBsFwouA9kYWP450PZEomxNvzf9SpslLlD+UZeHM
23GWdpi5zInESmtHFue2Zyc4Q8Ul761ENTA5N3uqUmWN2Egkv64Nyigv0CGCjoLB6n
24q1256S/ZxISiEl5MTwO/LfhhGExsu+cU12aek3Ks1kNhVXHFoqjJ3YB8Hw08VmHV
25V0Bh8jdHVABDaRcR5/k00h9VB8zMP1qQmfhE/4q/fZBrGbgWucrGbBHIYlKFq8gF
26zZrH4XWvX41le5IEefm9+hFPE6TRJPh1ezDvh2eVhQxFpK7iqpR0z2OxdLJ5fhmB
27CCRHZuRpg7p7MWB6cUhrtBZXDytdkARnlqJsLFudjVUTjU9gi+GUt1sUmEf2Bjba
28z58UC7CfPIBJGMLjQD1oAQi1GVo9K1ZIaKqUtGA2QEHB2m/aXZg8F3ZDMfHp6Tpc
29au9Em4AL42Hrau1ArCk0fnhgA4dbnmZoEVbZJDdMX5xno1tuqEKYdPLJHuZxJhz2
30xdJUNYSFgpDWLJTzvTOEdZWm+CVmLNl60kJkWNh7HdvWeBV1yBquA6+k+r26sIoq
31LaZuSq/8QWnNJYZeQpKl8Ib9d8ycQ62Q2sHxLTq+eTYlwkE4Gomi3665IfmE6DS9
32OnFfYO440lKJZJbJ9ET+VN8kkVfCGh3tJdyVTJc95LKJtxKJzaFUDMObCMPfWOz+
33PaTTY8j9qA+GvdRDxwyBw0CJqgIps1pZ+foEZsIBtNyHHNSWjZxImIuWtfYgNmZ9
34dteZkKibWyZYgb64rgMQ2+nViwGMlQaDfYWCOAIj3mQGPTLb0OgFfKNvxBZuj72B
35l8tx3oufN9Ah9DwXl+ynXen39ct901v5eakpCC9VC0xke6JBXyXjxw5qtXRbevyT
36jKbYkPFkruwrCUL2fVUxV3mBXGagjz2XNTaz3oDSu9GX/UMViGwwHryeSiwX9XOo
37/KVNv+i57w2OlY2k72EoK+700fHlcx+EZu+1tIjh8YOVXDg7+nBklcrr21/FABqP
38Apm+fBEQ7QQyQUF1aViizQLgyfRl/J9szZKY2S2z0pHJroahmgSQRPwWgk5FEFpW
39PXSG0bRJ8SFNZn2zz3cdT6WvA6hg40jrEHSnCmDTWbWshMPvhCKZqXQTbCqYQnwf
40FBCtlpJOGVVvqshqIv69DBbLztTZkjjmdKP48v2B5qHlER4T8vewDt3lU5BAGuQn
41yRCcm5qOeuwg8PxcKBgFAoLKM+65cczLna/yIRyB/gD4p53MV5RztnnLxw/YvA2h
42xgPLVYn4LFIakKGYnlC7rXhfeDuVAMTpL+NVGbLGE8DeJ2KzdUJHrGZdwV+DkUuB
43BN9Pz0NtwEX91mabWawiXrxptmWMxnofMYNe5gg34izvm33+Kj/+Jgvej7uImuo+
44LaOQcCiCUv/gwrqA/FnkiheKboF0JDFIh3UJzZ1T/Uqdjv+JcuZjvCc60AufVdm5
450zQaj4aZ6PJHybyuU8qT0lQvm083q596yelHHgd7K3J/c8SsfRnTcnSUI8lo7/Hn
46N593dZ7kMIc+UNOdzQYSI8KBoNxqOyzuou/GTpaRe3XKADtdzXxy8jY58hwmolrV
47UU3Lfay3+bzdNLq0p/GCZ4B5NXkyivJxxiHDoOmHWAzg9pxOV8EYoyponhvF2t3i
48kc32y9OhqwUBDZXuiZgtd9W6d3EVcaY6vqOkQGxqDJuMiArC+Hk2qwkK7Mh5qDx6
49q/dVB6PdWr8sVO5J1phIV9u8m5rK7PGnmcDx4sS9eE3soa7gqkVb5H9SrOz/s/DD
501G6BjakHtlizfJLQhhK9eTvDCUf3pvOhtNyX6OKGsPw1VB+UcC0+mnHnThrszIf9
51q/AXJnpoVUPP3Fr1eGCdLTluIc8lRwuYUH/LGdy88Vyx+joZ626a4cb63W2knQoV
52mQwz9Gwgm8RIZMLgZAXimazG8EUz/kz0z2C1Ux/wpii8yof9deLZBpMjt4R0uKhM
53VFd/Rdko+JspcfoQ9PttA/aZ7aTYu4bXHBpTpusjTOvWrf9/pC4CScqCJWsS3AlG
54BzTInw7fk96f7eVOF5g+d7lEOjPHb4/7naj3pDUlH7Htecq3faYzreT3CbqltvKt
55LBR3/aRyIM912RTHuTw+6acOq0vguiK+D62C7ZDVtiCm+BbtNNB/UJm79/OQ5mp5
56bTI0kPmDeycaWTa0Ojpum+c/dpG/iJOBDICj7jHOXSHT7JlGyX6aSFJUltucAnZv
57wzhPDmdDaIDiKSk85GqgdDWVfGosSCX9Ph/T3WpIxnwfWSDRtIHkWTjly+pe4yy5
58K6/XISy/L5Zh/fhiI5fjHjgzmlibs2ru4nVw6hBhUvlSSe2BEs5d9h/yNH8Wy3qv
59b2D3jh7hkepFtZJGNTHp8ZUC7Ns2JIpQYObsaxdI65i3mMOu7fRwI+0/4ejsWhP6
60KCEiLgwvLg0qM82ma6YB7qHAHboaczRVEffDcJUG4a5uycB0DoZFn+uEaEFyili2
610hCn4hVfsqUQk2PT8Mo1tSl5e30xI1YJZrRgiJm9nHRX6fLizngP+ILJLPHZsPvl
62SVIfY+/v/FR8feKOjaGhyGF51BAxaM2NIQ4jMP5/X+U5gQybi0E6u7rroDhaHsKm
63CMgXqszwXWCpedA/sEbeHpiTC59YlPPSlIOMc9vPKo/mQCfWy/9icUaIfKQldvkl
64lUxxNkqu6AbIpHVscbAEzSPs5xbQXU8EZNNCDisFnnpY3nQ3eLnlm89saTJxRb7N
65WHRMlmPv7qgD7uMIq3vdOGA7i5wT9MeoNIgK1/DsgH30s6RWjJy4YyyLmRTXPzbj
66hbQVpEmiMRbEidIvUx2OjKVxVQIcgtLsa2lvHQ4XL1cpLr5GVtOgy0fMg5OCDUUD
67svjgjgLQ3P2Up2nVY5FM6/QpPc5DTLuuR9ekI2/c9Biz09RtcYDUQK2ajdo8h1Iy
68KqHFoB7h48OXxXKKY94DY0TGx6PonB/epj8orAw4QKmm5M0vXYwBOqRymCTHTqOJ
69GObdLx1euFFyqguzHJOU2gAGZI0z9Lg1yRuFyhdPZyuniIcmtLNxRZ1duYHErcAy
70X56qndmLXt7UVkATai/rIMuoJLfAsUnVuTUS5p7tJM754UZT7lTcXvDJgOUNnBRa
71IcxC3pxvbrYDJ2iFJ72xkxUP2p74gucqg25XnCVmQuLg6zDDxF6CLuw9isxyXg4p
72kneMN//7fpp8GYl9nyZm2yqYYM+jcw0fcVc64L+X4w/gL3H2UMGgxIHSJp7HIG7V
73KHtXrNyjdPXXPVUsMsAAimqOr0Lr2sZWirfuivLaPTqhbkvG5PF7K3gT80AOIcd/
746EIHBy2hZ7ukfjHmdP4LyQOhTQklaKzGHI0mypq0uFLWJOUlZnVrMiLP1xrWkpC8
75Ro9eo6mfjjQ45z8adC43a47klwTEzvod3rNEFIGJJUEjAN3mbqie7IxoSJknBBJK
760D9lZEQ8lZWlq7vuN8JdqPM6xh155jMVsPwjLK6Tzkj5BpRD9Tgm3u6HPeCRYQ3v
77ky71MaixdjTGbWTorqw+/wv3j0KstajivUjYsDTvZtMa9A/bxWyFQDvqOBxPWhwL
78770+iS0grXRgKrnD4V8wBDTgp4Je4B2aJjaIBPhKV5rrU8wIy1reZUbItRkIsSY/
794jRQpHmaU7R8YRyNT2PxOZuNmrE0WqWguxTuhKLs6zQS1geR0BWsTFTI5z9kOJ7p
808GN0tOYt0KZsT0k3COVtfKl1Nm6kaAs2EoYMiyRQAAzBlhrIjph9IgyQ0J4BhOeM
8164ZlnWawJcZex8wFHWx9QiP1R4aPAPyCr5RVUdf+h6gf+bR4nmmmqLf6dSWBz0O+
82liwL8WDQbYq5hv0H5Un5rgYzNBI9ESgW1CkH120uQFvsdr+GkZZMh2rNbR4CjmWX
83I3wU2+XYW7Yhwto2ZYU7r2AuNEpCimnR28U67ABUjp+8YOOnVaKCg1sVmXw36KJa
84bMo6OgbZktt7PVyVkKaz8k8mteEQww7FalXORDI3ffpVYeYaAxyNooIZJ4DaecRI
85ga6IJcyuQeUZ9ptgiwpwcUKja3Xe5fJk9/TNI9OS4PQSH3bCoL2m8DeC+usJR+j0
86yfduz54pYqYOWlyzyYOfTfagiD7OtCEh24ypdWfd6/N5UzcHkwE4Yy+DnX9JeDtH
874wL/jreO5BARv0hV78hgac7/+hab2XD/fvsB/+of4Wc3TahsnDUW96xAiz17lEc1
88DKQps76+ZUlCXWd30NlascM07v/zRjPaEKbtPCzmdJE3aIWXJFpgkevvKnGRTasJ
89qTavq5rtcPC7WpTZFPf6o+NPVG7FDahOUfIaQo8xkYJFz4JJbPlp54KYdlXB1vec
90Lxil+y6MyJirKAt65DzamMq5HsMgoaad9w4t2/kX4STZbLLQP3yJKCT5qhAZguEv
912WVTXemfbW5GwNjm4ZxeIjDUgRMWVN2AQ0S/x+61m4mx6Cunt+YVfI2g3IU3LKl4
92OszpmpHi8rEWODe0op5WmTD9bgQCSXMzGY2JrMY0MEeydhXevA+Upr4d54TZjGew
93rAYsI2BFhRdNomTjrW9LXrTPd2+H+Yt91nsxgKSY7ds0TcQtQMDDthCRK6j26PN0
94Uq170sLfiyOD1857HdOECDljnSfBibjMGYYzvISovw7pCCczq0gMVL1evINos3Nw
95aExaoy+HM7qwL8ADZZ8uDBLnXsKnTciQlBaob2rDnb4T4YC2mKgl9zMSGW/0GuGO
962126BFKMmsbxJhVgTjMbcC6vl40GgZoAsg4c60/Dz4mi9CYhZwWhon9ZC6CUWta1
977DnUgroXxGIcA4FVq9k65lw7u1X7l6dV+t453Stfxk7LiFiYeGYXWE6utY6f4R4T
98RJgqidc3TUEz3EywrzQKaZxj01Bo8GzCUYNVSdijIgVh+aCafLcnyAMTLlhXbWi2
99G0Ujg12zgLIT1SvCQGPA0A5M6mgkwJC030kQLfcmOkm1KTLEb+8WvJzGTSQScyU/
100W/8DY4IjiYGhriTJFdoPw19o3z9z6zDP0m58+3nTkVx49T2uV00/JxuTEtBbmYL3
101r3at6P4FVQM/mQijh90oTM2b36dNZUl+YGiU35ZlOnHTcLZ9smeiEnBezq41HgPY
102hKElUfXUHAPuJQd0QBtyzMHJ8V2N+Q+/jzCcxyGXRXEp6vp9NwAmNvxP099Yoo0R
1039va72BxiPpj/4nmLOOYquH01qOotR6H3li3T9H1+8Vt1ztP4VmBYsAcSruusIQG0
104YWom91yTb3rVbNuU6GF8og6YxvnHeawjHovLBkMEwY/WXodFEaHjFtYp0z9Cbwpj
105FK2YAAAAAA==
106-----END PKCS7-----
diff --git a/src/lib/libcrypto/pkcs7/t/msie-s-a-e b/src/lib/libcrypto/pkcs7/t/msie-s-a-e
new file mode 100644
index 0000000000..0067794d70
--- /dev/null
+++ b/src/lib/libcrypto/pkcs7/t/msie-s-a-e
@@ -0,0 +1,91 @@
1
2MIAGCSqGSIb3DQEHA6CAMIACAQAxggHCMIHMAgEAMHYwYjERMA8GA1UEBxMISW50ZXJuZXQxFzAV
3BgNVBAoTDlZlcmlTaWduLCBJbmMuMTQwMgYDVQQLEytWZXJpU2lnbiBDbGFzcyAxIENBIC0gSW5k
4aXZpZHVhbCBTdWJzY3JpYmVyAhBgQJiC3qfbCbjdj5INYLnKMA0GCSqGSIb3DQEBAQUABECjscaS
5G0U299fqiEAgTqTFQBp8Ai6zzjl557cVb3k6z4QZ7CbqBjSXAjLbh5e7S5Hd/FrFcDnxl1Ka06ha
6VHGPMIHwAgEAMIGZMIGSMQswCQYDVQQGEwJBVTETMBEGA1UECBMKUXVlZW5zbGFuZDERMA8GA1UE
7BxMIQnJpc2JhbmUxGjAYBgNVBAoTEUNyeXB0c29mdCBQdHkgTHRkMSIwIAYDVQQLExlERU1PTlNU
8UkFUSU9OIEFORCBURVNUSU5HMRswGQYDVQQDExJERU1PIFpFUk8gVkFMVUUgQ0ECAgRuMA0GCSqG
9SIb3DQEBAQUABECsyHXZ1xaiv0UQRvOmVYsaF38AL2XX75wxbCsz5/wOg7g3RP4aicZxaR4sBog0
10f2G1o9om/hu+A0rIYF/L4/GUMIAGCSqGSIb3DQEHATAaBggqhkiG9w0DAjAOAgIAoAQIsozQrnwj
11cc2ggASCBAAQz/LPoJe/+iYWeTwSebz6Q9UeKZzQ2UWm7GLtEM3s3c9SCvpmkwIRdEhLjWaBJMyI
12DiL7t1I1vMf9inB8LXgAcIEYkpNScjS8ERA9Ebb7ieNKSBg7w7B8ATHFxLSlDADqRgoZrB1Ctfgf
13ximp3EgxTgnhtyQhZxXW7kBQyFRwumplrJXOp7albP7IothrOKncw30IJT1fwPxWNMItI9juXF0U
14CbWVSjPzGBo4+XNXMvUO6MplOQEz/ywEQ9E8OZAQex1Zw9qq5ppsXB2pMsYV5sLJGikukMYKquiz
153YK+tN6J8ahLcDUs+VGwqvZi17gpBTlbEP+ZmXJpnO63t1yTEB0V5AZcRKWUOhzlCBM5YUagqNoY
16cpsmSvOK6bYzkUKOrzWpDCAtGZ/Dvul5dTZZmxs2WpM+iyeHXMxO3huy8K1brPTqt1f1sHhuq1jD
171eXedaCjIgUW9qV18vNAQCof/Yb6T/1fxztf/jD7pPLQJ+7LJkKCAEHGcaizpoKqhYcttaEhLq1G
18O+Ohqf7yFegMdTJ3wwP324w5ZYSU5fLo2Z34/Edf6EGvXyTIqVfAmEBALd6JGVdN5GlYYTxrL+eO
19P80Z4ao4YKoxwEmRp5bmQsQ8B29QhOFKmC6eiG5B96qLMtp7Zmu1grDNxTd6OXShWVwYARD0/B1P
20Sy0PAfk9Gb4fAkO9fZJDQYZ7s0mM5iOPEeSR7820TolOb+KfRabLA9d714jsc2jEykKlpP66Bh4j
21aCsyqJ0uUQcE8SnzrKAqGwgWiCGQpiTa+HBiP6eRlRGOKQj5Y06vcNx6Ija4cGe6+yCN8HV8tCY0
22okZK98NQCl5t79R/ZB2c3NvBJH+/g3ulU48ikT3tVmDxE3mOZofZyGFEM99P+YCMScLDxTl3hzGy
230YkI8U855P7qOAbcFfh2T5n+LSELwLhbkymEfZT917GWTfmypBWMvJx0WHeDhKwQYPdzbKgWETnc
24yeKasaCW+oLdhBwrd6Ws2r4MA8cwiYXDLbwYmCxJA8VF++8kubF2HJOjSyMBS+QT2PSV/0D9UWoi
25Vfk7R4OvWBJVvq7nV+lXS0O5igjExxlmx1OaBfg7+Cr/MbK4zVNrKSJn82NnKKt6LC6RaTmvFYay
260sDFxQ7Xo+Th6tDNKmKWJt6Kegfjc+qTWJTKb3kL+UI8vS0zTLy1+M/rZ4ekos/JiS5rYIcAswvg
2758kBgp/0rc6upBeWjBaK5O0aLAeBQfLulo1axWX04OSVKmYeoAltyR6UO9ME3acurQyg7Ta24yqO
28whi/PrIaEiO7dsWvFtzsshVzBLic02NlAkPkMUzliPYnZHWQglDAVxL5K2qhvK1OFCkQpIgBsBDM
296KYRL/mkBIIEALIl927rIkaN37/BQIcxLcSa05YfC0Hl3mxWESt1A0D4lA37A9S8EbYmDfAYlMc0
303HhZGdZEtawfpJFyDHzNZceNWBch6nxeNZCY4YFdsbzuGS0RKpwNA9S/czOJ4p9ymBCxuhGepI3U
31PKbC8C749Www1/wMdAot1n+K7M/PBGR8hWmaH5SS7U3yMwAB1fq2NDjx4ur+Um+MclSdN01MDXzG
32EO+eAo1pdAY8479234l8dB2YVAhZ1ZlJ4KmbqMKJrGJXnQUEYS6/cTDRjsUocsoW7uGg1ci2GiHa
33qjlkfpBfie3SdhFW/K8hwAH0HALs56oFN66wUkP/AaJAPfIUNhR6RpHKzZ9zCC42oB2mNawQRMnF
34ETBl1s/SwMxLKRp7jAfKs4NZxSY6I9z/2dTpzS3tsHMjxVDuxkolvRNWBILEMeL1CBvip2HhmoUw
35/Sz5NDgyzk1aQLV6DQNJ2RZLMZDRCtSwZSBu6lhhSgTJGazP0+NbqXXC5aQTrqrFIcWyDXz+ADle
36kszzYM/gSaQTCALTwfDDaU9Ek3xVgW+XBtExtJ3U+0AN3l0j86rUIdIvp6eWdxWQqv9LtpoorKMD
37KfUc5PYV09Z1JgsT4X51Zzq+74l5dz7udIM7UNbdTpmRm9PDj3TUbGCvNR9hqOEGTLbkvb1ZR24a
38h6uGRl2znB25IpDAGRhNRb9is/pO2tvHwHTDMOjrgvZG/pNvXgSUxz0pRjUjXIcqBe2X2gcQfeal
39r8gY76o83WEGL6ODryV9vTQVHt52+izgpYoBZaVlpgqbZl54c+OE0Zxf9RwXwDbcYu5Ku5E0MPL0
40qUjc0y2+Y6E4P5bAWaZGMGT+ORkyVUzcaWmM/+XlO7PER5wrWlCIMZCX1L/nvioY0q0CKqALn7DJ
41QU+qenbwrb6uwS7uNZY6V86s0aDYpU7yRyqxC5SbuyNJb02gdxUCgpIscFaMUjMVRml4M4BIjX/b
42U+HgHoVMUm8SnN9gRcT2izPrgOGVcMTJjfenzoCKoCPo9RjgGMctgB4DvKamErNU7OrilIfuoqzE
43PNSeP9SPw/zkDmNvMebM499We9CVnsHUWqF00/ZJWoua77+0f1bLS/tmci1JBvIcMo/4SJvgH+KF
44o0gijP9gqAPd5iCOnpnJlHUqRIym42SmyKEDuzdSwXKjAR6j7uXda39JyMJr8gGzEsu0jYRkAmj1
45YdiqwKXUcLMkcj1AKeU/PxTUVw0YKsv/rowrPYww3xQUWqNivrXB7GCHE3BzsYNdHsmziaGIXQbA
46+EBHdkuKrM8BcC+fxhF/l/KUxngsD1E75IcUv8zFDF+sk4CBYHqks9S4JYlcubuizqsILbdGzIMN
47Z7w34k0XT+sEggQAyzr8MHeIJGsT+AYnZr08PeTbyr01JEoT7lPYT6PzX4F63QKKDl+mB+PwLMzY
48CXrxZcUmuay6/MV8w/f5T6vQXdoSw5puWodBYwVReYh1IaEN+jiTapm9YBVmcIsJPO6abHowknSV
49OWSvST0AtAX57fFOTckm+facfBK9s9T1lUUgF44Bh5e8f9qKqfOV44nqdCOEyUm0Dao497ieN4Eg
50XBLNvOZY9+irMiXjp0lcyFvhrJOczfyCr9EiiaiH1TfSzKGKsf2W84iKn/JH6x2eOo7xjwJ40BQD
51c6S1cUNEuqBhP6by0FioOXYOKVyifpxk84Eb+F/4CNdTJTvCPwsiegdfsX/Q53DvKVtXp9Ycam5J
52TmKRHXK/bMHF4ONv3p/O/kn/BqRx+fbbP2eMX8Z1F/ltHKfp6B+06HljUwQLBJs9XtCfqH5Zgdz9
53gad5WZF5ykFArmHDgeFlgggvbZ7z9vqnjN/TH68TxJzauYQ5vLHQ6wGXik4/4uq7/TqNmhxlQEM4
54zVkwsn203bUmKLyz+yl1zItDpn5zy1uXfGo99rBdUzdbdE9LmEFPMaFsaHd4a8oDaUroD7FgCbeD
55JJVld3ac6F8+3QbExPs48OrgA1kI3/UwXr52ldjiYzTLfAGR9BjqNFTw45FUHuMf8TEM5hcHx56w
5695eKAqraDk28o9k+M2UKpcmrdlWoWzdqVVFeWGpM8x9Y9Nt0lf/4VUQgrXjqTkUCQkJyqTeTeGgH
57rn3QBk2XAgpxZhaJs3InW0BkAlBmK99cMinUiJeFt5a4p5wPeXrVuh6V9m7Mpl9hzpogg++EZqah
58fzzNnDgxOZfW342DX052PdgXo0NnkhCk005LvFt6M2mRn0fLgNVfyUZZoOp8cO5ZWbhXXlrhrgUt
59j2zKPK6Q94Zj4kdXHBGpAkrB8ZQ4EGGODE0Dqusm8WPXzB+9236IMHPU7lFbyjBrFNI7O4jg+qRI
60Ipi+7tX0FsilqEbmjG+OPwhZXrdqUqyF+rjKQuSRq7lOeDB4c6S2dq4OOny01i5HCbbyc9UvSHRm
61hOhGqUlzHyHLo3W7j+26V/MhkDXJ+Tx+qfylv4pbliwTteJJj+CZwzjv29qb6lxYi+38Bw10ERap
62m8UCRFBecVN7xXlcIfyeAl666Vi7EBJZv3EdFNrx1nlLwM65nYya7uj6L7IwJWotIUx8E0XH0/cU
63xS/dG8bxf9L/8652h5gq3LI+wTNGuEX0DMuz7BGQG+NtgabrZ6SsKGthGa7eULTpz0McWTLRU0y/
64/tkckpm5pDnXSFbIMskwwjECz82UZBSPpigdN/Pjg5d+0yWu7s3VJxw4ENWPPpzZ+j7sOXmdvn9P
65O1tQd60EO+3awASCBAAZQvWV3/yJ6FxPttbP+qeURpJoPEZfpN2UYZmd8HqtR0YbaOZ6Rln9nvpd
66K9fylXdw9z2xeCbjDWUttJB4VqZxGJM8eCTC1VDVyAOsQ5n7SY55dMkQbU+o4Z/4J5m8+wz50BBI
67LfruL1eZ6/CF6CdvxVRiJ10sXc0Tn2sVMXqkw7Adp1GYoCI9c6VFSFK74+n+y7LVFQ5HBnbQyKJc
68dvdLOXwZOPaFHC5UNXRmOpcwdPqyXUe+xIsOMYbzdlAnI9eGDNeRDktUa/Rh0CbZCxjmJzoZEYOE
69ZjsYZlEfp1Kb61t8z4m28hGLEg88T1Ihmxa2HeUWes1RpmgIOP+/2Lb3smj/l/fpSu4gabFgyCAV
70H5HdCYMScUv8SVu55+tpeO8ELoHHQUXV4rr084O4budzhgNSOPyLGDl5sfDUXiyusPCxS4JVO/KY
716V2Qrtg/q2wtmXpEkZnGT+Qi3WDzwt4W81alztnYMP17oGLmxX71KV9OEiMZjI4WaaGt+OOINLtR
72qefioZ1NI2L1s5M0tybwTsyU9WERM+3pUwXIfJVsbMZRlNaO2OogcHbaR4UWvhOj+3CTG1sThiYQ
73MxMnp1Rpqx3nhyzqLO3TRrkYvxnA3cdPBn9EeqpgBMg7X3hCiMV3Fl5cj/WOMhtHYgY7BgeCXo46
74EFVZ4+WroGZ46xGiRDiIblo8bzLd7QCxvukzxy3mUDgsZQ8pds4N28weSUhBk5MAPbfBpRvXUVJx
75MhKqXucQU1Md1qSGLbuuIQuz9pAGp1JFUx/vEkCgm74daSoVWCZuB+1ZE4f48clvrBj51xMNf8CP
76EFE7vySzVb6X2H1i5X3Z+Y3DdIcWw4Y2FClfcJk4Mwq8Cq2GALGFEge9YSEE9YmyuU6OFeU0ICon
77iXAgZ72SM8fBwJPruLFbdsNYKW+oAfmPisXSWMcZmdSbfk0GYv+vKtu3eegSbWw1UsCVtZOh9E5Z
78uQ83l59CBqO9sV/SFU3WrrJ0qNWxrmXu9nJn5Qf5iCRoFGYNHYHkIG5FS6N00GEDZxGkxmro2d++
79Adj5LVHc/b1cYWmrux+jEqI8ZK8cyTB0XMbBA/HYbx9NXazr7znP4/Mlv3pZToEcYt+lgLHAArtU
80AdhybhbLIwNMq0gr6EwtDklBa3ns4Wx/rJU8H7LGs6gV8uqeaSketv+nz+sQhfctxZ1rx+5qzXfy
81FOQVpO23KDQunBi1Bl9k61Di4q9JWcyADBXPHXJzp7mL8Fk7zdvMAEfuED1phdRm6GgDYoYUs4yQ
82IrhSjFlWyk7hT8475xk3BIv++obvWSAv/3+pF6A6U2RXDChVmnG0JnPa9wYYtdzBmLfZKBjX+DjD
83yEMsuhPsCzuN4R6tBIIBWCVRKmKwdkatmpsQBgDw48u0/Arffl5/DRlS9ee+QffFecUitDdCK+kt
84X5L2fGYrL5g6SltncMIeV1ptx4nuSjC/O944q1KYtqvQiPFWJqEXIRMNbbYOC47sjLza0tEFrimN
85wxcrWGSzsy5R9beFQ1aHPcMrDWfCoviNRk2qPtxuKIC5Qk2ZuOmJLjCiLwUGEb0/1Mpzv3MqQa7d
86mRayXg3DZWJPajxNZv6eS357ElMvwGQmqafb2mlQJwWLsg9m9PG7uqEoyrqSc6MiuY+icLEFib9j
87OfRQrx70rTSKUfTr4MtP0aZZAefjCrpVIyTekhFDOk0Nmx057eonlyGgmGpl5/Uo+t1J1Z11Ya/l
88bNbfmebRISJeTVW0I8FhseAZMI1GSwp/ludJxSLYOgyRkh+GX134MexNo7O9F1SxLCfWaSG9Fc3s
895ify04ua9/t8SGrYZPm/l3MkAAAAAAAAAAAAAA==
90
91
diff --git a/src/lib/libcrypto/pkcs7/t/msie-s-a-e.pem b/src/lib/libcrypto/pkcs7/t/msie-s-a-e.pem
new file mode 100644
index 0000000000..55dbd8f80b
--- /dev/null
+++ b/src/lib/libcrypto/pkcs7/t/msie-s-a-e.pem
@@ -0,0 +1,106 @@
1-----BEGIN PKCS7-----
2MIAGCSqGSIb3DQEHA6CAMIITUAIBADGCAcIwgcwCAQAwdjBiMREwDwYDVQQHEwhJ
3bnRlcm5ldDEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xNDAyBgNVBAsTK1ZlcmlT
4aWduIENsYXNzIDEgQ0EgLSBJbmRpdmlkdWFsIFN1YnNjcmliZXICEGBAmILep9sJ
5uN2Pkg1gucowDQYJKoZIhvcNAQEBBQAEQKOxxpIbRTb31+qIQCBOpMVAGnwCLrPO
6OXnntxVveTrPhBnsJuoGNJcCMtuHl7tLkd38WsVwOfGXUprTqFpUcY8wgfACAQAw
7gZkwgZIxCzAJBgNVBAYTAkFVMRMwEQYDVQQIEwpRdWVlbnNsYW5kMREwDwYDVQQH
8EwhCcmlzYmFuZTEaMBgGA1UEChMRQ3J5cHRzb2Z0IFB0eSBMdGQxIjAgBgNVBAsT
9GURFTU9OU1RSQVRJT04gQU5EIFRFU1RJTkcxGzAZBgNVBAMTEkRFTU8gWkVSTyBW
10QUxVRSBDQQICBG4wDQYJKoZIhvcNAQEBBQAEQKzIddnXFqK/RRBG86ZVixoXfwAv
11ZdfvnDFsKzPn/A6DuDdE/hqJxnFpHiwGiDR/YbWj2ib+G74DSshgX8vj8ZQwghGD
12BgkqhkiG9w0BBwEwGgYIKoZIhvcNAwIwDgICAKAECLKM0K58I3HNgIIRWBDP8s+g
13l7/6JhZ5PBJ5vPpD1R4pnNDZRabsYu0Qzezdz1IK+maTAhF0SEuNZoEkzIgOIvu3
14UjW8x/2KcHwteABwgRiSk1JyNLwRED0RtvuJ40pIGDvDsHwBMcXEtKUMAOpGChms
15HUK1+B/GKancSDFOCeG3JCFnFdbuQFDIVHC6amWslc6ntqVs/sii2Gs4qdzDfQgl
16PV/A/FY0wi0j2O5cXRQJtZVKM/MYGjj5c1cy9Q7oymU5ATP/LARD0Tw5kBB7HVnD
172qrmmmxcHakyxhXmwskaKS6Qxgqq6LPdgr603onxqEtwNSz5UbCq9mLXuCkFOVsQ
18/5mZcmmc7re3XJMQHRXkBlxEpZQ6HOUIEzlhRqCo2hhymyZK84rptjORQo6vNakM
19IC0Zn8O+6Xl1NlmbGzZakz6LJ4dczE7eG7LwrVus9Oq3V/WweG6rWMPV5d51oKMi
20BRb2pXXy80BAKh/9hvpP/V/HO1/+MPuk8tAn7ssmQoIAQcZxqLOmgqqFhy21oSEu
21rUY746Gp/vIV6Ax1MnfDA/fbjDllhJTl8ujZnfj8R1/oQa9fJMipV8CYQEAt3okZ
22V03kaVhhPGsv544/zRnhqjhgqjHASZGnluZCxDwHb1CE4UqYLp6IbkH3qosy2ntm
23a7WCsM3FN3o5dKFZXBgBEPT8HU9LLQ8B+T0Zvh8CQ719kkNBhnuzSYzmI48R5JHv
24zbROiU5v4p9FpssD13vXiOxzaMTKQqWk/roGHiNoKzKonS5RBwTxKfOsoCobCBaI
25IZCmJNr4cGI/p5GVEY4pCPljTq9w3HoiNrhwZ7r7II3wdXy0JjSiRkr3w1AKXm3v
261H9kHZzc28Ekf7+De6VTjyKRPe1WYPETeY5mh9nIYUQz30/5gIxJwsPFOXeHMbLR
27iQjxTznk/uo4BtwV+HZPmf4tIQvAuFuTKYR9lP3XsZZN+bKkFYy8nHRYd4OErBBg
2893NsqBYROdzJ4pqxoJb6gt2EHCt3pazavgwDxzCJhcMtvBiYLEkDxUX77yS5sXYc
29k6NLIwFL5BPY9JX/QP1RaiJV+TtHg69YElW+rudX6VdLQ7mKCMTHGWbHU5oF+Dv4
30Kv8xsrjNU2spImfzY2coq3osLpFpOa8VhrLSwMXFDtej5OHq0M0qYpYm3op6B+Nz
316pNYlMpveQv5Qjy9LTNMvLX4z+tnh6Siz8mJLmtghwCzC+DnyQGCn/Stzq6kF5aM
32Fork7RosB4FB8u6WjVrFZfTg5JUqZh6gCW3JHpQ70wTdpy6tDKDtNrbjKo7CGL8+
33shoSI7t2xa8W3OyyFXMEuJzTY2UCQ+QxTOWI9idkdZCCUMBXEvkraqG8rU4UKRCk
34iAGwEMzophEv+aSyJfdu6yJGjd+/wUCHMS3EmtOWHwtB5d5sVhErdQNA+JQN+wPU
35vBG2Jg3wGJTHNNx4WRnWRLWsH6SRcgx8zWXHjVgXIep8XjWQmOGBXbG87hktESqc
36DQPUv3MzieKfcpgQsboRnqSN1DymwvAu+PVsMNf8DHQKLdZ/iuzPzwRkfIVpmh+U
37ku1N8jMAAdX6tjQ48eLq/lJvjHJUnTdNTA18xhDvngKNaXQGPOO/dt+JfHQdmFQI
38WdWZSeCpm6jCiaxiV50FBGEuv3Ew0Y7FKHLKFu7hoNXIthoh2qo5ZH6QX4nt0nYR
39VvyvIcAB9BwC7OeqBTeusFJD/wGiQD3yFDYUekaRys2fcwguNqAdpjWsEETJxREw
40ZdbP0sDMSykae4wHyrODWcUmOiPc/9nU6c0t7bBzI8VQ7sZKJb0TVgSCxDHi9Qgb
414qdh4ZqFMP0s+TQ4Ms5NWkC1eg0DSdkWSzGQ0QrUsGUgbupYYUoEyRmsz9PjW6l1
42wuWkE66qxSHFsg18/gA5XpLM82DP4EmkEwgC08Hww2lPRJN8VYFvlwbRMbSd1PtA
43Dd5dI/Oq1CHSL6enlncVkKr/S7aaKKyjAyn1HOT2FdPWdSYLE+F+dWc6vu+JeXc+
447nSDO1DW3U6ZkZvTw4901GxgrzUfYajhBky25L29WUduGoerhkZds5wduSKQwBkY
45TUW/YrP6Ttrbx8B0wzDo64L2Rv6Tb14ElMc9KUY1I1yHKgXtl9oHEH3mpa/IGO+q
46PN1hBi+jg68lfb00FR7edvos4KWKAWWlZaYKm2ZeeHPjhNGcX/UcF8A23GLuSruR
47NDDy9KlI3NMtvmOhOD+WwFmmRjBk/jkZMlVM3GlpjP/l5TuzxEecK1pQiDGQl9S/
48574qGNKtAiqgC5+wyUFPqnp28K2+rsEu7jWWOlfOrNGg2KVO8kcqsQuUm7sjSW9N
49oHcVAoKSLHBWjFIzFUZpeDOASI1/21Ph4B6FTFJvEpzfYEXE9osz64DhlXDEyY33
50p86AiqAj6PUY4BjHLYAeA7ymphKzVOzq4pSH7qKsxDzUnj/Uj8P85A5jbzHmzOPf
51VnvQlZ7B1FqhdNP2SVqLmu+/tH9Wy0v7ZnItSQbyHDKP+Eib4B/ihaNIIoz/YKgD
523eYgjp6ZyZR1KkSMpuNkpsihA7s3UsFyowEeo+7l3Wt/ScjCa/IBsxLLtI2EZAJo
539WHYqsCl1HCzJHI9QCnlPz8U1FcNGCrL/66MKz2MMN8UFFqjYr61wexghxNwc7GD
54XR7Js4mhiF0GwPhAR3ZLiqzPAXAvn8YRf5fylMZ4LA9RO+SHFL/MxQxfrJOAgWB6
55pLPUuCWJXLm7os6rCC23RsyDDWe8N+JNF0/ryzr8MHeIJGsT+AYnZr08PeTbyr01
56JEoT7lPYT6PzX4F63QKKDl+mB+PwLMzYCXrxZcUmuay6/MV8w/f5T6vQXdoSw5pu
57WodBYwVReYh1IaEN+jiTapm9YBVmcIsJPO6abHowknSVOWSvST0AtAX57fFOTckm
58+facfBK9s9T1lUUgF44Bh5e8f9qKqfOV44nqdCOEyUm0Dao497ieN4EgXBLNvOZY
599+irMiXjp0lcyFvhrJOczfyCr9EiiaiH1TfSzKGKsf2W84iKn/JH6x2eOo7xjwJ4
600BQDc6S1cUNEuqBhP6by0FioOXYOKVyifpxk84Eb+F/4CNdTJTvCPwsiegdfsX/Q
6153DvKVtXp9Ycam5JTmKRHXK/bMHF4ONv3p/O/kn/BqRx+fbbP2eMX8Z1F/ltHKfp
626B+06HljUwQLBJs9XtCfqH5Zgdz9gad5WZF5ykFArmHDgeFlgggvbZ7z9vqnjN/T
63H68TxJzauYQ5vLHQ6wGXik4/4uq7/TqNmhxlQEM4zVkwsn203bUmKLyz+yl1zItD
64pn5zy1uXfGo99rBdUzdbdE9LmEFPMaFsaHd4a8oDaUroD7FgCbeDJJVld3ac6F8+
653QbExPs48OrgA1kI3/UwXr52ldjiYzTLfAGR9BjqNFTw45FUHuMf8TEM5hcHx56w
6695eKAqraDk28o9k+M2UKpcmrdlWoWzdqVVFeWGpM8x9Y9Nt0lf/4VUQgrXjqTkUC
67QkJyqTeTeGgHrn3QBk2XAgpxZhaJs3InW0BkAlBmK99cMinUiJeFt5a4p5wPeXrV
68uh6V9m7Mpl9hzpogg++EZqahfzzNnDgxOZfW342DX052PdgXo0NnkhCk005LvFt6
69M2mRn0fLgNVfyUZZoOp8cO5ZWbhXXlrhrgUtj2zKPK6Q94Zj4kdXHBGpAkrB8ZQ4
70EGGODE0Dqusm8WPXzB+9236IMHPU7lFbyjBrFNI7O4jg+qRIIpi+7tX0FsilqEbm
71jG+OPwhZXrdqUqyF+rjKQuSRq7lOeDB4c6S2dq4OOny01i5HCbbyc9UvSHRmhOhG
72qUlzHyHLo3W7j+26V/MhkDXJ+Tx+qfylv4pbliwTteJJj+CZwzjv29qb6lxYi+38
73Bw10ERapm8UCRFBecVN7xXlcIfyeAl666Vi7EBJZv3EdFNrx1nlLwM65nYya7uj6
74L7IwJWotIUx8E0XH0/cUxS/dG8bxf9L/8652h5gq3LI+wTNGuEX0DMuz7BGQG+Nt
75gabrZ6SsKGthGa7eULTpz0McWTLRU0y//tkckpm5pDnXSFbIMskwwjECz82UZBSP
76pigdN/Pjg5d+0yWu7s3VJxw4ENWPPpzZ+j7sOXmdvn9PO1tQd60EO+3awBlC9ZXf
77/InoXE+21s/6p5RGkmg8Rl+k3ZRhmZ3weq1HRhto5npGWf2e+l0r1/KVd3D3PbF4
78JuMNZS20kHhWpnEYkzx4JMLVUNXIA6xDmftJjnl0yRBtT6jhn/gnmbz7DPnQEEgt
79+u4vV5nr8IXoJ2/FVGInXSxdzROfaxUxeqTDsB2nUZigIj1zpUVIUrvj6f7LstUV
80DkcGdtDIolx290s5fBk49oUcLlQ1dGY6lzB0+rJdR77Eiw4xhvN2UCcj14YM15EO
81S1Rr9GHQJtkLGOYnOhkRg4RmOxhmUR+nUpvrW3zPibbyEYsSDzxPUiGbFrYd5RZ6
82zVGmaAg4/7/YtveyaP+X9+lK7iBpsWDIIBUfkd0JgxJxS/xJW7nn62l47wQugcdB
83RdXiuvTzg7hu53OGA1I4/IsYOXmx8NReLK6w8LFLglU78pjpXZCu2D+rbC2ZekSR
84mcZP5CLdYPPC3hbzVqXO2dgw/XugYubFfvUpX04SIxmMjhZpoa3444g0u1Gp5+Kh
85nU0jYvWzkzS3JvBOzJT1YREz7elTBch8lWxsxlGU1o7Y6iBwdtpHhRa+E6P7cJMb
86WxOGJhAzEyenVGmrHeeHLOos7dNGuRi/GcDdx08Gf0R6qmAEyDtfeEKIxXcWXlyP
879Y4yG0diBjsGB4JejjoQVVnj5augZnjrEaJEOIhuWjxvMt3tALG+6TPHLeZQOCxl
88Dyl2zg3bzB5JSEGTkwA9t8GlG9dRUnEyEqpe5xBTUx3WpIYtu64hC7P2kAanUkVT
89H+8SQKCbvh1pKhVYJm4H7VkTh/jxyW+sGPnXEw1/wI8QUTu/JLNVvpfYfWLlfdn5
90jcN0hxbDhjYUKV9wmTgzCrwKrYYAsYUSB71hIQT1ibK5To4V5TQgKieJcCBnvZIz
91x8HAk+u4sVt2w1gpb6gB+Y+KxdJYxxmZ1Jt+TQZi/68q27d56BJtbDVSwJW1k6H0
92Tlm5DzeXn0IGo72xX9IVTdausnSo1bGuZe72cmflB/mIJGgUZg0dgeQgbkVLo3TQ
93YQNnEaTGaujZ374B2PktUdz9vVxhaau7H6MSojxkrxzJMHRcxsED8dhvH01drOvv
94Oc/j8yW/ellOgRxi36WAscACu1QB2HJuFssjA0yrSCvoTC0OSUFreezhbH+slTwf
95ssazqBXy6p5pKR62/6fP6xCF9y3FnWvH7mrNd/IU5BWk7bcoNC6cGLUGX2TrUOLi
96r0lZzIAMFc8dcnOnuYvwWTvN28wAR+4QPWmF1GboaANihhSzjJAiuFKMWVbKTuFP
97zjvnGTcEi/76hu9ZIC//f6kXoDpTZFcMKFWacbQmc9r3Bhi13MGYt9koGNf4OMPI
98Qyy6E+wLO43hHq0lUSpisHZGrZqbEAYA8OPLtPwK335efw0ZUvXnvkH3xXnFIrQ3
99QivpLV+S9nxmKy+YOkpbZ3DCHldabceJ7kowvzveOKtSmLar0IjxViahFyETDW22
100DguO7Iy82tLRBa4pjcMXK1hks7MuUfW3hUNWhz3DKw1nwqL4jUZNqj7cbiiAuUJN
101mbjpiS4woi8FBhG9P9TKc79zKkGu3ZkWsl4Nw2ViT2o8TWb+nkt+exJTL8BkJqmn
10229ppUCcFi7IPZvTxu7qhKMq6knOjIrmPonCxBYm/Yzn0UK8e9K00ilH06+DLT9Gm
103WQHn4wq6VSMk3pIRQzpNDZsdOe3qJ5choJhqZef1KPrdSdWddWGv5WzW35nm0SEi
104Xk1VtCPBYbHgGTCNRksKf5bnScUi2DoMkZIfhl9d+DHsTaOzvRdUsSwn1mkhvRXN
1057OYn8tOLmvf7fEhq2GT5v5dzJAAAAAA=
106-----END PKCS7-----
diff --git a/src/lib/libcrypto/pkcs7/t/nav-smime b/src/lib/libcrypto/pkcs7/t/nav-smime
new file mode 100644
index 0000000000..6ee4b597a1
--- /dev/null
+++ b/src/lib/libcrypto/pkcs7/t/nav-smime
@@ -0,0 +1,157 @@
1From angela@c2.net.au Thu May 14 13:32:27 1998
2X-UIDL: 83c94dd550e54329bf9571b72038b8c8
3Return-Path: angela@c2.net.au
4Received: from cryptsoft.com (play.cryptsoft.com [203.56.44.3]) by pandora.cryptsoft.com (8.8.3/8.7.3) with ESMTP id NAA27838 for <tjh@cryptsoft.com>; Thu, 14 May 1998 13:32:26 +1000 (EST)
5Message-ID: <355A6779.4B63E64C@cryptsoft.com>
6Date: Thu, 14 May 1998 13:39:37 +1000
7From: Angela van Lent <angela@c2.net.au>
8X-Mailer: Mozilla 4.03 [en] (Win95; U)
9MIME-Version: 1.0
10To: tjh@cryptsoft.com
11Subject: signed
12Content-Type: multipart/signed; protocol="application/x-pkcs7-signature"; micalg=sha1; boundary="------------ms9A58844C95949ECC78A1C54C"
13Content-Length: 2604
14Status: OR
15
16This is a cryptographically signed message in MIME format.
17
18--------------ms9A58844C95949ECC78A1C54C
19Content-Type: text/plain; charset=us-ascii
20Content-Transfer-Encoding: 7bit
21
22signed body
23
24--------------ms9A58844C95949ECC78A1C54C
25Content-Type: application/x-pkcs7-signature; name="smime.p7s"
26Content-Transfer-Encoding: base64
27Content-Disposition: attachment; filename="smime.p7s"
28Content-Description: S/MIME Cryptographic Signature
29
30MIIGHgYJKoZIhvcNAQcCoIIGDzCCBgsCAQExCzAJBgUrDgMCGgUAMAsGCSqGSIb3DQEHAaCC
31BGswggJTMIIB/aADAgECAgIEfjANBgkqhkiG9w0BAQQFADCBkjELMAkGA1UEBhMCQVUxEzAR
32BgNVBAgTClF1ZWVuc2xhbmQxETAPBgNVBAcTCEJyaXNiYW5lMRowGAYDVQQKExFDcnlwdHNv
33ZnQgUHR5IEx0ZDEiMCAGA1UECxMZREVNT05TVFJBVElPTiBBTkQgVEVTVElORzEbMBkGA1UE
34AxMSREVNTyBaRVJPIFZBTFVFIENBMB4XDTk4MDUxMzA2MjY1NloXDTAwMDUxMjA2MjY1Nlow
35gaUxCzAJBgNVBAYTAkFVMRMwEQYDVQQIEwpRdWVlbnNsYW5kMREwDwYDVQQHEwhCcmlzYmFu
36ZTEaMBgGA1UEChMRQ3J5cHRzb2Z0IFB0eSBMdGQxEjAQBgNVBAsTCVNNSU1FIDAwMzEZMBcG
37A1UEAxMQQW5nZWxhIHZhbiBMZWVudDEjMCEGCSqGSIb3DQEJARYUYW5nZWxhQGNyeXB0c29m
38dC5jb20wXDANBgkqhkiG9w0BAQEFAANLADBIAkEAuC3+7dAb2LhuO7gt2cTM8vsNjhG5JfDh
39hX1Vl/wVGbKEEj0MA6vWEolvefQlxB+EzwCtR0YZ7eEC/T/4JoCyeQIDAQABoygwJjAkBglg
40hkgBhvhCAQ0EFxYVR2VuZXJhdGVkIHdpdGggU1NMZWF5MA0GCSqGSIb3DQEBBAUAA0EAUnSP
41igs6TMFISTjw8cBtJYb98czgAVkVFjKyJQwYMH8FbDnCyx6NocM555nsyDstaw8fKR11Khds
42syd3ikkrhDCCAhAwggG6AgEDMA0GCSqGSIb3DQEBBAUAMIGSMQswCQYDVQQGEwJBVTETMBEG
43A1UECBMKUXVlZW5zbGFuZDERMA8GA1UEBxMIQnJpc2JhbmUxGjAYBgNVBAoTEUNyeXB0c29m
44dCBQdHkgTHRkMSIwIAYDVQQLExlERU1PTlNUUkFUSU9OIEFORCBURVNUSU5HMRswGQYDVQQD
45ExJERU1PIFpFUk8gVkFMVUUgQ0EwHhcNOTgwMzAzMDc0MTMyWhcNMDgwMjI5MDc0MTMyWjCB
46kjELMAkGA1UEBhMCQVUxEzARBgNVBAgTClF1ZWVuc2xhbmQxETAPBgNVBAcTCEJyaXNiYW5l
47MRowGAYDVQQKExFDcnlwdHNvZnQgUHR5IEx0ZDEiMCAGA1UECxMZREVNT05TVFJBVElPTiBB
48TkQgVEVTVElORzEbMBkGA1UEAxMSREVNTyBaRVJPIFZBTFVFIENBMFwwDQYJKoZIhvcNAQEB
49BQADSwAwSAJBAL+0E2fLej3FSCwe2A2iRnMuC3z12qHIp6Ky1wo2zZcxft7AI+RfkrWrSGtf
50mfzBEuPrLdfulncC5Y1pNcM8RTUCAwEAATANBgkqhkiG9w0BAQQFAANBAGSbLMphL6F5pp3s
518o0Xyh86FHFdpVOwYx09ELLkuG17V/P9pgIc0Eo/gDMbN+KT3IdgECf8S//pCRA6RrNjcXIx
52ggF7MIIBdwIBATCBmTCBkjELMAkGA1UEBhMCQVUxEzARBgNVBAgTClF1ZWVuc2xhbmQxETAP
53BgNVBAcTCEJyaXNiYW5lMRowGAYDVQQKExFDcnlwdHNvZnQgUHR5IEx0ZDEiMCAGA1UECxMZ
54REVNT05TVFJBVElPTiBBTkQgVEVTVElORzEbMBkGA1UEAxMSREVNTyBaRVJPIFZBTFVFIENB
55AgIEfjAJBgUrDgMCGgUAoHowGAYJKoZIhvcNAQkDMQsGCSqGSIb3DQEHATAbBgkqhkiG9w0B
56CQ8xDjAMMAoGCCqGSIb3DQMHMBwGCSqGSIb3DQEJBTEPFw05ODA1MTQwMzM5MzdaMCMGCSqG
57SIb3DQEJBDEWBBQstNMnSV26ba8PapQEDhO21yNFrjANBgkqhkiG9w0BAQEFAARAW9Xb9YXv
58BfcNkutgFX9Gr8iXhBVsNtGEVrjrpkQwpKa7jHI8SjAlLhk/4RFwDHf+ISB9Np3Z1WDWnLcA
599CWR6g==
60--------------ms9A58844C95949ECC78A1C54C--
61
62
63From angela@c2.net.au Thu May 14 13:33:16 1998
64X-UIDL: 8f076c44ff7c5967fd5b00c4588a8731
65Return-Path: angela@c2.net.au
66Received: from cryptsoft.com (play.cryptsoft.com [203.56.44.3]) by pandora.cryptsoft.com (8.8.3/8.7.3) with ESMTP id NAA27847 for <tjh@cryptsoft.com>; Thu, 14 May 1998 13:33:15 +1000 (EST)
67Message-ID: <355A67AB.2AF38806@cryptsoft.com>
68Date: Thu, 14 May 1998 13:40:27 +1000
69From: Angela van Lent <angela@c2.net.au>
70X-Mailer: Mozilla 4.03 [en] (Win95; U)
71MIME-Version: 1.0
72To: tjh@cryptsoft.com
73Subject: signed
74Content-Type: multipart/signed; protocol="application/x-pkcs7-signature"; micalg=sha1; boundary="------------msD7863B84BD61E02C407F2F5E"
75Content-Length: 2679
76Status: OR
77
78This is a cryptographically signed message in MIME format.
79
80--------------msD7863B84BD61E02C407F2F5E
81Content-Type: text/plain; charset=us-ascii
82Content-Transfer-Encoding: 7bit
83
84signed body 2
85
86--------------msD7863B84BD61E02C407F2F5E
87Content-Type: application/x-pkcs7-signature; name="smime.p7s"
88Content-Transfer-Encoding: base64
89Content-Disposition: attachment; filename="smime.p7s"
90Content-Description: S/MIME Cryptographic Signature
91
92MIIGVgYJKoZIhvcNAQcCoIIGRzCCBkMCAQExCzAJBgUrDgMCGgUAMAsGCSqGSIb3DQEHAaCC
93BGswggJTMIIB/aADAgECAgIEfjANBgkqhkiG9w0BAQQFADCBkjELMAkGA1UEBhMCQVUxEzAR
94BgNVBAgTClF1ZWVuc2xhbmQxETAPBgNVBAcTCEJyaXNiYW5lMRowGAYDVQQKExFDcnlwdHNv
95ZnQgUHR5IEx0ZDEiMCAGA1UECxMZREVNT05TVFJBVElPTiBBTkQgVEVTVElORzEbMBkGA1UE
96AxMSREVNTyBaRVJPIFZBTFVFIENBMB4XDTk4MDUxMzA2MjY1NloXDTAwMDUxMjA2MjY1Nlow
97gaUxCzAJBgNVBAYTAkFVMRMwEQYDVQQIEwpRdWVlbnNsYW5kMREwDwYDVQQHEwhCcmlzYmFu
98ZTEaMBgGA1UEChMRQ3J5cHRzb2Z0IFB0eSBMdGQxEjAQBgNVBAsTCVNNSU1FIDAwMzEZMBcG
99A1UEAxMQQW5nZWxhIHZhbiBMZWVudDEjMCEGCSqGSIb3DQEJARYUYW5nZWxhQGNyeXB0c29m
100dC5jb20wXDANBgkqhkiG9w0BAQEFAANLADBIAkEAuC3+7dAb2LhuO7gt2cTM8vsNjhG5JfDh
101hX1Vl/wVGbKEEj0MA6vWEolvefQlxB+EzwCtR0YZ7eEC/T/4JoCyeQIDAQABoygwJjAkBglg
102hkgBhvhCAQ0EFxYVR2VuZXJhdGVkIHdpdGggU1NMZWF5MA0GCSqGSIb3DQEBBAUAA0EAUnSP
103igs6TMFISTjw8cBtJYb98czgAVkVFjKyJQwYMH8FbDnCyx6NocM555nsyDstaw8fKR11Khds
104syd3ikkrhDCCAhAwggG6AgEDMA0GCSqGSIb3DQEBBAUAMIGSMQswCQYDVQQGEwJBVTETMBEG
105A1UECBMKUXVlZW5zbGFuZDERMA8GA1UEBxMIQnJpc2JhbmUxGjAYBgNVBAoTEUNyeXB0c29m
106dCBQdHkgTHRkMSIwIAYDVQQLExlERU1PTlNUUkFUSU9OIEFORCBURVNUSU5HMRswGQYDVQQD
107ExJERU1PIFpFUk8gVkFMVUUgQ0EwHhcNOTgwMzAzMDc0MTMyWhcNMDgwMjI5MDc0MTMyWjCB
108kjELMAkGA1UEBhMCQVUxEzARBgNVBAgTClF1ZWVuc2xhbmQxETAPBgNVBAcTCEJyaXNiYW5l
109MRowGAYDVQQKExFDcnlwdHNvZnQgUHR5IEx0ZDEiMCAGA1UECxMZREVNT05TVFJBVElPTiBB
110TkQgVEVTVElORzEbMBkGA1UEAxMSREVNTyBaRVJPIFZBTFVFIENBMFwwDQYJKoZIhvcNAQEB
111BQADSwAwSAJBAL+0E2fLej3FSCwe2A2iRnMuC3z12qHIp6Ky1wo2zZcxft7AI+RfkrWrSGtf
112mfzBEuPrLdfulncC5Y1pNcM8RTUCAwEAATANBgkqhkiG9w0BAQQFAANBAGSbLMphL6F5pp3s
1138o0Xyh86FHFdpVOwYx09ELLkuG17V/P9pgIc0Eo/gDMbN+KT3IdgECf8S//pCRA6RrNjcXIx
114ggGzMIIBrwIBATCBmTCBkjELMAkGA1UEBhMCQVUxEzARBgNVBAgTClF1ZWVuc2xhbmQxETAP
115BgNVBAcTCEJyaXNiYW5lMRowGAYDVQQKExFDcnlwdHNvZnQgUHR5IEx0ZDEiMCAGA1UECxMZ
116REVNT05TVFJBVElPTiBBTkQgVEVTVElORzEbMBkGA1UEAxMSREVNTyBaRVJPIFZBTFVFIENB
117AgIEfjAJBgUrDgMCGgUAoIGxMBgGCSqGSIb3DQEJAzELBgkqhkiG9w0BBwEwHAYJKoZIhvcN
118AQkFMQ8XDTk4MDUxNDAzNDAyN1owIwYJKoZIhvcNAQkEMRYEFOKcV8mNYJnM8rHQajcSEqJN
119rwdDMFIGCSqGSIb3DQEJDzFFMEMwCgYIKoZIhvcNAwcwDgYIKoZIhvcNAwICAgCAMAcGBSsO
120AwIHMA0GCCqGSIb3DQMCAgFAMA0GCCqGSIb3DQMCAgEoMA0GCSqGSIb3DQEBAQUABEADPE/N
121coH+zTFuX5YpolupTKxKK8eEjc48TuADuO8bIHHDE/fEYaWunlwDuTlcFJl1ig0idffPB1qC
122Zp8SSVVY
123--------------msD7863B84BD61E02C407F2F5E--
124
125
126From angela@c2.net.au Thu May 14 14:05:32 1998
127X-UIDL: a7d629b4b9acacaee8b39371b860a32a
128Return-Path: angela@c2.net.au
129Received: from cryptsoft.com (play.cryptsoft.com [203.56.44.3]) by pandora.cryptsoft.com (8.8.3/8.7.3) with ESMTP id OAA28033 for <tjh@cryptsoft.com>; Thu, 14 May 1998 14:05:32 +1000 (EST)
130Message-ID: <355A6F3B.AC385981@cryptsoft.com>
131Date: Thu, 14 May 1998 14:12:43 +1000
132From: Angela van Lent <angela@c2.net.au>
133X-Mailer: Mozilla 4.03 [en] (Win95; U)
134MIME-Version: 1.0
135To: tjh@cryptsoft.com
136Subject: encrypted
137Content-Type: application/x-pkcs7-mime; name="smime.p7m"
138Content-Transfer-Encoding: base64
139Content-Disposition: attachment; filename="smime.p7m"
140Content-Description: S/MIME Encrypted Message
141Content-Length: 905
142Status: OR
143
144MIAGCSqGSIb3DQEHA6CAMIACAQAxggHmMIHwAgEAMIGZMIGSMQswCQYDVQQGEwJBVTETMBEG
145A1UECBMKUXVlZW5zbGFuZDERMA8GA1UEBxMIQnJpc2JhbmUxGjAYBgNVBAoTEUNyeXB0c29m
146dCBQdHkgTHRkMSIwIAYDVQQLExlERU1PTlNUUkFUSU9OIEFORCBURVNUSU5HMRswGQYDVQQD
147ExJERU1PIFpFUk8gVkFMVUUgQ0ECAgR+MA0GCSqGSIb3DQEBAQUABEA92N29Yk39RUY2tIVd
148exGT2MFX3J6H8LB8aDRJjw7843ALgJ5zXpM5+f80QkAWwEN2A6Pl3VxiCeKLi435zXVyMIHw
149AgEAMIGZMIGSMQswCQYDVQQGEwJBVTETMBEGA1UECBMKUXVlZW5zbGFuZDERMA8GA1UEBxMI
150QnJpc2JhbmUxGjAYBgNVBAoTEUNyeXB0c29mdCBQdHkgTHRkMSIwIAYDVQQLExlERU1PTlNU
151UkFUSU9OIEFORCBURVNUSU5HMRswGQYDVQQDExJERU1PIFpFUk8gVkFMVUUgQ0ECAgRuMA0G
152CSqGSIb3DQEBAQUABECR9IfyHtvnjFmZ8B2oUCEs1vxMsG0u1kxKE4RMPFyDqDCEARq7zXMg
153nzSUI7Wgv5USSKDqcLRJeW+jvYURv/nJMIAGCSqGSIb3DQEHATAaBggqhkiG9w0DAjAOAgIA
154oAQIrLqrij2ZMpeggAQoibtn6reRZWuWk5Iv5IAhgitr8EYE4w4ySQ7EMB6mTlBoFpccUMWX
155BwQgQn1UoWCvYAlhDzURdbui64Dc0rS2wtj+kE/InS6y25EEEPe4NUKaF8/UlE+lo3LtILQE
156CL3uV8k7m0iqAAAAAAAAAAAAAA==
157
diff --git a/src/lib/libcrypto/pkcs7/t/s.pem b/src/lib/libcrypto/pkcs7/t/s.pem
new file mode 100644
index 0000000000..4fa925b182
--- /dev/null
+++ b/src/lib/libcrypto/pkcs7/t/s.pem
@@ -0,0 +1,57 @@
1-----BEGIN RSA PRIVATE KEY-----
2MIIBOgIBAAJBAK3nI4nuDYe3nDJES5WBc90igEstxWC4/h4YY+/ciYki35U8ets9
3mgaoCNYp/e9BCZHtvK2Y+fYokGJv5+cMTQsCAwEAAQJBAIHpvXvqEcOEoDRRHuIG
4fkcB4jPHcr9KE9TpxabH6xs9beN6OJnkePXAHwaz5MnUgSnbpOKq+cw8miKjXwe/
5zVECIQDVLwncT2lRmXarEYHzb+q/0uaSvKhWKKt3kJasLNTrAwIhANDUc/ghut29
6p3jJYjurzUKuG774/5eLjPLsxPPIZzNZAiA/10hSq41UnGqHLEUIS9m2/EeEZe7b
7bm567dfRU9OnVQIgDo8ROrZXSchEGbaog5J5r/Fle83uO8l93R3GqVxKXZkCIFfk
8IPD5PIYQAyyod3hyKKza7ZP4CGY4oOfZetbkSGGG
9-----END RSA PRIVATE KEY-----
10issuer :/C=AU/SP=Queensland/L=Brisbane/O=Cryptsoft Pty Ltd/OU=DEMONSTRATION AND TESTING/CN=DEMO ZERO VALUE CA
11subject:/C=AU/SP=Queensland/L=Brisbane/O=Cryptsoft Pty Ltd/OU=SMIME 003/CN=Information/Email=info@cryptsoft.com
12serial :047D
13
14Certificate:
15 Data:
16 Version: 3 (0x2)
17 Serial Number: 1149 (0x47d)
18 Signature Algorithm: md5withRSAEncryption
19 Issuer: C=AU, SP=Queensland, L=Brisbane, O=Cryptsoft Pty Ltd, OU=DEMONSTRATION AND TESTING, CN=DEMO ZERO VALUE CA
20 Validity
21 Not Before: May 13 05:40:58 1998 GMT
22 Not After : May 12 05:40:58 2000 GMT
23 Subject: C=AU, SP=Queensland, L=Brisbane, O=Cryptsoft Pty Ltd, OU=SMIME 003, CN=Information/Email=info@cryptsoft.com
24 Subject Public Key Info:
25 Public Key Algorithm: rsaEncryption
26 Modulus:
27 00:ad:e7:23:89:ee:0d:87:b7:9c:32:44:4b:95:81:
28 73:dd:22:80:4b:2d:c5:60:b8:fe:1e:18:63:ef:dc:
29 89:89:22:df:95:3c:7a:db:3d:9a:06:a8:08:d6:29:
30 fd:ef:41:09:91:ed:bc:ad:98:f9:f6:28:90:62:6f:
31 e7:e7:0c:4d:0b
32 Exponent: 65537 (0x10001)
33 X509v3 extensions:
34 Netscape Comment:
35 Generated with SSLeay
36 Signature Algorithm: md5withRSAEncryption
37 52:15:ea:88:f4:f0:f9:0b:ef:ce:d5:f8:83:40:61:16:5e:55:
38 f9:ce:2d:d1:8b:31:5c:03:c6:2d:10:7c:61:d5:5c:0a:42:97:
39 d1:fd:65:b6:b6:84:a5:39:ec:46:ec:fc:e0:0d:d9:22:da:1b:
40 50:74:ad:92:cb:4e:90:e5:fa:7d
41
42-----BEGIN CERTIFICATE-----
43MIICTDCCAfagAwIBAgICBH0wDQYJKoZIhvcNAQEEBQAwgZIxCzAJBgNVBAYTAkFV
44MRMwEQYDVQQIEwpRdWVlbnNsYW5kMREwDwYDVQQHEwhCcmlzYmFuZTEaMBgGA1UE
45ChMRQ3J5cHRzb2Z0IFB0eSBMdGQxIjAgBgNVBAsTGURFTU9OU1RSQVRJT04gQU5E
46IFRFU1RJTkcxGzAZBgNVBAMTEkRFTU8gWkVSTyBWQUxVRSBDQTAeFw05ODA1MTMw
47NTQwNThaFw0wMDA1MTIwNTQwNThaMIGeMQswCQYDVQQGEwJBVTETMBEGA1UECBMK
48UXVlZW5zbGFuZDERMA8GA1UEBxMIQnJpc2JhbmUxGjAYBgNVBAoTEUNyeXB0c29m
49dCBQdHkgTHRkMRIwEAYDVQQLEwlTTUlNRSAwMDMxFDASBgNVBAMTC0luZm9ybWF0
50aW9uMSEwHwYJKoZIhvcNAQkBFhJpbmZvQGNyeXB0c29mdC5jb20wXDANBgkqhkiG
519w0BAQEFAANLADBIAkEArecjie4Nh7ecMkRLlYFz3SKASy3FYLj+Hhhj79yJiSLf
52lTx62z2aBqgI1in970EJke28rZj59iiQYm/n5wxNCwIDAQABoygwJjAkBglghkgB
53hvhCAQ0EFxYVR2VuZXJhdGVkIHdpdGggU1NMZWF5MA0GCSqGSIb3DQEBBAUAA0EA
54UhXqiPTw+QvvztX4g0BhFl5V+c4t0YsxXAPGLRB8YdVcCkKX0f1ltraEpTnsRuz8
554A3ZItobUHStkstOkOX6fQ==
56-----END CERTIFICATE-----
57
diff --git a/src/lib/libcrypto/pkcs7/t/server.pem b/src/lib/libcrypto/pkcs7/t/server.pem
new file mode 100644
index 0000000000..989baf8709
--- /dev/null
+++ b/src/lib/libcrypto/pkcs7/t/server.pem
@@ -0,0 +1,57 @@
1issuer :/C=AU/SP=Queensland/L=Brisbane/O=Cryptsoft Pty Ltd/OU=DEMONSTRATION AND TESTING/CN=DEMO ZERO VALUE CA
2subject:/C=AU/SP=Queensland/L=Brisbane/O=Cryptsoft Pty Ltd/OU=SMIME 003/CN=Information/Email=info@cryptsoft.com
3serial :047D
4
5Certificate:
6 Data:
7 Version: 3 (0x2)
8 Serial Number: 1149 (0x47d)
9 Signature Algorithm: md5withRSAEncryption
10 Issuer: C=AU, SP=Queensland, L=Brisbane, O=Cryptsoft Pty Ltd, OU=DEMONSTRATION AND TESTING, CN=DEMO ZERO VALUE CA
11 Validity
12 Not Before: May 13 05:40:58 1998 GMT
13 Not After : May 12 05:40:58 2000 GMT
14 Subject: C=AU, SP=Queensland, L=Brisbane, O=Cryptsoft Pty Ltd, OU=SMIME 003, CN=Information/Email=info@cryptsoft.com
15 Subject Public Key Info:
16 Public Key Algorithm: rsaEncryption
17 Modulus:
18 00:ad:e7:23:89:ee:0d:87:b7:9c:32:44:4b:95:81:
19 73:dd:22:80:4b:2d:c5:60:b8:fe:1e:18:63:ef:dc:
20 89:89:22:df:95:3c:7a:db:3d:9a:06:a8:08:d6:29:
21 fd:ef:41:09:91:ed:bc:ad:98:f9:f6:28:90:62:6f:
22 e7:e7:0c:4d:0b
23 Exponent: 65537 (0x10001)
24 X509v3 extensions:
25 Netscape Comment:
26 Generated with SSLeay
27 Signature Algorithm: md5withRSAEncryption
28 52:15:ea:88:f4:f0:f9:0b:ef:ce:d5:f8:83:40:61:16:5e:55:
29 f9:ce:2d:d1:8b:31:5c:03:c6:2d:10:7c:61:d5:5c:0a:42:97:
30 d1:fd:65:b6:b6:84:a5:39:ec:46:ec:fc:e0:0d:d9:22:da:1b:
31 50:74:ad:92:cb:4e:90:e5:fa:7d
32
33-----BEGIN CERTIFICATE-----
34MIICTDCCAfagAwIBAgICBH0wDQYJKoZIhvcNAQEEBQAwgZIxCzAJBgNVBAYTAkFV
35MRMwEQYDVQQIEwpRdWVlbnNsYW5kMREwDwYDVQQHEwhCcmlzYmFuZTEaMBgGA1UE
36ChMRQ3J5cHRzb2Z0IFB0eSBMdGQxIjAgBgNVBAsTGURFTU9OU1RSQVRJT04gQU5E
37IFRFU1RJTkcxGzAZBgNVBAMTEkRFTU8gWkVSTyBWQUxVRSBDQTAeFw05ODA1MTMw
38NTQwNThaFw0wMDA1MTIwNTQwNThaMIGeMQswCQYDVQQGEwJBVTETMBEGA1UECBMK
39UXVlZW5zbGFuZDERMA8GA1UEBxMIQnJpc2JhbmUxGjAYBgNVBAoTEUNyeXB0c29m
40dCBQdHkgTHRkMRIwEAYDVQQLEwlTTUlNRSAwMDMxFDASBgNVBAMTC0luZm9ybWF0
41aW9uMSEwHwYJKoZIhvcNAQkBFhJpbmZvQGNyeXB0c29mdC5jb20wXDANBgkqhkiG
429w0BAQEFAANLADBIAkEArecjie4Nh7ecMkRLlYFz3SKASy3FYLj+Hhhj79yJiSLf
43lTx62z2aBqgI1in970EJke28rZj59iiQYm/n5wxNCwIDAQABoygwJjAkBglghkgB
44hvhCAQ0EFxYVR2VuZXJhdGVkIHdpdGggU1NMZWF5MA0GCSqGSIb3DQEBBAUAA0EA
45UhXqiPTw+QvvztX4g0BhFl5V+c4t0YsxXAPGLRB8YdVcCkKX0f1ltraEpTnsRuz8
464A3ZItobUHStkstOkOX6fQ==
47-----END CERTIFICATE-----
48
49-----BEGIN RSA PRIVATE KEY-----
50MIIBOgIBAAJBAK3nI4nuDYe3nDJES5WBc90igEstxWC4/h4YY+/ciYki35U8ets9
51mgaoCNYp/e9BCZHtvK2Y+fYokGJv5+cMTQsCAwEAAQJBAIHpvXvqEcOEoDRRHuIG
52fkcB4jPHcr9KE9TpxabH6xs9beN6OJnkePXAHwaz5MnUgSnbpOKq+cw8miKjXwe/
53zVECIQDVLwncT2lRmXarEYHzb+q/0uaSvKhWKKt3kJasLNTrAwIhANDUc/ghut29
54p3jJYjurzUKuG774/5eLjPLsxPPIZzNZAiA/10hSq41UnGqHLEUIS9m2/EeEZe7b
55bm567dfRU9OnVQIgDo8ROrZXSchEGbaog5J5r/Fle83uO8l93R3GqVxKXZkCIFfk
56IPD5PIYQAyyod3hyKKza7ZP4CGY4oOfZetbkSGGG
57-----END RSA PRIVATE KEY-----
diff --git a/src/lib/libcrypto/pkcs7/verify.c b/src/lib/libcrypto/pkcs7/verify.c
new file mode 100644
index 0000000000..b40f26032e
--- /dev/null
+++ b/src/lib/libcrypto/pkcs7/verify.c
@@ -0,0 +1,263 @@
1/* crypto/pkcs7/verify.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58#include <stdio.h>
59#include <string.h>
60#include <openssl/bio.h>
61#include <openssl/asn1.h>
62#include <openssl/x509.h>
63#include <openssl/pem.h>
64#include <openssl/err.h>
65#include "example.h"
66
67int verify_callback(int ok, X509_STORE_CTX *ctx);
68
69BIO *bio_err=NULL;
70BIO *bio_out=NULL;
71
72int main(argc,argv)
73int argc;
74char *argv[];
75 {
76 PKCS7 *p7;
77 PKCS7_SIGNER_INFO *si;
78 X509_STORE_CTX cert_ctx;
79 X509_STORE *cert_store=NULL;
80 BIO *data,*detached=NULL,*p7bio=NULL;
81 char buf[1024*4];
82 char *pp;
83 int i,printit=0;
84 STACK_OF(PKCS7_SIGNER_INFO) *sk;
85
86 bio_err=BIO_new_fp(stderr,BIO_NOCLOSE);
87 bio_out=BIO_new_fp(stdout,BIO_NOCLOSE);
88#ifndef OPENSSL_NO_MD2
89 EVP_add_digest(EVP_md2());
90#endif
91#ifndef OPENSSL_NO_MD5
92 EVP_add_digest(EVP_md5());
93#endif
94#ifndef OPENSSL_NO_SHA1
95 EVP_add_digest(EVP_sha1());
96#endif
97#ifndef OPENSSL_NO_MDC2
98 EVP_add_digest(EVP_mdc2());
99#endif
100
101 data=BIO_new(BIO_s_file());
102
103 pp=NULL;
104 while (argc > 1)
105 {
106 argc--;
107 argv++;
108 if (strcmp(argv[0],"-p") == 0)
109 {
110 printit=1;
111 }
112 else if ((strcmp(argv[0],"-d") == 0) && (argc >= 2))
113 {
114 detached=BIO_new(BIO_s_file());
115 if (!BIO_read_filename(detached,argv[1]))
116 goto err;
117 argc--;
118 argv++;
119 }
120 else
121 {
122 pp=argv[0];
123 if (!BIO_read_filename(data,argv[0]))
124 goto err;
125 }
126 }
127
128 if (pp == NULL)
129 BIO_set_fp(data,stdin,BIO_NOCLOSE);
130
131
132 /* Load the PKCS7 object from a file */
133 if ((p7=PEM_read_bio_PKCS7(data,NULL,NULL,NULL)) == NULL) goto err;
134
135 /* This stuff is being setup for certificate verification.
136 * When using SSL, it could be replaced with a
137 * cert_stre=SSL_CTX_get_cert_store(ssl_ctx); */
138 cert_store=X509_STORE_new();
139 X509_STORE_set_default_paths(cert_store);
140 X509_STORE_load_locations(cert_store,NULL,"../../certs");
141 X509_STORE_set_verify_cb_func(cert_store,verify_callback);
142
143 ERR_clear_error();
144
145 /* We need to process the data */
146 if ((PKCS7_get_detached(p7) || detached))
147 {
148 if (detached == NULL)
149 {
150 printf("no data to verify the signature on\n");
151 exit(1);
152 }
153 else
154 p7bio=PKCS7_dataInit(p7,detached);
155 }
156 else
157 {
158 p7bio=PKCS7_dataInit(p7,NULL);
159 }
160
161 /* We now have to 'read' from p7bio to calculate digests etc. */
162 for (;;)
163 {
164 i=BIO_read(p7bio,buf,sizeof(buf));
165 /* print it? */
166 if (i <= 0) break;
167 }
168
169 /* We can now verify signatures */
170 sk=PKCS7_get_signer_info(p7);
171 if (sk == NULL)
172 {
173 printf("there are no signatures on this data\n");
174 exit(1);
175 }
176
177 /* Ok, first we need to, for each subject entry, see if we can verify */
178 for (i=0; i<sk_PKCS7_SIGNER_INFO_num(sk); i++)
179 {
180 ASN1_UTCTIME *tm;
181 char *str1,*str2;
182 int rc;
183
184 si=sk_PKCS7_SIGNER_INFO_value(sk,i);
185 rc=PKCS7_dataVerify(cert_store,&cert_ctx,p7bio,p7,si);
186 if (rc <= 0)
187 goto err;
188 printf("signer info\n");
189 if ((tm=get_signed_time(si)) != NULL)
190 {
191 BIO_printf(bio_out,"Signed time:");
192 ASN1_UTCTIME_print(bio_out,tm);
193 ASN1_UTCTIME_free(tm);
194 BIO_printf(bio_out,"\n");
195 }
196 if (get_signed_seq2string(si,&str1,&str2))
197 {
198 BIO_printf(bio_out,"String 1 is %s\n",str1);
199 BIO_printf(bio_out,"String 2 is %s\n",str2);
200 }
201
202 }
203
204 X509_STORE_free(cert_store);
205
206 printf("done\n");
207 exit(0);
208err:
209 ERR_load_crypto_strings();
210 ERR_print_errors_fp(stderr);
211 exit(1);
212 }
213
214/* should be X509 * but we can just have them as char *. */
215int verify_callback(int ok, X509_STORE_CTX *ctx)
216 {
217 char buf[256];
218 X509 *err_cert;
219 int err,depth;
220
221 err_cert=X509_STORE_CTX_get_current_cert(ctx);
222 err= X509_STORE_CTX_get_error(ctx);
223 depth= X509_STORE_CTX_get_error_depth(ctx);
224
225 X509_NAME_oneline(X509_get_subject_name(err_cert),buf,256);
226 BIO_printf(bio_err,"depth=%d %s\n",depth,buf);
227 if (!ok)
228 {
229 BIO_printf(bio_err,"verify error:num=%d:%s\n",err,
230 X509_verify_cert_error_string(err));
231 if (depth < 6)
232 {
233 ok=1;
234 X509_STORE_CTX_set_error(ctx,X509_V_OK);
235 }
236 else
237 {
238 ok=0;
239 X509_STORE_CTX_set_error(ctx,X509_V_ERR_CERT_CHAIN_TOO_LONG);
240 }
241 }
242 switch (ctx->error)
243 {
244 case X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT:
245 X509_NAME_oneline(X509_get_issuer_name(ctx->current_cert),buf,256);
246 BIO_printf(bio_err,"issuer= %s\n",buf);
247 break;
248 case X509_V_ERR_CERT_NOT_YET_VALID:
249 case X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD:
250 BIO_printf(bio_err,"notBefore=");
251 ASN1_UTCTIME_print(bio_err,X509_get_notBefore(ctx->current_cert));
252 BIO_printf(bio_err,"\n");
253 break;
254 case X509_V_ERR_CERT_HAS_EXPIRED:
255 case X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD:
256 BIO_printf(bio_err,"notAfter=");
257 ASN1_UTCTIME_print(bio_err,X509_get_notAfter(ctx->current_cert));
258 BIO_printf(bio_err,"\n");
259 break;
260 }
261 BIO_printf(bio_err,"verify return:%d\n",ok);
262 return(ok);
263 }
diff --git a/src/lib/libcrypto/pqueue/Makefile b/src/lib/libcrypto/pqueue/Makefile
new file mode 100644
index 0000000000..fb36a0c876
--- /dev/null
+++ b/src/lib/libcrypto/pqueue/Makefile
@@ -0,0 +1,83 @@
1#
2# OpenSSL/crypto/pqueue/Makefile
3#
4
5DIR= pqueue
6TOP= ../..
7CC= cc
8INCLUDES=
9CFLAG=-g
10MAKEFILE= Makefile
11AR= ar r
12
13CFLAGS= $(INCLUDES) $(CFLAG)
14
15GENERAL=Makefile
16TEST=
17APPS=
18
19LIB=$(TOP)/libcrypto.a
20LIBSRC=pqueue.c
21LIBOBJ=pqueue.o
22
23SRC= $(LIBSRC)
24
25EXHEADER= pqueue.h
26HEADER= $(EXHEADER)
27
28ALL= $(GENERAL) $(SRC) $(HEADER)
29
30top:
31 (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all)
32
33all: lib
34
35lib: $(LIBOBJ)
36 $(AR) $(LIB) $(LIBOBJ)
37 $(RANLIB) $(LIB) || echo Never mind.
38 @touch lib
39
40files:
41 $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
42
43links:
44 @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
45 @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
46 @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
47
48install:
49 @[ -n "$(INSTALLTOP)" ] # should be set by top Makefile...
50 @headerlist="$(EXHEADER)"; for i in $$headerlist ; \
51 do \
52 (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
53 chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
54 done;
55
56tags:
57 ctags $(SRC)
58
59tests:
60
61lint:
62 lint -DLINT $(INCLUDES) $(SRC)>fluff
63
64depend:
65 @[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile...
66 $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
67
68dclean:
69 $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
70 mv -f Makefile.new $(MAKEFILE)
71
72clean:
73 rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
74
75# DO NOT DELETE THIS LINE -- make depend depends on it.
76
77pqueue.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h
78pqueue.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
79pqueue.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
80pqueue.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
81pqueue.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
82pqueue.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
83pqueue.o: ../../include/openssl/symhacks.h ../cryptlib.h pqueue.c pqueue.h
diff --git a/src/lib/libcrypto/pqueue/pq_test.c b/src/lib/libcrypto/pqueue/pq_test.c
new file mode 100644
index 0000000000..8d496dfc65
--- /dev/null
+++ b/src/lib/libcrypto/pqueue/pq_test.c
@@ -0,0 +1,95 @@
1/* crypto/pqueue/pq_test.c */
2/*
3 * DTLS implementation written by Nagendra Modadugu
4 * (nagendra@cs.stanford.edu) for the OpenSSL project 2005.
5 */
6/* ====================================================================
7 * Copyright (c) 1999-2005 The OpenSSL Project. All rights reserved.
8 *
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
11 * are met:
12 *
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 *
16 * 2. Redistributions in binary form must reproduce the above copyright
17 * notice, this list of conditions and the following disclaimer in
18 * the documentation and/or other materials provided with the
19 * distribution.
20 *
21 * 3. All advertising materials mentioning features or use of this
22 * software must display the following acknowledgment:
23 * "This product includes software developed by the OpenSSL Project
24 * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
25 *
26 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
27 * endorse or promote products derived from this software without
28 * prior written permission. For written permission, please contact
29 * openssl-core@OpenSSL.org.
30 *
31 * 5. Products derived from this software may not be called "OpenSSL"
32 * nor may "OpenSSL" appear in their names without prior written
33 * permission of the OpenSSL Project.
34 *
35 * 6. Redistributions of any form whatsoever must retain the following
36 * acknowledgment:
37 * "This product includes software developed by the OpenSSL Project
38 * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
39 *
40 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
41 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
42 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
43 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
44 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
45 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
46 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
47 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
49 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
50 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
51 * OF THE POSSIBILITY OF SUCH DAMAGE.
52 * ====================================================================
53 *
54 * This product includes cryptographic software written by Eric Young
55 * (eay@cryptsoft.com). This product includes software written by Tim
56 * Hudson (tjh@cryptsoft.com).
57 *
58 */
59
60#include "pqueue.h"
61
62int
63main(void)
64 {
65 pitem *item;
66 pqueue pq;
67
68 pq = pqueue_new();
69
70 item = pitem_new(3, NULL);
71 pqueue_insert(pq, item);
72
73 item = pitem_new(1, NULL);
74 pqueue_insert(pq, item);
75
76 item = pitem_new(2, NULL);
77 pqueue_insert(pq, item);
78
79 item = pqueue_find(pq, 1);
80 fprintf(stderr, "found %ld\n", item->priority);
81
82 item = pqueue_find(pq, 2);
83 fprintf(stderr, "found %ld\n", item->priority);
84
85 item = pqueue_find(pq, 3);
86 fprintf(stderr, "found %ld\n", item ? item->priority: 0);
87
88 pqueue_print(pq);
89
90 for(item = pqueue_pop(pq); item != NULL; item = pqueue_pop(pq))
91 pitem_free(item);
92
93 pqueue_free(pq);
94 return 0;
95 }
diff --git a/src/lib/libcrypto/pqueue/pqueue.c b/src/lib/libcrypto/pqueue/pqueue.c
new file mode 100644
index 0000000000..eab13a1250
--- /dev/null
+++ b/src/lib/libcrypto/pqueue/pqueue.c
@@ -0,0 +1,252 @@
1/* crypto/pqueue/pqueue.c */
2/*
3 * DTLS implementation written by Nagendra Modadugu
4 * (nagendra@cs.stanford.edu) for the OpenSSL project 2005.
5 */
6/* ====================================================================
7 * Copyright (c) 1999-2005 The OpenSSL Project. All rights reserved.
8 *
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
11 * are met:
12 *
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 *
16 * 2. Redistributions in binary form must reproduce the above copyright
17 * notice, this list of conditions and the following disclaimer in
18 * the documentation and/or other materials provided with the
19 * distribution.
20 *
21 * 3. All advertising materials mentioning features or use of this
22 * software must display the following acknowledgment:
23 * "This product includes software developed by the OpenSSL Project
24 * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
25 *
26 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
27 * endorse or promote products derived from this software without
28 * prior written permission. For written permission, please contact
29 * openssl-core@OpenSSL.org.
30 *
31 * 5. Products derived from this software may not be called "OpenSSL"
32 * nor may "OpenSSL" appear in their names without prior written
33 * permission of the OpenSSL Project.
34 *
35 * 6. Redistributions of any form whatsoever must retain the following
36 * acknowledgment:
37 * "This product includes software developed by the OpenSSL Project
38 * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
39 *
40 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
41 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
42 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
43 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
44 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
45 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
46 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
47 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
49 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
50 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
51 * OF THE POSSIBILITY OF SUCH DAMAGE.
52 * ====================================================================
53 *
54 * This product includes cryptographic software written by Eric Young
55 * (eay@cryptsoft.com). This product includes software written by Tim
56 * Hudson (tjh@cryptsoft.com).
57 *
58 */
59
60#include "cryptlib.h"
61#include <openssl/bn.h>
62#include "pqueue.h"
63
64typedef struct _pqueue
65 {
66 pitem *items;
67 int count;
68 } pqueue_s;
69
70pitem *
71pitem_new(unsigned char *prio64be, void *data)
72 {
73 pitem *item = (pitem *) OPENSSL_malloc(sizeof(pitem));
74 if (item == NULL) return NULL;
75
76 memcpy(item->priority,prio64be,sizeof(item->priority));
77
78 item->data = data;
79 item->next = NULL;
80
81 return item;
82 }
83
84void
85pitem_free(pitem *item)
86 {
87 if (item == NULL) return;
88
89 OPENSSL_free(item);
90 }
91
92pqueue_s *
93pqueue_new()
94 {
95 pqueue_s *pq = (pqueue_s *) OPENSSL_malloc(sizeof(pqueue_s));
96 if (pq == NULL) return NULL;
97
98 memset(pq, 0x00, sizeof(pqueue_s));
99 return pq;
100 }
101
102void
103pqueue_free(pqueue_s *pq)
104 {
105 if (pq == NULL) return;
106
107 OPENSSL_free(pq);
108 }
109
110pitem *
111pqueue_insert(pqueue_s *pq, pitem *item)
112 {
113 pitem *curr, *next;
114
115 if (pq->items == NULL)
116 {
117 pq->items = item;
118 return item;
119 }
120
121 for(curr = NULL, next = pq->items;
122 next != NULL;
123 curr = next, next = next->next)
124 {
125 /* we can compare 64-bit value in big-endian encoding
126 * with memcmp:-) */
127 int cmp = memcmp(next->priority, item->priority,8);
128 if (cmp > 0) /* next > item */
129 {
130 item->next = next;
131
132 if (curr == NULL)
133 pq->items = item;
134 else
135 curr->next = item;
136
137 return item;
138 }
139
140 else if (cmp == 0) /* duplicates not allowed */
141 return NULL;
142 }
143
144 item->next = NULL;
145 curr->next = item;
146
147 return item;
148 }
149
150pitem *
151pqueue_peek(pqueue_s *pq)
152 {
153 return pq->items;
154 }
155
156pitem *
157pqueue_pop(pqueue_s *pq)
158 {
159 pitem *item = pq->items;
160
161 if (pq->items != NULL)
162 pq->items = pq->items->next;
163
164 return item;
165 }
166
167pitem *
168pqueue_find(pqueue_s *pq, unsigned char *prio64be)
169 {
170 pitem *next;
171 pitem *found = NULL;
172
173 if ( pq->items == NULL)
174 return NULL;
175
176 for ( next = pq->items; next->next != NULL; next = next->next)
177 {
178 if ( memcmp(next->priority, prio64be,8) == 0)
179 {
180 found = next;
181 break;
182 }
183 }
184
185 /* check the one last node */
186 if ( memcmp(next->priority, prio64be,8) ==0)
187 found = next;
188
189 if ( ! found)
190 return NULL;
191
192#if 0 /* find works in peek mode */
193 if ( prev == NULL)
194 pq->items = next->next;
195 else
196 prev->next = next->next;
197#endif
198
199 return found;
200 }
201
202void
203pqueue_print(pqueue_s *pq)
204 {
205 pitem *item = pq->items;
206
207 while(item != NULL)
208 {
209 printf("item\t%02x%02x%02x%02x%02x%02x%02x%02x\n",
210 item->priority[0],item->priority[1],
211 item->priority[2],item->priority[3],
212 item->priority[4],item->priority[5],
213 item->priority[6],item->priority[7]);
214 item = item->next;
215 }
216 }
217
218pitem *
219pqueue_iterator(pqueue_s *pq)
220 {
221 return pqueue_peek(pq);
222 }
223
224pitem *
225pqueue_next(pitem **item)
226 {
227 pitem *ret;
228
229 if ( item == NULL || *item == NULL)
230 return NULL;
231
232
233 /* *item != NULL */
234 ret = *item;
235 *item = (*item)->next;
236
237 return ret;
238 }
239
240int
241pqueue_size(pqueue_s *pq)
242{
243 pitem *item = pq->items;
244 int count = 0;
245
246 while(item != NULL)
247 {
248 count++;
249 item = item->next;
250 }
251 return count;
252}
diff --git a/src/lib/libcrypto/pqueue/pqueue.h b/src/lib/libcrypto/pqueue/pqueue.h
new file mode 100644
index 0000000000..87fc9037c8
--- /dev/null
+++ b/src/lib/libcrypto/pqueue/pqueue.h
@@ -0,0 +1,94 @@
1/* crypto/pqueue/pqueue.h */
2/*
3 * DTLS implementation written by Nagendra Modadugu
4 * (nagendra@cs.stanford.edu) for the OpenSSL project 2005.
5 */
6/* ====================================================================
7 * Copyright (c) 1999-2005 The OpenSSL Project. All rights reserved.
8 *
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
11 * are met:
12 *
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 *
16 * 2. Redistributions in binary form must reproduce the above copyright
17 * notice, this list of conditions and the following disclaimer in
18 * the documentation and/or other materials provided with the
19 * distribution.
20 *
21 * 3. All advertising materials mentioning features or use of this
22 * software must display the following acknowledgment:
23 * "This product includes software developed by the OpenSSL Project
24 * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
25 *
26 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
27 * endorse or promote products derived from this software without
28 * prior written permission. For written permission, please contact
29 * openssl-core@OpenSSL.org.
30 *
31 * 5. Products derived from this software may not be called "OpenSSL"
32 * nor may "OpenSSL" appear in their names without prior written
33 * permission of the OpenSSL Project.
34 *
35 * 6. Redistributions of any form whatsoever must retain the following
36 * acknowledgment:
37 * "This product includes software developed by the OpenSSL Project
38 * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
39 *
40 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
41 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
42 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
43 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
44 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
45 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
46 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
47 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
49 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
50 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
51 * OF THE POSSIBILITY OF SUCH DAMAGE.
52 * ====================================================================
53 *
54 * This product includes cryptographic software written by Eric Young
55 * (eay@cryptsoft.com). This product includes software written by Tim
56 * Hudson (tjh@cryptsoft.com).
57 *
58 */
59
60#ifndef HEADER_PQUEUE_H
61#define HEADER_PQUEUE_H
62
63#include <stdio.h>
64#include <stdlib.h>
65#include <string.h>
66
67typedef struct _pqueue *pqueue;
68
69typedef struct _pitem
70 {
71 unsigned char priority[8]; /* 64-bit value in big-endian encoding */
72 void *data;
73 struct _pitem *next;
74 } pitem;
75
76typedef struct _pitem *piterator;
77
78pitem *pitem_new(unsigned char *prio64be, void *data);
79void pitem_free(pitem *item);
80
81pqueue pqueue_new(void);
82void pqueue_free(pqueue pq);
83
84pitem *pqueue_insert(pqueue pq, pitem *item);
85pitem *pqueue_peek(pqueue pq);
86pitem *pqueue_pop(pqueue pq);
87pitem *pqueue_find(pqueue pq, unsigned char *prio64be);
88pitem *pqueue_iterator(pqueue pq);
89pitem *pqueue_next(piterator *iter);
90
91void pqueue_print(pqueue pq);
92int pqueue_size(pqueue pq);
93
94#endif /* ! HEADER_PQUEUE_H */
diff --git a/src/lib/libcrypto/rand/Makefile b/src/lib/libcrypto/rand/Makefile
new file mode 100644
index 0000000000..27694aa664
--- /dev/null
+++ b/src/lib/libcrypto/rand/Makefile
@@ -0,0 +1,164 @@
1#
2# OpenSSL/crypto/rand/Makefile
3#
4
5DIR= rand
6TOP= ../..
7CC= cc
8INCLUDES=
9CFLAG=-g
10MAKEFILE= Makefile
11AR= ar r
12
13CFLAGS= $(INCLUDES) $(CFLAG)
14
15GENERAL=Makefile
16TEST= randtest.c
17APPS=
18
19LIB=$(TOP)/libcrypto.a
20LIBSRC=md_rand.c randfile.c rand_lib.c rand_err.c rand_egd.c \
21 rand_win.c rand_unix.c rand_os2.c rand_nw.c
22LIBOBJ=md_rand.o randfile.o rand_lib.o rand_err.o rand_egd.o \
23 rand_win.o rand_unix.o rand_os2.o rand_nw.o
24
25SRC= $(LIBSRC)
26
27EXHEADER= rand.h
28HEADER= $(EXHEADER)
29
30ALL= $(GENERAL) $(SRC) $(HEADER)
31
32top:
33 (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all)
34
35all: lib
36
37lib: $(LIBOBJ)
38 $(AR) $(LIB) $(LIBOBJ)
39 $(RANLIB) $(LIB) || echo Never mind.
40 @touch lib
41
42files:
43 $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
44
45links:
46 @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
47 @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
48 @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
49
50install:
51 @[ -n "$(INSTALLTOP)" ] # should be set by top Makefile...
52 @headerlist="$(EXHEADER)"; for i in $$headerlist ; \
53 do \
54 (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
55 chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
56 done;
57
58tags:
59 ctags $(SRC)
60
61tests:
62
63lint:
64 lint -DLINT $(INCLUDES) $(SRC)>fluff
65
66depend:
67 @[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile...
68 $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
69
70dclean:
71 $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
72 mv -f Makefile.new $(MAKEFILE)
73
74clean:
75 rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
76
77# DO NOT DELETE THIS LINE -- make depend depends on it.
78
79md_rand.o: ../../e_os.h ../../include/openssl/asn1.h
80md_rand.o: ../../include/openssl/bio.h ../../include/openssl/crypto.h
81md_rand.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
82md_rand.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
83md_rand.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
84md_rand.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
85md_rand.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rand.h
86md_rand.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
87md_rand.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
88md_rand.o: md_rand.c rand_lcl.h
89rand_egd.o: ../../include/openssl/buffer.h ../../include/openssl/e_os2.h
90rand_egd.o: ../../include/openssl/opensslconf.h
91rand_egd.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rand.h
92rand_egd.o: rand_egd.c
93rand_err.o: ../../include/openssl/bio.h ../../include/openssl/crypto.h
94rand_err.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
95rand_err.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
96rand_err.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
97rand_err.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h
98rand_err.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
99rand_err.o: rand_err.c
100rand_lib.o: ../../e_os.h ../../include/openssl/asn1.h
101rand_lib.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
102rand_lib.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
103rand_lib.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
104rand_lib.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h
105rand_lib.o: ../../include/openssl/err.h ../../include/openssl/evp.h
106rand_lib.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
107rand_lib.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
108rand_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
109rand_lib.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h
110rand_lib.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
111rand_lib.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
112rand_lib.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
113rand_lib.o: ../cryptlib.h rand_lib.c
114rand_nw.o: ../../e_os.h ../../include/openssl/asn1.h
115rand_nw.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
116rand_nw.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
117rand_nw.o: ../../include/openssl/err.h ../../include/openssl/evp.h
118rand_nw.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
119rand_nw.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
120rand_nw.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
121rand_nw.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h
122rand_nw.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
123rand_nw.o: ../../include/openssl/symhacks.h ../cryptlib.h rand_lcl.h rand_nw.c
124rand_os2.o: ../../e_os.h ../../include/openssl/asn1.h
125rand_os2.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
126rand_os2.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
127rand_os2.o: ../../include/openssl/err.h ../../include/openssl/evp.h
128rand_os2.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
129rand_os2.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
130rand_os2.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
131rand_os2.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h
132rand_os2.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
133rand_os2.o: ../../include/openssl/symhacks.h ../cryptlib.h rand_lcl.h
134rand_os2.o: rand_os2.c
135rand_unix.o: ../../e_os.h ../../include/openssl/asn1.h
136rand_unix.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
137rand_unix.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
138rand_unix.o: ../../include/openssl/err.h ../../include/openssl/evp.h
139rand_unix.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
140rand_unix.o: ../../include/openssl/objects.h
141rand_unix.o: ../../include/openssl/opensslconf.h
142rand_unix.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
143rand_unix.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h
144rand_unix.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
145rand_unix.o: ../../include/openssl/symhacks.h ../cryptlib.h rand_lcl.h
146rand_unix.o: rand_unix.c
147rand_win.o: ../../e_os.h ../../include/openssl/asn1.h
148rand_win.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
149rand_win.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
150rand_win.o: ../../include/openssl/err.h ../../include/openssl/evp.h
151rand_win.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
152rand_win.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
153rand_win.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
154rand_win.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h
155rand_win.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
156rand_win.o: ../../include/openssl/symhacks.h ../cryptlib.h rand_lcl.h
157rand_win.o: rand_win.c
158randfile.o: ../../e_os.h ../../include/openssl/buffer.h
159randfile.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
160randfile.o: ../../include/openssl/opensslconf.h
161randfile.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
162randfile.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h
163randfile.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
164randfile.o: randfile.c
diff --git a/src/lib/libcrypto/rand/md_rand.c b/src/lib/libcrypto/rand/md_rand.c
new file mode 100644
index 0000000000..fcdd3f2a84
--- /dev/null
+++ b/src/lib/libcrypto/rand/md_rand.c
@@ -0,0 +1,592 @@
1/* crypto/rand/md_rand.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58/* ====================================================================
59 * Copyright (c) 1998-2001 The OpenSSL Project. All rights reserved.
60 *
61 * Redistribution and use in source and binary forms, with or without
62 * modification, are permitted provided that the following conditions
63 * are met:
64 *
65 * 1. Redistributions of source code must retain the above copyright
66 * notice, this list of conditions and the following disclaimer.
67 *
68 * 2. Redistributions in binary form must reproduce the above copyright
69 * notice, this list of conditions and the following disclaimer in
70 * the documentation and/or other materials provided with the
71 * distribution.
72 *
73 * 3. All advertising materials mentioning features or use of this
74 * software must display the following acknowledgment:
75 * "This product includes software developed by the OpenSSL Project
76 * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
77 *
78 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
79 * endorse or promote products derived from this software without
80 * prior written permission. For written permission, please contact
81 * openssl-core@openssl.org.
82 *
83 * 5. Products derived from this software may not be called "OpenSSL"
84 * nor may "OpenSSL" appear in their names without prior written
85 * permission of the OpenSSL Project.
86 *
87 * 6. Redistributions of any form whatsoever must retain the following
88 * acknowledgment:
89 * "This product includes software developed by the OpenSSL Project
90 * for use in the OpenSSL Toolkit (http://www.openssl.org/)"
91 *
92 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
93 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
94 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
95 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
96 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
97 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
98 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
99 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
100 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
101 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
102 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
103 * OF THE POSSIBILITY OF SUCH DAMAGE.
104 * ====================================================================
105 *
106 * This product includes cryptographic software written by Eric Young
107 * (eay@cryptsoft.com). This product includes software written by Tim
108 * Hudson (tjh@cryptsoft.com).
109 *
110 */
111
112#define OPENSSL_FIPSEVP
113
114#ifdef MD_RAND_DEBUG
115# ifndef NDEBUG
116# define NDEBUG
117# endif
118#endif
119
120#include <assert.h>
121#include <stdio.h>
122#include <string.h>
123
124#include "e_os.h"
125
126#include <openssl/rand.h>
127#include "rand_lcl.h"
128
129#include <openssl/crypto.h>
130#include <openssl/err.h>
131
132#ifdef BN_DEBUG
133# define PREDICT
134#endif
135
136/* #define PREDICT 1 */
137
138#define STATE_SIZE 1023
139static int state_num=0,state_index=0;
140static unsigned char state[STATE_SIZE+MD_DIGEST_LENGTH];
141static unsigned char md[MD_DIGEST_LENGTH];
142static long md_count[2]={0,0};
143static double entropy=0;
144static int initialized=0;
145
146static unsigned int crypto_lock_rand = 0; /* may be set only when a thread
147 * holds CRYPTO_LOCK_RAND
148 * (to prevent double locking) */
149/* access to lockin_thread is synchronized by CRYPTO_LOCK_RAND2 */
150static CRYPTO_THREADID locking_threadid; /* valid iff crypto_lock_rand is set */
151
152
153#ifdef PREDICT
154int rand_predictable=0;
155#endif
156
157const char RAND_version[]="RAND" OPENSSL_VERSION_PTEXT;
158
159static void ssleay_rand_cleanup(void);
160static void ssleay_rand_seed(const void *buf, int num);
161static void ssleay_rand_add(const void *buf, int num, double add_entropy);
162static int ssleay_rand_bytes(unsigned char *buf, int num, int pseudo);
163static int ssleay_rand_nopseudo_bytes(unsigned char *buf, int num);
164static int ssleay_rand_pseudo_bytes(unsigned char *buf, int num);
165static int ssleay_rand_status(void);
166
167RAND_METHOD rand_ssleay_meth={
168 ssleay_rand_seed,
169 ssleay_rand_nopseudo_bytes,
170 ssleay_rand_cleanup,
171 ssleay_rand_add,
172 ssleay_rand_pseudo_bytes,
173 ssleay_rand_status
174 };
175
176RAND_METHOD *RAND_SSLeay(void)
177 {
178 return(&rand_ssleay_meth);
179 }
180
181static void ssleay_rand_cleanup(void)
182 {
183 OPENSSL_cleanse(state,sizeof(state));
184 state_num=0;
185 state_index=0;
186 OPENSSL_cleanse(md,MD_DIGEST_LENGTH);
187 md_count[0]=0;
188 md_count[1]=0;
189 entropy=0;
190 initialized=0;
191 }
192
193static void ssleay_rand_add(const void *buf, int num, double add)
194 {
195 int i,j,k,st_idx;
196 long md_c[2];
197 unsigned char local_md[MD_DIGEST_LENGTH];
198 EVP_MD_CTX m;
199 int do_not_lock;
200
201 /*
202 * (Based on the rand(3) manpage)
203 *
204 * The input is chopped up into units of 20 bytes (or less for
205 * the last block). Each of these blocks is run through the hash
206 * function as follows: The data passed to the hash function
207 * is the current 'md', the same number of bytes from the 'state'
208 * (the location determined by in incremented looping index) as
209 * the current 'block', the new key data 'block', and 'count'
210 * (which is incremented after each use).
211 * The result of this is kept in 'md' and also xored into the
212 * 'state' at the same locations that were used as input into the
213 * hash function.
214 */
215
216 /* check if we already have the lock */
217 if (crypto_lock_rand)
218 {
219 CRYPTO_THREADID cur;
220 CRYPTO_THREADID_current(&cur);
221 CRYPTO_r_lock(CRYPTO_LOCK_RAND2);
222 do_not_lock = !CRYPTO_THREADID_cmp(&locking_threadid, &cur);
223 CRYPTO_r_unlock(CRYPTO_LOCK_RAND2);
224 }
225 else
226 do_not_lock = 0;
227
228 if (!do_not_lock) CRYPTO_w_lock(CRYPTO_LOCK_RAND);
229 st_idx=state_index;
230
231 /* use our own copies of the counters so that even
232 * if a concurrent thread seeds with exactly the
233 * same data and uses the same subarray there's _some_
234 * difference */
235 md_c[0] = md_count[0];
236 md_c[1] = md_count[1];
237
238 memcpy(local_md, md, sizeof md);
239
240 /* state_index <= state_num <= STATE_SIZE */
241 state_index += num;
242 if (state_index >= STATE_SIZE)
243 {
244 state_index%=STATE_SIZE;
245 state_num=STATE_SIZE;
246 }
247 else if (state_num < STATE_SIZE)
248 {
249 if (state_index > state_num)
250 state_num=state_index;
251 }
252 /* state_index <= state_num <= STATE_SIZE */
253
254 /* state[st_idx], ..., state[(st_idx + num - 1) % STATE_SIZE]
255 * are what we will use now, but other threads may use them
256 * as well */
257
258 md_count[1] += (num / MD_DIGEST_LENGTH) + (num % MD_DIGEST_LENGTH > 0);
259
260 if (!do_not_lock) CRYPTO_w_unlock(CRYPTO_LOCK_RAND);
261
262 EVP_MD_CTX_init(&m);
263 for (i=0; i<num; i+=MD_DIGEST_LENGTH)
264 {
265 j=(num-i);
266 j=(j > MD_DIGEST_LENGTH)?MD_DIGEST_LENGTH:j;
267
268 MD_Init(&m);
269 MD_Update(&m,local_md,MD_DIGEST_LENGTH);
270 k=(st_idx+j)-STATE_SIZE;
271 if (k > 0)
272 {
273 MD_Update(&m,&(state[st_idx]),j-k);
274 MD_Update(&m,&(state[0]),k);
275 }
276 else
277 MD_Update(&m,&(state[st_idx]),j);
278
279 /* DO NOT REMOVE THE FOLLOWING CALL TO MD_Update()! */
280 MD_Update(&m,buf,j);
281 /* We know that line may cause programs such as
282 purify and valgrind to complain about use of
283 uninitialized data. The problem is not, it's
284 with the caller. Removing that line will make
285 sure you get really bad randomness and thereby
286 other problems such as very insecure keys. */
287
288 MD_Update(&m,(unsigned char *)&(md_c[0]),sizeof(md_c));
289 MD_Final(&m,local_md);
290 md_c[1]++;
291
292 buf=(const char *)buf + j;
293
294 for (k=0; k<j; k++)
295 {
296 /* Parallel threads may interfere with this,
297 * but always each byte of the new state is
298 * the XOR of some previous value of its
299 * and local_md (itermediate values may be lost).
300 * Alway using locking could hurt performance more
301 * than necessary given that conflicts occur only
302 * when the total seeding is longer than the random
303 * state. */
304 state[st_idx++]^=local_md[k];
305 if (st_idx >= STATE_SIZE)
306 st_idx=0;
307 }
308 }
309 EVP_MD_CTX_cleanup(&m);
310
311 if (!do_not_lock) CRYPTO_w_lock(CRYPTO_LOCK_RAND);
312 /* Don't just copy back local_md into md -- this could mean that
313 * other thread's seeding remains without effect (except for
314 * the incremented counter). By XORing it we keep at least as
315 * much entropy as fits into md. */
316 for (k = 0; k < (int)sizeof(md); k++)
317 {
318 md[k] ^= local_md[k];
319 }
320 if (entropy < ENTROPY_NEEDED) /* stop counting when we have enough */
321 entropy += add;
322 if (!do_not_lock) CRYPTO_w_unlock(CRYPTO_LOCK_RAND);
323
324#if !defined(OPENSSL_THREADS) && !defined(OPENSSL_SYS_WIN32)
325 assert(md_c[1] == md_count[1]);
326#endif
327 }
328
329static void ssleay_rand_seed(const void *buf, int num)
330 {
331 ssleay_rand_add(buf, num, (double)num);
332 }
333
334static int ssleay_rand_bytes(unsigned char *buf, int num, int pseudo)
335 {
336 static volatile int stirred_pool = 0;
337 int i,j,k,st_num,st_idx;
338 int num_ceil;
339 int ok;
340 long md_c[2];
341 unsigned char local_md[MD_DIGEST_LENGTH];
342 EVP_MD_CTX m;
343#ifndef GETPID_IS_MEANINGLESS
344 pid_t curr_pid = getpid();
345#endif
346 int do_stir_pool = 0;
347
348#ifdef PREDICT
349 if (rand_predictable)
350 {
351 static unsigned char val=0;
352
353 for (i=0; i<num; i++)
354 buf[i]=val++;
355 return(1);
356 }
357#endif
358
359 if (num <= 0)
360 return 1;
361
362 EVP_MD_CTX_init(&m);
363 /* round upwards to multiple of MD_DIGEST_LENGTH/2 */
364 num_ceil = (1 + (num-1)/(MD_DIGEST_LENGTH/2)) * (MD_DIGEST_LENGTH/2);
365
366 /*
367 * (Based on the rand(3) manpage:)
368 *
369 * For each group of 10 bytes (or less), we do the following:
370 *
371 * Input into the hash function the local 'md' (which is initialized from
372 * the global 'md' before any bytes are generated), the bytes that are to
373 * be overwritten by the random bytes, and bytes from the 'state'
374 * (incrementing looping index). From this digest output (which is kept
375 * in 'md'), the top (up to) 10 bytes are returned to the caller and the
376 * bottom 10 bytes are xored into the 'state'.
377 *
378 * Finally, after we have finished 'num' random bytes for the
379 * caller, 'count' (which is incremented) and the local and global 'md'
380 * are fed into the hash function and the results are kept in the
381 * global 'md'.
382 */
383
384 CRYPTO_w_lock(CRYPTO_LOCK_RAND);
385
386 /* prevent ssleay_rand_bytes() from trying to obtain the lock again */
387 CRYPTO_w_lock(CRYPTO_LOCK_RAND2);
388 CRYPTO_THREADID_current(&locking_threadid);
389 CRYPTO_w_unlock(CRYPTO_LOCK_RAND2);
390 crypto_lock_rand = 1;
391
392 if (!initialized)
393 {
394 RAND_poll();
395 initialized = 1;
396 }
397
398 if (!stirred_pool)
399 do_stir_pool = 1;
400
401 ok = (entropy >= ENTROPY_NEEDED);
402 if (!ok)
403 {
404 /* If the PRNG state is not yet unpredictable, then seeing
405 * the PRNG output may help attackers to determine the new
406 * state; thus we have to decrease the entropy estimate.
407 * Once we've had enough initial seeding we don't bother to
408 * adjust the entropy count, though, because we're not ambitious
409 * to provide *information-theoretic* randomness.
410 *
411 * NOTE: This approach fails if the program forks before
412 * we have enough entropy. Entropy should be collected
413 * in a separate input pool and be transferred to the
414 * output pool only when the entropy limit has been reached.
415 */
416 entropy -= num;
417 if (entropy < 0)
418 entropy = 0;
419 }
420
421 if (do_stir_pool)
422 {
423 /* In the output function only half of 'md' remains secret,
424 * so we better make sure that the required entropy gets
425 * 'evenly distributed' through 'state', our randomness pool.
426 * The input function (ssleay_rand_add) chains all of 'md',
427 * which makes it more suitable for this purpose.
428 */
429
430 int n = STATE_SIZE; /* so that the complete pool gets accessed */
431 while (n > 0)
432 {
433#if MD_DIGEST_LENGTH > 20
434# error "Please adjust DUMMY_SEED."
435#endif
436#define DUMMY_SEED "...................." /* at least MD_DIGEST_LENGTH */
437 /* Note that the seed does not matter, it's just that
438 * ssleay_rand_add expects to have something to hash. */
439 ssleay_rand_add(DUMMY_SEED, MD_DIGEST_LENGTH, 0.0);
440 n -= MD_DIGEST_LENGTH;
441 }
442 if (ok)
443 stirred_pool = 1;
444 }
445
446 st_idx=state_index;
447 st_num=state_num;
448 md_c[0] = md_count[0];
449 md_c[1] = md_count[1];
450 memcpy(local_md, md, sizeof md);
451
452 state_index+=num_ceil;
453 if (state_index > state_num)
454 state_index %= state_num;
455
456 /* state[st_idx], ..., state[(st_idx + num_ceil - 1) % st_num]
457 * are now ours (but other threads may use them too) */
458
459 md_count[0] += 1;
460
461 /* before unlocking, we must clear 'crypto_lock_rand' */
462 crypto_lock_rand = 0;
463 CRYPTO_w_unlock(CRYPTO_LOCK_RAND);
464
465 while (num > 0)
466 {
467 /* num_ceil -= MD_DIGEST_LENGTH/2 */
468 j=(num >= MD_DIGEST_LENGTH/2)?MD_DIGEST_LENGTH/2:num;
469 num-=j;
470 MD_Init(&m);
471#ifndef GETPID_IS_MEANINGLESS
472 if (curr_pid) /* just in the first iteration to save time */
473 {
474 MD_Update(&m,(unsigned char*)&curr_pid,sizeof curr_pid);
475 curr_pid = 0;
476 }
477#endif
478 MD_Update(&m,local_md,MD_DIGEST_LENGTH);
479 MD_Update(&m,(unsigned char *)&(md_c[0]),sizeof(md_c));
480
481#ifndef PURIFY /* purify complains */
482 /* The following line uses the supplied buffer as a small
483 * source of entropy: since this buffer is often uninitialised
484 * it may cause programs such as purify or valgrind to
485 * complain. So for those builds it is not used: the removal
486 * of such a small source of entropy has negligible impact on
487 * security.
488 */
489 MD_Update(&m,buf,j);
490#endif
491
492 k=(st_idx+MD_DIGEST_LENGTH/2)-st_num;
493 if (k > 0)
494 {
495 MD_Update(&m,&(state[st_idx]),MD_DIGEST_LENGTH/2-k);
496 MD_Update(&m,&(state[0]),k);
497 }
498 else
499 MD_Update(&m,&(state[st_idx]),MD_DIGEST_LENGTH/2);
500 MD_Final(&m,local_md);
501
502 for (i=0; i<MD_DIGEST_LENGTH/2; i++)
503 {
504 state[st_idx++]^=local_md[i]; /* may compete with other threads */
505 if (st_idx >= st_num)
506 st_idx=0;
507 if (i < j)
508 *(buf++)=local_md[i+MD_DIGEST_LENGTH/2];
509 }
510 }
511
512 MD_Init(&m);
513 MD_Update(&m,(unsigned char *)&(md_c[0]),sizeof(md_c));
514 MD_Update(&m,local_md,MD_DIGEST_LENGTH);
515 CRYPTO_w_lock(CRYPTO_LOCK_RAND);
516 MD_Update(&m,md,MD_DIGEST_LENGTH);
517 MD_Final(&m,md);
518 CRYPTO_w_unlock(CRYPTO_LOCK_RAND);
519
520 EVP_MD_CTX_cleanup(&m);
521 if (ok)
522 return(1);
523 else if (pseudo)
524 return 0;
525 else
526 {
527 RANDerr(RAND_F_SSLEAY_RAND_BYTES,RAND_R_PRNG_NOT_SEEDED);
528 ERR_add_error_data(1, "You need to read the OpenSSL FAQ, "
529 "http://www.openssl.org/support/faq.html");
530 return(0);
531 }
532 }
533
534static int ssleay_rand_nopseudo_bytes(unsigned char *buf, int num)
535 {
536 return ssleay_rand_bytes(buf, num, 0);
537 }
538
539/* pseudo-random bytes that are guaranteed to be unique but not
540 unpredictable */
541static int ssleay_rand_pseudo_bytes(unsigned char *buf, int num)
542 {
543 return ssleay_rand_bytes(buf, num, 1);
544 }
545
546static int ssleay_rand_status(void)
547 {
548 CRYPTO_THREADID cur;
549 int ret;
550 int do_not_lock;
551
552 CRYPTO_THREADID_current(&cur);
553 /* check if we already have the lock
554 * (could happen if a RAND_poll() implementation calls RAND_status()) */
555 if (crypto_lock_rand)
556 {
557 CRYPTO_r_lock(CRYPTO_LOCK_RAND2);
558 do_not_lock = !CRYPTO_THREADID_cmp(&locking_threadid, &cur);
559 CRYPTO_r_unlock(CRYPTO_LOCK_RAND2);
560 }
561 else
562 do_not_lock = 0;
563
564 if (!do_not_lock)
565 {
566 CRYPTO_w_lock(CRYPTO_LOCK_RAND);
567
568 /* prevent ssleay_rand_bytes() from trying to obtain the lock again */
569 CRYPTO_w_lock(CRYPTO_LOCK_RAND2);
570 CRYPTO_THREADID_cpy(&locking_threadid, &cur);
571 CRYPTO_w_unlock(CRYPTO_LOCK_RAND2);
572 crypto_lock_rand = 1;
573 }
574
575 if (!initialized)
576 {
577 RAND_poll();
578 initialized = 1;
579 }
580
581 ret = entropy >= ENTROPY_NEEDED;
582
583 if (!do_not_lock)
584 {
585 /* before unlocking, we must clear 'crypto_lock_rand' */
586 crypto_lock_rand = 0;
587
588 CRYPTO_w_unlock(CRYPTO_LOCK_RAND);
589 }
590
591 return ret;
592 }
diff --git a/src/lib/libcrypto/rand/rand.h b/src/lib/libcrypto/rand/rand.h
index bb5520e80a..dc8fcf94c5 100644
--- a/src/lib/libcrypto/rand/rand.h
+++ b/src/lib/libcrypto/rand/rand.h
@@ -138,7 +138,6 @@ void ERR_load_RAND_strings(void);
138#define RAND_F_SSLEAY_RAND_BYTES 100 138#define RAND_F_SSLEAY_RAND_BYTES 100
139 139
140/* Reason codes. */ 140/* Reason codes. */
141#define RAND_R_DUAL_EC_DRBG_DISABLED 104
142#define RAND_R_ERROR_INITIALISING_DRBG 102 141#define RAND_R_ERROR_INITIALISING_DRBG 102
143#define RAND_R_ERROR_INSTANTIATING_DRBG 103 142#define RAND_R_ERROR_INSTANTIATING_DRBG 103
144#define RAND_R_NO_FIPS_RANDOM_METHOD_SET 101 143#define RAND_R_NO_FIPS_RANDOM_METHOD_SET 101
diff --git a/src/lib/libcrypto/rand/rand_egd.c b/src/lib/libcrypto/rand/rand_egd.c
new file mode 100644
index 0000000000..d53b916ebe
--- /dev/null
+++ b/src/lib/libcrypto/rand/rand_egd.c
@@ -0,0 +1,303 @@
1/* crypto/rand/rand_egd.c */
2/* Written by Ulf Moeller and Lutz Jaenicke for the OpenSSL project. */
3/* ====================================================================
4 * Copyright (c) 1998-2000 The OpenSSL Project. All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 *
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 *
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in
15 * the documentation and/or other materials provided with the
16 * distribution.
17 *
18 * 3. All advertising materials mentioning features or use of this
19 * software must display the following acknowledgment:
20 * "This product includes software developed by the OpenSSL Project
21 * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
22 *
23 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
24 * endorse or promote products derived from this software without
25 * prior written permission. For written permission, please contact
26 * openssl-core@openssl.org.
27 *
28 * 5. Products derived from this software may not be called "OpenSSL"
29 * nor may "OpenSSL" appear in their names without prior written
30 * permission of the OpenSSL Project.
31 *
32 * 6. Redistributions of any form whatsoever must retain the following
33 * acknowledgment:
34 * "This product includes software developed by the OpenSSL Project
35 * for use in the OpenSSL Toolkit (http://www.openssl.org/)"
36 *
37 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
38 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
39 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
40 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
41 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
42 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
43 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
44 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
45 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
46 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
47 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
48 * OF THE POSSIBILITY OF SUCH DAMAGE.
49 * ====================================================================
50 *
51 * This product includes cryptographic software written by Eric Young
52 * (eay@cryptsoft.com). This product includes software written by Tim
53 * Hudson (tjh@cryptsoft.com).
54 *
55 */
56
57#include <openssl/e_os2.h>
58#include <openssl/rand.h>
59#include <openssl/buffer.h>
60
61/*
62 * Query the EGD <URL: http://www.lothar.com/tech/crypto/>.
63 *
64 * This module supplies three routines:
65 *
66 * RAND_query_egd_bytes(path, buf, bytes)
67 * will actually query "bytes" bytes of entropy form the egd-socket located
68 * at path and will write them to buf (if supplied) or will directly feed
69 * it to RAND_seed() if buf==NULL.
70 * The number of bytes is not limited by the maximum chunk size of EGD,
71 * which is 255 bytes. If more than 255 bytes are wanted, several chunks
72 * of entropy bytes are requested. The connection is left open until the
73 * query is competed.
74 * RAND_query_egd_bytes() returns with
75 * -1 if an error occured during connection or communication.
76 * num the number of bytes read from the EGD socket. This number is either
77 * the number of bytes requested or smaller, if the EGD pool is
78 * drained and the daemon signals that the pool is empty.
79 * This routine does not touch any RAND_status(). This is necessary, since
80 * PRNG functions may call it during initialization.
81 *
82 * RAND_egd_bytes(path, bytes) will query "bytes" bytes and have them
83 * used to seed the PRNG.
84 * RAND_egd_bytes() is a wrapper for RAND_query_egd_bytes() with buf=NULL.
85 * Unlike RAND_query_egd_bytes(), RAND_status() is used to test the
86 * seed status so that the return value can reflect the seed state:
87 * -1 if an error occured during connection or communication _or_
88 * if the PRNG has still not received the required seeding.
89 * num the number of bytes read from the EGD socket. This number is either
90 * the number of bytes requested or smaller, if the EGD pool is
91 * drained and the daemon signals that the pool is empty.
92 *
93 * RAND_egd(path) will query 255 bytes and use the bytes retreived to seed
94 * the PRNG.
95 * RAND_egd() is a wrapper for RAND_egd_bytes() with numbytes=255.
96 */
97
98#if defined(OPENSSL_SYS_WIN32) || defined(OPENSSL_SYS_VMS) || defined(OPENSSL_SYS_MSDOS) || defined(OPENSSL_SYS_VXWORKS) || defined(OPENSSL_SYS_NETWARE) || defined(OPENSSL_SYS_VOS) || defined(OPENSSL_SYS_BEOS)
99int RAND_query_egd_bytes(const char *path, unsigned char *buf, int bytes)
100 {
101 return(-1);
102 }
103int RAND_egd(const char *path)
104 {
105 return(-1);
106 }
107
108int RAND_egd_bytes(const char *path,int bytes)
109 {
110 return(-1);
111 }
112#else
113#include <openssl/opensslconf.h>
114#include OPENSSL_UNISTD
115#include <sys/types.h>
116#include <sys/socket.h>
117#ifndef NO_SYS_UN_H
118# ifdef OPENSSL_SYS_VXWORKS
119# include <streams/un.h>
120# else
121# include <sys/un.h>
122# endif
123#else
124struct sockaddr_un {
125 short sun_family; /* AF_UNIX */
126 char sun_path[108]; /* path name (gag) */
127};
128#endif /* NO_SYS_UN_H */
129#include <string.h>
130#include <errno.h>
131
132#ifndef offsetof
133# define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
134#endif
135
136int RAND_query_egd_bytes(const char *path, unsigned char *buf, int bytes)
137 {
138 int ret = 0;
139 struct sockaddr_un addr;
140 int len, num, numbytes;
141 int fd = -1;
142 int success;
143 unsigned char egdbuf[2], tempbuf[255], *retrievebuf;
144
145 memset(&addr, 0, sizeof(addr));
146 addr.sun_family = AF_UNIX;
147 if (strlen(path) >= sizeof(addr.sun_path))
148 return (-1);
149 BUF_strlcpy(addr.sun_path,path,sizeof addr.sun_path);
150 len = offsetof(struct sockaddr_un, sun_path) + strlen(path);
151 fd = socket(AF_UNIX, SOCK_STREAM, 0);
152 if (fd == -1) return (-1);
153 success = 0;
154 while (!success)
155 {
156 if (connect(fd, (struct sockaddr *)&addr, len) == 0)
157 success = 1;
158 else
159 {
160 switch (errno)
161 {
162#ifdef EINTR
163 case EINTR:
164#endif
165#ifdef EAGAIN
166 case EAGAIN:
167#endif
168#ifdef EINPROGRESS
169 case EINPROGRESS:
170#endif
171#ifdef EALREADY
172 case EALREADY:
173#endif
174 /* No error, try again */
175 break;
176#ifdef EISCONN
177 case EISCONN:
178 success = 1;
179 break;
180#endif
181 default:
182 goto err; /* failure */
183 }
184 }
185 }
186
187 while(bytes > 0)
188 {
189 egdbuf[0] = 1;
190 egdbuf[1] = bytes < 255 ? bytes : 255;
191 numbytes = 0;
192 while (numbytes != 2)
193 {
194 num = write(fd, egdbuf + numbytes, 2 - numbytes);
195 if (num >= 0)
196 numbytes += num;
197 else
198 {
199 switch (errno)
200 {
201#ifdef EINTR
202 case EINTR:
203#endif
204#ifdef EAGAIN
205 case EAGAIN:
206#endif
207 /* No error, try again */
208 break;
209 default:
210 ret = -1;
211 goto err; /* failure */
212 }
213 }
214 }
215 numbytes = 0;
216 while (numbytes != 1)
217 {
218 num = read(fd, egdbuf, 1);
219 if (num == 0)
220 goto err; /* descriptor closed */
221 else if (num > 0)
222 numbytes += num;
223 else
224 {
225 switch (errno)
226 {
227#ifdef EINTR
228 case EINTR:
229#endif
230#ifdef EAGAIN
231 case EAGAIN:
232#endif
233 /* No error, try again */
234 break;
235 default:
236 ret = -1;
237 goto err; /* failure */
238 }
239 }
240 }
241 if(egdbuf[0] == 0)
242 goto err;
243 if (buf)
244 retrievebuf = buf + ret;
245 else
246 retrievebuf = tempbuf;
247 numbytes = 0;
248 while (numbytes != egdbuf[0])
249 {
250 num = read(fd, retrievebuf + numbytes, egdbuf[0] - numbytes);
251 if (num == 0)
252 goto err; /* descriptor closed */
253 else if (num > 0)
254 numbytes += num;
255 else
256 {
257 switch (errno)
258 {
259#ifdef EINTR
260 case EINTR:
261#endif
262#ifdef EAGAIN
263 case EAGAIN:
264#endif
265 /* No error, try again */
266 break;
267 default:
268 ret = -1;
269 goto err; /* failure */
270 }
271 }
272 }
273 ret += egdbuf[0];
274 bytes -= egdbuf[0];
275 if (!buf)
276 RAND_seed(tempbuf, egdbuf[0]);
277 }
278 err:
279 if (fd != -1) close(fd);
280 return(ret);
281 }
282
283
284int RAND_egd_bytes(const char *path, int bytes)
285 {
286 int num, ret = 0;
287
288 num = RAND_query_egd_bytes(path, NULL, bytes);
289 if (num < 1) goto err;
290 if (RAND_status() == 1)
291 ret = num;
292 err:
293 return(ret);
294 }
295
296
297int RAND_egd(const char *path)
298 {
299 return (RAND_egd_bytes(path, 255));
300 }
301
302
303#endif
diff --git a/src/lib/libcrypto/rand/rand_err.c b/src/lib/libcrypto/rand/rand_err.c
index c4c80fc8cc..b8586c8f4a 100644
--- a/src/lib/libcrypto/rand/rand_err.c
+++ b/src/lib/libcrypto/rand/rand_err.c
@@ -78,7 +78,6 @@ static ERR_STRING_DATA RAND_str_functs[]=
78 78
79static ERR_STRING_DATA RAND_str_reasons[]= 79static ERR_STRING_DATA RAND_str_reasons[]=
80 { 80 {
81{ERR_REASON(RAND_R_DUAL_EC_DRBG_DISABLED),"dual ec drbg disabled"},
82{ERR_REASON(RAND_R_ERROR_INITIALISING_DRBG),"error initialising drbg"}, 81{ERR_REASON(RAND_R_ERROR_INITIALISING_DRBG),"error initialising drbg"},
83{ERR_REASON(RAND_R_ERROR_INSTANTIATING_DRBG),"error instantiating drbg"}, 82{ERR_REASON(RAND_R_ERROR_INSTANTIATING_DRBG),"error instantiating drbg"},
84{ERR_REASON(RAND_R_NO_FIPS_RANDOM_METHOD_SET),"no fips random method set"}, 83{ERR_REASON(RAND_R_NO_FIPS_RANDOM_METHOD_SET),"no fips random method set"},
diff --git a/src/lib/libcrypto/rand/rand_lcl.h b/src/lib/libcrypto/rand/rand_lcl.h
new file mode 100644
index 0000000000..618a8ec899
--- /dev/null
+++ b/src/lib/libcrypto/rand/rand_lcl.h
@@ -0,0 +1,158 @@
1/* crypto/rand/rand_lcl.h */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58/* ====================================================================
59 * Copyright (c) 1998-2000 The OpenSSL Project. All rights reserved.
60 *
61 * Redistribution and use in source and binary forms, with or without
62 * modification, are permitted provided that the following conditions
63 * are met:
64 *
65 * 1. Redistributions of source code must retain the above copyright
66 * notice, this list of conditions and the following disclaimer.
67 *
68 * 2. Redistributions in binary form must reproduce the above copyright
69 * notice, this list of conditions and the following disclaimer in
70 * the documentation and/or other materials provided with the
71 * distribution.
72 *
73 * 3. All advertising materials mentioning features or use of this
74 * software must display the following acknowledgment:
75 * "This product includes software developed by the OpenSSL Project
76 * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
77 *
78 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
79 * endorse or promote products derived from this software without
80 * prior written permission. For written permission, please contact
81 * openssl-core@openssl.org.
82 *
83 * 5. Products derived from this software may not be called "OpenSSL"
84 * nor may "OpenSSL" appear in their names without prior written
85 * permission of the OpenSSL Project.
86 *
87 * 6. Redistributions of any form whatsoever must retain the following
88 * acknowledgment:
89 * "This product includes software developed by the OpenSSL Project
90 * for use in the OpenSSL Toolkit (http://www.openssl.org/)"
91 *
92 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
93 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
94 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
95 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
96 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
97 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
98 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
99 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
100 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
101 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
102 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
103 * OF THE POSSIBILITY OF SUCH DAMAGE.
104 * ====================================================================
105 *
106 * This product includes cryptographic software written by Eric Young
107 * (eay@cryptsoft.com). This product includes software written by Tim
108 * Hudson (tjh@cryptsoft.com).
109 *
110 */
111
112#ifndef HEADER_RAND_LCL_H
113#define HEADER_RAND_LCL_H
114
115#define ENTROPY_NEEDED 32 /* require 256 bits = 32 bytes of randomness */
116
117
118#if !defined(USE_MD5_RAND) && !defined(USE_SHA1_RAND) && !defined(USE_MDC2_RAND) && !defined(USE_MD2_RAND)
119#if !defined(OPENSSL_NO_SHA) && !defined(OPENSSL_NO_SHA1)
120#define USE_SHA1_RAND
121#elif !defined(OPENSSL_NO_MD5)
122#define USE_MD5_RAND
123#elif !defined(OPENSSL_NO_MDC2) && !defined(OPENSSL_NO_DES)
124#define USE_MDC2_RAND
125#elif !defined(OPENSSL_NO_MD2)
126#define USE_MD2_RAND
127#else
128#error No message digest algorithm available
129#endif
130#endif
131
132#include <openssl/evp.h>
133#define MD_Update(a,b,c) EVP_DigestUpdate(a,b,c)
134#define MD_Final(a,b) EVP_DigestFinal_ex(a,b,NULL)
135#if defined(USE_MD5_RAND)
136#include <openssl/md5.h>
137#define MD_DIGEST_LENGTH MD5_DIGEST_LENGTH
138#define MD_Init(a) EVP_DigestInit_ex(a,EVP_md5(), NULL)
139#define MD(a,b,c) EVP_Digest(a,b,c,NULL,EVP_md5(), NULL)
140#elif defined(USE_SHA1_RAND)
141#include <openssl/sha.h>
142#define MD_DIGEST_LENGTH SHA_DIGEST_LENGTH
143#define MD_Init(a) EVP_DigestInit_ex(a,EVP_sha1(), NULL)
144#define MD(a,b,c) EVP_Digest(a,b,c,NULL,EVP_sha1(), NULL)
145#elif defined(USE_MDC2_RAND)
146#include <openssl/mdc2.h>
147#define MD_DIGEST_LENGTH MDC2_DIGEST_LENGTH
148#define MD_Init(a) EVP_DigestInit_ex(a,EVP_mdc2(), NULL)
149#define MD(a,b,c) EVP_Digest(a,b,c,NULL,EVP_mdc2(), NULL)
150#elif defined(USE_MD2_RAND)
151#include <openssl/md2.h>
152#define MD_DIGEST_LENGTH MD2_DIGEST_LENGTH
153#define MD_Init(a) EVP_DigestInit_ex(a,EVP_md2(), NULL)
154#define MD(a,b,c) EVP_Digest(a,b,c,NULL,EVP_md2(), NULL)
155#endif
156
157
158#endif
diff --git a/src/lib/libcrypto/rand/rand_lib.c b/src/lib/libcrypto/rand/rand_lib.c
index 5ac0e14caf..daf1dab973 100644
--- a/src/lib/libcrypto/rand/rand_lib.c
+++ b/src/lib/libcrypto/rand/rand_lib.c
@@ -210,11 +210,8 @@ static size_t drbg_get_entropy(DRBG_CTX *ctx, unsigned char **pout,
210 210
211static void drbg_free_entropy(DRBG_CTX *ctx, unsigned char *out, size_t olen) 211static void drbg_free_entropy(DRBG_CTX *ctx, unsigned char *out, size_t olen)
212 { 212 {
213 if (out) 213 OPENSSL_cleanse(out, olen);
214 { 214 OPENSSL_free(out);
215 OPENSSL_cleanse(out, olen);
216 OPENSSL_free(out);
217 }
218 } 215 }
219 216
220/* Set "additional input" when generating random data. This uses the 217/* Set "additional input" when generating random data. This uses the
@@ -269,14 +266,6 @@ int RAND_init_fips(void)
269 DRBG_CTX *dctx; 266 DRBG_CTX *dctx;
270 size_t plen; 267 size_t plen;
271 unsigned char pers[32], *p; 268 unsigned char pers[32], *p;
272#ifndef OPENSSL_ALLOW_DUAL_EC_DRBG
273 if (fips_drbg_type >> 16)
274 {
275 RANDerr(RAND_F_RAND_INIT_FIPS, RAND_R_DUAL_EC_DRBG_DISABLED);
276 return 0;
277 }
278#endif
279
280 dctx = FIPS_get_default_drbg(); 269 dctx = FIPS_get_default_drbg();
281 if (FIPS_drbg_init(dctx, fips_drbg_type, fips_drbg_flags) <= 0) 270 if (FIPS_drbg_init(dctx, fips_drbg_type, fips_drbg_flags) <= 0)
282 { 271 {
diff --git a/src/lib/libcrypto/rand/rand_nw.c b/src/lib/libcrypto/rand/rand_nw.c
new file mode 100644
index 0000000000..8d5b8d2e32
--- /dev/null
+++ b/src/lib/libcrypto/rand/rand_nw.c
@@ -0,0 +1,183 @@
1/* crypto/rand/rand_nw.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58/* ====================================================================
59 * Copyright (c) 1998-2000 The OpenSSL Project. All rights reserved.
60 *
61 * Redistribution and use in source and binary forms, with or without
62 * modification, are permitted provided that the following conditions
63 * are met:
64 *
65 * 1. Redistributions of source code must retain the above copyright
66 * notice, this list of conditions and the following disclaimer.
67 *
68 * 2. Redistributions in binary form must reproduce the above copyright
69 * notice, this list of conditions and the following disclaimer in
70 * the documentation and/or other materials provided with the
71 * distribution.
72 *
73 * 3. All advertising materials mentioning features or use of this
74 * software must display the following acknowledgment:
75 * "This product includes software developed by the OpenSSL Project
76 * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
77 *
78 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
79 * endorse or promote products derived from this software without
80 * prior written permission. For written permission, please contact
81 * openssl-core@openssl.org.
82 *
83 * 5. Products derived from this software may not be called "OpenSSL"
84 * nor may "OpenSSL" appear in their names without prior written
85 * permission of the OpenSSL Project.
86 *
87 * 6. Redistributions of any form whatsoever must retain the following
88 * acknowledgment:
89 * "This product includes software developed by the OpenSSL Project
90 * for use in the OpenSSL Toolkit (http://www.openssl.org/)"
91 *
92 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
93 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
94 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
95 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
96 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
97 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
98 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
99 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
100 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
101 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
102 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
103 * OF THE POSSIBILITY OF SUCH DAMAGE.
104 * ====================================================================
105 *
106 * This product includes cryptographic software written by Eric Young
107 * (eay@cryptsoft.com). This product includes software written by Tim
108 * Hudson (tjh@cryptsoft.com).
109 *
110 */
111
112#include "cryptlib.h"
113#include <openssl/rand.h>
114#include "rand_lcl.h"
115
116#if defined (OPENSSL_SYS_NETWARE)
117
118#if defined(NETWARE_LIBC)
119#include <nks/thread.h>
120#else
121#include <nwthread.h>
122#endif
123
124extern int GetProcessSwitchCount(void);
125#if !defined(NETWARE_LIBC) || (CURRENT_NDK_THRESHOLD < 509220000)
126extern void *RunningProcess; /* declare here same as found in newer NDKs */
127extern unsigned long GetSuperHighResolutionTimer(void);
128#endif
129
130 /* the FAQ indicates we need to provide at least 20 bytes (160 bits) of seed
131 */
132int RAND_poll(void)
133{
134 unsigned long l;
135 unsigned long tsc;
136 int i;
137
138 /* There are several options to gather miscellaneous data
139 * but for now we will loop checking the time stamp counter (rdtsc) and
140 * the SuperHighResolutionTimer. Each iteration will collect 8 bytes
141 * of data but it is treated as only 1 byte of entropy. The call to
142 * ThreadSwitchWithDelay() will introduce additional variability into
143 * the data returned by rdtsc.
144 *
145 * Applications can agument the seed material by adding additional
146 * stuff with RAND_add() and should probably do so.
147 */
148 l = GetProcessSwitchCount();
149 RAND_add(&l,sizeof(l),1);
150
151 /* need to cast the void* to unsigned long here */
152 l = (unsigned long)RunningProcess;
153 RAND_add(&l,sizeof(l),1);
154
155 for( i=2; i<ENTROPY_NEEDED; i++)
156 {
157#ifdef __MWERKS__
158 asm
159 {
160 rdtsc
161 mov tsc, eax
162 }
163#elif defined(__GNUC__) && __GNUC__>=2 && !defined(OPENSSL_NO_ASM) && !defined(OPENSSL_NO_INLINE_ASM)
164 asm volatile("rdtsc":"=a"(tsc)::"edx");
165#endif
166
167 RAND_add(&tsc, sizeof(tsc), 1);
168
169 l = GetSuperHighResolutionTimer();
170 RAND_add(&l, sizeof(l), 0);
171
172# if defined(NETWARE_LIBC)
173 NXThreadYield();
174# else /* NETWARE_CLIB */
175 ThreadSwitchWithDelay();
176# endif
177 }
178
179 return 1;
180}
181
182#endif
183
diff --git a/src/lib/libcrypto/rand/rand_os2.c b/src/lib/libcrypto/rand/rand_os2.c
new file mode 100644
index 0000000000..fc1e78b179
--- /dev/null
+++ b/src/lib/libcrypto/rand/rand_os2.c
@@ -0,0 +1,153 @@
1/* crypto/rand/rand_os2.c */
2/* ====================================================================
3 * Copyright (c) 1998-2000 The OpenSSL Project. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 *
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in
14 * the documentation and/or other materials provided with the
15 * distribution.
16 *
17 * 3. All advertising materials mentioning features or use of this
18 * software must display the following acknowledgment:
19 * "This product includes software developed by the OpenSSL Project
20 * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
21 *
22 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
23 * endorse or promote products derived from this software without
24 * prior written permission. For written permission, please contact
25 * openssl-core@openssl.org.
26 *
27 * 5. Products derived from this software may not be called "OpenSSL"
28 * nor may "OpenSSL" appear in their names without prior written
29 * permission of the OpenSSL Project.
30 *
31 * 6. Redistributions of any form whatsoever must retain the following
32 * acknowledgment:
33 * "This product includes software developed by the OpenSSL Project
34 * for use in the OpenSSL Toolkit (http://www.openssl.org/)"
35 *
36 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
37 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
38 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
39 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
40 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
41 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
42 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
43 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
44 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
45 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
46 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
47 * OF THE POSSIBILITY OF SUCH DAMAGE.
48 * ====================================================================
49 *
50 * This product includes cryptographic software written by Eric Young
51 * (eay@cryptsoft.com). This product includes software written by Tim
52 * Hudson (tjh@cryptsoft.com).
53 *
54 */
55
56#include "cryptlib.h"
57#include <openssl/rand.h>
58#include "rand_lcl.h"
59
60#ifdef OPENSSL_SYS_OS2
61
62#define INCL_DOSPROCESS
63#define INCL_DOSPROFILE
64#define INCL_DOSMISC
65#define INCL_DOSMODULEMGR
66#include <os2.h>
67
68#define CMD_KI_RDCNT (0x63)
69
70typedef struct _CPUUTIL {
71 ULONG ulTimeLow; /* Low 32 bits of time stamp */
72 ULONG ulTimeHigh; /* High 32 bits of time stamp */
73 ULONG ulIdleLow; /* Low 32 bits of idle time */
74 ULONG ulIdleHigh; /* High 32 bits of idle time */
75 ULONG ulBusyLow; /* Low 32 bits of busy time */
76 ULONG ulBusyHigh; /* High 32 bits of busy time */
77 ULONG ulIntrLow; /* Low 32 bits of interrupt time */
78 ULONG ulIntrHigh; /* High 32 bits of interrupt time */
79} CPUUTIL;
80
81#ifndef __KLIBC__
82APIRET APIENTRY(*DosPerfSysCall) (ULONG ulCommand, ULONG ulParm1, ULONG ulParm2, ULONG ulParm3) = NULL;
83APIRET APIENTRY(*DosQuerySysState) (ULONG func, ULONG arg1, ULONG pid, ULONG _res_, PVOID buf, ULONG bufsz) = NULL;
84#endif
85HMODULE hDoscalls = 0;
86
87int RAND_poll(void)
88{
89 char failed_module[20];
90 QWORD qwTime;
91 ULONG SysVars[QSV_FOREGROUND_PROCESS];
92
93 if (hDoscalls == 0) {
94 ULONG rc = DosLoadModule(failed_module, sizeof(failed_module), "DOSCALLS", &hDoscalls);
95
96#ifndef __KLIBC__
97 if (rc == 0) {
98 rc = DosQueryProcAddr(hDoscalls, 976, NULL, (PFN *)&DosPerfSysCall);
99
100 if (rc)
101 DosPerfSysCall = NULL;
102
103 rc = DosQueryProcAddr(hDoscalls, 368, NULL, (PFN *)&DosQuerySysState);
104
105 if (rc)
106 DosQuerySysState = NULL;
107 }
108#endif
109 }
110
111 /* Sample the hi-res timer, runs at around 1.1 MHz */
112 DosTmrQueryTime(&qwTime);
113 RAND_add(&qwTime, sizeof(qwTime), 2);
114
115 /* Sample a bunch of system variables, includes various process & memory statistics */
116 DosQuerySysInfo(1, QSV_FOREGROUND_PROCESS, SysVars, sizeof(SysVars));
117 RAND_add(SysVars, sizeof(SysVars), 4);
118
119 /* If available, sample CPU registers that count at CPU MHz
120 * Only fairly new CPUs (PPro & K6 onwards) & OS/2 versions support this
121 */
122 if (DosPerfSysCall) {
123 CPUUTIL util;
124
125 if (DosPerfSysCall(CMD_KI_RDCNT, (ULONG)&util, 0, 0) == 0) {
126 RAND_add(&util, sizeof(util), 10);
127 }
128 else {
129#ifndef __KLIBC__
130 DosPerfSysCall = NULL;
131#endif
132 }
133 }
134
135 /* DosQuerySysState() gives us a huge quantity of process, thread, memory & handle stats */
136 if (DosQuerySysState) {
137 char *buffer = OPENSSL_malloc(256 * 1024);
138
139 if (DosQuerySysState(0x1F, 0, 0, 0, buffer, 256 * 1024) == 0) {
140 /* First 4 bytes in buffer is a pointer to the thread count
141 * there should be at least 1 byte of entropy per thread
142 */
143 RAND_add(buffer, 256 * 1024, **(ULONG **)buffer);
144 }
145
146 OPENSSL_free(buffer);
147 return 1;
148 }
149
150 return 0;
151}
152
153#endif /* OPENSSL_SYS_OS2 */
diff --git a/src/lib/libcrypto/rand/rand_unix.c b/src/lib/libcrypto/rand/rand_unix.c
new file mode 100644
index 0000000000..3316388443
--- /dev/null
+++ b/src/lib/libcrypto/rand/rand_unix.c
@@ -0,0 +1,425 @@
1/* crypto/rand/rand_unix.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58/* ====================================================================
59 * Copyright (c) 1998-2006 The OpenSSL Project. All rights reserved.
60 *
61 * Redistribution and use in source and binary forms, with or without
62 * modification, are permitted provided that the following conditions
63 * are met:
64 *
65 * 1. Redistributions of source code must retain the above copyright
66 * notice, this list of conditions and the following disclaimer.
67 *
68 * 2. Redistributions in binary form must reproduce the above copyright
69 * notice, this list of conditions and the following disclaimer in
70 * the documentation and/or other materials provided with the
71 * distribution.
72 *
73 * 3. All advertising materials mentioning features or use of this
74 * software must display the following acknowledgment:
75 * "This product includes software developed by the OpenSSL Project
76 * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
77 *
78 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
79 * endorse or promote products derived from this software without
80 * prior written permission. For written permission, please contact
81 * openssl-core@openssl.org.
82 *
83 * 5. Products derived from this software may not be called "OpenSSL"
84 * nor may "OpenSSL" appear in their names without prior written
85 * permission of the OpenSSL Project.
86 *
87 * 6. Redistributions of any form whatsoever must retain the following
88 * acknowledgment:
89 * "This product includes software developed by the OpenSSL Project
90 * for use in the OpenSSL Toolkit (http://www.openssl.org/)"
91 *
92 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
93 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
94 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
95 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
96 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
97 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
98 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
99 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
100 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
101 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
102 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
103 * OF THE POSSIBILITY OF SUCH DAMAGE.
104 * ====================================================================
105 *
106 * This product includes cryptographic software written by Eric Young
107 * (eay@cryptsoft.com). This product includes software written by Tim
108 * Hudson (tjh@cryptsoft.com).
109 *
110 */
111#include <stdio.h>
112
113#define USE_SOCKETS
114#include "e_os.h"
115#include "cryptlib.h"
116#include <openssl/rand.h>
117#include "rand_lcl.h"
118
119#if !(defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_WIN32) || defined(OPENSSL_SYS_VMS) || defined(OPENSSL_SYS_OS2) || defined(OPENSSL_SYS_VXWORKS) || defined(OPENSSL_SYS_NETWARE))
120
121#include <sys/types.h>
122#include <sys/time.h>
123#include <sys/times.h>
124#include <sys/stat.h>
125#include <fcntl.h>
126#include <unistd.h>
127#include <time.h>
128#if defined(OPENSSL_SYS_LINUX) /* should actually be available virtually everywhere */
129# include <poll.h>
130#endif
131#include <limits.h>
132#ifndef FD_SETSIZE
133# define FD_SETSIZE (8*sizeof(fd_set))
134#endif
135
136#if defined(OPENSSL_SYS_VOS)
137
138/* The following algorithm repeatedly samples the real-time clock
139 (RTC) to generate a sequence of unpredictable data. The algorithm
140 relies upon the uneven execution speed of the code (due to factors
141 such as cache misses, interrupts, bus activity, and scheduling) and
142 upon the rather large relative difference between the speed of the
143 clock and the rate at which it can be read.
144
145 If this code is ported to an environment where execution speed is
146 more constant or where the RTC ticks at a much slower rate, or the
147 clock can be read with fewer instructions, it is likely that the
148 results would be far more predictable.
149
150 As a precaution, we generate 4 times the minimum required amount of
151 seed data. */
152
153int RAND_poll(void)
154{
155 short int code;
156 gid_t curr_gid;
157 pid_t curr_pid;
158 uid_t curr_uid;
159 int i, k;
160 struct timespec ts;
161 unsigned char v;
162
163#ifdef OPENSSL_SYS_VOS_HPPA
164 long duration;
165 extern void s$sleep (long *_duration, short int *_code);
166#else
167#ifdef OPENSSL_SYS_VOS_IA32
168 long long duration;
169 extern void s$sleep2 (long long *_duration, short int *_code);
170#else
171#error "Unsupported Platform."
172#endif /* OPENSSL_SYS_VOS_IA32 */
173#endif /* OPENSSL_SYS_VOS_HPPA */
174
175 /* Seed with the gid, pid, and uid, to ensure *some*
176 variation between different processes. */
177
178 curr_gid = getgid();
179 RAND_add (&curr_gid, sizeof curr_gid, 1);
180 curr_gid = 0;
181
182 curr_pid = getpid();
183 RAND_add (&curr_pid, sizeof curr_pid, 1);
184 curr_pid = 0;
185
186 curr_uid = getuid();
187 RAND_add (&curr_uid, sizeof curr_uid, 1);
188 curr_uid = 0;
189
190 for (i=0; i<(ENTROPY_NEEDED*4); i++)
191 {
192 /* burn some cpu; hope for interrupts, cache
193 collisions, bus interference, etc. */
194 for (k=0; k<99; k++)
195 ts.tv_nsec = random ();
196
197#ifdef OPENSSL_SYS_VOS_HPPA
198 /* sleep for 1/1024 of a second (976 us). */
199 duration = 1;
200 s$sleep (&duration, &code);
201#else
202#ifdef OPENSSL_SYS_VOS_IA32
203 /* sleep for 1/65536 of a second (15 us). */
204 duration = 1;
205 s$sleep2 (&duration, &code);
206#endif /* OPENSSL_SYS_VOS_IA32 */
207#endif /* OPENSSL_SYS_VOS_HPPA */
208
209 /* get wall clock time. */
210 clock_gettime (CLOCK_REALTIME, &ts);
211
212 /* take 8 bits */
213 v = (unsigned char) (ts.tv_nsec % 256);
214 RAND_add (&v, sizeof v, 1);
215 v = 0;
216 }
217 return 1;
218}
219#elif defined __OpenBSD__
220int RAND_poll(void)
221{
222 unsigned char buf[ENTROPY_NEEDED];
223
224 arc4random_buf(buf, sizeof(buf));
225 RAND_add(buf, sizeof(buf), sizeof(buf));
226 memset(buf, 0, sizeof(buf));
227
228 return 1;
229}
230#else /* !defined(__OpenBSD__) */
231int RAND_poll(void)
232{
233 unsigned long l;
234 pid_t curr_pid = getpid();
235#if defined(DEVRANDOM) || defined(DEVRANDOM_EGD)
236 unsigned char tmpbuf[ENTROPY_NEEDED];
237 int n = 0;
238#endif
239#ifdef DEVRANDOM
240 static const char *randomfiles[] = { DEVRANDOM };
241 struct stat randomstats[sizeof(randomfiles)/sizeof(randomfiles[0])];
242 int fd;
243 unsigned int i;
244#endif
245#ifdef DEVRANDOM_EGD
246 static const char *egdsockets[] = { DEVRANDOM_EGD, NULL };
247 const char **egdsocket = NULL;
248#endif
249
250#ifdef DEVRANDOM
251 memset(randomstats,0,sizeof(randomstats));
252 /* Use a random entropy pool device. Linux, FreeBSD and OpenBSD
253 * have this. Use /dev/urandom if you can as /dev/random may block
254 * if it runs out of random entries. */
255
256 for (i = 0; (i < sizeof(randomfiles)/sizeof(randomfiles[0])) &&
257 (n < ENTROPY_NEEDED); i++)
258 {
259 if ((fd = open(randomfiles[i], O_RDONLY
260#ifdef O_NONBLOCK
261 |O_NONBLOCK
262#endif
263#ifdef O_BINARY
264 |O_BINARY
265#endif
266#ifdef O_NOCTTY /* If it happens to be a TTY (god forbid), do not make it
267 our controlling tty */
268 |O_NOCTTY
269#endif
270 )) >= 0)
271 {
272 int usec = 10*1000; /* spend 10ms on each file */
273 int r;
274 unsigned int j;
275 struct stat *st=&randomstats[i];
276
277 /* Avoid using same input... Used to be O_NOFOLLOW
278 * above, but it's not universally appropriate... */
279 if (fstat(fd,st) != 0) { close(fd); continue; }
280 for (j=0;j<i;j++)
281 {
282 if (randomstats[j].st_ino==st->st_ino &&
283 randomstats[j].st_dev==st->st_dev)
284 break;
285 }
286 if (j<i) { close(fd); continue; }
287
288 do
289 {
290 int try_read = 0;
291
292#if defined(OPENSSL_SYS_BEOS_R5)
293 /* select() is broken in BeOS R5, so we simply
294 * try to read something and snooze if we couldn't */
295 try_read = 1;
296
297#elif defined(OPENSSL_SYS_LINUX)
298 /* use poll() */
299 struct pollfd pset;
300
301 pset.fd = fd;
302 pset.events = POLLIN;
303 pset.revents = 0;
304
305 if (poll(&pset, 1, usec / 1000) < 0)
306 usec = 0;
307 else
308 try_read = (pset.revents & POLLIN) != 0;
309
310#else
311 /* use select() */
312 fd_set fset;
313 struct timeval t;
314
315 t.tv_sec = 0;
316 t.tv_usec = usec;
317
318 if (FD_SETSIZE > 0 && (unsigned)fd >= FD_SETSIZE)
319 {
320 /* can't use select, so just try to read once anyway */
321 try_read = 1;
322 }
323 else
324 {
325 FD_ZERO(&fset);
326 FD_SET(fd, &fset);
327
328 if (select(fd+1,&fset,NULL,NULL,&t) >= 0)
329 {
330 usec = t.tv_usec;
331 if (FD_ISSET(fd, &fset))
332 try_read = 1;
333 }
334 else
335 usec = 0;
336 }
337#endif
338
339 if (try_read)
340 {
341 r = read(fd,(unsigned char *)tmpbuf+n, ENTROPY_NEEDED-n);
342 if (r > 0)
343 n += r;
344#if defined(OPENSSL_SYS_BEOS_R5)
345 if (r == 0)
346 snooze(t.tv_usec);
347#endif
348 }
349 else
350 r = -1;
351
352 /* Some Unixen will update t in select(), some
353 won't. For those who won't, or if we
354 didn't use select() in the first place,
355 give up here, otherwise, we will do
356 this once again for the remaining
357 time. */
358 if (usec == 10*1000)
359 usec = 0;
360 }
361 while ((r > 0 ||
362 (errno == EINTR || errno == EAGAIN)) && usec != 0 && n < ENTROPY_NEEDED);
363
364 close(fd);
365 }
366 }
367#endif /* defined(DEVRANDOM) */
368
369#ifdef DEVRANDOM_EGD
370 /* Use an EGD socket to read entropy from an EGD or PRNGD entropy
371 * collecting daemon. */
372
373 for (egdsocket = egdsockets; *egdsocket && n < ENTROPY_NEEDED; egdsocket++)
374 {
375 int r;
376
377 r = RAND_query_egd_bytes(*egdsocket, (unsigned char *)tmpbuf+n,
378 ENTROPY_NEEDED-n);
379 if (r > 0)
380 n += r;
381 }
382#endif /* defined(DEVRANDOM_EGD) */
383
384#if defined(DEVRANDOM) || defined(DEVRANDOM_EGD)
385 if (n > 0)
386 {
387 RAND_add(tmpbuf,sizeof tmpbuf,(double)n);
388 OPENSSL_cleanse(tmpbuf,n);
389 }
390#endif
391
392 /* put in some default random data, we need more than just this */
393 l=curr_pid;
394 RAND_add(&l,sizeof(l),0.0);
395 l=getuid();
396 RAND_add(&l,sizeof(l),0.0);
397
398 l=time(NULL);
399 RAND_add(&l,sizeof(l),0.0);
400
401#if defined(OPENSSL_SYS_BEOS)
402 {
403 system_info sysInfo;
404 get_system_info(&sysInfo);
405 RAND_add(&sysInfo,sizeof(sysInfo),0);
406 }
407#endif
408
409#if defined(DEVRANDOM) || defined(DEVRANDOM_EGD)
410 return 1;
411#else
412 return 0;
413#endif
414}
415
416#endif /* defined(__OpenBSD__) */
417#endif /* !(defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_WIN32) || defined(OPENSSL_SYS_VMS) || defined(OPENSSL_SYS_OS2) || defined(OPENSSL_SYS_VXWORKS) || defined(OPENSSL_SYS_NETWARE)) */
418
419
420#if defined(OPENSSL_SYS_VXWORKS)
421int RAND_poll(void)
422 {
423 return 0;
424 }
425#endif
diff --git a/src/lib/libcrypto/rand/rand_vms.c b/src/lib/libcrypto/rand/rand_vms.c
new file mode 100644
index 0000000000..0bfd8ff7e4
--- /dev/null
+++ b/src/lib/libcrypto/rand/rand_vms.c
@@ -0,0 +1,148 @@
1/* crypto/rand/rand_vms.c -*- mode:C; c-file-style: "eay" -*- */
2/* Written by Richard Levitte <richard@levitte.org> for the OpenSSL
3 * project 2000.
4 */
5/* ====================================================================
6 * Copyright (c) 1998-2000 The OpenSSL Project. All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 *
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 *
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in
17 * the documentation and/or other materials provided with the
18 * distribution.
19 *
20 * 3. All advertising materials mentioning features or use of this
21 * software must display the following acknowledgment:
22 * "This product includes software developed by the OpenSSL Project
23 * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
24 *
25 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
26 * endorse or promote products derived from this software without
27 * prior written permission. For written permission, please contact
28 * openssl-core@openssl.org.
29 *
30 * 5. Products derived from this software may not be called "OpenSSL"
31 * nor may "OpenSSL" appear in their names without prior written
32 * permission of the OpenSSL Project.
33 *
34 * 6. Redistributions of any form whatsoever must retain the following
35 * acknowledgment:
36 * "This product includes software developed by the OpenSSL Project
37 * for use in the OpenSSL Toolkit (http://www.openssl.org/)"
38 *
39 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
40 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
41 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
42 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
43 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
44 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
45 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
46 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
47 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
48 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
49 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50 * OF THE POSSIBILITY OF SUCH DAMAGE.
51 * ====================================================================
52 *
53 * This product includes cryptographic software written by Eric Young
54 * (eay@cryptsoft.com). This product includes software written by Tim
55 * Hudson (tjh@cryptsoft.com).
56 *
57 */
58
59#include <openssl/rand.h>
60#include "rand_lcl.h"
61
62#if defined(OPENSSL_SYS_VMS)
63
64#include <descrip.h>
65#include <jpidef.h>
66#include <ssdef.h>
67#include <starlet.h>
68#ifdef __DECC
69# pragma message disable DOLLARID
70#endif
71
72/* Use 32-bit pointers almost everywhere. Define the type to which to
73 * cast a pointer passed to an external function.
74 */
75#if __INITIAL_POINTER_SIZE == 64
76# define PTR_T __void_ptr64
77# pragma pointer_size save
78# pragma pointer_size 32
79#else /* __INITIAL_POINTER_SIZE == 64 */
80# define PTR_T void *
81#endif /* __INITIAL_POINTER_SIZE == 64 [else] */
82
83static struct items_data_st
84 {
85 short length, code; /* length is amount of bytes */
86 } items_data[] =
87 { { 4, JPI$_BUFIO },
88 { 4, JPI$_CPUTIM },
89 { 4, JPI$_DIRIO },
90 { 8, JPI$_LOGINTIM },
91 { 4, JPI$_PAGEFLTS },
92 { 4, JPI$_PID },
93 { 4, JPI$_WSSIZE },
94 { 0, 0 }
95 };
96
97int RAND_poll(void)
98 {
99 long pid, iosb[2];
100 int status = 0;
101 struct
102 {
103 short length, code;
104 long *buffer;
105 int *retlen;
106 } item[32], *pitem;
107 unsigned char data_buffer[256];
108 short total_length = 0;
109 struct items_data_st *pitems_data;
110
111 pitems_data = items_data;
112 pitem = item;
113
114 /* Setup */
115 while (pitems_data->length
116 && (total_length + pitems_data->length <= 256))
117 {
118 pitem->length = pitems_data->length;
119 pitem->code = pitems_data->code;
120 pitem->buffer = (long *)&data_buffer[total_length];
121 pitem->retlen = 0;
122 total_length += pitems_data->length;
123 pitems_data++;
124 pitem++;
125 }
126 pitem->length = pitem->code = 0;
127
128 /*
129 * Scan through all the processes in the system and add entropy with
130 * results from the processes that were possible to look at.
131 * However, view the information as only half trustable.
132 */
133 pid = -1; /* search context */
134 while ((status = sys$getjpiw(0, &pid, 0, item, iosb, 0, 0))
135 != SS$_NOMOREPROC)
136 {
137 if (status == SS$_NORMAL)
138 {
139 RAND_add( (PTR_T)data_buffer, total_length,
140 total_length/2);
141 }
142 }
143 sys$gettim(iosb);
144 RAND_add( (PTR_T)iosb, sizeof(iosb), sizeof(iosb)/2);
145 return 1;
146}
147
148#endif
diff --git a/src/lib/libcrypto/rand/rand_win.c b/src/lib/libcrypto/rand/rand_win.c
new file mode 100644
index 0000000000..5d134e186b
--- /dev/null
+++ b/src/lib/libcrypto/rand/rand_win.c
@@ -0,0 +1,807 @@
1/* crypto/rand/rand_win.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58/* ====================================================================
59 * Copyright (c) 1998-2000 The OpenSSL Project. All rights reserved.
60 *
61 * Redistribution and use in source and binary forms, with or without
62 * modification, are permitted provided that the following conditions
63 * are met:
64 *
65 * 1. Redistributions of source code must retain the above copyright
66 * notice, this list of conditions and the following disclaimer.
67 *
68 * 2. Redistributions in binary form must reproduce the above copyright
69 * notice, this list of conditions and the following disclaimer in
70 * the documentation and/or other materials provided with the
71 * distribution.
72 *
73 * 3. All advertising materials mentioning features or use of this
74 * software must display the following acknowledgment:
75 * "This product includes software developed by the OpenSSL Project
76 * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
77 *
78 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
79 * endorse or promote products derived from this software without
80 * prior written permission. For written permission, please contact
81 * openssl-core@openssl.org.
82 *
83 * 5. Products derived from this software may not be called "OpenSSL"
84 * nor may "OpenSSL" appear in their names without prior written
85 * permission of the OpenSSL Project.
86 *
87 * 6. Redistributions of any form whatsoever must retain the following
88 * acknowledgment:
89 * "This product includes software developed by the OpenSSL Project
90 * for use in the OpenSSL Toolkit (http://www.openssl.org/)"
91 *
92 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
93 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
94 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
95 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
96 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
97 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
98 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
99 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
100 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
101 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
102 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
103 * OF THE POSSIBILITY OF SUCH DAMAGE.
104 * ====================================================================
105 *
106 * This product includes cryptographic software written by Eric Young
107 * (eay@cryptsoft.com). This product includes software written by Tim
108 * Hudson (tjh@cryptsoft.com).
109 *
110 */
111
112#include "cryptlib.h"
113#include <openssl/rand.h>
114#include "rand_lcl.h"
115
116#if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_WIN32)
117#include <windows.h>
118#ifndef _WIN32_WINNT
119# define _WIN32_WINNT 0x0400
120#endif
121#include <wincrypt.h>
122#include <tlhelp32.h>
123
124/* Limit the time spent walking through the heap, processes, threads and modules to
125 a maximum of 1000 miliseconds each, unless CryptoGenRandom failed */
126#define MAXDELAY 1000
127
128/* Intel hardware RNG CSP -- available from
129 * http://developer.intel.com/design/security/rng/redist_license.htm
130 */
131#define PROV_INTEL_SEC 22
132#define INTEL_DEF_PROV L"Intel Hardware Cryptographic Service Provider"
133
134static void readtimer(void);
135static void readscreen(void);
136
137/* It appears like CURSORINFO, PCURSORINFO and LPCURSORINFO are only defined
138 when WINVER is 0x0500 and up, which currently only happens on Win2000.
139 Unfortunately, those are typedefs, so they're a little bit difficult to
140 detect properly. On the other hand, the macro CURSOR_SHOWING is defined
141 within the same conditional, so it can be use to detect the absence of said
142 typedefs. */
143
144#ifndef CURSOR_SHOWING
145/*
146 * Information about the global cursor.
147 */
148typedef struct tagCURSORINFO
149{
150 DWORD cbSize;
151 DWORD flags;
152 HCURSOR hCursor;
153 POINT ptScreenPos;
154} CURSORINFO, *PCURSORINFO, *LPCURSORINFO;
155
156#define CURSOR_SHOWING 0x00000001
157#endif /* CURSOR_SHOWING */
158
159#if !defined(OPENSSL_SYS_WINCE)
160typedef BOOL (WINAPI *CRYPTACQUIRECONTEXTW)(HCRYPTPROV *, LPCWSTR, LPCWSTR,
161 DWORD, DWORD);
162typedef BOOL (WINAPI *CRYPTGENRANDOM)(HCRYPTPROV, DWORD, BYTE *);
163typedef BOOL (WINAPI *CRYPTRELEASECONTEXT)(HCRYPTPROV, DWORD);
164
165typedef HWND (WINAPI *GETFOREGROUNDWINDOW)(VOID);
166typedef BOOL (WINAPI *GETCURSORINFO)(PCURSORINFO);
167typedef DWORD (WINAPI *GETQUEUESTATUS)(UINT);
168
169typedef HANDLE (WINAPI *CREATETOOLHELP32SNAPSHOT)(DWORD, DWORD);
170typedef BOOL (WINAPI *CLOSETOOLHELP32SNAPSHOT)(HANDLE);
171typedef BOOL (WINAPI *HEAP32FIRST)(LPHEAPENTRY32, DWORD, size_t);
172typedef BOOL (WINAPI *HEAP32NEXT)(LPHEAPENTRY32);
173typedef BOOL (WINAPI *HEAP32LIST)(HANDLE, LPHEAPLIST32);
174typedef BOOL (WINAPI *PROCESS32)(HANDLE, LPPROCESSENTRY32);
175typedef BOOL (WINAPI *THREAD32)(HANDLE, LPTHREADENTRY32);
176typedef BOOL (WINAPI *MODULE32)(HANDLE, LPMODULEENTRY32);
177
178#include <lmcons.h>
179#include <lmstats.h>
180#if 1 /* The NET API is Unicode only. It requires the use of the UNICODE
181 * macro. When UNICODE is defined LPTSTR becomes LPWSTR. LMSTR was
182 * was added to the Platform SDK to allow the NET API to be used in
183 * non-Unicode applications provided that Unicode strings were still
184 * used for input. LMSTR is defined as LPWSTR.
185 */
186typedef NET_API_STATUS (NET_API_FUNCTION * NETSTATGET)
187 (LPWSTR, LPWSTR, DWORD, DWORD, LPBYTE*);
188typedef NET_API_STATUS (NET_API_FUNCTION * NETFREE)(LPBYTE);
189#endif /* 1 */
190#endif /* !OPENSSL_SYS_WINCE */
191
192int RAND_poll(void)
193{
194 MEMORYSTATUS m;
195 HCRYPTPROV hProvider = 0;
196 DWORD w;
197 int good = 0;
198
199 /* Determine the OS version we are on so we can turn off things
200 * that do not work properly.
201 */
202 OSVERSIONINFO osverinfo ;
203 osverinfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO) ;
204 GetVersionEx( &osverinfo ) ;
205
206#if defined(OPENSSL_SYS_WINCE)
207# if defined(_WIN32_WCE) && _WIN32_WCE>=300
208/* Even though MSDN says _WIN32_WCE>=210, it doesn't seem to be available
209 * in commonly available implementations prior 300... */
210 {
211 BYTE buf[64];
212 /* poll the CryptoAPI PRNG */
213 /* The CryptoAPI returns sizeof(buf) bytes of randomness */
214 if (CryptAcquireContextW(&hProvider, NULL, NULL, PROV_RSA_FULL,
215 CRYPT_VERIFYCONTEXT))
216 {
217 if (CryptGenRandom(hProvider, sizeof(buf), buf))
218 RAND_add(buf, sizeof(buf), sizeof(buf));
219 CryptReleaseContext(hProvider, 0);
220 }
221 }
222# endif
223#else /* OPENSSL_SYS_WINCE */
224 /*
225 * None of below libraries are present on Windows CE, which is
226 * why we #ifndef the whole section. This also excuses us from
227 * handling the GetProcAddress issue. The trouble is that in
228 * real Win32 API GetProcAddress is available in ANSI flavor
229 * only. In WinCE on the other hand GetProcAddress is a macro
230 * most commonly defined as GetProcAddressW, which accepts
231 * Unicode argument. If we were to call GetProcAddress under
232 * WinCE, I'd recommend to either redefine GetProcAddress as
233 * GetProcAddressA (there seem to be one in common CE spec) or
234 * implement own shim routine, which would accept ANSI argument
235 * and expand it to Unicode.
236 */
237 {
238 /* load functions dynamically - not available on all systems */
239 HMODULE advapi = LoadLibrary(TEXT("ADVAPI32.DLL"));
240 HMODULE kernel = LoadLibrary(TEXT("KERNEL32.DLL"));
241 HMODULE user = NULL;
242 HMODULE netapi = LoadLibrary(TEXT("NETAPI32.DLL"));
243 CRYPTACQUIRECONTEXTW acquire = NULL;
244 CRYPTGENRANDOM gen = NULL;
245 CRYPTRELEASECONTEXT release = NULL;
246 NETSTATGET netstatget = NULL;
247 NETFREE netfree = NULL;
248 BYTE buf[64];
249
250 if (netapi)
251 {
252 netstatget = (NETSTATGET) GetProcAddress(netapi,"NetStatisticsGet");
253 netfree = (NETFREE) GetProcAddress(netapi,"NetApiBufferFree");
254 }
255
256 if (netstatget && netfree)
257 {
258 LPBYTE outbuf;
259 /* NetStatisticsGet() is a Unicode only function
260 * STAT_WORKSTATION_0 contains 45 fields and STAT_SERVER_0
261 * contains 17 fields. We treat each field as a source of
262 * one byte of entropy.
263 */
264
265 if (netstatget(NULL, L"LanmanWorkstation", 0, 0, &outbuf) == 0)
266 {
267 RAND_add(outbuf, sizeof(STAT_WORKSTATION_0), 45);
268 netfree(outbuf);
269 }
270 if (netstatget(NULL, L"LanmanServer", 0, 0, &outbuf) == 0)
271 {
272 RAND_add(outbuf, sizeof(STAT_SERVER_0), 17);
273 netfree(outbuf);
274 }
275 }
276
277 if (netapi)
278 FreeLibrary(netapi);
279
280 /* It appears like this can cause an exception deep within ADVAPI32.DLL
281 * at random times on Windows 2000. Reported by Jeffrey Altman.
282 * Only use it on NT.
283 */
284 /* Wolfgang Marczy <WMarczy@topcall.co.at> reports that
285 * the RegQueryValueEx call below can hang on NT4.0 (SP6).
286 * So we don't use this at all for now. */
287#if 0
288 if ( osverinfo.dwPlatformId == VER_PLATFORM_WIN32_NT &&
289 osverinfo.dwMajorVersion < 5)
290 {
291 /* Read Performance Statistics from NT/2000 registry
292 * The size of the performance data can vary from call
293 * to call so we must guess the size of the buffer to use
294 * and increase its size if we get an ERROR_MORE_DATA
295 * return instead of ERROR_SUCCESS.
296 */
297 LONG rc=ERROR_MORE_DATA;
298 char * buf=NULL;
299 DWORD bufsz=0;
300 DWORD length;
301
302 while (rc == ERROR_MORE_DATA)
303 {
304 buf = realloc(buf,bufsz+8192);
305 if (!buf)
306 break;
307 bufsz += 8192;
308
309 length = bufsz;
310 rc = RegQueryValueEx(HKEY_PERFORMANCE_DATA, TEXT("Global"),
311 NULL, NULL, buf, &length);
312 }
313 if (rc == ERROR_SUCCESS)
314 {
315 /* For entropy count assume only least significant
316 * byte of each DWORD is random.
317 */
318 RAND_add(&length, sizeof(length), 0);
319 RAND_add(buf, length, length / 4.0);
320
321 /* Close the Registry Key to allow Windows to cleanup/close
322 * the open handle
323 * Note: The 'HKEY_PERFORMANCE_DATA' key is implicitly opened
324 * when the RegQueryValueEx above is done. However, if
325 * it is not explicitly closed, it can cause disk
326 * partition manipulation problems.
327 */
328 RegCloseKey(HKEY_PERFORMANCE_DATA);
329 }
330 if (buf)
331 free(buf);
332 }
333#endif
334
335 if (advapi)
336 {
337 /*
338 * If it's available, then it's available in both ANSI
339 * and UNICODE flavors even in Win9x, documentation says.
340 * We favor Unicode...
341 */
342 acquire = (CRYPTACQUIRECONTEXTW) GetProcAddress(advapi,
343 "CryptAcquireContextW");
344 gen = (CRYPTGENRANDOM) GetProcAddress(advapi,
345 "CryptGenRandom");
346 release = (CRYPTRELEASECONTEXT) GetProcAddress(advapi,
347 "CryptReleaseContext");
348 }
349
350 if (acquire && gen && release)
351 {
352 /* poll the CryptoAPI PRNG */
353 /* The CryptoAPI returns sizeof(buf) bytes of randomness */
354 if (acquire(&hProvider, NULL, NULL, PROV_RSA_FULL,
355 CRYPT_VERIFYCONTEXT))
356 {
357 if (gen(hProvider, sizeof(buf), buf) != 0)
358 {
359 RAND_add(buf, sizeof(buf), 0);
360 good = 1;
361#if 0
362 printf("randomness from PROV_RSA_FULL\n");
363#endif
364 }
365 release(hProvider, 0);
366 }
367
368 /* poll the Pentium PRG with CryptoAPI */
369 if (acquire(&hProvider, 0, INTEL_DEF_PROV, PROV_INTEL_SEC, 0))
370 {
371 if (gen(hProvider, sizeof(buf), buf) != 0)
372 {
373 RAND_add(buf, sizeof(buf), sizeof(buf));
374 good = 1;
375#if 0
376 printf("randomness from PROV_INTEL_SEC\n");
377#endif
378 }
379 release(hProvider, 0);
380 }
381 }
382
383 if (advapi)
384 FreeLibrary(advapi);
385
386 if ((osverinfo.dwPlatformId != VER_PLATFORM_WIN32_NT ||
387 !OPENSSL_isservice()) &&
388 (user = LoadLibrary(TEXT("USER32.DLL"))))
389 {
390 GETCURSORINFO cursor;
391 GETFOREGROUNDWINDOW win;
392 GETQUEUESTATUS queue;
393
394 win = (GETFOREGROUNDWINDOW) GetProcAddress(user, "GetForegroundWindow");
395 cursor = (GETCURSORINFO) GetProcAddress(user, "GetCursorInfo");
396 queue = (GETQUEUESTATUS) GetProcAddress(user, "GetQueueStatus");
397
398 if (win)
399 {
400 /* window handle */
401 HWND h = win();
402 RAND_add(&h, sizeof(h), 0);
403 }
404 if (cursor)
405 {
406 /* unfortunately, its not safe to call GetCursorInfo()
407 * on NT4 even though it exists in SP3 (or SP6) and
408 * higher.
409 */
410 if ( osverinfo.dwPlatformId == VER_PLATFORM_WIN32_NT &&
411 osverinfo.dwMajorVersion < 5)
412 cursor = 0;
413 }
414 if (cursor)
415 {
416 /* cursor position */
417 /* assume 2 bytes of entropy */
418 CURSORINFO ci;
419 ci.cbSize = sizeof(CURSORINFO);
420 if (cursor(&ci))
421 RAND_add(&ci, ci.cbSize, 2);
422 }
423
424 if (queue)
425 {
426 /* message queue status */
427 /* assume 1 byte of entropy */
428 w = queue(QS_ALLEVENTS);
429 RAND_add(&w, sizeof(w), 1);
430 }
431
432 FreeLibrary(user);
433 }
434
435 /* Toolhelp32 snapshot: enumerate processes, threads, modules and heap
436 * http://msdn.microsoft.com/library/psdk/winbase/toolhelp_5pfd.htm
437 * (Win 9x and 2000 only, not available on NT)
438 *
439 * This seeding method was proposed in Peter Gutmann, Software
440 * Generation of Practically Strong Random Numbers,
441 * http://www.usenix.org/publications/library/proceedings/sec98/gutmann.html
442 * revised version at http://www.cryptoengines.com/~peter/06_random.pdf
443 * (The assignment of entropy estimates below is arbitrary, but based
444 * on Peter's analysis the full poll appears to be safe. Additional
445 * interactive seeding is encouraged.)
446 */
447
448 if (kernel)
449 {
450 CREATETOOLHELP32SNAPSHOT snap;
451 CLOSETOOLHELP32SNAPSHOT close_snap;
452 HANDLE handle;
453
454 HEAP32FIRST heap_first;
455 HEAP32NEXT heap_next;
456 HEAP32LIST heaplist_first, heaplist_next;
457 PROCESS32 process_first, process_next;
458 THREAD32 thread_first, thread_next;
459 MODULE32 module_first, module_next;
460
461 HEAPLIST32 hlist;
462 HEAPENTRY32 hentry;
463 PROCESSENTRY32 p;
464 THREADENTRY32 t;
465 MODULEENTRY32 m;
466 DWORD starttime = 0;
467
468 snap = (CREATETOOLHELP32SNAPSHOT)
469 GetProcAddress(kernel, "CreateToolhelp32Snapshot");
470 close_snap = (CLOSETOOLHELP32SNAPSHOT)
471 GetProcAddress(kernel, "CloseToolhelp32Snapshot");
472 heap_first = (HEAP32FIRST) GetProcAddress(kernel, "Heap32First");
473 heap_next = (HEAP32NEXT) GetProcAddress(kernel, "Heap32Next");
474 heaplist_first = (HEAP32LIST) GetProcAddress(kernel, "Heap32ListFirst");
475 heaplist_next = (HEAP32LIST) GetProcAddress(kernel, "Heap32ListNext");
476 process_first = (PROCESS32) GetProcAddress(kernel, "Process32First");
477 process_next = (PROCESS32) GetProcAddress(kernel, "Process32Next");
478 thread_first = (THREAD32) GetProcAddress(kernel, "Thread32First");
479 thread_next = (THREAD32) GetProcAddress(kernel, "Thread32Next");
480 module_first = (MODULE32) GetProcAddress(kernel, "Module32First");
481 module_next = (MODULE32) GetProcAddress(kernel, "Module32Next");
482
483 if (snap && heap_first && heap_next && heaplist_first &&
484 heaplist_next && process_first && process_next &&
485 thread_first && thread_next && module_first &&
486 module_next && (handle = snap(TH32CS_SNAPALL,0))
487 != INVALID_HANDLE_VALUE)
488 {
489 /* heap list and heap walking */
490 /* HEAPLIST32 contains 3 fields that will change with
491 * each entry. Consider each field a source of 1 byte
492 * of entropy.
493 * HEAPENTRY32 contains 5 fields that will change with
494 * each entry. Consider each field a source of 1 byte
495 * of entropy.
496 */
497 ZeroMemory(&hlist, sizeof(HEAPLIST32));
498 hlist.dwSize = sizeof(HEAPLIST32);
499 if (good) starttime = GetTickCount();
500#ifdef _MSC_VER
501 if (heaplist_first(handle, &hlist))
502 {
503 /*
504 following discussion on dev ML, exception on WinCE (or other Win
505 platform) is theoretically of unknown origin; prevent infinite
506 loop here when this theoretical case occurs; otherwise cope with
507 the expected (MSDN documented) exception-throwing behaviour of
508 Heap32Next() on WinCE.
509
510 based on patch in original message by Tanguy Fautré (2009/03/02)
511 Subject: RAND_poll() and CreateToolhelp32Snapshot() stability
512 */
513 int ex_cnt_limit = 42;
514 do
515 {
516 RAND_add(&hlist, hlist.dwSize, 3);
517 __try
518 {
519 ZeroMemory(&hentry, sizeof(HEAPENTRY32));
520 hentry.dwSize = sizeof(HEAPENTRY32);
521 if (heap_first(&hentry,
522 hlist.th32ProcessID,
523 hlist.th32HeapID))
524 {
525 int entrycnt = 80;
526 do
527 RAND_add(&hentry,
528 hentry.dwSize, 5);
529 while (heap_next(&hentry)
530 && (!good || (GetTickCount()-starttime)<MAXDELAY)
531 && --entrycnt > 0);
532 }
533 }
534 __except (EXCEPTION_EXECUTE_HANDLER)
535 {
536 /* ignore access violations when walking the heap list */
537 ex_cnt_limit--;
538 }
539 } while (heaplist_next(handle, &hlist)
540 && (!good || (GetTickCount()-starttime)<MAXDELAY)
541 && ex_cnt_limit > 0);
542 }
543
544#else
545 if (heaplist_first(handle, &hlist))
546 {
547 do
548 {
549 RAND_add(&hlist, hlist.dwSize, 3);
550 hentry.dwSize = sizeof(HEAPENTRY32);
551 if (heap_first(&hentry,
552 hlist.th32ProcessID,
553 hlist.th32HeapID))
554 {
555 int entrycnt = 80;
556 do
557 RAND_add(&hentry,
558 hentry.dwSize, 5);
559 while (heap_next(&hentry)
560 && --entrycnt > 0);
561 }
562 } while (heaplist_next(handle, &hlist)
563 && (!good || (GetTickCount()-starttime)<MAXDELAY));
564 }
565#endif
566
567 /* process walking */
568 /* PROCESSENTRY32 contains 9 fields that will change
569 * with each entry. Consider each field a source of
570 * 1 byte of entropy.
571 */
572 p.dwSize = sizeof(PROCESSENTRY32);
573
574 if (good) starttime = GetTickCount();
575 if (process_first(handle, &p))
576 do
577 RAND_add(&p, p.dwSize, 9);
578 while (process_next(handle, &p) && (!good || (GetTickCount()-starttime)<MAXDELAY));
579
580 /* thread walking */
581 /* THREADENTRY32 contains 6 fields that will change
582 * with each entry. Consider each field a source of
583 * 1 byte of entropy.
584 */
585 t.dwSize = sizeof(THREADENTRY32);
586 if (good) starttime = GetTickCount();
587 if (thread_first(handle, &t))
588 do
589 RAND_add(&t, t.dwSize, 6);
590 while (thread_next(handle, &t) && (!good || (GetTickCount()-starttime)<MAXDELAY));
591
592 /* module walking */
593 /* MODULEENTRY32 contains 9 fields that will change
594 * with each entry. Consider each field a source of
595 * 1 byte of entropy.
596 */
597 m.dwSize = sizeof(MODULEENTRY32);
598 if (good) starttime = GetTickCount();
599 if (module_first(handle, &m))
600 do
601 RAND_add(&m, m.dwSize, 9);
602 while (module_next(handle, &m)
603 && (!good || (GetTickCount()-starttime)<MAXDELAY));
604 if (close_snap)
605 close_snap(handle);
606 else
607 CloseHandle(handle);
608
609 }
610
611 FreeLibrary(kernel);
612 }
613 }
614#endif /* !OPENSSL_SYS_WINCE */
615
616 /* timer data */
617 readtimer();
618
619 /* memory usage statistics */
620 GlobalMemoryStatus(&m);
621 RAND_add(&m, sizeof(m), 1);
622
623 /* process ID */
624 w = GetCurrentProcessId();
625 RAND_add(&w, sizeof(w), 1);
626
627#if 0
628 printf("Exiting RAND_poll\n");
629#endif
630
631 return(1);
632}
633
634int RAND_event(UINT iMsg, WPARAM wParam, LPARAM lParam)
635 {
636 double add_entropy=0;
637
638 switch (iMsg)
639 {
640 case WM_KEYDOWN:
641 {
642 static WPARAM key;
643 if (key != wParam)
644 add_entropy = 0.05;
645 key = wParam;
646 }
647 break;
648 case WM_MOUSEMOVE:
649 {
650 static int lastx,lasty,lastdx,lastdy;
651 int x,y,dx,dy;
652
653 x=LOWORD(lParam);
654 y=HIWORD(lParam);
655 dx=lastx-x;
656 dy=lasty-y;
657 if (dx != 0 && dy != 0 && dx-lastdx != 0 && dy-lastdy != 0)
658 add_entropy=.2;
659 lastx=x, lasty=y;
660 lastdx=dx, lastdy=dy;
661 }
662 break;
663 }
664
665 readtimer();
666 RAND_add(&iMsg, sizeof(iMsg), add_entropy);
667 RAND_add(&wParam, sizeof(wParam), 0);
668 RAND_add(&lParam, sizeof(lParam), 0);
669
670 return (RAND_status());
671 }
672
673
674void RAND_screen(void) /* function available for backward compatibility */
675{
676 RAND_poll();
677 readscreen();
678}
679
680
681/* feed timing information to the PRNG */
682static void readtimer(void)
683{
684 DWORD w;
685 LARGE_INTEGER l;
686 static int have_perfc = 1;
687#if defined(_MSC_VER) && defined(_M_X86)
688 static int have_tsc = 1;
689 DWORD cyclecount;
690
691 if (have_tsc) {
692 __try {
693 __asm {
694 _emit 0x0f
695 _emit 0x31
696 mov cyclecount, eax
697 }
698 RAND_add(&cyclecount, sizeof(cyclecount), 1);
699 } __except(EXCEPTION_EXECUTE_HANDLER) {
700 have_tsc = 0;
701 }
702 }
703#else
704# define have_tsc 0
705#endif
706
707 if (have_perfc) {
708 if (QueryPerformanceCounter(&l) == 0)
709 have_perfc = 0;
710 else
711 RAND_add(&l, sizeof(l), 0);
712 }
713
714 if (!have_tsc && !have_perfc) {
715 w = GetTickCount();
716 RAND_add(&w, sizeof(w), 0);
717 }
718}
719
720/* feed screen contents to PRNG */
721/*****************************************************************************
722 *
723 * Created 960901 by Gertjan van Oosten, gertjan@West.NL, West Consulting B.V.
724 *
725 * Code adapted from
726 * <URL:http://support.microsoft.com/default.aspx?scid=kb;[LN];97193>;
727 * the original copyright message is:
728 *
729 * (C) Copyright Microsoft Corp. 1993. All rights reserved.
730 *
731 * You have a royalty-free right to use, modify, reproduce and
732 * distribute the Sample Files (and/or any modified version) in
733 * any way you find useful, provided that you agree that
734 * Microsoft has no warranty obligations or liability for any
735 * Sample Application Files which are modified.
736 */
737
738static void readscreen(void)
739{
740#if !defined(OPENSSL_SYS_WINCE) && !defined(OPENSSL_SYS_WIN32_CYGWIN)
741 HDC hScrDC; /* screen DC */
742 HDC hMemDC; /* memory DC */
743 HBITMAP hBitmap; /* handle for our bitmap */
744 HBITMAP hOldBitmap; /* handle for previous bitmap */
745 BITMAP bm; /* bitmap properties */
746 unsigned int size; /* size of bitmap */
747 char *bmbits; /* contents of bitmap */
748 int w; /* screen width */
749 int h; /* screen height */
750 int y; /* y-coordinate of screen lines to grab */
751 int n = 16; /* number of screen lines to grab at a time */
752
753 if (GetVersion() < 0x80000000 && OPENSSL_isservice()>0)
754 return;
755
756 /* Create a screen DC and a memory DC compatible to screen DC */
757 hScrDC = CreateDC(TEXT("DISPLAY"), NULL, NULL, NULL);
758 hMemDC = CreateCompatibleDC(hScrDC);
759
760 /* Get screen resolution */
761 w = GetDeviceCaps(hScrDC, HORZRES);
762 h = GetDeviceCaps(hScrDC, VERTRES);
763
764 /* Create a bitmap compatible with the screen DC */
765 hBitmap = CreateCompatibleBitmap(hScrDC, w, n);
766
767 /* Select new bitmap into memory DC */
768 hOldBitmap = SelectObject(hMemDC, hBitmap);
769
770 /* Get bitmap properties */
771 GetObject(hBitmap, sizeof(BITMAP), (LPSTR)&bm);
772 size = (unsigned int)bm.bmWidthBytes * bm.bmHeight * bm.bmPlanes;
773
774 bmbits = OPENSSL_malloc(size);
775 if (bmbits) {
776 /* Now go through the whole screen, repeatedly grabbing n lines */
777 for (y = 0; y < h-n; y += n)
778 {
779 unsigned char md[MD_DIGEST_LENGTH];
780
781 /* Bitblt screen DC to memory DC */
782 BitBlt(hMemDC, 0, 0, w, n, hScrDC, 0, y, SRCCOPY);
783
784 /* Copy bitmap bits from memory DC to bmbits */
785 GetBitmapBits(hBitmap, size, bmbits);
786
787 /* Get the hash of the bitmap */
788 MD(bmbits,size,md);
789
790 /* Seed the random generator with the hash value */
791 RAND_add(md, MD_DIGEST_LENGTH, 0);
792 }
793
794 OPENSSL_free(bmbits);
795 }
796
797 /* Select old bitmap back into memory DC */
798 hBitmap = SelectObject(hMemDC, hOldBitmap);
799
800 /* Clean up */
801 DeleteObject(hBitmap);
802 DeleteDC(hMemDC);
803 DeleteDC(hScrDC);
804#endif /* !OPENSSL_SYS_WINCE */
805}
806
807#endif
diff --git a/src/lib/libcrypto/rand/randfile.c b/src/lib/libcrypto/rand/randfile.c
index 7f1428072d..030e07f418 100644
--- a/src/lib/libcrypto/rand/randfile.c
+++ b/src/lib/libcrypto/rand/randfile.c
@@ -57,9 +57,7 @@
57 */ 57 */
58 58
59/* We need to define this to get macros like S_IFBLK and S_IFCHR */ 59/* We need to define this to get macros like S_IFBLK and S_IFCHR */
60#if !defined(OPENSSL_SYS_VXWORKS)
61#define _XOPEN_SOURCE 500 60#define _XOPEN_SOURCE 500
62#endif
63 61
64#include <errno.h> 62#include <errno.h>
65#include <stdio.h> 63#include <stdio.h>
diff --git a/src/lib/libcrypto/rand/randtest.c b/src/lib/libcrypto/rand/randtest.c
new file mode 100644
index 0000000000..9e92a70b03
--- /dev/null
+++ b/src/lib/libcrypto/rand/randtest.c
@@ -0,0 +1,219 @@
1/* crypto/rand/randtest.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
59#include <stdio.h>
60#include <stdlib.h>
61#include <openssl/rand.h>
62
63#include "../e_os.h"
64
65/* some FIPS 140-1 random number test */
66/* some simple tests */
67
68int main(int argc,char **argv)
69 {
70 unsigned char buf[2500];
71 int i,j,k,s,sign,nsign,err=0;
72 unsigned long n1;
73 unsigned long n2[16];
74 unsigned long runs[2][34];
75 /*double d; */
76 long d;
77
78 i = RAND_pseudo_bytes(buf,2500);
79 if (i < 0)
80 {
81 printf ("init failed, the rand method is not properly installed\n");
82 err++;
83 goto err;
84 }
85
86 n1=0;
87 for (i=0; i<16; i++) n2[i]=0;
88 for (i=0; i<34; i++) runs[0][i]=runs[1][i]=0;
89
90 /* test 1 and 2 */
91 sign=0;
92 nsign=0;
93 for (i=0; i<2500; i++)
94 {
95 j=buf[i];
96
97 n2[j&0x0f]++;
98 n2[(j>>4)&0x0f]++;
99
100 for (k=0; k<8; k++)
101 {
102 s=(j&0x01);
103 if (s == sign)
104 nsign++;
105 else
106 {
107 if (nsign > 34) nsign=34;
108 if (nsign != 0)
109 {
110 runs[sign][nsign-1]++;
111 if (nsign > 6)
112 runs[sign][5]++;
113 }
114 sign=s;
115 nsign=1;
116 }
117
118 if (s) n1++;
119 j>>=1;
120 }
121 }
122 if (nsign > 34) nsign=34;
123 if (nsign != 0) runs[sign][nsign-1]++;
124
125 /* test 1 */
126 if (!((9654 < n1) && (n1 < 10346)))
127 {
128 printf("test 1 failed, X=%lu\n",n1);
129 err++;
130 }
131 printf("test 1 done\n");
132
133 /* test 2 */
134#ifdef undef
135 d=0;
136 for (i=0; i<16; i++)
137 d+=n2[i]*n2[i];
138 d=d*16.0/5000.0-5000.0;
139 if (!((1.03 < d) && (d < 57.4)))
140 {
141 printf("test 2 failed, X=%.2f\n",d);
142 err++;
143 }
144#endif
145 d=0;
146 for (i=0; i<16; i++)
147 d+=n2[i]*n2[i];
148 d=(d*8)/25-500000;
149 if (!((103 < d) && (d < 5740)))
150 {
151 printf("test 2 failed, X=%ld.%02ld\n",d/100L,d%100L);
152 err++;
153 }
154 printf("test 2 done\n");
155
156 /* test 3 */
157 for (i=0; i<2; i++)
158 {
159 if (!((2267 < runs[i][0]) && (runs[i][0] < 2733)))
160 {
161 printf("test 3 failed, bit=%d run=%d num=%lu\n",
162 i,1,runs[i][0]);
163 err++;
164 }
165 if (!((1079 < runs[i][1]) && (runs[i][1] < 1421)))
166 {
167 printf("test 3 failed, bit=%d run=%d num=%lu\n",
168 i,2,runs[i][1]);
169 err++;
170 }
171 if (!(( 502 < runs[i][2]) && (runs[i][2] < 748)))
172 {
173 printf("test 3 failed, bit=%d run=%d num=%lu\n",
174 i,3,runs[i][2]);
175 err++;
176 }
177 if (!(( 223 < runs[i][3]) && (runs[i][3] < 402)))
178 {
179 printf("test 3 failed, bit=%d run=%d num=%lu\n",
180 i,4,runs[i][3]);
181 err++;
182 }
183 if (!(( 90 < runs[i][4]) && (runs[i][4] < 223)))
184 {
185 printf("test 3 failed, bit=%d run=%d num=%lu\n",
186 i,5,runs[i][4]);
187 err++;
188 }
189 if (!(( 90 < runs[i][5]) && (runs[i][5] < 223)))
190 {
191 printf("test 3 failed, bit=%d run=%d num=%lu\n",
192 i,6,runs[i][5]);
193 err++;
194 }
195 }
196 printf("test 3 done\n");
197
198 /* test 4 */
199 if (runs[0][33] != 0)
200 {
201 printf("test 4 failed, bit=%d run=%d num=%lu\n",
202 0,34,runs[0][33]);
203 err++;
204 }
205 if (runs[1][33] != 0)
206 {
207 printf("test 4 failed, bit=%d run=%d num=%lu\n",
208 1,34,runs[1][33]);
209 err++;
210 }
211 printf("test 4 done\n");
212 err:
213 err=((err)?1:0);
214#ifdef OPENSSL_SYS_NETWARE
215 if (err) printf("ERROR: %d\n", err);
216#endif
217 EXIT(err);
218 return(err);
219 }
diff --git a/src/lib/libcrypto/rc2/Makefile b/src/lib/libcrypto/rc2/Makefile
new file mode 100644
index 0000000000..8a9d49ab5e
--- /dev/null
+++ b/src/lib/libcrypto/rc2/Makefile
@@ -0,0 +1,90 @@
1#
2# OpenSSL/crypto/rc2/Makefile
3#
4
5DIR= rc2
6TOP= ../..
7CC= cc
8INCLUDES=
9CFLAG=-g
10MAKEFILE= Makefile
11AR= ar r
12
13CFLAGS= $(INCLUDES) $(CFLAG)
14
15GENERAL=Makefile
16TEST=rc2test.c
17APPS=
18
19LIB=$(TOP)/libcrypto.a
20LIBSRC=rc2_ecb.c rc2_skey.c rc2_cbc.c rc2cfb64.c rc2ofb64.c
21LIBOBJ=rc2_ecb.o rc2_skey.o rc2_cbc.o rc2cfb64.o rc2ofb64.o
22
23SRC= $(LIBSRC)
24
25EXHEADER= rc2.h
26HEADER= rc2_locl.h $(EXHEADER)
27
28ALL= $(GENERAL) $(SRC) $(HEADER)
29
30top:
31 (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all)
32
33all: lib
34
35lib: $(LIBOBJ)
36 $(AR) $(LIB) $(LIBOBJ)
37 $(RANLIB) $(LIB) || echo Never mind.
38 @touch lib
39
40files:
41 $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
42
43links:
44 @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
45 @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
46 @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
47
48install:
49 @[ -n "$(INSTALLTOP)" ] # should be set by top Makefile...
50 @headerlist="$(EXHEADER)"; for i in $$headerlist ; \
51 do \
52 (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
53 chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
54 done;
55
56tags:
57 ctags $(SRC)
58
59tests:
60
61lint:
62 lint -DLINT $(INCLUDES) $(SRC)>fluff
63
64depend:
65 @[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile...
66 $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
67
68dclean:
69 $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
70 mv -f Makefile.new $(MAKEFILE)
71
72clean:
73 rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
74
75# DO NOT DELETE THIS LINE -- make depend depends on it.
76
77rc2_cbc.o: ../../include/openssl/opensslconf.h ../../include/openssl/rc2.h
78rc2_cbc.o: rc2_cbc.c rc2_locl.h
79rc2_ecb.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
80rc2_ecb.o: ../../include/openssl/rc2.h rc2_ecb.c rc2_locl.h
81rc2_skey.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
82rc2_skey.o: ../../include/openssl/opensslconf.h
83rc2_skey.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
84rc2_skey.o: ../../include/openssl/rc2.h ../../include/openssl/safestack.h
85rc2_skey.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
86rc2_skey.o: rc2_locl.h rc2_skey.c
87rc2cfb64.o: ../../include/openssl/opensslconf.h ../../include/openssl/rc2.h
88rc2cfb64.o: rc2_locl.h rc2cfb64.c
89rc2ofb64.o: ../../include/openssl/opensslconf.h ../../include/openssl/rc2.h
90rc2ofb64.o: rc2_locl.h rc2ofb64.c
diff --git a/src/lib/libcrypto/rc2/rc2speed.c b/src/lib/libcrypto/rc2/rc2speed.c
new file mode 100644
index 0000000000..85cf6f65bf
--- /dev/null
+++ b/src/lib/libcrypto/rc2/rc2speed.c
@@ -0,0 +1,277 @@
1/* crypto/rc2/rc2speed.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
59/* 11-Sep-92 Andrew Daviel Support for Silicon Graphics IRIX added */
60/* 06-Apr-92 Luke Brennan Support for VMS and add extra signal calls */
61
62#if !defined(OPENSSL_SYS_MSDOS) && (!defined(OPENSSL_SYS_VMS) || defined(__DECC)) && !defined(OPENSSL_SYS_MACOSX)
63#define TIMES
64#endif
65
66#include <stdio.h>
67
68#include <openssl/e_os2.h>
69#include OPENSSL_UNISTD_IO
70OPENSSL_DECLARE_EXIT
71
72#ifndef OPENSSL_SYS_NETWARE
73#include <signal.h>
74#endif
75
76#ifndef _IRIX
77#include <time.h>
78#endif
79#ifdef TIMES
80#include <sys/types.h>
81#include <sys/times.h>
82#endif
83
84/* Depending on the VMS version, the tms structure is perhaps defined.
85 The __TMS macro will show if it was. If it wasn't defined, we should
86 undefine TIMES, since that tells the rest of the program how things
87 should be handled. -- Richard Levitte */
88#if defined(OPENSSL_SYS_VMS_DECC) && !defined(__TMS)
89#undef TIMES
90#endif
91
92#ifndef TIMES
93#include <sys/timeb.h>
94#endif
95
96#if defined(sun) || defined(__ultrix)
97#define _POSIX_SOURCE
98#include <limits.h>
99#include <sys/param.h>
100#endif
101
102#include <openssl/rc2.h>
103
104/* The following if from times(3) man page. It may need to be changed */
105#ifndef HZ
106#ifndef CLK_TCK
107#define HZ 100.0
108#else /* CLK_TCK */
109#define HZ ((double)CLK_TCK)
110#endif /* CLK_TCK */
111#endif /* HZ */
112
113#define BUFSIZE ((long)1024)
114long run=0;
115
116double Time_F(int s);
117#ifdef SIGALRM
118#if defined(__STDC__) || defined(sgi) || defined(_AIX)
119#define SIGRETTYPE void
120#else
121#define SIGRETTYPE int
122#endif
123
124SIGRETTYPE sig_done(int sig);
125SIGRETTYPE sig_done(int sig)
126 {
127 signal(SIGALRM,sig_done);
128 run=0;
129#ifdef LINT
130 sig=sig;
131#endif
132 }
133#endif
134
135#define START 0
136#define STOP 1
137
138double Time_F(int s)
139 {
140 double ret;
141#ifdef TIMES
142 static struct tms tstart,tend;
143
144 if (s == START)
145 {
146 times(&tstart);
147 return(0);
148 }
149 else
150 {
151 times(&tend);
152 ret=((double)(tend.tms_utime-tstart.tms_utime))/HZ;
153 return((ret == 0.0)?1e-6:ret);
154 }
155#else /* !times() */
156 static struct timeb tstart,tend;
157 long i;
158
159 if (s == START)
160 {
161 ftime(&tstart);
162 return(0);
163 }
164 else
165 {
166 ftime(&tend);
167 i=(long)tend.millitm-(long)tstart.millitm;
168 ret=((double)(tend.time-tstart.time))+((double)i)/1e3;
169 return((ret == 0.0)?1e-6:ret);
170 }
171#endif
172 }
173
174int main(int argc, char **argv)
175 {
176 long count;
177 static unsigned char buf[BUFSIZE];
178 static unsigned char key[] ={
179 0x12,0x34,0x56,0x78,0x9a,0xbc,0xde,0xf0,
180 0xfe,0xdc,0xba,0x98,0x76,0x54,0x32,0x10,
181 };
182 RC2_KEY sch;
183 double a,b,c,d;
184#ifndef SIGALRM
185 long ca,cb,cc;
186#endif
187
188#ifndef TIMES
189 printf("To get the most accurate results, try to run this\n");
190 printf("program when this computer is idle.\n");
191#endif
192
193#ifndef SIGALRM
194 printf("First we calculate the approximate speed ...\n");
195 RC2_set_key(&sch,16,key,128);
196 count=10;
197 do {
198 long i;
199 unsigned long data[2];
200
201 count*=2;
202 Time_F(START);
203 for (i=count; i; i--)
204 RC2_encrypt(data,&sch);
205 d=Time_F(STOP);
206 } while (d < 3.0);
207 ca=count/512;
208 cb=count;
209 cc=count*8/BUFSIZE+1;
210 printf("Doing RC2_set_key %ld times\n",ca);
211#define COND(d) (count != (d))
212#define COUNT(d) (d)
213#else
214#define COND(c) (run)
215#define COUNT(d) (count)
216 signal(SIGALRM,sig_done);
217 printf("Doing RC2_set_key for 10 seconds\n");
218 alarm(10);
219#endif
220
221 Time_F(START);
222 for (count=0,run=1; COND(ca); count+=4)
223 {
224 RC2_set_key(&sch,16,key,128);
225 RC2_set_key(&sch,16,key,128);
226 RC2_set_key(&sch,16,key,128);
227 RC2_set_key(&sch,16,key,128);
228 }
229 d=Time_F(STOP);
230 printf("%ld RC2_set_key's in %.2f seconds\n",count,d);
231 a=((double)COUNT(ca))/d;
232
233#ifdef SIGALRM
234 printf("Doing RC2_encrypt's for 10 seconds\n");
235 alarm(10);
236#else
237 printf("Doing RC2_encrypt %ld times\n",cb);
238#endif
239 Time_F(START);
240 for (count=0,run=1; COND(cb); count+=4)
241 {
242 unsigned long data[2];
243
244 RC2_encrypt(data,&sch);
245 RC2_encrypt(data,&sch);
246 RC2_encrypt(data,&sch);
247 RC2_encrypt(data,&sch);
248 }
249 d=Time_F(STOP);
250 printf("%ld RC2_encrypt's in %.2f second\n",count,d);
251 b=((double)COUNT(cb)*8)/d;
252
253#ifdef SIGALRM
254 printf("Doing RC2_cbc_encrypt on %ld byte blocks for 10 seconds\n",
255 BUFSIZE);
256 alarm(10);
257#else
258 printf("Doing RC2_cbc_encrypt %ld times on %ld byte blocks\n",cc,
259 BUFSIZE);
260#endif
261 Time_F(START);
262 for (count=0,run=1; COND(cc); count++)
263 RC2_cbc_encrypt(buf,buf,BUFSIZE,&sch,
264 &(key[0]),RC2_ENCRYPT);
265 d=Time_F(STOP);
266 printf("%ld RC2_cbc_encrypt's of %ld byte blocks in %.2f second\n",
267 count,BUFSIZE,d);
268 c=((double)COUNT(cc)*BUFSIZE)/d;
269
270 printf("RC2 set_key per sec = %12.2f (%9.3fuS)\n",a,1.0e6/a);
271 printf("RC2 raw ecb bytes per sec = %12.2f (%9.3fuS)\n",b,8.0e6/b);
272 printf("RC2 cbc bytes per sec = %12.2f (%9.3fuS)\n",c,8.0e6/c);
273 exit(0);
274#if defined(LINT) || defined(OPENSSL_SYS_MSDOS)
275 return(0);
276#endif
277 }
diff --git a/src/lib/libcrypto/rc2/rc2test.c b/src/lib/libcrypto/rc2/rc2test.c
new file mode 100644
index 0000000000..0e117436bb
--- /dev/null
+++ b/src/lib/libcrypto/rc2/rc2test.c
@@ -0,0 +1,274 @@
1/* crypto/rc2/rc2test.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
59/* This has been a quickly hacked 'ideatest.c'. When I add tests for other
60 * RC2 modes, more of the code will be uncommented. */
61
62#include <stdio.h>
63#include <string.h>
64#include <stdlib.h>
65
66#include "../e_os.h"
67
68#ifdef OPENSSL_NO_RC2
69int main(int argc, char *argv[])
70{
71 printf("No RC2 support\n");
72 return(0);
73}
74#else
75#include <openssl/rc2.h>
76
77static unsigned char RC2key[4][16]={
78 {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
79 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
80 {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
81 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01},
82 {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
83 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
84 {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,
85 0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F},
86 };
87
88static unsigned char RC2plain[4][8]={
89 {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
90 {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
91 {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF},
92 {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
93 };
94
95static unsigned char RC2cipher[4][8]={
96 {0x1C,0x19,0x8A,0x83,0x8D,0xF0,0x28,0xB7},
97 {0x21,0x82,0x9C,0x78,0xA9,0xF9,0xC0,0x74},
98 {0x13,0xDB,0x35,0x17,0xD3,0x21,0x86,0x9E},
99 {0x50,0xDC,0x01,0x62,0xBD,0x75,0x7F,0x31},
100 };
101/************/
102#ifdef undef
103unsigned char k[16]={
104 0x00,0x01,0x00,0x02,0x00,0x03,0x00,0x04,
105 0x00,0x05,0x00,0x06,0x00,0x07,0x00,0x08};
106
107unsigned char in[8]={0x00,0x00,0x00,0x01,0x00,0x02,0x00,0x03};
108unsigned char c[8]={0x11,0xFB,0xED,0x2B,0x01,0x98,0x6D,0xE5};
109unsigned char out[80];
110
111char *text="Hello to all people out there";
112
113static unsigned char cfb_key[16]={
114 0xe1,0xf0,0xc3,0xd2,0xa5,0xb4,0x87,0x96,
115 0x69,0x78,0x4b,0x5a,0x2d,0x3c,0x0f,0x1e,
116 };
117static unsigned char cfb_iv[80]={0x34,0x12,0x78,0x56,0xab,0x90,0xef,0xcd};
118static unsigned char cfb_buf1[40],cfb_buf2[40],cfb_tmp[8];
119#define CFB_TEST_SIZE 24
120static unsigned char plain[CFB_TEST_SIZE]=
121 {
122 0x4e,0x6f,0x77,0x20,0x69,0x73,
123 0x20,0x74,0x68,0x65,0x20,0x74,
124 0x69,0x6d,0x65,0x20,0x66,0x6f,
125 0x72,0x20,0x61,0x6c,0x6c,0x20
126 };
127static unsigned char cfb_cipher64[CFB_TEST_SIZE]={
128 0x59,0xD8,0xE2,0x65,0x00,0x58,0x6C,0x3F,
129 0x2C,0x17,0x25,0xD0,0x1A,0x38,0xB7,0x2A,
130 0x39,0x61,0x37,0xDC,0x79,0xFB,0x9F,0x45
131
132/* 0xF9,0x78,0x32,0xB5,0x42,0x1A,0x6B,0x38,
133 0x9A,0x44,0xD6,0x04,0x19,0x43,0xC4,0xD9,
134 0x3D,0x1E,0xAE,0x47,0xFC,0xCF,0x29,0x0B,*/
135 };
136
137
138/*static int cfb64_test(unsigned char *cfb_cipher);*/
139static char *pt(unsigned char *p);
140#endif
141
142int main(int argc, char *argv[])
143 {
144 int i,n,err=0;
145 RC2_KEY key;
146 unsigned char buf[8],buf2[8];
147
148 for (n=0; n<4; n++)
149 {
150 RC2_set_key(&key,16,&(RC2key[n][0]),0 /* or 1024 */);
151
152 RC2_ecb_encrypt(&(RC2plain[n][0]),buf,&key,RC2_ENCRYPT);
153 if (memcmp(&(RC2cipher[n][0]),buf,8) != 0)
154 {
155 printf("ecb rc2 error encrypting\n");
156 printf("got :");
157 for (i=0; i<8; i++)
158 printf("%02X ",buf[i]);
159 printf("\n");
160 printf("expected:");
161 for (i=0; i<8; i++)
162 printf("%02X ",RC2cipher[n][i]);
163 err=20;
164 printf("\n");
165 }
166
167 RC2_ecb_encrypt(buf,buf2,&key,RC2_DECRYPT);
168 if (memcmp(&(RC2plain[n][0]),buf2,8) != 0)
169 {
170 printf("ecb RC2 error decrypting\n");
171 printf("got :");
172 for (i=0; i<8; i++)
173 printf("%02X ",buf[i]);
174 printf("\n");
175 printf("expected:");
176 for (i=0; i<8; i++)
177 printf("%02X ",RC2plain[n][i]);
178 printf("\n");
179 err=3;
180 }
181 }
182
183 if (err == 0) printf("ecb RC2 ok\n");
184#ifdef undef
185 memcpy(iv,k,8);
186 idea_cbc_encrypt((unsigned char *)text,out,strlen(text)+1,&key,iv,1);
187 memcpy(iv,k,8);
188 idea_cbc_encrypt(out,out,8,&dkey,iv,0);
189 idea_cbc_encrypt(&(out[8]),&(out[8]),strlen(text)+1-8,&dkey,iv,0);
190 if (memcmp(text,out,strlen(text)+1) != 0)
191 {
192 printf("cbc idea bad\n");
193 err=4;
194 }
195 else
196 printf("cbc idea ok\n");
197
198 printf("cfb64 idea ");
199 if (cfb64_test(cfb_cipher64))
200 {
201 printf("bad\n");
202 err=5;
203 }
204 else
205 printf("ok\n");
206#endif
207
208#ifdef OPENSSL_SYS_NETWARE
209 if (err) printf("ERROR: %d\n", err);
210#endif
211 EXIT(err);
212 return(err);
213 }
214
215#ifdef undef
216static int cfb64_test(unsigned char *cfb_cipher)
217 {
218 IDEA_KEY_SCHEDULE eks,dks;
219 int err=0,i,n;
220
221 idea_set_encrypt_key(cfb_key,&eks);
222 idea_set_decrypt_key(&eks,&dks);
223 memcpy(cfb_tmp,cfb_iv,8);
224 n=0;
225 idea_cfb64_encrypt(plain,cfb_buf1,(long)12,&eks,
226 cfb_tmp,&n,IDEA_ENCRYPT);
227 idea_cfb64_encrypt(&(plain[12]),&(cfb_buf1[12]),
228 (long)CFB_TEST_SIZE-12,&eks,
229 cfb_tmp,&n,IDEA_ENCRYPT);
230 if (memcmp(cfb_cipher,cfb_buf1,CFB_TEST_SIZE) != 0)
231 {
232 err=1;
233 printf("idea_cfb64_encrypt encrypt error\n");
234 for (i=0; i<CFB_TEST_SIZE; i+=8)
235 printf("%s\n",pt(&(cfb_buf1[i])));
236 }
237 memcpy(cfb_tmp,cfb_iv,8);
238 n=0;
239 idea_cfb64_encrypt(cfb_buf1,cfb_buf2,(long)17,&eks,
240 cfb_tmp,&n,IDEA_DECRYPT);
241 idea_cfb64_encrypt(&(cfb_buf1[17]),&(cfb_buf2[17]),
242 (long)CFB_TEST_SIZE-17,&dks,
243 cfb_tmp,&n,IDEA_DECRYPT);
244 if (memcmp(plain,cfb_buf2,CFB_TEST_SIZE) != 0)
245 {
246 err=1;
247 printf("idea_cfb_encrypt decrypt error\n");
248 for (i=0; i<24; i+=8)
249 printf("%s\n",pt(&(cfb_buf2[i])));
250 }
251 return(err);
252 }
253
254static char *pt(unsigned char *p)
255 {
256 static char bufs[10][20];
257 static int bnum=0;
258 char *ret;
259 int i;
260 static char *f="0123456789ABCDEF";
261
262 ret= &(bufs[bnum++][0]);
263 bnum%=10;
264 for (i=0; i<8; i++)
265 {
266 ret[i*2]=f[(p[i]>>4)&0xf];
267 ret[i*2+1]=f[p[i]&0xf];
268 }
269 ret[16]='\0';
270 return(ret);
271 }
272
273#endif
274#endif
diff --git a/src/lib/libcrypto/rc2/tab.c b/src/lib/libcrypto/rc2/tab.c
new file mode 100644
index 0000000000..25dc14eeba
--- /dev/null
+++ b/src/lib/libcrypto/rc2/tab.c
@@ -0,0 +1,86 @@
1#include <stdio.h>
2
3unsigned char ebits_to_num[256]={
4 0xbd,0x56,0xea,0xf2,0xa2,0xf1,0xac,0x2a,
5 0xb0,0x93,0xd1,0x9c,0x1b,0x33,0xfd,0xd0,
6 0x30,0x04,0xb6,0xdc,0x7d,0xdf,0x32,0x4b,
7 0xf7,0xcb,0x45,0x9b,0x31,0xbb,0x21,0x5a,
8 0x41,0x9f,0xe1,0xd9,0x4a,0x4d,0x9e,0xda,
9 0xa0,0x68,0x2c,0xc3,0x27,0x5f,0x80,0x36,
10 0x3e,0xee,0xfb,0x95,0x1a,0xfe,0xce,0xa8,
11 0x34,0xa9,0x13,0xf0,0xa6,0x3f,0xd8,0x0c,
12 0x78,0x24,0xaf,0x23,0x52,0xc1,0x67,0x17,
13 0xf5,0x66,0x90,0xe7,0xe8,0x07,0xb8,0x60,
14 0x48,0xe6,0x1e,0x53,0xf3,0x92,0xa4,0x72,
15 0x8c,0x08,0x15,0x6e,0x86,0x00,0x84,0xfa,
16 0xf4,0x7f,0x8a,0x42,0x19,0xf6,0xdb,0xcd,
17 0x14,0x8d,0x50,0x12,0xba,0x3c,0x06,0x4e,
18 0xec,0xb3,0x35,0x11,0xa1,0x88,0x8e,0x2b,
19 0x94,0x99,0xb7,0x71,0x74,0xd3,0xe4,0xbf,
20 0x3a,0xde,0x96,0x0e,0xbc,0x0a,0xed,0x77,
21 0xfc,0x37,0x6b,0x03,0x79,0x89,0x62,0xc6,
22 0xd7,0xc0,0xd2,0x7c,0x6a,0x8b,0x22,0xa3,
23 0x5b,0x05,0x5d,0x02,0x75,0xd5,0x61,0xe3,
24 0x18,0x8f,0x55,0x51,0xad,0x1f,0x0b,0x5e,
25 0x85,0xe5,0xc2,0x57,0x63,0xca,0x3d,0x6c,
26 0xb4,0xc5,0xcc,0x70,0xb2,0x91,0x59,0x0d,
27 0x47,0x20,0xc8,0x4f,0x58,0xe0,0x01,0xe2,
28 0x16,0x38,0xc4,0x6f,0x3b,0x0f,0x65,0x46,
29 0xbe,0x7e,0x2d,0x7b,0x82,0xf9,0x40,0xb5,
30 0x1d,0x73,0xf8,0xeb,0x26,0xc7,0x87,0x97,
31 0x25,0x54,0xb1,0x28,0xaa,0x98,0x9d,0xa5,
32 0x64,0x6d,0x7a,0xd4,0x10,0x81,0x44,0xef,
33 0x49,0xd6,0xae,0x2e,0xdd,0x76,0x5c,0x2f,
34 0xa7,0x1c,0xc9,0x09,0x69,0x9a,0x83,0xcf,
35 0x29,0x39,0xb9,0xe9,0x4c,0xff,0x43,0xab,
36 };
37
38unsigned char num_to_ebits[256]={
39 0x5d,0xbe,0x9b,0x8b,0x11,0x99,0x6e,0x4d,
40 0x59,0xf3,0x85,0xa6,0x3f,0xb7,0x83,0xc5,
41 0xe4,0x73,0x6b,0x3a,0x68,0x5a,0xc0,0x47,
42 0xa0,0x64,0x34,0x0c,0xf1,0xd0,0x52,0xa5,
43 0xb9,0x1e,0x96,0x43,0x41,0xd8,0xd4,0x2c,
44 0xdb,0xf8,0x07,0x77,0x2a,0xca,0xeb,0xef,
45 0x10,0x1c,0x16,0x0d,0x38,0x72,0x2f,0x89,
46 0xc1,0xf9,0x80,0xc4,0x6d,0xae,0x30,0x3d,
47 0xce,0x20,0x63,0xfe,0xe6,0x1a,0xc7,0xb8,
48 0x50,0xe8,0x24,0x17,0xfc,0x25,0x6f,0xbb,
49 0x6a,0xa3,0x44,0x53,0xd9,0xa2,0x01,0xab,
50 0xbc,0xb6,0x1f,0x98,0xee,0x9a,0xa7,0x2d,
51 0x4f,0x9e,0x8e,0xac,0xe0,0xc6,0x49,0x46,
52 0x29,0xf4,0x94,0x8a,0xaf,0xe1,0x5b,0xc3,
53 0xb3,0x7b,0x57,0xd1,0x7c,0x9c,0xed,0x87,
54 0x40,0x8c,0xe2,0xcb,0x93,0x14,0xc9,0x61,
55 0x2e,0xe5,0xcc,0xf6,0x5e,0xa8,0x5c,0xd6,
56 0x75,0x8d,0x62,0x95,0x58,0x69,0x76,0xa1,
57 0x4a,0xb5,0x55,0x09,0x78,0x33,0x82,0xd7,
58 0xdd,0x79,0xf5,0x1b,0x0b,0xde,0x26,0x21,
59 0x28,0x74,0x04,0x97,0x56,0xdf,0x3c,0xf0,
60 0x37,0x39,0xdc,0xff,0x06,0xa4,0xea,0x42,
61 0x08,0xda,0xb4,0x71,0xb0,0xcf,0x12,0x7a,
62 0x4e,0xfa,0x6c,0x1d,0x84,0x00,0xc8,0x7f,
63 0x91,0x45,0xaa,0x2b,0xc2,0xb1,0x8f,0xd5,
64 0xba,0xf2,0xad,0x19,0xb2,0x67,0x36,0xf7,
65 0x0f,0x0a,0x92,0x7d,0xe3,0x9d,0xe9,0x90,
66 0x3e,0x23,0x27,0x66,0x13,0xec,0x81,0x15,
67 0xbd,0x22,0xbf,0x9f,0x7e,0xa9,0x51,0x4b,
68 0x4c,0xfb,0x02,0xd3,0x70,0x86,0x31,0xe7,
69 0x3b,0x05,0x03,0x54,0x60,0x48,0x65,0x18,
70 0xd2,0xcd,0x5f,0x32,0x88,0x0e,0x35,0xfd,
71 };
72
73main()
74 {
75 int i,j;
76
77 for (i=0; i<256; i++)
78 {
79 for (j=0; j<256; j++)
80 if (ebits_to_num[j] == i)
81 {
82 printf("0x%02x,",j);
83 break;
84 }
85 }
86 }
diff --git a/src/lib/libcrypto/rc4/Makefile b/src/lib/libcrypto/rc4/Makefile
new file mode 100644
index 0000000000..1614d47961
--- /dev/null
+++ b/src/lib/libcrypto/rc4/Makefile
@@ -0,0 +1,125 @@
1#
2# OpenSSL/crypto/rc4/Makefile
3#
4
5DIR= rc4
6TOP= ../..
7CC= cc
8CPP= $(CC) -E
9INCLUDES=
10CFLAG=-g
11AR= ar r
12
13RC4_ENC=rc4_enc.o rc4_skey.o
14
15CFLAGS= $(INCLUDES) $(CFLAG)
16ASFLAGS= $(INCLUDES) $(ASFLAG)
17AFLAGS= $(ASFLAGS)
18
19GENERAL=Makefile
20TEST=rc4test.c
21APPS=
22
23LIB=$(TOP)/libcrypto.a
24LIBSRC=rc4_skey.c rc4_enc.c rc4_utl.c
25LIBOBJ=$(RC4_ENC) rc4_utl.o
26
27SRC= $(LIBSRC)
28
29EXHEADER= rc4.h
30HEADER= $(EXHEADER) rc4_locl.h
31
32ALL= $(GENERAL) $(SRC) $(HEADER)
33
34top:
35 (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all)
36
37all: lib
38
39lib: $(LIBOBJ)
40 $(AR) $(LIB) $(LIBOBJ)
41 $(RANLIB) $(LIB) || echo Never mind.
42 @touch lib
43
44rc4-586.s: asm/rc4-586.pl ../perlasm/x86asm.pl
45 $(PERL) asm/rc4-586.pl $(PERLASM_SCHEME) $(CFLAGS) > $@
46
47rc4-x86_64.s: asm/rc4-x86_64.pl
48 $(PERL) asm/rc4-x86_64.pl $(PERLASM_SCHEME) > $@
49rc4-md5-x86_64.s: asm/rc4-md5-x86_64.pl
50 $(PERL) asm/rc4-md5-x86_64.pl $(PERLASM_SCHEME) > $@
51
52rc4-ia64.S: asm/rc4-ia64.pl
53 $(PERL) asm/rc4-ia64.pl $(CFLAGS) > $@
54
55rc4-parisc.s: asm/rc4-parisc.pl
56 $(PERL) asm/rc4-parisc.pl $(PERLASM_SCHEME) $@
57
58rc4-ia64.s: rc4-ia64.S
59 @case `awk '/^#define RC4_INT/{print$$NF}' $(TOP)/include/openssl/opensslconf.h` in \
60 int) set -x; $(CC) $(CFLAGS) -DSZ=4 -E rc4-ia64.S > $@ ;; \
61 char) set -x; $(CC) $(CFLAGS) -DSZ=1 -E rc4-ia64.S > $@ ;; \
62 *) exit 1 ;; \
63 esac
64
65# GNU make "catch all"
66rc4-%.s: asm/rc4-%.pl; $(PERL) $< $(PERLASM_SCHEME) $@
67
68files:
69 $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
70
71links:
72 @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
73 @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
74 @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
75
76install:
77 @[ -n "$(INSTALLTOP)" ] # should be set by top Makefile...
78 @headerlist="$(EXHEADER)"; for i in $$headerlist ; \
79 do \
80 (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
81 chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
82 done;
83
84tags:
85 ctags $(SRC)
86
87tests:
88
89lint:
90 lint -DLINT $(INCLUDES) $(SRC)>fluff
91
92depend:
93 @[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile...
94 $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
95
96dclean:
97 $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
98 mv -f Makefile.new $(MAKEFILE)
99
100clean:
101 rm -f *.s *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
102
103# DO NOT DELETE THIS LINE -- make depend depends on it.
104
105rc4_enc.o: ../../e_os.h ../../include/openssl/bio.h
106rc4_enc.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
107rc4_enc.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
108rc4_enc.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
109rc4_enc.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
110rc4_enc.o: ../../include/openssl/rc4.h ../../include/openssl/safestack.h
111rc4_enc.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
112rc4_enc.o: ../cryptlib.h rc4_enc.c rc4_locl.h
113rc4_skey.o: ../../e_os.h ../../include/openssl/bio.h
114rc4_skey.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
115rc4_skey.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
116rc4_skey.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
117rc4_skey.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
118rc4_skey.o: ../../include/openssl/rc4.h ../../include/openssl/safestack.h
119rc4_skey.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
120rc4_skey.o: ../cryptlib.h rc4_locl.h rc4_skey.c
121rc4_utl.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
122rc4_utl.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
123rc4_utl.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rc4.h
124rc4_utl.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
125rc4_utl.o: ../../include/openssl/symhacks.h rc4_utl.c
diff --git a/src/lib/libcrypto/rc4/asm/rc4-x86_64.pl b/src/lib/libcrypto/rc4/asm/rc4-x86_64.pl
index 75750dbf33..d6eac205e9 100755
--- a/src/lib/libcrypto/rc4/asm/rc4-x86_64.pl
+++ b/src/lib/libcrypto/rc4/asm/rc4-x86_64.pl
@@ -112,8 +112,7 @@ $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1;
112( $xlate="${dir}../../perlasm/x86_64-xlate.pl" and -f $xlate) or 112( $xlate="${dir}../../perlasm/x86_64-xlate.pl" and -f $xlate) or
113die "can't locate x86_64-xlate.pl"; 113die "can't locate x86_64-xlate.pl";
114 114
115open OUT,"| \"$^X\" $xlate $flavour $output"; 115open STDOUT,"| $^X $xlate $flavour $output";
116*STDOUT=*OUT;
117 116
118$dat="%rdi"; # arg1 117$dat="%rdi"; # arg1
119$len="%rsi"; # arg2 118$len="%rsi"; # arg2
diff --git a/src/lib/libcrypto/rc4/rc4.c b/src/lib/libcrypto/rc4/rc4.c
new file mode 100644
index 0000000000..c900b26055
--- /dev/null
+++ b/src/lib/libcrypto/rc4/rc4.c
@@ -0,0 +1,193 @@
1/* crypto/rc4/rc4.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
59#include <stdio.h>
60#include <stdlib.h>
61#include <string.h>
62#include <openssl/rc4.h>
63#include <openssl/evp.h>
64
65char *usage[]={
66"usage: rc4 args\n",
67"\n",
68" -in arg - input file - default stdin\n",
69" -out arg - output file - default stdout\n",
70" -key key - password\n",
71NULL
72};
73
74int main(int argc, char *argv[])
75 {
76 FILE *in=NULL,*out=NULL;
77 char *infile=NULL,*outfile=NULL,*keystr=NULL;
78 RC4_KEY key;
79 char buf[BUFSIZ];
80 int badops=0,i;
81 char **pp;
82 unsigned char md[MD5_DIGEST_LENGTH];
83
84 argc--;
85 argv++;
86 while (argc >= 1)
87 {
88 if (strcmp(*argv,"-in") == 0)
89 {
90 if (--argc < 1) goto bad;
91 infile= *(++argv);
92 }
93 else if (strcmp(*argv,"-out") == 0)
94 {
95 if (--argc < 1) goto bad;
96 outfile= *(++argv);
97 }
98 else if (strcmp(*argv,"-key") == 0)
99 {
100 if (--argc < 1) goto bad;
101 keystr= *(++argv);
102 }
103 else
104 {
105 fprintf(stderr,"unknown option %s\n",*argv);
106 badops=1;
107 break;
108 }
109 argc--;
110 argv++;
111 }
112
113 if (badops)
114 {
115bad:
116 for (pp=usage; (*pp != NULL); pp++)
117 fprintf(stderr,"%s",*pp);
118 exit(1);
119 }
120
121 if (infile == NULL)
122 in=stdin;
123 else
124 {
125 in=fopen(infile,"r");
126 if (in == NULL)
127 {
128 perror("open");
129 exit(1);
130 }
131
132 }
133 if (outfile == NULL)
134 out=stdout;
135 else
136 {
137 out=fopen(outfile,"w");
138 if (out == NULL)
139 {
140 perror("open");
141 exit(1);
142 }
143 }
144
145#ifdef OPENSSL_SYS_MSDOS
146 /* This should set the file to binary mode. */
147 {
148#include <fcntl.h>
149 setmode(fileno(in),O_BINARY);
150 setmode(fileno(out),O_BINARY);
151 }
152#endif
153
154 if (keystr == NULL)
155 { /* get key */
156 i=EVP_read_pw_string(buf,BUFSIZ,"Enter RC4 password:",0);
157 if (i != 0)
158 {
159 OPENSSL_cleanse(buf,BUFSIZ);
160 fprintf(stderr,"bad password read\n");
161 exit(1);
162 }
163 keystr=buf;
164 }
165
166 EVP_Digest((unsigned char *)keystr,strlen(keystr),md,NULL,EVP_md5(),NULL);
167 OPENSSL_cleanse(keystr,strlen(keystr));
168 RC4_set_key(&key,MD5_DIGEST_LENGTH,md);
169
170 for(;;)
171 {
172 i=fread(buf,1,BUFSIZ,in);
173 if (i == 0) break;
174 if (i < 0)
175 {
176 perror("read");
177 exit(1);
178 }
179 RC4(&key,(unsigned int)i,(unsigned char *)buf,
180 (unsigned char *)buf);
181 i=fwrite(buf,(unsigned int)i,1,out);
182 if (i != 1)
183 {
184 perror("write");
185 exit(1);
186 }
187 }
188 fclose(out);
189 fclose(in);
190 exit(0);
191 return(1);
192 }
193
diff --git a/src/lib/libcrypto/rc4/rc4_utl.c b/src/lib/libcrypto/rc4/rc4_utl.c
new file mode 100644
index 0000000000..ab3f02fe6a
--- /dev/null
+++ b/src/lib/libcrypto/rc4/rc4_utl.c
@@ -0,0 +1,62 @@
1/* crypto/rc4/rc4_utl.c -*- mode:C; c-file-style: "eay" -*- */
2/* ====================================================================
3 * Copyright (c) 2011 The OpenSSL Project. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 *
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in
14 * the documentation and/or other materials provided with the
15 * distribution.
16 *
17 * 3. All advertising materials mentioning features or use of this
18 * software must display the following acknowledgment:
19 * "This product includes software developed by the OpenSSL Project
20 * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
21 *
22 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
23 * endorse or promote products derived from this software without
24 * prior written permission. For written permission, please contact
25 * openssl-core@openssl.org.
26 *
27 * 5. Products derived from this software may not be called "OpenSSL"
28 * nor may "OpenSSL" appear in their names without prior written
29 * permission of the OpenSSL Project.
30 *
31 * 6. Redistributions of any form whatsoever must retain the following
32 * acknowledgment:
33 * "This product includes software developed by the OpenSSL Project
34 * for use in the OpenSSL Toolkit (http://www.openssl.org/)"
35 *
36 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
37 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
38 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
39 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
40 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
41 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
42 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
43 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
44 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
45 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
46 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
47 * OF THE POSSIBILITY OF SUCH DAMAGE.
48 * ====================================================================
49 *
50 */
51
52#include <openssl/opensslv.h>
53#include <openssl/crypto.h>
54#include <openssl/rc4.h>
55
56void RC4_set_key(RC4_KEY *key, int len, const unsigned char *data)
57 {
58#ifdef OPENSSL_FIPS
59 fips_cipher_abort(RC4);
60#endif
61 private_RC4_set_key(key, len, data);
62 }
diff --git a/src/lib/libcrypto/rc4/rc4s.cpp b/src/lib/libcrypto/rc4/rc4s.cpp
new file mode 100644
index 0000000000..3814fde997
--- /dev/null
+++ b/src/lib/libcrypto/rc4/rc4s.cpp
@@ -0,0 +1,73 @@
1//
2// gettsc.inl
3//
4// gives access to the Pentium's (secret) cycle counter
5//
6// This software was written by Leonard Janke (janke@unixg.ubc.ca)
7// in 1996-7 and is entered, by him, into the public domain.
8
9#if defined(__WATCOMC__)
10void GetTSC(unsigned long&);
11#pragma aux GetTSC = 0x0f 0x31 "mov [edi], eax" parm [edi] modify [edx eax];
12#elif defined(__GNUC__)
13inline
14void GetTSC(unsigned long& tsc)
15{
16 asm volatile(".byte 15, 49\n\t"
17 : "=eax" (tsc)
18 :
19 : "%edx", "%eax");
20}
21#elif defined(_MSC_VER)
22inline
23void GetTSC(unsigned long& tsc)
24{
25 unsigned long a;
26 __asm _emit 0fh
27 __asm _emit 31h
28 __asm mov a, eax;
29 tsc=a;
30}
31#endif
32
33#include <stdio.h>
34#include <stdlib.h>
35#include <openssl/rc4.h>
36
37void main(int argc,char *argv[])
38 {
39 unsigned char buffer[1024];
40 RC4_KEY ctx;
41 unsigned long s1,s2,e1,e2;
42 unsigned char k[16];
43 unsigned long data[2];
44 unsigned char iv[8];
45 int i,num=64,numm;
46 int j=0;
47
48 if (argc >= 2)
49 num=atoi(argv[1]);
50
51 if (num == 0) num=256;
52 if (num > 1024-16) num=1024-16;
53 numm=num+8;
54
55 for (j=0; j<6; j++)
56 {
57 for (i=0; i<10; i++) /**/
58 {
59 RC4(&ctx,numm,buffer,buffer);
60 GetTSC(s1);
61 RC4(&ctx,numm,buffer,buffer);
62 GetTSC(e1);
63 GetTSC(s2);
64 RC4(&ctx,num,buffer,buffer);
65 GetTSC(e2);
66 RC4(&ctx,num,buffer,buffer);
67 }
68
69 printf("RC4 (%d bytes) %d %d (%d) - 8 bytes\n",num,
70 e1-s1,e2-s2,(e1-s1)-(e2-s2));
71 }
72 }
73
diff --git a/src/lib/libcrypto/rc4/rc4speed.c b/src/lib/libcrypto/rc4/rc4speed.c
new file mode 100644
index 0000000000..0ebd38123d
--- /dev/null
+++ b/src/lib/libcrypto/rc4/rc4speed.c
@@ -0,0 +1,253 @@
1/* crypto/rc4/rc4speed.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
59/* 11-Sep-92 Andrew Daviel Support for Silicon Graphics IRIX added */
60/* 06-Apr-92 Luke Brennan Support for VMS and add extra signal calls */
61
62#if !defined(OPENSSL_SYS_MSDOS) && (!defined(OPENSSL_SYS_VMS) || defined(__DECC)) && !defined(OPENSSL_SYS_MACOSX)
63#define TIMES
64#endif
65
66#include <stdio.h>
67
68#include <openssl/e_os2.h>
69#include OPENSSL_UNISTD_IO
70OPENSSL_DECLARE_EXIT
71
72#ifndef OPENSSL_SYS_NETWARE
73#include <signal.h>
74#endif
75
76#ifndef _IRIX
77#include <time.h>
78#endif
79#ifdef TIMES
80#include <sys/types.h>
81#include <sys/times.h>
82#endif
83
84/* Depending on the VMS version, the tms structure is perhaps defined.
85 The __TMS macro will show if it was. If it wasn't defined, we should
86 undefine TIMES, since that tells the rest of the program how things
87 should be handled. -- Richard Levitte */
88#if defined(OPENSSL_SYS_VMS_DECC) && !defined(__TMS)
89#undef TIMES
90#endif
91
92#ifndef TIMES
93#include <sys/timeb.h>
94#endif
95
96#if defined(sun) || defined(__ultrix)
97#define _POSIX_SOURCE
98#include <limits.h>
99#include <sys/param.h>
100#endif
101
102#include <openssl/rc4.h>
103
104/* The following if from times(3) man page. It may need to be changed */
105#ifndef HZ
106#ifndef CLK_TCK
107#define HZ 100.0
108#else /* CLK_TCK */
109#define HZ ((double)CLK_TCK)
110#endif
111#endif
112
113#define BUFSIZE ((long)1024)
114long run=0;
115
116double Time_F(int s);
117#ifdef SIGALRM
118#if defined(__STDC__) || defined(sgi) || defined(_AIX)
119#define SIGRETTYPE void
120#else
121#define SIGRETTYPE int
122#endif
123
124SIGRETTYPE sig_done(int sig);
125SIGRETTYPE sig_done(int sig)
126 {
127 signal(SIGALRM,sig_done);
128 run=0;
129#ifdef LINT
130 sig=sig;
131#endif
132 }
133#endif
134
135#define START 0
136#define STOP 1
137
138double Time_F(int s)
139 {
140 double ret;
141#ifdef TIMES
142 static struct tms tstart,tend;
143
144 if (s == START)
145 {
146 times(&tstart);
147 return(0);
148 }
149 else
150 {
151 times(&tend);
152 ret=((double)(tend.tms_utime-tstart.tms_utime))/HZ;
153 return((ret == 0.0)?1e-6:ret);
154 }
155#else /* !times() */
156 static struct timeb tstart,tend;
157 long i;
158
159 if (s == START)
160 {
161 ftime(&tstart);
162 return(0);
163 }
164 else
165 {
166 ftime(&tend);
167 i=(long)tend.millitm-(long)tstart.millitm;
168 ret=((double)(tend.time-tstart.time))+((double)i)/1e3;
169 return((ret == 0.0)?1e-6:ret);
170 }
171#endif
172 }
173
174int main(int argc, char **argv)
175 {
176 long count;
177 static unsigned char buf[BUFSIZE];
178 static unsigned char key[] ={
179 0x12,0x34,0x56,0x78,0x9a,0xbc,0xde,0xf0,
180 0xfe,0xdc,0xba,0x98,0x76,0x54,0x32,0x10,
181 };
182 RC4_KEY sch;
183 double a,b,c,d;
184#ifndef SIGALRM
185 long ca,cb,cc;
186#endif
187
188#ifndef TIMES
189 printf("To get the most accurate results, try to run this\n");
190 printf("program when this computer is idle.\n");
191#endif
192
193#ifndef SIGALRM
194 printf("First we calculate the approximate speed ...\n");
195 RC4_set_key(&sch,16,key);
196 count=10;
197 do {
198 long i;
199 unsigned long data[2];
200
201 count*=2;
202 Time_F(START);
203 for (i=count; i; i--)
204 RC4(&sch,8,buf,buf);
205 d=Time_F(STOP);
206 } while (d < 3.0);
207 ca=count/512;
208 cc=count*8/BUFSIZE+1;
209 printf("Doing RC4_set_key %ld times\n",ca);
210#define COND(d) (count != (d))
211#define COUNT(d) (d)
212#else
213#define COND(c) (run)
214#define COUNT(d) (count)
215 signal(SIGALRM,sig_done);
216 printf("Doing RC4_set_key for 10 seconds\n");
217 alarm(10);
218#endif
219
220 Time_F(START);
221 for (count=0,run=1; COND(ca); count+=4)
222 {
223 RC4_set_key(&sch,16,key);
224 RC4_set_key(&sch,16,key);
225 RC4_set_key(&sch,16,key);
226 RC4_set_key(&sch,16,key);
227 }
228 d=Time_F(STOP);
229 printf("%ld RC4_set_key's in %.2f seconds\n",count,d);
230 a=((double)COUNT(ca))/d;
231
232#ifdef SIGALRM
233 printf("Doing RC4 on %ld byte blocks for 10 seconds\n",BUFSIZE);
234 alarm(10);
235#else
236 printf("Doing RC4 %ld times on %ld byte blocks\n",cc,BUFSIZE);
237#endif
238 Time_F(START);
239 for (count=0,run=1; COND(cc); count++)
240 RC4(&sch,BUFSIZE,buf,buf);
241 d=Time_F(STOP);
242 printf("%ld RC4's of %ld byte blocks in %.2f second\n",
243 count,BUFSIZE,d);
244 c=((double)COUNT(cc)*BUFSIZE)/d;
245
246 printf("RC4 set_key per sec = %12.2f (%9.3fuS)\n",a,1.0e6/a);
247 printf("RC4 bytes per sec = %12.2f (%9.3fuS)\n",c,8.0e6/c);
248 exit(0);
249#if defined(LINT) || defined(OPENSSL_SYS_MSDOS)
250 return(0);
251#endif
252 }
253
diff --git a/src/lib/libcrypto/rc4/rc4test.c b/src/lib/libcrypto/rc4/rc4test.c
new file mode 100644
index 0000000000..633a79e758
--- /dev/null
+++ b/src/lib/libcrypto/rc4/rc4test.c
@@ -0,0 +1,236 @@
1/* crypto/rc4/rc4test.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
59#include <stdio.h>
60#include <stdlib.h>
61#include <string.h>
62
63#include "../e_os.h"
64
65#ifdef OPENSSL_NO_RC4
66int main(int argc, char *argv[])
67{
68 printf("No RC4 support\n");
69 return(0);
70}
71#else
72#include <openssl/rc4.h>
73#include <openssl/sha.h>
74
75static unsigned char keys[7][30]={
76 {8,0x01,0x23,0x45,0x67,0x89,0xab,0xcd,0xef},
77 {8,0x01,0x23,0x45,0x67,0x89,0xab,0xcd,0xef},
78 {8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
79 {4,0xef,0x01,0x23,0x45},
80 {8,0x01,0x23,0x45,0x67,0x89,0xab,0xcd,0xef},
81 {4,0xef,0x01,0x23,0x45},
82 };
83
84static unsigned char data_len[7]={8,8,8,20,28,10};
85static unsigned char data[7][30]={
86 {0x01,0x23,0x45,0x67,0x89,0xab,0xcd,0xef,0xff},
87 {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff},
88 {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff},
89 {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
90 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
91 0x00,0x00,0x00,0x00,0xff},
92 {0x12,0x34,0x56,0x78,0x9A,0xBC,0xDE,0xF0,
93 0x12,0x34,0x56,0x78,0x9A,0xBC,0xDE,0xF0,
94 0x12,0x34,0x56,0x78,0x9A,0xBC,0xDE,0xF0,
95 0x12,0x34,0x56,0x78,0xff},
96 {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff},
97 {0},
98 };
99
100static unsigned char output[7][30]={
101 {0x75,0xb7,0x87,0x80,0x99,0xe0,0xc5,0x96,0x00},
102 {0x74,0x94,0xc2,0xe7,0x10,0x4b,0x08,0x79,0x00},
103 {0xde,0x18,0x89,0x41,0xa3,0x37,0x5d,0x3a,0x00},
104 {0xd6,0xa1,0x41,0xa7,0xec,0x3c,0x38,0xdf,
105 0xbd,0x61,0x5a,0x11,0x62,0xe1,0xc7,0xba,
106 0x36,0xb6,0x78,0x58,0x00},
107 {0x66,0xa0,0x94,0x9f,0x8a,0xf7,0xd6,0x89,
108 0x1f,0x7f,0x83,0x2b,0xa8,0x33,0xc0,0x0c,
109 0x89,0x2e,0xbe,0x30,0x14,0x3c,0xe2,0x87,
110 0x40,0x01,0x1e,0xcf,0x00},
111 {0xd6,0xa1,0x41,0xa7,0xec,0x3c,0x38,0xdf,0xbd,0x61,0x00},
112 {0},
113 };
114
115int main(int argc, char *argv[])
116 {
117 int i,err=0;
118 int j;
119 unsigned char *p;
120 RC4_KEY key;
121 unsigned char obuf[512];
122
123 for (i=0; i<6; i++)
124 {
125 RC4_set_key(&key,keys[i][0],&(keys[i][1]));
126 memset(obuf,0x00,sizeof(obuf));
127 RC4(&key,data_len[i],&(data[i][0]),obuf);
128 if (memcmp(obuf,output[i],data_len[i]+1) != 0)
129 {
130 printf("error calculating RC4\n");
131 printf("output:");
132 for (j=0; j<data_len[i]+1; j++)
133 printf(" %02x",obuf[j]);
134 printf("\n");
135 printf("expect:");
136 p= &(output[i][0]);
137 for (j=0; j<data_len[i]+1; j++)
138 printf(" %02x",*(p++));
139 printf("\n");
140 err++;
141 }
142 else
143 printf("test %d ok\n",i);
144 }
145 printf("test end processing ");
146 for (i=0; i<data_len[3]; i++)
147 {
148 RC4_set_key(&key,keys[3][0],&(keys[3][1]));
149 memset(obuf,0x00,sizeof(obuf));
150 RC4(&key,i,&(data[3][0]),obuf);
151 if ((memcmp(obuf,output[3],i) != 0) || (obuf[i] != 0))
152 {
153 printf("error in RC4 length processing\n");
154 printf("output:");
155 for (j=0; j<i+1; j++)
156 printf(" %02x",obuf[j]);
157 printf("\n");
158 printf("expect:");
159 p= &(output[3][0]);
160 for (j=0; j<i; j++)
161 printf(" %02x",*(p++));
162 printf(" 00\n");
163 err++;
164 }
165 else
166 {
167 printf(".");
168 fflush(stdout);
169 }
170 }
171 printf("done\n");
172 printf("test multi-call ");
173 for (i=0; i<data_len[3]; i++)
174 {
175 RC4_set_key(&key,keys[3][0],&(keys[3][1]));
176 memset(obuf,0x00,sizeof(obuf));
177 RC4(&key,i,&(data[3][0]),obuf);
178 RC4(&key,data_len[3]-i,&(data[3][i]),&(obuf[i]));
179 if (memcmp(obuf,output[3],data_len[3]+1) != 0)
180 {
181 printf("error in RC4 multi-call processing\n");
182 printf("output:");
183 for (j=0; j<data_len[3]+1; j++)
184 printf(" %02x",obuf[j]);
185 printf("\n");
186 printf("expect:");
187 p= &(output[3][0]);
188 for (j=0; j<data_len[3]+1; j++)
189 printf(" %02x",*(p++));
190 err++;
191 }
192 else
193 {
194 printf(".");
195 fflush(stdout);
196 }
197 }
198 printf("done\n");
199 printf("bulk test ");
200 { unsigned char buf[513];
201 SHA_CTX c;
202 unsigned char md[SHA_DIGEST_LENGTH];
203 static unsigned char expected[]={
204 0xa4,0x7b,0xcc,0x00,0x3d,0xd0,0xbd,0xe1,0xac,0x5f,
205 0x12,0x1e,0x45,0xbc,0xfb,0x1a,0xa1,0xf2,0x7f,0xc5 };
206
207 RC4_set_key(&key,keys[0][0],&(keys[3][1]));
208 memset(buf,'\0',sizeof(buf));
209 SHA1_Init(&c);
210 for (i=0;i<2571;i++) {
211 RC4(&key,sizeof(buf),buf,buf);
212 SHA1_Update(&c,buf,sizeof(buf));
213 }
214 SHA1_Final(md,&c);
215
216 if (memcmp(md,expected,sizeof(md))) {
217 printf("error in RC4 bulk test\n");
218 printf("output:");
219 for (j=0; j<(int)sizeof(md); j++)
220 printf(" %02x",md[j]);
221 printf("\n");
222 printf("expect:");
223 for (j=0; j<(int)sizeof(md); j++)
224 printf(" %02x",expected[j]);
225 printf("\n");
226 err++;
227 }
228 else printf("ok\n");
229 }
230#ifdef OPENSSL_SYS_NETWARE
231 if (err) printf("ERROR: %d\n", err);
232#endif
233 EXIT(err);
234 return(0);
235 }
236#endif
diff --git a/src/lib/libcrypto/rc4/rrc4.doc b/src/lib/libcrypto/rc4/rrc4.doc
new file mode 100644
index 0000000000..2f9a953c12
--- /dev/null
+++ b/src/lib/libcrypto/rc4/rrc4.doc
@@ -0,0 +1,278 @@
1Newsgroups: sci.crypt,alt.security,comp.security.misc,alt.privacy
2Path: ghost.dsi.unimi.it!univ-lyon1.fr!jussieu.fr!zaphod.crihan.fr!warwick!clyde.open.ac.uk!strath-cs!bnr.co.uk!bt!pipex!howland.reston.ans.net!europa.eng.gtefsd.com!MathWorks.Com!yeshua.marcam.com!charnel.ecst.csuchico.edu!csusac!csus.edu!netcom.com!sterndark
3From: sterndark@netcom.com (David Sterndark)
4Subject: RC4 Algorithm revealed.
5Message-ID: <sternCvKL4B.Hyy@netcom.com>
6Sender: sterndark@netcom.com
7Organization: NETCOM On-line Communication Services (408 261-4700 guest)
8X-Newsreader: TIN [version 1.2 PL1]
9Date: Wed, 14 Sep 1994 06:35:31 GMT
10Lines: 263
11Xref: ghost.dsi.unimi.it sci.crypt:27332 alt.security:14732 comp.security.misc:11701 alt.privacy:16026
12
13I am shocked, shocked, I tell you, shocked, to discover
14that the cypherpunks have illegaly and criminally revealed
15a crucial RSA trade secret and harmed the security of
16America by reverse engineering the RC4 algorithm and
17publishing it to the world.
18
19On Saturday morning an anonymous cypherpunk wrote:
20
21
22 SUBJECT: RC4 Source Code
23
24
25 I've tested this. It is compatible with the RC4 object module
26 that comes in the various RSA toolkits.
27
28 /* rc4.h */
29 typedef struct rc4_key
30 {
31 unsigned char state[256];
32 unsigned char x;
33 unsigned char y;
34 } rc4_key;
35 void prepare_key(unsigned char *key_data_ptr,int key_data_len,
36 rc4_key *key);
37 void rc4(unsigned char *buffer_ptr,int buffer_len,rc4_key * key);
38
39
40 /*rc4.c */
41 #include "rc4.h"
42 static void swap_byte(unsigned char *a, unsigned char *b);
43 void prepare_key(unsigned char *key_data_ptr, int key_data_len,
44 rc4_key *key)
45 {
46 unsigned char swapByte;
47 unsigned char index1;
48 unsigned char index2;
49 unsigned char* state;
50 short counter;
51
52 state = &key->state[0];
53 for(counter = 0; counter < 256; counter++)
54 state[counter] = counter;
55 key->x = 0;
56 key->y = 0;
57 index1 = 0;
58 index2 = 0;
59 for(counter = 0; counter < 256; counter++)
60 {
61 index2 = (key_data_ptr[index1] + state[counter] +
62 index2) % 256;
63 swap_byte(&state[counter], &state[index2]);
64
65 index1 = (index1 + 1) % key_data_len;
66 }
67 }
68
69 void rc4(unsigned char *buffer_ptr, int buffer_len, rc4_key *key)
70 {
71 unsigned char x;
72 unsigned char y;
73 unsigned char* state;
74 unsigned char xorIndex;
75 short counter;
76
77 x = key->x;
78 y = key->y;
79
80 state = &key->state[0];
81 for(counter = 0; counter < buffer_len; counter ++)
82 {
83 x = (x + 1) % 256;
84 y = (state[x] + y) % 256;
85 swap_byte(&state[x], &state[y]);
86
87 xorIndex = (state[x] + state[y]) % 256;
88
89 buffer_ptr[counter] ^= state[xorIndex];
90 }
91 key->x = x;
92 key->y = y;
93 }
94
95 static void swap_byte(unsigned char *a, unsigned char *b)
96 {
97 unsigned char swapByte;
98
99 swapByte = *a;
100 *a = *b;
101 *b = swapByte;
102 }
103
104
105
106Another cypherpunk, this one not anonymous, tested the
107output from this algorithm against the output from
108official RC4 object code
109
110
111 Date: Tue, 13 Sep 94 18:37:56 PDT
112 From: ekr@eit.COM (Eric Rescorla)
113 Message-Id: <9409140137.AA17743@eitech.eit.com>
114 Subject: RC4 compatibility testing
115 Cc: cypherpunks@toad.com
116
117 One data point:
118
119 I can't say anything about the internals of RC4 versus the
120 algorithm that Bill Sommerfeld is rightly calling 'Alleged RC4',
121 since I don't know anything about RC4's internals.
122
123 However, I do have a (legitimately acquired) copy of BSAFE2 and
124 so I'm able to compare the output of this algorithm to the output
125 of genuine RC4 as found in BSAFE. I chose a set of test vectors
126 and ran them through both algorithms. The algorithms appear to
127 give identical results, at least with these key/plaintext pairs.
128
129 I note that this is the algorithm _without_ Hal Finney's
130 proposed modification
131
132 (see <199409130605.XAA24133@jobe.shell.portal.com>).
133
134 The vectors I used (together with the ciphertext they produce)
135 follow at the end of this message.
136
137 -Ekr
138
139 Disclaimer: This posting does not reflect the opinions of EIT.
140
141 --------------------results follow--------------
142 Test vector 0
143 Key: 0x01 0x23 0x45 0x67 0x89 0xab 0xcd 0xef
144 Input: 0x01 0x23 0x45 0x67 0x89 0xab 0xcd 0xef
145 0 Output: 0x75 0xb7 0x87 0x80 0x99 0xe0 0xc5 0x96
146
147 Test vector 1
148 Key: 0x01 0x23 0x45 0x67 0x89 0xab 0xcd 0xef
149 Input: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
150 0 Output: 0x74 0x94 0xc2 0xe7 0x10 0x4b 0x08 0x79
151
152 Test vector 2
153 Key: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
154 Input: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
155 0 Output: 0xde 0x18 0x89 0x41 0xa3 0x37 0x5d 0x3a
156
157 Test vector 3
158 Key: 0xef 0x01 0x23 0x45
159 Input: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
160 0 Output: 0xd6 0xa1 0x41 0xa7 0xec 0x3c 0x38 0xdf 0xbd 0x61
161
162 Test vector 4
163 Key: 0x01 0x23 0x45 0x67 0x89 0xab 0xcd 0xef
164 Input: 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01
165 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01
166 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01
167 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01
168 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01
169 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01
170 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01
171 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01
172 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01
173 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01
174 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01
175 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01
176 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01
177 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01
178 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01
179 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01
180 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01
181 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01
182 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01
183 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01
184 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01
185 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01
186 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01
187 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01
188 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01
189 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01
190 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01
191 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01
192 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01
193 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01
194 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01
195 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01
196 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01
197 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01
198 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01
199 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01
200 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01
201 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01
202 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01
203 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01
204 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01
205 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01
206 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01
207 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01
208 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01
209 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01
210 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01
211 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01
212 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01
213 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01
214 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01
215 0x01
216 0 Output: 0x75 0x95 0xc3 0xe6 0x11 0x4a 0x09 0x78 0x0c 0x4a 0xd4
217 0x52 0x33 0x8e 0x1f 0xfd 0x9a 0x1b 0xe9 0x49 0x8f
218 0x81 0x3d 0x76 0x53 0x34 0x49 0xb6 0x77 0x8d 0xca
219 0xd8 0xc7 0x8a 0x8d 0x2b 0xa9 0xac 0x66 0x08 0x5d
220 0x0e 0x53 0xd5 0x9c 0x26 0xc2 0xd1 0xc4 0x90 0xc1
221 0xeb 0xbe 0x0c 0xe6 0x6d 0x1b 0x6b 0x1b 0x13 0xb6
222 0xb9 0x19 0xb8 0x47 0xc2 0x5a 0x91 0x44 0x7a 0x95
223 0xe7 0x5e 0x4e 0xf1 0x67 0x79 0xcd 0xe8 0xbf 0x0a
224 0x95 0x85 0x0e 0x32 0xaf 0x96 0x89 0x44 0x4f 0xd3
225 0x77 0x10 0x8f 0x98 0xfd 0xcb 0xd4 0xe7 0x26 0x56
226 0x75 0x00 0x99 0x0b 0xcc 0x7e 0x0c 0xa3 0xc4 0xaa
227 0xa3 0x04 0xa3 0x87 0xd2 0x0f 0x3b 0x8f 0xbb 0xcd
228 0x42 0xa1 0xbd 0x31 0x1d 0x7a 0x43 0x03 0xdd 0xa5
229 0xab 0x07 0x88 0x96 0xae 0x80 0xc1 0x8b 0x0a 0xf6
230 0x6d 0xff 0x31 0x96 0x16 0xeb 0x78 0x4e 0x49 0x5a
231 0xd2 0xce 0x90 0xd7 0xf7 0x72 0xa8 0x17 0x47 0xb6
232 0x5f 0x62 0x09 0x3b 0x1e 0x0d 0xb9 0xe5 0xba 0x53
233 0x2f 0xaf 0xec 0x47 0x50 0x83 0x23 0xe6 0x71 0x32
234 0x7d 0xf9 0x44 0x44 0x32 0xcb 0x73 0x67 0xce 0xc8
235 0x2f 0x5d 0x44 0xc0 0xd0 0x0b 0x67 0xd6 0x50 0xa0
236 0x75 0xcd 0x4b 0x70 0xde 0xdd 0x77 0xeb 0x9b 0x10
237 0x23 0x1b 0x6b 0x5b 0x74 0x13 0x47 0x39 0x6d 0x62
238 0x89 0x74 0x21 0xd4 0x3d 0xf9 0xb4 0x2e 0x44 0x6e
239 0x35 0x8e 0x9c 0x11 0xa9 0xb2 0x18 0x4e 0xcb 0xef
240 0x0c 0xd8 0xe7 0xa8 0x77 0xef 0x96 0x8f 0x13 0x90
241 0xec 0x9b 0x3d 0x35 0xa5 0x58 0x5c 0xb0 0x09 0x29
242 0x0e 0x2f 0xcd 0xe7 0xb5 0xec 0x66 0xd9 0x08 0x4b
243 0xe4 0x40 0x55 0xa6 0x19 0xd9 0xdd 0x7f 0xc3 0x16
244 0x6f 0x94 0x87 0xf7 0xcb 0x27 0x29 0x12 0x42 0x64
245 0x45 0x99 0x85 0x14 0xc1 0x5d 0x53 0xa1 0x8c 0x86
246 0x4c 0xe3 0xa2 0xb7 0x55 0x57 0x93 0x98 0x81 0x26
247 0x52 0x0e 0xac 0xf2 0xe3 0x06 0x6e 0x23 0x0c 0x91
248 0xbe 0xe4 0xdd 0x53 0x04 0xf5 0xfd 0x04 0x05 0xb3
249 0x5b 0xd9 0x9c 0x73 0x13 0x5d 0x3d 0x9b 0xc3 0x35
250 0xee 0x04 0x9e 0xf6 0x9b 0x38 0x67 0xbf 0x2d 0x7b
251 0xd1 0xea 0xa5 0x95 0xd8 0xbf 0xc0 0x06 0x6f 0xf8
252 0xd3 0x15 0x09 0xeb 0x0c 0x6c 0xaa 0x00 0x6c 0x80
253 0x7a 0x62 0x3e 0xf8 0x4c 0x3d 0x33 0xc1 0x95 0xd2
254 0x3e 0xe3 0x20 0xc4 0x0d 0xe0 0x55 0x81 0x57 0xc8
255 0x22 0xd4 0xb8 0xc5 0x69 0xd8 0x49 0xae 0xd5 0x9d
256 0x4e 0x0f 0xd7 0xf3 0x79 0x58 0x6b 0x4b 0x7f 0xf6
257 0x84 0xed 0x6a 0x18 0x9f 0x74 0x86 0xd4 0x9b 0x9c
258 0x4b 0xad 0x9b 0xa2 0x4b 0x96 0xab 0xf9 0x24 0x37
259 0x2c 0x8a 0x8f 0xff 0xb1 0x0d 0x55 0x35 0x49 0x00
260 0xa7 0x7a 0x3d 0xb5 0xf2 0x05 0xe1 0xb9 0x9f 0xcd
261 0x86 0x60 0x86 0x3a 0x15 0x9a 0xd4 0xab 0xe4 0x0f
262 0xa4 0x89 0x34 0x16 0x3d 0xdd 0xe5 0x42 0xa6 0x58
263 0x55 0x40 0xfd 0x68 0x3c 0xbf 0xd8 0xc0 0x0f 0x12
264 0x12 0x9a 0x28 0x4d 0xea 0xcc 0x4c 0xde 0xfe 0x58
265 0xbe 0x71 0x37 0x54 0x1c 0x04 0x71 0x26 0xc8 0xd4
266 0x9e 0x27 0x55 0xab 0x18 0x1a 0xb7 0xe9 0x40 0xb0
267 0xc0
268
269
270
271--
272 ---------------------------------------------------------------------
273We have the right to defend ourselves and our
274property, because of the kind of animals that we James A. Donald
275are. True law derives from this right, not from
276the arbitrary power of the omnipotent state. jamesd@netcom.com
277
278
diff --git a/src/lib/libcrypto/rc5/Makefile b/src/lib/libcrypto/rc5/Makefile
new file mode 100644
index 0000000000..8a8b00eb89
--- /dev/null
+++ b/src/lib/libcrypto/rc5/Makefile
@@ -0,0 +1,94 @@
1#
2# OpenSSL/crypto/rc5/Makefile
3#
4
5DIR= rc5
6TOP= ../..
7CC= cc
8CPP= $(CC) -E
9INCLUDES=
10CFLAG=-g
11MAKEFILE= Makefile
12AR= ar r
13
14RC5_ENC= rc5_enc.o
15
16CFLAGS= $(INCLUDES) $(CFLAG)
17ASFLAGS= $(INCLUDES) $(ASFLAG)
18AFLAGS= $(ASFLAGS)
19
20GENERAL=Makefile
21TEST=rc5test.c
22APPS=
23
24LIB=$(TOP)/libcrypto.a
25LIBSRC=rc5_skey.c rc5_ecb.c rc5_enc.c rc5cfb64.c rc5ofb64.c
26LIBOBJ=rc5_skey.o rc5_ecb.o $(RC5_ENC) rc5cfb64.o rc5ofb64.o
27
28SRC= $(LIBSRC)
29
30EXHEADER= rc5.h
31HEADER= rc5_locl.h $(EXHEADER)
32
33ALL= $(GENERAL) $(SRC) $(HEADER)
34
35top:
36 (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all)
37
38all: lib
39
40lib: $(LIBOBJ)
41 $(AR) $(LIB) $(LIBOBJ)
42 $(RANLIB) $(LIB) || echo Never mind.
43 @touch lib
44
45rc5-586.s: asm/rc5-586.pl ../perlasm/x86asm.pl ../perlasm/cbc.pl
46 $(PERL) asm/rc5-586.pl $(PERLASM_SCHEME) $(CFLAGS) > $@
47
48files:
49 $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
50
51links:
52 @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
53 @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
54 @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
55
56install:
57 @[ -n "$(INSTALLTOP)" ] # should be set by top Makefile...
58 @headerlist="$(EXHEADER)"; for i in $$headerlist ; \
59 do \
60 (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
61 chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
62 done;
63
64tags:
65 ctags $(SRC)
66
67tests:
68
69lint:
70 lint -DLINT $(INCLUDES) $(SRC)>fluff
71
72depend:
73 @[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile...
74 $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
75
76dclean:
77 $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
78 mv -f Makefile.new $(MAKEFILE)
79
80clean:
81 rm -f *.s *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
82
83# DO NOT DELETE THIS LINE -- make depend depends on it.
84
85rc5_ecb.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
86rc5_ecb.o: ../../include/openssl/rc5.h rc5_ecb.c rc5_locl.h
87rc5_enc.o: ../../include/openssl/opensslconf.h ../../include/openssl/rc5.h
88rc5_enc.o: rc5_enc.c rc5_locl.h
89rc5_skey.o: ../../include/openssl/opensslconf.h ../../include/openssl/rc5.h
90rc5_skey.o: rc5_locl.h rc5_skey.c
91rc5cfb64.o: ../../include/openssl/opensslconf.h ../../include/openssl/rc5.h
92rc5cfb64.o: rc5_locl.h rc5cfb64.c
93rc5ofb64.o: ../../include/openssl/opensslconf.h ../../include/openssl/rc5.h
94rc5ofb64.o: rc5_locl.h rc5ofb64.c
diff --git a/src/lib/libcrypto/rc5/rc5.h b/src/lib/libcrypto/rc5/rc5.h
new file mode 100644
index 0000000000..4b3c153b50
--- /dev/null
+++ b/src/lib/libcrypto/rc5/rc5.h
@@ -0,0 +1,118 @@
1/* crypto/rc5/rc5.h */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
59#ifndef HEADER_RC5_H
60#define HEADER_RC5_H
61
62#include <openssl/opensslconf.h> /* OPENSSL_NO_RC5 */
63
64#ifdef __cplusplus
65extern "C" {
66#endif
67
68#ifdef OPENSSL_NO_RC5
69#error RC5 is disabled.
70#endif
71
72#define RC5_ENCRYPT 1
73#define RC5_DECRYPT 0
74
75/* 32 bit. For Alpha, things may get weird */
76#define RC5_32_INT unsigned long
77
78#define RC5_32_BLOCK 8
79#define RC5_32_KEY_LENGTH 16 /* This is a default, max is 255 */
80
81/* This are the only values supported. Tweak the code if you want more
82 * The most supported modes will be
83 * RC5-32/12/16
84 * RC5-32/16/8
85 */
86#define RC5_8_ROUNDS 8
87#define RC5_12_ROUNDS 12
88#define RC5_16_ROUNDS 16
89
90typedef struct rc5_key_st
91 {
92 /* Number of rounds */
93 int rounds;
94 RC5_32_INT data[2*(RC5_16_ROUNDS+1)];
95 } RC5_32_KEY;
96
97
98void RC5_32_set_key(RC5_32_KEY *key, int len, const unsigned char *data,
99 int rounds);
100void RC5_32_ecb_encrypt(const unsigned char *in,unsigned char *out,RC5_32_KEY *key,
101 int enc);
102void RC5_32_encrypt(unsigned long *data,RC5_32_KEY *key);
103void RC5_32_decrypt(unsigned long *data,RC5_32_KEY *key);
104void RC5_32_cbc_encrypt(const unsigned char *in, unsigned char *out,
105 long length, RC5_32_KEY *ks, unsigned char *iv,
106 int enc);
107void RC5_32_cfb64_encrypt(const unsigned char *in, unsigned char *out,
108 long length, RC5_32_KEY *schedule,
109 unsigned char *ivec, int *num, int enc);
110void RC5_32_ofb64_encrypt(const unsigned char *in, unsigned char *out,
111 long length, RC5_32_KEY *schedule,
112 unsigned char *ivec, int *num);
113
114#ifdef __cplusplus
115}
116#endif
117
118#endif
diff --git a/src/lib/libcrypto/rc5/rc5_ecb.c b/src/lib/libcrypto/rc5/rc5_ecb.c
new file mode 100644
index 0000000000..e72b535507
--- /dev/null
+++ b/src/lib/libcrypto/rc5/rc5_ecb.c
@@ -0,0 +1,80 @@
1/* crypto/rc5/rc5_ecb.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
59#include <openssl/rc5.h>
60#include "rc5_locl.h"
61#include <openssl/opensslv.h>
62
63const char RC5_version[]="RC5" OPENSSL_VERSION_PTEXT;
64
65void RC5_32_ecb_encrypt(const unsigned char *in, unsigned char *out,
66 RC5_32_KEY *ks, int encrypt)
67 {
68 unsigned long l,d[2];
69
70 c2l(in,l); d[0]=l;
71 c2l(in,l); d[1]=l;
72 if (encrypt)
73 RC5_32_encrypt(d,ks);
74 else
75 RC5_32_decrypt(d,ks);
76 l=d[0]; l2c(l,out);
77 l=d[1]; l2c(l,out);
78 l=d[0]=d[1]=0;
79 }
80
diff --git a/src/lib/libcrypto/rc5/rc5_enc.c b/src/lib/libcrypto/rc5/rc5_enc.c
new file mode 100644
index 0000000000..f327d32a76
--- /dev/null
+++ b/src/lib/libcrypto/rc5/rc5_enc.c
@@ -0,0 +1,215 @@
1/* crypto/rc5/rc5_enc.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
59#include <stdio.h>
60#include <openssl/rc5.h>
61#include "rc5_locl.h"
62
63void RC5_32_cbc_encrypt(const unsigned char *in, unsigned char *out,
64 long length, RC5_32_KEY *ks, unsigned char *iv,
65 int encrypt)
66 {
67 register unsigned long tin0,tin1;
68 register unsigned long tout0,tout1,xor0,xor1;
69 register long l=length;
70 unsigned long tin[2];
71
72 if (encrypt)
73 {
74 c2l(iv,tout0);
75 c2l(iv,tout1);
76 iv-=8;
77 for (l-=8; l>=0; l-=8)
78 {
79 c2l(in,tin0);
80 c2l(in,tin1);
81 tin0^=tout0;
82 tin1^=tout1;
83 tin[0]=tin0;
84 tin[1]=tin1;
85 RC5_32_encrypt(tin,ks);
86 tout0=tin[0]; l2c(tout0,out);
87 tout1=tin[1]; l2c(tout1,out);
88 }
89 if (l != -8)
90 {
91 c2ln(in,tin0,tin1,l+8);
92 tin0^=tout0;
93 tin1^=tout1;
94 tin[0]=tin0;
95 tin[1]=tin1;
96 RC5_32_encrypt(tin,ks);
97 tout0=tin[0]; l2c(tout0,out);
98 tout1=tin[1]; l2c(tout1,out);
99 }
100 l2c(tout0,iv);
101 l2c(tout1,iv);
102 }
103 else
104 {
105 c2l(iv,xor0);
106 c2l(iv,xor1);
107 iv-=8;
108 for (l-=8; l>=0; l-=8)
109 {
110 c2l(in,tin0); tin[0]=tin0;
111 c2l(in,tin1); tin[1]=tin1;
112 RC5_32_decrypt(tin,ks);
113 tout0=tin[0]^xor0;
114 tout1=tin[1]^xor1;
115 l2c(tout0,out);
116 l2c(tout1,out);
117 xor0=tin0;
118 xor1=tin1;
119 }
120 if (l != -8)
121 {
122 c2l(in,tin0); tin[0]=tin0;
123 c2l(in,tin1); tin[1]=tin1;
124 RC5_32_decrypt(tin,ks);
125 tout0=tin[0]^xor0;
126 tout1=tin[1]^xor1;
127 l2cn(tout0,tout1,out,l+8);
128 xor0=tin0;
129 xor1=tin1;
130 }
131 l2c(xor0,iv);
132 l2c(xor1,iv);
133 }
134 tin0=tin1=tout0=tout1=xor0=xor1=0;
135 tin[0]=tin[1]=0;
136 }
137
138void RC5_32_encrypt(unsigned long *d, RC5_32_KEY *key)
139 {
140 RC5_32_INT a,b,*s;
141
142 s=key->data;
143
144 a=d[0]+s[0];
145 b=d[1]+s[1];
146 E_RC5_32(a,b,s, 2);
147 E_RC5_32(a,b,s, 4);
148 E_RC5_32(a,b,s, 6);
149 E_RC5_32(a,b,s, 8);
150 E_RC5_32(a,b,s,10);
151 E_RC5_32(a,b,s,12);
152 E_RC5_32(a,b,s,14);
153 E_RC5_32(a,b,s,16);
154 if (key->rounds == 12)
155 {
156 E_RC5_32(a,b,s,18);
157 E_RC5_32(a,b,s,20);
158 E_RC5_32(a,b,s,22);
159 E_RC5_32(a,b,s,24);
160 }
161 else if (key->rounds == 16)
162 {
163 /* Do a full expansion to avoid a jump */
164 E_RC5_32(a,b,s,18);
165 E_RC5_32(a,b,s,20);
166 E_RC5_32(a,b,s,22);
167 E_RC5_32(a,b,s,24);
168 E_RC5_32(a,b,s,26);
169 E_RC5_32(a,b,s,28);
170 E_RC5_32(a,b,s,30);
171 E_RC5_32(a,b,s,32);
172 }
173 d[0]=a;
174 d[1]=b;
175 }
176
177void RC5_32_decrypt(unsigned long *d, RC5_32_KEY *key)
178 {
179 RC5_32_INT a,b,*s;
180
181 s=key->data;
182
183 a=d[0];
184 b=d[1];
185 if (key->rounds == 16)
186 {
187 D_RC5_32(a,b,s,32);
188 D_RC5_32(a,b,s,30);
189 D_RC5_32(a,b,s,28);
190 D_RC5_32(a,b,s,26);
191 /* Do a full expansion to avoid a jump */
192 D_RC5_32(a,b,s,24);
193 D_RC5_32(a,b,s,22);
194 D_RC5_32(a,b,s,20);
195 D_RC5_32(a,b,s,18);
196 }
197 else if (key->rounds == 12)
198 {
199 D_RC5_32(a,b,s,24);
200 D_RC5_32(a,b,s,22);
201 D_RC5_32(a,b,s,20);
202 D_RC5_32(a,b,s,18);
203 }
204 D_RC5_32(a,b,s,16);
205 D_RC5_32(a,b,s,14);
206 D_RC5_32(a,b,s,12);
207 D_RC5_32(a,b,s,10);
208 D_RC5_32(a,b,s, 8);
209 D_RC5_32(a,b,s, 6);
210 D_RC5_32(a,b,s, 4);
211 D_RC5_32(a,b,s, 2);
212 d[0]=a-s[0];
213 d[1]=b-s[1];
214 }
215
diff --git a/src/lib/libcrypto/rc5/rc5_locl.h b/src/lib/libcrypto/rc5/rc5_locl.h
new file mode 100644
index 0000000000..d337f73fad
--- /dev/null
+++ b/src/lib/libcrypto/rc5/rc5_locl.h
@@ -0,0 +1,207 @@
1/* crypto/rc5/rc5_locl.h */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
59#include <stdlib.h>
60
61#undef c2l
62#define c2l(c,l) (l =((unsigned long)(*((c)++))) , \
63 l|=((unsigned long)(*((c)++)))<< 8L, \
64 l|=((unsigned long)(*((c)++)))<<16L, \
65 l|=((unsigned long)(*((c)++)))<<24L)
66
67/* NOTE - c is not incremented as per c2l */
68#undef c2ln
69#define c2ln(c,l1,l2,n) { \
70 c+=n; \
71 l1=l2=0; \
72 switch (n) { \
73 case 8: l2 =((unsigned long)(*(--(c))))<<24L; \
74 case 7: l2|=((unsigned long)(*(--(c))))<<16L; \
75 case 6: l2|=((unsigned long)(*(--(c))))<< 8L; \
76 case 5: l2|=((unsigned long)(*(--(c)))); \
77 case 4: l1 =((unsigned long)(*(--(c))))<<24L; \
78 case 3: l1|=((unsigned long)(*(--(c))))<<16L; \
79 case 2: l1|=((unsigned long)(*(--(c))))<< 8L; \
80 case 1: l1|=((unsigned long)(*(--(c)))); \
81 } \
82 }
83
84#undef l2c
85#define l2c(l,c) (*((c)++)=(unsigned char)(((l) )&0xff), \
86 *((c)++)=(unsigned char)(((l)>> 8L)&0xff), \
87 *((c)++)=(unsigned char)(((l)>>16L)&0xff), \
88 *((c)++)=(unsigned char)(((l)>>24L)&0xff))
89
90/* NOTE - c is not incremented as per l2c */
91#undef l2cn
92#define l2cn(l1,l2,c,n) { \
93 c+=n; \
94 switch (n) { \
95 case 8: *(--(c))=(unsigned char)(((l2)>>24L)&0xff); \
96 case 7: *(--(c))=(unsigned char)(((l2)>>16L)&0xff); \
97 case 6: *(--(c))=(unsigned char)(((l2)>> 8L)&0xff); \
98 case 5: *(--(c))=(unsigned char)(((l2) )&0xff); \
99 case 4: *(--(c))=(unsigned char)(((l1)>>24L)&0xff); \
100 case 3: *(--(c))=(unsigned char)(((l1)>>16L)&0xff); \
101 case 2: *(--(c))=(unsigned char)(((l1)>> 8L)&0xff); \
102 case 1: *(--(c))=(unsigned char)(((l1) )&0xff); \
103 } \
104 }
105
106/* NOTE - c is not incremented as per n2l */
107#define n2ln(c,l1,l2,n) { \
108 c+=n; \
109 l1=l2=0; \
110 switch (n) { \
111 case 8: l2 =((unsigned long)(*(--(c)))) ; \
112 case 7: l2|=((unsigned long)(*(--(c))))<< 8; \
113 case 6: l2|=((unsigned long)(*(--(c))))<<16; \
114 case 5: l2|=((unsigned long)(*(--(c))))<<24; \
115 case 4: l1 =((unsigned long)(*(--(c)))) ; \
116 case 3: l1|=((unsigned long)(*(--(c))))<< 8; \
117 case 2: l1|=((unsigned long)(*(--(c))))<<16; \
118 case 1: l1|=((unsigned long)(*(--(c))))<<24; \
119 } \
120 }
121
122/* NOTE - c is not incremented as per l2n */
123#define l2nn(l1,l2,c,n) { \
124 c+=n; \
125 switch (n) { \
126 case 8: *(--(c))=(unsigned char)(((l2) )&0xff); \
127 case 7: *(--(c))=(unsigned char)(((l2)>> 8)&0xff); \
128 case 6: *(--(c))=(unsigned char)(((l2)>>16)&0xff); \
129 case 5: *(--(c))=(unsigned char)(((l2)>>24)&0xff); \
130 case 4: *(--(c))=(unsigned char)(((l1) )&0xff); \
131 case 3: *(--(c))=(unsigned char)(((l1)>> 8)&0xff); \
132 case 2: *(--(c))=(unsigned char)(((l1)>>16)&0xff); \
133 case 1: *(--(c))=(unsigned char)(((l1)>>24)&0xff); \
134 } \
135 }
136
137#undef n2l
138#define n2l(c,l) (l =((unsigned long)(*((c)++)))<<24L, \
139 l|=((unsigned long)(*((c)++)))<<16L, \
140 l|=((unsigned long)(*((c)++)))<< 8L, \
141 l|=((unsigned long)(*((c)++))))
142
143#undef l2n
144#define l2n(l,c) (*((c)++)=(unsigned char)(((l)>>24L)&0xff), \
145 *((c)++)=(unsigned char)(((l)>>16L)&0xff), \
146 *((c)++)=(unsigned char)(((l)>> 8L)&0xff), \
147 *((c)++)=(unsigned char)(((l) )&0xff))
148
149#if (defined(OPENSSL_SYS_WIN32) && defined(_MSC_VER)) || defined(__ICC)
150#define ROTATE_l32(a,n) _lrotl(a,n)
151#define ROTATE_r32(a,n) _lrotr(a,n)
152#elif defined(__GNUC__) && __GNUC__>=2 && !defined(__STRICT_ANSI__) && !defined(OPENSSL_NO_ASM) && !defined(OPENSSL_NO_INLINE_ASM) && !defined(PEDANTIC)
153# if defined(__i386) || defined(__i386__) || defined(__x86_64) || defined(__x86_64__)
154# define ROTATE_l32(a,n) ({ register unsigned int ret; \
155 asm ("roll %%cl,%0" \
156 : "=r"(ret) \
157 : "c"(n),"0"((unsigned int)(a)) \
158 : "cc"); \
159 ret; \
160 })
161# define ROTATE_r32(a,n) ({ register unsigned int ret; \
162 asm ("rorl %%cl,%0" \
163 : "=r"(ret) \
164 : "c"(n),"0"((unsigned int)(a)) \
165 : "cc"); \
166 ret; \
167 })
168# endif
169#endif
170#ifndef ROTATE_l32
171#define ROTATE_l32(a,n) (((a)<<(n&0x1f))|(((a)&0xffffffff)>>(32-(n&0x1f))))
172#endif
173#ifndef ROTATE_r32
174#define ROTATE_r32(a,n) (((a)<<(32-(n&0x1f)))|(((a)&0xffffffff)>>(n&0x1f)))
175#endif
176
177#define RC5_32_MASK 0xffffffffL
178
179#define RC5_16_P 0xB7E1
180#define RC5_16_Q 0x9E37
181#define RC5_32_P 0xB7E15163L
182#define RC5_32_Q 0x9E3779B9L
183#define RC5_64_P 0xB7E151628AED2A6BLL
184#define RC5_64_Q 0x9E3779B97F4A7C15LL
185
186#define E_RC5_32(a,b,s,n) \
187 a^=b; \
188 a=ROTATE_l32(a,b); \
189 a+=s[n]; \
190 a&=RC5_32_MASK; \
191 b^=a; \
192 b=ROTATE_l32(b,a); \
193 b+=s[n+1]; \
194 b&=RC5_32_MASK;
195
196#define D_RC5_32(a,b,s,n) \
197 b-=s[n+1]; \
198 b&=RC5_32_MASK; \
199 b=ROTATE_r32(b,a); \
200 b^=a; \
201 a-=s[n]; \
202 a&=RC5_32_MASK; \
203 a=ROTATE_r32(a,b); \
204 a^=b;
205
206
207
diff --git a/src/lib/libcrypto/rc5/rc5_skey.c b/src/lib/libcrypto/rc5/rc5_skey.c
new file mode 100644
index 0000000000..a2e00a41c5
--- /dev/null
+++ b/src/lib/libcrypto/rc5/rc5_skey.c
@@ -0,0 +1,113 @@
1/* crypto/rc5/rc5_skey.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
59#include <openssl/rc5.h>
60#include "rc5_locl.h"
61
62void RC5_32_set_key(RC5_32_KEY *key, int len, const unsigned char *data,
63 int rounds)
64 {
65 RC5_32_INT L[64],l,ll,A,B,*S,k;
66 int i,j,m,c,t,ii,jj;
67
68 if ( (rounds != RC5_16_ROUNDS) &&
69 (rounds != RC5_12_ROUNDS) &&
70 (rounds != RC5_8_ROUNDS))
71 rounds=RC5_16_ROUNDS;
72
73 key->rounds=rounds;
74 S= &(key->data[0]);
75 j=0;
76 for (i=0; i<=(len-8); i+=8)
77 {
78 c2l(data,l);
79 L[j++]=l;
80 c2l(data,l);
81 L[j++]=l;
82 }
83 ii=len-i;
84 if (ii)
85 {
86 k=len&0x07;
87 c2ln(data,l,ll,k);
88 L[j+0]=l;
89 L[j+1]=ll;
90 }
91
92 c=(len+3)/4;
93 t=(rounds+1)*2;
94 S[0]=RC5_32_P;
95 for (i=1; i<t; i++)
96 S[i]=(S[i-1]+RC5_32_Q)&RC5_32_MASK;
97
98 j=(t>c)?t:c;
99 j*=3;
100 ii=jj=0;
101 A=B=0;
102 for (i=0; i<j; i++)
103 {
104 k=(S[ii]+A+B)&RC5_32_MASK;
105 A=S[ii]=ROTATE_l32(k,3);
106 m=(int)(A+B);
107 k=(L[jj]+A+B)&RC5_32_MASK;
108 B=L[jj]=ROTATE_l32(k,m);
109 if (++ii >= t) ii=0;
110 if (++jj >= c) jj=0;
111 }
112 }
113
diff --git a/src/lib/libcrypto/rc5/rc5cfb64.c b/src/lib/libcrypto/rc5/rc5cfb64.c
new file mode 100644
index 0000000000..3a8b60bc7a
--- /dev/null
+++ b/src/lib/libcrypto/rc5/rc5cfb64.c
@@ -0,0 +1,122 @@
1/* crypto/rc5/rc5cfb64.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
59#include <openssl/rc5.h>
60#include "rc5_locl.h"
61
62/* The input and output encrypted as though 64bit cfb mode is being
63 * used. The extra state information to record how much of the
64 * 64bit block we have used is contained in *num;
65 */
66
67void RC5_32_cfb64_encrypt(const unsigned char *in, unsigned char *out,
68 long length, RC5_32_KEY *schedule,
69 unsigned char *ivec, int *num, int encrypt)
70 {
71 register unsigned long v0,v1,t;
72 register int n= *num;
73 register long l=length;
74 unsigned long ti[2];
75 unsigned char *iv,c,cc;
76
77 iv=(unsigned char *)ivec;
78 if (encrypt)
79 {
80 while (l--)
81 {
82 if (n == 0)
83 {
84 c2l(iv,v0); ti[0]=v0;
85 c2l(iv,v1); ti[1]=v1;
86 RC5_32_encrypt((unsigned long *)ti,schedule);
87 iv=(unsigned char *)ivec;
88 t=ti[0]; l2c(t,iv);
89 t=ti[1]; l2c(t,iv);
90 iv=(unsigned char *)ivec;
91 }
92 c= *(in++)^iv[n];
93 *(out++)=c;
94 iv[n]=c;
95 n=(n+1)&0x07;
96 }
97 }
98 else
99 {
100 while (l--)
101 {
102 if (n == 0)
103 {
104 c2l(iv,v0); ti[0]=v0;
105 c2l(iv,v1); ti[1]=v1;
106 RC5_32_encrypt((unsigned long *)ti,schedule);
107 iv=(unsigned char *)ivec;
108 t=ti[0]; l2c(t,iv);
109 t=ti[1]; l2c(t,iv);
110 iv=(unsigned char *)ivec;
111 }
112 cc= *(in++);
113 c=iv[n];
114 iv[n]=cc;
115 *(out++)=c^cc;
116 n=(n+1)&0x07;
117 }
118 }
119 v0=v1=ti[0]=ti[1]=t=c=cc=0;
120 *num=n;
121 }
122
diff --git a/src/lib/libcrypto/rc5/rc5ofb64.c b/src/lib/libcrypto/rc5/rc5ofb64.c
new file mode 100644
index 0000000000..d412215f3c
--- /dev/null
+++ b/src/lib/libcrypto/rc5/rc5ofb64.c
@@ -0,0 +1,111 @@
1/* crypto/rc5/rc5ofb64.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
59#include <openssl/rc5.h>
60#include "rc5_locl.h"
61
62/* The input and output encrypted as though 64bit ofb mode is being
63 * used. The extra state information to record how much of the
64 * 64bit block we have used is contained in *num;
65 */
66void RC5_32_ofb64_encrypt(const unsigned char *in, unsigned char *out,
67 long length, RC5_32_KEY *schedule,
68 unsigned char *ivec, int *num)
69 {
70 register unsigned long v0,v1,t;
71 register int n= *num;
72 register long l=length;
73 unsigned char d[8];
74 register char *dp;
75 unsigned long ti[2];
76 unsigned char *iv;
77 int save=0;
78
79 iv=(unsigned char *)ivec;
80 c2l(iv,v0);
81 c2l(iv,v1);
82 ti[0]=v0;
83 ti[1]=v1;
84 dp=(char *)d;
85 l2c(v0,dp);
86 l2c(v1,dp);
87 while (l--)
88 {
89 if (n == 0)
90 {
91 RC5_32_encrypt((unsigned long *)ti,schedule);
92 dp=(char *)d;
93 t=ti[0]; l2c(t,dp);
94 t=ti[1]; l2c(t,dp);
95 save++;
96 }
97 *(out++)= *(in++)^d[n];
98 n=(n+1)&0x07;
99 }
100 if (save)
101 {
102 v0=ti[0];
103 v1=ti[1];
104 iv=(unsigned char *)ivec;
105 l2c(v0,iv);
106 l2c(v1,iv);
107 }
108 t=v0=v1=ti[0]=ti[1]=0;
109 *num=n;
110 }
111
diff --git a/src/lib/libcrypto/rc5/rc5s.cpp b/src/lib/libcrypto/rc5/rc5s.cpp
new file mode 100644
index 0000000000..1c5518bc80
--- /dev/null
+++ b/src/lib/libcrypto/rc5/rc5s.cpp
@@ -0,0 +1,70 @@
1//
2// gettsc.inl
3//
4// gives access to the Pentium's (secret) cycle counter
5//
6// This software was written by Leonard Janke (janke@unixg.ubc.ca)
7// in 1996-7 and is entered, by him, into the public domain.
8
9#if defined(__WATCOMC__)
10void GetTSC(unsigned long&);
11#pragma aux GetTSC = 0x0f 0x31 "mov [edi], eax" parm [edi] modify [edx eax];
12#elif defined(__GNUC__)
13inline
14void GetTSC(unsigned long& tsc)
15{
16 asm volatile(".byte 15, 49\n\t"
17 : "=eax" (tsc)
18 :
19 : "%edx", "%eax");
20}
21#elif defined(_MSC_VER)
22inline
23void GetTSC(unsigned long& tsc)
24{
25 unsigned long a;
26 __asm _emit 0fh
27 __asm _emit 31h
28 __asm mov a, eax;
29 tsc=a;
30}
31#endif
32
33#include <stdio.h>
34#include <stdlib.h>
35#include <openssl/rc5.h>
36
37void main(int argc,char *argv[])
38 {
39 RC5_32_KEY key;
40 unsigned long s1,s2,e1,e2;
41 unsigned long data[2];
42 int i,j;
43 static unsigned char d[16]={0x01,0x23,0x45,0x67,0x89,0xAB,0xCD,0xEF};
44
45 RC5_32_set_key(&key, 16,d,12);
46
47 for (j=0; j<6; j++)
48 {
49 for (i=0; i<1000; i++) /**/
50 {
51 RC5_32_encrypt(&data[0],&key);
52 GetTSC(s1);
53 RC5_32_encrypt(&data[0],&key);
54 RC5_32_encrypt(&data[0],&key);
55 RC5_32_encrypt(&data[0],&key);
56 GetTSC(e1);
57 GetTSC(s2);
58 RC5_32_encrypt(&data[0],&key);
59 RC5_32_encrypt(&data[0],&key);
60 RC5_32_encrypt(&data[0],&key);
61 RC5_32_encrypt(&data[0],&key);
62 GetTSC(e2);
63 RC5_32_encrypt(&data[0],&key);
64 }
65
66 printf("cast %d %d (%d)\n",
67 e1-s1,e2-s2,((e2-s2)-(e1-s1)));
68 }
69 }
70
diff --git a/src/lib/libcrypto/rc5/rc5speed.c b/src/lib/libcrypto/rc5/rc5speed.c
new file mode 100644
index 0000000000..8e363be535
--- /dev/null
+++ b/src/lib/libcrypto/rc5/rc5speed.c
@@ -0,0 +1,277 @@
1/* crypto/rc5/rc5speed.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
59/* 11-Sep-92 Andrew Daviel Support for Silicon Graphics IRIX added */
60/* 06-Apr-92 Luke Brennan Support for VMS and add extra signal calls */
61
62#if !defined(OPENSSL_SYS_MSDOS) && (!defined(OPENSSL_SYS_VMS) || defined(__DECC)) && !defined(OPENSSL_SYS_MACOSX)
63#define TIMES
64#endif
65
66#include <stdio.h>
67
68#include <openssl/e_os2.h>
69#include OPENSSL_UNISTD_IO
70OPENSSL_DECLARE_EXIT
71
72#ifndef OPENSSL_SYS_NETWARE
73#include <signal.h>
74#endif
75
76#ifndef _IRIX
77#include <time.h>
78#endif
79#ifdef TIMES
80#include <sys/types.h>
81#include <sys/times.h>
82#endif
83
84/* Depending on the VMS version, the tms structure is perhaps defined.
85 The __TMS macro will show if it was. If it wasn't defined, we should
86 undefine TIMES, since that tells the rest of the program how things
87 should be handled. -- Richard Levitte */
88#if defined(OPENSSL_SYS_VMS_DECC) && !defined(__TMS)
89#undef TIMES
90#endif
91
92#ifndef TIMES
93#include <sys/timeb.h>
94#endif
95
96#if defined(sun) || defined(__ultrix)
97#define _POSIX_SOURCE
98#include <limits.h>
99#include <sys/param.h>
100#endif
101
102#include <openssl/rc5.h>
103
104/* The following if from times(3) man page. It may need to be changed */
105#ifndef HZ
106#ifndef CLK_TCK
107#define HZ 100.0
108#else /* CLK_TCK */
109#define HZ ((double)CLK_TCK)
110#endif
111#endif
112
113#define BUFSIZE ((long)1024)
114long run=0;
115
116double Time_F(int s);
117#ifdef SIGALRM
118#if defined(__STDC__) || defined(sgi) || defined(_AIX)
119#define SIGRETTYPE void
120#else
121#define SIGRETTYPE int
122#endif
123
124SIGRETTYPE sig_done(int sig);
125SIGRETTYPE sig_done(int sig)
126 {
127 signal(SIGALRM,sig_done);
128 run=0;
129#ifdef LINT
130 sig=sig;
131#endif
132 }
133#endif
134
135#define START 0
136#define STOP 1
137
138double Time_F(int s)
139 {
140 double ret;
141#ifdef TIMES
142 static struct tms tstart,tend;
143
144 if (s == START)
145 {
146 times(&tstart);
147 return(0);
148 }
149 else
150 {
151 times(&tend);
152 ret=((double)(tend.tms_utime-tstart.tms_utime))/HZ;
153 return((ret == 0.0)?1e-6:ret);
154 }
155#else /* !times() */
156 static struct timeb tstart,tend;
157 long i;
158
159 if (s == START)
160 {
161 ftime(&tstart);
162 return(0);
163 }
164 else
165 {
166 ftime(&tend);
167 i=(long)tend.millitm-(long)tstart.millitm;
168 ret=((double)(tend.time-tstart.time))+((double)i)/1e3;
169 return((ret == 0.0)?1e-6:ret);
170 }
171#endif
172 }
173
174int main(int argc, char **argv)
175 {
176 long count;
177 static unsigned char buf[BUFSIZE];
178 static unsigned char key[] ={
179 0x12,0x34,0x56,0x78,0x9a,0xbc,0xde,0xf0,
180 0xfe,0xdc,0xba,0x98,0x76,0x54,0x32,0x10,
181 };
182 RC5_32_KEY sch;
183 double a,b,c,d;
184#ifndef SIGALRM
185 long ca,cb,cc;
186#endif
187
188#ifndef TIMES
189 printf("To get the most accurate results, try to run this\n");
190 printf("program when this computer is idle.\n");
191#endif
192
193#ifndef SIGALRM
194 printf("First we calculate the approximate speed ...\n");
195 RC5_32_set_key(&sch,16,key,12);
196 count=10;
197 do {
198 long i;
199 unsigned long data[2];
200
201 count*=2;
202 Time_F(START);
203 for (i=count; i; i--)
204 RC5_32_encrypt(data,&sch);
205 d=Time_F(STOP);
206 } while (d < 3.0);
207 ca=count/512;
208 cb=count;
209 cc=count*8/BUFSIZE+1;
210 printf("Doing RC5_32_set_key %ld times\n",ca);
211#define COND(d) (count != (d))
212#define COUNT(d) (d)
213#else
214#define COND(c) (run)
215#define COUNT(d) (count)
216 signal(SIGALRM,sig_done);
217 printf("Doing RC5_32_set_key for 10 seconds\n");
218 alarm(10);
219#endif
220
221 Time_F(START);
222 for (count=0,run=1; COND(ca); count+=4)
223 {
224 RC5_32_set_key(&sch,16,key,12);
225 RC5_32_set_key(&sch,16,key,12);
226 RC5_32_set_key(&sch,16,key,12);
227 RC5_32_set_key(&sch,16,key,12);
228 }
229 d=Time_F(STOP);
230 printf("%ld RC5_32_set_key's in %.2f seconds\n",count,d);
231 a=((double)COUNT(ca))/d;
232
233#ifdef SIGALRM
234 printf("Doing RC5_32_encrypt's for 10 seconds\n");
235 alarm(10);
236#else
237 printf("Doing RC5_32_encrypt %ld times\n",cb);
238#endif
239 Time_F(START);
240 for (count=0,run=1; COND(cb); count+=4)
241 {
242 unsigned long data[2];
243
244 RC5_32_encrypt(data,&sch);
245 RC5_32_encrypt(data,&sch);
246 RC5_32_encrypt(data,&sch);
247 RC5_32_encrypt(data,&sch);
248 }
249 d=Time_F(STOP);
250 printf("%ld RC5_32_encrypt's in %.2f second\n",count,d);
251 b=((double)COUNT(cb)*8)/d;
252
253#ifdef SIGALRM
254 printf("Doing RC5_32_cbc_encrypt on %ld byte blocks for 10 seconds\n",
255 BUFSIZE);
256 alarm(10);
257#else
258 printf("Doing RC5_32_cbc_encrypt %ld times on %ld byte blocks\n",cc,
259 BUFSIZE);
260#endif
261 Time_F(START);
262 for (count=0,run=1; COND(cc); count++)
263 RC5_32_cbc_encrypt(buf,buf,BUFSIZE,&sch,
264 &(key[0]),RC5_ENCRYPT);
265 d=Time_F(STOP);
266 printf("%ld RC5_32_cbc_encrypt's of %ld byte blocks in %.2f second\n",
267 count,BUFSIZE,d);
268 c=((double)COUNT(cc)*BUFSIZE)/d;
269
270 printf("RC5_32/12/16 set_key per sec = %12.2f (%9.3fuS)\n",a,1.0e6/a);
271 printf("RC5_32/12/16 raw ecb bytes per sec = %12.2f (%9.3fuS)\n",b,8.0e6/b);
272 printf("RC5_32/12/16 cbc bytes per sec = %12.2f (%9.3fuS)\n",c,8.0e6/c);
273 exit(0);
274#if defined(LINT) || defined(OPENSSL_SYS_MSDOS)
275 return(0);
276#endif
277 }
diff --git a/src/lib/libcrypto/rc5/rc5test.c b/src/lib/libcrypto/rc5/rc5test.c
new file mode 100644
index 0000000000..ce3d0cc16f
--- /dev/null
+++ b/src/lib/libcrypto/rc5/rc5test.c
@@ -0,0 +1,386 @@
1/* crypto/rc5/rc5test.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
59/* This has been a quickly hacked 'ideatest.c'. When I add tests for other
60 * RC5 modes, more of the code will be uncommented. */
61
62#include <stdio.h>
63#include <string.h>
64#include <stdlib.h>
65
66#include "../e_os.h"
67
68#ifdef OPENSSL_NO_RC5
69int main(int argc, char *argv[])
70{
71 printf("No RC5 support\n");
72 return(0);
73}
74#else
75#include <openssl/rc5.h>
76
77static unsigned char RC5key[5][16]={
78 {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
79 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
80 {0x91,0x5f,0x46,0x19,0xbe,0x41,0xb2,0x51,
81 0x63,0x55,0xa5,0x01,0x10,0xa9,0xce,0x91},
82 {0x78,0x33,0x48,0xe7,0x5a,0xeb,0x0f,0x2f,
83 0xd7,0xb1,0x69,0xbb,0x8d,0xc1,0x67,0x87},
84 {0xdc,0x49,0xdb,0x13,0x75,0xa5,0x58,0x4f,
85 0x64,0x85,0xb4,0x13,0xb5,0xf1,0x2b,0xaf},
86 {0x52,0x69,0xf1,0x49,0xd4,0x1b,0xa0,0x15,
87 0x24,0x97,0x57,0x4d,0x7f,0x15,0x31,0x25},
88 };
89
90static unsigned char RC5plain[5][8]={
91 {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
92 {0x21,0xA5,0xDB,0xEE,0x15,0x4B,0x8F,0x6D},
93 {0xF7,0xC0,0x13,0xAC,0x5B,0x2B,0x89,0x52},
94 {0x2F,0x42,0xB3,0xB7,0x03,0x69,0xFC,0x92},
95 {0x65,0xC1,0x78,0xB2,0x84,0xD1,0x97,0xCC},
96 };
97
98static unsigned char RC5cipher[5][8]={
99 {0x21,0xA5,0xDB,0xEE,0x15,0x4B,0x8F,0x6D},
100 {0xF7,0xC0,0x13,0xAC,0x5B,0x2B,0x89,0x52},
101 {0x2F,0x42,0xB3,0xB7,0x03,0x69,0xFC,0x92},
102 {0x65,0xC1,0x78,0xB2,0x84,0xD1,0x97,0xCC},
103 {0xEB,0x44,0xE4,0x15,0xDA,0x31,0x98,0x24},
104 };
105
106#define RC5_CBC_NUM 27
107static unsigned char rc5_cbc_cipher[RC5_CBC_NUM][8]={
108 {0x7a,0x7b,0xba,0x4d,0x79,0x11,0x1d,0x1e},
109 {0x79,0x7b,0xba,0x4d,0x78,0x11,0x1d,0x1e},
110 {0x7a,0x7b,0xba,0x4d,0x79,0x11,0x1d,0x1f},
111 {0x7a,0x7b,0xba,0x4d,0x79,0x11,0x1d,0x1f},
112 {0x8b,0x9d,0xed,0x91,0xce,0x77,0x94,0xa6},
113 {0x2f,0x75,0x9f,0xe7,0xad,0x86,0xa3,0x78},
114 {0xdc,0xa2,0x69,0x4b,0xf4,0x0e,0x07,0x88},
115 {0xdc,0xa2,0x69,0x4b,0xf4,0x0e,0x07,0x88},
116 {0xdc,0xfe,0x09,0x85,0x77,0xec,0xa5,0xff},
117 {0x96,0x46,0xfb,0x77,0x63,0x8f,0x9c,0xa8},
118 {0xb2,0xb3,0x20,0x9d,0xb6,0x59,0x4d,0xa4},
119 {0x54,0x5f,0x7f,0x32,0xa5,0xfc,0x38,0x36},
120 {0x82,0x85,0xe7,0xc1,0xb5,0xbc,0x74,0x02},
121 {0xfc,0x58,0x6f,0x92,0xf7,0x08,0x09,0x34},
122 {0xcf,0x27,0x0e,0xf9,0x71,0x7f,0xf7,0xc4},
123 {0xe4,0x93,0xf1,0xc1,0xbb,0x4d,0x6e,0x8c},
124 {0x5c,0x4c,0x04,0x1e,0x0f,0x21,0x7a,0xc3},
125 {0x92,0x1f,0x12,0x48,0x53,0x73,0xb4,0xf7},
126 {0x5b,0xa0,0xca,0x6b,0xbe,0x7f,0x5f,0xad},
127 {0xc5,0x33,0x77,0x1c,0xd0,0x11,0x0e,0x63},
128 {0x29,0x4d,0xdb,0x46,0xb3,0x27,0x8d,0x60},
129 {0xda,0xd6,0xbd,0xa9,0xdf,0xe8,0xf7,0xe8},
130 {0x97,0xe0,0x78,0x78,0x37,0xed,0x31,0x7f},
131 {0x78,0x75,0xdb,0xf6,0x73,0x8c,0x64,0x78},
132 {0x8f,0x34,0xc3,0xc6,0x81,0xc9,0x96,0x95},
133 {0x7c,0xb3,0xf1,0xdf,0x34,0xf9,0x48,0x11},
134 {0x7f,0xd1,0xa0,0x23,0xa5,0xbb,0xa2,0x17},
135 };
136
137static unsigned char rc5_cbc_key[RC5_CBC_NUM][17]={
138 { 1,0x00},
139 { 1,0x00},
140 { 1,0x00},
141 { 1,0x00},
142 { 1,0x00},
143 { 1,0x11},
144 { 1,0x00},
145 { 4,0x00,0x00,0x00,0x00},
146 { 1,0x00},
147 { 1,0x00},
148 { 1,0x00},
149 { 1,0x00},
150 { 4,0x01,0x02,0x03,0x04},
151 { 4,0x01,0x02,0x03,0x04},
152 { 4,0x01,0x02,0x03,0x04},
153 { 8,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08},
154 { 8,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08},
155 { 8,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08},
156 { 8,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08},
157 {16,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,
158 0x10,0x20,0x30,0x40,0x50,0x60,0x70,0x80},
159 {16,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,
160 0x10,0x20,0x30,0x40,0x50,0x60,0x70,0x80},
161 {16,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,
162 0x10,0x20,0x30,0x40,0x50,0x60,0x70,0x80},
163 { 5,0x01,0x02,0x03,0x04,0x05},
164 { 5,0x01,0x02,0x03,0x04,0x05},
165 { 5,0x01,0x02,0x03,0x04,0x05},
166 { 5,0x01,0x02,0x03,0x04,0x05},
167 { 5,0x01,0x02,0x03,0x04,0x05},
168 };
169
170static unsigned char rc5_cbc_plain[RC5_CBC_NUM][8]={
171 {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
172 {0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff},
173 {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
174 {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01},
175 {0x10,0x20,0x30,0x40,0x50,0x60,0x70,0x80},
176 {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
177 {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
178 {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
179 {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
180 {0x10,0x20,0x30,0x40,0x50,0x60,0x70,0x80},
181 {0x10,0x20,0x30,0x40,0x50,0x60,0x70,0x80},
182 {0x10,0x20,0x30,0x40,0x50,0x60,0x70,0x80},
183 {0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff},
184 {0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff},
185 {0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff},
186 {0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff},
187 {0x10,0x20,0x30,0x40,0x50,0x60,0x70,0x80},
188 {0x10,0x20,0x30,0x40,0x50,0x60,0x70,0x80},
189 {0x10,0x20,0x30,0x40,0x50,0x60,0x70,0x80},
190 {0x10,0x20,0x30,0x40,0x50,0x60,0x70,0x80},
191 {0x10,0x20,0x30,0x40,0x50,0x60,0x70,0x80},
192 {0x10,0x20,0x30,0x40,0x50,0x60,0x70,0x80},
193 {0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff},
194 {0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff},
195 {0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08},
196 {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
197 {0x11,0x22,0x33,0x44,0x55,0x66,0x77,0x01},
198 };
199
200static int rc5_cbc_rounds[RC5_CBC_NUM]={
201 0, 0, 0, 0, 0, 1, 2, 2,
202 8, 8,12,16, 8,12,16,12,
203 8,12,16, 8,12,16,12, 8,
204 8, 8, 8,
205 };
206
207static unsigned char rc5_cbc_iv[RC5_CBC_NUM][8]={
208 {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
209 {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
210 {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01},
211 {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
212 {0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08},
213 {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
214 {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
215 {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
216 {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
217 {0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08},
218 {0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08},
219 {0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08},
220 {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
221 {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
222 {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
223 {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
224 {0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08},
225 {0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08},
226 {0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08},
227 {0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08},
228 {0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08},
229 {0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08},
230 {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
231 {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
232 {0x78,0x75,0xdb,0xf6,0x73,0x8c,0x64,0x78},
233 {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
234 {0x7c,0xb3,0xf1,0xdf,0x34,0xf9,0x48,0x11},
235 };
236
237int main(int argc, char *argv[])
238 {
239 int i,n,err=0;
240 RC5_32_KEY key;
241 unsigned char buf[8],buf2[8],ivb[8];
242
243 for (n=0; n<5; n++)
244 {
245 RC5_32_set_key(&key,16,&(RC5key[n][0]),12);
246
247 RC5_32_ecb_encrypt(&(RC5plain[n][0]),buf,&key,RC5_ENCRYPT);
248 if (memcmp(&(RC5cipher[n][0]),buf,8) != 0)
249 {
250 printf("ecb RC5 error encrypting (%d)\n",n+1);
251 printf("got :");
252 for (i=0; i<8; i++)
253 printf("%02X ",buf[i]);
254 printf("\n");
255 printf("expected:");
256 for (i=0; i<8; i++)
257 printf("%02X ",RC5cipher[n][i]);
258 err=20;
259 printf("\n");
260 }
261
262 RC5_32_ecb_encrypt(buf,buf2,&key,RC5_DECRYPT);
263 if (memcmp(&(RC5plain[n][0]),buf2,8) != 0)
264 {
265 printf("ecb RC5 error decrypting (%d)\n",n+1);
266 printf("got :");
267 for (i=0; i<8; i++)
268 printf("%02X ",buf2[i]);
269 printf("\n");
270 printf("expected:");
271 for (i=0; i<8; i++)
272 printf("%02X ",RC5plain[n][i]);
273 printf("\n");
274 err=3;
275 }
276 }
277 if (err == 0) printf("ecb RC5 ok\n");
278
279 for (n=0; n<RC5_CBC_NUM; n++)
280 {
281 i=rc5_cbc_rounds[n];
282 if (i < 8) continue;
283
284 RC5_32_set_key(&key,rc5_cbc_key[n][0],&(rc5_cbc_key[n][1]),i);
285
286 memcpy(ivb,&(rc5_cbc_iv[n][0]),8);
287 RC5_32_cbc_encrypt(&(rc5_cbc_plain[n][0]),buf,8,
288 &key,&(ivb[0]),RC5_ENCRYPT);
289
290 if (memcmp(&(rc5_cbc_cipher[n][0]),buf,8) != 0)
291 {
292 printf("cbc RC5 error encrypting (%d)\n",n+1);
293 printf("got :");
294 for (i=0; i<8; i++)
295 printf("%02X ",buf[i]);
296 printf("\n");
297 printf("expected:");
298 for (i=0; i<8; i++)
299 printf("%02X ",rc5_cbc_cipher[n][i]);
300 err=30;
301 printf("\n");
302 }
303
304 memcpy(ivb,&(rc5_cbc_iv[n][0]),8);
305 RC5_32_cbc_encrypt(buf,buf2,8,
306 &key,&(ivb[0]),RC5_DECRYPT);
307 if (memcmp(&(rc5_cbc_plain[n][0]),buf2,8) != 0)
308 {
309 printf("cbc RC5 error decrypting (%d)\n",n+1);
310 printf("got :");
311 for (i=0; i<8; i++)
312 printf("%02X ",buf2[i]);
313 printf("\n");
314 printf("expected:");
315 for (i=0; i<8; i++)
316 printf("%02X ",rc5_cbc_plain[n][i]);
317 printf("\n");
318 err=3;
319 }
320 }
321 if (err == 0) printf("cbc RC5 ok\n");
322
323 EXIT(err);
324 return(err);
325 }
326
327#ifdef undef
328static int cfb64_test(unsigned char *cfb_cipher)
329 {
330 IDEA_KEY_SCHEDULE eks,dks;
331 int err=0,i,n;
332
333 idea_set_encrypt_key(cfb_key,&eks);
334 idea_set_decrypt_key(&eks,&dks);
335 memcpy(cfb_tmp,cfb_iv,8);
336 n=0;
337 idea_cfb64_encrypt(plain,cfb_buf1,(long)12,&eks,
338 cfb_tmp,&n,IDEA_ENCRYPT);
339 idea_cfb64_encrypt(&(plain[12]),&(cfb_buf1[12]),
340 (long)CFB_TEST_SIZE-12,&eks,
341 cfb_tmp,&n,IDEA_ENCRYPT);
342 if (memcmp(cfb_cipher,cfb_buf1,CFB_TEST_SIZE) != 0)
343 {
344 err=1;
345 printf("idea_cfb64_encrypt encrypt error\n");
346 for (i=0; i<CFB_TEST_SIZE; i+=8)
347 printf("%s\n",pt(&(cfb_buf1[i])));
348 }
349 memcpy(cfb_tmp,cfb_iv,8);
350 n=0;
351 idea_cfb64_encrypt(cfb_buf1,cfb_buf2,(long)17,&eks,
352 cfb_tmp,&n,IDEA_DECRYPT);
353 idea_cfb64_encrypt(&(cfb_buf1[17]),&(cfb_buf2[17]),
354 (long)CFB_TEST_SIZE-17,&dks,
355 cfb_tmp,&n,IDEA_DECRYPT);
356 if (memcmp(plain,cfb_buf2,CFB_TEST_SIZE) != 0)
357 {
358 err=1;
359 printf("idea_cfb_encrypt decrypt error\n");
360 for (i=0; i<24; i+=8)
361 printf("%s\n",pt(&(cfb_buf2[i])));
362 }
363 return(err);
364 }
365
366static char *pt(unsigned char *p)
367 {
368 static char bufs[10][20];
369 static int bnum=0;
370 char *ret;
371 int i;
372 static char *f="0123456789ABCDEF";
373
374 ret= &(bufs[bnum++][0]);
375 bnum%=10;
376 for (i=0; i<8; i++)
377 {
378 ret[i*2]=f[(p[i]>>4)&0xf];
379 ret[i*2+1]=f[p[i]&0xf];
380 }
381 ret[16]='\0';
382 return(ret);
383 }
384
385#endif
386#endif
diff --git a/src/lib/libcrypto/ripemd/Makefile b/src/lib/libcrypto/ripemd/Makefile
new file mode 100644
index 0000000000..25140b2a73
--- /dev/null
+++ b/src/lib/libcrypto/ripemd/Makefile
@@ -0,0 +1,95 @@
1#
2# OpenSSL/crypto/ripemd/Makefile
3#
4
5DIR= ripemd
6TOP= ../..
7CC= cc
8CPP= $(CC) -E
9INCLUDES=
10CFLAG=-g
11MAKEFILE= Makefile
12AR= ar r
13
14RIP_ASM_OBJ=
15
16CFLAGS= $(INCLUDES) $(CFLAG)
17ASFLAGS= $(INCLUDES) $(ASFLAG)
18AFLAGS= $(ASFLAGS)
19
20GENERAL=Makefile
21TEST=rmdtest.c
22APPS=
23
24LIB=$(TOP)/libcrypto.a
25LIBSRC=rmd_dgst.c rmd_one.c
26LIBOBJ=rmd_dgst.o rmd_one.o $(RMD160_ASM_OBJ)
27
28SRC= $(LIBSRC)
29
30EXHEADER= ripemd.h
31HEADER= rmd_locl.h rmdconst.h $(EXHEADER)
32
33ALL= $(GENERAL) $(SRC) $(HEADER)
34
35top:
36 (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all)
37
38all: lib
39
40lib: $(LIBOBJ)
41 $(AR) $(LIB) $(LIBOBJ)
42 $(RANLIB) $(LIB) || echo Never mind.
43 @touch lib
44
45rmd-586.s: asm/rmd-586.pl ../perlasm/x86asm.pl
46 $(PERL) asm/rmd-586.pl $(PERLASM_SCHEME) $(CFLAGS) > $@
47
48files:
49 $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
50
51links:
52 @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
53 @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
54 @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
55
56install:
57 @[ -n "$(INSTALLTOP)" ] # should be set by top Makefile...
58 @headerlist="$(EXHEADER)"; for i in $$headerlist ; \
59 do \
60 (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
61 chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
62 done;
63
64tags:
65 ctags $(SRC)
66
67tests:
68
69lint:
70 lint -DLINT $(INCLUDES) $(SRC)>fluff
71
72depend:
73 @[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile...
74 $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
75
76dclean:
77 $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
78 mv -f Makefile.new $(MAKEFILE)
79
80clean:
81 rm -f *.s *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
82
83# DO NOT DELETE THIS LINE -- make depend depends on it.
84
85rmd_dgst.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
86rmd_dgst.o: ../../include/openssl/opensslconf.h
87rmd_dgst.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
88rmd_dgst.o: ../../include/openssl/ripemd.h ../../include/openssl/safestack.h
89rmd_dgst.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
90rmd_dgst.o: ../md32_common.h rmd_dgst.c rmd_locl.h rmdconst.h
91rmd_one.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
92rmd_one.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
93rmd_one.o: ../../include/openssl/ossl_typ.h ../../include/openssl/ripemd.h
94rmd_one.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
95rmd_one.o: ../../include/openssl/symhacks.h rmd_one.c
diff --git a/src/lib/libcrypto/ripemd/asm/rips.cpp b/src/lib/libcrypto/ripemd/asm/rips.cpp
new file mode 100644
index 0000000000..f7a13677a9
--- /dev/null
+++ b/src/lib/libcrypto/ripemd/asm/rips.cpp
@@ -0,0 +1,82 @@
1//
2// gettsc.inl
3//
4// gives access to the Pentium's (secret) cycle counter
5//
6// This software was written by Leonard Janke (janke@unixg.ubc.ca)
7// in 1996-7 and is entered, by him, into the public domain.
8
9#if defined(__WATCOMC__)
10void GetTSC(unsigned long&);
11#pragma aux GetTSC = 0x0f 0x31 "mov [edi], eax" parm [edi] modify [edx eax];
12#elif defined(__GNUC__)
13inline
14void GetTSC(unsigned long& tsc)
15{
16 asm volatile(".byte 15, 49\n\t"
17 : "=eax" (tsc)
18 :
19 : "%edx", "%eax");
20}
21#elif defined(_MSC_VER)
22inline
23void GetTSC(unsigned long& tsc)
24{
25 unsigned long a;
26 __asm _emit 0fh
27 __asm _emit 31h
28 __asm mov a, eax;
29 tsc=a;
30}
31#endif
32
33#include <stdio.h>
34#include <stdlib.h>
35#include <openssl/ripemd.h>
36
37#define ripemd160_block_x86 ripemd160_block_asm_host_order
38
39extern "C" {
40void ripemd160_block_x86(RIPEMD160_CTX *ctx, unsigned char *buffer,int num);
41}
42
43void main(int argc,char *argv[])
44 {
45 unsigned char buffer[64*256];
46 RIPEMD160_CTX ctx;
47 unsigned long s1,s2,e1,e2;
48 unsigned char k[16];
49 unsigned long data[2];
50 unsigned char iv[8];
51 int i,num=0,numm;
52 int j=0;
53
54 if (argc >= 2)
55 num=atoi(argv[1]);
56
57 if (num == 0) num=16;
58 if (num > 250) num=16;
59 numm=num+2;
60#if 0
61 num*=64;
62 numm*=64;
63#endif
64
65 for (j=0; j<6; j++)
66 {
67 for (i=0; i<10; i++) /**/
68 {
69 ripemd160_block_x86(&ctx,buffer,numm);
70 GetTSC(s1);
71 ripemd160_block_x86(&ctx,buffer,numm);
72 GetTSC(e1);
73 GetTSC(s2);
74 ripemd160_block_x86(&ctx,buffer,num);
75 GetTSC(e2);
76 ripemd160_block_x86(&ctx,buffer,num);
77 }
78 printf("ripemd160 (%d bytes) %d %d (%.2f)\n",num*64,
79 e1-s1,e2-s2,(double)((e1-s1)-(e2-s2))/2);
80 }
81 }
82
diff --git a/src/lib/libcrypto/ripemd/rmd160.c b/src/lib/libcrypto/ripemd/rmd160.c
new file mode 100644
index 0000000000..b0ec574498
--- /dev/null
+++ b/src/lib/libcrypto/ripemd/rmd160.c
@@ -0,0 +1,127 @@
1/* crypto/ripemd/rmd160.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
59#include <stdio.h>
60#include <stdlib.h>
61#include <openssl/ripemd.h>
62
63#define BUFSIZE 1024*16
64
65void do_fp(FILE *f);
66void pt(unsigned char *md);
67#if !defined(_OSD_POSIX) && !defined(__DJGPP__)
68int read(int, void *, unsigned int);
69#endif
70
71int main(int argc, char **argv)
72 {
73 int i,err=0;
74 FILE *IN;
75
76 if (argc == 1)
77 {
78 do_fp(stdin);
79 }
80 else
81 {
82 for (i=1; i<argc; i++)
83 {
84 IN=fopen(argv[i],"r");
85 if (IN == NULL)
86 {
87 perror(argv[i]);
88 err++;
89 continue;
90 }
91 printf("RIPEMD160(%s)= ",argv[i]);
92 do_fp(IN);
93 fclose(IN);
94 }
95 }
96 exit(err);
97 }
98
99void do_fp(FILE *f)
100 {
101 RIPEMD160_CTX c;
102 unsigned char md[RIPEMD160_DIGEST_LENGTH];
103 int fd;
104 int i;
105 static unsigned char buf[BUFSIZE];
106
107 fd=fileno(f);
108 RIPEMD160_Init(&c);
109 for (;;)
110 {
111 i=read(fd,buf,BUFSIZE);
112 if (i <= 0) break;
113 RIPEMD160_Update(&c,buf,(unsigned long)i);
114 }
115 RIPEMD160_Final(&(md[0]),&c);
116 pt(md);
117 }
118
119void pt(unsigned char *md)
120 {
121 int i;
122
123 for (i=0; i<RIPEMD160_DIGEST_LENGTH; i++)
124 printf("%02x",md[i]);
125 printf("\n");
126 }
127
diff --git a/src/lib/libcrypto/ripemd/rmd_dgst.c b/src/lib/libcrypto/ripemd/rmd_dgst.c
index d8e72da51b..9ff1a0705e 100644
--- a/src/lib/libcrypto/ripemd/rmd_dgst.c
+++ b/src/lib/libcrypto/ripemd/rmd_dgst.c
@@ -88,7 +88,7 @@ fips_md_init(RIPEMD160)
88void ripemd160_block_data_order (RIPEMD160_CTX *ctx, const void *p, size_t num) 88void ripemd160_block_data_order (RIPEMD160_CTX *ctx, const void *p, size_t num)
89 { 89 {
90 const unsigned char *data=p; 90 const unsigned char *data=p;
91 register unsigned MD32_REG_T A,B,C,D,E; 91 register volatile unsigned MD32_REG_T A,B,C,D,E;
92 unsigned MD32_REG_T a,b,c,d,e,l; 92 unsigned MD32_REG_T a,b,c,d,e,l;
93#ifndef MD32_XARRAY 93#ifndef MD32_XARRAY
94 /* See comment in crypto/sha/sha_locl.h for details. */ 94 /* See comment in crypto/sha/sha_locl.h for details. */
@@ -105,21 +105,21 @@ void ripemd160_block_data_order (RIPEMD160_CTX *ctx, const void *p, size_t num)
105 105
106 A=ctx->A; B=ctx->B; C=ctx->C; D=ctx->D; E=ctx->E; 106 A=ctx->A; B=ctx->B; C=ctx->C; D=ctx->D; E=ctx->E;
107 107
108 (void)HOST_c2l(data,l); X( 0)=l;(void)HOST_c2l(data,l); X( 1)=l; 108 HOST_c2l(data,l); X( 0)=l; HOST_c2l(data,l); X( 1)=l;
109 RIP1(A,B,C,D,E,WL00,SL00); (void)HOST_c2l(data,l); X( 2)=l; 109 RIP1(A,B,C,D,E,WL00,SL00); HOST_c2l(data,l); X( 2)=l;
110 RIP1(E,A,B,C,D,WL01,SL01); (void)HOST_c2l(data,l); X( 3)=l; 110 RIP1(E,A,B,C,D,WL01,SL01); HOST_c2l(data,l); X( 3)=l;
111 RIP1(D,E,A,B,C,WL02,SL02); (void)HOST_c2l(data,l); X( 4)=l; 111 RIP1(D,E,A,B,C,WL02,SL02); HOST_c2l(data,l); X( 4)=l;
112 RIP1(C,D,E,A,B,WL03,SL03); (void)HOST_c2l(data,l); X( 5)=l; 112 RIP1(C,D,E,A,B,WL03,SL03); HOST_c2l(data,l); X( 5)=l;
113 RIP1(B,C,D,E,A,WL04,SL04); (void)HOST_c2l(data,l); X( 6)=l; 113 RIP1(B,C,D,E,A,WL04,SL04); HOST_c2l(data,l); X( 6)=l;
114 RIP1(A,B,C,D,E,WL05,SL05); (void)HOST_c2l(data,l); X( 7)=l; 114 RIP1(A,B,C,D,E,WL05,SL05); HOST_c2l(data,l); X( 7)=l;
115 RIP1(E,A,B,C,D,WL06,SL06); (void)HOST_c2l(data,l); X( 8)=l; 115 RIP1(E,A,B,C,D,WL06,SL06); HOST_c2l(data,l); X( 8)=l;
116 RIP1(D,E,A,B,C,WL07,SL07); (void)HOST_c2l(data,l); X( 9)=l; 116 RIP1(D,E,A,B,C,WL07,SL07); HOST_c2l(data,l); X( 9)=l;
117 RIP1(C,D,E,A,B,WL08,SL08); (void)HOST_c2l(data,l); X(10)=l; 117 RIP1(C,D,E,A,B,WL08,SL08); HOST_c2l(data,l); X(10)=l;
118 RIP1(B,C,D,E,A,WL09,SL09); (void)HOST_c2l(data,l); X(11)=l; 118 RIP1(B,C,D,E,A,WL09,SL09); HOST_c2l(data,l); X(11)=l;
119 RIP1(A,B,C,D,E,WL10,SL10); (void)HOST_c2l(data,l); X(12)=l; 119 RIP1(A,B,C,D,E,WL10,SL10); HOST_c2l(data,l); X(12)=l;
120 RIP1(E,A,B,C,D,WL11,SL11); (void)HOST_c2l(data,l); X(13)=l; 120 RIP1(E,A,B,C,D,WL11,SL11); HOST_c2l(data,l); X(13)=l;
121 RIP1(D,E,A,B,C,WL12,SL12); (void)HOST_c2l(data,l); X(14)=l; 121 RIP1(D,E,A,B,C,WL12,SL12); HOST_c2l(data,l); X(14)=l;
122 RIP1(C,D,E,A,B,WL13,SL13); (void)HOST_c2l(data,l); X(15)=l; 122 RIP1(C,D,E,A,B,WL13,SL13); HOST_c2l(data,l); X(15)=l;
123 RIP1(B,C,D,E,A,WL14,SL14); 123 RIP1(B,C,D,E,A,WL14,SL14);
124 RIP1(A,B,C,D,E,WL15,SL15); 124 RIP1(A,B,C,D,E,WL15,SL15);
125 125
diff --git a/src/lib/libcrypto/ripemd/rmd_locl.h b/src/lib/libcrypto/ripemd/rmd_locl.h
index 2bd8957d14..f14b346e66 100644
--- a/src/lib/libcrypto/ripemd/rmd_locl.h
+++ b/src/lib/libcrypto/ripemd/rmd_locl.h
@@ -88,11 +88,11 @@ void ripemd160_block_data_order (RIPEMD160_CTX *c, const void *p,size_t num);
88#define HASH_FINAL RIPEMD160_Final 88#define HASH_FINAL RIPEMD160_Final
89#define HASH_MAKE_STRING(c,s) do { \ 89#define HASH_MAKE_STRING(c,s) do { \
90 unsigned long ll; \ 90 unsigned long ll; \
91 ll=(c)->A; (void)HOST_l2c(ll,(s)); \ 91 ll=(c)->A; HOST_l2c(ll,(s)); \
92 ll=(c)->B; (void)HOST_l2c(ll,(s)); \ 92 ll=(c)->B; HOST_l2c(ll,(s)); \
93 ll=(c)->C; (void)HOST_l2c(ll,(s)); \ 93 ll=(c)->C; HOST_l2c(ll,(s)); \
94 ll=(c)->D; (void)HOST_l2c(ll,(s)); \ 94 ll=(c)->D; HOST_l2c(ll,(s)); \
95 ll=(c)->E; (void)HOST_l2c(ll,(s)); \ 95 ll=(c)->E; HOST_l2c(ll,(s)); \
96 } while (0) 96 } while (0)
97#define HASH_BLOCK_DATA_ORDER ripemd160_block_data_order 97#define HASH_BLOCK_DATA_ORDER ripemd160_block_data_order
98 98
diff --git a/src/lib/libcrypto/ripemd/rmdtest.c b/src/lib/libcrypto/ripemd/rmdtest.c
new file mode 100644
index 0000000000..fb34e0e836
--- /dev/null
+++ b/src/lib/libcrypto/ripemd/rmdtest.c
@@ -0,0 +1,145 @@
1/* crypto/ripemd/rmdtest.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
59#include <stdio.h>
60#include <string.h>
61#include <stdlib.h>
62
63#include "../e_os.h"
64
65#ifdef OPENSSL_NO_RIPEMD
66int main(int argc, char *argv[])
67{
68 printf("No ripemd support\n");
69 return(0);
70}
71#else
72#include <openssl/ripemd.h>
73#include <openssl/evp.h>
74
75#ifdef CHARSET_EBCDIC
76#include <openssl/ebcdic.h>
77#endif
78
79static char *test[]={
80 "",
81 "a",
82 "abc",
83 "message digest",
84 "abcdefghijklmnopqrstuvwxyz",
85 "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq",
86 "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",
87 "12345678901234567890123456789012345678901234567890123456789012345678901234567890",
88 NULL,
89 };
90
91static char *ret[]={
92 "9c1185a5c5e9fc54612808977ee8f548b2258d31",
93 "0bdc9d2d256b3ee9daae347be6f4dc835a467ffe",
94 "8eb208f7e05d987a9b044a8e98c6b087f15a0bfc",
95 "5d0689ef49d2fae572b881b123a85ffa21595f36",
96 "f71c27109c692c1b56bbdceb5b9d2865b3708dbc",
97 "12a053384a9c0c88e405a06c27dcf49ada62eb2b",
98 "b0e20b6e3116640286ed3a87a5713079b21f5189",
99 "9b752e45573d4b39f4dbd3323cab82bf63326bfb",
100 };
101
102static char *pt(unsigned char *md);
103int main(int argc, char *argv[])
104 {
105 int i,err=0;
106 char **P,**R;
107 char *p;
108 unsigned char md[RIPEMD160_DIGEST_LENGTH];
109
110 P=test;
111 R=ret;
112 i=1;
113 while (*P != NULL)
114 {
115#ifdef CHARSET_EBCDIC
116 ebcdic2ascii((char *)*P, (char *)*P, strlen((char *)*P));
117#endif
118 EVP_Digest(&(P[0][0]),strlen((char *)*P),md,NULL,EVP_ripemd160(), NULL);
119 p=pt(md);
120 if (strcmp(p,(char *)*R) != 0)
121 {
122 printf("error calculating RIPEMD160 on '%s'\n",*P);
123 printf("got %s instead of %s\n",p,*R);
124 err++;
125 }
126 else
127 printf("test %d ok\n",i);
128 i++;
129 R++;
130 P++;
131 }
132 EXIT(err);
133 return(0);
134 }
135
136static char *pt(unsigned char *md)
137 {
138 int i;
139 static char buf[80];
140
141 for (i=0; i<RIPEMD160_DIGEST_LENGTH; i++)
142 sprintf(&(buf[i*2]),"%02x",md[i]);
143 return(buf);
144 }
145#endif
diff --git a/src/lib/libcrypto/rsa/Makefile b/src/lib/libcrypto/rsa/Makefile
new file mode 100644
index 0000000000..f798d2f749
--- /dev/null
+++ b/src/lib/libcrypto/rsa/Makefile
@@ -0,0 +1,308 @@
1#
2# OpenSSL/crypto/rsa/Makefile
3#
4
5DIR= rsa
6TOP= ../..
7CC= cc
8INCLUDES= -I.. -I$(TOP) -I../../include
9CFLAG=-g
10MAKEFILE= Makefile
11AR= ar r
12
13CFLAGS= $(INCLUDES) $(CFLAG)
14
15GENERAL=Makefile
16TEST=rsa_test.c
17APPS=
18
19LIB=$(TOP)/libcrypto.a
20LIBSRC= rsa_eay.c rsa_gen.c rsa_lib.c rsa_sign.c rsa_saos.c rsa_err.c \
21 rsa_pk1.c rsa_ssl.c rsa_none.c rsa_oaep.c rsa_chk.c rsa_null.c \
22 rsa_pss.c rsa_x931.c rsa_asn1.c rsa_depr.c rsa_ameth.c rsa_prn.c \
23 rsa_pmeth.c rsa_crpt.c
24LIBOBJ= rsa_eay.o rsa_gen.o rsa_lib.o rsa_sign.o rsa_saos.o rsa_err.o \
25 rsa_pk1.o rsa_ssl.o rsa_none.o rsa_oaep.o rsa_chk.o rsa_null.o \
26 rsa_pss.o rsa_x931.o rsa_asn1.o rsa_depr.o rsa_ameth.o rsa_prn.o \
27 rsa_pmeth.o rsa_crpt.o
28
29SRC= $(LIBSRC)
30
31EXHEADER= rsa.h
32HEADER= $(EXHEADER)
33
34ALL= $(GENERAL) $(SRC) $(HEADER)
35
36top:
37 (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all)
38
39all: lib
40
41lib: $(LIBOBJ)
42 $(AR) $(LIB) $(LIBOBJ)
43 $(RANLIB) $(LIB) || echo Never mind.
44 @touch lib
45
46files:
47 $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
48
49links:
50 @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
51 @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
52 @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
53
54install:
55 @[ -n "$(INSTALLTOP)" ] # should be set by top Makefile...
56 @headerlist="$(EXHEADER)"; for i in $$headerlist ; \
57 do \
58 (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
59 chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
60 done;
61
62tags:
63 ctags $(SRC)
64
65tests:
66
67lint:
68 lint -DLINT $(INCLUDES) $(SRC)>fluff
69
70depend:
71 @[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile...
72 $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
73
74dclean:
75 $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
76 mv -f Makefile.new $(MAKEFILE)
77
78clean:
79 rm -f *.o */*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
80
81# DO NOT DELETE THIS LINE -- make depend depends on it.
82
83rsa_ameth.o: ../../e_os.h ../../include/openssl/asn1.h
84rsa_ameth.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
85rsa_ameth.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
86rsa_ameth.o: ../../include/openssl/cms.h ../../include/openssl/crypto.h
87rsa_ameth.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
88rsa_ameth.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
89rsa_ameth.o: ../../include/openssl/err.h ../../include/openssl/evp.h
90rsa_ameth.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
91rsa_ameth.o: ../../include/openssl/objects.h
92rsa_ameth.o: ../../include/openssl/opensslconf.h
93rsa_ameth.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
94rsa_ameth.o: ../../include/openssl/pkcs7.h ../../include/openssl/rsa.h
95rsa_ameth.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
96rsa_ameth.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
97rsa_ameth.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
98rsa_ameth.o: ../asn1/asn1_locl.h ../cryptlib.h rsa_ameth.c
99rsa_asn1.o: ../../e_os.h ../../include/openssl/asn1.h
100rsa_asn1.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
101rsa_asn1.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
102rsa_asn1.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
103rsa_asn1.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
104rsa_asn1.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
105rsa_asn1.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
106rsa_asn1.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
107rsa_asn1.o: ../../include/openssl/opensslconf.h
108rsa_asn1.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
109rsa_asn1.o: ../../include/openssl/pkcs7.h ../../include/openssl/rsa.h
110rsa_asn1.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
111rsa_asn1.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
112rsa_asn1.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
113rsa_asn1.o: ../cryptlib.h rsa_asn1.c
114rsa_chk.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
115rsa_chk.o: ../../include/openssl/bn.h ../../include/openssl/crypto.h
116rsa_chk.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
117rsa_chk.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
118rsa_chk.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
119rsa_chk.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
120rsa_chk.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
121rsa_chk.o: rsa_chk.c
122rsa_crpt.o: ../../e_os.h ../../include/openssl/asn1.h
123rsa_crpt.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
124rsa_crpt.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
125rsa_crpt.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
126rsa_crpt.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
127rsa_crpt.o: ../../include/openssl/engine.h ../../include/openssl/err.h
128rsa_crpt.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
129rsa_crpt.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
130rsa_crpt.o: ../../include/openssl/opensslconf.h
131rsa_crpt.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
132rsa_crpt.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h
133rsa_crpt.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
134rsa_crpt.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
135rsa_crpt.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
136rsa_crpt.o: ../../include/openssl/x509_vfy.h ../cryptlib.h rsa_crpt.c
137rsa_depr.o: ../../e_os.h ../../include/openssl/asn1.h
138rsa_depr.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
139rsa_depr.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
140rsa_depr.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
141rsa_depr.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
142rsa_depr.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
143rsa_depr.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
144rsa_depr.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
145rsa_depr.o: ../cryptlib.h rsa_depr.c
146rsa_eay.o: ../../e_os.h ../../include/openssl/asn1.h
147rsa_eay.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
148rsa_eay.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
149rsa_eay.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
150rsa_eay.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
151rsa_eay.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
152rsa_eay.o: ../../include/openssl/rand.h ../../include/openssl/rsa.h
153rsa_eay.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
154rsa_eay.o: ../../include/openssl/symhacks.h ../cryptlib.h rsa_eay.c
155rsa_err.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
156rsa_err.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
157rsa_err.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
158rsa_err.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
159rsa_err.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rsa.h
160rsa_err.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
161rsa_err.o: ../../include/openssl/symhacks.h rsa_err.c
162rsa_gen.o: ../../e_os.h ../../include/openssl/asn1.h
163rsa_gen.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
164rsa_gen.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
165rsa_gen.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
166rsa_gen.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
167rsa_gen.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
168rsa_gen.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
169rsa_gen.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
170rsa_gen.o: ../cryptlib.h rsa_gen.c
171rsa_lib.o: ../../e_os.h ../../include/openssl/asn1.h
172rsa_lib.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
173rsa_lib.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
174rsa_lib.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
175rsa_lib.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
176rsa_lib.o: ../../include/openssl/engine.h ../../include/openssl/err.h
177rsa_lib.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
178rsa_lib.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
179rsa_lib.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
180rsa_lib.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
181rsa_lib.o: ../../include/openssl/rand.h ../../include/openssl/rsa.h
182rsa_lib.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
183rsa_lib.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
184rsa_lib.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
185rsa_lib.o: ../cryptlib.h rsa_lib.c
186rsa_none.o: ../../e_os.h ../../include/openssl/asn1.h
187rsa_none.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
188rsa_none.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
189rsa_none.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
190rsa_none.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
191rsa_none.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
192rsa_none.o: ../../include/openssl/rand.h ../../include/openssl/rsa.h
193rsa_none.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
194rsa_none.o: ../../include/openssl/symhacks.h ../cryptlib.h rsa_none.c
195rsa_null.o: ../../e_os.h ../../include/openssl/asn1.h
196rsa_null.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
197rsa_null.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
198rsa_null.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
199rsa_null.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
200rsa_null.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
201rsa_null.o: ../../include/openssl/rand.h ../../include/openssl/rsa.h
202rsa_null.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
203rsa_null.o: ../../include/openssl/symhacks.h ../cryptlib.h rsa_null.c
204rsa_oaep.o: ../../e_os.h ../../include/openssl/asn1.h
205rsa_oaep.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
206rsa_oaep.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
207rsa_oaep.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
208rsa_oaep.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
209rsa_oaep.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
210rsa_oaep.o: ../../include/openssl/opensslconf.h
211rsa_oaep.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
212rsa_oaep.o: ../../include/openssl/rand.h ../../include/openssl/rsa.h
213rsa_oaep.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
214rsa_oaep.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
215rsa_oaep.o: ../cryptlib.h rsa_oaep.c
216rsa_pk1.o: ../../e_os.h ../../include/openssl/asn1.h
217rsa_pk1.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
218rsa_pk1.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
219rsa_pk1.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
220rsa_pk1.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
221rsa_pk1.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
222rsa_pk1.o: ../../include/openssl/rand.h ../../include/openssl/rsa.h
223rsa_pk1.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
224rsa_pk1.o: ../../include/openssl/symhacks.h ../cryptlib.h rsa_pk1.c
225rsa_pmeth.o: ../../e_os.h ../../include/openssl/asn1.h
226rsa_pmeth.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
227rsa_pmeth.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
228rsa_pmeth.o: ../../include/openssl/cms.h ../../include/openssl/crypto.h
229rsa_pmeth.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
230rsa_pmeth.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
231rsa_pmeth.o: ../../include/openssl/err.h ../../include/openssl/evp.h
232rsa_pmeth.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
233rsa_pmeth.o: ../../include/openssl/objects.h
234rsa_pmeth.o: ../../include/openssl/opensslconf.h
235rsa_pmeth.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
236rsa_pmeth.o: ../../include/openssl/pkcs7.h ../../include/openssl/rsa.h
237rsa_pmeth.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
238rsa_pmeth.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
239rsa_pmeth.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
240rsa_pmeth.o: ../cryptlib.h ../evp/evp_locl.h rsa_locl.h rsa_pmeth.c
241rsa_prn.o: ../../e_os.h ../../include/openssl/asn1.h
242rsa_prn.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
243rsa_prn.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
244rsa_prn.o: ../../include/openssl/err.h ../../include/openssl/evp.h
245rsa_prn.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
246rsa_prn.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
247rsa_prn.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
248rsa_prn.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
249rsa_prn.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
250rsa_prn.o: ../cryptlib.h rsa_prn.c
251rsa_pss.o: ../../e_os.h ../../include/openssl/asn1.h
252rsa_pss.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
253rsa_pss.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
254rsa_pss.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
255rsa_pss.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
256rsa_pss.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
257rsa_pss.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
258rsa_pss.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rand.h
259rsa_pss.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
260rsa_pss.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
261rsa_pss.o: ../../include/openssl/symhacks.h ../cryptlib.h rsa_pss.c
262rsa_saos.o: ../../e_os.h ../../include/openssl/asn1.h
263rsa_saos.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
264rsa_saos.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
265rsa_saos.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
266rsa_saos.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
267rsa_saos.o: ../../include/openssl/err.h ../../include/openssl/evp.h
268rsa_saos.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
269rsa_saos.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
270rsa_saos.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
271rsa_saos.o: ../../include/openssl/pkcs7.h ../../include/openssl/rsa.h
272rsa_saos.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
273rsa_saos.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
274rsa_saos.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
275rsa_saos.o: ../cryptlib.h rsa_saos.c
276rsa_sign.o: ../../e_os.h ../../include/openssl/asn1.h
277rsa_sign.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
278rsa_sign.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
279rsa_sign.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
280rsa_sign.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
281rsa_sign.o: ../../include/openssl/err.h ../../include/openssl/evp.h
282rsa_sign.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
283rsa_sign.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
284rsa_sign.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
285rsa_sign.o: ../../include/openssl/pkcs7.h ../../include/openssl/rsa.h
286rsa_sign.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
287rsa_sign.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
288rsa_sign.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
289rsa_sign.o: ../cryptlib.h rsa_locl.h rsa_sign.c
290rsa_ssl.o: ../../e_os.h ../../include/openssl/asn1.h
291rsa_ssl.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
292rsa_ssl.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
293rsa_ssl.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
294rsa_ssl.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
295rsa_ssl.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
296rsa_ssl.o: ../../include/openssl/rand.h ../../include/openssl/rsa.h
297rsa_ssl.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
298rsa_ssl.o: ../../include/openssl/symhacks.h ../cryptlib.h rsa_ssl.c
299rsa_x931.o: ../../e_os.h ../../include/openssl/asn1.h
300rsa_x931.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
301rsa_x931.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
302rsa_x931.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
303rsa_x931.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
304rsa_x931.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
305rsa_x931.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
306rsa_x931.o: ../../include/openssl/rand.h ../../include/openssl/rsa.h
307rsa_x931.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
308rsa_x931.o: ../../include/openssl/symhacks.h ../cryptlib.h rsa_x931.c
diff --git a/src/lib/libcrypto/rsa/rsa.h b/src/lib/libcrypto/rsa/rsa.h
index 5f269e577a..4814a2fc15 100644
--- a/src/lib/libcrypto/rsa/rsa.h
+++ b/src/lib/libcrypto/rsa/rsa.h
@@ -280,7 +280,7 @@ struct rsa_st
280 280
281RSA * RSA_new(void); 281RSA * RSA_new(void);
282RSA * RSA_new_method(ENGINE *engine); 282RSA * RSA_new_method(ENGINE *engine);
283int RSA_size(const RSA *rsa); 283int RSA_size(const RSA *);
284 284
285/* Deprecated version */ 285/* Deprecated version */
286#ifndef OPENSSL_NO_DEPRECATED 286#ifndef OPENSSL_NO_DEPRECATED
diff --git a/src/lib/libcrypto/rsa/rsa_chk.c b/src/lib/libcrypto/rsa/rsa_chk.c
index cc30e77132..9d848db8c6 100644
--- a/src/lib/libcrypto/rsa/rsa_chk.c
+++ b/src/lib/libcrypto/rsa/rsa_chk.c
@@ -59,12 +59,6 @@ int RSA_check_key(const RSA *key)
59 BN_CTX *ctx; 59 BN_CTX *ctx;
60 int r; 60 int r;
61 int ret=1; 61 int ret=1;
62
63 if (!key->p || !key->q || !key->n || !key->e || !key->d)
64 {
65 RSAerr(RSA_F_RSA_CHECK_KEY, RSA_R_VALUE_MISSING);
66 return 0;
67 }
68 62
69 i = BN_new(); 63 i = BN_new();
70 j = BN_new(); 64 j = BN_new();
diff --git a/src/lib/libcrypto/rsa/rsa_eay.c b/src/lib/libcrypto/rsa/rsa_eay.c
index 88ee2cb557..2e1ddd48d3 100644
--- a/src/lib/libcrypto/rsa/rsa_eay.c
+++ b/src/lib/libcrypto/rsa/rsa_eay.c
@@ -847,12 +847,12 @@ static int RSA_eay_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa, BN_CTX *ctx)
847 if (!BN_mod(r0,pr1,rsa->p,ctx)) goto err; 847 if (!BN_mod(r0,pr1,rsa->p,ctx)) goto err;
848 848
849 /* If p < q it is occasionally possible for the correction of 849 /* If p < q it is occasionally possible for the correction of
850 * adding 'p' if r0 is negative above to leave the result still 850 * adding 'p' if r0 is negative above to leave the result still
851 * negative. This can break the private key operations: the following 851 * negative. This can break the private key operations: the following
852 * second correction should *always* correct this rare occurrence. 852 * second correction should *always* correct this rare occurrence.
853 * This will *never* happen with OpenSSL generated keys because 853 * This will *never* happen with OpenSSL generated keys because
854 * they ensure p > q [steve] 854 * they ensure p > q [steve]
855 */ 855 */
856 if (BN_is_negative(r0)) 856 if (BN_is_negative(r0))
857 if (!BN_add(r0,r0,rsa->p)) goto err; 857 if (!BN_add(r0,r0,rsa->p)) goto err;
858 if (!BN_mul(r1,r0,rsa->q,ctx)) goto err; 858 if (!BN_mul(r1,r0,rsa->q,ctx)) goto err;
diff --git a/src/lib/libcrypto/rsa/rsa_null.c b/src/lib/libcrypto/rsa/rsa_null.c
new file mode 100644
index 0000000000..2f2202f142
--- /dev/null
+++ b/src/lib/libcrypto/rsa/rsa_null.c
@@ -0,0 +1,151 @@
1/* rsa_null.c */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project 1999.
4 */
5/* ====================================================================
6 * Copyright (c) 1999 The OpenSSL Project. All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 *
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 *
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in
17 * the documentation and/or other materials provided with the
18 * distribution.
19 *
20 * 3. All advertising materials mentioning features or use of this
21 * software must display the following acknowledgment:
22 * "This product includes software developed by the OpenSSL Project
23 * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
24 *
25 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
26 * endorse or promote products derived from this software without
27 * prior written permission. For written permission, please contact
28 * licensing@OpenSSL.org.
29 *
30 * 5. Products derived from this software may not be called "OpenSSL"
31 * nor may "OpenSSL" appear in their names without prior written
32 * permission of the OpenSSL Project.
33 *
34 * 6. Redistributions of any form whatsoever must retain the following
35 * acknowledgment:
36 * "This product includes software developed by the OpenSSL Project
37 * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
38 *
39 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
40 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
41 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
42 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
43 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
44 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
45 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
46 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
47 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
48 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
49 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50 * OF THE POSSIBILITY OF SUCH DAMAGE.
51 * ====================================================================
52 *
53 * This product includes cryptographic software written by Eric Young
54 * (eay@cryptsoft.com). This product includes software written by Tim
55 * Hudson (tjh@cryptsoft.com).
56 *
57 */
58
59#include <stdio.h>
60#include "cryptlib.h"
61#include <openssl/bn.h>
62#include <openssl/rsa.h>
63#include <openssl/rand.h>
64
65/* This is a dummy RSA implementation that just returns errors when called.
66 * It is designed to allow some RSA functions to work while stopping those
67 * covered by the RSA patent. That is RSA, encryption, decryption, signing
68 * and verify is not allowed but RSA key generation, key checking and other
69 * operations (like storing RSA keys) are permitted.
70 */
71
72static int RSA_null_public_encrypt(int flen, const unsigned char *from,
73 unsigned char *to, RSA *rsa,int padding);
74static int RSA_null_private_encrypt(int flen, const unsigned char *from,
75 unsigned char *to, RSA *rsa,int padding);
76static int RSA_null_public_decrypt(int flen, const unsigned char *from,
77 unsigned char *to, RSA *rsa,int padding);
78static int RSA_null_private_decrypt(int flen, const unsigned char *from,
79 unsigned char *to, RSA *rsa,int padding);
80#if 0 /* not currently used */
81static int RSA_null_mod_exp(const BIGNUM *r0, const BIGNUM *i, RSA *rsa);
82#endif
83static int RSA_null_init(RSA *rsa);
84static int RSA_null_finish(RSA *rsa);
85static RSA_METHOD rsa_null_meth={
86 "Null RSA",
87 RSA_null_public_encrypt,
88 RSA_null_public_decrypt,
89 RSA_null_private_encrypt,
90 RSA_null_private_decrypt,
91 NULL,
92 NULL,
93 RSA_null_init,
94 RSA_null_finish,
95 0,
96 NULL,
97 NULL,
98 NULL,
99 NULL
100 };
101
102const RSA_METHOD *RSA_null_method(void)
103 {
104 return(&rsa_null_meth);
105 }
106
107static int RSA_null_public_encrypt(int flen, const unsigned char *from,
108 unsigned char *to, RSA *rsa, int padding)
109 {
110 RSAerr(RSA_F_RSA_NULL_PUBLIC_ENCRYPT, RSA_R_RSA_OPERATIONS_NOT_SUPPORTED);
111 return -1;
112 }
113
114static int RSA_null_private_encrypt(int flen, const unsigned char *from,
115 unsigned char *to, RSA *rsa, int padding)
116 {
117 RSAerr(RSA_F_RSA_NULL_PRIVATE_ENCRYPT, RSA_R_RSA_OPERATIONS_NOT_SUPPORTED);
118 return -1;
119 }
120
121static int RSA_null_private_decrypt(int flen, const unsigned char *from,
122 unsigned char *to, RSA *rsa, int padding)
123 {
124 RSAerr(RSA_F_RSA_NULL_PRIVATE_DECRYPT, RSA_R_RSA_OPERATIONS_NOT_SUPPORTED);
125 return -1;
126 }
127
128static int RSA_null_public_decrypt(int flen, const unsigned char *from,
129 unsigned char *to, RSA *rsa, int padding)
130 {
131 RSAerr(RSA_F_RSA_NULL_PUBLIC_DECRYPT, RSA_R_RSA_OPERATIONS_NOT_SUPPORTED);
132 return -1;
133 }
134
135#if 0 /* not currently used */
136static int RSA_null_mod_exp(BIGNUM *r0, BIGNUM *I, RSA *rsa)
137 {
138 ...err(RSA_F_RSA_NULL_MOD_EXP, RSA_R_RSA_OPERATIONS_NOT_SUPPORTED);
139 return -1;
140 }
141#endif
142
143static int RSA_null_init(RSA *rsa)
144 {
145 return(1);
146 }
147
148static int RSA_null_finish(RSA *rsa)
149 {
150 return(1);
151 }
diff --git a/src/lib/libcrypto/rsa/rsa_oaep.c b/src/lib/libcrypto/rsa/rsa_oaep.c
index af4d24a56e..e08ac151ff 100644
--- a/src/lib/libcrypto/rsa/rsa_oaep.c
+++ b/src/lib/libcrypto/rsa/rsa_oaep.c
@@ -149,7 +149,7 @@ int RSA_padding_check_PKCS1_OAEP(unsigned char *to, int tlen,
149 if (!EVP_Digest((void *)param, plen, phash, NULL, EVP_sha1(), NULL)) 149 if (!EVP_Digest((void *)param, plen, phash, NULL, EVP_sha1(), NULL))
150 return -1; 150 return -1;
151 151
152 if (CRYPTO_memcmp(db, phash, SHA_DIGEST_LENGTH) != 0 || bad) 152 if (timingsafe_bcmp(db, phash, SHA_DIGEST_LENGTH) != 0 || bad)
153 goto decoding_err; 153 goto decoding_err;
154 else 154 else
155 { 155 {
diff --git a/src/lib/libcrypto/rsa/rsa_test.c b/src/lib/libcrypto/rsa/rsa_test.c
new file mode 100644
index 0000000000..c8705a0f6e
--- /dev/null
+++ b/src/lib/libcrypto/rsa/rsa_test.c
@@ -0,0 +1,340 @@
1/* test vectors from p1ovect1.txt */
2
3#include <stdio.h>
4#include <string.h>
5
6#include "e_os.h"
7
8#include <openssl/crypto.h>
9#include <openssl/err.h>
10#include <openssl/rand.h>
11#include <openssl/bn.h>
12#ifdef OPENSSL_NO_RSA
13int main(int argc, char *argv[])
14{
15 printf("No RSA support\n");
16 return(0);
17}
18#else
19#include <openssl/rsa.h>
20
21#define SetKey \
22 key->n = BN_bin2bn(n, sizeof(n)-1, key->n); \
23 key->e = BN_bin2bn(e, sizeof(e)-1, key->e); \
24 key->d = BN_bin2bn(d, sizeof(d)-1, key->d); \
25 key->p = BN_bin2bn(p, sizeof(p)-1, key->p); \
26 key->q = BN_bin2bn(q, sizeof(q)-1, key->q); \
27 key->dmp1 = BN_bin2bn(dmp1, sizeof(dmp1)-1, key->dmp1); \
28 key->dmq1 = BN_bin2bn(dmq1, sizeof(dmq1)-1, key->dmq1); \
29 key->iqmp = BN_bin2bn(iqmp, sizeof(iqmp)-1, key->iqmp); \
30 memcpy(c, ctext_ex, sizeof(ctext_ex) - 1); \
31 return (sizeof(ctext_ex) - 1);
32
33static int key1(RSA *key, unsigned char *c)
34 {
35 static unsigned char n[] =
36"\x00\xAA\x36\xAB\xCE\x88\xAC\xFD\xFF\x55\x52\x3C\x7F\xC4\x52\x3F"
37"\x90\xEF\xA0\x0D\xF3\x77\x4A\x25\x9F\x2E\x62\xB4\xC5\xD9\x9C\xB5"
38"\xAD\xB3\x00\xA0\x28\x5E\x53\x01\x93\x0E\x0C\x70\xFB\x68\x76\x93"
39"\x9C\xE6\x16\xCE\x62\x4A\x11\xE0\x08\x6D\x34\x1E\xBC\xAC\xA0\xA1"
40"\xF5";
41
42 static unsigned char e[] = "\x11";
43
44 static unsigned char d[] =
45"\x0A\x03\x37\x48\x62\x64\x87\x69\x5F\x5F\x30\xBC\x38\xB9\x8B\x44"
46"\xC2\xCD\x2D\xFF\x43\x40\x98\xCD\x20\xD8\xA1\x38\xD0\x90\xBF\x64"
47"\x79\x7C\x3F\xA7\xA2\xCD\xCB\x3C\xD1\xE0\xBD\xBA\x26\x54\xB4\xF9"
48"\xDF\x8E\x8A\xE5\x9D\x73\x3D\x9F\x33\xB3\x01\x62\x4A\xFD\x1D\x51";
49
50 static unsigned char p[] =
51"\x00\xD8\x40\xB4\x16\x66\xB4\x2E\x92\xEA\x0D\xA3\xB4\x32\x04\xB5"
52"\xCF\xCE\x33\x52\x52\x4D\x04\x16\xA5\xA4\x41\xE7\x00\xAF\x46\x12"
53"\x0D";
54
55 static unsigned char q[] =
56"\x00\xC9\x7F\xB1\xF0\x27\xF4\x53\xF6\x34\x12\x33\xEA\xAA\xD1\xD9"
57"\x35\x3F\x6C\x42\xD0\x88\x66\xB1\xD0\x5A\x0F\x20\x35\x02\x8B\x9D"
58"\x89";
59
60 static unsigned char dmp1[] =
61"\x59\x0B\x95\x72\xA2\xC2\xA9\xC4\x06\x05\x9D\xC2\xAB\x2F\x1D\xAF"
62"\xEB\x7E\x8B\x4F\x10\xA7\x54\x9E\x8E\xED\xF5\xB4\xFC\xE0\x9E\x05";
63
64 static unsigned char dmq1[] =
65"\x00\x8E\x3C\x05\x21\xFE\x15\xE0\xEA\x06\xA3\x6F\xF0\xF1\x0C\x99"
66"\x52\xC3\x5B\x7A\x75\x14\xFD\x32\x38\xB8\x0A\xAD\x52\x98\x62\x8D"
67"\x51";
68
69 static unsigned char iqmp[] =
70"\x36\x3F\xF7\x18\x9D\xA8\xE9\x0B\x1D\x34\x1F\x71\xD0\x9B\x76\xA8"
71"\xA9\x43\xE1\x1D\x10\xB2\x4D\x24\x9F\x2D\xEA\xFE\xF8\x0C\x18\x26";
72
73 static unsigned char ctext_ex[] =
74"\x1b\x8f\x05\xf9\xca\x1a\x79\x52\x6e\x53\xf3\xcc\x51\x4f\xdb\x89"
75"\x2b\xfb\x91\x93\x23\x1e\x78\xb9\x92\xe6\x8d\x50\xa4\x80\xcb\x52"
76"\x33\x89\x5c\x74\x95\x8d\x5d\x02\xab\x8c\x0f\xd0\x40\xeb\x58\x44"
77"\xb0\x05\xc3\x9e\xd8\x27\x4a\x9d\xbf\xa8\x06\x71\x40\x94\x39\xd2";
78
79 SetKey;
80 }
81
82static int key2(RSA *key, unsigned char *c)
83 {
84 static unsigned char n[] =
85"\x00\xA3\x07\x9A\x90\xDF\x0D\xFD\x72\xAC\x09\x0C\xCC\x2A\x78\xB8"
86"\x74\x13\x13\x3E\x40\x75\x9C\x98\xFA\xF8\x20\x4F\x35\x8A\x0B\x26"
87"\x3C\x67\x70\xE7\x83\xA9\x3B\x69\x71\xB7\x37\x79\xD2\x71\x7B\xE8"
88"\x34\x77\xCF";
89
90 static unsigned char e[] = "\x3";
91
92 static unsigned char d[] =
93"\x6C\xAF\xBC\x60\x94\xB3\xFE\x4C\x72\xB0\xB3\x32\xC6\xFB\x25\xA2"
94"\xB7\x62\x29\x80\x4E\x68\x65\xFC\xA4\x5A\x74\xDF\x0F\x8F\xB8\x41"
95"\x3B\x52\xC0\xD0\xE5\x3D\x9B\x59\x0F\xF1\x9B\xE7\x9F\x49\xDD\x21"
96"\xE5\xEB";
97
98 static unsigned char p[] =
99"\x00\xCF\x20\x35\x02\x8B\x9D\x86\x98\x40\xB4\x16\x66\xB4\x2E\x92"
100"\xEA\x0D\xA3\xB4\x32\x04\xB5\xCF\xCE\x91";
101
102 static unsigned char q[] =
103"\x00\xC9\x7F\xB1\xF0\x27\xF4\x53\xF6\x34\x12\x33\xEA\xAA\xD1\xD9"
104"\x35\x3F\x6C\x42\xD0\x88\x66\xB1\xD0\x5F";
105
106 static unsigned char dmp1[] =
107"\x00\x8A\x15\x78\xAC\x5D\x13\xAF\x10\x2B\x22\xB9\x99\xCD\x74\x61"
108"\xF1\x5E\x6D\x22\xCC\x03\x23\xDF\xDF\x0B";
109
110 static unsigned char dmq1[] =
111"\x00\x86\x55\x21\x4A\xC5\x4D\x8D\x4E\xCD\x61\x77\xF1\xC7\x36\x90"
112"\xCE\x2A\x48\x2C\x8B\x05\x99\xCB\xE0\x3F";
113
114 static unsigned char iqmp[] =
115"\x00\x83\xEF\xEF\xB8\xA9\xA4\x0D\x1D\xB6\xED\x98\xAD\x84\xED\x13"
116"\x35\xDC\xC1\x08\xF3\x22\xD0\x57\xCF\x8D";
117
118 static unsigned char ctext_ex[] =
119"\x14\xbd\xdd\x28\xc9\x83\x35\x19\x23\x80\xe8\xe5\x49\xb1\x58\x2a"
120"\x8b\x40\xb4\x48\x6d\x03\xa6\xa5\x31\x1f\x1f\xd5\xf0\xa1\x80\xe4"
121"\x17\x53\x03\x29\xa9\x34\x90\x74\xb1\x52\x13\x54\x29\x08\x24\x52"
122"\x62\x51";
123
124 SetKey;
125 }
126
127static int key3(RSA *key, unsigned char *c)
128 {
129 static unsigned char n[] =
130"\x00\xBB\xF8\x2F\x09\x06\x82\xCE\x9C\x23\x38\xAC\x2B\x9D\xA8\x71"
131"\xF7\x36\x8D\x07\xEE\xD4\x10\x43\xA4\x40\xD6\xB6\xF0\x74\x54\xF5"
132"\x1F\xB8\xDF\xBA\xAF\x03\x5C\x02\xAB\x61\xEA\x48\xCE\xEB\x6F\xCD"
133"\x48\x76\xED\x52\x0D\x60\xE1\xEC\x46\x19\x71\x9D\x8A\x5B\x8B\x80"
134"\x7F\xAF\xB8\xE0\xA3\xDF\xC7\x37\x72\x3E\xE6\xB4\xB7\xD9\x3A\x25"
135"\x84\xEE\x6A\x64\x9D\x06\x09\x53\x74\x88\x34\xB2\x45\x45\x98\x39"
136"\x4E\xE0\xAA\xB1\x2D\x7B\x61\xA5\x1F\x52\x7A\x9A\x41\xF6\xC1\x68"
137"\x7F\xE2\x53\x72\x98\xCA\x2A\x8F\x59\x46\xF8\xE5\xFD\x09\x1D\xBD"
138"\xCB";
139
140 static unsigned char e[] = "\x11";
141
142 static unsigned char d[] =
143"\x00\xA5\xDA\xFC\x53\x41\xFA\xF2\x89\xC4\xB9\x88\xDB\x30\xC1\xCD"
144"\xF8\x3F\x31\x25\x1E\x06\x68\xB4\x27\x84\x81\x38\x01\x57\x96\x41"
145"\xB2\x94\x10\xB3\xC7\x99\x8D\x6B\xC4\x65\x74\x5E\x5C\x39\x26\x69"
146"\xD6\x87\x0D\xA2\xC0\x82\xA9\x39\xE3\x7F\xDC\xB8\x2E\xC9\x3E\xDA"
147"\xC9\x7F\xF3\xAD\x59\x50\xAC\xCF\xBC\x11\x1C\x76\xF1\xA9\x52\x94"
148"\x44\xE5\x6A\xAF\x68\xC5\x6C\x09\x2C\xD3\x8D\xC3\xBE\xF5\xD2\x0A"
149"\x93\x99\x26\xED\x4F\x74\xA1\x3E\xDD\xFB\xE1\xA1\xCE\xCC\x48\x94"
150"\xAF\x94\x28\xC2\xB7\xB8\x88\x3F\xE4\x46\x3A\x4B\xC8\x5B\x1C\xB3"
151"\xC1";
152
153 static unsigned char p[] =
154"\x00\xEE\xCF\xAE\x81\xB1\xB9\xB3\xC9\x08\x81\x0B\x10\xA1\xB5\x60"
155"\x01\x99\xEB\x9F\x44\xAE\xF4\xFD\xA4\x93\xB8\x1A\x9E\x3D\x84\xF6"
156"\x32\x12\x4E\xF0\x23\x6E\x5D\x1E\x3B\x7E\x28\xFA\xE7\xAA\x04\x0A"
157"\x2D\x5B\x25\x21\x76\x45\x9D\x1F\x39\x75\x41\xBA\x2A\x58\xFB\x65"
158"\x99";
159
160 static unsigned char q[] =
161"\x00\xC9\x7F\xB1\xF0\x27\xF4\x53\xF6\x34\x12\x33\xEA\xAA\xD1\xD9"
162"\x35\x3F\x6C\x42\xD0\x88\x66\xB1\xD0\x5A\x0F\x20\x35\x02\x8B\x9D"
163"\x86\x98\x40\xB4\x16\x66\xB4\x2E\x92\xEA\x0D\xA3\xB4\x32\x04\xB5"
164"\xCF\xCE\x33\x52\x52\x4D\x04\x16\xA5\xA4\x41\xE7\x00\xAF\x46\x15"
165"\x03";
166
167 static unsigned char dmp1[] =
168"\x54\x49\x4C\xA6\x3E\xBA\x03\x37\xE4\xE2\x40\x23\xFC\xD6\x9A\x5A"
169"\xEB\x07\xDD\xDC\x01\x83\xA4\xD0\xAC\x9B\x54\xB0\x51\xF2\xB1\x3E"
170"\xD9\x49\x09\x75\xEA\xB7\x74\x14\xFF\x59\xC1\xF7\x69\x2E\x9A\x2E"
171"\x20\x2B\x38\xFC\x91\x0A\x47\x41\x74\xAD\xC9\x3C\x1F\x67\xC9\x81";
172
173 static unsigned char dmq1[] =
174"\x47\x1E\x02\x90\xFF\x0A\xF0\x75\x03\x51\xB7\xF8\x78\x86\x4C\xA9"
175"\x61\xAD\xBD\x3A\x8A\x7E\x99\x1C\x5C\x05\x56\xA9\x4C\x31\x46\xA7"
176"\xF9\x80\x3F\x8F\x6F\x8A\xE3\x42\xE9\x31\xFD\x8A\xE4\x7A\x22\x0D"
177"\x1B\x99\xA4\x95\x84\x98\x07\xFE\x39\xF9\x24\x5A\x98\x36\xDA\x3D";
178
179 static unsigned char iqmp[] =
180"\x00\xB0\x6C\x4F\xDA\xBB\x63\x01\x19\x8D\x26\x5B\xDB\xAE\x94\x23"
181"\xB3\x80\xF2\x71\xF7\x34\x53\x88\x50\x93\x07\x7F\xCD\x39\xE2\x11"
182"\x9F\xC9\x86\x32\x15\x4F\x58\x83\xB1\x67\xA9\x67\xBF\x40\x2B\x4E"
183"\x9E\x2E\x0F\x96\x56\xE6\x98\xEA\x36\x66\xED\xFB\x25\x79\x80\x39"
184"\xF7";
185
186 static unsigned char ctext_ex[] =
187"\xb8\x24\x6b\x56\xa6\xed\x58\x81\xae\xb5\x85\xd9\xa2\x5b\x2a\xd7"
188"\x90\xc4\x17\xe0\x80\x68\x1b\xf1\xac\x2b\xc3\xde\xb6\x9d\x8b\xce"
189"\xf0\xc4\x36\x6f\xec\x40\x0a\xf0\x52\xa7\x2e\x9b\x0e\xff\xb5\xb3"
190"\xf2\xf1\x92\xdb\xea\xca\x03\xc1\x27\x40\x05\x71\x13\xbf\x1f\x06"
191"\x69\xac\x22\xe9\xf3\xa7\x85\x2e\x3c\x15\xd9\x13\xca\xb0\xb8\x86"
192"\x3a\x95\xc9\x92\x94\xce\x86\x74\x21\x49\x54\x61\x03\x46\xf4\xd4"
193"\x74\xb2\x6f\x7c\x48\xb4\x2e\xe6\x8e\x1f\x57\x2a\x1f\xc4\x02\x6a"
194"\xc4\x56\xb4\xf5\x9f\x7b\x62\x1e\xa1\xb9\xd8\x8f\x64\x20\x2f\xb1";
195
196 SetKey;
197 }
198
199static int pad_unknown(void)
200{
201 unsigned long l;
202 while ((l = ERR_get_error()) != 0)
203 if (ERR_GET_REASON(l) == RSA_R_UNKNOWN_PADDING_TYPE)
204 return(1);
205 return(0);
206}
207
208static const char rnd_seed[] = "string to make the random number generator think it has entropy";
209
210int main(int argc, char *argv[])
211 {
212 int err=0;
213 int v;
214 RSA *key;
215 unsigned char ptext[256];
216 unsigned char ctext[256];
217 static unsigned char ptext_ex[] = "\x54\x85\x9b\x34\x2c\x49\xea\x2a";
218 unsigned char ctext_ex[256];
219 int plen;
220 int clen = 0;
221 int num;
222 int n;
223
224 CRYPTO_malloc_debug_init();
225 CRYPTO_dbg_set_options(V_CRYPTO_MDEBUG_ALL);
226 CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON);
227
228 RAND_seed(rnd_seed, sizeof rnd_seed); /* or OAEP may fail */
229
230 plen = sizeof(ptext_ex) - 1;
231
232 for (v = 0; v < 6; v++)
233 {
234 key = RSA_new();
235 switch (v%3) {
236 case 0:
237 clen = key1(key, ctext_ex);
238 break;
239 case 1:
240 clen = key2(key, ctext_ex);
241 break;
242 case 2:
243 clen = key3(key, ctext_ex);
244 break;
245 }
246 if (v/3 >= 1) key->flags |= RSA_FLAG_NO_CONSTTIME;
247
248 num = RSA_public_encrypt(plen, ptext_ex, ctext, key,
249 RSA_PKCS1_PADDING);
250 if (num != clen)
251 {
252 printf("PKCS#1 v1.5 encryption failed!\n");
253 err=1;
254 goto oaep;
255 }
256
257 num = RSA_private_decrypt(num, ctext, ptext, key,
258 RSA_PKCS1_PADDING);
259 if (num != plen || memcmp(ptext, ptext_ex, num) != 0)
260 {
261 printf("PKCS#1 v1.5 decryption failed!\n");
262 err=1;
263 }
264 else
265 printf("PKCS #1 v1.5 encryption/decryption ok\n");
266
267 oaep:
268 ERR_clear_error();
269 num = RSA_public_encrypt(plen, ptext_ex, ctext, key,
270 RSA_PKCS1_OAEP_PADDING);
271 if (num == -1 && pad_unknown())
272 {
273 printf("No OAEP support\n");
274 goto next;
275 }
276 if (num != clen)
277 {
278 printf("OAEP encryption failed!\n");
279 err=1;
280 goto next;
281 }
282
283 num = RSA_private_decrypt(num, ctext, ptext, key,
284 RSA_PKCS1_OAEP_PADDING);
285 if (num != plen || memcmp(ptext, ptext_ex, num) != 0)
286 {
287 printf("OAEP decryption (encrypted data) failed!\n");
288 err=1;
289 }
290 else if (memcmp(ctext, ctext_ex, num) == 0)
291 printf("OAEP test vector %d passed!\n", v);
292
293 /* Different ciphertexts (rsa_oaep.c without -DPKCS_TESTVECT).
294 Try decrypting ctext_ex */
295
296 num = RSA_private_decrypt(clen, ctext_ex, ptext, key,
297 RSA_PKCS1_OAEP_PADDING);
298
299 if (num != plen || memcmp(ptext, ptext_ex, num) != 0)
300 {
301 printf("OAEP decryption (test vector data) failed!\n");
302 err=1;
303 }
304 else
305 printf("OAEP encryption/decryption ok\n");
306
307 /* Try decrypting corrupted ciphertexts */
308 for(n = 0 ; n < clen ; ++n)
309 {
310 int b;
311 unsigned char saved = ctext[n];
312 for(b = 0 ; b < 256 ; ++b)
313 {
314 if(b == saved)
315 continue;
316 ctext[n] = b;
317 num = RSA_private_decrypt(num, ctext, ptext, key,
318 RSA_PKCS1_OAEP_PADDING);
319 if(num > 0)
320 {
321 printf("Corrupt data decrypted!\n");
322 err = 1;
323 }
324 }
325 }
326 next:
327 RSA_free(key);
328 }
329
330 CRYPTO_cleanup_all_ex_data();
331 ERR_remove_thread_state(NULL);
332
333 CRYPTO_mem_leaks_fp(stderr);
334
335#ifdef OPENSSL_SYS_NETWARE
336 if (err) printf("ERROR: %d\n", err);
337#endif
338 return err;
339 }
340#endif
diff --git a/src/lib/libcrypto/seed/Makefile b/src/lib/libcrypto/seed/Makefile
new file mode 100644
index 0000000000..4bc55e4916
--- /dev/null
+++ b/src/lib/libcrypto/seed/Makefile
@@ -0,0 +1,106 @@
1#
2# crypto/seed/Makefile
3#
4
5DIR= seed
6TOP= ../..
7CC= cc
8CPP= $(CC) -E
9INCLUDES=
10CFLAG=-g
11MAKEFILE= Makefile
12AR= ar r
13
14CFLAGS= $(INCLUDES) $(CFLAG)
15
16GENERAL=Makefile
17TEST=
18APPS=
19
20LIB=$(TOP)/libcrypto.a
21LIBSRC=seed.c seed_ecb.c seed_cbc.c seed_cfb.c seed_ofb.c
22LIBOBJ=seed.o seed_ecb.o seed_cbc.o seed_cfb.o seed_ofb.o
23
24SRC= $(LIBSRC)
25
26EXHEADER= seed.h
27HEADER= seed_locl.h $(EXHEADER)
28
29ALL= $(GENERAL) $(SRC) $(HEADER)
30
31top:
32 (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all)
33
34all: lib
35
36lib: $(LIBOBJ)
37 $(AR) $(LIB) $(LIBOBJ)
38 $(RANLIB) $(LIB) || echo Never mind.
39 @touch lib
40
41files:
42 $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
43
44links:
45 @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
46 @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
47 @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
48
49install:
50 @[ -n "$(INSTALLTOP)" ] # should be set by top Makefile...
51 @headerlist="$(EXHEADER)"; for i in $$headerlist ; \
52 do \
53 (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
54 chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
55 done;
56
57tags:
58 ctags $(SRC)
59
60tests:
61
62lint:
63 lint -DLINT $(INCLUDES) $(SRC)>fluff
64
65depend:
66 @[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile...
67 $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
68
69dclean:
70 $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
71 mv -f Makefile.new $(MAKEFILE)
72
73clean:
74 rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
75
76# DO NOT DELETE THIS LINE -- make depend depends on it.
77
78seed.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
79seed.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
80seed.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
81seed.o: ../../include/openssl/seed.h ../../include/openssl/stack.h
82seed.o: ../../include/openssl/symhacks.h seed.c seed_locl.h
83seed_cbc.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
84seed_cbc.o: ../../include/openssl/modes.h ../../include/openssl/opensslconf.h
85seed_cbc.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
86seed_cbc.o: ../../include/openssl/safestack.h ../../include/openssl/seed.h
87seed_cbc.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
88seed_cbc.o: seed_cbc.c
89seed_cfb.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
90seed_cfb.o: ../../include/openssl/modes.h ../../include/openssl/opensslconf.h
91seed_cfb.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
92seed_cfb.o: ../../include/openssl/safestack.h ../../include/openssl/seed.h
93seed_cfb.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
94seed_cfb.o: seed_cfb.c
95seed_ecb.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
96seed_ecb.o: ../../include/openssl/opensslconf.h
97seed_ecb.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
98seed_ecb.o: ../../include/openssl/safestack.h ../../include/openssl/seed.h
99seed_ecb.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
100seed_ecb.o: seed_ecb.c
101seed_ofb.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
102seed_ofb.o: ../../include/openssl/modes.h ../../include/openssl/opensslconf.h
103seed_ofb.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
104seed_ofb.o: ../../include/openssl/safestack.h ../../include/openssl/seed.h
105seed_ofb.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
106seed_ofb.o: seed_ofb.c
diff --git a/src/lib/libcrypto/seed/seed.c b/src/lib/libcrypto/seed/seed.c
new file mode 100644
index 0000000000..3e675a8d75
--- /dev/null
+++ b/src/lib/libcrypto/seed/seed.c
@@ -0,0 +1,336 @@
1/*
2 * Copyright (c) 2007 KISA(Korea Information Security Agency). All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * 2. Neither the name of author nor the names of its contributors may
10 * be used to endorse or promote products derived from this software
11 * without specific prior written permission.
12 *
13 * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16 * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
17 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23 * SUCH DAMAGE.
24 *
25 */
26#ifndef OPENSSL_NO_SEED
27
28#include <stdio.h>
29#include <stdlib.h>
30#include <string.h>
31#ifdef WIN32
32#include <memory.h>
33#endif
34
35#include <openssl/crypto.h>
36#include <openssl/seed.h>
37#include "seed_locl.h"
38
39#ifdef SS /* can get defined on Solaris by inclusion of <stdlib.h> */
40#undef SS
41#endif
42
43static const seed_word SS[4][256] = { {
44 0x2989a1a8, 0x05858184, 0x16c6d2d4, 0x13c3d3d0, 0x14445054, 0x1d0d111c, 0x2c8ca0ac, 0x25052124,
45 0x1d4d515c, 0x03434340, 0x18081018, 0x1e0e121c, 0x11415150, 0x3cccf0fc, 0x0acac2c8, 0x23436360,
46 0x28082028, 0x04444044, 0x20002020, 0x1d8d919c, 0x20c0e0e0, 0x22c2e2e0, 0x08c8c0c8, 0x17071314,
47 0x2585a1a4, 0x0f8f838c, 0x03030300, 0x3b4b7378, 0x3b8bb3b8, 0x13031310, 0x12c2d2d0, 0x2ecee2ec,
48 0x30407070, 0x0c8c808c, 0x3f0f333c, 0x2888a0a8, 0x32023230, 0x1dcdd1dc, 0x36c6f2f4, 0x34447074,
49 0x2ccce0ec, 0x15859194, 0x0b0b0308, 0x17475354, 0x1c4c505c, 0x1b4b5358, 0x3d8db1bc, 0x01010100,
50 0x24042024, 0x1c0c101c, 0x33437370, 0x18889098, 0x10001010, 0x0cccc0cc, 0x32c2f2f0, 0x19c9d1d8,
51 0x2c0c202c, 0x27c7e3e4, 0x32427270, 0x03838380, 0x1b8b9398, 0x11c1d1d0, 0x06868284, 0x09c9c1c8,
52 0x20406060, 0x10405050, 0x2383a3a0, 0x2bcbe3e8, 0x0d0d010c, 0x3686b2b4, 0x1e8e929c, 0x0f4f434c,
53 0x3787b3b4, 0x1a4a5258, 0x06c6c2c4, 0x38487078, 0x2686a2a4, 0x12021210, 0x2f8fa3ac, 0x15c5d1d4,
54 0x21416160, 0x03c3c3c0, 0x3484b0b4, 0x01414140, 0x12425250, 0x3d4d717c, 0x0d8d818c, 0x08080008,
55 0x1f0f131c, 0x19899198, 0x00000000, 0x19091118, 0x04040004, 0x13435350, 0x37c7f3f4, 0x21c1e1e0,
56 0x3dcdf1fc, 0x36467274, 0x2f0f232c, 0x27072324, 0x3080b0b0, 0x0b8b8388, 0x0e0e020c, 0x2b8ba3a8,
57 0x2282a2a0, 0x2e4e626c, 0x13839390, 0x0d4d414c, 0x29496168, 0x3c4c707c, 0x09090108, 0x0a0a0208,
58 0x3f8fb3bc, 0x2fcfe3ec, 0x33c3f3f0, 0x05c5c1c4, 0x07878384, 0x14041014, 0x3ecef2fc, 0x24446064,
59 0x1eced2dc, 0x2e0e222c, 0x0b4b4348, 0x1a0a1218, 0x06060204, 0x21012120, 0x2b4b6368, 0x26466264,
60 0x02020200, 0x35c5f1f4, 0x12829290, 0x0a8a8288, 0x0c0c000c, 0x3383b3b0, 0x3e4e727c, 0x10c0d0d0,
61 0x3a4a7278, 0x07474344, 0x16869294, 0x25c5e1e4, 0x26062224, 0x00808080, 0x2d8da1ac, 0x1fcfd3dc,
62 0x2181a1a0, 0x30003030, 0x37073334, 0x2e8ea2ac, 0x36063234, 0x15051114, 0x22022220, 0x38083038,
63 0x34c4f0f4, 0x2787a3a4, 0x05454144, 0x0c4c404c, 0x01818180, 0x29c9e1e8, 0x04848084, 0x17879394,
64 0x35053134, 0x0bcbc3c8, 0x0ecec2cc, 0x3c0c303c, 0x31417170, 0x11011110, 0x07c7c3c4, 0x09898188,
65 0x35457174, 0x3bcbf3f8, 0x1acad2d8, 0x38c8f0f8, 0x14849094, 0x19495158, 0x02828280, 0x04c4c0c4,
66 0x3fcff3fc, 0x09494148, 0x39093138, 0x27476364, 0x00c0c0c0, 0x0fcfc3cc, 0x17c7d3d4, 0x3888b0b8,
67 0x0f0f030c, 0x0e8e828c, 0x02424240, 0x23032320, 0x11819190, 0x2c4c606c, 0x1bcbd3d8, 0x2484a0a4,
68 0x34043034, 0x31c1f1f0, 0x08484048, 0x02c2c2c0, 0x2f4f636c, 0x3d0d313c, 0x2d0d212c, 0x00404040,
69 0x3e8eb2bc, 0x3e0e323c, 0x3c8cb0bc, 0x01c1c1c0, 0x2a8aa2a8, 0x3a8ab2b8, 0x0e4e424c, 0x15455154,
70 0x3b0b3338, 0x1cccd0dc, 0x28486068, 0x3f4f737c, 0x1c8c909c, 0x18c8d0d8, 0x0a4a4248, 0x16465254,
71 0x37477374, 0x2080a0a0, 0x2dcde1ec, 0x06464244, 0x3585b1b4, 0x2b0b2328, 0x25456164, 0x3acaf2f8,
72 0x23c3e3e0, 0x3989b1b8, 0x3181b1b0, 0x1f8f939c, 0x1e4e525c, 0x39c9f1f8, 0x26c6e2e4, 0x3282b2b0,
73 0x31013130, 0x2acae2e8, 0x2d4d616c, 0x1f4f535c, 0x24c4e0e4, 0x30c0f0f0, 0x0dcdc1cc, 0x08888088,
74 0x16061214, 0x3a0a3238, 0x18485058, 0x14c4d0d4, 0x22426260, 0x29092128, 0x07070304, 0x33033330,
75 0x28c8e0e8, 0x1b0b1318, 0x05050104, 0x39497178, 0x10809090, 0x2a4a6268, 0x2a0a2228, 0x1a8a9298
76}, {
77 0x38380830, 0xe828c8e0, 0x2c2d0d21, 0xa42686a2, 0xcc0fcfc3, 0xdc1eced2, 0xb03383b3, 0xb83888b0,
78 0xac2f8fa3, 0x60204060, 0x54154551, 0xc407c7c3, 0x44044440, 0x6c2f4f63, 0x682b4b63, 0x581b4b53,
79 0xc003c3c3, 0x60224262, 0x30330333, 0xb43585b1, 0x28290921, 0xa02080a0, 0xe022c2e2, 0xa42787a3,
80 0xd013c3d3, 0x90118191, 0x10110111, 0x04060602, 0x1c1c0c10, 0xbc3c8cb0, 0x34360632, 0x480b4b43,
81 0xec2fcfe3, 0x88088880, 0x6c2c4c60, 0xa82888a0, 0x14170713, 0xc404c4c0, 0x14160612, 0xf434c4f0,
82 0xc002c2c2, 0x44054541, 0xe021c1e1, 0xd416c6d2, 0x3c3f0f33, 0x3c3d0d31, 0x8c0e8e82, 0x98188890,
83 0x28280820, 0x4c0e4e42, 0xf436c6f2, 0x3c3e0e32, 0xa42585a1, 0xf839c9f1, 0x0c0d0d01, 0xdc1fcfd3,
84 0xd818c8d0, 0x282b0b23, 0x64264662, 0x783a4a72, 0x24270723, 0x2c2f0f23, 0xf031c1f1, 0x70324272,
85 0x40024242, 0xd414c4d0, 0x40014141, 0xc000c0c0, 0x70334373, 0x64274763, 0xac2c8ca0, 0x880b8b83,
86 0xf437c7f3, 0xac2d8da1, 0x80008080, 0x1c1f0f13, 0xc80acac2, 0x2c2c0c20, 0xa82a8aa2, 0x34340430,
87 0xd012c2d2, 0x080b0b03, 0xec2ecee2, 0xe829c9e1, 0x5c1d4d51, 0x94148490, 0x18180810, 0xf838c8f0,
88 0x54174753, 0xac2e8ea2, 0x08080800, 0xc405c5c1, 0x10130313, 0xcc0dcdc1, 0x84068682, 0xb83989b1,
89 0xfc3fcff3, 0x7c3d4d71, 0xc001c1c1, 0x30310131, 0xf435c5f1, 0x880a8a82, 0x682a4a62, 0xb03181b1,
90 0xd011c1d1, 0x20200020, 0xd417c7d3, 0x00020202, 0x20220222, 0x04040400, 0x68284860, 0x70314171,
91 0x04070703, 0xd81bcbd3, 0x9c1d8d91, 0x98198991, 0x60214161, 0xbc3e8eb2, 0xe426c6e2, 0x58194951,
92 0xdc1dcdd1, 0x50114151, 0x90108090, 0xdc1cccd0, 0x981a8a92, 0xa02383a3, 0xa82b8ba3, 0xd010c0d0,
93 0x80018181, 0x0c0f0f03, 0x44074743, 0x181a0a12, 0xe023c3e3, 0xec2ccce0, 0x8c0d8d81, 0xbc3f8fb3,
94 0x94168692, 0x783b4b73, 0x5c1c4c50, 0xa02282a2, 0xa02181a1, 0x60234363, 0x20230323, 0x4c0d4d41,
95 0xc808c8c0, 0x9c1e8e92, 0x9c1c8c90, 0x383a0a32, 0x0c0c0c00, 0x2c2e0e22, 0xb83a8ab2, 0x6c2e4e62,
96 0x9c1f8f93, 0x581a4a52, 0xf032c2f2, 0x90128292, 0xf033c3f3, 0x48094941, 0x78384870, 0xcc0cccc0,
97 0x14150511, 0xf83bcbf3, 0x70304070, 0x74354571, 0x7c3f4f73, 0x34350531, 0x10100010, 0x00030303,
98 0x64244460, 0x6c2d4d61, 0xc406c6c2, 0x74344470, 0xd415c5d1, 0xb43484b0, 0xe82acae2, 0x08090901,
99 0x74364672, 0x18190911, 0xfc3ecef2, 0x40004040, 0x10120212, 0xe020c0e0, 0xbc3d8db1, 0x04050501,
100 0xf83acaf2, 0x00010101, 0xf030c0f0, 0x282a0a22, 0x5c1e4e52, 0xa82989a1, 0x54164652, 0x40034343,
101 0x84058581, 0x14140410, 0x88098981, 0x981b8b93, 0xb03080b0, 0xe425c5e1, 0x48084840, 0x78394971,
102 0x94178793, 0xfc3cccf0, 0x1c1e0e12, 0x80028282, 0x20210121, 0x8c0c8c80, 0x181b0b13, 0x5c1f4f53,
103 0x74374773, 0x54144450, 0xb03282b2, 0x1c1d0d11, 0x24250521, 0x4c0f4f43, 0x00000000, 0x44064642,
104 0xec2dcde1, 0x58184850, 0x50124252, 0xe82bcbe3, 0x7c3e4e72, 0xd81acad2, 0xc809c9c1, 0xfc3dcdf1,
105 0x30300030, 0x94158591, 0x64254561, 0x3c3c0c30, 0xb43686b2, 0xe424c4e0, 0xb83b8bb3, 0x7c3c4c70,
106 0x0c0e0e02, 0x50104050, 0x38390931, 0x24260622, 0x30320232, 0x84048480, 0x68294961, 0x90138393,
107 0x34370733, 0xe427c7e3, 0x24240420, 0xa42484a0, 0xc80bcbc3, 0x50134353, 0x080a0a02, 0x84078783,
108 0xd819c9d1, 0x4c0c4c40, 0x80038383, 0x8c0f8f83, 0xcc0ecec2, 0x383b0b33, 0x480a4a42, 0xb43787b3
109}, {
110 0xa1a82989, 0x81840585, 0xd2d416c6, 0xd3d013c3, 0x50541444, 0x111c1d0d, 0xa0ac2c8c, 0x21242505,
111 0x515c1d4d, 0x43400343, 0x10181808, 0x121c1e0e, 0x51501141, 0xf0fc3ccc, 0xc2c80aca, 0x63602343,
112 0x20282808, 0x40440444, 0x20202000, 0x919c1d8d, 0xe0e020c0, 0xe2e022c2, 0xc0c808c8, 0x13141707,
113 0xa1a42585, 0x838c0f8f, 0x03000303, 0x73783b4b, 0xb3b83b8b, 0x13101303, 0xd2d012c2, 0xe2ec2ece,
114 0x70703040, 0x808c0c8c, 0x333c3f0f, 0xa0a82888, 0x32303202, 0xd1dc1dcd, 0xf2f436c6, 0x70743444,
115 0xe0ec2ccc, 0x91941585, 0x03080b0b, 0x53541747, 0x505c1c4c, 0x53581b4b, 0xb1bc3d8d, 0x01000101,
116 0x20242404, 0x101c1c0c, 0x73703343, 0x90981888, 0x10101000, 0xc0cc0ccc, 0xf2f032c2, 0xd1d819c9,
117 0x202c2c0c, 0xe3e427c7, 0x72703242, 0x83800383, 0x93981b8b, 0xd1d011c1, 0x82840686, 0xc1c809c9,
118 0x60602040, 0x50501040, 0xa3a02383, 0xe3e82bcb, 0x010c0d0d, 0xb2b43686, 0x929c1e8e, 0x434c0f4f,
119 0xb3b43787, 0x52581a4a, 0xc2c406c6, 0x70783848, 0xa2a42686, 0x12101202, 0xa3ac2f8f, 0xd1d415c5,
120 0x61602141, 0xc3c003c3, 0xb0b43484, 0x41400141, 0x52501242, 0x717c3d4d, 0x818c0d8d, 0x00080808,
121 0x131c1f0f, 0x91981989, 0x00000000, 0x11181909, 0x00040404, 0x53501343, 0xf3f437c7, 0xe1e021c1,
122 0xf1fc3dcd, 0x72743646, 0x232c2f0f, 0x23242707, 0xb0b03080, 0x83880b8b, 0x020c0e0e, 0xa3a82b8b,
123 0xa2a02282, 0x626c2e4e, 0x93901383, 0x414c0d4d, 0x61682949, 0x707c3c4c, 0x01080909, 0x02080a0a,
124 0xb3bc3f8f, 0xe3ec2fcf, 0xf3f033c3, 0xc1c405c5, 0x83840787, 0x10141404, 0xf2fc3ece, 0x60642444,
125 0xd2dc1ece, 0x222c2e0e, 0x43480b4b, 0x12181a0a, 0x02040606, 0x21202101, 0x63682b4b, 0x62642646,
126 0x02000202, 0xf1f435c5, 0x92901282, 0x82880a8a, 0x000c0c0c, 0xb3b03383, 0x727c3e4e, 0xd0d010c0,
127 0x72783a4a, 0x43440747, 0x92941686, 0xe1e425c5, 0x22242606, 0x80800080, 0xa1ac2d8d, 0xd3dc1fcf,
128 0xa1a02181, 0x30303000, 0x33343707, 0xa2ac2e8e, 0x32343606, 0x11141505, 0x22202202, 0x30383808,
129 0xf0f434c4, 0xa3a42787, 0x41440545, 0x404c0c4c, 0x81800181, 0xe1e829c9, 0x80840484, 0x93941787,
130 0x31343505, 0xc3c80bcb, 0xc2cc0ece, 0x303c3c0c, 0x71703141, 0x11101101, 0xc3c407c7, 0x81880989,
131 0x71743545, 0xf3f83bcb, 0xd2d81aca, 0xf0f838c8, 0x90941484, 0x51581949, 0x82800282, 0xc0c404c4,
132 0xf3fc3fcf, 0x41480949, 0x31383909, 0x63642747, 0xc0c000c0, 0xc3cc0fcf, 0xd3d417c7, 0xb0b83888,
133 0x030c0f0f, 0x828c0e8e, 0x42400242, 0x23202303, 0x91901181, 0x606c2c4c, 0xd3d81bcb, 0xa0a42484,
134 0x30343404, 0xf1f031c1, 0x40480848, 0xc2c002c2, 0x636c2f4f, 0x313c3d0d, 0x212c2d0d, 0x40400040,
135 0xb2bc3e8e, 0x323c3e0e, 0xb0bc3c8c, 0xc1c001c1, 0xa2a82a8a, 0xb2b83a8a, 0x424c0e4e, 0x51541545,
136 0x33383b0b, 0xd0dc1ccc, 0x60682848, 0x737c3f4f, 0x909c1c8c, 0xd0d818c8, 0x42480a4a, 0x52541646,
137 0x73743747, 0xa0a02080, 0xe1ec2dcd, 0x42440646, 0xb1b43585, 0x23282b0b, 0x61642545, 0xf2f83aca,
138 0xe3e023c3, 0xb1b83989, 0xb1b03181, 0x939c1f8f, 0x525c1e4e, 0xf1f839c9, 0xe2e426c6, 0xb2b03282,
139 0x31303101, 0xe2e82aca, 0x616c2d4d, 0x535c1f4f, 0xe0e424c4, 0xf0f030c0, 0xc1cc0dcd, 0x80880888,
140 0x12141606, 0x32383a0a, 0x50581848, 0xd0d414c4, 0x62602242, 0x21282909, 0x03040707, 0x33303303,
141 0xe0e828c8, 0x13181b0b, 0x01040505, 0x71783949, 0x90901080, 0x62682a4a, 0x22282a0a, 0x92981a8a
142}, {
143 0x08303838, 0xc8e0e828, 0x0d212c2d, 0x86a2a426, 0xcfc3cc0f, 0xced2dc1e, 0x83b3b033, 0x88b0b838,
144 0x8fa3ac2f, 0x40606020, 0x45515415, 0xc7c3c407, 0x44404404, 0x4f636c2f, 0x4b63682b, 0x4b53581b,
145 0xc3c3c003, 0x42626022, 0x03333033, 0x85b1b435, 0x09212829, 0x80a0a020, 0xc2e2e022, 0x87a3a427,
146 0xc3d3d013, 0x81919011, 0x01111011, 0x06020406, 0x0c101c1c, 0x8cb0bc3c, 0x06323436, 0x4b43480b,
147 0xcfe3ec2f, 0x88808808, 0x4c606c2c, 0x88a0a828, 0x07131417, 0xc4c0c404, 0x06121416, 0xc4f0f434,
148 0xc2c2c002, 0x45414405, 0xc1e1e021, 0xc6d2d416, 0x0f333c3f, 0x0d313c3d, 0x8e828c0e, 0x88909818,
149 0x08202828, 0x4e424c0e, 0xc6f2f436, 0x0e323c3e, 0x85a1a425, 0xc9f1f839, 0x0d010c0d, 0xcfd3dc1f,
150 0xc8d0d818, 0x0b23282b, 0x46626426, 0x4a72783a, 0x07232427, 0x0f232c2f, 0xc1f1f031, 0x42727032,
151 0x42424002, 0xc4d0d414, 0x41414001, 0xc0c0c000, 0x43737033, 0x47636427, 0x8ca0ac2c, 0x8b83880b,
152 0xc7f3f437, 0x8da1ac2d, 0x80808000, 0x0f131c1f, 0xcac2c80a, 0x0c202c2c, 0x8aa2a82a, 0x04303434,
153 0xc2d2d012, 0x0b03080b, 0xcee2ec2e, 0xc9e1e829, 0x4d515c1d, 0x84909414, 0x08101818, 0xc8f0f838,
154 0x47535417, 0x8ea2ac2e, 0x08000808, 0xc5c1c405, 0x03131013, 0xcdc1cc0d, 0x86828406, 0x89b1b839,
155 0xcff3fc3f, 0x4d717c3d, 0xc1c1c001, 0x01313031, 0xc5f1f435, 0x8a82880a, 0x4a62682a, 0x81b1b031,
156 0xc1d1d011, 0x00202020, 0xc7d3d417, 0x02020002, 0x02222022, 0x04000404, 0x48606828, 0x41717031,
157 0x07030407, 0xcbd3d81b, 0x8d919c1d, 0x89919819, 0x41616021, 0x8eb2bc3e, 0xc6e2e426, 0x49515819,
158 0xcdd1dc1d, 0x41515011, 0x80909010, 0xccd0dc1c, 0x8a92981a, 0x83a3a023, 0x8ba3a82b, 0xc0d0d010,
159 0x81818001, 0x0f030c0f, 0x47434407, 0x0a12181a, 0xc3e3e023, 0xcce0ec2c, 0x8d818c0d, 0x8fb3bc3f,
160 0x86929416, 0x4b73783b, 0x4c505c1c, 0x82a2a022, 0x81a1a021, 0x43636023, 0x03232023, 0x4d414c0d,
161 0xc8c0c808, 0x8e929c1e, 0x8c909c1c, 0x0a32383a, 0x0c000c0c, 0x0e222c2e, 0x8ab2b83a, 0x4e626c2e,
162 0x8f939c1f, 0x4a52581a, 0xc2f2f032, 0x82929012, 0xc3f3f033, 0x49414809, 0x48707838, 0xccc0cc0c,
163 0x05111415, 0xcbf3f83b, 0x40707030, 0x45717435, 0x4f737c3f, 0x05313435, 0x00101010, 0x03030003,
164 0x44606424, 0x4d616c2d, 0xc6c2c406, 0x44707434, 0xc5d1d415, 0x84b0b434, 0xcae2e82a, 0x09010809,
165 0x46727436, 0x09111819, 0xcef2fc3e, 0x40404000, 0x02121012, 0xc0e0e020, 0x8db1bc3d, 0x05010405,
166 0xcaf2f83a, 0x01010001, 0xc0f0f030, 0x0a22282a, 0x4e525c1e, 0x89a1a829, 0x46525416, 0x43434003,
167 0x85818405, 0x04101414, 0x89818809, 0x8b93981b, 0x80b0b030, 0xc5e1e425, 0x48404808, 0x49717839,
168 0x87939417, 0xccf0fc3c, 0x0e121c1e, 0x82828002, 0x01212021, 0x8c808c0c, 0x0b13181b, 0x4f535c1f,
169 0x47737437, 0x44505414, 0x82b2b032, 0x0d111c1d, 0x05212425, 0x4f434c0f, 0x00000000, 0x46424406,
170 0xcde1ec2d, 0x48505818, 0x42525012, 0xcbe3e82b, 0x4e727c3e, 0xcad2d81a, 0xc9c1c809, 0xcdf1fc3d,
171 0x00303030, 0x85919415, 0x45616425, 0x0c303c3c, 0x86b2b436, 0xc4e0e424, 0x8bb3b83b, 0x4c707c3c,
172 0x0e020c0e, 0x40505010, 0x09313839, 0x06222426, 0x02323032, 0x84808404, 0x49616829, 0x83939013,
173 0x07333437, 0xc7e3e427, 0x04202424, 0x84a0a424, 0xcbc3c80b, 0x43535013, 0x0a02080a, 0x87838407,
174 0xc9d1d819, 0x4c404c0c, 0x83838003, 0x8f838c0f, 0xcec2cc0e, 0x0b33383b, 0x4a42480a, 0x87b3b437
175} };
176
177/* key schedule constants - golden ratio */
178#define KC0 0x9e3779b9
179#define KC1 0x3c6ef373
180#define KC2 0x78dde6e6
181#define KC3 0xf1bbcdcc
182#define KC4 0xe3779b99
183#define KC5 0xc6ef3733
184#define KC6 0x8dde6e67
185#define KC7 0x1bbcdccf
186#define KC8 0x3779b99e
187#define KC9 0x6ef3733c
188#define KC10 0xdde6e678
189#define KC11 0xbbcdccf1
190#define KC12 0x779b99e3
191#define KC13 0xef3733c6
192#define KC14 0xde6e678d
193#define KC15 0xbcdccf1b
194
195#if defined(OPENSSL_SMALL_FOOTPRINT)
196static const seed_word KC[] = {
197 KC0, KC1, KC2, KC3, KC4, KC5, KC6, KC7,
198 KC8, KC9, KC10, KC11, KC12, KC13, KC14, KC15 };
199#endif
200void SEED_set_key(const unsigned char rawkey[SEED_KEY_LENGTH], SEED_KEY_SCHEDULE *ks)
201#ifdef OPENSSL_FIPS
202 {
203 fips_cipher_abort(SEED);
204 private_SEED_set_key(rawkey, ks);
205 }
206void private_SEED_set_key(const unsigned char rawkey[SEED_KEY_LENGTH], SEED_KEY_SCHEDULE *ks)
207#endif
208{
209 seed_word x1, x2, x3, x4;
210 seed_word t0, t1;
211
212 char2word(rawkey , x1);
213 char2word(rawkey+4 , x2);
214 char2word(rawkey+8 , x3);
215 char2word(rawkey+12, x4);
216
217 t0 = (x1 + x3 - KC0) & 0xffffffff;
218 t1 = (x2 - x4 + KC0) & 0xffffffff; KEYUPDATE_TEMP(t0, t1, &ks->data[0]);
219 KEYSCHEDULE_UPDATE1(t0, t1, x1, x2, x3, x4, KC1); KEYUPDATE_TEMP(t0, t1, &ks->data[2]);
220
221#if !defined(OPENSSL_SMALL_FOOTPRINT)
222 KEYSCHEDULE_UPDATE0(t0, t1, x1, x2, x3, x4, KC2); KEYUPDATE_TEMP(t0, t1, &ks->data[4]);
223 KEYSCHEDULE_UPDATE1(t0, t1, x1, x2, x3, x4, KC3); KEYUPDATE_TEMP(t0, t1, &ks->data[6]);
224 KEYSCHEDULE_UPDATE0(t0, t1, x1, x2, x3, x4, KC4); KEYUPDATE_TEMP(t0, t1, &ks->data[8]);
225 KEYSCHEDULE_UPDATE1(t0, t1, x1, x2, x3, x4, KC5); KEYUPDATE_TEMP(t0, t1, &ks->data[10]);
226 KEYSCHEDULE_UPDATE0(t0, t1, x1, x2, x3, x4, KC6); KEYUPDATE_TEMP(t0, t1, &ks->data[12]);
227 KEYSCHEDULE_UPDATE1(t0, t1, x1, x2, x3, x4, KC7); KEYUPDATE_TEMP(t0, t1, &ks->data[14]);
228 KEYSCHEDULE_UPDATE0(t0, t1, x1, x2, x3, x4, KC8); KEYUPDATE_TEMP(t0, t1, &ks->data[16]);
229 KEYSCHEDULE_UPDATE1(t0, t1, x1, x2, x3, x4, KC9); KEYUPDATE_TEMP(t0, t1, &ks->data[18]);
230 KEYSCHEDULE_UPDATE0(t0, t1, x1, x2, x3, x4, KC10); KEYUPDATE_TEMP(t0, t1, &ks->data[20]);
231 KEYSCHEDULE_UPDATE1(t0, t1, x1, x2, x3, x4, KC11); KEYUPDATE_TEMP(t0, t1, &ks->data[22]);
232 KEYSCHEDULE_UPDATE0(t0, t1, x1, x2, x3, x4, KC12); KEYUPDATE_TEMP(t0, t1, &ks->data[24]);
233 KEYSCHEDULE_UPDATE1(t0, t1, x1, x2, x3, x4, KC13); KEYUPDATE_TEMP(t0, t1, &ks->data[26]);
234 KEYSCHEDULE_UPDATE0(t0, t1, x1, x2, x3, x4, KC14); KEYUPDATE_TEMP(t0, t1, &ks->data[28]);
235 KEYSCHEDULE_UPDATE1(t0, t1, x1, x2, x3, x4, KC15); KEYUPDATE_TEMP(t0, t1, &ks->data[30]);
236#else
237 {
238 int i;
239 for (i=2; i<16; i+=2) {
240 KEYSCHEDULE_UPDATE0(t0, t1, x1, x2, x3, x4, KC[i]);
241 KEYUPDATE_TEMP(t0, t1, &ks->data[i*2]);
242 KEYSCHEDULE_UPDATE1(t0, t1, x1, x2, x3, x4, KC[i+1]);
243 KEYUPDATE_TEMP(t0, t1, &ks->data[i*2+2]);
244 }
245 }
246#endif
247}
248
249void SEED_encrypt(const unsigned char s[SEED_BLOCK_SIZE], unsigned char d[SEED_BLOCK_SIZE], const SEED_KEY_SCHEDULE *ks)
250{
251 seed_word x1, x2, x3, x4;
252 seed_word t0, t1;
253
254 char2word(s, x1);
255 char2word(s+4, x2);
256 char2word(s+8, x3);
257 char2word(s+12, x4);
258
259#if !defined(OPENSSL_SMALL_FOOTPRINT)
260 E_SEED(t0, t1, x1, x2, x3, x4, 0);
261 E_SEED(t0, t1, x3, x4, x1, x2, 2);
262 E_SEED(t0, t1, x1, x2, x3, x4, 4);
263 E_SEED(t0, t1, x3, x4, x1, x2, 6);
264 E_SEED(t0, t1, x1, x2, x3, x4, 8);
265 E_SEED(t0, t1, x3, x4, x1, x2, 10);
266 E_SEED(t0, t1, x1, x2, x3, x4, 12);
267 E_SEED(t0, t1, x3, x4, x1, x2, 14);
268 E_SEED(t0, t1, x1, x2, x3, x4, 16);
269 E_SEED(t0, t1, x3, x4, x1, x2, 18);
270 E_SEED(t0, t1, x1, x2, x3, x4, 20);
271 E_SEED(t0, t1, x3, x4, x1, x2, 22);
272 E_SEED(t0, t1, x1, x2, x3, x4, 24);
273 E_SEED(t0, t1, x3, x4, x1, x2, 26);
274 E_SEED(t0, t1, x1, x2, x3, x4, 28);
275 E_SEED(t0, t1, x3, x4, x1, x2, 30);
276#else
277 {
278 int i;
279 for (i=0;i<30;i+=4) {
280 E_SEED(t0,t1,x1,x2,x3,x4,i);
281 E_SEED(t0,t1,x3,x4,x1,x2,i+2);
282 }
283 }
284#endif
285
286 word2char(x3, d);
287 word2char(x4, d+4);
288 word2char(x1, d+8);
289 word2char(x2, d+12);
290}
291
292void SEED_decrypt(const unsigned char s[SEED_BLOCK_SIZE], unsigned char d[SEED_BLOCK_SIZE], const SEED_KEY_SCHEDULE *ks)
293{
294 seed_word x1, x2, x3, x4;
295 seed_word t0, t1;
296
297 char2word(s, x1);
298 char2word(s+4, x2);
299 char2word(s+8, x3);
300 char2word(s+12, x4);
301
302#if !defined(OPENSSL_SMALL_FOOTPRINT)
303 E_SEED(t0, t1, x1, x2, x3, x4, 30);
304 E_SEED(t0, t1, x3, x4, x1, x2, 28);
305 E_SEED(t0, t1, x1, x2, x3, x4, 26);
306 E_SEED(t0, t1, x3, x4, x1, x2, 24);
307 E_SEED(t0, t1, x1, x2, x3, x4, 22);
308 E_SEED(t0, t1, x3, x4, x1, x2, 20);
309 E_SEED(t0, t1, x1, x2, x3, x4, 18);
310 E_SEED(t0, t1, x3, x4, x1, x2, 16);
311 E_SEED(t0, t1, x1, x2, x3, x4, 14);
312 E_SEED(t0, t1, x3, x4, x1, x2, 12);
313 E_SEED(t0, t1, x1, x2, x3, x4, 10);
314 E_SEED(t0, t1, x3, x4, x1, x2, 8);
315 E_SEED(t0, t1, x1, x2, x3, x4, 6);
316 E_SEED(t0, t1, x3, x4, x1, x2, 4);
317 E_SEED(t0, t1, x1, x2, x3, x4, 2);
318 E_SEED(t0, t1, x3, x4, x1, x2, 0);
319#else
320 {
321 int i;
322 for (i=30; i>0; i-=4) {
323 E_SEED(t0, t1, x1, x2, x3, x4, i);
324 E_SEED(t0, t1, x3, x4, x1, x2, i-2);
325
326 }
327 }
328#endif
329
330 word2char(x3, d);
331 word2char(x4, d+4);
332 word2char(x1, d+8);
333 word2char(x2, d+12);
334}
335
336#endif /* OPENSSL_NO_SEED */
diff --git a/src/lib/libcrypto/seed/seed.h b/src/lib/libcrypto/seed/seed.h
new file mode 100644
index 0000000000..c50fdd3607
--- /dev/null
+++ b/src/lib/libcrypto/seed/seed.h
@@ -0,0 +1,139 @@
1/*
2 * Copyright (c) 2007 KISA(Korea Information Security Agency). All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * 2. Neither the name of author nor the names of its contributors may
10 * be used to endorse or promote products derived from this software
11 * without specific prior written permission.
12 *
13 * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16 * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
17 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23 * SUCH DAMAGE.
24 *
25 */
26/* ====================================================================
27 * Copyright (c) 1998-2007 The OpenSSL Project. All rights reserved.
28 *
29 * Redistribution and use in source and binary forms, with or without
30 * modification, are permitted provided that the following conditions
31 * are met:
32 *
33 * 1. Redistributions of source code must retain the above copyright
34 * notice, this list of conditions and the following disclaimer.
35 *
36 * 2. Redistributions in binary form must reproduce the above copyright
37 * notice, this list of conditions and the following disclaimer in
38 * the documentation and/or other materials provided with the
39 * distribution.
40 *
41 * 3. All advertising materials mentioning features or use of this
42 * software must display the following acknowledgment:
43 * "This product includes software developed by the OpenSSL Project
44 * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
45 *
46 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
47 * endorse or promote products derived from this software without
48 * prior written permission. For written permission, please contact
49 * openssl-core@openssl.org.
50 *
51 * 5. Products derived from this software may not be called "OpenSSL"
52 * nor may "OpenSSL" appear in their names without prior written
53 * permission of the OpenSSL Project.
54 *
55 * 6. Redistributions of any form whatsoever must retain the following
56 * acknowledgment:
57 * "This product includes software developed by the OpenSSL Project
58 * for use in the OpenSSL Toolkit (http://www.openssl.org/)"
59 *
60 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
61 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
62 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
63 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
64 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
65 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
66 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
67 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
68 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
69 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
70 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
71 * OF THE POSSIBILITY OF SUCH DAMAGE.
72 * ====================================================================
73 *
74 * This product includes cryptographic software written by Eric Young
75 * (eay@cryptsoft.com). This product includes software written by Tim
76 * Hudson (tjh@cryptsoft.com).
77 *
78 */
79
80
81#ifndef HEADER_SEED_H
82#define HEADER_SEED_H
83
84#include <openssl/opensslconf.h>
85#include <openssl/e_os2.h>
86#include <openssl/crypto.h>
87
88#ifdef OPENSSL_NO_SEED
89#error SEED is disabled.
90#endif
91
92#ifdef AES_LONG /* look whether we need 'long' to get 32 bits */
93# ifndef SEED_LONG
94# define SEED_LONG 1
95# endif
96#endif
97
98#if !defined(NO_SYS_TYPES_H)
99# include <sys/types.h>
100#endif
101
102#define SEED_BLOCK_SIZE 16
103#define SEED_KEY_LENGTH 16
104
105
106#ifdef __cplusplus
107extern "C" {
108#endif
109
110
111typedef struct seed_key_st {
112#ifdef SEED_LONG
113 unsigned long data[32];
114#else
115 unsigned int data[32];
116#endif
117} SEED_KEY_SCHEDULE;
118
119#ifdef OPENSSL_FIPS
120void private_SEED_set_key(const unsigned char rawkey[SEED_KEY_LENGTH], SEED_KEY_SCHEDULE *ks);
121#endif
122void SEED_set_key(const unsigned char rawkey[SEED_KEY_LENGTH], SEED_KEY_SCHEDULE *ks);
123
124void SEED_encrypt(const unsigned char s[SEED_BLOCK_SIZE], unsigned char d[SEED_BLOCK_SIZE], const SEED_KEY_SCHEDULE *ks);
125void SEED_decrypt(const unsigned char s[SEED_BLOCK_SIZE], unsigned char d[SEED_BLOCK_SIZE], const SEED_KEY_SCHEDULE *ks);
126
127void SEED_ecb_encrypt(const unsigned char *in, unsigned char *out, const SEED_KEY_SCHEDULE *ks, int enc);
128void SEED_cbc_encrypt(const unsigned char *in, unsigned char *out,
129 size_t len, const SEED_KEY_SCHEDULE *ks, unsigned char ivec[SEED_BLOCK_SIZE], int enc);
130void SEED_cfb128_encrypt(const unsigned char *in, unsigned char *out,
131 size_t len, const SEED_KEY_SCHEDULE *ks, unsigned char ivec[SEED_BLOCK_SIZE], int *num, int enc);
132void SEED_ofb128_encrypt(const unsigned char *in, unsigned char *out,
133 size_t len, const SEED_KEY_SCHEDULE *ks, unsigned char ivec[SEED_BLOCK_SIZE], int *num);
134
135#ifdef __cplusplus
136}
137#endif
138
139#endif /* HEADER_SEED_H */
diff --git a/src/lib/libcrypto/seed/seed_cbc.c b/src/lib/libcrypto/seed/seed_cbc.c
new file mode 100644
index 0000000000..6c3f9b527a
--- /dev/null
+++ b/src/lib/libcrypto/seed/seed_cbc.c
@@ -0,0 +1,63 @@
1/* crypto/seed/seed_cbc.c -*- mode:C; c-file-style: "eay" -*- */
2/* ====================================================================
3 * Copyright (c) 1998-2007 The OpenSSL Project. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 *
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in
14 * the documentation and/or other materials provided with the
15 * distribution.
16 *
17 * 3. All advertising materials mentioning features or use of this
18 * software must display the following acknowledgment:
19 * "This product includes software developed by the OpenSSL Project
20 * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
21 *
22 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
23 * endorse or promote products derived from this software without
24 * prior written permission. For written permission, please contact
25 * openssl-core@openssl.org.
26 *
27 * 5. Products derived from this software may not be called "OpenSSL"
28 * nor may "OpenSSL" appear in their names without prior written
29 * permission of the OpenSSL Project.
30 *
31 * 6. Redistributions of any form whatsoever must retain the following
32 * acknowledgment:
33 * "This product includes software developed by the OpenSSL Project
34 * for use in the OpenSSL Toolkit (http://www.openssl.org/)"
35 *
36 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
37 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
38 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
39 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
40 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
41 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
42 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
43 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
44 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
45 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
46 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
47 * OF THE POSSIBILITY OF SUCH DAMAGE.
48 * ====================================================================
49 *
50 */
51
52#include <openssl/seed.h>
53#include <openssl/modes.h>
54
55void SEED_cbc_encrypt(const unsigned char *in, unsigned char *out,
56 size_t len, const SEED_KEY_SCHEDULE *ks,
57 unsigned char ivec[SEED_BLOCK_SIZE], int enc)
58 {
59 if (enc)
60 CRYPTO_cbc128_encrypt(in,out,len,ks,ivec,(block128_f)SEED_encrypt);
61 else
62 CRYPTO_cbc128_decrypt(in,out,len,ks,ivec,(block128_f)SEED_decrypt);
63 }
diff --git a/src/lib/libcrypto/seed/seed_cfb.c b/src/lib/libcrypto/seed/seed_cfb.c
new file mode 100644
index 0000000000..694597dd06
--- /dev/null
+++ b/src/lib/libcrypto/seed/seed_cfb.c
@@ -0,0 +1,116 @@
1/* crypto/seed/seed_cfb.c -*- mode:C; c-file-style: "eay" -*- */
2/* ====================================================================
3 * Copyright (c) 1998-2007 The OpenSSL Project. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 *
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in
14 * the documentation and/or other materials provided with the
15 * distribution.
16 *
17 * 3. All advertising materials mentioning features or use of this
18 * software must display the following acknowledgment:
19 * "This product includes software developed by the OpenSSL Project
20 * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
21 *
22 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
23 * endorse or promote products derived from this software without
24 * prior written permission. For written permission, please contact
25 * openssl-core@openssl.org.
26 *
27 * 5. Products derived from this software may not be called "OpenSSL"
28 * nor may "OpenSSL" appear in their names without prior written
29 * permission of the OpenSSL Project.
30 *
31 * 6. Redistributions of any form whatsoever must retain the following
32 * acknowledgment:
33 * "This product includes software developed by the OpenSSL Project
34 * for use in the OpenSSL Toolkit (http://www.openssl.org/)"
35 *
36 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
37 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
38 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
39 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
40 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
41 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
42 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
43 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
44 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
45 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
46 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
47 * OF THE POSSIBILITY OF SUCH DAMAGE.
48 * ====================================================================
49 *
50 */
51/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
52 * All rights reserved.
53 *
54 * This package is an SSL implementation written
55 * by Eric Young (eay@cryptsoft.com).
56 * The implementation was written so as to conform with Netscapes SSL.
57 *
58 * This library is free for commercial and non-commercial use as long as
59 * the following conditions are aheared to. The following conditions
60 * apply to all code found in this distribution, be it the RC4, RSA,
61 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
62 * included with this distribution is covered by the same copyright terms
63 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
64 *
65 * Copyright remains Eric Young's, and as such any Copyright notices in
66 * the code are not to be removed.
67 * If this package is used in a product, Eric Young should be given attribution
68 * as the author of the parts of the library used.
69 * This can be in the form of a textual message at program startup or
70 * in documentation (online or textual) provided with the package.
71 *
72 * Redistribution and use in source and binary forms, with or without
73 * modification, are permitted provided that the following conditions
74 * are met:
75 * 1. Redistributions of source code must retain the copyright
76 * notice, this list of conditions and the following disclaimer.
77 * 2. Redistributions in binary form must reproduce the above copyright
78 * notice, this list of conditions and the following disclaimer in the
79 * documentation and/or other materials provided with the distribution.
80 * 3. All advertising materials mentioning features or use of this software
81 * must display the following acknowledgement:
82 * "This product includes cryptographic software written by
83 * Eric Young (eay@cryptsoft.com)"
84 * The word 'cryptographic' can be left out if the rouines from the library
85 * being used are not cryptographic related :-).
86 * 4. If you include any Windows specific code (or a derivative thereof) from
87 * the apps directory (application code) you must include an acknowledgement:
88 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
89 *
90 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
91 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
92 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
93 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
94 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
95 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
96 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
97 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
98 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
99 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
100 * SUCH DAMAGE.
101 *
102 * The licence and distribution terms for any publically available version or
103 * derivative of this code cannot be changed. i.e. this code cannot simply be
104 * copied and put under another distribution licence
105 * [including the GNU Public Licence.]
106 */
107
108#include <openssl/seed.h>
109#include <openssl/modes.h>
110
111void SEED_cfb128_encrypt(const unsigned char *in, unsigned char *out,
112 size_t len, const SEED_KEY_SCHEDULE *ks,
113 unsigned char ivec[SEED_BLOCK_SIZE], int *num, int enc)
114 {
115 CRYPTO_cfb128_encrypt(in,out,len,ks,ivec,num,enc,(block128_f)SEED_encrypt);
116 }
diff --git a/src/lib/libcrypto/seed/seed_ecb.c b/src/lib/libcrypto/seed/seed_ecb.c
new file mode 100644
index 0000000000..e63f5ae14e
--- /dev/null
+++ b/src/lib/libcrypto/seed/seed_ecb.c
@@ -0,0 +1,60 @@
1/* crypto/seed/seed_ecb.c -*- mode:C; c-file-style: "eay" -*- */
2/* ====================================================================
3 * Copyright (c) 2007 The OpenSSL Project. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 *
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in
14 * the documentation and/or other materials provided with the
15 * distribution.
16 *
17 * 3. All advertising materials mentioning features or use of this
18 * software must display the following acknowledgment:
19 * "This product includes software developed by the OpenSSL Project
20 * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
21 *
22 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
23 * endorse or promote products derived from this software without
24 * prior written permission. For written permission, please contact
25 * openssl-core@openssl.org.
26 *
27 * 5. Products derived from this software may not be called "OpenSSL"
28 * nor may "OpenSSL" appear in their names without prior written
29 * permission of the OpenSSL Project.
30 *
31 * 6. Redistributions of any form whatsoever must retain the following
32 * acknowledgment:
33 * "This product includes software developed by the OpenSSL Project
34 * for use in the OpenSSL Toolkit (http://www.openssl.org/)"
35 *
36 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
37 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
38 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
39 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
40 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
41 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
42 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
43 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
44 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
45 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
46 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
47 * OF THE POSSIBILITY OF SUCH DAMAGE.
48 * ====================================================================
49 *
50 */
51
52#include <openssl/seed.h>
53
54void SEED_ecb_encrypt(const unsigned char *in, unsigned char *out, const SEED_KEY_SCHEDULE *ks, int enc)
55 {
56 if (enc)
57 SEED_encrypt(in, out, ks);
58 else
59 SEED_decrypt(in, out, ks);
60 }
diff --git a/src/lib/libcrypto/seed/seed_locl.h b/src/lib/libcrypto/seed/seed_locl.h
new file mode 100644
index 0000000000..fd456b6422
--- /dev/null
+++ b/src/lib/libcrypto/seed/seed_locl.h
@@ -0,0 +1,116 @@
1/*
2 * Copyright (c) 2007 KISA(Korea Information Security Agency). All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * 2. Neither the name of author nor the names of its contributors may
10 * be used to endorse or promote products derived from this software
11 * without specific prior written permission.
12 *
13 * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16 * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
17 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23 * SUCH DAMAGE.
24 *
25 */
26#ifndef HEADER_SEED_LOCL_H
27#define HEADER_SEED_LOCL_H
28
29#include "openssl/e_os2.h"
30#include <openssl/seed.h>
31
32
33#ifdef SEED_LONG /* need 32-bit type */
34typedef unsigned long seed_word;
35#else
36typedef unsigned int seed_word;
37#endif
38
39
40#ifdef __cplusplus
41extern "C" {
42#endif
43
44#define G_FUNC(v) \
45 SS[0][(unsigned char) (v) & 0xff] ^ SS[1][(unsigned char) ((v)>>8) & 0xff] ^ \
46 SS[2][(unsigned char)((v)>>16) & 0xff] ^ SS[3][(unsigned char)((v)>>24) & 0xff]
47
48#define char2word(c, i) \
49 (i) = ((((seed_word)(c)[0]) << 24) | (((seed_word)(c)[1]) << 16) | (((seed_word)(c)[2]) << 8) | ((seed_word)(c)[3]))
50
51#define word2char(l, c) \
52 *((c)+0) = (unsigned char)((l)>>24) & 0xff; \
53 *((c)+1) = (unsigned char)((l)>>16) & 0xff; \
54 *((c)+2) = (unsigned char)((l)>> 8) & 0xff; \
55 *((c)+3) = (unsigned char)((l)) & 0xff
56
57#define KEYSCHEDULE_UPDATE0(T0, T1, X1, X2, X3, X4, KC) \
58 (T0) = (X3); \
59 (X3) = (((X3)<<8) ^ ((X4)>>24)) & 0xffffffff; \
60 (X4) = (((X4)<<8) ^ ((T0)>>24)) & 0xffffffff; \
61 (T0) = ((X1) + (X3) - (KC)) & 0xffffffff; \
62 (T1) = ((X2) + (KC) - (X4)) & 0xffffffff
63
64#define KEYSCHEDULE_UPDATE1(T0, T1, X1, X2, X3, X4, KC) \
65 (T0) = (X1); \
66 (X1) = (((X1)>>8) ^ ((X2)<<24)) & 0xffffffff; \
67 (X2) = (((X2)>>8) ^ ((T0)<<24)) & 0xffffffff; \
68 (T0) = ((X1) + (X3) - (KC)) & 0xffffffff; \
69 (T1) = ((X2) + (KC) - (X4)) & 0xffffffff
70
71#define KEYUPDATE_TEMP(T0, T1, K) \
72 (K)[0] = G_FUNC((T0)); \
73 (K)[1] = G_FUNC((T1))
74
75#define XOR_SEEDBLOCK(DST, SRC) \
76 ((DST))[0] ^= ((SRC))[0]; \
77 ((DST))[1] ^= ((SRC))[1]; \
78 ((DST))[2] ^= ((SRC))[2]; \
79 ((DST))[3] ^= ((SRC))[3]
80
81#define MOV_SEEDBLOCK(DST, SRC) \
82 ((DST))[0] = ((SRC))[0]; \
83 ((DST))[1] = ((SRC))[1]; \
84 ((DST))[2] = ((SRC))[2]; \
85 ((DST))[3] = ((SRC))[3]
86
87# define CHAR2WORD(C, I) \
88 char2word((C), (I)[0]); \
89 char2word((C+4), (I)[1]); \
90 char2word((C+8), (I)[2]); \
91 char2word((C+12), (I)[3])
92
93# define WORD2CHAR(I, C) \
94 word2char((I)[0], (C)); \
95 word2char((I)[1], (C+4)); \
96 word2char((I)[2], (C+8)); \
97 word2char((I)[3], (C+12))
98
99# define E_SEED(T0, T1, X1, X2, X3, X4, rbase) \
100 (T0) = (X3) ^ (ks->data)[(rbase)]; \
101 (T1) = (X4) ^ (ks->data)[(rbase)+1]; \
102 (T1) ^= (T0); \
103 (T1) = G_FUNC((T1)); \
104 (T0) = ((T0) + (T1)) & 0xffffffff; \
105 (T0) = G_FUNC((T0)); \
106 (T1) = ((T1) + (T0)) & 0xffffffff; \
107 (T1) = G_FUNC((T1)); \
108 (T0) = ((T0) + (T1)) & 0xffffffff; \
109 (X1) ^= (T0); \
110 (X2) ^= (T1)
111
112#ifdef __cplusplus
113}
114#endif
115
116#endif /* HEADER_SEED_LOCL_H */
diff --git a/src/lib/libcrypto/seed/seed_ofb.c b/src/lib/libcrypto/seed/seed_ofb.c
new file mode 100644
index 0000000000..3c8ba33bb9
--- /dev/null
+++ b/src/lib/libcrypto/seed/seed_ofb.c
@@ -0,0 +1,116 @@
1/* crypto/seed/seed_ofb.c -*- mode:C; c-file-style: "eay" -*- */
2/* ====================================================================
3 * Copyright (c) 1998-2007 The OpenSSL Project. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 *
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in
14 * the documentation and/or other materials provided with the
15 * distribution.
16 *
17 * 3. All advertising materials mentioning features or use of this
18 * software must display the following acknowledgment:
19 * "This product includes software developed by the OpenSSL Project
20 * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
21 *
22 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
23 * endorse or promote products derived from this software without
24 * prior written permission. For written permission, please contact
25 * openssl-core@openssl.org.
26 *
27 * 5. Products derived from this software may not be called "OpenSSL"
28 * nor may "OpenSSL" appear in their names without prior written
29 * permission of the OpenSSL Project.
30 *
31 * 6. Redistributions of any form whatsoever must retain the following
32 * acknowledgment:
33 * "This product includes software developed by the OpenSSL Project
34 * for use in the OpenSSL Toolkit (http://www.openssl.org/)"
35 *
36 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
37 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
38 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
39 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
40 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
41 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
42 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
43 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
44 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
45 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
46 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
47 * OF THE POSSIBILITY OF SUCH DAMAGE.
48 * ====================================================================
49 *
50 */
51/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
52 * All rights reserved.
53 *
54 * This package is an SSL implementation written
55 * by Eric Young (eay@cryptsoft.com).
56 * The implementation was written so as to conform with Netscapes SSL.
57 *
58 * This library is free for commercial and non-commercial use as long as
59 * the following conditions are aheared to. The following conditions
60 * apply to all code found in this distribution, be it the RC4, RSA,
61 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
62 * included with this distribution is covered by the same copyright terms
63 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
64 *
65 * Copyright remains Eric Young's, and as such any Copyright notices in
66 * the code are not to be removed.
67 * If this package is used in a product, Eric Young should be given attribution
68 * as the author of the parts of the library used.
69 * This can be in the form of a textual message at program startup or
70 * in documentation (online or textual) provided with the package.
71 *
72 * Redistribution and use in source and binary forms, with or without
73 * modification, are permitted provided that the following conditions
74 * are met:
75 * 1. Redistributions of source code must retain the copyright
76 * notice, this list of conditions and the following disclaimer.
77 * 2. Redistributions in binary form must reproduce the above copyright
78 * notice, this list of conditions and the following disclaimer in the
79 * documentation and/or other materials provided with the distribution.
80 * 3. All advertising materials mentioning features or use of this software
81 * must display the following acknowledgement:
82 * "This product includes cryptographic software written by
83 * Eric Young (eay@cryptsoft.com)"
84 * The word 'cryptographic' can be left out if the rouines from the library
85 * being used are not cryptographic related :-).
86 * 4. If you include any Windows specific code (or a derivative thereof) from
87 * the apps directory (application code) you must include an acknowledgement:
88 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
89 *
90 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
91 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
92 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
93 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
94 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
95 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
96 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
97 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
98 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
99 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
100 * SUCH DAMAGE.
101 *
102 * The licence and distribution terms for any publically available version or
103 * derivative of this code cannot be changed. i.e. this code cannot simply be
104 * copied and put under another distribution licence
105 * [including the GNU Public Licence.]
106 */
107
108#include <openssl/seed.h>
109#include <openssl/modes.h>
110
111void SEED_ofb128_encrypt(const unsigned char *in, unsigned char *out,
112 size_t len, const SEED_KEY_SCHEDULE *ks,
113 unsigned char ivec[SEED_BLOCK_SIZE], int *num)
114 {
115 CRYPTO_ofb128_encrypt(in,out,len,ks,ivec,num,(block128_f)SEED_encrypt);
116 }
diff --git a/src/lib/libcrypto/sha/Makefile b/src/lib/libcrypto/sha/Makefile
new file mode 100644
index 0000000000..2eb2b7af99
--- /dev/null
+++ b/src/lib/libcrypto/sha/Makefile
@@ -0,0 +1,168 @@
1#
2# OpenSSL/crypto/sha/Makefile
3#
4
5DIR= sha
6TOP= ../..
7CC= cc
8CPP= $(CC) -E
9INCLUDES=
10CFLAG=-g
11MAKEFILE= Makefile
12AR= ar r
13
14SHA1_ASM_OBJ=
15
16CFLAGS= $(INCLUDES) $(CFLAG)
17ASFLAGS= $(INCLUDES) $(ASFLAG)
18AFLAGS= $(ASFLAGS)
19
20GENERAL=Makefile
21TEST=shatest.c sha1test.c sha256t.c sha512t.c
22APPS=
23
24LIB=$(TOP)/libcrypto.a
25LIBSRC=sha_dgst.c sha1dgst.c sha_one.c sha1_one.c sha256.c sha512.c
26LIBOBJ=sha_dgst.o sha1dgst.o sha_one.o sha1_one.o sha256.o sha512.o $(SHA1_ASM_OBJ)
27
28SRC= $(LIBSRC)
29
30EXHEADER= sha.h
31HEADER= sha_locl.h $(EXHEADER)
32
33ALL= $(GENERAL) $(SRC) $(HEADER)
34
35top:
36 (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all)
37
38all: lib
39
40lib: $(LIBOBJ)
41 $(AR) $(LIB) $(LIBOBJ)
42 $(RANLIB) $(LIB) || echo Never mind.
43 @touch lib
44
45sha1-586.s: asm/sha1-586.pl ../perlasm/x86asm.pl
46 $(PERL) asm/sha1-586.pl $(PERLASM_SCHEME) $(CFLAGS) $(PROCESSOR) > $@
47sha256-586.s: asm/sha256-586.pl ../perlasm/x86asm.pl
48 $(PERL) asm/sha256-586.pl $(PERLASM_SCHEME) $(CFLAGS) $(PROCESSOR) > $@
49sha512-586.s: asm/sha512-586.pl ../perlasm/x86asm.pl
50 $(PERL) asm/sha512-586.pl $(PERLASM_SCHEME) $(CFLAGS) $(PROCESSOR) > $@
51
52sha1-ia64.s: asm/sha1-ia64.pl
53 (cd asm; $(PERL) sha1-ia64.pl ../$@ $(CFLAGS))
54sha256-ia64.s: asm/sha512-ia64.pl
55 (cd asm; $(PERL) sha512-ia64.pl ../$@ $(CFLAGS))
56sha512-ia64.s: asm/sha512-ia64.pl
57 (cd asm; $(PERL) sha512-ia64.pl ../$@ $(CFLAGS))
58
59sha256-armv4.S: asm/sha256-armv4.pl
60 $(PERL) $< $(PERLASM_SCHEME) $@
61
62sha1-alpha.s: asm/sha1-alpha.pl
63 (preproc=/tmp/$$$$.$@; trap "rm $$preproc" INT; \
64 $(PERL) asm/sha1-alpha.pl > $$preproc && \
65 $(CC) -E $$preproc > $@ && rm $$preproc)
66
67# Solaris make has to be explicitly told
68sha1-x86_64.s: asm/sha1-x86_64.pl; $(PERL) asm/sha1-x86_64.pl $(PERLASM_SCHEME) > $@
69sha256-x86_64.s:asm/sha512-x86_64.pl; $(PERL) asm/sha512-x86_64.pl $(PERLASM_SCHEME) $@
70sha512-x86_64.s:asm/sha512-x86_64.pl; $(PERL) asm/sha512-x86_64.pl $(PERLASM_SCHEME) $@
71sha1-sparcv9.s: asm/sha1-sparcv9.pl; $(PERL) asm/sha1-sparcv9.pl $@ $(CFLAGS)
72sha256-sparcv9.s:asm/sha512-sparcv9.pl; $(PERL) asm/sha512-sparcv9.pl $@ $(CFLAGS)
73sha512-sparcv9.s:asm/sha512-sparcv9.pl; $(PERL) asm/sha512-sparcv9.pl $@ $(CFLAGS)
74
75sha1-ppc.s: asm/sha1-ppc.pl; $(PERL) asm/sha1-ppc.pl $(PERLASM_SCHEME) $@
76sha256-ppc.s: asm/sha512-ppc.pl; $(PERL) asm/sha512-ppc.pl $(PERLASM_SCHEME) $@
77sha512-ppc.s: asm/sha512-ppc.pl; $(PERL) asm/sha512-ppc.pl $(PERLASM_SCHEME) $@
78
79sha1-parisc.s: asm/sha1-parisc.pl; $(PERL) asm/sha1-parisc.pl $(PERLASM_SCHEME) $@
80sha256-parisc.s:asm/sha512-parisc.pl; $(PERL) asm/sha512-parisc.pl $(PERLASM_SCHEME) $@
81sha512-parisc.s:asm/sha512-parisc.pl; $(PERL) asm/sha512-parisc.pl $(PERLASM_SCHEME) $@
82
83sha1-mips.S: asm/sha1-mips.pl; $(PERL) asm/sha1-mips.pl $(PERLASM_SCHEME) $@
84sha256-mips.S: asm/sha512-mips.pl; $(PERL) asm/sha512-mips.pl $(PERLASM_SCHEME) $@
85sha512-mips.S: asm/sha512-mips.pl; $(PERL) asm/sha512-mips.pl $(PERLASM_SCHEME) $@
86
87# GNU make "catch all"
88sha1-%.S: asm/sha1-%.pl; $(PERL) $< $(PERLASM_SCHEME) $@
89sha256-%.S: asm/sha512-%.pl; $(PERL) $< $(PERLASM_SCHEME) $@
90sha512-%.S: asm/sha512-%.pl; $(PERL) $< $(PERLASM_SCHEME) $@
91
92sha1-armv4-large.o: sha1-armv4-large.S
93sha256-armv4.o: sha256-armv4.S
94sha512-armv4.o: sha512-armv4.S
95
96files:
97 $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
98
99links:
100 @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
101 @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
102 @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
103
104install:
105 @[ -n "$(INSTALLTOP)" ] # should be set by top Makefile...
106 @headerlist="$(EXHEADER)"; for i in $$headerlist ; \
107 do \
108 (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
109 chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
110 done;
111
112tags:
113 ctags $(SRC)
114
115tests:
116
117lint:
118 lint -DLINT $(INCLUDES) $(SRC)>fluff
119
120depend:
121 @[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile...
122 $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
123
124dclean:
125 $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
126 mv -f Makefile.new $(MAKEFILE)
127
128clean:
129 rm -f *.s *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
130
131# DO NOT DELETE THIS LINE -- make depend depends on it.
132
133sha1_one.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
134sha1_one.o: ../../include/openssl/opensslconf.h
135sha1_one.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
136sha1_one.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
137sha1_one.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
138sha1_one.o: sha1_one.c
139sha1dgst.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
140sha1dgst.o: ../../include/openssl/opensslconf.h
141sha1dgst.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
142sha1dgst.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
143sha1dgst.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
144sha1dgst.o: ../md32_common.h sha1dgst.c sha_locl.h
145sha256.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
146sha256.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
147sha256.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
148sha256.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
149sha256.o: ../../include/openssl/symhacks.h ../md32_common.h sha256.c
150sha512.o: ../../e_os.h ../../include/openssl/bio.h
151sha512.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
152sha512.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
153sha512.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
154sha512.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
155sha512.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
156sha512.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
157sha512.o: ../cryptlib.h sha512.c
158sha_dgst.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
159sha_dgst.o: ../../include/openssl/opensslconf.h
160sha_dgst.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
161sha_dgst.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
162sha_dgst.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
163sha_dgst.o: ../md32_common.h sha_dgst.c sha_locl.h
164sha_one.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
165sha_one.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
166sha_one.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
167sha_one.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
168sha_one.o: ../../include/openssl/symhacks.h sha_one.c
diff --git a/src/lib/libcrypto/sha/asm/README b/src/lib/libcrypto/sha/asm/README
new file mode 100644
index 0000000000..b7e755765f
--- /dev/null
+++ b/src/lib/libcrypto/sha/asm/README
@@ -0,0 +1 @@
C2.pl works
diff --git a/src/lib/libcrypto/sha/sha.c b/src/lib/libcrypto/sha/sha.c
new file mode 100644
index 0000000000..42126551d1
--- /dev/null
+++ b/src/lib/libcrypto/sha/sha.c
@@ -0,0 +1,124 @@
1/* crypto/sha/sha.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
59#include <stdio.h>
60#include <stdlib.h>
61#include <openssl/sha.h>
62
63#define BUFSIZE 1024*16
64
65void do_fp(FILE *f);
66void pt(unsigned char *md);
67int read(int, void *, unsigned int);
68int main(int argc, char **argv)
69 {
70 int i,err=0;
71 FILE *IN;
72
73 if (argc == 1)
74 {
75 do_fp(stdin);
76 }
77 else
78 {
79 for (i=1; i<argc; i++)
80 {
81 IN=fopen(argv[i],"r");
82 if (IN == NULL)
83 {
84 perror(argv[i]);
85 err++;
86 continue;
87 }
88 printf("SHA(%s)= ",argv[i]);
89 do_fp(IN);
90 fclose(IN);
91 }
92 }
93 exit(err);
94 }
95
96void do_fp(FILE *f)
97 {
98 SHA_CTX c;
99 unsigned char md[SHA_DIGEST_LENGTH];
100 int fd;
101 int i;
102 unsigned char buf[BUFSIZE];
103
104 fd=fileno(f);
105 SHA_Init(&c);
106 for (;;)
107 {
108 i=read(fd,buf,BUFSIZE);
109 if (i <= 0) break;
110 SHA_Update(&c,buf,(unsigned long)i);
111 }
112 SHA_Final(&(md[0]),&c);
113 pt(md);
114 }
115
116void pt(unsigned char *md)
117 {
118 int i;
119
120 for (i=0; i<SHA_DIGEST_LENGTH; i++)
121 printf("%02x",md[i]);
122 printf("\n");
123 }
124
diff --git a/src/lib/libcrypto/sha/sha1.c b/src/lib/libcrypto/sha/sha1.c
new file mode 100644
index 0000000000..d350c88ee4
--- /dev/null
+++ b/src/lib/libcrypto/sha/sha1.c
@@ -0,0 +1,127 @@
1/* crypto/sha/sha1.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
59#include <stdio.h>
60#include <stdlib.h>
61#include <openssl/sha.h>
62
63#define BUFSIZE 1024*16
64
65void do_fp(FILE *f);
66void pt(unsigned char *md);
67#ifndef _OSD_POSIX
68int read(int, void *, unsigned int);
69#endif
70
71int main(int argc, char **argv)
72 {
73 int i,err=0;
74 FILE *IN;
75
76 if (argc == 1)
77 {
78 do_fp(stdin);
79 }
80 else
81 {
82 for (i=1; i<argc; i++)
83 {
84 IN=fopen(argv[i],"r");
85 if (IN == NULL)
86 {
87 perror(argv[i]);
88 err++;
89 continue;
90 }
91 printf("SHA1(%s)= ",argv[i]);
92 do_fp(IN);
93 fclose(IN);
94 }
95 }
96 exit(err);
97 }
98
99void do_fp(FILE *f)
100 {
101 SHA_CTX c;
102 unsigned char md[SHA_DIGEST_LENGTH];
103 int fd;
104 int i;
105 unsigned char buf[BUFSIZE];
106
107 fd=fileno(f);
108 SHA1_Init(&c);
109 for (;;)
110 {
111 i=read(fd,buf,BUFSIZE);
112 if (i <= 0) break;
113 SHA1_Update(&c,buf,(unsigned long)i);
114 }
115 SHA1_Final(&(md[0]),&c);
116 pt(md);
117 }
118
119void pt(unsigned char *md)
120 {
121 int i;
122
123 for (i=0; i<SHA_DIGEST_LENGTH; i++)
124 printf("%02x",md[i]);
125 printf("\n");
126 }
127
diff --git a/src/lib/libcrypto/sha/sha1_one.c b/src/lib/libcrypto/sha/sha1_one.c
index c56ec94020..7c65b60276 100644
--- a/src/lib/libcrypto/sha/sha1_one.c
+++ b/src/lib/libcrypto/sha/sha1_one.c
@@ -58,8 +58,8 @@
58 58
59#include <stdio.h> 59#include <stdio.h>
60#include <string.h> 60#include <string.h>
61#include <openssl/crypto.h>
62#include <openssl/sha.h> 61#include <openssl/sha.h>
62#include <openssl/crypto.h>
63 63
64#ifndef OPENSSL_NO_SHA1 64#ifndef OPENSSL_NO_SHA1
65unsigned char *SHA1(const unsigned char *d, size_t n, unsigned char *md) 65unsigned char *SHA1(const unsigned char *d, size_t n, unsigned char *md)
diff --git a/src/lib/libcrypto/sha/sha1dgst.c b/src/lib/libcrypto/sha/sha1dgst.c
index a98690225f..81219af088 100644
--- a/src/lib/libcrypto/sha/sha1dgst.c
+++ b/src/lib/libcrypto/sha/sha1dgst.c
@@ -56,8 +56,8 @@
56 * [including the GNU Public Licence.] 56 * [including the GNU Public Licence.]
57 */ 57 */
58 58
59#include <openssl/crypto.h>
60#include <openssl/opensslconf.h> 59#include <openssl/opensslconf.h>
60#include <openssl/crypto.h>
61#if !defined(OPENSSL_NO_SHA1) && !defined(OPENSSL_NO_SHA) 61#if !defined(OPENSSL_NO_SHA1) && !defined(OPENSSL_NO_SHA)
62 62
63#undef SHA_0 63#undef SHA_0
diff --git a/src/lib/libcrypto/sha/sha1test.c b/src/lib/libcrypto/sha/sha1test.c
new file mode 100644
index 0000000000..6feb3964c7
--- /dev/null
+++ b/src/lib/libcrypto/sha/sha1test.c
@@ -0,0 +1,178 @@
1/* crypto/sha/sha1test.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
59#include <stdio.h>
60#include <string.h>
61#include <stdlib.h>
62
63#include "../e_os.h"
64
65#ifdef OPENSSL_NO_SHA
66int main(int argc, char *argv[])
67{
68 printf("No SHA support\n");
69 return(0);
70}
71#else
72#include <openssl/evp.h>
73#include <openssl/sha.h>
74
75#ifdef CHARSET_EBCDIC
76#include <openssl/ebcdic.h>
77#endif
78
79#undef SHA_0 /* FIPS 180 */
80#define SHA_1 /* FIPS 180-1 */
81
82static char *test[]={
83 "abc",
84 "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq",
85 NULL,
86 };
87
88#ifdef SHA_0
89static char *ret[]={
90 "0164b8a914cd2a5e74c4f7ff082c4d97f1edf880",
91 "d2516ee1acfa5baf33dfc1c471e438449ef134c8",
92 };
93static char *bigret=
94 "3232affa48628a26653b5aaa44541fd90d690603";
95#endif
96#ifdef SHA_1
97static char *ret[]={
98 "a9993e364706816aba3e25717850c26c9cd0d89d",
99 "84983e441c3bd26ebaae4aa1f95129e5e54670f1",
100 };
101static char *bigret=
102 "34aa973cd4c4daa4f61eeb2bdbad27316534016f";
103#endif
104
105static char *pt(unsigned char *md);
106int main(int argc, char *argv[])
107 {
108 int i,err=0;
109 char **P,**R;
110 static unsigned char buf[1000];
111 char *p,*r;
112 EVP_MD_CTX c;
113 unsigned char md[SHA_DIGEST_LENGTH];
114
115#ifdef CHARSET_EBCDIC
116 ebcdic2ascii(test[0], test[0], strlen(test[0]));
117 ebcdic2ascii(test[1], test[1], strlen(test[1]));
118#endif
119
120 EVP_MD_CTX_init(&c);
121 P=test;
122 R=ret;
123 i=1;
124 while (*P != NULL)
125 {
126 EVP_Digest(*P,strlen((char *)*P),md,NULL,EVP_sha1(), NULL);
127 p=pt(md);
128 if (strcmp(p,(char *)*R) != 0)
129 {
130 printf("error calculating SHA1 on '%s'\n",*P);
131 printf("got %s instead of %s\n",p,*R);
132 err++;
133 }
134 else
135 printf("test %d ok\n",i);
136 i++;
137 R++;
138 P++;
139 }
140
141 memset(buf,'a',1000);
142#ifdef CHARSET_EBCDIC
143 ebcdic2ascii(buf, buf, 1000);
144#endif /*CHARSET_EBCDIC*/
145 EVP_DigestInit_ex(&c,EVP_sha1(), NULL);
146 for (i=0; i<1000; i++)
147 EVP_DigestUpdate(&c,buf,1000);
148 EVP_DigestFinal_ex(&c,md,NULL);
149 p=pt(md);
150
151 r=bigret;
152 if (strcmp(p,r) != 0)
153 {
154 printf("error calculating SHA1 on 'a' * 1000\n");
155 printf("got %s instead of %s\n",p,r);
156 err++;
157 }
158 else
159 printf("test 3 ok\n");
160
161#ifdef OPENSSL_SYS_NETWARE
162 if (err) printf("ERROR: %d\n", err);
163#endif
164 EXIT(err);
165 EVP_MD_CTX_cleanup(&c);
166 return(0);
167 }
168
169static char *pt(unsigned char *md)
170 {
171 int i;
172 static char buf[80];
173
174 for (i=0; i<SHA_DIGEST_LENGTH; i++)
175 sprintf(&(buf[i*2]),"%02x",md[i]);
176 return(buf);
177 }
178#endif
diff --git a/src/lib/libcrypto/sha/sha256t.c b/src/lib/libcrypto/sha/sha256t.c
new file mode 100644
index 0000000000..6b4a3bd001
--- /dev/null
+++ b/src/lib/libcrypto/sha/sha256t.c
@@ -0,0 +1,147 @@
1/* crypto/sha/sha256t.c */
2/* ====================================================================
3 * Copyright (c) 2004 The OpenSSL Project. All rights reserved.
4 * ====================================================================
5 */
6#include <stdio.h>
7#include <string.h>
8#include <stdlib.h>
9
10#include <openssl/sha.h>
11#include <openssl/evp.h>
12
13#if defined(OPENSSL_NO_SHA) || defined(OPENSSL_NO_SHA256)
14int main(int argc, char *argv[])
15{
16 printf("No SHA256 support\n");
17 return(0);
18}
19#else
20
21unsigned char app_b1[SHA256_DIGEST_LENGTH] = {
22 0xba,0x78,0x16,0xbf,0x8f,0x01,0xcf,0xea,
23 0x41,0x41,0x40,0xde,0x5d,0xae,0x22,0x23,
24 0xb0,0x03,0x61,0xa3,0x96,0x17,0x7a,0x9c,
25 0xb4,0x10,0xff,0x61,0xf2,0x00,0x15,0xad };
26
27unsigned char app_b2[SHA256_DIGEST_LENGTH] = {
28 0x24,0x8d,0x6a,0x61,0xd2,0x06,0x38,0xb8,
29 0xe5,0xc0,0x26,0x93,0x0c,0x3e,0x60,0x39,
30 0xa3,0x3c,0xe4,0x59,0x64,0xff,0x21,0x67,
31 0xf6,0xec,0xed,0xd4,0x19,0xdb,0x06,0xc1 };
32
33unsigned char app_b3[SHA256_DIGEST_LENGTH] = {
34 0xcd,0xc7,0x6e,0x5c,0x99,0x14,0xfb,0x92,
35 0x81,0xa1,0xc7,0xe2,0x84,0xd7,0x3e,0x67,
36 0xf1,0x80,0x9a,0x48,0xa4,0x97,0x20,0x0e,
37 0x04,0x6d,0x39,0xcc,0xc7,0x11,0x2c,0xd0 };
38
39unsigned char addenum_1[SHA224_DIGEST_LENGTH] = {
40 0x23,0x09,0x7d,0x22,0x34,0x05,0xd8,0x22,
41 0x86,0x42,0xa4,0x77,0xbd,0xa2,0x55,0xb3,
42 0x2a,0xad,0xbc,0xe4,0xbd,0xa0,0xb3,0xf7,
43 0xe3,0x6c,0x9d,0xa7 };
44
45unsigned char addenum_2[SHA224_DIGEST_LENGTH] = {
46 0x75,0x38,0x8b,0x16,0x51,0x27,0x76,0xcc,
47 0x5d,0xba,0x5d,0xa1,0xfd,0x89,0x01,0x50,
48 0xb0,0xc6,0x45,0x5c,0xb4,0xf5,0x8b,0x19,
49 0x52,0x52,0x25,0x25 };
50
51unsigned char addenum_3[SHA224_DIGEST_LENGTH] = {
52 0x20,0x79,0x46,0x55,0x98,0x0c,0x91,0xd8,
53 0xbb,0xb4,0xc1,0xea,0x97,0x61,0x8a,0x4b,
54 0xf0,0x3f,0x42,0x58,0x19,0x48,0xb2,0xee,
55 0x4e,0xe7,0xad,0x67 };
56
57int main (int argc,char **argv)
58{ unsigned char md[SHA256_DIGEST_LENGTH];
59 int i;
60 EVP_MD_CTX evp;
61
62 fprintf(stdout,"Testing SHA-256 ");
63
64 EVP_Digest ("abc",3,md,NULL,EVP_sha256(),NULL);
65 if (memcmp(md,app_b1,sizeof(app_b1)))
66 { fflush(stdout);
67 fprintf(stderr,"\nTEST 1 of 3 failed.\n");
68 return 1;
69 }
70 else
71 fprintf(stdout,"."); fflush(stdout);
72
73 EVP_Digest ("abcdbcde""cdefdefg""efghfghi""ghijhijk"
74 "ijkljklm""klmnlmno""mnopnopq",56,md,NULL,EVP_sha256(),NULL);
75 if (memcmp(md,app_b2,sizeof(app_b2)))
76 { fflush(stdout);
77 fprintf(stderr,"\nTEST 2 of 3 failed.\n");
78 return 1;
79 }
80 else
81 fprintf(stdout,"."); fflush(stdout);
82
83 EVP_MD_CTX_init (&evp);
84 EVP_DigestInit_ex (&evp,EVP_sha256(),NULL);
85 for (i=0;i<1000000;i+=160)
86 EVP_DigestUpdate (&evp, "aaaaaaaa""aaaaaaaa""aaaaaaaa""aaaaaaaa"
87 "aaaaaaaa""aaaaaaaa""aaaaaaaa""aaaaaaaa"
88 "aaaaaaaa""aaaaaaaa""aaaaaaaa""aaaaaaaa"
89 "aaaaaaaa""aaaaaaaa""aaaaaaaa""aaaaaaaa"
90 "aaaaaaaa""aaaaaaaa""aaaaaaaa""aaaaaaaa",
91 (1000000-i)<160?1000000-i:160);
92 EVP_DigestFinal_ex (&evp,md,NULL);
93 EVP_MD_CTX_cleanup (&evp);
94
95 if (memcmp(md,app_b3,sizeof(app_b3)))
96 { fflush(stdout);
97 fprintf(stderr,"\nTEST 3 of 3 failed.\n");
98 return 1;
99 }
100 else
101 fprintf(stdout,"."); fflush(stdout);
102
103 fprintf(stdout," passed.\n"); fflush(stdout);
104
105 fprintf(stdout,"Testing SHA-224 ");
106
107 EVP_Digest ("abc",3,md,NULL,EVP_sha224(),NULL);
108 if (memcmp(md,addenum_1,sizeof(addenum_1)))
109 { fflush(stdout);
110 fprintf(stderr,"\nTEST 1 of 3 failed.\n");
111 return 1;
112 }
113 else
114 fprintf(stdout,"."); fflush(stdout);
115
116 EVP_Digest ("abcdbcde""cdefdefg""efghfghi""ghijhijk"
117 "ijkljklm""klmnlmno""mnopnopq",56,md,NULL,EVP_sha224(),NULL);
118 if (memcmp(md,addenum_2,sizeof(addenum_2)))
119 { fflush(stdout);
120 fprintf(stderr,"\nTEST 2 of 3 failed.\n");
121 return 1;
122 }
123 else
124 fprintf(stdout,"."); fflush(stdout);
125
126 EVP_MD_CTX_init (&evp);
127 EVP_DigestInit_ex (&evp,EVP_sha224(),NULL);
128 for (i=0;i<1000000;i+=64)
129 EVP_DigestUpdate (&evp, "aaaaaaaa""aaaaaaaa""aaaaaaaa""aaaaaaaa"
130 "aaaaaaaa""aaaaaaaa""aaaaaaaa""aaaaaaaa",
131 (1000000-i)<64?1000000-i:64);
132 EVP_DigestFinal_ex (&evp,md,NULL);
133 EVP_MD_CTX_cleanup (&evp);
134
135 if (memcmp(md,addenum_3,sizeof(addenum_3)))
136 { fflush(stdout);
137 fprintf(stderr,"\nTEST 3 of 3 failed.\n");
138 return 1;
139 }
140 else
141 fprintf(stdout,"."); fflush(stdout);
142
143 fprintf(stdout," passed.\n"); fflush(stdout);
144
145 return 0;
146}
147#endif
diff --git a/src/lib/libcrypto/sha/sha512t.c b/src/lib/libcrypto/sha/sha512t.c
new file mode 100644
index 0000000000..210041d435
--- /dev/null
+++ b/src/lib/libcrypto/sha/sha512t.c
@@ -0,0 +1,184 @@
1/* crypto/sha/sha512t.c */
2/* ====================================================================
3 * Copyright (c) 2004 The OpenSSL Project. All rights reserved.
4 * ====================================================================
5 */
6#include <stdio.h>
7#include <string.h>
8#include <stdlib.h>
9
10#include <openssl/sha.h>
11#include <openssl/evp.h>
12#include <openssl/crypto.h>
13
14#if defined(OPENSSL_NO_SHA) || defined(OPENSSL_NO_SHA512)
15int main(int argc, char *argv[])
16{
17 printf("No SHA512 support\n");
18 return(0);
19}
20#else
21
22unsigned char app_c1[SHA512_DIGEST_LENGTH] = {
23 0xdd,0xaf,0x35,0xa1,0x93,0x61,0x7a,0xba,
24 0xcc,0x41,0x73,0x49,0xae,0x20,0x41,0x31,
25 0x12,0xe6,0xfa,0x4e,0x89,0xa9,0x7e,0xa2,
26 0x0a,0x9e,0xee,0xe6,0x4b,0x55,0xd3,0x9a,
27 0x21,0x92,0x99,0x2a,0x27,0x4f,0xc1,0xa8,
28 0x36,0xba,0x3c,0x23,0xa3,0xfe,0xeb,0xbd,
29 0x45,0x4d,0x44,0x23,0x64,0x3c,0xe8,0x0e,
30 0x2a,0x9a,0xc9,0x4f,0xa5,0x4c,0xa4,0x9f };
31
32unsigned char app_c2[SHA512_DIGEST_LENGTH] = {
33 0x8e,0x95,0x9b,0x75,0xda,0xe3,0x13,0xda,
34 0x8c,0xf4,0xf7,0x28,0x14,0xfc,0x14,0x3f,
35 0x8f,0x77,0x79,0xc6,0xeb,0x9f,0x7f,0xa1,
36 0x72,0x99,0xae,0xad,0xb6,0x88,0x90,0x18,
37 0x50,0x1d,0x28,0x9e,0x49,0x00,0xf7,0xe4,
38 0x33,0x1b,0x99,0xde,0xc4,0xb5,0x43,0x3a,
39 0xc7,0xd3,0x29,0xee,0xb6,0xdd,0x26,0x54,
40 0x5e,0x96,0xe5,0x5b,0x87,0x4b,0xe9,0x09 };
41
42unsigned char app_c3[SHA512_DIGEST_LENGTH] = {
43 0xe7,0x18,0x48,0x3d,0x0c,0xe7,0x69,0x64,
44 0x4e,0x2e,0x42,0xc7,0xbc,0x15,0xb4,0x63,
45 0x8e,0x1f,0x98,0xb1,0x3b,0x20,0x44,0x28,
46 0x56,0x32,0xa8,0x03,0xaf,0xa9,0x73,0xeb,
47 0xde,0x0f,0xf2,0x44,0x87,0x7e,0xa6,0x0a,
48 0x4c,0xb0,0x43,0x2c,0xe5,0x77,0xc3,0x1b,
49 0xeb,0x00,0x9c,0x5c,0x2c,0x49,0xaa,0x2e,
50 0x4e,0xad,0xb2,0x17,0xad,0x8c,0xc0,0x9b };
51
52unsigned char app_d1[SHA384_DIGEST_LENGTH] = {
53 0xcb,0x00,0x75,0x3f,0x45,0xa3,0x5e,0x8b,
54 0xb5,0xa0,0x3d,0x69,0x9a,0xc6,0x50,0x07,
55 0x27,0x2c,0x32,0xab,0x0e,0xde,0xd1,0x63,
56 0x1a,0x8b,0x60,0x5a,0x43,0xff,0x5b,0xed,
57 0x80,0x86,0x07,0x2b,0xa1,0xe7,0xcc,0x23,
58 0x58,0xba,0xec,0xa1,0x34,0xc8,0x25,0xa7 };
59
60unsigned char app_d2[SHA384_DIGEST_LENGTH] = {
61 0x09,0x33,0x0c,0x33,0xf7,0x11,0x47,0xe8,
62 0x3d,0x19,0x2f,0xc7,0x82,0xcd,0x1b,0x47,
63 0x53,0x11,0x1b,0x17,0x3b,0x3b,0x05,0xd2,
64 0x2f,0xa0,0x80,0x86,0xe3,0xb0,0xf7,0x12,
65 0xfc,0xc7,0xc7,0x1a,0x55,0x7e,0x2d,0xb9,
66 0x66,0xc3,0xe9,0xfa,0x91,0x74,0x60,0x39 };
67
68unsigned char app_d3[SHA384_DIGEST_LENGTH] = {
69 0x9d,0x0e,0x18,0x09,0x71,0x64,0x74,0xcb,
70 0x08,0x6e,0x83,0x4e,0x31,0x0a,0x4a,0x1c,
71 0xed,0x14,0x9e,0x9c,0x00,0xf2,0x48,0x52,
72 0x79,0x72,0xce,0xc5,0x70,0x4c,0x2a,0x5b,
73 0x07,0xb8,0xb3,0xdc,0x38,0xec,0xc4,0xeb,
74 0xae,0x97,0xdd,0xd8,0x7f,0x3d,0x89,0x85 };
75
76int main (int argc,char **argv)
77{ unsigned char md[SHA512_DIGEST_LENGTH];
78 int i;
79 EVP_MD_CTX evp;
80
81#ifdef OPENSSL_IA32_SSE2
82 /* Alternative to this is to call OpenSSL_add_all_algorithms...
83 * The below code is retained exclusively for debugging purposes. */
84 { char *env;
85
86 if ((env=getenv("OPENSSL_ia32cap")))
87 OPENSSL_ia32cap = strtoul (env,NULL,0);
88 }
89#endif
90
91 fprintf(stdout,"Testing SHA-512 ");
92
93 EVP_Digest ("abc",3,md,NULL,EVP_sha512(),NULL);
94 if (memcmp(md,app_c1,sizeof(app_c1)))
95 { fflush(stdout);
96 fprintf(stderr,"\nTEST 1 of 3 failed.\n");
97 return 1;
98 }
99 else
100 fprintf(stdout,"."); fflush(stdout);
101
102 EVP_Digest ("abcdefgh""bcdefghi""cdefghij""defghijk"
103 "efghijkl""fghijklm""ghijklmn""hijklmno"
104 "ijklmnop""jklmnopq""klmnopqr""lmnopqrs"
105 "mnopqrst""nopqrstu",112,md,NULL,EVP_sha512(),NULL);
106 if (memcmp(md,app_c2,sizeof(app_c2)))
107 { fflush(stdout);
108 fprintf(stderr,"\nTEST 2 of 3 failed.\n");
109 return 1;
110 }
111 else
112 fprintf(stdout,"."); fflush(stdout);
113
114 EVP_MD_CTX_init (&evp);
115 EVP_DigestInit_ex (&evp,EVP_sha512(),NULL);
116 for (i=0;i<1000000;i+=288)
117 EVP_DigestUpdate (&evp, "aaaaaaaa""aaaaaaaa""aaaaaaaa""aaaaaaaa"
118 "aaaaaaaa""aaaaaaaa""aaaaaaaa""aaaaaaaa"
119 "aaaaaaaa""aaaaaaaa""aaaaaaaa""aaaaaaaa"
120 "aaaaaaaa""aaaaaaaa""aaaaaaaa""aaaaaaaa"
121 "aaaaaaaa""aaaaaaaa""aaaaaaaa""aaaaaaaa"
122 "aaaaaaaa""aaaaaaaa""aaaaaaaa""aaaaaaaa"
123 "aaaaaaaa""aaaaaaaa""aaaaaaaa""aaaaaaaa"
124 "aaaaaaaa""aaaaaaaa""aaaaaaaa""aaaaaaaa"
125 "aaaaaaaa""aaaaaaaa""aaaaaaaa""aaaaaaaa",
126 (1000000-i)<288?1000000-i:288);
127 EVP_DigestFinal_ex (&evp,md,NULL);
128 EVP_MD_CTX_cleanup (&evp);
129
130 if (memcmp(md,app_c3,sizeof(app_c3)))
131 { fflush(stdout);
132 fprintf(stderr,"\nTEST 3 of 3 failed.\n");
133 return 1;
134 }
135 else
136 fprintf(stdout,"."); fflush(stdout);
137
138 fprintf(stdout," passed.\n"); fflush(stdout);
139
140 fprintf(stdout,"Testing SHA-384 ");
141
142 EVP_Digest ("abc",3,md,NULL,EVP_sha384(),NULL);
143 if (memcmp(md,app_d1,sizeof(app_d1)))
144 { fflush(stdout);
145 fprintf(stderr,"\nTEST 1 of 3 failed.\n");
146 return 1;
147 }
148 else
149 fprintf(stdout,"."); fflush(stdout);
150
151 EVP_Digest ("abcdefgh""bcdefghi""cdefghij""defghijk"
152 "efghijkl""fghijklm""ghijklmn""hijklmno"
153 "ijklmnop""jklmnopq""klmnopqr""lmnopqrs"
154 "mnopqrst""nopqrstu",112,md,NULL,EVP_sha384(),NULL);
155 if (memcmp(md,app_d2,sizeof(app_d2)))
156 { fflush(stdout);
157 fprintf(stderr,"\nTEST 2 of 3 failed.\n");
158 return 1;
159 }
160 else
161 fprintf(stdout,"."); fflush(stdout);
162
163 EVP_MD_CTX_init (&evp);
164 EVP_DigestInit_ex (&evp,EVP_sha384(),NULL);
165 for (i=0;i<1000000;i+=64)
166 EVP_DigestUpdate (&evp, "aaaaaaaa""aaaaaaaa""aaaaaaaa""aaaaaaaa"
167 "aaaaaaaa""aaaaaaaa""aaaaaaaa""aaaaaaaa",
168 (1000000-i)<64?1000000-i:64);
169 EVP_DigestFinal_ex (&evp,md,NULL);
170 EVP_MD_CTX_cleanup (&evp);
171
172 if (memcmp(md,app_d3,sizeof(app_d3)))
173 { fflush(stdout);
174 fprintf(stderr,"\nTEST 3 of 3 failed.\n");
175 return 1;
176 }
177 else
178 fprintf(stdout,"."); fflush(stdout);
179
180 fprintf(stdout," passed.\n"); fflush(stdout);
181
182 return 0;
183}
184#endif
diff --git a/src/lib/libcrypto/sha/sha_dgst.c b/src/lib/libcrypto/sha/sha_dgst.c
new file mode 100644
index 0000000000..c946ad827d
--- /dev/null
+++ b/src/lib/libcrypto/sha/sha_dgst.c
@@ -0,0 +1,75 @@
1/* crypto/sha/sha1dgst.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
59#include <openssl/opensslconf.h>
60#include <openssl/crypto.h>
61#if !defined(OPENSSL_NO_SHA0) && !defined(OPENSSL_NO_SHA)
62
63#undef SHA_1
64#define SHA_0
65
66#include <openssl/opensslv.h>
67
68const char SHA_version[]="SHA" OPENSSL_VERSION_PTEXT;
69
70/* The implementation is in ../md32_common.h */
71
72#include "sha_locl.h"
73
74#endif
75
diff --git a/src/lib/libcrypto/sha/sha_locl.h b/src/lib/libcrypto/sha/sha_locl.h
index d673255f78..7a0c3ca8d8 100644
--- a/src/lib/libcrypto/sha/sha_locl.h
+++ b/src/lib/libcrypto/sha/sha_locl.h
@@ -69,11 +69,11 @@
69#define HASH_CBLOCK SHA_CBLOCK 69#define HASH_CBLOCK SHA_CBLOCK
70#define HASH_MAKE_STRING(c,s) do { \ 70#define HASH_MAKE_STRING(c,s) do { \
71 unsigned long ll; \ 71 unsigned long ll; \
72 ll=(c)->h0; (void)HOST_l2c(ll,(s)); \ 72 ll=(c)->h0; HOST_l2c(ll,(s)); \
73 ll=(c)->h1; (void)HOST_l2c(ll,(s)); \ 73 ll=(c)->h1; HOST_l2c(ll,(s)); \
74 ll=(c)->h2; (void)HOST_l2c(ll,(s)); \ 74 ll=(c)->h2; HOST_l2c(ll,(s)); \
75 ll=(c)->h3; (void)HOST_l2c(ll,(s)); \ 75 ll=(c)->h3; HOST_l2c(ll,(s)); \
76 ll=(c)->h4; (void)HOST_l2c(ll,(s)); \ 76 ll=(c)->h4; HOST_l2c(ll,(s)); \
77 } while (0) 77 } while (0)
78 78
79#if defined(SHA_0) 79#if defined(SHA_0)
@@ -256,21 +256,21 @@ static void HASH_BLOCK_DATA_ORDER (SHA_CTX *c, const void *p, size_t num)
256 } 256 }
257 else 257 else
258 { 258 {
259 (void)HOST_c2l(data,l); X( 0)=l; (void)HOST_c2l(data,l); X( 1)=l; 259 HOST_c2l(data,l); X( 0)=l; HOST_c2l(data,l); X( 1)=l;
260 BODY_00_15( 0,A,B,C,D,E,T,X( 0)); (void)HOST_c2l(data,l); X( 2)=l; 260 BODY_00_15( 0,A,B,C,D,E,T,X( 0)); HOST_c2l(data,l); X( 2)=l;
261 BODY_00_15( 1,T,A,B,C,D,E,X( 1)); (void)HOST_c2l(data,l); X( 3)=l; 261 BODY_00_15( 1,T,A,B,C,D,E,X( 1)); HOST_c2l(data,l); X( 3)=l;
262 BODY_00_15( 2,E,T,A,B,C,D,X( 2)); (void)HOST_c2l(data,l); X( 4)=l; 262 BODY_00_15( 2,E,T,A,B,C,D,X( 2)); HOST_c2l(data,l); X( 4)=l;
263 BODY_00_15( 3,D,E,T,A,B,C,X( 3)); (void)HOST_c2l(data,l); X( 5)=l; 263 BODY_00_15( 3,D,E,T,A,B,C,X( 3)); HOST_c2l(data,l); X( 5)=l;
264 BODY_00_15( 4,C,D,E,T,A,B,X( 4)); (void)HOST_c2l(data,l); X( 6)=l; 264 BODY_00_15( 4,C,D,E,T,A,B,X( 4)); HOST_c2l(data,l); X( 6)=l;
265 BODY_00_15( 5,B,C,D,E,T,A,X( 5)); (void)HOST_c2l(data,l); X( 7)=l; 265 BODY_00_15( 5,B,C,D,E,T,A,X( 5)); HOST_c2l(data,l); X( 7)=l;
266 BODY_00_15( 6,A,B,C,D,E,T,X( 6)); (void)HOST_c2l(data,l); X( 8)=l; 266 BODY_00_15( 6,A,B,C,D,E,T,X( 6)); HOST_c2l(data,l); X( 8)=l;
267 BODY_00_15( 7,T,A,B,C,D,E,X( 7)); (void)HOST_c2l(data,l); X( 9)=l; 267 BODY_00_15( 7,T,A,B,C,D,E,X( 7)); HOST_c2l(data,l); X( 9)=l;
268 BODY_00_15( 8,E,T,A,B,C,D,X( 8)); (void)HOST_c2l(data,l); X(10)=l; 268 BODY_00_15( 8,E,T,A,B,C,D,X( 8)); HOST_c2l(data,l); X(10)=l;
269 BODY_00_15( 9,D,E,T,A,B,C,X( 9)); (void)HOST_c2l(data,l); X(11)=l; 269 BODY_00_15( 9,D,E,T,A,B,C,X( 9)); HOST_c2l(data,l); X(11)=l;
270 BODY_00_15(10,C,D,E,T,A,B,X(10)); (void)HOST_c2l(data,l); X(12)=l; 270 BODY_00_15(10,C,D,E,T,A,B,X(10)); HOST_c2l(data,l); X(12)=l;
271 BODY_00_15(11,B,C,D,E,T,A,X(11)); (void)HOST_c2l(data,l); X(13)=l; 271 BODY_00_15(11,B,C,D,E,T,A,X(11)); HOST_c2l(data,l); X(13)=l;
272 BODY_00_15(12,A,B,C,D,E,T,X(12)); (void)HOST_c2l(data,l); X(14)=l; 272 BODY_00_15(12,A,B,C,D,E,T,X(12)); HOST_c2l(data,l); X(14)=l;
273 BODY_00_15(13,T,A,B,C,D,E,X(13)); (void)HOST_c2l(data,l); X(15)=l; 273 BODY_00_15(13,T,A,B,C,D,E,X(13)); HOST_c2l(data,l); X(15)=l;
274 BODY_00_15(14,E,T,A,B,C,D,X(14)); 274 BODY_00_15(14,E,T,A,B,C,D,X(14));
275 BODY_00_15(15,D,E,T,A,B,C,X(15)); 275 BODY_00_15(15,D,E,T,A,B,C,X(15));
276 } 276 }
diff --git a/src/lib/libcrypto/sha/sha_one.c b/src/lib/libcrypto/sha/sha_one.c
new file mode 100644
index 0000000000..3bae623ce8
--- /dev/null
+++ b/src/lib/libcrypto/sha/sha_one.c
@@ -0,0 +1,78 @@
1/* crypto/sha/sha_one.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
59#include <stdio.h>
60#include <string.h>
61#include <openssl/sha.h>
62#include <openssl/crypto.h>
63
64#ifndef OPENSSL_NO_SHA0
65unsigned char *SHA(const unsigned char *d, size_t n, unsigned char *md)
66 {
67 SHA_CTX c;
68 static unsigned char m[SHA_DIGEST_LENGTH];
69
70 if (md == NULL) md=m;
71 if (!SHA_Init(&c))
72 return NULL;
73 SHA_Update(&c,d,n);
74 SHA_Final(md,&c);
75 OPENSSL_cleanse(&c,sizeof(c));
76 return(md);
77 }
78#endif
diff --git a/src/lib/libcrypto/sha/shatest.c b/src/lib/libcrypto/sha/shatest.c
new file mode 100644
index 0000000000..27614646d1
--- /dev/null
+++ b/src/lib/libcrypto/sha/shatest.c
@@ -0,0 +1,178 @@
1/* crypto/sha/shatest.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
59#include <stdio.h>
60#include <string.h>
61#include <stdlib.h>
62
63#include "../e_os.h"
64
65#if defined(OPENSSL_NO_SHA) || defined(OPENSSL_NO_SHA0)
66int main(int argc, char *argv[])
67{
68 printf("No SHA0 support\n");
69 return(0);
70}
71#else
72#include <openssl/evp.h>
73#include <openssl/sha.h>
74
75#ifdef CHARSET_EBCDIC
76#include <openssl/ebcdic.h>
77#endif
78
79#define SHA_0 /* FIPS 180 */
80#undef SHA_1 /* FIPS 180-1 */
81
82static char *test[]={
83 "abc",
84 "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq",
85 NULL,
86 };
87
88#ifdef SHA_0
89static char *ret[]={
90 "0164b8a914cd2a5e74c4f7ff082c4d97f1edf880",
91 "d2516ee1acfa5baf33dfc1c471e438449ef134c8",
92 };
93static char *bigret=
94 "3232affa48628a26653b5aaa44541fd90d690603";
95#endif
96#ifdef SHA_1
97static char *ret[]={
98 "a9993e364706816aba3e25717850c26c9cd0d89d",
99 "84983e441c3bd26ebaae4aa1f95129e5e54670f1",
100 };
101static char *bigret=
102 "34aa973cd4c4daa4f61eeb2bdbad27316534016f";
103#endif
104
105static char *pt(unsigned char *md);
106int main(int argc, char *argv[])
107 {
108 int i,err=0;
109 char **P,**R;
110 static unsigned char buf[1000];
111 char *p,*r;
112 EVP_MD_CTX c;
113 unsigned char md[SHA_DIGEST_LENGTH];
114
115#ifdef CHARSET_EBCDIC
116 ebcdic2ascii(test[0], test[0], strlen(test[0]));
117 ebcdic2ascii(test[1], test[1], strlen(test[1]));
118#endif
119
120 EVP_MD_CTX_init(&c);
121 P=test;
122 R=ret;
123 i=1;
124 while (*P != NULL)
125 {
126 EVP_Digest(*P,strlen(*P),md,NULL,EVP_sha(), NULL);
127 p=pt(md);
128 if (strcmp(p,*R) != 0)
129 {
130 printf("error calculating SHA on '%s'\n",*P);
131 printf("got %s instead of %s\n",p,*R);
132 err++;
133 }
134 else
135 printf("test %d ok\n",i);
136 i++;
137 R++;
138 P++;
139 }
140
141 memset(buf,'a',1000);
142#ifdef CHARSET_EBCDIC
143 ebcdic2ascii(buf, buf, 1000);
144#endif /*CHARSET_EBCDIC*/
145 EVP_DigestInit_ex(&c,EVP_sha(), NULL);
146 for (i=0; i<1000; i++)
147 EVP_DigestUpdate(&c,buf,1000);
148 EVP_DigestFinal_ex(&c,md,NULL);
149 p=pt(md);
150
151 r=bigret;
152 if (strcmp(p,r) != 0)
153 {
154 printf("error calculating SHA on '%s'\n",p);
155 printf("got %s instead of %s\n",p,r);
156 err++;
157 }
158 else
159 printf("test 3 ok\n");
160
161#ifdef OPENSSL_SYS_NETWARE
162 if (err) printf("ERROR: %d\n", err);
163#endif
164 EVP_MD_CTX_cleanup(&c);
165 EXIT(err);
166 return(0);
167 }
168
169static char *pt(unsigned char *md)
170 {
171 int i;
172 static char buf[80];
173
174 for (i=0; i<SHA_DIGEST_LENGTH; i++)
175 sprintf(&(buf[i*2]),"%02x",md[i]);
176 return(buf);
177 }
178#endif
diff --git a/src/lib/libcrypto/shlib_version b/src/lib/libcrypto/shlib_version
new file mode 100644
index 0000000000..df4de0fc4d
--- /dev/null
+++ b/src/lib/libcrypto/shlib_version
@@ -0,0 +1,2 @@
1major=23
2minor=0
diff --git a/src/lib/libcrypto/srp/Makefile b/src/lib/libcrypto/srp/Makefile
new file mode 100644
index 0000000000..41859d46fa
--- /dev/null
+++ b/src/lib/libcrypto/srp/Makefile
@@ -0,0 +1,98 @@
1DIR= srp
2TOP= ../..
3CC= cc
4INCLUDES= -I.. -I$(TOP) -I../../include
5CFLAG=-g
6INSTALL_PREFIX=
7OPENSSLDIR= /usr/local/ssl
8INSTALLTOP=/usr/local/ssl
9MAKE= make -f Makefile.ssl
10MAKEDEPPROG= makedepend
11MAKEDEPEND= $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG)
12MAKEFILE= Makefile.ssl
13AR= ar r
14
15CFLAGS= $(INCLUDES) $(CFLAG)
16
17GENERAL=Makefile
18TEST=srptest.c
19APPS=
20
21LIB=$(TOP)/libcrypto.a
22LIBSRC=srp_lib.c srp_vfy.c
23LIBOBJ=srp_lib.o srp_vfy.o
24
25SRC= $(LIBSRC)
26
27EXHEADER= srp.h
28HEADER= $(EXHEADER)
29
30top:
31 (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all)
32
33all: lib
34
35lib: $(LIBOBJ)
36 $(AR) $(LIB) $(LIBOBJ)
37 $(RANLIB) $(LIB) || echo Never mind.
38 @touch lib
39
40links:
41 @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
42 @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
43 @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
44
45install:
46 @[ -n "$(INSTALLTOP)" ] # should be set by top Makefile...
47 @headerlist="$(EXHEADER)"; for i in $$headerlist ; \
48 do \
49 (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
50 chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
51 done;
52
53tags:
54 ctags $(SRC)
55
56tests:
57
58srptest: top srptest.c $(LIB)
59 $(CC) $(CFLAGS) -Wall -Werror -g -o srptest srptest.c $(LIB)
60
61lint:
62 lint -DLINT $(INCLUDES) $(SRC)>fluff
63
64depend:
65 $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
66
67dclean:
68 $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
69 mv -f Makefile.new $(MAKEFILE)
70
71clean:
72 rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
73
74# DO NOT DELETE THIS LINE -- make depend depends on it.
75
76srp_lib.o: ../../e_os.h ../../include/openssl/asn1.h
77srp_lib.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
78srp_lib.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
79srp_lib.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
80srp_lib.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
81srp_lib.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
82srp_lib.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
83srp_lib.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
84srp_lib.o: ../../include/openssl/sha.h ../../include/openssl/srp.h
85srp_lib.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
86srp_lib.o: ../cryptlib.h srp_grps.h srp_lcl.h srp_lib.c
87srp_vfy.o: ../../e_os.h ../../include/openssl/asn1.h
88srp_vfy.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
89srp_vfy.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
90srp_vfy.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
91srp_vfy.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
92srp_vfy.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
93srp_vfy.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
94srp_vfy.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rand.h
95srp_vfy.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
96srp_vfy.o: ../../include/openssl/srp.h ../../include/openssl/stack.h
97srp_vfy.o: ../../include/openssl/symhacks.h ../../include/openssl/txt_db.h
98srp_vfy.o: ../cryptlib.h srp_lcl.h srp_vfy.c
diff --git a/src/lib/libcrypto/srp/srp.h b/src/lib/libcrypto/srp/srp.h
new file mode 100644
index 0000000000..7ec7825cad
--- /dev/null
+++ b/src/lib/libcrypto/srp/srp.h
@@ -0,0 +1,172 @@
1/* crypto/srp/srp.h */
2/* Written by Christophe Renou (christophe.renou@edelweb.fr) with
3 * the precious help of Peter Sylvester (peter.sylvester@edelweb.fr)
4 * for the EdelKey project and contributed to the OpenSSL project 2004.
5 */
6/* ====================================================================
7 * Copyright (c) 2004 The OpenSSL Project. All rights reserved.
8 *
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
11 * are met:
12 *
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 *
16 * 2. Redistributions in binary form must reproduce the above copyright
17 * notice, this list of conditions and the following disclaimer in
18 * the documentation and/or other materials provided with the
19 * distribution.
20 *
21 * 3. All advertising materials mentioning features or use of this
22 * software must display the following acknowledgment:
23 * "This product includes software developed by the OpenSSL Project
24 * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
25 *
26 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
27 * endorse or promote products derived from this software without
28 * prior written permission. For written permission, please contact
29 * licensing@OpenSSL.org.
30 *
31 * 5. Products derived from this software may not be called "OpenSSL"
32 * nor may "OpenSSL" appear in their names without prior written
33 * permission of the OpenSSL Project.
34 *
35 * 6. Redistributions of any form whatsoever must retain the following
36 * acknowledgment:
37 * "This product includes software developed by the OpenSSL Project
38 * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
39 *
40 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
41 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
42 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
43 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
44 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
45 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
46 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
47 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
49 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
50 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
51 * OF THE POSSIBILITY OF SUCH DAMAGE.
52 * ====================================================================
53 *
54 * This product includes cryptographic software written by Eric Young
55 * (eay@cryptsoft.com). This product includes software written by Tim
56 * Hudson (tjh@cryptsoft.com).
57 *
58 */
59#ifndef __SRP_H__
60#define __SRP_H__
61
62#ifndef OPENSSL_NO_SRP
63
64#include <stdio.h>
65#include <string.h>
66
67#ifdef __cplusplus
68extern "C" {
69#endif
70
71#include <openssl/safestack.h>
72#include <openssl/bn.h>
73#include <openssl/crypto.h>
74
75typedef struct SRP_gN_cache_st
76 {
77 char *b64_bn;
78 BIGNUM *bn;
79 } SRP_gN_cache;
80
81
82DECLARE_STACK_OF(SRP_gN_cache)
83
84typedef struct SRP_user_pwd_st
85 {
86 char *id;
87 BIGNUM *s;
88 BIGNUM *v;
89 const BIGNUM *g;
90 const BIGNUM *N;
91 char *info;
92 } SRP_user_pwd;
93
94DECLARE_STACK_OF(SRP_user_pwd)
95
96typedef struct SRP_VBASE_st
97 {
98 STACK_OF(SRP_user_pwd) *users_pwd;
99 STACK_OF(SRP_gN_cache) *gN_cache;
100/* to simulate a user */
101 char *seed_key;
102 BIGNUM *default_g;
103 BIGNUM *default_N;
104 } SRP_VBASE;
105
106
107/*Structure interne pour retenir les couples N et g*/
108typedef struct SRP_gN_st
109 {
110 char *id;
111 BIGNUM *g;
112 BIGNUM *N;
113 } SRP_gN;
114
115DECLARE_STACK_OF(SRP_gN)
116
117SRP_VBASE *SRP_VBASE_new(char *seed_key);
118int SRP_VBASE_free(SRP_VBASE *vb);
119int SRP_VBASE_init(SRP_VBASE *vb, char * verifier_file);
120SRP_user_pwd *SRP_VBASE_get_by_user(SRP_VBASE *vb, char *username);
121char *SRP_create_verifier(const char *user, const char *pass, char **salt,
122 char **verifier, const char *N, const char *g);
123int SRP_create_verifier_BN(const char *user, const char *pass, BIGNUM **salt, BIGNUM **verifier, BIGNUM *N, BIGNUM *g);
124
125
126#define SRP_NO_ERROR 0
127#define SRP_ERR_VBASE_INCOMPLETE_FILE 1
128#define SRP_ERR_VBASE_BN_LIB 2
129#define SRP_ERR_OPEN_FILE 3
130#define SRP_ERR_MEMORY 4
131
132#define DB_srptype 0
133#define DB_srpverifier 1
134#define DB_srpsalt 2
135#define DB_srpid 3
136#define DB_srpgN 4
137#define DB_srpinfo 5
138#undef DB_NUMBER
139#define DB_NUMBER 6
140
141#define DB_SRP_INDEX 'I'
142#define DB_SRP_VALID 'V'
143#define DB_SRP_REVOKED 'R'
144#define DB_SRP_MODIF 'v'
145
146
147/* see srp.c */
148char * SRP_check_known_gN_param(BIGNUM* g, BIGNUM* N);
149SRP_gN *SRP_get_default_gN(const char * id) ;
150
151/* server side .... */
152BIGNUM *SRP_Calc_server_key(BIGNUM *A, BIGNUM *v, BIGNUM *u, BIGNUM *b, BIGNUM *N);
153BIGNUM *SRP_Calc_B(BIGNUM *b, BIGNUM *N, BIGNUM *g, BIGNUM *v);
154int SRP_Verify_A_mod_N(BIGNUM *A, BIGNUM *N);
155BIGNUM *SRP_Calc_u(BIGNUM *A, BIGNUM *B, BIGNUM *N) ;
156
157
158
159/* client side .... */
160BIGNUM *SRP_Calc_x(BIGNUM *s, const char *user, const char *pass);
161BIGNUM *SRP_Calc_A(BIGNUM *a, BIGNUM *N, BIGNUM *g);
162BIGNUM *SRP_Calc_client_key(BIGNUM *N, BIGNUM *B, BIGNUM *g, BIGNUM *x, BIGNUM *a, BIGNUM *u);
163int SRP_Verify_B_mod_N(BIGNUM *B, BIGNUM *N);
164
165#define SRP_MINIMAL_N 1024
166
167#ifdef __cplusplus
168}
169#endif
170
171#endif
172#endif
diff --git a/src/lib/libcrypto/srp/srp_grps.h b/src/lib/libcrypto/srp/srp_grps.h
new file mode 100644
index 0000000000..8e3c35e3f5
--- /dev/null
+++ b/src/lib/libcrypto/srp/srp_grps.h
@@ -0,0 +1,517 @@
1/* start of generated data */
2
3static BN_ULONG bn_group_1024_value[] = {
4 bn_pack4(0x9FC6,0x1D2F,0xC0EB,0x06E3),
5 bn_pack4(0xFD51,0x38FE,0x8376,0x435B),
6 bn_pack4(0x2FD4,0xCBF4,0x976E,0xAA9A),
7 bn_pack4(0x68ED,0xBC3C,0x0572,0x6CC0),
8 bn_pack4(0xC529,0xF566,0x660E,0x57EC),
9 bn_pack4(0x8255,0x9B29,0x7BCF,0x1885),
10 bn_pack4(0xCE8E,0xF4AD,0x69B1,0x5D49),
11 bn_pack4(0x5DC7,0xD7B4,0x6154,0xD6B6),
12 bn_pack4(0x8E49,0x5C1D,0x6089,0xDAD1),
13 bn_pack4(0xE0D5,0xD8E2,0x50B9,0x8BE4),
14 bn_pack4(0x383B,0x4813,0xD692,0xC6E0),
15 bn_pack4(0xD674,0xDF74,0x96EA,0x81D3),
16 bn_pack4(0x9EA2,0x314C,0x9C25,0x6576),
17 bn_pack4(0x6072,0x6187,0x75FF,0x3C0B),
18 bn_pack4(0x9C33,0xF80A,0xFA8F,0xC5E8),
19 bn_pack4(0xEEAF,0x0AB9,0xADB3,0x8DD6)
20};
21static BIGNUM bn_group_1024 = {
22 bn_group_1024_value,
23 (sizeof bn_group_1024_value)/sizeof(BN_ULONG),
24 (sizeof bn_group_1024_value)/sizeof(BN_ULONG),
25 0,
26 BN_FLG_STATIC_DATA
27};
28
29static BN_ULONG bn_group_1536_value[] = {
30 bn_pack4(0xCF76,0xE3FE,0xD135,0xF9BB),
31 bn_pack4(0x1518,0x0F93,0x499A,0x234D),
32 bn_pack4(0x8CE7,0xA28C,0x2442,0xC6F3),
33 bn_pack4(0x5A02,0x1FFF,0x5E91,0x479E),
34 bn_pack4(0x7F8A,0x2FE9,0xB8B5,0x292E),
35 bn_pack4(0x837C,0x264A,0xE3A9,0xBEB8),
36 bn_pack4(0xE442,0x734A,0xF7CC,0xB7AE),
37 bn_pack4(0x6577,0x2E43,0x7D6C,0x7F8C),
38 bn_pack4(0xDB2F,0xD53D,0x24B7,0xC486),
39 bn_pack4(0x6EDF,0x0195,0x3934,0x9627),
40 bn_pack4(0x158B,0xFD3E,0x2B9C,0x8CF5),
41 bn_pack4(0x764E,0x3F4B,0x53DD,0x9DA1),
42 bn_pack4(0x4754,0x8381,0xDBC5,0xB1FC),
43 bn_pack4(0x9B60,0x9E0B,0xE3BA,0xB63D),
44 bn_pack4(0x8134,0xB1C8,0xB979,0x8914),
45 bn_pack4(0xDF02,0x8A7C,0xEC67,0xF0D0),
46 bn_pack4(0x80B6,0x55BB,0x9A22,0xE8DC),
47 bn_pack4(0x1558,0x903B,0xA0D0,0xF843),
48 bn_pack4(0x51C6,0xA94B,0xE460,0x7A29),
49 bn_pack4(0x5F4F,0x5F55,0x6E27,0xCBDE),
50 bn_pack4(0xBEEE,0xA961,0x4B19,0xCC4D),
51 bn_pack4(0xDBA5,0x1DF4,0x99AC,0x4C80),
52 bn_pack4(0xB1F1,0x2A86,0x17A4,0x7BBB),
53 bn_pack4(0x9DEF,0x3CAF,0xB939,0x277A)
54};
55static BIGNUM bn_group_1536 = {
56 bn_group_1536_value,
57 (sizeof bn_group_1536_value)/sizeof(BN_ULONG),
58 (sizeof bn_group_1536_value)/sizeof(BN_ULONG),
59 0,
60 BN_FLG_STATIC_DATA
61};
62
63static BN_ULONG bn_group_2048_value[] = {
64 bn_pack4(0x0FA7,0x111F,0x9E4A,0xFF73),
65 bn_pack4(0x9B65,0xE372,0xFCD6,0x8EF2),
66 bn_pack4(0x35DE,0x236D,0x525F,0x5475),
67 bn_pack4(0x94B5,0xC803,0xD89F,0x7AE4),
68 bn_pack4(0x71AE,0x35F8,0xE9DB,0xFBB6),
69 bn_pack4(0x2A56,0x98F3,0xA8D0,0xC382),
70 bn_pack4(0x9CCC,0x041C,0x7BC3,0x08D8),
71 bn_pack4(0xAF87,0x4E73,0x03CE,0x5329),
72 bn_pack4(0x6160,0x2790,0x04E5,0x7AE6),
73 bn_pack4(0x032C,0xFBDB,0xF52F,0xB378),
74 bn_pack4(0x5EA7,0x7A27,0x75D2,0xECFA),
75 bn_pack4(0x5445,0x23B5,0x24B0,0xD57D),
76 bn_pack4(0x5B9D,0x32E6,0x88F8,0x7748),
77 bn_pack4(0xF1D2,0xB907,0x8717,0x461A),
78 bn_pack4(0x76BD,0x207A,0x436C,0x6481),
79 bn_pack4(0xCA97,0xB43A,0x23FB,0x8016),
80 bn_pack4(0x1D28,0x1E44,0x6B14,0x773B),
81 bn_pack4(0x7359,0xD041,0xD5C3,0x3EA7),
82 bn_pack4(0xA80D,0x740A,0xDBF4,0xFF74),
83 bn_pack4(0x55F9,0x7993,0xEC97,0x5EEA),
84 bn_pack4(0x2918,0xA996,0x2F0B,0x93B8),
85 bn_pack4(0x661A,0x05FB,0xD5FA,0xAAE8),
86 bn_pack4(0xCF60,0x9517,0x9A16,0x3AB3),
87 bn_pack4(0xE808,0x3969,0xEDB7,0x67B0),
88 bn_pack4(0xCD7F,0x48A9,0xDA04,0xFD50),
89 bn_pack4(0xD523,0x12AB,0x4B03,0x310D),
90 bn_pack4(0x8193,0xE075,0x7767,0xA13D),
91 bn_pack4(0xA373,0x29CB,0xB4A0,0x99ED),
92 bn_pack4(0xFC31,0x9294,0x3DB5,0x6050),
93 bn_pack4(0xAF72,0xB665,0x1987,0xEE07),
94 bn_pack4(0xF166,0xDE5E,0x1389,0x582F),
95 bn_pack4(0xAC6B,0xDB41,0x324A,0x9A9B)
96};
97static BIGNUM bn_group_2048 = {
98 bn_group_2048_value,
99 (sizeof bn_group_2048_value)/sizeof(BN_ULONG),
100 (sizeof bn_group_2048_value)/sizeof(BN_ULONG),
101 0,
102 BN_FLG_STATIC_DATA
103};
104
105static BN_ULONG bn_group_3072_value[] = {
106 bn_pack4(0xFFFF,0xFFFF,0xFFFF,0xFFFF),
107 bn_pack4(0x4B82,0xD120,0xA93A,0xD2CA),
108 bn_pack4(0x43DB,0x5BFC,0xE0FD,0x108E),
109 bn_pack4(0x08E2,0x4FA0,0x74E5,0xAB31),
110 bn_pack4(0x7709,0x88C0,0xBAD9,0x46E2),
111 bn_pack4(0xBBE1,0x1757,0x7A61,0x5D6C),
112 bn_pack4(0x521F,0x2B18,0x177B,0x200C),
113 bn_pack4(0xD876,0x0273,0x3EC8,0x6A64),
114 bn_pack4(0xF12F,0xFA06,0xD98A,0x0864),
115 bn_pack4(0xCEE3,0xD226,0x1AD2,0xEE6B),
116 bn_pack4(0x1E8C,0x94E0,0x4A25,0x619D),
117 bn_pack4(0xABF5,0xAE8C,0xDB09,0x33D7),
118 bn_pack4(0xB397,0x0F85,0xA6E1,0xE4C7),
119 bn_pack4(0x8AEA,0x7157,0x5D06,0x0C7D),
120 bn_pack4(0xECFB,0x8504,0x58DB,0xEF0A),
121 bn_pack4(0xA855,0x21AB,0xDF1C,0xBA64),
122 bn_pack4(0xAD33,0x170D,0x0450,0x7A33),
123 bn_pack4(0x1572,0x8E5A,0x8AAA,0xC42D),
124 bn_pack4(0x15D2,0x2618,0x98FA,0x0510),
125 bn_pack4(0x3995,0x497C,0xEA95,0x6AE5),
126 bn_pack4(0xDE2B,0xCBF6,0x9558,0x1718),
127 bn_pack4(0xB5C5,0x5DF0,0x6F4C,0x52C9),
128 bn_pack4(0x9B27,0x83A2,0xEC07,0xA28F),
129 bn_pack4(0xE39E,0x772C,0x180E,0x8603),
130 bn_pack4(0x3290,0x5E46,0x2E36,0xCE3B),
131 bn_pack4(0xF174,0x6C08,0xCA18,0x217C),
132 bn_pack4(0x670C,0x354E,0x4ABC,0x9804),
133 bn_pack4(0x9ED5,0x2907,0x7096,0x966D),
134 bn_pack4(0x1C62,0xF356,0x2085,0x52BB),
135 bn_pack4(0x8365,0x5D23,0xDCA3,0xAD96),
136 bn_pack4(0x6916,0x3FA8,0xFD24,0xCF5F),
137 bn_pack4(0x98DA,0x4836,0x1C55,0xD39A),
138 bn_pack4(0xC200,0x7CB8,0xA163,0xBF05),
139 bn_pack4(0x4928,0x6651,0xECE4,0x5B3D),
140 bn_pack4(0xAE9F,0x2411,0x7C4B,0x1FE6),
141 bn_pack4(0xEE38,0x6BFB,0x5A89,0x9FA5),
142 bn_pack4(0x0BFF,0x5CB6,0xF406,0xB7ED),
143 bn_pack4(0xF44C,0x42E9,0xA637,0xED6B),
144 bn_pack4(0xE485,0xB576,0x625E,0x7EC6),
145 bn_pack4(0x4FE1,0x356D,0x6D51,0xC245),
146 bn_pack4(0x302B,0x0A6D,0xF25F,0x1437),
147 bn_pack4(0xEF95,0x19B3,0xCD3A,0x431B),
148 bn_pack4(0x514A,0x0879,0x8E34,0x04DD),
149 bn_pack4(0x020B,0xBEA6,0x3B13,0x9B22),
150 bn_pack4(0x2902,0x4E08,0x8A67,0xCC74),
151 bn_pack4(0xC4C6,0x628B,0x80DC,0x1CD1),
152 bn_pack4(0xC90F,0xDAA2,0x2168,0xC234),
153 bn_pack4(0xFFFF,0xFFFF,0xFFFF,0xFFFF)
154};
155static BIGNUM bn_group_3072 = {
156 bn_group_3072_value,
157 (sizeof bn_group_3072_value)/sizeof(BN_ULONG),
158 (sizeof bn_group_3072_value)/sizeof(BN_ULONG),
159 0,
160 BN_FLG_STATIC_DATA
161};
162
163static BN_ULONG bn_group_4096_value[] = {
164 bn_pack4(0xFFFF,0xFFFF,0xFFFF,0xFFFF),
165 bn_pack4(0x4DF4,0x35C9,0x3406,0x3199),
166 bn_pack4(0x86FF,0xB7DC,0x90A6,0xC08F),
167 bn_pack4(0x93B4,0xEA98,0x8D8F,0xDDC1),
168 bn_pack4(0xD006,0x9127,0xD5B0,0x5AA9),
169 bn_pack4(0xB81B,0xDD76,0x2170,0x481C),
170 bn_pack4(0x1F61,0x2970,0xCEE2,0xD7AF),
171 bn_pack4(0x233B,0xA186,0x515B,0xE7ED),
172 bn_pack4(0x99B2,0x964F,0xA090,0xC3A2),
173 bn_pack4(0x287C,0x5947,0x4E6B,0xC05D),
174 bn_pack4(0x2E8E,0xFC14,0x1FBE,0xCAA6),
175 bn_pack4(0xDBBB,0xC2DB,0x04DE,0x8EF9),
176 bn_pack4(0x2583,0xE9CA,0x2AD4,0x4CE8),
177 bn_pack4(0x1A94,0x6834,0xB615,0x0BDA),
178 bn_pack4(0x99C3,0x2718,0x6AF4,0xE23C),
179 bn_pack4(0x8871,0x9A10,0xBDBA,0x5B26),
180 bn_pack4(0x1A72,0x3C12,0xA787,0xE6D7),
181 bn_pack4(0x4B82,0xD120,0xA921,0x0801),
182 bn_pack4(0x43DB,0x5BFC,0xE0FD,0x108E),
183 bn_pack4(0x08E2,0x4FA0,0x74E5,0xAB31),
184 bn_pack4(0x7709,0x88C0,0xBAD9,0x46E2),
185 bn_pack4(0xBBE1,0x1757,0x7A61,0x5D6C),
186 bn_pack4(0x521F,0x2B18,0x177B,0x200C),
187 bn_pack4(0xD876,0x0273,0x3EC8,0x6A64),
188 bn_pack4(0xF12F,0xFA06,0xD98A,0x0864),
189 bn_pack4(0xCEE3,0xD226,0x1AD2,0xEE6B),
190 bn_pack4(0x1E8C,0x94E0,0x4A25,0x619D),
191 bn_pack4(0xABF5,0xAE8C,0xDB09,0x33D7),
192 bn_pack4(0xB397,0x0F85,0xA6E1,0xE4C7),
193 bn_pack4(0x8AEA,0x7157,0x5D06,0x0C7D),
194 bn_pack4(0xECFB,0x8504,0x58DB,0xEF0A),
195 bn_pack4(0xA855,0x21AB,0xDF1C,0xBA64),
196 bn_pack4(0xAD33,0x170D,0x0450,0x7A33),
197 bn_pack4(0x1572,0x8E5A,0x8AAA,0xC42D),
198 bn_pack4(0x15D2,0x2618,0x98FA,0x0510),
199 bn_pack4(0x3995,0x497C,0xEA95,0x6AE5),
200 bn_pack4(0xDE2B,0xCBF6,0x9558,0x1718),
201 bn_pack4(0xB5C5,0x5DF0,0x6F4C,0x52C9),
202 bn_pack4(0x9B27,0x83A2,0xEC07,0xA28F),
203 bn_pack4(0xE39E,0x772C,0x180E,0x8603),
204 bn_pack4(0x3290,0x5E46,0x2E36,0xCE3B),
205 bn_pack4(0xF174,0x6C08,0xCA18,0x217C),
206 bn_pack4(0x670C,0x354E,0x4ABC,0x9804),
207 bn_pack4(0x9ED5,0x2907,0x7096,0x966D),
208 bn_pack4(0x1C62,0xF356,0x2085,0x52BB),
209 bn_pack4(0x8365,0x5D23,0xDCA3,0xAD96),
210 bn_pack4(0x6916,0x3FA8,0xFD24,0xCF5F),
211 bn_pack4(0x98DA,0x4836,0x1C55,0xD39A),
212 bn_pack4(0xC200,0x7CB8,0xA163,0xBF05),
213 bn_pack4(0x4928,0x6651,0xECE4,0x5B3D),
214 bn_pack4(0xAE9F,0x2411,0x7C4B,0x1FE6),
215 bn_pack4(0xEE38,0x6BFB,0x5A89,0x9FA5),
216 bn_pack4(0x0BFF,0x5CB6,0xF406,0xB7ED),
217 bn_pack4(0xF44C,0x42E9,0xA637,0xED6B),
218 bn_pack4(0xE485,0xB576,0x625E,0x7EC6),
219 bn_pack4(0x4FE1,0x356D,0x6D51,0xC245),
220 bn_pack4(0x302B,0x0A6D,0xF25F,0x1437),
221 bn_pack4(0xEF95,0x19B3,0xCD3A,0x431B),
222 bn_pack4(0x514A,0x0879,0x8E34,0x04DD),
223 bn_pack4(0x020B,0xBEA6,0x3B13,0x9B22),
224 bn_pack4(0x2902,0x4E08,0x8A67,0xCC74),
225 bn_pack4(0xC4C6,0x628B,0x80DC,0x1CD1),
226 bn_pack4(0xC90F,0xDAA2,0x2168,0xC234),
227 bn_pack4(0xFFFF,0xFFFF,0xFFFF,0xFFFF)
228};
229static BIGNUM bn_group_4096 = {
230 bn_group_4096_value,
231 (sizeof bn_group_4096_value)/sizeof(BN_ULONG),
232 (sizeof bn_group_4096_value)/sizeof(BN_ULONG),
233 0,
234 BN_FLG_STATIC_DATA
235};
236
237static BN_ULONG bn_group_6144_value[] = {
238 bn_pack4(0xFFFF,0xFFFF,0xFFFF,0xFFFF),
239 bn_pack4(0xE694,0xF91E,0x6DCC,0x4024),
240 bn_pack4(0x12BF,0x2D5B,0x0B74,0x74D6),
241 bn_pack4(0x043E,0x8F66,0x3F48,0x60EE),
242 bn_pack4(0x387F,0xE8D7,0x6E3C,0x0468),
243 bn_pack4(0xDA56,0xC9EC,0x2EF2,0x9632),
244 bn_pack4(0xEB19,0xCCB1,0xA313,0xD55C),
245 bn_pack4(0xF550,0xAA3D,0x8A1F,0xBFF0),
246 bn_pack4(0x06A1,0xD58B,0xB7C5,0xDA76),
247 bn_pack4(0xA797,0x15EE,0xF29B,0xE328),
248 bn_pack4(0x14CC,0x5ED2,0x0F80,0x37E0),
249 bn_pack4(0xCC8F,0x6D7E,0xBF48,0xE1D8),
250 bn_pack4(0x4BD4,0x07B2,0x2B41,0x54AA),
251 bn_pack4(0x0F1D,0x45B7,0xFF58,0x5AC5),
252 bn_pack4(0x23A9,0x7A7E,0x36CC,0x88BE),
253 bn_pack4(0x59E7,0xC97F,0xBEC7,0xE8F3),
254 bn_pack4(0xB5A8,0x4031,0x900B,0x1C9E),
255 bn_pack4(0xD55E,0x702F,0x4698,0x0C82),
256 bn_pack4(0xF482,0xD7CE,0x6E74,0xFEF6),
257 bn_pack4(0xF032,0xEA15,0xD172,0x1D03),
258 bn_pack4(0x5983,0xCA01,0xC64B,0x92EC),
259 bn_pack4(0x6FB8,0xF401,0x378C,0xD2BF),
260 bn_pack4(0x3320,0x5151,0x2BD7,0xAF42),
261 bn_pack4(0xDB7F,0x1447,0xE6CC,0x254B),
262 bn_pack4(0x44CE,0x6CBA,0xCED4,0xBB1B),
263 bn_pack4(0xDA3E,0xDBEB,0xCF9B,0x14ED),
264 bn_pack4(0x1797,0x27B0,0x865A,0x8918),
265 bn_pack4(0xB06A,0x53ED,0x9027,0xD831),
266 bn_pack4(0xE5DB,0x382F,0x4130,0x01AE),
267 bn_pack4(0xF8FF,0x9406,0xAD9E,0x530E),
268 bn_pack4(0xC975,0x1E76,0x3DBA,0x37BD),
269 bn_pack4(0xC1D4,0xDCB2,0x6026,0x46DE),
270 bn_pack4(0x36C3,0xFAB4,0xD27C,0x7026),
271 bn_pack4(0x4DF4,0x35C9,0x3402,0x8492),
272 bn_pack4(0x86FF,0xB7DC,0x90A6,0xC08F),
273 bn_pack4(0x93B4,0xEA98,0x8D8F,0xDDC1),
274 bn_pack4(0xD006,0x9127,0xD5B0,0x5AA9),
275 bn_pack4(0xB81B,0xDD76,0x2170,0x481C),
276 bn_pack4(0x1F61,0x2970,0xCEE2,0xD7AF),
277 bn_pack4(0x233B,0xA186,0x515B,0xE7ED),
278 bn_pack4(0x99B2,0x964F,0xA090,0xC3A2),
279 bn_pack4(0x287C,0x5947,0x4E6B,0xC05D),
280 bn_pack4(0x2E8E,0xFC14,0x1FBE,0xCAA6),
281 bn_pack4(0xDBBB,0xC2DB,0x04DE,0x8EF9),
282 bn_pack4(0x2583,0xE9CA,0x2AD4,0x4CE8),
283 bn_pack4(0x1A94,0x6834,0xB615,0x0BDA),
284 bn_pack4(0x99C3,0x2718,0x6AF4,0xE23C),
285 bn_pack4(0x8871,0x9A10,0xBDBA,0x5B26),
286 bn_pack4(0x1A72,0x3C12,0xA787,0xE6D7),
287 bn_pack4(0x4B82,0xD120,0xA921,0x0801),
288 bn_pack4(0x43DB,0x5BFC,0xE0FD,0x108E),
289 bn_pack4(0x08E2,0x4FA0,0x74E5,0xAB31),
290 bn_pack4(0x7709,0x88C0,0xBAD9,0x46E2),
291 bn_pack4(0xBBE1,0x1757,0x7A61,0x5D6C),
292 bn_pack4(0x521F,0x2B18,0x177B,0x200C),
293 bn_pack4(0xD876,0x0273,0x3EC8,0x6A64),
294 bn_pack4(0xF12F,0xFA06,0xD98A,0x0864),
295 bn_pack4(0xCEE3,0xD226,0x1AD2,0xEE6B),
296 bn_pack4(0x1E8C,0x94E0,0x4A25,0x619D),
297 bn_pack4(0xABF5,0xAE8C,0xDB09,0x33D7),
298 bn_pack4(0xB397,0x0F85,0xA6E1,0xE4C7),
299 bn_pack4(0x8AEA,0x7157,0x5D06,0x0C7D),
300 bn_pack4(0xECFB,0x8504,0x58DB,0xEF0A),
301 bn_pack4(0xA855,0x21AB,0xDF1C,0xBA64),
302 bn_pack4(0xAD33,0x170D,0x0450,0x7A33),
303 bn_pack4(0x1572,0x8E5A,0x8AAA,0xC42D),
304 bn_pack4(0x15D2,0x2618,0x98FA,0x0510),
305 bn_pack4(0x3995,0x497C,0xEA95,0x6AE5),
306 bn_pack4(0xDE2B,0xCBF6,0x9558,0x1718),
307 bn_pack4(0xB5C5,0x5DF0,0x6F4C,0x52C9),
308 bn_pack4(0x9B27,0x83A2,0xEC07,0xA28F),
309 bn_pack4(0xE39E,0x772C,0x180E,0x8603),
310 bn_pack4(0x3290,0x5E46,0x2E36,0xCE3B),
311 bn_pack4(0xF174,0x6C08,0xCA18,0x217C),
312 bn_pack4(0x670C,0x354E,0x4ABC,0x9804),
313 bn_pack4(0x9ED5,0x2907,0x7096,0x966D),
314 bn_pack4(0x1C62,0xF356,0x2085,0x52BB),
315 bn_pack4(0x8365,0x5D23,0xDCA3,0xAD96),
316 bn_pack4(0x6916,0x3FA8,0xFD24,0xCF5F),
317 bn_pack4(0x98DA,0x4836,0x1C55,0xD39A),
318 bn_pack4(0xC200,0x7CB8,0xA163,0xBF05),
319 bn_pack4(0x4928,0x6651,0xECE4,0x5B3D),
320 bn_pack4(0xAE9F,0x2411,0x7C4B,0x1FE6),
321 bn_pack4(0xEE38,0x6BFB,0x5A89,0x9FA5),
322 bn_pack4(0x0BFF,0x5CB6,0xF406,0xB7ED),
323 bn_pack4(0xF44C,0x42E9,0xA637,0xED6B),
324 bn_pack4(0xE485,0xB576,0x625E,0x7EC6),
325 bn_pack4(0x4FE1,0x356D,0x6D51,0xC245),
326 bn_pack4(0x302B,0x0A6D,0xF25F,0x1437),
327 bn_pack4(0xEF95,0x19B3,0xCD3A,0x431B),
328 bn_pack4(0x514A,0x0879,0x8E34,0x04DD),
329 bn_pack4(0x020B,0xBEA6,0x3B13,0x9B22),
330 bn_pack4(0x2902,0x4E08,0x8A67,0xCC74),
331 bn_pack4(0xC4C6,0x628B,0x80DC,0x1CD1),
332 bn_pack4(0xC90F,0xDAA2,0x2168,0xC234),
333 bn_pack4(0xFFFF,0xFFFF,0xFFFF,0xFFFF)
334};
335static BIGNUM bn_group_6144 = {
336 bn_group_6144_value,
337 (sizeof bn_group_6144_value)/sizeof(BN_ULONG),
338 (sizeof bn_group_6144_value)/sizeof(BN_ULONG),
339 0,
340 BN_FLG_STATIC_DATA
341};
342
343static BN_ULONG bn_group_8192_value[] = {
344 bn_pack4(0xFFFF,0xFFFF,0xFFFF,0xFFFF),
345 bn_pack4(0x60C9,0x80DD,0x98ED,0xD3DF),
346 bn_pack4(0xC81F,0x56E8,0x80B9,0x6E71),
347 bn_pack4(0x9E30,0x50E2,0x7656,0x94DF),
348 bn_pack4(0x9558,0xE447,0x5677,0xE9AA),
349 bn_pack4(0xC919,0x0DA6,0xFC02,0x6E47),
350 bn_pack4(0x889A,0x002E,0xD5EE,0x382B),
351 bn_pack4(0x4009,0x438B,0x481C,0x6CD7),
352 bn_pack4(0x3590,0x46F4,0xEB87,0x9F92),
353 bn_pack4(0xFAF3,0x6BC3,0x1ECF,0xA268),
354 bn_pack4(0xB1D5,0x10BD,0x7EE7,0x4D73),
355 bn_pack4(0xF9AB,0x4819,0x5DED,0x7EA1),
356 bn_pack4(0x64F3,0x1CC5,0x0846,0x851D),
357 bn_pack4(0x4597,0xE899,0xA025,0x5DC1),
358 bn_pack4(0xDF31,0x0EE0,0x74AB,0x6A36),
359 bn_pack4(0x6D2A,0x13F8,0x3F44,0xF82D),
360 bn_pack4(0x062B,0x3CF5,0xB3A2,0x78A6),
361 bn_pack4(0x7968,0x3303,0xED5B,0xDD3A),
362 bn_pack4(0xFA9D,0x4B7F,0xA2C0,0x87E8),
363 bn_pack4(0x4BCB,0xC886,0x2F83,0x85DD),
364 bn_pack4(0x3473,0xFC64,0x6CEA,0x306B),
365 bn_pack4(0x13EB,0x57A8,0x1A23,0xF0C7),
366 bn_pack4(0x2222,0x2E04,0xA403,0x7C07),
367 bn_pack4(0xE3FD,0xB8BE,0xFC84,0x8AD9),
368 bn_pack4(0x238F,0x16CB,0xE39D,0x652D),
369 bn_pack4(0x3423,0xB474,0x2BF1,0xC978),
370 bn_pack4(0x3AAB,0x639C,0x5AE4,0xF568),
371 bn_pack4(0x2576,0xF693,0x6BA4,0x2466),
372 bn_pack4(0x741F,0xA7BF,0x8AFC,0x47ED),
373 bn_pack4(0x3BC8,0x32B6,0x8D9D,0xD300),
374 bn_pack4(0xD8BE,0xC4D0,0x73B9,0x31BA),
375 bn_pack4(0x3877,0x7CB6,0xA932,0xDF8C),
376 bn_pack4(0x74A3,0x926F,0x12FE,0xE5E4),
377 bn_pack4(0xE694,0xF91E,0x6DBE,0x1159),
378 bn_pack4(0x12BF,0x2D5B,0x0B74,0x74D6),
379 bn_pack4(0x043E,0x8F66,0x3F48,0x60EE),
380 bn_pack4(0x387F,0xE8D7,0x6E3C,0x0468),
381 bn_pack4(0xDA56,0xC9EC,0x2EF2,0x9632),
382 bn_pack4(0xEB19,0xCCB1,0xA313,0xD55C),
383 bn_pack4(0xF550,0xAA3D,0x8A1F,0xBFF0),
384 bn_pack4(0x06A1,0xD58B,0xB7C5,0xDA76),
385 bn_pack4(0xA797,0x15EE,0xF29B,0xE328),
386 bn_pack4(0x14CC,0x5ED2,0x0F80,0x37E0),
387 bn_pack4(0xCC8F,0x6D7E,0xBF48,0xE1D8),
388 bn_pack4(0x4BD4,0x07B2,0x2B41,0x54AA),
389 bn_pack4(0x0F1D,0x45B7,0xFF58,0x5AC5),
390 bn_pack4(0x23A9,0x7A7E,0x36CC,0x88BE),
391 bn_pack4(0x59E7,0xC97F,0xBEC7,0xE8F3),
392 bn_pack4(0xB5A8,0x4031,0x900B,0x1C9E),
393 bn_pack4(0xD55E,0x702F,0x4698,0x0C82),
394 bn_pack4(0xF482,0xD7CE,0x6E74,0xFEF6),
395 bn_pack4(0xF032,0xEA15,0xD172,0x1D03),
396 bn_pack4(0x5983,0xCA01,0xC64B,0x92EC),
397 bn_pack4(0x6FB8,0xF401,0x378C,0xD2BF),
398 bn_pack4(0x3320,0x5151,0x2BD7,0xAF42),
399 bn_pack4(0xDB7F,0x1447,0xE6CC,0x254B),
400 bn_pack4(0x44CE,0x6CBA,0xCED4,0xBB1B),
401 bn_pack4(0xDA3E,0xDBEB,0xCF9B,0x14ED),
402 bn_pack4(0x1797,0x27B0,0x865A,0x8918),
403 bn_pack4(0xB06A,0x53ED,0x9027,0xD831),
404 bn_pack4(0xE5DB,0x382F,0x4130,0x01AE),
405 bn_pack4(0xF8FF,0x9406,0xAD9E,0x530E),
406 bn_pack4(0xC975,0x1E76,0x3DBA,0x37BD),
407 bn_pack4(0xC1D4,0xDCB2,0x6026,0x46DE),
408 bn_pack4(0x36C3,0xFAB4,0xD27C,0x7026),
409 bn_pack4(0x4DF4,0x35C9,0x3402,0x8492),
410 bn_pack4(0x86FF,0xB7DC,0x90A6,0xC08F),
411 bn_pack4(0x93B4,0xEA98,0x8D8F,0xDDC1),
412 bn_pack4(0xD006,0x9127,0xD5B0,0x5AA9),
413 bn_pack4(0xB81B,0xDD76,0x2170,0x481C),
414 bn_pack4(0x1F61,0x2970,0xCEE2,0xD7AF),
415 bn_pack4(0x233B,0xA186,0x515B,0xE7ED),
416 bn_pack4(0x99B2,0x964F,0xA090,0xC3A2),
417 bn_pack4(0x287C,0x5947,0x4E6B,0xC05D),
418 bn_pack4(0x2E8E,0xFC14,0x1FBE,0xCAA6),
419 bn_pack4(0xDBBB,0xC2DB,0x04DE,0x8EF9),
420 bn_pack4(0x2583,0xE9CA,0x2AD4,0x4CE8),
421 bn_pack4(0x1A94,0x6834,0xB615,0x0BDA),
422 bn_pack4(0x99C3,0x2718,0x6AF4,0xE23C),
423 bn_pack4(0x8871,0x9A10,0xBDBA,0x5B26),
424 bn_pack4(0x1A72,0x3C12,0xA787,0xE6D7),
425 bn_pack4(0x4B82,0xD120,0xA921,0x0801),
426 bn_pack4(0x43DB,0x5BFC,0xE0FD,0x108E),
427 bn_pack4(0x08E2,0x4FA0,0x74E5,0xAB31),
428 bn_pack4(0x7709,0x88C0,0xBAD9,0x46E2),
429 bn_pack4(0xBBE1,0x1757,0x7A61,0x5D6C),
430 bn_pack4(0x521F,0x2B18,0x177B,0x200C),
431 bn_pack4(0xD876,0x0273,0x3EC8,0x6A64),
432 bn_pack4(0xF12F,0xFA06,0xD98A,0x0864),
433 bn_pack4(0xCEE3,0xD226,0x1AD2,0xEE6B),
434 bn_pack4(0x1E8C,0x94E0,0x4A25,0x619D),
435 bn_pack4(0xABF5,0xAE8C,0xDB09,0x33D7),
436 bn_pack4(0xB397,0x0F85,0xA6E1,0xE4C7),
437 bn_pack4(0x8AEA,0x7157,0x5D06,0x0C7D),
438 bn_pack4(0xECFB,0x8504,0x58DB,0xEF0A),
439 bn_pack4(0xA855,0x21AB,0xDF1C,0xBA64),
440 bn_pack4(0xAD33,0x170D,0x0450,0x7A33),
441 bn_pack4(0x1572,0x8E5A,0x8AAA,0xC42D),
442 bn_pack4(0x15D2,0x2618,0x98FA,0x0510),
443 bn_pack4(0x3995,0x497C,0xEA95,0x6AE5),
444 bn_pack4(0xDE2B,0xCBF6,0x9558,0x1718),
445 bn_pack4(0xB5C5,0x5DF0,0x6F4C,0x52C9),
446 bn_pack4(0x9B27,0x83A2,0xEC07,0xA28F),
447 bn_pack4(0xE39E,0x772C,0x180E,0x8603),
448 bn_pack4(0x3290,0x5E46,0x2E36,0xCE3B),
449 bn_pack4(0xF174,0x6C08,0xCA18,0x217C),
450 bn_pack4(0x670C,0x354E,0x4ABC,0x9804),
451 bn_pack4(0x9ED5,0x2907,0x7096,0x966D),
452 bn_pack4(0x1C62,0xF356,0x2085,0x52BB),
453 bn_pack4(0x8365,0x5D23,0xDCA3,0xAD96),
454 bn_pack4(0x6916,0x3FA8,0xFD24,0xCF5F),
455 bn_pack4(0x98DA,0x4836,0x1C55,0xD39A),
456 bn_pack4(0xC200,0x7CB8,0xA163,0xBF05),
457 bn_pack4(0x4928,0x6651,0xECE4,0x5B3D),
458 bn_pack4(0xAE9F,0x2411,0x7C4B,0x1FE6),
459 bn_pack4(0xEE38,0x6BFB,0x5A89,0x9FA5),
460 bn_pack4(0x0BFF,0x5CB6,0xF406,0xB7ED),
461 bn_pack4(0xF44C,0x42E9,0xA637,0xED6B),
462 bn_pack4(0xE485,0xB576,0x625E,0x7EC6),
463 bn_pack4(0x4FE1,0x356D,0x6D51,0xC245),
464 bn_pack4(0x302B,0x0A6D,0xF25F,0x1437),
465 bn_pack4(0xEF95,0x19B3,0xCD3A,0x431B),
466 bn_pack4(0x514A,0x0879,0x8E34,0x04DD),
467 bn_pack4(0x020B,0xBEA6,0x3B13,0x9B22),
468 bn_pack4(0x2902,0x4E08,0x8A67,0xCC74),
469 bn_pack4(0xC4C6,0x628B,0x80DC,0x1CD1),
470 bn_pack4(0xC90F,0xDAA2,0x2168,0xC234),
471 bn_pack4(0xFFFF,0xFFFF,0xFFFF,0xFFFF)
472};
473static BIGNUM bn_group_8192 = {
474 bn_group_8192_value,
475 (sizeof bn_group_8192_value)/sizeof(BN_ULONG),
476 (sizeof bn_group_8192_value)/sizeof(BN_ULONG),
477 0,
478 BN_FLG_STATIC_DATA
479};
480
481static BN_ULONG bn_generator_19_value[] = {19} ;
482static BIGNUM bn_generator_19 = {
483 bn_generator_19_value,
484 1,
485 1,
486 0,
487 BN_FLG_STATIC_DATA
488};
489static BN_ULONG bn_generator_5_value[] = {5} ;
490static BIGNUM bn_generator_5 = {
491 bn_generator_5_value,
492 1,
493 1,
494 0,
495 BN_FLG_STATIC_DATA
496};
497static BN_ULONG bn_generator_2_value[] = {2} ;
498static BIGNUM bn_generator_2 = {
499 bn_generator_2_value,
500 1,
501 1,
502 0,
503 BN_FLG_STATIC_DATA
504};
505
506static SRP_gN knowngN[] = {
507 {"8192",&bn_generator_19 , &bn_group_8192},
508 {"6144",&bn_generator_5 , &bn_group_6144},
509 {"4096",&bn_generator_5 , &bn_group_4096},
510 {"3072",&bn_generator_5 , &bn_group_3072},
511 {"2048",&bn_generator_2 , &bn_group_2048},
512 {"1536",&bn_generator_2 , &bn_group_1536},
513 {"1024",&bn_generator_2 , &bn_group_1024},
514};
515#define KNOWN_GN_NUMBER sizeof(knowngN) / sizeof(SRP_gN)
516
517/* end of generated data */
diff --git a/src/lib/libcrypto/srp/srp_lcl.h b/src/lib/libcrypto/srp/srp_lcl.h
new file mode 100644
index 0000000000..42bda3f148
--- /dev/null
+++ b/src/lib/libcrypto/srp/srp_lcl.h
@@ -0,0 +1,83 @@
1/* crypto/srp/srp_lcl.h */
2/* Written by Peter Sylvester (peter.sylvester@edelweb.fr)
3 * for the EdelKey project and contributed to the OpenSSL project 2004.
4 */
5/* ====================================================================
6 * Copyright (c) 2004 The OpenSSL Project. All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 *
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 *
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in
17 * the documentation and/or other materials provided with the
18 * distribution.
19 *
20 * 3. All advertising materials mentioning features or use of this
21 * software must display the following acknowledgment:
22 * "This product includes software developed by the OpenSSL Project
23 * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
24 *
25 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
26 * endorse or promote products derived from this software without
27 * prior written permission. For written permission, please contact
28 * licensing@OpenSSL.org.
29 *
30 * 5. Products derived from this software may not be called "OpenSSL"
31 * nor may "OpenSSL" appear in their names without prior written
32 * permission of the OpenSSL Project.
33 *
34 * 6. Redistributions of any form whatsoever must retain the following
35 * acknowledgment:
36 * "This product includes software developed by the OpenSSL Project
37 * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
38 *
39 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
40 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
41 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
42 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
43 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
44 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
45 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
46 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
47 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
48 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
49 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50 * OF THE POSSIBILITY OF SUCH DAMAGE.
51 * ====================================================================
52 *
53 * This product includes cryptographic software written by Eric Young
54 * (eay@cryptsoft.com). This product includes software written by Tim
55 * Hudson (tjh@cryptsoft.com).
56 *
57 */
58#ifndef HEADER_SRP_LCL_H
59#define HEADER_SRP_LCL_H
60
61#include <openssl/srp.h>
62#include <openssl/sha.h>
63
64#if 0
65#define srp_bn_print(a) {fprintf(stderr, #a "="); BN_print_fp(stderr,a); \
66 fprintf(stderr,"\n");}
67#else
68#define srp_bn_print(a)
69#endif
70
71
72
73#ifdef __cplusplus
74extern "C" {
75#endif
76
77
78
79#ifdef __cplusplus
80}
81#endif
82
83#endif
diff --git a/src/lib/libcrypto/srp/srp_lib.c b/src/lib/libcrypto/srp/srp_lib.c
new file mode 100644
index 0000000000..7c1dcc5111
--- /dev/null
+++ b/src/lib/libcrypto/srp/srp_lib.c
@@ -0,0 +1,361 @@
1/* crypto/srp/srp_lib.c */
2/* Written by Christophe Renou (christophe.renou@edelweb.fr) with
3 * the precious help of Peter Sylvester (peter.sylvester@edelweb.fr)
4 * for the EdelKey project and contributed to the OpenSSL project 2004.
5 */
6/* ====================================================================
7 * Copyright (c) 2004 The OpenSSL Project. All rights reserved.
8 *
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
11 * are met:
12 *
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 *
16 * 2. Redistributions in binary form must reproduce the above copyright
17 * notice, this list of conditions and the following disclaimer in
18 * the documentation and/or other materials provided with the
19 * distribution.
20 *
21 * 3. All advertising materials mentioning features or use of this
22 * software must display the following acknowledgment:
23 * "This product includes software developed by the OpenSSL Project
24 * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
25 *
26 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
27 * endorse or promote products derived from this software without
28 * prior written permission. For written permission, please contact
29 * licensing@OpenSSL.org.
30 *
31 * 5. Products derived from this software may not be called "OpenSSL"
32 * nor may "OpenSSL" appear in their names without prior written
33 * permission of the OpenSSL Project.
34 *
35 * 6. Redistributions of any form whatsoever must retain the following
36 * acknowledgment:
37 * "This product includes software developed by the OpenSSL Project
38 * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
39 *
40 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
41 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
42 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
43 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
44 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
45 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
46 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
47 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
49 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
50 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
51 * OF THE POSSIBILITY OF SUCH DAMAGE.
52 * ====================================================================
53 *
54 * This product includes cryptographic software written by Eric Young
55 * (eay@cryptsoft.com). This product includes software written by Tim
56 * Hudson (tjh@cryptsoft.com).
57 *
58 */
59#ifndef OPENSSL_NO_SRP
60#include "cryptlib.h"
61#include "srp_lcl.h"
62#include <openssl/srp.h>
63#include <openssl/evp.h>
64
65#if (BN_BYTES == 8)
66# if (defined(_WIN32) || defined(_WIN64)) && !defined(__MINGW32__)
67# define bn_pack4(a1,a2,a3,a4) ((a1##UI64<<48)|(a2##UI64<<32)|(a3##UI64<<16)|a4##UI64)
68# elif defined(__arch64__)
69# define bn_pack4(a1,a2,a3,a4) ((a1##UL<<48)|(a2##UL<<32)|(a3##UL<<16)|a4##UL)
70# else
71# define bn_pack4(a1,a2,a3,a4) ((a1##ULL<<48)|(a2##ULL<<32)|(a3##ULL<<16)|a4##ULL)
72# endif
73#elif (BN_BYTES == 4)
74# define bn_pack4(a1,a2,a3,a4) ((a3##UL<<16)|a4##UL), ((a1##UL<<16)|a2##UL)
75#else
76# error "unsupported BN_BYTES"
77#endif
78
79
80#include "srp_grps.h"
81
82static BIGNUM *srp_Calc_k(BIGNUM *N, BIGNUM *g)
83 {
84 /* k = SHA1(N | PAD(g)) -- tls-srp draft 8 */
85
86 unsigned char digest[SHA_DIGEST_LENGTH];
87 unsigned char *tmp;
88 EVP_MD_CTX ctxt;
89 int longg ;
90 int longN = BN_num_bytes(N);
91
92 if ((tmp = OPENSSL_malloc(longN)) == NULL)
93 return NULL;
94 BN_bn2bin(N,tmp) ;
95
96 EVP_MD_CTX_init(&ctxt);
97 EVP_DigestInit_ex(&ctxt, EVP_sha1(), NULL);
98 EVP_DigestUpdate(&ctxt, tmp, longN);
99
100 memset(tmp, 0, longN);
101 longg = BN_bn2bin(g,tmp) ;
102 /* use the zeros behind to pad on left */
103 EVP_DigestUpdate(&ctxt, tmp + longg, longN-longg);
104 EVP_DigestUpdate(&ctxt, tmp, longg);
105 OPENSSL_free(tmp);
106
107 EVP_DigestFinal_ex(&ctxt, digest, NULL);
108 EVP_MD_CTX_cleanup(&ctxt);
109 return BN_bin2bn(digest, sizeof(digest), NULL);
110 }
111
112BIGNUM *SRP_Calc_u(BIGNUM *A, BIGNUM *B, BIGNUM *N)
113 {
114 /* k = SHA1(PAD(A) || PAD(B) ) -- tls-srp draft 8 */
115
116 BIGNUM *u;
117 unsigned char cu[SHA_DIGEST_LENGTH];
118 unsigned char *cAB;
119 EVP_MD_CTX ctxt;
120 int longN;
121 if ((A == NULL) ||(B == NULL) || (N == NULL))
122 return NULL;
123
124 longN= BN_num_bytes(N);
125
126 if ((cAB = OPENSSL_malloc(2*longN)) == NULL)
127 return NULL;
128
129 memset(cAB, 0, longN);
130
131 EVP_MD_CTX_init(&ctxt);
132 EVP_DigestInit_ex(&ctxt, EVP_sha1(), NULL);
133 EVP_DigestUpdate(&ctxt, cAB + BN_bn2bin(A,cAB+longN), longN);
134 EVP_DigestUpdate(&ctxt, cAB + BN_bn2bin(B,cAB+longN), longN);
135 OPENSSL_free(cAB);
136 EVP_DigestFinal_ex(&ctxt, cu, NULL);
137 EVP_MD_CTX_cleanup(&ctxt);
138
139 if (!(u = BN_bin2bn(cu, sizeof(cu), NULL)))
140 return NULL;
141 if (!BN_is_zero(u))
142 return u;
143 BN_free(u);
144 return NULL;
145}
146
147BIGNUM *SRP_Calc_server_key(BIGNUM *A, BIGNUM *v, BIGNUM *u, BIGNUM *b, BIGNUM *N)
148 {
149 BIGNUM *tmp = NULL, *S = NULL;
150 BN_CTX *bn_ctx;
151
152 if (u == NULL || A == NULL || v == NULL || b == NULL || N == NULL)
153 return NULL;
154
155 if ((bn_ctx = BN_CTX_new()) == NULL ||
156 (tmp = BN_new()) == NULL ||
157 (S = BN_new()) == NULL )
158 goto err;
159
160 /* S = (A*v**u) ** b */
161
162 if (!BN_mod_exp(tmp,v,u,N,bn_ctx))
163 goto err;
164 if (!BN_mod_mul(tmp,A,tmp,N,bn_ctx))
165 goto err;
166 if (!BN_mod_exp(S,tmp,b,N,bn_ctx))
167 goto err;
168err:
169 BN_CTX_free(bn_ctx);
170 BN_clear_free(tmp);
171 return S;
172 }
173
174BIGNUM *SRP_Calc_B(BIGNUM *b, BIGNUM *N, BIGNUM *g, BIGNUM *v)
175 {
176 BIGNUM *kv = NULL, *gb = NULL;
177 BIGNUM *B = NULL, *k = NULL;
178 BN_CTX *bn_ctx;
179
180 if (b == NULL || N == NULL || g == NULL || v == NULL ||
181 (bn_ctx = BN_CTX_new()) == NULL)
182 return NULL;
183
184 if ( (kv = BN_new()) == NULL ||
185 (gb = BN_new()) == NULL ||
186 (B = BN_new())== NULL)
187 goto err;
188
189 /* B = g**b + k*v */
190
191 if (!BN_mod_exp(gb,g,b,N,bn_ctx) ||
192 !(k = srp_Calc_k(N,g)) ||
193 !BN_mod_mul(kv,v,k,N,bn_ctx) ||
194 !BN_mod_add(B,gb,kv,N,bn_ctx))
195 {
196 BN_free(B);
197 B = NULL;
198 }
199err:
200 BN_CTX_free(bn_ctx);
201 BN_clear_free(kv);
202 BN_clear_free(gb);
203 BN_free(k);
204 return B;
205 }
206
207BIGNUM *SRP_Calc_x(BIGNUM *s, const char *user, const char *pass)
208 {
209 unsigned char dig[SHA_DIGEST_LENGTH];
210 EVP_MD_CTX ctxt;
211 unsigned char *cs;
212
213 if ((s == NULL) ||
214 (user == NULL) ||
215 (pass == NULL))
216 return NULL;
217
218 if ((cs = OPENSSL_malloc(BN_num_bytes(s))) == NULL)
219 return NULL;
220
221 EVP_MD_CTX_init(&ctxt);
222 EVP_DigestInit_ex(&ctxt, EVP_sha1(), NULL);
223 EVP_DigestUpdate(&ctxt, user, strlen(user));
224 EVP_DigestUpdate(&ctxt, ":", 1);
225 EVP_DigestUpdate(&ctxt, pass, strlen(pass));
226 EVP_DigestFinal_ex(&ctxt, dig, NULL);
227
228 EVP_DigestInit_ex(&ctxt, EVP_sha1(), NULL);
229 BN_bn2bin(s,cs);
230 EVP_DigestUpdate(&ctxt, cs, BN_num_bytes(s));
231 OPENSSL_free(cs);
232 EVP_DigestUpdate(&ctxt, dig, sizeof(dig));
233 EVP_DigestFinal_ex(&ctxt, dig, NULL);
234 EVP_MD_CTX_cleanup(&ctxt);
235
236 return BN_bin2bn(dig, sizeof(dig), NULL);
237 }
238
239BIGNUM *SRP_Calc_A(BIGNUM *a, BIGNUM *N, BIGNUM *g)
240 {
241 BN_CTX *bn_ctx;
242 BIGNUM * A = NULL;
243
244 if (a == NULL || N == NULL || g == NULL ||
245 (bn_ctx = BN_CTX_new()) == NULL)
246 return NULL;
247
248 if ((A = BN_new()) != NULL &&
249 !BN_mod_exp(A,g,a,N,bn_ctx))
250 {
251 BN_free(A);
252 A = NULL;
253 }
254 BN_CTX_free(bn_ctx);
255 return A;
256 }
257
258
259BIGNUM *SRP_Calc_client_key(BIGNUM *N, BIGNUM *B, BIGNUM *g, BIGNUM *x, BIGNUM *a, BIGNUM *u)
260 {
261 BIGNUM *tmp = NULL, *tmp2 = NULL, *tmp3 = NULL , *k = NULL, *K = NULL;
262 BN_CTX *bn_ctx;
263
264 if (u == NULL || B == NULL || N == NULL || g == NULL || x == NULL || a == NULL ||
265 (bn_ctx = BN_CTX_new()) == NULL)
266 return NULL;
267
268 if ((tmp = BN_new()) == NULL ||
269 (tmp2 = BN_new())== NULL ||
270 (tmp3 = BN_new())== NULL ||
271 (K = BN_new()) == NULL)
272 goto err;
273
274 if (!BN_mod_exp(tmp,g,x,N,bn_ctx))
275 goto err;
276 if (!(k = srp_Calc_k(N,g)))
277 goto err;
278 if (!BN_mod_mul(tmp2,tmp,k,N,bn_ctx))
279 goto err;
280 if (!BN_mod_sub(tmp,B,tmp2,N,bn_ctx))
281 goto err;
282
283 if (!BN_mod_mul(tmp3,u,x,N,bn_ctx))
284 goto err;
285 if (!BN_mod_add(tmp2,a,tmp3,N,bn_ctx))
286 goto err;
287 if (!BN_mod_exp(K,tmp,tmp2,N,bn_ctx))
288 goto err;
289
290err :
291 BN_CTX_free(bn_ctx);
292 BN_clear_free(tmp);
293 BN_clear_free(tmp2);
294 BN_clear_free(tmp3);
295 BN_free(k);
296 return K;
297 }
298
299int SRP_Verify_B_mod_N(BIGNUM *B, BIGNUM *N)
300 {
301 BIGNUM *r;
302 BN_CTX *bn_ctx;
303 int ret = 0;
304
305 if (B == NULL || N == NULL ||
306 (bn_ctx = BN_CTX_new()) == NULL)
307 return 0;
308
309 if ((r = BN_new()) == NULL)
310 goto err;
311 /* Checks if B % N == 0 */
312 if (!BN_nnmod(r,B,N,bn_ctx))
313 goto err;
314 ret = !BN_is_zero(r);
315err:
316 BN_CTX_free(bn_ctx);
317 BN_free(r);
318 return ret;
319 }
320
321int SRP_Verify_A_mod_N(BIGNUM *A, BIGNUM *N)
322 {
323 /* Checks if A % N == 0 */
324 return SRP_Verify_B_mod_N(A,N) ;
325 }
326
327
328/* Check if G and N are kwown parameters.
329 The values have been generated from the ietf-tls-srp draft version 8
330*/
331char *SRP_check_known_gN_param(BIGNUM *g, BIGNUM *N)
332 {
333 size_t i;
334 if ((g == NULL) || (N == NULL))
335 return 0;
336
337 srp_bn_print(g);
338 srp_bn_print(N);
339
340 for(i = 0; i < KNOWN_GN_NUMBER; i++)
341 {
342 if (BN_cmp(knowngN[i].g, g) == 0 && BN_cmp(knowngN[i].N, N) == 0)
343 return knowngN[i].id;
344 }
345 return NULL;
346 }
347
348SRP_gN *SRP_get_default_gN(const char *id)
349 {
350 size_t i;
351
352 if (id == NULL)
353 return knowngN;
354 for(i = 0; i < KNOWN_GN_NUMBER; i++)
355 {
356 if (strcmp(knowngN[i].id, id)==0)
357 return knowngN + i;
358 }
359 return NULL;
360 }
361#endif
diff --git a/src/lib/libcrypto/srp/srp_vfy.c b/src/lib/libcrypto/srp/srp_vfy.c
new file mode 100644
index 0000000000..4a3d13edf6
--- /dev/null
+++ b/src/lib/libcrypto/srp/srp_vfy.c
@@ -0,0 +1,658 @@
1/* crypto/srp/srp_vfy.c */
2/* Written by Christophe Renou (christophe.renou@edelweb.fr) with
3 * the precious help of Peter Sylvester (peter.sylvester@edelweb.fr)
4 * for the EdelKey project and contributed to the OpenSSL project 2004.
5 */
6/* ====================================================================
7 * Copyright (c) 2004 The OpenSSL Project. All rights reserved.
8 *
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
11 * are met:
12 *
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 *
16 * 2. Redistributions in binary form must reproduce the above copyright
17 * notice, this list of conditions and the following disclaimer in
18 * the documentation and/or other materials provided with the
19 * distribution.
20 *
21 * 3. All advertising materials mentioning features or use of this
22 * software must display the following acknowledgment:
23 * "This product includes software developed by the OpenSSL Project
24 * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
25 *
26 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
27 * endorse or promote products derived from this software without
28 * prior written permission. For written permission, please contact
29 * licensing@OpenSSL.org.
30 *
31 * 5. Products derived from this software may not be called "OpenSSL"
32 * nor may "OpenSSL" appear in their names without prior written
33 * permission of the OpenSSL Project.
34 *
35 * 6. Redistributions of any form whatsoever must retain the following
36 * acknowledgment:
37 * "This product includes software developed by the OpenSSL Project
38 * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
39 *
40 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
41 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
42 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
43 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
44 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
45 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
46 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
47 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
49 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
50 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
51 * OF THE POSSIBILITY OF SUCH DAMAGE.
52 * ====================================================================
53 *
54 * This product includes cryptographic software written by Eric Young
55 * (eay@cryptsoft.com). This product includes software written by Tim
56 * Hudson (tjh@cryptsoft.com).
57 *
58 */
59#ifndef OPENSSL_NO_SRP
60#include "cryptlib.h"
61#include "srp_lcl.h"
62#include <openssl/srp.h>
63#include <openssl/evp.h>
64#include <openssl/buffer.h>
65#include <openssl/rand.h>
66#include <openssl/txt_db.h>
67
68#define SRP_RANDOM_SALT_LEN 20
69#define MAX_LEN 2500
70
71static char b64table[] =
72 "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz./";
73
74/* the following two conversion routines have been inspired by code from Stanford */
75
76/*
77 * Convert a base64 string into raw byte array representation.
78 */
79static int t_fromb64(unsigned char *a, const char *src)
80 {
81 char *loc;
82 int i, j;
83 int size;
84
85 while(*src && (*src == ' ' || *src == '\t' || *src == '\n'))
86 ++src;
87 size = strlen(src);
88 i = 0;
89 while(i < size)
90 {
91 loc = strchr(b64table, src[i]);
92 if(loc == (char *) 0) break;
93 else a[i] = loc - b64table;
94 ++i;
95 }
96 size = i;
97 i = size - 1;
98 j = size;
99 while(1)
100 {
101 a[j] = a[i];
102 if(--i < 0) break;
103 a[j] |= (a[i] & 3) << 6;
104 --j;
105 a[j] = (unsigned char) ((a[i] & 0x3c) >> 2);
106 if(--i < 0) break;
107 a[j] |= (a[i] & 0xf) << 4;
108 --j;
109 a[j] = (unsigned char) ((a[i] & 0x30) >> 4);
110 if(--i < 0) break;
111 a[j] |= (a[i] << 2);
112
113 a[--j] = 0;
114 if(--i < 0) break;
115 }
116 while(a[j] == 0 && j <= size) ++j;
117 i = 0;
118 while (j <= size) a[i++] = a[j++];
119 return i;
120 }
121
122
123/*
124 * Convert a raw byte string into a null-terminated base64 ASCII string.
125 */
126static char *t_tob64(char *dst, const unsigned char *src, int size)
127 {
128 int c, pos = size % 3;
129 unsigned char b0 = 0, b1 = 0, b2 = 0, notleading = 0;
130 char *olddst = dst;
131
132 switch(pos)
133 {
134 case 1:
135 b2 = src[0];
136 break;
137 case 2:
138 b1 = src[0];
139 b2 = src[1];
140 break;
141 }
142
143 while(1)
144 {
145 c = (b0 & 0xfc) >> 2;
146 if(notleading || c != 0)
147 {
148 *dst++ = b64table[c];
149 notleading = 1;
150 }
151 c = ((b0 & 3) << 4) | ((b1 & 0xf0) >> 4);
152 if(notleading || c != 0)
153 {
154 *dst++ = b64table[c];
155 notleading = 1;
156 }
157 c = ((b1 & 0xf) << 2) | ((b2 & 0xc0) >> 6);
158 if(notleading || c != 0)
159 {
160 *dst++ = b64table[c];
161 notleading = 1;
162 }
163 c = b2 & 0x3f;
164 if(notleading || c != 0)
165 {
166 *dst++ = b64table[c];
167 notleading = 1;
168 }
169 if(pos >= size) break;
170 else
171 {
172 b0 = src[pos++];
173 b1 = src[pos++];
174 b2 = src[pos++];
175 }
176 }
177
178 *dst++ = '\0';
179 return olddst;
180 }
181
182static void SRP_user_pwd_free(SRP_user_pwd *user_pwd)
183 {
184 if (user_pwd == NULL)
185 return;
186 BN_free(user_pwd->s);
187 BN_clear_free(user_pwd->v);
188 OPENSSL_free(user_pwd->id);
189 OPENSSL_free(user_pwd->info);
190 OPENSSL_free(user_pwd);
191 }
192
193static SRP_user_pwd *SRP_user_pwd_new()
194 {
195 SRP_user_pwd *ret = OPENSSL_malloc(sizeof(SRP_user_pwd));
196 if (ret == NULL)
197 return NULL;
198 ret->N = NULL;
199 ret->g = NULL;
200 ret->s = NULL;
201 ret->v = NULL;
202 ret->id = NULL ;
203 ret->info = NULL;
204 return ret;
205 }
206
207static void SRP_user_pwd_set_gN(SRP_user_pwd *vinfo, const BIGNUM *g,
208 const BIGNUM *N)
209 {
210 vinfo->N = N;
211 vinfo->g = g;
212 }
213
214static int SRP_user_pwd_set_ids(SRP_user_pwd *vinfo, const char *id,
215 const char *info)
216 {
217 if (id != NULL && NULL == (vinfo->id = BUF_strdup(id)))
218 return 0;
219 return (info == NULL || NULL != (vinfo->info = BUF_strdup(info))) ;
220 }
221
222static int SRP_user_pwd_set_sv(SRP_user_pwd *vinfo, const char *s,
223 const char *v)
224 {
225 unsigned char tmp[MAX_LEN];
226 int len;
227
228 if (strlen(s) > MAX_LEN || strlen(v) > MAX_LEN)
229 return 0;
230 len = t_fromb64(tmp, v);
231 if (NULL == (vinfo->v = BN_bin2bn(tmp, len, NULL)) )
232 return 0;
233 len = t_fromb64(tmp, s);
234 return ((vinfo->s = BN_bin2bn(tmp, len, NULL)) != NULL) ;
235 }
236
237static int SRP_user_pwd_set_sv_BN(SRP_user_pwd *vinfo, BIGNUM *s, BIGNUM *v)
238 {
239 vinfo->v = v;
240 vinfo->s = s;
241 return (vinfo->s != NULL && vinfo->v != NULL) ;
242 }
243
244SRP_VBASE *SRP_VBASE_new(char *seed_key)
245 {
246 SRP_VBASE *vb = (SRP_VBASE *) OPENSSL_malloc(sizeof(SRP_VBASE));
247
248 if (vb == NULL)
249 return NULL;
250 if (!(vb->users_pwd = sk_SRP_user_pwd_new_null()) ||
251 !(vb->gN_cache = sk_SRP_gN_cache_new_null()))
252 {
253 OPENSSL_free(vb);
254 return NULL;
255 }
256 vb->default_g = NULL;
257 vb->default_N = NULL;
258 vb->seed_key = NULL;
259 if ((seed_key != NULL) &&
260 (vb->seed_key = BUF_strdup(seed_key)) == NULL)
261 {
262 sk_SRP_user_pwd_free(vb->users_pwd);
263 sk_SRP_gN_cache_free(vb->gN_cache);
264 OPENSSL_free(vb);
265 return NULL;
266 }
267 return vb;
268 }
269
270
271int SRP_VBASE_free(SRP_VBASE *vb)
272 {
273 sk_SRP_user_pwd_pop_free(vb->users_pwd,SRP_user_pwd_free);
274 sk_SRP_gN_cache_free(vb->gN_cache);
275 OPENSSL_free(vb->seed_key);
276 OPENSSL_free(vb);
277 return 0;
278 }
279
280
281static SRP_gN_cache *SRP_gN_new_init(const char *ch)
282 {
283 unsigned char tmp[MAX_LEN];
284 int len;
285
286 SRP_gN_cache *newgN = (SRP_gN_cache *)OPENSSL_malloc(sizeof(SRP_gN_cache));
287 if (newgN == NULL)
288 return NULL;
289
290 if ((newgN->b64_bn = BUF_strdup(ch)) == NULL)
291 goto err;
292
293 len = t_fromb64(tmp, ch);
294 if ((newgN->bn = BN_bin2bn(tmp, len, NULL)))
295 return newgN;
296
297 OPENSSL_free(newgN->b64_bn);
298err:
299 OPENSSL_free(newgN);
300 return NULL;
301 }
302
303
304static void SRP_gN_free(SRP_gN_cache *gN_cache)
305 {
306 if (gN_cache == NULL)
307 return;
308 OPENSSL_free(gN_cache->b64_bn);
309 BN_free(gN_cache->bn);
310 OPENSSL_free(gN_cache);
311 }
312
313static SRP_gN *SRP_get_gN_by_id(const char *id, STACK_OF(SRP_gN) *gN_tab)
314 {
315 int i;
316
317 SRP_gN *gN;
318 if (gN_tab != NULL)
319 for(i = 0; i < sk_SRP_gN_num(gN_tab); i++)
320 {
321 gN = sk_SRP_gN_value(gN_tab, i);
322 if (gN && (id == NULL || strcmp(gN->id,id)==0))
323 return gN;
324 }
325
326 return SRP_get_default_gN(id);
327 }
328
329static BIGNUM *SRP_gN_place_bn(STACK_OF(SRP_gN_cache) *gN_cache, char *ch)
330 {
331 int i;
332 if (gN_cache == NULL)
333 return NULL;
334
335 /* search if we have already one... */
336 for(i = 0; i < sk_SRP_gN_cache_num(gN_cache); i++)
337 {
338 SRP_gN_cache *cache = sk_SRP_gN_cache_value(gN_cache, i);
339 if (strcmp(cache->b64_bn,ch)==0)
340 return cache->bn;
341 }
342 { /* it is the first time that we find it */
343 SRP_gN_cache *newgN = SRP_gN_new_init(ch);
344 if (newgN)
345 {
346 if (sk_SRP_gN_cache_insert(gN_cache,newgN,0)>0)
347 return newgN->bn;
348 SRP_gN_free(newgN);
349 }
350 }
351 return NULL;
352 }
353
354/* this function parses verifier file. Format is:
355 * string(index):base64(N):base64(g):0
356 * string(username):base64(v):base64(salt):int(index)
357 */
358
359
360int SRP_VBASE_init(SRP_VBASE *vb, char *verifier_file)
361 {
362 int error_code ;
363 STACK_OF(SRP_gN) *SRP_gN_tab = sk_SRP_gN_new_null();
364 char *last_index = NULL;
365 int i;
366 char **pp;
367
368 SRP_gN *gN = NULL;
369 SRP_user_pwd *user_pwd = NULL ;
370
371 TXT_DB *tmpdb = NULL;
372 BIO *in = BIO_new(BIO_s_file());
373
374 error_code = SRP_ERR_OPEN_FILE;
375
376 if (in == NULL || BIO_read_filename(in,verifier_file) <= 0)
377 goto err;
378
379 error_code = SRP_ERR_VBASE_INCOMPLETE_FILE;
380
381 if ((tmpdb =TXT_DB_read(in,DB_NUMBER)) == NULL)
382 goto err;
383
384 error_code = SRP_ERR_MEMORY;
385
386
387 if (vb->seed_key)
388 {
389 last_index = SRP_get_default_gN(NULL)->id;
390 }
391 for (i = 0; i < sk_OPENSSL_PSTRING_num(tmpdb->data); i++)
392 {
393 pp = sk_OPENSSL_PSTRING_value(tmpdb->data,i);
394 if (pp[DB_srptype][0] == DB_SRP_INDEX)
395 {
396 /*we add this couple in the internal Stack */
397
398 if ((gN = (SRP_gN *)OPENSSL_malloc(sizeof(SRP_gN))) == NULL)
399 goto err;
400
401 if (!(gN->id = BUF_strdup(pp[DB_srpid]))
402 || !(gN->N = SRP_gN_place_bn(vb->gN_cache,pp[DB_srpverifier]))
403 || !(gN->g = SRP_gN_place_bn(vb->gN_cache,pp[DB_srpsalt]))
404 || sk_SRP_gN_insert(SRP_gN_tab,gN,0) == 0)
405 goto err;
406
407 gN = NULL;
408
409 if (vb->seed_key != NULL)
410 {
411 last_index = pp[DB_srpid];
412 }
413 }
414 else if (pp[DB_srptype][0] == DB_SRP_VALID)
415 {
416 /* it is a user .... */
417 SRP_gN *lgN;
418 if ((lgN = SRP_get_gN_by_id(pp[DB_srpgN],SRP_gN_tab))!=NULL)
419 {
420 error_code = SRP_ERR_MEMORY;
421 if ((user_pwd = SRP_user_pwd_new()) == NULL)
422 goto err;
423
424 SRP_user_pwd_set_gN(user_pwd,lgN->g,lgN->N);
425 if (!SRP_user_pwd_set_ids(user_pwd, pp[DB_srpid],pp[DB_srpinfo]))
426 goto err;
427
428 error_code = SRP_ERR_VBASE_BN_LIB;
429 if (!SRP_user_pwd_set_sv(user_pwd, pp[DB_srpsalt],pp[DB_srpverifier]))
430 goto err;
431
432 if (sk_SRP_user_pwd_insert(vb->users_pwd, user_pwd, 0) == 0)
433 goto err;
434 user_pwd = NULL; /* abandon responsability */
435 }
436 }
437 }
438
439 if (last_index != NULL)
440 {
441 /* this means that we want to simulate a default user */
442
443 if (((gN = SRP_get_gN_by_id(last_index,SRP_gN_tab))==NULL))
444 {
445 error_code = SRP_ERR_VBASE_BN_LIB;
446 goto err;
447 }
448 vb->default_g = gN->g ;
449 vb->default_N = gN->N ;
450 gN = NULL ;
451 }
452 error_code = SRP_NO_ERROR;
453
454 err:
455 /* there may be still some leaks to fix, if this fails, the application terminates most likely */
456
457 if (gN != NULL)
458 {
459 OPENSSL_free(gN->id);
460 OPENSSL_free(gN);
461 }
462
463 SRP_user_pwd_free(user_pwd);
464
465 if (tmpdb) TXT_DB_free(tmpdb);
466 if (in) BIO_free_all(in);
467
468 sk_SRP_gN_free(SRP_gN_tab);
469
470 return error_code;
471
472 }
473
474
475SRP_user_pwd *SRP_VBASE_get_by_user(SRP_VBASE *vb, char *username)
476 {
477 int i;
478 SRP_user_pwd *user;
479 unsigned char digv[SHA_DIGEST_LENGTH];
480 unsigned char digs[SHA_DIGEST_LENGTH];
481 EVP_MD_CTX ctxt;
482
483 if (vb == NULL)
484 return NULL;
485 for(i = 0; i < sk_SRP_user_pwd_num(vb->users_pwd); i++)
486 {
487 user = sk_SRP_user_pwd_value(vb->users_pwd, i);
488 if (strcmp(user->id,username)==0)
489 return user;
490 }
491 if ((vb->seed_key == NULL) ||
492 (vb->default_g == NULL) ||
493 (vb->default_N == NULL))
494 return NULL;
495
496/* if the user is unknown we set parameters as well if we have a seed_key */
497
498 if ((user = SRP_user_pwd_new()) == NULL)
499 return NULL;
500
501 SRP_user_pwd_set_gN(user,vb->default_g,vb->default_N);
502
503 if (!SRP_user_pwd_set_ids(user,username,NULL))
504 goto err;
505
506 RAND_pseudo_bytes(digv, SHA_DIGEST_LENGTH);
507 EVP_MD_CTX_init(&ctxt);
508 EVP_DigestInit_ex(&ctxt, EVP_sha1(), NULL);
509 EVP_DigestUpdate(&ctxt, vb->seed_key, strlen(vb->seed_key));
510 EVP_DigestUpdate(&ctxt, username, strlen(username));
511 EVP_DigestFinal_ex(&ctxt, digs, NULL);
512 EVP_MD_CTX_cleanup(&ctxt);
513 if (SRP_user_pwd_set_sv_BN(user, BN_bin2bn(digs,SHA_DIGEST_LENGTH,NULL), BN_bin2bn(digv,SHA_DIGEST_LENGTH, NULL)))
514 return user;
515
516err: SRP_user_pwd_free(user);
517 return NULL;
518 }
519
520
521/*
522 create a verifier (*salt,*verifier,g and N are in base64)
523*/
524char *SRP_create_verifier(const char *user, const char *pass, char **salt,
525 char **verifier, const char *N, const char *g)
526 {
527 int len;
528 char * result=NULL;
529 char *vf;
530 BIGNUM *N_bn = NULL, *g_bn = NULL, *s = NULL, *v = NULL;
531 unsigned char tmp[MAX_LEN];
532 unsigned char tmp2[MAX_LEN];
533 char * defgNid = NULL;
534
535 if ((user == NULL)||
536 (pass == NULL)||
537 (salt == NULL)||
538 (verifier == NULL))
539 goto err;
540
541 if (N)
542 {
543 if (!(len = t_fromb64(tmp, N))) goto err;
544 N_bn = BN_bin2bn(tmp, len, NULL);
545 if (!(len = t_fromb64(tmp, g))) goto err;
546 g_bn = BN_bin2bn(tmp, len, NULL);
547 defgNid = "*";
548 }
549 else
550 {
551 SRP_gN * gN = SRP_get_gN_by_id(g, NULL) ;
552 if (gN == NULL)
553 goto err;
554 N_bn = gN->N;
555 g_bn = gN->g;
556 defgNid = gN->id;
557 }
558
559 if (*salt == NULL)
560 {
561 RAND_pseudo_bytes(tmp2, SRP_RANDOM_SALT_LEN);
562
563 s = BN_bin2bn(tmp2, SRP_RANDOM_SALT_LEN, NULL);
564 }
565 else
566 {
567 if (!(len = t_fromb64(tmp2, *salt)))
568 goto err;
569 s = BN_bin2bn(tmp2, len, NULL);
570 }
571
572
573 if(!SRP_create_verifier_BN(user, pass, &s, &v, N_bn, g_bn)) goto err;
574
575 BN_bn2bin(v,tmp);
576 if (((vf = OPENSSL_malloc(BN_num_bytes(v)*2)) == NULL))
577 goto err;
578 t_tob64(vf, tmp, BN_num_bytes(v));
579
580 *verifier = vf;
581 if (*salt == NULL)
582 {
583 char *tmp_salt;
584
585 if ((tmp_salt = OPENSSL_malloc(SRP_RANDOM_SALT_LEN * 2)) == NULL)
586 {
587 OPENSSL_free(vf);
588 goto err;
589 }
590 t_tob64(tmp_salt, tmp2, SRP_RANDOM_SALT_LEN);
591 *salt = tmp_salt;
592 }
593
594 result=defgNid;
595
596err:
597 if(N)
598 {
599 BN_free(N_bn);
600 BN_free(g_bn);
601 }
602 return result;
603 }
604
605/*
606 create a verifier (*salt,*verifier,g and N are BIGNUMs)
607*/
608int SRP_create_verifier_BN(const char *user, const char *pass, BIGNUM **salt, BIGNUM **verifier, BIGNUM *N, BIGNUM *g)
609 {
610 int result=0;
611 BIGNUM *x = NULL;
612 BN_CTX *bn_ctx = BN_CTX_new();
613 unsigned char tmp2[MAX_LEN];
614
615 if ((user == NULL)||
616 (pass == NULL)||
617 (salt == NULL)||
618 (verifier == NULL)||
619 (N == NULL)||
620 (g == NULL)||
621 (bn_ctx == NULL))
622 goto err;
623
624 srp_bn_print(N);
625 srp_bn_print(g);
626
627 if (*salt == NULL)
628 {
629 RAND_pseudo_bytes(tmp2, SRP_RANDOM_SALT_LEN);
630
631 *salt = BN_bin2bn(tmp2,SRP_RANDOM_SALT_LEN,NULL);
632 }
633
634 x = SRP_Calc_x(*salt,user,pass);
635
636 *verifier = BN_new();
637 if(*verifier == NULL) goto err;
638
639 if (!BN_mod_exp(*verifier,g,x,N,bn_ctx))
640 {
641 BN_clear_free(*verifier);
642 goto err;
643 }
644
645 srp_bn_print(*verifier);
646
647 result=1;
648
649err:
650
651 BN_clear_free(x);
652 BN_CTX_free(bn_ctx);
653 return result;
654 }
655
656
657
658#endif
diff --git a/src/lib/libcrypto/srp/srptest.c b/src/lib/libcrypto/srp/srptest.c
new file mode 100644
index 0000000000..04b66b4544
--- /dev/null
+++ b/src/lib/libcrypto/srp/srptest.c
@@ -0,0 +1,162 @@
1#include <openssl/opensslconf.h>
2#ifdef OPENSSL_NO_SRP
3
4#include <stdio.h>
5
6int main(int argc, char *argv[])
7 {
8 printf("No SRP support\n");
9 return(0);
10 }
11
12#else
13
14#include <openssl/srp.h>
15#include <openssl/rand.h>
16#include <openssl/err.h>
17
18static void showbn(const char *name, const BIGNUM *bn)
19 {
20 fputs(name, stdout);
21 fputs(" = ", stdout);
22 BN_print_fp(stdout, bn);
23 putc('\n', stdout);
24 }
25
26#define RANDOM_SIZE 32 /* use 256 bits on each side */
27
28static int run_srp(const char *username, const char *client_pass, const char *server_pass)
29 {
30 int ret=-1;
31 BIGNUM *s = NULL;
32 BIGNUM *v = NULL;
33 BIGNUM *a = NULL;
34 BIGNUM *b = NULL;
35 BIGNUM *u = NULL;
36 BIGNUM *x = NULL;
37 BIGNUM *Apub = NULL;
38 BIGNUM *Bpub = NULL;
39 BIGNUM *Kclient = NULL;
40 BIGNUM *Kserver = NULL;
41 unsigned char rand_tmp[RANDOM_SIZE];
42 /* use builtin 1024-bit params */
43 SRP_gN *GN = SRP_get_default_gN("1024");
44
45 if(GN == NULL)
46 {
47 fprintf(stderr, "Failed to get SRP parameters\n");
48 return -1;
49 }
50 /* Set up server's password entry */
51 if(!SRP_create_verifier_BN(username, server_pass, &s, &v, GN->N, GN->g))
52 {
53 fprintf(stderr, "Failed to create SRP verifier\n");
54 return -1;
55 }
56
57 showbn("N", GN->N);
58 showbn("g", GN->g);
59 showbn("Salt", s);
60 showbn("Verifier", v);
61
62 /* Server random */
63 RAND_pseudo_bytes(rand_tmp, sizeof(rand_tmp));
64 b = BN_bin2bn(rand_tmp, sizeof(rand_tmp), NULL);
65 /* TODO - check b != 0 */
66 showbn("b", b);
67
68 /* Server's first message */
69 Bpub = SRP_Calc_B(b, GN->N, GN->g, v);
70 showbn("B", Bpub);
71
72 if(!SRP_Verify_B_mod_N(Bpub, GN->N))
73 {
74 fprintf(stderr, "Invalid B\n");
75 return -1;
76 }
77
78 /* Client random */
79 RAND_pseudo_bytes(rand_tmp, sizeof(rand_tmp));
80 a = BN_bin2bn(rand_tmp, sizeof(rand_tmp), NULL);
81 /* TODO - check a != 0 */
82 showbn("a", a);
83
84 /* Client's response */
85 Apub = SRP_Calc_A(a, GN->N, GN->g);
86 showbn("A", Apub);
87
88 if(!SRP_Verify_A_mod_N(Apub, GN->N))
89 {
90 fprintf(stderr, "Invalid A\n");
91 return -1;
92 }
93
94 /* Both sides calculate u */
95 u = SRP_Calc_u(Apub, Bpub, GN->N);
96
97 /* Client's key */
98 x = SRP_Calc_x(s, username, client_pass);
99 Kclient = SRP_Calc_client_key(GN->N, Bpub, GN->g, x, a, u);
100 showbn("Client's key", Kclient);
101
102 /* Server's key */
103 Kserver = SRP_Calc_server_key(Apub, v, u, b, GN->N);
104 showbn("Server's key", Kserver);
105
106 if(BN_cmp(Kclient, Kserver) == 0)
107 {
108 ret = 0;
109 }
110 else
111 {
112 fprintf(stderr, "Keys mismatch\n");
113 ret = 1;
114 }
115
116 BN_clear_free(Kclient);
117 BN_clear_free(Kserver);
118 BN_clear_free(x);
119 BN_free(u);
120 BN_free(Apub);
121 BN_clear_free(a);
122 BN_free(Bpub);
123 BN_clear_free(b);
124 BN_free(s);
125 BN_clear_free(v);
126
127 return ret;
128 }
129
130int main(int argc, char **argv)
131 {
132 BIO *bio_err;
133 bio_err = BIO_new_fp(stderr, BIO_NOCLOSE);
134
135 CRYPTO_malloc_debug_init();
136 CRYPTO_dbg_set_options(V_CRYPTO_MDEBUG_ALL);
137 CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON);
138
139 ERR_load_crypto_strings();
140
141 /* "Negative" test, expect a mismatch */
142 if(run_srp("alice", "password1", "password2") == 0)
143 {
144 fprintf(stderr, "Mismatched SRP run failed\n");
145 return 1;
146 }
147
148 /* "Positive" test, should pass */
149 if(run_srp("alice", "password", "password") != 0)
150 {
151 fprintf(stderr, "Plain SRP run failed\n");
152 return 1;
153 }
154
155 CRYPTO_cleanup_all_ex_data();
156 ERR_remove_thread_state(NULL);
157 ERR_free_strings();
158 CRYPTO_mem_leaks(bio_err);
159
160 return 0;
161 }
162#endif
diff --git a/src/lib/libcrypto/stack/Makefile b/src/lib/libcrypto/stack/Makefile
new file mode 100644
index 0000000000..5327692ac8
--- /dev/null
+++ b/src/lib/libcrypto/stack/Makefile
@@ -0,0 +1,84 @@
1#
2# OpenSSL/crypto/stack/Makefile
3#
4
5DIR= stack
6TOP= ../..
7CC= cc
8INCLUDES=
9CFLAG=-g
10MAKEFILE= Makefile
11AR= ar r
12
13CFLAGS= $(INCLUDES) $(CFLAG)
14
15GENERAL=Makefile
16TEST=
17APPS=
18
19LIB=$(TOP)/libcrypto.a
20LIBSRC=stack.c
21LIBOBJ=stack.o
22
23SRC= $(LIBSRC)
24
25EXHEADER= stack.h safestack.h
26HEADER= $(EXHEADER)
27
28ALL= $(GENERAL) $(SRC) $(HEADER)
29
30top:
31 (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all)
32
33all: lib
34
35lib: $(LIBOBJ)
36 $(AR) $(LIB) $(LIBOBJ)
37 $(RANLIB) $(LIB) || echo Never mind.
38 @touch lib
39
40files:
41 $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
42
43links:
44 @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
45 @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
46 @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
47
48install:
49 @[ -n "$(INSTALLTOP)" ] # should be set by top Makefile...
50 @headerlist="$(EXHEADER)"; for i in $$headerlist ; \
51 do \
52 (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
53 chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
54 done;
55
56tags:
57 ctags $(SRC)
58
59tests:
60
61lint:
62 lint -DLINT $(INCLUDES) $(SRC)>fluff
63
64depend:
65 @[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile...
66 $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
67
68dclean:
69 $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
70 mv -f Makefile.new $(MAKEFILE)
71
72clean:
73 rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
74
75# DO NOT DELETE THIS LINE -- make depend depends on it.
76
77stack.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
78stack.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
79stack.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
80stack.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
81stack.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
82stack.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
83stack.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
84stack.o: ../../include/openssl/symhacks.h ../cryptlib.h stack.c
diff --git a/src/lib/libcrypto/store/Makefile b/src/lib/libcrypto/store/Makefile
new file mode 100644
index 0000000000..0dcfd7857a
--- /dev/null
+++ b/src/lib/libcrypto/store/Makefile
@@ -0,0 +1,112 @@
1#
2# OpenSSL/crypto/store/Makefile
3#
4
5DIR= store
6TOP= ../..
7CC= cc
8INCLUDES= -I.. -I$(TOP) -I../../include
9CFLAG=-g
10MAKEFILE= Makefile
11AR= ar r
12
13CFLAGS= $(INCLUDES) $(CFLAG)
14
15GENERAL=Makefile
16#TEST= storetest.c
17TEST=
18APPS=
19
20LIB=$(TOP)/libcrypto.a
21LIBSRC= str_err.c str_lib.c str_meth.c str_mem.c
22LIBOBJ= str_err.o str_lib.o str_meth.o str_mem.o
23
24SRC= $(LIBSRC)
25
26#EXHEADER= store.h str_compat.h
27EXHEADER= store.h
28HEADER= $(EXHEADER) str_locl.h
29
30ALL= $(GENERAL) $(SRC) $(HEADER)
31
32top:
33 (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all)
34
35all: lib
36
37lib: $(LIBOBJ)
38 $(AR) $(LIB) $(LIBOBJ)
39 $(RANLIB) $(LIB) || echo Never mind.
40 @touch lib
41
42files:
43 $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
44
45links:
46 @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
47 @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
48 @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
49
50install:
51 @[ -n "$(INSTALLTOP)" ] # should be set by top Makefile...
52 @headerlist="$(EXHEADER)"; for i in $$headerlist; \
53 do \
54 (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
55 chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
56 done;
57
58tags:
59 ctags $(SRC)
60
61tests:
62
63lint:
64 lint -DLINT $(INCLUDES) $(SRC)>fluff
65
66depend:
67 @[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile...
68 $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
69
70dclean:
71 $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
72 mv -f Makefile.new $(MAKEFILE)
73
74clean:
75 rm -f *.o */*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
76
77# DO NOT DELETE THIS LINE -- make depend depends on it.
78
79str_err.o: ../../include/openssl/bio.h ../../include/openssl/crypto.h
80str_err.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
81str_err.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
82str_err.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
83str_err.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
84str_err.o: ../../include/openssl/store.h ../../include/openssl/symhacks.h
85str_err.o: str_err.c
86str_lib.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
87str_lib.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
88str_lib.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
89str_lib.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
90str_lib.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h
91str_lib.o: ../../include/openssl/err.h ../../include/openssl/evp.h
92str_lib.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
93str_lib.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
94str_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
95str_lib.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
96str_lib.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
97str_lib.o: ../../include/openssl/store.h ../../include/openssl/symhacks.h
98str_lib.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
99str_lib.o: str_lib.c str_locl.h
100str_mem.o: ../../include/openssl/bio.h ../../include/openssl/crypto.h
101str_mem.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
102str_mem.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
103str_mem.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
104str_mem.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
105str_mem.o: ../../include/openssl/store.h ../../include/openssl/symhacks.h
106str_mem.o: str_locl.h str_mem.c
107str_meth.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
108str_meth.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslconf.h
109str_meth.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
110str_meth.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
111str_meth.o: ../../include/openssl/store.h ../../include/openssl/symhacks.h
112str_meth.o: str_locl.h str_meth.c
diff --git a/src/lib/libcrypto/store/README b/src/lib/libcrypto/store/README
new file mode 100644
index 0000000000..966168f6a5
--- /dev/null
+++ b/src/lib/libcrypto/store/README
@@ -0,0 +1,95 @@
1The STORE type
2==============
3
4A STORE, as defined in this code section, is really a rather simple
5thing which stores objects and per-object associations to a number
6of attributes. What attributes are supported entirely depends on
7the particular implementation of a STORE. It has some support for
8generation of certain objects (for example, keys and CRLs).
9
10
11Supported object types
12----------------------
13
14For now, the objects that are supported are the following:
15
16X.509 certificate
17X.509 CRL
18private key
19public key
20number
21arbitrary (application) data
22
23The intention is that a STORE should be able to store everything
24needed by an application that wants a cert/key store, as well as
25the data a CA might need to store (this includes the serial number
26counter, which explains the support for numbers).
27
28
29Supported attribute types
30-------------------------
31
32For now, the following attributes are supported:
33
34Friendly Name - the value is a normal C string
35Key ID - the value is a 160 bit SHA1 hash
36Issuer Key ID - the value is a 160 bit SHA1 hash
37Subject Key ID - the value is a 160 bit SHA1 hash
38Issuer/Serial Hash - the value is a 160 bit SHA1 hash
39Issuer - the value is a X509_NAME
40Serial - the value is a BIGNUM
41Subject - the value is a X509_NAME
42Certificate Hash - the value is a 160 bit SHA1 hash
43Email - the value is a normal C string
44Filename - the value is a normal C string
45
46It is expected that these attributes should be enough to support
47the need from most, if not all, current applications. Applications
48that need to do certificate verification would typically use Subject
49Key ID, Issuer/Serial Hash or Subject to look up issuer certificates.
50S/MIME applications would typically use Email to look up recipient
51and signer certificates.
52
53There's added support for combined sets of attributes to search for,
54with the special OR attribute.
55
56
57Supported basic functionality
58-----------------------------
59
60The functions that are supported through the STORE type are these:
61
62generate_object - for example to generate keys and CRLs
63get_object - to look up one object
64 NOTE: this function is really rather
65 redundant and probably of lesser usage
66 than the list functions
67store_object - store an object and the attributes
68 associated with it
69modify_object - modify the attributes associated with
70 a specific object
71revoke_object - revoke an object
72 NOTE: this only marks an object as
73 invalid, it doesn't remove the object
74 from the database
75delete_object - remove an object from the database
76list_object - list objects associated with a given
77 set of attributes
78 NOTE: this is really four functions:
79 list_start, list_next, list_end and
80 list_endp
81update_store - update the internal data of the store
82lock_store - lock the store
83unlock_store - unlock the store
84
85The list functions need some extra explanation: list_start is
86used to set up a lookup. That's where the attributes to use in
87the search are set up. It returns a search context. list_next
88returns the next object searched for. list_end closes the search.
89list_endp is used to check if we have reached the end.
90
91A few words on the store functions as well: update_store is
92typically used by a CA application to update the internal
93structure of a database. This may for example involve automatic
94removal of expired certificates. lock_store and unlock_store
95are used for locking a store to allow exclusive writes.
diff --git a/src/lib/libcrypto/store/store.h b/src/lib/libcrypto/store/store.h
new file mode 100644
index 0000000000..0a28c7d5a2
--- /dev/null
+++ b/src/lib/libcrypto/store/store.h
@@ -0,0 +1,561 @@
1/* crypto/store/store.h -*- mode:C; c-file-style: "eay" -*- */
2/* Written by Richard Levitte (richard@levitte.org) for the OpenSSL
3 * project 2003.
4 */
5/* ====================================================================
6 * Copyright (c) 2003 The OpenSSL Project. All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 *
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 *
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in
17 * the documentation and/or other materials provided with the
18 * distribution.
19 *
20 * 3. All advertising materials mentioning features or use of this
21 * software must display the following acknowledgment:
22 * "This product includes software developed by the OpenSSL Project
23 * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
24 *
25 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
26 * endorse or promote products derived from this software without
27 * prior written permission. For written permission, please contact
28 * openssl-core@openssl.org.
29 *
30 * 5. Products derived from this software may not be called "OpenSSL"
31 * nor may "OpenSSL" appear in their names without prior written
32 * permission of the OpenSSL Project.
33 *
34 * 6. Redistributions of any form whatsoever must retain the following
35 * acknowledgment:
36 * "This product includes software developed by the OpenSSL Project
37 * for use in the OpenSSL Toolkit (http://www.openssl.org/)"
38 *
39 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
40 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
41 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
42 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
43 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
44 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
45 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
46 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
47 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
48 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
49 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50 * OF THE POSSIBILITY OF SUCH DAMAGE.
51 * ====================================================================
52 *
53 * This product includes cryptographic software written by Eric Young
54 * (eay@cryptsoft.com). This product includes software written by Tim
55 * Hudson (tjh@cryptsoft.com).
56 *
57 */
58
59#ifndef HEADER_STORE_H
60#define HEADER_STORE_H
61
62#include <openssl/opensslconf.h>
63
64#ifdef OPENSSL_NO_STORE
65#error STORE is disabled.
66#endif
67
68#include <openssl/ossl_typ.h>
69#ifndef OPENSSL_NO_DEPRECATED
70#include <openssl/evp.h>
71#include <openssl/bn.h>
72#include <openssl/x509.h>
73#endif
74
75#ifdef __cplusplus
76extern "C" {
77#endif
78
79/* Already defined in ossl_typ.h */
80/* typedef struct store_st STORE; */
81/* typedef struct store_method_st STORE_METHOD; */
82
83
84/* All the following functions return 0, a negative number or NULL on error.
85 When everything is fine, they return a positive value or a non-NULL
86 pointer, all depending on their purpose. */
87
88/* Creators and destructor. */
89STORE *STORE_new_method(const STORE_METHOD *method);
90STORE *STORE_new_engine(ENGINE *engine);
91void STORE_free(STORE *ui);
92
93
94/* Give a user interface parametrised control commands. This can be used to
95 send down an integer, a data pointer or a function pointer, as well as
96 be used to get information from a STORE. */
97int STORE_ctrl(STORE *store, int cmd, long i, void *p, void (*f)(void));
98
99/* A control to set the directory with keys and certificates. Used by the
100 built-in directory level method. */
101#define STORE_CTRL_SET_DIRECTORY 0x0001
102/* A control to set a file to load. Used by the built-in file level method. */
103#define STORE_CTRL_SET_FILE 0x0002
104/* A control to set a configuration file to load. Can be used by any method
105 that wishes to load a configuration file. */
106#define STORE_CTRL_SET_CONF_FILE 0x0003
107/* A control to set a the section of the loaded configuration file. Can be
108 used by any method that wishes to load a configuration file. */
109#define STORE_CTRL_SET_CONF_SECTION 0x0004
110
111
112/* Some methods may use extra data */
113#define STORE_set_app_data(s,arg) STORE_set_ex_data(s,0,arg)
114#define STORE_get_app_data(s) STORE_get_ex_data(s,0)
115int STORE_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,
116 CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);
117int STORE_set_ex_data(STORE *r,int idx,void *arg);
118void *STORE_get_ex_data(STORE *r, int idx);
119
120/* Use specific methods instead of the built-in one */
121const STORE_METHOD *STORE_get_method(STORE *store);
122const STORE_METHOD *STORE_set_method(STORE *store, const STORE_METHOD *meth);
123
124/* The standard OpenSSL methods. */
125/* This is the in-memory method. It does everything except revoking and updating,
126 and is of course volatile. It's used by other methods that have an in-memory
127 cache. */
128const STORE_METHOD *STORE_Memory(void);
129#if 0 /* Not yet implemented */
130/* This is the directory store. It does everything except revoking and updating,
131 and uses STORE_Memory() to cache things in memory. */
132const STORE_METHOD *STORE_Directory(void);
133/* This is the file store. It does everything except revoking and updating,
134 and uses STORE_Memory() to cache things in memory. Certificates are added
135 to it with the store operation, and it will only get cached certificates. */
136const STORE_METHOD *STORE_File(void);
137#endif
138
139/* Store functions take a type code for the type of data they should store
140 or fetch */
141typedef enum STORE_object_types
142 {
143 STORE_OBJECT_TYPE_X509_CERTIFICATE= 0x01, /* X509 * */
144 STORE_OBJECT_TYPE_X509_CRL= 0x02, /* X509_CRL * */
145 STORE_OBJECT_TYPE_PRIVATE_KEY= 0x03, /* EVP_PKEY * */
146 STORE_OBJECT_TYPE_PUBLIC_KEY= 0x04, /* EVP_PKEY * */
147 STORE_OBJECT_TYPE_NUMBER= 0x05, /* BIGNUM * */
148 STORE_OBJECT_TYPE_ARBITRARY= 0x06, /* BUF_MEM * */
149 STORE_OBJECT_TYPE_NUM= 0x06 /* The amount of known
150 object types */
151 } STORE_OBJECT_TYPES;
152/* List of text strings corresponding to the object types. */
153extern const char * const STORE_object_type_string[STORE_OBJECT_TYPE_NUM+1];
154
155/* Some store functions take a parameter list. Those parameters come with
156 one of the following codes. The comments following the codes below indicate
157 what type the value should be a pointer to. */
158typedef enum STORE_params
159 {
160 STORE_PARAM_EVP_TYPE= 0x01, /* int */
161 STORE_PARAM_BITS= 0x02, /* size_t */
162 STORE_PARAM_KEY_PARAMETERS= 0x03, /* ??? */
163 STORE_PARAM_KEY_NO_PARAMETERS= 0x04, /* N/A */
164 STORE_PARAM_AUTH_PASSPHRASE= 0x05, /* char * */
165 STORE_PARAM_AUTH_KRB5_TICKET= 0x06, /* void * */
166 STORE_PARAM_TYPE_NUM= 0x06 /* The amount of known
167 parameter types */
168 } STORE_PARAM_TYPES;
169/* Parameter value sizes. -1 means unknown, anything else is the required size. */
170extern const int STORE_param_sizes[STORE_PARAM_TYPE_NUM+1];
171
172/* Store functions take attribute lists. Those attributes come with codes.
173 The comments following the codes below indicate what type the value should
174 be a pointer to. */
175typedef enum STORE_attribs
176 {
177 STORE_ATTR_END= 0x00,
178 STORE_ATTR_FRIENDLYNAME= 0x01, /* C string */
179 STORE_ATTR_KEYID= 0x02, /* 160 bit string (SHA1) */
180 STORE_ATTR_ISSUERKEYID= 0x03, /* 160 bit string (SHA1) */
181 STORE_ATTR_SUBJECTKEYID= 0x04, /* 160 bit string (SHA1) */
182 STORE_ATTR_ISSUERSERIALHASH= 0x05, /* 160 bit string (SHA1) */
183 STORE_ATTR_ISSUER= 0x06, /* X509_NAME * */
184 STORE_ATTR_SERIAL= 0x07, /* BIGNUM * */
185 STORE_ATTR_SUBJECT= 0x08, /* X509_NAME * */
186 STORE_ATTR_CERTHASH= 0x09, /* 160 bit string (SHA1) */
187 STORE_ATTR_EMAIL= 0x0a, /* C string */
188 STORE_ATTR_FILENAME= 0x0b, /* C string */
189 STORE_ATTR_TYPE_NUM= 0x0b, /* The amount of known
190 attribute types */
191 STORE_ATTR_OR= 0xff /* This is a special
192 separator, which
193 expresses the OR
194 operation. */
195 } STORE_ATTR_TYPES;
196/* Attribute value sizes. -1 means unknown, anything else is the required size. */
197extern const int STORE_attr_sizes[STORE_ATTR_TYPE_NUM+1];
198
199typedef enum STORE_certificate_status
200 {
201 STORE_X509_VALID= 0x00,
202 STORE_X509_EXPIRED= 0x01,
203 STORE_X509_SUSPENDED= 0x02,
204 STORE_X509_REVOKED= 0x03
205 } STORE_CERTIFICATE_STATUS;
206
207/* Engine store functions will return a structure that contains all the necessary
208 * information, including revokation status for certificates. This is really not
209 * needed for application authors, as the ENGINE framework functions will extract
210 * the OpenSSL-specific information when at all possible. However, for engine
211 * authors, it's crucial to know this structure. */
212typedef struct STORE_OBJECT_st
213 {
214 STORE_OBJECT_TYPES type;
215 union
216 {
217 struct
218 {
219 STORE_CERTIFICATE_STATUS status;
220 X509 *certificate;
221 } x509;
222 X509_CRL *crl;
223 EVP_PKEY *key;
224 BIGNUM *number;
225 BUF_MEM *arbitrary;
226 } data;
227 } STORE_OBJECT;
228DECLARE_STACK_OF(STORE_OBJECT)
229STORE_OBJECT *STORE_OBJECT_new(void);
230void STORE_OBJECT_free(STORE_OBJECT *data);
231
232
233
234/* The following functions handle the storage. They return 0, a negative number
235 or NULL on error, anything else on success. */
236X509 *STORE_get_certificate(STORE *e, OPENSSL_ITEM attributes[],
237 OPENSSL_ITEM parameters[]);
238int STORE_store_certificate(STORE *e, X509 *data, OPENSSL_ITEM attributes[],
239 OPENSSL_ITEM parameters[]);
240int STORE_modify_certificate(STORE *e, OPENSSL_ITEM search_attributes[],
241 OPENSSL_ITEM add_attributes[], OPENSSL_ITEM modify_attributes[],
242 OPENSSL_ITEM delete_attributes[], OPENSSL_ITEM parameters[]);
243int STORE_revoke_certificate(STORE *e, OPENSSL_ITEM attributes[],
244 OPENSSL_ITEM parameters[]);
245int STORE_delete_certificate(STORE *e, OPENSSL_ITEM attributes[],
246 OPENSSL_ITEM parameters[]);
247void *STORE_list_certificate_start(STORE *e, OPENSSL_ITEM attributes[],
248 OPENSSL_ITEM parameters[]);
249X509 *STORE_list_certificate_next(STORE *e, void *handle);
250int STORE_list_certificate_end(STORE *e, void *handle);
251int STORE_list_certificate_endp(STORE *e, void *handle);
252EVP_PKEY *STORE_generate_key(STORE *e, OPENSSL_ITEM attributes[],
253 OPENSSL_ITEM parameters[]);
254EVP_PKEY *STORE_get_private_key(STORE *e, OPENSSL_ITEM attributes[],
255 OPENSSL_ITEM parameters[]);
256int STORE_store_private_key(STORE *e, EVP_PKEY *data,
257 OPENSSL_ITEM attributes[], OPENSSL_ITEM parameters[]);
258int STORE_modify_private_key(STORE *e, OPENSSL_ITEM search_attributes[],
259 OPENSSL_ITEM add_sttributes[], OPENSSL_ITEM modify_attributes[],
260 OPENSSL_ITEM delete_attributes[], OPENSSL_ITEM parameters[]);
261int STORE_revoke_private_key(STORE *e, OPENSSL_ITEM attributes[],
262 OPENSSL_ITEM parameters[]);
263int STORE_delete_private_key(STORE *e, OPENSSL_ITEM attributes[],
264 OPENSSL_ITEM parameters[]);
265void *STORE_list_private_key_start(STORE *e, OPENSSL_ITEM attributes[],
266 OPENSSL_ITEM parameters[]);
267EVP_PKEY *STORE_list_private_key_next(STORE *e, void *handle);
268int STORE_list_private_key_end(STORE *e, void *handle);
269int STORE_list_private_key_endp(STORE *e, void *handle);
270EVP_PKEY *STORE_get_public_key(STORE *e, OPENSSL_ITEM attributes[],
271 OPENSSL_ITEM parameters[]);
272int STORE_store_public_key(STORE *e, EVP_PKEY *data, OPENSSL_ITEM attributes[],
273 OPENSSL_ITEM parameters[]);
274int STORE_modify_public_key(STORE *e, OPENSSL_ITEM search_attributes[],
275 OPENSSL_ITEM add_sttributes[], OPENSSL_ITEM modify_attributes[],
276 OPENSSL_ITEM delete_attributes[], OPENSSL_ITEM parameters[]);
277int STORE_revoke_public_key(STORE *e, OPENSSL_ITEM attributes[],
278 OPENSSL_ITEM parameters[]);
279int STORE_delete_public_key(STORE *e, OPENSSL_ITEM attributes[],
280 OPENSSL_ITEM parameters[]);
281void *STORE_list_public_key_start(STORE *e, OPENSSL_ITEM attributes[],
282 OPENSSL_ITEM parameters[]);
283EVP_PKEY *STORE_list_public_key_next(STORE *e, void *handle);
284int STORE_list_public_key_end(STORE *e, void *handle);
285int STORE_list_public_key_endp(STORE *e, void *handle);
286X509_CRL *STORE_generate_crl(STORE *e, OPENSSL_ITEM attributes[],
287 OPENSSL_ITEM parameters[]);
288X509_CRL *STORE_get_crl(STORE *e, OPENSSL_ITEM attributes[],
289 OPENSSL_ITEM parameters[]);
290int STORE_store_crl(STORE *e, X509_CRL *data, OPENSSL_ITEM attributes[],
291 OPENSSL_ITEM parameters[]);
292int STORE_modify_crl(STORE *e, OPENSSL_ITEM search_attributes[],
293 OPENSSL_ITEM add_sttributes[], OPENSSL_ITEM modify_attributes[],
294 OPENSSL_ITEM delete_attributes[], OPENSSL_ITEM parameters[]);
295int STORE_delete_crl(STORE *e, OPENSSL_ITEM attributes[],
296 OPENSSL_ITEM parameters[]);
297void *STORE_list_crl_start(STORE *e, OPENSSL_ITEM attributes[],
298 OPENSSL_ITEM parameters[]);
299X509_CRL *STORE_list_crl_next(STORE *e, void *handle);
300int STORE_list_crl_end(STORE *e, void *handle);
301int STORE_list_crl_endp(STORE *e, void *handle);
302int STORE_store_number(STORE *e, BIGNUM *data, OPENSSL_ITEM attributes[],
303 OPENSSL_ITEM parameters[]);
304int STORE_modify_number(STORE *e, OPENSSL_ITEM search_attributes[],
305 OPENSSL_ITEM add_sttributes[], OPENSSL_ITEM modify_attributes[],
306 OPENSSL_ITEM delete_attributes[], OPENSSL_ITEM parameters[]);
307BIGNUM *STORE_get_number(STORE *e, OPENSSL_ITEM attributes[],
308 OPENSSL_ITEM parameters[]);
309int STORE_delete_number(STORE *e, OPENSSL_ITEM attributes[],
310 OPENSSL_ITEM parameters[]);
311int STORE_store_arbitrary(STORE *e, BUF_MEM *data, OPENSSL_ITEM attributes[],
312 OPENSSL_ITEM parameters[]);
313int STORE_modify_arbitrary(STORE *e, OPENSSL_ITEM search_attributes[],
314 OPENSSL_ITEM add_sttributes[], OPENSSL_ITEM modify_attributes[],
315 OPENSSL_ITEM delete_attributes[], OPENSSL_ITEM parameters[]);
316BUF_MEM *STORE_get_arbitrary(STORE *e, OPENSSL_ITEM attributes[],
317 OPENSSL_ITEM parameters[]);
318int STORE_delete_arbitrary(STORE *e, OPENSSL_ITEM attributes[],
319 OPENSSL_ITEM parameters[]);
320
321
322/* Create and manipulate methods */
323STORE_METHOD *STORE_create_method(char *name);
324void STORE_destroy_method(STORE_METHOD *store_method);
325
326/* These callback types are use for store handlers */
327typedef int (*STORE_INITIALISE_FUNC_PTR)(STORE *);
328typedef void (*STORE_CLEANUP_FUNC_PTR)(STORE *);
329typedef STORE_OBJECT *(*STORE_GENERATE_OBJECT_FUNC_PTR)(STORE *, STORE_OBJECT_TYPES type, OPENSSL_ITEM attributes[], OPENSSL_ITEM parameters[]);
330typedef STORE_OBJECT *(*STORE_GET_OBJECT_FUNC_PTR)(STORE *, STORE_OBJECT_TYPES type, OPENSSL_ITEM attributes[], OPENSSL_ITEM parameters[]);
331typedef void *(*STORE_START_OBJECT_FUNC_PTR)(STORE *, STORE_OBJECT_TYPES type, OPENSSL_ITEM attributes[], OPENSSL_ITEM parameters[]);
332typedef STORE_OBJECT *(*STORE_NEXT_OBJECT_FUNC_PTR)(STORE *, void *handle);
333typedef int (*STORE_END_OBJECT_FUNC_PTR)(STORE *, void *handle);
334typedef int (*STORE_HANDLE_OBJECT_FUNC_PTR)(STORE *, STORE_OBJECT_TYPES type, OPENSSL_ITEM attributes[], OPENSSL_ITEM parameters[]);
335typedef int (*STORE_STORE_OBJECT_FUNC_PTR)(STORE *, STORE_OBJECT_TYPES type, STORE_OBJECT *data, OPENSSL_ITEM attributes[], OPENSSL_ITEM parameters[]);
336typedef int (*STORE_MODIFY_OBJECT_FUNC_PTR)(STORE *, STORE_OBJECT_TYPES type, OPENSSL_ITEM search_attributes[], OPENSSL_ITEM add_attributes[], OPENSSL_ITEM modify_attributes[], OPENSSL_ITEM delete_attributes[], OPENSSL_ITEM parameters[]);
337typedef int (*STORE_GENERIC_FUNC_PTR)(STORE *, OPENSSL_ITEM attributes[], OPENSSL_ITEM parameters[]);
338typedef int (*STORE_CTRL_FUNC_PTR)(STORE *, int cmd, long l, void *p, void (*f)(void));
339
340int STORE_method_set_initialise_function(STORE_METHOD *sm, STORE_INITIALISE_FUNC_PTR init_f);
341int STORE_method_set_cleanup_function(STORE_METHOD *sm, STORE_CLEANUP_FUNC_PTR clean_f);
342int STORE_method_set_generate_function(STORE_METHOD *sm, STORE_GENERATE_OBJECT_FUNC_PTR generate_f);
343int STORE_method_set_get_function(STORE_METHOD *sm, STORE_GET_OBJECT_FUNC_PTR get_f);
344int STORE_method_set_store_function(STORE_METHOD *sm, STORE_STORE_OBJECT_FUNC_PTR store_f);
345int STORE_method_set_modify_function(STORE_METHOD *sm, STORE_MODIFY_OBJECT_FUNC_PTR store_f);
346int STORE_method_set_revoke_function(STORE_METHOD *sm, STORE_HANDLE_OBJECT_FUNC_PTR revoke_f);
347int STORE_method_set_delete_function(STORE_METHOD *sm, STORE_HANDLE_OBJECT_FUNC_PTR delete_f);
348int STORE_method_set_list_start_function(STORE_METHOD *sm, STORE_START_OBJECT_FUNC_PTR list_start_f);
349int STORE_method_set_list_next_function(STORE_METHOD *sm, STORE_NEXT_OBJECT_FUNC_PTR list_next_f);
350int STORE_method_set_list_end_function(STORE_METHOD *sm, STORE_END_OBJECT_FUNC_PTR list_end_f);
351int STORE_method_set_update_store_function(STORE_METHOD *sm, STORE_GENERIC_FUNC_PTR);
352int STORE_method_set_lock_store_function(STORE_METHOD *sm, STORE_GENERIC_FUNC_PTR);
353int STORE_method_set_unlock_store_function(STORE_METHOD *sm, STORE_GENERIC_FUNC_PTR);
354int STORE_method_set_ctrl_function(STORE_METHOD *sm, STORE_CTRL_FUNC_PTR ctrl_f);
355
356STORE_INITIALISE_FUNC_PTR STORE_method_get_initialise_function(STORE_METHOD *sm);
357STORE_CLEANUP_FUNC_PTR STORE_method_get_cleanup_function(STORE_METHOD *sm);
358STORE_GENERATE_OBJECT_FUNC_PTR STORE_method_get_generate_function(STORE_METHOD *sm);
359STORE_GET_OBJECT_FUNC_PTR STORE_method_get_get_function(STORE_METHOD *sm);
360STORE_STORE_OBJECT_FUNC_PTR STORE_method_get_store_function(STORE_METHOD *sm);
361STORE_MODIFY_OBJECT_FUNC_PTR STORE_method_get_modify_function(STORE_METHOD *sm);
362STORE_HANDLE_OBJECT_FUNC_PTR STORE_method_get_revoke_function(STORE_METHOD *sm);
363STORE_HANDLE_OBJECT_FUNC_PTR STORE_method_get_delete_function(STORE_METHOD *sm);
364STORE_START_OBJECT_FUNC_PTR STORE_method_get_list_start_function(STORE_METHOD *sm);
365STORE_NEXT_OBJECT_FUNC_PTR STORE_method_get_list_next_function(STORE_METHOD *sm);
366STORE_END_OBJECT_FUNC_PTR STORE_method_get_list_end_function(STORE_METHOD *sm);
367STORE_GENERIC_FUNC_PTR STORE_method_get_update_store_function(STORE_METHOD *sm);
368STORE_GENERIC_FUNC_PTR STORE_method_get_lock_store_function(STORE_METHOD *sm);
369STORE_GENERIC_FUNC_PTR STORE_method_get_unlock_store_function(STORE_METHOD *sm);
370STORE_CTRL_FUNC_PTR STORE_method_get_ctrl_function(STORE_METHOD *sm);
371
372/* Method helper structures and functions. */
373
374/* This structure is the result of parsing through the information in a list
375 of OPENSSL_ITEMs. It stores all the necessary information in a structured
376 way.*/
377typedef struct STORE_attr_info_st STORE_ATTR_INFO;
378
379/* Parse a list of OPENSSL_ITEMs and return a pointer to a STORE_ATTR_INFO.
380 Note that we do this in the list form, since the list of OPENSSL_ITEMs can
381 come in blocks separated with STORE_ATTR_OR. Note that the value returned
382 by STORE_parse_attrs_next() must be freed with STORE_ATTR_INFO_free(). */
383void *STORE_parse_attrs_start(OPENSSL_ITEM *attributes);
384STORE_ATTR_INFO *STORE_parse_attrs_next(void *handle);
385int STORE_parse_attrs_end(void *handle);
386int STORE_parse_attrs_endp(void *handle);
387
388/* Creator and destructor */
389STORE_ATTR_INFO *STORE_ATTR_INFO_new(void);
390int STORE_ATTR_INFO_free(STORE_ATTR_INFO *attrs);
391
392/* Manipulators */
393char *STORE_ATTR_INFO_get0_cstr(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code);
394unsigned char *STORE_ATTR_INFO_get0_sha1str(STORE_ATTR_INFO *attrs,
395 STORE_ATTR_TYPES code);
396X509_NAME *STORE_ATTR_INFO_get0_dn(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code);
397BIGNUM *STORE_ATTR_INFO_get0_number(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code);
398int STORE_ATTR_INFO_set_cstr(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code,
399 char *cstr, size_t cstr_size);
400int STORE_ATTR_INFO_set_sha1str(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code,
401 unsigned char *sha1str, size_t sha1str_size);
402int STORE_ATTR_INFO_set_dn(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code,
403 X509_NAME *dn);
404int STORE_ATTR_INFO_set_number(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code,
405 BIGNUM *number);
406int STORE_ATTR_INFO_modify_cstr(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code,
407 char *cstr, size_t cstr_size);
408int STORE_ATTR_INFO_modify_sha1str(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code,
409 unsigned char *sha1str, size_t sha1str_size);
410int STORE_ATTR_INFO_modify_dn(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code,
411 X509_NAME *dn);
412int STORE_ATTR_INFO_modify_number(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code,
413 BIGNUM *number);
414
415/* Compare on basis of a bit pattern formed by the STORE_ATTR_TYPES values
416 in each contained attribute. */
417int STORE_ATTR_INFO_compare(const STORE_ATTR_INFO * const *a,
418 const STORE_ATTR_INFO * const *b);
419/* Check if the set of attributes in a is within the range of attributes
420 set in b. */
421int STORE_ATTR_INFO_in_range(STORE_ATTR_INFO *a, STORE_ATTR_INFO *b);
422/* Check if the set of attributes in a are also set in b. */
423int STORE_ATTR_INFO_in(STORE_ATTR_INFO *a, STORE_ATTR_INFO *b);
424/* Same as STORE_ATTR_INFO_in(), but also checks the attribute values. */
425int STORE_ATTR_INFO_in_ex(STORE_ATTR_INFO *a, STORE_ATTR_INFO *b);
426
427
428/* BEGIN ERROR CODES */
429/* The following lines are auto generated by the script mkerr.pl. Any changes
430 * made after this point may be overwritten when the script is next run.
431 */
432void ERR_load_STORE_strings(void);
433
434/* Error codes for the STORE functions. */
435
436/* Function codes. */
437#define STORE_F_MEM_DELETE 134
438#define STORE_F_MEM_GENERATE 135
439#define STORE_F_MEM_LIST_END 168
440#define STORE_F_MEM_LIST_NEXT 136
441#define STORE_F_MEM_LIST_START 137
442#define STORE_F_MEM_MODIFY 169
443#define STORE_F_MEM_STORE 138
444#define STORE_F_STORE_ATTR_INFO_GET0_CSTR 139
445#define STORE_F_STORE_ATTR_INFO_GET0_DN 140
446#define STORE_F_STORE_ATTR_INFO_GET0_NUMBER 141
447#define STORE_F_STORE_ATTR_INFO_GET0_SHA1STR 142
448#define STORE_F_STORE_ATTR_INFO_MODIFY_CSTR 143
449#define STORE_F_STORE_ATTR_INFO_MODIFY_DN 144
450#define STORE_F_STORE_ATTR_INFO_MODIFY_NUMBER 145
451#define STORE_F_STORE_ATTR_INFO_MODIFY_SHA1STR 146
452#define STORE_F_STORE_ATTR_INFO_SET_CSTR 147
453#define STORE_F_STORE_ATTR_INFO_SET_DN 148
454#define STORE_F_STORE_ATTR_INFO_SET_NUMBER 149
455#define STORE_F_STORE_ATTR_INFO_SET_SHA1STR 150
456#define STORE_F_STORE_CERTIFICATE 170
457#define STORE_F_STORE_CTRL 161
458#define STORE_F_STORE_DELETE_ARBITRARY 158
459#define STORE_F_STORE_DELETE_CERTIFICATE 102
460#define STORE_F_STORE_DELETE_CRL 103
461#define STORE_F_STORE_DELETE_NUMBER 104
462#define STORE_F_STORE_DELETE_PRIVATE_KEY 105
463#define STORE_F_STORE_DELETE_PUBLIC_KEY 106
464#define STORE_F_STORE_GENERATE_CRL 107
465#define STORE_F_STORE_GENERATE_KEY 108
466#define STORE_F_STORE_GET_ARBITRARY 159
467#define STORE_F_STORE_GET_CERTIFICATE 109
468#define STORE_F_STORE_GET_CRL 110
469#define STORE_F_STORE_GET_NUMBER 111
470#define STORE_F_STORE_GET_PRIVATE_KEY 112
471#define STORE_F_STORE_GET_PUBLIC_KEY 113
472#define STORE_F_STORE_LIST_CERTIFICATE_END 114
473#define STORE_F_STORE_LIST_CERTIFICATE_ENDP 153
474#define STORE_F_STORE_LIST_CERTIFICATE_NEXT 115
475#define STORE_F_STORE_LIST_CERTIFICATE_START 116
476#define STORE_F_STORE_LIST_CRL_END 117
477#define STORE_F_STORE_LIST_CRL_ENDP 154
478#define STORE_F_STORE_LIST_CRL_NEXT 118
479#define STORE_F_STORE_LIST_CRL_START 119
480#define STORE_F_STORE_LIST_PRIVATE_KEY_END 120
481#define STORE_F_STORE_LIST_PRIVATE_KEY_ENDP 155
482#define STORE_F_STORE_LIST_PRIVATE_KEY_NEXT 121
483#define STORE_F_STORE_LIST_PRIVATE_KEY_START 122
484#define STORE_F_STORE_LIST_PUBLIC_KEY_END 123
485#define STORE_F_STORE_LIST_PUBLIC_KEY_ENDP 156
486#define STORE_F_STORE_LIST_PUBLIC_KEY_NEXT 124
487#define STORE_F_STORE_LIST_PUBLIC_KEY_START 125
488#define STORE_F_STORE_MODIFY_ARBITRARY 162
489#define STORE_F_STORE_MODIFY_CERTIFICATE 163
490#define STORE_F_STORE_MODIFY_CRL 164
491#define STORE_F_STORE_MODIFY_NUMBER 165
492#define STORE_F_STORE_MODIFY_PRIVATE_KEY 166
493#define STORE_F_STORE_MODIFY_PUBLIC_KEY 167
494#define STORE_F_STORE_NEW_ENGINE 133
495#define STORE_F_STORE_NEW_METHOD 132
496#define STORE_F_STORE_PARSE_ATTRS_END 151
497#define STORE_F_STORE_PARSE_ATTRS_ENDP 172
498#define STORE_F_STORE_PARSE_ATTRS_NEXT 152
499#define STORE_F_STORE_PARSE_ATTRS_START 171
500#define STORE_F_STORE_REVOKE_CERTIFICATE 129
501#define STORE_F_STORE_REVOKE_PRIVATE_KEY 130
502#define STORE_F_STORE_REVOKE_PUBLIC_KEY 131
503#define STORE_F_STORE_STORE_ARBITRARY 157
504#define STORE_F_STORE_STORE_CERTIFICATE 100
505#define STORE_F_STORE_STORE_CRL 101
506#define STORE_F_STORE_STORE_NUMBER 126
507#define STORE_F_STORE_STORE_PRIVATE_KEY 127
508#define STORE_F_STORE_STORE_PUBLIC_KEY 128
509
510/* Reason codes. */
511#define STORE_R_ALREADY_HAS_A_VALUE 127
512#define STORE_R_FAILED_DELETING_ARBITRARY 132
513#define STORE_R_FAILED_DELETING_CERTIFICATE 100
514#define STORE_R_FAILED_DELETING_KEY 101
515#define STORE_R_FAILED_DELETING_NUMBER 102
516#define STORE_R_FAILED_GENERATING_CRL 103
517#define STORE_R_FAILED_GENERATING_KEY 104
518#define STORE_R_FAILED_GETTING_ARBITRARY 133
519#define STORE_R_FAILED_GETTING_CERTIFICATE 105
520#define STORE_R_FAILED_GETTING_KEY 106
521#define STORE_R_FAILED_GETTING_NUMBER 107
522#define STORE_R_FAILED_LISTING_CERTIFICATES 108
523#define STORE_R_FAILED_LISTING_KEYS 109
524#define STORE_R_FAILED_MODIFYING_ARBITRARY 138
525#define STORE_R_FAILED_MODIFYING_CERTIFICATE 139
526#define STORE_R_FAILED_MODIFYING_CRL 140
527#define STORE_R_FAILED_MODIFYING_NUMBER 141
528#define STORE_R_FAILED_MODIFYING_PRIVATE_KEY 142
529#define STORE_R_FAILED_MODIFYING_PUBLIC_KEY 143
530#define STORE_R_FAILED_REVOKING_CERTIFICATE 110
531#define STORE_R_FAILED_REVOKING_KEY 111
532#define STORE_R_FAILED_STORING_ARBITRARY 134
533#define STORE_R_FAILED_STORING_CERTIFICATE 112
534#define STORE_R_FAILED_STORING_KEY 113
535#define STORE_R_FAILED_STORING_NUMBER 114
536#define STORE_R_NOT_IMPLEMENTED 128
537#define STORE_R_NO_CONTROL_FUNCTION 144
538#define STORE_R_NO_DELETE_ARBITRARY_FUNCTION 135
539#define STORE_R_NO_DELETE_NUMBER_FUNCTION 115
540#define STORE_R_NO_DELETE_OBJECT_FUNCTION 116
541#define STORE_R_NO_GENERATE_CRL_FUNCTION 117
542#define STORE_R_NO_GENERATE_OBJECT_FUNCTION 118
543#define STORE_R_NO_GET_OBJECT_ARBITRARY_FUNCTION 136
544#define STORE_R_NO_GET_OBJECT_FUNCTION 119
545#define STORE_R_NO_GET_OBJECT_NUMBER_FUNCTION 120
546#define STORE_R_NO_LIST_OBJECT_ENDP_FUNCTION 131
547#define STORE_R_NO_LIST_OBJECT_END_FUNCTION 121
548#define STORE_R_NO_LIST_OBJECT_NEXT_FUNCTION 122
549#define STORE_R_NO_LIST_OBJECT_START_FUNCTION 123
550#define STORE_R_NO_MODIFY_OBJECT_FUNCTION 145
551#define STORE_R_NO_REVOKE_OBJECT_FUNCTION 124
552#define STORE_R_NO_STORE 129
553#define STORE_R_NO_STORE_OBJECT_ARBITRARY_FUNCTION 137
554#define STORE_R_NO_STORE_OBJECT_FUNCTION 125
555#define STORE_R_NO_STORE_OBJECT_NUMBER_FUNCTION 126
556#define STORE_R_NO_VALUE 130
557
558#ifdef __cplusplus
559}
560#endif
561#endif
diff --git a/src/lib/libcrypto/store/str_err.c b/src/lib/libcrypto/store/str_err.c
new file mode 100644
index 0000000000..924edf0505
--- /dev/null
+++ b/src/lib/libcrypto/store/str_err.c
@@ -0,0 +1,211 @@
1/* crypto/store/str_err.c */
2/* ====================================================================
3 * Copyright (c) 1999-2006 The OpenSSL Project. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 *
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in
14 * the documentation and/or other materials provided with the
15 * distribution.
16 *
17 * 3. All advertising materials mentioning features or use of this
18 * software must display the following acknowledgment:
19 * "This product includes software developed by the OpenSSL Project
20 * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
21 *
22 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
23 * endorse or promote products derived from this software without
24 * prior written permission. For written permission, please contact
25 * openssl-core@OpenSSL.org.
26 *
27 * 5. Products derived from this software may not be called "OpenSSL"
28 * nor may "OpenSSL" appear in their names without prior written
29 * permission of the OpenSSL Project.
30 *
31 * 6. Redistributions of any form whatsoever must retain the following
32 * acknowledgment:
33 * "This product includes software developed by the OpenSSL Project
34 * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
35 *
36 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
37 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
38 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
39 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
40 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
41 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
42 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
43 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
44 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
45 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
46 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
47 * OF THE POSSIBILITY OF SUCH DAMAGE.
48 * ====================================================================
49 *
50 * This product includes cryptographic software written by Eric Young
51 * (eay@cryptsoft.com). This product includes software written by Tim
52 * Hudson (tjh@cryptsoft.com).
53 *
54 */
55
56/* NOTE: this file was auto generated by the mkerr.pl script: any changes
57 * made to it will be overwritten when the script next updates this file,
58 * only reason strings will be preserved.
59 */
60
61#include <stdio.h>
62#include <openssl/err.h>
63#include <openssl/store.h>
64
65/* BEGIN ERROR CODES */
66#ifndef OPENSSL_NO_ERR
67
68#define ERR_FUNC(func) ERR_PACK(ERR_LIB_STORE,func,0)
69#define ERR_REASON(reason) ERR_PACK(ERR_LIB_STORE,0,reason)
70
71static ERR_STRING_DATA STORE_str_functs[]=
72 {
73{ERR_FUNC(STORE_F_MEM_DELETE), "MEM_DELETE"},
74{ERR_FUNC(STORE_F_MEM_GENERATE), "MEM_GENERATE"},
75{ERR_FUNC(STORE_F_MEM_LIST_END), "MEM_LIST_END"},
76{ERR_FUNC(STORE_F_MEM_LIST_NEXT), "MEM_LIST_NEXT"},
77{ERR_FUNC(STORE_F_MEM_LIST_START), "MEM_LIST_START"},
78{ERR_FUNC(STORE_F_MEM_MODIFY), "MEM_MODIFY"},
79{ERR_FUNC(STORE_F_MEM_STORE), "MEM_STORE"},
80{ERR_FUNC(STORE_F_STORE_ATTR_INFO_GET0_CSTR), "STORE_ATTR_INFO_get0_cstr"},
81{ERR_FUNC(STORE_F_STORE_ATTR_INFO_GET0_DN), "STORE_ATTR_INFO_get0_dn"},
82{ERR_FUNC(STORE_F_STORE_ATTR_INFO_GET0_NUMBER), "STORE_ATTR_INFO_get0_number"},
83{ERR_FUNC(STORE_F_STORE_ATTR_INFO_GET0_SHA1STR), "STORE_ATTR_INFO_get0_sha1str"},
84{ERR_FUNC(STORE_F_STORE_ATTR_INFO_MODIFY_CSTR), "STORE_ATTR_INFO_modify_cstr"},
85{ERR_FUNC(STORE_F_STORE_ATTR_INFO_MODIFY_DN), "STORE_ATTR_INFO_modify_dn"},
86{ERR_FUNC(STORE_F_STORE_ATTR_INFO_MODIFY_NUMBER), "STORE_ATTR_INFO_modify_number"},
87{ERR_FUNC(STORE_F_STORE_ATTR_INFO_MODIFY_SHA1STR), "STORE_ATTR_INFO_modify_sha1str"},
88{ERR_FUNC(STORE_F_STORE_ATTR_INFO_SET_CSTR), "STORE_ATTR_INFO_set_cstr"},
89{ERR_FUNC(STORE_F_STORE_ATTR_INFO_SET_DN), "STORE_ATTR_INFO_set_dn"},
90{ERR_FUNC(STORE_F_STORE_ATTR_INFO_SET_NUMBER), "STORE_ATTR_INFO_set_number"},
91{ERR_FUNC(STORE_F_STORE_ATTR_INFO_SET_SHA1STR), "STORE_ATTR_INFO_set_sha1str"},
92{ERR_FUNC(STORE_F_STORE_CERTIFICATE), "STORE_CERTIFICATE"},
93{ERR_FUNC(STORE_F_STORE_CTRL), "STORE_ctrl"},
94{ERR_FUNC(STORE_F_STORE_DELETE_ARBITRARY), "STORE_delete_arbitrary"},
95{ERR_FUNC(STORE_F_STORE_DELETE_CERTIFICATE), "STORE_delete_certificate"},
96{ERR_FUNC(STORE_F_STORE_DELETE_CRL), "STORE_delete_crl"},
97{ERR_FUNC(STORE_F_STORE_DELETE_NUMBER), "STORE_delete_number"},
98{ERR_FUNC(STORE_F_STORE_DELETE_PRIVATE_KEY), "STORE_delete_private_key"},
99{ERR_FUNC(STORE_F_STORE_DELETE_PUBLIC_KEY), "STORE_delete_public_key"},
100{ERR_FUNC(STORE_F_STORE_GENERATE_CRL), "STORE_generate_crl"},
101{ERR_FUNC(STORE_F_STORE_GENERATE_KEY), "STORE_generate_key"},
102{ERR_FUNC(STORE_F_STORE_GET_ARBITRARY), "STORE_get_arbitrary"},
103{ERR_FUNC(STORE_F_STORE_GET_CERTIFICATE), "STORE_get_certificate"},
104{ERR_FUNC(STORE_F_STORE_GET_CRL), "STORE_get_crl"},
105{ERR_FUNC(STORE_F_STORE_GET_NUMBER), "STORE_get_number"},
106{ERR_FUNC(STORE_F_STORE_GET_PRIVATE_KEY), "STORE_get_private_key"},
107{ERR_FUNC(STORE_F_STORE_GET_PUBLIC_KEY), "STORE_get_public_key"},
108{ERR_FUNC(STORE_F_STORE_LIST_CERTIFICATE_END), "STORE_list_certificate_end"},
109{ERR_FUNC(STORE_F_STORE_LIST_CERTIFICATE_ENDP), "STORE_list_certificate_endp"},
110{ERR_FUNC(STORE_F_STORE_LIST_CERTIFICATE_NEXT), "STORE_list_certificate_next"},
111{ERR_FUNC(STORE_F_STORE_LIST_CERTIFICATE_START), "STORE_list_certificate_start"},
112{ERR_FUNC(STORE_F_STORE_LIST_CRL_END), "STORE_list_crl_end"},
113{ERR_FUNC(STORE_F_STORE_LIST_CRL_ENDP), "STORE_list_crl_endp"},
114{ERR_FUNC(STORE_F_STORE_LIST_CRL_NEXT), "STORE_list_crl_next"},
115{ERR_FUNC(STORE_F_STORE_LIST_CRL_START), "STORE_list_crl_start"},
116{ERR_FUNC(STORE_F_STORE_LIST_PRIVATE_KEY_END), "STORE_list_private_key_end"},
117{ERR_FUNC(STORE_F_STORE_LIST_PRIVATE_KEY_ENDP), "STORE_list_private_key_endp"},
118{ERR_FUNC(STORE_F_STORE_LIST_PRIVATE_KEY_NEXT), "STORE_list_private_key_next"},
119{ERR_FUNC(STORE_F_STORE_LIST_PRIVATE_KEY_START), "STORE_list_private_key_start"},
120{ERR_FUNC(STORE_F_STORE_LIST_PUBLIC_KEY_END), "STORE_list_public_key_end"},
121{ERR_FUNC(STORE_F_STORE_LIST_PUBLIC_KEY_ENDP), "STORE_list_public_key_endp"},
122{ERR_FUNC(STORE_F_STORE_LIST_PUBLIC_KEY_NEXT), "STORE_list_public_key_next"},
123{ERR_FUNC(STORE_F_STORE_LIST_PUBLIC_KEY_START), "STORE_list_public_key_start"},
124{ERR_FUNC(STORE_F_STORE_MODIFY_ARBITRARY), "STORE_modify_arbitrary"},
125{ERR_FUNC(STORE_F_STORE_MODIFY_CERTIFICATE), "STORE_modify_certificate"},
126{ERR_FUNC(STORE_F_STORE_MODIFY_CRL), "STORE_modify_crl"},
127{ERR_FUNC(STORE_F_STORE_MODIFY_NUMBER), "STORE_modify_number"},
128{ERR_FUNC(STORE_F_STORE_MODIFY_PRIVATE_KEY), "STORE_modify_private_key"},
129{ERR_FUNC(STORE_F_STORE_MODIFY_PUBLIC_KEY), "STORE_modify_public_key"},
130{ERR_FUNC(STORE_F_STORE_NEW_ENGINE), "STORE_new_engine"},
131{ERR_FUNC(STORE_F_STORE_NEW_METHOD), "STORE_new_method"},
132{ERR_FUNC(STORE_F_STORE_PARSE_ATTRS_END), "STORE_parse_attrs_end"},
133{ERR_FUNC(STORE_F_STORE_PARSE_ATTRS_ENDP), "STORE_parse_attrs_endp"},
134{ERR_FUNC(STORE_F_STORE_PARSE_ATTRS_NEXT), "STORE_parse_attrs_next"},
135{ERR_FUNC(STORE_F_STORE_PARSE_ATTRS_START), "STORE_parse_attrs_start"},
136{ERR_FUNC(STORE_F_STORE_REVOKE_CERTIFICATE), "STORE_revoke_certificate"},
137{ERR_FUNC(STORE_F_STORE_REVOKE_PRIVATE_KEY), "STORE_revoke_private_key"},
138{ERR_FUNC(STORE_F_STORE_REVOKE_PUBLIC_KEY), "STORE_revoke_public_key"},
139{ERR_FUNC(STORE_F_STORE_STORE_ARBITRARY), "STORE_store_arbitrary"},
140{ERR_FUNC(STORE_F_STORE_STORE_CERTIFICATE), "STORE_store_certificate"},
141{ERR_FUNC(STORE_F_STORE_STORE_CRL), "STORE_store_crl"},
142{ERR_FUNC(STORE_F_STORE_STORE_NUMBER), "STORE_store_number"},
143{ERR_FUNC(STORE_F_STORE_STORE_PRIVATE_KEY), "STORE_store_private_key"},
144{ERR_FUNC(STORE_F_STORE_STORE_PUBLIC_KEY), "STORE_store_public_key"},
145{0,NULL}
146 };
147
148static ERR_STRING_DATA STORE_str_reasons[]=
149 {
150{ERR_REASON(STORE_R_ALREADY_HAS_A_VALUE) ,"already has a value"},
151{ERR_REASON(STORE_R_FAILED_DELETING_ARBITRARY),"failed deleting arbitrary"},
152{ERR_REASON(STORE_R_FAILED_DELETING_CERTIFICATE),"failed deleting certificate"},
153{ERR_REASON(STORE_R_FAILED_DELETING_KEY) ,"failed deleting key"},
154{ERR_REASON(STORE_R_FAILED_DELETING_NUMBER),"failed deleting number"},
155{ERR_REASON(STORE_R_FAILED_GENERATING_CRL),"failed generating crl"},
156{ERR_REASON(STORE_R_FAILED_GENERATING_KEY),"failed generating key"},
157{ERR_REASON(STORE_R_FAILED_GETTING_ARBITRARY),"failed getting arbitrary"},
158{ERR_REASON(STORE_R_FAILED_GETTING_CERTIFICATE),"failed getting certificate"},
159{ERR_REASON(STORE_R_FAILED_GETTING_KEY) ,"failed getting key"},
160{ERR_REASON(STORE_R_FAILED_GETTING_NUMBER),"failed getting number"},
161{ERR_REASON(STORE_R_FAILED_LISTING_CERTIFICATES),"failed listing certificates"},
162{ERR_REASON(STORE_R_FAILED_LISTING_KEYS) ,"failed listing keys"},
163{ERR_REASON(STORE_R_FAILED_MODIFYING_ARBITRARY),"failed modifying arbitrary"},
164{ERR_REASON(STORE_R_FAILED_MODIFYING_CERTIFICATE),"failed modifying certificate"},
165{ERR_REASON(STORE_R_FAILED_MODIFYING_CRL),"failed modifying crl"},
166{ERR_REASON(STORE_R_FAILED_MODIFYING_NUMBER),"failed modifying number"},
167{ERR_REASON(STORE_R_FAILED_MODIFYING_PRIVATE_KEY),"failed modifying private key"},
168{ERR_REASON(STORE_R_FAILED_MODIFYING_PUBLIC_KEY),"failed modifying public key"},
169{ERR_REASON(STORE_R_FAILED_REVOKING_CERTIFICATE),"failed revoking certificate"},
170{ERR_REASON(STORE_R_FAILED_REVOKING_KEY) ,"failed revoking key"},
171{ERR_REASON(STORE_R_FAILED_STORING_ARBITRARY),"failed storing arbitrary"},
172{ERR_REASON(STORE_R_FAILED_STORING_CERTIFICATE),"failed storing certificate"},
173{ERR_REASON(STORE_R_FAILED_STORING_KEY) ,"failed storing key"},
174{ERR_REASON(STORE_R_FAILED_STORING_NUMBER),"failed storing number"},
175{ERR_REASON(STORE_R_NOT_IMPLEMENTED) ,"not implemented"},
176{ERR_REASON(STORE_R_NO_CONTROL_FUNCTION) ,"no control function"},
177{ERR_REASON(STORE_R_NO_DELETE_ARBITRARY_FUNCTION),"no delete arbitrary function"},
178{ERR_REASON(STORE_R_NO_DELETE_NUMBER_FUNCTION),"no delete number function"},
179{ERR_REASON(STORE_R_NO_DELETE_OBJECT_FUNCTION),"no delete object function"},
180{ERR_REASON(STORE_R_NO_GENERATE_CRL_FUNCTION),"no generate crl function"},
181{ERR_REASON(STORE_R_NO_GENERATE_OBJECT_FUNCTION),"no generate object function"},
182{ERR_REASON(STORE_R_NO_GET_OBJECT_ARBITRARY_FUNCTION),"no get object arbitrary function"},
183{ERR_REASON(STORE_R_NO_GET_OBJECT_FUNCTION),"no get object function"},
184{ERR_REASON(STORE_R_NO_GET_OBJECT_NUMBER_FUNCTION),"no get object number function"},
185{ERR_REASON(STORE_R_NO_LIST_OBJECT_ENDP_FUNCTION),"no list object endp function"},
186{ERR_REASON(STORE_R_NO_LIST_OBJECT_END_FUNCTION),"no list object end function"},
187{ERR_REASON(STORE_R_NO_LIST_OBJECT_NEXT_FUNCTION),"no list object next function"},
188{ERR_REASON(STORE_R_NO_LIST_OBJECT_START_FUNCTION),"no list object start function"},
189{ERR_REASON(STORE_R_NO_MODIFY_OBJECT_FUNCTION),"no modify object function"},
190{ERR_REASON(STORE_R_NO_REVOKE_OBJECT_FUNCTION),"no revoke object function"},
191{ERR_REASON(STORE_R_NO_STORE) ,"no store"},
192{ERR_REASON(STORE_R_NO_STORE_OBJECT_ARBITRARY_FUNCTION),"no store object arbitrary function"},
193{ERR_REASON(STORE_R_NO_STORE_OBJECT_FUNCTION),"no store object function"},
194{ERR_REASON(STORE_R_NO_STORE_OBJECT_NUMBER_FUNCTION),"no store object number function"},
195{ERR_REASON(STORE_R_NO_VALUE) ,"no value"},
196{0,NULL}
197 };
198
199#endif
200
201void ERR_load_STORE_strings(void)
202 {
203#ifndef OPENSSL_NO_ERR
204
205 if (ERR_func_error_string(STORE_str_functs[0].error) == NULL)
206 {
207 ERR_load_strings(0,STORE_str_functs);
208 ERR_load_strings(0,STORE_str_reasons);
209 }
210#endif
211 }
diff --git a/src/lib/libcrypto/store/str_lib.c b/src/lib/libcrypto/store/str_lib.c
new file mode 100644
index 0000000000..f1dbcbd0e0
--- /dev/null
+++ b/src/lib/libcrypto/store/str_lib.c
@@ -0,0 +1,1828 @@
1/* crypto/store/str_lib.c -*- mode:C; c-file-style: "eay" -*- */
2/* Written by Richard Levitte (richard@levitte.org) for the OpenSSL
3 * project 2003.
4 */
5/* ====================================================================
6 * Copyright (c) 2003 The OpenSSL Project. All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 *
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 *
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in
17 * the documentation and/or other materials provided with the
18 * distribution.
19 *
20 * 3. All advertising materials mentioning features or use of this
21 * software must display the following acknowledgment:
22 * "This product includes software developed by the OpenSSL Project
23 * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
24 *
25 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
26 * endorse or promote products derived from this software without
27 * prior written permission. For written permission, please contact
28 * openssl-core@openssl.org.
29 *
30 * 5. Products derived from this software may not be called "OpenSSL"
31 * nor may "OpenSSL" appear in their names without prior written
32 * permission of the OpenSSL Project.
33 *
34 * 6. Redistributions of any form whatsoever must retain the following
35 * acknowledgment:
36 * "This product includes software developed by the OpenSSL Project
37 * for use in the OpenSSL Toolkit (http://www.openssl.org/)"
38 *
39 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
40 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
41 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
42 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
43 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
44 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
45 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
46 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
47 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
48 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
49 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50 * OF THE POSSIBILITY OF SUCH DAMAGE.
51 * ====================================================================
52 *
53 * This product includes cryptographic software written by Eric Young
54 * (eay@cryptsoft.com). This product includes software written by Tim
55 * Hudson (tjh@cryptsoft.com).
56 *
57 */
58
59#include <string.h>
60#include <openssl/bn.h>
61#include <openssl/err.h>
62#ifndef OPENSSL_NO_ENGINE
63#include <openssl/engine.h>
64#endif
65#include <openssl/sha.h>
66#include <openssl/x509.h>
67#include "str_locl.h"
68
69const char * const STORE_object_type_string[STORE_OBJECT_TYPE_NUM+1] =
70 {
71 0,
72 "X.509 Certificate",
73 "X.509 CRL",
74 "Private Key",
75 "Public Key",
76 "Number",
77 "Arbitrary Data"
78 };
79
80const int STORE_param_sizes[STORE_PARAM_TYPE_NUM+1] =
81 {
82 0,
83 sizeof(int), /* EVP_TYPE */
84 sizeof(size_t), /* BITS */
85 -1, /* KEY_PARAMETERS */
86 0 /* KEY_NO_PARAMETERS */
87 };
88
89const int STORE_attr_sizes[STORE_ATTR_TYPE_NUM+1] =
90 {
91 0,
92 -1, /* FRIENDLYNAME: C string */
93 SHA_DIGEST_LENGTH, /* KEYID: SHA1 digest, 160 bits */
94 SHA_DIGEST_LENGTH, /* ISSUERKEYID: SHA1 digest, 160 bits */
95 SHA_DIGEST_LENGTH, /* SUBJECTKEYID: SHA1 digest, 160 bits */
96 SHA_DIGEST_LENGTH, /* ISSUERSERIALHASH: SHA1 digest, 160 bits */
97 sizeof(X509_NAME *), /* ISSUER: X509_NAME * */
98 sizeof(BIGNUM *), /* SERIAL: BIGNUM * */
99 sizeof(X509_NAME *), /* SUBJECT: X509_NAME * */
100 SHA_DIGEST_LENGTH, /* CERTHASH: SHA1 digest, 160 bits */
101 -1, /* EMAIL: C string */
102 -1, /* FILENAME: C string */
103 };
104
105STORE *STORE_new_method(const STORE_METHOD *method)
106 {
107 STORE *ret;
108
109 if (method == NULL)
110 {
111 STOREerr(STORE_F_STORE_NEW_METHOD,ERR_R_PASSED_NULL_PARAMETER);
112 return NULL;
113 }
114
115 ret=(STORE *)OPENSSL_malloc(sizeof(STORE));
116 if (ret == NULL)
117 {
118 STOREerr(STORE_F_STORE_NEW_METHOD,ERR_R_MALLOC_FAILURE);
119 return NULL;
120 }
121
122 ret->meth=method;
123
124 CRYPTO_new_ex_data(CRYPTO_EX_INDEX_STORE, ret, &ret->ex_data);
125 if (ret->meth->init && !ret->meth->init(ret))
126 {
127 STORE_free(ret);
128 ret = NULL;
129 }
130 return ret;
131 }
132
133STORE *STORE_new_engine(ENGINE *engine)
134 {
135 STORE *ret = NULL;
136 ENGINE *e = engine;
137 const STORE_METHOD *meth = 0;
138
139#ifdef OPENSSL_NO_ENGINE
140 e = NULL;
141#else
142 if (engine)
143 {
144 if (!ENGINE_init(engine))
145 {
146 STOREerr(STORE_F_STORE_NEW_ENGINE, ERR_R_ENGINE_LIB);
147 return NULL;
148 }
149 e = engine;
150 }
151 else
152 {
153 STOREerr(STORE_F_STORE_NEW_ENGINE,ERR_R_PASSED_NULL_PARAMETER);
154 return NULL;
155 }
156 if(e)
157 {
158 meth = ENGINE_get_STORE(e);
159 if(!meth)
160 {
161 STOREerr(STORE_F_STORE_NEW_ENGINE,
162 ERR_R_ENGINE_LIB);
163 ENGINE_finish(e);
164 return NULL;
165 }
166 }
167#endif
168
169 ret = STORE_new_method(meth);
170 if (ret == NULL)
171 {
172 STOREerr(STORE_F_STORE_NEW_ENGINE,ERR_R_STORE_LIB);
173 return NULL;
174 }
175
176 ret->engine = e;
177
178 return(ret);
179 }
180
181void STORE_free(STORE *store)
182 {
183 if (store == NULL)
184 return;
185 if (store->meth->clean)
186 store->meth->clean(store);
187 CRYPTO_free_ex_data(CRYPTO_EX_INDEX_STORE, store, &store->ex_data);
188 OPENSSL_free(store);
189 }
190
191int STORE_ctrl(STORE *store, int cmd, long i, void *p, void (*f)(void))
192 {
193 if (store == NULL)
194 {
195 STOREerr(STORE_F_STORE_CTRL,ERR_R_PASSED_NULL_PARAMETER);
196 return 0;
197 }
198 if (store->meth->ctrl)
199 return store->meth->ctrl(store, cmd, i, p, f);
200 STOREerr(STORE_F_STORE_CTRL,STORE_R_NO_CONTROL_FUNCTION);
201 return 0;
202 }
203
204
205int STORE_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,
206 CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func)
207 {
208 return CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_STORE, argl, argp,
209 new_func, dup_func, free_func);
210 }
211
212int STORE_set_ex_data(STORE *r, int idx, void *arg)
213 {
214 return(CRYPTO_set_ex_data(&r->ex_data,idx,arg));
215 }
216
217void *STORE_get_ex_data(STORE *r, int idx)
218 {
219 return(CRYPTO_get_ex_data(&r->ex_data,idx));
220 }
221
222const STORE_METHOD *STORE_get_method(STORE *store)
223 {
224 return store->meth;
225 }
226
227const STORE_METHOD *STORE_set_method(STORE *store, const STORE_METHOD *meth)
228 {
229 store->meth=meth;
230 return store->meth;
231 }
232
233
234/* API helpers */
235
236#define check_store(s,fncode,fnname,fnerrcode) \
237 do \
238 { \
239 if ((s) == NULL || (s)->meth == NULL) \
240 { \
241 STOREerr((fncode), ERR_R_PASSED_NULL_PARAMETER); \
242 return 0; \
243 } \
244 if ((s)->meth->fnname == NULL) \
245 { \
246 STOREerr((fncode), (fnerrcode)); \
247 return 0; \
248 } \
249 } \
250 while(0)
251
252/* API functions */
253
254X509 *STORE_get_certificate(STORE *s, OPENSSL_ITEM attributes[],
255 OPENSSL_ITEM parameters[])
256 {
257 STORE_OBJECT *object;
258 X509 *x;
259
260 check_store(s,STORE_F_STORE_GET_CERTIFICATE,
261 get_object,STORE_R_NO_GET_OBJECT_FUNCTION);
262
263 object = s->meth->get_object(s, STORE_OBJECT_TYPE_X509_CERTIFICATE,
264 attributes, parameters);
265 if (!object || !object->data.x509.certificate)
266 {
267 STOREerr(STORE_F_STORE_GET_CERTIFICATE,
268 STORE_R_FAILED_GETTING_CERTIFICATE);
269 return 0;
270 }
271 CRYPTO_add(&object->data.x509.certificate->references,1,CRYPTO_LOCK_X509);
272#ifdef REF_PRINT
273 REF_PRINT("X509",data);
274#endif
275 x = object->data.x509.certificate;
276 STORE_OBJECT_free(object);
277 return x;
278 }
279
280int STORE_store_certificate(STORE *s, X509 *data, OPENSSL_ITEM attributes[],
281 OPENSSL_ITEM parameters[])
282 {
283 STORE_OBJECT *object;
284 int i;
285
286 check_store(s,STORE_F_STORE_CERTIFICATE,
287 store_object,STORE_R_NO_STORE_OBJECT_FUNCTION);
288
289 object = STORE_OBJECT_new();
290 if (!object)
291 {
292 STOREerr(STORE_F_STORE_STORE_CERTIFICATE,
293 ERR_R_MALLOC_FAILURE);
294 return 0;
295 }
296
297 CRYPTO_add(&data->references,1,CRYPTO_LOCK_X509);
298#ifdef REF_PRINT
299 REF_PRINT("X509",data);
300#endif
301 object->data.x509.certificate = data;
302
303 i = s->meth->store_object(s, STORE_OBJECT_TYPE_X509_CERTIFICATE,
304 object, attributes, parameters);
305
306 STORE_OBJECT_free(object);
307
308 if (!i)
309 {
310 STOREerr(STORE_F_STORE_STORE_CERTIFICATE,
311 STORE_R_FAILED_STORING_CERTIFICATE);
312 return 0;
313 }
314 return 1;
315 }
316
317int STORE_modify_certificate(STORE *s, OPENSSL_ITEM search_attributes[],
318 OPENSSL_ITEM add_attributes[], OPENSSL_ITEM modify_attributes[],
319 OPENSSL_ITEM delete_attributes[], OPENSSL_ITEM parameters[])
320 {
321 check_store(s,STORE_F_STORE_MODIFY_CERTIFICATE,
322 modify_object,STORE_R_NO_MODIFY_OBJECT_FUNCTION);
323
324 if (!s->meth->modify_object(s, STORE_OBJECT_TYPE_X509_CERTIFICATE,
325 search_attributes, add_attributes, modify_attributes,
326 delete_attributes, parameters))
327 {
328 STOREerr(STORE_F_STORE_MODIFY_CERTIFICATE,
329 STORE_R_FAILED_MODIFYING_CERTIFICATE);
330 return 0;
331 }
332 return 1;
333 }
334
335int STORE_revoke_certificate(STORE *s, OPENSSL_ITEM attributes[],
336 OPENSSL_ITEM parameters[])
337 {
338 check_store(s,STORE_F_STORE_REVOKE_CERTIFICATE,
339 revoke_object,STORE_R_NO_REVOKE_OBJECT_FUNCTION);
340
341 if (!s->meth->revoke_object(s, STORE_OBJECT_TYPE_X509_CERTIFICATE,
342 attributes, parameters))
343 {
344 STOREerr(STORE_F_STORE_REVOKE_CERTIFICATE,
345 STORE_R_FAILED_REVOKING_CERTIFICATE);
346 return 0;
347 }
348 return 1;
349 }
350
351int STORE_delete_certificate(STORE *s, OPENSSL_ITEM attributes[],
352 OPENSSL_ITEM parameters[])
353 {
354 check_store(s,STORE_F_STORE_DELETE_CERTIFICATE,
355 delete_object,STORE_R_NO_DELETE_OBJECT_FUNCTION);
356
357 if (!s->meth->delete_object(s, STORE_OBJECT_TYPE_X509_CERTIFICATE,
358 attributes, parameters))
359 {
360 STOREerr(STORE_F_STORE_DELETE_CERTIFICATE,
361 STORE_R_FAILED_DELETING_CERTIFICATE);
362 return 0;
363 }
364 return 1;
365 }
366
367void *STORE_list_certificate_start(STORE *s, OPENSSL_ITEM attributes[],
368 OPENSSL_ITEM parameters[])
369 {
370 void *handle;
371
372 check_store(s,STORE_F_STORE_LIST_CERTIFICATE_START,
373 list_object_start,STORE_R_NO_LIST_OBJECT_START_FUNCTION);
374
375 handle = s->meth->list_object_start(s,
376 STORE_OBJECT_TYPE_X509_CERTIFICATE, attributes, parameters);
377 if (!handle)
378 {
379 STOREerr(STORE_F_STORE_LIST_CERTIFICATE_START,
380 STORE_R_FAILED_LISTING_CERTIFICATES);
381 return 0;
382 }
383 return handle;
384 }
385
386X509 *STORE_list_certificate_next(STORE *s, void *handle)
387 {
388 STORE_OBJECT *object;
389 X509 *x;
390
391 check_store(s,STORE_F_STORE_LIST_CERTIFICATE_NEXT,
392 list_object_next,STORE_R_NO_LIST_OBJECT_NEXT_FUNCTION);
393
394 object = s->meth->list_object_next(s, handle);
395 if (!object || !object->data.x509.certificate)
396 {
397 STOREerr(STORE_F_STORE_LIST_CERTIFICATE_NEXT,
398 STORE_R_FAILED_LISTING_CERTIFICATES);
399 return 0;
400 }
401 CRYPTO_add(&object->data.x509.certificate->references,1,CRYPTO_LOCK_X509);
402#ifdef REF_PRINT
403 REF_PRINT("X509",data);
404#endif
405 x = object->data.x509.certificate;
406 STORE_OBJECT_free(object);
407 return x;
408 }
409
410int STORE_list_certificate_end(STORE *s, void *handle)
411 {
412 check_store(s,STORE_F_STORE_LIST_CERTIFICATE_END,
413 list_object_end,STORE_R_NO_LIST_OBJECT_END_FUNCTION);
414
415 if (!s->meth->list_object_end(s, handle))
416 {
417 STOREerr(STORE_F_STORE_LIST_CERTIFICATE_END,
418 STORE_R_FAILED_LISTING_CERTIFICATES);
419 return 0;
420 }
421 return 1;
422 }
423
424int STORE_list_certificate_endp(STORE *s, void *handle)
425 {
426 check_store(s,STORE_F_STORE_LIST_CERTIFICATE_ENDP,
427 list_object_endp,STORE_R_NO_LIST_OBJECT_ENDP_FUNCTION);
428
429 if (!s->meth->list_object_endp(s, handle))
430 {
431 STOREerr(STORE_F_STORE_LIST_CERTIFICATE_ENDP,
432 STORE_R_FAILED_LISTING_CERTIFICATES);
433 return 0;
434 }
435 return 1;
436 }
437
438EVP_PKEY *STORE_generate_key(STORE *s, OPENSSL_ITEM attributes[],
439 OPENSSL_ITEM parameters[])
440 {
441 STORE_OBJECT *object;
442 EVP_PKEY *pkey;
443
444 check_store(s,STORE_F_STORE_GENERATE_KEY,
445 generate_object,STORE_R_NO_GENERATE_OBJECT_FUNCTION);
446
447 object = s->meth->generate_object(s, STORE_OBJECT_TYPE_PRIVATE_KEY,
448 attributes, parameters);
449 if (!object || !object->data.key)
450 {
451 STOREerr(STORE_F_STORE_GENERATE_KEY,
452 STORE_R_FAILED_GENERATING_KEY);
453 return 0;
454 }
455 CRYPTO_add(&object->data.key->references,1,CRYPTO_LOCK_EVP_PKEY);
456#ifdef REF_PRINT
457 REF_PRINT("EVP_PKEY",data);
458#endif
459 pkey = object->data.key;
460 STORE_OBJECT_free(object);
461 return pkey;
462 }
463
464EVP_PKEY *STORE_get_private_key(STORE *s, OPENSSL_ITEM attributes[],
465 OPENSSL_ITEM parameters[])
466 {
467 STORE_OBJECT *object;
468 EVP_PKEY *pkey;
469
470 check_store(s,STORE_F_STORE_GET_PRIVATE_KEY,
471 get_object,STORE_R_NO_GET_OBJECT_FUNCTION);
472
473 object = s->meth->get_object(s, STORE_OBJECT_TYPE_PRIVATE_KEY,
474 attributes, parameters);
475 if (!object || !object->data.key || !object->data.key)
476 {
477 STOREerr(STORE_F_STORE_GET_PRIVATE_KEY,
478 STORE_R_FAILED_GETTING_KEY);
479 return 0;
480 }
481 CRYPTO_add(&object->data.key->references,1,CRYPTO_LOCK_EVP_PKEY);
482#ifdef REF_PRINT
483 REF_PRINT("EVP_PKEY",data);
484#endif
485 pkey = object->data.key;
486 STORE_OBJECT_free(object);
487 return pkey;
488 }
489
490int STORE_store_private_key(STORE *s, EVP_PKEY *data, OPENSSL_ITEM attributes[],
491 OPENSSL_ITEM parameters[])
492 {
493 STORE_OBJECT *object;
494 int i;
495
496 check_store(s,STORE_F_STORE_STORE_PRIVATE_KEY,
497 store_object,STORE_R_NO_STORE_OBJECT_FUNCTION);
498
499 object = STORE_OBJECT_new();
500 if (!object)
501 {
502 STOREerr(STORE_F_STORE_STORE_PRIVATE_KEY,
503 ERR_R_MALLOC_FAILURE);
504 return 0;
505 }
506 object->data.key = EVP_PKEY_new();
507 if (!object->data.key)
508 {
509 STOREerr(STORE_F_STORE_STORE_PRIVATE_KEY,
510 ERR_R_MALLOC_FAILURE);
511 return 0;
512 }
513
514 CRYPTO_add(&data->references,1,CRYPTO_LOCK_EVP_PKEY);
515#ifdef REF_PRINT
516 REF_PRINT("EVP_PKEY",data);
517#endif
518 object->data.key = data;
519
520 i = s->meth->store_object(s, STORE_OBJECT_TYPE_PRIVATE_KEY, object,
521 attributes, parameters);
522
523 STORE_OBJECT_free(object);
524
525 if (!i)
526 {
527 STOREerr(STORE_F_STORE_STORE_PRIVATE_KEY,
528 STORE_R_FAILED_STORING_KEY);
529 return 0;
530 }
531 return i;
532 }
533
534int STORE_modify_private_key(STORE *s, OPENSSL_ITEM search_attributes[],
535 OPENSSL_ITEM add_attributes[], OPENSSL_ITEM modify_attributes[],
536 OPENSSL_ITEM delete_attributes[], OPENSSL_ITEM parameters[])
537 {
538 check_store(s,STORE_F_STORE_MODIFY_PRIVATE_KEY,
539 modify_object,STORE_R_NO_MODIFY_OBJECT_FUNCTION);
540
541 if (!s->meth->modify_object(s, STORE_OBJECT_TYPE_PRIVATE_KEY,
542 search_attributes, add_attributes, modify_attributes,
543 delete_attributes, parameters))
544 {
545 STOREerr(STORE_F_STORE_MODIFY_PRIVATE_KEY,
546 STORE_R_FAILED_MODIFYING_PRIVATE_KEY);
547 return 0;
548 }
549 return 1;
550 }
551
552int STORE_revoke_private_key(STORE *s, OPENSSL_ITEM attributes[],
553 OPENSSL_ITEM parameters[])
554 {
555 int i;
556
557 check_store(s,STORE_F_STORE_REVOKE_PRIVATE_KEY,
558 revoke_object,STORE_R_NO_REVOKE_OBJECT_FUNCTION);
559
560 i = s->meth->revoke_object(s, STORE_OBJECT_TYPE_PRIVATE_KEY,
561 attributes, parameters);
562
563 if (!i)
564 {
565 STOREerr(STORE_F_STORE_REVOKE_PRIVATE_KEY,
566 STORE_R_FAILED_REVOKING_KEY);
567 return 0;
568 }
569 return i;
570 }
571
572int STORE_delete_private_key(STORE *s, OPENSSL_ITEM attributes[],
573 OPENSSL_ITEM parameters[])
574 {
575 check_store(s,STORE_F_STORE_DELETE_PRIVATE_KEY,
576 delete_object,STORE_R_NO_DELETE_OBJECT_FUNCTION);
577
578 if (!s->meth->delete_object(s, STORE_OBJECT_TYPE_PRIVATE_KEY,
579 attributes, parameters))
580 {
581 STOREerr(STORE_F_STORE_DELETE_PRIVATE_KEY,
582 STORE_R_FAILED_DELETING_KEY);
583 return 0;
584 }
585 return 1;
586 }
587
588void *STORE_list_private_key_start(STORE *s, OPENSSL_ITEM attributes[],
589 OPENSSL_ITEM parameters[])
590 {
591 void *handle;
592
593 check_store(s,STORE_F_STORE_LIST_PRIVATE_KEY_START,
594 list_object_start,STORE_R_NO_LIST_OBJECT_START_FUNCTION);
595
596 handle = s->meth->list_object_start(s, STORE_OBJECT_TYPE_PRIVATE_KEY,
597 attributes, parameters);
598 if (!handle)
599 {
600 STOREerr(STORE_F_STORE_LIST_PRIVATE_KEY_START,
601 STORE_R_FAILED_LISTING_KEYS);
602 return 0;
603 }
604 return handle;
605 }
606
607EVP_PKEY *STORE_list_private_key_next(STORE *s, void *handle)
608 {
609 STORE_OBJECT *object;
610 EVP_PKEY *pkey;
611
612 check_store(s,STORE_F_STORE_LIST_PRIVATE_KEY_NEXT,
613 list_object_next,STORE_R_NO_LIST_OBJECT_NEXT_FUNCTION);
614
615 object = s->meth->list_object_next(s, handle);
616 if (!object || !object->data.key || !object->data.key)
617 {
618 STOREerr(STORE_F_STORE_LIST_PRIVATE_KEY_NEXT,
619 STORE_R_FAILED_LISTING_KEYS);
620 return 0;
621 }
622 CRYPTO_add(&object->data.key->references,1,CRYPTO_LOCK_EVP_PKEY);
623#ifdef REF_PRINT
624 REF_PRINT("EVP_PKEY",data);
625#endif
626 pkey = object->data.key;
627 STORE_OBJECT_free(object);
628 return pkey;
629 }
630
631int STORE_list_private_key_end(STORE *s, void *handle)
632 {
633 check_store(s,STORE_F_STORE_LIST_PRIVATE_KEY_END,
634 list_object_end,STORE_R_NO_LIST_OBJECT_END_FUNCTION);
635
636 if (!s->meth->list_object_end(s, handle))
637 {
638 STOREerr(STORE_F_STORE_LIST_PRIVATE_KEY_END,
639 STORE_R_FAILED_LISTING_KEYS);
640 return 0;
641 }
642 return 1;
643 }
644
645int STORE_list_private_key_endp(STORE *s, void *handle)
646 {
647 check_store(s,STORE_F_STORE_LIST_PRIVATE_KEY_ENDP,
648 list_object_endp,STORE_R_NO_LIST_OBJECT_ENDP_FUNCTION);
649
650 if (!s->meth->list_object_endp(s, handle))
651 {
652 STOREerr(STORE_F_STORE_LIST_PRIVATE_KEY_ENDP,
653 STORE_R_FAILED_LISTING_KEYS);
654 return 0;
655 }
656 return 1;
657 }
658
659EVP_PKEY *STORE_get_public_key(STORE *s, OPENSSL_ITEM attributes[],
660 OPENSSL_ITEM parameters[])
661 {
662 STORE_OBJECT *object;
663 EVP_PKEY *pkey;
664
665 check_store(s,STORE_F_STORE_GET_PUBLIC_KEY,
666 get_object,STORE_R_NO_GET_OBJECT_FUNCTION);
667
668 object = s->meth->get_object(s, STORE_OBJECT_TYPE_PUBLIC_KEY,
669 attributes, parameters);
670 if (!object || !object->data.key || !object->data.key)
671 {
672 STOREerr(STORE_F_STORE_GET_PUBLIC_KEY,
673 STORE_R_FAILED_GETTING_KEY);
674 return 0;
675 }
676 CRYPTO_add(&object->data.key->references,1,CRYPTO_LOCK_EVP_PKEY);
677#ifdef REF_PRINT
678 REF_PRINT("EVP_PKEY",data);
679#endif
680 pkey = object->data.key;
681 STORE_OBJECT_free(object);
682 return pkey;
683 }
684
685int STORE_store_public_key(STORE *s, EVP_PKEY *data, OPENSSL_ITEM attributes[],
686 OPENSSL_ITEM parameters[])
687 {
688 STORE_OBJECT *object;
689 int i;
690
691 check_store(s,STORE_F_STORE_STORE_PUBLIC_KEY,
692 store_object,STORE_R_NO_STORE_OBJECT_FUNCTION);
693
694 object = STORE_OBJECT_new();
695 if (!object)
696 {
697 STOREerr(STORE_F_STORE_STORE_PUBLIC_KEY,
698 ERR_R_MALLOC_FAILURE);
699 return 0;
700 }
701 object->data.key = EVP_PKEY_new();
702 if (!object->data.key)
703 {
704 STOREerr(STORE_F_STORE_STORE_PUBLIC_KEY,
705 ERR_R_MALLOC_FAILURE);
706 return 0;
707 }
708
709 CRYPTO_add(&data->references,1,CRYPTO_LOCK_EVP_PKEY);
710#ifdef REF_PRINT
711 REF_PRINT("EVP_PKEY",data);
712#endif
713 object->data.key = data;
714
715 i = s->meth->store_object(s, STORE_OBJECT_TYPE_PUBLIC_KEY, object,
716 attributes, parameters);
717
718 STORE_OBJECT_free(object);
719
720 if (!i)
721 {
722 STOREerr(STORE_F_STORE_STORE_PUBLIC_KEY,
723 STORE_R_FAILED_STORING_KEY);
724 return 0;
725 }
726 return i;
727 }
728
729int STORE_modify_public_key(STORE *s, OPENSSL_ITEM search_attributes[],
730 OPENSSL_ITEM add_attributes[], OPENSSL_ITEM modify_attributes[],
731 OPENSSL_ITEM delete_attributes[], OPENSSL_ITEM parameters[])
732 {
733 check_store(s,STORE_F_STORE_MODIFY_PUBLIC_KEY,
734 modify_object,STORE_R_NO_MODIFY_OBJECT_FUNCTION);
735
736 if (!s->meth->modify_object(s, STORE_OBJECT_TYPE_PUBLIC_KEY,
737 search_attributes, add_attributes, modify_attributes,
738 delete_attributes, parameters))
739 {
740 STOREerr(STORE_F_STORE_MODIFY_PUBLIC_KEY,
741 STORE_R_FAILED_MODIFYING_PUBLIC_KEY);
742 return 0;
743 }
744 return 1;
745 }
746
747int STORE_revoke_public_key(STORE *s, OPENSSL_ITEM attributes[],
748 OPENSSL_ITEM parameters[])
749 {
750 int i;
751
752 check_store(s,STORE_F_STORE_REVOKE_PUBLIC_KEY,
753 revoke_object,STORE_R_NO_REVOKE_OBJECT_FUNCTION);
754
755 i = s->meth->revoke_object(s, STORE_OBJECT_TYPE_PUBLIC_KEY,
756 attributes, parameters);
757
758 if (!i)
759 {
760 STOREerr(STORE_F_STORE_REVOKE_PUBLIC_KEY,
761 STORE_R_FAILED_REVOKING_KEY);
762 return 0;
763 }
764 return i;
765 }
766
767int STORE_delete_public_key(STORE *s, OPENSSL_ITEM attributes[],
768 OPENSSL_ITEM parameters[])
769 {
770 check_store(s,STORE_F_STORE_DELETE_PUBLIC_KEY,
771 delete_object,STORE_R_NO_DELETE_OBJECT_FUNCTION);
772
773 if (!s->meth->delete_object(s, STORE_OBJECT_TYPE_PUBLIC_KEY,
774 attributes, parameters))
775 {
776 STOREerr(STORE_F_STORE_DELETE_PUBLIC_KEY,
777 STORE_R_FAILED_DELETING_KEY);
778 return 0;
779 }
780 return 1;
781 }
782
783void *STORE_list_public_key_start(STORE *s, OPENSSL_ITEM attributes[],
784 OPENSSL_ITEM parameters[])
785 {
786 void *handle;
787
788 check_store(s,STORE_F_STORE_LIST_PUBLIC_KEY_START,
789 list_object_start,STORE_R_NO_LIST_OBJECT_START_FUNCTION);
790
791 handle = s->meth->list_object_start(s, STORE_OBJECT_TYPE_PUBLIC_KEY,
792 attributes, parameters);
793 if (!handle)
794 {
795 STOREerr(STORE_F_STORE_LIST_PUBLIC_KEY_START,
796 STORE_R_FAILED_LISTING_KEYS);
797 return 0;
798 }
799 return handle;
800 }
801
802EVP_PKEY *STORE_list_public_key_next(STORE *s, void *handle)
803 {
804 STORE_OBJECT *object;
805 EVP_PKEY *pkey;
806
807 check_store(s,STORE_F_STORE_LIST_PUBLIC_KEY_NEXT,
808 list_object_next,STORE_R_NO_LIST_OBJECT_NEXT_FUNCTION);
809
810 object = s->meth->list_object_next(s, handle);
811 if (!object || !object->data.key || !object->data.key)
812 {
813 STOREerr(STORE_F_STORE_LIST_PUBLIC_KEY_NEXT,
814 STORE_R_FAILED_LISTING_KEYS);
815 return 0;
816 }
817 CRYPTO_add(&object->data.key->references,1,CRYPTO_LOCK_EVP_PKEY);
818#ifdef REF_PRINT
819 REF_PRINT("EVP_PKEY",data);
820#endif
821 pkey = object->data.key;
822 STORE_OBJECT_free(object);
823 return pkey;
824 }
825
826int STORE_list_public_key_end(STORE *s, void *handle)
827 {
828 check_store(s,STORE_F_STORE_LIST_PUBLIC_KEY_END,
829 list_object_end,STORE_R_NO_LIST_OBJECT_END_FUNCTION);
830
831 if (!s->meth->list_object_end(s, handle))
832 {
833 STOREerr(STORE_F_STORE_LIST_PUBLIC_KEY_END,
834 STORE_R_FAILED_LISTING_KEYS);
835 return 0;
836 }
837 return 1;
838 }
839
840int STORE_list_public_key_endp(STORE *s, void *handle)
841 {
842 check_store(s,STORE_F_STORE_LIST_PUBLIC_KEY_ENDP,
843 list_object_endp,STORE_R_NO_LIST_OBJECT_ENDP_FUNCTION);
844
845 if (!s->meth->list_object_endp(s, handle))
846 {
847 STOREerr(STORE_F_STORE_LIST_PUBLIC_KEY_ENDP,
848 STORE_R_FAILED_LISTING_KEYS);
849 return 0;
850 }
851 return 1;
852 }
853
854X509_CRL *STORE_generate_crl(STORE *s, OPENSSL_ITEM attributes[],
855 OPENSSL_ITEM parameters[])
856 {
857 STORE_OBJECT *object;
858 X509_CRL *crl;
859
860 check_store(s,STORE_F_STORE_GENERATE_CRL,
861 generate_object,STORE_R_NO_GENERATE_CRL_FUNCTION);
862
863 object = s->meth->generate_object(s, STORE_OBJECT_TYPE_X509_CRL,
864 attributes, parameters);
865 if (!object || !object->data.crl)
866 {
867 STOREerr(STORE_F_STORE_GENERATE_CRL,
868 STORE_R_FAILED_GENERATING_CRL);
869 return 0;
870 }
871 CRYPTO_add(&object->data.crl->references,1,CRYPTO_LOCK_X509_CRL);
872#ifdef REF_PRINT
873 REF_PRINT("X509_CRL",data);
874#endif
875 crl = object->data.crl;
876 STORE_OBJECT_free(object);
877 return crl;
878 }
879
880X509_CRL *STORE_get_crl(STORE *s, OPENSSL_ITEM attributes[],
881 OPENSSL_ITEM parameters[])
882 {
883 STORE_OBJECT *object;
884 X509_CRL *crl;
885
886 check_store(s,STORE_F_STORE_GET_CRL,
887 get_object,STORE_R_NO_GET_OBJECT_FUNCTION);
888
889 object = s->meth->get_object(s, STORE_OBJECT_TYPE_X509_CRL,
890 attributes, parameters);
891 if (!object || !object->data.crl)
892 {
893 STOREerr(STORE_F_STORE_GET_CRL,
894 STORE_R_FAILED_GETTING_KEY);
895 return 0;
896 }
897 CRYPTO_add(&object->data.crl->references,1,CRYPTO_LOCK_X509_CRL);
898#ifdef REF_PRINT
899 REF_PRINT("X509_CRL",data);
900#endif
901 crl = object->data.crl;
902 STORE_OBJECT_free(object);
903 return crl;
904 }
905
906int STORE_store_crl(STORE *s, X509_CRL *data, OPENSSL_ITEM attributes[],
907 OPENSSL_ITEM parameters[])
908 {
909 STORE_OBJECT *object;
910 int i;
911
912 check_store(s,STORE_F_STORE_STORE_CRL,
913 store_object,STORE_R_NO_STORE_OBJECT_FUNCTION);
914
915 object = STORE_OBJECT_new();
916 if (!object)
917 {
918 STOREerr(STORE_F_STORE_STORE_CRL,
919 ERR_R_MALLOC_FAILURE);
920 return 0;
921 }
922
923 CRYPTO_add(&data->references,1,CRYPTO_LOCK_X509_CRL);
924#ifdef REF_PRINT
925 REF_PRINT("X509_CRL",data);
926#endif
927 object->data.crl = data;
928
929 i = s->meth->store_object(s, STORE_OBJECT_TYPE_X509_CRL, object,
930 attributes, parameters);
931
932 STORE_OBJECT_free(object);
933
934 if (!i)
935 {
936 STOREerr(STORE_F_STORE_STORE_CRL,
937 STORE_R_FAILED_STORING_KEY);
938 return 0;
939 }
940 return i;
941 }
942
943int STORE_modify_crl(STORE *s, OPENSSL_ITEM search_attributes[],
944 OPENSSL_ITEM add_attributes[], OPENSSL_ITEM modify_attributes[],
945 OPENSSL_ITEM delete_attributes[], OPENSSL_ITEM parameters[])
946 {
947 check_store(s,STORE_F_STORE_MODIFY_CRL,
948 modify_object,STORE_R_NO_MODIFY_OBJECT_FUNCTION);
949
950 if (!s->meth->modify_object(s, STORE_OBJECT_TYPE_X509_CRL,
951 search_attributes, add_attributes, modify_attributes,
952 delete_attributes, parameters))
953 {
954 STOREerr(STORE_F_STORE_MODIFY_CRL,
955 STORE_R_FAILED_MODIFYING_CRL);
956 return 0;
957 }
958 return 1;
959 }
960
961int STORE_delete_crl(STORE *s, OPENSSL_ITEM attributes[],
962 OPENSSL_ITEM parameters[])
963 {
964 check_store(s,STORE_F_STORE_DELETE_CRL,
965 delete_object,STORE_R_NO_DELETE_OBJECT_FUNCTION);
966
967 if (!s->meth->delete_object(s, STORE_OBJECT_TYPE_X509_CRL,
968 attributes, parameters))
969 {
970 STOREerr(STORE_F_STORE_DELETE_CRL,
971 STORE_R_FAILED_DELETING_KEY);
972 return 0;
973 }
974 return 1;
975 }
976
977void *STORE_list_crl_start(STORE *s, OPENSSL_ITEM attributes[],
978 OPENSSL_ITEM parameters[])
979 {
980 void *handle;
981
982 check_store(s,STORE_F_STORE_LIST_CRL_START,
983 list_object_start,STORE_R_NO_LIST_OBJECT_START_FUNCTION);
984
985 handle = s->meth->list_object_start(s, STORE_OBJECT_TYPE_X509_CRL,
986 attributes, parameters);
987 if (!handle)
988 {
989 STOREerr(STORE_F_STORE_LIST_CRL_START,
990 STORE_R_FAILED_LISTING_KEYS);
991 return 0;
992 }
993 return handle;
994 }
995
996X509_CRL *STORE_list_crl_next(STORE *s, void *handle)
997 {
998 STORE_OBJECT *object;
999 X509_CRL *crl;
1000
1001 check_store(s,STORE_F_STORE_LIST_CRL_NEXT,
1002 list_object_next,STORE_R_NO_LIST_OBJECT_NEXT_FUNCTION);
1003
1004 object = s->meth->list_object_next(s, handle);
1005 if (!object || !object->data.crl)
1006 {
1007 STOREerr(STORE_F_STORE_LIST_CRL_NEXT,
1008 STORE_R_FAILED_LISTING_KEYS);
1009 return 0;
1010 }
1011 CRYPTO_add(&object->data.crl->references,1,CRYPTO_LOCK_X509_CRL);
1012#ifdef REF_PRINT
1013 REF_PRINT("X509_CRL",data);
1014#endif
1015 crl = object->data.crl;
1016 STORE_OBJECT_free(object);
1017 return crl;
1018 }
1019
1020int STORE_list_crl_end(STORE *s, void *handle)
1021 {
1022 check_store(s,STORE_F_STORE_LIST_CRL_END,
1023 list_object_end,STORE_R_NO_LIST_OBJECT_END_FUNCTION);
1024
1025 if (!s->meth->list_object_end(s, handle))
1026 {
1027 STOREerr(STORE_F_STORE_LIST_CRL_END,
1028 STORE_R_FAILED_LISTING_KEYS);
1029 return 0;
1030 }
1031 return 1;
1032 }
1033
1034int STORE_list_crl_endp(STORE *s, void *handle)
1035 {
1036 check_store(s,STORE_F_STORE_LIST_CRL_ENDP,
1037 list_object_endp,STORE_R_NO_LIST_OBJECT_ENDP_FUNCTION);
1038
1039 if (!s->meth->list_object_endp(s, handle))
1040 {
1041 STOREerr(STORE_F_STORE_LIST_CRL_ENDP,
1042 STORE_R_FAILED_LISTING_KEYS);
1043 return 0;
1044 }
1045 return 1;
1046 }
1047
1048int STORE_store_number(STORE *s, BIGNUM *data, OPENSSL_ITEM attributes[],
1049 OPENSSL_ITEM parameters[])
1050 {
1051 STORE_OBJECT *object;
1052 int i;
1053
1054 check_store(s,STORE_F_STORE_STORE_NUMBER,
1055 store_object,STORE_R_NO_STORE_OBJECT_NUMBER_FUNCTION);
1056
1057 object = STORE_OBJECT_new();
1058 if (!object)
1059 {
1060 STOREerr(STORE_F_STORE_STORE_NUMBER,
1061 ERR_R_MALLOC_FAILURE);
1062 return 0;
1063 }
1064
1065 object->data.number = data;
1066
1067 i = s->meth->store_object(s, STORE_OBJECT_TYPE_NUMBER, object,
1068 attributes, parameters);
1069
1070 STORE_OBJECT_free(object);
1071
1072 if (!i)
1073 {
1074 STOREerr(STORE_F_STORE_STORE_NUMBER,
1075 STORE_R_FAILED_STORING_NUMBER);
1076 return 0;
1077 }
1078 return 1;
1079 }
1080
1081int STORE_modify_number(STORE *s, OPENSSL_ITEM search_attributes[],
1082 OPENSSL_ITEM add_attributes[], OPENSSL_ITEM modify_attributes[],
1083 OPENSSL_ITEM delete_attributes[], OPENSSL_ITEM parameters[])
1084 {
1085 check_store(s,STORE_F_STORE_MODIFY_NUMBER,
1086 modify_object,STORE_R_NO_MODIFY_OBJECT_FUNCTION);
1087
1088 if (!s->meth->modify_object(s, STORE_OBJECT_TYPE_NUMBER,
1089 search_attributes, add_attributes, modify_attributes,
1090 delete_attributes, parameters))
1091 {
1092 STOREerr(STORE_F_STORE_MODIFY_NUMBER,
1093 STORE_R_FAILED_MODIFYING_NUMBER);
1094 return 0;
1095 }
1096 return 1;
1097 }
1098
1099BIGNUM *STORE_get_number(STORE *s, OPENSSL_ITEM attributes[],
1100 OPENSSL_ITEM parameters[])
1101 {
1102 STORE_OBJECT *object;
1103 BIGNUM *n;
1104
1105 check_store(s,STORE_F_STORE_GET_NUMBER,
1106 get_object,STORE_R_NO_GET_OBJECT_NUMBER_FUNCTION);
1107
1108 object = s->meth->get_object(s, STORE_OBJECT_TYPE_NUMBER, attributes,
1109 parameters);
1110 if (!object || !object->data.number)
1111 {
1112 STOREerr(STORE_F_STORE_GET_NUMBER,
1113 STORE_R_FAILED_GETTING_NUMBER);
1114 return 0;
1115 }
1116 n = object->data.number;
1117 object->data.number = NULL;
1118 STORE_OBJECT_free(object);
1119 return n;
1120 }
1121
1122int STORE_delete_number(STORE *s, OPENSSL_ITEM attributes[],
1123 OPENSSL_ITEM parameters[])
1124 {
1125 check_store(s,STORE_F_STORE_DELETE_NUMBER,
1126 delete_object,STORE_R_NO_DELETE_NUMBER_FUNCTION);
1127
1128 if (!s->meth->delete_object(s, STORE_OBJECT_TYPE_NUMBER, attributes,
1129 parameters))
1130 {
1131 STOREerr(STORE_F_STORE_DELETE_NUMBER,
1132 STORE_R_FAILED_DELETING_NUMBER);
1133 return 0;
1134 }
1135 return 1;
1136 }
1137
1138int STORE_store_arbitrary(STORE *s, BUF_MEM *data, OPENSSL_ITEM attributes[],
1139 OPENSSL_ITEM parameters[])
1140 {
1141 STORE_OBJECT *object;
1142 int i;
1143
1144 check_store(s,STORE_F_STORE_STORE_ARBITRARY,
1145 store_object,STORE_R_NO_STORE_OBJECT_ARBITRARY_FUNCTION);
1146
1147 object = STORE_OBJECT_new();
1148 if (!object)
1149 {
1150 STOREerr(STORE_F_STORE_STORE_ARBITRARY,
1151 ERR_R_MALLOC_FAILURE);
1152 return 0;
1153 }
1154
1155 object->data.arbitrary = data;
1156
1157 i = s->meth->store_object(s, STORE_OBJECT_TYPE_ARBITRARY, object,
1158 attributes, parameters);
1159
1160 STORE_OBJECT_free(object);
1161
1162 if (!i)
1163 {
1164 STOREerr(STORE_F_STORE_STORE_ARBITRARY,
1165 STORE_R_FAILED_STORING_ARBITRARY);
1166 return 0;
1167 }
1168 return 1;
1169 }
1170
1171int STORE_modify_arbitrary(STORE *s, OPENSSL_ITEM search_attributes[],
1172 OPENSSL_ITEM add_attributes[], OPENSSL_ITEM modify_attributes[],
1173 OPENSSL_ITEM delete_attributes[], OPENSSL_ITEM parameters[])
1174 {
1175 check_store(s,STORE_F_STORE_MODIFY_ARBITRARY,
1176 modify_object,STORE_R_NO_MODIFY_OBJECT_FUNCTION);
1177
1178 if (!s->meth->modify_object(s, STORE_OBJECT_TYPE_ARBITRARY,
1179 search_attributes, add_attributes, modify_attributes,
1180 delete_attributes, parameters))
1181 {
1182 STOREerr(STORE_F_STORE_MODIFY_ARBITRARY,
1183 STORE_R_FAILED_MODIFYING_ARBITRARY);
1184 return 0;
1185 }
1186 return 1;
1187 }
1188
1189BUF_MEM *STORE_get_arbitrary(STORE *s, OPENSSL_ITEM attributes[],
1190 OPENSSL_ITEM parameters[])
1191 {
1192 STORE_OBJECT *object;
1193 BUF_MEM *b;
1194
1195 check_store(s,STORE_F_STORE_GET_ARBITRARY,
1196 get_object,STORE_R_NO_GET_OBJECT_ARBITRARY_FUNCTION);
1197
1198 object = s->meth->get_object(s, STORE_OBJECT_TYPE_ARBITRARY,
1199 attributes, parameters);
1200 if (!object || !object->data.arbitrary)
1201 {
1202 STOREerr(STORE_F_STORE_GET_ARBITRARY,
1203 STORE_R_FAILED_GETTING_ARBITRARY);
1204 return 0;
1205 }
1206 b = object->data.arbitrary;
1207 object->data.arbitrary = NULL;
1208 STORE_OBJECT_free(object);
1209 return b;
1210 }
1211
1212int STORE_delete_arbitrary(STORE *s, OPENSSL_ITEM attributes[],
1213 OPENSSL_ITEM parameters[])
1214 {
1215 check_store(s,STORE_F_STORE_DELETE_ARBITRARY,
1216 delete_object,STORE_R_NO_DELETE_ARBITRARY_FUNCTION);
1217
1218 if (!s->meth->delete_object(s, STORE_OBJECT_TYPE_ARBITRARY, attributes,
1219 parameters))
1220 {
1221 STOREerr(STORE_F_STORE_DELETE_ARBITRARY,
1222 STORE_R_FAILED_DELETING_ARBITRARY);
1223 return 0;
1224 }
1225 return 1;
1226 }
1227
1228STORE_OBJECT *STORE_OBJECT_new(void)
1229 {
1230 STORE_OBJECT *object = OPENSSL_malloc(sizeof(STORE_OBJECT));
1231 if (object) memset(object, 0, sizeof(STORE_OBJECT));
1232 return object;
1233 }
1234void STORE_OBJECT_free(STORE_OBJECT *data)
1235 {
1236 if (!data) return;
1237 switch (data->type)
1238 {
1239 case STORE_OBJECT_TYPE_X509_CERTIFICATE:
1240 X509_free(data->data.x509.certificate);
1241 break;
1242 case STORE_OBJECT_TYPE_X509_CRL:
1243 X509_CRL_free(data->data.crl);
1244 break;
1245 case STORE_OBJECT_TYPE_PRIVATE_KEY:
1246 case STORE_OBJECT_TYPE_PUBLIC_KEY:
1247 EVP_PKEY_free(data->data.key);
1248 break;
1249 case STORE_OBJECT_TYPE_NUMBER:
1250 BN_free(data->data.number);
1251 break;
1252 case STORE_OBJECT_TYPE_ARBITRARY:
1253 BUF_MEM_free(data->data.arbitrary);
1254 break;
1255 }
1256 OPENSSL_free(data);
1257 }
1258
1259IMPLEMENT_STACK_OF(STORE_OBJECT*)
1260
1261
1262struct STORE_attr_info_st
1263 {
1264 unsigned char set[(STORE_ATTR_TYPE_NUM + 8) / 8];
1265 union
1266 {
1267 char *cstring;
1268 unsigned char *sha1string;
1269 X509_NAME *dn;
1270 BIGNUM *number;
1271 void *any;
1272 } values[STORE_ATTR_TYPE_NUM+1];
1273 size_t value_sizes[STORE_ATTR_TYPE_NUM+1];
1274 };
1275
1276#define ATTR_IS_SET(a,i) ((i) > 0 && (i) < STORE_ATTR_TYPE_NUM \
1277 && ((a)->set[(i) / 8] & (1 << ((i) % 8))))
1278#define SET_ATTRBIT(a,i) ((a)->set[(i) / 8] |= (1 << ((i) % 8)))
1279#define CLEAR_ATTRBIT(a,i) ((a)->set[(i) / 8] &= ~(1 << ((i) % 8)))
1280
1281STORE_ATTR_INFO *STORE_ATTR_INFO_new(void)
1282 {
1283 return (STORE_ATTR_INFO *)OPENSSL_malloc(sizeof(STORE_ATTR_INFO));
1284 }
1285static void STORE_ATTR_INFO_attr_free(STORE_ATTR_INFO *attrs,
1286 STORE_ATTR_TYPES code)
1287 {
1288 if (ATTR_IS_SET(attrs,code))
1289 {
1290 switch(code)
1291 {
1292 case STORE_ATTR_FRIENDLYNAME:
1293 case STORE_ATTR_EMAIL:
1294 case STORE_ATTR_FILENAME:
1295 STORE_ATTR_INFO_modify_cstr(attrs, code, NULL, 0);
1296 break;
1297 case STORE_ATTR_KEYID:
1298 case STORE_ATTR_ISSUERKEYID:
1299 case STORE_ATTR_SUBJECTKEYID:
1300 case STORE_ATTR_ISSUERSERIALHASH:
1301 case STORE_ATTR_CERTHASH:
1302 STORE_ATTR_INFO_modify_sha1str(attrs, code, NULL, 0);
1303 break;
1304 case STORE_ATTR_ISSUER:
1305 case STORE_ATTR_SUBJECT:
1306 STORE_ATTR_INFO_modify_dn(attrs, code, NULL);
1307 break;
1308 case STORE_ATTR_SERIAL:
1309 STORE_ATTR_INFO_modify_number(attrs, code, NULL);
1310 break;
1311 default:
1312 break;
1313 }
1314 }
1315 }
1316int STORE_ATTR_INFO_free(STORE_ATTR_INFO *attrs)
1317 {
1318 if (attrs)
1319 {
1320 STORE_ATTR_TYPES i;
1321 for(i = 0; i++ < STORE_ATTR_TYPE_NUM;)
1322 STORE_ATTR_INFO_attr_free(attrs, i);
1323 OPENSSL_free(attrs);
1324 }
1325 return 1;
1326 }
1327char *STORE_ATTR_INFO_get0_cstr(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code)
1328 {
1329 if (!attrs)
1330 {
1331 STOREerr(STORE_F_STORE_ATTR_INFO_GET0_CSTR,
1332 ERR_R_PASSED_NULL_PARAMETER);
1333 return NULL;
1334 }
1335 if (ATTR_IS_SET(attrs,code))
1336 return attrs->values[code].cstring;
1337 STOREerr(STORE_F_STORE_ATTR_INFO_GET0_CSTR,
1338 STORE_R_NO_VALUE);
1339 return NULL;
1340 }
1341unsigned char *STORE_ATTR_INFO_get0_sha1str(STORE_ATTR_INFO *attrs,
1342 STORE_ATTR_TYPES code)
1343 {
1344 if (!attrs)
1345 {
1346 STOREerr(STORE_F_STORE_ATTR_INFO_GET0_SHA1STR,
1347 ERR_R_PASSED_NULL_PARAMETER);
1348 return NULL;
1349 }
1350 if (ATTR_IS_SET(attrs,code))
1351 return attrs->values[code].sha1string;
1352 STOREerr(STORE_F_STORE_ATTR_INFO_GET0_SHA1STR,
1353 STORE_R_NO_VALUE);
1354 return NULL;
1355 }
1356X509_NAME *STORE_ATTR_INFO_get0_dn(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code)
1357 {
1358 if (!attrs)
1359 {
1360 STOREerr(STORE_F_STORE_ATTR_INFO_GET0_DN,
1361 ERR_R_PASSED_NULL_PARAMETER);
1362 return NULL;
1363 }
1364 if (ATTR_IS_SET(attrs,code))
1365 return attrs->values[code].dn;
1366 STOREerr(STORE_F_STORE_ATTR_INFO_GET0_DN,
1367 STORE_R_NO_VALUE);
1368 return NULL;
1369 }
1370BIGNUM *STORE_ATTR_INFO_get0_number(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code)
1371 {
1372 if (!attrs)
1373 {
1374 STOREerr(STORE_F_STORE_ATTR_INFO_GET0_NUMBER,
1375 ERR_R_PASSED_NULL_PARAMETER);
1376 return NULL;
1377 }
1378 if (ATTR_IS_SET(attrs,code))
1379 return attrs->values[code].number;
1380 STOREerr(STORE_F_STORE_ATTR_INFO_GET0_NUMBER,
1381 STORE_R_NO_VALUE);
1382 return NULL;
1383 }
1384int STORE_ATTR_INFO_set_cstr(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code,
1385 char *cstr, size_t cstr_size)
1386 {
1387 if (!attrs)
1388 {
1389 STOREerr(STORE_F_STORE_ATTR_INFO_SET_CSTR,
1390 ERR_R_PASSED_NULL_PARAMETER);
1391 return 0;
1392 }
1393 if (!ATTR_IS_SET(attrs,code))
1394 {
1395 if ((attrs->values[code].cstring = BUF_strndup(cstr, cstr_size)))
1396 return 1;
1397 STOREerr(STORE_F_STORE_ATTR_INFO_SET_CSTR,
1398 ERR_R_MALLOC_FAILURE);
1399 return 0;
1400 }
1401 STOREerr(STORE_F_STORE_ATTR_INFO_SET_CSTR, STORE_R_ALREADY_HAS_A_VALUE);
1402 return 0;
1403 }
1404int STORE_ATTR_INFO_set_sha1str(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code,
1405 unsigned char *sha1str, size_t sha1str_size)
1406 {
1407 if (!attrs)
1408 {
1409 STOREerr(STORE_F_STORE_ATTR_INFO_SET_SHA1STR,
1410 ERR_R_PASSED_NULL_PARAMETER);
1411 return 0;
1412 }
1413 if (!ATTR_IS_SET(attrs,code))
1414 {
1415 if ((attrs->values[code].sha1string =
1416 (unsigned char *)BUF_memdup(sha1str,
1417 sha1str_size)))
1418 return 1;
1419 STOREerr(STORE_F_STORE_ATTR_INFO_SET_SHA1STR,
1420 ERR_R_MALLOC_FAILURE);
1421 return 0;
1422 }
1423 STOREerr(STORE_F_STORE_ATTR_INFO_SET_SHA1STR, STORE_R_ALREADY_HAS_A_VALUE);
1424 return 0;
1425 }
1426int STORE_ATTR_INFO_set_dn(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code,
1427 X509_NAME *dn)
1428 {
1429 if (!attrs)
1430 {
1431 STOREerr(STORE_F_STORE_ATTR_INFO_SET_DN,
1432 ERR_R_PASSED_NULL_PARAMETER);
1433 return 0;
1434 }
1435 if (!ATTR_IS_SET(attrs,code))
1436 {
1437 if ((attrs->values[code].dn = X509_NAME_dup(dn)))
1438 return 1;
1439 STOREerr(STORE_F_STORE_ATTR_INFO_SET_DN,
1440 ERR_R_MALLOC_FAILURE);
1441 return 0;
1442 }
1443 STOREerr(STORE_F_STORE_ATTR_INFO_SET_DN, STORE_R_ALREADY_HAS_A_VALUE);
1444 return 0;
1445 }
1446int STORE_ATTR_INFO_set_number(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code,
1447 BIGNUM *number)
1448 {
1449 if (!attrs)
1450 {
1451 STOREerr(STORE_F_STORE_ATTR_INFO_SET_NUMBER,
1452 ERR_R_PASSED_NULL_PARAMETER);
1453 return 0;
1454 }
1455 if (!ATTR_IS_SET(attrs,code))
1456 {
1457 if ((attrs->values[code].number = BN_dup(number)))
1458 return 1;
1459 STOREerr(STORE_F_STORE_ATTR_INFO_SET_NUMBER,
1460 ERR_R_MALLOC_FAILURE);
1461 return 0;
1462 }
1463 STOREerr(STORE_F_STORE_ATTR_INFO_SET_NUMBER, STORE_R_ALREADY_HAS_A_VALUE);
1464 return 0;
1465 }
1466int STORE_ATTR_INFO_modify_cstr(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code,
1467 char *cstr, size_t cstr_size)
1468 {
1469 if (!attrs)
1470 {
1471 STOREerr(STORE_F_STORE_ATTR_INFO_MODIFY_CSTR,
1472 ERR_R_PASSED_NULL_PARAMETER);
1473 return 0;
1474 }
1475 if (ATTR_IS_SET(attrs,code))
1476 {
1477 OPENSSL_free(attrs->values[code].cstring);
1478 attrs->values[code].cstring = NULL;
1479 CLEAR_ATTRBIT(attrs, code);
1480 }
1481 return STORE_ATTR_INFO_set_cstr(attrs, code, cstr, cstr_size);
1482 }
1483int STORE_ATTR_INFO_modify_sha1str(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code,
1484 unsigned char *sha1str, size_t sha1str_size)
1485 {
1486 if (!attrs)
1487 {
1488 STOREerr(STORE_F_STORE_ATTR_INFO_MODIFY_SHA1STR,
1489 ERR_R_PASSED_NULL_PARAMETER);
1490 return 0;
1491 }
1492 if (ATTR_IS_SET(attrs,code))
1493 {
1494 OPENSSL_free(attrs->values[code].sha1string);
1495 attrs->values[code].sha1string = NULL;
1496 CLEAR_ATTRBIT(attrs, code);
1497 }
1498 return STORE_ATTR_INFO_set_sha1str(attrs, code, sha1str, sha1str_size);
1499 }
1500int STORE_ATTR_INFO_modify_dn(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code,
1501 X509_NAME *dn)
1502 {
1503 if (!attrs)
1504 {
1505 STOREerr(STORE_F_STORE_ATTR_INFO_MODIFY_DN,
1506 ERR_R_PASSED_NULL_PARAMETER);
1507 return 0;
1508 }
1509 if (ATTR_IS_SET(attrs,code))
1510 {
1511 OPENSSL_free(attrs->values[code].dn);
1512 attrs->values[code].dn = NULL;
1513 CLEAR_ATTRBIT(attrs, code);
1514 }
1515 return STORE_ATTR_INFO_set_dn(attrs, code, dn);
1516 }
1517int STORE_ATTR_INFO_modify_number(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code,
1518 BIGNUM *number)
1519 {
1520 if (!attrs)
1521 {
1522 STOREerr(STORE_F_STORE_ATTR_INFO_MODIFY_NUMBER,
1523 ERR_R_PASSED_NULL_PARAMETER);
1524 return 0;
1525 }
1526 if (ATTR_IS_SET(attrs,code))
1527 {
1528 OPENSSL_free(attrs->values[code].number);
1529 attrs->values[code].number = NULL;
1530 CLEAR_ATTRBIT(attrs, code);
1531 }
1532 return STORE_ATTR_INFO_set_number(attrs, code, number);
1533 }
1534
1535struct attr_list_ctx_st
1536 {
1537 OPENSSL_ITEM *attributes;
1538 };
1539void *STORE_parse_attrs_start(OPENSSL_ITEM *attributes)
1540 {
1541 if (attributes)
1542 {
1543 struct attr_list_ctx_st *context =
1544 (struct attr_list_ctx_st *)OPENSSL_malloc(sizeof(struct attr_list_ctx_st));
1545 if (context)
1546 context->attributes = attributes;
1547 else
1548 STOREerr(STORE_F_STORE_PARSE_ATTRS_START,
1549 ERR_R_MALLOC_FAILURE);
1550 return context;
1551 }
1552 STOREerr(STORE_F_STORE_PARSE_ATTRS_START, ERR_R_PASSED_NULL_PARAMETER);
1553 return 0;
1554 }
1555STORE_ATTR_INFO *STORE_parse_attrs_next(void *handle)
1556 {
1557 struct attr_list_ctx_st *context = (struct attr_list_ctx_st *)handle;
1558
1559 if (context && context->attributes)
1560 {
1561 STORE_ATTR_INFO *attrs = NULL;
1562
1563 while(context->attributes
1564 && context->attributes->code != STORE_ATTR_OR
1565 && context->attributes->code != STORE_ATTR_END)
1566 {
1567 switch(context->attributes->code)
1568 {
1569 case STORE_ATTR_FRIENDLYNAME:
1570 case STORE_ATTR_EMAIL:
1571 case STORE_ATTR_FILENAME:
1572 if (!attrs) attrs = STORE_ATTR_INFO_new();
1573 if (attrs == NULL)
1574 {
1575 STOREerr(STORE_F_STORE_PARSE_ATTRS_NEXT,
1576 ERR_R_MALLOC_FAILURE);
1577 goto err;
1578 }
1579 STORE_ATTR_INFO_set_cstr(attrs,
1580 context->attributes->code,
1581 context->attributes->value,
1582 context->attributes->value_size);
1583 break;
1584 case STORE_ATTR_KEYID:
1585 case STORE_ATTR_ISSUERKEYID:
1586 case STORE_ATTR_SUBJECTKEYID:
1587 case STORE_ATTR_ISSUERSERIALHASH:
1588 case STORE_ATTR_CERTHASH:
1589 if (!attrs) attrs = STORE_ATTR_INFO_new();
1590 if (attrs == NULL)
1591 {
1592 STOREerr(STORE_F_STORE_PARSE_ATTRS_NEXT,
1593 ERR_R_MALLOC_FAILURE);
1594 goto err;
1595 }
1596 STORE_ATTR_INFO_set_sha1str(attrs,
1597 context->attributes->code,
1598 context->attributes->value,
1599 context->attributes->value_size);
1600 break;
1601 case STORE_ATTR_ISSUER:
1602 case STORE_ATTR_SUBJECT:
1603 if (!attrs) attrs = STORE_ATTR_INFO_new();
1604 if (attrs == NULL)
1605 {
1606 STOREerr(STORE_F_STORE_PARSE_ATTRS_NEXT,
1607 ERR_R_MALLOC_FAILURE);
1608 goto err;
1609 }
1610 STORE_ATTR_INFO_modify_dn(attrs,
1611 context->attributes->code,
1612 context->attributes->value);
1613 break;
1614 case STORE_ATTR_SERIAL:
1615 if (!attrs) attrs = STORE_ATTR_INFO_new();
1616 if (attrs == NULL)
1617 {
1618 STOREerr(STORE_F_STORE_PARSE_ATTRS_NEXT,
1619 ERR_R_MALLOC_FAILURE);
1620 goto err;
1621 }
1622 STORE_ATTR_INFO_modify_number(attrs,
1623 context->attributes->code,
1624 context->attributes->value);
1625 break;
1626 }
1627 context->attributes++;
1628 }
1629 if (context->attributes->code == STORE_ATTR_OR)
1630 context->attributes++;
1631 return attrs;
1632 err:
1633 while(context->attributes
1634 && context->attributes->code != STORE_ATTR_OR
1635 && context->attributes->code != STORE_ATTR_END)
1636 context->attributes++;
1637 if (context->attributes->code == STORE_ATTR_OR)
1638 context->attributes++;
1639 return NULL;
1640 }
1641 STOREerr(STORE_F_STORE_PARSE_ATTRS_NEXT, ERR_R_PASSED_NULL_PARAMETER);
1642 return NULL;
1643 }
1644int STORE_parse_attrs_end(void *handle)
1645 {
1646 struct attr_list_ctx_st *context = (struct attr_list_ctx_st *)handle;
1647
1648 if (context && context->attributes)
1649 {
1650#if 0
1651 OPENSSL_ITEM *attributes = context->attributes;
1652#endif
1653 OPENSSL_free(context);
1654 return 1;
1655 }
1656 STOREerr(STORE_F_STORE_PARSE_ATTRS_END, ERR_R_PASSED_NULL_PARAMETER);
1657 return 0;
1658 }
1659
1660int STORE_parse_attrs_endp(void *handle)
1661 {
1662 struct attr_list_ctx_st *context = (struct attr_list_ctx_st *)handle;
1663
1664 if (context && context->attributes)
1665 {
1666 return context->attributes->code == STORE_ATTR_END;
1667 }
1668 STOREerr(STORE_F_STORE_PARSE_ATTRS_ENDP, ERR_R_PASSED_NULL_PARAMETER);
1669 return 0;
1670 }
1671
1672static int attr_info_compare_compute_range(
1673 const unsigned char *abits, const unsigned char *bbits,
1674 unsigned int *alowp, unsigned int *ahighp,
1675 unsigned int *blowp, unsigned int *bhighp)
1676 {
1677 unsigned int alow = (unsigned int)-1, ahigh = 0;
1678 unsigned int blow = (unsigned int)-1, bhigh = 0;
1679 int i, res = 0;
1680
1681 for (i = 0; i < (STORE_ATTR_TYPE_NUM + 8) / 8; i++, abits++, bbits++)
1682 {
1683 if (res == 0)
1684 {
1685 if (*abits < *bbits) res = -1;
1686 if (*abits > *bbits) res = 1;
1687 }
1688 if (*abits)
1689 {
1690 if (alow == (unsigned int)-1)
1691 {
1692 alow = i * 8;
1693 if (!(*abits & 0x01)) alow++;
1694 if (!(*abits & 0x02)) alow++;
1695 if (!(*abits & 0x04)) alow++;
1696 if (!(*abits & 0x08)) alow++;
1697 if (!(*abits & 0x10)) alow++;
1698 if (!(*abits & 0x20)) alow++;
1699 if (!(*abits & 0x40)) alow++;
1700 }
1701 ahigh = i * 8 + 7;
1702 if (!(*abits & 0x80)) ahigh++;
1703 if (!(*abits & 0x40)) ahigh++;
1704 if (!(*abits & 0x20)) ahigh++;
1705 if (!(*abits & 0x10)) ahigh++;
1706 if (!(*abits & 0x08)) ahigh++;
1707 if (!(*abits & 0x04)) ahigh++;
1708 if (!(*abits & 0x02)) ahigh++;
1709 }
1710 if (*bbits)
1711 {
1712 if (blow == (unsigned int)-1)
1713 {
1714 blow = i * 8;
1715 if (!(*bbits & 0x01)) blow++;
1716 if (!(*bbits & 0x02)) blow++;
1717 if (!(*bbits & 0x04)) blow++;
1718 if (!(*bbits & 0x08)) blow++;
1719 if (!(*bbits & 0x10)) blow++;
1720 if (!(*bbits & 0x20)) blow++;
1721 if (!(*bbits & 0x40)) blow++;
1722 }
1723 bhigh = i * 8 + 7;
1724 if (!(*bbits & 0x80)) bhigh++;
1725 if (!(*bbits & 0x40)) bhigh++;
1726 if (!(*bbits & 0x20)) bhigh++;
1727 if (!(*bbits & 0x10)) bhigh++;
1728 if (!(*bbits & 0x08)) bhigh++;
1729 if (!(*bbits & 0x04)) bhigh++;
1730 if (!(*bbits & 0x02)) bhigh++;
1731 }
1732 }
1733 if (ahigh + alow < bhigh + blow) res = -1;
1734 if (ahigh + alow > bhigh + blow) res = 1;
1735 if (alowp) *alowp = alow;
1736 if (ahighp) *ahighp = ahigh;
1737 if (blowp) *blowp = blow;
1738 if (bhighp) *bhighp = bhigh;
1739 return res;
1740 }
1741
1742int STORE_ATTR_INFO_compare(const STORE_ATTR_INFO * const *a,
1743 const STORE_ATTR_INFO * const *b)
1744 {
1745 if (a == b) return 0;
1746 if (!a) return -1;
1747 if (!b) return 1;
1748 return attr_info_compare_compute_range((*a)->set, (*b)->set, 0, 0, 0, 0);
1749 }
1750
1751int STORE_ATTR_INFO_in_range(STORE_ATTR_INFO *a, STORE_ATTR_INFO *b)
1752 {
1753 unsigned int alow, ahigh, blow, bhigh;
1754
1755 if (a == b) return 1;
1756 if (!a) return 0;
1757 if (!b) return 0;
1758 attr_info_compare_compute_range(a->set, b->set,
1759 &alow, &ahigh, &blow, &bhigh);
1760 if (alow >= blow && ahigh <= bhigh)
1761 return 1;
1762 return 0;
1763 }
1764
1765int STORE_ATTR_INFO_in(STORE_ATTR_INFO *a, STORE_ATTR_INFO *b)
1766 {
1767 unsigned char *abits, *bbits;
1768 int i;
1769
1770 if (a == b) return 1;
1771 if (!a) return 0;
1772 if (!b) return 0;
1773 abits = a->set;
1774 bbits = b->set;
1775 for (i = 0; i < (STORE_ATTR_TYPE_NUM + 8) / 8; i++, abits++, bbits++)
1776 {
1777 if (*abits && (*bbits & *abits) != *abits)
1778 return 0;
1779 }
1780 return 1;
1781 }
1782
1783int STORE_ATTR_INFO_in_ex(STORE_ATTR_INFO *a, STORE_ATTR_INFO *b)
1784 {
1785 STORE_ATTR_TYPES i;
1786
1787 if (a == b) return 1;
1788 if (!STORE_ATTR_INFO_in(a, b)) return 0;
1789 for (i = 1; i < STORE_ATTR_TYPE_NUM; i++)
1790 if (ATTR_IS_SET(a, i))
1791 {
1792 switch(i)
1793 {
1794 case STORE_ATTR_FRIENDLYNAME:
1795 case STORE_ATTR_EMAIL:
1796 case STORE_ATTR_FILENAME:
1797 if (strcmp(a->values[i].cstring,
1798 b->values[i].cstring))
1799 return 0;
1800 break;
1801 case STORE_ATTR_KEYID:
1802 case STORE_ATTR_ISSUERKEYID:
1803 case STORE_ATTR_SUBJECTKEYID:
1804 case STORE_ATTR_ISSUERSERIALHASH:
1805 case STORE_ATTR_CERTHASH:
1806 if (memcmp(a->values[i].sha1string,
1807 b->values[i].sha1string,
1808 a->value_sizes[i]))
1809 return 0;
1810 break;
1811 case STORE_ATTR_ISSUER:
1812 case STORE_ATTR_SUBJECT:
1813 if (X509_NAME_cmp(a->values[i].dn,
1814 b->values[i].dn))
1815 return 0;
1816 break;
1817 case STORE_ATTR_SERIAL:
1818 if (BN_cmp(a->values[i].number,
1819 b->values[i].number))
1820 return 0;
1821 break;
1822 default:
1823 break;
1824 }
1825 }
1826
1827 return 1;
1828 }
diff --git a/src/lib/libcrypto/store/str_locl.h b/src/lib/libcrypto/store/str_locl.h
new file mode 100644
index 0000000000..3f8cb75619
--- /dev/null
+++ b/src/lib/libcrypto/store/str_locl.h
@@ -0,0 +1,124 @@
1/* crypto/store/str_locl.h -*- mode:C; c-file-style: "eay" -*- */
2/* Written by Richard Levitte (richard@levitte.org) for the OpenSSL
3 * project 2003.
4 */
5/* ====================================================================
6 * Copyright (c) 2003 The OpenSSL Project. All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 *
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 *
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in
17 * the documentation and/or other materials provided with the
18 * distribution.
19 *
20 * 3. All advertising materials mentioning features or use of this
21 * software must display the following acknowledgment:
22 * "This product includes software developed by the OpenSSL Project
23 * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
24 *
25 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
26 * endorse or promote products derived from this software without
27 * prior written permission. For written permission, please contact
28 * openssl-core@openssl.org.
29 *
30 * 5. Products derived from this software may not be called "OpenSSL"
31 * nor may "OpenSSL" appear in their names without prior written
32 * permission of the OpenSSL Project.
33 *
34 * 6. Redistributions of any form whatsoever must retain the following
35 * acknowledgment:
36 * "This product includes software developed by the OpenSSL Project
37 * for use in the OpenSSL Toolkit (http://www.openssl.org/)"
38 *
39 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
40 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
41 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
42 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
43 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
44 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
45 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
46 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
47 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
48 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
49 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50 * OF THE POSSIBILITY OF SUCH DAMAGE.
51 * ====================================================================
52 *
53 * This product includes cryptographic software written by Eric Young
54 * (eay@cryptsoft.com). This product includes software written by Tim
55 * Hudson (tjh@cryptsoft.com).
56 *
57 */
58
59#ifndef HEADER_STORE_LOCL_H
60#define HEADER_STORE_LOCL_H
61
62#include <openssl/crypto.h>
63#include <openssl/store.h>
64
65#ifdef __cplusplus
66extern "C" {
67#endif
68
69struct store_method_st
70 {
71 char *name;
72
73 /* All the functions return a positive integer or non-NULL for success
74 and 0, a negative integer or NULL for failure */
75
76 /* Initialise the STORE with private data */
77 STORE_INITIALISE_FUNC_PTR init;
78 /* Initialise the STORE with private data */
79 STORE_CLEANUP_FUNC_PTR clean;
80 /* Generate an object of a given type */
81 STORE_GENERATE_OBJECT_FUNC_PTR generate_object;
82 /* Get an object of a given type. This function isn't really very
83 useful since the listing functions (below) can be used for the
84 same purpose and are much more general. */
85 STORE_GET_OBJECT_FUNC_PTR get_object;
86 /* Store an object of a given type. */
87 STORE_STORE_OBJECT_FUNC_PTR store_object;
88 /* Modify the attributes bound to an object of a given type. */
89 STORE_MODIFY_OBJECT_FUNC_PTR modify_object;
90 /* Revoke an object of a given type. */
91 STORE_HANDLE_OBJECT_FUNC_PTR revoke_object;
92 /* Delete an object of a given type. */
93 STORE_HANDLE_OBJECT_FUNC_PTR delete_object;
94 /* List a bunch of objects of a given type and with the associated
95 attributes. */
96 STORE_START_OBJECT_FUNC_PTR list_object_start;
97 STORE_NEXT_OBJECT_FUNC_PTR list_object_next;
98 STORE_END_OBJECT_FUNC_PTR list_object_end;
99 STORE_END_OBJECT_FUNC_PTR list_object_endp;
100 /* Store-level function to make any necessary update operations. */
101 STORE_GENERIC_FUNC_PTR update_store;
102 /* Store-level function to get exclusive access to the store. */
103 STORE_GENERIC_FUNC_PTR lock_store;
104 /* Store-level function to release exclusive access to the store. */
105 STORE_GENERIC_FUNC_PTR unlock_store;
106
107 /* Generic control function */
108 STORE_CTRL_FUNC_PTR ctrl;
109 };
110
111struct store_st
112 {
113 const STORE_METHOD *meth;
114 /* functional reference if 'meth' is ENGINE-provided */
115 ENGINE *engine;
116
117 CRYPTO_EX_DATA ex_data;
118 int references;
119 };
120#ifdef __cplusplus
121}
122#endif
123
124#endif
diff --git a/src/lib/libcrypto/store/str_mem.c b/src/lib/libcrypto/store/str_mem.c
new file mode 100644
index 0000000000..8ac4f7e55c
--- /dev/null
+++ b/src/lib/libcrypto/store/str_mem.c
@@ -0,0 +1,365 @@
1/* crypto/store/str_mem.c -*- mode:C; c-file-style: "eay" -*- */
2/* Written by Richard Levitte (richard@levitte.org) for the OpenSSL
3 * project 2003.
4 */
5/* ====================================================================
6 * Copyright (c) 2003 The OpenSSL Project. All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 *
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 *
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in
17 * the documentation and/or other materials provided with the
18 * distribution.
19 *
20 * 3. All advertising materials mentioning features or use of this
21 * software must display the following acknowledgment:
22 * "This product includes software developed by the OpenSSL Project
23 * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
24 *
25 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
26 * endorse or promote products derived from this software without
27 * prior written permission. For written permission, please contact
28 * openssl-core@openssl.org.
29 *
30 * 5. Products derived from this software may not be called "OpenSSL"
31 * nor may "OpenSSL" appear in their names without prior written
32 * permission of the OpenSSL Project.
33 *
34 * 6. Redistributions of any form whatsoever must retain the following
35 * acknowledgment:
36 * "This product includes software developed by the OpenSSL Project
37 * for use in the OpenSSL Toolkit (http://www.openssl.org/)"
38 *
39 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
40 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
41 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
42 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
43 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
44 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
45 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
46 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
47 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
48 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
49 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50 * OF THE POSSIBILITY OF SUCH DAMAGE.
51 * ====================================================================
52 *
53 * This product includes cryptographic software written by Eric Young
54 * (eay@cryptsoft.com). This product includes software written by Tim
55 * Hudson (tjh@cryptsoft.com).
56 *
57 */
58
59#include <string.h>
60#include <openssl/err.h>
61#include "str_locl.h"
62
63/* The memory store is currently highly experimental. It's meant to become
64 a base store used by other stores for internal caching (for full caching
65 support, aging needs to be added).
66
67 The database use is meant to support as much attribute association as
68 possible, while providing for as small search ranges as possible.
69 This is currently provided for by sorting the entries by numbers that
70 are composed of bits set at the positions indicated by attribute type
71 codes. This provides for ranges determined by the highest attribute
72 type code value. A better idea might be to sort by values computed
73 from the range of attributes associated with the object (basically,
74 the difference between the highest and lowest attribute type code)
75 and it's distance from a base (basically, the lowest associated
76 attribute type code).
77*/
78
79typedef struct mem_object_data_st
80 {
81 STORE_OBJECT *object;
82 STORE_ATTR_INFO *attr_info;
83 int references;
84 } MEM_OBJECT_DATA;
85
86DECLARE_STACK_OF(MEM_OBJECT_DATA)
87struct mem_data_st
88 {
89 STACK_OF(MEM_OBJECT_DATA) *data; /* sorted with
90 * STORE_ATTR_INFO_compare(). */
91 unsigned int compute_components : 1; /* Currently unused, but can
92 be used to add attributes
93 from parts of the data. */
94 };
95
96DECLARE_STACK_OF(STORE_ATTR_INFO)
97struct mem_ctx_st
98 {
99 int type; /* The type we're searching for */
100 STACK_OF(STORE_ATTR_INFO) *search_attributes; /* Sets of
101 attributes to search for. Each
102 element is a STORE_ATTR_INFO. */
103 int search_index; /* which of the search attributes we
104 found a match for, -1 when we still
105 haven't found any */
106 int index; /* -1 as long as we're searching for
107 the first */
108 };
109
110static int mem_init(STORE *s);
111static void mem_clean(STORE *s);
112static STORE_OBJECT *mem_generate(STORE *s, STORE_OBJECT_TYPES type,
113 OPENSSL_ITEM attributes[], OPENSSL_ITEM parameters[]);
114static STORE_OBJECT *mem_get(STORE *s, STORE_OBJECT_TYPES type,
115 OPENSSL_ITEM attributes[], OPENSSL_ITEM parameters[]);
116static int mem_store(STORE *s, STORE_OBJECT_TYPES type,
117 STORE_OBJECT *data, OPENSSL_ITEM attributes[],
118 OPENSSL_ITEM parameters[]);
119static int mem_modify(STORE *s, STORE_OBJECT_TYPES type,
120 OPENSSL_ITEM search_attributes[], OPENSSL_ITEM add_attributes[],
121 OPENSSL_ITEM modify_attributes[], OPENSSL_ITEM delete_attributes[],
122 OPENSSL_ITEM parameters[]);
123static int mem_delete(STORE *s, STORE_OBJECT_TYPES type,
124 OPENSSL_ITEM attributes[], OPENSSL_ITEM parameters[]);
125static void *mem_list_start(STORE *s, STORE_OBJECT_TYPES type,
126 OPENSSL_ITEM attributes[], OPENSSL_ITEM parameters[]);
127static STORE_OBJECT *mem_list_next(STORE *s, void *handle);
128static int mem_list_end(STORE *s, void *handle);
129static int mem_list_endp(STORE *s, void *handle);
130static int mem_lock(STORE *s, OPENSSL_ITEM attributes[],
131 OPENSSL_ITEM parameters[]);
132static int mem_unlock(STORE *s, OPENSSL_ITEM attributes[],
133 OPENSSL_ITEM parameters[]);
134static int mem_ctrl(STORE *s, int cmd, long l, void *p, void (*f)(void));
135
136static STORE_METHOD store_memory =
137 {
138 "OpenSSL memory store interface",
139 mem_init,
140 mem_clean,
141 mem_generate,
142 mem_get,
143 mem_store,
144 mem_modify,
145 NULL, /* revoke */
146 mem_delete,
147 mem_list_start,
148 mem_list_next,
149 mem_list_end,
150 mem_list_endp,
151 NULL, /* update */
152 mem_lock,
153 mem_unlock,
154 mem_ctrl
155 };
156
157const STORE_METHOD *STORE_Memory(void)
158 {
159 return &store_memory;
160 }
161
162static int mem_init(STORE *s)
163 {
164 return 1;
165 }
166
167static void mem_clean(STORE *s)
168 {
169 return;
170 }
171
172static STORE_OBJECT *mem_generate(STORE *s, STORE_OBJECT_TYPES type,
173 OPENSSL_ITEM attributes[], OPENSSL_ITEM parameters[])
174 {
175 STOREerr(STORE_F_MEM_GENERATE, STORE_R_NOT_IMPLEMENTED);
176 return 0;
177 }
178static STORE_OBJECT *mem_get(STORE *s, STORE_OBJECT_TYPES type,
179 OPENSSL_ITEM attributes[], OPENSSL_ITEM parameters[])
180 {
181 void *context = mem_list_start(s, type, attributes, parameters);
182
183 if (context)
184 {
185 STORE_OBJECT *object = mem_list_next(s, context);
186
187 if (mem_list_end(s, context))
188 return object;
189 }
190 return NULL;
191 }
192static int mem_store(STORE *s, STORE_OBJECT_TYPES type,
193 STORE_OBJECT *data, OPENSSL_ITEM attributes[],
194 OPENSSL_ITEM parameters[])
195 {
196 STOREerr(STORE_F_MEM_STORE, STORE_R_NOT_IMPLEMENTED);
197 return 0;
198 }
199static int mem_modify(STORE *s, STORE_OBJECT_TYPES type,
200 OPENSSL_ITEM search_attributes[], OPENSSL_ITEM add_attributes[],
201 OPENSSL_ITEM modify_attributes[], OPENSSL_ITEM delete_attributes[],
202 OPENSSL_ITEM parameters[])
203 {
204 STOREerr(STORE_F_MEM_MODIFY, STORE_R_NOT_IMPLEMENTED);
205 return 0;
206 }
207static int mem_delete(STORE *s, STORE_OBJECT_TYPES type,
208 OPENSSL_ITEM attributes[], OPENSSL_ITEM parameters[])
209 {
210 STOREerr(STORE_F_MEM_DELETE, STORE_R_NOT_IMPLEMENTED);
211 return 0;
212 }
213
214/* The list functions may be the hardest to understand. Basically,
215 mem_list_start compiles a stack of attribute info elements, and
216 puts that stack into the context to be returned. mem_list_next
217 will then find the first matching element in the store, and then
218 walk all the way to the end of the store (since any combination
219 of attribute bits above the starting point may match the searched
220 for bit pattern...). */
221static void *mem_list_start(STORE *s, STORE_OBJECT_TYPES type,
222 OPENSSL_ITEM attributes[], OPENSSL_ITEM parameters[])
223 {
224 struct mem_ctx_st *context =
225 (struct mem_ctx_st *)OPENSSL_malloc(sizeof(struct mem_ctx_st));
226 void *attribute_context = NULL;
227 STORE_ATTR_INFO *attrs = NULL;
228
229 if (!context)
230 {
231 STOREerr(STORE_F_MEM_LIST_START, ERR_R_MALLOC_FAILURE);
232 return 0;
233 }
234 memset(context, 0, sizeof(struct mem_ctx_st));
235
236 attribute_context = STORE_parse_attrs_start(attributes);
237 if (!attribute_context)
238 {
239 STOREerr(STORE_F_MEM_LIST_START, ERR_R_STORE_LIB);
240 goto err;
241 }
242
243 while((attrs = STORE_parse_attrs_next(attribute_context)))
244 {
245 if (context->search_attributes == NULL)
246 {
247 context->search_attributes =
248 sk_STORE_ATTR_INFO_new(STORE_ATTR_INFO_compare);
249 if (!context->search_attributes)
250 {
251 STOREerr(STORE_F_MEM_LIST_START,
252 ERR_R_MALLOC_FAILURE);
253 goto err;
254 }
255 }
256 sk_STORE_ATTR_INFO_push(context->search_attributes,attrs);
257 }
258 if (!STORE_parse_attrs_endp(attribute_context))
259 goto err;
260 STORE_parse_attrs_end(attribute_context);
261 context->search_index = -1;
262 context->index = -1;
263 return context;
264 err:
265 if (attribute_context) STORE_parse_attrs_end(attribute_context);
266 mem_list_end(s, context);
267 return NULL;
268 }
269static STORE_OBJECT *mem_list_next(STORE *s, void *handle)
270 {
271 int i;
272 struct mem_ctx_st *context = (struct mem_ctx_st *)handle;
273 struct mem_object_data_st key = { 0, 0, 1 };
274 struct mem_data_st *store =
275 (struct mem_data_st *)STORE_get_ex_data(s, 1);
276 int srch;
277 int cres = 0;
278
279 if (!context)
280 {
281 STOREerr(STORE_F_MEM_LIST_NEXT, ERR_R_PASSED_NULL_PARAMETER);
282 return NULL;
283 }
284 if (!store)
285 {
286 STOREerr(STORE_F_MEM_LIST_NEXT, STORE_R_NO_STORE);
287 return NULL;
288 }
289
290 if (context->search_index == -1)
291 {
292 for (i = 0;
293 i < sk_STORE_ATTR_INFO_num(context->search_attributes);
294 i++)
295 {
296 key.attr_info
297 = sk_STORE_ATTR_INFO_value(context->search_attributes,
298 i);
299 srch = sk_MEM_OBJECT_DATA_find_ex(store->data, &key);
300
301 if (srch >= 0)
302 {
303 context->search_index = srch;
304 break;
305 }
306 }
307 }
308 if (context->search_index < 0)
309 return NULL;
310
311 key.attr_info =
312 sk_STORE_ATTR_INFO_value(context->search_attributes,
313 context->search_index);
314 for(srch = context->search_index;
315 srch < sk_MEM_OBJECT_DATA_num(store->data)
316 && STORE_ATTR_INFO_in_range(key.attr_info,
317 sk_MEM_OBJECT_DATA_value(store->data, srch)->attr_info)
318 && !(cres = STORE_ATTR_INFO_in_ex(key.attr_info,
319 sk_MEM_OBJECT_DATA_value(store->data, srch)->attr_info));
320 srch++)
321 ;
322
323 context->search_index = srch;
324 if (cres)
325 return (sk_MEM_OBJECT_DATA_value(store->data, srch))->object;
326 return NULL;
327 }
328static int mem_list_end(STORE *s, void *handle)
329 {
330 struct mem_ctx_st *context = (struct mem_ctx_st *)handle;
331
332 if (!context)
333 {
334 STOREerr(STORE_F_MEM_LIST_END, ERR_R_PASSED_NULL_PARAMETER);
335 return 0;
336 }
337 if (context && context->search_attributes)
338 sk_STORE_ATTR_INFO_free(context->search_attributes);
339 if (context) OPENSSL_free(context);
340 return 1;
341 }
342static int mem_list_endp(STORE *s, void *handle)
343 {
344 struct mem_ctx_st *context = (struct mem_ctx_st *)handle;
345
346 if (!context
347 || context->search_index
348 == sk_STORE_ATTR_INFO_num(context->search_attributes))
349 return 1;
350 return 0;
351 }
352static int mem_lock(STORE *s, OPENSSL_ITEM attributes[],
353 OPENSSL_ITEM parameters[])
354 {
355 return 1;
356 }
357static int mem_unlock(STORE *s, OPENSSL_ITEM attributes[],
358 OPENSSL_ITEM parameters[])
359 {
360 return 1;
361 }
362static int mem_ctrl(STORE *s, int cmd, long l, void *p, void (*f)(void))
363 {
364 return 1;
365 }
diff --git a/src/lib/libcrypto/store/str_meth.c b/src/lib/libcrypto/store/str_meth.c
new file mode 100644
index 0000000000..a46de03a26
--- /dev/null
+++ b/src/lib/libcrypto/store/str_meth.c
@@ -0,0 +1,250 @@
1/* crypto/store/str_meth.c -*- mode:C; c-file-style: "eay" -*- */
2/* Written by Richard Levitte (richard@levitte.org) for the OpenSSL
3 * project 2003.
4 */
5/* ====================================================================
6 * Copyright (c) 2003 The OpenSSL Project. All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 *
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 *
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in
17 * the documentation and/or other materials provided with the
18 * distribution.
19 *
20 * 3. All advertising materials mentioning features or use of this
21 * software must display the following acknowledgment:
22 * "This product includes software developed by the OpenSSL Project
23 * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
24 *
25 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
26 * endorse or promote products derived from this software without
27 * prior written permission. For written permission, please contact
28 * openssl-core@openssl.org.
29 *
30 * 5. Products derived from this software may not be called "OpenSSL"
31 * nor may "OpenSSL" appear in their names without prior written
32 * permission of the OpenSSL Project.
33 *
34 * 6. Redistributions of any form whatsoever must retain the following
35 * acknowledgment:
36 * "This product includes software developed by the OpenSSL Project
37 * for use in the OpenSSL Toolkit (http://www.openssl.org/)"
38 *
39 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
40 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
41 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
42 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
43 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
44 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
45 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
46 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
47 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
48 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
49 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50 * OF THE POSSIBILITY OF SUCH DAMAGE.
51 * ====================================================================
52 *
53 * This product includes cryptographic software written by Eric Young
54 * (eay@cryptsoft.com). This product includes software written by Tim
55 * Hudson (tjh@cryptsoft.com).
56 *
57 */
58
59#include <string.h>
60#include <openssl/buffer.h>
61#include "str_locl.h"
62
63STORE_METHOD *STORE_create_method(char *name)
64 {
65 STORE_METHOD *store_method = (STORE_METHOD *)OPENSSL_malloc(sizeof(STORE_METHOD));
66
67 if (store_method)
68 {
69 memset(store_method, 0, sizeof(*store_method));
70 store_method->name = BUF_strdup(name);
71 }
72 return store_method;
73 }
74
75/* BIG FSCKING WARNING!!!! If you use this on a statically allocated method
76 (that is, it hasn't been allocated using STORE_create_method(), you deserve
77 anything Murphy can throw at you and more! You have been warned. */
78void STORE_destroy_method(STORE_METHOD *store_method)
79 {
80 if (!store_method) return;
81 OPENSSL_free(store_method->name);
82 store_method->name = NULL;
83 OPENSSL_free(store_method);
84 }
85
86int STORE_method_set_initialise_function(STORE_METHOD *sm, STORE_INITIALISE_FUNC_PTR init_f)
87 {
88 sm->init = init_f;
89 return 1;
90 }
91
92int STORE_method_set_cleanup_function(STORE_METHOD *sm, STORE_CLEANUP_FUNC_PTR clean_f)
93 {
94 sm->clean = clean_f;
95 return 1;
96 }
97
98int STORE_method_set_generate_function(STORE_METHOD *sm, STORE_GENERATE_OBJECT_FUNC_PTR generate_f)
99 {
100 sm->generate_object = generate_f;
101 return 1;
102 }
103
104int STORE_method_set_get_function(STORE_METHOD *sm, STORE_GET_OBJECT_FUNC_PTR get_f)
105 {
106 sm->get_object = get_f;
107 return 1;
108 }
109
110int STORE_method_set_store_function(STORE_METHOD *sm, STORE_STORE_OBJECT_FUNC_PTR store_f)
111 {
112 sm->store_object = store_f;
113 return 1;
114 }
115
116int STORE_method_set_modify_function(STORE_METHOD *sm, STORE_MODIFY_OBJECT_FUNC_PTR modify_f)
117 {
118 sm->modify_object = modify_f;
119 return 1;
120 }
121
122int STORE_method_set_revoke_function(STORE_METHOD *sm, STORE_HANDLE_OBJECT_FUNC_PTR revoke_f)
123 {
124 sm->revoke_object = revoke_f;
125 return 1;
126 }
127
128int STORE_method_set_delete_function(STORE_METHOD *sm, STORE_HANDLE_OBJECT_FUNC_PTR delete_f)
129 {
130 sm->delete_object = delete_f;
131 return 1;
132 }
133
134int STORE_method_set_list_start_function(STORE_METHOD *sm, STORE_START_OBJECT_FUNC_PTR list_start_f)
135 {
136 sm->list_object_start = list_start_f;
137 return 1;
138 }
139
140int STORE_method_set_list_next_function(STORE_METHOD *sm, STORE_NEXT_OBJECT_FUNC_PTR list_next_f)
141 {
142 sm->list_object_next = list_next_f;
143 return 1;
144 }
145
146int STORE_method_set_list_end_function(STORE_METHOD *sm, STORE_END_OBJECT_FUNC_PTR list_end_f)
147 {
148 sm->list_object_end = list_end_f;
149 return 1;
150 }
151
152int STORE_method_set_update_store_function(STORE_METHOD *sm, STORE_GENERIC_FUNC_PTR update_f)
153 {
154 sm->update_store = update_f;
155 return 1;
156 }
157
158int STORE_method_set_lock_store_function(STORE_METHOD *sm, STORE_GENERIC_FUNC_PTR lock_f)
159 {
160 sm->lock_store = lock_f;
161 return 1;
162 }
163
164int STORE_method_set_unlock_store_function(STORE_METHOD *sm, STORE_GENERIC_FUNC_PTR unlock_f)
165 {
166 sm->unlock_store = unlock_f;
167 return 1;
168 }
169
170int STORE_method_set_ctrl_function(STORE_METHOD *sm, STORE_CTRL_FUNC_PTR ctrl_f)
171 {
172 sm->ctrl = ctrl_f;
173 return 1;
174 }
175
176STORE_INITIALISE_FUNC_PTR STORE_method_get_initialise_function(STORE_METHOD *sm)
177 {
178 return sm->init;
179 }
180
181STORE_CLEANUP_FUNC_PTR STORE_method_get_cleanup_function(STORE_METHOD *sm)
182 {
183 return sm->clean;
184 }
185
186STORE_GENERATE_OBJECT_FUNC_PTR STORE_method_get_generate_function(STORE_METHOD *sm)
187 {
188 return sm->generate_object;
189 }
190
191STORE_GET_OBJECT_FUNC_PTR STORE_method_get_get_function(STORE_METHOD *sm)
192 {
193 return sm->get_object;
194 }
195
196STORE_STORE_OBJECT_FUNC_PTR STORE_method_get_store_function(STORE_METHOD *sm)
197 {
198 return sm->store_object;
199 }
200
201STORE_MODIFY_OBJECT_FUNC_PTR STORE_method_get_modify_function(STORE_METHOD *sm)
202 {
203 return sm->modify_object;
204 }
205
206STORE_HANDLE_OBJECT_FUNC_PTR STORE_method_get_revoke_function(STORE_METHOD *sm)
207 {
208 return sm->revoke_object;
209 }
210
211STORE_HANDLE_OBJECT_FUNC_PTR STORE_method_get_delete_function(STORE_METHOD *sm)
212 {
213 return sm->delete_object;
214 }
215
216STORE_START_OBJECT_FUNC_PTR STORE_method_get_list_start_function(STORE_METHOD *sm)
217 {
218 return sm->list_object_start;
219 }
220
221STORE_NEXT_OBJECT_FUNC_PTR STORE_method_get_list_next_function(STORE_METHOD *sm)
222 {
223 return sm->list_object_next;
224 }
225
226STORE_END_OBJECT_FUNC_PTR STORE_method_get_list_end_function(STORE_METHOD *sm)
227 {
228 return sm->list_object_end;
229 }
230
231STORE_GENERIC_FUNC_PTR STORE_method_get_update_store_function(STORE_METHOD *sm)
232 {
233 return sm->update_store;
234 }
235
236STORE_GENERIC_FUNC_PTR STORE_method_get_lock_store_function(STORE_METHOD *sm)
237 {
238 return sm->lock_store;
239 }
240
241STORE_GENERIC_FUNC_PTR STORE_method_get_unlock_store_function(STORE_METHOD *sm)
242 {
243 return sm->unlock_store;
244 }
245
246STORE_CTRL_FUNC_PTR STORE_method_get_ctrl_function(STORE_METHOD *sm)
247 {
248 return sm->ctrl;
249 }
250
diff --git a/src/lib/libcrypto/symhacks.h b/src/lib/libcrypto/symhacks.h
new file mode 100644
index 0000000000..403f592dcd
--- /dev/null
+++ b/src/lib/libcrypto/symhacks.h
@@ -0,0 +1,477 @@
1/* ====================================================================
2 * Copyright (c) 1999 The OpenSSL Project. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 *
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 *
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in
13 * the documentation and/or other materials provided with the
14 * distribution.
15 *
16 * 3. All advertising materials mentioning features or use of this
17 * software must display the following acknowledgment:
18 * "This product includes software developed by the OpenSSL Project
19 * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
20 *
21 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
22 * endorse or promote products derived from this software without
23 * prior written permission. For written permission, please contact
24 * openssl-core@openssl.org.
25 *
26 * 5. Products derived from this software may not be called "OpenSSL"
27 * nor may "OpenSSL" appear in their names without prior written
28 * permission of the OpenSSL Project.
29 *
30 * 6. Redistributions of any form whatsoever must retain the following
31 * acknowledgment:
32 * "This product includes software developed by the OpenSSL Project
33 * for use in the OpenSSL Toolkit (http://www.openssl.org/)"
34 *
35 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
36 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
37 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
38 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
39 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
40 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
41 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
42 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
43 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
44 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
45 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
46 * OF THE POSSIBILITY OF SUCH DAMAGE.
47 * ====================================================================
48 *
49 * This product includes cryptographic software written by Eric Young
50 * (eay@cryptsoft.com). This product includes software written by Tim
51 * Hudson (tjh@cryptsoft.com).
52 *
53 */
54
55#ifndef HEADER_SYMHACKS_H
56#define HEADER_SYMHACKS_H
57
58#include <openssl/e_os2.h>
59
60/* Hacks to solve the problem with linkers incapable of handling very long
61 symbol names. In the case of VMS, the limit is 31 characters on VMS for
62 VAX. */
63/* Note that this affects util/libeay.num and util/ssleay.num... you may
64 change those manually, but that's not recommended, as those files are
65 controlled centrally and updated on Unix, and the central definition
66 may disagree with yours, which in turn may come with shareable library
67 incompatibilities. */
68#ifdef OPENSSL_SYS_VMS
69
70/* Hack a long name in crypto/ex_data.c */
71#undef CRYPTO_get_ex_data_implementation
72#define CRYPTO_get_ex_data_implementation CRYPTO_get_ex_data_impl
73#undef CRYPTO_set_ex_data_implementation
74#define CRYPTO_set_ex_data_implementation CRYPTO_set_ex_data_impl
75
76/* Hack a long name in crypto/asn1/a_mbstr.c */
77#undef ASN1_STRING_set_default_mask_asc
78#define ASN1_STRING_set_default_mask_asc ASN1_STRING_set_def_mask_asc
79
80#if 0 /* No longer needed, since safestack macro magic does the job */
81/* Hack the names created with DECLARE_ASN1_SET_OF(PKCS7_SIGNER_INFO) */
82#undef i2d_ASN1_SET_OF_PKCS7_SIGNER_INFO
83#define i2d_ASN1_SET_OF_PKCS7_SIGNER_INFO i2d_ASN1_SET_OF_PKCS7_SIGINF
84#undef d2i_ASN1_SET_OF_PKCS7_SIGNER_INFO
85#define d2i_ASN1_SET_OF_PKCS7_SIGNER_INFO d2i_ASN1_SET_OF_PKCS7_SIGINF
86#endif
87
88#if 0 /* No longer needed, since safestack macro magic does the job */
89/* Hack the names created with DECLARE_ASN1_SET_OF(PKCS7_RECIP_INFO) */
90#undef i2d_ASN1_SET_OF_PKCS7_RECIP_INFO
91#define i2d_ASN1_SET_OF_PKCS7_RECIP_INFO i2d_ASN1_SET_OF_PKCS7_RECINF
92#undef d2i_ASN1_SET_OF_PKCS7_RECIP_INFO
93#define d2i_ASN1_SET_OF_PKCS7_RECIP_INFO d2i_ASN1_SET_OF_PKCS7_RECINF
94#endif
95
96#if 0 /* No longer needed, since safestack macro magic does the job */
97/* Hack the names created with DECLARE_ASN1_SET_OF(ACCESS_DESCRIPTION) */
98#undef i2d_ASN1_SET_OF_ACCESS_DESCRIPTION
99#define i2d_ASN1_SET_OF_ACCESS_DESCRIPTION i2d_ASN1_SET_OF_ACC_DESC
100#undef d2i_ASN1_SET_OF_ACCESS_DESCRIPTION
101#define d2i_ASN1_SET_OF_ACCESS_DESCRIPTION d2i_ASN1_SET_OF_ACC_DESC
102#endif
103
104/* Hack the names created with DECLARE_PEM_rw(NETSCAPE_CERT_SEQUENCE) */
105#undef PEM_read_NETSCAPE_CERT_SEQUENCE
106#define PEM_read_NETSCAPE_CERT_SEQUENCE PEM_read_NS_CERT_SEQ
107#undef PEM_write_NETSCAPE_CERT_SEQUENCE
108#define PEM_write_NETSCAPE_CERT_SEQUENCE PEM_write_NS_CERT_SEQ
109#undef PEM_read_bio_NETSCAPE_CERT_SEQUENCE
110#define PEM_read_bio_NETSCAPE_CERT_SEQUENCE PEM_read_bio_NS_CERT_SEQ
111#undef PEM_write_bio_NETSCAPE_CERT_SEQUENCE
112#define PEM_write_bio_NETSCAPE_CERT_SEQUENCE PEM_write_bio_NS_CERT_SEQ
113#undef PEM_write_cb_bio_NETSCAPE_CERT_SEQUENCE
114#define PEM_write_cb_bio_NETSCAPE_CERT_SEQUENCE PEM_write_cb_bio_NS_CERT_SEQ
115
116/* Hack the names created with DECLARE_PEM_rw(PKCS8_PRIV_KEY_INFO) */
117#undef PEM_read_PKCS8_PRIV_KEY_INFO
118#define PEM_read_PKCS8_PRIV_KEY_INFO PEM_read_P8_PRIV_KEY_INFO
119#undef PEM_write_PKCS8_PRIV_KEY_INFO
120#define PEM_write_PKCS8_PRIV_KEY_INFO PEM_write_P8_PRIV_KEY_INFO
121#undef PEM_read_bio_PKCS8_PRIV_KEY_INFO
122#define PEM_read_bio_PKCS8_PRIV_KEY_INFO PEM_read_bio_P8_PRIV_KEY_INFO
123#undef PEM_write_bio_PKCS8_PRIV_KEY_INFO
124#define PEM_write_bio_PKCS8_PRIV_KEY_INFO PEM_write_bio_P8_PRIV_KEY_INFO
125#undef PEM_write_cb_bio_PKCS8_PRIV_KEY_INFO
126#define PEM_write_cb_bio_PKCS8_PRIV_KEY_INFO PEM_wrt_cb_bio_P8_PRIV_KEY_INFO
127
128/* Hack other PEM names */
129#undef PEM_write_bio_PKCS8PrivateKey_nid
130#define PEM_write_bio_PKCS8PrivateKey_nid PEM_write_bio_PKCS8PrivKey_nid
131
132/* Hack some long X509 names */
133#undef X509_REVOKED_get_ext_by_critical
134#define X509_REVOKED_get_ext_by_critical X509_REVOKED_get_ext_by_critic
135#undef X509_policy_tree_get0_user_policies
136#define X509_policy_tree_get0_user_policies X509_pcy_tree_get0_usr_policies
137#undef X509_policy_node_get0_qualifiers
138#define X509_policy_node_get0_qualifiers X509_pcy_node_get0_qualifiers
139#undef X509_STORE_CTX_get_explicit_policy
140#define X509_STORE_CTX_get_explicit_policy X509_STORE_CTX_get_expl_policy
141#undef X509_STORE_CTX_get0_current_issuer
142#define X509_STORE_CTX_get0_current_issuer X509_STORE_CTX_get0_cur_issuer
143
144/* Hack some long CRYPTO names */
145#undef CRYPTO_set_dynlock_destroy_callback
146#define CRYPTO_set_dynlock_destroy_callback CRYPTO_set_dynlock_destroy_cb
147#undef CRYPTO_set_dynlock_create_callback
148#define CRYPTO_set_dynlock_create_callback CRYPTO_set_dynlock_create_cb
149#undef CRYPTO_set_dynlock_lock_callback
150#define CRYPTO_set_dynlock_lock_callback CRYPTO_set_dynlock_lock_cb
151#undef CRYPTO_get_dynlock_lock_callback
152#define CRYPTO_get_dynlock_lock_callback CRYPTO_get_dynlock_lock_cb
153#undef CRYPTO_get_dynlock_destroy_callback
154#define CRYPTO_get_dynlock_destroy_callback CRYPTO_get_dynlock_destroy_cb
155#undef CRYPTO_get_dynlock_create_callback
156#define CRYPTO_get_dynlock_create_callback CRYPTO_get_dynlock_create_cb
157#undef CRYPTO_set_locked_mem_ex_functions
158#define CRYPTO_set_locked_mem_ex_functions CRYPTO_set_locked_mem_ex_funcs
159#undef CRYPTO_get_locked_mem_ex_functions
160#define CRYPTO_get_locked_mem_ex_functions CRYPTO_get_locked_mem_ex_funcs
161
162/* Hack some long SSL names */
163#undef SSL_CTX_set_default_verify_paths
164#define SSL_CTX_set_default_verify_paths SSL_CTX_set_def_verify_paths
165#undef SSL_get_ex_data_X509_STORE_CTX_idx
166#define SSL_get_ex_data_X509_STORE_CTX_idx SSL_get_ex_d_X509_STORE_CTX_idx
167#undef SSL_add_file_cert_subjects_to_stack
168#define SSL_add_file_cert_subjects_to_stack SSL_add_file_cert_subjs_to_stk
169#undef SSL_add_dir_cert_subjects_to_stack
170#define SSL_add_dir_cert_subjects_to_stack SSL_add_dir_cert_subjs_to_stk
171#undef SSL_CTX_use_certificate_chain_file
172#define SSL_CTX_use_certificate_chain_file SSL_CTX_use_cert_chain_file
173#undef SSL_CTX_set_cert_verify_callback
174#define SSL_CTX_set_cert_verify_callback SSL_CTX_set_cert_verify_cb
175#undef SSL_CTX_set_default_passwd_cb_userdata
176#define SSL_CTX_set_default_passwd_cb_userdata SSL_CTX_set_def_passwd_cb_ud
177#undef SSL_COMP_get_compression_methods
178#define SSL_COMP_get_compression_methods SSL_COMP_get_compress_methods
179#undef ssl_add_clienthello_renegotiate_ext
180#define ssl_add_clienthello_renegotiate_ext ssl_add_clienthello_reneg_ext
181#undef ssl_add_serverhello_renegotiate_ext
182#define ssl_add_serverhello_renegotiate_ext ssl_add_serverhello_reneg_ext
183#undef ssl_parse_clienthello_renegotiate_ext
184#define ssl_parse_clienthello_renegotiate_ext ssl_parse_clienthello_reneg_ext
185#undef ssl_parse_serverhello_renegotiate_ext
186#define ssl_parse_serverhello_renegotiate_ext ssl_parse_serverhello_reneg_ext
187#undef SSL_srp_server_param_with_username
188#define SSL_srp_server_param_with_username SSL_srp_server_param_with_un
189#undef SSL_CTX_set_srp_client_pwd_callback
190#define SSL_CTX_set_srp_client_pwd_callback SSL_CTX_set_srp_client_pwd_cb
191#undef SSL_CTX_set_srp_verify_param_callback
192#define SSL_CTX_set_srp_verify_param_callback SSL_CTX_set_srp_vfy_param_cb
193#undef SSL_CTX_set_srp_username_callback
194#define SSL_CTX_set_srp_username_callback SSL_CTX_set_srp_un_cb
195#undef ssl_add_clienthello_use_srtp_ext
196#define ssl_add_clienthello_use_srtp_ext ssl_add_clihello_use_srtp_ext
197#undef ssl_add_serverhello_use_srtp_ext
198#define ssl_add_serverhello_use_srtp_ext ssl_add_serhello_use_srtp_ext
199#undef ssl_parse_clienthello_use_srtp_ext
200#define ssl_parse_clienthello_use_srtp_ext ssl_parse_clihello_use_srtp_ext
201#undef ssl_parse_serverhello_use_srtp_ext
202#define ssl_parse_serverhello_use_srtp_ext ssl_parse_serhello_use_srtp_ext
203#undef SSL_CTX_set_next_protos_advertised_cb
204#define SSL_CTX_set_next_protos_advertised_cb SSL_CTX_set_next_protos_adv_cb
205#undef SSL_CTX_set_next_proto_select_cb
206#define SSL_CTX_set_next_proto_select_cb SSL_CTX_set_next_proto_sel_cb
207
208/* Hack some long ENGINE names */
209#undef ENGINE_get_default_BN_mod_exp_crt
210#define ENGINE_get_default_BN_mod_exp_crt ENGINE_get_def_BN_mod_exp_crt
211#undef ENGINE_set_default_BN_mod_exp_crt
212#define ENGINE_set_default_BN_mod_exp_crt ENGINE_set_def_BN_mod_exp_crt
213#undef ENGINE_set_load_privkey_function
214#define ENGINE_set_load_privkey_function ENGINE_set_load_privkey_fn
215#undef ENGINE_get_load_privkey_function
216#define ENGINE_get_load_privkey_function ENGINE_get_load_privkey_fn
217#undef ENGINE_unregister_pkey_asn1_meths
218#define ENGINE_unregister_pkey_asn1_meths ENGINE_unreg_pkey_asn1_meths
219#undef ENGINE_register_all_pkey_asn1_meths
220#define ENGINE_register_all_pkey_asn1_meths ENGINE_reg_all_pkey_asn1_meths
221#undef ENGINE_set_default_pkey_asn1_meths
222#define ENGINE_set_default_pkey_asn1_meths ENGINE_set_def_pkey_asn1_meths
223#undef ENGINE_get_pkey_asn1_meth_engine
224#define ENGINE_get_pkey_asn1_meth_engine ENGINE_get_pkey_asn1_meth_eng
225#undef ENGINE_set_load_ssl_client_cert_function
226#define ENGINE_set_load_ssl_client_cert_function \
227 ENGINE_set_ld_ssl_clnt_cert_fn
228#undef ENGINE_get_ssl_client_cert_function
229#define ENGINE_get_ssl_client_cert_function ENGINE_get_ssl_client_cert_fn
230
231/* Hack some long OCSP names */
232#undef OCSP_REQUEST_get_ext_by_critical
233#define OCSP_REQUEST_get_ext_by_critical OCSP_REQUEST_get_ext_by_crit
234#undef OCSP_BASICRESP_get_ext_by_critical
235#define OCSP_BASICRESP_get_ext_by_critical OCSP_BASICRESP_get_ext_by_crit
236#undef OCSP_SINGLERESP_get_ext_by_critical
237#define OCSP_SINGLERESP_get_ext_by_critical OCSP_SINGLERESP_get_ext_by_crit
238
239/* Hack some long DES names */
240#undef _ossl_old_des_ede3_cfb64_encrypt
241#define _ossl_old_des_ede3_cfb64_encrypt _ossl_odes_ede3_cfb64_encrypt
242#undef _ossl_old_des_ede3_ofb64_encrypt
243#define _ossl_old_des_ede3_ofb64_encrypt _ossl_odes_ede3_ofb64_encrypt
244
245/* Hack some long EVP names */
246#undef OPENSSL_add_all_algorithms_noconf
247#define OPENSSL_add_all_algorithms_noconf OPENSSL_add_all_algo_noconf
248#undef OPENSSL_add_all_algorithms_conf
249#define OPENSSL_add_all_algorithms_conf OPENSSL_add_all_algo_conf
250#undef EVP_PKEY_meth_set_verify_recover
251#define EVP_PKEY_meth_set_verify_recover EVP_PKEY_meth_set_vrfy_recover
252
253/* Hack some long EC names */
254#undef EC_GROUP_set_point_conversion_form
255#define EC_GROUP_set_point_conversion_form EC_GROUP_set_point_conv_form
256#undef EC_GROUP_get_point_conversion_form
257#define EC_GROUP_get_point_conversion_form EC_GROUP_get_point_conv_form
258#undef EC_GROUP_clear_free_all_extra_data
259#define EC_GROUP_clear_free_all_extra_data EC_GROUP_clr_free_all_xtra_data
260#undef EC_KEY_set_public_key_affine_coordinates
261#define EC_KEY_set_public_key_affine_coordinates \
262 EC_KEY_set_pub_key_aff_coords
263#undef EC_POINT_set_Jprojective_coordinates_GFp
264#define EC_POINT_set_Jprojective_coordinates_GFp \
265 EC_POINT_set_Jproj_coords_GFp
266#undef EC_POINT_get_Jprojective_coordinates_GFp
267#define EC_POINT_get_Jprojective_coordinates_GFp \
268 EC_POINT_get_Jproj_coords_GFp
269#undef EC_POINT_set_affine_coordinates_GFp
270#define EC_POINT_set_affine_coordinates_GFp EC_POINT_set_affine_coords_GFp
271#undef EC_POINT_get_affine_coordinates_GFp
272#define EC_POINT_get_affine_coordinates_GFp EC_POINT_get_affine_coords_GFp
273#undef EC_POINT_set_compressed_coordinates_GFp
274#define EC_POINT_set_compressed_coordinates_GFp EC_POINT_set_compr_coords_GFp
275#undef EC_POINT_set_affine_coordinates_GF2m
276#define EC_POINT_set_affine_coordinates_GF2m EC_POINT_set_affine_coords_GF2m
277#undef EC_POINT_get_affine_coordinates_GF2m
278#define EC_POINT_get_affine_coordinates_GF2m EC_POINT_get_affine_coords_GF2m
279#undef EC_POINT_set_compressed_coordinates_GF2m
280#define EC_POINT_set_compressed_coordinates_GF2m \
281 EC_POINT_set_compr_coords_GF2m
282#undef ec_GF2m_simple_group_clear_finish
283#define ec_GF2m_simple_group_clear_finish ec_GF2m_simple_grp_clr_finish
284#undef ec_GF2m_simple_group_check_discriminant
285#define ec_GF2m_simple_group_check_discriminant ec_GF2m_simple_grp_chk_discrim
286#undef ec_GF2m_simple_point_clear_finish
287#define ec_GF2m_simple_point_clear_finish ec_GF2m_simple_pt_clr_finish
288#undef ec_GF2m_simple_point_set_to_infinity
289#define ec_GF2m_simple_point_set_to_infinity ec_GF2m_simple_pt_set_to_inf
290#undef ec_GF2m_simple_points_make_affine
291#define ec_GF2m_simple_points_make_affine ec_GF2m_simple_pts_make_affine
292#undef ec_GF2m_simple_point_set_affine_coordinates
293#define ec_GF2m_simple_point_set_affine_coordinates \
294 ec_GF2m_smp_pt_set_af_coords
295#undef ec_GF2m_simple_point_get_affine_coordinates
296#define ec_GF2m_simple_point_get_affine_coordinates \
297 ec_GF2m_smp_pt_get_af_coords
298#undef ec_GF2m_simple_set_compressed_coordinates
299#define ec_GF2m_simple_set_compressed_coordinates \
300 ec_GF2m_smp_set_compr_coords
301#undef ec_GFp_simple_group_set_curve_GFp
302#define ec_GFp_simple_group_set_curve_GFp ec_GFp_simple_grp_set_curve_GFp
303#undef ec_GFp_simple_group_get_curve_GFp
304#define ec_GFp_simple_group_get_curve_GFp ec_GFp_simple_grp_get_curve_GFp
305#undef ec_GFp_simple_group_clear_finish
306#define ec_GFp_simple_group_clear_finish ec_GFp_simple_grp_clear_finish
307#undef ec_GFp_simple_group_set_generator
308#define ec_GFp_simple_group_set_generator ec_GFp_simple_grp_set_generator
309#undef ec_GFp_simple_group_get0_generator
310#define ec_GFp_simple_group_get0_generator ec_GFp_simple_grp_gt0_generator
311#undef ec_GFp_simple_group_get_cofactor
312#define ec_GFp_simple_group_get_cofactor ec_GFp_simple_grp_get_cofactor
313#undef ec_GFp_simple_point_clear_finish
314#define ec_GFp_simple_point_clear_finish ec_GFp_simple_pt_clear_finish
315#undef ec_GFp_simple_point_set_to_infinity
316#define ec_GFp_simple_point_set_to_infinity ec_GFp_simple_pt_set_to_inf
317#undef ec_GFp_simple_points_make_affine
318#define ec_GFp_simple_points_make_affine ec_GFp_simple_pts_make_affine
319#undef ec_GFp_simple_group_get_curve_GFp
320#define ec_GFp_simple_group_get_curve_GFp ec_GFp_simple_grp_get_curve_GFp
321#undef ec_GFp_simple_set_Jprojective_coordinates_GFp
322#define ec_GFp_simple_set_Jprojective_coordinates_GFp \
323 ec_GFp_smp_set_Jproj_coords_GFp
324#undef ec_GFp_simple_get_Jprojective_coordinates_GFp
325#define ec_GFp_simple_get_Jprojective_coordinates_GFp \
326 ec_GFp_smp_get_Jproj_coords_GFp
327#undef ec_GFp_simple_point_set_affine_coordinates_GFp
328#define ec_GFp_simple_point_set_affine_coordinates_GFp \
329 ec_GFp_smp_pt_set_af_coords_GFp
330#undef ec_GFp_simple_point_get_affine_coordinates_GFp
331#define ec_GFp_simple_point_get_affine_coordinates_GFp \
332 ec_GFp_smp_pt_get_af_coords_GFp
333#undef ec_GFp_simple_set_compressed_coordinates_GFp
334#define ec_GFp_simple_set_compressed_coordinates_GFp \
335 ec_GFp_smp_set_compr_coords_GFp
336#undef ec_GFp_simple_point_set_affine_coordinates
337#define ec_GFp_simple_point_set_affine_coordinates \
338 ec_GFp_smp_pt_set_af_coords
339#undef ec_GFp_simple_point_get_affine_coordinates
340#define ec_GFp_simple_point_get_affine_coordinates \
341 ec_GFp_smp_pt_get_af_coords
342#undef ec_GFp_simple_set_compressed_coordinates
343#define ec_GFp_simple_set_compressed_coordinates \
344 ec_GFp_smp_set_compr_coords
345#undef ec_GFp_simple_group_check_discriminant
346#define ec_GFp_simple_group_check_discriminant ec_GFp_simple_grp_chk_discrim
347
348/* Hack som long STORE names */
349#undef STORE_method_set_initialise_function
350#define STORE_method_set_initialise_function STORE_meth_set_initialise_fn
351#undef STORE_method_set_cleanup_function
352#define STORE_method_set_cleanup_function STORE_meth_set_cleanup_fn
353#undef STORE_method_set_generate_function
354#define STORE_method_set_generate_function STORE_meth_set_generate_fn
355#undef STORE_method_set_modify_function
356#define STORE_method_set_modify_function STORE_meth_set_modify_fn
357#undef STORE_method_set_revoke_function
358#define STORE_method_set_revoke_function STORE_meth_set_revoke_fn
359#undef STORE_method_set_delete_function
360#define STORE_method_set_delete_function STORE_meth_set_delete_fn
361#undef STORE_method_set_list_start_function
362#define STORE_method_set_list_start_function STORE_meth_set_list_start_fn
363#undef STORE_method_set_list_next_function
364#define STORE_method_set_list_next_function STORE_meth_set_list_next_fn
365#undef STORE_method_set_list_end_function
366#define STORE_method_set_list_end_function STORE_meth_set_list_end_fn
367#undef STORE_method_set_update_store_function
368#define STORE_method_set_update_store_function STORE_meth_set_update_store_fn
369#undef STORE_method_set_lock_store_function
370#define STORE_method_set_lock_store_function STORE_meth_set_lock_store_fn
371#undef STORE_method_set_unlock_store_function
372#define STORE_method_set_unlock_store_function STORE_meth_set_unlock_store_fn
373#undef STORE_method_get_initialise_function
374#define STORE_method_get_initialise_function STORE_meth_get_initialise_fn
375#undef STORE_method_get_cleanup_function
376#define STORE_method_get_cleanup_function STORE_meth_get_cleanup_fn
377#undef STORE_method_get_generate_function
378#define STORE_method_get_generate_function STORE_meth_get_generate_fn
379#undef STORE_method_get_modify_function
380#define STORE_method_get_modify_function STORE_meth_get_modify_fn
381#undef STORE_method_get_revoke_function
382#define STORE_method_get_revoke_function STORE_meth_get_revoke_fn
383#undef STORE_method_get_delete_function
384#define STORE_method_get_delete_function STORE_meth_get_delete_fn
385#undef STORE_method_get_list_start_function
386#define STORE_method_get_list_start_function STORE_meth_get_list_start_fn
387#undef STORE_method_get_list_next_function
388#define STORE_method_get_list_next_function STORE_meth_get_list_next_fn
389#undef STORE_method_get_list_end_function
390#define STORE_method_get_list_end_function STORE_meth_get_list_end_fn
391#undef STORE_method_get_update_store_function
392#define STORE_method_get_update_store_function STORE_meth_get_update_store_fn
393#undef STORE_method_get_lock_store_function
394#define STORE_method_get_lock_store_function STORE_meth_get_lock_store_fn
395#undef STORE_method_get_unlock_store_function
396#define STORE_method_get_unlock_store_function STORE_meth_get_unlock_store_fn
397
398/* Hack some long TS names */
399#undef TS_RESP_CTX_set_status_info_cond
400#define TS_RESP_CTX_set_status_info_cond TS_RESP_CTX_set_stat_info_cond
401#undef TS_RESP_CTX_set_clock_precision_digits
402#define TS_RESP_CTX_set_clock_precision_digits TS_RESP_CTX_set_clk_prec_digits
403#undef TS_CONF_set_clock_precision_digits
404#define TS_CONF_set_clock_precision_digits TS_CONF_set_clk_prec_digits
405
406/* Hack some long CMS names */
407#undef CMS_RecipientInfo_ktri_get0_algs
408#define CMS_RecipientInfo_ktri_get0_algs CMS_RecipInfo_ktri_get0_algs
409#undef CMS_RecipientInfo_ktri_get0_signer_id
410#define CMS_RecipientInfo_ktri_get0_signer_id CMS_RecipInfo_ktri_get0_sigr_id
411#undef CMS_OtherRevocationInfoFormat_it
412#define CMS_OtherRevocationInfoFormat_it CMS_OtherRevocInfoFormat_it
413#undef CMS_KeyAgreeRecipientIdentifier_it
414#define CMS_KeyAgreeRecipientIdentifier_it CMS_KeyAgreeRecipIdentifier_it
415#undef CMS_OriginatorIdentifierOrKey_it
416#define CMS_OriginatorIdentifierOrKey_it CMS_OriginatorIdOrKey_it
417#undef cms_SignerIdentifier_get0_signer_id
418#define cms_SignerIdentifier_get0_signer_id cms_SignerId_get0_signer_id
419
420/* Hack some long DTLS1 names */
421#undef dtls1_retransmit_buffered_messages
422#define dtls1_retransmit_buffered_messages dtls1_retransmit_buffered_msgs
423
424/* Hack some long SRP names */
425#undef SRP_generate_server_master_secret
426#define SRP_generate_server_master_secret SRP_gen_server_master_secret
427#undef SRP_generate_client_master_secret
428#define SRP_generate_client_master_secret SRP_gen_client_master_secret
429
430/* Hack some long UI names */
431#undef UI_method_get_prompt_constructor
432#define UI_method_get_prompt_constructor UI_method_get_prompt_constructr
433#undef UI_method_set_prompt_constructor
434#define UI_method_set_prompt_constructor UI_method_set_prompt_constructr
435
436#endif /* defined OPENSSL_SYS_VMS */
437
438
439/* Case insensitive linking causes problems.... */
440#if defined(OPENSSL_SYS_VMS) || defined(OPENSSL_SYS_OS2)
441#undef ERR_load_CRYPTO_strings
442#define ERR_load_CRYPTO_strings ERR_load_CRYPTOlib_strings
443#undef OCSP_crlID_new
444#define OCSP_crlID_new OCSP_crlID2_new
445
446#undef d2i_ECPARAMETERS
447#define d2i_ECPARAMETERS d2i_UC_ECPARAMETERS
448#undef i2d_ECPARAMETERS
449#define i2d_ECPARAMETERS i2d_UC_ECPARAMETERS
450#undef d2i_ECPKPARAMETERS
451#define d2i_ECPKPARAMETERS d2i_UC_ECPKPARAMETERS
452#undef i2d_ECPKPARAMETERS
453#define i2d_ECPKPARAMETERS i2d_UC_ECPKPARAMETERS
454
455/* These functions do not seem to exist! However, I'm paranoid...
456 Original command in x509v3.h:
457 These functions are being redefined in another directory,
458 and clash when the linker is case-insensitive, so let's
459 hide them a little, by giving them an extra 'o' at the
460 beginning of the name... */
461#undef X509v3_cleanup_extensions
462#define X509v3_cleanup_extensions oX509v3_cleanup_extensions
463#undef X509v3_add_extension
464#define X509v3_add_extension oX509v3_add_extension
465#undef X509v3_add_netscape_extensions
466#define X509v3_add_netscape_extensions oX509v3_add_netscape_extensions
467#undef X509v3_add_standard_extensions
468#define X509v3_add_standard_extensions oX509v3_add_standard_extensions
469
470/* This one clashes with CMS_data_create */
471#undef cms_Data_create
472#define cms_Data_create priv_cms_Data_create
473
474#endif
475
476
477#endif /* ! defined HEADER_VMS_IDHACKS_H */
diff --git a/src/lib/libcrypto/threads/README b/src/lib/libcrypto/threads/README
new file mode 100644
index 0000000000..df6b26e146
--- /dev/null
+++ b/src/lib/libcrypto/threads/README
@@ -0,0 +1,14 @@
1Mutithreading testing area.
2
3Since this stuff is very very platorm specific, this is not part of the
4normal build. Have a read of doc/threads.doc.
5
6mttest will do some testing and will currently build under Windows NT/95,
7Solaris and Linux. The IRIX stuff is not finished.
8
9I have tested this program on a 12 CPU ultra sparc box (solaris 2.5.1)
10and things seem to work ok.
11
12The Linux pthreads package can be retrieved from
13http://www.mit.edu:8001/people/proven/pthreads.html
14
diff --git a/src/lib/libcrypto/threads/mttest.c b/src/lib/libcrypto/threads/mttest.c
new file mode 100644
index 0000000000..eba7aa8a6e
--- /dev/null
+++ b/src/lib/libcrypto/threads/mttest.c
@@ -0,0 +1,1310 @@
1/* crypto/threads/mttest.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
59#include <stdio.h>
60#include <stdlib.h>
61#include <string.h>
62#include <errno.h>
63#ifdef LINUX
64#include <typedefs.h>
65#endif
66#ifdef OPENSSL_SYS_WIN32
67#include <windows.h>
68#endif
69#ifdef SOLARIS
70#include <synch.h>
71#include <thread.h>
72#endif
73#ifdef IRIX
74#include <ulocks.h>
75#include <sys/prctl.h>
76#endif
77#ifdef PTHREADS
78#include <pthread.h>
79#endif
80#ifdef OPENSSL_SYS_NETWARE
81#if !defined __int64
82# define __int64 long long
83#endif
84#include <nwmpk.h>
85#endif
86#include <openssl/lhash.h>
87#include <openssl/crypto.h>
88#include <openssl/buffer.h>
89#include "../../e_os.h"
90#include <openssl/x509.h>
91#include <openssl/ssl.h>
92#include <openssl/err.h>
93#include <openssl/rand.h>
94
95#ifdef OPENSSL_NO_FP_API
96#define APPS_WIN16
97#include "../buffer/bss_file.c"
98#endif
99
100#ifdef OPENSSL_SYS_NETWARE
101#define TEST_SERVER_CERT "/openssl/apps/server.pem"
102#define TEST_CLIENT_CERT "/openssl/apps/client.pem"
103#else
104#define TEST_SERVER_CERT "../../apps/server.pem"
105#define TEST_CLIENT_CERT "../../apps/client.pem"
106#endif
107
108#define MAX_THREAD_NUMBER 100
109
110int MS_CALLBACK verify_callback(int ok, X509_STORE_CTX *xs);
111void thread_setup(void);
112void thread_cleanup(void);
113void do_threads(SSL_CTX *s_ctx,SSL_CTX *c_ctx);
114
115void irix_locking_callback(int mode,int type,char *file,int line);
116void solaris_locking_callback(int mode,int type,char *file,int line);
117void win32_locking_callback(int mode,int type,char *file,int line);
118void pthreads_locking_callback(int mode,int type,char *file,int line);
119void netware_locking_callback(int mode,int type,char *file,int line);
120void beos_locking_callback(int mode,int type,const char *file,int line);
121
122unsigned long irix_thread_id(void );
123unsigned long solaris_thread_id(void );
124unsigned long pthreads_thread_id(void );
125unsigned long netware_thread_id(void );
126unsigned long beos_thread_id(void );
127
128#if defined(OPENSSL_SYS_NETWARE)
129static MPKMutex *lock_cs;
130static MPKSema ThreadSem;
131static long *lock_count;
132#endif
133
134BIO *bio_err=NULL;
135BIO *bio_stdout=NULL;
136
137static char *cipher=NULL;
138int verbose=0;
139#ifdef FIONBIO
140static int s_nbio=0;
141#endif
142
143int thread_number=10;
144int number_of_loops=10;
145int reconnect=0;
146int cache_stats=0;
147
148static const char rnd_seed[] = "string to make the random number generator think it has entropy";
149
150int doit(char *ctx[4]);
151static void print_stats(FILE *fp, SSL_CTX *ctx)
152{
153 fprintf(fp,"%4ld items in the session cache\n",
154 SSL_CTX_sess_number(ctx));
155 fprintf(fp,"%4d client connects (SSL_connect())\n",
156 SSL_CTX_sess_connect(ctx));
157 fprintf(fp,"%4d client connects that finished\n",
158 SSL_CTX_sess_connect_good(ctx));
159 fprintf(fp,"%4d server connects (SSL_accept())\n",
160 SSL_CTX_sess_accept(ctx));
161 fprintf(fp,"%4d server connects that finished\n",
162 SSL_CTX_sess_accept_good(ctx));
163 fprintf(fp,"%4d session cache hits\n",SSL_CTX_sess_hits(ctx));
164 fprintf(fp,"%4d session cache misses\n",SSL_CTX_sess_misses(ctx));
165 fprintf(fp,"%4d session cache timeouts\n",SSL_CTX_sess_timeouts(ctx));
166 }
167
168static void sv_usage(void)
169 {
170 fprintf(stderr,"usage: ssltest [args ...]\n");
171 fprintf(stderr,"\n");
172 fprintf(stderr," -server_auth - check server certificate\n");
173 fprintf(stderr," -client_auth - do client authentication\n");
174 fprintf(stderr," -v - more output\n");
175 fprintf(stderr," -CApath arg - PEM format directory of CA's\n");
176 fprintf(stderr," -CAfile arg - PEM format file of CA's\n");
177 fprintf(stderr," -threads arg - number of threads\n");
178 fprintf(stderr," -loops arg - number of 'connections', per thread\n");
179 fprintf(stderr," -reconnect - reuse session-id's\n");
180 fprintf(stderr," -stats - server session-id cache stats\n");
181 fprintf(stderr," -cert arg - server certificate/key\n");
182 fprintf(stderr," -ccert arg - client certificate/key\n");
183 fprintf(stderr," -ssl3 - just SSLv3n\n");
184 }
185
186int main(int argc, char *argv[])
187 {
188 char *CApath=NULL,*CAfile=NULL;
189 int badop=0;
190 int ret=1;
191 int client_auth=0;
192 int server_auth=0;
193 SSL_CTX *s_ctx=NULL;
194 SSL_CTX *c_ctx=NULL;
195 char *scert=TEST_SERVER_CERT;
196 char *ccert=TEST_CLIENT_CERT;
197 SSL_METHOD *ssl_method=SSLv23_method();
198
199 RAND_seed(rnd_seed, sizeof rnd_seed);
200
201 if (bio_err == NULL)
202 bio_err=BIO_new_fp(stderr,BIO_NOCLOSE);
203 if (bio_stdout == NULL)
204 bio_stdout=BIO_new_fp(stdout,BIO_NOCLOSE);
205 argc--;
206 argv++;
207
208 while (argc >= 1)
209 {
210 if (strcmp(*argv,"-server_auth") == 0)
211 server_auth=1;
212 else if (strcmp(*argv,"-client_auth") == 0)
213 client_auth=1;
214 else if (strcmp(*argv,"-reconnect") == 0)
215 reconnect=1;
216 else if (strcmp(*argv,"-stats") == 0)
217 cache_stats=1;
218 else if (strcmp(*argv,"-ssl3") == 0)
219 ssl_method=SSLv3_method();
220 else if (strcmp(*argv,"-ssl2") == 0)
221 ssl_method=SSLv2_method();
222 else if (strcmp(*argv,"-CApath") == 0)
223 {
224 if (--argc < 1) goto bad;
225 CApath= *(++argv);
226 }
227 else if (strcmp(*argv,"-CAfile") == 0)
228 {
229 if (--argc < 1) goto bad;
230 CAfile= *(++argv);
231 }
232 else if (strcmp(*argv,"-cert") == 0)
233 {
234 if (--argc < 1) goto bad;
235 scert= *(++argv);
236 }
237 else if (strcmp(*argv,"-ccert") == 0)
238 {
239 if (--argc < 1) goto bad;
240 ccert= *(++argv);
241 }
242 else if (strcmp(*argv,"-threads") == 0)
243 {
244 if (--argc < 1) goto bad;
245 thread_number= atoi(*(++argv));
246 if (thread_number == 0) thread_number=1;
247 if (thread_number > MAX_THREAD_NUMBER)
248 thread_number=MAX_THREAD_NUMBER;
249 }
250 else if (strcmp(*argv,"-loops") == 0)
251 {
252 if (--argc < 1) goto bad;
253 number_of_loops= atoi(*(++argv));
254 if (number_of_loops == 0) number_of_loops=1;
255 }
256 else
257 {
258 fprintf(stderr,"unknown option %s\n",*argv);
259 badop=1;
260 break;
261 }
262 argc--;
263 argv++;
264 }
265 if (badop)
266 {
267bad:
268 sv_usage();
269 goto end;
270 }
271
272 if (cipher == NULL && OPENSSL_issetugid() == 0)
273 cipher=getenv("SSL_CIPHER");
274
275 SSL_load_error_strings();
276 OpenSSL_add_ssl_algorithms();
277
278 c_ctx=SSL_CTX_new(ssl_method);
279 s_ctx=SSL_CTX_new(ssl_method);
280 if ((c_ctx == NULL) || (s_ctx == NULL))
281 {
282 ERR_print_errors(bio_err);
283 goto end;
284 }
285
286 SSL_CTX_set_session_cache_mode(s_ctx,
287 SSL_SESS_CACHE_NO_AUTO_CLEAR|SSL_SESS_CACHE_SERVER);
288 SSL_CTX_set_session_cache_mode(c_ctx,
289 SSL_SESS_CACHE_NO_AUTO_CLEAR|SSL_SESS_CACHE_SERVER);
290
291 if (!SSL_CTX_use_certificate_file(s_ctx,scert,SSL_FILETYPE_PEM))
292 {
293 ERR_print_errors(bio_err);
294 }
295 else if (!SSL_CTX_use_RSAPrivateKey_file(s_ctx,scert,SSL_FILETYPE_PEM))
296 {
297 ERR_print_errors(bio_err);
298 goto end;
299 }
300
301 if (client_auth)
302 {
303 SSL_CTX_use_certificate_file(c_ctx,ccert,
304 SSL_FILETYPE_PEM);
305 SSL_CTX_use_RSAPrivateKey_file(c_ctx,ccert,
306 SSL_FILETYPE_PEM);
307 }
308
309 if ( (!SSL_CTX_load_verify_locations(s_ctx,CAfile,CApath)) ||
310 (!SSL_CTX_set_default_verify_paths(s_ctx)) ||
311 (!SSL_CTX_load_verify_locations(c_ctx,CAfile,CApath)) ||
312 (!SSL_CTX_set_default_verify_paths(c_ctx)))
313 {
314 fprintf(stderr,"SSL_load_verify_locations\n");
315 ERR_print_errors(bio_err);
316 goto end;
317 }
318
319 if (client_auth)
320 {
321 fprintf(stderr,"client authentication\n");
322 SSL_CTX_set_verify(s_ctx,
323 SSL_VERIFY_PEER|SSL_VERIFY_FAIL_IF_NO_PEER_CERT,
324 verify_callback);
325 }
326 if (server_auth)
327 {
328 fprintf(stderr,"server authentication\n");
329 SSL_CTX_set_verify(c_ctx,SSL_VERIFY_PEER,
330 verify_callback);
331 }
332
333 thread_setup();
334 do_threads(s_ctx,c_ctx);
335 thread_cleanup();
336end:
337
338 if (c_ctx != NULL)
339 {
340 fprintf(stderr,"Client SSL_CTX stats then free it\n");
341 print_stats(stderr,c_ctx);
342 SSL_CTX_free(c_ctx);
343 }
344 if (s_ctx != NULL)
345 {
346 fprintf(stderr,"Server SSL_CTX stats then free it\n");
347 print_stats(stderr,s_ctx);
348 if (cache_stats)
349 {
350 fprintf(stderr,"-----\n");
351 lh_stats(SSL_CTX_sessions(s_ctx),stderr);
352 fprintf(stderr,"-----\n");
353 /* lh_node_stats(SSL_CTX_sessions(s_ctx),stderr);
354 fprintf(stderr,"-----\n"); */
355 lh_node_usage_stats(SSL_CTX_sessions(s_ctx),stderr);
356 fprintf(stderr,"-----\n");
357 }
358 SSL_CTX_free(s_ctx);
359 fprintf(stderr,"done free\n");
360 }
361 exit(ret);
362 return(0);
363 }
364
365#define W_READ 1
366#define W_WRITE 2
367#define C_DONE 1
368#define S_DONE 2
369
370int ndoit(SSL_CTX *ssl_ctx[2])
371 {
372 int i;
373 int ret;
374 char *ctx[4];
375
376 ctx[0]=(char *)ssl_ctx[0];
377 ctx[1]=(char *)ssl_ctx[1];
378
379 if (reconnect)
380 {
381 ctx[2]=(char *)SSL_new(ssl_ctx[0]);
382 ctx[3]=(char *)SSL_new(ssl_ctx[1]);
383 }
384 else
385 {
386 ctx[2]=NULL;
387 ctx[3]=NULL;
388 }
389
390 fprintf(stdout,"started thread %lu\n",CRYPTO_thread_id());
391 for (i=0; i<number_of_loops; i++)
392 {
393/* fprintf(stderr,"%4d %2d ctx->ref (%3d,%3d)\n",
394 CRYPTO_thread_id(),i,
395 ssl_ctx[0]->references,
396 ssl_ctx[1]->references); */
397 /* pthread_delay_np(&tm);*/
398
399 ret=doit(ctx);
400 if (ret != 0)
401 {
402 fprintf(stdout,"error[%d] %lu - %d\n",
403 i,CRYPTO_thread_id(),ret);
404 return(ret);
405 }
406 }
407 fprintf(stdout,"DONE %lu\n",CRYPTO_thread_id());
408 if (reconnect)
409 {
410 SSL_free((SSL *)ctx[2]);
411 SSL_free((SSL *)ctx[3]);
412 }
413# ifdef OPENSSL_SYS_NETWARE
414 MPKSemaphoreSignal(ThreadSem);
415# endif
416 return(0);
417 }
418
419int doit(char *ctx[4])
420 {
421 SSL_CTX *s_ctx,*c_ctx;
422 static char cbuf[200],sbuf[200];
423 SSL *c_ssl=NULL;
424 SSL *s_ssl=NULL;
425 BIO *c_to_s=NULL;
426 BIO *s_to_c=NULL;
427 BIO *c_bio=NULL;
428 BIO *s_bio=NULL;
429 int c_r,c_w,s_r,s_w;
430 int c_want,s_want;
431 int i;
432 int done=0;
433 int c_write,s_write;
434 int do_server=0,do_client=0;
435
436 s_ctx=(SSL_CTX *)ctx[0];
437 c_ctx=(SSL_CTX *)ctx[1];
438
439 if (ctx[2] != NULL)
440 s_ssl=(SSL *)ctx[2];
441 else
442 s_ssl=SSL_new(s_ctx);
443
444 if (ctx[3] != NULL)
445 c_ssl=(SSL *)ctx[3];
446 else
447 c_ssl=SSL_new(c_ctx);
448
449 if ((s_ssl == NULL) || (c_ssl == NULL)) goto err;
450
451 c_to_s=BIO_new(BIO_s_mem());
452 s_to_c=BIO_new(BIO_s_mem());
453 if ((s_to_c == NULL) || (c_to_s == NULL)) goto err;
454
455 c_bio=BIO_new(BIO_f_ssl());
456 s_bio=BIO_new(BIO_f_ssl());
457 if ((c_bio == NULL) || (s_bio == NULL)) goto err;
458
459 SSL_set_connect_state(c_ssl);
460 SSL_set_bio(c_ssl,s_to_c,c_to_s);
461 BIO_set_ssl(c_bio,c_ssl,(ctx[2] == NULL)?BIO_CLOSE:BIO_NOCLOSE);
462
463 SSL_set_accept_state(s_ssl);
464 SSL_set_bio(s_ssl,c_to_s,s_to_c);
465 BIO_set_ssl(s_bio,s_ssl,(ctx[3] == NULL)?BIO_CLOSE:BIO_NOCLOSE);
466
467 c_r=0; s_r=1;
468 c_w=1; s_w=0;
469 c_want=W_WRITE;
470 s_want=0;
471 c_write=1,s_write=0;
472
473 /* We can always do writes */
474 for (;;)
475 {
476 do_server=0;
477 do_client=0;
478
479 i=(int)BIO_pending(s_bio);
480 if ((i && s_r) || s_w) do_server=1;
481
482 i=(int)BIO_pending(c_bio);
483 if ((i && c_r) || c_w) do_client=1;
484
485 if (do_server && verbose)
486 {
487 if (SSL_in_init(s_ssl))
488 printf("server waiting in SSL_accept - %s\n",
489 SSL_state_string_long(s_ssl));
490 else if (s_write)
491 printf("server:SSL_write()\n");
492 else
493 printf("server:SSL_read()\n");
494 }
495
496 if (do_client && verbose)
497 {
498 if (SSL_in_init(c_ssl))
499 printf("client waiting in SSL_connect - %s\n",
500 SSL_state_string_long(c_ssl));
501 else if (c_write)
502 printf("client:SSL_write()\n");
503 else
504 printf("client:SSL_read()\n");
505 }
506
507 if (!do_client && !do_server)
508 {
509 fprintf(stdout,"ERROR IN STARTUP\n");
510 break;
511 }
512 if (do_client && !(done & C_DONE))
513 {
514 if (c_write)
515 {
516 i=BIO_write(c_bio,"hello from client\n",18);
517 if (i < 0)
518 {
519 c_r=0;
520 c_w=0;
521 if (BIO_should_retry(c_bio))
522 {
523 if (BIO_should_read(c_bio))
524 c_r=1;
525 if (BIO_should_write(c_bio))
526 c_w=1;
527 }
528 else
529 {
530 fprintf(stderr,"ERROR in CLIENT\n");
531 ERR_print_errors_fp(stderr);
532 return(1);
533 }
534 }
535 else if (i == 0)
536 {
537 fprintf(stderr,"SSL CLIENT STARTUP FAILED\n");
538 return(1);
539 }
540 else
541 {
542 /* ok */
543 c_write=0;
544 }
545 }
546 else
547 {
548 i=BIO_read(c_bio,cbuf,100);
549 if (i < 0)
550 {
551 c_r=0;
552 c_w=0;
553 if (BIO_should_retry(c_bio))
554 {
555 if (BIO_should_read(c_bio))
556 c_r=1;
557 if (BIO_should_write(c_bio))
558 c_w=1;
559 }
560 else
561 {
562 fprintf(stderr,"ERROR in CLIENT\n");
563 ERR_print_errors_fp(stderr);
564 return(1);
565 }
566 }
567 else if (i == 0)
568 {
569 fprintf(stderr,"SSL CLIENT STARTUP FAILED\n");
570 return(1);
571 }
572 else
573 {
574 done|=C_DONE;
575#ifdef undef
576 fprintf(stdout,"CLIENT:from server:");
577 fwrite(cbuf,1,i,stdout);
578 fflush(stdout);
579#endif
580 }
581 }
582 }
583
584 if (do_server && !(done & S_DONE))
585 {
586 if (!s_write)
587 {
588 i=BIO_read(s_bio,sbuf,100);
589 if (i < 0)
590 {
591 s_r=0;
592 s_w=0;
593 if (BIO_should_retry(s_bio))
594 {
595 if (BIO_should_read(s_bio))
596 s_r=1;
597 if (BIO_should_write(s_bio))
598 s_w=1;
599 }
600 else
601 {
602 fprintf(stderr,"ERROR in SERVER\n");
603 ERR_print_errors_fp(stderr);
604 return(1);
605 }
606 }
607 else if (i == 0)
608 {
609 fprintf(stderr,"SSL SERVER STARTUP FAILED\n");
610 return(1);
611 }
612 else
613 {
614 s_write=1;
615 s_w=1;
616#ifdef undef
617 fprintf(stdout,"SERVER:from client:");
618 fwrite(sbuf,1,i,stdout);
619 fflush(stdout);
620#endif
621 }
622 }
623 else
624 {
625 i=BIO_write(s_bio,"hello from server\n",18);
626 if (i < 0)
627 {
628 s_r=0;
629 s_w=0;
630 if (BIO_should_retry(s_bio))
631 {
632 if (BIO_should_read(s_bio))
633 s_r=1;
634 if (BIO_should_write(s_bio))
635 s_w=1;
636 }
637 else
638 {
639 fprintf(stderr,"ERROR in SERVER\n");
640 ERR_print_errors_fp(stderr);
641 return(1);
642 }
643 }
644 else if (i == 0)
645 {
646 fprintf(stderr,"SSL SERVER STARTUP FAILED\n");
647 return(1);
648 }
649 else
650 {
651 s_write=0;
652 s_r=1;
653 done|=S_DONE;
654 }
655 }
656 }
657
658 if ((done & S_DONE) && (done & C_DONE)) break;
659# if defined(OPENSSL_SYS_NETWARE)
660 ThreadSwitchWithDelay();
661# endif
662 }
663
664 SSL_set_shutdown(c_ssl,SSL_SENT_SHUTDOWN|SSL_RECEIVED_SHUTDOWN);
665 SSL_set_shutdown(s_ssl,SSL_SENT_SHUTDOWN|SSL_RECEIVED_SHUTDOWN);
666
667#ifdef undef
668 fprintf(stdout,"DONE\n");
669#endif
670err:
671 /* We have to set the BIO's to NULL otherwise they will be
672 * free()ed twice. Once when th s_ssl is SSL_free()ed and
673 * again when c_ssl is SSL_free()ed.
674 * This is a hack required because s_ssl and c_ssl are sharing the same
675 * BIO structure and SSL_set_bio() and SSL_free() automatically
676 * BIO_free non NULL entries.
677 * You should not normally do this or be required to do this */
678
679 if (s_ssl != NULL)
680 {
681 s_ssl->rbio=NULL;
682 s_ssl->wbio=NULL;
683 }
684 if (c_ssl != NULL)
685 {
686 c_ssl->rbio=NULL;
687 c_ssl->wbio=NULL;
688 }
689
690 /* The SSL's are optionally freed in the following calls */
691 if (c_to_s != NULL) BIO_free(c_to_s);
692 if (s_to_c != NULL) BIO_free(s_to_c);
693
694 if (c_bio != NULL) BIO_free(c_bio);
695 if (s_bio != NULL) BIO_free(s_bio);
696 return(0);
697 }
698
699int MS_CALLBACK verify_callback(int ok, X509_STORE_CTX *ctx)
700 {
701 char *s, buf[256];
702
703 if (verbose)
704 {
705 s=X509_NAME_oneline(X509_get_subject_name(ctx->current_cert),
706 buf,256);
707 if (s != NULL)
708 {
709 if (ok)
710 fprintf(stderr,"depth=%d %s\n",
711 ctx->error_depth,buf);
712 else
713 fprintf(stderr,"depth=%d error=%d %s\n",
714 ctx->error_depth,ctx->error,buf);
715 }
716 }
717 return(ok);
718 }
719
720#define THREAD_STACK_SIZE (16*1024)
721
722#ifdef OPENSSL_SYS_WIN32
723
724static HANDLE *lock_cs;
725
726void thread_setup(void)
727 {
728 int i;
729
730 lock_cs=OPENSSL_malloc(CRYPTO_num_locks() * sizeof(HANDLE));
731 for (i=0; i<CRYPTO_num_locks(); i++)
732 {
733 lock_cs[i]=CreateMutex(NULL,FALSE,NULL);
734 }
735
736 CRYPTO_set_locking_callback((void (*)(int,int,char *,int))win32_locking_callback);
737 /* id callback defined */
738 }
739
740void thread_cleanup(void)
741 {
742 int i;
743
744 CRYPTO_set_locking_callback(NULL);
745 for (i=0; i<CRYPTO_num_locks(); i++)
746 CloseHandle(lock_cs[i]);
747 OPENSSL_free(lock_cs);
748 }
749
750void win32_locking_callback(int mode, int type, char *file, int line)
751 {
752 if (mode & CRYPTO_LOCK)
753 {
754 WaitForSingleObject(lock_cs[type],INFINITE);
755 }
756 else
757 {
758 ReleaseMutex(lock_cs[type]);
759 }
760 }
761
762void do_threads(SSL_CTX *s_ctx, SSL_CTX *c_ctx)
763 {
764 double ret;
765 SSL_CTX *ssl_ctx[2];
766 DWORD thread_id[MAX_THREAD_NUMBER];
767 HANDLE thread_handle[MAX_THREAD_NUMBER];
768 int i;
769 SYSTEMTIME start,end;
770
771 ssl_ctx[0]=s_ctx;
772 ssl_ctx[1]=c_ctx;
773
774 GetSystemTime(&start);
775 for (i=0; i<thread_number; i++)
776 {
777 thread_handle[i]=CreateThread(NULL,
778 THREAD_STACK_SIZE,
779 (LPTHREAD_START_ROUTINE)ndoit,
780 (void *)ssl_ctx,
781 0L,
782 &(thread_id[i]));
783 }
784
785 printf("reaping\n");
786 for (i=0; i<thread_number; i+=50)
787 {
788 int j;
789
790 j=(thread_number < (i+50))?(thread_number-i):50;
791
792 if (WaitForMultipleObjects(j,
793 (CONST HANDLE *)&(thread_handle[i]),TRUE,INFINITE)
794 == WAIT_FAILED)
795 {
796 fprintf(stderr,"WaitForMultipleObjects failed:%d\n",GetLastError());
797 exit(1);
798 }
799 }
800 GetSystemTime(&end);
801
802 if (start.wDayOfWeek > end.wDayOfWeek) end.wDayOfWeek+=7;
803 ret=(end.wDayOfWeek-start.wDayOfWeek)*24;
804
805 ret=(ret+end.wHour-start.wHour)*60;
806 ret=(ret+end.wMinute-start.wMinute)*60;
807 ret=(ret+end.wSecond-start.wSecond);
808 ret+=(end.wMilliseconds-start.wMilliseconds)/1000.0;
809
810 printf("win32 threads done - %.3f seconds\n",ret);
811 }
812
813#endif /* OPENSSL_SYS_WIN32 */
814
815#ifdef SOLARIS
816
817static mutex_t *lock_cs;
818/*static rwlock_t *lock_cs; */
819static long *lock_count;
820
821void thread_setup(void)
822 {
823 int i;
824
825 lock_cs=OPENSSL_malloc(CRYPTO_num_locks() * sizeof(mutex_t));
826 lock_count=OPENSSL_malloc(CRYPTO_num_locks() * sizeof(long));
827 for (i=0; i<CRYPTO_num_locks(); i++)
828 {
829 lock_count[i]=0;
830 /* rwlock_init(&(lock_cs[i]),USYNC_THREAD,NULL); */
831 mutex_init(&(lock_cs[i]),USYNC_THREAD,NULL);
832 }
833
834 CRYPTO_set_id_callback((unsigned long (*)())solaris_thread_id);
835 CRYPTO_set_locking_callback((void (*)())solaris_locking_callback);
836 }
837
838void thread_cleanup(void)
839 {
840 int i;
841
842 CRYPTO_set_locking_callback(NULL);
843
844 fprintf(stderr,"cleanup\n");
845
846 for (i=0; i<CRYPTO_num_locks(); i++)
847 {
848 /* rwlock_destroy(&(lock_cs[i])); */
849 mutex_destroy(&(lock_cs[i]));
850 fprintf(stderr,"%8ld:%s\n",lock_count[i],CRYPTO_get_lock_name(i));
851 }
852 OPENSSL_free(lock_cs);
853 OPENSSL_free(lock_count);
854
855 fprintf(stderr,"done cleanup\n");
856
857 }
858
859void solaris_locking_callback(int mode, int type, char *file, int line)
860 {
861#ifdef undef
862 fprintf(stderr,"thread=%4d mode=%s lock=%s %s:%d\n",
863 CRYPTO_thread_id(),
864 (mode&CRYPTO_LOCK)?"l":"u",
865 (type&CRYPTO_READ)?"r":"w",file,line);
866#endif
867
868 /*
869 if (CRYPTO_LOCK_SSL_CERT == type)
870 fprintf(stderr,"(t,m,f,l) %ld %d %s %d\n",
871 CRYPTO_thread_id(),
872 mode,file,line);
873 */
874 if (mode & CRYPTO_LOCK)
875 {
876 /* if (mode & CRYPTO_READ)
877 rw_rdlock(&(lock_cs[type]));
878 else
879 rw_wrlock(&(lock_cs[type])); */
880
881 mutex_lock(&(lock_cs[type]));
882 lock_count[type]++;
883 }
884 else
885 {
886/* rw_unlock(&(lock_cs[type])); */
887 mutex_unlock(&(lock_cs[type]));
888 }
889 }
890
891void do_threads(SSL_CTX *s_ctx, SSL_CTX *c_ctx)
892 {
893 SSL_CTX *ssl_ctx[2];
894 thread_t thread_ctx[MAX_THREAD_NUMBER];
895 int i;
896
897 ssl_ctx[0]=s_ctx;
898 ssl_ctx[1]=c_ctx;
899
900 thr_setconcurrency(thread_number);
901 for (i=0; i<thread_number; i++)
902 {
903 thr_create(NULL, THREAD_STACK_SIZE,
904 (void *(*)())ndoit,
905 (void *)ssl_ctx,
906 0L,
907 &(thread_ctx[i]));
908 }
909
910 printf("reaping\n");
911 for (i=0; i<thread_number; i++)
912 {
913 thr_join(thread_ctx[i],NULL,NULL);
914 }
915
916 printf("solaris threads done (%d,%d)\n",
917 s_ctx->references,c_ctx->references);
918 }
919
920unsigned long solaris_thread_id(void)
921 {
922 unsigned long ret;
923
924 ret=(unsigned long)thr_self();
925 return(ret);
926 }
927#endif /* SOLARIS */
928
929#ifdef IRIX
930
931
932static usptr_t *arena;
933static usema_t **lock_cs;
934
935void thread_setup(void)
936 {
937 int i;
938 char filename[20];
939
940 strcpy(filename,"/tmp/mttest.XXXXXX");
941 mktemp(filename);
942
943 usconfig(CONF_STHREADIOOFF);
944 usconfig(CONF_STHREADMALLOCOFF);
945 usconfig(CONF_INITUSERS,100);
946 usconfig(CONF_LOCKTYPE,US_DEBUGPLUS);
947 arena=usinit(filename);
948 unlink(filename);
949
950 lock_cs=OPENSSL_malloc(CRYPTO_num_locks() * sizeof(usema_t *));
951 for (i=0; i<CRYPTO_num_locks(); i++)
952 {
953 lock_cs[i]=usnewsema(arena,1);
954 }
955
956 CRYPTO_set_id_callback((unsigned long (*)())irix_thread_id);
957 CRYPTO_set_locking_callback((void (*)())irix_locking_callback);
958 }
959
960void thread_cleanup(void)
961 {
962 int i;
963
964 CRYPTO_set_locking_callback(NULL);
965 for (i=0; i<CRYPTO_num_locks(); i++)
966 {
967 char buf[10];
968
969 sprintf(buf,"%2d:",i);
970 usdumpsema(lock_cs[i],stdout,buf);
971 usfreesema(lock_cs[i],arena);
972 }
973 OPENSSL_free(lock_cs);
974 }
975
976void irix_locking_callback(int mode, int type, char *file, int line)
977 {
978 if (mode & CRYPTO_LOCK)
979 {
980 printf("lock %d\n",type);
981 uspsema(lock_cs[type]);
982 }
983 else
984 {
985 printf("unlock %d\n",type);
986 usvsema(lock_cs[type]);
987 }
988 }
989
990void do_threads(SSL_CTX *s_ctx, SSL_CTX *c_ctx)
991 {
992 SSL_CTX *ssl_ctx[2];
993 int thread_ctx[MAX_THREAD_NUMBER];
994 int i;
995
996 ssl_ctx[0]=s_ctx;
997 ssl_ctx[1]=c_ctx;
998
999 for (i=0; i<thread_number; i++)
1000 {
1001 thread_ctx[i]=sproc((void (*)())ndoit,
1002 PR_SADDR|PR_SFDS,(void *)ssl_ctx);
1003 }
1004
1005 printf("reaping\n");
1006 for (i=0; i<thread_number; i++)
1007 {
1008 wait(NULL);
1009 }
1010
1011 printf("irix threads done (%d,%d)\n",
1012 s_ctx->references,c_ctx->references);
1013 }
1014
1015unsigned long irix_thread_id(void)
1016 {
1017 unsigned long ret;
1018
1019 ret=(unsigned long)getpid();
1020 return(ret);
1021 }
1022#endif /* IRIX */
1023
1024#ifdef PTHREADS
1025
1026static pthread_mutex_t *lock_cs;
1027static long *lock_count;
1028
1029void thread_setup(void)
1030 {
1031 int i;
1032
1033 lock_cs=OPENSSL_malloc(CRYPTO_num_locks() * sizeof(pthread_mutex_t));
1034 lock_count=OPENSSL_malloc(CRYPTO_num_locks() * sizeof(long));
1035 for (i=0; i<CRYPTO_num_locks(); i++)
1036 {
1037 lock_count[i]=0;
1038 pthread_mutex_init(&(lock_cs[i]),NULL);
1039 }
1040
1041 CRYPTO_set_id_callback((unsigned long (*)())pthreads_thread_id);
1042 CRYPTO_set_locking_callback((void (*)())pthreads_locking_callback);
1043 }
1044
1045void thread_cleanup(void)
1046 {
1047 int i;
1048
1049 CRYPTO_set_locking_callback(NULL);
1050 fprintf(stderr,"cleanup\n");
1051 for (i=0; i<CRYPTO_num_locks(); i++)
1052 {
1053 pthread_mutex_destroy(&(lock_cs[i]));
1054 fprintf(stderr,"%8ld:%s\n",lock_count[i],
1055 CRYPTO_get_lock_name(i));
1056 }
1057 OPENSSL_free(lock_cs);
1058 OPENSSL_free(lock_count);
1059
1060 fprintf(stderr,"done cleanup\n");
1061 }
1062
1063void pthreads_locking_callback(int mode, int type, char *file,
1064 int line)
1065 {
1066#ifdef undef
1067 fprintf(stderr,"thread=%4d mode=%s lock=%s %s:%d\n",
1068 CRYPTO_thread_id(),
1069 (mode&CRYPTO_LOCK)?"l":"u",
1070 (type&CRYPTO_READ)?"r":"w",file,line);
1071#endif
1072/*
1073 if (CRYPTO_LOCK_SSL_CERT == type)
1074 fprintf(stderr,"(t,m,f,l) %ld %d %s %d\n",
1075 CRYPTO_thread_id(),
1076 mode,file,line);
1077*/
1078 if (mode & CRYPTO_LOCK)
1079 {
1080 pthread_mutex_lock(&(lock_cs[type]));
1081 lock_count[type]++;
1082 }
1083 else
1084 {
1085 pthread_mutex_unlock(&(lock_cs[type]));
1086 }
1087 }
1088
1089void do_threads(SSL_CTX *s_ctx, SSL_CTX *c_ctx)
1090 {
1091 SSL_CTX *ssl_ctx[2];
1092 pthread_t thread_ctx[MAX_THREAD_NUMBER];
1093 int i;
1094
1095 ssl_ctx[0]=s_ctx;
1096 ssl_ctx[1]=c_ctx;
1097
1098 /*
1099 thr_setconcurrency(thread_number);
1100 */
1101 for (i=0; i<thread_number; i++)
1102 {
1103 pthread_create(&(thread_ctx[i]), NULL,
1104 (void *(*)())ndoit, (void *)ssl_ctx);
1105 }
1106
1107 printf("reaping\n");
1108 for (i=0; i<thread_number; i++)
1109 {
1110 pthread_join(thread_ctx[i],NULL);
1111 }
1112
1113 printf("pthreads threads done (%d,%d)\n",
1114 s_ctx->references,c_ctx->references);
1115 }
1116
1117unsigned long pthreads_thread_id(void)
1118 {
1119 unsigned long ret;
1120
1121 ret=(unsigned long)pthread_self();
1122 return(ret);
1123 }
1124
1125#endif /* PTHREADS */
1126
1127
1128
1129#ifdef OPENSSL_SYS_NETWARE
1130
1131void thread_setup(void)
1132{
1133 int i;
1134
1135 lock_cs=OPENSSL_malloc(CRYPTO_num_locks() * sizeof(MPKMutex));
1136 lock_count=OPENSSL_malloc(CRYPTO_num_locks() * sizeof(long));
1137 for (i=0; i<CRYPTO_num_locks(); i++)
1138 {
1139 lock_count[i]=0;
1140 lock_cs[i]=MPKMutexAlloc("OpenSSL mutex");
1141 }
1142
1143 ThreadSem = MPKSemaphoreAlloc("OpenSSL mttest semaphore", 0 );
1144
1145 CRYPTO_set_id_callback((unsigned long (*)())netware_thread_id);
1146 CRYPTO_set_locking_callback((void (*)())netware_locking_callback);
1147}
1148
1149void thread_cleanup(void)
1150{
1151 int i;
1152
1153 CRYPTO_set_locking_callback(NULL);
1154
1155 fprintf(stdout,"thread_cleanup\n");
1156
1157 for (i=0; i<CRYPTO_num_locks(); i++)
1158 {
1159 MPKMutexFree(lock_cs[i]);
1160 fprintf(stdout,"%8ld:%s\n",lock_count[i],CRYPTO_get_lock_name(i));
1161 }
1162 OPENSSL_free(lock_cs);
1163 OPENSSL_free(lock_count);
1164
1165 MPKSemaphoreFree(ThreadSem);
1166
1167 fprintf(stdout,"done cleanup\n");
1168}
1169
1170void netware_locking_callback(int mode, int type, char *file, int line)
1171{
1172 if (mode & CRYPTO_LOCK)
1173 {
1174 MPKMutexLock(lock_cs[type]);
1175 lock_count[type]++;
1176 }
1177 else
1178 MPKMutexUnlock(lock_cs[type]);
1179}
1180
1181void do_threads(SSL_CTX *s_ctx, SSL_CTX *c_ctx)
1182{
1183 SSL_CTX *ssl_ctx[2];
1184 int i;
1185 ssl_ctx[0]=s_ctx;
1186 ssl_ctx[1]=c_ctx;
1187
1188 for (i=0; i<thread_number; i++)
1189 {
1190 BeginThread( (void(*)(void*))ndoit, NULL, THREAD_STACK_SIZE,
1191 (void*)ssl_ctx);
1192 ThreadSwitchWithDelay();
1193 }
1194
1195 printf("reaping\n");
1196
1197 /* loop until all threads have signaled the semaphore */
1198 for (i=0; i<thread_number; i++)
1199 {
1200 MPKSemaphoreWait(ThreadSem);
1201 }
1202 printf("netware threads done (%d,%d)\n",
1203 s_ctx->references,c_ctx->references);
1204}
1205
1206unsigned long netware_thread_id(void)
1207{
1208 unsigned long ret;
1209
1210 ret=(unsigned long)GetThreadID();
1211 return(ret);
1212}
1213#endif /* NETWARE */
1214
1215#ifdef BEOS_THREADS
1216
1217#include <Locker.h>
1218
1219static BLocker** lock_cs;
1220static long* lock_count;
1221
1222void thread_setup(void)
1223 {
1224 int i;
1225
1226 lock_cs=(BLocker**)OPENSSL_malloc(CRYPTO_num_locks() * sizeof(BLocker*));
1227 lock_count=(long*)OPENSSL_malloc(CRYPTO_num_locks() * sizeof(long));
1228 for (i=0; i<CRYPTO_num_locks(); i++)
1229 {
1230 lock_count[i]=0;
1231 lock_cs[i] = new BLocker(CRYPTO_get_lock_name(i));
1232 }
1233
1234 CRYPTO_set_id_callback((unsigned long (*)())beos_thread_id);
1235 CRYPTO_set_locking_callback(beos_locking_callback);
1236 }
1237
1238void thread_cleanup(void)
1239 {
1240 int i;
1241
1242 CRYPTO_set_locking_callback(NULL);
1243 fprintf(stderr,"cleanup\n");
1244 for (i=0; i<CRYPTO_num_locks(); i++)
1245 {
1246 delete lock_cs[i];
1247 fprintf(stderr,"%8ld:%s\n",lock_count[i],
1248 CRYPTO_get_lock_name(i));
1249 }
1250 OPENSSL_free(lock_cs);
1251 OPENSSL_free(lock_count);
1252
1253 fprintf(stderr,"done cleanup\n");
1254 }
1255
1256void beos_locking_callback(int mode, int type, const char *file, int line)
1257 {
1258#if 0
1259 fprintf(stderr,"thread=%4d mode=%s lock=%s %s:%d\n",
1260 CRYPTO_thread_id(),
1261 (mode&CRYPTO_LOCK)?"l":"u",
1262 (type&CRYPTO_READ)?"r":"w",file,line);
1263#endif
1264 if (mode & CRYPTO_LOCK)
1265 {
1266 lock_cs[type]->Lock();
1267 lock_count[type]++;
1268 }
1269 else
1270 {
1271 lock_cs[type]->Unlock();
1272 }
1273 }
1274
1275void do_threads(SSL_CTX *s_ctx, SSL_CTX *c_ctx)
1276 {
1277 SSL_CTX *ssl_ctx[2];
1278 thread_id thread_ctx[MAX_THREAD_NUMBER];
1279 int i;
1280
1281 ssl_ctx[0]=s_ctx;
1282 ssl_ctx[1]=c_ctx;
1283
1284 for (i=0; i<thread_number; i++)
1285 {
1286 thread_ctx[i] = spawn_thread((thread_func)ndoit,
1287 NULL, B_NORMAL_PRIORITY, (void *)ssl_ctx);
1288 resume_thread(thread_ctx[i]);
1289 }
1290
1291 printf("waiting...\n");
1292 for (i=0; i<thread_number; i++)
1293 {
1294 status_t result;
1295 wait_for_thread(thread_ctx[i], &result);
1296 }
1297
1298 printf("beos threads done (%d,%d)\n",
1299 s_ctx->references,c_ctx->references);
1300 }
1301
1302unsigned long beos_thread_id(void)
1303 {
1304 unsigned long ret;
1305
1306 ret=(unsigned long)find_thread(NULL);
1307 return(ret);
1308 }
1309
1310#endif /* BEOS_THREADS */
diff --git a/src/lib/libcrypto/threads/netware.bat b/src/lib/libcrypto/threads/netware.bat
new file mode 100644
index 0000000000..0b3eca3caf
--- /dev/null
+++ b/src/lib/libcrypto/threads/netware.bat
@@ -0,0 +1,79 @@
1@echo off
2rem batch file to build multi-thread test ( mttest.nlm )
3
4rem command line arguments:
5rem debug => build using debug settings
6
7rem
8rem After building, copy mttest.nlm to the server and run it, you'll probably
9rem want to redirect stdout and stderr. An example command line would be
10rem "mttest.nlm -thread 20 -loops 10 -CAfile \openssl\apps\server.pem >mttest.out 2>mttest.err"
11rem
12
13del mttest.nlm
14
15set BLD_DEBUG=
16set CFLAGS=
17set LFLAGS=
18set LIBS=
19
20if "%1" == "DEBUG" set BLD_DEBUG=YES
21if "%1" == "debug" set BLD_DEBUG=YES
22
23if "%MWCIncludes%" == "" goto inc_error
24if "%PRELUDE%" == "" goto prelude_error
25if "%IMPORTS%" == "" goto imports_error
26
27set CFLAGS=-c -I..\..\outinc_nw -nosyspath -DOPENSSL_SYS_NETWARE -opt off -g -sym internal -maxerrors 20
28
29if "%BLD_DEBUG%" == "YES" set LIBS=..\..\out_nw.dbg\ssl.lib ..\..\out_nw.dbg\crypto.lib
30if "%BLD_DEBUG%" == "" set LIBS=..\..\out_nw\ssl.lib ..\..\out_nw\crypto.lib
31
32set LFLAGS=-msgstyle gcc -zerobss -stacksize 32768 -nostdlib -sym internal
33
34rem generate command file for metrowerks
35echo.
36echo Generating Metrowerks command file: mttest.def
37echo # dynamically generated command file for metrowerks build > mttest.def
38echo IMPORT @%IMPORTS%\clib.imp >> mttest.def
39echo IMPORT @%IMPORTS%\threads.imp >> mttest.def
40echo IMPORT @%IMPORTS%\ws2nlm.imp >> mttest.def
41echo IMPORT GetProcessSwitchCount >> mttest.def
42echo MODULE clib >> mttest.def
43
44rem compile
45echo.
46echo Compiling mttest.c
47mwccnlm.exe mttest.c %CFLAGS%
48if errorlevel 1 goto end
49
50rem link
51echo.
52echo Linking mttest.nlm
53mwldnlm.exe %LFLAGS% -screenname mttest -commandfile mttest.def mttest.o "%PRELUDE%" %LIBS% -o mttest.nlm
54if errorlevel 1 goto end
55
56goto end
57
58:inc_error
59echo.
60echo Environment variable MWCIncludes is not set - see install.nw
61goto end
62
63:prelude_error
64echo.
65echo Environment variable PRELUDE is not set - see install.nw
66goto end
67
68:imports_error
69echo.
70echo Environment variable IMPORTS is not set - see install.nw
71goto end
72
73
74:end
75set BLD_DEBUG=
76set CFLAGS=
77set LFLAGS=
78set LIBS=
79
diff --git a/src/lib/libcrypto/threads/profile.sh b/src/lib/libcrypto/threads/profile.sh
new file mode 100644
index 0000000000..6e3e342fc0
--- /dev/null
+++ b/src/lib/libcrypto/threads/profile.sh
@@ -0,0 +1,4 @@
1#!/bin/sh
2/bin/rm -f mttest
3cc -p -DSOLARIS -I../../include -g mttest.c -o mttest -L/usr/lib/libc -ldl -L../.. -lthread -lssl -lcrypto -lnsl -lsocket
4
diff --git a/src/lib/libcrypto/threads/ptest.bat b/src/lib/libcrypto/threads/ptest.bat
new file mode 100644
index 0000000000..4071b5ffea
--- /dev/null
+++ b/src/lib/libcrypto/threads/ptest.bat
@@ -0,0 +1,4 @@
1del mttest.exe
2
3purify cl /O2 -DWIN32 /MD -I..\..\out mttest.c /Femttest ..\..\out\ssl32.lib ..\..\out\crypt32.lib
4
diff --git a/src/lib/libcrypto/threads/pthread.sh b/src/lib/libcrypto/threads/pthread.sh
new file mode 100644
index 0000000000..f1c49821d2
--- /dev/null
+++ b/src/lib/libcrypto/threads/pthread.sh
@@ -0,0 +1,9 @@
1#!/bin/sh
2#
3# build using pthreads
4#
5# http://www.mit.edu:8001/people/proven/pthreads.html
6#
7/bin/rm -f mttest
8pgcc -DPTHREADS -I../../include -g mttest.c -o mttest -L../.. -lssl -lcrypto
9
diff --git a/src/lib/libcrypto/threads/pthread2.sh b/src/lib/libcrypto/threads/pthread2.sh
new file mode 100644
index 0000000000..41264c6a50
--- /dev/null
+++ b/src/lib/libcrypto/threads/pthread2.sh
@@ -0,0 +1,7 @@
1#!/bin/sh
2#
3# build using pthreads where it's already built into the system
4#
5/bin/rm -f mttest
6gcc -DPTHREADS -I../../include -g mttest.c -o mttest -L../.. -lssl -lcrypto -lpthread
7
diff --git a/src/lib/libcrypto/threads/pthreads-vms.com b/src/lib/libcrypto/threads/pthreads-vms.com
new file mode 100644
index 0000000000..1cf92bdf57
--- /dev/null
+++ b/src/lib/libcrypto/threads/pthreads-vms.com
@@ -0,0 +1,14 @@
1$! To compile mttest on VMS.
2$!
3$! WARNING: only tested with DEC C so far.
4$
5$ if (f$getsyi("cpu").lt.128)
6$ then
7$ arch := VAX
8$ else
9$ arch = f$edit( f$getsyi( "ARCH_NAME"), "UPCASE")
10$ if (arch .eqs. "") then arch = "UNK"
11$ endif
12$ define/user openssl [--.include.openssl]
13$ cc/def=PTHREADS mttest.c
14$ link mttest,[--.'arch'.exe.ssl]libssl/lib,[--.'arch'.exe.crypto]libcrypto/lib
diff --git a/src/lib/libcrypto/threads/purify.sh b/src/lib/libcrypto/threads/purify.sh
new file mode 100644
index 0000000000..6d44fe26b7
--- /dev/null
+++ b/src/lib/libcrypto/threads/purify.sh
@@ -0,0 +1,4 @@
1#!/bin/sh
2/bin/rm -f mttest
3purify cc -DSOLARIS -I../../include -g mttest.c -o mttest -L../.. -lthread -lssl -lcrypto -lnsl -lsocket
4
diff --git a/src/lib/libcrypto/threads/solaris.sh b/src/lib/libcrypto/threads/solaris.sh
new file mode 100644
index 0000000000..bc93094a27
--- /dev/null
+++ b/src/lib/libcrypto/threads/solaris.sh
@@ -0,0 +1,4 @@
1#!/bin/sh
2/bin/rm -f mttest
3cc -DSOLARIS -I../../include -g mttest.c -o mttest -L../.. -lthread -lssl -lcrypto -lnsl -lsocket
4
diff --git a/src/lib/libcrypto/threads/th-lock.c b/src/lib/libcrypto/threads/th-lock.c
new file mode 100644
index 0000000000..14aae5f912
--- /dev/null
+++ b/src/lib/libcrypto/threads/th-lock.c
@@ -0,0 +1,387 @@
1/* crypto/threads/th-lock.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
59#include <stdio.h>
60#include <stdlib.h>
61#include <string.h>
62#include <errno.h>
63#ifdef LINUX
64#include <typedefs.h>
65#endif
66#ifdef OPENSSL_SYS_WIN32
67#include <windows.h>
68#endif
69#ifdef SOLARIS
70#include <synch.h>
71#include <thread.h>
72#endif
73#ifdef IRIX
74#include <ulocks.h>
75#include <sys/prctl.h>
76#endif
77#ifdef PTHREADS
78#include <pthread.h>
79#endif
80#include <openssl/lhash.h>
81#include <openssl/crypto.h>
82#include <openssl/buffer.h>
83#include "../../e_os.h"
84#include <openssl/x509.h>
85#include <openssl/ssl.h>
86#include <openssl/err.h>
87
88void CRYPTO_thread_setup(void);
89void CRYPTO_thread_cleanup(void);
90
91static void irix_locking_callback(int mode,int type,char *file,int line);
92static void solaris_locking_callback(int mode,int type,char *file,int line);
93static void win32_locking_callback(int mode,int type,char *file,int line);
94static void pthreads_locking_callback(int mode,int type,char *file,int line);
95
96static unsigned long irix_thread_id(void );
97static unsigned long solaris_thread_id(void );
98static unsigned long pthreads_thread_id(void );
99
100/* usage:
101 * CRYPTO_thread_setup();
102 * application code
103 * CRYPTO_thread_cleanup();
104 */
105
106#define THREAD_STACK_SIZE (16*1024)
107
108#ifdef OPENSSL_SYS_WIN32
109
110static HANDLE *lock_cs;
111
112void CRYPTO_thread_setup(void)
113 {
114 int i;
115
116 lock_cs=OPENSSL_malloc(CRYPTO_num_locks() * sizeof(HANDLE));
117 for (i=0; i<CRYPTO_num_locks(); i++)
118 {
119 lock_cs[i]=CreateMutex(NULL,FALSE,NULL);
120 }
121
122 CRYPTO_set_locking_callback((void (*)(int,int,char *,int))win32_locking_callback);
123 /* id callback defined */
124 return(1);
125 }
126
127static void CRYPTO_thread_cleanup(void)
128 {
129 int i;
130
131 CRYPTO_set_locking_callback(NULL);
132 for (i=0; i<CRYPTO_num_locks(); i++)
133 CloseHandle(lock_cs[i]);
134 OPENSSL_free(lock_cs);
135 }
136
137void win32_locking_callback(int mode, int type, char *file, int line)
138 {
139 if (mode & CRYPTO_LOCK)
140 {
141 WaitForSingleObject(lock_cs[type],INFINITE);
142 }
143 else
144 {
145 ReleaseMutex(lock_cs[type]);
146 }
147 }
148
149#endif /* OPENSSL_SYS_WIN32 */
150
151#ifdef SOLARIS
152
153#define USE_MUTEX
154
155#ifdef USE_MUTEX
156static mutex_t *lock_cs;
157#else
158static rwlock_t *lock_cs;
159#endif
160static long *lock_count;
161
162void CRYPTO_thread_setup(void)
163 {
164 int i;
165
166#ifdef USE_MUTEX
167 lock_cs=OPENSSL_malloc(CRYPTO_num_locks() * sizeof(mutex_t));
168#else
169 lock_cs=OPENSSL_malloc(CRYPTO_num_locks() * sizeof(rwlock_t));
170#endif
171 lock_count=OPENSSL_malloc(CRYPTO_num_locks() * sizeof(long));
172 for (i=0; i<CRYPTO_num_locks(); i++)
173 {
174 lock_count[i]=0;
175#ifdef USE_MUTEX
176 mutex_init(&(lock_cs[i]),USYNC_THREAD,NULL);
177#else
178 rwlock_init(&(lock_cs[i]),USYNC_THREAD,NULL);
179#endif
180 }
181
182 CRYPTO_set_id_callback((unsigned long (*)())solaris_thread_id);
183 CRYPTO_set_locking_callback((void (*)())solaris_locking_callback);
184 }
185
186void CRYPTO_thread_cleanup(void)
187 {
188 int i;
189
190 CRYPTO_set_locking_callback(NULL);
191 for (i=0; i<CRYPTO_num_locks(); i++)
192 {
193#ifdef USE_MUTEX
194 mutex_destroy(&(lock_cs[i]));
195#else
196 rwlock_destroy(&(lock_cs[i]));
197#endif
198 }
199 OPENSSL_free(lock_cs);
200 OPENSSL_free(lock_count);
201 }
202
203void solaris_locking_callback(int mode, int type, char *file, int line)
204 {
205#if 0
206 fprintf(stderr,"thread=%4d mode=%s lock=%s %s:%d\n",
207 CRYPTO_thread_id(),
208 (mode&CRYPTO_LOCK)?"l":"u",
209 (type&CRYPTO_READ)?"r":"w",file,line);
210#endif
211
212#if 0
213 if (CRYPTO_LOCK_SSL_CERT == type)
214 fprintf(stderr,"(t,m,f,l) %ld %d %s %d\n",
215 CRYPTO_thread_id(),
216 mode,file,line);
217#endif
218 if (mode & CRYPTO_LOCK)
219 {
220#ifdef USE_MUTEX
221 mutex_lock(&(lock_cs[type]));
222#else
223 if (mode & CRYPTO_READ)
224 rw_rdlock(&(lock_cs[type]));
225 else
226 rw_wrlock(&(lock_cs[type]));
227#endif
228 lock_count[type]++;
229 }
230 else
231 {
232#ifdef USE_MUTEX
233 mutex_unlock(&(lock_cs[type]));
234#else
235 rw_unlock(&(lock_cs[type]));
236#endif
237 }
238 }
239
240unsigned long solaris_thread_id(void)
241 {
242 unsigned long ret;
243
244 ret=(unsigned long)thr_self();
245 return(ret);
246 }
247#endif /* SOLARIS */
248
249#ifdef IRIX
250/* I don't think this works..... */
251
252static usptr_t *arena;
253static usema_t **lock_cs;
254
255void CRYPTO_thread_setup(void)
256 {
257 int i;
258 char filename[20];
259
260 strcpy(filename,"/tmp/mttest.XXXXXX");
261 mktemp(filename);
262
263 usconfig(CONF_STHREADIOOFF);
264 usconfig(CONF_STHREADMALLOCOFF);
265 usconfig(CONF_INITUSERS,100);
266 usconfig(CONF_LOCKTYPE,US_DEBUGPLUS);
267 arena=usinit(filename);
268 unlink(filename);
269
270 lock_cs=OPENSSL_malloc(CRYPTO_num_locks() * sizeof(usema_t *));
271 for (i=0; i<CRYPTO_num_locks(); i++)
272 {
273 lock_cs[i]=usnewsema(arena,1);
274 }
275
276 CRYPTO_set_id_callback((unsigned long (*)())irix_thread_id);
277 CRYPTO_set_locking_callback((void (*)())irix_locking_callback);
278 }
279
280void CRYPTO_thread_cleanup(void)
281 {
282 int i;
283
284 CRYPTO_set_locking_callback(NULL);
285 for (i=0; i<CRYPTO_num_locks(); i++)
286 {
287 char buf[10];
288
289 sprintf(buf,"%2d:",i);
290 usdumpsema(lock_cs[i],stdout,buf);
291 usfreesema(lock_cs[i],arena);
292 }
293 OPENSSL_free(lock_cs);
294 }
295
296void irix_locking_callback(int mode, int type, char *file, int line)
297 {
298 if (mode & CRYPTO_LOCK)
299 {
300 uspsema(lock_cs[type]);
301 }
302 else
303 {
304 usvsema(lock_cs[type]);
305 }
306 }
307
308unsigned long irix_thread_id(void)
309 {
310 unsigned long ret;
311
312 ret=(unsigned long)getpid();
313 return(ret);
314 }
315#endif /* IRIX */
316
317/* Linux and a few others */
318#ifdef PTHREADS
319
320static pthread_mutex_t *lock_cs;
321static long *lock_count;
322
323void CRYPTO_thread_setup(void)
324 {
325 int i;
326
327 lock_cs=OPENSSL_malloc(CRYPTO_num_locks() * sizeof(pthread_mutex_t));
328 lock_count=OPENSSL_malloc(CRYPTO_num_locks() * sizeof(long));
329 for (i=0; i<CRYPTO_num_locks(); i++)
330 {
331 lock_count[i]=0;
332 pthread_mutex_init(&(lock_cs[i]),NULL);
333 }
334
335 CRYPTO_set_id_callback((unsigned long (*)())pthreads_thread_id);
336 CRYPTO_set_locking_callback((void (*)())pthreads_locking_callback);
337 }
338
339void thread_cleanup(void)
340 {
341 int i;
342
343 CRYPTO_set_locking_callback(NULL);
344 for (i=0; i<CRYPTO_num_locks(); i++)
345 {
346 pthread_mutex_destroy(&(lock_cs[i]));
347 }
348 OPENSSL_free(lock_cs);
349 OPENSSL_free(lock_count);
350 }
351
352void pthreads_locking_callback(int mode, int type, char *file,
353 int line)
354 {
355#if 0
356 fprintf(stderr,"thread=%4d mode=%s lock=%s %s:%d\n",
357 CRYPTO_thread_id(),
358 (mode&CRYPTO_LOCK)?"l":"u",
359 (type&CRYPTO_READ)?"r":"w",file,line);
360#endif
361#if 0
362 if (CRYPTO_LOCK_SSL_CERT == type)
363 fprintf(stderr,"(t,m,f,l) %ld %d %s %d\n",
364 CRYPTO_thread_id(),
365 mode,file,line);
366#endif
367 if (mode & CRYPTO_LOCK)
368 {
369 pthread_mutex_lock(&(lock_cs[type]));
370 lock_count[type]++;
371 }
372 else
373 {
374 pthread_mutex_unlock(&(lock_cs[type]));
375 }
376 }
377
378unsigned long pthreads_thread_id(void)
379 {
380 unsigned long ret;
381
382 ret=(unsigned long)pthread_self();
383 return(ret);
384 }
385
386#endif /* PTHREADS */
387
diff --git a/src/lib/libcrypto/threads/win32.bat b/src/lib/libcrypto/threads/win32.bat
new file mode 100644
index 0000000000..ee6da80a07
--- /dev/null
+++ b/src/lib/libcrypto/threads/win32.bat
@@ -0,0 +1,4 @@
1del mttest.exe
2
3cl /O2 -DWIN32 /MD -I..\..\out mttest.c /Femttest ..\..\out\ssleay32.lib ..\..\out\libeay32.lib
4
diff --git a/src/lib/libcrypto/ts/Makefile b/src/lib/libcrypto/ts/Makefile
new file mode 100644
index 0000000000..c18234555b
--- /dev/null
+++ b/src/lib/libcrypto/ts/Makefile
@@ -0,0 +1,269 @@
1#
2# SSLeay/crypto/ts/Makefile
3#
4
5DIR= ts
6TOP= ../..
7CC= cc
8INCLUDES= -I.. -I../../include
9CFLAG = -g
10INSTALL_PREFIX=
11OPENSSLDIR= /usr/local/ssl
12INSTALLTOP=/usr/local/ssl
13MAKEDEPPROG= makedepend
14MAKEDEPEND= $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG)
15MAKEFILE= Makefile
16AR= ar r
17
18PEX_LIBS=
19EX_LIBS=
20
21CFLAGS= $(INCLUDES) $(CFLAG)
22
23GENERAL= Makefile
24TEST=
25APPS=
26
27LIB=$(TOP)/libcrypto.a
28LIBSRC= ts_err.c ts_req_utils.c ts_req_print.c ts_rsp_utils.c ts_rsp_print.c \
29 ts_rsp_sign.c ts_rsp_verify.c ts_verify_ctx.c ts_lib.c ts_conf.c \
30 ts_asn1.c
31LIBOBJ= ts_err.o ts_req_utils.o ts_req_print.o ts_rsp_utils.o ts_rsp_print.o \
32 ts_rsp_sign.o ts_rsp_verify.o ts_verify_ctx.o ts_lib.o ts_conf.o \
33 ts_asn1.o
34
35SRC= $(LIBSRC)
36
37EXHEADER= ts.h
38HEADER= $(EXHEADER)
39
40ALL= $(GENERAL) $(SRC) $(HEADER)
41
42top:
43 (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all)
44
45test:
46
47all: lib
48
49lib: $(LIBOBJ)
50 $(AR) $(LIB) $(LIBOBJ)
51 $(RANLIB) $(LIB) || echo Never mind.
52 @touch lib
53
54files:
55 $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
56
57links:
58 @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
59 @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
60 @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
61
62install:
63 @[ -n "$(INSTALLTOP)" ] # should be set by top Makefile...
64 @headerlist="$(EXHEADER)"; for i in $$headerlist ; \
65 do \
66 (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
67 chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
68 done;
69
70tags:
71 ctags $(SRC)
72
73lint:
74 lint -DLINT $(INCLUDES) $(SRC)>fluff
75
76depend:
77 $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(LIBSRC)
78
79dclean:
80 $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
81 mv -f Makefile.new $(MAKEFILE)
82
83clean:
84 rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff enc dec sign verify
85
86# DO NOT DELETE THIS LINE -- make depend depends on it.
87
88ts_asn1.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h
89ts_asn1.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
90ts_asn1.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
91ts_asn1.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
92ts_asn1.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
93ts_asn1.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
94ts_asn1.o: ../../include/openssl/err.h ../../include/openssl/evp.h
95ts_asn1.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
96ts_asn1.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
97ts_asn1.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
98ts_asn1.o: ../../include/openssl/pkcs7.h ../../include/openssl/rsa.h
99ts_asn1.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
100ts_asn1.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
101ts_asn1.o: ../../include/openssl/ts.h ../../include/openssl/x509.h
102ts_asn1.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
103ts_asn1.o: ts_asn1.c
104ts_conf.o: ../../e_os.h ../../include/openssl/asn1.h
105ts_conf.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
106ts_conf.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
107ts_conf.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
108ts_conf.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
109ts_conf.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
110ts_conf.o: ../../include/openssl/engine.h ../../include/openssl/err.h
111ts_conf.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
112ts_conf.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
113ts_conf.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
114ts_conf.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pem.h
115ts_conf.o: ../../include/openssl/pem2.h ../../include/openssl/pkcs7.h
116ts_conf.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
117ts_conf.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
118ts_conf.o: ../../include/openssl/symhacks.h ../../include/openssl/ts.h
119ts_conf.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
120ts_conf.o: ../../include/openssl/x509v3.h ../cryptlib.h ts_conf.c
121ts_err.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
122ts_err.o: ../../include/openssl/buffer.h ../../include/openssl/conf.h
123ts_err.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
124ts_err.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
125ts_err.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
126ts_err.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
127ts_err.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
128ts_err.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
129ts_err.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
130ts_err.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
131ts_err.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
132ts_err.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
133ts_err.o: ../../include/openssl/symhacks.h ../../include/openssl/ts.h
134ts_err.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
135ts_err.o: ../../include/openssl/x509v3.h ts_err.c
136ts_lib.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
137ts_lib.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
138ts_lib.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
139ts_lib.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
140ts_lib.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
141ts_lib.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
142ts_lib.o: ../../include/openssl/err.h ../../include/openssl/evp.h
143ts_lib.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
144ts_lib.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
145ts_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
146ts_lib.o: ../../include/openssl/pkcs7.h ../../include/openssl/rsa.h
147ts_lib.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
148ts_lib.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
149ts_lib.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
150ts_lib.o: ../../include/openssl/x509v3.h ../cryptlib.h ts.h ts_lib.c
151ts_req_print.o: ../../e_os.h ../../include/openssl/asn1.h
152ts_req_print.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
153ts_req_print.o: ../../include/openssl/buffer.h ../../include/openssl/conf.h
154ts_req_print.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
155ts_req_print.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
156ts_req_print.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
157ts_req_print.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
158ts_req_print.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
159ts_req_print.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
160ts_req_print.o: ../../include/openssl/opensslconf.h
161ts_req_print.o: ../../include/openssl/opensslv.h
162ts_req_print.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
163ts_req_print.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
164ts_req_print.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
165ts_req_print.o: ../../include/openssl/symhacks.h ../../include/openssl/ts.h
166ts_req_print.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
167ts_req_print.o: ../../include/openssl/x509v3.h ../cryptlib.h ts_req_print.c
168ts_req_utils.o: ../../e_os.h ../../include/openssl/asn1.h
169ts_req_utils.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
170ts_req_utils.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
171ts_req_utils.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
172ts_req_utils.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
173ts_req_utils.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
174ts_req_utils.o: ../../include/openssl/err.h ../../include/openssl/evp.h
175ts_req_utils.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
176ts_req_utils.o: ../../include/openssl/objects.h
177ts_req_utils.o: ../../include/openssl/opensslconf.h
178ts_req_utils.o: ../../include/openssl/opensslv.h
179ts_req_utils.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
180ts_req_utils.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
181ts_req_utils.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
182ts_req_utils.o: ../../include/openssl/symhacks.h ../../include/openssl/ts.h
183ts_req_utils.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
184ts_req_utils.o: ../../include/openssl/x509v3.h ../cryptlib.h ts_req_utils.c
185ts_rsp_print.o: ../../e_os.h ../../include/openssl/asn1.h
186ts_rsp_print.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
187ts_rsp_print.o: ../../include/openssl/buffer.h ../../include/openssl/conf.h
188ts_rsp_print.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
189ts_rsp_print.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
190ts_rsp_print.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
191ts_rsp_print.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
192ts_rsp_print.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
193ts_rsp_print.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
194ts_rsp_print.o: ../../include/openssl/opensslconf.h
195ts_rsp_print.o: ../../include/openssl/opensslv.h
196ts_rsp_print.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
197ts_rsp_print.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
198ts_rsp_print.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
199ts_rsp_print.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
200ts_rsp_print.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
201ts_rsp_print.o: ../cryptlib.h ts.h ts_rsp_print.c
202ts_rsp_sign.o: ../../e_os.h ../../include/openssl/asn1.h
203ts_rsp_sign.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
204ts_rsp_sign.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
205ts_rsp_sign.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
206ts_rsp_sign.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
207ts_rsp_sign.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
208ts_rsp_sign.o: ../../include/openssl/err.h ../../include/openssl/evp.h
209ts_rsp_sign.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
210ts_rsp_sign.o: ../../include/openssl/objects.h
211ts_rsp_sign.o: ../../include/openssl/opensslconf.h
212ts_rsp_sign.o: ../../include/openssl/opensslv.h
213ts_rsp_sign.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
214ts_rsp_sign.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
215ts_rsp_sign.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
216ts_rsp_sign.o: ../../include/openssl/symhacks.h ../../include/openssl/ts.h
217ts_rsp_sign.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
218ts_rsp_sign.o: ../../include/openssl/x509v3.h ../cryptlib.h ts_rsp_sign.c
219ts_rsp_utils.o: ../../e_os.h ../../include/openssl/asn1.h
220ts_rsp_utils.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
221ts_rsp_utils.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
222ts_rsp_utils.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
223ts_rsp_utils.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
224ts_rsp_utils.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
225ts_rsp_utils.o: ../../include/openssl/err.h ../../include/openssl/evp.h
226ts_rsp_utils.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
227ts_rsp_utils.o: ../../include/openssl/objects.h
228ts_rsp_utils.o: ../../include/openssl/opensslconf.h
229ts_rsp_utils.o: ../../include/openssl/opensslv.h
230ts_rsp_utils.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
231ts_rsp_utils.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
232ts_rsp_utils.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
233ts_rsp_utils.o: ../../include/openssl/symhacks.h ../../include/openssl/ts.h
234ts_rsp_utils.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
235ts_rsp_utils.o: ../../include/openssl/x509v3.h ../cryptlib.h ts_rsp_utils.c
236ts_rsp_verify.o: ../../e_os.h ../../include/openssl/asn1.h
237ts_rsp_verify.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
238ts_rsp_verify.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
239ts_rsp_verify.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
240ts_rsp_verify.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
241ts_rsp_verify.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
242ts_rsp_verify.o: ../../include/openssl/err.h ../../include/openssl/evp.h
243ts_rsp_verify.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
244ts_rsp_verify.o: ../../include/openssl/objects.h
245ts_rsp_verify.o: ../../include/openssl/opensslconf.h
246ts_rsp_verify.o: ../../include/openssl/opensslv.h
247ts_rsp_verify.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
248ts_rsp_verify.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
249ts_rsp_verify.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
250ts_rsp_verify.o: ../../include/openssl/symhacks.h ../../include/openssl/ts.h
251ts_rsp_verify.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
252ts_rsp_verify.o: ../../include/openssl/x509v3.h ../cryptlib.h ts_rsp_verify.c
253ts_verify_ctx.o: ../../e_os.h ../../include/openssl/asn1.h
254ts_verify_ctx.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
255ts_verify_ctx.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
256ts_verify_ctx.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
257ts_verify_ctx.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
258ts_verify_ctx.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
259ts_verify_ctx.o: ../../include/openssl/err.h ../../include/openssl/evp.h
260ts_verify_ctx.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
261ts_verify_ctx.o: ../../include/openssl/objects.h
262ts_verify_ctx.o: ../../include/openssl/opensslconf.h
263ts_verify_ctx.o: ../../include/openssl/opensslv.h
264ts_verify_ctx.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
265ts_verify_ctx.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
266ts_verify_ctx.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
267ts_verify_ctx.o: ../../include/openssl/symhacks.h ../../include/openssl/ts.h
268ts_verify_ctx.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
269ts_verify_ctx.o: ../../include/openssl/x509v3.h ../cryptlib.h ts_verify_ctx.c
diff --git a/src/lib/libcrypto/ts/ts_rsp_verify.c b/src/lib/libcrypto/ts/ts_rsp_verify.c
index afe16afbe4..a003207428 100644
--- a/src/lib/libcrypto/ts/ts_rsp_verify.c
+++ b/src/lib/libcrypto/ts/ts_rsp_verify.c
@@ -509,15 +509,17 @@ static int TS_check_status_info(TS_RESP *response)
509 TS_failure_info[i].code)) 509 TS_failure_info[i].code))
510 { 510 {
511 if (!first) 511 if (!first)
512 strcpy(failure_text, ","); 512 strlcat(failure_text, ",",
513 TS_STATUS_BUF_SIZE);
513 else 514 else
514 first = 0; 515 first = 0;
515 strcat(failure_text, TS_failure_info[i].text); 516 strlcat(failure_text, TS_failure_info[i].text,
517 TS_STATUS_BUF_SIZE);
516 } 518 }
517 } 519 }
518 } 520 }
519 if (failure_text[0] == '\0') 521 if (failure_text[0] == '\0')
520 strcpy(failure_text, "unspecified"); 522 strlcpy(failure_text, "unspecified", TS_STATUS_BUF_SIZE);
521 523
522 /* Making up the error string. */ 524 /* Making up the error string. */
523 TSerr(TS_F_TS_CHECK_STATUS_INFO, TS_R_NO_TIME_STAMP_TOKEN); 525 TSerr(TS_F_TS_CHECK_STATUS_INFO, TS_R_NO_TIME_STAMP_TOKEN);
diff --git a/src/lib/libcrypto/txt_db/Makefile b/src/lib/libcrypto/txt_db/Makefile
new file mode 100644
index 0000000000..e6f30331d8
--- /dev/null
+++ b/src/lib/libcrypto/txt_db/Makefile
@@ -0,0 +1,84 @@
1#
2# OpenSSL/crypto/txt_db/Makefile
3#
4
5DIR= txt_db
6TOP= ../..
7CC= cc
8INCLUDES=
9CFLAG=-g
10MAKEFILE= Makefile
11AR= ar r
12
13CFLAGS= $(INCLUDES) $(CFLAG)
14
15GENERAL=Makefile
16TEST=
17APPS=
18
19LIB=$(TOP)/libcrypto.a
20LIBSRC=txt_db.c
21LIBOBJ=txt_db.o
22
23SRC= $(LIBSRC)
24
25EXHEADER= txt_db.h
26HEADER= $(EXHEADER)
27
28ALL= $(GENERAL) $(SRC) $(HEADER)
29
30top:
31 (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all)
32
33all: lib
34
35lib: $(LIBOBJ)
36 $(AR) $(LIB) $(LIBOBJ)
37 $(RANLIB) $(LIB) || echo Never mind.
38 @touch lib
39
40files:
41 $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
42
43links:
44 @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
45 @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
46 @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
47
48install:
49 @[ -n "$(INSTALLTOP)" ] # should be set by top Makefile...
50 @headerlist="$(EXHEADER)"; for i in $$headerlist ; \
51 do \
52 (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
53 chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
54 done;
55
56tags:
57 ctags $(SRC)
58
59tests:
60
61lint:
62 lint -DLINT $(INCLUDES) $(SRC)>fluff
63
64depend:
65 @[ -n "$(MAKEDEPEND)" ] # should be set by top Makefile...
66 $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
67
68dclean:
69 $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
70 mv -f Makefile.new $(MAKEFILE)
71
72clean:
73 rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
74
75# DO NOT DELETE THIS LINE -- make depend depends on it.
76
77txt_db.o: ../../e_os.h ../../include/openssl/bio.h
78txt_db.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
79txt_db.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
80txt_db.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
81txt_db.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
82txt_db.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
83txt_db.o: ../../include/openssl/symhacks.h ../../include/openssl/txt_db.h
84txt_db.o: ../cryptlib.h txt_db.c
diff --git a/src/lib/libcrypto/ui/Makefile b/src/lib/libcrypto/ui/Makefile
new file mode 100644
index 0000000000..a685659fb4
--- /dev/null
+++ b/src/lib/libcrypto/ui/Makefile
@@ -0,0 +1,111 @@
1#
2# OpenSSL/crypto/ui/Makefile
3#
4
5DIR= ui
6TOP= ../..
7CC= cc
8INCLUDES= -I.. -I$(TOP) -I../../include
9CFLAG=-g
10MAKEFILE= Makefile
11AR= ar r
12
13CFLAGS= $(INCLUDES) $(CFLAG)
14
15GENERAL=Makefile
16#TEST= uitest.c
17TEST=
18APPS=
19
20COMPATSRC= ui_compat.c
21COMPATOBJ= ui_compat.o
22
23LIB=$(TOP)/libcrypto.a
24LIBSRC= ui_err.c ui_lib.c ui_openssl.c ui_util.c $(COMPATSRC)
25LIBOBJ= ui_err.o ui_lib.o ui_openssl.o ui_util.o $(COMPATOBJ)
26
27SRC= $(LIBSRC)
28
29EXHEADER= ui.h ui_compat.h
30HEADER= $(EXHEADER) ui_locl.h
31
32ALL= $(GENERAL) $(SRC) $(HEADER)
33
34top:
35 (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all)
36
37all: lib
38
39lib: $(LIBOBJ)
40 $(AR) $(LIB) $(LIBOBJ)
41 $(RANLIB) $(LIB) || echo Never mind.
42 @touch lib
43
44files:
45 $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
46
47links:
48 @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
49 @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
50 @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
51
52install:
53 @[ -n "$(INSTALLTOP)" ] # should be set by top Makefile...
54 @headerlist="$(EXHEADER)"; for i in $$headerlist ; \
55 do \
56 (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
57 chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
58 done;
59
60tags:
61 ctags $(SRC)
62
63tests:
64
65lint:
66 lint -DLINT $(INCLUDES) $(SRC)>fluff
67
68depend:
69 @[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile...
70 $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
71
72dclean:
73 $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
74 mv -f Makefile.new $(MAKEFILE)
75
76clean:
77 rm -f *.o */*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
78
79# DO NOT DELETE THIS LINE -- make depend depends on it.
80
81ui_compat.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslconf.h
82ui_compat.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
83ui_compat.o: ../../include/openssl/stack.h ../../include/openssl/ui.h
84ui_compat.o: ../../include/openssl/ui_compat.h ui_compat.c
85ui_err.o: ../../include/openssl/bio.h ../../include/openssl/crypto.h
86ui_err.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
87ui_err.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
88ui_err.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
89ui_err.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
90ui_err.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h ui_err.c
91ui_lib.o: ../../e_os.h ../../include/openssl/bio.h
92ui_lib.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
93ui_lib.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
94ui_lib.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
95ui_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
96ui_lib.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
97ui_lib.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
98ui_lib.o: ../cryptlib.h ui_lib.c ui_locl.h
99ui_openssl.o: ../../e_os.h ../../include/openssl/bio.h
100ui_openssl.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
101ui_openssl.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
102ui_openssl.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
103ui_openssl.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
104ui_openssl.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
105ui_openssl.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
106ui_openssl.o: ../cryptlib.h ui_locl.h ui_openssl.c
107ui_util.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
108ui_util.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
109ui_util.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
110ui_util.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
111ui_util.o: ../../include/openssl/ui.h ui_locl.h ui_util.c
diff --git a/src/lib/libcrypto/ui/ui_compat.c b/src/lib/libcrypto/ui/ui_compat.c
new file mode 100644
index 0000000000..13e0f70d90
--- /dev/null
+++ b/src/lib/libcrypto/ui/ui_compat.c
@@ -0,0 +1,67 @@
1/* crypto/ui/ui_compat.c -*- mode:C; c-file-style: "eay" -*- */
2/* ====================================================================
3 * Copyright (c) 2001-2002 The OpenSSL Project. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 *
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in
14 * the documentation and/or other materials provided with the
15 * distribution.
16 *
17 * 3. All advertising materials mentioning features or use of this
18 * software must display the following acknowledgment:
19 * "This product includes software developed by the OpenSSL Project
20 * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
21 *
22 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
23 * endorse or promote products derived from this software without
24 * prior written permission. For written permission, please contact
25 * openssl-core@openssl.org.
26 *
27 * 5. Products derived from this software may not be called "OpenSSL"
28 * nor may "OpenSSL" appear in their names without prior written
29 * permission of the OpenSSL Project.
30 *
31 * 6. Redistributions of any form whatsoever must retain the following
32 * acknowledgment:
33 * "This product includes software developed by the OpenSSL Project
34 * for use in the OpenSSL Toolkit (http://www.openssl.org/)"
35 *
36 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
37 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
38 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
39 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
40 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
41 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
42 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
43 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
44 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
45 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
46 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
47 * OF THE POSSIBILITY OF SUCH DAMAGE.
48 * ====================================================================
49 *
50 * This product includes cryptographic software written by Eric Young
51 * (eay@cryptsoft.com). This product includes software written by Tim
52 * Hudson (tjh@cryptsoft.com).
53 *
54 */
55
56#include <string.h>
57#include <openssl/ui_compat.h>
58
59int _ossl_old_des_read_pw_string(char *buf,int length,const char *prompt,int verify)
60 {
61 return UI_UTIL_read_pw_string(buf, length, prompt, verify);
62 }
63
64int _ossl_old_des_read_pw(char *buf,char *buff,int size,const char *prompt,int verify)
65 {
66 return UI_UTIL_read_pw(buf, buff, size, prompt, verify);
67 }
diff --git a/src/lib/libcrypto/ui/ui_openssl.c b/src/lib/libcrypto/ui/ui_openssl.c
index a38c7581e6..e319faa47b 100644
--- a/src/lib/libcrypto/ui/ui_openssl.c
+++ b/src/lib/libcrypto/ui/ui_openssl.c
@@ -122,15 +122,9 @@
122 * sigaction and fileno included. -pedantic would be more appropriate for 122 * sigaction and fileno included. -pedantic would be more appropriate for
123 * the intended purposes, but we can't prevent users from adding -ansi. 123 * the intended purposes, but we can't prevent users from adding -ansi.
124 */ 124 */
125#if defined(OPENSSL_SYSNAME_VXWORKS)
126#include <sys/types.h>
127#endif
128
129#if !defined(_POSIX_C_SOURCE) && defined(OPENSSL_SYS_VMS) 125#if !defined(_POSIX_C_SOURCE) && defined(OPENSSL_SYS_VMS)
130#ifndef _POSIX_C_SOURCE
131#define _POSIX_C_SOURCE 2 126#define _POSIX_C_SOURCE 2
132#endif 127#endif
133#endif
134#include <signal.h> 128#include <signal.h>
135#include <stdio.h> 129#include <stdio.h>
136#include <string.h> 130#include <string.h>
@@ -404,8 +398,8 @@ static int read_till_nl(FILE *in)
404 char buf[SIZE+1]; 398 char buf[SIZE+1];
405 399
406 do { 400 do {
407 if (!fgets(buf,SIZE,in)) 401 if (fgets(buf,sizeof(buf),in) == NULL)
408 return 0; 402 break;
409 } while (strchr(buf,'\n') == NULL); 403 } while (strchr(buf,'\n') == NULL);
410 return 1; 404 return 1;
411 } 405 }
diff --git a/src/lib/libcrypto/uid.c b/src/lib/libcrypto/uid.c
new file mode 100644
index 0000000000..b1fd52bada
--- /dev/null
+++ b/src/lib/libcrypto/uid.c
@@ -0,0 +1,89 @@
1/* crypto/uid.c */
2/* ====================================================================
3 * Copyright (c) 2001 The OpenSSL Project. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 *
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in
14 * the documentation and/or other materials provided with the
15 * distribution.
16 *
17 * 3. All advertising materials mentioning features or use of this
18 * software must display the following acknowledgment:
19 * "This product includes software developed by the OpenSSL Project
20 * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
21 *
22 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
23 * endorse or promote products derived from this software without
24 * prior written permission. For written permission, please contact
25 * licensing@OpenSSL.org.
26 *
27 * 5. Products derived from this software may not be called "OpenSSL"
28 * nor may "OpenSSL" appear in their names without prior written
29 * permission of the OpenSSL Project.
30 *
31 * 6. Redistributions of any form whatsoever must retain the following
32 * acknowledgment:
33 * "This product includes software developed by the OpenSSL Project
34 * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
35 *
36 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
37 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
38 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
39 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
40 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
41 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
42 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
43 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
44 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
45 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
46 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
47 * OF THE POSSIBILITY OF SUCH DAMAGE.
48 * ====================================================================
49 *
50 * This product includes cryptographic software written by Eric Young
51 * (eay@cryptsoft.com). This product includes software written by Tim
52 * Hudson (tjh@cryptsoft.com).
53 *
54 */
55
56#include <openssl/crypto.h>
57#include <openssl/opensslconf.h>
58
59#if defined(__OpenBSD__) || (defined(__FreeBSD__) && __FreeBSD__ > 2)
60
61#include OPENSSL_UNISTD
62
63int OPENSSL_issetugid(void)
64 {
65 return issetugid();
66 }
67
68#elif defined(OPENSSL_SYS_WIN32) || defined(OPENSSL_SYS_VXWORKS) || defined(OPENSSL_SYS_NETWARE)
69
70int OPENSSL_issetugid(void)
71 {
72 return 0;
73 }
74
75#else
76
77#include OPENSSL_UNISTD
78#include <sys/types.h>
79
80int OPENSSL_issetugid(void)
81 {
82 if (getuid() != geteuid()) return 1;
83 if (getgid() != getegid()) return 1;
84 return 0;
85 }
86#endif
87
88
89
diff --git a/src/lib/libcrypto/util/FreeBSD.sh b/src/lib/libcrypto/util/FreeBSD.sh
new file mode 100644
index 0000000000..db8edfc6aa
--- /dev/null
+++ b/src/lib/libcrypto/util/FreeBSD.sh
@@ -0,0 +1,6 @@
1#!/bin/sh
2
3perl util/perlpath.pl /usr/bin
4perl util/ssldir.pl /usr/local
5perl util/mk1mf.pl FreeBSD >Makefile.FreeBSD
6perl Configure FreeBSD
diff --git a/src/lib/libcrypto/util/add_cr.pl b/src/lib/libcrypto/util/add_cr.pl
new file mode 100644
index 0000000000..c7b62c11ec
--- /dev/null
+++ b/src/lib/libcrypto/util/add_cr.pl
@@ -0,0 +1,123 @@
1#!/usr/local/bin/perl
2#
3# This adds a copyright message to a souce code file.
4# It also gets the file name correct.
5#
6# perl util/add_cr.pl *.[ch] */*.[ch] */*/*.[ch]
7#
8
9foreach (@ARGV)
10 {
11 &dofile($_);
12 }
13
14sub dofile
15 {
16 local($file)=@_;
17
18 open(IN,"<$file") || die "unable to open $file:$!\n";
19
20 print STDERR "doing $file\n";
21 @in=<IN>;
22
23 return(1) if ($in[0] =~ / NOCW /);
24
25 @out=();
26 open(OUT,">$file.out") || die "unable to open $file.$$:$!\n";
27 push(@out,"/* $file */\n");
28 if (($in[1] !~ /^\/\* Copyright \(C\) [0-9-]+ Eric Young \(eay\@cryptsoft.com\)/))
29 {
30 push(@out,&Copyright);
31 $i=2;
32 @a=grep(/ Copyright \(C\) /,@in);
33 if ($#a >= 0)
34 {
35 while (($i <= $#in) && ($in[$i] ne " */\n"))
36 { $i++; }
37 $i++ if ($in[$i] eq " */\n");
38
39 while (($i <= $#in) && ($in[$i] =~ /^\s*$/))
40 { $i++; }
41
42 push(@out,"\n");
43 for ( ; $i <= $#in; $i++)
44 { push(@out,$in[$i]); }
45 }
46 else
47 { push(@out,@in); }
48 }
49 else
50 {
51 shift(@in);
52 push(@out,@in);
53 }
54 print OUT @out;
55 close(IN);
56 close(OUT);
57 rename("$file","$file.orig") || die "unable to rename $file:$!\n";
58 rename("$file.out",$file) || die "unable to rename $file.out:$!\n";
59 }
60
61
62
63sub Copyright
64 {
65 return <<'EOF';
66/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
67 * All rights reserved.
68 *
69 * This package is an SSL implementation written
70 * by Eric Young (eay@cryptsoft.com).
71 * The implementation was written so as to conform with Netscapes SSL.
72 *
73 * This library is free for commercial and non-commercial use as long as
74 * the following conditions are aheared to. The following conditions
75 * apply to all code found in this distribution, be it the RC4, RSA,
76 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
77 * included with this distribution is covered by the same copyright terms
78 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
79 *
80 * Copyright remains Eric Young's, and as such any Copyright notices in
81 * the code are not to be removed.
82 * If this package is used in a product, Eric Young should be given attribution
83 * as the author of the parts of the library used.
84 * This can be in the form of a textual message at program startup or
85 * in documentation (online or textual) provided with the package.
86 *
87 * Redistribution and use in source and binary forms, with or without
88 * modification, are permitted provided that the following conditions
89 * are met:
90 * 1. Redistributions of source code must retain the copyright
91 * notice, this list of conditions and the following disclaimer.
92 * 2. Redistributions in binary form must reproduce the above copyright
93 * notice, this list of conditions and the following disclaimer in the
94 * documentation and/or other materials provided with the distribution.
95 * 3. All advertising materials mentioning features or use of this software
96 * must display the following acknowledgement:
97 * "This product includes cryptographic software written by
98 * Eric Young (eay@cryptsoft.com)"
99 * The word 'cryptographic' can be left out if the rouines from the library
100 * being used are not cryptographic related :-).
101 * 4. If you include any Windows specific code (or a derivative thereof) from
102 * the apps directory (application code) you must include an acknowledgement:
103 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
104 *
105 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
106 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
107 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
108 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
109 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
110 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
111 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
112 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
113 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
114 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
115 * SUCH DAMAGE.
116 *
117 * The licence and distribution terms for any publically available version or
118 * derivative of this code cannot be changed. i.e. this code cannot simply be
119 * copied and put under another distribution licence
120 * [including the GNU Public Licence.]
121 */
122EOF
123 }
diff --git a/src/lib/libcrypto/util/bat.sh b/src/lib/libcrypto/util/bat.sh
new file mode 100644
index 0000000000..4d9a8287d0
--- /dev/null
+++ b/src/lib/libcrypto/util/bat.sh
@@ -0,0 +1,134 @@
1#!/usr/local/bin/perl
2
3$infile="/home/eay/ssl/SSLeay/MINFO";
4
5open(IN,"<$infile") || die "unable to open $infile:$!\n";
6$_=<IN>;
7for (;;)
8 {
9 chop;
10
11 ($key,$val)=/^([^=]+)=(.*)/;
12 if ($key eq "RELATIVE_DIRECTORY")
13 {
14 if ($lib ne "")
15 {
16 $uc=$lib;
17 $uc =~ s/^lib(.*)\.a/$1/;
18 $uc =~ tr/a-z/A-Z/;
19 $lib_nam{$uc}=$uc;
20 $lib_obj{$uc}.=$libobj." ";
21 }
22 last if ($val eq "FINISHED");
23 $lib="";
24 $libobj="";
25 $dir=$val;
26 }
27
28 if ($key eq "TEST")
29 { $test.=&var_add($dir,$val); }
30
31 if (($key eq "PROGS") || ($key eq "E_OBJ"))
32 { $e_exe.=&var_add($dir,$val); }
33
34 if ($key eq "LIB")
35 {
36 $lib=$val;
37 $lib =~ s/^.*\/([^\/]+)$/$1/;
38 }
39
40 if ($key eq "EXHEADER")
41 { $exheader.=&var_add($dir,$val); }
42
43 if ($key eq "HEADER")
44 { $header.=&var_add($dir,$val); }
45
46 if ($key eq "LIBSRC")
47 { $libsrc.=&var_add($dir,$val); }
48
49 if (!($_=<IN>))
50 { $_="RELATIVE_DIRECTORY=FINISHED\n"; }
51 }
52close(IN);
53
54@a=split(/\s+/,$libsrc);
55foreach (@a)
56 {
57 print "${_}.c\n";
58 }
59
60sub var_add
61 {
62 local($dir,$val)=@_;
63 local(@a,$_,$ret);
64
65 return("") if $no_engine && $dir =~ /\/engine/;
66 return("") if $no_idea && $dir =~ /\/idea/;
67 return("") if $no_rc2 && $dir =~ /\/rc2/;
68 return("") if $no_rc4 && $dir =~ /\/rc4/;
69 return("") if $no_rsa && $dir =~ /\/rsa/;
70 return("") if $no_rsa && $dir =~ /^rsaref/;
71 return("") if $no_dsa && $dir =~ /\/dsa/;
72 return("") if $no_dh && $dir =~ /\/dh/;
73 if ($no_des && $dir =~ /\/des/)
74 {
75 if ($val =~ /read_pwd/)
76 { return("$dir/read_pwd "); }
77 else
78 { return(""); }
79 }
80 return("") if $no_mdc2 && $dir =~ /\/mdc2/;
81 return("") if $no_sock && $dir =~ /\/proxy/;
82 return("") if $no_bf && $dir =~ /\/bf/;
83 return("") if $no_cast && $dir =~ /\/cast/;
84
85 $val =~ s/^\s*(.*)\s*$/$1/;
86 @a=split(/\s+/,$val);
87 grep(s/\.[och]$//,@a);
88
89 @a=grep(!/^e_.*_3d$/,@a) if $no_des;
90 @a=grep(!/^e_.*_d$/,@a) if $no_des;
91 @a=grep(!/^e_.*_i$/,@a) if $no_idea;
92 @a=grep(!/^e_.*_r2$/,@a) if $no_rc2;
93 @a=grep(!/^e_.*_bf$/,@a) if $no_bf;
94 @a=grep(!/^e_.*_c$/,@a) if $no_cast;
95 @a=grep(!/^e_rc4$/,@a) if $no_rc4;
96
97 @a=grep(!/(^s2_)|(^s23_)/,@a) if $no_ssl2;
98 @a=grep(!/(^s3_)|(^s23_)/,@a) if $no_ssl3;
99
100 @a=grep(!/(_sock$)|(_acpt$)|(_conn$)|(^pxy_)/,@a) if $no_sock;
101
102 @a=grep(!/(^md2)|(_md2$)/,@a) if $no_md2;
103 @a=grep(!/(^md5)|(_md5$)/,@a) if $no_md5;
104
105 @a=grep(!/(^d2i_r_)|(^i2d_r_)/,@a) if $no_rsa;
106 @a=grep(!/(^p_open$)|(^p_seal$)/,@a) if $no_rsa;
107 @a=grep(!/(^pem_seal$)/,@a) if $no_rsa;
108
109 @a=grep(!/(m_dss$)|(m_dss1$)/,@a) if $no_dsa;
110 @a=grep(!/(^d2i_s_)|(^i2d_s_)|(_dsap$)/,@a) if $no_dsa;
111
112 @a=grep(!/^n_pkey$/,@a) if $no_rsa || $no_rc4;
113
114 @a=grep(!/_dhp$/,@a) if $no_dh;
115
116 @a=grep(!/(^sha[^1])|(_sha$)|(m_dss$)/,@a) if $no_sha;
117 @a=grep(!/(^sha1)|(_sha1$)|(m_dss1$)/,@a) if $no_sha1;
118 @a=grep(!/_mdc2$/,@a) if $no_mdc2;
119
120 @a=grep(!/^engine$/,@a) if $no_engine;
121 @a=grep(!/(^rsa$)|(^genrsa$)|(^req$)|(^ca$)/,@a) if $no_rsa;
122 @a=grep(!/(^dsa$)|(^gendsa$)|(^dsaparam$)/,@a) if $no_dsa;
123 @a=grep(!/^gendsa$/,@a) if $no_sha1;
124 @a=grep(!/(^dh$)|(^gendh$)/,@a) if $no_dh;
125
126 @a=grep(!/(^dh)|(_sha1$)|(m_dss1$)/,@a) if $no_sha1;
127
128 grep($_="$dir/$_",@a);
129 @a=grep(!/(^|\/)s_/,@a) if $no_sock;
130 @a=grep(!/(^|\/)bio_sock/,@a) if $no_sock;
131 $ret=join(' ',@a)." ";
132 return($ret);
133 }
134
diff --git a/src/lib/libcrypto/util/ck_errf.pl b/src/lib/libcrypto/util/ck_errf.pl
new file mode 100644
index 0000000000..f13af5c50b
--- /dev/null
+++ b/src/lib/libcrypto/util/ck_errf.pl
@@ -0,0 +1,64 @@
1#!/usr/local/bin/perl
2#
3# This is just a quick script to scan for cases where the 'error'
4# function name in a XXXerr() macro is wrong.
5#
6# Run in the top level by going
7# perl util/ck_errf.pl */*.c */*/*.c
8#
9
10my $err_strict = 0;
11my $bad = 0;
12
13foreach $file (@ARGV)
14 {
15 if ($file eq "-strict")
16 {
17 $err_strict = 1;
18 next;
19 }
20 open(IN,"<$file") || die "unable to open $file\n";
21 $func="";
22 while (<IN>)
23 {
24 if (!/;$/ && /^([a-zA-Z].*[\s*])?([A-Za-z_0-9]+)\(.*[),]/)
25 {
26 /^([^()]*(\([^()]*\)[^()]*)*)\(/;
27 $1 =~ /([A-Za-z_0-9]*)$/;
28 $func = $1;
29 $func =~ tr/A-Z/a-z/;
30 }
31 if (/([A-Z0-9]+)err\(([^,]+)/ && ! /ckerr_ignore/)
32 {
33 $errlib=$1;
34 $n=$2;
35
36 if ($func eq "")
37 { print "$file:$.:???:$n\n"; $bad = 1; next; }
38
39 if ($n !~ /([^_]+)_F_(.+)$/)
40 {
41 # print "check -$file:$.:$func:$n\n";
42 next;
43 }
44 $lib=$1;
45 $n=$2;
46
47 if ($lib ne $errlib)
48 { print "$file:$.:$func:$n [${errlib}err]\n"; $bad = 1; next; }
49
50 $n =~ tr/A-Z/a-z/;
51 if (($n ne $func) && ($errlib ne "SYS"))
52 { print "$file:$.:$func:$n\n"; $bad = 1; next; }
53 # print "$func:$1\n";
54 }
55 }
56 close(IN);
57 }
58
59if ($bad && $err_strict)
60 {
61 print STDERR "FATAL: error discrepancy\n";
62 exit 1;
63 }
64
diff --git a/src/lib/libcrypto/util/clean-depend.pl b/src/lib/libcrypto/util/clean-depend.pl
new file mode 100644
index 0000000000..d3525b0ed0
--- /dev/null
+++ b/src/lib/libcrypto/util/clean-depend.pl
@@ -0,0 +1,58 @@
1#!/usr/local/bin/perl -w
2# Clean the dependency list in a makefile of standard includes...
3# Written by Ben Laurie <ben@algroup.co.uk> 19 Jan 1999
4
5use strict;
6
7while(<STDIN>) {
8 print;
9 last if /^# DO NOT DELETE THIS LINE/;
10}
11
12my %files;
13
14my $thisfile="";
15while(<STDIN>) {
16 my ($dummy, $file,$deps)=/^((.*):)? (.*)$/;
17 my $origfile="";
18 $thisfile=$file if defined $file;
19 next if !defined $deps;
20 $origfile=$thisfile;
21 $origfile=~s/\.o$/.c/;
22 my @deps=split ' ',$deps;
23 @deps=grep(!/^\//,@deps);
24 @deps=grep(!/^\\$/,@deps);
25 @deps=grep(!/^$origfile$/,@deps);
26# pull out the kludged kerberos header (if present).
27 @deps=grep(!/^[.\/]+\/krb5.h/,@deps);
28 push @{$files{$thisfile}},@deps;
29}
30
31my $file;
32foreach $file (sort keys %files) {
33 my $len=0;
34 my $dep;
35 my $origfile=$file;
36 $origfile=~s/\.o$/.c/;
37 $file=~s/^\.\///;
38 push @{$files{$file}},$origfile;
39 my $prevdep="";
40
41 # Remove leading ./ before sorting
42 my @deps = map { $_ =~ s/^\.\///; $_ } @{$files{$file}};
43
44 foreach $dep (sort @deps) {
45 $dep=~s/^\.\///;
46 next if $prevdep eq $dep; # to exterminate duplicates...
47 $prevdep = $dep;
48 $len=0 if $len+length($dep)+1 >= 80;
49 if($len == 0) {
50 print "\n$file:";
51 $len=length($file)+1;
52 }
53 print " $dep";
54 $len+=length($dep)+1;
55 }
56}
57
58print "\n";
diff --git a/src/lib/libcrypto/util/copy.pl b/src/lib/libcrypto/util/copy.pl
new file mode 100644
index 0000000000..eba6d5815e
--- /dev/null
+++ b/src/lib/libcrypto/util/copy.pl
@@ -0,0 +1,70 @@
1#!/usr/local/bin/perl
2
3use Fcntl;
4
5
6# copy.pl
7
8# Perl script 'copy' comment. On Windows the built in "copy" command also
9# copies timestamps: this messes up Makefile dependencies.
10
11my $stripcr = 0;
12
13my $arg;
14
15foreach $arg (@ARGV) {
16 if ($arg eq "-stripcr")
17 {
18 $stripcr = 1;
19 next;
20 }
21 $arg =~ s|\\|/|g; # compensate for bug/feature in cygwin glob...
22 foreach (glob $arg)
23 {
24 push @filelist, $_;
25 }
26}
27
28$fnum = @filelist;
29
30if ($fnum <= 1)
31 {
32 die "Need at least two filenames";
33 }
34
35$dest = pop @filelist;
36
37if ($fnum > 2 && ! -d $dest)
38 {
39 die "Destination must be a directory";
40 }
41
42foreach (@filelist)
43 {
44 if (-d $dest)
45 {
46 $dfile = $_;
47 $dfile =~ s|^.*[/\\]([^/\\]*)$|$1|;
48 $dfile = "$dest/$dfile";
49 }
50 else
51 {
52 $dfile = $dest;
53 }
54 sysopen(IN, $_, O_RDONLY|O_BINARY) || die "Can't Open $_";
55 sysopen(OUT, $dfile, O_WRONLY|O_CREAT|O_TRUNC|O_BINARY)
56 || die "Can't Open $dfile";
57 while (sysread IN, $buf, 10240)
58 {
59 if ($stripcr)
60 {
61 $buf =~ tr/\015//d;
62 }
63 syswrite(OUT, $buf, length($buf));
64 }
65 close(IN);
66 close(OUT);
67 print "Copying: $_ to $dfile\n";
68 }
69
70
diff --git a/src/lib/libcrypto/util/cygwin.sh b/src/lib/libcrypto/util/cygwin.sh
new file mode 100644
index 0000000000..cfdb04d2a4
--- /dev/null
+++ b/src/lib/libcrypto/util/cygwin.sh
@@ -0,0 +1,154 @@
1#!/bin/bash
2#
3# This script configures, builds and packs the binary package for
4# the Cygwin net distribution version of OpenSSL
5#
6
7# Uncomment when debugging
8#set -x
9
10CONFIG_OPTIONS="--prefix=/usr shared zlib no-idea no-rc5"
11INSTALL_PREFIX=/tmp/install/INSTALL
12
13VERSION=
14SHLIB_VERSION_NUMBER=
15SUBVERSION=$1
16
17function cleanup()
18{
19 rm -rf ${INSTALL_PREFIX}/etc
20 rm -rf ${INSTALL_PREFIX}/usr
21}
22
23function get_openssl_version()
24{
25 eval `grep '^VERSION=' Makefile`
26 if [ -z "${VERSION}" ]
27 then
28 echo "Error: Couldn't retrieve OpenSSL version from Makefile."
29 echo " Check value of variable VERSION in Makefile."
30 exit 1
31 fi
32 eval `grep '^SHLIB_VERSION_NUMBER=' Makefile`
33 if [ -z "${SHLIB_VERSION_NUMBER}" ]
34 then
35 echo "Error: Couldn't retrieve OpenSSL shared lib version from Makefile."
36 echo " Check value of variable SHLIB_VERSION_NUMBER in Makefile."
37 exit 1
38 fi
39}
40
41function base_install()
42{
43 mkdir -p ${INSTALL_PREFIX}
44 cleanup
45 make install INSTALL_PREFIX="${INSTALL_PREFIX}"
46}
47
48function doc_install()
49{
50 DOC_DIR=${INSTALL_PREFIX}/usr/share/doc/openssl
51
52 mkdir -p ${DOC_DIR}
53 cp CHANGES CHANGES.SSLeay INSTALL LICENSE NEWS README ${DOC_DIR}
54
55 create_cygwin_readme
56}
57
58function certs_install()
59{
60 CERTS_DIR=${INSTALL_PREFIX}/usr/ssl/certs
61
62 mkdir -p ${CERTS_DIR}
63 cp -rp certs/* ${CERTS_DIR}
64}
65
66function create_cygwin_readme()
67{
68 README_DIR=${INSTALL_PREFIX}/usr/share/doc/Cygwin
69 README_FILE=${README_DIR}/openssl-${VERSION}.README
70
71 mkdir -p ${README_DIR}
72 cat > ${README_FILE} <<- EOF
73 The Cygwin version has been built using the following configure:
74
75 ./config ${CONFIG_OPTIONS}
76
77 The IDEA and RC5 algorithms are disabled due to patent and/or
78 licensing issues.
79 EOF
80}
81
82function create_profile_files()
83{
84 PROFILE_DIR=${INSTALL_PREFIX}/etc/profile.d
85
86 mkdir -p $PROFILE_DIR
87 cat > ${PROFILE_DIR}/openssl.sh <<- "EOF"
88 export MANPATH="${MANPATH}:/usr/ssl/man"
89 EOF
90 cat > ${PROFILE_DIR}/openssl.csh <<- "EOF"
91 if ( $?MANPATH ) then
92 setenv MANPATH "${MANPATH}:/usr/ssl/man"
93 else
94 setenv MANPATH ":/usr/ssl/man"
95 endif
96 EOF
97}
98
99if [ -z "${SUBVERSION}" ]
100then
101 echo "Usage: $0 subversion"
102 exit 1
103fi
104
105if [ ! -f config ]
106then
107 echo "You must start this script in the OpenSSL toplevel source dir."
108 exit 1
109fi
110
111./config ${CONFIG_OPTIONS}
112
113get_openssl_version
114
115make depend || exit 1
116
117make || exit 1
118
119base_install
120
121doc_install
122
123certs_install
124
125create_cygwin_readme
126
127create_profile_files
128
129cd ${INSTALL_PREFIX}
130chmod u+w usr/lib/engines/*.so
131strip usr/bin/*.exe usr/bin/*.dll usr/lib/engines/*.so
132chmod u-w usr/lib/engines/*.so
133
134# Runtime package
135tar cjf libopenssl${SHLIB_VERSION_NUMBER//[!0-9]/}-${VERSION}-${SUBVERSION}.tar.bz2 \
136 usr/bin/cyg*dll
137# Base package
138find etc usr/bin/openssl.exe usr/bin/c_rehash usr/lib/engines usr/share/doc \
139 usr/ssl/certs usr/ssl/man/man[157] usr/ssl/misc usr/ssl/openssl.cnf \
140 usr/ssl/private \
141 -empty -o \! -type d |
142tar cjfT openssl-${VERSION}-${SUBVERSION}.tar.bz2 -
143# Development package
144find usr/include usr/lib/*.a usr/lib/pkgconfig usr/ssl/man/man3 \
145 -empty -o \! -type d |
146tar cjfT openssl-devel-${VERSION}-${SUBVERSION}.tar.bz2 -
147
148ls -l openssl-${VERSION}-${SUBVERSION}.tar.bz2
149ls -l openssl-devel-${VERSION}-${SUBVERSION}.tar.bz2
150ls -l libopenssl${SHLIB_VERSION_NUMBER//[!0-9]/}-${VERSION}-${SUBVERSION}.tar.bz2
151
152cleanup
153
154exit 0
diff --git a/src/lib/libcrypto/util/deleof.pl b/src/lib/libcrypto/util/deleof.pl
new file mode 100644
index 0000000000..155acd88ff
--- /dev/null
+++ b/src/lib/libcrypto/util/deleof.pl
@@ -0,0 +1,7 @@
1#!/usr/local/bin/perl
2
3while (<>)
4 {
5 print
6 last if (/^# DO NOT DELETE THIS LINE/);
7 }
diff --git a/src/lib/libcrypto/util/deltree.com b/src/lib/libcrypto/util/deltree.com
new file mode 100644
index 0000000000..9f36b1a5e9
--- /dev/null
+++ b/src/lib/libcrypto/util/deltree.com
@@ -0,0 +1,34 @@
1$! DELTREE.COM
2$
3$ call deltree 'p1'
4$ exit $status
5$
6$ deltree: subroutine ! P1 is a name of a directory
7$ on control_y then goto dt_STOP
8$ on warning then goto dt_exit
9$ _dt_def = f$trnlnm("SYS$DISK")+f$directory()
10$ if f$parse(p1) .eqs. "" then exit
11$ set default 'f$parse(p1,,,"DEVICE")''f$parse(p1,,,"DIRECTORY")'
12$ p1 = f$parse(p1,,,"NAME") + f$parse(p1,,,"TYPE")
13$ _fp = f$parse(".DIR",p1)
14$ dt_loop:
15$ _f = f$search(_fp)
16$ if _f .eqs. "" then goto dt_loopend
17$ call deltree [.'f$parse(_f,,,"NAME")']*.*
18$ goto dt_loop
19$ dt_loopend:
20$ _fp = f$parse(p1,".;*")
21$ if f$search(_fp) .eqs. "" then goto dt_exit
22$ set noon
23$ set file/prot=(S:RWED,O:RWED,G:RWED,W:RWED) '_fp'
24$ set on
25$ delete/nolog '_fp'
26$ dt_exit:
27$ set default '_dt_def'
28$ goto dt_end
29$ dt_STOP:
30$ set default '_dt_def'
31$ stop/id=""
32$ exit
33$ dt_end:
34$ endsubroutine
diff --git a/src/lib/libcrypto/util/dirname.pl b/src/lib/libcrypto/util/dirname.pl
new file mode 100644
index 0000000000..d7a66d96ac
--- /dev/null
+++ b/src/lib/libcrypto/util/dirname.pl
@@ -0,0 +1,18 @@
1#!/usr/local/bin/perl
2
3if ($#ARGV < 0) {
4 die "dirname.pl: too few arguments\n";
5} elsif ($#ARGV > 0) {
6 die "dirname.pl: too many arguments\n";
7}
8
9my $d = $ARGV[0];
10
11if ($d =~ m|.*/.*|) {
12 $d =~ s|/[^/]*$||;
13} else {
14 $d = ".";
15}
16
17print $d,"\n";
18exit(0);
diff --git a/src/lib/libcrypto/util/do_ms.sh b/src/lib/libcrypto/util/do_ms.sh
new file mode 100644
index 0000000000..515b074cff
--- /dev/null
+++ b/src/lib/libcrypto/util/do_ms.sh
@@ -0,0 +1,19 @@
1#!/bin/sh
2#
3# generate the Microsoft makefiles and .def files
4#
5
6PATH=util:../util:$PATH
7
8# perl util/mk1mf.pl no-sock VC-MSDOS >ms/msdos.mak
9# perl util/mk1mf.pl VC-W31-32 >ms/w31.mak
10perl util/mk1mf.pl dll VC-WIN16 >ms/w31dll.mak
11# perl util/mk1mf.pl VC-WIN32 >ms/nt.mak
12perl util/mk1mf.pl dll VC-WIN32 >ms/ntdll.mak
13perl util/mk1mf.pl Mingw32 >ms/mingw32.mak
14perl util/mk1mf.pl Mingw32-files >ms/mingw32f.mak
15
16perl util/mkdef.pl 16 libeay > ms/libeay16.def
17perl util/mkdef.pl 32 libeay > ms/libeay32.def
18perl util/mkdef.pl 16 ssleay > ms/ssleay16.def
19perl util/mkdef.pl 32 ssleay > ms/ssleay32.def
diff --git a/src/lib/libcrypto/util/domd b/src/lib/libcrypto/util/domd
new file mode 100644
index 0000000000..bab48cb7a2
--- /dev/null
+++ b/src/lib/libcrypto/util/domd
@@ -0,0 +1,38 @@
1#!/bin/sh
2# Do a makedepend, only leave out the standard headers
3# Written by Ben Laurie <ben@algroup.co.uk> 19 Jan 1999
4
5TOP=$1
6shift
7if [ "$1" = "-MD" ]; then
8 shift
9 MAKEDEPEND=$1
10 shift
11fi
12if [ "$MAKEDEPEND" = "" ]; then MAKEDEPEND=makedepend; fi
13
14cp Makefile Makefile.save
15# fake the presence of Kerberos
16touch $TOP/krb5.h
17if expr "$MAKEDEPEND" : '.*gcc$' > /dev/null; then
18 args=""
19 while [ $# -gt 0 ]; do
20 if [ "$1" != "--" ]; then args="$args $1"; fi
21 shift
22 done
23 sed -e '/^# DO NOT DELETE.*/,$d' < Makefile > Makefile.tmp
24 echo '# DO NOT DELETE THIS LINE -- make depend depends on it.' >> Makefile.tmp
25 ${MAKEDEPEND} -Werror -D OPENSSL_DOING_MAKEDEPEND -M $args >> Makefile.tmp || exit 1
26 ${PERL} $TOP/util/clean-depend.pl < Makefile.tmp > Makefile.new
27 RC=$?
28 rm -f Makefile.tmp
29else
30 ${MAKEDEPEND} -D OPENSSL_DOING_MAKEDEPEND $@ && \
31 ${PERL} $TOP/util/clean-depend.pl < Makefile > Makefile.new
32 RC=$?
33fi
34mv Makefile.new Makefile
35# unfake the presence of Kerberos
36rm $TOP/krb5.h
37
38exit $RC
diff --git a/src/lib/libcrypto/util/err-ins.pl b/src/lib/libcrypto/util/err-ins.pl
new file mode 100644
index 0000000000..31b70df8d0
--- /dev/null
+++ b/src/lib/libcrypto/util/err-ins.pl
@@ -0,0 +1,33 @@
1#!/usr/local/bin/perl
2#
3# tack error codes onto the end of a file
4#
5
6open(ERR,$ARGV[0]) || die "unable to open error file '$ARGV[0]':$!\n";
7@err=<ERR>;
8close(ERR);
9
10open(IN,$ARGV[1]) || die "unable to open header file '$ARGV[1]':$!\n";
11
12@out="";
13while (<IN>)
14 {
15 push(@out,$_);
16 last if /BEGIN ERROR CODES/;
17 }
18close(IN);
19
20open(OUT,">$ARGV[1]") || die "unable to open header file '$ARGV[1]':$1\n";
21print OUT @out;
22print OUT @err;
23print OUT <<"EOF";
24
25#ifdef __cplusplus
26}
27#endif
28#endif
29
30EOF
31close(OUT);
32
33
diff --git a/src/lib/libcrypto/util/extract-names.pl b/src/lib/libcrypto/util/extract-names.pl
new file mode 100644
index 0000000000..35bd6ed843
--- /dev/null
+++ b/src/lib/libcrypto/util/extract-names.pl
@@ -0,0 +1,26 @@
1#!/usr/bin/perl
2
3$/ = ""; # Eat a paragraph at once.
4while(<STDIN>) {
5 chop;
6 s/\n/ /gm;
7 if (/^=head1 /) {
8 $name = 0;
9 } elsif ($name) {
10 if (/ - /) {
11 s/ - .*//;
12 s/,\s+/,/g;
13 s/\s+,/,/g;
14 s/^\s+//g;
15 s/\s+$//g;
16 s/\s/_/g;
17 push @words, split ',';
18 }
19 }
20 if (/^=head1 *NAME *$/) {
21 $name = 1;
22 }
23}
24
25print join("\n", @words),"\n";
26
diff --git a/src/lib/libcrypto/util/extract-section.pl b/src/lib/libcrypto/util/extract-section.pl
new file mode 100644
index 0000000000..7a0ba4f69a
--- /dev/null
+++ b/src/lib/libcrypto/util/extract-section.pl
@@ -0,0 +1,12 @@
1#!/usr/bin/perl
2
3while(<STDIN>) {
4 if (/=for\s+comment\s+openssl_manual_section:(\S+)/)
5 {
6 print "$1\n";
7 exit 0;
8 }
9}
10
11print "$ARGV[0]\n";
12
diff --git a/src/lib/libcrypto/util/files.pl b/src/lib/libcrypto/util/files.pl
new file mode 100644
index 0000000000..41f033e3b9
--- /dev/null
+++ b/src/lib/libcrypto/util/files.pl
@@ -0,0 +1,61 @@
1#!/usr/local/bin/perl
2#
3# used to generate the file MINFO for use by util/mk1mf.pl
4# It is basically a list of all variables from the passed makefile
5#
6
7$s="";
8while (<>)
9 {
10 chop;
11 s/#.*//;
12 if (/^(\S+)\s*=\s*(.*)$/)
13 {
14 $o="";
15 ($s,$b)=($1,$2);
16 for (;;)
17 {
18 if ($b =~ /\\$/)
19 {
20 chop($b);
21 $o.=$b." ";
22 $b=<>;
23 chop($b);
24 }
25 else
26 {
27 $o.=$b." ";
28 last;
29 }
30 }
31 $o =~ s/^\s+//;
32 $o =~ s/\s+$//;
33 $o =~ s/\s+/ /g;
34
35 $o =~ s/\$[({]([^)}]+)[)}]/$sym{$1}/g;
36 $sym{$s}=$o;
37 }
38 }
39
40$pwd=`pwd`; chop($pwd);
41
42if ($sym{'TOP'} eq ".")
43 {
44 $n=0;
45 $dir=".";
46 }
47else {
48 $n=split(/\//,$sym{'TOP'});
49 @_=split(/\//,$pwd);
50 $z=$#_-$n+1;
51 foreach $i ($z .. $#_) { $dir.=$_[$i]."/"; }
52 chop($dir);
53 }
54
55print "RELATIVE_DIRECTORY=$dir\n";
56
57foreach (sort keys %sym)
58 {
59 print "$_=$sym{$_}\n";
60 }
61print "RELATIVE_DIRECTORY=\n";
diff --git a/src/lib/libcrypto/util/fixNT.sh b/src/lib/libcrypto/util/fixNT.sh
new file mode 100644
index 0000000000..ab9e766b86
--- /dev/null
+++ b/src/lib/libcrypto/util/fixNT.sh
@@ -0,0 +1,14 @@
1#!/bin/sh
2#
3# clean up the mess that NT makes of my source tree
4#
5
6if [ -f makefile -a ! -f Makefile ]; then
7 /bin/mv makefile Makefile
8fi
9chmod +x Configure util/*
10echo cleaning
11/bin/rm -f `find . -name '*.$$$' -print` 2>/dev/null >/dev/null
12echo 'removing those damn ^M'
13perl -pi -e 's/\015//' `find . -type 'f' -print |grep -v '.obj$' |grep -v '.der$' |grep -v '.gz'`
14make -f Makefile links
diff --git a/src/lib/libcrypto/util/install.sh b/src/lib/libcrypto/util/install.sh
new file mode 100644
index 0000000000..e1d0c982df
--- /dev/null
+++ b/src/lib/libcrypto/util/install.sh
@@ -0,0 +1,108 @@
1#!/bin/sh
2#
3# install - install a program, script, or datafile
4# This comes from X11R5; it is not part of GNU.
5#
6# $XConsortium: install.sh,v 1.2 89/12/18 14:47:22 jim Exp $
7#
8# This script is compatible with the BSD install script, but was written
9# from scratch.
10#
11
12
13# set DOITPROG to echo to test this script
14
15doit="${DOITPROG:-}"
16
17
18# put in absolute paths if you don't have them in your path; or use env. vars.
19
20mvprog="${MVPROG:-mv}"
21cpprog="${CPPROG:-cp}"
22chmodprog="${CHMODPROG:-chmod}"
23chownprog="${CHOWNPROG:-chown}"
24chgrpprog="${CHGRPPROG:-chgrp}"
25stripprog="${STRIPPROG:-strip}"
26rmprog="${RMPROG:-rm}"
27
28instcmd="$mvprog"
29chmodcmd=""
30chowncmd=""
31chgrpcmd=""
32stripcmd=""
33rmcmd="$rmprog -f"
34src=""
35dst=""
36
37while [ x"$1" != x ]; do
38 case $1 in
39 -c) instcmd="$cpprog"
40 shift
41 continue;;
42
43 -m) chmodcmd="$chmodprog $2"
44 shift
45 shift
46 continue;;
47
48 -o) chowncmd="$chownprog $2"
49 shift
50 shift
51 continue;;
52
53 -g) chgrpcmd="$chgrpprog $2"
54 shift
55 shift
56 continue;;
57
58 -s) stripcmd="$stripprog"
59 shift
60 continue;;
61
62 *) if [ x"$src" = x ]
63 then
64 src=$1
65 else
66 dst=$1
67 fi
68 shift
69 continue;;
70 esac
71done
72
73if [ x"$src" = x ]
74then
75 echo "install: no input file specified"
76 exit 1
77fi
78
79if [ x"$dst" = x ]
80then
81 echo "install: no destination specified"
82 exit 1
83fi
84
85
86# if destination is a directory, append the input filename; if your system
87# does not like double slashes in filenames, you may need to add some logic
88
89if [ -d $dst ]
90then
91 dst="$dst"/`basename $src`
92fi
93
94
95# get rid of the old one and mode the new one in
96
97$doit $rmcmd $dst
98$doit $instcmd $src $dst
99
100
101# and set any options; do chmod last to preserve setuid bits
102
103if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; fi
104if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; fi
105if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; fi
106if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; fi
107
108exit 0
diff --git a/src/lib/libcrypto/util/libeay.num b/src/lib/libcrypto/util/libeay.num
new file mode 100644
index 0000000000..93f80ba0c6
--- /dev/null
+++ b/src/lib/libcrypto/util/libeay.num
@@ -0,0 +1,4312 @@
1SSLeay 1 EXIST::FUNCTION:
2SSLeay_version 2 EXIST::FUNCTION:
3ASN1_BIT_STRING_asn1_meth 3 NOEXIST::FUNCTION:
4ASN1_HEADER_free 4 NOEXIST::FUNCTION:
5ASN1_HEADER_new 5 NOEXIST::FUNCTION:
6ASN1_IA5STRING_asn1_meth 6 NOEXIST::FUNCTION:
7ASN1_INTEGER_get 7 EXIST::FUNCTION:
8ASN1_INTEGER_set 8 EXIST::FUNCTION:
9ASN1_INTEGER_to_BN 9 EXIST::FUNCTION:
10ASN1_OBJECT_create 10 EXIST::FUNCTION:
11ASN1_OBJECT_free 11 EXIST::FUNCTION:
12ASN1_OBJECT_new 12 EXIST::FUNCTION:
13ASN1_PRINTABLE_type 13 EXIST::FUNCTION:
14ASN1_STRING_cmp 14 EXIST::FUNCTION:
15ASN1_STRING_dup 15 EXIST::FUNCTION:
16ASN1_STRING_free 16 EXIST::FUNCTION:
17ASN1_STRING_new 17 EXIST::FUNCTION:
18ASN1_STRING_print 18 EXIST::FUNCTION:BIO
19ASN1_STRING_set 19 EXIST::FUNCTION:
20ASN1_STRING_type_new 20 EXIST::FUNCTION:
21ASN1_TYPE_free 21 EXIST::FUNCTION:
22ASN1_TYPE_new 22 EXIST::FUNCTION:
23ASN1_UNIVERSALSTRING_to_string 23 EXIST::FUNCTION:
24ASN1_UTCTIME_check 24 EXIST::FUNCTION:
25ASN1_UTCTIME_print 25 EXIST::FUNCTION:BIO
26ASN1_UTCTIME_set 26 EXIST::FUNCTION:
27ASN1_check_infinite_end 27 EXIST::FUNCTION:
28ASN1_d2i_bio 28 EXIST::FUNCTION:BIO
29ASN1_d2i_fp 29 EXIST::FUNCTION:FP_API
30ASN1_digest 30 EXIST::FUNCTION:EVP
31ASN1_dup 31 EXIST::FUNCTION:
32ASN1_get_object 32 EXIST::FUNCTION:
33ASN1_i2d_bio 33 EXIST::FUNCTION:BIO
34ASN1_i2d_fp 34 EXIST::FUNCTION:FP_API
35ASN1_object_size 35 EXIST::FUNCTION:
36ASN1_parse 36 EXIST::FUNCTION:BIO
37ASN1_put_object 37 EXIST::FUNCTION:
38ASN1_sign 38 EXIST::FUNCTION:EVP
39ASN1_verify 39 EXIST::FUNCTION:EVP
40BF_cbc_encrypt 40 EXIST::FUNCTION:BF
41BF_cfb64_encrypt 41 EXIST::FUNCTION:BF
42BF_ecb_encrypt 42 EXIST::FUNCTION:BF
43BF_encrypt 43 EXIST::FUNCTION:BF
44BF_ofb64_encrypt 44 EXIST::FUNCTION:BF
45BF_options 45 EXIST::FUNCTION:BF
46BF_set_key 46 EXIST::FUNCTION:BF
47BIO_CONNECT_free 47 NOEXIST::FUNCTION:
48BIO_CONNECT_new 48 NOEXIST::FUNCTION:
49BIO_accept 51 EXIST::FUNCTION:
50BIO_ctrl 52 EXIST::FUNCTION:
51BIO_int_ctrl 53 EXIST::FUNCTION:
52BIO_debug_callback 54 EXIST::FUNCTION:
53BIO_dump 55 EXIST::FUNCTION:
54BIO_dup_chain 56 EXIST::FUNCTION:
55BIO_f_base64 57 EXIST::FUNCTION:BIO
56BIO_f_buffer 58 EXIST::FUNCTION:
57BIO_f_cipher 59 EXIST::FUNCTION:BIO
58BIO_f_md 60 EXIST::FUNCTION:BIO
59BIO_f_null 61 EXIST::FUNCTION:
60BIO_f_proxy_server 62 NOEXIST::FUNCTION:
61BIO_fd_non_fatal_error 63 EXIST::FUNCTION:
62BIO_fd_should_retry 64 EXIST::FUNCTION:
63BIO_find_type 65 EXIST::FUNCTION:
64BIO_free 66 EXIST::FUNCTION:
65BIO_free_all 67 EXIST::FUNCTION:
66BIO_get_accept_socket 69 EXIST::FUNCTION:
67BIO_get_filter_bio 70 NOEXIST::FUNCTION:
68BIO_get_host_ip 71 EXIST::FUNCTION:
69BIO_get_port 72 EXIST::FUNCTION:
70BIO_get_retry_BIO 73 EXIST::FUNCTION:
71BIO_get_retry_reason 74 EXIST::FUNCTION:
72BIO_gethostbyname 75 EXIST::FUNCTION:
73BIO_gets 76 EXIST::FUNCTION:
74BIO_new 78 EXIST::FUNCTION:
75BIO_new_accept 79 EXIST::FUNCTION:
76BIO_new_connect 80 EXIST::FUNCTION:
77BIO_new_fd 81 EXIST::FUNCTION:
78BIO_new_file 82 EXIST::FUNCTION:FP_API
79BIO_new_fp 83 EXIST::FUNCTION:FP_API
80BIO_new_socket 84 EXIST::FUNCTION:
81BIO_pop 85 EXIST::FUNCTION:
82BIO_printf 86 EXIST::FUNCTION:
83BIO_push 87 EXIST::FUNCTION:
84BIO_puts 88 EXIST::FUNCTION:
85BIO_read 89 EXIST::FUNCTION:
86BIO_s_accept 90 EXIST::FUNCTION:
87BIO_s_connect 91 EXIST::FUNCTION:
88BIO_s_fd 92 EXIST::FUNCTION:
89BIO_s_file 93 EXIST::FUNCTION:FP_API
90BIO_s_mem 95 EXIST::FUNCTION:
91BIO_s_null 96 EXIST::FUNCTION:
92BIO_s_proxy_client 97 NOEXIST::FUNCTION:
93BIO_s_socket 98 EXIST::FUNCTION:
94BIO_set 100 EXIST::FUNCTION:
95BIO_set_cipher 101 EXIST::FUNCTION:BIO
96BIO_set_tcp_ndelay 102 EXIST::FUNCTION:
97BIO_sock_cleanup 103 EXIST::FUNCTION:
98BIO_sock_error 104 EXIST::FUNCTION:
99BIO_sock_init 105 EXIST::FUNCTION:
100BIO_sock_non_fatal_error 106 EXIST::FUNCTION:
101BIO_sock_should_retry 107 EXIST::FUNCTION:
102BIO_socket_ioctl 108 EXIST::FUNCTION:
103BIO_write 109 EXIST::FUNCTION:
104BN_CTX_free 110 EXIST::FUNCTION:
105BN_CTX_new 111 EXIST::FUNCTION:
106BN_MONT_CTX_free 112 EXIST::FUNCTION:
107BN_MONT_CTX_new 113 EXIST::FUNCTION:
108BN_MONT_CTX_set 114 EXIST::FUNCTION:
109BN_add 115 EXIST::FUNCTION:
110BN_add_word 116 EXIST::FUNCTION:
111BN_hex2bn 117 EXIST::FUNCTION:
112BN_bin2bn 118 EXIST::FUNCTION:
113BN_bn2hex 119 EXIST::FUNCTION:
114BN_bn2bin 120 EXIST::FUNCTION:
115BN_clear 121 EXIST::FUNCTION:
116BN_clear_bit 122 EXIST::FUNCTION:
117BN_clear_free 123 EXIST::FUNCTION:
118BN_cmp 124 EXIST::FUNCTION:
119BN_copy 125 EXIST::FUNCTION:
120BN_div 126 EXIST::FUNCTION:
121BN_div_word 127 EXIST::FUNCTION:
122BN_dup 128 EXIST::FUNCTION:
123BN_free 129 EXIST::FUNCTION:
124BN_from_montgomery 130 EXIST::FUNCTION:
125BN_gcd 131 EXIST::FUNCTION:
126BN_generate_prime 132 EXIST::FUNCTION:DEPRECATED
127BN_get_word 133 EXIST::FUNCTION:
128BN_is_bit_set 134 EXIST::FUNCTION:
129BN_is_prime 135 EXIST::FUNCTION:DEPRECATED
130BN_lshift 136 EXIST::FUNCTION:
131BN_lshift1 137 EXIST::FUNCTION:
132BN_mask_bits 138 EXIST::FUNCTION:
133BN_mod 139 NOEXIST::FUNCTION:
134BN_mod_exp 140 EXIST::FUNCTION:
135BN_mod_exp_mont 141 EXIST::FUNCTION:
136BN_mod_exp_simple 143 EXIST::FUNCTION:
137BN_mod_inverse 144 EXIST::FUNCTION:
138BN_mod_mul 145 EXIST::FUNCTION:
139BN_mod_mul_montgomery 146 EXIST::FUNCTION:
140BN_mod_word 148 EXIST::FUNCTION:
141BN_mul 149 EXIST::FUNCTION:
142BN_new 150 EXIST::FUNCTION:
143BN_num_bits 151 EXIST::FUNCTION:
144BN_num_bits_word 152 EXIST::FUNCTION:
145BN_options 153 EXIST::FUNCTION:
146BN_print 154 EXIST::FUNCTION:
147BN_print_fp 155 EXIST::FUNCTION:FP_API
148BN_rand 156 EXIST::FUNCTION:
149BN_reciprocal 157 EXIST::FUNCTION:
150BN_rshift 158 EXIST::FUNCTION:
151BN_rshift1 159 EXIST::FUNCTION:
152BN_set_bit 160 EXIST::FUNCTION:
153BN_set_word 161 EXIST::FUNCTION:
154BN_sqr 162 EXIST::FUNCTION:
155BN_sub 163 EXIST::FUNCTION:
156BN_to_ASN1_INTEGER 164 EXIST::FUNCTION:
157BN_ucmp 165 EXIST::FUNCTION:
158BN_value_one 166 EXIST::FUNCTION:
159BUF_MEM_free 167 EXIST::FUNCTION:
160BUF_MEM_grow 168 EXIST::FUNCTION:
161BUF_MEM_new 169 EXIST::FUNCTION:
162BUF_strdup 170 EXIST::FUNCTION:
163CONF_free 171 EXIST::FUNCTION:
164CONF_get_number 172 EXIST::FUNCTION:
165CONF_get_section 173 EXIST::FUNCTION:
166CONF_get_string 174 EXIST::FUNCTION:
167CONF_load 175 EXIST::FUNCTION:
168CRYPTO_add_lock 176 EXIST::FUNCTION:
169CRYPTO_dbg_free 177 EXIST::FUNCTION:
170CRYPTO_dbg_malloc 178 EXIST::FUNCTION:
171CRYPTO_dbg_realloc 179 EXIST::FUNCTION:
172CRYPTO_dbg_remalloc 180 NOEXIST::FUNCTION:
173CRYPTO_free 181 EXIST::FUNCTION:
174CRYPTO_get_add_lock_callback 182 EXIST::FUNCTION:
175CRYPTO_get_id_callback 183 EXIST::FUNCTION:DEPRECATED
176CRYPTO_get_lock_name 184 EXIST::FUNCTION:
177CRYPTO_get_locking_callback 185 EXIST::FUNCTION:
178CRYPTO_get_mem_functions 186 EXIST::FUNCTION:
179CRYPTO_lock 187 EXIST::FUNCTION:
180CRYPTO_malloc 188 EXIST::FUNCTION:
181CRYPTO_mem_ctrl 189 EXIST::FUNCTION:
182CRYPTO_mem_leaks 190 EXIST::FUNCTION:
183CRYPTO_mem_leaks_cb 191 EXIST::FUNCTION:
184CRYPTO_mem_leaks_fp 192 EXIST::FUNCTION:FP_API
185CRYPTO_realloc 193 EXIST::FUNCTION:
186CRYPTO_remalloc 194 EXIST::FUNCTION:
187CRYPTO_set_add_lock_callback 195 EXIST::FUNCTION:
188CRYPTO_set_id_callback 196 EXIST::FUNCTION:DEPRECATED
189CRYPTO_set_locking_callback 197 EXIST::FUNCTION:
190CRYPTO_set_mem_functions 198 EXIST::FUNCTION:
191CRYPTO_thread_id 199 EXIST::FUNCTION:DEPRECATED
192DH_check 200 EXIST::FUNCTION:DH
193DH_compute_key 201 EXIST::FUNCTION:DH
194DH_free 202 EXIST::FUNCTION:DH
195DH_generate_key 203 EXIST::FUNCTION:DH
196DH_generate_parameters 204 EXIST::FUNCTION:DEPRECATED,DH
197DH_new 205 EXIST::FUNCTION:DH
198DH_size 206 EXIST::FUNCTION:DH
199DHparams_print 207 EXIST::FUNCTION:BIO,DH
200DHparams_print_fp 208 EXIST::FUNCTION:DH,FP_API
201DSA_free 209 EXIST::FUNCTION:DSA
202DSA_generate_key 210 EXIST::FUNCTION:DSA
203DSA_generate_parameters 211 EXIST::FUNCTION:DEPRECATED,DSA
204DSA_is_prime 212 NOEXIST::FUNCTION:
205DSA_new 213 EXIST::FUNCTION:DSA
206DSA_print 214 EXIST::FUNCTION:BIO,DSA
207DSA_print_fp 215 EXIST::FUNCTION:DSA,FP_API
208DSA_sign 216 EXIST::FUNCTION:DSA
209DSA_sign_setup 217 EXIST::FUNCTION:DSA
210DSA_size 218 EXIST::FUNCTION:DSA
211DSA_verify 219 EXIST::FUNCTION:DSA
212DSAparams_print 220 EXIST::FUNCTION:BIO,DSA
213DSAparams_print_fp 221 EXIST::FUNCTION:DSA,FP_API
214ERR_clear_error 222 EXIST::FUNCTION:
215ERR_error_string 223 EXIST::FUNCTION:
216ERR_free_strings 224 EXIST::FUNCTION:
217ERR_func_error_string 225 EXIST::FUNCTION:
218ERR_get_err_state_table 226 EXIST::FUNCTION:LHASH
219ERR_get_error 227 EXIST::FUNCTION:
220ERR_get_error_line 228 EXIST::FUNCTION:
221ERR_get_state 229 EXIST::FUNCTION:
222ERR_get_string_table 230 EXIST::FUNCTION:LHASH
223ERR_lib_error_string 231 EXIST::FUNCTION:
224ERR_load_ASN1_strings 232 EXIST::FUNCTION:
225ERR_load_BIO_strings 233 EXIST::FUNCTION:
226ERR_load_BN_strings 234 EXIST::FUNCTION:
227ERR_load_BUF_strings 235 EXIST::FUNCTION:
228ERR_load_CONF_strings 236 EXIST::FUNCTION:
229ERR_load_DH_strings 237 EXIST::FUNCTION:DH
230ERR_load_DSA_strings 238 EXIST::FUNCTION:DSA
231ERR_load_ERR_strings 239 EXIST::FUNCTION:
232ERR_load_EVP_strings 240 EXIST::FUNCTION:
233ERR_load_OBJ_strings 241 EXIST::FUNCTION:
234ERR_load_PEM_strings 242 EXIST::FUNCTION:
235ERR_load_PROXY_strings 243 NOEXIST::FUNCTION:
236ERR_load_RSA_strings 244 EXIST::FUNCTION:RSA
237ERR_load_X509_strings 245 EXIST::FUNCTION:
238ERR_load_crypto_strings 246 EXIST::FUNCTION:
239ERR_load_strings 247 EXIST::FUNCTION:
240ERR_peek_error 248 EXIST::FUNCTION:
241ERR_peek_error_line 249 EXIST::FUNCTION:
242ERR_print_errors 250 EXIST::FUNCTION:BIO
243ERR_print_errors_fp 251 EXIST::FUNCTION:FP_API
244ERR_put_error 252 EXIST::FUNCTION:
245ERR_reason_error_string 253 EXIST::FUNCTION:
246ERR_remove_state 254 EXIST::FUNCTION:DEPRECATED
247EVP_BytesToKey 255 EXIST::FUNCTION:
248EVP_CIPHER_CTX_cleanup 256 EXIST::FUNCTION:
249EVP_CipherFinal 257 EXIST::FUNCTION:
250EVP_CipherInit 258 EXIST::FUNCTION:
251EVP_CipherUpdate 259 EXIST::FUNCTION:
252EVP_DecodeBlock 260 EXIST::FUNCTION:
253EVP_DecodeFinal 261 EXIST::FUNCTION:
254EVP_DecodeInit 262 EXIST::FUNCTION:
255EVP_DecodeUpdate 263 EXIST::FUNCTION:
256EVP_DecryptFinal 264 EXIST::FUNCTION:
257EVP_DecryptInit 265 EXIST::FUNCTION:
258EVP_DecryptUpdate 266 EXIST::FUNCTION:
259EVP_DigestFinal 267 EXIST::FUNCTION:
260EVP_DigestInit 268 EXIST::FUNCTION:
261EVP_DigestUpdate 269 EXIST::FUNCTION:
262EVP_EncodeBlock 270 EXIST::FUNCTION:
263EVP_EncodeFinal 271 EXIST::FUNCTION:
264EVP_EncodeInit 272 EXIST::FUNCTION:
265EVP_EncodeUpdate 273 EXIST::FUNCTION:
266EVP_EncryptFinal 274 EXIST::FUNCTION:
267EVP_EncryptInit 275 EXIST::FUNCTION:
268EVP_EncryptUpdate 276 EXIST::FUNCTION:
269EVP_OpenFinal 277 EXIST::FUNCTION:RSA
270EVP_OpenInit 278 EXIST::FUNCTION:RSA
271EVP_PKEY_assign 279 EXIST::FUNCTION:
272EVP_PKEY_copy_parameters 280 EXIST::FUNCTION:
273EVP_PKEY_free 281 EXIST::FUNCTION:
274EVP_PKEY_missing_parameters 282 EXIST::FUNCTION:
275EVP_PKEY_new 283 EXIST::FUNCTION:
276EVP_PKEY_save_parameters 284 EXIST::FUNCTION:
277EVP_PKEY_size 285 EXIST::FUNCTION:
278EVP_PKEY_type 286 EXIST::FUNCTION:
279EVP_SealFinal 287 EXIST::FUNCTION:RSA
280EVP_SealInit 288 EXIST::FUNCTION:RSA
281EVP_SignFinal 289 EXIST::FUNCTION:
282EVP_VerifyFinal 290 EXIST::FUNCTION:
283EVP_add_alias 291 NOEXIST::FUNCTION:
284EVP_add_cipher 292 EXIST::FUNCTION:
285EVP_add_digest 293 EXIST::FUNCTION:
286EVP_bf_cbc 294 EXIST::FUNCTION:BF
287EVP_bf_cfb64 295 EXIST::FUNCTION:BF
288EVP_bf_ecb 296 EXIST::FUNCTION:BF
289EVP_bf_ofb 297 EXIST::FUNCTION:BF
290EVP_cleanup 298 EXIST::FUNCTION:
291EVP_des_cbc 299 EXIST::FUNCTION:DES
292EVP_des_cfb64 300 EXIST::FUNCTION:DES
293EVP_des_ecb 301 EXIST::FUNCTION:DES
294EVP_des_ede 302 EXIST::FUNCTION:DES
295EVP_des_ede3 303 EXIST::FUNCTION:DES
296EVP_des_ede3_cbc 304 EXIST::FUNCTION:DES
297EVP_des_ede3_cfb64 305 EXIST::FUNCTION:DES
298EVP_des_ede3_ofb 306 EXIST::FUNCTION:DES
299EVP_des_ede_cbc 307 EXIST::FUNCTION:DES
300EVP_des_ede_cfb64 308 EXIST::FUNCTION:DES
301EVP_des_ede_ofb 309 EXIST::FUNCTION:DES
302EVP_des_ofb 310 EXIST::FUNCTION:DES
303EVP_desx_cbc 311 EXIST::FUNCTION:DES
304EVP_dss 312 EXIST::FUNCTION:DSA,SHA
305EVP_dss1 313 EXIST::FUNCTION:DSA,SHA
306EVP_enc_null 314 EXIST::FUNCTION:
307EVP_get_cipherbyname 315 EXIST::FUNCTION:
308EVP_get_digestbyname 316 EXIST::FUNCTION:
309EVP_get_pw_prompt 317 EXIST::FUNCTION:
310EVP_idea_cbc 318 EXIST::FUNCTION:IDEA
311EVP_idea_cfb64 319 EXIST::FUNCTION:IDEA
312EVP_idea_ecb 320 EXIST::FUNCTION:IDEA
313EVP_idea_ofb 321 EXIST::FUNCTION:IDEA
314EVP_md2 322 EXIST::FUNCTION:MD2
315EVP_md5 323 EXIST::FUNCTION:MD5
316EVP_md_null 324 EXIST::FUNCTION:
317EVP_rc2_cbc 325 EXIST::FUNCTION:RC2
318EVP_rc2_cfb64 326 EXIST::FUNCTION:RC2
319EVP_rc2_ecb 327 EXIST::FUNCTION:RC2
320EVP_rc2_ofb 328 EXIST::FUNCTION:RC2
321EVP_rc4 329 EXIST::FUNCTION:RC4
322EVP_read_pw_string 330 EXIST::FUNCTION:
323EVP_set_pw_prompt 331 EXIST::FUNCTION:
324EVP_sha 332 EXIST::FUNCTION:SHA
325EVP_sha1 333 EXIST::FUNCTION:SHA
326MD2 334 EXIST::FUNCTION:MD2
327MD2_Final 335 EXIST::FUNCTION:MD2
328MD2_Init 336 EXIST::FUNCTION:MD2
329MD2_Update 337 EXIST::FUNCTION:MD2
330MD2_options 338 EXIST::FUNCTION:MD2
331MD5 339 EXIST::FUNCTION:MD5
332MD5_Final 340 EXIST::FUNCTION:MD5
333MD5_Init 341 EXIST::FUNCTION:MD5
334MD5_Update 342 EXIST::FUNCTION:MD5
335MDC2 343 EXIST::FUNCTION:MDC2
336MDC2_Final 344 EXIST::FUNCTION:MDC2
337MDC2_Init 345 EXIST::FUNCTION:MDC2
338MDC2_Update 346 EXIST::FUNCTION:MDC2
339NETSCAPE_SPKAC_free 347 EXIST::FUNCTION:
340NETSCAPE_SPKAC_new 348 EXIST::FUNCTION:
341NETSCAPE_SPKI_free 349 EXIST::FUNCTION:
342NETSCAPE_SPKI_new 350 EXIST::FUNCTION:
343NETSCAPE_SPKI_sign 351 EXIST::FUNCTION:EVP
344NETSCAPE_SPKI_verify 352 EXIST::FUNCTION:EVP
345OBJ_add_object 353 EXIST::FUNCTION:
346OBJ_bsearch 354 NOEXIST::FUNCTION:
347OBJ_cleanup 355 EXIST::FUNCTION:
348OBJ_cmp 356 EXIST::FUNCTION:
349OBJ_create 357 EXIST::FUNCTION:
350OBJ_dup 358 EXIST::FUNCTION:
351OBJ_ln2nid 359 EXIST::FUNCTION:
352OBJ_new_nid 360 EXIST::FUNCTION:
353OBJ_nid2ln 361 EXIST::FUNCTION:
354OBJ_nid2obj 362 EXIST::FUNCTION:
355OBJ_nid2sn 363 EXIST::FUNCTION:
356OBJ_obj2nid 364 EXIST::FUNCTION:
357OBJ_sn2nid 365 EXIST::FUNCTION:
358OBJ_txt2nid 366 EXIST::FUNCTION:
359PEM_ASN1_read 367 EXIST::FUNCTION:
360PEM_ASN1_read_bio 368 EXIST::FUNCTION:BIO
361PEM_ASN1_write 369 EXIST::FUNCTION:
362PEM_ASN1_write_bio 370 EXIST::FUNCTION:BIO
363PEM_SealFinal 371 EXIST::FUNCTION:RSA
364PEM_SealInit 372 EXIST::FUNCTION:RSA
365PEM_SealUpdate 373 EXIST::FUNCTION:RSA
366PEM_SignFinal 374 EXIST::FUNCTION:
367PEM_SignInit 375 EXIST::FUNCTION:
368PEM_SignUpdate 376 EXIST::FUNCTION:
369PEM_X509_INFO_read 377 EXIST::FUNCTION:
370PEM_X509_INFO_read_bio 378 EXIST::FUNCTION:BIO
371PEM_X509_INFO_write_bio 379 EXIST::FUNCTION:BIO
372PEM_dek_info 380 EXIST::FUNCTION:
373PEM_do_header 381 EXIST::FUNCTION:
374PEM_get_EVP_CIPHER_INFO 382 EXIST::FUNCTION:
375PEM_proc_type 383 EXIST::FUNCTION:
376PEM_read 384 EXIST::FUNCTION:
377PEM_read_DHparams 385 EXIST:!WIN16:FUNCTION:DH
378PEM_read_DSAPrivateKey 386 EXIST:!WIN16:FUNCTION:DSA
379PEM_read_DSAparams 387 EXIST:!WIN16:FUNCTION:DSA
380PEM_read_PKCS7 388 EXIST:!WIN16:FUNCTION:
381PEM_read_PrivateKey 389 EXIST:!WIN16:FUNCTION:
382PEM_read_RSAPrivateKey 390 EXIST:!WIN16:FUNCTION:RSA
383PEM_read_X509 391 EXIST:!WIN16:FUNCTION:
384PEM_read_X509_CRL 392 EXIST:!WIN16:FUNCTION:
385PEM_read_X509_REQ 393 EXIST:!WIN16:FUNCTION:
386PEM_read_bio 394 EXIST::FUNCTION:BIO
387PEM_read_bio_DHparams 395 EXIST::FUNCTION:DH
388PEM_read_bio_DSAPrivateKey 396 EXIST::FUNCTION:DSA
389PEM_read_bio_DSAparams 397 EXIST::FUNCTION:DSA
390PEM_read_bio_PKCS7 398 EXIST::FUNCTION:
391PEM_read_bio_PrivateKey 399 EXIST::FUNCTION:
392PEM_read_bio_RSAPrivateKey 400 EXIST::FUNCTION:RSA
393PEM_read_bio_X509 401 EXIST::FUNCTION:
394PEM_read_bio_X509_CRL 402 EXIST::FUNCTION:
395PEM_read_bio_X509_REQ 403 EXIST::FUNCTION:
396PEM_write 404 EXIST::FUNCTION:
397PEM_write_DHparams 405 EXIST:!WIN16:FUNCTION:DH
398PEM_write_DSAPrivateKey 406 EXIST:!WIN16:FUNCTION:DSA
399PEM_write_DSAparams 407 EXIST:!WIN16:FUNCTION:DSA
400PEM_write_PKCS7 408 EXIST:!WIN16:FUNCTION:
401PEM_write_PrivateKey 409 EXIST:!WIN16:FUNCTION:
402PEM_write_RSAPrivateKey 410 EXIST:!WIN16:FUNCTION:RSA
403PEM_write_X509 411 EXIST:!WIN16:FUNCTION:
404PEM_write_X509_CRL 412 EXIST:!WIN16:FUNCTION:
405PEM_write_X509_REQ 413 EXIST:!WIN16:FUNCTION:
406PEM_write_bio 414 EXIST::FUNCTION:BIO
407PEM_write_bio_DHparams 415 EXIST::FUNCTION:DH
408PEM_write_bio_DSAPrivateKey 416 EXIST::FUNCTION:DSA
409PEM_write_bio_DSAparams 417 EXIST::FUNCTION:DSA
410PEM_write_bio_PKCS7 418 EXIST::FUNCTION:
411PEM_write_bio_PrivateKey 419 EXIST::FUNCTION:
412PEM_write_bio_RSAPrivateKey 420 EXIST::FUNCTION:RSA
413PEM_write_bio_X509 421 EXIST::FUNCTION:
414PEM_write_bio_X509_CRL 422 EXIST::FUNCTION:
415PEM_write_bio_X509_REQ 423 EXIST::FUNCTION:
416PKCS7_DIGEST_free 424 EXIST::FUNCTION:
417PKCS7_DIGEST_new 425 EXIST::FUNCTION:
418PKCS7_ENCRYPT_free 426 EXIST::FUNCTION:
419PKCS7_ENCRYPT_new 427 EXIST::FUNCTION:
420PKCS7_ENC_CONTENT_free 428 EXIST::FUNCTION:
421PKCS7_ENC_CONTENT_new 429 EXIST::FUNCTION:
422PKCS7_ENVELOPE_free 430 EXIST::FUNCTION:
423PKCS7_ENVELOPE_new 431 EXIST::FUNCTION:
424PKCS7_ISSUER_AND_SERIAL_digest 432 EXIST::FUNCTION:
425PKCS7_ISSUER_AND_SERIAL_free 433 EXIST::FUNCTION:
426PKCS7_ISSUER_AND_SERIAL_new 434 EXIST::FUNCTION:
427PKCS7_RECIP_INFO_free 435 EXIST::FUNCTION:
428PKCS7_RECIP_INFO_new 436 EXIST::FUNCTION:
429PKCS7_SIGNED_free 437 EXIST::FUNCTION:
430PKCS7_SIGNED_new 438 EXIST::FUNCTION:
431PKCS7_SIGNER_INFO_free 439 EXIST::FUNCTION:
432PKCS7_SIGNER_INFO_new 440 EXIST::FUNCTION:
433PKCS7_SIGN_ENVELOPE_free 441 EXIST::FUNCTION:
434PKCS7_SIGN_ENVELOPE_new 442 EXIST::FUNCTION:
435PKCS7_dup 443 EXIST::FUNCTION:
436PKCS7_free 444 EXIST::FUNCTION:
437PKCS7_new 445 EXIST::FUNCTION:
438PROXY_ENTRY_add_noproxy 446 NOEXIST::FUNCTION:
439PROXY_ENTRY_clear_noproxy 447 NOEXIST::FUNCTION:
440PROXY_ENTRY_free 448 NOEXIST::FUNCTION:
441PROXY_ENTRY_get_noproxy 449 NOEXIST::FUNCTION:
442PROXY_ENTRY_new 450 NOEXIST::FUNCTION:
443PROXY_ENTRY_set_server 451 NOEXIST::FUNCTION:
444PROXY_add_noproxy 452 NOEXIST::FUNCTION:
445PROXY_add_server 453 NOEXIST::FUNCTION:
446PROXY_check_by_host 454 NOEXIST::FUNCTION:
447PROXY_check_url 455 NOEXIST::FUNCTION:
448PROXY_clear_noproxy 456 NOEXIST::FUNCTION:
449PROXY_free 457 NOEXIST::FUNCTION:
450PROXY_get_noproxy 458 NOEXIST::FUNCTION:
451PROXY_get_proxies 459 NOEXIST::FUNCTION:
452PROXY_get_proxy_entry 460 NOEXIST::FUNCTION:
453PROXY_load_conf 461 NOEXIST::FUNCTION:
454PROXY_new 462 NOEXIST::FUNCTION:
455PROXY_print 463 NOEXIST::FUNCTION:
456RAND_bytes 464 EXIST::FUNCTION:
457RAND_cleanup 465 EXIST::FUNCTION:
458RAND_file_name 466 EXIST::FUNCTION:
459RAND_load_file 467 EXIST::FUNCTION:
460RAND_screen 468 EXIST:WIN32:FUNCTION:
461RAND_seed 469 EXIST::FUNCTION:
462RAND_write_file 470 EXIST::FUNCTION:
463RC2_cbc_encrypt 471 EXIST::FUNCTION:RC2
464RC2_cfb64_encrypt 472 EXIST::FUNCTION:RC2
465RC2_ecb_encrypt 473 EXIST::FUNCTION:RC2
466RC2_encrypt 474 EXIST::FUNCTION:RC2
467RC2_ofb64_encrypt 475 EXIST::FUNCTION:RC2
468RC2_set_key 476 EXIST::FUNCTION:RC2
469RC4 477 EXIST::FUNCTION:RC4
470RC4_options 478 EXIST::FUNCTION:RC4
471RC4_set_key 479 EXIST::FUNCTION:RC4
472RSAPrivateKey_asn1_meth 480 NOEXIST::FUNCTION:
473RSAPrivateKey_dup 481 EXIST::FUNCTION:RSA
474RSAPublicKey_dup 482 EXIST::FUNCTION:RSA
475RSA_PKCS1_SSLeay 483 EXIST::FUNCTION:RSA
476RSA_free 484 EXIST::FUNCTION:RSA
477RSA_generate_key 485 EXIST::FUNCTION:DEPRECATED,RSA
478RSA_new 486 EXIST::FUNCTION:RSA
479RSA_new_method 487 EXIST::FUNCTION:RSA
480RSA_print 488 EXIST::FUNCTION:BIO,RSA
481RSA_print_fp 489 EXIST::FUNCTION:FP_API,RSA
482RSA_private_decrypt 490 EXIST::FUNCTION:RSA
483RSA_private_encrypt 491 EXIST::FUNCTION:RSA
484RSA_public_decrypt 492 EXIST::FUNCTION:RSA
485RSA_public_encrypt 493 EXIST::FUNCTION:RSA
486RSA_set_default_method 494 EXIST::FUNCTION:RSA
487RSA_sign 495 EXIST::FUNCTION:RSA
488RSA_sign_ASN1_OCTET_STRING 496 EXIST::FUNCTION:RSA
489RSA_size 497 EXIST::FUNCTION:RSA
490RSA_verify 498 EXIST::FUNCTION:RSA
491RSA_verify_ASN1_OCTET_STRING 499 EXIST::FUNCTION:RSA
492SHA 500 EXIST::FUNCTION:SHA,SHA0
493SHA1 501 EXIST::FUNCTION:SHA,SHA1
494SHA1_Final 502 EXIST::FUNCTION:SHA,SHA1
495SHA1_Init 503 EXIST::FUNCTION:SHA,SHA1
496SHA1_Update 504 EXIST::FUNCTION:SHA,SHA1
497SHA_Final 505 EXIST::FUNCTION:SHA,SHA0
498SHA_Init 506 EXIST::FUNCTION:SHA,SHA0
499SHA_Update 507 EXIST::FUNCTION:SHA,SHA0
500OpenSSL_add_all_algorithms 508 NOEXIST::FUNCTION:
501OpenSSL_add_all_ciphers 509 EXIST::FUNCTION:
502OpenSSL_add_all_digests 510 EXIST::FUNCTION:
503TXT_DB_create_index 511 EXIST::FUNCTION:
504TXT_DB_free 512 EXIST::FUNCTION:
505TXT_DB_get_by_index 513 EXIST::FUNCTION:
506TXT_DB_insert 514 EXIST::FUNCTION:
507TXT_DB_read 515 EXIST::FUNCTION:BIO
508TXT_DB_write 516 EXIST::FUNCTION:BIO
509X509_ALGOR_free 517 EXIST::FUNCTION:
510X509_ALGOR_new 518 EXIST::FUNCTION:
511X509_ATTRIBUTE_free 519 EXIST::FUNCTION:
512X509_ATTRIBUTE_new 520 EXIST::FUNCTION:
513X509_CINF_free 521 EXIST::FUNCTION:
514X509_CINF_new 522 EXIST::FUNCTION:
515X509_CRL_INFO_free 523 EXIST::FUNCTION:
516X509_CRL_INFO_new 524 EXIST::FUNCTION:
517X509_CRL_add_ext 525 EXIST::FUNCTION:
518X509_CRL_cmp 526 EXIST::FUNCTION:
519X509_CRL_delete_ext 527 EXIST::FUNCTION:
520X509_CRL_dup 528 EXIST::FUNCTION:
521X509_CRL_free 529 EXIST::FUNCTION:
522X509_CRL_get_ext 530 EXIST::FUNCTION:
523X509_CRL_get_ext_by_NID 531 EXIST::FUNCTION:
524X509_CRL_get_ext_by_OBJ 532 EXIST::FUNCTION:
525X509_CRL_get_ext_by_critical 533 EXIST::FUNCTION:
526X509_CRL_get_ext_count 534 EXIST::FUNCTION:
527X509_CRL_new 535 EXIST::FUNCTION:
528X509_CRL_sign 536 EXIST::FUNCTION:EVP
529X509_CRL_verify 537 EXIST::FUNCTION:EVP
530X509_EXTENSION_create_by_NID 538 EXIST::FUNCTION:
531X509_EXTENSION_create_by_OBJ 539 EXIST::FUNCTION:
532X509_EXTENSION_dup 540 EXIST::FUNCTION:
533X509_EXTENSION_free 541 EXIST::FUNCTION:
534X509_EXTENSION_get_critical 542 EXIST::FUNCTION:
535X509_EXTENSION_get_data 543 EXIST::FUNCTION:
536X509_EXTENSION_get_object 544 EXIST::FUNCTION:
537X509_EXTENSION_new 545 EXIST::FUNCTION:
538X509_EXTENSION_set_critical 546 EXIST::FUNCTION:
539X509_EXTENSION_set_data 547 EXIST::FUNCTION:
540X509_EXTENSION_set_object 548 EXIST::FUNCTION:
541X509_INFO_free 549 EXIST::FUNCTION:EVP
542X509_INFO_new 550 EXIST::FUNCTION:EVP
543X509_LOOKUP_by_alias 551 EXIST::FUNCTION:
544X509_LOOKUP_by_fingerprint 552 EXIST::FUNCTION:
545X509_LOOKUP_by_issuer_serial 553 EXIST::FUNCTION:
546X509_LOOKUP_by_subject 554 EXIST::FUNCTION:
547X509_LOOKUP_ctrl 555 EXIST::FUNCTION:
548X509_LOOKUP_file 556 EXIST::FUNCTION:
549X509_LOOKUP_free 557 EXIST::FUNCTION:
550X509_LOOKUP_hash_dir 558 EXIST::FUNCTION:
551X509_LOOKUP_init 559 EXIST::FUNCTION:
552X509_LOOKUP_new 560 EXIST::FUNCTION:
553X509_LOOKUP_shutdown 561 EXIST::FUNCTION:
554X509_NAME_ENTRY_create_by_NID 562 EXIST::FUNCTION:
555X509_NAME_ENTRY_create_by_OBJ 563 EXIST::FUNCTION:
556X509_NAME_ENTRY_dup 564 EXIST::FUNCTION:
557X509_NAME_ENTRY_free 565 EXIST::FUNCTION:
558X509_NAME_ENTRY_get_data 566 EXIST::FUNCTION:
559X509_NAME_ENTRY_get_object 567 EXIST::FUNCTION:
560X509_NAME_ENTRY_new 568 EXIST::FUNCTION:
561X509_NAME_ENTRY_set_data 569 EXIST::FUNCTION:
562X509_NAME_ENTRY_set_object 570 EXIST::FUNCTION:
563X509_NAME_add_entry 571 EXIST::FUNCTION:
564X509_NAME_cmp 572 EXIST::FUNCTION:
565X509_NAME_delete_entry 573 EXIST::FUNCTION:
566X509_NAME_digest 574 EXIST::FUNCTION:EVP
567X509_NAME_dup 575 EXIST::FUNCTION:
568X509_NAME_entry_count 576 EXIST::FUNCTION:
569X509_NAME_free 577 EXIST::FUNCTION:
570X509_NAME_get_entry 578 EXIST::FUNCTION:
571X509_NAME_get_index_by_NID 579 EXIST::FUNCTION:
572X509_NAME_get_index_by_OBJ 580 EXIST::FUNCTION:
573X509_NAME_get_text_by_NID 581 EXIST::FUNCTION:
574X509_NAME_get_text_by_OBJ 582 EXIST::FUNCTION:
575X509_NAME_hash 583 EXIST::FUNCTION:
576X509_NAME_new 584 EXIST::FUNCTION:
577X509_NAME_oneline 585 EXIST::FUNCTION:EVP
578X509_NAME_print 586 EXIST::FUNCTION:BIO
579X509_NAME_set 587 EXIST::FUNCTION:
580X509_OBJECT_free_contents 588 EXIST::FUNCTION:
581X509_OBJECT_retrieve_by_subject 589 EXIST::FUNCTION:
582X509_OBJECT_up_ref_count 590 EXIST::FUNCTION:
583X509_PKEY_free 591 EXIST::FUNCTION:
584X509_PKEY_new 592 EXIST::FUNCTION:
585X509_PUBKEY_free 593 EXIST::FUNCTION:
586X509_PUBKEY_get 594 EXIST::FUNCTION:
587X509_PUBKEY_new 595 EXIST::FUNCTION:
588X509_PUBKEY_set 596 EXIST::FUNCTION:
589X509_REQ_INFO_free 597 EXIST::FUNCTION:
590X509_REQ_INFO_new 598 EXIST::FUNCTION:
591X509_REQ_dup 599 EXIST::FUNCTION:
592X509_REQ_free 600 EXIST::FUNCTION:
593X509_REQ_get_pubkey 601 EXIST::FUNCTION:
594X509_REQ_new 602 EXIST::FUNCTION:
595X509_REQ_print 603 EXIST::FUNCTION:BIO
596X509_REQ_print_fp 604 EXIST::FUNCTION:FP_API
597X509_REQ_set_pubkey 605 EXIST::FUNCTION:
598X509_REQ_set_subject_name 606 EXIST::FUNCTION:
599X509_REQ_set_version 607 EXIST::FUNCTION:
600X509_REQ_sign 608 EXIST::FUNCTION:EVP
601X509_REQ_to_X509 609 EXIST::FUNCTION:
602X509_REQ_verify 610 EXIST::FUNCTION:EVP
603X509_REVOKED_add_ext 611 EXIST::FUNCTION:
604X509_REVOKED_delete_ext 612 EXIST::FUNCTION:
605X509_REVOKED_free 613 EXIST::FUNCTION:
606X509_REVOKED_get_ext 614 EXIST::FUNCTION:
607X509_REVOKED_get_ext_by_NID 615 EXIST::FUNCTION:
608X509_REVOKED_get_ext_by_OBJ 616 EXIST::FUNCTION:
609X509_REVOKED_get_ext_by_critical 617 EXIST:!VMS:FUNCTION:
610X509_REVOKED_get_ext_by_critic 617 EXIST:VMS:FUNCTION:
611X509_REVOKED_get_ext_count 618 EXIST::FUNCTION:
612X509_REVOKED_new 619 EXIST::FUNCTION:
613X509_SIG_free 620 EXIST::FUNCTION:
614X509_SIG_new 621 EXIST::FUNCTION:
615X509_STORE_CTX_cleanup 622 EXIST::FUNCTION:
616X509_STORE_CTX_init 623 EXIST::FUNCTION:
617X509_STORE_add_cert 624 EXIST::FUNCTION:
618X509_STORE_add_lookup 625 EXIST::FUNCTION:
619X509_STORE_free 626 EXIST::FUNCTION:
620X509_STORE_get_by_subject 627 EXIST::FUNCTION:
621X509_STORE_load_locations 628 EXIST::FUNCTION:STDIO
622X509_STORE_new 629 EXIST::FUNCTION:
623X509_STORE_set_default_paths 630 EXIST::FUNCTION:STDIO
624X509_VAL_free 631 EXIST::FUNCTION:
625X509_VAL_new 632 EXIST::FUNCTION:
626X509_add_ext 633 EXIST::FUNCTION:
627X509_asn1_meth 634 NOEXIST::FUNCTION:
628X509_certificate_type 635 EXIST::FUNCTION:
629X509_check_private_key 636 EXIST::FUNCTION:
630X509_cmp_current_time 637 EXIST::FUNCTION:
631X509_delete_ext 638 EXIST::FUNCTION:
632X509_digest 639 EXIST::FUNCTION:EVP
633X509_dup 640 EXIST::FUNCTION:
634X509_free 641 EXIST::FUNCTION:
635X509_get_default_cert_area 642 EXIST::FUNCTION:
636X509_get_default_cert_dir 643 EXIST::FUNCTION:
637X509_get_default_cert_dir_env 644 EXIST::FUNCTION:
638X509_get_default_cert_file 645 EXIST::FUNCTION:
639X509_get_default_cert_file_env 646 EXIST::FUNCTION:
640X509_get_default_private_dir 647 EXIST::FUNCTION:
641X509_get_ext 648 EXIST::FUNCTION:
642X509_get_ext_by_NID 649 EXIST::FUNCTION:
643X509_get_ext_by_OBJ 650 EXIST::FUNCTION:
644X509_get_ext_by_critical 651 EXIST::FUNCTION:
645X509_get_ext_count 652 EXIST::FUNCTION:
646X509_get_issuer_name 653 EXIST::FUNCTION:
647X509_get_pubkey 654 EXIST::FUNCTION:
648X509_get_pubkey_parameters 655 EXIST::FUNCTION:
649X509_get_serialNumber 656 EXIST::FUNCTION:
650X509_get_subject_name 657 EXIST::FUNCTION:
651X509_gmtime_adj 658 EXIST::FUNCTION:
652X509_issuer_and_serial_cmp 659 EXIST::FUNCTION:
653X509_issuer_and_serial_hash 660 EXIST::FUNCTION:
654X509_issuer_name_cmp 661 EXIST::FUNCTION:
655X509_issuer_name_hash 662 EXIST::FUNCTION:
656X509_load_cert_file 663 EXIST::FUNCTION:STDIO
657X509_new 664 EXIST::FUNCTION:
658X509_print 665 EXIST::FUNCTION:BIO
659X509_print_fp 666 EXIST::FUNCTION:FP_API
660X509_set_issuer_name 667 EXIST::FUNCTION:
661X509_set_notAfter 668 EXIST::FUNCTION:
662X509_set_notBefore 669 EXIST::FUNCTION:
663X509_set_pubkey 670 EXIST::FUNCTION:
664X509_set_serialNumber 671 EXIST::FUNCTION:
665X509_set_subject_name 672 EXIST::FUNCTION:
666X509_set_version 673 EXIST::FUNCTION:
667X509_sign 674 EXIST::FUNCTION:EVP
668X509_subject_name_cmp 675 EXIST::FUNCTION:
669X509_subject_name_hash 676 EXIST::FUNCTION:
670X509_to_X509_REQ 677 EXIST::FUNCTION:
671X509_verify 678 EXIST::FUNCTION:EVP
672X509_verify_cert 679 EXIST::FUNCTION:
673X509_verify_cert_error_string 680 EXIST::FUNCTION:
674X509v3_add_ext 681 EXIST::FUNCTION:
675X509v3_add_extension 682 NOEXIST::FUNCTION:
676X509v3_add_netscape_extensions 683 NOEXIST::FUNCTION:
677X509v3_add_standard_extensions 684 NOEXIST::FUNCTION:
678X509v3_cleanup_extensions 685 NOEXIST::FUNCTION:
679X509v3_data_type_by_NID 686 NOEXIST::FUNCTION:
680X509v3_data_type_by_OBJ 687 NOEXIST::FUNCTION:
681X509v3_delete_ext 688 EXIST::FUNCTION:
682X509v3_get_ext 689 EXIST::FUNCTION:
683X509v3_get_ext_by_NID 690 EXIST::FUNCTION:
684X509v3_get_ext_by_OBJ 691 EXIST::FUNCTION:
685X509v3_get_ext_by_critical 692 EXIST::FUNCTION:
686X509v3_get_ext_count 693 EXIST::FUNCTION:
687X509v3_pack_string 694 NOEXIST::FUNCTION:
688X509v3_pack_type_by_NID 695 NOEXIST::FUNCTION:
689X509v3_pack_type_by_OBJ 696 NOEXIST::FUNCTION:
690X509v3_unpack_string 697 NOEXIST::FUNCTION:
691_des_crypt 698 NOEXIST::FUNCTION:
692a2d_ASN1_OBJECT 699 EXIST::FUNCTION:
693a2i_ASN1_INTEGER 700 EXIST::FUNCTION:BIO
694a2i_ASN1_STRING 701 EXIST::FUNCTION:BIO
695asn1_Finish 702 EXIST::FUNCTION:
696asn1_GetSequence 703 EXIST::FUNCTION:
697bn_div_words 704 EXIST::FUNCTION:
698bn_expand2 705 EXIST::FUNCTION:
699bn_mul_add_words 706 EXIST::FUNCTION:
700bn_mul_words 707 EXIST::FUNCTION:
701BN_uadd 708 EXIST::FUNCTION:
702BN_usub 709 EXIST::FUNCTION:
703bn_sqr_words 710 EXIST::FUNCTION:
704_ossl_old_crypt 711 EXIST:!NeXT,!PERL5:FUNCTION:DES
705d2i_ASN1_BIT_STRING 712 EXIST::FUNCTION:
706d2i_ASN1_BOOLEAN 713 EXIST::FUNCTION:
707d2i_ASN1_HEADER 714 NOEXIST::FUNCTION:
708d2i_ASN1_IA5STRING 715 EXIST::FUNCTION:
709d2i_ASN1_INTEGER 716 EXIST::FUNCTION:
710d2i_ASN1_OBJECT 717 EXIST::FUNCTION:
711d2i_ASN1_OCTET_STRING 718 EXIST::FUNCTION:
712d2i_ASN1_PRINTABLE 719 EXIST::FUNCTION:
713d2i_ASN1_PRINTABLESTRING 720 EXIST::FUNCTION:
714d2i_ASN1_SET 721 EXIST::FUNCTION:
715d2i_ASN1_T61STRING 722 EXIST::FUNCTION:
716d2i_ASN1_TYPE 723 EXIST::FUNCTION:
717d2i_ASN1_UTCTIME 724 EXIST::FUNCTION:
718d2i_ASN1_bytes 725 EXIST::FUNCTION:
719d2i_ASN1_type_bytes 726 EXIST::FUNCTION:
720d2i_DHparams 727 EXIST::FUNCTION:DH
721d2i_DSAPrivateKey 728 EXIST::FUNCTION:DSA
722d2i_DSAPrivateKey_bio 729 EXIST::FUNCTION:BIO,DSA
723d2i_DSAPrivateKey_fp 730 EXIST::FUNCTION:DSA,FP_API
724d2i_DSAPublicKey 731 EXIST::FUNCTION:DSA
725d2i_DSAparams 732 EXIST::FUNCTION:DSA
726d2i_NETSCAPE_SPKAC 733 EXIST::FUNCTION:
727d2i_NETSCAPE_SPKI 734 EXIST::FUNCTION:
728d2i_Netscape_RSA 735 EXIST::FUNCTION:RC4,RSA
729d2i_PKCS7 736 EXIST::FUNCTION:
730d2i_PKCS7_DIGEST 737 EXIST::FUNCTION:
731d2i_PKCS7_ENCRYPT 738 EXIST::FUNCTION:
732d2i_PKCS7_ENC_CONTENT 739 EXIST::FUNCTION:
733d2i_PKCS7_ENVELOPE 740 EXIST::FUNCTION:
734d2i_PKCS7_ISSUER_AND_SERIAL 741 EXIST::FUNCTION:
735d2i_PKCS7_RECIP_INFO 742 EXIST::FUNCTION:
736d2i_PKCS7_SIGNED 743 EXIST::FUNCTION:
737d2i_PKCS7_SIGNER_INFO 744 EXIST::FUNCTION:
738d2i_PKCS7_SIGN_ENVELOPE 745 EXIST::FUNCTION:
739d2i_PKCS7_bio 746 EXIST::FUNCTION:
740d2i_PKCS7_fp 747 EXIST::FUNCTION:FP_API
741d2i_PrivateKey 748 EXIST::FUNCTION:
742d2i_PublicKey 749 EXIST::FUNCTION:
743d2i_RSAPrivateKey 750 EXIST::FUNCTION:RSA
744d2i_RSAPrivateKey_bio 751 EXIST::FUNCTION:BIO,RSA
745d2i_RSAPrivateKey_fp 752 EXIST::FUNCTION:FP_API,RSA
746d2i_RSAPublicKey 753 EXIST::FUNCTION:RSA
747d2i_X509 754 EXIST::FUNCTION:
748d2i_X509_ALGOR 755 EXIST::FUNCTION:
749d2i_X509_ATTRIBUTE 756 EXIST::FUNCTION:
750d2i_X509_CINF 757 EXIST::FUNCTION:
751d2i_X509_CRL 758 EXIST::FUNCTION:
752d2i_X509_CRL_INFO 759 EXIST::FUNCTION:
753d2i_X509_CRL_bio 760 EXIST::FUNCTION:BIO
754d2i_X509_CRL_fp 761 EXIST::FUNCTION:FP_API
755d2i_X509_EXTENSION 762 EXIST::FUNCTION:
756d2i_X509_NAME 763 EXIST::FUNCTION:
757d2i_X509_NAME_ENTRY 764 EXIST::FUNCTION:
758d2i_X509_PKEY 765 EXIST::FUNCTION:
759d2i_X509_PUBKEY 766 EXIST::FUNCTION:
760d2i_X509_REQ 767 EXIST::FUNCTION:
761d2i_X509_REQ_INFO 768 EXIST::FUNCTION:
762d2i_X509_REQ_bio 769 EXIST::FUNCTION:BIO
763d2i_X509_REQ_fp 770 EXIST::FUNCTION:FP_API
764d2i_X509_REVOKED 771 EXIST::FUNCTION:
765d2i_X509_SIG 772 EXIST::FUNCTION:
766d2i_X509_VAL 773 EXIST::FUNCTION:
767d2i_X509_bio 774 EXIST::FUNCTION:BIO
768d2i_X509_fp 775 EXIST::FUNCTION:FP_API
769DES_cbc_cksum 777 EXIST::FUNCTION:DES
770DES_cbc_encrypt 778 EXIST::FUNCTION:DES
771DES_cblock_print_file 779 NOEXIST::FUNCTION:
772DES_cfb64_encrypt 780 EXIST::FUNCTION:DES
773DES_cfb_encrypt 781 EXIST::FUNCTION:DES
774DES_decrypt3 782 EXIST::FUNCTION:DES
775DES_ecb3_encrypt 783 EXIST::FUNCTION:DES
776DES_ecb_encrypt 784 EXIST::FUNCTION:DES
777DES_ede3_cbc_encrypt 785 EXIST::FUNCTION:DES
778DES_ede3_cfb64_encrypt 786 EXIST::FUNCTION:DES
779DES_ede3_ofb64_encrypt 787 EXIST::FUNCTION:DES
780DES_enc_read 788 EXIST::FUNCTION:DES
781DES_enc_write 789 EXIST::FUNCTION:DES
782DES_encrypt1 790 EXIST::FUNCTION:DES
783DES_encrypt2 791 EXIST::FUNCTION:DES
784DES_encrypt3 792 EXIST::FUNCTION:DES
785DES_fcrypt 793 EXIST::FUNCTION:DES
786DES_is_weak_key 794 EXIST::FUNCTION:DES
787DES_key_sched 795 EXIST::FUNCTION:DES
788DES_ncbc_encrypt 796 EXIST::FUNCTION:DES
789DES_ofb64_encrypt 797 EXIST::FUNCTION:DES
790DES_ofb_encrypt 798 EXIST::FUNCTION:DES
791DES_options 799 EXIST::FUNCTION:DES
792DES_pcbc_encrypt 800 EXIST::FUNCTION:DES
793DES_quad_cksum 801 EXIST::FUNCTION:DES
794DES_random_key 802 EXIST::FUNCTION:DES
795_ossl_old_des_random_seed 803 EXIST::FUNCTION:DES
796_ossl_old_des_read_2passwords 804 EXIST::FUNCTION:DES
797_ossl_old_des_read_password 805 EXIST::FUNCTION:DES
798_ossl_old_des_read_pw 806 EXIST::FUNCTION:
799_ossl_old_des_read_pw_string 807 EXIST::FUNCTION:
800DES_set_key 808 EXIST::FUNCTION:DES
801DES_set_odd_parity 809 EXIST::FUNCTION:DES
802DES_string_to_2keys 810 EXIST::FUNCTION:DES
803DES_string_to_key 811 EXIST::FUNCTION:DES
804DES_xcbc_encrypt 812 EXIST::FUNCTION:DES
805DES_xwhite_in2out 813 NOEXIST::FUNCTION:
806fcrypt_body 814 NOEXIST::FUNCTION:
807i2a_ASN1_INTEGER 815 EXIST::FUNCTION:BIO
808i2a_ASN1_OBJECT 816 EXIST::FUNCTION:BIO
809i2a_ASN1_STRING 817 EXIST::FUNCTION:BIO
810i2d_ASN1_BIT_STRING 818 EXIST::FUNCTION:
811i2d_ASN1_BOOLEAN 819 EXIST::FUNCTION:
812i2d_ASN1_HEADER 820 NOEXIST::FUNCTION:
813i2d_ASN1_IA5STRING 821 EXIST::FUNCTION:
814i2d_ASN1_INTEGER 822 EXIST::FUNCTION:
815i2d_ASN1_OBJECT 823 EXIST::FUNCTION:
816i2d_ASN1_OCTET_STRING 824 EXIST::FUNCTION:
817i2d_ASN1_PRINTABLE 825 EXIST::FUNCTION:
818i2d_ASN1_SET 826 EXIST::FUNCTION:
819i2d_ASN1_TYPE 827 EXIST::FUNCTION:
820i2d_ASN1_UTCTIME 828 EXIST::FUNCTION:
821i2d_ASN1_bytes 829 EXIST::FUNCTION:
822i2d_DHparams 830 EXIST::FUNCTION:DH
823i2d_DSAPrivateKey 831 EXIST::FUNCTION:DSA
824i2d_DSAPrivateKey_bio 832 EXIST::FUNCTION:BIO,DSA
825i2d_DSAPrivateKey_fp 833 EXIST::FUNCTION:DSA,FP_API
826i2d_DSAPublicKey 834 EXIST::FUNCTION:DSA
827i2d_DSAparams 835 EXIST::FUNCTION:DSA
828i2d_NETSCAPE_SPKAC 836 EXIST::FUNCTION:
829i2d_NETSCAPE_SPKI 837 EXIST::FUNCTION:
830i2d_Netscape_RSA 838 EXIST::FUNCTION:RC4,RSA
831i2d_PKCS7 839 EXIST::FUNCTION:
832i2d_PKCS7_DIGEST 840 EXIST::FUNCTION:
833i2d_PKCS7_ENCRYPT 841 EXIST::FUNCTION:
834i2d_PKCS7_ENC_CONTENT 842 EXIST::FUNCTION:
835i2d_PKCS7_ENVELOPE 843 EXIST::FUNCTION:
836i2d_PKCS7_ISSUER_AND_SERIAL 844 EXIST::FUNCTION:
837i2d_PKCS7_RECIP_INFO 845 EXIST::FUNCTION:
838i2d_PKCS7_SIGNED 846 EXIST::FUNCTION:
839i2d_PKCS7_SIGNER_INFO 847 EXIST::FUNCTION:
840i2d_PKCS7_SIGN_ENVELOPE 848 EXIST::FUNCTION:
841i2d_PKCS7_bio 849 EXIST::FUNCTION:
842i2d_PKCS7_fp 850 EXIST::FUNCTION:FP_API
843i2d_PrivateKey 851 EXIST::FUNCTION:
844i2d_PublicKey 852 EXIST::FUNCTION:
845i2d_RSAPrivateKey 853 EXIST::FUNCTION:RSA
846i2d_RSAPrivateKey_bio 854 EXIST::FUNCTION:BIO,RSA
847i2d_RSAPrivateKey_fp 855 EXIST::FUNCTION:FP_API,RSA
848i2d_RSAPublicKey 856 EXIST::FUNCTION:RSA
849i2d_X509 857 EXIST::FUNCTION:
850i2d_X509_ALGOR 858 EXIST::FUNCTION:
851i2d_X509_ATTRIBUTE 859 EXIST::FUNCTION:
852i2d_X509_CINF 860 EXIST::FUNCTION:
853i2d_X509_CRL 861 EXIST::FUNCTION:
854i2d_X509_CRL_INFO 862 EXIST::FUNCTION:
855i2d_X509_CRL_bio 863 EXIST::FUNCTION:BIO
856i2d_X509_CRL_fp 864 EXIST::FUNCTION:FP_API
857i2d_X509_EXTENSION 865 EXIST::FUNCTION:
858i2d_X509_NAME 866 EXIST::FUNCTION:
859i2d_X509_NAME_ENTRY 867 EXIST::FUNCTION:
860i2d_X509_PKEY 868 EXIST::FUNCTION:
861i2d_X509_PUBKEY 869 EXIST::FUNCTION:
862i2d_X509_REQ 870 EXIST::FUNCTION:
863i2d_X509_REQ_INFO 871 EXIST::FUNCTION:
864i2d_X509_REQ_bio 872 EXIST::FUNCTION:BIO
865i2d_X509_REQ_fp 873 EXIST::FUNCTION:FP_API
866i2d_X509_REVOKED 874 EXIST::FUNCTION:
867i2d_X509_SIG 875 EXIST::FUNCTION:
868i2d_X509_VAL 876 EXIST::FUNCTION:
869i2d_X509_bio 877 EXIST::FUNCTION:BIO
870i2d_X509_fp 878 EXIST::FUNCTION:FP_API
871idea_cbc_encrypt 879 EXIST::FUNCTION:IDEA
872idea_cfb64_encrypt 880 EXIST::FUNCTION:IDEA
873idea_ecb_encrypt 881 EXIST::FUNCTION:IDEA
874idea_encrypt 882 EXIST::FUNCTION:IDEA
875idea_ofb64_encrypt 883 EXIST::FUNCTION:IDEA
876idea_options 884 EXIST::FUNCTION:IDEA
877idea_set_decrypt_key 885 EXIST::FUNCTION:IDEA
878idea_set_encrypt_key 886 EXIST::FUNCTION:IDEA
879lh_delete 887 EXIST::FUNCTION:
880lh_doall 888 EXIST::FUNCTION:
881lh_doall_arg 889 EXIST::FUNCTION:
882lh_free 890 EXIST::FUNCTION:
883lh_insert 891 EXIST::FUNCTION:
884lh_new 892 EXIST::FUNCTION:
885lh_node_stats 893 EXIST::FUNCTION:FP_API
886lh_node_stats_bio 894 EXIST::FUNCTION:BIO
887lh_node_usage_stats 895 EXIST::FUNCTION:FP_API
888lh_node_usage_stats_bio 896 EXIST::FUNCTION:BIO
889lh_retrieve 897 EXIST::FUNCTION:
890lh_stats 898 EXIST::FUNCTION:FP_API
891lh_stats_bio 899 EXIST::FUNCTION:BIO
892lh_strhash 900 EXIST::FUNCTION:
893sk_delete 901 EXIST::FUNCTION:
894sk_delete_ptr 902 EXIST::FUNCTION:
895sk_dup 903 EXIST::FUNCTION:
896sk_find 904 EXIST::FUNCTION:
897sk_free 905 EXIST::FUNCTION:
898sk_insert 906 EXIST::FUNCTION:
899sk_new 907 EXIST::FUNCTION:
900sk_pop 908 EXIST::FUNCTION:
901sk_pop_free 909 EXIST::FUNCTION:
902sk_push 910 EXIST::FUNCTION:
903sk_set_cmp_func 911 EXIST::FUNCTION:
904sk_shift 912 EXIST::FUNCTION:
905sk_unshift 913 EXIST::FUNCTION:
906sk_zero 914 EXIST::FUNCTION:
907BIO_f_nbio_test 915 EXIST::FUNCTION:
908ASN1_TYPE_get 916 EXIST::FUNCTION:
909ASN1_TYPE_set 917 EXIST::FUNCTION:
910PKCS7_content_free 918 NOEXIST::FUNCTION:
911ERR_load_PKCS7_strings 919 EXIST::FUNCTION:
912X509_find_by_issuer_and_serial 920 EXIST::FUNCTION:
913X509_find_by_subject 921 EXIST::FUNCTION:
914PKCS7_ctrl 927 EXIST::FUNCTION:
915PKCS7_set_type 928 EXIST::FUNCTION:
916PKCS7_set_content 929 EXIST::FUNCTION:
917PKCS7_SIGNER_INFO_set 930 EXIST::FUNCTION:
918PKCS7_add_signer 931 EXIST::FUNCTION:
919PKCS7_add_certificate 932 EXIST::FUNCTION:
920PKCS7_add_crl 933 EXIST::FUNCTION:
921PKCS7_content_new 934 EXIST::FUNCTION:
922PKCS7_dataSign 935 NOEXIST::FUNCTION:
923PKCS7_dataVerify 936 EXIST::FUNCTION:
924PKCS7_dataInit 937 EXIST::FUNCTION:
925PKCS7_add_signature 938 EXIST::FUNCTION:
926PKCS7_cert_from_signer_info 939 EXIST::FUNCTION:
927PKCS7_get_signer_info 940 EXIST::FUNCTION:
928EVP_delete_alias 941 NOEXIST::FUNCTION:
929EVP_mdc2 942 EXIST::FUNCTION:MDC2
930PEM_read_bio_RSAPublicKey 943 EXIST::FUNCTION:RSA
931PEM_write_bio_RSAPublicKey 944 EXIST::FUNCTION:RSA
932d2i_RSAPublicKey_bio 945 EXIST::FUNCTION:BIO,RSA
933i2d_RSAPublicKey_bio 946 EXIST::FUNCTION:BIO,RSA
934PEM_read_RSAPublicKey 947 EXIST:!WIN16:FUNCTION:RSA
935PEM_write_RSAPublicKey 949 EXIST:!WIN16:FUNCTION:RSA
936d2i_RSAPublicKey_fp 952 EXIST::FUNCTION:FP_API,RSA
937i2d_RSAPublicKey_fp 954 EXIST::FUNCTION:FP_API,RSA
938BIO_copy_next_retry 955 EXIST::FUNCTION:
939RSA_flags 956 EXIST::FUNCTION:RSA
940X509_STORE_add_crl 957 EXIST::FUNCTION:
941X509_load_crl_file 958 EXIST::FUNCTION:STDIO
942EVP_rc2_40_cbc 959 EXIST::FUNCTION:RC2
943EVP_rc4_40 960 EXIST::FUNCTION:RC4
944EVP_CIPHER_CTX_init 961 EXIST::FUNCTION:
945HMAC 962 EXIST::FUNCTION:HMAC
946HMAC_Init 963 EXIST::FUNCTION:HMAC
947HMAC_Update 964 EXIST::FUNCTION:HMAC
948HMAC_Final 965 EXIST::FUNCTION:HMAC
949ERR_get_next_error_library 966 EXIST::FUNCTION:
950EVP_PKEY_cmp_parameters 967 EXIST::FUNCTION:
951HMAC_cleanup 968 NOEXIST::FUNCTION:
952BIO_ptr_ctrl 969 EXIST::FUNCTION:
953BIO_new_file_internal 970 NOEXIST::FUNCTION:
954BIO_new_fp_internal 971 NOEXIST::FUNCTION:
955BIO_s_file_internal 972 NOEXIST::FUNCTION:
956BN_BLINDING_convert 973 EXIST::FUNCTION:
957BN_BLINDING_invert 974 EXIST::FUNCTION:
958BN_BLINDING_update 975 EXIST::FUNCTION:
959RSA_blinding_on 977 EXIST::FUNCTION:RSA
960RSA_blinding_off 978 EXIST::FUNCTION:RSA
961i2t_ASN1_OBJECT 979 EXIST::FUNCTION:
962BN_BLINDING_new 980 EXIST::FUNCTION:
963BN_BLINDING_free 981 EXIST::FUNCTION:
964EVP_cast5_cbc 983 EXIST::FUNCTION:CAST
965EVP_cast5_cfb64 984 EXIST::FUNCTION:CAST
966EVP_cast5_ecb 985 EXIST::FUNCTION:CAST
967EVP_cast5_ofb 986 EXIST::FUNCTION:CAST
968BF_decrypt 987 EXIST::FUNCTION:BF
969CAST_set_key 988 EXIST::FUNCTION:CAST
970CAST_encrypt 989 EXIST::FUNCTION:CAST
971CAST_decrypt 990 EXIST::FUNCTION:CAST
972CAST_ecb_encrypt 991 EXIST::FUNCTION:CAST
973CAST_cbc_encrypt 992 EXIST::FUNCTION:CAST
974CAST_cfb64_encrypt 993 EXIST::FUNCTION:CAST
975CAST_ofb64_encrypt 994 EXIST::FUNCTION:CAST
976RC2_decrypt 995 EXIST::FUNCTION:RC2
977OBJ_create_objects 997 EXIST::FUNCTION:
978BN_exp 998 EXIST::FUNCTION:
979BN_mul_word 999 EXIST::FUNCTION:
980BN_sub_word 1000 EXIST::FUNCTION:
981BN_dec2bn 1001 EXIST::FUNCTION:
982BN_bn2dec 1002 EXIST::FUNCTION:
983BIO_ghbn_ctrl 1003 NOEXIST::FUNCTION:
984CRYPTO_free_ex_data 1004 EXIST::FUNCTION:
985CRYPTO_get_ex_data 1005 EXIST::FUNCTION:
986CRYPTO_set_ex_data 1007 EXIST::FUNCTION:
987ERR_load_CRYPTO_strings 1009 EXIST:!OS2,!VMS:FUNCTION:
988ERR_load_CRYPTOlib_strings 1009 EXIST:OS2,VMS:FUNCTION:
989EVP_PKEY_bits 1010 EXIST::FUNCTION:
990MD5_Transform 1011 EXIST::FUNCTION:MD5
991SHA1_Transform 1012 EXIST::FUNCTION:SHA,SHA1
992SHA_Transform 1013 EXIST::FUNCTION:SHA,SHA0
993X509_STORE_CTX_get_chain 1014 EXIST::FUNCTION:
994X509_STORE_CTX_get_current_cert 1015 EXIST::FUNCTION:
995X509_STORE_CTX_get_error 1016 EXIST::FUNCTION:
996X509_STORE_CTX_get_error_depth 1017 EXIST::FUNCTION:
997X509_STORE_CTX_get_ex_data 1018 EXIST::FUNCTION:
998X509_STORE_CTX_set_cert 1020 EXIST::FUNCTION:
999X509_STORE_CTX_set_chain 1021 EXIST::FUNCTION:
1000X509_STORE_CTX_set_error 1022 EXIST::FUNCTION:
1001X509_STORE_CTX_set_ex_data 1023 EXIST::FUNCTION:
1002CRYPTO_dup_ex_data 1025 EXIST::FUNCTION:
1003CRYPTO_get_new_lockid 1026 EXIST::FUNCTION:
1004CRYPTO_new_ex_data 1027 EXIST::FUNCTION:
1005RSA_set_ex_data 1028 EXIST::FUNCTION:RSA
1006RSA_get_ex_data 1029 EXIST::FUNCTION:RSA
1007RSA_get_ex_new_index 1030 EXIST::FUNCTION:RSA
1008RSA_padding_add_PKCS1_type_1 1031 EXIST::FUNCTION:RSA
1009RSA_padding_add_PKCS1_type_2 1032 EXIST::FUNCTION:RSA
1010RSA_padding_add_SSLv23 1033 EXIST::FUNCTION:RSA
1011RSA_padding_add_none 1034 EXIST::FUNCTION:RSA
1012RSA_padding_check_PKCS1_type_1 1035 EXIST::FUNCTION:RSA
1013RSA_padding_check_PKCS1_type_2 1036 EXIST::FUNCTION:RSA
1014RSA_padding_check_SSLv23 1037 EXIST::FUNCTION:RSA
1015RSA_padding_check_none 1038 EXIST::FUNCTION:RSA
1016bn_add_words 1039 EXIST::FUNCTION:
1017d2i_Netscape_RSA_2 1040 NOEXIST::FUNCTION:
1018CRYPTO_get_ex_new_index 1041 EXIST::FUNCTION:
1019RIPEMD160_Init 1042 EXIST::FUNCTION:RIPEMD
1020RIPEMD160_Update 1043 EXIST::FUNCTION:RIPEMD
1021RIPEMD160_Final 1044 EXIST::FUNCTION:RIPEMD
1022RIPEMD160 1045 EXIST::FUNCTION:RIPEMD
1023RIPEMD160_Transform 1046 EXIST::FUNCTION:RIPEMD
1024RC5_32_set_key 1047 EXIST::FUNCTION:RC5
1025RC5_32_ecb_encrypt 1048 EXIST::FUNCTION:RC5
1026RC5_32_encrypt 1049 EXIST::FUNCTION:RC5
1027RC5_32_decrypt 1050 EXIST::FUNCTION:RC5
1028RC5_32_cbc_encrypt 1051 EXIST::FUNCTION:RC5
1029RC5_32_cfb64_encrypt 1052 EXIST::FUNCTION:RC5
1030RC5_32_ofb64_encrypt 1053 EXIST::FUNCTION:RC5
1031BN_bn2mpi 1058 EXIST::FUNCTION:
1032BN_mpi2bn 1059 EXIST::FUNCTION:
1033ASN1_BIT_STRING_get_bit 1060 EXIST::FUNCTION:
1034ASN1_BIT_STRING_set_bit 1061 EXIST::FUNCTION:
1035BIO_get_ex_data 1062 EXIST::FUNCTION:
1036BIO_get_ex_new_index 1063 EXIST::FUNCTION:
1037BIO_set_ex_data 1064 EXIST::FUNCTION:
1038X509v3_get_key_usage 1066 NOEXIST::FUNCTION:
1039X509v3_set_key_usage 1067 NOEXIST::FUNCTION:
1040a2i_X509v3_key_usage 1068 NOEXIST::FUNCTION:
1041i2a_X509v3_key_usage 1069 NOEXIST::FUNCTION:
1042EVP_PKEY_decrypt 1070 EXIST::FUNCTION:
1043EVP_PKEY_encrypt 1071 EXIST::FUNCTION:
1044PKCS7_RECIP_INFO_set 1072 EXIST::FUNCTION:
1045PKCS7_add_recipient 1073 EXIST::FUNCTION:
1046PKCS7_add_recipient_info 1074 EXIST::FUNCTION:
1047PKCS7_set_cipher 1075 EXIST::FUNCTION:
1048ASN1_TYPE_get_int_octetstring 1076 EXIST::FUNCTION:
1049ASN1_TYPE_get_octetstring 1077 EXIST::FUNCTION:
1050ASN1_TYPE_set_int_octetstring 1078 EXIST::FUNCTION:
1051ASN1_TYPE_set_octetstring 1079 EXIST::FUNCTION:
1052ASN1_UTCTIME_set_string 1080 EXIST::FUNCTION:
1053ERR_add_error_data 1081 EXIST::FUNCTION:
1054ERR_set_error_data 1082 EXIST::FUNCTION:
1055EVP_CIPHER_asn1_to_param 1083 EXIST::FUNCTION:
1056EVP_CIPHER_param_to_asn1 1084 EXIST::FUNCTION:
1057EVP_CIPHER_get_asn1_iv 1085 EXIST::FUNCTION:
1058EVP_CIPHER_set_asn1_iv 1086 EXIST::FUNCTION:
1059EVP_rc5_32_12_16_cbc 1087 EXIST::FUNCTION:RC5
1060EVP_rc5_32_12_16_cfb64 1088 EXIST::FUNCTION:RC5
1061EVP_rc5_32_12_16_ecb 1089 EXIST::FUNCTION:RC5
1062EVP_rc5_32_12_16_ofb 1090 EXIST::FUNCTION:RC5
1063asn1_add_error 1091 EXIST::FUNCTION:
1064d2i_ASN1_BMPSTRING 1092 EXIST::FUNCTION:
1065i2d_ASN1_BMPSTRING 1093 EXIST::FUNCTION:
1066BIO_f_ber 1094 NOEXIST::FUNCTION:
1067BN_init 1095 EXIST::FUNCTION:
1068COMP_CTX_new 1096 EXIST::FUNCTION:
1069COMP_CTX_free 1097 EXIST::FUNCTION:
1070COMP_CTX_compress_block 1098 NOEXIST::FUNCTION:
1071COMP_CTX_expand_block 1099 NOEXIST::FUNCTION:
1072X509_STORE_CTX_get_ex_new_index 1100 EXIST::FUNCTION:
1073OBJ_NAME_add 1101 EXIST::FUNCTION:
1074BIO_socket_nbio 1102 EXIST::FUNCTION:
1075EVP_rc2_64_cbc 1103 EXIST::FUNCTION:RC2
1076OBJ_NAME_cleanup 1104 EXIST::FUNCTION:
1077OBJ_NAME_get 1105 EXIST::FUNCTION:
1078OBJ_NAME_init 1106 EXIST::FUNCTION:
1079OBJ_NAME_new_index 1107 EXIST::FUNCTION:
1080OBJ_NAME_remove 1108 EXIST::FUNCTION:
1081BN_MONT_CTX_copy 1109 EXIST::FUNCTION:
1082BIO_new_socks4a_connect 1110 NOEXIST::FUNCTION:
1083BIO_s_socks4a_connect 1111 NOEXIST::FUNCTION:
1084PROXY_set_connect_mode 1112 NOEXIST::FUNCTION:
1085RAND_SSLeay 1113 EXIST::FUNCTION:
1086RAND_set_rand_method 1114 EXIST::FUNCTION:
1087RSA_memory_lock 1115 EXIST::FUNCTION:RSA
1088bn_sub_words 1116 EXIST::FUNCTION:
1089bn_mul_normal 1117 NOEXIST::FUNCTION:
1090bn_mul_comba8 1118 NOEXIST::FUNCTION:
1091bn_mul_comba4 1119 NOEXIST::FUNCTION:
1092bn_sqr_normal 1120 NOEXIST::FUNCTION:
1093bn_sqr_comba8 1121 NOEXIST::FUNCTION:
1094bn_sqr_comba4 1122 NOEXIST::FUNCTION:
1095bn_cmp_words 1123 NOEXIST::FUNCTION:
1096bn_mul_recursive 1124 NOEXIST::FUNCTION:
1097bn_mul_part_recursive 1125 NOEXIST::FUNCTION:
1098bn_sqr_recursive 1126 NOEXIST::FUNCTION:
1099bn_mul_low_normal 1127 NOEXIST::FUNCTION:
1100BN_RECP_CTX_init 1128 EXIST::FUNCTION:
1101BN_RECP_CTX_new 1129 EXIST::FUNCTION:
1102BN_RECP_CTX_free 1130 EXIST::FUNCTION:
1103BN_RECP_CTX_set 1131 EXIST::FUNCTION:
1104BN_mod_mul_reciprocal 1132 EXIST::FUNCTION:
1105BN_mod_exp_recp 1133 EXIST::FUNCTION:
1106BN_div_recp 1134 EXIST::FUNCTION:
1107BN_CTX_init 1135 EXIST::FUNCTION:DEPRECATED
1108BN_MONT_CTX_init 1136 EXIST::FUNCTION:
1109RAND_get_rand_method 1137 EXIST::FUNCTION:
1110PKCS7_add_attribute 1138 EXIST::FUNCTION:
1111PKCS7_add_signed_attribute 1139 EXIST::FUNCTION:
1112PKCS7_digest_from_attributes 1140 EXIST::FUNCTION:
1113PKCS7_get_attribute 1141 EXIST::FUNCTION:
1114PKCS7_get_issuer_and_serial 1142 EXIST::FUNCTION:
1115PKCS7_get_signed_attribute 1143 EXIST::FUNCTION:
1116COMP_compress_block 1144 EXIST::FUNCTION:
1117COMP_expand_block 1145 EXIST::FUNCTION:
1118COMP_rle 1146 EXIST::FUNCTION:
1119COMP_zlib 1147 EXIST::FUNCTION:
1120ms_time_diff 1148 NOEXIST::FUNCTION:
1121ms_time_new 1149 NOEXIST::FUNCTION:
1122ms_time_free 1150 NOEXIST::FUNCTION:
1123ms_time_cmp 1151 NOEXIST::FUNCTION:
1124ms_time_get 1152 NOEXIST::FUNCTION:
1125PKCS7_set_attributes 1153 EXIST::FUNCTION:
1126PKCS7_set_signed_attributes 1154 EXIST::FUNCTION:
1127X509_ATTRIBUTE_create 1155 EXIST::FUNCTION:
1128X509_ATTRIBUTE_dup 1156 EXIST::FUNCTION:
1129ASN1_GENERALIZEDTIME_check 1157 EXIST::FUNCTION:
1130ASN1_GENERALIZEDTIME_print 1158 EXIST::FUNCTION:BIO
1131ASN1_GENERALIZEDTIME_set 1159 EXIST::FUNCTION:
1132ASN1_GENERALIZEDTIME_set_string 1160 EXIST::FUNCTION:
1133ASN1_TIME_print 1161 EXIST::FUNCTION:BIO
1134BASIC_CONSTRAINTS_free 1162 EXIST::FUNCTION:
1135BASIC_CONSTRAINTS_new 1163 EXIST::FUNCTION:
1136ERR_load_X509V3_strings 1164 EXIST::FUNCTION:
1137NETSCAPE_CERT_SEQUENCE_free 1165 EXIST::FUNCTION:
1138NETSCAPE_CERT_SEQUENCE_new 1166 EXIST::FUNCTION:
1139OBJ_txt2obj 1167 EXIST::FUNCTION:
1140PEM_read_NETSCAPE_CERT_SEQUENCE 1168 EXIST:!VMS,!WIN16:FUNCTION:
1141PEM_read_NS_CERT_SEQ 1168 EXIST:VMS:FUNCTION:
1142PEM_read_bio_NETSCAPE_CERT_SEQUENCE 1169 EXIST:!VMS:FUNCTION:
1143PEM_read_bio_NS_CERT_SEQ 1169 EXIST:VMS:FUNCTION:
1144PEM_write_NETSCAPE_CERT_SEQUENCE 1170 EXIST:!VMS,!WIN16:FUNCTION:
1145PEM_write_NS_CERT_SEQ 1170 EXIST:VMS:FUNCTION:
1146PEM_write_bio_NETSCAPE_CERT_SEQUENCE 1171 EXIST:!VMS:FUNCTION:
1147PEM_write_bio_NS_CERT_SEQ 1171 EXIST:VMS:FUNCTION:
1148X509V3_EXT_add 1172 EXIST::FUNCTION:
1149X509V3_EXT_add_alias 1173 EXIST::FUNCTION:
1150X509V3_EXT_add_conf 1174 EXIST::FUNCTION:
1151X509V3_EXT_cleanup 1175 EXIST::FUNCTION:
1152X509V3_EXT_conf 1176 EXIST::FUNCTION:
1153X509V3_EXT_conf_nid 1177 EXIST::FUNCTION:
1154X509V3_EXT_get 1178 EXIST::FUNCTION:
1155X509V3_EXT_get_nid 1179 EXIST::FUNCTION:
1156X509V3_EXT_print 1180 EXIST::FUNCTION:
1157X509V3_EXT_print_fp 1181 EXIST::FUNCTION:
1158X509V3_add_standard_extensions 1182 EXIST::FUNCTION:
1159X509V3_add_value 1183 EXIST::FUNCTION:
1160X509V3_add_value_bool 1184 EXIST::FUNCTION:
1161X509V3_add_value_int 1185 EXIST::FUNCTION:
1162X509V3_conf_free 1186 EXIST::FUNCTION:
1163X509V3_get_value_bool 1187 EXIST::FUNCTION:
1164X509V3_get_value_int 1188 EXIST::FUNCTION:
1165X509V3_parse_list 1189 EXIST::FUNCTION:
1166d2i_ASN1_GENERALIZEDTIME 1190 EXIST::FUNCTION:
1167d2i_ASN1_TIME 1191 EXIST::FUNCTION:
1168d2i_BASIC_CONSTRAINTS 1192 EXIST::FUNCTION:
1169d2i_NETSCAPE_CERT_SEQUENCE 1193 EXIST::FUNCTION:
1170d2i_ext_ku 1194 NOEXIST::FUNCTION:
1171ext_ku_free 1195 NOEXIST::FUNCTION:
1172ext_ku_new 1196 NOEXIST::FUNCTION:
1173i2d_ASN1_GENERALIZEDTIME 1197 EXIST::FUNCTION:
1174i2d_ASN1_TIME 1198 EXIST::FUNCTION:
1175i2d_BASIC_CONSTRAINTS 1199 EXIST::FUNCTION:
1176i2d_NETSCAPE_CERT_SEQUENCE 1200 EXIST::FUNCTION:
1177i2d_ext_ku 1201 NOEXIST::FUNCTION:
1178EVP_MD_CTX_copy 1202 EXIST::FUNCTION:
1179i2d_ASN1_ENUMERATED 1203 EXIST::FUNCTION:
1180d2i_ASN1_ENUMERATED 1204 EXIST::FUNCTION:
1181ASN1_ENUMERATED_set 1205 EXIST::FUNCTION:
1182ASN1_ENUMERATED_get 1206 EXIST::FUNCTION:
1183BN_to_ASN1_ENUMERATED 1207 EXIST::FUNCTION:
1184ASN1_ENUMERATED_to_BN 1208 EXIST::FUNCTION:
1185i2a_ASN1_ENUMERATED 1209 EXIST::FUNCTION:BIO
1186a2i_ASN1_ENUMERATED 1210 EXIST::FUNCTION:BIO
1187i2d_GENERAL_NAME 1211 EXIST::FUNCTION:
1188d2i_GENERAL_NAME 1212 EXIST::FUNCTION:
1189GENERAL_NAME_new 1213 EXIST::FUNCTION:
1190GENERAL_NAME_free 1214 EXIST::FUNCTION:
1191GENERAL_NAMES_new 1215 EXIST::FUNCTION:
1192GENERAL_NAMES_free 1216 EXIST::FUNCTION:
1193d2i_GENERAL_NAMES 1217 EXIST::FUNCTION:
1194i2d_GENERAL_NAMES 1218 EXIST::FUNCTION:
1195i2v_GENERAL_NAMES 1219 EXIST::FUNCTION:
1196i2s_ASN1_OCTET_STRING 1220 EXIST::FUNCTION:
1197s2i_ASN1_OCTET_STRING 1221 EXIST::FUNCTION:
1198X509V3_EXT_check_conf 1222 NOEXIST::FUNCTION:
1199hex_to_string 1223 EXIST::FUNCTION:
1200string_to_hex 1224 EXIST::FUNCTION:
1201DES_ede3_cbcm_encrypt 1225 EXIST::FUNCTION:DES
1202RSA_padding_add_PKCS1_OAEP 1226 EXIST::FUNCTION:RSA
1203RSA_padding_check_PKCS1_OAEP 1227 EXIST::FUNCTION:RSA
1204X509_CRL_print_fp 1228 EXIST::FUNCTION:FP_API
1205X509_CRL_print 1229 EXIST::FUNCTION:BIO
1206i2v_GENERAL_NAME 1230 EXIST::FUNCTION:
1207v2i_GENERAL_NAME 1231 EXIST::FUNCTION:
1208i2d_PKEY_USAGE_PERIOD 1232 EXIST::FUNCTION:
1209d2i_PKEY_USAGE_PERIOD 1233 EXIST::FUNCTION:
1210PKEY_USAGE_PERIOD_new 1234 EXIST::FUNCTION:
1211PKEY_USAGE_PERIOD_free 1235 EXIST::FUNCTION:
1212v2i_GENERAL_NAMES 1236 EXIST::FUNCTION:
1213i2s_ASN1_INTEGER 1237 EXIST::FUNCTION:
1214X509V3_EXT_d2i 1238 EXIST::FUNCTION:
1215name_cmp 1239 EXIST::FUNCTION:
1216str_dup 1240 NOEXIST::FUNCTION:
1217i2s_ASN1_ENUMERATED 1241 EXIST::FUNCTION:
1218i2s_ASN1_ENUMERATED_TABLE 1242 EXIST::FUNCTION:
1219BIO_s_log 1243 EXIST:!OS2,!WIN16,!WIN32,!macintosh:FUNCTION:
1220BIO_f_reliable 1244 EXIST::FUNCTION:BIO
1221PKCS7_dataFinal 1245 EXIST::FUNCTION:
1222PKCS7_dataDecode 1246 EXIST::FUNCTION:
1223X509V3_EXT_CRL_add_conf 1247 EXIST::FUNCTION:
1224BN_set_params 1248 EXIST::FUNCTION:DEPRECATED
1225BN_get_params 1249 EXIST::FUNCTION:DEPRECATED
1226BIO_get_ex_num 1250 NOEXIST::FUNCTION:
1227BIO_set_ex_free_func 1251 NOEXIST::FUNCTION:
1228EVP_ripemd160 1252 EXIST::FUNCTION:RIPEMD
1229ASN1_TIME_set 1253 EXIST::FUNCTION:
1230i2d_AUTHORITY_KEYID 1254 EXIST::FUNCTION:
1231d2i_AUTHORITY_KEYID 1255 EXIST::FUNCTION:
1232AUTHORITY_KEYID_new 1256 EXIST::FUNCTION:
1233AUTHORITY_KEYID_free 1257 EXIST::FUNCTION:
1234ASN1_seq_unpack 1258 EXIST::FUNCTION:
1235ASN1_seq_pack 1259 EXIST::FUNCTION:
1236ASN1_unpack_string 1260 EXIST::FUNCTION:
1237ASN1_pack_string 1261 EXIST::FUNCTION:
1238PKCS12_pack_safebag 1262 NOEXIST::FUNCTION:
1239PKCS12_MAKE_KEYBAG 1263 EXIST::FUNCTION:
1240PKCS8_encrypt 1264 EXIST::FUNCTION:
1241PKCS12_MAKE_SHKEYBAG 1265 EXIST::FUNCTION:
1242PKCS12_pack_p7data 1266 EXIST::FUNCTION:
1243PKCS12_pack_p7encdata 1267 EXIST::FUNCTION:
1244PKCS12_add_localkeyid 1268 EXIST::FUNCTION:
1245PKCS12_add_friendlyname_asc 1269 EXIST::FUNCTION:
1246PKCS12_add_friendlyname_uni 1270 EXIST::FUNCTION:
1247PKCS12_get_friendlyname 1271 EXIST::FUNCTION:
1248PKCS12_pbe_crypt 1272 EXIST::FUNCTION:
1249PKCS12_decrypt_d2i 1273 NOEXIST::FUNCTION:
1250PKCS12_i2d_encrypt 1274 NOEXIST::FUNCTION:
1251PKCS12_init 1275 EXIST::FUNCTION:
1252PKCS12_key_gen_asc 1276 EXIST::FUNCTION:
1253PKCS12_key_gen_uni 1277 EXIST::FUNCTION:
1254PKCS12_gen_mac 1278 EXIST::FUNCTION:
1255PKCS12_verify_mac 1279 EXIST::FUNCTION:
1256PKCS12_set_mac 1280 EXIST::FUNCTION:
1257PKCS12_setup_mac 1281 EXIST::FUNCTION:
1258OPENSSL_asc2uni 1282 EXIST::FUNCTION:
1259OPENSSL_uni2asc 1283 EXIST::FUNCTION:
1260i2d_PKCS12_BAGS 1284 EXIST::FUNCTION:
1261PKCS12_BAGS_new 1285 EXIST::FUNCTION:
1262d2i_PKCS12_BAGS 1286 EXIST::FUNCTION:
1263PKCS12_BAGS_free 1287 EXIST::FUNCTION:
1264i2d_PKCS12 1288 EXIST::FUNCTION:
1265d2i_PKCS12 1289 EXIST::FUNCTION:
1266PKCS12_new 1290 EXIST::FUNCTION:
1267PKCS12_free 1291 EXIST::FUNCTION:
1268i2d_PKCS12_MAC_DATA 1292 EXIST::FUNCTION:
1269PKCS12_MAC_DATA_new 1293 EXIST::FUNCTION:
1270d2i_PKCS12_MAC_DATA 1294 EXIST::FUNCTION:
1271PKCS12_MAC_DATA_free 1295 EXIST::FUNCTION:
1272i2d_PKCS12_SAFEBAG 1296 EXIST::FUNCTION:
1273PKCS12_SAFEBAG_new 1297 EXIST::FUNCTION:
1274d2i_PKCS12_SAFEBAG 1298 EXIST::FUNCTION:
1275PKCS12_SAFEBAG_free 1299 EXIST::FUNCTION:
1276ERR_load_PKCS12_strings 1300 EXIST::FUNCTION:
1277PKCS12_PBE_add 1301 EXIST::FUNCTION:
1278PKCS8_add_keyusage 1302 EXIST::FUNCTION:
1279PKCS12_get_attr_gen 1303 EXIST::FUNCTION:
1280PKCS12_parse 1304 EXIST::FUNCTION:
1281PKCS12_create 1305 EXIST::FUNCTION:
1282i2d_PKCS12_bio 1306 EXIST::FUNCTION:
1283i2d_PKCS12_fp 1307 EXIST::FUNCTION:
1284d2i_PKCS12_bio 1308 EXIST::FUNCTION:
1285d2i_PKCS12_fp 1309 EXIST::FUNCTION:
1286i2d_PBEPARAM 1310 EXIST::FUNCTION:
1287PBEPARAM_new 1311 EXIST::FUNCTION:
1288d2i_PBEPARAM 1312 EXIST::FUNCTION:
1289PBEPARAM_free 1313 EXIST::FUNCTION:
1290i2d_PKCS8_PRIV_KEY_INFO 1314 EXIST::FUNCTION:
1291PKCS8_PRIV_KEY_INFO_new 1315 EXIST::FUNCTION:
1292d2i_PKCS8_PRIV_KEY_INFO 1316 EXIST::FUNCTION:
1293PKCS8_PRIV_KEY_INFO_free 1317 EXIST::FUNCTION:
1294EVP_PKCS82PKEY 1318 EXIST::FUNCTION:
1295EVP_PKEY2PKCS8 1319 EXIST::FUNCTION:
1296PKCS8_set_broken 1320 EXIST::FUNCTION:
1297EVP_PBE_ALGOR_CipherInit 1321 NOEXIST::FUNCTION:
1298EVP_PBE_alg_add 1322 EXIST::FUNCTION:
1299PKCS5_pbe_set 1323 EXIST::FUNCTION:
1300EVP_PBE_cleanup 1324 EXIST::FUNCTION:
1301i2d_SXNET 1325 EXIST::FUNCTION:
1302d2i_SXNET 1326 EXIST::FUNCTION:
1303SXNET_new 1327 EXIST::FUNCTION:
1304SXNET_free 1328 EXIST::FUNCTION:
1305i2d_SXNETID 1329 EXIST::FUNCTION:
1306d2i_SXNETID 1330 EXIST::FUNCTION:
1307SXNETID_new 1331 EXIST::FUNCTION:
1308SXNETID_free 1332 EXIST::FUNCTION:
1309DSA_SIG_new 1333 EXIST::FUNCTION:DSA
1310DSA_SIG_free 1334 EXIST::FUNCTION:DSA
1311DSA_do_sign 1335 EXIST::FUNCTION:DSA
1312DSA_do_verify 1336 EXIST::FUNCTION:DSA
1313d2i_DSA_SIG 1337 EXIST::FUNCTION:DSA
1314i2d_DSA_SIG 1338 EXIST::FUNCTION:DSA
1315i2d_ASN1_VISIBLESTRING 1339 EXIST::FUNCTION:
1316d2i_ASN1_VISIBLESTRING 1340 EXIST::FUNCTION:
1317i2d_ASN1_UTF8STRING 1341 EXIST::FUNCTION:
1318d2i_ASN1_UTF8STRING 1342 EXIST::FUNCTION:
1319i2d_DIRECTORYSTRING 1343 EXIST::FUNCTION:
1320d2i_DIRECTORYSTRING 1344 EXIST::FUNCTION:
1321i2d_DISPLAYTEXT 1345 EXIST::FUNCTION:
1322d2i_DISPLAYTEXT 1346 EXIST::FUNCTION:
1323d2i_ASN1_SET_OF_X509 1379 NOEXIST::FUNCTION:
1324i2d_ASN1_SET_OF_X509 1380 NOEXIST::FUNCTION:
1325i2d_PBKDF2PARAM 1397 EXIST::FUNCTION:
1326PBKDF2PARAM_new 1398 EXIST::FUNCTION:
1327d2i_PBKDF2PARAM 1399 EXIST::FUNCTION:
1328PBKDF2PARAM_free 1400 EXIST::FUNCTION:
1329i2d_PBE2PARAM 1401 EXIST::FUNCTION:
1330PBE2PARAM_new 1402 EXIST::FUNCTION:
1331d2i_PBE2PARAM 1403 EXIST::FUNCTION:
1332PBE2PARAM_free 1404 EXIST::FUNCTION:
1333d2i_ASN1_SET_OF_GENERAL_NAME 1421 NOEXIST::FUNCTION:
1334i2d_ASN1_SET_OF_GENERAL_NAME 1422 NOEXIST::FUNCTION:
1335d2i_ASN1_SET_OF_SXNETID 1439 NOEXIST::FUNCTION:
1336i2d_ASN1_SET_OF_SXNETID 1440 NOEXIST::FUNCTION:
1337d2i_ASN1_SET_OF_POLICYQUALINFO 1457 NOEXIST::FUNCTION:
1338i2d_ASN1_SET_OF_POLICYQUALINFO 1458 NOEXIST::FUNCTION:
1339d2i_ASN1_SET_OF_POLICYINFO 1475 NOEXIST::FUNCTION:
1340i2d_ASN1_SET_OF_POLICYINFO 1476 NOEXIST::FUNCTION:
1341SXNET_add_id_asc 1477 EXIST::FUNCTION:
1342SXNET_add_id_ulong 1478 EXIST::FUNCTION:
1343SXNET_add_id_INTEGER 1479 EXIST::FUNCTION:
1344SXNET_get_id_asc 1480 EXIST::FUNCTION:
1345SXNET_get_id_ulong 1481 EXIST::FUNCTION:
1346SXNET_get_id_INTEGER 1482 EXIST::FUNCTION:
1347X509V3_set_conf_lhash 1483 EXIST::FUNCTION:
1348i2d_CERTIFICATEPOLICIES 1484 EXIST::FUNCTION:
1349CERTIFICATEPOLICIES_new 1485 EXIST::FUNCTION:
1350CERTIFICATEPOLICIES_free 1486 EXIST::FUNCTION:
1351d2i_CERTIFICATEPOLICIES 1487 EXIST::FUNCTION:
1352i2d_POLICYINFO 1488 EXIST::FUNCTION:
1353POLICYINFO_new 1489 EXIST::FUNCTION:
1354d2i_POLICYINFO 1490 EXIST::FUNCTION:
1355POLICYINFO_free 1491 EXIST::FUNCTION:
1356i2d_POLICYQUALINFO 1492 EXIST::FUNCTION:
1357POLICYQUALINFO_new 1493 EXIST::FUNCTION:
1358d2i_POLICYQUALINFO 1494 EXIST::FUNCTION:
1359POLICYQUALINFO_free 1495 EXIST::FUNCTION:
1360i2d_USERNOTICE 1496 EXIST::FUNCTION:
1361USERNOTICE_new 1497 EXIST::FUNCTION:
1362d2i_USERNOTICE 1498 EXIST::FUNCTION:
1363USERNOTICE_free 1499 EXIST::FUNCTION:
1364i2d_NOTICEREF 1500 EXIST::FUNCTION:
1365NOTICEREF_new 1501 EXIST::FUNCTION:
1366d2i_NOTICEREF 1502 EXIST::FUNCTION:
1367NOTICEREF_free 1503 EXIST::FUNCTION:
1368X509V3_get_string 1504 EXIST::FUNCTION:
1369X509V3_get_section 1505 EXIST::FUNCTION:
1370X509V3_string_free 1506 EXIST::FUNCTION:
1371X509V3_section_free 1507 EXIST::FUNCTION:
1372X509V3_set_ctx 1508 EXIST::FUNCTION:
1373s2i_ASN1_INTEGER 1509 EXIST::FUNCTION:
1374CRYPTO_set_locked_mem_functions 1510 EXIST::FUNCTION:
1375CRYPTO_get_locked_mem_functions 1511 EXIST::FUNCTION:
1376CRYPTO_malloc_locked 1512 EXIST::FUNCTION:
1377CRYPTO_free_locked 1513 EXIST::FUNCTION:
1378BN_mod_exp2_mont 1514 EXIST::FUNCTION:
1379ERR_get_error_line_data 1515 EXIST::FUNCTION:
1380ERR_peek_error_line_data 1516 EXIST::FUNCTION:
1381PKCS12_PBE_keyivgen 1517 EXIST::FUNCTION:
1382X509_ALGOR_dup 1518 EXIST::FUNCTION:
1383d2i_ASN1_SET_OF_DIST_POINT 1535 NOEXIST::FUNCTION:
1384i2d_ASN1_SET_OF_DIST_POINT 1536 NOEXIST::FUNCTION:
1385i2d_CRL_DIST_POINTS 1537 EXIST::FUNCTION:
1386CRL_DIST_POINTS_new 1538 EXIST::FUNCTION:
1387CRL_DIST_POINTS_free 1539 EXIST::FUNCTION:
1388d2i_CRL_DIST_POINTS 1540 EXIST::FUNCTION:
1389i2d_DIST_POINT 1541 EXIST::FUNCTION:
1390DIST_POINT_new 1542 EXIST::FUNCTION:
1391d2i_DIST_POINT 1543 EXIST::FUNCTION:
1392DIST_POINT_free 1544 EXIST::FUNCTION:
1393i2d_DIST_POINT_NAME 1545 EXIST::FUNCTION:
1394DIST_POINT_NAME_new 1546 EXIST::FUNCTION:
1395DIST_POINT_NAME_free 1547 EXIST::FUNCTION:
1396d2i_DIST_POINT_NAME 1548 EXIST::FUNCTION:
1397X509V3_add_value_uchar 1549 EXIST::FUNCTION:
1398d2i_ASN1_SET_OF_X509_ATTRIBUTE 1555 NOEXIST::FUNCTION:
1399i2d_ASN1_SET_OF_ASN1_TYPE 1560 NOEXIST::FUNCTION:
1400d2i_ASN1_SET_OF_X509_EXTENSION 1567 NOEXIST::FUNCTION:
1401d2i_ASN1_SET_OF_X509_NAME_ENTRY 1574 NOEXIST::FUNCTION:
1402d2i_ASN1_SET_OF_ASN1_TYPE 1589 NOEXIST::FUNCTION:
1403i2d_ASN1_SET_OF_X509_ATTRIBUTE 1615 NOEXIST::FUNCTION:
1404i2d_ASN1_SET_OF_X509_EXTENSION 1624 NOEXIST::FUNCTION:
1405i2d_ASN1_SET_OF_X509_NAME_ENTRY 1633 NOEXIST::FUNCTION:
1406X509V3_EXT_i2d 1646 EXIST::FUNCTION:
1407X509V3_EXT_val_prn 1647 EXIST::FUNCTION:
1408X509V3_EXT_add_list 1648 EXIST::FUNCTION:
1409EVP_CIPHER_type 1649 EXIST::FUNCTION:
1410EVP_PBE_CipherInit 1650 EXIST::FUNCTION:
1411X509V3_add_value_bool_nf 1651 EXIST::FUNCTION:
1412d2i_ASN1_UINTEGER 1652 EXIST::FUNCTION:
1413sk_value 1653 EXIST::FUNCTION:
1414sk_num 1654 EXIST::FUNCTION:
1415sk_set 1655 EXIST::FUNCTION:
1416i2d_ASN1_SET_OF_X509_REVOKED 1661 NOEXIST::FUNCTION:
1417sk_sort 1671 EXIST::FUNCTION:
1418d2i_ASN1_SET_OF_X509_REVOKED 1674 NOEXIST::FUNCTION:
1419i2d_ASN1_SET_OF_X509_ALGOR 1682 NOEXIST::FUNCTION:
1420i2d_ASN1_SET_OF_X509_CRL 1685 NOEXIST::FUNCTION:
1421d2i_ASN1_SET_OF_X509_ALGOR 1696 NOEXIST::FUNCTION:
1422d2i_ASN1_SET_OF_X509_CRL 1702 NOEXIST::FUNCTION:
1423i2d_ASN1_SET_OF_PKCS7_SIGNER_INFO 1723 NOEXIST::FUNCTION:
1424i2d_ASN1_SET_OF_PKCS7_RECIP_INFO 1738 NOEXIST::FUNCTION:
1425d2i_ASN1_SET_OF_PKCS7_SIGNER_INFO 1748 NOEXIST::FUNCTION:
1426d2i_ASN1_SET_OF_PKCS7_RECIP_INFO 1753 NOEXIST::FUNCTION:
1427PKCS5_PBE_add 1775 EXIST::FUNCTION:
1428PEM_write_bio_PKCS8 1776 EXIST::FUNCTION:
1429i2d_PKCS8_fp 1777 EXIST::FUNCTION:FP_API
1430PEM_read_bio_PKCS8_PRIV_KEY_INFO 1778 EXIST:!VMS:FUNCTION:
1431PEM_read_bio_P8_PRIV_KEY_INFO 1778 EXIST:VMS:FUNCTION:
1432d2i_PKCS8_bio 1779 EXIST::FUNCTION:BIO
1433d2i_PKCS8_PRIV_KEY_INFO_fp 1780 EXIST::FUNCTION:FP_API
1434PEM_write_bio_PKCS8_PRIV_KEY_INFO 1781 EXIST:!VMS:FUNCTION:
1435PEM_write_bio_P8_PRIV_KEY_INFO 1781 EXIST:VMS:FUNCTION:
1436PEM_read_PKCS8 1782 EXIST:!WIN16:FUNCTION:
1437d2i_PKCS8_PRIV_KEY_INFO_bio 1783 EXIST::FUNCTION:BIO
1438d2i_PKCS8_fp 1784 EXIST::FUNCTION:FP_API
1439PEM_write_PKCS8 1785 EXIST:!WIN16:FUNCTION:
1440PEM_read_PKCS8_PRIV_KEY_INFO 1786 EXIST:!VMS,!WIN16:FUNCTION:
1441PEM_read_P8_PRIV_KEY_INFO 1786 EXIST:VMS:FUNCTION:
1442PEM_read_bio_PKCS8 1787 EXIST::FUNCTION:
1443PEM_write_PKCS8_PRIV_KEY_INFO 1788 EXIST:!VMS,!WIN16:FUNCTION:
1444PEM_write_P8_PRIV_KEY_INFO 1788 EXIST:VMS:FUNCTION:
1445PKCS5_PBE_keyivgen 1789 EXIST::FUNCTION:
1446i2d_PKCS8_bio 1790 EXIST::FUNCTION:BIO
1447i2d_PKCS8_PRIV_KEY_INFO_fp 1791 EXIST::FUNCTION:FP_API
1448i2d_PKCS8_PRIV_KEY_INFO_bio 1792 EXIST::FUNCTION:BIO
1449BIO_s_bio 1793 EXIST::FUNCTION:
1450PKCS5_pbe2_set 1794 EXIST::FUNCTION:
1451PKCS5_PBKDF2_HMAC_SHA1 1795 EXIST::FUNCTION:
1452PKCS5_v2_PBE_keyivgen 1796 EXIST::FUNCTION:
1453PEM_write_bio_PKCS8PrivateKey 1797 EXIST::FUNCTION:
1454PEM_write_PKCS8PrivateKey 1798 EXIST::FUNCTION:
1455BIO_ctrl_get_read_request 1799 EXIST::FUNCTION:
1456BIO_ctrl_pending 1800 EXIST::FUNCTION:
1457BIO_ctrl_wpending 1801 EXIST::FUNCTION:
1458BIO_new_bio_pair 1802 EXIST::FUNCTION:
1459BIO_ctrl_get_write_guarantee 1803 EXIST::FUNCTION:
1460CRYPTO_num_locks 1804 EXIST::FUNCTION:
1461CONF_load_bio 1805 EXIST::FUNCTION:
1462CONF_load_fp 1806 EXIST::FUNCTION:FP_API
1463i2d_ASN1_SET_OF_ASN1_OBJECT 1837 NOEXIST::FUNCTION:
1464d2i_ASN1_SET_OF_ASN1_OBJECT 1844 NOEXIST::FUNCTION:
1465PKCS7_signatureVerify 1845 EXIST::FUNCTION:
1466RSA_set_method 1846 EXIST::FUNCTION:RSA
1467RSA_get_method 1847 EXIST::FUNCTION:RSA
1468RSA_get_default_method 1848 EXIST::FUNCTION:RSA
1469RSA_check_key 1869 EXIST::FUNCTION:RSA
1470OBJ_obj2txt 1870 EXIST::FUNCTION:
1471DSA_dup_DH 1871 EXIST::FUNCTION:DH,DSA
1472X509_REQ_get_extensions 1872 EXIST::FUNCTION:
1473X509_REQ_set_extension_nids 1873 EXIST::FUNCTION:
1474BIO_nwrite 1874 EXIST::FUNCTION:
1475X509_REQ_extension_nid 1875 EXIST::FUNCTION:
1476BIO_nread 1876 EXIST::FUNCTION:
1477X509_REQ_get_extension_nids 1877 EXIST::FUNCTION:
1478BIO_nwrite0 1878 EXIST::FUNCTION:
1479X509_REQ_add_extensions_nid 1879 EXIST::FUNCTION:
1480BIO_nread0 1880 EXIST::FUNCTION:
1481X509_REQ_add_extensions 1881 EXIST::FUNCTION:
1482BIO_new_mem_buf 1882 EXIST::FUNCTION:
1483DH_set_ex_data 1883 EXIST::FUNCTION:DH
1484DH_set_method 1884 EXIST::FUNCTION:DH
1485DSA_OpenSSL 1885 EXIST::FUNCTION:DSA
1486DH_get_ex_data 1886 EXIST::FUNCTION:DH
1487DH_get_ex_new_index 1887 EXIST::FUNCTION:DH
1488DSA_new_method 1888 EXIST::FUNCTION:DSA
1489DH_new_method 1889 EXIST::FUNCTION:DH
1490DH_OpenSSL 1890 EXIST::FUNCTION:DH
1491DSA_get_ex_new_index 1891 EXIST::FUNCTION:DSA
1492DH_get_default_method 1892 EXIST::FUNCTION:DH
1493DSA_set_ex_data 1893 EXIST::FUNCTION:DSA
1494DH_set_default_method 1894 EXIST::FUNCTION:DH
1495DSA_get_ex_data 1895 EXIST::FUNCTION:DSA
1496X509V3_EXT_REQ_add_conf 1896 EXIST::FUNCTION:
1497NETSCAPE_SPKI_print 1897 EXIST::FUNCTION:EVP
1498NETSCAPE_SPKI_set_pubkey 1898 EXIST::FUNCTION:EVP
1499NETSCAPE_SPKI_b64_encode 1899 EXIST::FUNCTION:EVP
1500NETSCAPE_SPKI_get_pubkey 1900 EXIST::FUNCTION:EVP
1501NETSCAPE_SPKI_b64_decode 1901 EXIST::FUNCTION:EVP
1502UTF8_putc 1902 EXIST::FUNCTION:
1503UTF8_getc 1903 EXIST::FUNCTION:
1504RSA_null_method 1904 EXIST::FUNCTION:RSA
1505ASN1_tag2str 1905 EXIST::FUNCTION:
1506BIO_ctrl_reset_read_request 1906 EXIST::FUNCTION:
1507DISPLAYTEXT_new 1907 EXIST::FUNCTION:
1508ASN1_GENERALIZEDTIME_free 1908 EXIST::FUNCTION:
1509X509_REVOKED_get_ext_d2i 1909 EXIST::FUNCTION:
1510X509_set_ex_data 1910 EXIST::FUNCTION:
1511X509_reject_set_bit_asc 1911 NOEXIST::FUNCTION:
1512X509_NAME_add_entry_by_txt 1912 EXIST::FUNCTION:
1513X509_NAME_add_entry_by_NID 1914 EXIST::FUNCTION:
1514X509_PURPOSE_get0 1915 EXIST::FUNCTION:
1515PEM_read_X509_AUX 1917 EXIST:!WIN16:FUNCTION:
1516d2i_AUTHORITY_INFO_ACCESS 1918 EXIST::FUNCTION:
1517PEM_write_PUBKEY 1921 EXIST:!WIN16:FUNCTION:
1518ACCESS_DESCRIPTION_new 1925 EXIST::FUNCTION:
1519X509_CERT_AUX_free 1926 EXIST::FUNCTION:
1520d2i_ACCESS_DESCRIPTION 1927 EXIST::FUNCTION:
1521X509_trust_clear 1928 EXIST::FUNCTION:
1522X509_TRUST_add 1931 EXIST::FUNCTION:
1523ASN1_VISIBLESTRING_new 1932 EXIST::FUNCTION:
1524X509_alias_set1 1933 EXIST::FUNCTION:
1525ASN1_PRINTABLESTRING_free 1934 EXIST::FUNCTION:
1526EVP_PKEY_get1_DSA 1935 EXIST::FUNCTION:DSA
1527ASN1_BMPSTRING_new 1936 EXIST::FUNCTION:
1528ASN1_mbstring_copy 1937 EXIST::FUNCTION:
1529ASN1_UTF8STRING_new 1938 EXIST::FUNCTION:
1530DSA_get_default_method 1941 EXIST::FUNCTION:DSA
1531i2d_ASN1_SET_OF_ACCESS_DESCRIPTION 1945 NOEXIST::FUNCTION:
1532ASN1_T61STRING_free 1946 EXIST::FUNCTION:
1533DSA_set_method 1949 EXIST::FUNCTION:DSA
1534X509_get_ex_data 1950 EXIST::FUNCTION:
1535ASN1_STRING_type 1951 EXIST::FUNCTION:
1536X509_PURPOSE_get_by_sname 1952 EXIST::FUNCTION:
1537ASN1_TIME_free 1954 EXIST::FUNCTION:
1538ASN1_OCTET_STRING_cmp 1955 EXIST::FUNCTION:
1539ASN1_BIT_STRING_new 1957 EXIST::FUNCTION:
1540X509_get_ext_d2i 1958 EXIST::FUNCTION:
1541PEM_read_bio_X509_AUX 1959 EXIST::FUNCTION:
1542ASN1_STRING_set_default_mask_asc 1960 EXIST:!VMS:FUNCTION:
1543ASN1_STRING_set_def_mask_asc 1960 EXIST:VMS:FUNCTION:
1544PEM_write_bio_RSA_PUBKEY 1961 EXIST::FUNCTION:RSA
1545ASN1_INTEGER_cmp 1963 EXIST::FUNCTION:
1546d2i_RSA_PUBKEY_fp 1964 EXIST::FUNCTION:FP_API,RSA
1547X509_trust_set_bit_asc 1967 NOEXIST::FUNCTION:
1548PEM_write_bio_DSA_PUBKEY 1968 EXIST::FUNCTION:DSA
1549X509_STORE_CTX_free 1969 EXIST::FUNCTION:
1550EVP_PKEY_set1_DSA 1970 EXIST::FUNCTION:DSA
1551i2d_DSA_PUBKEY_fp 1971 EXIST::FUNCTION:DSA,FP_API
1552X509_load_cert_crl_file 1972 EXIST::FUNCTION:STDIO
1553ASN1_TIME_new 1973 EXIST::FUNCTION:
1554i2d_RSA_PUBKEY 1974 EXIST::FUNCTION:RSA
1555X509_STORE_CTX_purpose_inherit 1976 EXIST::FUNCTION:
1556PEM_read_RSA_PUBKEY 1977 EXIST:!WIN16:FUNCTION:RSA
1557d2i_X509_AUX 1980 EXIST::FUNCTION:
1558i2d_DSA_PUBKEY 1981 EXIST::FUNCTION:DSA
1559X509_CERT_AUX_print 1982 EXIST::FUNCTION:BIO
1560PEM_read_DSA_PUBKEY 1984 EXIST:!WIN16:FUNCTION:DSA
1561i2d_RSA_PUBKEY_bio 1985 EXIST::FUNCTION:BIO,RSA
1562ASN1_BIT_STRING_num_asc 1986 EXIST::FUNCTION:
1563i2d_PUBKEY 1987 EXIST::FUNCTION:
1564ASN1_UTCTIME_free 1988 EXIST::FUNCTION:
1565DSA_set_default_method 1989 EXIST::FUNCTION:DSA
1566X509_PURPOSE_get_by_id 1990 EXIST::FUNCTION:
1567ACCESS_DESCRIPTION_free 1994 EXIST::FUNCTION:
1568PEM_read_bio_PUBKEY 1995 EXIST::FUNCTION:
1569ASN1_STRING_set_by_NID 1996 EXIST::FUNCTION:
1570X509_PURPOSE_get_id 1997 EXIST::FUNCTION:
1571DISPLAYTEXT_free 1998 EXIST::FUNCTION:
1572OTHERNAME_new 1999 EXIST::FUNCTION:
1573X509_CERT_AUX_new 2001 EXIST::FUNCTION:
1574X509_TRUST_cleanup 2007 EXIST::FUNCTION:
1575X509_NAME_add_entry_by_OBJ 2008 EXIST::FUNCTION:
1576X509_CRL_get_ext_d2i 2009 EXIST::FUNCTION:
1577X509_PURPOSE_get0_name 2011 EXIST::FUNCTION:
1578PEM_read_PUBKEY 2012 EXIST:!WIN16:FUNCTION:
1579i2d_DSA_PUBKEY_bio 2014 EXIST::FUNCTION:BIO,DSA
1580i2d_OTHERNAME 2015 EXIST::FUNCTION:
1581ASN1_OCTET_STRING_free 2016 EXIST::FUNCTION:
1582ASN1_BIT_STRING_set_asc 2017 EXIST::FUNCTION:
1583X509_get_ex_new_index 2019 EXIST::FUNCTION:
1584ASN1_STRING_TABLE_cleanup 2020 EXIST::FUNCTION:
1585X509_TRUST_get_by_id 2021 EXIST::FUNCTION:
1586X509_PURPOSE_get_trust 2022 EXIST::FUNCTION:
1587ASN1_STRING_length 2023 EXIST::FUNCTION:
1588d2i_ASN1_SET_OF_ACCESS_DESCRIPTION 2024 NOEXIST::FUNCTION:
1589ASN1_PRINTABLESTRING_new 2025 EXIST::FUNCTION:
1590X509V3_get_d2i 2026 EXIST::FUNCTION:
1591ASN1_ENUMERATED_free 2027 EXIST::FUNCTION:
1592i2d_X509_CERT_AUX 2028 EXIST::FUNCTION:
1593X509_STORE_CTX_set_trust 2030 EXIST::FUNCTION:
1594ASN1_STRING_set_default_mask 2032 EXIST::FUNCTION:
1595X509_STORE_CTX_new 2033 EXIST::FUNCTION:
1596EVP_PKEY_get1_RSA 2034 EXIST::FUNCTION:RSA
1597DIRECTORYSTRING_free 2038 EXIST::FUNCTION:
1598PEM_write_X509_AUX 2039 EXIST:!WIN16:FUNCTION:
1599ASN1_OCTET_STRING_set 2040 EXIST::FUNCTION:
1600d2i_DSA_PUBKEY_fp 2041 EXIST::FUNCTION:DSA,FP_API
1601d2i_RSA_PUBKEY 2044 EXIST::FUNCTION:RSA
1602X509_TRUST_get0_name 2046 EXIST::FUNCTION:
1603X509_TRUST_get0 2047 EXIST::FUNCTION:
1604AUTHORITY_INFO_ACCESS_free 2048 EXIST::FUNCTION:
1605ASN1_IA5STRING_new 2049 EXIST::FUNCTION:
1606d2i_DSA_PUBKEY 2050 EXIST::FUNCTION:DSA
1607X509_check_purpose 2051 EXIST::FUNCTION:
1608ASN1_ENUMERATED_new 2052 EXIST::FUNCTION:
1609d2i_RSA_PUBKEY_bio 2053 EXIST::FUNCTION:BIO,RSA
1610d2i_PUBKEY 2054 EXIST::FUNCTION:
1611X509_TRUST_get_trust 2055 EXIST::FUNCTION:
1612X509_TRUST_get_flags 2056 EXIST::FUNCTION:
1613ASN1_BMPSTRING_free 2057 EXIST::FUNCTION:
1614ASN1_T61STRING_new 2058 EXIST::FUNCTION:
1615ASN1_UTCTIME_new 2060 EXIST::FUNCTION:
1616i2d_AUTHORITY_INFO_ACCESS 2062 EXIST::FUNCTION:
1617EVP_PKEY_set1_RSA 2063 EXIST::FUNCTION:RSA
1618X509_STORE_CTX_set_purpose 2064 EXIST::FUNCTION:
1619ASN1_IA5STRING_free 2065 EXIST::FUNCTION:
1620PEM_write_bio_X509_AUX 2066 EXIST::FUNCTION:
1621X509_PURPOSE_get_count 2067 EXIST::FUNCTION:
1622CRYPTO_add_info 2068 NOEXIST::FUNCTION:
1623X509_NAME_ENTRY_create_by_txt 2071 EXIST::FUNCTION:
1624ASN1_STRING_get_default_mask 2072 EXIST::FUNCTION:
1625X509_alias_get0 2074 EXIST::FUNCTION:
1626ASN1_STRING_data 2075 EXIST::FUNCTION:
1627i2d_ACCESS_DESCRIPTION 2077 EXIST::FUNCTION:
1628X509_trust_set_bit 2078 NOEXIST::FUNCTION:
1629ASN1_BIT_STRING_free 2080 EXIST::FUNCTION:
1630PEM_read_bio_RSA_PUBKEY 2081 EXIST::FUNCTION:RSA
1631X509_add1_reject_object 2082 EXIST::FUNCTION:
1632X509_check_trust 2083 EXIST::FUNCTION:
1633PEM_read_bio_DSA_PUBKEY 2088 EXIST::FUNCTION:DSA
1634X509_PURPOSE_add 2090 EXIST::FUNCTION:
1635ASN1_STRING_TABLE_get 2091 EXIST::FUNCTION:
1636ASN1_UTF8STRING_free 2092 EXIST::FUNCTION:
1637d2i_DSA_PUBKEY_bio 2093 EXIST::FUNCTION:BIO,DSA
1638PEM_write_RSA_PUBKEY 2095 EXIST:!WIN16:FUNCTION:RSA
1639d2i_OTHERNAME 2096 EXIST::FUNCTION:
1640X509_reject_set_bit 2098 NOEXIST::FUNCTION:
1641PEM_write_DSA_PUBKEY 2101 EXIST:!WIN16:FUNCTION:DSA
1642X509_PURPOSE_get0_sname 2105 EXIST::FUNCTION:
1643EVP_PKEY_set1_DH 2107 EXIST::FUNCTION:DH
1644ASN1_OCTET_STRING_dup 2108 EXIST::FUNCTION:
1645ASN1_BIT_STRING_set 2109 EXIST::FUNCTION:
1646X509_TRUST_get_count 2110 EXIST::FUNCTION:
1647ASN1_INTEGER_free 2111 EXIST::FUNCTION:
1648OTHERNAME_free 2112 EXIST::FUNCTION:
1649i2d_RSA_PUBKEY_fp 2113 EXIST::FUNCTION:FP_API,RSA
1650ASN1_INTEGER_dup 2114 EXIST::FUNCTION:
1651d2i_X509_CERT_AUX 2115 EXIST::FUNCTION:
1652PEM_write_bio_PUBKEY 2117 EXIST::FUNCTION:
1653ASN1_VISIBLESTRING_free 2118 EXIST::FUNCTION:
1654X509_PURPOSE_cleanup 2119 EXIST::FUNCTION:
1655ASN1_mbstring_ncopy 2123 EXIST::FUNCTION:
1656ASN1_GENERALIZEDTIME_new 2126 EXIST::FUNCTION:
1657EVP_PKEY_get1_DH 2128 EXIST::FUNCTION:DH
1658ASN1_OCTET_STRING_new 2130 EXIST::FUNCTION:
1659ASN1_INTEGER_new 2131 EXIST::FUNCTION:
1660i2d_X509_AUX 2132 EXIST::FUNCTION:
1661ASN1_BIT_STRING_name_print 2134 EXIST::FUNCTION:BIO
1662X509_cmp 2135 EXIST::FUNCTION:
1663ASN1_STRING_length_set 2136 EXIST::FUNCTION:
1664DIRECTORYSTRING_new 2137 EXIST::FUNCTION:
1665X509_add1_trust_object 2140 EXIST::FUNCTION:
1666PKCS12_newpass 2141 EXIST::FUNCTION:
1667SMIME_write_PKCS7 2142 EXIST::FUNCTION:
1668SMIME_read_PKCS7 2143 EXIST::FUNCTION:
1669DES_set_key_checked 2144 EXIST::FUNCTION:DES
1670PKCS7_verify 2145 EXIST::FUNCTION:
1671PKCS7_encrypt 2146 EXIST::FUNCTION:
1672DES_set_key_unchecked 2147 EXIST::FUNCTION:DES
1673SMIME_crlf_copy 2148 EXIST::FUNCTION:
1674i2d_ASN1_PRINTABLESTRING 2149 EXIST::FUNCTION:
1675PKCS7_get0_signers 2150 EXIST::FUNCTION:
1676PKCS7_decrypt 2151 EXIST::FUNCTION:
1677SMIME_text 2152 EXIST::FUNCTION:
1678PKCS7_simple_smimecap 2153 EXIST::FUNCTION:
1679PKCS7_get_smimecap 2154 EXIST::FUNCTION:
1680PKCS7_sign 2155 EXIST::FUNCTION:
1681PKCS7_add_attrib_smimecap 2156 EXIST::FUNCTION:
1682CRYPTO_dbg_set_options 2157 EXIST::FUNCTION:
1683CRYPTO_remove_all_info 2158 EXIST::FUNCTION:
1684CRYPTO_get_mem_debug_functions 2159 EXIST::FUNCTION:
1685CRYPTO_is_mem_check_on 2160 EXIST::FUNCTION:
1686CRYPTO_set_mem_debug_functions 2161 EXIST::FUNCTION:
1687CRYPTO_pop_info 2162 EXIST::FUNCTION:
1688CRYPTO_push_info_ 2163 EXIST::FUNCTION:
1689CRYPTO_set_mem_debug_options 2164 EXIST::FUNCTION:
1690PEM_write_PKCS8PrivateKey_nid 2165 EXIST::FUNCTION:
1691PEM_write_bio_PKCS8PrivateKey_nid 2166 EXIST:!VMS:FUNCTION:
1692PEM_write_bio_PKCS8PrivKey_nid 2166 EXIST:VMS:FUNCTION:
1693d2i_PKCS8PrivateKey_bio 2167 EXIST::FUNCTION:
1694ASN1_NULL_free 2168 EXIST::FUNCTION:
1695d2i_ASN1_NULL 2169 EXIST::FUNCTION:
1696ASN1_NULL_new 2170 EXIST::FUNCTION:
1697i2d_PKCS8PrivateKey_bio 2171 EXIST::FUNCTION:
1698i2d_PKCS8PrivateKey_fp 2172 EXIST::FUNCTION:
1699i2d_ASN1_NULL 2173 EXIST::FUNCTION:
1700i2d_PKCS8PrivateKey_nid_fp 2174 EXIST::FUNCTION:
1701d2i_PKCS8PrivateKey_fp 2175 EXIST::FUNCTION:
1702i2d_PKCS8PrivateKey_nid_bio 2176 EXIST::FUNCTION:
1703i2d_PKCS8PrivateKeyInfo_fp 2177 EXIST::FUNCTION:FP_API
1704i2d_PKCS8PrivateKeyInfo_bio 2178 EXIST::FUNCTION:BIO
1705PEM_cb 2179 NOEXIST::FUNCTION:
1706i2d_PrivateKey_fp 2180 EXIST::FUNCTION:FP_API
1707d2i_PrivateKey_bio 2181 EXIST::FUNCTION:BIO
1708d2i_PrivateKey_fp 2182 EXIST::FUNCTION:FP_API
1709i2d_PrivateKey_bio 2183 EXIST::FUNCTION:BIO
1710X509_reject_clear 2184 EXIST::FUNCTION:
1711X509_TRUST_set_default 2185 EXIST::FUNCTION:
1712d2i_AutoPrivateKey 2186 EXIST::FUNCTION:
1713X509_ATTRIBUTE_get0_type 2187 EXIST::FUNCTION:
1714X509_ATTRIBUTE_set1_data 2188 EXIST::FUNCTION:
1715X509at_get_attr 2189 EXIST::FUNCTION:
1716X509at_get_attr_count 2190 EXIST::FUNCTION:
1717X509_ATTRIBUTE_create_by_NID 2191 EXIST::FUNCTION:
1718X509_ATTRIBUTE_set1_object 2192 EXIST::FUNCTION:
1719X509_ATTRIBUTE_count 2193 EXIST::FUNCTION:
1720X509_ATTRIBUTE_create_by_OBJ 2194 EXIST::FUNCTION:
1721X509_ATTRIBUTE_get0_object 2195 EXIST::FUNCTION:
1722X509at_get_attr_by_NID 2196 EXIST::FUNCTION:
1723X509at_add1_attr 2197 EXIST::FUNCTION:
1724X509_ATTRIBUTE_get0_data 2198 EXIST::FUNCTION:
1725X509at_delete_attr 2199 EXIST::FUNCTION:
1726X509at_get_attr_by_OBJ 2200 EXIST::FUNCTION:
1727RAND_add 2201 EXIST::FUNCTION:
1728BIO_number_written 2202 EXIST::FUNCTION:
1729BIO_number_read 2203 EXIST::FUNCTION:
1730X509_STORE_CTX_get1_chain 2204 EXIST::FUNCTION:
1731ERR_load_RAND_strings 2205 EXIST::FUNCTION:
1732RAND_pseudo_bytes 2206 EXIST::FUNCTION:
1733X509_REQ_get_attr_by_NID 2207 EXIST::FUNCTION:
1734X509_REQ_get_attr 2208 EXIST::FUNCTION:
1735X509_REQ_add1_attr_by_NID 2209 EXIST::FUNCTION:
1736X509_REQ_get_attr_by_OBJ 2210 EXIST::FUNCTION:
1737X509at_add1_attr_by_NID 2211 EXIST::FUNCTION:
1738X509_REQ_add1_attr_by_OBJ 2212 EXIST::FUNCTION:
1739X509_REQ_get_attr_count 2213 EXIST::FUNCTION:
1740X509_REQ_add1_attr 2214 EXIST::FUNCTION:
1741X509_REQ_delete_attr 2215 EXIST::FUNCTION:
1742X509at_add1_attr_by_OBJ 2216 EXIST::FUNCTION:
1743X509_REQ_add1_attr_by_txt 2217 EXIST::FUNCTION:
1744X509_ATTRIBUTE_create_by_txt 2218 EXIST::FUNCTION:
1745X509at_add1_attr_by_txt 2219 EXIST::FUNCTION:
1746BN_pseudo_rand 2239 EXIST::FUNCTION:
1747BN_is_prime_fasttest 2240 EXIST::FUNCTION:DEPRECATED
1748BN_CTX_end 2241 EXIST::FUNCTION:
1749BN_CTX_start 2242 EXIST::FUNCTION:
1750BN_CTX_get 2243 EXIST::FUNCTION:
1751EVP_PKEY2PKCS8_broken 2244 EXIST::FUNCTION:
1752ASN1_STRING_TABLE_add 2245 EXIST::FUNCTION:
1753CRYPTO_dbg_get_options 2246 EXIST::FUNCTION:
1754AUTHORITY_INFO_ACCESS_new 2247 EXIST::FUNCTION:
1755CRYPTO_get_mem_debug_options 2248 EXIST::FUNCTION:
1756DES_crypt 2249 EXIST::FUNCTION:DES
1757PEM_write_bio_X509_REQ_NEW 2250 EXIST::FUNCTION:
1758PEM_write_X509_REQ_NEW 2251 EXIST:!WIN16:FUNCTION:
1759BIO_callback_ctrl 2252 EXIST::FUNCTION:
1760RAND_egd 2253 EXIST::FUNCTION:
1761RAND_status 2254 EXIST::FUNCTION:
1762bn_dump1 2255 NOEXIST::FUNCTION:
1763DES_check_key_parity 2256 EXIST::FUNCTION:DES
1764lh_num_items 2257 EXIST::FUNCTION:
1765RAND_event 2258 EXIST:WIN32:FUNCTION:
1766DSO_new 2259 EXIST::FUNCTION:
1767DSO_new_method 2260 EXIST::FUNCTION:
1768DSO_free 2261 EXIST::FUNCTION:
1769DSO_flags 2262 EXIST::FUNCTION:
1770DSO_up 2263 NOEXIST::FUNCTION:
1771DSO_set_default_method 2264 EXIST::FUNCTION:
1772DSO_get_default_method 2265 EXIST::FUNCTION:
1773DSO_get_method 2266 EXIST::FUNCTION:
1774DSO_set_method 2267 EXIST::FUNCTION:
1775DSO_load 2268 EXIST::FUNCTION:
1776DSO_bind_var 2269 EXIST::FUNCTION:
1777DSO_METHOD_null 2270 EXIST::FUNCTION:
1778DSO_METHOD_openssl 2271 EXIST::FUNCTION:
1779DSO_METHOD_dlfcn 2272 EXIST::FUNCTION:
1780DSO_METHOD_win32 2273 EXIST::FUNCTION:
1781ERR_load_DSO_strings 2274 EXIST::FUNCTION:
1782DSO_METHOD_dl 2275 EXIST::FUNCTION:
1783NCONF_load 2276 EXIST::FUNCTION:
1784NCONF_load_fp 2278 EXIST::FUNCTION:FP_API
1785NCONF_new 2279 EXIST::FUNCTION:
1786NCONF_get_string 2280 EXIST::FUNCTION:
1787NCONF_free 2281 EXIST::FUNCTION:
1788NCONF_get_number 2282 NOEXIST::FUNCTION:
1789CONF_dump_fp 2283 EXIST::FUNCTION:
1790NCONF_load_bio 2284 EXIST::FUNCTION:
1791NCONF_dump_fp 2285 EXIST::FUNCTION:
1792NCONF_get_section 2286 EXIST::FUNCTION:
1793NCONF_dump_bio 2287 EXIST::FUNCTION:
1794CONF_dump_bio 2288 EXIST::FUNCTION:
1795NCONF_free_data 2289 EXIST::FUNCTION:
1796CONF_set_default_method 2290 EXIST::FUNCTION:
1797ERR_error_string_n 2291 EXIST::FUNCTION:
1798BIO_snprintf 2292 EXIST::FUNCTION:
1799DSO_ctrl 2293 EXIST::FUNCTION:
1800i2d_ASN1_SET_OF_ASN1_INTEGER 2317 NOEXIST::FUNCTION:
1801i2d_ASN1_SET_OF_PKCS12_SAFEBAG 2320 NOEXIST::FUNCTION:
1802i2d_ASN1_SET_OF_PKCS7 2328 NOEXIST::FUNCTION:
1803BIO_vfree 2334 EXIST::FUNCTION:
1804d2i_ASN1_SET_OF_ASN1_INTEGER 2339 NOEXIST::FUNCTION:
1805d2i_ASN1_SET_OF_PKCS12_SAFEBAG 2341 NOEXIST::FUNCTION:
1806ASN1_UTCTIME_get 2350 NOEXIST::FUNCTION:
1807X509_REQ_digest 2362 EXIST::FUNCTION:EVP
1808X509_CRL_digest 2391 EXIST::FUNCTION:EVP
1809d2i_ASN1_SET_OF_PKCS7 2397 NOEXIST::FUNCTION:
1810EVP_CIPHER_CTX_set_key_length 2399 EXIST::FUNCTION:
1811EVP_CIPHER_CTX_ctrl 2400 EXIST::FUNCTION:
1812BN_mod_exp_mont_word 2401 EXIST::FUNCTION:
1813RAND_egd_bytes 2402 EXIST::FUNCTION:
1814X509_REQ_get1_email 2403 EXIST::FUNCTION:
1815X509_get1_email 2404 EXIST::FUNCTION:
1816X509_email_free 2405 EXIST::FUNCTION:
1817i2d_RSA_NET 2406 EXIST::FUNCTION:RC4,RSA
1818d2i_RSA_NET_2 2407 NOEXIST::FUNCTION:
1819d2i_RSA_NET 2408 EXIST::FUNCTION:RC4,RSA
1820DSO_bind_func 2409 EXIST::FUNCTION:
1821CRYPTO_get_new_dynlockid 2410 EXIST::FUNCTION:
1822sk_new_null 2411 EXIST::FUNCTION:
1823CRYPTO_set_dynlock_destroy_callback 2412 EXIST:!VMS:FUNCTION:
1824CRYPTO_set_dynlock_destroy_cb 2412 EXIST:VMS:FUNCTION:
1825CRYPTO_destroy_dynlockid 2413 EXIST::FUNCTION:
1826CRYPTO_set_dynlock_size 2414 NOEXIST::FUNCTION:
1827CRYPTO_set_dynlock_create_callback 2415 EXIST:!VMS:FUNCTION:
1828CRYPTO_set_dynlock_create_cb 2415 EXIST:VMS:FUNCTION:
1829CRYPTO_set_dynlock_lock_callback 2416 EXIST:!VMS:FUNCTION:
1830CRYPTO_set_dynlock_lock_cb 2416 EXIST:VMS:FUNCTION:
1831CRYPTO_get_dynlock_lock_callback 2417 EXIST:!VMS:FUNCTION:
1832CRYPTO_get_dynlock_lock_cb 2417 EXIST:VMS:FUNCTION:
1833CRYPTO_get_dynlock_destroy_callback 2418 EXIST:!VMS:FUNCTION:
1834CRYPTO_get_dynlock_destroy_cb 2418 EXIST:VMS:FUNCTION:
1835CRYPTO_get_dynlock_value 2419 EXIST::FUNCTION:
1836CRYPTO_get_dynlock_create_callback 2420 EXIST:!VMS:FUNCTION:
1837CRYPTO_get_dynlock_create_cb 2420 EXIST:VMS:FUNCTION:
1838c2i_ASN1_BIT_STRING 2421 EXIST::FUNCTION:
1839i2c_ASN1_BIT_STRING 2422 EXIST::FUNCTION:
1840RAND_poll 2423 EXIST::FUNCTION:
1841c2i_ASN1_INTEGER 2424 EXIST::FUNCTION:
1842i2c_ASN1_INTEGER 2425 EXIST::FUNCTION:
1843BIO_dump_indent 2426 EXIST::FUNCTION:
1844ASN1_parse_dump 2427 EXIST::FUNCTION:BIO
1845c2i_ASN1_OBJECT 2428 EXIST::FUNCTION:
1846X509_NAME_print_ex_fp 2429 EXIST::FUNCTION:FP_API
1847ASN1_STRING_print_ex_fp 2430 EXIST::FUNCTION:FP_API
1848X509_NAME_print_ex 2431 EXIST::FUNCTION:BIO
1849ASN1_STRING_print_ex 2432 EXIST::FUNCTION:BIO
1850MD4 2433 EXIST::FUNCTION:MD4
1851MD4_Transform 2434 EXIST::FUNCTION:MD4
1852MD4_Final 2435 EXIST::FUNCTION:MD4
1853MD4_Update 2436 EXIST::FUNCTION:MD4
1854MD4_Init 2437 EXIST::FUNCTION:MD4
1855EVP_md4 2438 EXIST::FUNCTION:MD4
1856i2d_PUBKEY_bio 2439 EXIST::FUNCTION:BIO
1857i2d_PUBKEY_fp 2440 EXIST::FUNCTION:FP_API
1858d2i_PUBKEY_bio 2441 EXIST::FUNCTION:BIO
1859ASN1_STRING_to_UTF8 2442 EXIST::FUNCTION:
1860BIO_vprintf 2443 EXIST::FUNCTION:
1861BIO_vsnprintf 2444 EXIST::FUNCTION:
1862d2i_PUBKEY_fp 2445 EXIST::FUNCTION:FP_API
1863X509_cmp_time 2446 EXIST::FUNCTION:
1864X509_STORE_CTX_set_time 2447 EXIST::FUNCTION:
1865X509_STORE_CTX_get1_issuer 2448 EXIST::FUNCTION:
1866X509_OBJECT_retrieve_match 2449 EXIST::FUNCTION:
1867X509_OBJECT_idx_by_subject 2450 EXIST::FUNCTION:
1868X509_STORE_CTX_set_flags 2451 EXIST::FUNCTION:
1869X509_STORE_CTX_trusted_stack 2452 EXIST::FUNCTION:
1870X509_time_adj 2453 EXIST::FUNCTION:
1871X509_check_issued 2454 EXIST::FUNCTION:
1872ASN1_UTCTIME_cmp_time_t 2455 EXIST::FUNCTION:
1873DES_set_weak_key_flag 2456 NOEXIST::FUNCTION:
1874DES_check_key 2457 NOEXIST::FUNCTION:
1875DES_rw_mode 2458 NOEXIST::FUNCTION:
1876RSA_PKCS1_RSAref 2459 NOEXIST::FUNCTION:
1877X509_keyid_set1 2460 EXIST::FUNCTION:
1878BIO_next 2461 EXIST::FUNCTION:
1879DSO_METHOD_vms 2462 EXIST::FUNCTION:
1880BIO_f_linebuffer 2463 EXIST:VMS:FUNCTION:
1881BN_bntest_rand 2464 EXIST::FUNCTION:
1882OPENSSL_issetugid 2465 EXIST::FUNCTION:
1883BN_rand_range 2466 EXIST::FUNCTION:
1884ERR_load_ENGINE_strings 2467 EXIST::FUNCTION:ENGINE
1885ENGINE_set_DSA 2468 EXIST::FUNCTION:ENGINE
1886ENGINE_get_finish_function 2469 EXIST::FUNCTION:ENGINE
1887ENGINE_get_default_RSA 2470 EXIST::FUNCTION:ENGINE
1888ENGINE_get_BN_mod_exp 2471 NOEXIST::FUNCTION:
1889DSA_get_default_openssl_method 2472 NOEXIST::FUNCTION:
1890ENGINE_set_DH 2473 EXIST::FUNCTION:ENGINE
1891ENGINE_set_def_BN_mod_exp_crt 2474 NOEXIST::FUNCTION:
1892ENGINE_set_default_BN_mod_exp_crt 2474 NOEXIST::FUNCTION:
1893ENGINE_init 2475 EXIST::FUNCTION:ENGINE
1894DH_get_default_openssl_method 2476 NOEXIST::FUNCTION:
1895RSA_set_default_openssl_method 2477 NOEXIST::FUNCTION:
1896ENGINE_finish 2478 EXIST::FUNCTION:ENGINE
1897ENGINE_load_public_key 2479 EXIST::FUNCTION:ENGINE
1898ENGINE_get_DH 2480 EXIST::FUNCTION:ENGINE
1899ENGINE_ctrl 2481 EXIST::FUNCTION:ENGINE
1900ENGINE_get_init_function 2482 EXIST::FUNCTION:ENGINE
1901ENGINE_set_init_function 2483 EXIST::FUNCTION:ENGINE
1902ENGINE_set_default_DSA 2484 EXIST::FUNCTION:ENGINE
1903ENGINE_get_name 2485 EXIST::FUNCTION:ENGINE
1904ENGINE_get_last 2486 EXIST::FUNCTION:ENGINE
1905ENGINE_get_prev 2487 EXIST::FUNCTION:ENGINE
1906ENGINE_get_default_DH 2488 EXIST::FUNCTION:ENGINE
1907ENGINE_get_RSA 2489 EXIST::FUNCTION:ENGINE
1908ENGINE_set_default 2490 EXIST::FUNCTION:ENGINE
1909ENGINE_get_RAND 2491 EXIST::FUNCTION:ENGINE
1910ENGINE_get_first 2492 EXIST::FUNCTION:ENGINE
1911ENGINE_by_id 2493 EXIST::FUNCTION:ENGINE
1912ENGINE_set_finish_function 2494 EXIST::FUNCTION:ENGINE
1913ENGINE_get_def_BN_mod_exp_crt 2495 NOEXIST::FUNCTION:
1914ENGINE_get_default_BN_mod_exp_crt 2495 NOEXIST::FUNCTION:
1915RSA_get_default_openssl_method 2496 NOEXIST::FUNCTION:
1916ENGINE_set_RSA 2497 EXIST::FUNCTION:ENGINE
1917ENGINE_load_private_key 2498 EXIST::FUNCTION:ENGINE
1918ENGINE_set_default_RAND 2499 EXIST::FUNCTION:ENGINE
1919ENGINE_set_BN_mod_exp 2500 NOEXIST::FUNCTION:
1920ENGINE_remove 2501 EXIST::FUNCTION:ENGINE
1921ENGINE_free 2502 EXIST::FUNCTION:ENGINE
1922ENGINE_get_BN_mod_exp_crt 2503 NOEXIST::FUNCTION:
1923ENGINE_get_next 2504 EXIST::FUNCTION:ENGINE
1924ENGINE_set_name 2505 EXIST::FUNCTION:ENGINE
1925ENGINE_get_default_DSA 2506 EXIST::FUNCTION:ENGINE
1926ENGINE_set_default_BN_mod_exp 2507 NOEXIST::FUNCTION:
1927ENGINE_set_default_RSA 2508 EXIST::FUNCTION:ENGINE
1928ENGINE_get_default_RAND 2509 EXIST::FUNCTION:ENGINE
1929ENGINE_get_default_BN_mod_exp 2510 NOEXIST::FUNCTION:
1930ENGINE_set_RAND 2511 EXIST::FUNCTION:ENGINE
1931ENGINE_set_id 2512 EXIST::FUNCTION:ENGINE
1932ENGINE_set_BN_mod_exp_crt 2513 NOEXIST::FUNCTION:
1933ENGINE_set_default_DH 2514 EXIST::FUNCTION:ENGINE
1934ENGINE_new 2515 EXIST::FUNCTION:ENGINE
1935ENGINE_get_id 2516 EXIST::FUNCTION:ENGINE
1936DSA_set_default_openssl_method 2517 NOEXIST::FUNCTION:
1937ENGINE_add 2518 EXIST::FUNCTION:ENGINE
1938DH_set_default_openssl_method 2519 NOEXIST::FUNCTION:
1939ENGINE_get_DSA 2520 EXIST::FUNCTION:ENGINE
1940ENGINE_get_ctrl_function 2521 EXIST::FUNCTION:ENGINE
1941ENGINE_set_ctrl_function 2522 EXIST::FUNCTION:ENGINE
1942BN_pseudo_rand_range 2523 EXIST::FUNCTION:
1943X509_STORE_CTX_set_verify_cb 2524 EXIST::FUNCTION:
1944ERR_load_COMP_strings 2525 EXIST::FUNCTION:
1945PKCS12_item_decrypt_d2i 2526 EXIST::FUNCTION:
1946ASN1_UTF8STRING_it 2527 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
1947ASN1_UTF8STRING_it 2527 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
1948ENGINE_unregister_ciphers 2528 EXIST::FUNCTION:ENGINE
1949ENGINE_get_ciphers 2529 EXIST::FUNCTION:ENGINE
1950d2i_OCSP_BASICRESP 2530 EXIST::FUNCTION:
1951KRB5_CHECKSUM_it 2531 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
1952KRB5_CHECKSUM_it 2531 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
1953EC_POINT_add 2532 EXIST::FUNCTION:EC
1954ASN1_item_ex_i2d 2533 EXIST::FUNCTION:
1955OCSP_CERTID_it 2534 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
1956OCSP_CERTID_it 2534 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
1957d2i_OCSP_RESPBYTES 2535 EXIST::FUNCTION:
1958X509V3_add1_i2d 2536 EXIST::FUNCTION:
1959PKCS7_ENVELOPE_it 2537 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
1960PKCS7_ENVELOPE_it 2537 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
1961UI_add_input_boolean 2538 EXIST::FUNCTION:
1962ENGINE_unregister_RSA 2539 EXIST::FUNCTION:ENGINE
1963X509V3_EXT_nconf 2540 EXIST::FUNCTION:
1964ASN1_GENERALSTRING_free 2541 EXIST::FUNCTION:
1965d2i_OCSP_CERTSTATUS 2542 EXIST::FUNCTION:
1966X509_REVOKED_set_serialNumber 2543 EXIST::FUNCTION:
1967X509_print_ex 2544 EXIST::FUNCTION:BIO
1968OCSP_ONEREQ_get1_ext_d2i 2545 EXIST::FUNCTION:
1969ENGINE_register_all_RAND 2546 EXIST::FUNCTION:ENGINE
1970ENGINE_load_dynamic 2547 EXIST::FUNCTION:ENGINE
1971PBKDF2PARAM_it 2548 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
1972PBKDF2PARAM_it 2548 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
1973EXTENDED_KEY_USAGE_new 2549 EXIST::FUNCTION:
1974EC_GROUP_clear_free 2550 EXIST::FUNCTION:EC
1975OCSP_sendreq_bio 2551 EXIST::FUNCTION:
1976ASN1_item_digest 2552 EXIST::FUNCTION:EVP
1977OCSP_BASICRESP_delete_ext 2553 EXIST::FUNCTION:
1978OCSP_SIGNATURE_it 2554 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
1979OCSP_SIGNATURE_it 2554 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
1980X509_CRL_it 2555 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
1981X509_CRL_it 2555 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
1982OCSP_BASICRESP_add_ext 2556 EXIST::FUNCTION:
1983KRB5_ENCKEY_it 2557 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
1984KRB5_ENCKEY_it 2557 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
1985UI_method_set_closer 2558 EXIST::FUNCTION:
1986X509_STORE_set_purpose 2559 EXIST::FUNCTION:
1987i2d_ASN1_GENERALSTRING 2560 EXIST::FUNCTION:
1988OCSP_response_status 2561 EXIST::FUNCTION:
1989i2d_OCSP_SERVICELOC 2562 EXIST::FUNCTION:
1990ENGINE_get_digest_engine 2563 EXIST::FUNCTION:ENGINE
1991EC_GROUP_set_curve_GFp 2564 EXIST::FUNCTION:EC
1992OCSP_REQUEST_get_ext_by_OBJ 2565 EXIST::FUNCTION:
1993_ossl_old_des_random_key 2566 EXIST::FUNCTION:DES
1994ASN1_T61STRING_it 2567 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
1995ASN1_T61STRING_it 2567 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
1996EC_GROUP_method_of 2568 EXIST::FUNCTION:EC
1997i2d_KRB5_APREQ 2569 EXIST::FUNCTION:
1998_ossl_old_des_encrypt 2570 EXIST::FUNCTION:DES
1999ASN1_PRINTABLE_new 2571 EXIST::FUNCTION:
2000HMAC_Init_ex 2572 EXIST::FUNCTION:HMAC
2001d2i_KRB5_AUTHENT 2573 EXIST::FUNCTION:
2002OCSP_archive_cutoff_new 2574 EXIST::FUNCTION:
2003EC_POINT_set_Jprojective_coordinates_GFp 2575 EXIST:!VMS:FUNCTION:EC
2004EC_POINT_set_Jproj_coords_GFp 2575 EXIST:VMS:FUNCTION:EC
2005_ossl_old_des_is_weak_key 2576 EXIST::FUNCTION:DES
2006OCSP_BASICRESP_get_ext_by_OBJ 2577 EXIST::FUNCTION:
2007EC_POINT_oct2point 2578 EXIST::FUNCTION:EC
2008OCSP_SINGLERESP_get_ext_count 2579 EXIST::FUNCTION:
2009UI_ctrl 2580 EXIST::FUNCTION:
2010_shadow_DES_rw_mode 2581 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:DES
2011_shadow_DES_rw_mode 2581 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:DES
2012asn1_do_adb 2582 EXIST::FUNCTION:
2013ASN1_template_i2d 2583 EXIST::FUNCTION:
2014ENGINE_register_DH 2584 EXIST::FUNCTION:ENGINE
2015UI_construct_prompt 2585 EXIST::FUNCTION:
2016X509_STORE_set_trust 2586 EXIST::FUNCTION:
2017UI_dup_input_string 2587 EXIST::FUNCTION:
2018d2i_KRB5_APREQ 2588 EXIST::FUNCTION:
2019EVP_MD_CTX_copy_ex 2589 EXIST::FUNCTION:
2020OCSP_request_is_signed 2590 EXIST::FUNCTION:
2021i2d_OCSP_REQINFO 2591 EXIST::FUNCTION:
2022KRB5_ENCKEY_free 2592 EXIST::FUNCTION:
2023OCSP_resp_get0 2593 EXIST::FUNCTION:
2024GENERAL_NAME_it 2594 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
2025GENERAL_NAME_it 2594 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
2026ASN1_GENERALIZEDTIME_it 2595 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
2027ASN1_GENERALIZEDTIME_it 2595 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
2028X509_STORE_set_flags 2596 EXIST::FUNCTION:
2029EC_POINT_set_compressed_coordinates_GFp 2597 EXIST:!VMS:FUNCTION:EC
2030EC_POINT_set_compr_coords_GFp 2597 EXIST:VMS:FUNCTION:EC
2031OCSP_response_status_str 2598 EXIST::FUNCTION:
2032d2i_OCSP_REVOKEDINFO 2599 EXIST::FUNCTION:
2033OCSP_basic_add1_cert 2600 EXIST::FUNCTION:
2034ERR_get_implementation 2601 EXIST::FUNCTION:
2035EVP_CipherFinal_ex 2602 EXIST::FUNCTION:
2036OCSP_CERTSTATUS_new 2603 EXIST::FUNCTION:
2037CRYPTO_cleanup_all_ex_data 2604 EXIST::FUNCTION:
2038OCSP_resp_find 2605 EXIST::FUNCTION:
2039BN_nnmod 2606 EXIST::FUNCTION:
2040X509_CRL_sort 2607 EXIST::FUNCTION:
2041X509_REVOKED_set_revocationDate 2608 EXIST::FUNCTION:
2042ENGINE_register_RAND 2609 EXIST::FUNCTION:ENGINE
2043OCSP_SERVICELOC_new 2610 EXIST::FUNCTION:
2044EC_POINT_set_affine_coordinates_GFp 2611 EXIST:!VMS:FUNCTION:EC
2045EC_POINT_set_affine_coords_GFp 2611 EXIST:VMS:FUNCTION:EC
2046_ossl_old_des_options 2612 EXIST::FUNCTION:DES
2047SXNET_it 2613 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
2048SXNET_it 2613 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
2049UI_dup_input_boolean 2614 EXIST::FUNCTION:
2050PKCS12_add_CSPName_asc 2615 EXIST::FUNCTION:
2051EC_POINT_is_at_infinity 2616 EXIST::FUNCTION:EC
2052ENGINE_load_cryptodev 2617 EXIST::FUNCTION:ENGINE
2053DSO_convert_filename 2618 EXIST::FUNCTION:
2054POLICYQUALINFO_it 2619 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
2055POLICYQUALINFO_it 2619 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
2056ENGINE_register_ciphers 2620 EXIST::FUNCTION:ENGINE
2057BN_mod_lshift_quick 2621 EXIST::FUNCTION:
2058DSO_set_filename 2622 EXIST::FUNCTION:
2059ASN1_item_free 2623 EXIST::FUNCTION:
2060KRB5_TKTBODY_free 2624 EXIST::FUNCTION:
2061AUTHORITY_KEYID_it 2625 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
2062AUTHORITY_KEYID_it 2625 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
2063KRB5_APREQBODY_new 2626 EXIST::FUNCTION:
2064X509V3_EXT_REQ_add_nconf 2627 EXIST::FUNCTION:
2065ENGINE_ctrl_cmd_string 2628 EXIST::FUNCTION:ENGINE
2066i2d_OCSP_RESPDATA 2629 EXIST::FUNCTION:
2067EVP_MD_CTX_init 2630 EXIST::FUNCTION:
2068EXTENDED_KEY_USAGE_free 2631 EXIST::FUNCTION:
2069PKCS7_ATTR_SIGN_it 2632 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
2070PKCS7_ATTR_SIGN_it 2632 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
2071UI_add_error_string 2633 EXIST::FUNCTION:
2072KRB5_CHECKSUM_free 2634 EXIST::FUNCTION:
2073OCSP_REQUEST_get_ext 2635 EXIST::FUNCTION:
2074ENGINE_load_ubsec 2636 EXIST::FUNCTION:ENGINE,STATIC_ENGINE
2075ENGINE_register_all_digests 2637 EXIST::FUNCTION:ENGINE
2076PKEY_USAGE_PERIOD_it 2638 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
2077PKEY_USAGE_PERIOD_it 2638 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
2078PKCS12_unpack_authsafes 2639 EXIST::FUNCTION:
2079ASN1_item_unpack 2640 EXIST::FUNCTION:
2080NETSCAPE_SPKAC_it 2641 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
2081NETSCAPE_SPKAC_it 2641 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
2082X509_REVOKED_it 2642 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
2083X509_REVOKED_it 2642 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
2084ASN1_STRING_encode 2643 NOEXIST::FUNCTION:
2085EVP_aes_128_ecb 2644 EXIST::FUNCTION:AES
2086KRB5_AUTHENT_free 2645 EXIST::FUNCTION:
2087OCSP_BASICRESP_get_ext_by_critical 2646 EXIST:!VMS:FUNCTION:
2088OCSP_BASICRESP_get_ext_by_crit 2646 EXIST:VMS:FUNCTION:
2089OCSP_cert_status_str 2647 EXIST::FUNCTION:
2090d2i_OCSP_REQUEST 2648 EXIST::FUNCTION:
2091UI_dup_info_string 2649 EXIST::FUNCTION:
2092_ossl_old_des_xwhite_in2out 2650 NOEXIST::FUNCTION:
2093PKCS12_it 2651 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
2094PKCS12_it 2651 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
2095OCSP_SINGLERESP_get_ext_by_critical 2652 EXIST:!VMS:FUNCTION:
2096OCSP_SINGLERESP_get_ext_by_crit 2652 EXIST:VMS:FUNCTION:
2097OCSP_CERTSTATUS_free 2653 EXIST::FUNCTION:
2098_ossl_old_des_crypt 2654 EXIST::FUNCTION:DES
2099ASN1_item_i2d 2655 EXIST::FUNCTION:
2100EVP_DecryptFinal_ex 2656 EXIST::FUNCTION:
2101ENGINE_load_openssl 2657 EXIST::FUNCTION:ENGINE
2102ENGINE_get_cmd_defns 2658 EXIST::FUNCTION:ENGINE
2103ENGINE_set_load_privkey_function 2659 EXIST:!VMS:FUNCTION:ENGINE
2104ENGINE_set_load_privkey_fn 2659 EXIST:VMS:FUNCTION:ENGINE
2105EVP_EncryptFinal_ex 2660 EXIST::FUNCTION:
2106ENGINE_set_default_digests 2661 EXIST::FUNCTION:ENGINE
2107X509_get0_pubkey_bitstr 2662 EXIST::FUNCTION:
2108asn1_ex_i2c 2663 EXIST::FUNCTION:
2109ENGINE_register_RSA 2664 EXIST::FUNCTION:ENGINE
2110ENGINE_unregister_DSA 2665 EXIST::FUNCTION:ENGINE
2111_ossl_old_des_key_sched 2666 EXIST::FUNCTION:DES
2112X509_EXTENSION_it 2667 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
2113X509_EXTENSION_it 2667 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
2114i2d_KRB5_AUTHENT 2668 EXIST::FUNCTION:
2115SXNETID_it 2669 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
2116SXNETID_it 2669 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
2117d2i_OCSP_SINGLERESP 2670 EXIST::FUNCTION:
2118EDIPARTYNAME_new 2671 EXIST::FUNCTION:
2119PKCS12_certbag2x509 2672 EXIST::FUNCTION:
2120_ossl_old_des_ofb64_encrypt 2673 EXIST::FUNCTION:DES
2121d2i_EXTENDED_KEY_USAGE 2674 EXIST::FUNCTION:
2122ERR_print_errors_cb 2675 EXIST::FUNCTION:
2123ENGINE_set_ciphers 2676 EXIST::FUNCTION:ENGINE
2124d2i_KRB5_APREQBODY 2677 EXIST::FUNCTION:
2125UI_method_get_flusher 2678 EXIST::FUNCTION:
2126X509_PUBKEY_it 2679 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
2127X509_PUBKEY_it 2679 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
2128_ossl_old_des_enc_read 2680 EXIST::FUNCTION:DES
2129PKCS7_ENCRYPT_it 2681 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
2130PKCS7_ENCRYPT_it 2681 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
2131i2d_OCSP_RESPONSE 2682 EXIST::FUNCTION:
2132EC_GROUP_get_cofactor 2683 EXIST::FUNCTION:EC
2133PKCS12_unpack_p7data 2684 EXIST::FUNCTION:
2134d2i_KRB5_AUTHDATA 2685 EXIST::FUNCTION:
2135OCSP_copy_nonce 2686 EXIST::FUNCTION:
2136KRB5_AUTHDATA_new 2687 EXIST::FUNCTION:
2137OCSP_RESPDATA_new 2688 EXIST::FUNCTION:
2138EC_GFp_mont_method 2689 EXIST::FUNCTION:EC
2139OCSP_REVOKEDINFO_free 2690 EXIST::FUNCTION:
2140UI_get_ex_data 2691 EXIST::FUNCTION:
2141KRB5_APREQBODY_free 2692 EXIST::FUNCTION:
2142EC_GROUP_get0_generator 2693 EXIST::FUNCTION:EC
2143UI_get_default_method 2694 EXIST::FUNCTION:
2144X509V3_set_nconf 2695 EXIST::FUNCTION:
2145PKCS12_item_i2d_encrypt 2696 EXIST::FUNCTION:
2146X509_add1_ext_i2d 2697 EXIST::FUNCTION:
2147PKCS7_SIGNER_INFO_it 2698 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
2148PKCS7_SIGNER_INFO_it 2698 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
2149KRB5_PRINCNAME_new 2699 EXIST::FUNCTION:
2150PKCS12_SAFEBAG_it 2700 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
2151PKCS12_SAFEBAG_it 2700 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
2152EC_GROUP_get_order 2701 EXIST::FUNCTION:EC
2153d2i_OCSP_RESPID 2702 EXIST::FUNCTION:
2154OCSP_request_verify 2703 EXIST::FUNCTION:
2155NCONF_get_number_e 2704 EXIST::FUNCTION:
2156_ossl_old_des_decrypt3 2705 EXIST::FUNCTION:DES
2157X509_signature_print 2706 EXIST::FUNCTION:EVP
2158OCSP_SINGLERESP_free 2707 EXIST::FUNCTION:
2159ENGINE_load_builtin_engines 2708 EXIST::FUNCTION:ENGINE
2160i2d_OCSP_ONEREQ 2709 EXIST::FUNCTION:
2161OCSP_REQUEST_add_ext 2710 EXIST::FUNCTION:
2162OCSP_RESPBYTES_new 2711 EXIST::FUNCTION:
2163EVP_MD_CTX_create 2712 EXIST::FUNCTION:
2164OCSP_resp_find_status 2713 EXIST::FUNCTION:
2165X509_ALGOR_it 2714 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
2166X509_ALGOR_it 2714 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
2167ASN1_TIME_it 2715 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
2168ASN1_TIME_it 2715 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
2169OCSP_request_set1_name 2716 EXIST::FUNCTION:
2170OCSP_ONEREQ_get_ext_count 2717 EXIST::FUNCTION:
2171UI_get0_result 2718 EXIST::FUNCTION:
2172PKCS12_AUTHSAFES_it 2719 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
2173PKCS12_AUTHSAFES_it 2719 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
2174EVP_aes_256_ecb 2720 EXIST::FUNCTION:AES
2175PKCS12_pack_authsafes 2721 EXIST::FUNCTION:
2176ASN1_IA5STRING_it 2722 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
2177ASN1_IA5STRING_it 2722 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
2178UI_get_input_flags 2723 EXIST::FUNCTION:
2179EC_GROUP_set_generator 2724 EXIST::FUNCTION:EC
2180_ossl_old_des_string_to_2keys 2725 EXIST::FUNCTION:DES
2181OCSP_CERTID_free 2726 EXIST::FUNCTION:
2182X509_CERT_AUX_it 2727 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
2183X509_CERT_AUX_it 2727 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
2184CERTIFICATEPOLICIES_it 2728 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
2185CERTIFICATEPOLICIES_it 2728 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
2186_ossl_old_des_ede3_cbc_encrypt 2729 EXIST::FUNCTION:DES
2187RAND_set_rand_engine 2730 EXIST::FUNCTION:ENGINE
2188DSO_get_loaded_filename 2731 EXIST::FUNCTION:
2189X509_ATTRIBUTE_it 2732 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
2190X509_ATTRIBUTE_it 2732 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
2191OCSP_ONEREQ_get_ext_by_NID 2733 EXIST::FUNCTION:
2192PKCS12_decrypt_skey 2734 EXIST::FUNCTION:
2193KRB5_AUTHENT_it 2735 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
2194KRB5_AUTHENT_it 2735 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
2195UI_dup_error_string 2736 EXIST::FUNCTION:
2196RSAPublicKey_it 2737 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:RSA
2197RSAPublicKey_it 2737 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:RSA
2198i2d_OCSP_REQUEST 2738 EXIST::FUNCTION:
2199PKCS12_x509crl2certbag 2739 EXIST::FUNCTION:
2200OCSP_SERVICELOC_it 2740 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
2201OCSP_SERVICELOC_it 2740 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
2202ASN1_item_sign 2741 EXIST::FUNCTION:EVP
2203X509_CRL_set_issuer_name 2742 EXIST::FUNCTION:
2204OBJ_NAME_do_all_sorted 2743 EXIST::FUNCTION:
2205i2d_OCSP_BASICRESP 2744 EXIST::FUNCTION:
2206i2d_OCSP_RESPBYTES 2745 EXIST::FUNCTION:
2207PKCS12_unpack_p7encdata 2746 EXIST::FUNCTION:
2208HMAC_CTX_init 2747 EXIST::FUNCTION:HMAC
2209ENGINE_get_digest 2748 EXIST::FUNCTION:ENGINE
2210OCSP_RESPONSE_print 2749 EXIST::FUNCTION:
2211KRB5_TKTBODY_it 2750 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
2212KRB5_TKTBODY_it 2750 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
2213ACCESS_DESCRIPTION_it 2751 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
2214ACCESS_DESCRIPTION_it 2751 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
2215PKCS7_ISSUER_AND_SERIAL_it 2752 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
2216PKCS7_ISSUER_AND_SERIAL_it 2752 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
2217PBE2PARAM_it 2753 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
2218PBE2PARAM_it 2753 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
2219PKCS12_certbag2x509crl 2754 EXIST::FUNCTION:
2220PKCS7_SIGNED_it 2755 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
2221PKCS7_SIGNED_it 2755 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
2222ENGINE_get_cipher 2756 EXIST::FUNCTION:ENGINE
2223i2d_OCSP_CRLID 2757 EXIST::FUNCTION:
2224OCSP_SINGLERESP_new 2758 EXIST::FUNCTION:
2225ENGINE_cmd_is_executable 2759 EXIST::FUNCTION:ENGINE
2226RSA_up_ref 2760 EXIST::FUNCTION:RSA
2227ASN1_GENERALSTRING_it 2761 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
2228ASN1_GENERALSTRING_it 2761 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
2229ENGINE_register_DSA 2762 EXIST::FUNCTION:ENGINE
2230X509V3_EXT_add_nconf_sk 2763 EXIST::FUNCTION:
2231ENGINE_set_load_pubkey_function 2764 EXIST::FUNCTION:ENGINE
2232PKCS8_decrypt 2765 EXIST::FUNCTION:
2233PEM_bytes_read_bio 2766 EXIST::FUNCTION:BIO
2234DIRECTORYSTRING_it 2767 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
2235DIRECTORYSTRING_it 2767 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
2236d2i_OCSP_CRLID 2768 EXIST::FUNCTION:
2237EC_POINT_is_on_curve 2769 EXIST::FUNCTION:EC
2238CRYPTO_set_locked_mem_ex_functions 2770 EXIST:!VMS:FUNCTION:
2239CRYPTO_set_locked_mem_ex_funcs 2770 EXIST:VMS:FUNCTION:
2240d2i_KRB5_CHECKSUM 2771 EXIST::FUNCTION:
2241ASN1_item_dup 2772 EXIST::FUNCTION:
2242X509_it 2773 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
2243X509_it 2773 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
2244BN_mod_add 2774 EXIST::FUNCTION:
2245KRB5_AUTHDATA_free 2775 EXIST::FUNCTION:
2246_ossl_old_des_cbc_cksum 2776 EXIST::FUNCTION:DES
2247ASN1_item_verify 2777 EXIST::FUNCTION:EVP
2248CRYPTO_set_mem_ex_functions 2778 EXIST::FUNCTION:
2249EC_POINT_get_Jprojective_coordinates_GFp 2779 EXIST:!VMS:FUNCTION:EC
2250EC_POINT_get_Jproj_coords_GFp 2779 EXIST:VMS:FUNCTION:EC
2251ZLONG_it 2780 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
2252ZLONG_it 2780 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
2253CRYPTO_get_locked_mem_ex_functions 2781 EXIST:!VMS:FUNCTION:
2254CRYPTO_get_locked_mem_ex_funcs 2781 EXIST:VMS:FUNCTION:
2255ASN1_TIME_check 2782 EXIST::FUNCTION:
2256UI_get0_user_data 2783 EXIST::FUNCTION:
2257HMAC_CTX_cleanup 2784 EXIST::FUNCTION:HMAC
2258DSA_up_ref 2785 EXIST::FUNCTION:DSA
2259_ossl_old_des_ede3_cfb64_encrypt 2786 EXIST:!VMS:FUNCTION:DES
2260_ossl_odes_ede3_cfb64_encrypt 2786 EXIST:VMS:FUNCTION:DES
2261ASN1_BMPSTRING_it 2787 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
2262ASN1_BMPSTRING_it 2787 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
2263ASN1_tag2bit 2788 EXIST::FUNCTION:
2264UI_method_set_flusher 2789 EXIST::FUNCTION:
2265X509_ocspid_print 2790 EXIST::FUNCTION:BIO
2266KRB5_ENCDATA_it 2791 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
2267KRB5_ENCDATA_it 2791 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
2268ENGINE_get_load_pubkey_function 2792 EXIST::FUNCTION:ENGINE
2269UI_add_user_data 2793 EXIST::FUNCTION:
2270OCSP_REQUEST_delete_ext 2794 EXIST::FUNCTION:
2271UI_get_method 2795 EXIST::FUNCTION:
2272OCSP_ONEREQ_free 2796 EXIST::FUNCTION:
2273ASN1_PRINTABLESTRING_it 2797 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
2274ASN1_PRINTABLESTRING_it 2797 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
2275X509_CRL_set_nextUpdate 2798 EXIST::FUNCTION:
2276OCSP_REQUEST_it 2799 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
2277OCSP_REQUEST_it 2799 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
2278OCSP_BASICRESP_it 2800 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
2279OCSP_BASICRESP_it 2800 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
2280AES_ecb_encrypt 2801 EXIST::FUNCTION:AES
2281BN_mod_sqr 2802 EXIST::FUNCTION:
2282NETSCAPE_CERT_SEQUENCE_it 2803 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
2283NETSCAPE_CERT_SEQUENCE_it 2803 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
2284GENERAL_NAMES_it 2804 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
2285GENERAL_NAMES_it 2804 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
2286AUTHORITY_INFO_ACCESS_it 2805 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
2287AUTHORITY_INFO_ACCESS_it 2805 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
2288ASN1_FBOOLEAN_it 2806 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
2289ASN1_FBOOLEAN_it 2806 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
2290UI_set_ex_data 2807 EXIST::FUNCTION:
2291_ossl_old_des_string_to_key 2808 EXIST::FUNCTION:DES
2292ENGINE_register_all_RSA 2809 EXIST::FUNCTION:ENGINE
2293d2i_KRB5_PRINCNAME 2810 EXIST::FUNCTION:
2294OCSP_RESPBYTES_it 2811 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
2295OCSP_RESPBYTES_it 2811 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
2296X509_CINF_it 2812 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
2297X509_CINF_it 2812 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
2298ENGINE_unregister_digests 2813 EXIST::FUNCTION:ENGINE
2299d2i_EDIPARTYNAME 2814 EXIST::FUNCTION:
2300d2i_OCSP_SERVICELOC 2815 EXIST::FUNCTION:
2301ENGINE_get_digests 2816 EXIST::FUNCTION:ENGINE
2302_ossl_old_des_set_odd_parity 2817 EXIST::FUNCTION:DES
2303OCSP_RESPDATA_free 2818 EXIST::FUNCTION:
2304d2i_KRB5_TICKET 2819 EXIST::FUNCTION:
2305OTHERNAME_it 2820 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
2306OTHERNAME_it 2820 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
2307EVP_MD_CTX_cleanup 2821 EXIST::FUNCTION:
2308d2i_ASN1_GENERALSTRING 2822 EXIST::FUNCTION:
2309X509_CRL_set_version 2823 EXIST::FUNCTION:
2310BN_mod_sub 2824 EXIST::FUNCTION:
2311OCSP_SINGLERESP_get_ext_by_NID 2825 EXIST::FUNCTION:
2312ENGINE_get_ex_new_index 2826 EXIST::FUNCTION:ENGINE
2313OCSP_REQUEST_free 2827 EXIST::FUNCTION:
2314OCSP_REQUEST_add1_ext_i2d 2828 EXIST::FUNCTION:
2315X509_VAL_it 2829 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
2316X509_VAL_it 2829 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
2317EC_POINTs_make_affine 2830 EXIST::FUNCTION:EC
2318EC_POINT_mul 2831 EXIST::FUNCTION:EC
2319X509V3_EXT_add_nconf 2832 EXIST::FUNCTION:
2320X509_TRUST_set 2833 EXIST::FUNCTION:
2321X509_CRL_add1_ext_i2d 2834 EXIST::FUNCTION:
2322_ossl_old_des_fcrypt 2835 EXIST::FUNCTION:DES
2323DISPLAYTEXT_it 2836 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
2324DISPLAYTEXT_it 2836 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
2325X509_CRL_set_lastUpdate 2837 EXIST::FUNCTION:
2326OCSP_BASICRESP_free 2838 EXIST::FUNCTION:
2327OCSP_BASICRESP_add1_ext_i2d 2839 EXIST::FUNCTION:
2328d2i_KRB5_AUTHENTBODY 2840 EXIST::FUNCTION:
2329CRYPTO_set_ex_data_implementation 2841 EXIST:!VMS:FUNCTION:
2330CRYPTO_set_ex_data_impl 2841 EXIST:VMS:FUNCTION:
2331KRB5_ENCDATA_new 2842 EXIST::FUNCTION:
2332DSO_up_ref 2843 EXIST::FUNCTION:
2333OCSP_crl_reason_str 2844 EXIST::FUNCTION:
2334UI_get0_result_string 2845 EXIST::FUNCTION:
2335ASN1_GENERALSTRING_new 2846 EXIST::FUNCTION:
2336X509_SIG_it 2847 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
2337X509_SIG_it 2847 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
2338ERR_set_implementation 2848 EXIST::FUNCTION:
2339ERR_load_EC_strings 2849 EXIST::FUNCTION:EC
2340UI_get0_action_string 2850 EXIST::FUNCTION:
2341OCSP_ONEREQ_get_ext 2851 EXIST::FUNCTION:
2342EC_POINT_method_of 2852 EXIST::FUNCTION:EC
2343i2d_KRB5_APREQBODY 2853 EXIST::FUNCTION:
2344_ossl_old_des_ecb3_encrypt 2854 EXIST::FUNCTION:DES
2345CRYPTO_get_mem_ex_functions 2855 EXIST::FUNCTION:
2346ENGINE_get_ex_data 2856 EXIST::FUNCTION:ENGINE
2347UI_destroy_method 2857 EXIST::FUNCTION:
2348ASN1_item_i2d_bio 2858 EXIST::FUNCTION:BIO
2349OCSP_ONEREQ_get_ext_by_OBJ 2859 EXIST::FUNCTION:
2350ASN1_primitive_new 2860 EXIST::FUNCTION:
2351ASN1_PRINTABLE_it 2861 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
2352ASN1_PRINTABLE_it 2861 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
2353EVP_aes_192_ecb 2862 EXIST::FUNCTION:AES
2354OCSP_SIGNATURE_new 2863 EXIST::FUNCTION:
2355LONG_it 2864 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
2356LONG_it 2864 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
2357ASN1_VISIBLESTRING_it 2865 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
2358ASN1_VISIBLESTRING_it 2865 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
2359OCSP_SINGLERESP_add1_ext_i2d 2866 EXIST::FUNCTION:
2360d2i_OCSP_CERTID 2867 EXIST::FUNCTION:
2361ASN1_item_d2i_fp 2868 EXIST::FUNCTION:FP_API
2362CRL_DIST_POINTS_it 2869 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
2363CRL_DIST_POINTS_it 2869 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
2364GENERAL_NAME_print 2870 EXIST::FUNCTION:
2365OCSP_SINGLERESP_delete_ext 2871 EXIST::FUNCTION:
2366PKCS12_SAFEBAGS_it 2872 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
2367PKCS12_SAFEBAGS_it 2872 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
2368d2i_OCSP_SIGNATURE 2873 EXIST::FUNCTION:
2369OCSP_request_add1_nonce 2874 EXIST::FUNCTION:
2370ENGINE_set_cmd_defns 2875 EXIST::FUNCTION:ENGINE
2371OCSP_SERVICELOC_free 2876 EXIST::FUNCTION:
2372EC_GROUP_free 2877 EXIST::FUNCTION:EC
2373ASN1_BIT_STRING_it 2878 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
2374ASN1_BIT_STRING_it 2878 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
2375X509_REQ_it 2879 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
2376X509_REQ_it 2879 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
2377_ossl_old_des_cbc_encrypt 2880 EXIST::FUNCTION:DES
2378ERR_unload_strings 2881 EXIST::FUNCTION:
2379PKCS7_SIGN_ENVELOPE_it 2882 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
2380PKCS7_SIGN_ENVELOPE_it 2882 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
2381EDIPARTYNAME_free 2883 EXIST::FUNCTION:
2382OCSP_REQINFO_free 2884 EXIST::FUNCTION:
2383EC_GROUP_new_curve_GFp 2885 EXIST::FUNCTION:EC
2384OCSP_REQUEST_get1_ext_d2i 2886 EXIST::FUNCTION:
2385PKCS12_item_pack_safebag 2887 EXIST::FUNCTION:
2386asn1_ex_c2i 2888 EXIST::FUNCTION:
2387ENGINE_register_digests 2889 EXIST::FUNCTION:ENGINE
2388i2d_OCSP_REVOKEDINFO 2890 EXIST::FUNCTION:
2389asn1_enc_restore 2891 EXIST::FUNCTION:
2390UI_free 2892 EXIST::FUNCTION:
2391UI_new_method 2893 EXIST::FUNCTION:
2392EVP_EncryptInit_ex 2894 EXIST::FUNCTION:
2393X509_pubkey_digest 2895 EXIST::FUNCTION:EVP
2394EC_POINT_invert 2896 EXIST::FUNCTION:EC
2395OCSP_basic_sign 2897 EXIST::FUNCTION:
2396i2d_OCSP_RESPID 2898 EXIST::FUNCTION:
2397OCSP_check_nonce 2899 EXIST::FUNCTION:
2398ENGINE_ctrl_cmd 2900 EXIST::FUNCTION:ENGINE
2399d2i_KRB5_ENCKEY 2901 EXIST::FUNCTION:
2400OCSP_parse_url 2902 EXIST::FUNCTION:
2401OCSP_SINGLERESP_get_ext 2903 EXIST::FUNCTION:
2402OCSP_CRLID_free 2904 EXIST::FUNCTION:
2403OCSP_BASICRESP_get1_ext_d2i 2905 EXIST::FUNCTION:
2404RSAPrivateKey_it 2906 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:RSA
2405RSAPrivateKey_it 2906 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:RSA
2406ENGINE_register_all_DH 2907 EXIST::FUNCTION:ENGINE
2407i2d_EDIPARTYNAME 2908 EXIST::FUNCTION:
2408EC_POINT_get_affine_coordinates_GFp 2909 EXIST:!VMS:FUNCTION:EC
2409EC_POINT_get_affine_coords_GFp 2909 EXIST:VMS:FUNCTION:EC
2410OCSP_CRLID_new 2910 EXIST::FUNCTION:
2411ENGINE_get_flags 2911 EXIST::FUNCTION:ENGINE
2412OCSP_ONEREQ_it 2912 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
2413OCSP_ONEREQ_it 2912 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
2414UI_process 2913 EXIST::FUNCTION:
2415ASN1_INTEGER_it 2914 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
2416ASN1_INTEGER_it 2914 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
2417EVP_CipherInit_ex 2915 EXIST::FUNCTION:
2418UI_get_string_type 2916 EXIST::FUNCTION:
2419ENGINE_unregister_DH 2917 EXIST::FUNCTION:ENGINE
2420ENGINE_register_all_DSA 2918 EXIST::FUNCTION:ENGINE
2421OCSP_ONEREQ_get_ext_by_critical 2919 EXIST::FUNCTION:
2422bn_dup_expand 2920 EXIST::FUNCTION:DEPRECATED
2423OCSP_cert_id_new 2921 EXIST::FUNCTION:
2424BASIC_CONSTRAINTS_it 2922 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
2425BASIC_CONSTRAINTS_it 2922 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
2426BN_mod_add_quick 2923 EXIST::FUNCTION:
2427EC_POINT_new 2924 EXIST::FUNCTION:EC
2428EVP_MD_CTX_destroy 2925 EXIST::FUNCTION:
2429OCSP_RESPBYTES_free 2926 EXIST::FUNCTION:
2430EVP_aes_128_cbc 2927 EXIST::FUNCTION:AES
2431OCSP_SINGLERESP_get1_ext_d2i 2928 EXIST::FUNCTION:
2432EC_POINT_free 2929 EXIST::FUNCTION:EC
2433DH_up_ref 2930 EXIST::FUNCTION:DH
2434X509_NAME_ENTRY_it 2931 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
2435X509_NAME_ENTRY_it 2931 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
2436UI_get_ex_new_index 2932 EXIST::FUNCTION:
2437BN_mod_sub_quick 2933 EXIST::FUNCTION:
2438OCSP_ONEREQ_add_ext 2934 EXIST::FUNCTION:
2439OCSP_request_sign 2935 EXIST::FUNCTION:
2440EVP_DigestFinal_ex 2936 EXIST::FUNCTION:
2441ENGINE_set_digests 2937 EXIST::FUNCTION:ENGINE
2442OCSP_id_issuer_cmp 2938 EXIST::FUNCTION:
2443OBJ_NAME_do_all 2939 EXIST::FUNCTION:
2444EC_POINTs_mul 2940 EXIST::FUNCTION:EC
2445ENGINE_register_complete 2941 EXIST::FUNCTION:ENGINE
2446X509V3_EXT_nconf_nid 2942 EXIST::FUNCTION:
2447ASN1_SEQUENCE_it 2943 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
2448ASN1_SEQUENCE_it 2943 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
2449UI_set_default_method 2944 EXIST::FUNCTION:
2450RAND_query_egd_bytes 2945 EXIST::FUNCTION:
2451UI_method_get_writer 2946 EXIST::FUNCTION:
2452UI_OpenSSL 2947 EXIST::FUNCTION:
2453PEM_def_callback 2948 EXIST::FUNCTION:
2454ENGINE_cleanup 2949 EXIST::FUNCTION:ENGINE
2455DIST_POINT_it 2950 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
2456DIST_POINT_it 2950 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
2457OCSP_SINGLERESP_it 2951 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
2458OCSP_SINGLERESP_it 2951 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
2459d2i_KRB5_TKTBODY 2952 EXIST::FUNCTION:
2460EC_POINT_cmp 2953 EXIST::FUNCTION:EC
2461OCSP_REVOKEDINFO_new 2954 EXIST::FUNCTION:
2462i2d_OCSP_CERTSTATUS 2955 EXIST::FUNCTION:
2463OCSP_basic_add1_nonce 2956 EXIST::FUNCTION:
2464ASN1_item_ex_d2i 2957 EXIST::FUNCTION:
2465BN_mod_lshift1_quick 2958 EXIST::FUNCTION:
2466UI_set_method 2959 EXIST::FUNCTION:
2467OCSP_id_get0_info 2960 EXIST::FUNCTION:
2468BN_mod_sqrt 2961 EXIST::FUNCTION:
2469EC_GROUP_copy 2962 EXIST::FUNCTION:EC
2470KRB5_ENCDATA_free 2963 EXIST::FUNCTION:
2471_ossl_old_des_cfb_encrypt 2964 EXIST::FUNCTION:DES
2472OCSP_SINGLERESP_get_ext_by_OBJ 2965 EXIST::FUNCTION:
2473OCSP_cert_to_id 2966 EXIST::FUNCTION:
2474OCSP_RESPID_new 2967 EXIST::FUNCTION:
2475OCSP_RESPDATA_it 2968 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
2476OCSP_RESPDATA_it 2968 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
2477d2i_OCSP_RESPDATA 2969 EXIST::FUNCTION:
2478ENGINE_register_all_complete 2970 EXIST::FUNCTION:ENGINE
2479OCSP_check_validity 2971 EXIST::FUNCTION:
2480PKCS12_BAGS_it 2972 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
2481PKCS12_BAGS_it 2972 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
2482OCSP_url_svcloc_new 2973 EXIST::FUNCTION:
2483ASN1_template_free 2974 EXIST::FUNCTION:
2484OCSP_SINGLERESP_add_ext 2975 EXIST::FUNCTION:
2485KRB5_AUTHENTBODY_it 2976 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
2486KRB5_AUTHENTBODY_it 2976 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
2487X509_supported_extension 2977 EXIST::FUNCTION:
2488i2d_KRB5_AUTHDATA 2978 EXIST::FUNCTION:
2489UI_method_get_opener 2979 EXIST::FUNCTION:
2490ENGINE_set_ex_data 2980 EXIST::FUNCTION:ENGINE
2491OCSP_REQUEST_print 2981 EXIST::FUNCTION:
2492CBIGNUM_it 2982 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
2493CBIGNUM_it 2982 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
2494KRB5_TICKET_new 2983 EXIST::FUNCTION:
2495KRB5_APREQ_new 2984 EXIST::FUNCTION:
2496EC_GROUP_get_curve_GFp 2985 EXIST::FUNCTION:EC
2497KRB5_ENCKEY_new 2986 EXIST::FUNCTION:
2498ASN1_template_d2i 2987 EXIST::FUNCTION:
2499_ossl_old_des_quad_cksum 2988 EXIST::FUNCTION:DES
2500OCSP_single_get0_status 2989 EXIST::FUNCTION:
2501BN_swap 2990 EXIST::FUNCTION:
2502POLICYINFO_it 2991 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
2503POLICYINFO_it 2991 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
2504ENGINE_set_destroy_function 2992 EXIST::FUNCTION:ENGINE
2505asn1_enc_free 2993 EXIST::FUNCTION:
2506OCSP_RESPID_it 2994 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
2507OCSP_RESPID_it 2994 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
2508EC_GROUP_new 2995 EXIST::FUNCTION:EC
2509EVP_aes_256_cbc 2996 EXIST::FUNCTION:AES
2510i2d_KRB5_PRINCNAME 2997 EXIST::FUNCTION:
2511_ossl_old_des_encrypt2 2998 EXIST::FUNCTION:DES
2512_ossl_old_des_encrypt3 2999 EXIST::FUNCTION:DES
2513PKCS8_PRIV_KEY_INFO_it 3000 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
2514PKCS8_PRIV_KEY_INFO_it 3000 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
2515OCSP_REQINFO_it 3001 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
2516OCSP_REQINFO_it 3001 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
2517PBEPARAM_it 3002 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
2518PBEPARAM_it 3002 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
2519KRB5_AUTHENTBODY_new 3003 EXIST::FUNCTION:
2520X509_CRL_add0_revoked 3004 EXIST::FUNCTION:
2521EDIPARTYNAME_it 3005 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
2522EDIPARTYNAME_it 3005 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
2523NETSCAPE_SPKI_it 3006 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
2524NETSCAPE_SPKI_it 3006 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
2525UI_get0_test_string 3007 EXIST::FUNCTION:
2526ENGINE_get_cipher_engine 3008 EXIST::FUNCTION:ENGINE
2527ENGINE_register_all_ciphers 3009 EXIST::FUNCTION:ENGINE
2528EC_POINT_copy 3010 EXIST::FUNCTION:EC
2529BN_kronecker 3011 EXIST::FUNCTION:
2530_ossl_old_des_ede3_ofb64_encrypt 3012 EXIST:!VMS:FUNCTION:DES
2531_ossl_odes_ede3_ofb64_encrypt 3012 EXIST:VMS:FUNCTION:DES
2532UI_method_get_reader 3013 EXIST::FUNCTION:
2533OCSP_BASICRESP_get_ext_count 3014 EXIST::FUNCTION:
2534ASN1_ENUMERATED_it 3015 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
2535ASN1_ENUMERATED_it 3015 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
2536UI_set_result 3016 EXIST::FUNCTION:
2537i2d_KRB5_TICKET 3017 EXIST::FUNCTION:
2538X509_print_ex_fp 3018 EXIST::FUNCTION:FP_API
2539EVP_CIPHER_CTX_set_padding 3019 EXIST::FUNCTION:
2540d2i_OCSP_RESPONSE 3020 EXIST::FUNCTION:
2541ASN1_UTCTIME_it 3021 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
2542ASN1_UTCTIME_it 3021 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
2543_ossl_old_des_enc_write 3022 EXIST::FUNCTION:DES
2544OCSP_RESPONSE_new 3023 EXIST::FUNCTION:
2545AES_set_encrypt_key 3024 EXIST::FUNCTION:AES
2546OCSP_resp_count 3025 EXIST::FUNCTION:
2547KRB5_CHECKSUM_new 3026 EXIST::FUNCTION:
2548ENGINE_load_cswift 3027 EXIST::FUNCTION:ENGINE,STATIC_ENGINE
2549OCSP_onereq_get0_id 3028 EXIST::FUNCTION:
2550ENGINE_set_default_ciphers 3029 EXIST::FUNCTION:ENGINE
2551NOTICEREF_it 3030 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
2552NOTICEREF_it 3030 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
2553X509V3_EXT_CRL_add_nconf 3031 EXIST::FUNCTION:
2554OCSP_REVOKEDINFO_it 3032 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
2555OCSP_REVOKEDINFO_it 3032 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
2556AES_encrypt 3033 EXIST::FUNCTION:AES
2557OCSP_REQUEST_new 3034 EXIST::FUNCTION:
2558ASN1_ANY_it 3035 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
2559ASN1_ANY_it 3035 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
2560CRYPTO_ex_data_new_class 3036 EXIST::FUNCTION:
2561_ossl_old_des_ncbc_encrypt 3037 EXIST::FUNCTION:DES
2562i2d_KRB5_TKTBODY 3038 EXIST::FUNCTION:
2563EC_POINT_clear_free 3039 EXIST::FUNCTION:EC
2564AES_decrypt 3040 EXIST::FUNCTION:AES
2565asn1_enc_init 3041 EXIST::FUNCTION:
2566UI_get_result_maxsize 3042 EXIST::FUNCTION:
2567OCSP_CERTID_new 3043 EXIST::FUNCTION:
2568ENGINE_unregister_RAND 3044 EXIST::FUNCTION:ENGINE
2569UI_method_get_closer 3045 EXIST::FUNCTION:
2570d2i_KRB5_ENCDATA 3046 EXIST::FUNCTION:
2571OCSP_request_onereq_count 3047 EXIST::FUNCTION:
2572OCSP_basic_verify 3048 EXIST::FUNCTION:
2573KRB5_AUTHENTBODY_free 3049 EXIST::FUNCTION:
2574ASN1_item_d2i 3050 EXIST::FUNCTION:
2575ASN1_primitive_free 3051 EXIST::FUNCTION:
2576i2d_EXTENDED_KEY_USAGE 3052 EXIST::FUNCTION:
2577i2d_OCSP_SIGNATURE 3053 EXIST::FUNCTION:
2578asn1_enc_save 3054 EXIST::FUNCTION:
2579ENGINE_load_nuron 3055 EXIST::FUNCTION:ENGINE,STATIC_ENGINE
2580_ossl_old_des_pcbc_encrypt 3056 EXIST::FUNCTION:DES
2581PKCS12_MAC_DATA_it 3057 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
2582PKCS12_MAC_DATA_it 3057 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
2583OCSP_accept_responses_new 3058 EXIST::FUNCTION:
2584asn1_do_lock 3059 EXIST::FUNCTION:
2585PKCS7_ATTR_VERIFY_it 3060 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
2586PKCS7_ATTR_VERIFY_it 3060 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
2587KRB5_APREQBODY_it 3061 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
2588KRB5_APREQBODY_it 3061 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
2589i2d_OCSP_SINGLERESP 3062 EXIST::FUNCTION:
2590ASN1_item_ex_new 3063 EXIST::FUNCTION:
2591UI_add_verify_string 3064 EXIST::FUNCTION:
2592_ossl_old_des_set_key 3065 EXIST::FUNCTION:DES
2593KRB5_PRINCNAME_it 3066 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
2594KRB5_PRINCNAME_it 3066 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
2595EVP_DecryptInit_ex 3067 EXIST::FUNCTION:
2596i2d_OCSP_CERTID 3068 EXIST::FUNCTION:
2597ASN1_item_d2i_bio 3069 EXIST::FUNCTION:BIO
2598EC_POINT_dbl 3070 EXIST::FUNCTION:EC
2599asn1_get_choice_selector 3071 EXIST::FUNCTION:
2600i2d_KRB5_CHECKSUM 3072 EXIST::FUNCTION:
2601ENGINE_set_table_flags 3073 EXIST::FUNCTION:ENGINE
2602AES_options 3074 EXIST::FUNCTION:AES
2603ENGINE_load_chil 3075 EXIST::FUNCTION:ENGINE,STATIC_ENGINE
2604OCSP_id_cmp 3076 EXIST::FUNCTION:
2605OCSP_BASICRESP_new 3077 EXIST::FUNCTION:
2606OCSP_REQUEST_get_ext_by_NID 3078 EXIST::FUNCTION:
2607KRB5_APREQ_it 3079 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
2608KRB5_APREQ_it 3079 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
2609ENGINE_get_destroy_function 3080 EXIST::FUNCTION:ENGINE
2610CONF_set_nconf 3081 EXIST::FUNCTION:
2611ASN1_PRINTABLE_free 3082 EXIST::FUNCTION:
2612OCSP_BASICRESP_get_ext_by_NID 3083 EXIST::FUNCTION:
2613DIST_POINT_NAME_it 3084 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
2614DIST_POINT_NAME_it 3084 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
2615X509V3_extensions_print 3085 EXIST::FUNCTION:
2616_ossl_old_des_cfb64_encrypt 3086 EXIST::FUNCTION:DES
2617X509_REVOKED_add1_ext_i2d 3087 EXIST::FUNCTION:
2618_ossl_old_des_ofb_encrypt 3088 EXIST::FUNCTION:DES
2619KRB5_TKTBODY_new 3089 EXIST::FUNCTION:
2620ASN1_OCTET_STRING_it 3090 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
2621ASN1_OCTET_STRING_it 3090 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
2622ERR_load_UI_strings 3091 EXIST::FUNCTION:
2623i2d_KRB5_ENCKEY 3092 EXIST::FUNCTION:
2624ASN1_template_new 3093 EXIST::FUNCTION:
2625OCSP_SIGNATURE_free 3094 EXIST::FUNCTION:
2626ASN1_item_i2d_fp 3095 EXIST::FUNCTION:FP_API
2627KRB5_PRINCNAME_free 3096 EXIST::FUNCTION:
2628PKCS7_RECIP_INFO_it 3097 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
2629PKCS7_RECIP_INFO_it 3097 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
2630EXTENDED_KEY_USAGE_it 3098 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
2631EXTENDED_KEY_USAGE_it 3098 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
2632EC_GFp_simple_method 3099 EXIST::FUNCTION:EC
2633EC_GROUP_precompute_mult 3100 EXIST::FUNCTION:EC
2634OCSP_request_onereq_get0 3101 EXIST::FUNCTION:
2635UI_method_set_writer 3102 EXIST::FUNCTION:
2636KRB5_AUTHENT_new 3103 EXIST::FUNCTION:
2637X509_CRL_INFO_it 3104 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
2638X509_CRL_INFO_it 3104 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
2639DSO_set_name_converter 3105 EXIST::FUNCTION:
2640AES_set_decrypt_key 3106 EXIST::FUNCTION:AES
2641PKCS7_DIGEST_it 3107 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
2642PKCS7_DIGEST_it 3107 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
2643PKCS12_x5092certbag 3108 EXIST::FUNCTION:
2644EVP_DigestInit_ex 3109 EXIST::FUNCTION:
2645i2a_ACCESS_DESCRIPTION 3110 EXIST::FUNCTION:
2646OCSP_RESPONSE_it 3111 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
2647OCSP_RESPONSE_it 3111 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
2648PKCS7_ENC_CONTENT_it 3112 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
2649PKCS7_ENC_CONTENT_it 3112 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
2650OCSP_request_add0_id 3113 EXIST::FUNCTION:
2651EC_POINT_make_affine 3114 EXIST::FUNCTION:EC
2652DSO_get_filename 3115 EXIST::FUNCTION:
2653OCSP_CERTSTATUS_it 3116 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
2654OCSP_CERTSTATUS_it 3116 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
2655OCSP_request_add1_cert 3117 EXIST::FUNCTION:
2656UI_get0_output_string 3118 EXIST::FUNCTION:
2657UI_dup_verify_string 3119 EXIST::FUNCTION:
2658BN_mod_lshift 3120 EXIST::FUNCTION:
2659KRB5_AUTHDATA_it 3121 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
2660KRB5_AUTHDATA_it 3121 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
2661asn1_set_choice_selector 3122 EXIST::FUNCTION:
2662OCSP_basic_add1_status 3123 EXIST::FUNCTION:
2663OCSP_RESPID_free 3124 EXIST::FUNCTION:
2664asn1_get_field_ptr 3125 EXIST::FUNCTION:
2665UI_add_input_string 3126 EXIST::FUNCTION:
2666OCSP_CRLID_it 3127 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
2667OCSP_CRLID_it 3127 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
2668i2d_KRB5_AUTHENTBODY 3128 EXIST::FUNCTION:
2669OCSP_REQUEST_get_ext_count 3129 EXIST::FUNCTION:
2670ENGINE_load_atalla 3130 EXIST::FUNCTION:ENGINE,STATIC_ENGINE
2671X509_NAME_it 3131 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
2672X509_NAME_it 3131 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
2673USERNOTICE_it 3132 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
2674USERNOTICE_it 3132 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
2675OCSP_REQINFO_new 3133 EXIST::FUNCTION:
2676OCSP_BASICRESP_get_ext 3134 EXIST::FUNCTION:
2677CRYPTO_get_ex_data_implementation 3135 EXIST:!VMS:FUNCTION:
2678CRYPTO_get_ex_data_impl 3135 EXIST:VMS:FUNCTION:
2679ASN1_item_pack 3136 EXIST::FUNCTION:
2680i2d_KRB5_ENCDATA 3137 EXIST::FUNCTION:
2681X509_PURPOSE_set 3138 EXIST::FUNCTION:
2682X509_REQ_INFO_it 3139 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
2683X509_REQ_INFO_it 3139 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
2684UI_method_set_opener 3140 EXIST::FUNCTION:
2685ASN1_item_ex_free 3141 EXIST::FUNCTION:
2686ASN1_BOOLEAN_it 3142 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
2687ASN1_BOOLEAN_it 3142 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
2688ENGINE_get_table_flags 3143 EXIST::FUNCTION:ENGINE
2689UI_create_method 3144 EXIST::FUNCTION:
2690OCSP_ONEREQ_add1_ext_i2d 3145 EXIST::FUNCTION:
2691_shadow_DES_check_key 3146 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:DES
2692_shadow_DES_check_key 3146 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:DES
2693d2i_OCSP_REQINFO 3147 EXIST::FUNCTION:
2694UI_add_info_string 3148 EXIST::FUNCTION:
2695UI_get_result_minsize 3149 EXIST::FUNCTION:
2696ASN1_NULL_it 3150 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
2697ASN1_NULL_it 3150 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
2698BN_mod_lshift1 3151 EXIST::FUNCTION:
2699d2i_OCSP_ONEREQ 3152 EXIST::FUNCTION:
2700OCSP_ONEREQ_new 3153 EXIST::FUNCTION:
2701KRB5_TICKET_it 3154 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
2702KRB5_TICKET_it 3154 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
2703EVP_aes_192_cbc 3155 EXIST::FUNCTION:AES
2704KRB5_TICKET_free 3156 EXIST::FUNCTION:
2705UI_new 3157 EXIST::FUNCTION:
2706OCSP_response_create 3158 EXIST::FUNCTION:
2707_ossl_old_des_xcbc_encrypt 3159 EXIST::FUNCTION:DES
2708PKCS7_it 3160 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
2709PKCS7_it 3160 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
2710OCSP_REQUEST_get_ext_by_critical 3161 EXIST:!VMS:FUNCTION:
2711OCSP_REQUEST_get_ext_by_crit 3161 EXIST:VMS:FUNCTION:
2712ENGINE_set_flags 3162 EXIST::FUNCTION:ENGINE
2713_ossl_old_des_ecb_encrypt 3163 EXIST::FUNCTION:DES
2714OCSP_response_get1_basic 3164 EXIST::FUNCTION:
2715EVP_Digest 3165 EXIST::FUNCTION:
2716OCSP_ONEREQ_delete_ext 3166 EXIST::FUNCTION:
2717ASN1_TBOOLEAN_it 3167 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
2718ASN1_TBOOLEAN_it 3167 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
2719ASN1_item_new 3168 EXIST::FUNCTION:
2720ASN1_TIME_to_generalizedtime 3169 EXIST::FUNCTION:
2721BIGNUM_it 3170 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
2722BIGNUM_it 3170 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
2723AES_cbc_encrypt 3171 EXIST::FUNCTION:AES
2724ENGINE_get_load_privkey_function 3172 EXIST:!VMS:FUNCTION:ENGINE
2725ENGINE_get_load_privkey_fn 3172 EXIST:VMS:FUNCTION:ENGINE
2726OCSP_RESPONSE_free 3173 EXIST::FUNCTION:
2727UI_method_set_reader 3174 EXIST::FUNCTION:
2728i2d_ASN1_T61STRING 3175 EXIST::FUNCTION:
2729EC_POINT_set_to_infinity 3176 EXIST::FUNCTION:EC
2730ERR_load_OCSP_strings 3177 EXIST::FUNCTION:
2731EC_POINT_point2oct 3178 EXIST::FUNCTION:EC
2732KRB5_APREQ_free 3179 EXIST::FUNCTION:
2733ASN1_OBJECT_it 3180 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
2734ASN1_OBJECT_it 3180 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
2735OCSP_crlID_new 3181 EXIST:!OS2,!VMS:FUNCTION:
2736OCSP_crlID2_new 3181 EXIST:OS2,VMS:FUNCTION:
2737CONF_modules_load_file 3182 EXIST::FUNCTION:
2738CONF_imodule_set_usr_data 3183 EXIST::FUNCTION:
2739ENGINE_set_default_string 3184 EXIST::FUNCTION:ENGINE
2740CONF_module_get_usr_data 3185 EXIST::FUNCTION:
2741ASN1_add_oid_module 3186 EXIST::FUNCTION:
2742CONF_modules_finish 3187 EXIST::FUNCTION:
2743OPENSSL_config 3188 EXIST::FUNCTION:
2744CONF_modules_unload 3189 EXIST::FUNCTION:
2745CONF_imodule_get_value 3190 EXIST::FUNCTION:
2746CONF_module_set_usr_data 3191 EXIST::FUNCTION:
2747CONF_parse_list 3192 EXIST::FUNCTION:
2748CONF_module_add 3193 EXIST::FUNCTION:
2749CONF_get1_default_config_file 3194 EXIST::FUNCTION:
2750CONF_imodule_get_flags 3195 EXIST::FUNCTION:
2751CONF_imodule_get_module 3196 EXIST::FUNCTION:
2752CONF_modules_load 3197 EXIST::FUNCTION:
2753CONF_imodule_get_name 3198 EXIST::FUNCTION:
2754ERR_peek_top_error 3199 NOEXIST::FUNCTION:
2755CONF_imodule_get_usr_data 3200 EXIST::FUNCTION:
2756CONF_imodule_set_flags 3201 EXIST::FUNCTION:
2757ENGINE_add_conf_module 3202 EXIST::FUNCTION:ENGINE
2758ERR_peek_last_error_line 3203 EXIST::FUNCTION:
2759ERR_peek_last_error_line_data 3204 EXIST::FUNCTION:
2760ERR_peek_last_error 3205 EXIST::FUNCTION:
2761DES_read_2passwords 3206 EXIST::FUNCTION:DES
2762DES_read_password 3207 EXIST::FUNCTION:DES
2763UI_UTIL_read_pw 3208 EXIST::FUNCTION:
2764UI_UTIL_read_pw_string 3209 EXIST::FUNCTION:
2765ENGINE_load_aep 3210 EXIST::FUNCTION:ENGINE,STATIC_ENGINE
2766ENGINE_load_sureware 3211 EXIST::FUNCTION:ENGINE,STATIC_ENGINE
2767OPENSSL_add_all_algorithms_noconf 3212 EXIST:!VMS:FUNCTION:
2768OPENSSL_add_all_algo_noconf 3212 EXIST:VMS:FUNCTION:
2769OPENSSL_add_all_algorithms_conf 3213 EXIST:!VMS:FUNCTION:
2770OPENSSL_add_all_algo_conf 3213 EXIST:VMS:FUNCTION:
2771OPENSSL_load_builtin_modules 3214 EXIST::FUNCTION:
2772AES_ofb128_encrypt 3215 EXIST::FUNCTION:AES
2773AES_ctr128_encrypt 3216 EXIST::FUNCTION:AES
2774AES_cfb128_encrypt 3217 EXIST::FUNCTION:AES
2775ENGINE_load_4758cca 3218 EXIST::FUNCTION:ENGINE,STATIC_ENGINE
2776_ossl_096_des_random_seed 3219 EXIST::FUNCTION:DES
2777EVP_aes_256_ofb 3220 EXIST::FUNCTION:AES
2778EVP_aes_192_ofb 3221 EXIST::FUNCTION:AES
2779EVP_aes_128_cfb128 3222 EXIST::FUNCTION:AES
2780EVP_aes_256_cfb128 3223 EXIST::FUNCTION:AES
2781EVP_aes_128_ofb 3224 EXIST::FUNCTION:AES
2782EVP_aes_192_cfb128 3225 EXIST::FUNCTION:AES
2783CONF_modules_free 3226 EXIST::FUNCTION:
2784NCONF_default 3227 EXIST::FUNCTION:
2785OPENSSL_no_config 3228 EXIST::FUNCTION:
2786NCONF_WIN32 3229 EXIST::FUNCTION:
2787ASN1_UNIVERSALSTRING_new 3230 EXIST::FUNCTION:
2788EVP_des_ede_ecb 3231 EXIST::FUNCTION:DES
2789i2d_ASN1_UNIVERSALSTRING 3232 EXIST::FUNCTION:
2790ASN1_UNIVERSALSTRING_free 3233 EXIST::FUNCTION:
2791ASN1_UNIVERSALSTRING_it 3234 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
2792ASN1_UNIVERSALSTRING_it 3234 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
2793d2i_ASN1_UNIVERSALSTRING 3235 EXIST::FUNCTION:
2794EVP_des_ede3_ecb 3236 EXIST::FUNCTION:DES
2795X509_REQ_print_ex 3237 EXIST::FUNCTION:BIO
2796ENGINE_up_ref 3238 EXIST::FUNCTION:ENGINE
2797BUF_MEM_grow_clean 3239 EXIST::FUNCTION:
2798CRYPTO_realloc_clean 3240 EXIST::FUNCTION:
2799BUF_strlcat 3241 EXIST::FUNCTION:
2800BIO_indent 3242 EXIST::FUNCTION:
2801BUF_strlcpy 3243 EXIST::FUNCTION:
2802OpenSSLDie 3244 EXIST::FUNCTION:
2803OPENSSL_cleanse 3245 EXIST::FUNCTION:
2804ENGINE_setup_bsd_cryptodev 3246 EXIST:__FreeBSD__:FUNCTION:ENGINE
2805ERR_release_err_state_table 3247 EXIST::FUNCTION:LHASH
2806EVP_aes_128_cfb8 3248 EXIST::FUNCTION:AES
2807FIPS_corrupt_rsa 3249 NOEXIST::FUNCTION:
2808FIPS_selftest_des 3250 NOEXIST::FUNCTION:
2809EVP_aes_128_cfb1 3251 EXIST::FUNCTION:AES
2810EVP_aes_192_cfb8 3252 EXIST::FUNCTION:AES
2811FIPS_mode_set 3253 EXIST::FUNCTION:
2812FIPS_selftest_dsa 3254 NOEXIST::FUNCTION:
2813EVP_aes_256_cfb8 3255 EXIST::FUNCTION:AES
2814FIPS_allow_md5 3256 NOEXIST::FUNCTION:
2815DES_ede3_cfb_encrypt 3257 EXIST::FUNCTION:DES
2816EVP_des_ede3_cfb8 3258 EXIST::FUNCTION:DES
2817FIPS_rand_seeded 3259 NOEXIST::FUNCTION:
2818AES_cfbr_encrypt_block 3260 NOEXIST::FUNCTION:
2819AES_cfb8_encrypt 3261 EXIST::FUNCTION:AES
2820FIPS_rand_seed 3262 NOEXIST::FUNCTION:
2821FIPS_corrupt_des 3263 NOEXIST::FUNCTION:
2822EVP_aes_192_cfb1 3264 EXIST::FUNCTION:AES
2823FIPS_selftest_aes 3265 NOEXIST::FUNCTION:
2824FIPS_set_prng_key 3266 NOEXIST::FUNCTION:
2825EVP_des_cfb8 3267 EXIST::FUNCTION:DES
2826FIPS_corrupt_dsa 3268 NOEXIST::FUNCTION:
2827FIPS_test_mode 3269 NOEXIST::FUNCTION:
2828FIPS_rand_method 3270 NOEXIST::FUNCTION:
2829EVP_aes_256_cfb1 3271 EXIST::FUNCTION:AES
2830ERR_load_FIPS_strings 3272 NOEXIST::FUNCTION:
2831FIPS_corrupt_aes 3273 NOEXIST::FUNCTION:
2832FIPS_selftest_sha1 3274 NOEXIST::FUNCTION:
2833FIPS_selftest_rsa 3275 NOEXIST::FUNCTION:
2834FIPS_corrupt_sha1 3276 NOEXIST::FUNCTION:
2835EVP_des_cfb1 3277 EXIST::FUNCTION:DES
2836FIPS_dsa_check 3278 NOEXIST::FUNCTION:
2837AES_cfb1_encrypt 3279 EXIST::FUNCTION:AES
2838EVP_des_ede3_cfb1 3280 EXIST::FUNCTION:DES
2839FIPS_rand_check 3281 NOEXIST::FUNCTION:
2840FIPS_md5_allowed 3282 NOEXIST::FUNCTION:
2841FIPS_mode 3283 EXIST::FUNCTION:
2842FIPS_selftest_failed 3284 NOEXIST::FUNCTION:
2843sk_is_sorted 3285 EXIST::FUNCTION:
2844X509_check_ca 3286 EXIST::FUNCTION:
2845private_idea_set_encrypt_key 3287 EXIST:OPENSSL_FIPS:FUNCTION:IDEA
2846HMAC_CTX_set_flags 3288 EXIST::FUNCTION:HMAC
2847private_SHA_Init 3289 EXIST:OPENSSL_FIPS:FUNCTION:SHA,SHA0
2848private_CAST_set_key 3290 EXIST:OPENSSL_FIPS:FUNCTION:CAST
2849private_RIPEMD160_Init 3291 EXIST:OPENSSL_FIPS:FUNCTION:RIPEMD
2850private_RC5_32_set_key 3292 NOEXIST::FUNCTION:
2851private_MD5_Init 3293 EXIST:OPENSSL_FIPS:FUNCTION:MD5
2852private_RC4_set_key 3294 EXIST::FUNCTION:RC4
2853private_MDC2_Init 3295 EXIST:OPENSSL_FIPS:FUNCTION:MDC2
2854private_RC2_set_key 3296 EXIST:OPENSSL_FIPS:FUNCTION:RC2
2855private_MD4_Init 3297 EXIST:OPENSSL_FIPS:FUNCTION:MD4
2856private_BF_set_key 3298 EXIST:OPENSSL_FIPS:FUNCTION:BF
2857private_MD2_Init 3299 EXIST:OPENSSL_FIPS:FUNCTION:MD2
2858d2i_PROXY_CERT_INFO_EXTENSION 3300 EXIST::FUNCTION:
2859PROXY_POLICY_it 3301 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
2860PROXY_POLICY_it 3301 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
2861i2d_PROXY_POLICY 3302 EXIST::FUNCTION:
2862i2d_PROXY_CERT_INFO_EXTENSION 3303 EXIST::FUNCTION:
2863d2i_PROXY_POLICY 3304 EXIST::FUNCTION:
2864PROXY_CERT_INFO_EXTENSION_new 3305 EXIST::FUNCTION:
2865PROXY_CERT_INFO_EXTENSION_free 3306 EXIST::FUNCTION:
2866PROXY_CERT_INFO_EXTENSION_it 3307 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
2867PROXY_CERT_INFO_EXTENSION_it 3307 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
2868PROXY_POLICY_free 3308 EXIST::FUNCTION:
2869PROXY_POLICY_new 3309 EXIST::FUNCTION:
2870BN_MONT_CTX_set_locked 3310 EXIST::FUNCTION:
2871FIPS_selftest_rng 3311 NOEXIST::FUNCTION:
2872EVP_sha384 3312 EXIST:!VMSVAX:FUNCTION:SHA,SHA512
2873EVP_sha512 3313 EXIST:!VMSVAX:FUNCTION:SHA,SHA512
2874EVP_sha224 3314 EXIST::FUNCTION:SHA,SHA256
2875EVP_sha256 3315 EXIST::FUNCTION:SHA,SHA256
2876FIPS_selftest_hmac 3316 NOEXIST::FUNCTION:
2877FIPS_corrupt_rng 3317 NOEXIST::FUNCTION:
2878BN_mod_exp_mont_consttime 3318 EXIST::FUNCTION:
2879RSA_X931_hash_id 3319 EXIST::FUNCTION:RSA
2880RSA_padding_check_X931 3320 EXIST::FUNCTION:RSA
2881RSA_verify_PKCS1_PSS 3321 EXIST::FUNCTION:RSA
2882RSA_padding_add_X931 3322 EXIST::FUNCTION:RSA
2883RSA_padding_add_PKCS1_PSS 3323 EXIST::FUNCTION:RSA
2884PKCS1_MGF1 3324 EXIST::FUNCTION:RSA
2885BN_X931_generate_Xpq 3325 EXIST::FUNCTION:
2886RSA_X931_generate_key 3326 NOEXIST::FUNCTION:
2887BN_X931_derive_prime 3327 NOEXIST::FUNCTION:
2888BN_X931_generate_prime 3328 NOEXIST::FUNCTION:
2889RSA_X931_derive 3329 NOEXIST::FUNCTION:
2890BIO_new_dgram 3330 EXIST::FUNCTION:
2891BN_get0_nist_prime_384 3331 EXIST::FUNCTION:
2892ERR_set_mark 3332 EXIST::FUNCTION:
2893X509_STORE_CTX_set0_crls 3333 EXIST::FUNCTION:
2894ENGINE_set_STORE 3334 EXIST::FUNCTION:ENGINE
2895ENGINE_register_ECDSA 3335 EXIST::FUNCTION:ENGINE
2896STORE_meth_set_list_start_fn 3336 NOEXIST::FUNCTION:
2897STORE_method_set_list_start_function 3336 NOEXIST::FUNCTION:
2898BN_BLINDING_invert_ex 3337 EXIST::FUNCTION:
2899NAME_CONSTRAINTS_free 3338 EXIST::FUNCTION:
2900STORE_ATTR_INFO_set_number 3339 NOEXIST::FUNCTION:
2901BN_BLINDING_get_thread_id 3340 EXIST::FUNCTION:DEPRECATED
2902X509_STORE_CTX_set0_param 3341 EXIST::FUNCTION:
2903POLICY_MAPPING_it 3342 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
2904POLICY_MAPPING_it 3342 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
2905STORE_parse_attrs_start 3343 NOEXIST::FUNCTION:
2906POLICY_CONSTRAINTS_free 3344 EXIST::FUNCTION:
2907EVP_PKEY_add1_attr_by_NID 3345 EXIST::FUNCTION:
2908BN_nist_mod_192 3346 EXIST::FUNCTION:
2909EC_GROUP_get_trinomial_basis 3347 EXIST::FUNCTION:EC,EC2M
2910STORE_set_method 3348 NOEXIST::FUNCTION:
2911GENERAL_SUBTREE_free 3349 EXIST::FUNCTION:
2912NAME_CONSTRAINTS_it 3350 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
2913NAME_CONSTRAINTS_it 3350 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
2914ECDH_get_default_method 3351 EXIST::FUNCTION:ECDH
2915PKCS12_add_safe 3352 EXIST::FUNCTION:
2916EC_KEY_new_by_curve_name 3353 EXIST::FUNCTION:EC
2917STORE_meth_get_update_store_fn 3354 NOEXIST::FUNCTION:
2918STORE_method_get_update_store_function 3354 NOEXIST::FUNCTION:
2919ENGINE_register_ECDH 3355 EXIST::FUNCTION:ENGINE
2920SHA512_Update 3356 EXIST:!VMSVAX:FUNCTION:SHA,SHA512
2921i2d_ECPrivateKey 3357 EXIST::FUNCTION:EC
2922BN_get0_nist_prime_192 3358 EXIST::FUNCTION:
2923STORE_modify_certificate 3359 NOEXIST::FUNCTION:
2924EC_POINT_set_affine_coordinates_GF2m 3360 EXIST:!VMS:FUNCTION:EC,EC2M
2925EC_POINT_set_affine_coords_GF2m 3360 EXIST:VMS:FUNCTION:EC,EC2M
2926BN_GF2m_mod_exp_arr 3361 EXIST::FUNCTION:EC2M
2927STORE_ATTR_INFO_modify_number 3362 NOEXIST::FUNCTION:
2928X509_keyid_get0 3363 EXIST::FUNCTION:
2929ENGINE_load_gmp 3364 EXIST::FUNCTION:ENGINE,GMP,STATIC_ENGINE
2930pitem_new 3365 EXIST::FUNCTION:
2931BN_GF2m_mod_mul_arr 3366 EXIST::FUNCTION:EC2M
2932STORE_list_public_key_endp 3367 NOEXIST::FUNCTION:
2933o2i_ECPublicKey 3368 EXIST::FUNCTION:EC
2934EC_KEY_copy 3369 EXIST::FUNCTION:EC
2935BIO_dump_fp 3370 EXIST::FUNCTION:FP_API
2936X509_policy_node_get0_parent 3371 EXIST::FUNCTION:
2937EC_GROUP_check_discriminant 3372 EXIST::FUNCTION:EC
2938i2o_ECPublicKey 3373 EXIST::FUNCTION:EC
2939EC_KEY_precompute_mult 3374 EXIST::FUNCTION:EC
2940a2i_IPADDRESS 3375 EXIST::FUNCTION:
2941STORE_meth_set_initialise_fn 3376 NOEXIST::FUNCTION:
2942STORE_method_set_initialise_function 3376 NOEXIST::FUNCTION:
2943X509_STORE_CTX_set_depth 3377 EXIST::FUNCTION:
2944X509_VERIFY_PARAM_inherit 3378 EXIST::FUNCTION:
2945EC_POINT_point2bn 3379 EXIST::FUNCTION:EC
2946STORE_ATTR_INFO_set_dn 3380 NOEXIST::FUNCTION:
2947X509_policy_tree_get0_policies 3381 EXIST::FUNCTION:
2948EC_GROUP_new_curve_GF2m 3382 EXIST::FUNCTION:EC,EC2M
2949STORE_destroy_method 3383 NOEXIST::FUNCTION:
2950ENGINE_unregister_STORE 3384 EXIST::FUNCTION:ENGINE
2951EVP_PKEY_get1_EC_KEY 3385 EXIST::FUNCTION:EC
2952STORE_ATTR_INFO_get0_number 3386 NOEXIST::FUNCTION:
2953ENGINE_get_default_ECDH 3387 EXIST::FUNCTION:ENGINE
2954EC_KEY_get_conv_form 3388 EXIST::FUNCTION:EC
2955ASN1_OCTET_STRING_NDEF_it 3389 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
2956ASN1_OCTET_STRING_NDEF_it 3389 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
2957STORE_delete_public_key 3390 NOEXIST::FUNCTION:
2958STORE_get_public_key 3391 NOEXIST::FUNCTION:
2959STORE_modify_arbitrary 3392 NOEXIST::FUNCTION:
2960ENGINE_get_static_state 3393 EXIST::FUNCTION:ENGINE
2961pqueue_iterator 3394 EXIST::FUNCTION:
2962ECDSA_SIG_new 3395 EXIST::FUNCTION:ECDSA
2963OPENSSL_DIR_end 3396 EXIST::FUNCTION:
2964BN_GF2m_mod_sqr 3397 EXIST::FUNCTION:EC2M
2965EC_POINT_bn2point 3398 EXIST::FUNCTION:EC
2966X509_VERIFY_PARAM_set_depth 3399 EXIST::FUNCTION:
2967EC_KEY_set_asn1_flag 3400 EXIST::FUNCTION:EC
2968STORE_get_method 3401 NOEXIST::FUNCTION:
2969EC_KEY_get_key_method_data 3402 EXIST::FUNCTION:EC
2970ECDSA_sign_ex 3403 EXIST::FUNCTION:ECDSA
2971STORE_parse_attrs_end 3404 NOEXIST::FUNCTION:
2972EC_GROUP_get_point_conversion_form 3405 EXIST:!VMS:FUNCTION:EC
2973EC_GROUP_get_point_conv_form 3405 EXIST:VMS:FUNCTION:EC
2974STORE_method_set_store_function 3406 NOEXIST::FUNCTION:
2975STORE_ATTR_INFO_in 3407 NOEXIST::FUNCTION:
2976PEM_read_bio_ECPKParameters 3408 EXIST::FUNCTION:EC
2977EC_GROUP_get_pentanomial_basis 3409 EXIST::FUNCTION:EC,EC2M
2978EVP_PKEY_add1_attr_by_txt 3410 EXIST::FUNCTION:
2979BN_BLINDING_set_flags 3411 EXIST::FUNCTION:
2980X509_VERIFY_PARAM_set1_policies 3412 EXIST::FUNCTION:
2981X509_VERIFY_PARAM_set1_name 3413 EXIST::FUNCTION:
2982X509_VERIFY_PARAM_set_purpose 3414 EXIST::FUNCTION:
2983STORE_get_number 3415 NOEXIST::FUNCTION:
2984ECDSA_sign_setup 3416 EXIST::FUNCTION:ECDSA
2985BN_GF2m_mod_solve_quad_arr 3417 EXIST::FUNCTION:EC2M
2986EC_KEY_up_ref 3418 EXIST::FUNCTION:EC
2987POLICY_MAPPING_free 3419 EXIST::FUNCTION:
2988BN_GF2m_mod_div 3420 EXIST::FUNCTION:EC2M
2989X509_VERIFY_PARAM_set_flags 3421 EXIST::FUNCTION:
2990EC_KEY_free 3422 EXIST::FUNCTION:EC
2991STORE_meth_set_list_next_fn 3423 NOEXIST::FUNCTION:
2992STORE_method_set_list_next_function 3423 NOEXIST::FUNCTION:
2993PEM_write_bio_ECPrivateKey 3424 EXIST::FUNCTION:EC
2994d2i_EC_PUBKEY 3425 EXIST::FUNCTION:EC
2995STORE_meth_get_generate_fn 3426 NOEXIST::FUNCTION:
2996STORE_method_get_generate_function 3426 NOEXIST::FUNCTION:
2997STORE_meth_set_list_end_fn 3427 NOEXIST::FUNCTION:
2998STORE_method_set_list_end_function 3427 NOEXIST::FUNCTION:
2999pqueue_print 3428 EXIST::FUNCTION:
3000EC_GROUP_have_precompute_mult 3429 EXIST::FUNCTION:EC
3001EC_KEY_print_fp 3430 EXIST::FUNCTION:EC,FP_API
3002BN_GF2m_mod_arr 3431 EXIST::FUNCTION:EC2M
3003PEM_write_bio_X509_CERT_PAIR 3432 EXIST::FUNCTION:
3004EVP_PKEY_cmp 3433 EXIST::FUNCTION:
3005X509_policy_level_node_count 3434 EXIST::FUNCTION:
3006STORE_new_engine 3435 NOEXIST::FUNCTION:
3007STORE_list_public_key_start 3436 NOEXIST::FUNCTION:
3008X509_VERIFY_PARAM_new 3437 EXIST::FUNCTION:
3009ECDH_get_ex_data 3438 EXIST::FUNCTION:ECDH
3010EVP_PKEY_get_attr 3439 EXIST::FUNCTION:
3011ECDSA_do_sign 3440 EXIST::FUNCTION:ECDSA
3012ENGINE_unregister_ECDH 3441 EXIST::FUNCTION:ENGINE
3013ECDH_OpenSSL 3442 EXIST::FUNCTION:ECDH
3014EC_KEY_set_conv_form 3443 EXIST::FUNCTION:EC
3015EC_POINT_dup 3444 EXIST::FUNCTION:EC
3016GENERAL_SUBTREE_new 3445 EXIST::FUNCTION:
3017STORE_list_crl_endp 3446 NOEXIST::FUNCTION:
3018EC_get_builtin_curves 3447 EXIST::FUNCTION:EC
3019X509_policy_node_get0_qualifiers 3448 EXIST:!VMS:FUNCTION:
3020X509_pcy_node_get0_qualifiers 3448 EXIST:VMS:FUNCTION:
3021STORE_list_crl_end 3449 NOEXIST::FUNCTION:
3022EVP_PKEY_set1_EC_KEY 3450 EXIST::FUNCTION:EC
3023BN_GF2m_mod_sqrt_arr 3451 EXIST::FUNCTION:EC2M
3024i2d_ECPrivateKey_bio 3452 EXIST::FUNCTION:BIO,EC
3025ECPKParameters_print_fp 3453 EXIST::FUNCTION:EC,FP_API
3026pqueue_find 3454 EXIST::FUNCTION:
3027ECDSA_SIG_free 3455 EXIST::FUNCTION:ECDSA
3028PEM_write_bio_ECPKParameters 3456 EXIST::FUNCTION:EC
3029STORE_method_set_ctrl_function 3457 NOEXIST::FUNCTION:
3030STORE_list_public_key_end 3458 NOEXIST::FUNCTION:
3031EC_KEY_set_private_key 3459 EXIST::FUNCTION:EC
3032pqueue_peek 3460 EXIST::FUNCTION:
3033STORE_get_arbitrary 3461 NOEXIST::FUNCTION:
3034STORE_store_crl 3462 NOEXIST::FUNCTION:
3035X509_policy_node_get0_policy 3463 EXIST::FUNCTION:
3036PKCS12_add_safes 3464 EXIST::FUNCTION:
3037BN_BLINDING_convert_ex 3465 EXIST::FUNCTION:
3038X509_policy_tree_free 3466 EXIST::FUNCTION:
3039OPENSSL_ia32cap_loc 3467 EXIST::FUNCTION:
3040BN_GF2m_poly2arr 3468 EXIST::FUNCTION:EC2M
3041STORE_ctrl 3469 NOEXIST::FUNCTION:
3042STORE_ATTR_INFO_compare 3470 NOEXIST::FUNCTION:
3043BN_get0_nist_prime_224 3471 EXIST::FUNCTION:
3044i2d_ECParameters 3472 EXIST::FUNCTION:EC
3045i2d_ECPKParameters 3473 EXIST::FUNCTION:EC
3046BN_GENCB_call 3474 EXIST::FUNCTION:
3047d2i_ECPKParameters 3475 EXIST::FUNCTION:EC
3048STORE_meth_set_generate_fn 3476 NOEXIST::FUNCTION:
3049STORE_method_set_generate_function 3476 NOEXIST::FUNCTION:
3050ENGINE_set_ECDH 3477 EXIST::FUNCTION:ENGINE
3051NAME_CONSTRAINTS_new 3478 EXIST::FUNCTION:
3052SHA256_Init 3479 EXIST::FUNCTION:SHA,SHA256
3053EC_KEY_get0_public_key 3480 EXIST::FUNCTION:EC
3054PEM_write_bio_EC_PUBKEY 3481 EXIST::FUNCTION:EC
3055STORE_ATTR_INFO_set_cstr 3482 NOEXIST::FUNCTION:
3056STORE_list_crl_next 3483 NOEXIST::FUNCTION:
3057STORE_ATTR_INFO_in_range 3484 NOEXIST::FUNCTION:
3058ECParameters_print 3485 EXIST::FUNCTION:BIO,EC
3059STORE_meth_set_delete_fn 3486 NOEXIST::FUNCTION:
3060STORE_method_set_delete_function 3486 NOEXIST::FUNCTION:
3061STORE_list_certificate_next 3487 NOEXIST::FUNCTION:
3062ASN1_generate_nconf 3488 EXIST::FUNCTION:
3063BUF_memdup 3489 EXIST::FUNCTION:
3064BN_GF2m_mod_mul 3490 EXIST::FUNCTION:EC2M
3065STORE_meth_get_list_next_fn 3491 NOEXIST::FUNCTION:
3066STORE_method_get_list_next_function 3491 NOEXIST::FUNCTION:
3067STORE_ATTR_INFO_get0_dn 3492 NOEXIST::FUNCTION:
3068STORE_list_private_key_next 3493 NOEXIST::FUNCTION:
3069EC_GROUP_set_seed 3494 EXIST::FUNCTION:EC
3070X509_VERIFY_PARAM_set_trust 3495 EXIST::FUNCTION:
3071STORE_ATTR_INFO_free 3496 NOEXIST::FUNCTION:
3072STORE_get_private_key 3497 NOEXIST::FUNCTION:
3073EVP_PKEY_get_attr_count 3498 EXIST::FUNCTION:
3074STORE_ATTR_INFO_new 3499 NOEXIST::FUNCTION:
3075EC_GROUP_get_curve_GF2m 3500 EXIST::FUNCTION:EC,EC2M
3076STORE_meth_set_revoke_fn 3501 NOEXIST::FUNCTION:
3077STORE_method_set_revoke_function 3501 NOEXIST::FUNCTION:
3078STORE_store_number 3502 NOEXIST::FUNCTION:
3079BN_is_prime_ex 3503 EXIST::FUNCTION:
3080STORE_revoke_public_key 3504 NOEXIST::FUNCTION:
3081X509_STORE_CTX_get0_param 3505 EXIST::FUNCTION:
3082STORE_delete_arbitrary 3506 NOEXIST::FUNCTION:
3083PEM_read_X509_CERT_PAIR 3507 EXIST:!WIN16:FUNCTION:
3084X509_STORE_set_depth 3508 EXIST::FUNCTION:
3085ECDSA_get_ex_data 3509 EXIST::FUNCTION:ECDSA
3086SHA224 3510 EXIST::FUNCTION:SHA,SHA256
3087BIO_dump_indent_fp 3511 EXIST::FUNCTION:FP_API
3088EC_KEY_set_group 3512 EXIST::FUNCTION:EC
3089BUF_strndup 3513 EXIST::FUNCTION:
3090STORE_list_certificate_start 3514 NOEXIST::FUNCTION:
3091BN_GF2m_mod 3515 EXIST::FUNCTION:EC2M
3092X509_REQ_check_private_key 3516 EXIST::FUNCTION:
3093EC_GROUP_get_seed_len 3517 EXIST::FUNCTION:EC
3094ERR_load_STORE_strings 3518 NOEXIST::FUNCTION:
3095PEM_read_bio_EC_PUBKEY 3519 EXIST::FUNCTION:EC
3096STORE_list_private_key_end 3520 NOEXIST::FUNCTION:
3097i2d_EC_PUBKEY 3521 EXIST::FUNCTION:EC
3098ECDSA_get_default_method 3522 EXIST::FUNCTION:ECDSA
3099ASN1_put_eoc 3523 EXIST::FUNCTION:
3100X509_STORE_CTX_get_explicit_policy 3524 EXIST:!VMS:FUNCTION:
3101X509_STORE_CTX_get_expl_policy 3524 EXIST:VMS:FUNCTION:
3102X509_VERIFY_PARAM_table_cleanup 3525 EXIST::FUNCTION:
3103STORE_modify_private_key 3526 NOEXIST::FUNCTION:
3104X509_VERIFY_PARAM_free 3527 EXIST::FUNCTION:
3105EC_METHOD_get_field_type 3528 EXIST::FUNCTION:EC
3106EC_GFp_nist_method 3529 EXIST::FUNCTION:EC
3107STORE_meth_set_modify_fn 3530 NOEXIST::FUNCTION:
3108STORE_method_set_modify_function 3530 NOEXIST::FUNCTION:
3109STORE_parse_attrs_next 3531 NOEXIST::FUNCTION:
3110ENGINE_load_padlock 3532 EXIST::FUNCTION:ENGINE,STATIC_ENGINE
3111EC_GROUP_set_curve_name 3533 EXIST::FUNCTION:EC
3112X509_CERT_PAIR_it 3534 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
3113X509_CERT_PAIR_it 3534 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
3114STORE_meth_get_revoke_fn 3535 NOEXIST::FUNCTION:
3115STORE_method_get_revoke_function 3535 NOEXIST::FUNCTION:
3116STORE_method_set_get_function 3536 NOEXIST::FUNCTION:
3117STORE_modify_number 3537 NOEXIST::FUNCTION:
3118STORE_method_get_store_function 3538 NOEXIST::FUNCTION:
3119STORE_store_private_key 3539 NOEXIST::FUNCTION:
3120BN_GF2m_mod_sqr_arr 3540 EXIST::FUNCTION:EC2M
3121RSA_setup_blinding 3541 EXIST::FUNCTION:RSA
3122BIO_s_datagram 3542 EXIST::FUNCTION:DGRAM
3123STORE_Memory 3543 NOEXIST::FUNCTION:
3124sk_find_ex 3544 EXIST::FUNCTION:
3125EC_GROUP_set_curve_GF2m 3545 EXIST::FUNCTION:EC,EC2M
3126ENGINE_set_default_ECDSA 3546 EXIST::FUNCTION:ENGINE
3127POLICY_CONSTRAINTS_new 3547 EXIST::FUNCTION:
3128BN_GF2m_mod_sqrt 3548 EXIST::FUNCTION:EC2M
3129ECDH_set_default_method 3549 EXIST::FUNCTION:ECDH
3130EC_KEY_generate_key 3550 EXIST::FUNCTION:EC
3131SHA384_Update 3551 EXIST:!VMSVAX:FUNCTION:SHA,SHA512
3132BN_GF2m_arr2poly 3552 EXIST::FUNCTION:EC2M
3133STORE_method_get_get_function 3553 NOEXIST::FUNCTION:
3134STORE_meth_set_cleanup_fn 3554 NOEXIST::FUNCTION:
3135STORE_method_set_cleanup_function 3554 NOEXIST::FUNCTION:
3136EC_GROUP_check 3555 EXIST::FUNCTION:EC
3137d2i_ECPrivateKey_bio 3556 EXIST::FUNCTION:BIO,EC
3138EC_KEY_insert_key_method_data 3557 EXIST::FUNCTION:EC
3139STORE_meth_get_lock_store_fn 3558 NOEXIST::FUNCTION:
3140STORE_method_get_lock_store_function 3558 NOEXIST::FUNCTION:
3141X509_VERIFY_PARAM_get_depth 3559 EXIST::FUNCTION:
3142SHA224_Final 3560 EXIST::FUNCTION:SHA,SHA256
3143STORE_meth_set_update_store_fn 3561 NOEXIST::FUNCTION:
3144STORE_method_set_update_store_function 3561 NOEXIST::FUNCTION:
3145SHA224_Update 3562 EXIST::FUNCTION:SHA,SHA256
3146d2i_ECPrivateKey 3563 EXIST::FUNCTION:EC
3147ASN1_item_ndef_i2d 3564 EXIST::FUNCTION:
3148STORE_delete_private_key 3565 NOEXIST::FUNCTION:
3149ERR_pop_to_mark 3566 EXIST::FUNCTION:
3150ENGINE_register_all_STORE 3567 EXIST::FUNCTION:ENGINE
3151X509_policy_level_get0_node 3568 EXIST::FUNCTION:
3152i2d_PKCS7_NDEF 3569 EXIST::FUNCTION:
3153EC_GROUP_get_degree 3570 EXIST::FUNCTION:EC
3154ASN1_generate_v3 3571 EXIST::FUNCTION:
3155STORE_ATTR_INFO_modify_cstr 3572 NOEXIST::FUNCTION:
3156X509_policy_tree_level_count 3573 EXIST::FUNCTION:
3157BN_GF2m_add 3574 EXIST::FUNCTION:EC2M
3158EC_KEY_get0_group 3575 EXIST::FUNCTION:EC
3159STORE_generate_crl 3576 NOEXIST::FUNCTION:
3160STORE_store_public_key 3577 NOEXIST::FUNCTION:
3161X509_CERT_PAIR_free 3578 EXIST::FUNCTION:
3162STORE_revoke_private_key 3579 NOEXIST::FUNCTION:
3163BN_nist_mod_224 3580 EXIST::FUNCTION:
3164SHA512_Final 3581 EXIST:!VMSVAX:FUNCTION:SHA,SHA512
3165STORE_ATTR_INFO_modify_dn 3582 NOEXIST::FUNCTION:
3166STORE_meth_get_initialise_fn 3583 NOEXIST::FUNCTION:
3167STORE_method_get_initialise_function 3583 NOEXIST::FUNCTION:
3168STORE_delete_number 3584 NOEXIST::FUNCTION:
3169i2d_EC_PUBKEY_bio 3585 EXIST::FUNCTION:BIO,EC
3170BIO_dgram_non_fatal_error 3586 EXIST::FUNCTION:
3171EC_GROUP_get_asn1_flag 3587 EXIST::FUNCTION:EC
3172STORE_ATTR_INFO_in_ex 3588 NOEXIST::FUNCTION:
3173STORE_list_crl_start 3589 NOEXIST::FUNCTION:
3174ECDH_get_ex_new_index 3590 EXIST::FUNCTION:ECDH
3175STORE_meth_get_modify_fn 3591 NOEXIST::FUNCTION:
3176STORE_method_get_modify_function 3591 NOEXIST::FUNCTION:
3177v2i_ASN1_BIT_STRING 3592 EXIST::FUNCTION:
3178STORE_store_certificate 3593 NOEXIST::FUNCTION:
3179OBJ_bsearch_ex 3594 NOEXIST::FUNCTION:
3180X509_STORE_CTX_set_default 3595 EXIST::FUNCTION:
3181STORE_ATTR_INFO_set_sha1str 3596 NOEXIST::FUNCTION:
3182BN_GF2m_mod_inv 3597 EXIST::FUNCTION:EC2M
3183BN_GF2m_mod_exp 3598 EXIST::FUNCTION:EC2M
3184STORE_modify_public_key 3599 NOEXIST::FUNCTION:
3185STORE_meth_get_list_start_fn 3600 NOEXIST::FUNCTION:
3186STORE_method_get_list_start_function 3600 NOEXIST::FUNCTION:
3187EC_GROUP_get0_seed 3601 EXIST::FUNCTION:EC
3188STORE_store_arbitrary 3602 NOEXIST::FUNCTION:
3189STORE_meth_set_unlock_store_fn 3603 NOEXIST::FUNCTION:
3190STORE_method_set_unlock_store_function 3603 NOEXIST::FUNCTION:
3191BN_GF2m_mod_div_arr 3604 EXIST::FUNCTION:EC2M
3192ENGINE_set_ECDSA 3605 EXIST::FUNCTION:ENGINE
3193STORE_create_method 3606 NOEXIST::FUNCTION:
3194ECPKParameters_print 3607 EXIST::FUNCTION:BIO,EC
3195EC_KEY_get0_private_key 3608 EXIST::FUNCTION:EC
3196PEM_write_EC_PUBKEY 3609 EXIST:!WIN16:FUNCTION:EC
3197X509_VERIFY_PARAM_set1 3610 EXIST::FUNCTION:
3198ECDH_set_method 3611 EXIST::FUNCTION:ECDH
3199v2i_GENERAL_NAME_ex 3612 EXIST::FUNCTION:
3200ECDH_set_ex_data 3613 EXIST::FUNCTION:ECDH
3201STORE_generate_key 3614 NOEXIST::FUNCTION:
3202BN_nist_mod_521 3615 EXIST::FUNCTION:
3203X509_policy_tree_get0_level 3616 EXIST::FUNCTION:
3204EC_GROUP_set_point_conversion_form 3617 EXIST:!VMS:FUNCTION:EC
3205EC_GROUP_set_point_conv_form 3617 EXIST:VMS:FUNCTION:EC
3206PEM_read_EC_PUBKEY 3618 EXIST:!WIN16:FUNCTION:EC
3207i2d_ECDSA_SIG 3619 EXIST::FUNCTION:ECDSA
3208ECDSA_OpenSSL 3620 EXIST::FUNCTION:ECDSA
3209STORE_delete_crl 3621 NOEXIST::FUNCTION:
3210EC_KEY_get_enc_flags 3622 EXIST::FUNCTION:EC
3211ASN1_const_check_infinite_end 3623 EXIST::FUNCTION:
3212EVP_PKEY_delete_attr 3624 EXIST::FUNCTION:
3213ECDSA_set_default_method 3625 EXIST::FUNCTION:ECDSA
3214EC_POINT_set_compressed_coordinates_GF2m 3626 EXIST:!VMS:FUNCTION:EC,EC2M
3215EC_POINT_set_compr_coords_GF2m 3626 EXIST:VMS:FUNCTION:EC,EC2M
3216EC_GROUP_cmp 3627 EXIST::FUNCTION:EC
3217STORE_revoke_certificate 3628 NOEXIST::FUNCTION:
3218BN_get0_nist_prime_256 3629 EXIST::FUNCTION:
3219STORE_meth_get_delete_fn 3630 NOEXIST::FUNCTION:
3220STORE_method_get_delete_function 3630 NOEXIST::FUNCTION:
3221SHA224_Init 3631 EXIST::FUNCTION:SHA,SHA256
3222PEM_read_ECPrivateKey 3632 EXIST:!WIN16:FUNCTION:EC
3223SHA512_Init 3633 EXIST:!VMSVAX:FUNCTION:SHA,SHA512
3224STORE_parse_attrs_endp 3634 NOEXIST::FUNCTION:
3225BN_set_negative 3635 EXIST::FUNCTION:
3226ERR_load_ECDSA_strings 3636 EXIST::FUNCTION:ECDSA
3227EC_GROUP_get_basis_type 3637 EXIST::FUNCTION:EC
3228STORE_list_public_key_next 3638 NOEXIST::FUNCTION:
3229i2v_ASN1_BIT_STRING 3639 EXIST::FUNCTION:
3230STORE_OBJECT_free 3640 NOEXIST::FUNCTION:
3231BN_nist_mod_384 3641 EXIST::FUNCTION:
3232i2d_X509_CERT_PAIR 3642 EXIST::FUNCTION:
3233PEM_write_ECPKParameters 3643 EXIST:!WIN16:FUNCTION:EC
3234ECDH_compute_key 3644 EXIST::FUNCTION:ECDH
3235STORE_ATTR_INFO_get0_sha1str 3645 NOEXIST::FUNCTION:
3236ENGINE_register_all_ECDH 3646 EXIST::FUNCTION:ENGINE
3237pqueue_pop 3647 EXIST::FUNCTION:
3238STORE_ATTR_INFO_get0_cstr 3648 NOEXIST::FUNCTION:
3239POLICY_CONSTRAINTS_it 3649 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
3240POLICY_CONSTRAINTS_it 3649 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
3241STORE_get_ex_new_index 3650 NOEXIST::FUNCTION:
3242EVP_PKEY_get_attr_by_OBJ 3651 EXIST::FUNCTION:
3243X509_VERIFY_PARAM_add0_policy 3652 EXIST::FUNCTION:
3244BN_GF2m_mod_solve_quad 3653 EXIST::FUNCTION:EC2M
3245SHA256 3654 EXIST::FUNCTION:SHA,SHA256
3246i2d_ECPrivateKey_fp 3655 EXIST::FUNCTION:EC,FP_API
3247X509_policy_tree_get0_user_policies 3656 EXIST:!VMS:FUNCTION:
3248X509_pcy_tree_get0_usr_policies 3656 EXIST:VMS:FUNCTION:
3249OPENSSL_DIR_read 3657 EXIST::FUNCTION:
3250ENGINE_register_all_ECDSA 3658 EXIST::FUNCTION:ENGINE
3251X509_VERIFY_PARAM_lookup 3659 EXIST::FUNCTION:
3252EC_POINT_get_affine_coordinates_GF2m 3660 EXIST:!VMS:FUNCTION:EC,EC2M
3253EC_POINT_get_affine_coords_GF2m 3660 EXIST:VMS:FUNCTION:EC,EC2M
3254EC_GROUP_dup 3661 EXIST::FUNCTION:EC
3255ENGINE_get_default_ECDSA 3662 EXIST::FUNCTION:ENGINE
3256EC_KEY_new 3663 EXIST::FUNCTION:EC
3257SHA256_Transform 3664 EXIST::FUNCTION:SHA,SHA256
3258EC_KEY_set_enc_flags 3665 EXIST::FUNCTION:EC
3259ECDSA_verify 3666 EXIST::FUNCTION:ECDSA
3260EC_POINT_point2hex 3667 EXIST::FUNCTION:EC
3261ENGINE_get_STORE 3668 EXIST::FUNCTION:ENGINE
3262SHA512 3669 EXIST:!VMSVAX:FUNCTION:SHA,SHA512
3263STORE_get_certificate 3670 NOEXIST::FUNCTION:
3264ECDSA_do_sign_ex 3671 EXIST::FUNCTION:ECDSA
3265ECDSA_do_verify 3672 EXIST::FUNCTION:ECDSA
3266d2i_ECPrivateKey_fp 3673 EXIST::FUNCTION:EC,FP_API
3267STORE_delete_certificate 3674 NOEXIST::FUNCTION:
3268SHA512_Transform 3675 EXIST:!VMSVAX:FUNCTION:SHA,SHA512
3269X509_STORE_set1_param 3676 EXIST::FUNCTION:
3270STORE_method_get_ctrl_function 3677 NOEXIST::FUNCTION:
3271STORE_free 3678 NOEXIST::FUNCTION:
3272PEM_write_ECPrivateKey 3679 EXIST:!WIN16:FUNCTION:EC
3273STORE_meth_get_unlock_store_fn 3680 NOEXIST::FUNCTION:
3274STORE_method_get_unlock_store_function 3680 NOEXIST::FUNCTION:
3275STORE_get_ex_data 3681 NOEXIST::FUNCTION:
3276EC_KEY_set_public_key 3682 EXIST::FUNCTION:EC
3277PEM_read_ECPKParameters 3683 EXIST:!WIN16:FUNCTION:EC
3278X509_CERT_PAIR_new 3684 EXIST::FUNCTION:
3279ENGINE_register_STORE 3685 EXIST::FUNCTION:ENGINE
3280RSA_generate_key_ex 3686 EXIST::FUNCTION:RSA
3281DSA_generate_parameters_ex 3687 EXIST::FUNCTION:DSA
3282ECParameters_print_fp 3688 EXIST::FUNCTION:EC,FP_API
3283X509V3_NAME_from_section 3689 EXIST::FUNCTION:
3284EVP_PKEY_add1_attr 3690 EXIST::FUNCTION:
3285STORE_modify_crl 3691 NOEXIST::FUNCTION:
3286STORE_list_private_key_start 3692 NOEXIST::FUNCTION:
3287POLICY_MAPPINGS_it 3693 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
3288POLICY_MAPPINGS_it 3693 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
3289GENERAL_SUBTREE_it 3694 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
3290GENERAL_SUBTREE_it 3694 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
3291EC_GROUP_get_curve_name 3695 EXIST::FUNCTION:EC
3292PEM_write_X509_CERT_PAIR 3696 EXIST:!WIN16:FUNCTION:
3293BIO_dump_indent_cb 3697 EXIST::FUNCTION:
3294d2i_X509_CERT_PAIR 3698 EXIST::FUNCTION:
3295STORE_list_private_key_endp 3699 NOEXIST::FUNCTION:
3296asn1_const_Finish 3700 EXIST::FUNCTION:
3297i2d_EC_PUBKEY_fp 3701 EXIST::FUNCTION:EC,FP_API
3298BN_nist_mod_256 3702 EXIST::FUNCTION:
3299X509_VERIFY_PARAM_add0_table 3703 EXIST::FUNCTION:
3300pqueue_free 3704 EXIST::FUNCTION:
3301BN_BLINDING_create_param 3705 EXIST::FUNCTION:
3302ECDSA_size 3706 EXIST::FUNCTION:ECDSA
3303d2i_EC_PUBKEY_bio 3707 EXIST::FUNCTION:BIO,EC
3304BN_get0_nist_prime_521 3708 EXIST::FUNCTION:
3305STORE_ATTR_INFO_modify_sha1str 3709 NOEXIST::FUNCTION:
3306BN_generate_prime_ex 3710 EXIST::FUNCTION:
3307EC_GROUP_new_by_curve_name 3711 EXIST::FUNCTION:EC
3308SHA256_Final 3712 EXIST::FUNCTION:SHA,SHA256
3309DH_generate_parameters_ex 3713 EXIST::FUNCTION:DH
3310PEM_read_bio_ECPrivateKey 3714 EXIST::FUNCTION:EC
3311STORE_meth_get_cleanup_fn 3715 NOEXIST::FUNCTION:
3312STORE_method_get_cleanup_function 3715 NOEXIST::FUNCTION:
3313ENGINE_get_ECDH 3716 EXIST::FUNCTION:ENGINE
3314d2i_ECDSA_SIG 3717 EXIST::FUNCTION:ECDSA
3315BN_is_prime_fasttest_ex 3718 EXIST::FUNCTION:
3316ECDSA_sign 3719 EXIST::FUNCTION:ECDSA
3317X509_policy_check 3720 EXIST::FUNCTION:
3318EVP_PKEY_get_attr_by_NID 3721 EXIST::FUNCTION:
3319STORE_set_ex_data 3722 NOEXIST::FUNCTION:
3320ENGINE_get_ECDSA 3723 EXIST::FUNCTION:ENGINE
3321EVP_ecdsa 3724 EXIST::FUNCTION:SHA
3322BN_BLINDING_get_flags 3725 EXIST::FUNCTION:
3323PKCS12_add_cert 3726 EXIST::FUNCTION:
3324STORE_OBJECT_new 3727 NOEXIST::FUNCTION:
3325ERR_load_ECDH_strings 3728 EXIST::FUNCTION:ECDH
3326EC_KEY_dup 3729 EXIST::FUNCTION:EC
3327EVP_CIPHER_CTX_rand_key 3730 EXIST::FUNCTION:
3328ECDSA_set_method 3731 EXIST::FUNCTION:ECDSA
3329a2i_IPADDRESS_NC 3732 EXIST::FUNCTION:
3330d2i_ECParameters 3733 EXIST::FUNCTION:EC
3331STORE_list_certificate_end 3734 NOEXIST::FUNCTION:
3332STORE_get_crl 3735 NOEXIST::FUNCTION:
3333X509_POLICY_NODE_print 3736 EXIST::FUNCTION:
3334SHA384_Init 3737 EXIST:!VMSVAX:FUNCTION:SHA,SHA512
3335EC_GF2m_simple_method 3738 EXIST::FUNCTION:EC,EC2M
3336ECDSA_set_ex_data 3739 EXIST::FUNCTION:ECDSA
3337SHA384_Final 3740 EXIST:!VMSVAX:FUNCTION:SHA,SHA512
3338PKCS7_set_digest 3741 EXIST::FUNCTION:
3339EC_KEY_print 3742 EXIST::FUNCTION:BIO,EC
3340STORE_meth_set_lock_store_fn 3743 NOEXIST::FUNCTION:
3341STORE_method_set_lock_store_function 3743 NOEXIST::FUNCTION:
3342ECDSA_get_ex_new_index 3744 EXIST::FUNCTION:ECDSA
3343SHA384 3745 EXIST:!VMSVAX:FUNCTION:SHA,SHA512
3344POLICY_MAPPING_new 3746 EXIST::FUNCTION:
3345STORE_list_certificate_endp 3747 NOEXIST::FUNCTION:
3346X509_STORE_CTX_get0_policy_tree 3748 EXIST::FUNCTION:
3347EC_GROUP_set_asn1_flag 3749 EXIST::FUNCTION:EC
3348EC_KEY_check_key 3750 EXIST::FUNCTION:EC
3349d2i_EC_PUBKEY_fp 3751 EXIST::FUNCTION:EC,FP_API
3350PKCS7_set0_type_other 3752 EXIST::FUNCTION:
3351PEM_read_bio_X509_CERT_PAIR 3753 EXIST::FUNCTION:
3352pqueue_next 3754 EXIST::FUNCTION:
3353STORE_meth_get_list_end_fn 3755 NOEXIST::FUNCTION:
3354STORE_method_get_list_end_function 3755 NOEXIST::FUNCTION:
3355EVP_PKEY_add1_attr_by_OBJ 3756 EXIST::FUNCTION:
3356X509_VERIFY_PARAM_set_time 3757 EXIST::FUNCTION:
3357pqueue_new 3758 EXIST::FUNCTION:
3358ENGINE_set_default_ECDH 3759 EXIST::FUNCTION:ENGINE
3359STORE_new_method 3760 NOEXIST::FUNCTION:
3360PKCS12_add_key 3761 EXIST::FUNCTION:
3361DSO_merge 3762 EXIST::FUNCTION:
3362EC_POINT_hex2point 3763 EXIST::FUNCTION:EC
3363BIO_dump_cb 3764 EXIST::FUNCTION:
3364SHA256_Update 3765 EXIST::FUNCTION:SHA,SHA256
3365pqueue_insert 3766 EXIST::FUNCTION:
3366pitem_free 3767 EXIST::FUNCTION:
3367BN_GF2m_mod_inv_arr 3768 EXIST::FUNCTION:EC2M
3368ENGINE_unregister_ECDSA 3769 EXIST::FUNCTION:ENGINE
3369BN_BLINDING_set_thread_id 3770 EXIST::FUNCTION:DEPRECATED
3370get_rfc3526_prime_8192 3771 EXIST::FUNCTION:
3371X509_VERIFY_PARAM_clear_flags 3772 EXIST::FUNCTION:
3372get_rfc2409_prime_1024 3773 EXIST::FUNCTION:
3373DH_check_pub_key 3774 EXIST::FUNCTION:DH
3374get_rfc3526_prime_2048 3775 EXIST::FUNCTION:
3375get_rfc3526_prime_6144 3776 EXIST::FUNCTION:
3376get_rfc3526_prime_1536 3777 EXIST::FUNCTION:
3377get_rfc3526_prime_3072 3778 EXIST::FUNCTION:
3378get_rfc3526_prime_4096 3779 EXIST::FUNCTION:
3379get_rfc2409_prime_768 3780 EXIST::FUNCTION:
3380X509_VERIFY_PARAM_get_flags 3781 EXIST::FUNCTION:
3381EVP_CIPHER_CTX_new 3782 EXIST::FUNCTION:
3382EVP_CIPHER_CTX_free 3783 EXIST::FUNCTION:
3383Camellia_cbc_encrypt 3784 EXIST::FUNCTION:CAMELLIA
3384Camellia_cfb128_encrypt 3785 EXIST::FUNCTION:CAMELLIA
3385Camellia_cfb1_encrypt 3786 EXIST::FUNCTION:CAMELLIA
3386Camellia_cfb8_encrypt 3787 EXIST::FUNCTION:CAMELLIA
3387Camellia_ctr128_encrypt 3788 EXIST::FUNCTION:CAMELLIA
3388Camellia_cfbr_encrypt_block 3789 NOEXIST::FUNCTION:
3389Camellia_decrypt 3790 EXIST::FUNCTION:CAMELLIA
3390Camellia_ecb_encrypt 3791 EXIST::FUNCTION:CAMELLIA
3391Camellia_encrypt 3792 EXIST::FUNCTION:CAMELLIA
3392Camellia_ofb128_encrypt 3793 EXIST::FUNCTION:CAMELLIA
3393Camellia_set_key 3794 EXIST::FUNCTION:CAMELLIA
3394EVP_camellia_128_cbc 3795 EXIST::FUNCTION:CAMELLIA
3395EVP_camellia_128_cfb128 3796 EXIST::FUNCTION:CAMELLIA
3396EVP_camellia_128_cfb1 3797 EXIST::FUNCTION:CAMELLIA
3397EVP_camellia_128_cfb8 3798 EXIST::FUNCTION:CAMELLIA
3398EVP_camellia_128_ecb 3799 EXIST::FUNCTION:CAMELLIA
3399EVP_camellia_128_ofb 3800 EXIST::FUNCTION:CAMELLIA
3400EVP_camellia_192_cbc 3801 EXIST::FUNCTION:CAMELLIA
3401EVP_camellia_192_cfb128 3802 EXIST::FUNCTION:CAMELLIA
3402EVP_camellia_192_cfb1 3803 EXIST::FUNCTION:CAMELLIA
3403EVP_camellia_192_cfb8 3804 EXIST::FUNCTION:CAMELLIA
3404EVP_camellia_192_ecb 3805 EXIST::FUNCTION:CAMELLIA
3405EVP_camellia_192_ofb 3806 EXIST::FUNCTION:CAMELLIA
3406EVP_camellia_256_cbc 3807 EXIST::FUNCTION:CAMELLIA
3407EVP_camellia_256_cfb128 3808 EXIST::FUNCTION:CAMELLIA
3408EVP_camellia_256_cfb1 3809 EXIST::FUNCTION:CAMELLIA
3409EVP_camellia_256_cfb8 3810 EXIST::FUNCTION:CAMELLIA
3410EVP_camellia_256_ecb 3811 EXIST::FUNCTION:CAMELLIA
3411EVP_camellia_256_ofb 3812 EXIST::FUNCTION:CAMELLIA
3412a2i_ipadd 3813 EXIST::FUNCTION:
3413ASIdentifiers_free 3814 EXIST::FUNCTION:RFC3779
3414i2d_ASIdOrRange 3815 EXIST::FUNCTION:RFC3779
3415EVP_CIPHER_block_size 3816 EXIST::FUNCTION:
3416v3_asid_is_canonical 3817 EXIST::FUNCTION:RFC3779
3417IPAddressChoice_free 3818 EXIST::FUNCTION:RFC3779
3418EVP_CIPHER_CTX_set_app_data 3819 EXIST::FUNCTION:
3419BIO_set_callback_arg 3820 EXIST::FUNCTION:
3420v3_addr_add_prefix 3821 EXIST::FUNCTION:RFC3779
3421IPAddressOrRange_it 3822 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:RFC3779
3422IPAddressOrRange_it 3822 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:RFC3779
3423BIO_set_flags 3823 EXIST::FUNCTION:
3424ASIdentifiers_it 3824 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:RFC3779
3425ASIdentifiers_it 3824 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:RFC3779
3426v3_addr_get_range 3825 EXIST::FUNCTION:RFC3779
3427BIO_method_type 3826 EXIST::FUNCTION:
3428v3_addr_inherits 3827 EXIST::FUNCTION:RFC3779
3429IPAddressChoice_it 3828 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:RFC3779
3430IPAddressChoice_it 3828 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:RFC3779
3431AES_ige_encrypt 3829 EXIST::FUNCTION:AES
3432v3_addr_add_range 3830 EXIST::FUNCTION:RFC3779
3433EVP_CIPHER_CTX_nid 3831 EXIST::FUNCTION:
3434d2i_ASRange 3832 EXIST::FUNCTION:RFC3779
3435v3_addr_add_inherit 3833 EXIST::FUNCTION:RFC3779
3436v3_asid_add_id_or_range 3834 EXIST::FUNCTION:RFC3779
3437v3_addr_validate_resource_set 3835 EXIST::FUNCTION:RFC3779
3438EVP_CIPHER_iv_length 3836 EXIST::FUNCTION:
3439EVP_MD_type 3837 EXIST::FUNCTION:
3440v3_asid_canonize 3838 EXIST::FUNCTION:RFC3779
3441IPAddressRange_free 3839 EXIST::FUNCTION:RFC3779
3442v3_asid_add_inherit 3840 EXIST::FUNCTION:RFC3779
3443EVP_CIPHER_CTX_key_length 3841 EXIST::FUNCTION:
3444IPAddressRange_new 3842 EXIST::FUNCTION:RFC3779
3445ASIdOrRange_new 3843 EXIST::FUNCTION:RFC3779
3446EVP_MD_size 3844 EXIST::FUNCTION:
3447EVP_MD_CTX_test_flags 3845 EXIST::FUNCTION:
3448BIO_clear_flags 3846 EXIST::FUNCTION:
3449i2d_ASRange 3847 EXIST::FUNCTION:RFC3779
3450IPAddressRange_it 3848 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:RFC3779
3451IPAddressRange_it 3848 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:RFC3779
3452IPAddressChoice_new 3849 EXIST::FUNCTION:RFC3779
3453ASIdentifierChoice_new 3850 EXIST::FUNCTION:RFC3779
3454ASRange_free 3851 EXIST::FUNCTION:RFC3779
3455EVP_MD_pkey_type 3852 EXIST::FUNCTION:
3456EVP_MD_CTX_clear_flags 3853 EXIST::FUNCTION:
3457IPAddressFamily_free 3854 EXIST::FUNCTION:RFC3779
3458i2d_IPAddressFamily 3855 EXIST::FUNCTION:RFC3779
3459IPAddressOrRange_new 3856 EXIST::FUNCTION:RFC3779
3460EVP_CIPHER_flags 3857 EXIST::FUNCTION:
3461v3_asid_validate_resource_set 3858 EXIST::FUNCTION:RFC3779
3462d2i_IPAddressRange 3859 EXIST::FUNCTION:RFC3779
3463AES_bi_ige_encrypt 3860 EXIST::FUNCTION:AES
3464BIO_get_callback 3861 EXIST::FUNCTION:
3465IPAddressOrRange_free 3862 EXIST::FUNCTION:RFC3779
3466v3_addr_subset 3863 EXIST::FUNCTION:RFC3779
3467d2i_IPAddressFamily 3864 EXIST::FUNCTION:RFC3779
3468v3_asid_subset 3865 EXIST::FUNCTION:RFC3779
3469BIO_test_flags 3866 EXIST::FUNCTION:
3470i2d_ASIdentifierChoice 3867 EXIST::FUNCTION:RFC3779
3471ASRange_it 3868 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:RFC3779
3472ASRange_it 3868 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:RFC3779
3473d2i_ASIdentifiers 3869 EXIST::FUNCTION:RFC3779
3474ASRange_new 3870 EXIST::FUNCTION:RFC3779
3475d2i_IPAddressChoice 3871 EXIST::FUNCTION:RFC3779
3476v3_addr_get_afi 3872 EXIST::FUNCTION:RFC3779
3477EVP_CIPHER_key_length 3873 EXIST::FUNCTION:
3478EVP_Cipher 3874 EXIST::FUNCTION:
3479i2d_IPAddressOrRange 3875 EXIST::FUNCTION:RFC3779
3480ASIdOrRange_it 3876 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:RFC3779
3481ASIdOrRange_it 3876 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:RFC3779
3482EVP_CIPHER_nid 3877 EXIST::FUNCTION:
3483i2d_IPAddressChoice 3878 EXIST::FUNCTION:RFC3779
3484EVP_CIPHER_CTX_block_size 3879 EXIST::FUNCTION:
3485ASIdentifiers_new 3880 EXIST::FUNCTION:RFC3779
3486v3_addr_validate_path 3881 EXIST::FUNCTION:RFC3779
3487IPAddressFamily_new 3882 EXIST::FUNCTION:RFC3779
3488EVP_MD_CTX_set_flags 3883 EXIST::FUNCTION:
3489v3_addr_is_canonical 3884 EXIST::FUNCTION:RFC3779
3490i2d_IPAddressRange 3885 EXIST::FUNCTION:RFC3779
3491IPAddressFamily_it 3886 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:RFC3779
3492IPAddressFamily_it 3886 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:RFC3779
3493v3_asid_inherits 3887 EXIST::FUNCTION:RFC3779
3494EVP_CIPHER_CTX_cipher 3888 EXIST::FUNCTION:
3495EVP_CIPHER_CTX_get_app_data 3889 EXIST::FUNCTION:
3496EVP_MD_block_size 3890 EXIST::FUNCTION:
3497EVP_CIPHER_CTX_flags 3891 EXIST::FUNCTION:
3498v3_asid_validate_path 3892 EXIST::FUNCTION:RFC3779
3499d2i_IPAddressOrRange 3893 EXIST::FUNCTION:RFC3779
3500v3_addr_canonize 3894 EXIST::FUNCTION:RFC3779
3501ASIdentifierChoice_it 3895 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:RFC3779
3502ASIdentifierChoice_it 3895 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:RFC3779
3503EVP_MD_CTX_md 3896 EXIST::FUNCTION:
3504d2i_ASIdentifierChoice 3897 EXIST::FUNCTION:RFC3779
3505BIO_method_name 3898 EXIST::FUNCTION:
3506EVP_CIPHER_CTX_iv_length 3899 EXIST::FUNCTION:
3507ASIdOrRange_free 3900 EXIST::FUNCTION:RFC3779
3508ASIdentifierChoice_free 3901 EXIST::FUNCTION:RFC3779
3509BIO_get_callback_arg 3902 EXIST::FUNCTION:
3510BIO_set_callback 3903 EXIST::FUNCTION:
3511d2i_ASIdOrRange 3904 EXIST::FUNCTION:RFC3779
3512i2d_ASIdentifiers 3905 EXIST::FUNCTION:RFC3779
3513SEED_decrypt 3908 EXIST::FUNCTION:SEED
3514SEED_encrypt 3909 EXIST::FUNCTION:SEED
3515SEED_cbc_encrypt 3910 EXIST::FUNCTION:SEED
3516EVP_seed_ofb 3911 EXIST::FUNCTION:SEED
3517SEED_cfb128_encrypt 3912 EXIST::FUNCTION:SEED
3518SEED_ofb128_encrypt 3913 EXIST::FUNCTION:SEED
3519EVP_seed_cbc 3914 EXIST::FUNCTION:SEED
3520SEED_ecb_encrypt 3915 EXIST::FUNCTION:SEED
3521EVP_seed_ecb 3916 EXIST::FUNCTION:SEED
3522SEED_set_key 3917 EXIST::FUNCTION:SEED
3523EVP_seed_cfb128 3918 EXIST::FUNCTION:SEED
3524X509_EXTENSIONS_it 3919 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
3525X509_EXTENSIONS_it 3919 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
3526X509_get1_ocsp 3920 EXIST::FUNCTION:
3527OCSP_REQ_CTX_free 3921 EXIST::FUNCTION:
3528i2d_X509_EXTENSIONS 3922 EXIST::FUNCTION:
3529OCSP_sendreq_nbio 3923 EXIST::FUNCTION:
3530OCSP_sendreq_new 3924 EXIST::FUNCTION:
3531d2i_X509_EXTENSIONS 3925 EXIST::FUNCTION:
3532X509_ALGORS_it 3926 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
3533X509_ALGORS_it 3926 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
3534X509_ALGOR_get0 3927 EXIST::FUNCTION:
3535X509_ALGOR_set0 3928 EXIST::FUNCTION:
3536AES_unwrap_key 3929 EXIST::FUNCTION:AES
3537AES_wrap_key 3930 EXIST::FUNCTION:AES
3538X509at_get0_data_by_OBJ 3931 EXIST::FUNCTION:
3539ASN1_TYPE_set1 3932 EXIST::FUNCTION:
3540ASN1_STRING_set0 3933 EXIST::FUNCTION:
3541i2d_X509_ALGORS 3934 EXIST::FUNCTION:
3542BIO_f_zlib 3935 EXIST:ZLIB:FUNCTION:
3543COMP_zlib_cleanup 3936 EXIST::FUNCTION:
3544d2i_X509_ALGORS 3937 EXIST::FUNCTION:
3545CMS_ReceiptRequest_free 3938 EXIST::FUNCTION:CMS
3546PEM_write_CMS 3939 EXIST:!WIN16:FUNCTION:CMS
3547CMS_add0_CertificateChoices 3940 EXIST::FUNCTION:CMS
3548CMS_unsigned_add1_attr_by_OBJ 3941 EXIST::FUNCTION:CMS
3549ERR_load_CMS_strings 3942 EXIST::FUNCTION:CMS
3550CMS_sign_receipt 3943 EXIST::FUNCTION:CMS
3551i2d_CMS_ContentInfo 3944 EXIST::FUNCTION:CMS
3552CMS_signed_delete_attr 3945 EXIST::FUNCTION:CMS
3553d2i_CMS_bio 3946 EXIST::FUNCTION:CMS
3554CMS_unsigned_get_attr_by_NID 3947 EXIST::FUNCTION:CMS
3555CMS_verify 3948 EXIST::FUNCTION:CMS
3556SMIME_read_CMS 3949 EXIST::FUNCTION:CMS
3557CMS_decrypt_set1_key 3950 EXIST::FUNCTION:CMS
3558CMS_SignerInfo_get0_algs 3951 EXIST::FUNCTION:CMS
3559CMS_add1_cert 3952 EXIST::FUNCTION:CMS
3560CMS_set_detached 3953 EXIST::FUNCTION:CMS
3561CMS_encrypt 3954 EXIST::FUNCTION:CMS
3562CMS_EnvelopedData_create 3955 EXIST::FUNCTION:CMS
3563CMS_uncompress 3956 EXIST::FUNCTION:CMS
3564CMS_add0_crl 3957 EXIST::FUNCTION:CMS
3565CMS_SignerInfo_verify_content 3958 EXIST::FUNCTION:CMS
3566CMS_unsigned_get0_data_by_OBJ 3959 EXIST::FUNCTION:CMS
3567PEM_write_bio_CMS 3960 EXIST::FUNCTION:CMS
3568CMS_unsigned_get_attr 3961 EXIST::FUNCTION:CMS
3569CMS_RecipientInfo_ktri_cert_cmp 3962 EXIST::FUNCTION:CMS
3570CMS_RecipientInfo_ktri_get0_algs 3963 EXIST:!VMS:FUNCTION:CMS
3571CMS_RecipInfo_ktri_get0_algs 3963 EXIST:VMS:FUNCTION:CMS
3572CMS_ContentInfo_free 3964 EXIST::FUNCTION:CMS
3573CMS_final 3965 EXIST::FUNCTION:CMS
3574CMS_add_simple_smimecap 3966 EXIST::FUNCTION:CMS
3575CMS_SignerInfo_verify 3967 EXIST::FUNCTION:CMS
3576CMS_data 3968 EXIST::FUNCTION:CMS
3577CMS_ContentInfo_it 3969 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:CMS
3578CMS_ContentInfo_it 3969 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:CMS
3579d2i_CMS_ReceiptRequest 3970 EXIST::FUNCTION:CMS
3580CMS_compress 3971 EXIST::FUNCTION:CMS
3581CMS_digest_create 3972 EXIST::FUNCTION:CMS
3582CMS_SignerInfo_cert_cmp 3973 EXIST::FUNCTION:CMS
3583CMS_SignerInfo_sign 3974 EXIST::FUNCTION:CMS
3584CMS_data_create 3975 EXIST::FUNCTION:CMS
3585i2d_CMS_bio 3976 EXIST::FUNCTION:CMS
3586CMS_EncryptedData_set1_key 3977 EXIST::FUNCTION:CMS
3587CMS_decrypt 3978 EXIST::FUNCTION:CMS
3588int_smime_write_ASN1 3979 NOEXIST::FUNCTION:
3589CMS_unsigned_delete_attr 3980 EXIST::FUNCTION:CMS
3590CMS_unsigned_get_attr_count 3981 EXIST::FUNCTION:CMS
3591CMS_add_smimecap 3982 EXIST::FUNCTION:CMS
3592PEM_read_CMS 3983 EXIST:!WIN16:FUNCTION:CMS
3593CMS_signed_get_attr_by_OBJ 3984 EXIST::FUNCTION:CMS
3594d2i_CMS_ContentInfo 3985 EXIST::FUNCTION:CMS
3595CMS_add_standard_smimecap 3986 EXIST::FUNCTION:CMS
3596CMS_ContentInfo_new 3987 EXIST::FUNCTION:CMS
3597CMS_RecipientInfo_type 3988 EXIST::FUNCTION:CMS
3598CMS_get0_type 3989 EXIST::FUNCTION:CMS
3599CMS_is_detached 3990 EXIST::FUNCTION:CMS
3600CMS_sign 3991 EXIST::FUNCTION:CMS
3601CMS_signed_add1_attr 3992 EXIST::FUNCTION:CMS
3602CMS_unsigned_get_attr_by_OBJ 3993 EXIST::FUNCTION:CMS
3603SMIME_write_CMS 3994 EXIST::FUNCTION:CMS
3604CMS_EncryptedData_decrypt 3995 EXIST::FUNCTION:CMS
3605CMS_get0_RecipientInfos 3996 EXIST::FUNCTION:CMS
3606CMS_add0_RevocationInfoChoice 3997 EXIST::FUNCTION:CMS
3607CMS_decrypt_set1_pkey 3998 EXIST::FUNCTION:CMS
3608CMS_SignerInfo_set1_signer_cert 3999 EXIST::FUNCTION:CMS
3609CMS_get0_signers 4000 EXIST::FUNCTION:CMS
3610CMS_ReceiptRequest_get0_values 4001 EXIST::FUNCTION:CMS
3611CMS_signed_get0_data_by_OBJ 4002 EXIST::FUNCTION:CMS
3612CMS_get0_SignerInfos 4003 EXIST::FUNCTION:CMS
3613CMS_add0_cert 4004 EXIST::FUNCTION:CMS
3614CMS_EncryptedData_encrypt 4005 EXIST::FUNCTION:CMS
3615CMS_digest_verify 4006 EXIST::FUNCTION:CMS
3616CMS_set1_signers_certs 4007 EXIST::FUNCTION:CMS
3617CMS_signed_get_attr 4008 EXIST::FUNCTION:CMS
3618CMS_RecipientInfo_set0_key 4009 EXIST::FUNCTION:CMS
3619CMS_SignedData_init 4010 EXIST::FUNCTION:CMS
3620CMS_RecipientInfo_kekri_get0_id 4011 EXIST::FUNCTION:CMS
3621CMS_verify_receipt 4012 EXIST::FUNCTION:CMS
3622CMS_ReceiptRequest_it 4013 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:CMS
3623CMS_ReceiptRequest_it 4013 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:CMS
3624PEM_read_bio_CMS 4014 EXIST::FUNCTION:CMS
3625CMS_get1_crls 4015 EXIST::FUNCTION:CMS
3626CMS_add0_recipient_key 4016 EXIST::FUNCTION:CMS
3627SMIME_read_ASN1 4017 EXIST::FUNCTION:
3628CMS_ReceiptRequest_new 4018 EXIST::FUNCTION:CMS
3629CMS_get0_content 4019 EXIST::FUNCTION:CMS
3630CMS_get1_ReceiptRequest 4020 EXIST::FUNCTION:CMS
3631CMS_signed_add1_attr_by_OBJ 4021 EXIST::FUNCTION:CMS
3632CMS_RecipientInfo_kekri_id_cmp 4022 EXIST::FUNCTION:CMS
3633CMS_add1_ReceiptRequest 4023 EXIST::FUNCTION:CMS
3634CMS_SignerInfo_get0_signer_id 4024 EXIST::FUNCTION:CMS
3635CMS_unsigned_add1_attr_by_NID 4025 EXIST::FUNCTION:CMS
3636CMS_unsigned_add1_attr 4026 EXIST::FUNCTION:CMS
3637CMS_signed_get_attr_by_NID 4027 EXIST::FUNCTION:CMS
3638CMS_get1_certs 4028 EXIST::FUNCTION:CMS
3639CMS_signed_add1_attr_by_NID 4029 EXIST::FUNCTION:CMS
3640CMS_unsigned_add1_attr_by_txt 4030 EXIST::FUNCTION:CMS
3641CMS_dataFinal 4031 EXIST::FUNCTION:CMS
3642CMS_RecipientInfo_ktri_get0_signer_id 4032 EXIST:!VMS:FUNCTION:CMS
3643CMS_RecipInfo_ktri_get0_sigr_id 4032 EXIST:VMS:FUNCTION:CMS
3644i2d_CMS_ReceiptRequest 4033 EXIST::FUNCTION:CMS
3645CMS_add1_recipient_cert 4034 EXIST::FUNCTION:CMS
3646CMS_dataInit 4035 EXIST::FUNCTION:CMS
3647CMS_signed_add1_attr_by_txt 4036 EXIST::FUNCTION:CMS
3648CMS_RecipientInfo_decrypt 4037 EXIST::FUNCTION:CMS
3649CMS_signed_get_attr_count 4038 EXIST::FUNCTION:CMS
3650CMS_get0_eContentType 4039 EXIST::FUNCTION:CMS
3651CMS_set1_eContentType 4040 EXIST::FUNCTION:CMS
3652CMS_ReceiptRequest_create0 4041 EXIST::FUNCTION:CMS
3653CMS_add1_signer 4042 EXIST::FUNCTION:CMS
3654CMS_RecipientInfo_set0_pkey 4043 EXIST::FUNCTION:CMS
3655ENGINE_set_load_ssl_client_cert_function 4044 EXIST:!VMS:FUNCTION:ENGINE
3656ENGINE_set_ld_ssl_clnt_cert_fn 4044 EXIST:VMS:FUNCTION:ENGINE
3657ENGINE_get_ssl_client_cert_function 4045 EXIST:!VMS:FUNCTION:ENGINE
3658ENGINE_get_ssl_client_cert_fn 4045 EXIST:VMS:FUNCTION:ENGINE
3659ENGINE_load_ssl_client_cert 4046 EXIST::FUNCTION:ENGINE
3660ENGINE_load_capi 4047 EXIST::FUNCTION:ENGINE,STATIC_ENGINE
3661OPENSSL_isservice 4048 EXIST::FUNCTION:
3662FIPS_dsa_sig_decode 4049 NOEXIST::FUNCTION:
3663EVP_CIPHER_CTX_clear_flags 4050 EXIST::FUNCTION:
3664FIPS_rand_status 4051 NOEXIST::FUNCTION:
3665FIPS_rand_set_key 4052 NOEXIST::FUNCTION:
3666CRYPTO_set_mem_info_functions 4053 NOEXIST::FUNCTION:
3667RSA_X931_generate_key_ex 4054 NOEXIST::FUNCTION:
3668int_ERR_set_state_func 4055 NOEXIST::FUNCTION:
3669int_EVP_MD_set_engine_callbacks 4056 NOEXIST::FUNCTION:
3670int_CRYPTO_set_do_dynlock_callback 4057 NOEXIST::FUNCTION:
3671FIPS_rng_stick 4058 NOEXIST::FUNCTION:
3672EVP_CIPHER_CTX_set_flags 4059 EXIST::FUNCTION:
3673BN_X931_generate_prime_ex 4060 EXIST::FUNCTION:
3674FIPS_selftest_check 4061 NOEXIST::FUNCTION:
3675FIPS_rand_set_dt 4062 NOEXIST::FUNCTION:
3676CRYPTO_dbg_pop_info 4063 NOEXIST::FUNCTION:
3677FIPS_dsa_free 4064 NOEXIST::FUNCTION:
3678RSA_X931_derive_ex 4065 NOEXIST::FUNCTION:
3679FIPS_rsa_new 4066 NOEXIST::FUNCTION:
3680FIPS_rand_bytes 4067 NOEXIST::FUNCTION:
3681fips_cipher_test 4068 NOEXIST::FUNCTION:
3682EVP_CIPHER_CTX_test_flags 4069 EXIST::FUNCTION:
3683CRYPTO_malloc_debug_init 4070 NOEXIST::FUNCTION:
3684CRYPTO_dbg_push_info 4071 NOEXIST::FUNCTION:
3685FIPS_corrupt_rsa_keygen 4072 NOEXIST::FUNCTION:
3686FIPS_dh_new 4073 NOEXIST::FUNCTION:
3687FIPS_corrupt_dsa_keygen 4074 NOEXIST::FUNCTION:
3688FIPS_dh_free 4075 NOEXIST::FUNCTION:
3689fips_pkey_signature_test 4076 NOEXIST::FUNCTION:
3690EVP_add_alg_module 4077 NOEXIST::FUNCTION:
3691int_RAND_init_engine_callbacks 4078 NOEXIST::FUNCTION:
3692int_EVP_CIPHER_set_engine_callbacks 4079 NOEXIST::FUNCTION:
3693int_EVP_MD_init_engine_callbacks 4080 NOEXIST::FUNCTION:
3694FIPS_rand_test_mode 4081 NOEXIST::FUNCTION:
3695FIPS_rand_reset 4082 NOEXIST::FUNCTION:
3696FIPS_dsa_new 4083 NOEXIST::FUNCTION:
3697int_RAND_set_callbacks 4084 NOEXIST::FUNCTION:
3698BN_X931_derive_prime_ex 4085 EXIST::FUNCTION:
3699int_ERR_lib_init 4086 NOEXIST::FUNCTION:
3700int_EVP_CIPHER_init_engine_callbacks 4087 NOEXIST::FUNCTION:
3701FIPS_rsa_free 4088 NOEXIST::FUNCTION:
3702FIPS_dsa_sig_encode 4089 NOEXIST::FUNCTION:
3703CRYPTO_dbg_remove_all_info 4090 NOEXIST::FUNCTION:
3704OPENSSL_init 4091 EXIST::FUNCTION:
3705private_Camellia_set_key 4092 EXIST:OPENSSL_FIPS:FUNCTION:CAMELLIA
3706CRYPTO_strdup 4093 EXIST::FUNCTION:
3707JPAKE_STEP3A_process 4094 EXIST::FUNCTION:JPAKE
3708JPAKE_STEP1_release 4095 EXIST::FUNCTION:JPAKE
3709JPAKE_get_shared_key 4096 EXIST::FUNCTION:JPAKE
3710JPAKE_STEP3B_init 4097 EXIST::FUNCTION:JPAKE
3711JPAKE_STEP1_generate 4098 EXIST::FUNCTION:JPAKE
3712JPAKE_STEP1_init 4099 EXIST::FUNCTION:JPAKE
3713JPAKE_STEP3B_process 4100 EXIST::FUNCTION:JPAKE
3714JPAKE_STEP2_generate 4101 EXIST::FUNCTION:JPAKE
3715JPAKE_CTX_new 4102 EXIST::FUNCTION:JPAKE
3716JPAKE_CTX_free 4103 EXIST::FUNCTION:JPAKE
3717JPAKE_STEP3B_release 4104 EXIST::FUNCTION:JPAKE
3718JPAKE_STEP3A_release 4105 EXIST::FUNCTION:JPAKE
3719JPAKE_STEP2_process 4106 EXIST::FUNCTION:JPAKE
3720JPAKE_STEP3B_generate 4107 EXIST::FUNCTION:JPAKE
3721JPAKE_STEP1_process 4108 EXIST::FUNCTION:JPAKE
3722JPAKE_STEP3A_generate 4109 EXIST::FUNCTION:JPAKE
3723JPAKE_STEP2_release 4110 EXIST::FUNCTION:JPAKE
3724JPAKE_STEP3A_init 4111 EXIST::FUNCTION:JPAKE
3725ERR_load_JPAKE_strings 4112 EXIST::FUNCTION:JPAKE
3726JPAKE_STEP2_init 4113 EXIST::FUNCTION:JPAKE
3727pqueue_size 4114 EXIST::FUNCTION:
3728i2d_TS_ACCURACY 4115 EXIST::FUNCTION:
3729i2d_TS_MSG_IMPRINT_fp 4116 EXIST::FUNCTION:
3730i2d_TS_MSG_IMPRINT 4117 EXIST::FUNCTION:
3731EVP_PKEY_print_public 4118 EXIST::FUNCTION:
3732EVP_PKEY_CTX_new 4119 EXIST::FUNCTION:
3733i2d_TS_TST_INFO 4120 EXIST::FUNCTION:
3734EVP_PKEY_asn1_find 4121 EXIST::FUNCTION:
3735DSO_METHOD_beos 4122 EXIST::FUNCTION:
3736TS_CONF_load_cert 4123 EXIST::FUNCTION:
3737TS_REQ_get_ext 4124 EXIST::FUNCTION:
3738EVP_PKEY_sign_init 4125 EXIST::FUNCTION:
3739ASN1_item_print 4126 EXIST::FUNCTION:
3740TS_TST_INFO_set_nonce 4127 EXIST::FUNCTION:
3741TS_RESP_dup 4128 EXIST::FUNCTION:
3742ENGINE_register_pkey_meths 4129 EXIST::FUNCTION:ENGINE
3743EVP_PKEY_asn1_add0 4130 EXIST::FUNCTION:
3744PKCS7_add0_attrib_signing_time 4131 EXIST::FUNCTION:
3745i2d_TS_TST_INFO_fp 4132 EXIST::FUNCTION:
3746BIO_asn1_get_prefix 4133 EXIST::FUNCTION:
3747TS_TST_INFO_set_time 4134 EXIST::FUNCTION:
3748EVP_PKEY_meth_set_decrypt 4135 EXIST::FUNCTION:
3749EVP_PKEY_set_type_str 4136 EXIST::FUNCTION:
3750EVP_PKEY_CTX_get_keygen_info 4137 EXIST::FUNCTION:
3751TS_REQ_set_policy_id 4138 EXIST::FUNCTION:
3752d2i_TS_RESP_fp 4139 EXIST::FUNCTION:
3753ENGINE_get_pkey_asn1_meth_engine 4140 EXIST:!VMS:FUNCTION:ENGINE
3754ENGINE_get_pkey_asn1_meth_eng 4140 EXIST:VMS:FUNCTION:ENGINE
3755WHIRLPOOL_Init 4141 EXIST:!VMSVAX:FUNCTION:WHIRLPOOL
3756TS_RESP_set_status_info 4142 EXIST::FUNCTION:
3757EVP_PKEY_keygen 4143 EXIST::FUNCTION:
3758EVP_DigestSignInit 4144 EXIST::FUNCTION:
3759TS_ACCURACY_set_millis 4145 EXIST::FUNCTION:
3760TS_REQ_dup 4146 EXIST::FUNCTION:
3761GENERAL_NAME_dup 4147 EXIST::FUNCTION:
3762ASN1_SEQUENCE_ANY_it 4148 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
3763ASN1_SEQUENCE_ANY_it 4148 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
3764WHIRLPOOL 4149 EXIST:!VMSVAX:FUNCTION:WHIRLPOOL
3765X509_STORE_get1_crls 4150 EXIST::FUNCTION:
3766ENGINE_get_pkey_asn1_meth 4151 EXIST::FUNCTION:ENGINE
3767EVP_PKEY_asn1_new 4152 EXIST::FUNCTION:
3768BIO_new_NDEF 4153 EXIST::FUNCTION:
3769ENGINE_get_pkey_meth 4154 EXIST::FUNCTION:ENGINE
3770TS_MSG_IMPRINT_set_algo 4155 EXIST::FUNCTION:
3771i2d_TS_TST_INFO_bio 4156 EXIST::FUNCTION:
3772TS_TST_INFO_set_ordering 4157 EXIST::FUNCTION:
3773TS_TST_INFO_get_ext_by_OBJ 4158 EXIST::FUNCTION:
3774CRYPTO_THREADID_set_pointer 4159 EXIST::FUNCTION:
3775TS_CONF_get_tsa_section 4160 EXIST::FUNCTION:
3776SMIME_write_ASN1 4161 EXIST::FUNCTION:
3777TS_RESP_CTX_set_signer_key 4162 EXIST::FUNCTION:
3778EVP_PKEY_encrypt_old 4163 EXIST::FUNCTION:
3779EVP_PKEY_encrypt_init 4164 EXIST::FUNCTION:
3780CRYPTO_THREADID_cpy 4165 EXIST::FUNCTION:
3781ASN1_PCTX_get_cert_flags 4166 EXIST::FUNCTION:
3782i2d_ESS_SIGNING_CERT 4167 EXIST::FUNCTION:
3783TS_CONF_load_key 4168 EXIST::FUNCTION:
3784i2d_ASN1_SEQUENCE_ANY 4169 EXIST::FUNCTION:
3785d2i_TS_MSG_IMPRINT_bio 4170 EXIST::FUNCTION:
3786EVP_PKEY_asn1_set_public 4171 EXIST::FUNCTION:
3787b2i_PublicKey_bio 4172 EXIST::FUNCTION:
3788BIO_asn1_set_prefix 4173 EXIST::FUNCTION:
3789EVP_PKEY_new_mac_key 4174 EXIST::FUNCTION:
3790BIO_new_CMS 4175 EXIST::FUNCTION:CMS
3791CRYPTO_THREADID_cmp 4176 EXIST::FUNCTION:
3792TS_REQ_ext_free 4177 EXIST::FUNCTION:
3793EVP_PKEY_asn1_set_free 4178 EXIST::FUNCTION:
3794EVP_PKEY_get0_asn1 4179 EXIST::FUNCTION:
3795d2i_NETSCAPE_X509 4180 EXIST::FUNCTION:
3796EVP_PKEY_verify_recover_init 4181 EXIST::FUNCTION:
3797EVP_PKEY_CTX_set_data 4182 EXIST::FUNCTION:
3798EVP_PKEY_keygen_init 4183 EXIST::FUNCTION:
3799TS_RESP_CTX_set_status_info 4184 EXIST::FUNCTION:
3800TS_MSG_IMPRINT_get_algo 4185 EXIST::FUNCTION:
3801TS_REQ_print_bio 4186 EXIST::FUNCTION:
3802EVP_PKEY_CTX_ctrl_str 4187 EXIST::FUNCTION:
3803EVP_PKEY_get_default_digest_nid 4188 EXIST::FUNCTION:
3804PEM_write_bio_PKCS7_stream 4189 EXIST::FUNCTION:
3805TS_MSG_IMPRINT_print_bio 4190 EXIST::FUNCTION:
3806BN_asc2bn 4191 EXIST::FUNCTION:
3807TS_REQ_get_policy_id 4192 EXIST::FUNCTION:
3808ENGINE_set_default_pkey_asn1_meths 4193 EXIST:!VMS:FUNCTION:ENGINE
3809ENGINE_set_def_pkey_asn1_meths 4193 EXIST:VMS:FUNCTION:ENGINE
3810d2i_TS_ACCURACY 4194 EXIST::FUNCTION:
3811DSO_global_lookup 4195 EXIST::FUNCTION:
3812TS_CONF_set_tsa_name 4196 EXIST::FUNCTION:
3813i2d_ASN1_SET_ANY 4197 EXIST::FUNCTION:
3814ENGINE_load_gost 4198 EXIST::FUNCTION:ENGINE,GOST,STATIC_ENGINE
3815WHIRLPOOL_BitUpdate 4199 EXIST:!VMSVAX:FUNCTION:WHIRLPOOL
3816ASN1_PCTX_get_flags 4200 EXIST::FUNCTION:
3817TS_TST_INFO_get_ext_by_NID 4201 EXIST::FUNCTION:
3818TS_RESP_new 4202 EXIST::FUNCTION:
3819ESS_CERT_ID_dup 4203 EXIST::FUNCTION:
3820TS_STATUS_INFO_dup 4204 EXIST::FUNCTION:
3821TS_REQ_delete_ext 4205 EXIST::FUNCTION:
3822EVP_DigestVerifyFinal 4206 EXIST::FUNCTION:
3823EVP_PKEY_print_params 4207 EXIST::FUNCTION:
3824i2d_CMS_bio_stream 4208 EXIST::FUNCTION:CMS
3825TS_REQ_get_msg_imprint 4209 EXIST::FUNCTION:
3826OBJ_find_sigid_by_algs 4210 EXIST::FUNCTION:
3827TS_TST_INFO_get_serial 4211 EXIST::FUNCTION:
3828TS_REQ_get_nonce 4212 EXIST::FUNCTION:
3829X509_PUBKEY_set0_param 4213 EXIST::FUNCTION:
3830EVP_PKEY_CTX_set0_keygen_info 4214 EXIST::FUNCTION:
3831DIST_POINT_set_dpname 4215 EXIST::FUNCTION:
3832i2d_ISSUING_DIST_POINT 4216 EXIST::FUNCTION:
3833ASN1_SET_ANY_it 4217 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
3834ASN1_SET_ANY_it 4217 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
3835EVP_PKEY_CTX_get_data 4218 EXIST::FUNCTION:
3836TS_STATUS_INFO_print_bio 4219 EXIST::FUNCTION:
3837EVP_PKEY_derive_init 4220 EXIST::FUNCTION:
3838d2i_TS_TST_INFO 4221 EXIST::FUNCTION:
3839EVP_PKEY_asn1_add_alias 4222 EXIST::FUNCTION:
3840d2i_TS_RESP_bio 4223 EXIST::FUNCTION:
3841OTHERNAME_cmp 4224 EXIST::FUNCTION:
3842GENERAL_NAME_set0_value 4225 EXIST::FUNCTION:
3843PKCS7_RECIP_INFO_get0_alg 4226 EXIST::FUNCTION:
3844TS_RESP_CTX_new 4227 EXIST::FUNCTION:
3845TS_RESP_set_tst_info 4228 EXIST::FUNCTION:
3846PKCS7_final 4229 EXIST::FUNCTION:
3847EVP_PKEY_base_id 4230 EXIST::FUNCTION:
3848TS_RESP_CTX_set_signer_cert 4231 EXIST::FUNCTION:
3849TS_REQ_set_msg_imprint 4232 EXIST::FUNCTION:
3850EVP_PKEY_CTX_ctrl 4233 EXIST::FUNCTION:
3851TS_CONF_set_digests 4234 EXIST::FUNCTION:
3852d2i_TS_MSG_IMPRINT 4235 EXIST::FUNCTION:
3853EVP_PKEY_meth_set_ctrl 4236 EXIST::FUNCTION:
3854TS_REQ_get_ext_by_NID 4237 EXIST::FUNCTION:
3855PKCS5_pbe_set0_algor 4238 EXIST::FUNCTION:
3856BN_BLINDING_thread_id 4239 EXIST::FUNCTION:
3857TS_ACCURACY_new 4240 EXIST::FUNCTION:
3858X509_CRL_METHOD_free 4241 EXIST::FUNCTION:
3859ASN1_PCTX_get_nm_flags 4242 EXIST::FUNCTION:
3860EVP_PKEY_meth_set_sign 4243 EXIST::FUNCTION:
3861CRYPTO_THREADID_current 4244 EXIST::FUNCTION:
3862EVP_PKEY_decrypt_init 4245 EXIST::FUNCTION:
3863NETSCAPE_X509_free 4246 EXIST::FUNCTION:
3864i2b_PVK_bio 4247 EXIST::FUNCTION:RC4
3865EVP_PKEY_print_private 4248 EXIST::FUNCTION:
3866GENERAL_NAME_get0_value 4249 EXIST::FUNCTION:
3867b2i_PVK_bio 4250 EXIST::FUNCTION:RC4
3868ASN1_UTCTIME_adj 4251 EXIST::FUNCTION:
3869TS_TST_INFO_new 4252 EXIST::FUNCTION:
3870EVP_MD_do_all_sorted 4253 EXIST::FUNCTION:
3871TS_CONF_set_default_engine 4254 EXIST::FUNCTION:
3872TS_ACCURACY_set_seconds 4255 EXIST::FUNCTION:
3873TS_TST_INFO_get_time 4256 EXIST::FUNCTION:
3874PKCS8_pkey_get0 4257 EXIST::FUNCTION:
3875EVP_PKEY_asn1_get0 4258 EXIST::FUNCTION:
3876OBJ_add_sigid 4259 EXIST::FUNCTION:
3877PKCS7_SIGNER_INFO_sign 4260 EXIST::FUNCTION:
3878EVP_PKEY_paramgen_init 4261 EXIST::FUNCTION:
3879EVP_PKEY_sign 4262 EXIST::FUNCTION:
3880OBJ_sigid_free 4263 EXIST::FUNCTION:
3881EVP_PKEY_meth_set_init 4264 EXIST::FUNCTION:
3882d2i_ESS_ISSUER_SERIAL 4265 EXIST::FUNCTION:
3883ISSUING_DIST_POINT_new 4266 EXIST::FUNCTION:
3884ASN1_TIME_adj 4267 EXIST::FUNCTION:
3885TS_OBJ_print_bio 4268 EXIST::FUNCTION:
3886EVP_PKEY_meth_set_verify_recover 4269 EXIST:!VMS:FUNCTION:
3887EVP_PKEY_meth_set_vrfy_recover 4269 EXIST:VMS:FUNCTION:
3888TS_RESP_get_status_info 4270 EXIST::FUNCTION:
3889CMS_stream 4271 EXIST::FUNCTION:CMS
3890EVP_PKEY_CTX_set_cb 4272 EXIST::FUNCTION:
3891PKCS7_to_TS_TST_INFO 4273 EXIST::FUNCTION:
3892ASN1_PCTX_get_oid_flags 4274 EXIST::FUNCTION:
3893TS_TST_INFO_add_ext 4275 EXIST::FUNCTION:
3894EVP_PKEY_meth_set_derive 4276 EXIST::FUNCTION:
3895i2d_TS_RESP_fp 4277 EXIST::FUNCTION:
3896i2d_TS_MSG_IMPRINT_bio 4278 EXIST::FUNCTION:
3897TS_RESP_CTX_set_accuracy 4279 EXIST::FUNCTION:
3898TS_REQ_set_nonce 4280 EXIST::FUNCTION:
3899ESS_CERT_ID_new 4281 EXIST::FUNCTION:
3900ENGINE_pkey_asn1_find_str 4282 EXIST::FUNCTION:ENGINE
3901TS_REQ_get_ext_count 4283 EXIST::FUNCTION:
3902BUF_reverse 4284 EXIST::FUNCTION:
3903TS_TST_INFO_print_bio 4285 EXIST::FUNCTION:
3904d2i_ISSUING_DIST_POINT 4286 EXIST::FUNCTION:
3905ENGINE_get_pkey_meths 4287 EXIST::FUNCTION:ENGINE
3906i2b_PrivateKey_bio 4288 EXIST::FUNCTION:
3907i2d_TS_RESP 4289 EXIST::FUNCTION:
3908b2i_PublicKey 4290 EXIST::FUNCTION:
3909TS_VERIFY_CTX_cleanup 4291 EXIST::FUNCTION:
3910TS_STATUS_INFO_free 4292 EXIST::FUNCTION:
3911TS_RESP_verify_token 4293 EXIST::FUNCTION:
3912OBJ_bsearch_ex_ 4294 EXIST::FUNCTION:
3913ASN1_bn_print 4295 EXIST::FUNCTION:BIO
3914EVP_PKEY_asn1_get_count 4296 EXIST::FUNCTION:
3915ENGINE_register_pkey_asn1_meths 4297 EXIST::FUNCTION:ENGINE
3916ASN1_PCTX_set_nm_flags 4298 EXIST::FUNCTION:
3917EVP_DigestVerifyInit 4299 EXIST::FUNCTION:
3918ENGINE_set_default_pkey_meths 4300 EXIST::FUNCTION:ENGINE
3919TS_TST_INFO_get_policy_id 4301 EXIST::FUNCTION:
3920TS_REQ_get_cert_req 4302 EXIST::FUNCTION:
3921X509_CRL_set_meth_data 4303 EXIST::FUNCTION:
3922PKCS8_pkey_set0 4304 EXIST::FUNCTION:
3923ASN1_STRING_copy 4305 EXIST::FUNCTION:
3924d2i_TS_TST_INFO_fp 4306 EXIST::FUNCTION:
3925X509_CRL_match 4307 EXIST::FUNCTION:
3926EVP_PKEY_asn1_set_private 4308 EXIST::FUNCTION:
3927TS_TST_INFO_get_ext_d2i 4309 EXIST::FUNCTION:
3928TS_RESP_CTX_add_policy 4310 EXIST::FUNCTION:
3929d2i_TS_RESP 4311 EXIST::FUNCTION:
3930TS_CONF_load_certs 4312 EXIST::FUNCTION:
3931TS_TST_INFO_get_msg_imprint 4313 EXIST::FUNCTION:
3932ERR_load_TS_strings 4314 EXIST::FUNCTION:
3933TS_TST_INFO_get_version 4315 EXIST::FUNCTION:
3934EVP_PKEY_CTX_dup 4316 EXIST::FUNCTION:
3935EVP_PKEY_meth_set_verify 4317 EXIST::FUNCTION:
3936i2b_PublicKey_bio 4318 EXIST::FUNCTION:
3937TS_CONF_set_certs 4319 EXIST::FUNCTION:
3938EVP_PKEY_asn1_get0_info 4320 EXIST::FUNCTION:
3939TS_VERIFY_CTX_free 4321 EXIST::FUNCTION:
3940TS_REQ_get_ext_by_critical 4322 EXIST::FUNCTION:
3941TS_RESP_CTX_set_serial_cb 4323 EXIST::FUNCTION:
3942X509_CRL_get_meth_data 4324 EXIST::FUNCTION:
3943TS_RESP_CTX_set_time_cb 4325 EXIST::FUNCTION:
3944TS_MSG_IMPRINT_get_msg 4326 EXIST::FUNCTION:
3945TS_TST_INFO_ext_free 4327 EXIST::FUNCTION:
3946TS_REQ_get_version 4328 EXIST::FUNCTION:
3947TS_REQ_add_ext 4329 EXIST::FUNCTION:
3948EVP_PKEY_CTX_set_app_data 4330 EXIST::FUNCTION:
3949OBJ_bsearch_ 4331 EXIST::FUNCTION:
3950EVP_PKEY_meth_set_verifyctx 4332 EXIST::FUNCTION:
3951i2d_PKCS7_bio_stream 4333 EXIST::FUNCTION:
3952CRYPTO_THREADID_set_numeric 4334 EXIST::FUNCTION:
3953PKCS7_sign_add_signer 4335 EXIST::FUNCTION:
3954d2i_TS_TST_INFO_bio 4336 EXIST::FUNCTION:
3955TS_TST_INFO_get_ordering 4337 EXIST::FUNCTION:
3956TS_RESP_print_bio 4338 EXIST::FUNCTION:
3957TS_TST_INFO_get_exts 4339 EXIST::FUNCTION:
3958HMAC_CTX_copy 4340 EXIST::FUNCTION:HMAC
3959PKCS5_pbe2_set_iv 4341 EXIST::FUNCTION:
3960ENGINE_get_pkey_asn1_meths 4342 EXIST::FUNCTION:ENGINE
3961b2i_PrivateKey 4343 EXIST::FUNCTION:
3962EVP_PKEY_CTX_get_app_data 4344 EXIST::FUNCTION:
3963TS_REQ_set_cert_req 4345 EXIST::FUNCTION:
3964CRYPTO_THREADID_set_callback 4346 EXIST::FUNCTION:
3965TS_CONF_set_serial 4347 EXIST::FUNCTION:
3966TS_TST_INFO_free 4348 EXIST::FUNCTION:
3967d2i_TS_REQ_fp 4349 EXIST::FUNCTION:
3968TS_RESP_verify_response 4350 EXIST::FUNCTION:
3969i2d_ESS_ISSUER_SERIAL 4351 EXIST::FUNCTION:
3970TS_ACCURACY_get_seconds 4352 EXIST::FUNCTION:
3971EVP_CIPHER_do_all 4353 EXIST::FUNCTION:
3972b2i_PrivateKey_bio 4354 EXIST::FUNCTION:
3973OCSP_CERTID_dup 4355 EXIST::FUNCTION:
3974X509_PUBKEY_get0_param 4356 EXIST::FUNCTION:
3975TS_MSG_IMPRINT_dup 4357 EXIST::FUNCTION:
3976PKCS7_print_ctx 4358 EXIST::FUNCTION:
3977i2d_TS_REQ_bio 4359 EXIST::FUNCTION:
3978EVP_whirlpool 4360 EXIST:!VMSVAX:FUNCTION:WHIRLPOOL
3979EVP_PKEY_asn1_set_param 4361 EXIST::FUNCTION:
3980EVP_PKEY_meth_set_encrypt 4362 EXIST::FUNCTION:
3981ASN1_PCTX_set_flags 4363 EXIST::FUNCTION:
3982i2d_ESS_CERT_ID 4364 EXIST::FUNCTION:
3983TS_VERIFY_CTX_new 4365 EXIST::FUNCTION:
3984TS_RESP_CTX_set_extension_cb 4366 EXIST::FUNCTION:
3985ENGINE_register_all_pkey_meths 4367 EXIST::FUNCTION:ENGINE
3986TS_RESP_CTX_set_status_info_cond 4368 EXIST:!VMS:FUNCTION:
3987TS_RESP_CTX_set_stat_info_cond 4368 EXIST:VMS:FUNCTION:
3988EVP_PKEY_verify 4369 EXIST::FUNCTION:
3989WHIRLPOOL_Final 4370 EXIST:!VMSVAX:FUNCTION:WHIRLPOOL
3990X509_CRL_METHOD_new 4371 EXIST::FUNCTION:
3991EVP_DigestSignFinal 4372 EXIST::FUNCTION:
3992TS_RESP_CTX_set_def_policy 4373 EXIST::FUNCTION:
3993NETSCAPE_X509_it 4374 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
3994NETSCAPE_X509_it 4374 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
3995TS_RESP_create_response 4375 EXIST::FUNCTION:
3996PKCS7_SIGNER_INFO_get0_algs 4376 EXIST::FUNCTION:
3997TS_TST_INFO_get_nonce 4377 EXIST::FUNCTION:
3998EVP_PKEY_decrypt_old 4378 EXIST::FUNCTION:
3999TS_TST_INFO_set_policy_id 4379 EXIST::FUNCTION:
4000TS_CONF_set_ess_cert_id_chain 4380 EXIST::FUNCTION:
4001EVP_PKEY_CTX_get0_pkey 4381 EXIST::FUNCTION:
4002d2i_TS_REQ 4382 EXIST::FUNCTION:
4003EVP_PKEY_asn1_find_str 4383 EXIST::FUNCTION:
4004BIO_f_asn1 4384 EXIST::FUNCTION:
4005ESS_SIGNING_CERT_new 4385 EXIST::FUNCTION:
4006EVP_PBE_find 4386 EXIST::FUNCTION:
4007X509_CRL_get0_by_cert 4387 EXIST::FUNCTION:
4008EVP_PKEY_derive 4388 EXIST::FUNCTION:
4009i2d_TS_REQ 4389 EXIST::FUNCTION:
4010TS_TST_INFO_delete_ext 4390 EXIST::FUNCTION:
4011ESS_ISSUER_SERIAL_free 4391 EXIST::FUNCTION:
4012ASN1_PCTX_set_str_flags 4392 EXIST::FUNCTION:
4013ENGINE_get_pkey_asn1_meth_str 4393 EXIST::FUNCTION:ENGINE
4014TS_CONF_set_signer_key 4394 EXIST::FUNCTION:
4015TS_ACCURACY_get_millis 4395 EXIST::FUNCTION:
4016TS_RESP_get_token 4396 EXIST::FUNCTION:
4017TS_ACCURACY_dup 4397 EXIST::FUNCTION:
4018ENGINE_register_all_pkey_asn1_meths 4398 EXIST:!VMS:FUNCTION:ENGINE
4019ENGINE_reg_all_pkey_asn1_meths 4398 EXIST:VMS:FUNCTION:ENGINE
4020X509_CRL_set_default_method 4399 EXIST::FUNCTION:
4021CRYPTO_THREADID_hash 4400 EXIST::FUNCTION:
4022CMS_ContentInfo_print_ctx 4401 EXIST::FUNCTION:CMS
4023TS_RESP_free 4402 EXIST::FUNCTION:
4024ISSUING_DIST_POINT_free 4403 EXIST::FUNCTION:
4025ESS_ISSUER_SERIAL_new 4404 EXIST::FUNCTION:
4026CMS_add1_crl 4405 EXIST::FUNCTION:CMS
4027PKCS7_add1_attrib_digest 4406 EXIST::FUNCTION:
4028TS_RESP_CTX_add_md 4407 EXIST::FUNCTION:
4029TS_TST_INFO_dup 4408 EXIST::FUNCTION:
4030ENGINE_set_pkey_asn1_meths 4409 EXIST::FUNCTION:ENGINE
4031PEM_write_bio_Parameters 4410 EXIST::FUNCTION:
4032TS_TST_INFO_get_accuracy 4411 EXIST::FUNCTION:
4033X509_CRL_get0_by_serial 4412 EXIST::FUNCTION:
4034TS_TST_INFO_set_version 4413 EXIST::FUNCTION:
4035TS_RESP_CTX_get_tst_info 4414 EXIST::FUNCTION:
4036TS_RESP_verify_signature 4415 EXIST::FUNCTION:
4037CRYPTO_THREADID_get_callback 4416 EXIST::FUNCTION:
4038TS_TST_INFO_get_tsa 4417 EXIST::FUNCTION:
4039TS_STATUS_INFO_new 4418 EXIST::FUNCTION:
4040EVP_PKEY_CTX_get_cb 4419 EXIST::FUNCTION:
4041TS_REQ_get_ext_d2i 4420 EXIST::FUNCTION:
4042GENERAL_NAME_set0_othername 4421 EXIST::FUNCTION:
4043TS_TST_INFO_get_ext_count 4422 EXIST::FUNCTION:
4044TS_RESP_CTX_get_request 4423 EXIST::FUNCTION:
4045i2d_NETSCAPE_X509 4424 EXIST::FUNCTION:
4046ENGINE_get_pkey_meth_engine 4425 EXIST::FUNCTION:ENGINE
4047EVP_PKEY_meth_set_signctx 4426 EXIST::FUNCTION:
4048EVP_PKEY_asn1_copy 4427 EXIST::FUNCTION:
4049ASN1_TYPE_cmp 4428 EXIST::FUNCTION:
4050EVP_CIPHER_do_all_sorted 4429 EXIST::FUNCTION:
4051EVP_PKEY_CTX_free 4430 EXIST::FUNCTION:
4052ISSUING_DIST_POINT_it 4431 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
4053ISSUING_DIST_POINT_it 4431 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
4054d2i_TS_MSG_IMPRINT_fp 4432 EXIST::FUNCTION:
4055X509_STORE_get1_certs 4433 EXIST::FUNCTION:
4056EVP_PKEY_CTX_get_operation 4434 EXIST::FUNCTION:
4057d2i_ESS_SIGNING_CERT 4435 EXIST::FUNCTION:
4058TS_CONF_set_ordering 4436 EXIST::FUNCTION:
4059EVP_PBE_alg_add_type 4437 EXIST::FUNCTION:
4060TS_REQ_set_version 4438 EXIST::FUNCTION:
4061EVP_PKEY_get0 4439 EXIST::FUNCTION:
4062BIO_asn1_set_suffix 4440 EXIST::FUNCTION:
4063i2d_TS_STATUS_INFO 4441 EXIST::FUNCTION:
4064EVP_MD_do_all 4442 EXIST::FUNCTION:
4065TS_TST_INFO_set_accuracy 4443 EXIST::FUNCTION:
4066PKCS7_add_attrib_content_type 4444 EXIST::FUNCTION:
4067ERR_remove_thread_state 4445 EXIST::FUNCTION:
4068EVP_PKEY_meth_add0 4446 EXIST::FUNCTION:
4069TS_TST_INFO_set_tsa 4447 EXIST::FUNCTION:
4070EVP_PKEY_meth_new 4448 EXIST::FUNCTION:
4071WHIRLPOOL_Update 4449 EXIST:!VMSVAX:FUNCTION:WHIRLPOOL
4072TS_CONF_set_accuracy 4450 EXIST::FUNCTION:
4073ASN1_PCTX_set_oid_flags 4451 EXIST::FUNCTION:
4074ESS_SIGNING_CERT_dup 4452 EXIST::FUNCTION:
4075d2i_TS_REQ_bio 4453 EXIST::FUNCTION:
4076X509_time_adj_ex 4454 EXIST::FUNCTION:
4077TS_RESP_CTX_add_flags 4455 EXIST::FUNCTION:
4078d2i_TS_STATUS_INFO 4456 EXIST::FUNCTION:
4079TS_MSG_IMPRINT_set_msg 4457 EXIST::FUNCTION:
4080BIO_asn1_get_suffix 4458 EXIST::FUNCTION:
4081TS_REQ_free 4459 EXIST::FUNCTION:
4082EVP_PKEY_meth_free 4460 EXIST::FUNCTION:
4083TS_REQ_get_exts 4461 EXIST::FUNCTION:
4084TS_RESP_CTX_set_clock_precision_digits 4462 EXIST:!VMS:FUNCTION:
4085TS_RESP_CTX_set_clk_prec_digits 4462 EXIST:VMS:FUNCTION:
4086TS_RESP_CTX_add_failure_info 4463 EXIST::FUNCTION:
4087i2d_TS_RESP_bio 4464 EXIST::FUNCTION:
4088EVP_PKEY_CTX_get0_peerkey 4465 EXIST::FUNCTION:
4089PEM_write_bio_CMS_stream 4466 EXIST::FUNCTION:CMS
4090TS_REQ_new 4467 EXIST::FUNCTION:
4091TS_MSG_IMPRINT_new 4468 EXIST::FUNCTION:
4092EVP_PKEY_meth_find 4469 EXIST::FUNCTION:
4093EVP_PKEY_id 4470 EXIST::FUNCTION:
4094TS_TST_INFO_set_serial 4471 EXIST::FUNCTION:
4095a2i_GENERAL_NAME 4472 EXIST::FUNCTION:
4096TS_CONF_set_crypto_device 4473 EXIST::FUNCTION:
4097EVP_PKEY_verify_init 4474 EXIST::FUNCTION:
4098TS_CONF_set_policies 4475 EXIST::FUNCTION:
4099ASN1_PCTX_new 4476 EXIST::FUNCTION:
4100ESS_CERT_ID_free 4477 EXIST::FUNCTION:
4101ENGINE_unregister_pkey_meths 4478 EXIST::FUNCTION:ENGINE
4102TS_MSG_IMPRINT_free 4479 EXIST::FUNCTION:
4103TS_VERIFY_CTX_init 4480 EXIST::FUNCTION:
4104PKCS7_stream 4481 EXIST::FUNCTION:
4105TS_RESP_CTX_set_certs 4482 EXIST::FUNCTION:
4106TS_CONF_set_def_policy 4483 EXIST::FUNCTION:
4107ASN1_GENERALIZEDTIME_adj 4484 EXIST::FUNCTION:
4108NETSCAPE_X509_new 4485 EXIST::FUNCTION:
4109TS_ACCURACY_free 4486 EXIST::FUNCTION:
4110TS_RESP_get_tst_info 4487 EXIST::FUNCTION:
4111EVP_PKEY_derive_set_peer 4488 EXIST::FUNCTION:
4112PEM_read_bio_Parameters 4489 EXIST::FUNCTION:
4113TS_CONF_set_clock_precision_digits 4490 EXIST:!VMS:FUNCTION:
4114TS_CONF_set_clk_prec_digits 4490 EXIST:VMS:FUNCTION:
4115ESS_ISSUER_SERIAL_dup 4491 EXIST::FUNCTION:
4116TS_ACCURACY_get_micros 4492 EXIST::FUNCTION:
4117ASN1_PCTX_get_str_flags 4493 EXIST::FUNCTION:
4118NAME_CONSTRAINTS_check 4494 EXIST::FUNCTION:
4119ASN1_BIT_STRING_check 4495 EXIST::FUNCTION:
4120X509_check_akid 4496 EXIST::FUNCTION:
4121ENGINE_unregister_pkey_asn1_meths 4497 EXIST:!VMS:FUNCTION:ENGINE
4122ENGINE_unreg_pkey_asn1_meths 4497 EXIST:VMS:FUNCTION:ENGINE
4123ASN1_PCTX_free 4498 EXIST::FUNCTION:
4124PEM_write_bio_ASN1_stream 4499 EXIST::FUNCTION:
4125i2d_ASN1_bio_stream 4500 EXIST::FUNCTION:
4126TS_X509_ALGOR_print_bio 4501 EXIST::FUNCTION:
4127EVP_PKEY_meth_set_cleanup 4502 EXIST::FUNCTION:
4128EVP_PKEY_asn1_free 4503 EXIST::FUNCTION:
4129ESS_SIGNING_CERT_free 4504 EXIST::FUNCTION:
4130TS_TST_INFO_set_msg_imprint 4505 EXIST::FUNCTION:
4131GENERAL_NAME_cmp 4506 EXIST::FUNCTION:
4132d2i_ASN1_SET_ANY 4507 EXIST::FUNCTION:
4133ENGINE_set_pkey_meths 4508 EXIST::FUNCTION:ENGINE
4134i2d_TS_REQ_fp 4509 EXIST::FUNCTION:
4135d2i_ASN1_SEQUENCE_ANY 4510 EXIST::FUNCTION:
4136GENERAL_NAME_get0_otherName 4511 EXIST::FUNCTION:
4137d2i_ESS_CERT_ID 4512 EXIST::FUNCTION:
4138OBJ_find_sigid_algs 4513 EXIST::FUNCTION:
4139EVP_PKEY_meth_set_keygen 4514 EXIST::FUNCTION:
4140PKCS5_PBKDF2_HMAC 4515 EXIST::FUNCTION:
4141EVP_PKEY_paramgen 4516 EXIST::FUNCTION:
4142EVP_PKEY_meth_set_paramgen 4517 EXIST::FUNCTION:
4143BIO_new_PKCS7 4518 EXIST::FUNCTION:
4144EVP_PKEY_verify_recover 4519 EXIST::FUNCTION:
4145TS_ext_print_bio 4520 EXIST::FUNCTION:
4146TS_ASN1_INTEGER_print_bio 4521 EXIST::FUNCTION:
4147check_defer 4522 EXIST::FUNCTION:
4148DSO_pathbyaddr 4523 EXIST::FUNCTION:
4149EVP_PKEY_set_type 4524 EXIST::FUNCTION:
4150TS_ACCURACY_set_micros 4525 EXIST::FUNCTION:
4151TS_REQ_to_TS_VERIFY_CTX 4526 EXIST::FUNCTION:
4152EVP_PKEY_meth_set_copy 4527 EXIST::FUNCTION:
4153ASN1_PCTX_set_cert_flags 4528 EXIST::FUNCTION:
4154TS_TST_INFO_get_ext 4529 EXIST::FUNCTION:
4155EVP_PKEY_asn1_set_ctrl 4530 EXIST::FUNCTION:
4156TS_TST_INFO_get_ext_by_critical 4531 EXIST::FUNCTION:
4157EVP_PKEY_CTX_new_id 4532 EXIST::FUNCTION:
4158TS_REQ_get_ext_by_OBJ 4533 EXIST::FUNCTION:
4159TS_CONF_set_signer_cert 4534 EXIST::FUNCTION:
4160X509_NAME_hash_old 4535 EXIST::FUNCTION:
4161ASN1_TIME_set_string 4536 EXIST::FUNCTION:
4162EVP_MD_flags 4537 EXIST::FUNCTION:
4163TS_RESP_CTX_free 4538 EXIST::FUNCTION:
4164DSAparams_dup 4539 EXIST::FUNCTION:DSA
4165DHparams_dup 4540 EXIST::FUNCTION:DH
4166OCSP_REQ_CTX_add1_header 4541 EXIST::FUNCTION:
4167OCSP_REQ_CTX_set1_req 4542 EXIST::FUNCTION:
4168X509_STORE_set_verify_cb 4543 EXIST::FUNCTION:
4169X509_STORE_CTX_get0_current_crl 4544 EXIST::FUNCTION:
4170X509_STORE_CTX_get0_parent_ctx 4545 EXIST::FUNCTION:
4171X509_STORE_CTX_get0_current_issuer 4546 EXIST:!VMS:FUNCTION:
4172X509_STORE_CTX_get0_cur_issuer 4546 EXIST:VMS:FUNCTION:
4173X509_issuer_name_hash_old 4547 EXIST::FUNCTION:MD5
4174X509_subject_name_hash_old 4548 EXIST::FUNCTION:MD5
4175EVP_CIPHER_CTX_copy 4549 EXIST::FUNCTION:
4176UI_method_get_prompt_constructor 4550 EXIST:!VMS:FUNCTION:
4177UI_method_get_prompt_constructr 4550 EXIST:VMS:FUNCTION:
4178UI_method_set_prompt_constructor 4551 EXIST:!VMS:FUNCTION:
4179UI_method_set_prompt_constructr 4551 EXIST:VMS:FUNCTION:
4180EVP_read_pw_string_min 4552 EXIST::FUNCTION:
4181CRYPTO_cts128_encrypt 4553 EXIST::FUNCTION:
4182CRYPTO_cts128_decrypt_block 4554 EXIST::FUNCTION:
4183CRYPTO_cfb128_1_encrypt 4555 EXIST::FUNCTION:
4184CRYPTO_cbc128_encrypt 4556 EXIST::FUNCTION:
4185CRYPTO_ctr128_encrypt 4557 EXIST::FUNCTION:
4186CRYPTO_ofb128_encrypt 4558 EXIST::FUNCTION:
4187CRYPTO_cts128_decrypt 4559 EXIST::FUNCTION:
4188CRYPTO_cts128_encrypt_block 4560 EXIST::FUNCTION:
4189CRYPTO_cbc128_decrypt 4561 EXIST::FUNCTION:
4190CRYPTO_cfb128_encrypt 4562 EXIST::FUNCTION:
4191CRYPTO_cfb128_8_encrypt 4563 EXIST::FUNCTION:
4192OPENSSL_strcasecmp 4564 EXIST::FUNCTION:
4193OPENSSL_memcmp 4565 EXIST::FUNCTION:
4194OPENSSL_strncasecmp 4566 EXIST::FUNCTION:
4195OPENSSL_gmtime 4567 EXIST::FUNCTION:
4196OPENSSL_gmtime_adj 4568 EXIST::FUNCTION:
4197SRP_VBASE_get_by_user 4569 EXIST::FUNCTION:SRP
4198SRP_Calc_server_key 4570 EXIST::FUNCTION:SRP
4199SRP_create_verifier 4571 EXIST::FUNCTION:SRP
4200SRP_create_verifier_BN 4572 EXIST::FUNCTION:SRP
4201SRP_Calc_u 4573 EXIST::FUNCTION:SRP
4202SRP_VBASE_free 4574 EXIST::FUNCTION:SRP
4203SRP_Calc_client_key 4575 EXIST::FUNCTION:SRP
4204SRP_get_default_gN 4576 EXIST::FUNCTION:SRP
4205SRP_Calc_x 4577 EXIST::FUNCTION:SRP
4206SRP_Calc_B 4578 EXIST::FUNCTION:SRP
4207SRP_VBASE_new 4579 EXIST::FUNCTION:SRP
4208SRP_check_known_gN_param 4580 EXIST::FUNCTION:SRP
4209SRP_Calc_A 4581 EXIST::FUNCTION:SRP
4210SRP_Verify_A_mod_N 4582 EXIST::FUNCTION:SRP
4211SRP_VBASE_init 4583 EXIST::FUNCTION:SRP
4212SRP_Verify_B_mod_N 4584 EXIST::FUNCTION:SRP
4213EC_KEY_set_public_key_affine_coordinates 4585 EXIST:!VMS:FUNCTION:EC
4214EC_KEY_set_pub_key_aff_coords 4585 EXIST:VMS:FUNCTION:EC
4215EVP_aes_192_ctr 4586 EXIST::FUNCTION:AES
4216EVP_PKEY_meth_get0_info 4587 EXIST::FUNCTION:
4217EVP_PKEY_meth_copy 4588 EXIST::FUNCTION:
4218ERR_add_error_vdata 4589 EXIST::FUNCTION:
4219EVP_aes_128_ctr 4590 EXIST::FUNCTION:AES
4220EVP_aes_256_ctr 4591 EXIST::FUNCTION:AES
4221EC_GFp_nistp224_method 4592 EXIST::FUNCTION:EC,EC_NISTP_64_GCC_128
4222EC_KEY_get_flags 4593 EXIST::FUNCTION:EC
4223RSA_padding_add_PKCS1_PSS_mgf1 4594 EXIST::FUNCTION:RSA
4224EVP_aes_128_xts 4595 EXIST::FUNCTION:AES
4225private_SHA224_Init 4596 EXIST:OPENSSL_FIPS:FUNCTION:SHA,SHA256
4226private_AES_set_decrypt_key 4597 EXIST::FUNCTION:AES
4227private_WHIRLPOOL_Init 4598 EXIST:OPENSSL_FIPS:FUNCTION:WHIRLPOOL
4228EVP_aes_256_xts 4599 EXIST::FUNCTION:AES
4229private_SHA512_Init 4600 EXIST:OPENSSL_FIPS:FUNCTION:SHA,SHA512
4230EVP_aes_128_gcm 4601 EXIST::FUNCTION:AES
4231EC_KEY_clear_flags 4602 EXIST::FUNCTION:EC
4232EC_KEY_set_flags 4603 EXIST::FUNCTION:EC
4233private_DES_set_key_unchecked 4604 EXIST:OPENSSL_FIPS:FUNCTION:DES
4234EVP_aes_256_ccm 4605 EXIST::FUNCTION:AES
4235private_AES_set_encrypt_key 4606 EXIST::FUNCTION:AES
4236RSA_verify_PKCS1_PSS_mgf1 4607 EXIST::FUNCTION:RSA
4237private_SHA1_Init 4608 EXIST:OPENSSL_FIPS:FUNCTION:SHA,SHA1
4238EVP_aes_128_ccm 4609 EXIST::FUNCTION:AES
4239private_SEED_set_key 4610 EXIST:OPENSSL_FIPS:FUNCTION:SEED
4240EVP_aes_192_gcm 4611 EXIST::FUNCTION:AES
4241X509_ALGOR_set_md 4612 EXIST::FUNCTION:
4242private_SHA256_Init 4613 EXIST:OPENSSL_FIPS:FUNCTION:SHA,SHA256
4243RAND_init_fips 4614 EXIST:OPENSSL_FIPS:FUNCTION:
4244EVP_aes_256_gcm 4615 EXIST::FUNCTION:AES
4245private_SHA384_Init 4616 EXIST:OPENSSL_FIPS:FUNCTION:SHA,SHA512
4246EVP_aes_192_ccm 4617 EXIST::FUNCTION:AES
4247CMAC_CTX_copy 4618 EXIST::FUNCTION:
4248CMAC_CTX_free 4619 EXIST::FUNCTION:
4249CMAC_CTX_get0_cipher_ctx 4620 EXIST::FUNCTION:
4250CMAC_CTX_cleanup 4621 EXIST::FUNCTION:
4251CMAC_Init 4622 EXIST::FUNCTION:
4252CMAC_Update 4623 EXIST::FUNCTION:
4253CMAC_resume 4624 EXIST::FUNCTION:
4254CMAC_CTX_new 4625 EXIST::FUNCTION:
4255CMAC_Final 4626 EXIST::FUNCTION:
4256CRYPTO_ctr128_encrypt_ctr32 4627 EXIST::FUNCTION:
4257CRYPTO_gcm128_release 4628 EXIST::FUNCTION:
4258CRYPTO_ccm128_decrypt_ccm64 4629 EXIST::FUNCTION:
4259CRYPTO_ccm128_encrypt 4630 EXIST::FUNCTION:
4260CRYPTO_gcm128_encrypt 4631 EXIST::FUNCTION:
4261CRYPTO_xts128_encrypt 4632 EXIST::FUNCTION:
4262EVP_rc4_hmac_md5 4633 EXIST::FUNCTION:MD5,RC4
4263CRYPTO_nistcts128_decrypt_block 4634 EXIST::FUNCTION:
4264CRYPTO_gcm128_setiv 4635 EXIST::FUNCTION:
4265CRYPTO_nistcts128_encrypt 4636 EXIST::FUNCTION:
4266EVP_aes_128_cbc_hmac_sha1 4637 EXIST::FUNCTION:AES,SHA,SHA1
4267CRYPTO_gcm128_tag 4638 EXIST::FUNCTION:
4268CRYPTO_ccm128_encrypt_ccm64 4639 EXIST::FUNCTION:
4269ENGINE_load_rdrand 4640 EXIST::FUNCTION:ENGINE
4270CRYPTO_ccm128_setiv 4641 EXIST::FUNCTION:
4271CRYPTO_nistcts128_encrypt_block 4642 EXIST::FUNCTION:
4272CRYPTO_gcm128_aad 4643 EXIST::FUNCTION:
4273CRYPTO_ccm128_init 4644 EXIST::FUNCTION:
4274CRYPTO_nistcts128_decrypt 4645 EXIST::FUNCTION:
4275CRYPTO_gcm128_new 4646 EXIST::FUNCTION:
4276CRYPTO_ccm128_tag 4647 EXIST::FUNCTION:
4277CRYPTO_ccm128_decrypt 4648 EXIST::FUNCTION:
4278CRYPTO_ccm128_aad 4649 EXIST::FUNCTION:
4279CRYPTO_gcm128_init 4650 EXIST::FUNCTION:
4280CRYPTO_gcm128_decrypt 4651 EXIST::FUNCTION:
4281ENGINE_load_rsax 4652 EXIST::FUNCTION:ENGINE
4282CRYPTO_gcm128_decrypt_ctr32 4653 EXIST::FUNCTION:
4283CRYPTO_gcm128_encrypt_ctr32 4654 EXIST::FUNCTION:
4284CRYPTO_gcm128_finish 4655 EXIST::FUNCTION:
4285EVP_aes_256_cbc_hmac_sha1 4656 EXIST::FUNCTION:AES,SHA,SHA1
4286PKCS5_pbkdf2_set 4657 EXIST::FUNCTION:
4287CMS_add0_recipient_password 4658 EXIST::FUNCTION:CMS
4288CMS_decrypt_set1_password 4659 EXIST::FUNCTION:CMS
4289CMS_RecipientInfo_set0_password 4660 EXIST::FUNCTION:CMS
4290RAND_set_fips_drbg_type 4661 EXIST:OPENSSL_FIPS:FUNCTION:
4291X509_REQ_sign_ctx 4662 EXIST::FUNCTION:EVP
4292RSA_PSS_PARAMS_new 4663 EXIST::FUNCTION:RSA
4293X509_CRL_sign_ctx 4664 EXIST::FUNCTION:EVP
4294X509_signature_dump 4665 EXIST::FUNCTION:EVP
4295d2i_RSA_PSS_PARAMS 4666 EXIST::FUNCTION:RSA
4296RSA_PSS_PARAMS_it 4667 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:RSA
4297RSA_PSS_PARAMS_it 4667 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:RSA
4298RSA_PSS_PARAMS_free 4668 EXIST::FUNCTION:RSA
4299X509_sign_ctx 4669 EXIST::FUNCTION:EVP
4300i2d_RSA_PSS_PARAMS 4670 EXIST::FUNCTION:RSA
4301ASN1_item_sign_ctx 4671 EXIST::FUNCTION:EVP
4302EC_GFp_nistp521_method 4672 EXIST::FUNCTION:EC,EC_NISTP_64_GCC_128
4303EC_GFp_nistp256_method 4673 EXIST::FUNCTION:EC,EC_NISTP_64_GCC_128
4304OPENSSL_stderr 4674 EXIST::FUNCTION:
4305OPENSSL_cpuid_setup 4675 EXIST::FUNCTION:
4306OPENSSL_showfatal 4676 EXIST::FUNCTION:
4307BIO_new_dgram_sctp 4677 EXIST::FUNCTION:SCTP
4308BIO_dgram_sctp_msg_waiting 4678 EXIST::FUNCTION:SCTP
4309BIO_dgram_sctp_wait_for_dry 4679 EXIST::FUNCTION:SCTP
4310BIO_s_datagram_sctp 4680 EXIST::FUNCTION:DGRAM,SCTP
4311BIO_dgram_is_sctp 4681 EXIST::FUNCTION:SCTP
4312BIO_dgram_sctp_notification_cb 4682 EXIST::FUNCTION:SCTP
diff --git a/src/lib/libcrypto/util/mk1mf.pl b/src/lib/libcrypto/util/mk1mf.pl
new file mode 100644
index 0000000000..458f830401
--- /dev/null
+++ b/src/lib/libcrypto/util/mk1mf.pl
@@ -0,0 +1,1231 @@
1#!/usr/local/bin/perl
2# A bit of an evil hack but it post processes the file ../MINFO which
3# is generated by `make files` in the top directory.
4# This script outputs one mega makefile that has no shell stuff or any
5# funny stuff
6#
7
8$INSTALLTOP="/usr/local/ssl";
9$OPENSSLDIR="/usr/local/ssl";
10$OPTIONS="";
11$ssl_version="";
12$banner="\t\@echo Building OpenSSL";
13
14my $no_static_engine = 1;
15my $engines = "";
16my $otherlibs = "";
17local $zlib_opt = 0; # 0 = no zlib, 1 = static, 2 = dynamic
18local $zlib_lib = "";
19local $perl_asm = 0; # 1 to autobuild asm files from perl scripts
20
21my $ex_l_libs = "";
22
23# Options to import from top level Makefile
24
25my %mf_import = (
26 VERSION => \$ssl_version,
27 OPTIONS => \$OPTIONS,
28 INSTALLTOP => \$INSTALLTOP,
29 OPENSSLDIR => \$OPENSSLDIR,
30 PLATFORM => \$mf_platform,
31 CFLAG => \$mf_cflag,
32 DEPFLAG => \$mf_depflag,
33 CPUID_OBJ => \$mf_cpuid_asm,
34 BN_ASM => \$mf_bn_asm,
35 DES_ENC => \$mf_des_asm,
36 AES_ENC => \$mf_aes_asm,
37 BF_ENC => \$mf_bf_asm,
38 CAST_ENC => \$mf_cast_asm,
39 RC4_ENC => \$mf_rc4_asm,
40 RC5_ENC => \$mf_rc5_asm,
41 MD5_ASM_OBJ => \$mf_md5_asm,
42 SHA1_ASM_OBJ => \$mf_sha_asm,
43 RMD160_ASM_OBJ => \$mf_rmd_asm,
44 WP_ASM_OBJ => \$mf_wp_asm,
45 CMLL_ENC => \$mf_cm_asm,
46 BASEADDR => \$baseaddr,
47 FIPSDIR => \$fipsdir,
48);
49
50
51open(IN,"<Makefile") || die "unable to open Makefile!\n";
52while(<IN>) {
53 my ($mf_opt, $mf_ref);
54 while (($mf_opt, $mf_ref) = each %mf_import) {
55 if (/^$mf_opt\s*=\s*(.*)$/) {
56 $$mf_ref = $1;
57 }
58 }
59}
60close(IN);
61
62$debug = 1 if $mf_platform =~ /^debug-/;
63
64die "Makefile is not the toplevel Makefile!\n" if $ssl_version eq "";
65
66$infile="MINFO";
67
68%ops=(
69 "VC-WIN32", "Microsoft Visual C++ [4-6] - Windows NT or 9X",
70 "VC-WIN64I", "Microsoft C/C++ - Win64/IA-64",
71 "VC-WIN64A", "Microsoft C/C++ - Win64/x64",
72 "VC-CE", "Microsoft eMbedded Visual C++ 3.0 - Windows CE ONLY",
73 "VC-NT", "Microsoft Visual C++ [4-6] - Windows NT ONLY",
74 "Mingw32", "GNU C++ - Windows NT or 9x",
75 "Mingw32-files", "Create files with DOS copy ...",
76 "BC-NT", "Borland C++ 4.5 - Windows NT",
77 "linux-elf","Linux elf",
78 "ultrix-mips","DEC mips ultrix",
79 "FreeBSD","FreeBSD distribution",
80 "OS2-EMX", "EMX GCC OS/2",
81 "netware-clib", "CodeWarrior for NetWare - CLib - with WinSock Sockets",
82 "netware-clib-bsdsock", "CodeWarrior for NetWare - CLib - with BSD Sockets",
83 "netware-libc", "CodeWarrior for NetWare - LibC - with WinSock Sockets",
84 "netware-libc-bsdsock", "CodeWarrior for NetWare - LibC - with BSD Sockets",
85 "default","cc under unix",
86 "auto", "auto detect from top level Makefile"
87 );
88
89$platform="";
90my $xcflags="";
91foreach (@ARGV)
92 {
93 if (!&read_options && !defined($ops{$_}))
94 {
95 print STDERR "unknown option - $_\n";
96 print STDERR "usage: perl mk1mf.pl [options] [system]\n";
97 print STDERR "\nwhere [system] can be one of the following\n";
98 foreach $i (sort keys %ops)
99 { printf STDERR "\t%-10s\t%s\n",$i,$ops{$i}; }
100 print STDERR <<"EOF";
101and [options] can be one of
102 no-md2 no-md4 no-md5 no-sha no-mdc2 - Skip this digest
103 no-ripemd
104 no-rc2 no-rc4 no-rc5 no-idea no-des - Skip this symetric cipher
105 no-bf no-cast no-aes no-camellia no-seed
106 no-rsa no-dsa no-dh - Skip this public key cipher
107 no-ssl2 no-ssl3 - Skip this version of SSL
108 just-ssl - remove all non-ssl keys/digest
109 no-asm - No x86 asm
110 no-krb5 - No KRB5
111 no-srp - No SRP
112 no-ec - No EC
113 no-ecdsa - No ECDSA
114 no-ecdh - No ECDH
115 no-engine - No engine
116 no-hw - No hw
117 nasm - Use NASM for x86 asm
118 nw-nasm - Use NASM x86 asm for NetWare
119 nw-mwasm - Use Metrowerks x86 asm for NetWare
120 gaswin - Use GNU as with Mingw32
121 no-socks - No socket code
122 no-err - No error strings
123 dll/shlib - Build shared libraries (MS)
124 debug - Debug build
125 profile - Profiling build
126 gcc - Use Gcc (unix)
127
128Values that can be set
129TMP=tmpdir OUT=outdir SRC=srcdir BIN=binpath INC=header-outdir CC=C-compiler
130
131-L<ex_lib_path> -l<ex_lib> - extra library flags (unix)
132-<ex_cc_flags> - extra 'cc' flags,
133 added (MS), or replace (unix)
134EOF
135 exit(1);
136 }
137 $platform=$_;
138 }
139foreach (grep(!/^$/, split(/ /, $OPTIONS)))
140 {
141 print STDERR "unknown option - $_\n" if !&read_options;
142 }
143
144$no_static_engine = 0 if (!$shlib);
145
146$no_mdc2=1 if ($no_des);
147
148$no_ssl3=1 if ($no_md5 || $no_sha);
149$no_ssl3=1 if ($no_rsa && $no_dh);
150
151$no_ssl2=1 if ($no_md5);
152$no_ssl2=1 if ($no_rsa);
153
154$out_def="out";
155$inc_def="outinc";
156$tmp_def="tmp";
157
158$perl="perl" unless defined $perl;
159$mkdir="-mkdir" unless defined $mkdir;
160
161($ssl,$crypto)=("ssl","crypto");
162$ranlib="echo ranlib";
163
164$cc=(defined($VARS{'CC'}))?$VARS{'CC'}:'cc';
165$src_dir=(defined($VARS{'SRC'}))?$VARS{'SRC'}:'.';
166$bin_dir=(defined($VARS{'BIN'}))?$VARS{'BIN'}:'';
167
168# $bin_dir.=$o causes a core dump on my sparc :-(
169
170
171$NT=0;
172
173push(@INC,"util/pl","pl");
174
175if ($platform eq "auto") {
176 $platform = $mf_platform;
177 print STDERR "Imported platform $mf_platform\n";
178}
179
180if (($platform =~ /VC-(.+)/))
181 {
182 $FLAVOR=$1;
183 $NT = 1 if $1 eq "NT";
184 require 'VC-32.pl';
185 }
186elsif ($platform eq "Mingw32")
187 {
188 require 'Mingw32.pl';
189 }
190elsif ($platform eq "Mingw32-files")
191 {
192 require 'Mingw32f.pl';
193 }
194elsif ($platform eq "BC-NT")
195 {
196 $bc=1;
197 require 'BC-32.pl';
198 }
199elsif ($platform eq "FreeBSD")
200 {
201 require 'unix.pl';
202 $cflags='-DTERMIO -D_ANSI_SOURCE -O2 -fomit-frame-pointer';
203 }
204elsif ($platform eq "linux-elf")
205 {
206 require "unix.pl";
207 require "linux.pl";
208 $unix=1;
209 }
210elsif ($platform eq "ultrix-mips")
211 {
212 require "unix.pl";
213 require "ultrix.pl";
214 $unix=1;
215 }
216elsif ($platform eq "OS2-EMX")
217 {
218 $wc=1;
219 require 'OS2-EMX.pl';
220 }
221elsif (($platform eq "netware-clib") || ($platform eq "netware-libc") ||
222 ($platform eq "netware-clib-bsdsock") || ($platform eq "netware-libc-bsdsock"))
223 {
224 $LIBC=1 if $platform eq "netware-libc" || $platform eq "netware-libc-bsdsock";
225 $BSDSOCK=1 if ($platform eq "netware-libc-bsdsock") || ($platform eq "netware-clib-bsdsock");
226 require 'netware.pl';
227 }
228else
229 {
230 require "unix.pl";
231
232 $unix=1;
233 $cflags.=' -DTERMIO';
234 }
235
236$fipsdir =~ s/\//${o}/g;
237
238$out_dir=(defined($VARS{'OUT'}))?$VARS{'OUT'}:$out_def.($debug?".dbg":"");
239$tmp_dir=(defined($VARS{'TMP'}))?$VARS{'TMP'}:$tmp_def.($debug?".dbg":"");
240$inc_dir=(defined($VARS{'INC'}))?$VARS{'INC'}:$inc_def;
241
242$bin_dir=$bin_dir.$o unless ((substr($bin_dir,-1,1) eq $o) || ($bin_dir eq ''));
243
244$cflags= "$xcflags$cflags" if $xcflags ne "";
245
246$cflags.=" -DOPENSSL_NO_IDEA" if $no_idea;
247$cflags.=" -DOPENSSL_NO_AES" if $no_aes;
248$cflags.=" -DOPENSSL_NO_CAMELLIA" if $no_camellia;
249$cflags.=" -DOPENSSL_NO_SEED" if $no_seed;
250$cflags.=" -DOPENSSL_NO_RC2" if $no_rc2;
251$cflags.=" -DOPENSSL_NO_RC4" if $no_rc4;
252$cflags.=" -DOPENSSL_NO_RC5" if $no_rc5;
253$cflags.=" -DOPENSSL_NO_MD2" if $no_md2;
254$cflags.=" -DOPENSSL_NO_MD4" if $no_md4;
255$cflags.=" -DOPENSSL_NO_MD5" if $no_md5;
256$cflags.=" -DOPENSSL_NO_SHA" if $no_sha;
257$cflags.=" -DOPENSSL_NO_SHA1" if $no_sha1;
258$cflags.=" -DOPENSSL_NO_RIPEMD" if $no_ripemd;
259$cflags.=" -DOPENSSL_NO_MDC2" if $no_mdc2;
260$cflags.=" -DOPENSSL_NO_BF" if $no_bf;
261$cflags.=" -DOPENSSL_NO_CAST" if $no_cast;
262$cflags.=" -DOPENSSL_NO_DES" if $no_des;
263$cflags.=" -DOPENSSL_NO_RSA" if $no_rsa;
264$cflags.=" -DOPENSSL_NO_DSA" if $no_dsa;
265$cflags.=" -DOPENSSL_NO_DH" if $no_dh;
266$cflags.=" -DOPENSSL_NO_WHIRLPOOL" if $no_whirlpool;
267$cflags.=" -DOPENSSL_NO_SOCK" if $no_sock;
268$cflags.=" -DOPENSSL_NO_SSL2" if $no_ssl2;
269$cflags.=" -DOPENSSL_NO_SSL3" if $no_ssl3;
270$cflags.=" -DOPENSSL_NO_TLSEXT" if $no_tlsext;
271$cflags.=" -DOPENSSL_NO_SRP" if $no_srp;
272$cflags.=" -DOPENSSL_NO_CMS" if $no_cms;
273$cflags.=" -DOPENSSL_NO_ERR" if $no_err;
274$cflags.=" -DOPENSSL_NO_KRB5" if $no_krb5;
275$cflags.=" -DOPENSSL_NO_EC" if $no_ec;
276$cflags.=" -DOPENSSL_NO_ECDSA" if $no_ecdsa;
277$cflags.=" -DOPENSSL_NO_ECDH" if $no_ecdh;
278$cflags.=" -DOPENSSL_NO_GOST" if $no_gost;
279$cflags.=" -DOPENSSL_NO_ENGINE" if $no_engine;
280$cflags.=" -DOPENSSL_NO_HW" if $no_hw;
281$cflags.=" -DOPENSSL_FIPS" if $fips;
282$cflags.=" -DOPENSSL_NO_JPAKE" if $no_jpake;
283$cflags.=" -DOPENSSL_NO_EC2M" if $no_ec2m;
284$cflags.= " -DZLIB" if $zlib_opt;
285$cflags.= " -DZLIB_SHARED" if $zlib_opt == 2;
286
287if ($no_static_engine)
288 {
289 $cflags .= " -DOPENSSL_NO_STATIC_ENGINE";
290 }
291else
292 {
293 $cflags .= " -DOPENSSL_NO_DYNAMIC_ENGINE";
294 }
295
296#$cflags.=" -DRSAref" if $rsaref ne "";
297
298## if ($unix)
299## { $cflags="$c_flags" if ($c_flags ne ""); }
300##else
301 { $cflags="$c_flags$cflags" if ($c_flags ne ""); }
302
303$ex_libs="$l_flags$ex_libs" if ($l_flags ne "");
304
305
306%shlib_ex_cflags=("SSL" => " -DOPENSSL_BUILD_SHLIBSSL",
307 "CRYPTO" => " -DOPENSSL_BUILD_SHLIBCRYPTO");
308
309if ($msdos)
310 {
311 $banner ="\t\@echo Make sure you have run 'perl Configure $platform' in the\n";
312 $banner.="\t\@echo top level directory, if you don't have perl, you will\n";
313 $banner.="\t\@echo need to probably edit crypto/bn/bn.h, check the\n";
314 $banner.="\t\@echo documentation for details.\n";
315 }
316
317# have to do this to allow $(CC) under unix
318$link="$bin_dir$link" if ($link !~ /^\$/);
319
320$INSTALLTOP =~ s|/|$o|g;
321$OPENSSLDIR =~ s|/|$o|g;
322
323#############################################
324# We parse in input file and 'store' info for later printing.
325open(IN,"<$infile") || die "unable to open $infile:$!\n";
326$_=<IN>;
327for (;;)
328 {
329 chop;
330
331 ($key,$val)=/^([^=]+)=(.*)/;
332 if ($key eq "RELATIVE_DIRECTORY")
333 {
334 if ($lib ne "")
335 {
336 $uc=$lib;
337 $uc =~ s/^lib(.*)\.a/$1/;
338 $uc =~ tr/a-z/A-Z/;
339 $lib_nam{$uc}=$uc;
340 $lib_obj{$uc}.=$libobj." ";
341 }
342 last if ($val eq "FINISHED");
343 $lib="";
344 $libobj="";
345 $dir=$val;
346 }
347
348 if ($key eq "KRB5_INCLUDES")
349 { $cflags .= " $val";}
350
351 if ($key eq "ZLIB_INCLUDE")
352 { $cflags .= " $val" if $val ne "";}
353
354 if ($key eq "LIBZLIB")
355 { $zlib_lib = "$val" if $val ne "";}
356
357 if ($key eq "LIBKRB5")
358 { $ex_libs .= " $val" if $val ne "";}
359
360 if ($key eq "TEST")
361 { $test.=&var_add($dir,$val, 0); }
362
363 if (($key eq "PROGS") || ($key eq "E_OBJ"))
364 { $e_exe.=&var_add($dir,$val, 0); }
365
366 if ($key eq "LIB")
367 {
368 $lib=$val;
369 $lib =~ s/^.*\/([^\/]+)$/$1/;
370 }
371 if ($key eq "LIBNAME" && $no_static_engine)
372 {
373 $lib=$val;
374 $lib =~ s/^.*\/([^\/]+)$/$1/;
375 $otherlibs .= " $lib";
376 }
377
378 if ($key eq "EXHEADER")
379 { $exheader.=&var_add($dir,$val, 1); }
380
381 if ($key eq "HEADER")
382 { $header.=&var_add($dir,$val, 1); }
383
384 if ($key eq "LIBOBJ" && ($dir ne "engines" || !$no_static_engine))
385 { $libobj=&var_add($dir,$val, 0); }
386 if ($key eq "LIBNAMES" && $dir eq "engines" && $no_static_engine)
387 { $engines.=$val }
388
389 if (!($_=<IN>))
390 { $_="RELATIVE_DIRECTORY=FINISHED\n"; }
391 }
392close(IN);
393
394if ($shlib)
395 {
396 $extra_install= <<"EOF";
397 \$(CP) \"\$(O_SSL)\" \"\$(INSTALLTOP)${o}bin\"
398 \$(CP) \"\$(O_CRYPTO)\" \"\$(INSTALLTOP)${o}bin\"
399 \$(CP) \"\$(L_SSL)\" \"\$(INSTALLTOP)${o}lib\"
400 \$(CP) \"\$(L_CRYPTO)\" \"\$(INSTALLTOP)${o}lib\"
401EOF
402 if ($no_static_engine)
403 {
404 $extra_install .= <<"EOF"
405 \$(MKDIR) \"\$(INSTALLTOP)${o}lib${o}engines\"
406 \$(CP) \"\$(E_SHLIB)\" \"\$(INSTALLTOP)${o}lib${o}engines\"
407EOF
408 }
409 }
410else
411 {
412 $extra_install= <<"EOF";
413 \$(CP) \"\$(O_SSL)\" \"\$(INSTALLTOP)${o}lib\"
414 \$(CP) \"\$(O_CRYPTO)\" \"\$(INSTALLTOP)${o}lib\"
415EOF
416 $ex_libs .= " $zlib_lib" if $zlib_opt == 1;
417 if ($fips)
418 {
419 $build_targets .= " \$(LIB_D)$o$crypto_compat \$(PREMAIN_DSO_EXE)";
420 $ex_l_libs .= " \$(O_FIPSCANISTER)";
421 }
422 }
423
424$defs= <<"EOF";
425# This makefile has been automatically generated from the OpenSSL distribution.
426# This single makefile will build the complete OpenSSL distribution and
427# by default leave the 'intertesting' output files in .${o}out and the stuff
428# that needs deleting in .${o}tmp.
429# The file was generated by running 'make makefile.one', which
430# does a 'make files', which writes all the environment variables from all
431# the makefiles to the file call MINFO. This file is used by
432# util${o}mk1mf.pl to generate makefile.one.
433# The 'makefile per directory' system suites me when developing this
434# library and also so I can 'distribute' indervidual library sections.
435# The one monster makefile better suits building in non-unix
436# environments.
437
438EOF
439
440$defs .= $preamble if defined $preamble;
441
442$defs.= <<"EOF";
443INSTALLTOP=$INSTALLTOP
444OPENSSLDIR=$OPENSSLDIR
445
446# Set your compiler options
447PLATFORM=$platform
448CC=$bin_dir${cc}
449CFLAG=$cflags
450APP_CFLAG=$app_cflag
451LIB_CFLAG=$lib_cflag
452SHLIB_CFLAG=$shl_cflag
453APP_EX_OBJ=$app_ex_obj
454SHLIB_EX_OBJ=$shlib_ex_obj
455# add extra libraries to this define, for solaris -lsocket -lnsl would
456# be added
457EX_LIBS=$ex_libs
458
459# The OpenSSL directory
460SRC_D=$src_dir
461
462LINK=$link
463LFLAGS=$lflags
464RSC=$rsc
465
466# The output directory for everything intersting
467OUT_D=$out_dir
468# The output directory for all the temporary muck
469TMP_D=$tmp_dir
470# The output directory for the header files
471INC_D=$inc_dir
472INCO_D=$inc_dir${o}openssl
473
474PERL=$perl
475CP=$cp
476RM=$rm
477RANLIB=$ranlib
478MKDIR=$mkdir
479MKLIB=$bin_dir$mklib
480MLFLAGS=$mlflags
481ASM=$bin_dir$asm
482
483# FIPS validated module and support file locations
484
485FIPSDIR=$fipsdir
486BASEADDR=$baseaddr
487FIPSLIB_D=\$(FIPSDIR)${o}lib
488FIPS_PREMAIN_SRC=\$(FIPSLIB_D)${o}fips_premain.c
489O_FIPSCANISTER=\$(FIPSLIB_D)${o}fipscanister.lib
490FIPS_SHA1_EXE=\$(FIPSDIR)${o}bin${o}fips_standalone_sha1${exep}
491E_PREMAIN_DSO=fips_premain_dso
492PREMAIN_DSO_EXE=\$(BIN_D)${o}fips_premain_dso$exep
493FIPSLINK=\$(PERL) \$(FIPSDIR)${o}bin${o}fipslink.pl
494
495######################################################
496# You should not need to touch anything below this point
497######################################################
498
499E_EXE=openssl
500SSL=$ssl
501CRYPTO=$crypto
502
503# BIN_D - Binary output directory
504# TEST_D - Binary test file output directory
505# LIB_D - library output directory
506# ENG_D - dynamic engine output directory
507# Note: if you change these point to different directories then uncomment out
508# the lines around the 'NB' comment below.
509#
510BIN_D=\$(OUT_D)
511TEST_D=\$(OUT_D)
512LIB_D=\$(OUT_D)
513ENG_D=\$(OUT_D)
514
515# INCL_D - local library directory
516# OBJ_D - temp object file directory
517OBJ_D=\$(TMP_D)
518INCL_D=\$(TMP_D)
519
520O_SSL= \$(LIB_D)$o$plib\$(SSL)$shlibp
521O_CRYPTO= \$(LIB_D)$o$plib\$(CRYPTO)$shlibp
522SO_SSL= $plib\$(SSL)$so_shlibp
523SO_CRYPTO= $plib\$(CRYPTO)$so_shlibp
524L_SSL= \$(LIB_D)$o$plib\$(SSL)$libp
525L_CRYPTO= \$(LIB_D)$o$plib\$(CRYPTO)$libp
526
527L_LIBS= \$(L_SSL) \$(L_CRYPTO) $ex_l_libs
528
529######################################################
530# Don't touch anything below this point
531######################################################
532
533INC=-I\$(INC_D) -I\$(INCL_D)
534APP_CFLAGS=\$(INC) \$(CFLAG) \$(APP_CFLAG)
535LIB_CFLAGS=\$(INC) \$(CFLAG) \$(LIB_CFLAG)
536SHLIB_CFLAGS=\$(INC) \$(CFLAG) \$(LIB_CFLAG) \$(SHLIB_CFLAG)
537LIBS_DEP=\$(O_CRYPTO) \$(O_SSL)
538
539#############################################
540EOF
541
542$rules=<<"EOF";
543all: banner \$(TMP_D) \$(BIN_D) \$(TEST_D) \$(LIB_D) \$(INCO_D) headers lib exe $build_targets
544
545banner:
546$banner
547
548\$(TMP_D):
549 \$(MKDIR) \"\$(TMP_D)\"
550# NB: uncomment out these lines if BIN_D, TEST_D and LIB_D are different
551#\$(BIN_D):
552# \$(MKDIR) \$(BIN_D)
553#
554#\$(TEST_D):
555# \$(MKDIR) \$(TEST_D)
556
557\$(LIB_D):
558 \$(MKDIR) \"\$(LIB_D)\"
559
560\$(INCO_D): \$(INC_D)
561 \$(MKDIR) \"\$(INCO_D)\"
562
563\$(INC_D):
564 \$(MKDIR) \"\$(INC_D)\"
565
566headers: \$(HEADER) \$(EXHEADER)
567 @
568
569lib: \$(LIBS_DEP) \$(E_SHLIB)
570
571exe: \$(T_EXE) \$(BIN_D)$o\$(E_EXE)$exep
572
573install: all
574 \$(MKDIR) \"\$(INSTALLTOP)\"
575 \$(MKDIR) \"\$(INSTALLTOP)${o}bin\"
576 \$(MKDIR) \"\$(INSTALLTOP)${o}include\"
577 \$(MKDIR) \"\$(INSTALLTOP)${o}include${o}openssl\"
578 \$(MKDIR) \"\$(INSTALLTOP)${o}lib\"
579 \$(CP) \"\$(INCO_D)${o}*.\[ch\]\" \"\$(INSTALLTOP)${o}include${o}openssl\"
580 \$(CP) \"\$(BIN_D)$o\$(E_EXE)$exep \$(INSTALLTOP)${o}bin\"
581 \$(MKDIR) \"\$(OPENSSLDIR)\"
582 \$(CP) apps${o}openssl.cnf \"\$(OPENSSLDIR)\"
583$extra_install
584
585
586test: \$(T_EXE)
587 cd \$(BIN_D)
588 ..${o}ms${o}test
589
590clean:
591 \$(RM) \$(TMP_D)$o*.*
592
593vclean:
594 \$(RM) \$(TMP_D)$o*.*
595 \$(RM) \$(OUT_D)$o*.*
596
597EOF
598
599my $platform_cpp_symbol = "MK1MF_PLATFORM_$platform";
600$platform_cpp_symbol =~ s/-/_/g;
601if (open(IN,"crypto/buildinf.h"))
602 {
603 # Remove entry for this platform in existing file buildinf.h.
604
605 my $old_buildinf_h = "";
606 while (<IN>)
607 {
608 if (/^\#ifdef $platform_cpp_symbol$/)
609 {
610 while (<IN>) { last if (/^\#endif/); }
611 }
612 else
613 {
614 $old_buildinf_h .= $_;
615 }
616 }
617 close(IN);
618
619 open(OUT,">crypto/buildinf.h") || die "Can't open buildinf.h";
620 print OUT $old_buildinf_h;
621 close(OUT);
622 }
623
624open (OUT,">>crypto/buildinf.h") || die "Can't open buildinf.h";
625printf OUT <<EOF;
626#ifdef $platform_cpp_symbol
627 /* auto-generated/updated by util/mk1mf.pl for crypto/cversion.c */
628 #define CFLAGS "$cc $cflags"
629 #define PLATFORM "$platform"
630EOF
631printf OUT " #define DATE \"%s\"\n", scalar gmtime();
632printf OUT "#endif\n";
633close(OUT);
634
635# Strip of trailing ' '
636foreach (keys %lib_obj) { $lib_obj{$_}=&clean_up_ws($lib_obj{$_}); }
637$test=&clean_up_ws($test);
638$e_exe=&clean_up_ws($e_exe);
639$exheader=&clean_up_ws($exheader);
640$header=&clean_up_ws($header);
641
642# First we strip the exheaders from the headers list
643foreach (split(/\s+/,$exheader)){ $h{$_}=1; }
644foreach (split(/\s+/,$header)) { $h.=$_." " unless $h{$_}; }
645chop($h); $header=$h;
646
647$defs.=&do_defs("HEADER",$header,"\$(INCL_D)","");
648$rules.=&do_copy_rule("\$(INCL_D)",$header,"");
649
650$defs.=&do_defs("EXHEADER",$exheader,"\$(INCO_D)","");
651$rules.=&do_copy_rule("\$(INCO_D)",$exheader,"");
652
653$defs.=&do_defs("T_OBJ",$test,"\$(OBJ_D)",$obj);
654$rules.=&do_compile_rule("\$(OBJ_D)",$test,"\$(APP_CFLAGS)");
655
656$defs.=&do_defs("E_OBJ",$e_exe,"\$(OBJ_D)",$obj);
657$rules.=&do_compile_rule("\$(OBJ_D)",$e_exe,'-DMONOLITH $(APP_CFLAGS)');
658
659# Special case rule for fips_premain_dso
660
661if ($fips)
662 {
663 $rules.=&cc_compile_target("\$(OBJ_D)${o}\$(E_PREMAIN_DSO)$obj",
664 "\$(FIPS_PREMAIN_SRC)",
665 "-DFINGERPRINT_PREMAIN_DSO_LOAD \$(SHLIB_CFLAGS)", "");
666 $rules.=&do_link_rule("\$(PREMAIN_DSO_EXE)","\$(OBJ_D)${o}\$(E_PREMAIN_DSO)$obj \$(CRYPTOOBJ) \$(O_FIPSCANISTER)","","\$(EX_LIBS)", 1);
667 }
668
669foreach (values %lib_nam)
670 {
671 $lib_obj=$lib_obj{$_};
672 local($slib)=$shlib;
673
674 if (($_ eq "SSL") && $no_ssl2 && $no_ssl3)
675 {
676 $rules.="\$(O_SSL):\n\n";
677 next;
678 }
679
680 $defs.=&do_defs(${_}."OBJ",$lib_obj,"\$(OBJ_D)",$obj);
681 $lib=($slib)?" \$(SHLIB_CFLAGS)".$shlib_ex_cflags{$_}:" \$(LIB_CFLAGS)";
682 $rules.=&do_compile_rule("\$(OBJ_D)",$lib_obj{$_},$lib);
683 }
684
685# hack to add version info on MSVC
686if (($platform eq "VC-WIN32") || ($platform eq "VC-WIN64A")
687 || ($platform eq "VC-WIN64I") || ($platform eq "VC-NT")) {
688 $rules.= <<"EOF";
689\$(OBJ_D)\\\$(CRYPTO).res: ms\\version32.rc
690 \$(RSC) /fo"\$(OBJ_D)\\\$(CRYPTO).res" /d CRYPTO ms\\version32.rc
691
692\$(OBJ_D)\\\$(SSL).res: ms\\version32.rc
693 \$(RSC) /fo"\$(OBJ_D)\\\$(SSL).res" /d SSL ms\\version32.rc
694
695EOF
696}
697
698$defs.=&do_defs("T_EXE",$test,"\$(TEST_D)",$exep);
699foreach (split(/\s+/,$test))
700 {
701 $t=&bname($_);
702 $tt="\$(OBJ_D)${o}$t${obj}";
703 $rules.=&do_link_rule("\$(TEST_D)$o$t$exep",$tt,"\$(LIBS_DEP)","\$(L_LIBS) \$(EX_LIBS)");
704 }
705
706$defs.=&do_defs("E_SHLIB",$engines . $otherlibs,"\$(ENG_D)",$shlibp);
707
708foreach (split(/\s+/,$engines))
709 {
710 $rules.=&do_compile_rule("\$(OBJ_D)","engines${o}e_$_",$lib);
711 $rules.= &do_lib_rule("\$(OBJ_D)${o}e_${_}.obj","\$(ENG_D)$o$_$shlibp","",$shlib,"");
712 }
713
714
715
716$rules.= &do_lib_rule("\$(SSLOBJ)","\$(O_SSL)",$ssl,$shlib,"\$(SO_SSL)");
717
718if ($fips)
719 {
720 if ($shlib)
721 {
722 $rules.= &do_lib_rule("\$(CRYPTOOBJ) \$(O_FIPSCANISTER)",
723 "\$(O_CRYPTO)", "$crypto",
724 $shlib, "\$(SO_CRYPTO)", "\$(BASEADDR)");
725 }
726 else
727 {
728 $rules.= &do_lib_rule("\$(CRYPTOOBJ)",
729 "\$(O_CRYPTO)",$crypto,$shlib,"\$(SO_CRYPTO)", "");
730 $rules.= &do_lib_rule("\$(CRYPTOOBJ) \$(O_FIPSCANISTER)",
731 "\$(LIB_D)$o$crypto_compat",$crypto,$shlib,"\$(SO_CRYPTO)", "");
732 }
733 }
734 else
735 {
736 $rules.= &do_lib_rule("\$(CRYPTOOBJ)","\$(O_CRYPTO)",$crypto,$shlib,
737 "\$(SO_CRYPTO)");
738 }
739
740foreach (split(" ",$otherlibs))
741 {
742 my $uc = $_;
743 $uc =~ tr /a-z/A-Z/;
744 $rules.= &do_lib_rule("\$(${uc}OBJ)","\$(ENG_D)$o$_$shlibp", "", $shlib, "");
745
746 }
747
748$rules.=&do_link_rule("\$(BIN_D)$o\$(E_EXE)$exep","\$(E_OBJ)","\$(LIBS_DEP)","\$(L_LIBS) \$(EX_LIBS)", ($fips && !$shlib) ? 2 : 0);
749
750print $defs;
751
752if ($platform eq "linux-elf") {
753 print <<"EOF";
754# Generate perlasm output files
755%.cpp:
756 (cd \$(\@D)/..; PERL=perl make -f Makefile asm/\$(\@F))
757EOF
758}
759print "###################################################################\n";
760print $rules;
761
762###############################################
763# strip off any trailing .[och] and append the relative directory
764# also remembering to do nothing if we are in one of the dropped
765# directories
766sub var_add
767 {
768 local($dir,$val,$keepext)=@_;
769 local(@a,$_,$ret);
770
771 return("") if $no_engine && $dir =~ /\/engine/;
772 return("") if $no_hw && $dir =~ /\/hw/;
773 return("") if $no_idea && $dir =~ /\/idea/;
774 return("") if $no_aes && $dir =~ /\/aes/;
775 return("") if $no_camellia && $dir =~ /\/camellia/;
776 return("") if $no_seed && $dir =~ /\/seed/;
777 return("") if $no_rc2 && $dir =~ /\/rc2/;
778 return("") if $no_rc4 && $dir =~ /\/rc4/;
779 return("") if $no_rc5 && $dir =~ /\/rc5/;
780 return("") if $no_rsa && $dir =~ /\/rsa/;
781 return("") if $no_rsa && $dir =~ /^rsaref/;
782 return("") if $no_dsa && $dir =~ /\/dsa/;
783 return("") if $no_dh && $dir =~ /\/dh/;
784 return("") if $no_ec && $dir =~ /\/ec/;
785 return("") if $no_gost && $dir =~ /\/ccgost/;
786 return("") if $no_cms && $dir =~ /\/cms/;
787 return("") if $no_jpake && $dir =~ /\/jpake/;
788 if ($no_des && $dir =~ /\/des/)
789 {
790 if ($val =~ /read_pwd/)
791 { return("$dir/read_pwd "); }
792 else
793 { return(""); }
794 }
795 return("") if $no_mdc2 && $dir =~ /\/mdc2/;
796 return("") if $no_sock && $dir =~ /\/proxy/;
797 return("") if $no_bf && $dir =~ /\/bf/;
798 return("") if $no_cast && $dir =~ /\/cast/;
799 return("") if $no_whirlpool && $dir =~ /\/whrlpool/;
800
801 $val =~ s/^\s*(.*)\s*$/$1/;
802 @a=split(/\s+/,$val);
803 grep(s/\.[och]$//,@a) unless $keepext;
804
805 @a=grep(!/^e_.*_3d$/,@a) if $no_des;
806 @a=grep(!/^e_.*_d$/,@a) if $no_des;
807 @a=grep(!/^e_.*_ae$/,@a) if $no_idea;
808 @a=grep(!/^e_.*_i$/,@a) if $no_aes;
809 @a=grep(!/^e_.*_r2$/,@a) if $no_rc2;
810 @a=grep(!/^e_.*_r5$/,@a) if $no_rc5;
811 @a=grep(!/^e_.*_bf$/,@a) if $no_bf;
812 @a=grep(!/^e_.*_c$/,@a) if $no_cast;
813 @a=grep(!/^e_rc4$/,@a) if $no_rc4;
814 @a=grep(!/^e_camellia$/,@a) if $no_camellia;
815 @a=grep(!/^e_seed$/,@a) if $no_seed;
816
817 #@a=grep(!/(^s2_)|(^s23_)/,@a) if $no_ssl2;
818 #@a=grep(!/(^s3_)|(^s23_)/,@a) if $no_ssl3;
819
820 @a=grep(!/(_sock$)|(_acpt$)|(_conn$)|(^pxy_)/,@a) if $no_sock;
821
822 @a=grep(!/(^md2)|(_md2$)/,@a) if $no_md2;
823 @a=grep(!/(^md4)|(_md4$)/,@a) if $no_md4;
824 @a=grep(!/(^md5)|(_md5$)/,@a) if $no_md5;
825 @a=grep(!/(rmd)|(ripemd)/,@a) if $no_ripemd;
826
827 @a=grep(!/(^d2i_r_)|(^i2d_r_)/,@a) if $no_rsa;
828 @a=grep(!/(^p_open$)|(^p_seal$)/,@a) if $no_rsa;
829 @a=grep(!/(^pem_seal$)/,@a) if $no_rsa;
830
831 @a=grep(!/(m_dss$)|(m_dss1$)/,@a) if $no_dsa;
832 @a=grep(!/(^d2i_s_)|(^i2d_s_)|(_dsap$)/,@a) if $no_dsa;
833
834 @a=grep(!/^n_pkey$/,@a) if $no_rsa || $no_rc4;
835
836 @a=grep(!/_dhp$/,@a) if $no_dh;
837
838 @a=grep(!/(^sha[^1])|(_sha$)|(m_dss$)/,@a) if $no_sha;
839 @a=grep(!/(^sha1)|(_sha1$)|(m_dss1$)/,@a) if $no_sha1;
840 @a=grep(!/_mdc2$/,@a) if $no_mdc2;
841
842 @a=grep(!/(srp)/,@a) if $no_srp;
843
844 @a=grep(!/^engine$/,@a) if $no_engine;
845 @a=grep(!/^hw$/,@a) if $no_hw;
846 @a=grep(!/(^rsa$)|(^genrsa$)/,@a) if $no_rsa;
847 @a=grep(!/(^dsa$)|(^gendsa$)|(^dsaparam$)/,@a) if $no_dsa;
848 @a=grep(!/^gendsa$/,@a) if $no_sha1;
849 @a=grep(!/(^dh$)|(^gendh$)/,@a) if $no_dh;
850
851 @a=grep(!/(^dh)|(_sha1$)|(m_dss1$)/,@a) if $no_sha1;
852
853 grep($_="$dir/$_",@a);
854 @a=grep(!/(^|\/)s_/,@a) if $no_sock;
855 @a=grep(!/(^|\/)bio_sock/,@a) if $no_sock;
856 $ret=join(' ',@a)." ";
857 return($ret);
858 }
859
860# change things so that each 'token' is only separated by one space
861sub clean_up_ws
862 {
863 local($w)=@_;
864
865 $w =~ s/^\s*(.*)\s*$/$1/;
866 $w =~ s/\s+/ /g;
867 return($w);
868 }
869
870sub do_defs
871 {
872 local($var,$files,$location,$postfix)=@_;
873 local($_,$ret,$pf);
874 local(*OUT,$tmp,$t);
875
876 $files =~ s/\//$o/g if $o ne '/';
877 $ret="$var=";
878 $n=1;
879 $Vars{$var}.="";
880 foreach (split(/ /,$files))
881 {
882 $orig=$_;
883 $_=&bname($_) unless /^\$/;
884 if ($n++ == 2)
885 {
886 $n=0;
887 $ret.="\\\n\t";
888 }
889 if (($_ =~ /bss_file/) && ($postfix eq ".h"))
890 { $pf=".c"; }
891 else { $pf=$postfix; }
892 if ($_ =~ /BN_ASM/) { $t="$_ "; }
893 elsif ($_ =~ /BNCO_ASM/){ $t="$_ "; }
894 elsif ($_ =~ /AES_ASM/){ $t="$_ "; }
895 elsif ($_ =~ /DES_ENC/) { $t="$_ "; }
896 elsif ($_ =~ /BF_ENC/) { $t="$_ "; }
897 elsif ($_ =~ /CAST_ENC/){ $t="$_ "; }
898 elsif ($_ =~ /RC4_ENC/) { $t="$_ "; }
899 elsif ($_ =~ /RC5_ENC/) { $t="$_ "; }
900 elsif ($_ =~ /MD5_ASM/) { $t="$_ "; }
901 elsif ($_ =~ /SHA1_ASM/){ $t="$_ "; }
902 elsif ($_ =~ /RMD160_ASM/){ $t="$_ "; }
903 elsif ($_ =~ /WHIRLPOOL_ASM/){ $t="$_ "; }
904 elsif ($_ =~ /CPUID_ASM/){ $t="$_ "; }
905 else { $t="$location${o}$_$pf "; }
906
907 $Vars{$var}.="$t ";
908 $ret.=$t;
909 }
910 # hack to add version info on MSVC
911 if ($shlib && (($platform eq "VC-WIN32") || ($platfrom eq "VC-WIN64I") || ($platform eq "VC-WIN64A") || ($platform eq "VC-NT")))
912 {
913 if ($var eq "CRYPTOOBJ")
914 { $ret.="\$(OBJ_D)\\\$(CRYPTO).res "; }
915 elsif ($var eq "SSLOBJ")
916 { $ret.="\$(OBJ_D)\\\$(SSL).res "; }
917 }
918 chomp($ret);
919 $ret.="\n\n";
920 return($ret);
921 }
922
923# return the name with the leading path removed
924sub bname
925 {
926 local($ret)=@_;
927 $ret =~ s/^.*[\\\/]([^\\\/]+)$/$1/;
928 return($ret);
929 }
930
931# return the leading path
932sub dname
933 {
934 my $ret=shift;
935 $ret =~ s/(^.*)[\\\/][^\\\/]+$/$1/;
936 return($ret);
937 }
938
939##############################################################
940# do a rule for each file that says 'compile' to new direcory
941# compile the files in '$files' into $to
942sub do_compile_rule
943 {
944 local($to,$files,$ex)=@_;
945 local($ret,$_,$n,$d,$s);
946
947 $files =~ s/\//$o/g if $o ne '/';
948 foreach (split(/\s+/,$files))
949 {
950 $n=&bname($_);
951 $d=&dname($_);
952 if (-f "${_}.c")
953 {
954 $ret.=&cc_compile_target("$to${o}$n$obj","${_}.c",$ex)
955 }
956 elsif (-f ($s="${d}${o}asm${o}${n}.pl") or
957 ($s=~s/sha256/sha512/ and -f $s) or
958 -f ($s="${d}${o}${n}.pl"))
959 {
960 $ret.=&perlasm_compile_target("$to${o}$n$obj",$s,$n);
961 }
962 elsif (-f ($s="${d}${o}asm${o}${n}.S") or
963 -f ($s="${d}${o}${n}.S"))
964 {
965 $ret.=&Sasm_compile_target("$to${o}$n$obj",$s,$n);
966 }
967 else { die "no rule for $_"; }
968 }
969 return($ret);
970 }
971
972##############################################################
973# do a rule for each file that says 'compile' to new direcory
974sub perlasm_compile_target
975 {
976 my($target,$source,$bname)=@_;
977 my($ret);
978
979 $bname =~ s/(.*)\.[^\.]$/$1/;
980 $ret ="\$(TMP_D)$o$bname.asm: $source\n";
981 $ret.="\t\$(PERL) $source $asmtype \$(CFLAG) >\$\@\n\n";
982 $ret.="$target: \$(TMP_D)$o$bname.asm\n";
983 $ret.="\t\$(ASM) $afile\$\@ \$(TMP_D)$o$bname.asm\n\n";
984 return($ret);
985 }
986
987sub Sasm_compile_target
988 {
989 my($target,$source,$bname)=@_;
990 my($ret);
991
992 $bname =~ s/(.*)\.[^\.]$/$1/;
993 $ret ="\$(TMP_D)$o$bname.asm: $source\n";
994 $ret.="\t\$(CC) -E \$(CFLAG) $source >\$\@\n\n";
995 $ret.="$target: \$(TMP_D)$o$bname.asm\n";
996 $ret.="\t\$(ASM) $afile\$\@ \$(TMP_D)$o$bname.asm\n\n";
997 return($ret);
998 }
999
1000sub cc_compile_target
1001 {
1002 local($target,$source,$ex_flags, $srcd)=@_;
1003 local($ret);
1004
1005 $ex_flags.=" -DMK1MF_BUILD -D$platform_cpp_symbol" if ($source =~ /cversion/);
1006 $target =~ s/\//$o/g if $o ne "/";
1007 $source =~ s/\//$o/g if $o ne "/";
1008 $srcd = "\$(SRC_D)$o" unless defined $srcd;
1009 $ret ="$target: $srcd$source\n\t";
1010 $ret.="\$(CC) ${ofile}$target $ex_flags -c $srcd$source\n\n";
1011 return($ret);
1012 }
1013
1014##############################################################
1015sub do_asm_rule
1016 {
1017 local($target,$src)=@_;
1018 local($ret,@s,@t,$i);
1019
1020 $target =~ s/\//$o/g if $o ne "/";
1021 $src =~ s/\//$o/g if $o ne "/";
1022
1023 @t=split(/\s+/,$target);
1024 @s=split(/\s+/,$src);
1025
1026
1027 for ($i=0; $i<=$#s; $i++)
1028 {
1029 my $objfile = $t[$i];
1030 my $srcfile = $s[$i];
1031
1032 if ($perl_asm == 1)
1033 {
1034 my $plasm = $objfile;
1035 $plasm =~ s/${obj}/.pl/;
1036 $ret.="$srcfile: $plasm\n";
1037 $ret.="\t\$(PERL) $plasm $asmtype \$(CFLAG) >$srcfile\n\n";
1038 }
1039
1040 $ret.="$objfile: $srcfile\n";
1041 $ret.="\t\$(ASM) $afile$objfile \$(SRC_D)$o$srcfile\n\n";
1042 }
1043 return($ret);
1044 }
1045
1046sub do_shlib_rule
1047 {
1048 local($n,$def)=@_;
1049 local($ret,$nn);
1050 local($t);
1051
1052 ($nn=$n) =~ tr/a-z/A-Z/;
1053 $ret.="$n.dll: \$(${nn}OBJ)\n";
1054 if ($vc && $w32)
1055 {
1056 $ret.="\t\$(MKSHLIB) $efile$n.dll $def @<<\n \$(${nn}OBJ_F)\n<<\n";
1057 }
1058 $ret.="\n";
1059 return($ret);
1060 }
1061
1062# do a rule for each file that says 'copy' to new direcory on change
1063sub do_copy_rule
1064 {
1065 local($to,$files,$p)=@_;
1066 local($ret,$_,$n,$pp);
1067
1068 $files =~ s/\//$o/g if $o ne '/';
1069 foreach (split(/\s+/,$files))
1070 {
1071 $n=&bname($_);
1072 if ($n =~ /bss_file/)
1073 { $pp=".c"; }
1074 else { $pp=$p; }
1075 $ret.="$to${o}$n$pp: \$(SRC_D)$o$_$pp\n\t\$(CP) \"\$(SRC_D)$o$_$pp\" \"$to${o}$n$pp\"\n\n";
1076 }
1077 return($ret);
1078 }
1079
1080sub read_options
1081 {
1082 # Many options are handled in a similar way. In particular
1083 # no-xxx sets zero or more scalars to 1.
1084 # Process these using a hash containing the option name and
1085 # reference to the scalars to set.
1086
1087 my %valid_options = (
1088 "no-rc2" => \$no_rc2,
1089 "no-rc4" => \$no_rc4,
1090 "no-rc5" => \$no_rc5,
1091 "no-idea" => \$no_idea,
1092 "no-aes" => \$no_aes,
1093 "no-camellia" => \$no_camellia,
1094 "no-seed" => \$no_seed,
1095 "no-des" => \$no_des,
1096 "no-bf" => \$no_bf,
1097 "no-cast" => \$no_cast,
1098 "no-md2" => \$no_md2,
1099 "no-md4" => \$no_md4,
1100 "no-md5" => \$no_md5,
1101 "no-sha" => \$no_sha,
1102 "no-sha1" => \$no_sha1,
1103 "no-ripemd" => \$no_ripemd,
1104 "no-mdc2" => \$no_mdc2,
1105 "no-whirlpool" => \$no_whirlpool,
1106 "no-patents" =>
1107 [\$no_rc2, \$no_rc4, \$no_rc5, \$no_idea, \$no_rsa],
1108 "no-rsa" => \$no_rsa,
1109 "no-dsa" => \$no_dsa,
1110 "no-dh" => \$no_dh,
1111 "no-hmac" => \$no_hmac,
1112 "no-asm" => \$no_asm,
1113 "nasm" => \$nasm,
1114 "nw-nasm" => \$nw_nasm,
1115 "nw-mwasm" => \$nw_mwasm,
1116 "gaswin" => \$gaswin,
1117 "no-ssl2" => \$no_ssl2,
1118 "no-ssl3" => \$no_ssl3,
1119 "no-tlsext" => \$no_tlsext,
1120 "no-srp" => \$no_srp,
1121 "no-cms" => \$no_cms,
1122 "no-ec2m" => \$no_ec2m,
1123 "no-jpake" => \$no_jpake,
1124 "no-ec_nistp_64_gcc_128" => 0,
1125 "no-err" => \$no_err,
1126 "no-sock" => \$no_sock,
1127 "no-krb5" => \$no_krb5,
1128 "no-ec" => \$no_ec,
1129 "no-ecdsa" => \$no_ecdsa,
1130 "no-ecdh" => \$no_ecdh,
1131 "no-gost" => \$no_gost,
1132 "no-engine" => \$no_engine,
1133 "no-hw" => \$no_hw,
1134 "no-rsax" => 0,
1135 "just-ssl" =>
1136 [\$no_rc2, \$no_idea, \$no_des, \$no_bf, \$no_cast,
1137 \$no_md2, \$no_sha, \$no_mdc2, \$no_dsa, \$no_dh,
1138 \$no_ssl2, \$no_err, \$no_ripemd, \$no_rc5,
1139 \$no_aes, \$no_camellia, \$no_seed, \$no_srp],
1140 "rsaref" => 0,
1141 "gcc" => \$gcc,
1142 "debug" => \$debug,
1143 "profile" => \$profile,
1144 "shlib" => \$shlib,
1145 "dll" => \$shlib,
1146 "shared" => 0,
1147 "no-sctp" => 0,
1148 "no-gmp" => 0,
1149 "no-rfc3779" => 0,
1150 "no-montasm" => 0,
1151 "no-shared" => 0,
1152 "no-store" => 0,
1153 "no-zlib" => 0,
1154 "no-zlib-dynamic" => 0,
1155 "fips" => \$fips
1156 );
1157
1158 if (exists $valid_options{$_})
1159 {
1160 my $r = $valid_options{$_};
1161 if ( ref $r eq "SCALAR")
1162 { $$r = 1;}
1163 elsif ( ref $r eq "ARRAY")
1164 {
1165 my $r2;
1166 foreach $r2 (@$r)
1167 {
1168 $$r2 = 1;
1169 }
1170 }
1171 }
1172 elsif (/^no-comp$/) { $xcflags = "-DOPENSSL_NO_COMP $xcflags"; }
1173 elsif (/^enable-zlib$/) { $zlib_opt = 1 if $zlib_opt == 0 }
1174 elsif (/^enable-zlib-dynamic$/)
1175 {
1176 $zlib_opt = 2;
1177 }
1178 elsif (/^no-static-engine/)
1179 {
1180 $no_static_engine = 1;
1181 }
1182 elsif (/^enable-static-engine/)
1183 {
1184 $no_static_engine = 0;
1185 }
1186 # There are also enable-xxx options which correspond to
1187 # the no-xxx. Since the scalars are enabled by default
1188 # these can be ignored.
1189 elsif (/^enable-/)
1190 {
1191 my $t = $_;
1192 $t =~ s/^enable/no/;
1193 if (exists $valid_options{$t})
1194 {return 1;}
1195 return 0;
1196 }
1197 # experimental-xxx is mostly like enable-xxx, but opensslconf.v
1198 # will still set OPENSSL_NO_xxx unless we set OPENSSL_EXPERIMENTAL_xxx.
1199 # (No need to fail if we don't know the algorithm -- this is for adventurous users only.)
1200 elsif (/^experimental-/)
1201 {
1202 my $algo, $ALGO;
1203 ($algo = $_) =~ s/^experimental-//;
1204 ($ALGO = $algo) =~ tr/[a-z]/[A-Z]/;
1205
1206 $xcflags="-DOPENSSL_EXPERIMENTAL_$ALGO $xcflags";
1207
1208 }
1209 elsif (/^--with-krb5-flavor=(.*)$/)
1210 {
1211 my $krb5_flavor = $1;
1212 if ($krb5_flavor =~ /^force-[Hh]eimdal$/)
1213 {
1214 $xcflags="-DKRB5_HEIMDAL $xcflags";
1215 }
1216 elsif ($krb5_flavor =~ /^MIT/i)
1217 {
1218 $xcflags="-DKRB5_MIT $xcflags";
1219 if ($krb5_flavor =~ /^MIT[._-]*1[._-]*[01]/i)
1220 {
1221 $xcflags="-DKRB5_MIT_OLD11 $xcflags"
1222 }
1223 }
1224 }
1225 elsif (/^([^=]*)=(.*)$/ && !/^-D/){ $VARS{$1}=$2; }
1226 elsif (/^-[lL].*$/) { $l_flags.="$_ "; }
1227 elsif ((!/^-help/) && (!/^-h/) && (!/^-\?/) && /^-.*$/)
1228 { $c_flags.="$_ "; }
1229 else { return(0); }
1230 return(1);
1231 }
diff --git a/src/lib/libcrypto/util/mkcerts.sh b/src/lib/libcrypto/util/mkcerts.sh
new file mode 100644
index 0000000000..0184fcb70e
--- /dev/null
+++ b/src/lib/libcrypto/util/mkcerts.sh
@@ -0,0 +1,220 @@
1#!/bin/sh
2
3# This script will re-make all the required certs.
4# cd apps
5# sh ../util/mkcerts.sh
6# mv ca-cert.pem pca-cert.pem ../certs
7# cd ..
8# cat certs/*.pem >>apps/server.pem
9# cat certs/*.pem >>apps/server2.pem
10# SSLEAY=`pwd`/apps/ssleay; export SSLEAY
11# sh tools/c_rehash certs
12#
13
14CAbits=1024
15SSLEAY="../apps/openssl"
16CONF="-config ../apps/openssl.cnf"
17
18# create pca request.
19echo creating $CAbits bit PCA cert request
20$SSLEAY req $CONF \
21 -new -md5 -newkey $CAbits \
22 -keyout pca-key.pem \
23 -out pca-req.pem -nodes >/dev/null <<EOF
24AU
25Queensland
26.
27CryptSoft Pty Ltd
28.
29Test PCA (1024 bit)
30
31
32
33EOF
34
35if [ $? != 0 ]; then
36 echo problems generating PCA request
37 exit 1
38fi
39
40#sign it.
41echo
42echo self signing PCA
43$SSLEAY x509 -md5 -days 1461 \
44 -req -signkey pca-key.pem \
45 -CAcreateserial -CAserial pca-cert.srl \
46 -in pca-req.pem -out pca-cert.pem
47
48if [ $? != 0 ]; then
49 echo problems self signing PCA cert
50 exit 1
51fi
52echo
53
54# create ca request.
55echo creating $CAbits bit CA cert request
56$SSLEAY req $CONF \
57 -new -md5 -newkey $CAbits \
58 -keyout ca-key.pem \
59 -out ca-req.pem -nodes >/dev/null <<EOF
60AU
61Queensland
62.
63CryptSoft Pty Ltd
64.
65Test CA (1024 bit)
66
67
68
69EOF
70
71if [ $? != 0 ]; then
72 echo problems generating CA request
73 exit 1
74fi
75
76#sign it.
77echo
78echo signing CA
79$SSLEAY x509 -md5 -days 1461 \
80 -req \
81 -CAcreateserial -CAserial pca-cert.srl \
82 -CA pca-cert.pem -CAkey pca-key.pem \
83 -in ca-req.pem -out ca-cert.pem
84
85if [ $? != 0 ]; then
86 echo problems signing CA cert
87 exit 1
88fi
89echo
90
91# create server request.
92echo creating 512 bit server cert request
93$SSLEAY req $CONF \
94 -new -md5 -newkey 512 \
95 -keyout s512-key.pem \
96 -out s512-req.pem -nodes >/dev/null <<EOF
97AU
98Queensland
99.
100CryptSoft Pty Ltd
101.
102Server test cert (512 bit)
103
104
105
106EOF
107
108if [ $? != 0 ]; then
109 echo problems generating 512 bit server cert request
110 exit 1
111fi
112
113#sign it.
114echo
115echo signing 512 bit server cert
116$SSLEAY x509 -md5 -days 365 \
117 -req \
118 -CAcreateserial -CAserial ca-cert.srl \
119 -CA ca-cert.pem -CAkey ca-key.pem \
120 -in s512-req.pem -out server.pem
121
122if [ $? != 0 ]; then
123 echo problems signing 512 bit server cert
124 exit 1
125fi
126echo
127
128# create 1024 bit server request.
129echo creating 1024 bit server cert request
130$SSLEAY req $CONF \
131 -new -md5 -newkey 1024 \
132 -keyout s1024key.pem \
133 -out s1024req.pem -nodes >/dev/null <<EOF
134AU
135Queensland
136.
137CryptSoft Pty Ltd
138.
139Server test cert (1024 bit)
140
141
142
143EOF
144
145if [ $? != 0 ]; then
146 echo problems generating 1024 bit server cert request
147 exit 1
148fi
149
150#sign it.
151echo
152echo signing 1024 bit server cert
153$SSLEAY x509 -md5 -days 365 \
154 -req \
155 -CAcreateserial -CAserial ca-cert.srl \
156 -CA ca-cert.pem -CAkey ca-key.pem \
157 -in s1024req.pem -out server2.pem
158
159if [ $? != 0 ]; then
160 echo problems signing 1024 bit server cert
161 exit 1
162fi
163echo
164
165# create 512 bit client request.
166echo creating 512 bit client cert request
167$SSLEAY req $CONF \
168 -new -md5 -newkey 512 \
169 -keyout c512-key.pem \
170 -out c512-req.pem -nodes >/dev/null <<EOF
171AU
172Queensland
173.
174CryptSoft Pty Ltd
175.
176Client test cert (512 bit)
177
178
179
180EOF
181
182if [ $? != 0 ]; then
183 echo problems generating 512 bit client cert request
184 exit 1
185fi
186
187#sign it.
188echo
189echo signing 512 bit client cert
190$SSLEAY x509 -md5 -days 365 \
191 -req \
192 -CAcreateserial -CAserial ca-cert.srl \
193 -CA ca-cert.pem -CAkey ca-key.pem \
194 -in c512-req.pem -out client.pem
195
196if [ $? != 0 ]; then
197 echo problems signing 512 bit client cert
198 exit 1
199fi
200
201echo cleanup
202
203cat pca-key.pem >> pca-cert.pem
204cat ca-key.pem >> ca-cert.pem
205cat s512-key.pem >> server.pem
206cat s1024key.pem >> server2.pem
207cat c512-key.pem >> client.pem
208
209for i in pca-cert.pem ca-cert.pem server.pem server2.pem client.pem
210do
211$SSLEAY x509 -issuer -subject -in $i -noout >$$
212cat $$
213/bin/cat $i >>$$
214/bin/mv $$ $i
215done
216
217#/bin/rm -f *key.pem *req.pem *.srl
218
219echo Finished
220
diff --git a/src/lib/libcrypto/util/mkdef.pl b/src/lib/libcrypto/util/mkdef.pl
new file mode 100644
index 0000000000..9a8c7b87d1
--- /dev/null
+++ b/src/lib/libcrypto/util/mkdef.pl
@@ -0,0 +1,1539 @@
1#!/usr/local/bin/perl -w
2#
3# generate a .def file
4#
5# It does this by parsing the header files and looking for the
6# prototyped functions: it then prunes the output.
7#
8# Intermediary files are created, call libeay.num and ssleay.num,...
9# Previously, they had the following format:
10#
11# routine-name nnnn
12#
13# But that isn't enough for a number of reasons, the first on being that
14# this format is (needlessly) very Win32-centric, and even then...
15# One of the biggest problems is that there's no information about what
16# routines should actually be used, which varies with what crypto algorithms
17# are disabled. Also, some operating systems (for example VMS with VAX C)
18# need to keep track of the global variables as well as the functions.
19#
20# So, a remake of this script is done so as to include information on the
21# kind of symbol it is (function or variable) and what algorithms they're
22# part of. This will allow easy translating to .def files or the corresponding
23# file in other operating systems (a .opt file for VMS, possibly with a .mar
24# file).
25#
26# The format now becomes:
27#
28# routine-name nnnn info
29#
30# and the "info" part is actually a colon-separated string of fields with
31# the following meaning:
32#
33# existence:platform:kind:algorithms
34#
35# - "existence" can be "EXIST" or "NOEXIST" depending on if the symbol is
36# found somewhere in the source,
37# - "platforms" is empty if it exists on all platforms, otherwise it contains
38# comma-separated list of the platform, just as they are if the symbol exists
39# for those platforms, or prepended with a "!" if not. This helps resolve
40# symbol name variants for platforms where the names are too long for the
41# compiler or linker, or if the systems is case insensitive and there is a
42# clash, or the symbol is implemented differently (see
43# EXPORT_VAR_AS_FUNCTION). This script assumes renaming of symbols is found
44# in the file crypto/symhacks.h.
45# The semantics for the platforms is that every item is checked against the
46# environment. For the negative items ("!FOO"), if any of them is false
47# (i.e. "FOO" is true) in the environment, the corresponding symbol can't be
48# used. For the positive itms, if all of them are false in the environment,
49# the corresponding symbol can't be used. Any combination of positive and
50# negative items are possible, and of course leave room for some redundancy.
51# - "kind" is "FUNCTION" or "VARIABLE". The meaning of that is obvious.
52# - "algorithms" is a comma-separated list of algorithm names. This helps
53# exclude symbols that are part of an algorithm that some user wants to
54# exclude.
55#
56
57my $debug=0;
58
59my $crypto_num= "util/libeay.num";
60my $ssl_num= "util/ssleay.num";
61my $libname;
62
63my $do_update = 0;
64my $do_rewrite = 1;
65my $do_crypto = 0;
66my $do_ssl = 0;
67my $do_ctest = 0;
68my $do_ctestall = 0;
69my $do_checkexist = 0;
70
71my $VMSVAX=0;
72my $VMSNonVAX=0;
73my $VMS=0;
74my $W32=0;
75my $W16=0;
76my $NT=0;
77my $OS2=0;
78# Set this to make typesafe STACK definitions appear in DEF
79my $safe_stack_def = 0;
80
81my @known_platforms = ( "__FreeBSD__", "PERL5", "NeXT",
82 "EXPORT_VAR_AS_FUNCTION", "ZLIB", "OPENSSL_FIPS" );
83my @known_ossl_platforms = ( "VMS", "WIN16", "WIN32", "WINNT", "OS2" );
84my @known_algorithms = ( "RC2", "RC4", "RC5", "IDEA", "DES", "BF",
85 "CAST", "MD2", "MD4", "MD5", "SHA", "SHA0", "SHA1",
86 "SHA256", "SHA512", "RIPEMD",
87 "MDC2", "WHIRLPOOL", "RSA", "DSA", "DH", "EC", "ECDH", "ECDSA", "EC2M",
88 "HMAC", "AES", "CAMELLIA", "SEED", "GOST",
89 # EC_NISTP_64_GCC_128
90 "EC_NISTP_64_GCC_128",
91 # Envelope "algorithms"
92 "EVP", "X509", "ASN1_TYPEDEFS",
93 # Helper "algorithms"
94 "BIO", "COMP", "BUFFER", "LHASH", "STACK", "ERR",
95 "LOCKING",
96 # External "algorithms"
97 "FP_API", "STDIO", "SOCK", "KRB5", "DGRAM",
98 # Engines
99 "STATIC_ENGINE", "ENGINE", "HW", "GMP",
100 # RFC3779
101 "RFC3779",
102 # TLS
103 "TLSEXT", "PSK", "SRP", "HEARTBEATS",
104 # CMS
105 "CMS",
106 # CryptoAPI Engine
107 "CAPIENG",
108 # SSL v2
109 "SSL2",
110 # JPAKE
111 "JPAKE",
112 # NEXTPROTONEG
113 "NEXTPROTONEG",
114 # Deprecated functions
115 "DEPRECATED",
116 # Hide SSL internals
117 "SSL_INTERN",
118 # SCTP
119 "SCTP");
120
121my $options="";
122open(IN,"<Makefile") || die "unable to open Makefile!\n";
123while(<IN>) {
124 $options=$1 if (/^OPTIONS=(.*)$/);
125}
126close(IN);
127
128# The following ciphers may be excluded (by Configure). This means functions
129# defined with ifndef(NO_XXX) are not included in the .def file, and everything
130# in directory xxx is ignored.
131my $no_rc2; my $no_rc4; my $no_rc5; my $no_idea; my $no_des; my $no_bf;
132my $no_cast; my $no_whirlpool; my $no_camellia; my $no_seed;
133my $no_md2; my $no_md4; my $no_md5; my $no_sha; my $no_ripemd; my $no_mdc2;
134my $no_rsa; my $no_dsa; my $no_dh; my $no_hmac=0; my $no_aes; my $no_krb5;
135my $no_ec; my $no_ecdsa; my $no_ecdh; my $no_engine; my $no_hw;
136my $no_fp_api; my $no_static_engine=1; my $no_gmp; my $no_deprecated;
137my $no_rfc3779; my $no_psk; my $no_tlsext; my $no_cms; my $no_capieng;
138my $no_jpake; my $no_srp; my $no_ssl2; my $no_ec2m; my $no_nistp_gcc;
139my $no_nextprotoneg; my $no_sctp;
140
141my $fips;
142
143my $zlib;
144
145
146foreach (@ARGV, split(/ /, $options))
147 {
148 $debug=1 if $_ eq "debug";
149 $W32=1 if $_ eq "32";
150 $W16=1 if $_ eq "16";
151 if($_ eq "NT") {
152 $W32 = 1;
153 $NT = 1;
154 }
155 if ($_ eq "VMS-VAX") {
156 $VMS=1;
157 $VMSVAX=1;
158 }
159 if ($_ eq "VMS-NonVAX") {
160 $VMS=1;
161 $VMSNonVAX=1;
162 }
163 $VMS=1 if $_ eq "VMS";
164 $OS2=1 if $_ eq "OS2";
165 $fips=1 if /^fips/;
166 if ($_ eq "zlib" || $_ eq "enable-zlib" || $_ eq "zlib-dynamic"
167 || $_ eq "enable-zlib-dynamic") {
168 $zlib = 1;
169 }
170
171 $do_ssl=1 if $_ eq "ssleay";
172 if ($_ eq "ssl") {
173 $do_ssl=1;
174 $libname=$_
175 }
176 $do_crypto=1 if $_ eq "libeay";
177 if ($_ eq "crypto") {
178 $do_crypto=1;
179 $libname=$_;
180 }
181 $no_static_engine=1 if $_ eq "no-static-engine";
182 $no_static_engine=0 if $_ eq "enable-static-engine";
183 $do_update=1 if $_ eq "update";
184 $do_rewrite=1 if $_ eq "rewrite";
185 $do_ctest=1 if $_ eq "ctest";
186 $do_ctestall=1 if $_ eq "ctestall";
187 $do_checkexist=1 if $_ eq "exist";
188 #$safe_stack_def=1 if $_ eq "-DDEBUG_SAFESTACK";
189
190 if (/^no-rc2$/) { $no_rc2=1; }
191 elsif (/^no-rc4$/) { $no_rc4=1; }
192 elsif (/^no-rc5$/) { $no_rc5=1; }
193 elsif (/^no-idea$/) { $no_idea=1; }
194 elsif (/^no-des$/) { $no_des=1; $no_mdc2=1; }
195 elsif (/^no-bf$/) { $no_bf=1; }
196 elsif (/^no-cast$/) { $no_cast=1; }
197 elsif (/^no-whirlpool$/) { $no_whirlpool=1; }
198 elsif (/^no-md2$/) { $no_md2=1; }
199 elsif (/^no-md4$/) { $no_md4=1; }
200 elsif (/^no-md5$/) { $no_md5=1; }
201 elsif (/^no-sha$/) { $no_sha=1; }
202 elsif (/^no-ripemd$/) { $no_ripemd=1; }
203 elsif (/^no-mdc2$/) { $no_mdc2=1; }
204 elsif (/^no-rsa$/) { $no_rsa=1; }
205 elsif (/^no-dsa$/) { $no_dsa=1; }
206 elsif (/^no-dh$/) { $no_dh=1; }
207 elsif (/^no-ec$/) { $no_ec=1; }
208 elsif (/^no-ecdsa$/) { $no_ecdsa=1; }
209 elsif (/^no-ecdh$/) { $no_ecdh=1; }
210 elsif (/^no-hmac$/) { $no_hmac=1; }
211 elsif (/^no-aes$/) { $no_aes=1; }
212 elsif (/^no-camellia$/) { $no_camellia=1; }
213 elsif (/^no-seed$/) { $no_seed=1; }
214 elsif (/^no-evp$/) { $no_evp=1; }
215 elsif (/^no-lhash$/) { $no_lhash=1; }
216 elsif (/^no-stack$/) { $no_stack=1; }
217 elsif (/^no-err$/) { $no_err=1; }
218 elsif (/^no-buffer$/) { $no_buffer=1; }
219 elsif (/^no-bio$/) { $no_bio=1; }
220 #elsif (/^no-locking$/) { $no_locking=1; }
221 elsif (/^no-comp$/) { $no_comp=1; }
222 elsif (/^no-dso$/) { $no_dso=1; }
223 elsif (/^no-krb5$/) { $no_krb5=1; }
224 elsif (/^no-engine$/) { $no_engine=1; }
225 elsif (/^no-hw$/) { $no_hw=1; }
226 elsif (/^no-gmp$/) { $no_gmp=1; }
227 elsif (/^no-rfc3779$/) { $no_rfc3779=1; }
228 elsif (/^no-tlsext$/) { $no_tlsext=1; }
229 elsif (/^no-cms$/) { $no_cms=1; }
230 elsif (/^no-ec2m$/) { $no_ec2m=1; }
231 elsif (/^no-ec_nistp_64_gcc_128$/) { $no_nistp_gcc=1; }
232 elsif (/^no-nextprotoneg$/) { $no_nextprotoneg=1; }
233 elsif (/^no-ssl2$/) { $no_ssl2=1; }
234 elsif (/^no-capieng$/) { $no_capieng=1; }
235 elsif (/^no-jpake$/) { $no_jpake=1; }
236 elsif (/^no-srp$/) { $no_srp=1; }
237 elsif (/^no-sctp$/) { $no_sctp=1; }
238 }
239
240
241if (!$libname) {
242 if ($do_ssl) {
243 $libname="SSLEAY";
244 }
245 if ($do_crypto) {
246 $libname="LIBEAY";
247 }
248}
249
250# If no platform is given, assume WIN32
251if ($W32 + $W16 + $VMS + $OS2 == 0) {
252 $W32 = 1;
253}
254
255# Add extra knowledge
256if ($W16) {
257 $no_fp_api=1;
258}
259
260if (!$do_ssl && !$do_crypto)
261 {
262 print STDERR "usage: $0 ( ssl | crypto ) [ 16 | 32 | NT | OS2 ]\n";
263 exit(1);
264 }
265
266%ssl_list=&load_numbers($ssl_num);
267$max_ssl = $max_num;
268%crypto_list=&load_numbers($crypto_num);
269$max_crypto = $max_num;
270
271my $ssl="ssl/ssl.h";
272$ssl.=" ssl/kssl.h";
273$ssl.=" ssl/tls1.h";
274$ssl.=" ssl/srtp.h";
275
276my $crypto ="crypto/crypto.h";
277$crypto.=" crypto/cryptlib.h";
278$crypto.=" crypto/o_dir.h";
279$crypto.=" crypto/o_str.h";
280$crypto.=" crypto/o_time.h";
281$crypto.=" crypto/des/des.h crypto/des/des_old.h" ; # unless $no_des;
282$crypto.=" crypto/idea/idea.h" ; # unless $no_idea;
283$crypto.=" crypto/rc4/rc4.h" ; # unless $no_rc4;
284$crypto.=" crypto/rc5/rc5.h" ; # unless $no_rc5;
285$crypto.=" crypto/rc2/rc2.h" ; # unless $no_rc2;
286$crypto.=" crypto/bf/blowfish.h" ; # unless $no_bf;
287$crypto.=" crypto/cast/cast.h" ; # unless $no_cast;
288$crypto.=" crypto/whrlpool/whrlpool.h" ;
289$crypto.=" crypto/md2/md2.h" ; # unless $no_md2;
290$crypto.=" crypto/md4/md4.h" ; # unless $no_md4;
291$crypto.=" crypto/md5/md5.h" ; # unless $no_md5;
292$crypto.=" crypto/mdc2/mdc2.h" ; # unless $no_mdc2;
293$crypto.=" crypto/sha/sha.h" ; # unless $no_sha;
294$crypto.=" crypto/ripemd/ripemd.h" ; # unless $no_ripemd;
295$crypto.=" crypto/aes/aes.h" ; # unless $no_aes;
296$crypto.=" crypto/camellia/camellia.h" ; # unless $no_camellia;
297$crypto.=" crypto/seed/seed.h"; # unless $no_seed;
298
299$crypto.=" crypto/bn/bn.h";
300$crypto.=" crypto/rsa/rsa.h" ; # unless $no_rsa;
301$crypto.=" crypto/dsa/dsa.h" ; # unless $no_dsa;
302$crypto.=" crypto/dh/dh.h" ; # unless $no_dh;
303$crypto.=" crypto/ec/ec.h" ; # unless $no_ec;
304$crypto.=" crypto/ecdsa/ecdsa.h" ; # unless $no_ecdsa;
305$crypto.=" crypto/ecdh/ecdh.h" ; # unless $no_ecdh;
306$crypto.=" crypto/hmac/hmac.h" ; # unless $no_hmac;
307$crypto.=" crypto/cmac/cmac.h" ; # unless $no_hmac;
308
309$crypto.=" crypto/engine/engine.h"; # unless $no_engine;
310$crypto.=" crypto/stack/stack.h" ; # unless $no_stack;
311$crypto.=" crypto/buffer/buffer.h" ; # unless $no_buffer;
312$crypto.=" crypto/bio/bio.h" ; # unless $no_bio;
313$crypto.=" crypto/dso/dso.h" ; # unless $no_dso;
314$crypto.=" crypto/lhash/lhash.h" ; # unless $no_lhash;
315$crypto.=" crypto/conf/conf.h";
316$crypto.=" crypto/txt_db/txt_db.h";
317
318$crypto.=" crypto/evp/evp.h" ; # unless $no_evp;
319$crypto.=" crypto/objects/objects.h";
320$crypto.=" crypto/pem/pem.h";
321#$crypto.=" crypto/meth/meth.h";
322$crypto.=" crypto/asn1/asn1.h";
323$crypto.=" crypto/asn1/asn1t.h";
324$crypto.=" crypto/asn1/asn1_mac.h";
325$crypto.=" crypto/err/err.h" ; # unless $no_err;
326$crypto.=" crypto/pkcs7/pkcs7.h";
327$crypto.=" crypto/pkcs12/pkcs12.h";
328$crypto.=" crypto/x509/x509.h";
329$crypto.=" crypto/x509/x509_vfy.h";
330$crypto.=" crypto/x509v3/x509v3.h";
331$crypto.=" crypto/ts/ts.h";
332$crypto.=" crypto/rand/rand.h";
333$crypto.=" crypto/comp/comp.h" ; # unless $no_comp;
334$crypto.=" crypto/ocsp/ocsp.h";
335$crypto.=" crypto/ui/ui.h crypto/ui/ui_compat.h";
336$crypto.=" crypto/krb5/krb5_asn.h";
337#$crypto.=" crypto/store/store.h";
338$crypto.=" crypto/pqueue/pqueue.h";
339$crypto.=" crypto/cms/cms.h";
340$crypto.=" crypto/jpake/jpake.h";
341$crypto.=" crypto/modes/modes.h";
342$crypto.=" crypto/srp/srp.h";
343
344my $symhacks="crypto/symhacks.h";
345
346my @ssl_symbols = &do_defs("SSLEAY", $ssl, $symhacks);
347my @crypto_symbols = &do_defs("LIBEAY", $crypto, $symhacks);
348
349if ($do_update) {
350
351if ($do_ssl == 1) {
352
353 &maybe_add_info("SSLEAY",*ssl_list,@ssl_symbols);
354 if ($do_rewrite == 1) {
355 open(OUT, ">$ssl_num");
356 &rewrite_numbers(*OUT,"SSLEAY",*ssl_list,@ssl_symbols);
357 } else {
358 open(OUT, ">>$ssl_num");
359 }
360 &update_numbers(*OUT,"SSLEAY",*ssl_list,$max_ssl,@ssl_symbols);
361 close OUT;
362}
363
364if($do_crypto == 1) {
365
366 &maybe_add_info("LIBEAY",*crypto_list,@crypto_symbols);
367 if ($do_rewrite == 1) {
368 open(OUT, ">$crypto_num");
369 &rewrite_numbers(*OUT,"LIBEAY",*crypto_list,@crypto_symbols);
370 } else {
371 open(OUT, ">>$crypto_num");
372 }
373 &update_numbers(*OUT,"LIBEAY",*crypto_list,$max_crypto,@crypto_symbols);
374 close OUT;
375}
376
377} elsif ($do_checkexist) {
378 &check_existing(*ssl_list, @ssl_symbols)
379 if $do_ssl == 1;
380 &check_existing(*crypto_list, @crypto_symbols)
381 if $do_crypto == 1;
382} elsif ($do_ctest || $do_ctestall) {
383
384 print <<"EOF";
385
386/* Test file to check all DEF file symbols are present by trying
387 * to link to all of them. This is *not* intended to be run!
388 */
389
390int main()
391{
392EOF
393 &print_test_file(*STDOUT,"SSLEAY",*ssl_list,$do_ctestall,@ssl_symbols)
394 if $do_ssl == 1;
395
396 &print_test_file(*STDOUT,"LIBEAY",*crypto_list,$do_ctestall,@crypto_symbols)
397 if $do_crypto == 1;
398
399 print "}\n";
400
401} else {
402
403 &print_def_file(*STDOUT,$libname,*ssl_list,@ssl_symbols)
404 if $do_ssl == 1;
405
406 &print_def_file(*STDOUT,$libname,*crypto_list,@crypto_symbols)
407 if $do_crypto == 1;
408
409}
410
411
412sub do_defs
413{
414 my($name,$files,$symhacksfile)=@_;
415 my $file;
416 my @ret;
417 my %syms;
418 my %platform; # For anything undefined, we assume ""
419 my %kind; # For anything undefined, we assume "FUNCTION"
420 my %algorithm; # For anything undefined, we assume ""
421 my %variant;
422 my %variant_cnt; # To be able to allocate "name{n}" if "name"
423 # is the same name as the original.
424 my $cpp;
425 my %unknown_algorithms = ();
426
427 foreach $file (split(/\s+/,$symhacksfile." ".$files))
428 {
429 print STDERR "DEBUG: starting on $file:\n" if $debug;
430 open(IN,"<$file") || die "unable to open $file:$!\n";
431 my $line = "", my $def= "";
432 my %tag = (
433 (map { $_ => 0 } @known_platforms),
434 (map { "OPENSSL_SYS_".$_ => 0 } @known_ossl_platforms),
435 (map { "OPENSSL_NO_".$_ => 0 } @known_algorithms),
436 NOPROTO => 0,
437 PERL5 => 0,
438 _WINDLL => 0,
439 CONST_STRICT => 0,
440 TRUE => 1,
441 );
442 my $symhacking = $file eq $symhacksfile;
443 my @current_platforms = ();
444 my @current_algorithms = ();
445
446 # params: symbol, alias, platforms, kind
447 # The reason to put this subroutine in a variable is that
448 # it will otherwise create it's own, unshared, version of
449 # %tag and %variant...
450 my $make_variant = sub
451 {
452 my ($s, $a, $p, $k) = @_;
453 my ($a1, $a2);
454
455 print STDERR "DEBUG: make_variant: Entered with ",$s,", ",$a,", ",(defined($p)?$p:""),", ",(defined($k)?$k:""),"\n" if $debug;
456 if (defined($p))
457 {
458 $a1 = join(",",$p,
459 grep(!/^$/,
460 map { $tag{$_} == 1 ? $_ : "" }
461 @known_platforms));
462 }
463 else
464 {
465 $a1 = join(",",
466 grep(!/^$/,
467 map { $tag{$_} == 1 ? $_ : "" }
468 @known_platforms));
469 }
470 $a2 = join(",",
471 grep(!/^$/,
472 map { $tag{"OPENSSL_SYS_".$_} == 1 ? $_ : "" }
473 @known_ossl_platforms));
474 print STDERR "DEBUG: make_variant: a1 = $a1; a2 = $a2\n" if $debug;
475 if ($a1 eq "") { $a1 = $a2; }
476 elsif ($a1 ne "" && $a2 ne "") { $a1 .= ",".$a2; }
477 if ($a eq $s)
478 {
479 if (!defined($variant_cnt{$s}))
480 {
481 $variant_cnt{$s} = 0;
482 }
483 $variant_cnt{$s}++;
484 $a .= "{$variant_cnt{$s}}";
485 }
486 my $toadd = $a.":".$a1.(defined($k)?":".$k:"");
487 my $togrep = $s.'(\{[0-9]+\})?:'.$a1.(defined($k)?":".$k:"");
488 if (!grep(/^$togrep$/,
489 split(/;/, defined($variant{$s})?$variant{$s}:""))) {
490 if (defined($variant{$s})) { $variant{$s} .= ";"; }
491 $variant{$s} .= $toadd;
492 }
493 print STDERR "DEBUG: make_variant: Exit with variant of ",$s," = ",$variant{$s},"\n" if $debug;
494 };
495
496 print STDERR "DEBUG: parsing ----------\n" if $debug;
497 while(<IN>) {
498 if (/\/\* Error codes for the \w+ functions\. \*\//)
499 {
500 undef @tag;
501 last;
502 }
503 if ($line ne '') {
504 $_ = $line . $_;
505 $line = '';
506 }
507
508 if (/\\$/) {
509 chomp; # remove eol
510 chop; # remove ending backslash
511 $line = $_;
512 next;
513 }
514
515 if(/\/\*/) {
516 if (not /\*\//) { # multiline comment...
517 $line = $_; # ... just accumulate
518 next;
519 } else {
520 s/\/\*.*?\*\///gs;# wipe it
521 }
522 }
523
524 if ($cpp) {
525 $cpp++ if /^#\s*if/;
526 $cpp-- if /^#\s*endif/;
527 next;
528 }
529 $cpp = 1 if /^#.*ifdef.*cplusplus/;
530
531 s/{[^{}]*}//gs; # ignore {} blocks
532 print STDERR "DEBUG: \$def=\"$def\"\n" if $debug && $def ne "";
533 print STDERR "DEBUG: \$_=\"$_\"\n" if $debug;
534 if (/^\#\s*ifndef\s+(.*)/) {
535 push(@tag,"-");
536 push(@tag,$1);
537 $tag{$1}=-1;
538 print STDERR "DEBUG: $file: found tag $1 = -1\n" if $debug;
539 } elsif (/^\#\s*if\s+!defined\(([^\)]+)\)/) {
540 push(@tag,"-");
541 if (/^\#\s*if\s+(!defined\(([^\)]+)\)(\s+\&\&\s+!defined\(([^\)]+)\))*)$/) {
542 my $tmp_1 = $1;
543 my $tmp_;
544 foreach $tmp_ (split '\&\&',$tmp_1) {
545 $tmp_ =~ /!defined\(([^\)]+)\)/;
546 print STDERR "DEBUG: $file: found tag $1 = -1\n" if $debug;
547 push(@tag,$1);
548 $tag{$1}=-1;
549 }
550 } else {
551 print STDERR "Warning: $file: complicated expression: $_" if $debug; # because it is O...
552 print STDERR "DEBUG: $file: found tag $1 = -1\n" if $debug;
553 push(@tag,$1);
554 $tag{$1}=-1;
555 }
556 } elsif (/^\#\s*ifdef\s+(\S*)/) {
557 push(@tag,"-");
558 push(@tag,$1);
559 $tag{$1}=1;
560 print STDERR "DEBUG: $file: found tag $1 = 1\n" if $debug;
561 } elsif (/^\#\s*if\s+defined\(([^\)]+)\)/) {
562 push(@tag,"-");
563 if (/^\#\s*if\s+(defined\(([^\)]+)\)(\s+\|\|\s+defined\(([^\)]+)\))*)$/) {
564 my $tmp_1 = $1;
565 my $tmp_;
566 foreach $tmp_ (split '\|\|',$tmp_1) {
567 $tmp_ =~ /defined\(([^\)]+)\)/;
568 print STDERR "DEBUG: $file: found tag $1 = 1\n" if $debug;
569 push(@tag,$1);
570 $tag{$1}=1;
571 }
572 } else {
573 print STDERR "Warning: $file: complicated expression: $_\n" if $debug; # because it is O...
574 print STDERR "DEBUG: $file: found tag $1 = 1\n" if $debug;
575 push(@tag,$1);
576 $tag{$1}=1;
577 }
578 } elsif (/^\#\s*error\s+(\w+) is disabled\./) {
579 my $tag_i = $#tag;
580 while($tag[$tag_i] ne "-") {
581 if ($tag[$tag_i] eq "OPENSSL_NO_".$1) {
582 $tag{$tag[$tag_i]}=2;
583 print STDERR "DEBUG: $file: chaged tag $1 = 2\n" if $debug;
584 }
585 $tag_i--;
586 }
587 } elsif (/^\#\s*endif/) {
588 my $tag_i = $#tag;
589 while($tag_i > 0 && $tag[$tag_i] ne "-") {
590 my $t=$tag[$tag_i];
591 print STDERR "DEBUG: \$t=\"$t\"\n" if $debug;
592 if ($tag{$t}==2) {
593 $tag{$t}=-1;
594 } else {
595 $tag{$t}=0;
596 }
597 print STDERR "DEBUG: $file: changed tag ",$t," = ",$tag{$t},"\n" if $debug;
598 pop(@tag);
599 if ($t =~ /^OPENSSL_NO_([A-Z0-9_]+)$/) {
600 $t=$1;
601 } else {
602 $t="";
603 }
604 if ($t ne ""
605 && !grep(/^$t$/, @known_algorithms)) {
606 $unknown_algorithms{$t} = 1;
607 #print STDERR "DEBUG: Added as unknown algorithm: $t\n" if $debug;
608 }
609 $tag_i--;
610 }
611 pop(@tag);
612 } elsif (/^\#\s*else/) {
613 my $tag_i = $#tag;
614 while($tag[$tag_i] ne "-") {
615 my $t=$tag[$tag_i];
616 $tag{$t}= -$tag{$t};
617 print STDERR "DEBUG: $file: changed tag ",$t," = ",$tag{$t},"\n" if $debug;
618 $tag_i--;
619 }
620 } elsif (/^\#\s*if\s+1/) {
621 push(@tag,"-");
622 # Dummy tag
623 push(@tag,"TRUE");
624 $tag{"TRUE"}=1;
625 print STDERR "DEBUG: $file: found 1\n" if $debug;
626 } elsif (/^\#\s*if\s+0/) {
627 push(@tag,"-");
628 # Dummy tag
629 push(@tag,"TRUE");
630 $tag{"TRUE"}=-1;
631 print STDERR "DEBUG: $file: found 0\n" if $debug;
632 } elsif (/^\#\s*define\s+(\w+)\s+(\w+)/
633 && $symhacking && $tag{'TRUE'} != -1) {
634 # This is for aliasing. When we find an alias,
635 # we have to invert
636 &$make_variant($1,$2);
637 print STDERR "DEBUG: $file: defined $1 = $2\n" if $debug;
638 }
639 if (/^\#/) {
640 @current_platforms =
641 grep(!/^$/,
642 map { $tag{$_} == 1 ? $_ :
643 $tag{$_} == -1 ? "!".$_ : "" }
644 @known_platforms);
645 push @current_platforms
646 , grep(!/^$/,
647 map { $tag{"OPENSSL_SYS_".$_} == 1 ? $_ :
648 $tag{"OPENSSL_SYS_".$_} == -1 ? "!".$_ : "" }
649 @known_ossl_platforms);
650 @current_algorithms =
651 grep(!/^$/,
652 map { $tag{"OPENSSL_NO_".$_} == -1 ? $_ : "" }
653 @known_algorithms);
654 $def .=
655 "#INFO:"
656 .join(',',@current_platforms).":"
657 .join(',',@current_algorithms).";";
658 next;
659 }
660 if ($tag{'TRUE'} != -1) {
661 if (/^\s*DECLARE_STACK_OF\s*\(\s*(\w*)\s*\)/) {
662 next;
663 } elsif (/^\s*DECLARE_ASN1_ENCODE_FUNCTIONS\s*\(\s*(\w*)\s*,\s*(\w*)\s*,\s*(\w*)\s*\)/) {
664 $def .= "int d2i_$3(void);";
665 $def .= "int i2d_$3(void);";
666 # Variant for platforms that do not
667 # have to access globale variables
668 # in shared libraries through functions
669 $def .=
670 "#INFO:"
671 .join(',',"!EXPORT_VAR_AS_FUNCTION",@current_platforms).":"
672 .join(',',@current_algorithms).";";
673 $def .= "OPENSSL_EXTERN int $2_it;";
674 $def .=
675 "#INFO:"
676 .join(',',@current_platforms).":"
677 .join(',',@current_algorithms).";";
678 # Variant for platforms that have to
679 # access globale variables in shared
680 # libraries through functions
681 &$make_variant("$2_it","$2_it",
682 "EXPORT_VAR_AS_FUNCTION",
683 "FUNCTION");
684 next;
685 } elsif (/^\s*DECLARE_ASN1_FUNCTIONS_fname\s*\(\s*(\w*)\s*,\s*(\w*)\s*,\s*(\w*)\s*\)/) {
686 $def .= "int d2i_$3(void);";
687 $def .= "int i2d_$3(void);";
688 $def .= "int $3_free(void);";
689 $def .= "int $3_new(void);";
690 # Variant for platforms that do not
691 # have to access globale variables
692 # in shared libraries through functions
693 $def .=
694 "#INFO:"
695 .join(',',"!EXPORT_VAR_AS_FUNCTION",@current_platforms).":"
696 .join(',',@current_algorithms).";";
697 $def .= "OPENSSL_EXTERN int $2_it;";
698 $def .=
699 "#INFO:"
700 .join(',',@current_platforms).":"
701 .join(',',@current_algorithms).";";
702 # Variant for platforms that have to
703 # access globale variables in shared
704 # libraries through functions
705 &$make_variant("$2_it","$2_it",
706 "EXPORT_VAR_AS_FUNCTION",
707 "FUNCTION");
708 next;
709 } elsif (/^\s*DECLARE_ASN1_FUNCTIONS\s*\(\s*(\w*)\s*\)/ ||
710 /^\s*DECLARE_ASN1_FUNCTIONS_const\s*\(\s*(\w*)\s*\)/) {
711 $def .= "int d2i_$1(void);";
712 $def .= "int i2d_$1(void);";
713 $def .= "int $1_free(void);";
714 $def .= "int $1_new(void);";
715 # Variant for platforms that do not
716 # have to access globale variables
717 # in shared libraries through functions
718 $def .=
719 "#INFO:"
720 .join(',',"!EXPORT_VAR_AS_FUNCTION",@current_platforms).":"
721 .join(',',@current_algorithms).";";
722 $def .= "OPENSSL_EXTERN int $1_it;";
723 $def .=
724 "#INFO:"
725 .join(',',@current_platforms).":"
726 .join(',',@current_algorithms).";";
727 # Variant for platforms that have to
728 # access globale variables in shared
729 # libraries through functions
730 &$make_variant("$1_it","$1_it",
731 "EXPORT_VAR_AS_FUNCTION",
732 "FUNCTION");
733 next;
734 } elsif (/^\s*DECLARE_ASN1_ENCODE_FUNCTIONS_const\s*\(\s*(\w*)\s*,\s*(\w*)\s*\)/) {
735 $def .= "int d2i_$2(void);";
736 $def .= "int i2d_$2(void);";
737 # Variant for platforms that do not
738 # have to access globale variables
739 # in shared libraries through functions
740 $def .=
741 "#INFO:"
742 .join(',',"!EXPORT_VAR_AS_FUNCTION",@current_platforms).":"
743 .join(',',@current_algorithms).";";
744 $def .= "OPENSSL_EXTERN int $2_it;";
745 $def .=
746 "#INFO:"
747 .join(',',@current_platforms).":"
748 .join(',',@current_algorithms).";";
749 # Variant for platforms that have to
750 # access globale variables in shared
751 # libraries through functions
752 &$make_variant("$2_it","$2_it",
753 "EXPORT_VAR_AS_FUNCTION",
754 "FUNCTION");
755 next;
756 } elsif (/^\s*DECLARE_ASN1_ALLOC_FUNCTIONS\s*\(\s*(\w*)\s*\)/) {
757 $def .= "int $1_free(void);";
758 $def .= "int $1_new(void);";
759 next;
760 } elsif (/^\s*DECLARE_ASN1_FUNCTIONS_name\s*\(\s*(\w*)\s*,\s*(\w*)\s*\)/) {
761 $def .= "int d2i_$2(void);";
762 $def .= "int i2d_$2(void);";
763 $def .= "int $2_free(void);";
764 $def .= "int $2_new(void);";
765 # Variant for platforms that do not
766 # have to access globale variables
767 # in shared libraries through functions
768 $def .=
769 "#INFO:"
770 .join(',',"!EXPORT_VAR_AS_FUNCTION",@current_platforms).":"
771 .join(',',@current_algorithms).";";
772 $def .= "OPENSSL_EXTERN int $2_it;";
773 $def .=
774 "#INFO:"
775 .join(',',@current_platforms).":"
776 .join(',',@current_algorithms).";";
777 # Variant for platforms that have to
778 # access globale variables in shared
779 # libraries through functions
780 &$make_variant("$2_it","$2_it",
781 "EXPORT_VAR_AS_FUNCTION",
782 "FUNCTION");
783 next;
784 } elsif (/^\s*DECLARE_ASN1_ITEM\s*\(\s*(\w*)\s*\)/) {
785 # Variant for platforms that do not
786 # have to access globale variables
787 # in shared libraries through functions
788 $def .=
789 "#INFO:"
790 .join(',',"!EXPORT_VAR_AS_FUNCTION",@current_platforms).":"
791 .join(',',@current_algorithms).";";
792 $def .= "OPENSSL_EXTERN int $1_it;";
793 $def .=
794 "#INFO:"
795 .join(',',@current_platforms).":"
796 .join(',',@current_algorithms).";";
797 # Variant for platforms that have to
798 # access globale variables in shared
799 # libraries through functions
800 &$make_variant("$1_it","$1_it",
801 "EXPORT_VAR_AS_FUNCTION",
802 "FUNCTION");
803 next;
804 } elsif (/^\s*DECLARE_ASN1_NDEF_FUNCTION\s*\(\s*(\w*)\s*\)/) {
805 $def .= "int i2d_$1_NDEF(void);";
806 } elsif (/^\s*DECLARE_ASN1_SET_OF\s*\(\s*(\w*)\s*\)/) {
807 next;
808 } elsif (/^\s*DECLARE_ASN1_PRINT_FUNCTION\s*\(\s*(\w*)\s*\)/) {
809 $def .= "int $1_print_ctx(void);";
810 next;
811 } elsif (/^\s*DECLARE_ASN1_PRINT_FUNCTION_name\s*\(\s*(\w*)\s*,\s*(\w*)\s*\)/) {
812 $def .= "int $2_print_ctx(void);";
813 next;
814 } elsif (/^\s*DECLARE_PKCS12_STACK_OF\s*\(\s*(\w*)\s*\)/) {
815 next;
816 } elsif (/^DECLARE_PEM_rw\s*\(\s*(\w*)\s*,/ ||
817 /^DECLARE_PEM_rw_cb\s*\(\s*(\w*)\s*,/ ||
818 /^DECLARE_PEM_rw_const\s*\(\s*(\w*)\s*,/ ) {
819 # Things not in Win16
820 $def .=
821 "#INFO:"
822 .join(',',"!WIN16",@current_platforms).":"
823 .join(',',@current_algorithms).";";
824 $def .= "int PEM_read_$1(void);";
825 $def .= "int PEM_write_$1(void);";
826 $def .=
827 "#INFO:"
828 .join(',',@current_platforms).":"
829 .join(',',@current_algorithms).";";
830 # Things that are everywhere
831 $def .= "int PEM_read_bio_$1(void);";
832 $def .= "int PEM_write_bio_$1(void);";
833 next;
834 } elsif (/^DECLARE_PEM_write\s*\(\s*(\w*)\s*,/ ||
835 /^DECLARE_PEM_write_cb\s*\(\s*(\w*)\s*,/ ) {
836 # Things not in Win16
837 $def .=
838 "#INFO:"
839 .join(',',"!WIN16",@current_platforms).":"
840 .join(',',@current_algorithms).";";
841 $def .= "int PEM_write_$1(void);";
842 $def .=
843 "#INFO:"
844 .join(',',@current_platforms).":"
845 .join(',',@current_algorithms).";";
846 # Things that are everywhere
847 $def .= "int PEM_write_bio_$1(void);";
848 next;
849 } elsif (/^DECLARE_PEM_read\s*\(\s*(\w*)\s*,/ ||
850 /^DECLARE_PEM_read_cb\s*\(\s*(\w*)\s*,/ ) {
851 # Things not in Win16
852 $def .=
853 "#INFO:"
854 .join(',',"!WIN16",@current_platforms).":"
855 .join(',',@current_algorithms).";";
856 $def .= "int PEM_read_$1(void);";
857 $def .=
858 "#INFO:"
859 .join(',',@current_platforms).":"
860 .join(',',@current_algorithms).";";
861 # Things that are everywhere
862 $def .= "int PEM_read_bio_$1(void);";
863 next;
864 } elsif (/^OPENSSL_DECLARE_GLOBAL\s*\(\s*(\w*)\s*,\s*(\w*)\s*\)/) {
865 # Variant for platforms that do not
866 # have to access globale variables
867 # in shared libraries through functions
868 $def .=
869 "#INFO:"
870 .join(',',"!EXPORT_VAR_AS_FUNCTION",@current_platforms).":"
871 .join(',',@current_algorithms).";";
872 $def .= "OPENSSL_EXTERN int _shadow_$2;";
873 $def .=
874 "#INFO:"
875 .join(',',@current_platforms).":"
876 .join(',',@current_algorithms).";";
877 # Variant for platforms that have to
878 # access globale variables in shared
879 # libraries through functions
880 &$make_variant("_shadow_$2","_shadow_$2",
881 "EXPORT_VAR_AS_FUNCTION",
882 "FUNCTION");
883 } elsif ($tag{'CONST_STRICT'} != 1) {
884 if (/\{|\/\*|\([^\)]*$/) {
885 $line = $_;
886 } else {
887 $def .= $_;
888 }
889 }
890 }
891 }
892 close(IN);
893
894 my $algs;
895 my $plays;
896
897 print STDERR "DEBUG: postprocessing ----------\n" if $debug;
898 foreach (split /;/, $def) {
899 my $s; my $k = "FUNCTION"; my $p; my $a;
900 s/^[\n\s]*//g;
901 s/[\n\s]*$//g;
902 next if(/\#undef/);
903 next if(/typedef\W/);
904 next if(/\#define/);
905
906 # Reduce argument lists to empty ()
907 # fold round brackets recursively: (t(*v)(t),t) -> (t{}{},t) -> {}
908 while(/\(.*\)/s) {
909 s/\([^\(\)]+\)/\{\}/gs;
910 s/\(\s*\*\s*(\w+)\s*\{\}\s*\)/$1/gs; #(*f{}) -> f
911 }
912 # pretend as we didn't use curly braces: {} -> ()
913 s/\{\}/\(\)/gs;
914
915 s/STACK_OF\(\)/void/gs;
916 s/LHASH_OF\(\)/void/gs;
917
918 print STDERR "DEBUG: \$_ = \"$_\"\n" if $debug;
919 if (/^\#INFO:([^:]*):(.*)$/) {
920 $plats = $1;
921 $algs = $2;
922 print STDERR "DEBUG: found info on platforms ($plats) and algorithms ($algs)\n" if $debug;
923 next;
924 } elsif (/^\s*OPENSSL_EXTERN\s.*?(\w+(\{[0-9]+\})?)(\[[0-9]*\])*\s*$/) {
925 $s = $1;
926 $k = "VARIABLE";
927 print STDERR "DEBUG: found external variable $s\n" if $debug;
928 } elsif (/TYPEDEF_\w+_OF/s) {
929 next;
930 } elsif (/(\w+)\s*\(\).*/s) { # first token prior [first] () is
931 $s = $1; # a function name!
932 print STDERR "DEBUG: found function $s\n" if $debug;
933 } elsif (/\(/ and not (/=/)) {
934 print STDERR "File $file: cannot parse: $_;\n";
935 next;
936 } else {
937 next;
938 }
939
940 $syms{$s} = 1;
941 $kind{$s} = $k;
942
943 $p = $plats;
944 $a = $algs;
945 $a .= ",BF" if($s =~ /EVP_bf/);
946 $a .= ",CAST" if($s =~ /EVP_cast/);
947 $a .= ",DES" if($s =~ /EVP_des/);
948 $a .= ",DSA" if($s =~ /EVP_dss/);
949 $a .= ",IDEA" if($s =~ /EVP_idea/);
950 $a .= ",MD2" if($s =~ /EVP_md2/);
951 $a .= ",MD4" if($s =~ /EVP_md4/);
952 $a .= ",MD5" if($s =~ /EVP_md5/);
953 $a .= ",RC2" if($s =~ /EVP_rc2/);
954 $a .= ",RC4" if($s =~ /EVP_rc4/);
955 $a .= ",RC5" if($s =~ /EVP_rc5/);
956 $a .= ",RIPEMD" if($s =~ /EVP_ripemd/);
957 $a .= ",SHA" if($s =~ /EVP_sha/);
958 $a .= ",RSA" if($s =~ /EVP_(Open|Seal)(Final|Init)/);
959 $a .= ",RSA" if($s =~ /PEM_Seal(Final|Init|Update)/);
960 $a .= ",RSA" if($s =~ /RSAPrivateKey/);
961 $a .= ",RSA" if($s =~ /SSLv23?_((client|server)_)?method/);
962
963 $platform{$s} =
964 &reduce_platforms((defined($platform{$s})?$platform{$s}.',':"").$p);
965 $algorithm{$s} .= ','.$a;
966
967 if (defined($variant{$s})) {
968 foreach $v (split /;/,$variant{$s}) {
969 (my $r, my $p, my $k) = split(/:/,$v);
970 my $ip = join ',',map({ /^!(.*)$/ ? $1 : "!".$_ } split /,/, $p);
971 $syms{$r} = 1;
972 if (!defined($k)) { $k = $kind{$s}; }
973 $kind{$r} = $k."(".$s.")";
974 $algorithm{$r} = $algorithm{$s};
975 $platform{$r} = &reduce_platforms($platform{$s}.",".$p.",".$p);
976 $platform{$s} = &reduce_platforms($platform{$s}.','.$ip.','.$ip);
977 print STDERR "DEBUG: \$variant{\"$s\"} = ",$v,"; \$r = $r; \$p = ",$platform{$r},"; \$a = ",$algorithm{$r},"; \$kind = ",$kind{$r},"\n" if $debug;
978 }
979 }
980 print STDERR "DEBUG: \$s = $s; \$p = ",$platform{$s},"; \$a = ",$algorithm{$s},"; \$kind = ",$kind{$s},"\n" if $debug;
981 }
982 }
983
984 # Prune the returned symbols
985
986 delete $syms{"bn_dump1"};
987 $platform{"BIO_s_log"} .= ",!WIN32,!WIN16,!macintosh";
988
989 $platform{"PEM_read_NS_CERT_SEQ"} = "VMS";
990 $platform{"PEM_write_NS_CERT_SEQ"} = "VMS";
991 $platform{"PEM_read_P8_PRIV_KEY_INFO"} = "VMS";
992 $platform{"PEM_write_P8_PRIV_KEY_INFO"} = "VMS";
993 $platform{"EVP_sha384"} = "!VMSVAX";
994 $platform{"EVP_sha512"} = "!VMSVAX";
995 $platform{"SHA384_Init"} = "!VMSVAX";
996 $platform{"SHA384_Transform"} = "!VMSVAX";
997 $platform{"SHA384_Update"} = "!VMSVAX";
998 $platform{"SHA384_Final"} = "!VMSVAX";
999 $platform{"SHA384"} = "!VMSVAX";
1000 $platform{"SHA512_Init"} = "!VMSVAX";
1001 $platform{"SHA512_Transform"} = "!VMSVAX";
1002 $platform{"SHA512_Update"} = "!VMSVAX";
1003 $platform{"SHA512_Final"} = "!VMSVAX";
1004 $platform{"SHA512"} = "!VMSVAX";
1005 $platform{"WHIRLPOOL_Init"} = "!VMSVAX";
1006 $platform{"WHIRLPOOL"} = "!VMSVAX";
1007 $platform{"WHIRLPOOL_BitUpdate"} = "!VMSVAX";
1008 $platform{"EVP_whirlpool"} = "!VMSVAX";
1009 $platform{"WHIRLPOOL_Final"} = "!VMSVAX";
1010 $platform{"WHIRLPOOL_Update"} = "!VMSVAX";
1011
1012
1013 # Info we know about
1014
1015 push @ret, map { $_."\\".&info_string($_,"EXIST",
1016 $platform{$_},
1017 $kind{$_},
1018 $algorithm{$_}) } keys %syms;
1019
1020 if (keys %unknown_algorithms) {
1021 print STDERR "WARNING: mkdef.pl doesn't know the following algorithms:\n";
1022 print STDERR "\t",join("\n\t",keys %unknown_algorithms),"\n";
1023 }
1024 return(@ret);
1025}
1026
1027# Param: string of comma-separated platform-specs.
1028sub reduce_platforms
1029{
1030 my ($platforms) = @_;
1031 my $pl = defined($platforms) ? $platforms : "";
1032 my %p = map { $_ => 0 } split /,/, $pl;
1033 my $ret;
1034
1035 print STDERR "DEBUG: Entered reduce_platforms with \"$platforms\"\n"
1036 if $debug;
1037 # We do this, because if there's code like the following, it really
1038 # means the function exists in all cases and should therefore be
1039 # everywhere. By increasing and decreasing, we may attain 0:
1040 #
1041 # ifndef WIN16
1042 # int foo();
1043 # else
1044 # int _fat foo();
1045 # endif
1046 foreach $platform (split /,/, $pl) {
1047 if ($platform =~ /^!(.*)$/) {
1048 $p{$1}--;
1049 } else {
1050 $p{$platform}++;
1051 }
1052 }
1053 foreach $platform (keys %p) {
1054 if ($p{$platform} == 0) { delete $p{$platform}; }
1055 }
1056
1057 delete $p{""};
1058
1059 $ret = join(',',sort(map { $p{$_} < 0 ? "!".$_ : $_ } keys %p));
1060 print STDERR "DEBUG: Exiting reduce_platforms with \"$ret\"\n"
1061 if $debug;
1062 return $ret;
1063}
1064
1065sub info_string {
1066 (my $symbol, my $exist, my $platforms, my $kind, my $algorithms) = @_;
1067
1068 my %a = defined($algorithms) ?
1069 map { $_ => 1 } split /,/, $algorithms : ();
1070 my $k = defined($kind) ? $kind : "FUNCTION";
1071 my $ret;
1072 my $p = &reduce_platforms($platforms);
1073
1074 delete $a{""};
1075
1076 $ret = $exist;
1077 $ret .= ":".$p;
1078 $ret .= ":".$k;
1079 $ret .= ":".join(',',sort keys %a);
1080 return $ret;
1081}
1082
1083sub maybe_add_info {
1084 (my $name, *nums, my @symbols) = @_;
1085 my $sym;
1086 my $new_info = 0;
1087 my %syms=();
1088
1089 print STDERR "Updating $name info\n";
1090 foreach $sym (@symbols) {
1091 (my $s, my $i) = split /\\/, $sym;
1092 if (defined($nums{$s})) {
1093 $i =~ s/^(.*?:.*?:\w+)(\(\w+\))?/$1/;
1094 (my $n, my $dummy) = split /\\/, $nums{$s};
1095 if (!defined($dummy) || $i ne $dummy) {
1096 $nums{$s} = $n."\\".$i;
1097 $new_info++;
1098 print STDERR "DEBUG: maybe_add_info for $s: \"$dummy\" => \"$i\"\n" if $debug;
1099 }
1100 }
1101 $syms{$s} = 1;
1102 }
1103
1104 my @s=sort { &parse_number($nums{$a},"n") <=> &parse_number($nums{$b},"n") } keys %nums;
1105 foreach $sym (@s) {
1106 (my $n, my $i) = split /\\/, $nums{$sym};
1107 if (!defined($syms{$sym}) && $i !~ /^NOEXIST:/) {
1108 $new_info++;
1109 print STDERR "DEBUG: maybe_add_info for $sym: -> undefined\n" if $debug;
1110 }
1111 }
1112 if ($new_info) {
1113 print STDERR "$new_info old symbols got an info update\n";
1114 if (!$do_rewrite) {
1115 print STDERR "You should do a rewrite to fix this.\n";
1116 }
1117 } else {
1118 print STDERR "No old symbols needed info update\n";
1119 }
1120}
1121
1122# Param: string of comma-separated keywords, each possibly prefixed with a "!"
1123sub is_valid
1124{
1125 my ($keywords_txt,$platforms) = @_;
1126 my (@keywords) = split /,/,$keywords_txt;
1127 my ($falsesum, $truesum) = (0, 1);
1128
1129 # Param: one keyword
1130 sub recognise
1131 {
1132 my ($keyword,$platforms) = @_;
1133
1134 if ($platforms) {
1135 # platforms
1136 if ($keyword eq "VMSVAX" && $VMSVAX) { return 1; }
1137 if ($keyword eq "VMSNonVAX" && $VMSNonVAX) { return 1; }
1138 if ($keyword eq "VMS" && $VMS) { return 1; }
1139 if ($keyword eq "WIN32" && $W32) { return 1; }
1140 if ($keyword eq "WIN16" && $W16) { return 1; }
1141 if ($keyword eq "WINNT" && $NT) { return 1; }
1142 if ($keyword eq "OS2" && $OS2) { return 1; }
1143 # Special platforms:
1144 # EXPORT_VAR_AS_FUNCTION means that global variables
1145 # will be represented as functions. This currently
1146 # only happens on VMS-VAX.
1147 if ($keyword eq "EXPORT_VAR_AS_FUNCTION" && ($VMSVAX || $W32 || $W16)) {
1148 return 1;
1149 }
1150 if ($keyword eq "OPENSSL_FIPS" && $fips) {
1151 return 1;
1152 }
1153 if ($keyword eq "ZLIB" && $zlib) { return 1; }
1154 return 0;
1155 } else {
1156 # algorithms
1157 if ($keyword eq "RC2" && $no_rc2) { return 0; }
1158 if ($keyword eq "RC4" && $no_rc4) { return 0; }
1159 if ($keyword eq "RC5" && $no_rc5) { return 0; }
1160 if ($keyword eq "IDEA" && $no_idea) { return 0; }
1161 if ($keyword eq "DES" && $no_des) { return 0; }
1162 if ($keyword eq "BF" && $no_bf) { return 0; }
1163 if ($keyword eq "CAST" && $no_cast) { return 0; }
1164 if ($keyword eq "MD2" && $no_md2) { return 0; }
1165 if ($keyword eq "MD4" && $no_md4) { return 0; }
1166 if ($keyword eq "MD5" && $no_md5) { return 0; }
1167 if ($keyword eq "SHA" && $no_sha) { return 0; }
1168 if ($keyword eq "RIPEMD" && $no_ripemd) { return 0; }
1169 if ($keyword eq "MDC2" && $no_mdc2) { return 0; }
1170 if ($keyword eq "WHIRLPOOL" && $no_whirlpool) { return 0; }
1171 if ($keyword eq "RSA" && $no_rsa) { return 0; }
1172 if ($keyword eq "DSA" && $no_dsa) { return 0; }
1173 if ($keyword eq "DH" && $no_dh) { return 0; }
1174 if ($keyword eq "EC" && $no_ec) { return 0; }
1175 if ($keyword eq "ECDSA" && $no_ecdsa) { return 0; }
1176 if ($keyword eq "ECDH" && $no_ecdh) { return 0; }
1177 if ($keyword eq "HMAC" && $no_hmac) { return 0; }
1178 if ($keyword eq "AES" && $no_aes) { return 0; }
1179 if ($keyword eq "CAMELLIA" && $no_camellia) { return 0; }
1180 if ($keyword eq "SEED" && $no_seed) { return 0; }
1181 if ($keyword eq "EVP" && $no_evp) { return 0; }
1182 if ($keyword eq "LHASH" && $no_lhash) { return 0; }
1183 if ($keyword eq "STACK" && $no_stack) { return 0; }
1184 if ($keyword eq "ERR" && $no_err) { return 0; }
1185 if ($keyword eq "BUFFER" && $no_buffer) { return 0; }
1186 if ($keyword eq "BIO" && $no_bio) { return 0; }
1187 if ($keyword eq "COMP" && $no_comp) { return 0; }
1188 if ($keyword eq "DSO" && $no_dso) { return 0; }
1189 if ($keyword eq "KRB5" && $no_krb5) { return 0; }
1190 if ($keyword eq "ENGINE" && $no_engine) { return 0; }
1191 if ($keyword eq "HW" && $no_hw) { return 0; }
1192 if ($keyword eq "FP_API" && $no_fp_api) { return 0; }
1193 if ($keyword eq "STATIC_ENGINE" && $no_static_engine) { return 0; }
1194 if ($keyword eq "GMP" && $no_gmp) { return 0; }
1195 if ($keyword eq "RFC3779" && $no_rfc3779) { return 0; }
1196 if ($keyword eq "TLSEXT" && $no_tlsext) { return 0; }
1197 if ($keyword eq "PSK" && $no_psk) { return 0; }
1198 if ($keyword eq "CMS" && $no_cms) { return 0; }
1199 if ($keyword eq "EC2M" && $no_ec2m) { return 0; }
1200 if ($keyword eq "NEXTPROTONEG" && $no_nextprotoneg) { return 0; }
1201 if ($keyword eq "EC_NISTP_64_GCC_128" && $no_nistp_gcc)
1202 { return 0; }
1203 if ($keyword eq "SSL2" && $no_ssl2) { return 0; }
1204 if ($keyword eq "CAPIENG" && $no_capieng) { return 0; }
1205 if ($keyword eq "JPAKE" && $no_jpake) { return 0; }
1206 if ($keyword eq "SRP" && $no_srp) { return 0; }
1207 if ($keyword eq "SCTP" && $no_sctp) { return 0; }
1208 if ($keyword eq "DEPRECATED" && $no_deprecated) { return 0; }
1209
1210 # Nothing recognise as true
1211 return 1;
1212 }
1213 }
1214
1215 foreach $k (@keywords) {
1216 if ($k =~ /^!(.*)$/) {
1217 $falsesum += &recognise($1,$platforms);
1218 } else {
1219 $truesum *= &recognise($k,$platforms);
1220 }
1221 }
1222 print STDERR "DEBUG: [",$#keywords,",",$#keywords < 0,"] is_valid($keywords_txt) => (\!$falsesum) && $truesum = ",(!$falsesum) && $truesum,"\n" if $debug;
1223 return (!$falsesum) && $truesum;
1224}
1225
1226sub print_test_file
1227{
1228 (*OUT,my $name,*nums,my $testall,my @symbols)=@_;
1229 my $n = 1; my @e; my @r;
1230 my $sym; my $prev = ""; my $prefSSLeay;
1231
1232 (@e)=grep(/^SSLeay(\{[0-9]+\})?\\.*?:.*?:.*/,@symbols);
1233 (@r)=grep(/^\w+(\{[0-9]+\})?\\.*?:.*?:.*/ && !/^SSLeay(\{[0-9]+\})?\\.*?:.*?:.*/,@symbols);
1234 @symbols=((sort @e),(sort @r));
1235
1236 foreach $sym (@symbols) {
1237 (my $s, my $i) = $sym =~ /^(.*?)\\(.*)$/;
1238 my $v = 0;
1239 $v = 1 if $i=~ /^.*?:.*?:VARIABLE/;
1240 my $p = ($i =~ /^[^:]*:([^:]*):/,$1);
1241 my $a = ($i =~ /^[^:]*:[^:]*:[^:]*:([^:]*)/,$1);
1242 if (!defined($nums{$s})) {
1243 print STDERR "Warning: $s does not have a number assigned\n"
1244 if(!$do_update);
1245 } elsif (is_valid($p,1) && is_valid($a,0)) {
1246 my $s2 = ($s =~ /^(.*?)(\{[0-9]+\})?$/, $1);
1247 if ($prev eq $s2) {
1248 print OUT "\t/* The following has already appeared previously */\n";
1249 print STDERR "Warning: Symbol '",$s2,"' redefined. old=",($nums{$prev} =~ /^(.*?)\\/,$1),", new=",($nums{$s2} =~ /^(.*?)\\/,$1),"\n";
1250 }
1251 $prev = $s2; # To warn about duplicates...
1252
1253 ($nn,$ni)=($nums{$s2} =~ /^(.*?)\\(.*)$/);
1254 if ($v) {
1255 print OUT "\textern int $s2; /* type unknown */ /* $nn $ni */\n";
1256 } else {
1257 print OUT "\textern int $s2(); /* type unknown */ /* $nn $ni */\n";
1258 }
1259 }
1260 }
1261}
1262
1263sub get_version {
1264 local *MF;
1265 my $v = '?';
1266 open MF, 'Makefile' or return $v;
1267 while (<MF>) {
1268 $v = $1, last if /^VERSION=(.*?)\s*$/;
1269 }
1270 close MF;
1271 return $v;
1272}
1273
1274sub print_def_file
1275{
1276 (*OUT,my $name,*nums,my @symbols)=@_;
1277 my $n = 1; my @e; my @r; my @v; my $prev="";
1278 my $liboptions="";
1279 my $libname = $name;
1280 my $http_vendor = 'www.openssl.org/';
1281 my $version = get_version();
1282 my $what = "OpenSSL: implementation of Secure Socket Layer";
1283 my $description = "$what $version, $name - http://$http_vendor";
1284
1285 if ($W32)
1286 { $libname.="32"; }
1287 elsif ($W16)
1288 { $libname.="16"; }
1289 elsif ($OS2)
1290 { # DLL names should not clash on the whole system.
1291 # However, they should not have any particular relationship
1292 # to the name of the static library. Chose descriptive names
1293 # (must be at most 8 chars).
1294 my %translate = (ssl => 'open_ssl', crypto => 'cryptssl');
1295 $libname = $translate{$name} || $name;
1296 $liboptions = <<EOO;
1297INITINSTANCE
1298DATA MULTIPLE NONSHARED
1299EOO
1300 # Vendor field can't contain colon, drat; so we omit http://
1301 $description = "\@#$http_vendor:$version#\@$what; DLL for library $name. Build for EMX -Zmtd";
1302 }
1303
1304 print OUT <<"EOF";
1305;
1306; Definition file for the DLL version of the $name library from OpenSSL
1307;
1308
1309LIBRARY $libname $liboptions
1310
1311EOF
1312
1313 if ($W16) {
1314 print <<"EOF";
1315CODE PRELOAD MOVEABLE
1316DATA PRELOAD MOVEABLE SINGLE
1317
1318EXETYPE WINDOWS
1319
1320HEAPSIZE 4096
1321STACKSIZE 8192
1322
1323EOF
1324 }
1325
1326 print "EXPORTS\n";
1327
1328 (@e)=grep(/^SSLeay(\{[0-9]+\})?\\.*?:.*?:FUNCTION/,@symbols);
1329 (@r)=grep(/^\w+(\{[0-9]+\})?\\.*?:.*?:FUNCTION/ && !/^SSLeay(\{[0-9]+\})?\\.*?:.*?:FUNCTION/,@symbols);
1330 (@v)=grep(/^\w+(\{[0-9]+\})?\\.*?:.*?:VARIABLE/,@symbols);
1331 @symbols=((sort @e),(sort @r), (sort @v));
1332
1333
1334 foreach $sym (@symbols) {
1335 (my $s, my $i) = $sym =~ /^(.*?)\\(.*)$/;
1336 my $v = 0;
1337 $v = 1 if $i =~ /^.*?:.*?:VARIABLE/;
1338 if (!defined($nums{$s})) {
1339 printf STDERR "Warning: $s does not have a number assigned\n"
1340 if(!$do_update);
1341 } else {
1342 (my $n, my $dummy) = split /\\/, $nums{$s};
1343 my %pf = ();
1344 my $p = ($i =~ /^[^:]*:([^:]*):/,$1);
1345 my $a = ($i =~ /^[^:]*:[^:]*:[^:]*:([^:]*)/,$1);
1346 if (is_valid($p,1) && is_valid($a,0)) {
1347 my $s2 = ($s =~ /^(.*?)(\{[0-9]+\})?$/, $1);
1348 if ($prev eq $s2) {
1349 print STDERR "Warning: Symbol '",$s2,"' redefined. old=",($nums{$prev} =~ /^(.*?)\\/,$1),", new=",($nums{$s2} =~ /^(.*?)\\/,$1),"\n";
1350 }
1351 $prev = $s2; # To warn about duplicates...
1352 if($v && !$OS2) {
1353 printf OUT " %s%-39s @%-8d DATA\n",($W32)?"":"_",$s2,$n;
1354 } else {
1355 printf OUT " %s%-39s @%d\n",($W32||$OS2)?"":"_",$s2,$n;
1356 }
1357 }
1358 }
1359 }
1360 printf OUT "\n";
1361}
1362
1363sub load_numbers
1364{
1365 my($name)=@_;
1366 my(@a,%ret);
1367
1368 $max_num = 0;
1369 $num_noinfo = 0;
1370 $prev = "";
1371 $prev_cnt = 0;
1372
1373 open(IN,"<$name") || die "unable to open $name:$!\n";
1374 while (<IN>) {
1375 chop;
1376 s/#.*$//;
1377 next if /^\s*$/;
1378 @a=split;
1379 if (defined $ret{$a[0]}) {
1380 # This is actually perfectly OK
1381 #print STDERR "Warning: Symbol '",$a[0],"' redefined. old=",$ret{$a[0]},", new=",$a[1],"\n";
1382 }
1383 if ($max_num > $a[1]) {
1384 print STDERR "Warning: Number decreased from ",$max_num," to ",$a[1],"\n";
1385 }
1386 elsif ($max_num == $a[1]) {
1387 # This is actually perfectly OK
1388 #print STDERR "Warning: Symbol ",$a[0]," has same number as previous ",$prev,": ",$a[1],"\n";
1389 if ($a[0] eq $prev) {
1390 $prev_cnt++;
1391 $a[0] .= "{$prev_cnt}";
1392 }
1393 }
1394 else {
1395 $prev_cnt = 0;
1396 }
1397 if ($#a < 2) {
1398 # Existence will be proven later, in do_defs
1399 $ret{$a[0]}=$a[1];
1400 $num_noinfo++;
1401 } else {
1402 $ret{$a[0]}=$a[1]."\\".$a[2]; # \\ is a special marker
1403 }
1404 $max_num = $a[1] if $a[1] > $max_num;
1405 $prev=$a[0];
1406 }
1407 if ($num_noinfo) {
1408 print STDERR "Warning: $num_noinfo symbols were without info.";
1409 if ($do_rewrite) {
1410 printf STDERR " The rewrite will fix this.\n";
1411 } else {
1412 printf STDERR " You should do a rewrite to fix this.\n";
1413 }
1414 }
1415 close(IN);
1416 return(%ret);
1417}
1418
1419sub parse_number
1420{
1421 (my $str, my $what) = @_;
1422 (my $n, my $i) = split(/\\/,$str);
1423 if ($what eq "n") {
1424 return $n;
1425 } else {
1426 return $i;
1427 }
1428}
1429
1430sub rewrite_numbers
1431{
1432 (*OUT,$name,*nums,@symbols)=@_;
1433 my $thing;
1434
1435 print STDERR "Rewriting $name\n";
1436
1437 my @r = grep(/^\w+(\{[0-9]+\})?\\.*?:.*?:\w+\(\w+\)/,@symbols);
1438 my $r; my %r; my %rsyms;
1439 foreach $r (@r) {
1440 (my $s, my $i) = split /\\/, $r;
1441 my $a = $1 if $i =~ /^.*?:.*?:\w+\((\w+)\)/;
1442 $i =~ s/^(.*?:.*?:\w+)\(\w+\)/$1/;
1443 $r{$a} = $s."\\".$i;
1444 $rsyms{$s} = 1;
1445 }
1446
1447 my %syms = ();
1448 foreach $_ (@symbols) {
1449 (my $n, my $i) = split /\\/;
1450 $syms{$n} = 1;
1451 }
1452
1453 my @s=sort {
1454 &parse_number($nums{$a},"n") <=> &parse_number($nums{$b},"n")
1455 || $a cmp $b
1456 } keys %nums;
1457 foreach $sym (@s) {
1458 (my $n, my $i) = split /\\/, $nums{$sym};
1459 next if defined($i) && $i =~ /^.*?:.*?:\w+\(\w+\)/;
1460 next if defined($rsyms{$sym});
1461 print STDERR "DEBUG: rewrite_numbers for sym = ",$sym,": i = ",$i,", n = ",$n,", rsym{sym} = ",$rsyms{$sym},"syms{sym} = ",$syms{$sym},"\n" if $debug;
1462 $i="NOEXIST::FUNCTION:"
1463 if !defined($i) || $i eq "" || !defined($syms{$sym});
1464 my $s2 = $sym;
1465 $s2 =~ s/\{[0-9]+\}$//;
1466 printf OUT "%s%-39s %d\t%s\n","",$s2,$n,$i;
1467 if (exists $r{$sym}) {
1468 (my $s, $i) = split /\\/,$r{$sym};
1469 my $s2 = $s;
1470 $s2 =~ s/\{[0-9]+\}$//;
1471 printf OUT "%s%-39s %d\t%s\n","",$s2,$n,$i;
1472 }
1473 }
1474}
1475
1476sub update_numbers
1477{
1478 (*OUT,$name,*nums,my $start_num, my @symbols)=@_;
1479 my $new_syms = 0;
1480
1481 print STDERR "Updating $name numbers\n";
1482
1483 my @r = grep(/^\w+(\{[0-9]+\})?\\.*?:.*?:\w+\(\w+\)/,@symbols);
1484 my $r; my %r; my %rsyms;
1485 foreach $r (@r) {
1486 (my $s, my $i) = split /\\/, $r;
1487 my $a = $1 if $i =~ /^.*?:.*?:\w+\((\w+)\)/;
1488 $i =~ s/^(.*?:.*?:\w+)\(\w+\)/$1/;
1489 $r{$a} = $s."\\".$i;
1490 $rsyms{$s} = 1;
1491 }
1492
1493 foreach $sym (@symbols) {
1494 (my $s, my $i) = $sym =~ /^(.*?)\\(.*)$/;
1495 next if $i =~ /^.*?:.*?:\w+\(\w+\)/;
1496 next if defined($rsyms{$sym});
1497 die "ERROR: Symbol $sym had no info attached to it."
1498 if $i eq "";
1499 if (!exists $nums{$s}) {
1500 $new_syms++;
1501 my $s2 = $s;
1502 $s2 =~ s/\{[0-9]+\}$//;
1503 printf OUT "%s%-39s %d\t%s\n","",$s2, ++$start_num,$i;
1504 if (exists $r{$s}) {
1505 ($s, $i) = split /\\/,$r{$s};
1506 $s =~ s/\{[0-9]+\}$//;
1507 printf OUT "%s%-39s %d\t%s\n","",$s, $start_num,$i;
1508 }
1509 }
1510 }
1511 if($new_syms) {
1512 print STDERR "$new_syms New symbols added\n";
1513 } else {
1514 print STDERR "No New symbols Added\n";
1515 }
1516}
1517
1518sub check_existing
1519{
1520 (*nums, my @symbols)=@_;
1521 my %existing; my @remaining;
1522 @remaining=();
1523 foreach $sym (@symbols) {
1524 (my $s, my $i) = $sym =~ /^(.*?)\\(.*)$/;
1525 $existing{$s}=1;
1526 }
1527 foreach $sym (keys %nums) {
1528 if (!exists $existing{$sym}) {
1529 push @remaining, $sym;
1530 }
1531 }
1532 if(@remaining) {
1533 print STDERR "The following symbols do not seem to exist:\n";
1534 foreach $sym (@remaining) {
1535 print STDERR "\t",$sym,"\n";
1536 }
1537 }
1538}
1539
diff --git a/src/lib/libcrypto/util/mkdir-p.pl b/src/lib/libcrypto/util/mkdir-p.pl
new file mode 100644
index 0000000000..e73d02b073
--- /dev/null
+++ b/src/lib/libcrypto/util/mkdir-p.pl
@@ -0,0 +1,34 @@
1#!/usr/local/bin/perl
2
3# mkdir-p.pl
4
5# On some systems, the -p option to mkdir (= also create any missing parent
6# directories) is not available.
7
8my $arg;
9
10foreach $arg (@ARGV) {
11 $arg =~ tr|\\|/|;
12 &do_mkdir_p($arg);
13}
14
15
16sub do_mkdir_p {
17 local($dir) = @_;
18
19 $dir =~ s|/*\Z(?!\n)||s;
20
21 if (-d $dir) {
22 return;
23 }
24
25 if ($dir =~ m|[^/]/|s) {
26 local($parent) = $dir;
27 $parent =~ s|[^/]*\Z(?!\n)||s;
28
29 do_mkdir_p($parent);
30 }
31
32 mkdir($dir, 0777) || die "Cannot create directory $dir: $!\n";
33 print "created directory `$dir'\n";
34}
diff --git a/src/lib/libcrypto/util/mkfiles.pl b/src/lib/libcrypto/util/mkfiles.pl
new file mode 100644
index 0000000000..7d9a9d5e5c
--- /dev/null
+++ b/src/lib/libcrypto/util/mkfiles.pl
@@ -0,0 +1,143 @@
1#!/usr/local/bin/perl
2#
3# This is a hacked version of files.pl for systems that can't do a 'make files'.
4# Do a perl util/mkminfo.pl >MINFO to build MINFO
5# Written by Steve Henson 1999.
6
7# List of directories to process
8
9my @dirs = (
10".",
11"crypto",
12"crypto/md2",
13"crypto/md4",
14"crypto/md5",
15"crypto/sha",
16"crypto/mdc2",
17"crypto/hmac",
18"crypto/cmac",
19"crypto/ripemd",
20"crypto/des",
21"crypto/rc2",
22"crypto/rc4",
23"crypto/rc5",
24"crypto/idea",
25"crypto/bf",
26"crypto/cast",
27"crypto/aes",
28"crypto/camellia",
29"crypto/seed",
30"crypto/modes",
31"crypto/bn",
32"crypto/rsa",
33"crypto/dsa",
34"crypto/dso",
35"crypto/dh",
36"crypto/ec",
37"crypto/ecdh",
38"crypto/ecdsa",
39"crypto/buffer",
40"crypto/bio",
41"crypto/stack",
42"crypto/lhash",
43"crypto/rand",
44"crypto/err",
45"crypto/objects",
46"crypto/evp",
47"crypto/asn1",
48"crypto/pem",
49"crypto/x509",
50"crypto/x509v3",
51"crypto/cms",
52"crypto/conf",
53"crypto/jpake",
54"crypto/txt_db",
55"crypto/pkcs7",
56"crypto/pkcs12",
57"crypto/comp",
58"crypto/engine",
59"crypto/ocsp",
60"crypto/ui",
61"crypto/krb5",
62#"crypto/store",
63"crypto/pqueue",
64"crypto/whrlpool",
65"crypto/ts",
66"crypto/srp",
67"ssl",
68"apps",
69"engines",
70"engines/ccgost",
71"test",
72"tools"
73);
74
75%top;
76
77foreach (@dirs) {
78 &files_dir ($_, "Makefile");
79}
80
81exit(0);
82
83sub files_dir
84{
85my ($dir, $makefile) = @_;
86
87my %sym;
88
89open (IN, "$dir/$makefile") || die "Can't open $dir/$makefile";
90
91my $s="";
92
93while (<IN>)
94 {
95 chop;
96 s/#.*//;
97 if (/^(\S+)\s*=\s*(.*)$/)
98 {
99 $o="";
100 ($s,$b)=($1,$2);
101 for (;;)
102 {
103 if ($b =~ /\\$/)
104 {
105 chop($b);
106 $o.=$b." ";
107 $b=<IN>;
108 chop($b);
109 }
110 else
111 {
112 $o.=$b." ";
113 last;
114 }
115 }
116 $o =~ s/^\s+//;
117 $o =~ s/\s+$//;
118 $o =~ s/\s+/ /g;
119
120 $o =~ s/\$[({]([^)}]+)[)}]/$top{$1} or $sym{$1}/ge;
121 $sym{$s}=($top{$s} or $o);
122 }
123 }
124
125print "RELATIVE_DIRECTORY=$dir\n";
126
127foreach (sort keys %sym)
128 {
129 print "$_=$sym{$_}\n";
130 }
131if ($dir eq "." && defined($sym{"BUILDENV"}))
132 {
133 foreach (split(' ',$sym{"BUILDENV"}))
134 {
135 /^(.+)=/;
136 $top{$1}=$sym{$1};
137 }
138 }
139
140print "RELATIVE_DIRECTORY=\n";
141
142close (IN);
143}
diff --git a/src/lib/libcrypto/util/mklink.pl b/src/lib/libcrypto/util/mklink.pl
new file mode 100644
index 0000000000..61db12c68f
--- /dev/null
+++ b/src/lib/libcrypto/util/mklink.pl
@@ -0,0 +1,73 @@
1#!/usr/local/bin/perl
2
3# mklink.pl
4
5# The first command line argument is a non-empty relative path
6# specifying the "from" directory.
7# Each other argument is a file name not containing / and
8# names a file in the current directory.
9#
10# For each of these files, we create in the "from" directory a link
11# of the same name pointing to the local file.
12#
13# We assume that the directory structure is a tree, i.e. that it does
14# not contain symbolic links and that the parent of / is never referenced.
15# Apart from this, this script should be able to handle even the most
16# pathological cases.
17
18use Cwd;
19
20my $from = shift;
21my @files = @ARGV;
22
23my @from_path = split(/[\\\/]/, $from);
24my $pwd = getcwd();
25chomp($pwd);
26my @pwd_path = split(/[\\\/]/, $pwd);
27
28my @to_path = ();
29
30my $dirname;
31foreach $dirname (@from_path) {
32
33 # In this loop, @to_path always is a relative path from
34 # @pwd_path (interpreted is an absolute path) to the original pwd.
35
36 # At the end, @from_path (as a relative path from the original pwd)
37 # designates the same directory as the absolute path @pwd_path,
38 # which means that @to_path then is a path from there to the original pwd.
39
40 next if ($dirname eq "" || $dirname eq ".");
41
42 if ($dirname eq "..") {
43 @to_path = (pop(@pwd_path), @to_path);
44 } else {
45 @to_path = ("..", @to_path);
46 push(@pwd_path, $dirname);
47 }
48}
49
50my $to = join('/', @to_path);
51
52my $file;
53$symlink_exists=eval {symlink("",""); 1};
54if ($^O eq "msys") { $symlink_exists=0 };
55foreach $file (@files) {
56 my $err = "";
57 if ($symlink_exists) {
58 unlink "$from/$file";
59 symlink("$to/$file", "$from/$file") or $err = " [$!]";
60 } else {
61 unlink "$from/$file";
62 open (OLD, "<$file") or die "Can't open $file: $!";
63 open (NEW, ">$from/$file") or die "Can't open $from/$file: $!";
64 binmode(OLD);
65 binmode(NEW);
66 while (<OLD>) {
67 print NEW $_;
68 }
69 close (OLD) or die "Can't close $file: $!";
70 close (NEW) or die "Can't close $from/$file: $!";
71 }
72 print $file . " => $from/$file$err\n";
73}
diff --git a/src/lib/libcrypto/util/mkrc.pl b/src/lib/libcrypto/util/mkrc.pl
new file mode 100755
index 0000000000..0ceadcf8d1
--- /dev/null
+++ b/src/lib/libcrypto/util/mkrc.pl
@@ -0,0 +1,71 @@
1#!/bin/env perl
2#
3open FD,"crypto/opensslv.h";
4while(<FD>) {
5 if (/OPENSSL_VERSION_NUMBER\s+(0x[0-9a-f]+)/i) {
6 $ver = hex($1);
7 $v1 = ($ver>>28);
8 $v2 = ($ver>>20)&0xff;
9 $v3 = ($ver>>12)&0xff;
10 $v4 = ($ver>> 4)&0xff;
11 $beta = $ver&0xf;
12 $version = "$v1.$v2.$v3";
13 if ($beta==0xf) { $version .= chr(ord('a')+$v4-1) if ($v4); }
14 elsif ($beta==0){ $version .= "-dev"; }
15 else { $version .= "-beta$beta"; }
16 last;
17 }
18}
19close(FD);
20
21$filename = $ARGV[0]; $filename =~ /(.*)\.([^.]+)$/;
22$basename = $1;
23$extname = $2;
24
25if ($extname =~ /dll/i) { $description = "OpenSSL shared library"; }
26else { $description = "OpenSSL application"; }
27
28print <<___;
29#include <winver.h>
30
31LANGUAGE 0x09,0x01
32
331 VERSIONINFO
34 FILEVERSION $v1,$v2,$v3,$v4
35 PRODUCTVERSION $v1,$v2,$v3,$v4
36 FILEFLAGSMASK 0x3fL
37#ifdef _DEBUG
38 FILEFLAGS 0x01L
39#else
40 FILEFLAGS 0x00L
41#endif
42 FILEOS VOS__WINDOWS32
43 FILETYPE VFT_DLL
44 FILESUBTYPE 0x0L
45BEGIN
46 BLOCK "StringFileInfo"
47 BEGIN
48 BLOCK "040904b0"
49 BEGIN
50 // Required:
51 VALUE "CompanyName", "The OpenSSL Project, http://www.openssl.org/\\0"
52 VALUE "FileDescription", "$description\\0"
53 VALUE "FileVersion", "$version\\0"
54 VALUE "InternalName", "$basename\\0"
55 VALUE "OriginalFilename", "$filename\\0"
56 VALUE "ProductName", "The OpenSSL Toolkit\\0"
57 VALUE "ProductVersion", "$version\\0"
58 // Optional:
59 //VALUE "Comments", "\\0"
60 VALUE "LegalCopyright", "Copyright © 1998-2006 The OpenSSL Project. Copyright © 1995-1998 Eric A. Young, Tim J. Hudson. All rights reserved.\\0"
61 //VALUE "LegalTrademarks", "\\0"
62 //VALUE "PrivateBuild", "\\0"
63 //VALUE "SpecialBuild", "\\0"
64 END
65 END
66 BLOCK "VarFileInfo"
67 BEGIN
68 VALUE "Translation", 0x409, 0x4b0
69 END
70END
71___
diff --git a/src/lib/libcrypto/util/opensslwrap.sh b/src/lib/libcrypto/util/opensslwrap.sh
new file mode 100755
index 0000000000..b27cbb897f
--- /dev/null
+++ b/src/lib/libcrypto/util/opensslwrap.sh
@@ -0,0 +1,26 @@
1#!/bin/sh
2
3HERE="`echo $0 | sed -e 's|[^/]*$||'`"
4OPENSSL="${HERE}../apps/openssl"
5
6if [ -d "${HERE}../engines" -a "x$OPENSSL_ENGINES" = "x" ]; then
7 OPENSSL_ENGINES="${HERE}../engines"; export OPENSSL_ENGINES
8fi
9
10if [ -x "${OPENSSL}.exe" ]; then
11 # The original reason for this script existence is to work around
12 # certain caveats in run-time linker behaviour. On Windows platforms
13 # adjusting $PATH used to be sufficient, but with introduction of
14 # SafeDllSearchMode in XP/2003 the only way to get it right in
15 # *all* possible situations is to copy newly built .DLLs to apps/
16 # and test/, which is now done elsewhere... The $PATH is adjusted
17 # for backward compatibility (and nostagical reasons:-).
18 if [ "$OSTYPE" != msdosdjgpp ]; then
19 PATH="${HERE}..:$PATH"; export PATH
20 fi
21 exec "${OPENSSL}.exe" "$@"
22elif [ -x "${OPENSSL}" -a -x "${HERE}shlib_wrap.sh" ]; then
23 exec "${HERE}shlib_wrap.sh" "${OPENSSL}" "$@"
24else
25 exec "${OPENSSL}" "$@" # hope for the best...
26fi
diff --git a/src/lib/libcrypto/util/perlpath.pl b/src/lib/libcrypto/util/perlpath.pl
new file mode 100644
index 0000000000..a1f236bd98
--- /dev/null
+++ b/src/lib/libcrypto/util/perlpath.pl
@@ -0,0 +1,35 @@
1#!/usr/local/bin/perl
2#
3# modify the '#!/usr/local/bin/perl'
4# line in all scripts that rely on perl.
5#
6
7require "find.pl";
8
9$#ARGV == 0 || print STDERR "usage: perlpath newpath (eg /usr/bin)\n";
10&find(".");
11
12sub wanted
13 {
14 return unless /\.pl$/ || /^[Cc]onfigur/;
15
16 open(IN,"<$_") || die "unable to open $dir/$_:$!\n";
17 @a=<IN>;
18 close(IN);
19
20 if (-d $ARGV[0]) {
21 $a[0]="#!$ARGV[0]/perl\n";
22 }
23 else {
24 $a[0]="#!$ARGV[0]\n";
25 }
26
27 # Playing it safe...
28 $new="$_.new";
29 open(OUT,">$new") || die "unable to open $dir/$new:$!\n";
30 print OUT @a;
31 close(OUT);
32
33 rename($new,$_) || die "unable to rename $dir/$new:$!\n";
34 chmod(0755,$_) || die "unable to chmod $dir/$new:$!\n";
35 }
diff --git a/src/lib/libcrypto/util/pl/BC-32.pl b/src/lib/libcrypto/util/pl/BC-32.pl
new file mode 100644
index 0000000000..1f1e13fb40
--- /dev/null
+++ b/src/lib/libcrypto/util/pl/BC-32.pl
@@ -0,0 +1,139 @@
1#!/usr/local/bin/perl
2# Borland C++ builder 3 and 4 -- Janez Jere <jj@void.si>
3#
4
5$ssl= "ssleay32";
6$crypto="libeay32";
7
8$o='\\';
9$cp='copy';
10$rm='del';
11
12# C compiler stuff
13$cc='bcc32';
14$lflags="-ap -Tpe -x -Gn ";
15$mlflags='';
16
17$out_def="out32";
18$tmp_def="tmp32";
19$inc_def="inc32";
20#enable max error messages, disable most common warnings
21$cflags="-DWIN32_LEAN_AND_MEAN -q -w-ccc -w-rch -w-pia -w-aus -w-par -w-inl -c -tWC -tWM -DOPENSSL_SYSNAME_WIN32 -DL_ENDIAN -DDSO_WIN32 -D_stricmp=stricmp -D_strnicmp=strnicmp ";
22if ($debug)
23{
24 $cflags.="-Od -y -v -vi- -D_DEBUG";
25 $mlflags.=' ';
26}
27else
28{
29 $cflags.="-O2 -ff -fp";
30}
31
32$obj='.obj';
33$ofile="-o";
34
35# EXE linking stuff
36$link="ilink32";
37$efile="";
38$exep='.exe';
39if ($no_sock)
40 { $ex_libs=""; }
41else { $ex_libs="cw32mt.lib import32.lib"; }
42
43# static library stuff
44$mklib='tlib /P64';
45$ranlib='';
46$plib="";
47$libp=".lib";
48$shlibp=($shlib)?".dll":".lib";
49$lfile='';
50
51$shlib_ex_obj="";
52$app_ex_obj="c0x32.obj";
53
54$asm='nasmw -f obj -d__omf__';
55$asm.=" /Zi" if $debug;
56$afile='-o';
57
58$bn_mulw_obj='';
59$bn_mulw_src='';
60$des_enc_obj='';
61$des_enc_src='';
62$bf_enc_obj='';
63$bf_enc_src='';
64
65if (!$no_asm)
66 {
67 $bn_mulw_obj='crypto\bn\asm\bn_win32.obj';
68 $bn_mulw_src='crypto\bn\asm\bn_win32.asm';
69 $des_enc_obj='crypto\des\asm\d_win32.obj crypto\des\asm\y_win32.obj';
70 $des_enc_src='crypto\des\asm\d_win32.asm crypto\des\asm\y_win32.asm';
71 $bf_enc_obj='crypto\bf\asm\b_win32.obj';
72 $bf_enc_src='crypto\bf\asm\b_win32.asm';
73 $cast_enc_obj='crypto\cast\asm\c_win32.obj';
74 $cast_enc_src='crypto\cast\asm\c_win32.asm';
75 $rc4_enc_obj='crypto\rc4\asm\r4_win32.obj';
76 $rc4_enc_src='crypto\rc4\asm\r4_win32.asm';
77 $rc5_enc_obj='crypto\rc5\asm\r5_win32.obj';
78 $rc5_enc_src='crypto\rc5\asm\r5_win32.asm';
79 $md5_asm_obj='crypto\md5\asm\m5_win32.obj';
80 $md5_asm_src='crypto\md5\asm\m5_win32.asm';
81 $sha1_asm_obj='crypto\sha\asm\s1_win32.obj';
82 $sha1_asm_src='crypto\sha\asm\s1_win32.asm';
83 $rmd160_asm_obj='crypto\ripemd\asm\rm_win32.obj';
84 $rmd160_asm_src='crypto\ripemd\asm\rm_win32.asm';
85 $cflags.=" -DBN_ASM -DMD5_ASM -DSHA1_ASM -DRMD160_ASM";
86 }
87
88if ($shlib)
89 {
90 $mlflags.=" $lflags /dll";
91# $cflags =~ s| /MD| /MT|;
92 $lib_cflag=" /GD -D_WINDLL -D_DLL";
93 $out_def="out32dll";
94 $tmp_def="tmp32dll";
95 }
96
97sub do_lib_rule
98 {
99 local($objs,$target,$name,$shlib)=@_;
100 local($ret,$Name);
101
102 $taget =~ s/\//$o/g if $o ne '/';
103 ($Name=$name) =~ tr/a-z/A-Z/;
104
105# $target="\$(LIB_D)$o$target";
106 $ret.="$target: $objs\n";
107 if (!$shlib)
108 {
109 $ret.=<<___;
110 -\$(RM) $lfile$target
111 \$(MKLIB) $lfile$target \@&&!
112+\$(**: = &^
113+)
114!
115___
116 }
117 else
118 {
119 local($ex)=($target =~ /O_SSL/)?' $(L_CRYPTO)':'';
120 $ex.=' ws2_32.lib gdi32.lib';
121 $ret.="\t\$(LINK) \$(MLFLAGS) $efile$target /def:ms/${Name}.def @<<\n \$(SHLIB_EX_OBJ) $objs $ex\n<<\n";
122 }
123 $ret.="\n";
124 return($ret);
125 }
126
127sub do_link_rule
128 {
129 local($target,$files,$dep_libs,$libs)=@_;
130 local($ret,$_);
131
132 $file =~ s/\//$o/g if $o ne '/';
133 $n=&bname($targer);
134 $ret.="$target: $files $dep_libs\n";
135 $ret.="\t\$(LINK) \$(LFLAGS) $files \$(APP_EX_OBJ), $target,, $libs\n\n";
136 return($ret);
137 }
138
1391;
diff --git a/src/lib/libcrypto/util/pl/Mingw32.pl b/src/lib/libcrypto/util/pl/Mingw32.pl
new file mode 100644
index 0000000000..fe3fb27a78
--- /dev/null
+++ b/src/lib/libcrypto/util/pl/Mingw32.pl
@@ -0,0 +1,104 @@
1#!/usr/local/bin/perl
2#
3# Mingw32.pl -- Mingw
4#
5
6$o='/';
7$cp='cp';
8$rm='rm -f';
9$mkdir='gmkdir';
10
11$o='\\';
12$cp='copy';
13$rm='del';
14$mkdir='mkdir';
15
16# C compiler stuff
17
18$cc='gcc';
19if ($debug)
20 { $cflags="-DL_ENDIAN -DDSO_WIN32 -g2 -ggdb"; }
21else
22 { $cflags="-DL_ENDIAN -DDSO_WIN32 -fomit-frame-pointer -O3 -mcpu=i486 -Wall"; }
23
24if ($gaswin and !$no_asm)
25 {
26 $bn_asm_obj='$(OBJ_D)\bn-win32.o';
27 $bn_asm_src='crypto/bn/asm/bn-win32.s';
28 $bnco_asm_obj='$(OBJ_D)\co-win32.o';
29 $bnco_asm_src='crypto/bn/asm/co-win32.s';
30 $des_enc_obj='$(OBJ_D)\d-win32.o $(OBJ_D)\y-win32.o';
31 $des_enc_src='crypto/des/asm/d-win32.s crypto/des/asm/y-win32.s';
32 $bf_enc_obj='$(OBJ_D)\b-win32.o';
33 $bf_enc_src='crypto/bf/asm/b-win32.s';
34# $cast_enc_obj='$(OBJ_D)\c-win32.o';
35# $cast_enc_src='crypto/cast/asm/c-win32.s';
36 $rc4_enc_obj='$(OBJ_D)\r4-win32.o';
37 $rc4_enc_src='crypto/rc4/asm/r4-win32.s';
38 $rc5_enc_obj='$(OBJ_D)\r5-win32.o';
39 $rc5_enc_src='crypto/rc5/asm/r5-win32.s';
40 $md5_asm_obj='$(OBJ_D)\m5-win32.o';
41 $md5_asm_src='crypto/md5/asm/m5-win32.s';
42 $rmd160_asm_obj='$(OBJ_D)\rm-win32.o';
43 $rmd160_asm_src='crypto/ripemd/asm/rm-win32.s';
44 $sha1_asm_obj='$(OBJ_D)\s1-win32.o';
45 $sha1_asm_src='crypto/sha/asm/s1-win32.s';
46 $cflags.=" -DBN_ASM -DMD5_ASM -DSHA1_ASM -DOPENSSL_BN_ASM_PART_WORDS";
47 }
48
49
50$obj='.o';
51$ofile='-o ';
52
53# EXE linking stuff
54$link='${CC}';
55$lflags='${CFLAGS}';
56$efile='-o ';
57$exep='';
58$ex_libs="-lws2_32 -lgdi32";
59
60# static library stuff
61$mklib='ar r';
62$mlflags='';
63$ranlib='ranlib';
64$plib='lib';
65$libp=".a";
66$shlibp=".a";
67$lfile='';
68
69$asm='as';
70$afile='-o ';
71#$bn_asm_obj="";
72#$bn_asm_src="";
73#$des_enc_obj="";
74#$des_enc_src="";
75#$bf_enc_obj="";
76#$bf_enc_src="";
77
78sub do_lib_rule
79 {
80 local($obj,$target,$name,$shlib)=@_;
81 local($ret,$_,$Name);
82
83 $target =~ s/\//$o/g if $o ne '/';
84 $target="$target";
85 ($Name=$name) =~ tr/a-z/A-Z/;
86
87 $ret.="$target: \$(${Name}OBJ)\n";
88 $ret.="\tif exist $target \$(RM) $target\n";
89 $ret.="\t\$(MKLIB) $target \$(${Name}OBJ)\n";
90 $ret.="\t\$(RANLIB) $target\n\n";
91 }
92
93sub do_link_rule
94 {
95 local($target,$files,$dep_libs,$libs)=@_;
96 local($ret,$_);
97
98 $file =~ s/\//$o/g if $o ne '/';
99 $n=&bname($target);
100 $ret.="$target: $files $dep_libs\n";
101 $ret.="\t\$(LINK) ${efile}$target \$(LFLAGS) $files $libs\n\n";
102 return($ret);
103 }
1041;
diff --git a/src/lib/libcrypto/util/pl/OS2-EMX.pl b/src/lib/libcrypto/util/pl/OS2-EMX.pl
new file mode 100644
index 0000000000..28cd116907
--- /dev/null
+++ b/src/lib/libcrypto/util/pl/OS2-EMX.pl
@@ -0,0 +1,120 @@
1#!/usr/local/bin/perl
2#
3# OS2-EMX.pl - for EMX GCC on OS/2
4#
5
6$o='/';
7$cp='cp';
8$rm='rm -f';
9
10$preamble = "SHELL=sh\n";
11
12# C compiler stuff
13
14$cc='gcc';
15$cflags="-DL_ENDIAN -O3 -fomit-frame-pointer -m486 -Zmtd -Wall ";
16$cflags.="-Zomf " if $shlib;
17$shl_cflag="-Zdll";
18
19if ($debug) {
20 $cflags.="-g ";
21}
22
23$obj=$shlib ? '.obj' : '.o';
24$ofile='-o ';
25
26# EXE linking stuff
27$link='${CC}';
28$lflags='${CFLAGS} -Zbsd-signals -s';
29$efile='-o ';
30$exep='.exe';
31$ex_libs="-lsocket";
32
33# static library stuff
34$mklib='ar r';
35$mlflags='';
36$ranlib="ar s";
37$plib='';
38$libp=$shlib ? ".lib" : ".a";
39$shlibp=$shlib ? ".dll" : ".a";
40$lfile='';
41
42$asm=$shlib ? 'as -Zomf' : 'as';
43$afile='-o ';
44$bn_asm_obj="";
45$bn_asm_src="";
46$des_enc_obj="";
47$des_enc_src="";
48$bf_enc_obj="";
49$bf_enc_src="";
50
51if (!$no_asm)
52 {
53 $bn_asm_obj="crypto/bn/asm/bn-os2$obj crypto/bn/asm/co-os2$obj";
54 $bn_asm_src="crypto/bn/asm/bn-os2.asm crypto/bn/asm/co-os2.asm";
55 $des_enc_obj="crypto/des/asm/d-os2$obj crypto/des/asm/y-os2$obj";
56 $des_enc_src="crypto/des/asm/d-os2.asm crypto/des/asm/y-os2.asm";
57 $bf_enc_obj="crypto/bf/asm/b-os2$obj";
58 $bf_enc_src="crypto/bf/asm/b-os2.asm";
59 $cast_enc_obj="crypto/cast/asm/c-os2$obj";
60 $cast_enc_src="crypto/cast/asm/c-os2.asm";
61 $rc4_enc_obj="crypto/rc4/asm/r4-os2$obj";
62 $rc4_enc_src="crypto/rc4/asm/r4-os2.asm";
63 $rc5_enc_obj="crypto/rc5/asm/r5-os2$obj";
64 $rc5_enc_src="crypto/rc5/asm/r5-os2.asm";
65 $md5_asm_obj="crypto/md5/asm/m5-os2$obj";
66 $md5_asm_src="crypto/md5/asm/m5-os2.asm";
67 $sha1_asm_obj="crypto/sha/asm/s1-os2$obj";
68 $sha1_asm_src="crypto/sha/asm/s1-os2.asm";
69 $rmd160_asm_obj="crypto/ripemd/asm/rm-os2$obj";
70 $rmd160_asm_src="crypto/ripemd/asm/rm-os2.asm";
71 $cflags.=" -DBN_ASM -DMD5_ASM -DSHA1_ASM -DOPENSSL_BN_ASM_PART_WORDS";
72 }
73
74if ($shlib)
75 {
76 $mlflags.=" $lflags -Zdll";
77 $lib_cflag=" -D_DLL";
78 $out_def="out_dll";
79 $tmp_def="tmp_dll";
80 }
81
82sub do_lib_rule
83 {
84 local($obj,$target,$name,$shlib)=@_;
85 local($ret,$_,$Name);
86
87 $target =~ s/\//$o/g if $o ne '/';
88 $target="$target";
89 ($Name=$name) =~ tr/a-z/A-Z/;
90
91 $ret.="$target: \$(${Name}OBJ)\n";
92 if (!$shlib)
93 {
94 $ret.="\t\$(RM) $target\n";
95 $ret.="\t\$(MKLIB) $target \$(${Name}OBJ)\n";
96 $ret.="\t\$(RANLIB) $target\n\n";
97 }
98 else
99 {
100 local($ex)=($target =~ /O_SSL/)?' $(L_CRYPTO)':'';
101 $ex.=' -lsocket';
102 $ret.="\t\$(LINK) \$(SHLIB_CFLAGS) \$(MLFLAGS) $efile$target \$(SHLIB_EX_OBJ) \$(${Name}OBJ) $ex os2/${Name}.def\n";
103 $ret.="\temximp -o $out_def/$name.a os2/${Name}.def\n";
104 $ret.="\temximp -o $out_def/$name.lib os2/${Name}.def\n\n";
105 }
106 }
107
108sub do_link_rule
109 {
110 local($target,$files,$dep_libs,$libs)=@_;
111 local($ret,$_);
112
113 $file =~ s/\//$o/g if $o ne '/';
114 $n=&bname($target);
115 $ret.="$target: $files $dep_libs\n";
116 $ret.="\t\$(LINK) ${efile}$target \$(CFLAG) \$(LFLAGS) $files $libs\n\n";
117 return($ret);
118 }
119
1201;
diff --git a/src/lib/libcrypto/util/pl/VC-32.pl b/src/lib/libcrypto/util/pl/VC-32.pl
new file mode 100644
index 0000000000..c503bd52b9
--- /dev/null
+++ b/src/lib/libcrypto/util/pl/VC-32.pl
@@ -0,0 +1,397 @@
1#!/usr/local/bin/perl
2# VC-32.pl - unified script for Microsoft Visual C++, covering Win32,
3# Win64 and WinCE [follow $FLAVOR variable to trace the differences].
4#
5
6$ssl= "ssleay32";
7$crypto="libeay32";
8
9if ($fips && !$shlib)
10 {
11 $crypto="libeayfips32";
12 $crypto_compat = "libeaycompat32.lib";
13 }
14else
15 {
16 $crypto="libeay32";
17 }
18
19$o='\\';
20$cp='$(PERL) util/copy.pl';
21$mkdir='$(PERL) util/mkdir-p.pl';
22$rm='del /Q';
23
24$zlib_lib="zlib1.lib";
25
26# Santize -L options for ms link
27$l_flags =~ s/-L("\[^"]+")/\/libpath:$1/g;
28$l_flags =~ s/-L(\S+)/\/libpath:$1/g;
29
30# C compiler stuff
31$cc='cl';
32if ($FLAVOR =~ /WIN64/)
33 {
34 # Note that we currently don't have /WX on Win64! There is a lot of
35 # warnings, but only of two types:
36 #
37 # C4344: conversion from '__int64' to 'int/long', possible loss of data
38 # C4267: conversion from 'size_t' to 'int/long', possible loss of data
39 #
40 # Amount of latter type is minimized by aliasing strlen to function of
41 # own desing and limiting its return value to 2GB-1 (see e_os.h). As
42 # per 0.9.8 release remaining warnings were explicitly examined and
43 # considered safe to ignore.
44 #
45 $base_cflags= " $mf_cflag";
46 my $f = $shlib || $fips ?' /MD':' /MT';
47 $lib_cflag='/Zl' if (!$shlib); # remove /DEFAULTLIBs from static lib
48 $opt_cflags=$f.' /Ox';
49 $dbg_cflags=$f.'d /Od -DDEBUG -D_DEBUG';
50 $lflags="/nologo /subsystem:console /opt:ref";
51
52 *::perlasm_compile_target = sub {
53 my ($target,$source,$bname)=@_;
54 my $ret;
55
56 $bname =~ s/(.*)\.[^\.]$/$1/;
57 $ret=<<___;
58\$(TMP_D)$o$bname.asm: $source
59 set ASM=\$(ASM)
60 \$(PERL) $source \$\@
61
62$target: \$(TMP_D)$o$bname.asm
63 \$(ASM) $afile\$\@ \$(TMP_D)$o$bname.asm
64
65___
66 }
67 }
68elsif ($FLAVOR =~ /CE/)
69 {
70 # sanity check
71 die '%OSVERSION% is not defined' if (!defined($ENV{'OSVERSION'}));
72 die '%PLATFORM% is not defined' if (!defined($ENV{'PLATFORM'}));
73 die '%TARGETCPU% is not defined' if (!defined($ENV{'TARGETCPU'}));
74
75 #
76 # Idea behind this is to mimic flags set by eVC++ IDE...
77 #
78 $wcevers = $ENV{'OSVERSION'}; # WCENNN
79 die '%OSVERSION% value is insane' if ($wcevers !~ /^WCE([1-9])([0-9]{2})$/);
80 $wcecdefs = "-D_WIN32_WCE=$1$2 -DUNDER_CE=$1$2"; # -D_WIN32_WCE=NNN
81 $wcelflag = "/subsystem:windowsce,$1.$2"; # ...,N.NN
82
83 $wceplatf = $ENV{'PLATFORM'};
84 $wceplatf =~ tr/a-z0-9 /A-Z0-9_/d;
85 $wcecdefs .= " -DWCE_PLATFORM_$wceplatf";
86
87 $wcetgt = $ENV{'TARGETCPU'}; # just shorter name...
88 SWITCH: for($wcetgt) {
89 /^X86/ && do { $wcecdefs.=" -Dx86 -D_X86_ -D_i386_ -Di_386_";
90 $wcelflag.=" /machine:IX86"; last; };
91 /^ARMV4[IT]/ && do { $wcecdefs.=" -DARM -D_ARM_ -D$wcetgt";
92 $wcecdefs.=" -DTHUMB -D_THUMB_" if($wcetgt=~/T$/);
93 $wcecdefs.=" -QRarch4T -QRinterwork-return";
94 $wcelflag.=" /machine:THUMB"; last; };
95 /^ARM/ && do { $wcecdefs.=" -DARM -D_ARM_ -D$wcetgt";
96 $wcelflag.=" /machine:ARM"; last; };
97 /^MIPSIV/ && do { $wcecdefs.=" -DMIPS -D_MIPS_ -DR4000 -D$wcetgt";
98 $wcecdefs.=" -D_MIPS64 -QMmips4 -QMn32";
99 $wcelflag.=" /machine:MIPSFPU"; last; };
100 /^MIPS16/ && do { $wcecdefs.=" -DMIPS -D_MIPS_ -DR4000 -D$wcetgt";
101 $wcecdefs.=" -DMIPSII -QMmips16";
102 $wcelflag.=" /machine:MIPS16"; last; };
103 /^MIPSII/ && do { $wcecdefs.=" -DMIPS -D_MIPS_ -DR4000 -D$wcetgt";
104 $wcecdefs.=" -QMmips2";
105 $wcelflag.=" /machine:MIPS"; last; };
106 /^R4[0-9]{3}/ && do { $wcecdefs.=" -DMIPS -D_MIPS_ -DR4000";
107 $wcelflag.=" /machine:MIPS"; last; };
108 /^SH[0-9]/ && do { $wcecdefs.=" -D$wcetgt -D_$wcetgt_ -DSHx";
109 $wcecdefs.=" -Qsh4" if ($wcetgt =~ /^SH4/);
110 $wcelflag.=" /machine:$wcetgt"; last; };
111 { $wcecdefs.=" -D$wcetgt -D_$wcetgt_";
112 $wcelflag.=" /machine:$wcetgt"; last; };
113 }
114
115 $cc='$(CC)';
116 $base_cflags=' /W3 /WX /GF /Gy /nologo -DUNICODE -D_UNICODE -DOPENSSL_SYSNAME_WINCE -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -DDSO_WIN32 -DNO_CHMOD -DOPENSSL_SMALL_FOOTPRINT';
117 $base_cflags.=" $wcecdefs";
118 $base_cflags.=' -I$(WCECOMPAT)/include' if (defined($ENV{'WCECOMPAT'}));
119 $base_cflags.=' -I$(PORTSDK_LIBPATH)/../../include' if (defined($ENV{'PORTSDK_LIBPATH'}));
120 $opt_cflags=' /MC /O1i'; # optimize for space, but with intrinsics...
121 $dbg_clfags=' /MC /Od -DDEBUG -D_DEBUG';
122 $lflags="/nologo /opt:ref $wcelflag";
123 }
124else # Win32
125 {
126 $base_cflags= " $mf_cflag";
127 my $f = $shlib || $fips ?' /MD':' /MT';
128 $lib_cflag='/Zl' if (!$shlib); # remove /DEFAULTLIBs from static lib
129 $opt_cflags=$f.' /Ox /O2 /Ob2';
130 $dbg_cflags=$f.'d /Od -DDEBUG -D_DEBUG';
131 $lflags="/nologo /subsystem:console /opt:ref";
132 }
133$mlflags='';
134
135$out_def ="out32"; $out_def.="dll" if ($shlib);
136 $out_def.='_$(TARGETCPU)' if ($FLAVOR =~ /CE/);
137$tmp_def ="tmp32"; $tmp_def.="dll" if ($shlib);
138 $tmp_def.='_$(TARGETCPU)' if ($FLAVOR =~ /CE/);
139$inc_def="inc32";
140
141if ($debug)
142 {
143 $cflags=$dbg_cflags.$base_cflags;
144 }
145else
146 {
147 $cflags=$opt_cflags.$base_cflags;
148 }
149
150# generate symbols.pdb unconditionally
151$app_cflag.=" /Zi /Fd\$(TMP_D)/app";
152$lib_cflag.=" /Zi /Fd\$(TMP_D)/lib";
153$lflags.=" /debug";
154
155$obj='.obj';
156$asm_suffix='.asm';
157$ofile="/Fo";
158
159# EXE linking stuff
160$link="link";
161$rsc="rc";
162$efile="/out:";
163$exep='.exe';
164if ($no_sock) { $ex_libs=''; }
165elsif ($FLAVOR =~ /CE/) { $ex_libs='winsock.lib'; }
166else { $ex_libs='ws2_32.lib'; }
167
168if ($FLAVOR =~ /CE/)
169 {
170 $ex_libs.=' $(WCECOMPAT)/lib/wcecompatex.lib' if (defined($ENV{'WCECOMPAT'}));
171 $ex_libs.=' $(PORTSDK_LIBPATH)/portlib.lib' if (defined($ENV{'PORTSDK_LIBPATH'}));
172 $ex_libs.=' /nodefaultlib:oldnames.lib coredll.lib corelibc.lib' if ($ENV{'TARGETCPU'} eq "X86");
173 }
174else
175 {
176 $ex_libs.=' gdi32.lib advapi32.lib crypt32.lib user32.lib';
177 $ex_libs.=' bufferoverflowu.lib' if ($FLAVOR =~ /WIN64/ and `cl 2>&1` =~ /14\.00\.4[0-9]{4}\./);
178 # WIN32 UNICODE build gets linked with unicows.lib for
179 # backward compatibility with Win9x.
180 $ex_libs="unicows.lib $ex_libs" if ($FLAVOR =~ /WIN32/ and $cflags =~ /\-DUNICODE/);
181 }
182
183# static library stuff
184$mklib='lib /nologo';
185$ranlib='';
186$plib="";
187$libp=".lib";
188$shlibp=($shlib)?".dll":".lib";
189$lfile='/out:';
190
191$shlib_ex_obj="";
192$app_ex_obj="setargv.obj" if ($FLAVOR !~ /CE/);
193if ($FLAVOR =~ /WIN64A/) {
194 if (`nasm -v 2>NUL` =~ /NASM version ([0-9]+\.[0-9]+)/ && $1 >= 2.0) {
195 $asm='nasm -f win64 -DNEAR -Ox -g';
196 $afile='-o ';
197 } else {
198 $asm='ml64 /c /Cp /Cx /Zi';
199 $afile='/Fo';
200 }
201} elsif ($FLAVOR =~ /WIN64I/) {
202 $asm='ias -d debug';
203 $afile="-o ";
204} elsif ($nasm) {
205 my $ver=`nasm -v 2>NUL`;
206 my $vew=`nasmw -v 2>NUL`;
207 # pick newest version
208 $asm=($ver ge $vew?"nasm":"nasmw")." -f win32";
209 $asmtype="win32n";
210 $afile='-o ';
211} else {
212 $asm='ml /nologo /Cp /coff /c /Cx /Zi';
213 $afile='/Fo';
214 $asmtype="win32";
215}
216
217$bn_asm_obj='';
218$bn_asm_src='';
219$des_enc_obj='';
220$des_enc_src='';
221$bf_enc_obj='';
222$bf_enc_src='';
223
224if (!$no_asm)
225 {
226 win32_import_asm($mf_bn_asm, "bn", \$bn_asm_obj, \$bn_asm_src);
227 win32_import_asm($mf_aes_asm, "aes", \$aes_asm_obj, \$aes_asm_src);
228 win32_import_asm($mf_des_asm, "des", \$des_enc_obj, \$des_enc_src);
229 win32_import_asm($mf_bf_asm, "bf", \$bf_enc_obj, \$bf_enc_src);
230 win32_import_asm($mf_cast_asm, "cast", \$cast_enc_obj, \$cast_enc_src);
231 win32_import_asm($mf_rc4_asm, "rc4", \$rc4_enc_obj, \$rc4_enc_src);
232 win32_import_asm($mf_rc5_asm, "rc5", \$rc5_enc_obj, \$rc5_enc_src);
233 win32_import_asm($mf_md5_asm, "md5", \$md5_asm_obj, \$md5_asm_src);
234 win32_import_asm($mf_sha_asm, "sha", \$sha1_asm_obj, \$sha1_asm_src);
235 win32_import_asm($mf_rmd_asm, "ripemd", \$rmd160_asm_obj, \$rmd160_asm_src);
236 win32_import_asm($mf_wp_asm, "whrlpool", \$whirlpool_asm_obj, \$whirlpool_asm_src);
237 win32_import_asm($mf_cpuid_asm, "", \$cpuid_asm_obj, \$cpuid_asm_src);
238 $perl_asm = 1;
239 }
240
241if ($shlib && $FLAVOR !~ /CE/)
242 {
243 $mlflags.=" $lflags /dll";
244 $lib_cflag.=" -D_WINDLL";
245 #
246 # Engage Applink...
247 #
248 $app_ex_obj.=" \$(OBJ_D)\\applink.obj /implib:\$(TMP_D)\\junk.lib";
249 $cflags.=" -DOPENSSL_USE_APPLINK -I.";
250 # I'm open for better suggestions than overriding $banner...
251 $banner=<<'___';
252 @echo Building OpenSSL
253
254$(OBJ_D)\applink.obj: ms\applink.c
255 $(CC) /Fo$(OBJ_D)\applink.obj $(APP_CFLAGS) -c ms\applink.c
256$(OBJ_D)\uplink.obj: ms\uplink.c ms\applink.c
257 $(CC) /Fo$(OBJ_D)\uplink.obj $(SHLIB_CFLAGS) -c ms\uplink.c
258$(INCO_D)\applink.c: ms\applink.c
259 $(CP) ms\applink.c $(INCO_D)\applink.c
260
261EXHEADER= $(EXHEADER) $(INCO_D)\applink.c
262
263LIBS_DEP=$(LIBS_DEP) $(OBJ_D)\applink.obj
264CRYPTOOBJ=$(OBJ_D)\uplink.obj $(CRYPTOOBJ)
265___
266 $banner.=<<'___' if ($FLAVOR =~ /WIN64/);
267CRYPTOOBJ=ms\uptable.obj $(CRYPTOOBJ)
268___
269 }
270elsif ($shlib && $FLAVOR =~ /CE/)
271 {
272 $mlflags.=" $lflags /dll";
273 $lflags.=' /entry:mainCRTstartup' if(defined($ENV{'PORTSDK_LIBPATH'}));
274 $lib_cflag.=" -D_WINDLL -D_DLL";
275 }
276
277sub do_lib_rule
278 {
279 my($objs,$target,$name,$shlib,$ign,$base_addr) = @_;
280 local($ret);
281
282 $taget =~ s/\//$o/g if $o ne '/';
283 my $base_arg;
284 if ($base_addr ne "")
285 {
286 $base_arg= " /base:$base_addr";
287 }
288 else
289 {
290 $base_arg = "";
291 }
292 if ($name ne "")
293 {
294 $name =~ tr/a-z/A-Z/;
295 $name = "/def:ms/${name}.def";
296 }
297
298# $target="\$(LIB_D)$o$target";
299# $ret.="$target: $objs\n";
300 if (!$shlib)
301 {
302# $ret.="\t\$(RM) \$(O_$Name)\n";
303 $ret.="$target: $objs\n";
304 $ret.="\t\$(MKLIB) $lfile$target @<<\n $objs\n<<\n";
305 }
306 else
307 {
308 local($ex)=($target =~ /O_CRYPTO/)?'':' $(L_CRYPTO)';
309 $ex.=" $zlib_lib" if $zlib_opt == 1 && $target =~ /O_CRYPTO/;
310
311 if ($fips && $target =~ /O_CRYPTO/)
312 {
313 $ret.="$target: $objs \$(PREMAIN_DSO_EXE)";
314 $ret.="\n\tSET FIPS_LINK=\$(LINK)\n";
315 $ret.="\tSET FIPS_CC=\$(CC)\n";
316 $ret.="\tSET FIPS_CC_ARGS=/Fo\$(OBJ_D)${o}fips_premain.obj \$(SHLIB_CFLAGS) -c\n";
317 $ret.="\tSET PREMAIN_DSO_EXE=\$(PREMAIN_DSO_EXE)\n";
318 $ret.="\tSET FIPS_SHA1_EXE=\$(FIPS_SHA1_EXE)\n";
319 $ret.="\tSET FIPS_TARGET=$target\n";
320 $ret.="\tSET FIPSLIB_D=\$(FIPSLIB_D)\n";
321 $ret.="\t\$(FIPSLINK) \$(MLFLAGS) /map $base_arg $efile$target ";
322 $ret.="$name @<<\n \$(SHLIB_EX_OBJ) $objs \$(EX_LIBS) ";
323 $ret.="\$(OBJ_D)${o}fips_premain.obj $ex\n<<\n";
324 }
325 else
326 {
327 $ret.="$target: $objs";
328 $ret.="\n\t\$(LINK) \$(MLFLAGS) $efile$target $name @<<\n \$(SHLIB_EX_OBJ) $objs $ex \$(EX_LIBS)\n<<\n";
329 }
330 $ret.="\tIF EXIST \$@.manifest mt -nologo -manifest \$@.manifest -outputresource:\$@;2\n\n";
331 }
332 $ret.="\n";
333 return($ret);
334 }
335
336sub do_link_rule
337 {
338 my($target,$files,$dep_libs,$libs,$standalone)=@_;
339 local($ret,$_);
340 $file =~ s/\//$o/g if $o ne '/';
341 $n=&bname($targer);
342 $ret.="$target: $files $dep_libs\n";
343 if ($standalone == 1)
344 {
345 $ret.=" \$(LINK) \$(LFLAGS) $efile$target @<<\n\t";
346 $ret.= "\$(EX_LIBS) " if ($files =~ /O_FIPSCANISTER/ && !$fipscanisterbuild);
347 $ret.="$files $libs\n<<\n";
348 }
349 elsif ($standalone == 2)
350 {
351 $ret.="\tSET FIPS_LINK=\$(LINK)\n";
352 $ret.="\tSET FIPS_CC=\$(CC)\n";
353 $ret.="\tSET FIPS_CC_ARGS=/Fo\$(OBJ_D)${o}fips_premain.obj \$(SHLIB_CFLAGS) -c\n";
354 $ret.="\tSET PREMAIN_DSO_EXE=\n";
355 $ret.="\tSET FIPS_TARGET=$target\n";
356 $ret.="\tSET FIPS_SHA1_EXE=\$(FIPS_SHA1_EXE)\n";
357 $ret.="\tSET FIPSLIB_D=\$(FIPSLIB_D)\n";
358 $ret.="\t\$(FIPSLINK) \$(LFLAGS) /map $efile$target @<<\n";
359 $ret.="\t\$(APP_EX_OBJ) $files \$(OBJ_D)${o}fips_premain.obj $libs\n<<\n";
360 }
361 else
362 {
363 $ret.="\t\$(LINK) \$(LFLAGS) $efile$target @<<\n";
364 $ret.="\t\$(APP_EX_OBJ) $files $libs\n<<\n";
365 }
366 $ret.="\tIF EXIST \$@.manifest mt -nologo -manifest \$@.manifest -outputresource:\$@;1\n\n";
367 return($ret);
368 }
369
370sub win32_import_asm
371 {
372 my ($mf_var, $asm_name, $oref, $sref) = @_;
373 my $asm_dir;
374 if ($asm_name eq "")
375 {
376 $asm_dir = "crypto\\";
377 }
378 else
379 {
380 $asm_dir = "crypto\\$asm_name\\asm\\";
381 }
382
383 $$oref = "";
384 $mf_var =~ s/\.o$/.obj/g;
385
386 foreach (split(/ /, $mf_var))
387 {
388 $$oref .= $asm_dir . $_ . " ";
389 }
390 $$oref =~ s/ $//;
391 $$sref = $$oref;
392 $$sref =~ s/\.obj/.asm/g;
393
394 }
395
396
3971;
diff --git a/src/lib/libcrypto/util/pl/linux.pl b/src/lib/libcrypto/util/pl/linux.pl
new file mode 100644
index 0000000000..d24f7b7291
--- /dev/null
+++ b/src/lib/libcrypto/util/pl/linux.pl
@@ -0,0 +1,104 @@
1#!/usr/local/bin/perl
2#
3# linux.pl - the standard unix makefile stuff.
4#
5
6$o='/';
7$cp='/bin/cp';
8$rm='/bin/rm -f';
9
10# C compiler stuff
11
12$cc='gcc';
13if ($debug)
14 { $cflags="-g2 -ggdb -DREF_CHECK -DCRYPTO_MDEBUG"; }
15elsif ($profile)
16 { $cflags="-pg -O3"; }
17else
18 { $cflags="-O3 -fomit-frame-pointer"; }
19
20if (!$no_asm)
21 {
22 $bn_asm_obj='$(OBJ_D)/bn86-elf.o';
23 $bn_asm_src='crypto/bn/asm/bn86unix.cpp';
24 $bnco_asm_obj='$(OBJ_D)/co86-elf.o';
25 $bnco_asm_src='crypto/bn/asm/co86unix.cpp';
26 $des_enc_obj='$(OBJ_D)/dx86-elf.o $(OBJ_D)/yx86-elf.o';
27 $des_enc_src='crypto/des/asm/dx86unix.cpp crypto/des/asm/yx86unix.cpp';
28 $bf_enc_obj='$(OBJ_D)/bx86-elf.o';
29 $bf_enc_src='crypto/bf/asm/bx86unix.cpp';
30 $cast_enc_obj='$(OBJ_D)/cx86-elf.o';
31 $cast_enc_src='crypto/cast/asm/cx86unix.cpp';
32 $rc4_enc_obj='$(OBJ_D)/rx86-elf.o';
33 $rc4_enc_src='crypto/rc4/asm/rx86unix.cpp';
34 $rc5_enc_obj='$(OBJ_D)/r586-elf.o';
35 $rc5_enc_src='crypto/rc5/asm/r586unix.cpp';
36 $md5_asm_obj='$(OBJ_D)/mx86-elf.o';
37 $md5_asm_src='crypto/md5/asm/mx86unix.cpp';
38 $rmd160_asm_obj='$(OBJ_D)/rm86-elf.o';
39 $rmd160_asm_src='crypto/ripemd/asm/rm86unix.cpp';
40 $sha1_asm_obj='$(OBJ_D)/sx86-elf.o';
41 $sha1_asm_src='crypto/sha/asm/sx86unix.cpp';
42 $cflags.=" -DBN_ASM -DMD5_ASM -DSHA1_ASM -DOPENSSL_BN_ASM_PART_WORDS";
43 }
44
45$cflags.=" -DTERMIO -DL_ENDIAN -m486 -Wall";
46
47if ($shlib)
48 {
49 $shl_cflag=" -DPIC -fpic";
50 $shlibp=".so.$ssl_version";
51 $so_shlibp=".so";
52 }
53
54sub do_shlib_rule
55 {
56 local($obj,$target,$name,$shlib,$so_name)=@_;
57 local($ret,$_,$Name);
58
59 $target =~ s/\//$o/g if $o ne '/';
60 ($Name=$name) =~ tr/a-z/A-Z/;
61
62 $ret.="$target: \$(${Name}OBJ)\n";
63 $ret.="\t\$(RM) target\n";
64 $ret.="\tgcc \${CFLAGS} -shared -Wl,-soname,$target -o $target \$(${Name}OBJ)\n";
65 ($t=$target) =~ s/(^.*)\/[^\/]*$/$1/;
66 if ($so_name ne "")
67 {
68 $ret.="\t\$(RM) \$(LIB_D)$o$so_name\n";
69 $ret.="\tln -s $target \$(LIB_D)$o$so_name\n\n";
70 }
71 }
72
73sub do_link_rule
74 {
75 local($target,$files,$dep_libs,$libs)=@_;
76 local($ret,$_);
77
78 $file =~ s/\//$o/g if $o ne '/';
79 $n=&bname($target);
80 $ret.="$target: $files $dep_libs\n";
81 $ret.="\t\$(LINK) ${efile}$target \$(LFLAGS) $files $libs\n\n";
82 return($ret);
83 }
84
85sub do_asm_rule
86 {
87 local($target,$src)=@_;
88 local($ret,@s,@t,$i);
89
90 $target =~ s/\//$o/g if $o ne "/";
91 $src =~ s/\//$o/g if $o ne "/";
92
93 @s=split(/\s+/,$src);
94 @t=split(/\s+/,$target);
95
96 for ($i=0; $i<=$#s; $i++)
97 {
98 $ret.="$t[$i]: $s[$i]\n";
99 $ret.="\tgcc -E -DELF \$(SRC_D)$o$s[$i]|\$(AS) $afile$t[$i]\n\n";
100 }
101 return($ret);
102 }
103
1041;
diff --git a/src/lib/libcrypto/util/pl/netware.pl b/src/lib/libcrypto/util/pl/netware.pl
new file mode 100644
index 0000000000..c78bcfc874
--- /dev/null
+++ b/src/lib/libcrypto/util/pl/netware.pl
@@ -0,0 +1,532 @@
1# Metrowerks Codewarrior or gcc / nlmconv for NetWare
2#
3
4$version_header = "crypto/opensslv.h";
5open(IN, "$version_header") or die "Couldn't open $version_header: $!";
6while (<IN>) {
7 if (/^#define[\s\t]+OPENSSL_VERSION_NUMBER[\s\t]+0x(\d)(\d{2})(\d{2})(\d{2})/)
8 {
9 # die "OpenSSL version detected: $1.$2.$3.$4\n";
10 #$nlmvernum = "$1,$2,$3";
11 $nlmvernum = "$1,".($2*10+$3).",".($4*1);
12 #$nlmverstr = "$1.".($2*1).".".($3*1).($4?(chr(96+$4)):"");
13 break;
14 }
15}
16close(IN) or die "Couldn't close $version_header: $!";
17
18$readme_file = "README";
19open(IN, $readme_file) or die "Couldn't open $readme_file: $!";
20while (<IN>) {
21 if (/^[\s\t]+OpenSSL[\s\t]+(\d)\.(\d{1,2})\.(\d{1,2})([a-z])(.*)/)
22 {
23 #$nlmvernum = "$1,$2,$3";
24 #$nlmvernum = "$1,".($2*10+$3).",".($4*1);
25 $nlmverstr = "$1.$2.$3$4$5";
26 }
27 elsif (/^[\s\t]+(Copyright \(c\) \d{4}\-\d{4} The OpenSSL Project)$/)
28 {
29 $nlmcpystr = $1;
30 }
31 break if ($nlmvernum && $nlmcpystr);
32}
33close(IN) or die "Couldn't close $readme_file: $!";
34
35# Define stacksize here
36$nlmstack = "32768";
37
38# some default settings here in case we failed to find them in README
39$nlmvernum = "1,0,0" if (!$nlmvernum);
40$nlmverstr = "OpenSSL" if (!$nlmverstr);
41$nlmcpystr = "Copyright (c) 1998-now The OpenSSL Project" if (!$nlmcpystr);
42
43# die "OpenSSL copyright: $nlmcpystr\nOpenSSL verstring: $nlmverstr\nOpenSSL vernumber: $nlmvernum\n";
44
45# The import files and other misc imports needed to link
46@misc_imports = ("GetProcessSwitchCount", "RunningProcess",
47 "GetSuperHighResolutionTimer");
48if ($LIBC)
49{
50 @import_files = ("libc.imp");
51 @module_files = ("libc");
52 $libarch = "LIBC";
53}
54else
55{
56 # clib build
57 @import_files = ("clib.imp");
58 push(@import_files, "socklib.imp") if ($BSDSOCK);
59 @module_files = ("clib");
60 # push(@misc_imports, "_rt_modu64%16", "_rt_divu64%16");
61 $libarch = "CLIB";
62}
63if ($BSDSOCK)
64{
65 $libarch .= "-BSD";
66}
67else
68{
69 $libarch .= "-WS2";
70 push(@import_files, "ws2nlm.imp");
71}
72
73# The "IMPORTS" environment variable must be set and point to the location
74# where import files (*.imp) can be found.
75# Example: set IMPORTS=c:\ndk\nwsdk\imports
76$import_path = $ENV{"IMPORTS"} || die ("IMPORTS environment variable not set\n");
77
78
79# The "PRELUDE" environment variable must be set and point to the location
80# and name of the prelude source to link with ( nwpre.obj is recommended ).
81# Example: set PRELUDE=c:\codewar\novell support\metrowerks support\libraries\runtime\nwpre.obj
82$prelude = $ENV{"PRELUDE"} || die ("PRELUDE environment variable not set\n");
83
84# The "INCLUDES" environment variable must be set and point to the location
85# where import files (*.imp) can be found.
86$include_path = $ENV{"INCLUDE"} || die ("INCLUDES environment variable not set\n");
87$include_path =~ s/\\/\//g;
88$include_path = join(" -I", split(/;/, $include_path));
89
90# check for gcc compiler
91$gnuc = $ENV{"GNUC"};
92
93#$ssl= "ssleay32";
94#$crypto="libeay32";
95
96if ($gnuc)
97{
98 # C compiler
99 $cc='gcc';
100 # Linker
101 $link='nlmconv';
102 # librarian
103 $mklib='ar';
104 $o='/';
105 # cp command
106 $cp='cp -af';
107 # rm command
108 $rm='rm -f';
109 # mv command
110 $mv='mv -f';
111 # mkdir command
112 $mkdir='gmkdir';
113 #$ranlib='ranlib';
114}
115else
116{
117 # C compiler
118 $cc='mwccnlm';
119 # Linker
120 $link='mwldnlm';
121 # librarian
122 $mklib='mwldnlm';
123 # Path separator
124 $o='\\';
125 # cp command
126 $cp='copy >nul:';
127 # rm command
128 $rm='del /f /q';
129}
130
131# assembler
132if ($nw_nasm)
133{
134 $asm=(`nasm -v 2>NUL` gt `nasmw -v 2>NUL`?"nasm":"nasmw");
135 if ($gnuc)
136 {
137 $asm.=" -s -f elf";
138 }
139 else
140 {
141 $asm.=" -s -f coff -d __coff__";
142 }
143 $afile="-o ";
144 $asm.=" -g" if $debug;
145}
146elsif ($nw_mwasm)
147{
148 $asm="mwasmnlm -maxerrors 20";
149 $afile="-o ";
150 $asm.=" -g" if $debug;
151}
152elsif ($nw_masm)
153{
154# masm assembly settings - it should be possible to use masm but haven't
155# got it working.
156# $asm='ml /Cp /coff /c /Cx';
157# $asm.=" /Zi" if $debug;
158# $afile='/Fo';
159 die("Support for masm assembler not yet functional\n");
160}
161else
162{
163 $asm="";
164 $afile="";
165}
166
167
168
169if ($gnuc)
170{
171 # compile flags for GNUC
172 # additional flags based upon debug | non-debug
173 if ($debug)
174 {
175 $cflags="-g -DDEBUG";
176 }
177 else
178 {
179 $cflags="-O2";
180 }
181 $cflags.=" -nostdinc -I$include_path \\
182 -fno-builtin -fpcc-struct-return -fno-strict-aliasing \\
183 -funsigned-char -Wall -Wno-unused -Wno-uninitialized";
184
185 # link flags
186 $lflags="-T";
187}
188else
189{
190 # compile flags for CodeWarrior
191 # additional flags based upon debug | non-debug
192 if ($debug)
193 {
194 $cflags="-opt off -g -sym internal -DDEBUG";
195 }
196 else
197 {
198 # CodeWarrior compiler has a problem with optimizations for floating
199 # points - no optimizations until further investigation
200 # $cflags="-opt all";
201 }
202
203 # NOTES: Several c files in the crypto subdirectory include headers from
204 # their local directories. Metrowerks wouldn't find these h files
205 # without adding individual include directives as compile flags
206 # or modifying the c files. Instead of adding individual include
207 # paths for each subdirectory a recursive include directive
208 # is used ( -ir crypto ).
209 #
210 # A similar issue exists for the engines and apps subdirectories.
211 #
212 # Turned off the "possible" warnings ( -w nopossible ). Metrowerks
213 # complained a lot about various stuff. May want to turn back
214 # on for further development.
215 $cflags.=" -nostdinc -ir crypto -ir engines -ir apps -I$include_path \\
216 -msgstyle gcc -align 4 -processor pentium -char unsigned \\
217 -w on -w nolargeargs -w nopossible -w nounusedarg -w nounusedexpr \\
218 -w noimplicitconv -relax_pointers -nosyspath -maxerrors 20";
219
220 # link flags
221 $lflags="-msgstyle gcc -zerobss -nostdlib -sym internal -commandfile";
222}
223
224# common defines
225$cflags.=" -DL_ENDIAN -DOPENSSL_SYSNAME_NETWARE -U_WIN32";
226
227# If LibC build add in NKS_LIBC define and set the entry/exit
228# routines - The default entry/exit routines are for CLib and don't exist
229# in LibC
230if ($LIBC)
231{
232 $cflags.=" -DNETWARE_LIBC";
233 $nlmstart = "_LibCPrelude";
234 $nlmexit = "_LibCPostlude";
235 @nlm_flags = ("pseudopreemption", "flag_on 64");
236}
237else
238{
239 $cflags.=" -DNETWARE_CLIB";
240 $nlmstart = "_Prelude";
241 $nlmexit = "_Stop";
242}
243
244# If BSD Socket support is requested, set a define for the compiler
245if ($BSDSOCK)
246{
247 $cflags.=" -DNETWARE_BSDSOCK";
248 if (!$LIBC)
249 {
250 $cflags.=" -DNETDB_USE_INTERNET";
251 }
252}
253
254
255# linking stuff
256# for the output directories use the mk1mf.pl values with "_nw" appended
257if ($shlib)
258{
259 if ($LIBC)
260 {
261 $out_def.="_nw_libc_nlm";
262 $tmp_def.="_nw_libc_nlm";
263 $inc_def.="_nw_libc_nlm";
264 }
265 else # NETWARE_CLIB
266 {
267 $out_def.="_nw_clib_nlm";
268 $tmp_def.="_nw_clib_nlm";
269 $inc_def.="_nw_clib_nlm";
270 }
271}
272else
273{
274 if ($gnuc) # GNUC Tools
275 {
276 $libp=".a";
277 $shlibp=".a";
278 $lib_flags="-cr";
279 }
280 else # CodeWarrior
281 {
282 $libp=".lib";
283 $shlibp=".lib";
284 $lib_flags="-nodefaults -type library -o";
285 }
286 if ($LIBC)
287 {
288 $out_def.="_nw_libc";
289 $tmp_def.="_nw_libc";
290 $inc_def.="_nw_libc";
291 }
292 else # NETWARE_CLIB
293 {
294 $out_def.="_nw_clib";
295 $tmp_def.="_nw_clib";
296 $inc_def.="_nw_clib";
297 }
298}
299
300# used by mk1mf.pl
301$obj='.o';
302$ofile='-o ';
303$efile='';
304$exep='.nlm';
305$ex_libs='';
306
307if (!$no_asm)
308{
309 $bn_asm_obj="\$(OBJ_D)${o}bn-nw${obj}";
310 $bn_asm_src="crypto${o}bn${o}asm${o}bn-nw.asm";
311 $bnco_asm_obj="\$(OBJ_D)${o}co-nw${obj}";
312 $bnco_asm_src="crypto${o}bn${o}asm${o}co-nw.asm";
313 $aes_asm_obj="\$(OBJ_D)${o}a-nw${obj}";
314 $aes_asm_src="crypto${o}aes${o}asm${o}a-nw.asm";
315 $des_enc_obj="\$(OBJ_D)${o}d-nw${obj} \$(OBJ_D)${o}y-nw${obj}";
316 $des_enc_src="crypto${o}des${o}asm${o}d-nw.asm crypto${o}des${o}asm${o}y-nw.asm";
317 $bf_enc_obj="\$(OBJ_D)${o}b-nw${obj}";
318 $bf_enc_src="crypto${o}bf${o}asm${o}b-nw.asm";
319 $cast_enc_obj="\$(OBJ_D)${o}c-nw${obj}";
320 $cast_enc_src="crypto${o}cast${o}asm${o}c-nw.asm";
321 $rc4_enc_obj="\$(OBJ_D)${o}r4-nw${obj}";
322 $rc4_enc_src="crypto${o}rc4${o}asm${o}r4-nw.asm";
323 $rc5_enc_obj="\$(OBJ_D)${o}r5-nw${obj}";
324 $rc5_enc_src="crypto${o}rc5${o}asm${o}r5-nw.asm";
325 $md5_asm_obj="\$(OBJ_D)${o}m5-nw${obj}";
326 $md5_asm_src="crypto${o}md5${o}asm${o}m5-nw.asm";
327 $sha1_asm_obj="\$(OBJ_D)${o}s1-nw${obj} \$(OBJ_D)${o}sha256-nw${obj} \$(OBJ_D)${o}sha512-nw${obj}";
328 $sha1_asm_src="crypto${o}sha${o}asm${o}s1-nw.asm crypto${o}sha${o}asm${o}sha256-nw.asm crypto${o}sha${o}asm${o}sha512-nw.asm";
329 $rmd160_asm_obj="\$(OBJ_D)${o}rm-nw${obj}";
330 $rmd160_asm_src="crypto${o}ripemd${o}asm${o}rm-nw.asm";
331 $whirlpool_asm_obj="\$(OBJ_D)${o}wp-nw${obj}";
332 $whirlpool_asm_src="crypto${o}whrlpool${o}asm${o}wp-nw.asm";
333 $cpuid_asm_obj="\$(OBJ_D)${o}x86cpuid-nw${obj}";
334 $cpuid_asm_src="crypto${o}x86cpuid-nw.asm";
335 $cflags.=" -DOPENSSL_CPUID_OBJ -DBN_ASM -DOPENSSL_BN_ASM_PART_WORDS -DMD5_ASM -DWHIRLPOOL_ASM";
336 $cflags.=" -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM";
337 $cflags.=" -DAES_ASM -DRMD160_ASM";
338}
339else
340{
341 $bn_asm_obj='';
342 $bn_asm_src='';
343 $bnco_asm_obj='';
344 $bnco_asm_src='';
345 $aes_asm_obj='';
346 $aes_asm_src='';
347 $des_enc_obj='';
348 $des_enc_src='';
349 $bf_enc_obj='';
350 $bf_enc_src='';
351 $cast_enc_obj='';
352 $cast_enc_src='';
353 $rc4_enc_obj='';
354 $rc4_enc_src='';
355 $rc5_enc_obj='';
356 $rc5_enc_src='';
357 $md5_asm_obj='';
358 $md5_asm_src='';
359 $sha1_asm_obj='';
360 $sha1_asm_src='';
361 $rmd160_asm_obj='';
362 $rmd160_asm_src='';
363 $whirlpool_asm_obj='';
364 $whirlpool_asm_src='';
365 $cpuid_asm_obj='';
366 $cpuid_asm_src='';
367}
368
369# create the *.def linker command files in \openssl\netware\ directory
370sub do_def_file
371{
372 # strip off the leading path
373 my($target) = bname(shift);
374 my($i);
375
376 if ($target =~ /(.*).nlm/)
377 {
378 $target = $1;
379 }
380
381 # special case for openssl - the mk1mf.pl defines E_EXE = openssl
382 if ($target =~ /E_EXE/)
383 {
384 $target =~ s/\$\(E_EXE\)/openssl/;
385 }
386
387 # Note: originally tried to use full path ( \openssl\netware\$target.def )
388 # Metrowerks linker choked on this with an assertion failure. bug???
389 #
390 my($def_file) = "netware${o}$target.def";
391
392 open(DEF_OUT, ">$def_file") || die("unable to open file $def_file\n");
393
394 print( DEF_OUT "# command file generated by netware.pl for NLM target.\n" );
395 print( DEF_OUT "# do not edit this file - all your changes will be lost!!\n" );
396 print( DEF_OUT "#\n");
397 print( DEF_OUT "DESCRIPTION \"$target ($libarch) - OpenSSL $nlmverstr\"\n");
398 print( DEF_OUT "COPYRIGHT \"$nlmcpystr\"\n");
399 print( DEF_OUT "VERSION $nlmvernum\n");
400 print( DEF_OUT "STACK $nlmstack\n");
401 print( DEF_OUT "START $nlmstart\n");
402 print( DEF_OUT "EXIT $nlmexit\n");
403
404 # special case for openssl
405 if ($target eq "openssl")
406 {
407 print( DEF_OUT "SCREENNAME \"OpenSSL $nlmverstr\"\n");
408 }
409 else
410 {
411 print( DEF_OUT "SCREENNAME \"DEFAULT\"\n");
412 }
413
414 foreach $i (@misc_imports)
415 {
416 print( DEF_OUT "IMPORT $i\n");
417 }
418
419 foreach $i (@import_files)
420 {
421 print( DEF_OUT "IMPORT \@$import_path${o}$i\n");
422 }
423
424 foreach $i (@module_files)
425 {
426 print( DEF_OUT "MODULE $i\n");
427 }
428
429 foreach $i (@nlm_flags)
430 {
431 print( DEF_OUT "$i\n");
432 }
433
434 if ($gnuc)
435 {
436 if ($target =~ /openssl/)
437 {
438 print( DEF_OUT "INPUT ${tmp_def}${o}openssl${obj}\n");
439 print( DEF_OUT "INPUT ${tmp_def}${o}openssl${libp}\n");
440 }
441 else
442 {
443 print( DEF_OUT "INPUT ${tmp_def}${o}${target}${obj}\n");
444 }
445 print( DEF_OUT "INPUT $prelude\n");
446 print( DEF_OUT "INPUT ${out_def}${o}${ssl}${libp} ${out_def}${o}${crypto}${libp}\n");
447 print( DEF_OUT "OUTPUT $target.nlm\n");
448 }
449
450 close(DEF_OUT);
451 return($def_file);
452}
453
454sub do_lib_rule
455{
456 my($objs,$target,$name,$shlib)=@_;
457 my($ret);
458
459 $ret.="$target: $objs\n";
460 if (!$shlib)
461 {
462 $ret.="\t\@echo Building Lib: $name\n";
463 $ret.="\t\$(MKLIB) $lib_flags $target $objs\n";
464 $ret.="\t\@echo .\n"
465 }
466 else
467 {
468 die( "Building as NLM not currently supported!" );
469 }
470
471 $ret.="\n";
472 return($ret);
473}
474
475sub do_link_rule
476{
477 my($target,$files,$dep_libs,$libs)=@_;
478 my($ret);
479 my($def_file) = do_def_file($target);
480
481 $ret.="$target: $files $dep_libs\n";
482
483 # NOTE: When building the test nlms no screen name is given
484 # which causes the console screen to be used. By using the console
485 # screen there is no "<press any key to continue>" message which
486 # requires user interaction. The test script ( do_tests.pl ) needs
487 # to be able to run the tests without requiring user interaction.
488 #
489 # However, the sample program "openssl.nlm" is used by the tests and is
490 # a interactive sample so a screen is desired when not be run by the
491 # tests. To solve the problem, two versions of the program are built:
492 # openssl2 - no screen used by tests
493 # openssl - default screen - use for normal interactive modes
494 #
495
496 # special case for openssl - the mk1mf.pl defines E_EXE = openssl
497 if ($target =~ /E_EXE/)
498 {
499 my($target2) = $target;
500
501 $target2 =~ s/\(E_EXE\)/\(E_EXE\)2/;
502
503 # openssl2
504 my($def_file2) = do_def_file($target2);
505
506 if ($gnuc)
507 {
508 $ret.="\t\$(MKLIB) $lib_flags \$(TMP_D)${o}\$(E_EXE).a \$(filter-out \$(TMP_D)${o}\$(E_EXE)${obj},$files)\n";
509 $ret.="\t\$(LINK) \$(LFLAGS) $def_file2\n";
510 $ret.="\t\@$mv \$(E_EXE)2.nlm \$(TEST_D)\n";
511 }
512 else
513 {
514 $ret.="\t\$(LINK) \$(LFLAGS) $def_file2 $files \"$prelude\" $libs -o $target2\n";
515 }
516 }
517 if ($gnuc)
518 {
519 $ret.="\t\$(LINK) \$(LFLAGS) $def_file\n";
520 $ret.="\t\@$mv \$(\@F) \$(TEST_D)\n";
521 }
522 else
523 {
524 $ret.="\t\$(LINK) \$(LFLAGS) $def_file $files \"$prelude\" $libs -o $target\n";
525 }
526
527 $ret.="\n";
528 return($ret);
529
530}
531
5321;
diff --git a/src/lib/libcrypto/util/pl/ultrix.pl b/src/lib/libcrypto/util/pl/ultrix.pl
new file mode 100644
index 0000000000..ea370c71f9
--- /dev/null
+++ b/src/lib/libcrypto/util/pl/ultrix.pl
@@ -0,0 +1,38 @@
1#!/usr/local/bin/perl
2#
3# linux.pl - the standard unix makefile stuff.
4#
5
6$o='/';
7$cp='/bin/cp';
8$rm='/bin/rm -f';
9
10# C compiler stuff
11
12$cc='cc';
13if ($debug)
14 { $cflags="-g -DREF_CHECK -DCRYPTO_MDEBUG"; }
15else
16 { $cflags="-O2"; }
17
18$cflags.=" -std1 -DL_ENDIAN";
19
20if (!$no_asm)
21 {
22 $bn_asm_obj='$(OBJ_D)/mips1.o';
23 $bn_asm_src='crypto/bn/asm/mips1.s';
24 }
25
26sub do_link_rule
27 {
28 local($target,$files,$dep_libs,$libs)=@_;
29 local($ret,$_);
30
31 $file =~ s/\//$o/g if $o ne '/';
32 $n=&bname($target);
33 $ret.="$target: $files $dep_libs\n";
34 $ret.="\t\$(LINK) ${efile}$target \$(LFLAGS) $files $libs\n\n";
35 return($ret);
36 }
37
381;
diff --git a/src/lib/libcrypto/util/pl/unix.pl b/src/lib/libcrypto/util/pl/unix.pl
new file mode 100644
index 0000000000..146611ad99
--- /dev/null
+++ b/src/lib/libcrypto/util/pl/unix.pl
@@ -0,0 +1,96 @@
1#!/usr/local/bin/perl
2#
3# unix.pl - the standard unix makefile stuff.
4#
5
6$o='/';
7$cp='/bin/cp';
8$rm='/bin/rm -f';
9
10# C compiler stuff
11
12if ($gcc)
13 {
14 $cc='gcc';
15 if ($debug)
16 { $cflags="-g2 -ggdb"; }
17 else
18 { $cflags="-O3 -fomit-frame-pointer"; }
19 }
20else
21 {
22 $cc='cc';
23 if ($debug)
24 { $cflags="-g"; }
25 else
26 { $cflags="-O"; }
27 }
28$obj='.o';
29$ofile='-o ';
30
31# EXE linking stuff
32$link='${CC}';
33$lflags='${CFLAGS}';
34$efile='-o ';
35$exep='';
36$ex_libs="";
37
38# static library stuff
39$mklib='ar r';
40$mlflags='';
41$ranlib=&which("ranlib") or $ranlib="true";
42$plib='lib';
43$libp=".a";
44$shlibp=".a";
45$lfile='';
46
47$asm='as';
48$afile='-o ';
49$bn_asm_obj="";
50$bn_asm_src="";
51$des_enc_obj="";
52$des_enc_src="";
53$bf_enc_obj="";
54$bf_enc_src="";
55
56sub do_lib_rule
57 {
58 local($obj,$target,$name,$shlib)=@_;
59 local($ret,$_,$Name);
60
61 $target =~ s/\//$o/g if $o ne '/';
62 $target="$target";
63 ($Name=$name) =~ tr/a-z/A-Z/;
64
65 $ret.="$target: \$(${Name}OBJ)\n";
66 $ret.="\t\$(RM) $target\n";
67 $ret.="\t\$(MKLIB) $target \$(${Name}OBJ)\n";
68 $ret.="\t\$(RANLIB) $target\n\n";
69 }
70
71sub do_link_rule
72 {
73 local($target,$files,$dep_libs,$libs)=@_;
74 local($ret,$_);
75
76 $file =~ s/\//$o/g if $o ne '/';
77 $n=&bname($target);
78 $ret.="$target: $files $dep_libs\n";
79 $ret.="\t\$(LINK) ${efile}$target \$(LFLAGS) $files $libs\n\n";
80 return($ret);
81 }
82
83sub which
84 {
85 my ($name)=@_;
86 my $path;
87 foreach $path (split /:/, $ENV{PATH})
88 {
89 if (-x "$path/$name")
90 {
91 return "$path/$name";
92 }
93 }
94 }
95
961;
diff --git a/src/lib/libcrypto/util/pod2man.pl b/src/lib/libcrypto/util/pod2man.pl
new file mode 100644
index 0000000000..025d914f2e
--- /dev/null
+++ b/src/lib/libcrypto/util/pod2man.pl
@@ -0,0 +1,1184 @@
1: #!/usr/bin/perl-5.005
2 eval 'exec /usr/bin/perl -S $0 ${1+"$@"}'
3 if $running_under_some_shell;
4
5$DEF_PM_SECTION = '3pm' || '3';
6
7=head1 NAME
8
9pod2man - translate embedded Perl pod directives into man pages
10
11=head1 SYNOPSIS
12
13B<pod2man>
14[ B<--section=>I<manext> ]
15[ B<--release=>I<relpatch> ]
16[ B<--center=>I<string> ]
17[ B<--date=>I<string> ]
18[ B<--fixed=>I<font> ]
19[ B<--official> ]
20[ B<--lax> ]
21I<inputfile>
22
23=head1 DESCRIPTION
24
25B<pod2man> converts its input file containing embedded pod directives (see
26L<perlpod>) into nroff source suitable for viewing with nroff(1) or
27troff(1) using the man(7) macro set.
28
29Besides the obvious pod conversions, B<pod2man> also takes care of
30func(), func(n), and simple variable references like $foo or @bar so
31you don't have to use code escapes for them; complex expressions like
32C<$fred{'stuff'}> will still need to be escaped, though. Other nagging
33little roffish things that it catches include translating the minus in
34something like foo-bar, making a long dash--like this--into a real em
35dash, fixing up "paired quotes", putting a little space after the
36parens in something like func(), making C++ and PI look right, making
37double underbars have a little tiny space between them, making ALLCAPS
38a teeny bit smaller in troff(1), and escaping backslashes so you don't
39have to.
40
41=head1 OPTIONS
42
43=over 8
44
45=item center
46
47Set the centered header to a specific string. The default is
48"User Contributed Perl Documentation", unless the C<--official> flag is
49given, in which case the default is "Perl Programmers Reference Guide".
50
51=item date
52
53Set the left-hand footer string to this value. By default,
54the modification date of the input file will be used.
55
56=item fixed
57
58The fixed font to use for code refs. Defaults to CW.
59
60=item official
61
62Set the default header to indicate that this page is of
63the standard release in case C<--center> is not given.
64
65=item release
66
67Set the centered footer. By default, this is the current
68perl release.
69
70=item section
71
72Set the section for the C<.TH> macro. The standard conventions on
73sections are to use 1 for user commands, 2 for system calls, 3 for
74functions, 4 for devices, 5 for file formats, 6 for games, 7 for
75miscellaneous information, and 8 for administrator commands. This works
76best if you put your Perl man pages in a separate tree, like
77F</usr/local/perl/man/>. By default, section 1 will be used
78unless the file ends in F<.pm> in which case section 3 will be selected.
79
80=item lax
81
82Don't complain when required sections aren't present.
83
84=back
85
86=head1 Anatomy of a Proper Man Page
87
88For those not sure of the proper layout of a man page, here's
89an example of the skeleton of a proper man page. Head of the
90major headers should be setout as a C<=head1> directive, and
91are historically written in the rather startling ALL UPPER CASE
92format, although this is not mandatory.
93Minor headers may be included using C<=head2>, and are
94typically in mixed case.
95
96=over 10
97
98=item NAME
99
100Mandatory section; should be a comma-separated list of programs or
101functions documented by this podpage, such as:
102
103 foo, bar - programs to do something
104
105=item SYNOPSIS
106
107A short usage summary for programs and functions, which
108may someday be deemed mandatory.
109
110=item DESCRIPTION
111
112Long drawn out discussion of the program. It's a good idea to break this
113up into subsections using the C<=head2> directives, like
114
115 =head2 A Sample Subection
116
117 =head2 Yet Another Sample Subection
118
119=item OPTIONS
120
121Some people make this separate from the description.
122
123=item RETURN VALUE
124
125What the program or function returns if successful.
126
127=item ERRORS
128
129Exceptions, return codes, exit stati, and errno settings.
130
131=item EXAMPLES
132
133Give some example uses of the program.
134
135=item ENVIRONMENT
136
137Envariables this program might care about.
138
139=item FILES
140
141All files used by the program. You should probably use the FE<lt>E<gt>
142for these.
143
144=item SEE ALSO
145
146Other man pages to check out, like man(1), man(7), makewhatis(8), or catman(8).
147
148=item NOTES
149
150Miscellaneous commentary.
151
152=item CAVEATS
153
154Things to take special care with; sometimes called WARNINGS.
155
156=item DIAGNOSTICS
157
158All possible messages the program can print out--and
159what they mean.
160
161=item BUGS
162
163Things that are broken or just don't work quite right.
164
165=item RESTRICTIONS
166
167Bugs you don't plan to fix :-)
168
169=item AUTHOR
170
171Who wrote it (or AUTHORS if multiple).
172
173=item HISTORY
174
175Programs derived from other sources sometimes have this, or
176you might keep a modification log here.
177
178=back
179
180=head1 EXAMPLES
181
182 pod2man program > program.1
183 pod2man some_module.pm > /usr/perl/man/man3/some_module.3
184 pod2man --section=7 note.pod > note.7
185
186=head1 DIAGNOSTICS
187
188The following diagnostics are generated by B<pod2man>. Items
189marked "(W)" are non-fatal, whereas the "(F)" errors will cause
190B<pod2man> to immediately exit with a non-zero status.
191
192=over 4
193
194=item bad option in paragraph %d of %s: ``%s'' should be [%s]<%s>
195
196(W) If you start include an option, you should set it off
197as bold, italic, or code.
198
199=item can't open %s: %s
200
201(F) The input file wasn't available for the given reason.
202
203=item Improper man page - no dash in NAME header in paragraph %d of %s
204
205(W) The NAME header did not have an isolated dash in it. This is
206considered important.
207
208=item Invalid man page - no NAME line in %s
209
210(F) You did not include a NAME header, which is essential.
211
212=item roff font should be 1 or 2 chars, not `%s' (F)
213
214(F) The font specified with the C<--fixed> option was not
215a one- or two-digit roff font.
216
217=item %s is missing required section: %s
218
219(W) Required sections include NAME, DESCRIPTION, and if you're
220using a section starting with a 3, also a SYNOPSIS. Actually,
221not having a NAME is a fatal.
222
223=item Unknown escape: %s in %s
224
225(W) An unknown HTML entity (probably for an 8-bit character) was given via
226a C<EE<lt>E<gt>> directive. Besides amp, lt, gt, and quot, recognized
227entities are Aacute, aacute, Acirc, acirc, AElig, aelig, Agrave, agrave,
228Aring, aring, Atilde, atilde, Auml, auml, Ccedil, ccedil, Eacute, eacute,
229Ecirc, ecirc, Egrave, egrave, ETH, eth, Euml, euml, Iacute, iacute, Icirc,
230icirc, Igrave, igrave, Iuml, iuml, Ntilde, ntilde, Oacute, oacute, Ocirc,
231ocirc, Ograve, ograve, Oslash, oslash, Otilde, otilde, Ouml, ouml, szlig,
232THORN, thorn, Uacute, uacute, Ucirc, ucirc, Ugrave, ugrave, Uuml, uuml,
233Yacute, yacute, and yuml.
234
235=item Unmatched =back
236
237(W) You have a C<=back> without a corresponding C<=over>.
238
239=item Unrecognized pod directive: %s
240
241(W) You specified a pod directive that isn't in the known list of
242C<=head1>, C<=head2>, C<=item>, C<=over>, C<=back>, or C<=cut>.
243
244
245=back
246
247=head1 NOTES
248
249If you would like to print out a lot of man page continuously, you
250probably want to set the C and D registers to set contiguous page
251numbering and even/odd paging, at least on some versions of man(7).
252Settting the F register will get you some additional experimental
253indexing:
254
255 troff -man -rC1 -rD1 -rF1 perl.1 perldata.1 perlsyn.1 ...
256
257The indexing merely outputs messages via C<.tm> for each
258major page, section, subsection, item, and any C<XE<lt>E<gt>>
259directives.
260
261
262=head1 RESTRICTIONS
263
264None at this time.
265
266=head1 BUGS
267
268The =over and =back directives don't really work right. They
269take absolute positions instead of offsets, don't nest well, and
270making people count is suboptimal in any event.
271
272=head1 AUTHORS
273
274Original prototype by Larry Wall, but so massively hacked over by
275Tom Christiansen such that Larry probably doesn't recognize it anymore.
276
277=cut
278
279$/ = "";
280$cutting = 1;
281@Indices = ();
282
283# We try first to get the version number from a local binary, in case we're
284# running an installed version of Perl to produce documentation from an
285# uninstalled newer version's pod files.
286if ($^O ne 'plan9' and $^O ne 'dos' and $^O ne 'os2' and $^O ne 'MSWin32') {
287 my $perl = (-x './perl' && -f './perl' ) ?
288 './perl' :
289 ((-x '../perl' && -f '../perl') ?
290 '../perl' :
291 '');
292 ($version,$patch) = `$perl -e 'print $]'` =~ /^(\d\.\d{3})(\d{2})?/ if $perl;
293}
294# No luck; we'll just go with the running Perl's version
295($version,$patch) = $] =~ /^(.{5})(\d{2})?/ unless $version;
296$DEF_RELEASE = "perl $version";
297$DEF_RELEASE .= ", patch $patch" if $patch;
298
299
300sub makedate {
301 my $secs = shift;
302 my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($secs);
303 my $mname = (qw{Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec})[$mon];
304 $year += 1900;
305 return "$mday/$mname/$year";
306}
307
308use Getopt::Long;
309
310$DEF_SECTION = 1;
311$DEF_CENTER = "User Contributed Perl Documentation";
312$STD_CENTER = "Perl Programmers Reference Guide";
313$DEF_FIXED = 'CW';
314$DEF_LAX = 0;
315
316sub usage {
317 warn "$0: @_\n" if @_;
318 die <<EOF;
319usage: $0 [options] podpage
320Options are:
321 --section=manext (default "$DEF_SECTION")
322 --release=relpatch (default "$DEF_RELEASE")
323 --center=string (default "$DEF_CENTER")
324 --date=string (default "$DEF_DATE")
325 --fixed=font (default "$DEF_FIXED")
326 --official (default NOT)
327 --lax (default NOT)
328EOF
329}
330
331$uok = GetOptions( qw(
332 section=s
333 release=s
334 center=s
335 date=s
336 fixed=s
337 official
338 lax
339 help));
340
341$DEF_DATE = makedate((stat($ARGV[0]))[9] || time());
342
343usage("Usage error!") unless $uok;
344usage() if $opt_help;
345usage("Need one and only one podpage argument") unless @ARGV == 1;
346
347$section = $opt_section || ($ARGV[0] =~ /\.pm$/
348 ? $DEF_PM_SECTION : $DEF_SECTION);
349$RP = $opt_release || $DEF_RELEASE;
350$center = $opt_center || ($opt_official ? $STD_CENTER : $DEF_CENTER);
351$lax = $opt_lax || $DEF_LAX;
352
353$CFont = $opt_fixed || $DEF_FIXED;
354
355if (length($CFont) == 2) {
356 $CFont_embed = "\\f($CFont";
357}
358elsif (length($CFont) == 1) {
359 $CFont_embed = "\\f$CFont";
360}
361else {
362 die "roff font should be 1 or 2 chars, not `$CFont_embed'";
363}
364
365$date = $opt_date || $DEF_DATE;
366
367for (qw{NAME DESCRIPTION}) {
368# for (qw{NAME DESCRIPTION AUTHOR}) {
369 $wanna_see{$_}++;
370}
371$wanna_see{SYNOPSIS}++ if $section =~ /^3/;
372
373
374$name = @ARGV ? $ARGV[0] : "<STDIN>";
375$Filename = $name;
376if ($section =~ /^1/) {
377 require File::Basename;
378 $name = uc File::Basename::basename($name);
379}
380$name =~ s/\.(pod|p[lm])$//i;
381
382# Lose everything up to the first of
383# */lib/*perl* standard or site_perl module
384# */*perl*/lib from -D prefix=/opt/perl
385# */*perl*/ random module hierarchy
386# which works.
387$name =~ s-//+-/-g;
388if ($name =~ s-^.*?/lib/[^/]*perl[^/]*/--i
389 or $name =~ s-^.*?/[^/]*perl[^/]*/lib/--i
390 or $name =~ s-^.*?/[^/]*perl[^/]*/--i) {
391 # Lose ^site(_perl)?/.
392 $name =~ s-^site(_perl)?/--;
393 # Lose ^arch/. (XXX should we use Config? Just for archname?)
394 $name =~ s~^(.*-$^O|$^O-.*)/~~o;
395 # Lose ^version/.
396 $name =~ s-^\d+\.\d+/--;
397}
398
399# Translate Getopt/Long to Getopt::Long, etc.
400$name =~ s(/)(::)g;
401
402if ($name ne 'something') {
403 FCHECK: {
404 open(F, "< $ARGV[0]") || die "can't open $ARGV[0]: $!";
405 while (<F>) {
406 next unless /^=\b/;
407 if (/^=head1\s+NAME\s*$/) { # an /m would forgive mistakes
408 $_ = <F>;
409 unless (/\s*-+\s+/) {
410 $oops++;
411 warn "$0: Improper man page - no dash in NAME header in paragraph $. of $ARGV[0]\n"
412 } else {
413 my @n = split /\s+-+\s+/;
414 if (@n != 2) {
415 $oops++;
416 warn "$0: Improper man page - malformed NAME header in paragraph $. of $ARGV[0]\n"
417 }
418 else {
419 $n[0] =~ s/\n/ /g;
420 $n[1] =~ s/\n/ /g;
421 %namedesc = @n;
422 }
423 }
424 last FCHECK;
425 }
426 next if /^=cut\b/; # DB_File and Net::Ping have =cut before NAME
427 next if /^=pod\b/; # It is OK to have =pod before NAME
428 next if /^=(for|begin|end)\s+comment\b/; # It is OK to have =for =begin or =end comment before NAME
429 die "$0: Invalid man page - 1st pod line is not NAME in $ARGV[0]\n" unless $lax;
430 }
431 die "$0: Invalid man page - no documentation in $ARGV[0]\n" unless $lax;
432 }
433 close F;
434}
435
436print <<"END";
437.rn '' }`
438''' \$RCSfile\$\$Revision\$\$Date\$
439'''
440''' \$Log\$
441'''
442.de Sh
443.br
444.if t .Sp
445.ne 5
446.PP
447\\fB\\\\\$1\\fR
448.PP
449..
450.de Sp
451.if t .sp .5v
452.if n .sp
453..
454.de Ip
455.br
456.ie \\\\n(.\$>=3 .ne \\\\\$3
457.el .ne 3
458.IP "\\\\\$1" \\\\\$2
459..
460.de Vb
461.ft $CFont
462.nf
463.ne \\\\\$1
464..
465.de Ve
466.ft R
467
468.fi
469..
470'''
471'''
472''' Set up \\*(-- to give an unbreakable dash;
473''' string Tr holds user defined translation string.
474''' Bell System Logo is used as a dummy character.
475'''
476.tr \\(*W-|\\(bv\\*(Tr
477.ie n \\{\\
478.ds -- \\(*W-
479.ds PI pi
480.if (\\n(.H=4u)&(1m=24u) .ds -- \\(*W\\h'-12u'\\(*W\\h'-12u'-\\" diablo 10 pitch
481.if (\\n(.H=4u)&(1m=20u) .ds -- \\(*W\\h'-12u'\\(*W\\h'-8u'-\\" diablo 12 pitch
482.ds L" ""
483.ds R" ""
484''' \\*(M", \\*(S", \\*(N" and \\*(T" are the equivalent of
485''' \\*(L" and \\*(R", except that they are used on ".xx" lines,
486''' such as .IP and .SH, which do another additional levels of
487''' double-quote interpretation
488.ds M" """
489.ds S" """
490.ds N" """""
491.ds T" """""
492.ds L' '
493.ds R' '
494.ds M' '
495.ds S' '
496.ds N' '
497.ds T' '
498'br\\}
499.el\\{\\
500.ds -- \\(em\\|
501.tr \\*(Tr
502.ds L" ``
503.ds R" ''
504.ds M" ``
505.ds S" ''
506.ds N" ``
507.ds T" ''
508.ds L' `
509.ds R' '
510.ds M' `
511.ds S' '
512.ds N' `
513.ds T' '
514.ds PI \\(*p
515'br\\}
516END
517
518print <<'END';
519.\" If the F register is turned on, we'll generate
520.\" index entries out stderr for the following things:
521.\" TH Title
522.\" SH Header
523.\" Sh Subsection
524.\" Ip Item
525.\" X<> Xref (embedded
526.\" Of course, you have to process the output yourself
527.\" in some meaninful fashion.
528.if \nF \{
529.de IX
530.tm Index:\\$1\t\\n%\t"\\$2"
531..
532.nr % 0
533.rr F
534.\}
535END
536
537print <<"END";
538.TH $name $section "$RP" "$date" "$center"
539.UC
540END
541
542push(@Indices, qq{.IX Title "$name $section"});
543
544while (($name, $desc) = each %namedesc) {
545 for ($name, $desc) { s/^\s+//; s/\s+$//; }
546 push(@Indices, qq(.IX Name "$name - $desc"\n));
547}
548
549print <<'END';
550.if n .hy 0
551.if n .na
552.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
553.de CQ \" put $1 in typewriter font
554END
555print ".ft $CFont\n";
556print <<'END';
557'if n "\c
558'if t \\&\\$1\c
559'if n \\&\\$1\c
560'if n \&"
561\\&\\$2 \\$3 \\$4 \\$5 \\$6 \\$7
562'.ft R
563..
564.\" @(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2
565. \" AM - accent mark definitions
566.bd B 3
567. \" fudge factors for nroff and troff
568.if n \{\
569. ds #H 0
570. ds #V .8m
571. ds #F .3m
572. ds #[ \f1
573. ds #] \fP
574.\}
575.if t \{\
576. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
577. ds #V .6m
578. ds #F 0
579. ds #[ \&
580. ds #] \&
581.\}
582. \" simple accents for nroff and troff
583.if n \{\
584. ds ' \&
585. ds ` \&
586. ds ^ \&
587. ds , \&
588. ds ~ ~
589. ds ? ?
590. ds ! !
591. ds /
592. ds q
593.\}
594.if t \{\
595. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
596. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
597. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
598. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
599. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
600. ds ? \s-2c\h'-\w'c'u*7/10'\u\h'\*(#H'\zi\d\s+2\h'\w'c'u*8/10'
601. ds ! \s-2\(or\s+2\h'-\w'\(or'u'\v'-.8m'.\v'.8m'
602. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
603. ds q o\h'-\w'o'u*8/10'\s-4\v'.4m'\z\(*i\v'-.4m'\s+4\h'\w'o'u*8/10'
604.\}
605. \" troff and (daisy-wheel) nroff accents
606.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
607.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
608.ds v \\k:\h'-(\\n(.wu*9/10-\*(#H)'\v'-\*(#V'\*(#[\s-4v\s0\v'\*(#V'\h'|\\n:u'\*(#]
609.ds _ \\k:\h'-(\\n(.wu*9/10-\*(#H+(\*(#F*2/3))'\v'-.4m'\z\(hy\v'.4m'\h'|\\n:u'
610.ds . \\k:\h'-(\\n(.wu*8/10)'\v'\*(#V*4/10'\z.\v'-\*(#V*4/10'\h'|\\n:u'
611.ds 3 \*(#[\v'.2m'\s-2\&3\s0\v'-.2m'\*(#]
612.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
613.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
614.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
615.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
616.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
617.ds ae a\h'-(\w'a'u*4/10)'e
618.ds Ae A\h'-(\w'A'u*4/10)'E
619.ds oe o\h'-(\w'o'u*4/10)'e
620.ds Oe O\h'-(\w'O'u*4/10)'E
621. \" corrections for vroff
622.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
623.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
624. \" for low resolution devices (crt and lpr)
625.if \n(.H>23 .if \n(.V>19 \
626\{\
627. ds : e
628. ds 8 ss
629. ds v \h'-1'\o'\(aa\(ga'
630. ds _ \h'-1'^
631. ds . \h'-1'.
632. ds 3 3
633. ds o a
634. ds d- d\h'-1'\(ga
635. ds D- D\h'-1'\(hy
636. ds th \o'bp'
637. ds Th \o'LP'
638. ds ae ae
639. ds Ae AE
640. ds oe oe
641. ds Oe OE
642.\}
643.rm #[ #] #H #V #F C
644END
645
646$indent = 0;
647
648$begun = "";
649
650# Unrolling [^A-Z>]|[A-Z](?!<) gives: // MRE pp 165.
651my $nonest = '(?:[^A-Z>]*(?:[A-Z](?!<)[^A-Z>]*)*)';
652
653while (<>) {
654 if ($cutting) {
655 next unless /^=/;
656 $cutting = 0;
657 }
658 if ($begun) {
659 if (/^=end\s+$begun/) {
660 $begun = "";
661 }
662 elsif ($begun =~ /^(roff|man)$/) {
663 print STDOUT $_;
664 }
665 next;
666 }
667 chomp;
668
669 # Translate verbatim paragraph
670
671 if (/^\s/) {
672 @lines = split(/\n/);
673 for (@lines) {
674 1 while s
675 {^( [^\t]* ) \t ( \t* ) }
676 { $1 . ' ' x (8 - (length($1)%8) + 8 * (length($2))) }ex;
677 s/\\/\\e/g;
678 s/\A/\\&/s;
679 }
680 $lines = @lines;
681 makespace() unless $verbatim++;
682 print ".Vb $lines\n";
683 print join("\n", @lines), "\n";
684 print ".Ve\n";
685 $needspace = 0;
686 next;
687 }
688
689 $verbatim = 0;
690
691 if (/^=for\s+(\S+)\s*/s) {
692 if ($1 eq "man" or $1 eq "roff") {
693 print STDOUT $',"\n\n";
694 } else {
695 # ignore unknown for
696 }
697 next;
698 }
699 elsif (/^=begin\s+(\S+)\s*/s) {
700 $begun = $1;
701 if ($1 eq "man" or $1 eq "roff") {
702 print STDOUT $'."\n\n";
703 }
704 next;
705 }
706
707 # check for things that'll hosed our noremap scheme; affects $_
708 init_noremap();
709
710 if (!/^=item/) {
711
712 # trofficate backslashes; must do it before what happens below
713 s/\\/noremap('\\e')/ge;
714
715 # protect leading periods and quotes against *roff
716 # mistaking them for directives
717 s/^(?:[A-Z]<)?[.']/\\&$&/gm;
718
719 # first hide the escapes in case we need to
720 # intuit something and get it wrong due to fmting
721
722 1 while s/([A-Z]<$nonest>)/noremap($1)/ge;
723
724 # func() is a reference to a perl function
725 s{
726 \b
727 (
728 [:\w]+ \(\)
729 )
730 } {I<$1>}gx;
731
732 # func(n) is a reference to a perl function or a man page
733 s{
734 ([:\w]+)
735 (
736 \( [^\051]+ \)
737 )
738 } {I<$1>\\|$2}gx;
739
740 # convert simple variable references
741 s/(\s+)([\$\@%][\w:]+)(?!\()/${1}C<$2>/g;
742
743 if (m{ (
744 [\-\w]+
745 \(
746 [^\051]*?
747 [\@\$,]
748 [^\051]*?
749 \)
750 )
751 }x && $` !~ /([LCI]<[^<>]*|-)$/ && !/^=\w/)
752 {
753 warn "$0: bad option in paragraph $. of $ARGV: ``$1'' should be [LCI]<$1>\n";
754 $oops++;
755 }
756
757 while (/(-[a-zA-Z])\b/g && $` !~ /[\w\-]$/) {
758 warn "$0: bad option in paragraph $. of $ARGV: ``$1'' should be [CB]<$1>\n";
759 $oops++;
760 }
761
762 # put it back so we get the <> processed again;
763 clear_noremap(0); # 0 means leave the E's
764
765 } else {
766 # trofficate backslashes
767 s/\\/noremap('\\e')/ge;
768
769 }
770
771 # need to hide E<> first; they're processed in clear_noremap
772 s/(E<[^<>]+>)/noremap($1)/ge;
773
774
775 $maxnest = 10;
776 while ($maxnest-- && /[A-Z]</) {
777
778 # can't do C font here
779 s/([BI])<($nonest)>/font($1) . $2 . font('R')/eg;
780
781 # files and filelike refs in italics
782 s/F<($nonest)>/I<$1>/g;
783
784 # no break -- usually we want C<> for this
785 s/S<($nonest)>/nobreak($1)/eg;
786
787 # LREF: a la HREF L<show this text|man/section>
788 s:L<([^|>]+)\|[^>]+>:$1:g;
789
790 # LREF: a manpage(3f)
791 s:L<([a-zA-Z][^\s\/]+)(\([^\)]+\))?>:the I<$1>$2 manpage:g;
792
793 # LREF: an =item on another manpage
794 s{
795 L<
796 ([^/]+)
797 /
798 (
799 [:\w]+
800 (\(\))?
801 )
802 >
803 } {the C<$2> entry in the I<$1> manpage}gx;
804
805 # LREF: an =item on this manpage
806 s{
807 ((?:
808 L<
809 /
810 (
811 [:\w]+
812 (\(\))?
813 )
814 >
815 (,?\s+(and\s+)?)?
816 )+)
817 } { internal_lrefs($1) }gex;
818
819 # LREF: a =head2 (head1?), maybe on a manpage, maybe right here
820 # the "func" can disambiguate
821 s{
822 L<
823 (?:
824 ([a-zA-Z]\S+?) /
825 )?
826 "?(.*?)"?
827 >
828 }{
829 do {
830 $1 # if no $1, assume it means on this page.
831 ? "the section on I<$2> in the I<$1> manpage"
832 : "the section on I<$2>"
833 }
834 }gesx; # s in case it goes over multiple lines, so . matches \n
835
836 s/Z<>/\\&/g;
837
838 # comes last because not subject to reprocessing
839 s/C<($nonest)>/noremap("${CFont_embed}${1}\\fR")/eg;
840 }
841
842 if (s/^=//) {
843 $needspace = 0; # Assume this.
844
845 s/\n/ /g;
846
847 ($Cmd, $_) = split(' ', $_, 2);
848
849 $dotlevel = 1;
850 if ($Cmd eq 'head1') {
851 $dotlevel = 1;
852 }
853 elsif ($Cmd eq 'head2') {
854 $dotlevel = 1;
855 }
856 elsif ($Cmd eq 'item') {
857 $dotlevel = 2;
858 }
859
860 if (defined $_) {
861 &escapes($dotlevel);
862 s/"/""/g;
863 }
864
865 clear_noremap(1);
866
867 if ($Cmd eq 'cut') {
868 $cutting = 1;
869 }
870 elsif ($Cmd eq 'head1') {
871 s/\s+$//;
872 delete $wanna_see{$_} if exists $wanna_see{$_};
873 print qq{.SH "$_"\n};
874 push(@Indices, qq{.IX Header "$_"\n});
875 }
876 elsif ($Cmd eq 'head2') {
877 print qq{.Sh "$_"\n};
878 push(@Indices, qq{.IX Subsection "$_"\n});
879 }
880 elsif ($Cmd eq 'over') {
881 push(@indent,$indent);
882 $indent += ($_ + 0) || 5;
883 }
884 elsif ($Cmd eq 'back') {
885 $indent = pop(@indent);
886 warn "$0: Unmatched =back in paragraph $. of $ARGV\n" unless defined $indent;
887 $needspace = 1;
888 }
889 elsif ($Cmd eq 'item') {
890 s/^\*( |$)/\\(bu$1/g;
891 # if you know how to get ":s please do
892 s/\\\*\(L"([^"]+?)\\\*\(R"/'$1'/g;
893 s/\\\*\(L"([^"]+?)""/'$1'/g;
894 s/[^"]""([^"]+?)""[^"]/'$1'/g;
895 # here do something about the $" in perlvar?
896 print STDOUT qq{.Ip "$_" $indent\n};
897 push(@Indices, qq{.IX Item "$_"\n});
898 }
899 elsif ($Cmd eq 'pod') {
900 # this is just a comment
901 }
902 else {
903 warn "$0: Unrecognized pod directive in paragraph $. of $ARGV: $Cmd\n";
904 }
905 }
906 else {
907 if ($needspace) {
908 &makespace;
909 }
910 &escapes(0);
911 clear_noremap(1);
912 print $_, "\n";
913 $needspace = 1;
914 }
915}
916
917print <<"END";
918
919.rn }` ''
920END
921
922if (%wanna_see && !$lax) {
923 @missing = keys %wanna_see;
924 warn "$0: $Filename is missing required section"
925 . (@missing > 1 && "s")
926 . ": @missing\n";
927 $oops++;
928}
929
930foreach (@Indices) { print "$_\n"; }
931
932exit;
933#exit ($oops != 0);
934
935#########################################################################
936
937sub nobreak {
938 my $string = shift;
939 $string =~ s/ /\\ /g;
940 $string;
941}
942
943sub escapes {
944 my $indot = shift;
945
946 s/X<(.*?)>/mkindex($1)/ge;
947
948 # translate the minus in foo-bar into foo\-bar for roff
949 s/([^0-9a-z-])-([^-])/$1\\-$2/g;
950
951 # make -- into the string version \*(-- (defined above)
952 s/\b--\b/\\*(--/g;
953 s/"--([^"])/"\\*(--$1/g; # should be a better way
954 s/([^"])--"/$1\\*(--"/g;
955
956 # fix up quotes; this is somewhat tricky
957 my $dotmacroL = 'L';
958 my $dotmacroR = 'R';
959 if ( $indot == 1 ) {
960 $dotmacroL = 'M';
961 $dotmacroR = 'S';
962 }
963 elsif ( $indot >= 2 ) {
964 $dotmacroL = 'N';
965 $dotmacroR = 'T';
966 }
967 if (!/""/) {
968 s/(^|\s)(['"])/noremap("$1\\*($dotmacroL$2")/ge;
969 s/(['"])($|[\-\s,;\\!?.])/noremap("\\*($dotmacroR$1$2")/ge;
970 }
971
972 #s/(?!")(?:.)--(?!")(?:.)/\\*(--/g;
973 #s/(?:(?!")(?:.)--(?:"))|(?:(?:")--(?!")(?:.))/\\*(--/g;
974
975
976 # make sure that func() keeps a bit a space tween the parens
977 ### s/\b\(\)/\\|()/g;
978 ### s/\b\(\)/(\\|)/g;
979
980 # make C++ into \*C+, which is a squinched version (defined above)
981 s/\bC\+\+/\\*(C+/g;
982
983 # make double underbars have a little tiny space between them
984 s/__/_\\|_/g;
985
986 # PI goes to \*(PI (defined above)
987 s/\bPI\b/noremap('\\*(PI')/ge;
988
989 # make all caps a teeny bit smaller, but don't muck with embedded code literals
990 my $hidCFont = font('C');
991 if ($Cmd !~ /^head1/) { # SH already makes smaller
992 # /g isn't enough; 1 while or we'll be off
993
994# 1 while s{
995# (?!$hidCFont)(..|^.|^)
996# \b
997# (
998# [A-Z][\/A-Z+:\-\d_$.]+
999# )
1000# (s?)
1001# \b
1002# } {$1\\s-1$2\\s0}gmox;
1003
1004 1 while s{
1005 (?!$hidCFont)(..|^.|^)
1006 (
1007 \b[A-Z]{2,}[\/A-Z+:\-\d_\$]*\b
1008 )
1009 } {
1010 $1 . noremap( '\\s-1' . $2 . '\\s0' )
1011 }egmox;
1012
1013 }
1014}
1015
1016# make troff just be normal, but make small nroff get quoted
1017# decided to just put the quotes in the text; sigh;
1018sub ccvt {
1019 local($_,$prev) = @_;
1020 noremap(qq{.CQ "$_" \n\\&});
1021}
1022
1023sub makespace {
1024 if ($indent) {
1025 print ".Sp\n";
1026 }
1027 else {
1028 print ".PP\n";
1029 }
1030}
1031
1032sub mkindex {
1033 my ($entry) = @_;
1034 my @entries = split m:\s*/\s*:, $entry;
1035 push @Indices, ".IX Xref " . join ' ', map {qq("$_")} @entries;
1036 return '';
1037}
1038
1039sub font {
1040 local($font) = shift;
1041 return '\\f' . noremap($font);
1042}
1043
1044sub noremap {
1045 local($thing_to_hide) = shift;
1046 $thing_to_hide =~ tr/\000-\177/\200-\377/;
1047 return $thing_to_hide;
1048}
1049
1050sub init_noremap {
1051 # escape high bit characters in input stream
1052 s/([\200-\377])/"E<".ord($1).">"/ge;
1053}
1054
1055sub clear_noremap {
1056 my $ready_to_print = $_[0];
1057
1058 tr/\200-\377/\000-\177/;
1059
1060 # trofficate backslashes
1061 # s/(?!\\e)(?:..|^.|^)\\/\\e/g;
1062
1063 # now for the E<>s, which have been hidden until now
1064 # otherwise the interative \w<> processing would have
1065 # been hosed by the E<gt>
1066 s {
1067 E<
1068 (
1069 ( \d + )
1070 | ( [A-Za-z]+ )
1071 )
1072 >
1073 } {
1074 do {
1075 defined $2
1076 ? chr($2)
1077 :
1078 exists $HTML_Escapes{$3}
1079 ? do { $HTML_Escapes{$3} }
1080 : do {
1081 warn "$0: Unknown escape in paragraph $. of $ARGV: ``$&''\n";
1082 "E<$1>";
1083 }
1084 }
1085 }egx if $ready_to_print;
1086}
1087
1088sub internal_lrefs {
1089 local($_) = shift;
1090 local $trailing_and = s/and\s+$// ? "and " : "";
1091
1092 s{L</([^>]+)>}{$1}g;
1093 my(@items) = split( /(?:,?\s+(?:and\s+)?)/ );
1094 my $retstr = "the ";
1095 my $i;
1096 for ($i = 0; $i <= $#items; $i++) {
1097 $retstr .= "C<$items[$i]>";
1098 $retstr .= ", " if @items > 2 && $i != $#items;
1099 $retstr .= " and " if $i+2 == @items;
1100 }
1101
1102 $retstr .= " entr" . ( @items > 1 ? "ies" : "y" )
1103 . " elsewhere in this document";
1104 # terminal space to avoid words running together (pattern used
1105 # strips terminal spaces)
1106 $retstr .= " " if length $trailing_and;
1107 $retstr .= $trailing_and;
1108
1109 return $retstr;
1110
1111}
1112
1113BEGIN {
1114%HTML_Escapes = (
1115 'amp' => '&', # ampersand
1116 'lt' => '<', # left chevron, less-than
1117 'gt' => '>', # right chevron, greater-than
1118 'quot' => '"', # double quote
1119
1120 "Aacute" => "A\\*'", # capital A, acute accent
1121 "aacute" => "a\\*'", # small a, acute accent
1122 "Acirc" => "A\\*^", # capital A, circumflex accent
1123 "acirc" => "a\\*^", # small a, circumflex accent
1124 "AElig" => '\*(AE', # capital AE diphthong (ligature)
1125 "aelig" => '\*(ae', # small ae diphthong (ligature)
1126 "Agrave" => "A\\*`", # capital A, grave accent
1127 "agrave" => "A\\*`", # small a, grave accent
1128 "Aring" => 'A\\*o', # capital A, ring
1129 "aring" => 'a\\*o', # small a, ring
1130 "Atilde" => 'A\\*~', # capital A, tilde
1131 "atilde" => 'a\\*~', # small a, tilde
1132 "Auml" => 'A\\*:', # capital A, dieresis or umlaut mark
1133 "auml" => 'a\\*:', # small a, dieresis or umlaut mark
1134 "Ccedil" => 'C\\*,', # capital C, cedilla
1135 "ccedil" => 'c\\*,', # small c, cedilla
1136 "Eacute" => "E\\*'", # capital E, acute accent
1137 "eacute" => "e\\*'", # small e, acute accent
1138 "Ecirc" => "E\\*^", # capital E, circumflex accent
1139 "ecirc" => "e\\*^", # small e, circumflex accent
1140 "Egrave" => "E\\*`", # capital E, grave accent
1141 "egrave" => "e\\*`", # small e, grave accent
1142 "ETH" => '\\*(D-', # capital Eth, Icelandic
1143 "eth" => '\\*(d-', # small eth, Icelandic
1144 "Euml" => "E\\*:", # capital E, dieresis or umlaut mark
1145 "euml" => "e\\*:", # small e, dieresis or umlaut mark
1146 "Iacute" => "I\\*'", # capital I, acute accent
1147 "iacute" => "i\\*'", # small i, acute accent
1148 "Icirc" => "I\\*^", # capital I, circumflex accent
1149 "icirc" => "i\\*^", # small i, circumflex accent
1150 "Igrave" => "I\\*`", # capital I, grave accent
1151 "igrave" => "i\\*`", # small i, grave accent
1152 "Iuml" => "I\\*:", # capital I, dieresis or umlaut mark
1153 "iuml" => "i\\*:", # small i, dieresis or umlaut mark
1154 "Ntilde" => 'N\*~', # capital N, tilde
1155 "ntilde" => 'n\*~', # small n, tilde
1156 "Oacute" => "O\\*'", # capital O, acute accent
1157 "oacute" => "o\\*'", # small o, acute accent
1158 "Ocirc" => "O\\*^", # capital O, circumflex accent
1159 "ocirc" => "o\\*^", # small o, circumflex accent
1160 "Ograve" => "O\\*`", # capital O, grave accent
1161 "ograve" => "o\\*`", # small o, grave accent
1162 "Oslash" => "O\\*/", # capital O, slash
1163 "oslash" => "o\\*/", # small o, slash
1164 "Otilde" => "O\\*~", # capital O, tilde
1165 "otilde" => "o\\*~", # small o, tilde
1166 "Ouml" => "O\\*:", # capital O, dieresis or umlaut mark
1167 "ouml" => "o\\*:", # small o, dieresis or umlaut mark
1168 "szlig" => '\*8', # small sharp s, German (sz ligature)
1169 "THORN" => '\\*(Th', # capital THORN, Icelandic
1170 "thorn" => '\\*(th',, # small thorn, Icelandic
1171 "Uacute" => "U\\*'", # capital U, acute accent
1172 "uacute" => "u\\*'", # small u, acute accent
1173 "Ucirc" => "U\\*^", # capital U, circumflex accent
1174 "ucirc" => "u\\*^", # small u, circumflex accent
1175 "Ugrave" => "U\\*`", # capital U, grave accent
1176 "ugrave" => "u\\*`", # small u, grave accent
1177 "Uuml" => "U\\*:", # capital U, dieresis or umlaut mark
1178 "uuml" => "u\\*:", # small u, dieresis or umlaut mark
1179 "Yacute" => "Y\\*'", # capital Y, acute accent
1180 "yacute" => "y\\*'", # small y, acute accent
1181 "yuml" => "y\\*:", # small y, dieresis or umlaut mark
1182);
1183}
1184
diff --git a/src/lib/libcrypto/util/pod2mantest b/src/lib/libcrypto/util/pod2mantest
new file mode 100644
index 0000000000..384e683df4
--- /dev/null
+++ b/src/lib/libcrypto/util/pod2mantest
@@ -0,0 +1,58 @@
1#!/bin/sh
2
3# This script is used by test/Makefile to check whether a sane 'pod2man'
4# is installed.
5# ('make install' should not try to run 'pod2man' if it does not exist or if
6# it is a broken 'pod2man' version that is known to cause trouble. if we find
7# the system 'pod2man' to be broken, we use our own copy instead)
8#
9# In any case, output an appropriate command line for running (or not
10# running) pod2man.
11
12
13IFS=:
14if test "$OSTYPE" = "msdosdjgpp"; then IFS=";"; fi
15
16try_without_dir=true
17# First we try "pod2man", then "$dir/pod2man" for each item in $PATH.
18for dir in dummy${IFS}$PATH; do
19 if [ "$try_without_dir" = true ]; then
20 # first iteration
21 pod2man=pod2man
22 try_without_dir=false
23 else
24 # second and later iterations
25 pod2man="$dir/pod2man"
26 if [ ! -f "$pod2man" ]; then # '-x' is not available on Ultrix
27 pod2man=''
28 fi
29 fi
30
31 if [ ! "$pod2man" = '' ]; then
32 failure=none
33
34 if "$pod2man" --section=1 --center=OpenSSL --release=dev pod2mantest.pod | fgrep OpenSSL >/dev/null; then
35 :
36 else
37 failure=BasicTest
38 fi
39
40 if [ "$failure" = none ]; then
41 if "$pod2man" --section=1 --center=OpenSSL --release=dev pod2mantest.pod | grep '^MARKER - ' >/dev/null; then
42 failure=MultilineTest
43 fi
44 fi
45
46
47 if [ "$failure" = none ]; then
48 echo "$pod2man"
49 exit 0
50 fi
51
52 echo "$pod2man does not work properly ('$failure' failed). Looking for another pod2man ..." >&2
53 fi
54done
55
56echo "No working pod2man found. Consider installing a new version." >&2
57echo "As a workaround, we'll use a bundled old copy of pod2man.pl." >&2
58echo "$1 ../../util/pod2man.pl"
diff --git a/src/lib/libcrypto/util/pod2mantest.pod b/src/lib/libcrypto/util/pod2mantest.pod
new file mode 100644
index 0000000000..5d2539a17f
--- /dev/null
+++ b/src/lib/libcrypto/util/pod2mantest.pod
@@ -0,0 +1,15 @@
1=pod
2
3=head1 NAME
4
5foo, bar,
6MARKER - test of multiline name section
7
8=head1 DESCRIPTION
9
10This is a test .pod file to see if we have a buggy pod2man or not.
11If we have a buggy implementation, we will get a line matching the
12regular expression "^ +MARKER - test of multiline name section *$"
13at the end of the resulting document.
14
15=cut
diff --git a/src/lib/libcrypto/util/point.sh b/src/lib/libcrypto/util/point.sh
new file mode 100644
index 0000000000..da39899cb1
--- /dev/null
+++ b/src/lib/libcrypto/util/point.sh
@@ -0,0 +1,10 @@
1#!/bin/sh
2
3rm -f "$2"
4if test "$OSTYPE" = msdosdjgpp || test "x$PLATFORM" = xmingw ; then
5 cp "$1" "$2"
6else
7 ln -s "$1" "$2"
8fi
9echo "$2 => $1"
10
diff --git a/src/lib/libcrypto/util/selftest.pl b/src/lib/libcrypto/util/selftest.pl
new file mode 100644
index 0000000000..7b32e9f4ff
--- /dev/null
+++ b/src/lib/libcrypto/util/selftest.pl
@@ -0,0 +1,201 @@
1#!/usr/local/bin/perl -w
2#
3# Run the test suite and generate a report
4#
5
6if (! -f "Configure") {
7 print "Please run perl util/selftest.pl in the OpenSSL directory.\n";
8 exit 1;
9}
10
11my $report="testlog";
12my $os="??";
13my $version="??";
14my $platform0="??";
15my $platform="??";
16my $options="??";
17my $last="??";
18my $ok=0;
19my $cc="cc";
20my $cversion="??";
21my $sep="-----------------------------------------------------------------------------\n";
22my $not_our_fault="\nPlease ask your system administrator/vendor for more information.\n[Problems with your operating system setup should not be reported\nto the OpenSSL project.]\n";
23
24open(OUT,">$report") or die;
25
26print OUT "OpenSSL self-test report:\n\n";
27
28$uname=`uname -a`;
29$uname="??\n" if $uname eq "";
30
31$c=`sh config -t`;
32foreach $_ (split("\n",$c)) {
33 $os=$1 if (/Operating system: (.*)$/);
34 $platform0=$1 if (/Configuring for (.*)$/);
35}
36
37system "sh config" if (! -f "Makefile");
38
39if (open(IN,"<Makefile")) {
40 while (<IN>) {
41 $version=$1 if (/^VERSION=(.*)$/);
42 $platform=$1 if (/^PLATFORM=(.*)$/);
43 $options=$1 if (/^OPTIONS=(.*)$/);
44 $cc=$1 if (/^CC= *(.*)$/);
45 }
46 close(IN);
47} else {
48 print OUT "Error running config!\n";
49}
50
51$cversion=`$cc -v 2>&1`;
52$cversion=`$cc -V 2>&1` if $cversion =~ "[Uu]sage";
53$cversion=`$cc -V |head -1` if $cversion =~ "Error";
54$cversion=`$cc --version` if $cversion eq "";
55$cversion =~ s/Reading specs.*\n//;
56$cversion =~ s/usage.*\n//;
57chomp $cversion;
58
59if (open(IN,"<CHANGES")) {
60 while(<IN>) {
61 if (/\*\) (.{0,55})/ && !/applies to/) {
62 $last=$1;
63 last;
64 }
65 }
66 close(IN);
67}
68
69print OUT "OpenSSL version: $version\n";
70print OUT "Last change: $last...\n";
71print OUT "Options: $options\n" if $options ne "";
72print OUT "OS (uname): $uname";
73print OUT "OS (config): $os\n";
74print OUT "Target (default): $platform0\n";
75print OUT "Target: $platform\n";
76print OUT "Compiler: $cversion\n";
77print OUT "\n";
78
79print "Checking compiler...\n";
80if (open(TEST,">cctest.c")) {
81 print TEST "#include <stdio.h>\n#include <stdlib.h>\n#include <errno.h>\nmain(){printf(\"Hello world\\n\");}\n";
82 close(TEST);
83 system("$cc -o cctest cctest.c");
84 if (`./cctest` !~ /Hello world/) {
85 print OUT "Compiler doesn't work.\n";
86 print OUT $not_our_fault;
87 goto err;
88 }
89 system("ar r cctest.a /dev/null");
90 if (not -f "cctest.a") {
91 print OUT "Check your archive tool (ar).\n";
92 print OUT $not_our_fault;
93 goto err;
94 }
95} else {
96 print OUT "Can't create cctest.c\n";
97}
98if (open(TEST,">cctest.c")) {
99 print TEST "#include <stdio.h>\n#include <stdlib.h>\n#include <openssl/opensslv.h>\nmain(){printf(OPENSSL_VERSION_TEXT);}\n";
100 close(TEST);
101 system("$cc -o cctest -Iinclude cctest.c");
102 $cctest = `./cctest`;
103 if ($cctest !~ /OpenSSL $version/) {
104 if ($cctest =~ /OpenSSL/) {
105 print OUT "#include uses headers from different OpenSSL version!\n";
106 } else {
107 print OUT "Can't compile test program!\n";
108 }
109 print OUT $not_our_fault;
110 goto err;
111 }
112} else {
113 print OUT "Can't create cctest.c\n";
114}
115
116print "Running make...\n";
117if (system("make 2>&1 | tee make.log") > 255) {
118
119 print OUT "make failed!\n";
120 if (open(IN,"<make.log")) {
121 print OUT $sep;
122 while (<IN>) {
123 print OUT;
124 }
125 close(IN);
126 print OUT $sep;
127 } else {
128 print OUT "make.log not found!\n";
129 }
130 goto err;
131}
132
133# Not sure why this is here. The tests themselves can detect if their
134# particular feature isn't included, and should therefore skip themselves.
135# To skip *all* tests just because one algorithm isn't included is like
136# shooting mosquito with an elephant gun...
137# -- Richard Levitte, inspired by problem report 1089
138#
139#$_=$options;
140#s/no-asm//;
141#s/no-shared//;
142#s/no-krb5//;
143#if (/no-/)
144#{
145# print OUT "Test skipped.\n";
146# goto err;
147#}
148
149print "Running make test...\n";
150if (system("make test 2>&1 | tee maketest.log") > 255)
151 {
152 print OUT "make test failed!\n";
153} else {
154 $ok=1;
155}
156
157if ($ok and open(IN,"<maketest.log")) {
158 while (<IN>) {
159 $ok=2 if /^platform: $platform/;
160 }
161 close(IN);
162}
163
164if ($ok != 2) {
165 print OUT "Failure!\n";
166 if (open(IN,"<make.log")) {
167 print OUT $sep;
168 while (<IN>) {
169 print OUT;
170 }
171 close(IN);
172 print OUT $sep;
173 } else {
174 print OUT "make.log not found!\n";
175 }
176 if (open(IN,"<maketest.log")) {
177 while (<IN>) {
178 print OUT;
179 }
180 close(IN);
181 print OUT $sep;
182 } else {
183 print OUT "maketest.log not found!\n";
184 }
185} else {
186 print OUT "Test passed.\n";
187}
188err:
189close(OUT);
190
191print "\n";
192open(IN,"<$report") or die;
193while (<IN>) {
194 if (/$sep/) {
195 print "[...]\n";
196 last;
197 }
198 print;
199}
200print "\nTest report in file $report\n";
201
diff --git a/src/lib/libcrypto/util/shlib_wrap.sh b/src/lib/libcrypto/util/shlib_wrap.sh
new file mode 100755
index 0000000000..8775cb5411
--- /dev/null
+++ b/src/lib/libcrypto/util/shlib_wrap.sh
@@ -0,0 +1,97 @@
1#!/bin/sh
2
3[ $# -ne 0 ] || set -x # debug mode without arguments:-)
4
5THERE="`echo $0 | sed -e 's|[^/]*$||' 2>/dev/null`.."
6[ -d "${THERE}" ] || exec "$@" # should never happen...
7
8# Alternative to this is to parse ${THERE}/Makefile...
9LIBCRYPTOSO="${THERE}/libcrypto.so"
10if [ -f "$LIBCRYPTOSO" ]; then
11 while [ -h "$LIBCRYPTOSO" ]; do
12 LIBCRYPTOSO="${THERE}/`ls -l "$LIBCRYPTOSO" | sed -e 's|.*\-> ||'`"
13 done
14 SOSUFFIX=`echo ${LIBCRYPTOSO} | sed -e 's|.*\.so||' 2>/dev/null`
15 LIBSSLSO="${THERE}/libssl.so${SOSUFFIX}"
16fi
17
18SYSNAME=`(uname -s) 2>/dev/null`;
19case "$SYSNAME" in
20SunOS|IRIX*)
21 # SunOS and IRIX run-time linkers evaluate alternative
22 # variables depending on target ABI...
23 rld_var=LD_LIBRARY_PATH
24 case "`(/usr/bin/file "$LIBCRYPTOSO") 2>/dev/null`" in
25 *ELF\ 64*SPARC*|*ELF\ 64*AMD64*)
26 [ -n "$LD_LIBRARY_PATH_64" ] && rld_var=LD_LIBRARY_PATH_64
27 LD_PRELOAD_64="$LIBCRYPTOSO $LIBSSLSO"; export LD_PRELOAD_64
28 preload_var=LD_PRELOAD_64
29 ;;
30 # Why are newly built .so's preloaded anyway? Because run-time
31 # .so lookup path embedded into application takes precedence
32 # over LD_LIBRARY_PATH and as result application ends up linking
33 # to previously installed .so's. On IRIX instead of preloading
34 # newly built .so's we trick run-time linker to fail to find
35 # the installed .so by setting _RLD_ROOT variable.
36 *ELF\ 32*MIPS*)
37 #_RLD_LIST="$LIBCRYPTOSO:$LIBSSLSO:DEFAULT"; export _RLD_LIST
38 _RLD_ROOT=/no/such/dir; export _RLD_ROOT
39 eval $rld_var=\"/usr/lib'${'$rld_var':+:$'$rld_var'}'\"
40 preload_var=_RLD_LIST
41 ;;
42 *ELF\ N32*MIPS*)
43 [ -n "$LD_LIBRARYN32_PATH" ] && rld_var=LD_LIBRARYN32_PATH
44 #_RLDN32_LIST="$LIBCRYPTOSO:$LIBSSLSO:DEFAULT"; export _RLDN32_LIST
45 _RLDN32_ROOT=/no/such/dir; export _RLDN32_ROOT
46 eval $rld_var=\"/usr/lib32'${'$rld_var':+:$'$rld_var'}'\"
47 preload_var=_RLDN32_LIST
48 ;;
49 *ELF\ 64*MIPS*)
50 [ -n "$LD_LIBRARY64_PATH" ] && rld_var=LD_LIBRARY64_PATH
51 #_RLD64_LIST="$LIBCRYPTOSO:$LIBSSLSO:DEFAULT"; export _RLD64_LIST
52 _RLD64_ROOT=/no/such/dir; export _RLD64_ROOT
53 eval $rld_var=\"/usr/lib64'${'$rld_var':+:$'$rld_var'}'\"
54 preload_var=_RLD64_LIST
55 ;;
56 esac
57 eval $rld_var=\"${THERE}'${'$rld_var':+:$'$rld_var'}'\"; export $rld_var
58 unset rld_var
59 ;;
60*) LD_LIBRARY_PATH="${THERE}:$LD_LIBRARY_PATH" # Linux, ELF HP-UX
61 DYLD_LIBRARY_PATH="${THERE}:$DYLD_LIBRARY_PATH" # MacOS X
62 SHLIB_PATH="${THERE}:$SHLIB_PATH" # legacy HP-UX
63 LIBPATH="${THERE}:$LIBPATH" # AIX, OS/2
64 export LD_LIBRARY_PATH DYLD_LIBRARY_PATH SHLIB_PATH LIBPATH
65 # Even though $PATH is adjusted [for Windows sake], it doesn't
66 # necessarily does the trick. Trouble is that with introduction
67 # of SafeDllSearchMode in XP/2003 it's more appropriate to copy
68 # .DLLs in vicinity of executable, which is done elsewhere...
69 if [ "$OSTYPE" != msdosdjgpp ]; then
70 PATH="${THERE}:$PATH"; export PATH
71 fi
72 ;;
73esac
74
75if [ -f "$LIBCRYPTOSO" -a -z "$preload_var" ]; then
76 # Following three lines are major excuse for isolating them into
77 # this wrapper script. Original reason for setting LD_PRELOAD
78 # was to make it possible to pass 'make test' when user linked
79 # with -rpath pointing to previous version installation. Wrapping
80 # it into a script makes it possible to do so on multi-ABI
81 # platforms.
82 case "$SYSNAME" in
83 *BSD|QNX) LD_PRELOAD="$LIBCRYPTOSO:$LIBSSLSO" ;; # *BSD, QNX
84 *) LD_PRELOAD="$LIBCRYPTOSO $LIBSSLSO" ;; # SunOS, Linux, ELF HP-UX
85 esac
86 _RLD_LIST="$LIBCRYPTOSO:$LIBSSLSO:DEFAULT" # Tru64, o32 IRIX
87 DYLD_INSERT_LIBRARIES="$LIBCRYPTOSO:$LIBSSLSO" # MacOS X
88 export LD_PRELOAD _RLD_LIST DYLD_INSERT_LIBRARIES
89fi
90
91cmd="$1${EXE_EXT}"
92shift
93if [ $# -eq 0 ]; then
94 exec "$cmd" # old sh, such as Tru64 4.x, fails to expand empty "$@"
95else
96 exec "$cmd" "$@"
97fi
diff --git a/src/lib/libcrypto/util/sp-diff.pl b/src/lib/libcrypto/util/sp-diff.pl
new file mode 100644
index 0000000000..9d6c60387f
--- /dev/null
+++ b/src/lib/libcrypto/util/sp-diff.pl
@@ -0,0 +1,80 @@
1#!/usr/local/bin/perl
2#
3# This file takes as input, the files that have been output from
4# ssleay speed.
5# It prints a table of the relative differences with %100 being 'no difference'
6#
7
8($#ARGV == 1) || die "$0 speedout1 speedout2\n";
9
10%one=&loadfile($ARGV[0]);
11%two=&loadfile($ARGV[1]);
12
13$line=0;
14foreach $a ("md2","md4","md5","sha","sha1","rc4","des cfb","des cbc","des ede3",
15 "idea cfb","idea cbc","rc2 cfb","rc2 cbc","blowfish cbc","cast cbc")
16 {
17 if (defined($one{$a,8}) && defined($two{$a,8}))
18 {
19 print "type 8 byte% 64 byte% 256 byte% 1024 byte% 8192 byte%\n"
20 unless $line;
21 $line++;
22 printf "%-12s ",$a;
23 foreach $b (8,64,256,1024,8192)
24 {
25 $r=$two{$a,$b}/$one{$a,$b}*100;
26 printf "%12.2f",$r;
27 }
28 print "\n";
29 }
30 }
31
32foreach $a (
33 "rsa 512","rsa 1024","rsa 2048","rsa 4096",
34 "dsa 512","dsa 1024","dsa 2048",
35 )
36 {
37 if (defined($one{$a,1}) && defined($two{$a,1}))
38 {
39 $r1=($one{$a,1}/$two{$a,1})*100;
40 $r2=($one{$a,2}/$two{$a,2})*100;
41 printf "$a bits %% %6.2f %% %6.2f\n",$r1,$r2;
42 }
43 }
44
45sub loadfile
46 {
47 local($file)=@_;
48 local($_,%ret);
49
50 open(IN,"<$file") || die "unable to open '$file' for input\n";
51 $header=1;
52 while (<IN>)
53 {
54 $header=0 if /^[dr]sa/;
55 if (/^type/) { $header=0; next; }
56 next if $header;
57 chop;
58 @a=split;
59 if ($a[0] =~ /^[dr]sa$/)
60 {
61 ($n,$t1,$t2)=($_ =~ /^([dr]sa\s+\d+)\s+bits\s+([.\d]+)s\s+([.\d]+)/);
62 $ret{$n,1}=$t1;
63 $ret{$n,2}=$t2;
64 }
65 else
66 {
67 $n=join(' ',grep(/[^k]$/,@a));
68 @k=grep(s/k$//,@a);
69
70 $ret{$n, 8}=$k[0];
71 $ret{$n, 64}=$k[1];
72 $ret{$n, 256}=$k[2];
73 $ret{$n,1024}=$k[3];
74 $ret{$n,8192}=$k[4];
75 }
76 }
77 close(IN);
78 return(%ret);
79 }
80
diff --git a/src/lib/libcrypto/util/speed.sh b/src/lib/libcrypto/util/speed.sh
new file mode 100644
index 0000000000..f489706197
--- /dev/null
+++ b/src/lib/libcrypto/util/speed.sh
@@ -0,0 +1,39 @@
1#!/bin/sh
2
3#
4# This is a ugly script use, in conjuction with editing the 'b'
5# configuration in the $(TOP)/Configure script which will
6# output when finished a file called speed.log which is the
7# timings of SSLeay with various options turned on or off.
8#
9# from the $(TOP) directory
10# Edit Configure, modifying things to do with the b/bl-4c-2c etc
11# configurations.
12#
13
14make clean
15perl Configure b
16make
17apps/ssleay version -v -b -f >speed.1
18apps/ssleay speed >speed.1l
19
20perl Configure bl-4c-2c
21/bin/rm -f crypto/rc4/*.o crypto/bn/bn*.o crypto/md2/md2_dgst.o
22make
23apps/ssleay speed rc4 rsa md2 >speed.2l
24
25perl Configure bl-4c-ri
26/bin/rm -f crypto/rc4/rc4*.o
27make
28apps/ssleay speed rc4 >speed.3l
29
30perl Configure b2-is-ri-dp
31/bin/rm -f crypto/idea/i_*.o crypto/rc4/*.o crypto/des/ecb_enc.o crypto/bn/bn*.o
32apps/ssleay speed rsa rc4 idea des >speed.4l
33
34cat speed.1 >speed.log
35cat speed.1l >>speed.log
36perl util/sp-diff.pl speed.1l speed.2l >>speed.log
37perl util/sp-diff.pl speed.1l speed.3l >>speed.log
38perl util/sp-diff.pl speed.1l speed.4l >>speed.log
39
diff --git a/src/lib/libcrypto/util/src-dep.pl b/src/lib/libcrypto/util/src-dep.pl
new file mode 100644
index 0000000000..ad997e4746
--- /dev/null
+++ b/src/lib/libcrypto/util/src-dep.pl
@@ -0,0 +1,147 @@
1#!/usr/local/bin/perl
2
3# we make up an array of
4# $file{function_name}=filename;
5# $unres{filename}="func1 func2 ...."
6$debug=1;
7#$nm_func="parse_linux";
8$nm_func="parse_solaris";
9
10foreach (@ARGV)
11 {
12 &$nm_func($_);
13 }
14
15foreach $file (sort keys %unres)
16 {
17 @a=split(/\s+/,$unres{$file});
18 %ff=();
19 foreach $func (@a)
20 {
21 $f=$file{$func};
22 $ff{$f}=1 if $f ne "";
23 }
24
25 foreach $a (keys %ff)
26 { $we_need{$file}.="$a "; }
27 }
28
29foreach $file (sort keys %we_need)
30 {
31# print " $file $we_need{$file}\n";
32 foreach $bit (split(/\s+/,$we_need{$file}))
33 { push(@final,&walk($bit)); }
34
35 foreach (@final) { $fin{$_}=1; }
36 @final="";
37 foreach (sort keys %fin)
38 { push(@final,$_); }
39
40 print "$file: @final\n";
41 }
42
43sub walk
44 {
45 local($f)=@_;
46 local(@a,%seen,@ret,$r);
47
48 @ret="";
49 $f =~ s/^\s+//;
50 $f =~ s/\s+$//;
51 return "" if ($f =~ "^\s*$");
52
53 return(split(/\s/,$done{$f})) if defined ($done{$f});
54
55 return if $in{$f} > 0;
56 $in{$f}++;
57 push(@ret,$f);
58 foreach $r (split(/\s+/,$we_need{$f}))
59 {
60 push(@ret,&walk($r));
61 }
62 $in{$f}--;
63 $done{$f}=join(" ",@ret);
64 return(@ret);
65 }
66
67sub parse_linux
68 {
69 local($name)=@_;
70
71 open(IN,"nm $name|") || die "unable to run 'nn $name':$!\n";
72 while (<IN>)
73 {
74 chop;
75 next if /^\s*$/;
76 if (/^[^[](.*):$/)
77 {
78 $file=$1;
79 $file="$1.c" if /\[(.*).o\]/;
80 print STDERR "$file\n";
81 $we_need{$file}=" ";
82 next;
83 }
84
85 @a=split(/\s*\|\s*/);
86 next unless $#a == 7;
87 next unless $a[4] eq "GLOB";
88 if ($a[6] eq "UNDEF")
89 {
90 $unres{$file}.=$a[7]." ";
91 }
92 else
93 {
94 if ($file{$a[7]} ne "")
95 {
96 print STDERR "duplicate definition of $a[7],\n$file{$a[7]} and $file \n";
97 }
98 else
99 {
100 $file{$a[7]}=$file;
101 }
102 }
103 }
104 close(IN);
105 }
106
107sub parse_solaris
108 {
109 local($name)=@_;
110
111 open(IN,"nm $name|") || die "unable to run 'nn $name':$!\n";
112 while (<IN>)
113 {
114 chop;
115 next if /^\s*$/;
116 if (/^(\S+):$/)
117 {
118 $file=$1;
119 #$file="$1.c" if $file =~ /^(.*).o$/;
120 print STDERR "$file\n";
121 $we_need{$file}=" ";
122 next;
123 }
124 @a=split(/\s*\|\s*/);
125 next unless $#a == 7;
126 next unless $a[4] eq "GLOB";
127 if ($a[6] eq "UNDEF")
128 {
129 $unres{$file}.=$a[7]." ";
130 print STDERR "$file needs $a[7]\n" if $debug;
131 }
132 else
133 {
134 if ($file{$a[7]} ne "")
135 {
136 print STDERR "duplicate definition of $a[7],\n$file{$a[7]} and $file \n";
137 }
138 else
139 {
140 $file{$a[7]}=$file;
141 print STDERR "$file has $a[7]\n" if $debug;
142 }
143 }
144 }
145 close(IN);
146 }
147
diff --git a/src/lib/libcrypto/util/ssleay.num b/src/lib/libcrypto/util/ssleay.num
new file mode 100644
index 0000000000..37655bc40a
--- /dev/null
+++ b/src/lib/libcrypto/util/ssleay.num
@@ -0,0 +1,322 @@
1ERR_load_SSL_strings 1 EXIST::FUNCTION:
2SSL_CIPHER_description 2 EXIST::FUNCTION:
3SSL_CTX_add_client_CA 3 EXIST::FUNCTION:
4SSL_CTX_add_session 4 EXIST::FUNCTION:
5SSL_CTX_check_private_key 5 EXIST::FUNCTION:
6SSL_CTX_ctrl 6 EXIST::FUNCTION:
7SSL_CTX_flush_sessions 7 EXIST::FUNCTION:
8SSL_CTX_free 8 EXIST::FUNCTION:
9SSL_CTX_get_client_CA_list 9 EXIST::FUNCTION:
10SSL_CTX_get_verify_callback 10 EXIST::FUNCTION:
11SSL_CTX_get_verify_mode 11 EXIST::FUNCTION:
12SSL_CTX_new 12 EXIST::FUNCTION:
13SSL_CTX_remove_session 13 EXIST::FUNCTION:
14SSL_CTX_set_cipher_list 15 EXIST::FUNCTION:
15SSL_CTX_set_client_CA_list 16 EXIST::FUNCTION:
16SSL_CTX_set_default_passwd_cb 17 EXIST::FUNCTION:
17SSL_CTX_set_ssl_version 19 EXIST::FUNCTION:
18SSL_CTX_set_verify 21 EXIST::FUNCTION:
19SSL_CTX_use_PrivateKey 22 EXIST::FUNCTION:
20SSL_CTX_use_PrivateKey_ASN1 23 EXIST::FUNCTION:
21SSL_CTX_use_PrivateKey_file 24 EXIST::FUNCTION:STDIO
22SSL_CTX_use_RSAPrivateKey 25 EXIST::FUNCTION:RSA
23SSL_CTX_use_RSAPrivateKey_ASN1 26 EXIST::FUNCTION:RSA
24SSL_CTX_use_RSAPrivateKey_file 27 EXIST::FUNCTION:RSA,STDIO
25SSL_CTX_use_certificate 28 EXIST::FUNCTION:
26SSL_CTX_use_certificate_ASN1 29 EXIST::FUNCTION:
27SSL_CTX_use_certificate_file 30 EXIST::FUNCTION:STDIO
28SSL_SESSION_free 31 EXIST::FUNCTION:
29SSL_SESSION_new 32 EXIST::FUNCTION:
30SSL_SESSION_print 33 EXIST::FUNCTION:BIO
31SSL_SESSION_print_fp 34 EXIST::FUNCTION:FP_API
32SSL_accept 35 EXIST::FUNCTION:
33SSL_add_client_CA 36 EXIST::FUNCTION:
34SSL_alert_desc_string 37 EXIST::FUNCTION:
35SSL_alert_desc_string_long 38 EXIST::FUNCTION:
36SSL_alert_type_string 39 EXIST::FUNCTION:
37SSL_alert_type_string_long 40 EXIST::FUNCTION:
38SSL_check_private_key 41 EXIST::FUNCTION:
39SSL_clear 42 EXIST::FUNCTION:
40SSL_connect 43 EXIST::FUNCTION:
41SSL_copy_session_id 44 EXIST::FUNCTION:
42SSL_ctrl 45 EXIST::FUNCTION:
43SSL_dup 46 EXIST::FUNCTION:
44SSL_dup_CA_list 47 EXIST::FUNCTION:
45SSL_free 48 EXIST::FUNCTION:
46SSL_get_certificate 49 EXIST::FUNCTION:
47SSL_get_cipher_list 52 EXIST::FUNCTION:
48SSL_get_ciphers 55 EXIST::FUNCTION:
49SSL_get_client_CA_list 56 EXIST::FUNCTION:
50SSL_get_default_timeout 57 EXIST::FUNCTION:
51SSL_get_error 58 EXIST::FUNCTION:
52SSL_get_fd 59 EXIST::FUNCTION:
53SSL_get_peer_cert_chain 60 EXIST::FUNCTION:
54SSL_get_peer_certificate 61 EXIST::FUNCTION:
55SSL_get_rbio 63 EXIST::FUNCTION:BIO
56SSL_get_read_ahead 64 EXIST::FUNCTION:
57SSL_get_shared_ciphers 65 EXIST::FUNCTION:
58SSL_get_ssl_method 66 EXIST::FUNCTION:
59SSL_get_verify_callback 69 EXIST::FUNCTION:
60SSL_get_verify_mode 70 EXIST::FUNCTION:
61SSL_get_version 71 EXIST::FUNCTION:
62SSL_get_wbio 72 EXIST::FUNCTION:BIO
63SSL_load_client_CA_file 73 EXIST::FUNCTION:STDIO
64SSL_load_error_strings 74 EXIST::FUNCTION:
65SSL_new 75 EXIST::FUNCTION:
66SSL_peek 76 EXIST::FUNCTION:
67SSL_pending 77 EXIST::FUNCTION:
68SSL_read 78 EXIST::FUNCTION:
69SSL_renegotiate 79 EXIST::FUNCTION:
70SSL_rstate_string 80 EXIST::FUNCTION:
71SSL_rstate_string_long 81 EXIST::FUNCTION:
72SSL_set_accept_state 82 EXIST::FUNCTION:
73SSL_set_bio 83 EXIST::FUNCTION:BIO
74SSL_set_cipher_list 84 EXIST::FUNCTION:
75SSL_set_client_CA_list 85 EXIST::FUNCTION:
76SSL_set_connect_state 86 EXIST::FUNCTION:
77SSL_set_fd 87 EXIST::FUNCTION:SOCK
78SSL_set_read_ahead 88 EXIST::FUNCTION:
79SSL_set_rfd 89 EXIST::FUNCTION:SOCK
80SSL_set_session 90 EXIST::FUNCTION:
81SSL_set_ssl_method 91 EXIST::FUNCTION:
82SSL_set_verify 94 EXIST::FUNCTION:
83SSL_set_wfd 95 EXIST::FUNCTION:SOCK
84SSL_shutdown 96 EXIST::FUNCTION:
85SSL_state_string 97 EXIST::FUNCTION:
86SSL_state_string_long 98 EXIST::FUNCTION:
87SSL_use_PrivateKey 99 EXIST::FUNCTION:
88SSL_use_PrivateKey_ASN1 100 EXIST::FUNCTION:
89SSL_use_PrivateKey_file 101 EXIST::FUNCTION:STDIO
90SSL_use_RSAPrivateKey 102 EXIST::FUNCTION:RSA
91SSL_use_RSAPrivateKey_ASN1 103 EXIST::FUNCTION:RSA
92SSL_use_RSAPrivateKey_file 104 EXIST::FUNCTION:RSA,STDIO
93SSL_use_certificate 105 EXIST::FUNCTION:
94SSL_use_certificate_ASN1 106 EXIST::FUNCTION:
95SSL_use_certificate_file 107 EXIST::FUNCTION:STDIO
96SSL_write 108 EXIST::FUNCTION:
97SSLeay_add_ssl_algorithms 109 NOEXIST::FUNCTION:
98SSLv23_client_method 110 EXIST::FUNCTION:RSA
99SSLv23_method 111 EXIST::FUNCTION:RSA
100SSLv23_server_method 112 EXIST::FUNCTION:RSA
101SSLv2_client_method 113 EXIST::FUNCTION:RSA,SSL2
102SSLv2_method 114 EXIST::FUNCTION:RSA,SSL2
103SSLv2_server_method 115 EXIST::FUNCTION:RSA,SSL2
104SSLv3_client_method 116 EXIST::FUNCTION:
105SSLv3_method 117 EXIST::FUNCTION:
106SSLv3_server_method 118 EXIST::FUNCTION:
107d2i_SSL_SESSION 119 EXIST::FUNCTION:
108i2d_SSL_SESSION 120 EXIST::FUNCTION:
109BIO_f_ssl 121 EXIST::FUNCTION:BIO
110BIO_new_ssl 122 EXIST::FUNCTION:BIO
111BIO_proxy_ssl_copy_session_id 123 NOEXIST::FUNCTION:
112BIO_ssl_copy_session_id 124 EXIST::FUNCTION:BIO
113SSL_do_handshake 125 EXIST::FUNCTION:
114SSL_get_privatekey 126 EXIST::FUNCTION:
115SSL_get_current_cipher 127 EXIST::FUNCTION:
116SSL_CIPHER_get_bits 128 EXIST::FUNCTION:
117SSL_CIPHER_get_version 129 EXIST::FUNCTION:
118SSL_CIPHER_get_name 130 EXIST::FUNCTION:
119BIO_ssl_shutdown 131 EXIST::FUNCTION:BIO
120SSL_SESSION_cmp 132 NOEXIST::FUNCTION:
121SSL_SESSION_hash 133 NOEXIST::FUNCTION:
122SSL_SESSION_get_time 134 EXIST::FUNCTION:
123SSL_SESSION_set_time 135 EXIST::FUNCTION:
124SSL_SESSION_get_timeout 136 EXIST::FUNCTION:
125SSL_SESSION_set_timeout 137 EXIST::FUNCTION:
126SSL_CTX_get_ex_data 138 EXIST::FUNCTION:
127SSL_CTX_get_quiet_shutdown 140 EXIST::FUNCTION:
128SSL_CTX_load_verify_locations 141 EXIST::FUNCTION:
129SSL_CTX_set_default_verify_paths 142 EXIST:!VMS:FUNCTION:
130SSL_CTX_set_def_verify_paths 142 EXIST:VMS:FUNCTION:
131SSL_CTX_set_ex_data 143 EXIST::FUNCTION:
132SSL_CTX_set_quiet_shutdown 145 EXIST::FUNCTION:
133SSL_SESSION_get_ex_data 146 EXIST::FUNCTION:
134SSL_SESSION_set_ex_data 148 EXIST::FUNCTION:
135SSL_get_SSL_CTX 150 EXIST::FUNCTION:
136SSL_get_ex_data 151 EXIST::FUNCTION:
137SSL_get_quiet_shutdown 153 EXIST::FUNCTION:
138SSL_get_session 154 EXIST::FUNCTION:
139SSL_get_shutdown 155 EXIST::FUNCTION:
140SSL_get_verify_result 157 EXIST::FUNCTION:
141SSL_set_ex_data 158 EXIST::FUNCTION:
142SSL_set_info_callback 160 EXIST::FUNCTION:
143SSL_set_quiet_shutdown 161 EXIST::FUNCTION:
144SSL_set_shutdown 162 EXIST::FUNCTION:
145SSL_set_verify_result 163 EXIST::FUNCTION:
146SSL_version 164 EXIST::FUNCTION:
147SSL_get_info_callback 165 EXIST::FUNCTION:
148SSL_state 166 EXIST::FUNCTION:
149SSL_CTX_get_ex_new_index 167 EXIST::FUNCTION:
150SSL_SESSION_get_ex_new_index 168 EXIST::FUNCTION:
151SSL_get_ex_new_index 169 EXIST::FUNCTION:
152TLSv1_method 170 EXIST::FUNCTION:
153TLSv1_server_method 171 EXIST::FUNCTION:
154TLSv1_client_method 172 EXIST::FUNCTION:
155BIO_new_buffer_ssl_connect 173 EXIST::FUNCTION:BIO
156BIO_new_ssl_connect 174 EXIST::FUNCTION:BIO
157SSL_get_ex_data_X509_STORE_CTX_idx 175 EXIST:!VMS:FUNCTION:
158SSL_get_ex_d_X509_STORE_CTX_idx 175 EXIST:VMS:FUNCTION:
159SSL_CTX_set_tmp_dh_callback 176 EXIST::FUNCTION:DH
160SSL_CTX_set_tmp_rsa_callback 177 EXIST::FUNCTION:RSA
161SSL_CTX_set_timeout 178 EXIST::FUNCTION:
162SSL_CTX_get_timeout 179 EXIST::FUNCTION:
163SSL_CTX_get_cert_store 180 EXIST::FUNCTION:
164SSL_CTX_set_cert_store 181 EXIST::FUNCTION:
165SSL_want 182 EXIST::FUNCTION:
166SSL_library_init 183 EXIST::FUNCTION:
167SSL_COMP_add_compression_method 184 EXIST::FUNCTION:COMP
168SSL_add_file_cert_subjects_to_stack 185 EXIST:!VMS:FUNCTION:STDIO
169SSL_add_file_cert_subjs_to_stk 185 EXIST:VMS:FUNCTION:STDIO
170SSL_set_tmp_rsa_callback 186 EXIST::FUNCTION:RSA
171SSL_set_tmp_dh_callback 187 EXIST::FUNCTION:DH
172SSL_add_dir_cert_subjects_to_stack 188 EXIST:!VMS:FUNCTION:STDIO
173SSL_add_dir_cert_subjs_to_stk 188 EXIST:VMS:FUNCTION:STDIO
174SSL_set_session_id_context 189 EXIST::FUNCTION:
175SSL_CTX_use_certificate_chain_file 222 EXIST:!VMS:FUNCTION:STDIO
176SSL_CTX_use_cert_chain_file 222 EXIST:VMS:FUNCTION:STDIO
177SSL_CTX_set_verify_depth 225 EXIST::FUNCTION:
178SSL_set_verify_depth 226 EXIST::FUNCTION:
179SSL_CTX_get_verify_depth 228 EXIST::FUNCTION:
180SSL_get_verify_depth 229 EXIST::FUNCTION:
181SSL_CTX_set_session_id_context 231 EXIST::FUNCTION:
182SSL_CTX_set_cert_verify_callback 232 EXIST:!VMS:FUNCTION:
183SSL_CTX_set_cert_verify_cb 232 EXIST:VMS:FUNCTION:
184SSL_CTX_set_default_passwd_cb_userdata 235 EXIST:!VMS:FUNCTION:
185SSL_CTX_set_def_passwd_cb_ud 235 EXIST:VMS:FUNCTION:
186SSL_set_purpose 236 EXIST::FUNCTION:
187SSL_CTX_set_trust 237 EXIST::FUNCTION:
188SSL_CTX_set_purpose 238 EXIST::FUNCTION:
189SSL_set_trust 239 EXIST::FUNCTION:
190SSL_get_finished 240 EXIST::FUNCTION:
191SSL_get_peer_finished 241 EXIST::FUNCTION:
192SSL_get1_session 242 EXIST::FUNCTION:
193SSL_CTX_callback_ctrl 243 EXIST::FUNCTION:
194SSL_callback_ctrl 244 EXIST::FUNCTION:
195SSL_CTX_sessions 245 EXIST::FUNCTION:
196SSL_get_rfd 246 EXIST::FUNCTION:
197SSL_get_wfd 247 EXIST::FUNCTION:
198kssl_cget_tkt 248 EXIST::FUNCTION:KRB5
199SSL_has_matching_session_id 249 EXIST::FUNCTION:
200kssl_err_set 250 EXIST::FUNCTION:KRB5
201kssl_ctx_show 251 EXIST::FUNCTION:KRB5
202kssl_validate_times 252 EXIST::FUNCTION:KRB5
203kssl_check_authent 253 EXIST::FUNCTION:KRB5
204kssl_ctx_new 254 EXIST::FUNCTION:KRB5
205kssl_build_principal_2 255 EXIST::FUNCTION:KRB5
206kssl_skip_confound 256 EXIST::FUNCTION:KRB5
207kssl_sget_tkt 257 EXIST::FUNCTION:KRB5
208SSL_set_generate_session_id 258 EXIST::FUNCTION:
209kssl_ctx_setkey 259 EXIST::FUNCTION:KRB5
210kssl_ctx_setprinc 260 EXIST::FUNCTION:KRB5
211kssl_ctx_free 261 EXIST::FUNCTION:KRB5
212kssl_krb5_free_data_contents 262 EXIST::FUNCTION:KRB5
213kssl_ctx_setstring 263 EXIST::FUNCTION:KRB5
214SSL_CTX_set_generate_session_id 264 EXIST::FUNCTION:
215SSL_renegotiate_pending 265 EXIST::FUNCTION:
216SSL_CTX_set_msg_callback 266 EXIST::FUNCTION:
217SSL_set_msg_callback 267 EXIST::FUNCTION:
218DTLSv1_client_method 268 EXIST::FUNCTION:
219SSL_CTX_set_tmp_ecdh_callback 269 EXIST::FUNCTION:ECDH
220SSL_set_tmp_ecdh_callback 270 EXIST::FUNCTION:ECDH
221SSL_COMP_get_name 271 EXIST::FUNCTION:COMP
222SSL_get_current_compression 272 EXIST::FUNCTION:COMP
223DTLSv1_method 273 EXIST::FUNCTION:
224SSL_get_current_expansion 274 EXIST::FUNCTION:COMP
225DTLSv1_server_method 275 EXIST::FUNCTION:
226SSL_COMP_get_compression_methods 276 EXIST:!VMS:FUNCTION:COMP
227SSL_COMP_get_compress_methods 276 EXIST:VMS:FUNCTION:COMP
228SSL_SESSION_get_id 277 EXIST::FUNCTION:
229SSL_CTX_sess_set_new_cb 278 EXIST::FUNCTION:
230SSL_CTX_sess_get_get_cb 279 EXIST::FUNCTION:
231SSL_CTX_sess_set_get_cb 280 EXIST::FUNCTION:
232SSL_CTX_set_cookie_verify_cb 281 EXIST::FUNCTION:
233SSL_CTX_get_info_callback 282 EXIST::FUNCTION:
234SSL_CTX_set_cookie_generate_cb 283 EXIST::FUNCTION:
235SSL_CTX_set_client_cert_cb 284 EXIST::FUNCTION:
236SSL_CTX_sess_set_remove_cb 285 EXIST::FUNCTION:
237SSL_CTX_set_info_callback 286 EXIST::FUNCTION:
238SSL_CTX_sess_get_new_cb 287 EXIST::FUNCTION:
239SSL_CTX_get_client_cert_cb 288 EXIST::FUNCTION:
240SSL_CTX_sess_get_remove_cb 289 EXIST::FUNCTION:
241SSL_set_SSL_CTX 290 EXIST::FUNCTION:
242SSL_get_servername 291 EXIST::FUNCTION:TLSEXT
243SSL_get_servername_type 292 EXIST::FUNCTION:TLSEXT
244SSL_CTX_set_client_cert_engine 293 EXIST::FUNCTION:ENGINE
245SSL_CTX_use_psk_identity_hint 294 EXIST::FUNCTION:PSK
246SSL_CTX_set_psk_client_callback 295 EXIST::FUNCTION:PSK
247PEM_write_bio_SSL_SESSION 296 EXIST::FUNCTION:
248SSL_get_psk_identity_hint 297 EXIST::FUNCTION:PSK
249SSL_set_psk_server_callback 298 EXIST::FUNCTION:PSK
250SSL_use_psk_identity_hint 299 EXIST::FUNCTION:PSK
251SSL_set_psk_client_callback 300 EXIST::FUNCTION:PSK
252PEM_read_SSL_SESSION 301 EXIST:!WIN16:FUNCTION:
253PEM_read_bio_SSL_SESSION 302 EXIST::FUNCTION:
254SSL_CTX_set_psk_server_callback 303 EXIST::FUNCTION:PSK
255SSL_get_psk_identity 304 EXIST::FUNCTION:PSK
256PEM_write_SSL_SESSION 305 EXIST:!WIN16:FUNCTION:
257SSL_set_session_ticket_ext 306 EXIST::FUNCTION:
258SSL_set_session_secret_cb 307 EXIST::FUNCTION:
259SSL_set_session_ticket_ext_cb 308 EXIST::FUNCTION:
260SSL_set1_param 309 EXIST::FUNCTION:
261SSL_CTX_set1_param 310 EXIST::FUNCTION:
262SSL_tls1_key_exporter 311 NOEXIST::FUNCTION:
263SSL_renegotiate_abbreviated 312 EXIST::FUNCTION:
264TLSv1_1_method 313 EXIST::FUNCTION:
265TLSv1_1_client_method 314 EXIST::FUNCTION:
266TLSv1_1_server_method 315 EXIST::FUNCTION:
267SSL_CTX_set_srp_client_pwd_callback 316 EXIST:!VMS:FUNCTION:SRP
268SSL_CTX_set_srp_client_pwd_cb 316 EXIST:VMS:FUNCTION:SRP
269SSL_get_srp_g 317 EXIST::FUNCTION:SRP
270SSL_CTX_set_srp_username_callback 318 EXIST:!VMS:FUNCTION:SRP
271SSL_CTX_set_srp_un_cb 318 EXIST:VMS:FUNCTION:SRP
272SSL_get_srp_userinfo 319 EXIST::FUNCTION:SRP
273SSL_set_srp_server_param 320 EXIST::FUNCTION:SRP
274SSL_set_srp_server_param_pw 321 EXIST::FUNCTION:SRP
275SSL_get_srp_N 322 EXIST::FUNCTION:SRP
276SSL_get_srp_username 323 EXIST::FUNCTION:SRP
277SSL_CTX_set_srp_password 324 EXIST::FUNCTION:SRP
278SSL_CTX_set_srp_strength 325 EXIST::FUNCTION:SRP
279SSL_CTX_set_srp_verify_param_callback 326 EXIST:!VMS:FUNCTION:SRP
280SSL_CTX_set_srp_vfy_param_cb 326 EXIST:VMS:FUNCTION:SRP
281SSL_CTX_set_srp_miss_srp_un_cb 327 NOEXIST::FUNCTION:
282SSL_CTX_set_srp_missing_srp_username_callback 327 NOEXIST::FUNCTION:
283SSL_CTX_set_srp_cb_arg 328 EXIST::FUNCTION:SRP
284SSL_CTX_set_srp_username 329 EXIST::FUNCTION:SRP
285SSL_CTX_SRP_CTX_init 330 EXIST::FUNCTION:SRP
286SSL_SRP_CTX_init 331 EXIST::FUNCTION:SRP
287SRP_Calc_A_param 332 EXIST::FUNCTION:SRP
288SRP_generate_server_master_secret 333 EXIST:!VMS:FUNCTION:SRP
289SRP_gen_server_master_secret 333 EXIST:VMS:FUNCTION:SRP
290SSL_CTX_SRP_CTX_free 334 EXIST::FUNCTION:SRP
291SRP_generate_client_master_secret 335 EXIST:!VMS:FUNCTION:SRP
292SRP_gen_client_master_secret 335 EXIST:VMS:FUNCTION:SRP
293SSL_srp_server_param_with_username 336 EXIST:!VMS:FUNCTION:SRP
294SSL_srp_server_param_with_un 336 EXIST:VMS:FUNCTION:SRP
295SRP_have_to_put_srp_username 337 NOEXIST::FUNCTION:
296SSL_SRP_CTX_free 338 EXIST::FUNCTION:SRP
297SSL_set_debug 339 EXIST::FUNCTION:
298SSL_SESSION_get0_peer 340 EXIST::FUNCTION:
299TLSv1_2_client_method 341 EXIST::FUNCTION:
300SSL_SESSION_set1_id_context 342 EXIST::FUNCTION:
301TLSv1_2_server_method 343 EXIST::FUNCTION:
302SSL_cache_hit 344 EXIST::FUNCTION:
303SSL_get0_kssl_ctx 345 EXIST::FUNCTION:KRB5
304SSL_set0_kssl_ctx 346 EXIST::FUNCTION:KRB5
305SSL_SESSION_get0_id 347 NOEXIST::FUNCTION:
306SSL_set_state 348 EXIST::FUNCTION:
307SSL_CIPHER_get_id 349 EXIST::FUNCTION:
308TLSv1_2_method 350 EXIST::FUNCTION:
309SSL_SESSION_get_id_len 351 NOEXIST::FUNCTION:
310kssl_ctx_get0_client_princ 352 EXIST::FUNCTION:KRB5
311SSL_export_keying_material 353 EXIST::FUNCTION:TLSEXT
312SSL_set_tlsext_use_srtp 354 EXIST::FUNCTION:
313SSL_CTX_set_next_protos_advertised_cb 355 EXIST:!VMS:FUNCTION:NEXTPROTONEG
314SSL_CTX_set_next_protos_adv_cb 355 EXIST:VMS:FUNCTION:NEXTPROTONEG
315SSL_get0_next_proto_negotiated 356 EXIST::FUNCTION:NEXTPROTONEG
316SSL_get_selected_srtp_profile 357 EXIST::FUNCTION:
317SSL_CTX_set_tlsext_use_srtp 358 EXIST::FUNCTION:
318SSL_select_next_proto 359 EXIST::FUNCTION:NEXTPROTONEG
319SSL_get_srtp_profiles 360 EXIST::FUNCTION:
320SSL_CTX_set_next_proto_select_cb 361 EXIST:!VMS:FUNCTION:NEXTPROTONEG
321SSL_CTX_set_next_proto_sel_cb 361 EXIST:VMS:FUNCTION:NEXTPROTONEG
322SSL_SESSION_get_compress_id 362 EXIST::FUNCTION:
diff --git a/src/lib/libcrypto/util/tab_num.pl b/src/lib/libcrypto/util/tab_num.pl
new file mode 100644
index 0000000000..a81ed0edc2
--- /dev/null
+++ b/src/lib/libcrypto/util/tab_num.pl
@@ -0,0 +1,17 @@
1#!/usr/local/bin/perl
2
3$num=1;
4$width=40;
5
6while (<>)
7 {
8 chop;
9
10 $i=length($_);
11
12 $n=$width-$i;
13 $i=int(($n+7)/8);
14 print $_.("\t" x $i).$num."\n";
15 $num++;
16 }
17
diff --git a/src/lib/libcrypto/util/x86asm.sh b/src/lib/libcrypto/util/x86asm.sh
new file mode 100644
index 0000000000..d2090a9849
--- /dev/null
+++ b/src/lib/libcrypto/util/x86asm.sh
@@ -0,0 +1,42 @@
1#!/bin/sh
2
3echo Generating x86 assember
4echo Bignum
5(cd crypto/bn/asm; perl x86.pl cpp > bn86unix.cpp)
6(cd crypto/bn/asm; perl x86.pl win32 > bn-win32.asm)
7
8echo DES
9(cd crypto/des/asm; perl des-586.pl cpp > dx86unix.cpp)
10(cd crypto/des/asm; perl des-586.pl win32 > d-win32.asm)
11
12echo "crypt(3)"
13(cd crypto/des/asm; perl crypt586.pl cpp > yx86unix.cpp)
14(cd crypto/des/asm; perl crypt586.pl win32 > y-win32.asm)
15
16echo Blowfish
17(cd crypto/bf/asm; perl bf-586.pl cpp > bx86unix.cpp)
18(cd crypto/bf/asm; perl bf-586.pl win32 > b-win32.asm)
19
20echo CAST5
21(cd crypto/cast/asm; perl cast-586.pl cpp > cx86unix.cpp)
22(cd crypto/cast/asm; perl cast-586.pl win32 > c-win32.asm)
23
24echo RC4
25(cd crypto/rc4/asm; perl rc4-586.pl cpp > rx86unix.cpp)
26(cd crypto/rc4/asm; perl rc4-586.pl win32 > r4-win32.asm)
27
28echo MD5
29(cd crypto/md5/asm; perl md5-586.pl cpp > mx86unix.cpp)
30(cd crypto/md5/asm; perl md5-586.pl win32 > m5-win32.asm)
31
32echo SHA1
33(cd crypto/sha/asm; perl sha1-586.pl cpp > sx86unix.cpp)
34(cd crypto/sha/asm; perl sha1-586.pl win32 > s1-win32.asm)
35
36echo RIPEMD160
37(cd crypto/ripemd/asm; perl rmd-586.pl cpp > rm86unix.cpp)
38(cd crypto/ripemd/asm; perl rmd-586.pl win32 > rm-win32.asm)
39
40echo RC5/32
41(cd crypto/rc5/asm; perl rc5-586.pl cpp > r586unix.cpp)
42(cd crypto/rc5/asm; perl rc5-586.pl win32 > r5-win32.asm)
diff --git a/src/lib/libcrypto/vms_rms.h b/src/lib/libcrypto/vms_rms.h
new file mode 100755
index 0000000000..00a00d993f
--- /dev/null
+++ b/src/lib/libcrypto/vms_rms.h
@@ -0,0 +1,51 @@
1
2#ifdef NAML$C_MAXRSS
3
4# define CC_RMS_NAMX cc$rms_naml
5# define FAB_NAMX fab$l_naml
6# define FAB_OR_NAML( fab, naml) naml
7# define FAB_OR_NAML_DNA naml$l_long_defname
8# define FAB_OR_NAML_DNS naml$l_long_defname_size
9# define FAB_OR_NAML_FNA naml$l_long_filename
10# define FAB_OR_NAML_FNS naml$l_long_filename_size
11# define NAMX_ESA naml$l_long_expand
12# define NAMX_ESL naml$l_long_expand_size
13# define NAMX_ESS naml$l_long_expand_alloc
14# define NAMX_NOP naml$b_nop
15# define SET_NAMX_NO_SHORT_UPCASE( nam) nam.naml$v_no_short_upcase = 1
16
17# if __INITIAL_POINTER_SIZE == 64
18# define NAMX_DNA_FNA_SET(fab) fab.fab$l_dna = (__char_ptr32) -1; \
19 fab.fab$l_fna = (__char_ptr32) -1;
20# else /* __INITIAL_POINTER_SIZE == 64 */
21# define NAMX_DNA_FNA_SET(fab) fab.fab$l_dna = (char *) -1; \
22 fab.fab$l_fna = (char *) -1;
23# endif /* __INITIAL_POINTER_SIZE == 64 [else] */
24
25# define NAMX_MAXRSS NAML$C_MAXRSS
26# define NAMX_STRUCT NAML
27
28#else /* def NAML$C_MAXRSS */
29
30# define CC_RMS_NAMX cc$rms_nam
31# define FAB_NAMX fab$l_nam
32# define FAB_OR_NAML( fab, naml) fab
33# define FAB_OR_NAML_DNA fab$l_dna
34# define FAB_OR_NAML_DNS fab$b_dns
35# define FAB_OR_NAML_FNA fab$l_fna
36# define FAB_OR_NAML_FNS fab$b_fns
37# define NAMX_ESA nam$l_esa
38# define NAMX_ESL nam$b_esl
39# define NAMX_ESS nam$b_ess
40# define NAMX_NOP nam$b_nop
41# define NAMX_DNA_FNA_SET(fab)
42# define NAMX_MAXRSS NAM$C_MAXRSS
43# define NAMX_STRUCT NAM
44# ifdef NAM$M_NO_SHORT_UPCASE
45# define SET_NAMX_NO_SHORT_UPCASE( nam) naml.naml$v_no_short_upcase = 1
46# else /* def NAM$M_NO_SHORT_UPCASE */
47# define SET_NAMX_NO_SHORT_UPCASE( nam)
48# endif /* def NAM$M_NO_SHORT_UPCASE [else] */
49
50#endif /* def NAML$C_MAXRSS [else] */
51
diff --git a/src/lib/libcrypto/whrlpool/Makefile b/src/lib/libcrypto/whrlpool/Makefile
new file mode 100644
index 0000000000..f4d46e4d17
--- /dev/null
+++ b/src/lib/libcrypto/whrlpool/Makefile
@@ -0,0 +1,96 @@
1#
2# crypto/whrlpool/Makefile
3#
4
5DIR= whrlpool
6TOP= ../..
7CC= cc
8CPP= $(CC) -E
9INCLUDES=
10CFLAG=-g
11MAKEFILE= Makefile
12AR= ar r
13
14WP_ASM_OBJ=wp_block.o
15
16CFLAGS= $(INCLUDES) $(CFLAG)
17ASFLAGS= $(INCLUDES) $(ASFLAG)
18AFLAGS= $(ASFLAGS)
19
20GENERAL=Makefile
21TEST=wp_test.c
22APPS=
23
24LIB=$(TOP)/libcrypto.a
25LIBSRC=wp_dgst.c wp_block.c
26LIBOBJ=wp_dgst.o $(WP_ASM_OBJ)
27
28SRC= $(LIBSRC)
29
30EXHEADER= whrlpool.h
31HEADER= wp_locl.h $(EXHEADER)
32
33ALL= $(GENERAL) $(SRC) $(HEADER)
34
35top:
36 (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all)
37
38all: lib
39
40lib: $(LIBOBJ)
41 $(AR) $(LIB) $(LIBOBJ)
42 $(RANLIB) $(LIB) || echo Never mind.
43 @touch lib
44
45wp-mmx.s: asm/wp-mmx.pl ../perlasm/x86asm.pl
46 $(PERL) asm/wp-mmx.pl $(PERLASM_SCHEME) $(CFLAGS) $(PROCESSOR) > $@
47
48wp-x86_64.s: asm/wp-x86_64.pl
49 $(PERL) asm/wp-x86_64.pl $(PERLASM_SCHEME) > $@
50
51$(LIBOBJ): $(LIBSRC)
52
53files:
54 $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
55
56links:
57 @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
58 @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
59 @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
60
61install:
62 @[ -n "$(INSTALLTOP)" ] # should be set by top Makefile...
63 @headerlist="$(EXHEADER)"; for i in $$headerlist ; \
64 do \
65 (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
66 chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
67 done;
68
69tags:
70 ctags $(SRC)
71
72tests:
73
74lint:
75 lint -DLINT $(INCLUDES) $(SRC)>fluff
76
77depend:
78 @[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile...
79 $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
80
81dclean:
82 $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
83 mv -f Makefile.new $(MAKEFILE)
84
85clean:
86 rm -f *.s *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
87
88# DO NOT DELETE THIS LINE -- make depend depends on it.
89
90wp_block.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslconf.h
91wp_block.o: ../../include/openssl/whrlpool.h wp_block.c wp_locl.h
92wp_dgst.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
93wp_dgst.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
94wp_dgst.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
95wp_dgst.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
96wp_dgst.o: ../../include/openssl/whrlpool.h wp_dgst.c wp_locl.h
diff --git a/src/lib/libcrypto/whrlpool/wp_test.c b/src/lib/libcrypto/whrlpool/wp_test.c
new file mode 100644
index 0000000000..c68c2c62ca
--- /dev/null
+++ b/src/lib/libcrypto/whrlpool/wp_test.c
@@ -0,0 +1,228 @@
1/* ====================================================================
2 * Copyright (c) 2005 The OpenSSL Project. All rights reserved.
3 * ====================================================================
4 */
5#include <stdio.h>
6#include <string.h>
7#include <stdlib.h>
8
9#include <openssl/whrlpool.h>
10#include <openssl/crypto.h>
11
12#if defined(OPENSSL_NO_WHIRLPOOL)
13int main(int argc, char *argv[])
14{
15 printf("No Whirlpool support\n");
16 return(0);
17}
18#else
19
20/* ISO/IEC 10118-3 test vector set */
21unsigned char iso_test_1[WHIRLPOOL_DIGEST_LENGTH] = {
22 0x19,0xFA,0x61,0xD7,0x55,0x22,0xA4,0x66,
23 0x9B,0x44,0xE3,0x9C,0x1D,0x2E,0x17,0x26,
24 0xC5,0x30,0x23,0x21,0x30,0xD4,0x07,0xF8,
25 0x9A,0xFE,0xE0,0x96,0x49,0x97,0xF7,0xA7,
26 0x3E,0x83,0xBE,0x69,0x8B,0x28,0x8F,0xEB,
27 0xCF,0x88,0xE3,0xE0,0x3C,0x4F,0x07,0x57,
28 0xEA,0x89,0x64,0xE5,0x9B,0x63,0xD9,0x37,
29 0x08,0xB1,0x38,0xCC,0x42,0xA6,0x6E,0xB3 };
30
31unsigned char iso_test_2[WHIRLPOOL_DIGEST_LENGTH] = {
32 0x8A,0xCA,0x26,0x02,0x79,0x2A,0xEC,0x6F,
33 0x11,0xA6,0x72,0x06,0x53,0x1F,0xB7,0xD7,
34 0xF0,0xDF,0xF5,0x94,0x13,0x14,0x5E,0x69,
35 0x73,0xC4,0x50,0x01,0xD0,0x08,0x7B,0x42,
36 0xD1,0x1B,0xC6,0x45,0x41,0x3A,0xEF,0xF6,
37 0x3A,0x42,0x39,0x1A,0x39,0x14,0x5A,0x59,
38 0x1A,0x92,0x20,0x0D,0x56,0x01,0x95,0xE5,
39 0x3B,0x47,0x85,0x84,0xFD,0xAE,0x23,0x1A };
40
41unsigned char iso_test_3[WHIRLPOOL_DIGEST_LENGTH] = {
42 0x4E,0x24,0x48,0xA4,0xC6,0xF4,0x86,0xBB,
43 0x16,0xB6,0x56,0x2C,0x73,0xB4,0x02,0x0B,
44 0xF3,0x04,0x3E,0x3A,0x73,0x1B,0xCE,0x72,
45 0x1A,0xE1,0xB3,0x03,0xD9,0x7E,0x6D,0x4C,
46 0x71,0x81,0xEE,0xBD,0xB6,0xC5,0x7E,0x27,
47 0x7D,0x0E,0x34,0x95,0x71,0x14,0xCB,0xD6,
48 0xC7,0x97,0xFC,0x9D,0x95,0xD8,0xB5,0x82,
49 0xD2,0x25,0x29,0x20,0x76,0xD4,0xEE,0xF5 };
50
51unsigned char iso_test_4[WHIRLPOOL_DIGEST_LENGTH] = {
52 0x37,0x8C,0x84,0xA4,0x12,0x6E,0x2D,0xC6,
53 0xE5,0x6D,0xCC,0x74,0x58,0x37,0x7A,0xAC,
54 0x83,0x8D,0x00,0x03,0x22,0x30,0xF5,0x3C,
55 0xE1,0xF5,0x70,0x0C,0x0F,0xFB,0x4D,0x3B,
56 0x84,0x21,0x55,0x76,0x59,0xEF,0x55,0xC1,
57 0x06,0xB4,0xB5,0x2A,0xC5,0xA4,0xAA,0xA6,
58 0x92,0xED,0x92,0x00,0x52,0x83,0x8F,0x33,
59 0x62,0xE8,0x6D,0xBD,0x37,0xA8,0x90,0x3E };
60
61unsigned char iso_test_5[WHIRLPOOL_DIGEST_LENGTH] = {
62 0xF1,0xD7,0x54,0x66,0x26,0x36,0xFF,0xE9,
63 0x2C,0x82,0xEB,0xB9,0x21,0x2A,0x48,0x4A,
64 0x8D,0x38,0x63,0x1E,0xAD,0x42,0x38,0xF5,
65 0x44,0x2E,0xE1,0x3B,0x80,0x54,0xE4,0x1B,
66 0x08,0xBF,0x2A,0x92,0x51,0xC3,0x0B,0x6A,
67 0x0B,0x8A,0xAE,0x86,0x17,0x7A,0xB4,0xA6,
68 0xF6,0x8F,0x67,0x3E,0x72,0x07,0x86,0x5D,
69 0x5D,0x98,0x19,0xA3,0xDB,0xA4,0xEB,0x3B };
70
71unsigned char iso_test_6[WHIRLPOOL_DIGEST_LENGTH] = {
72 0xDC,0x37,0xE0,0x08,0xCF,0x9E,0xE6,0x9B,
73 0xF1,0x1F,0x00,0xED,0x9A,0xBA,0x26,0x90,
74 0x1D,0xD7,0xC2,0x8C,0xDE,0xC0,0x66,0xCC,
75 0x6A,0xF4,0x2E,0x40,0xF8,0x2F,0x3A,0x1E,
76 0x08,0xEB,0xA2,0x66,0x29,0x12,0x9D,0x8F,
77 0xB7,0xCB,0x57,0x21,0x1B,0x92,0x81,0xA6,
78 0x55,0x17,0xCC,0x87,0x9D,0x7B,0x96,0x21,
79 0x42,0xC6,0x5F,0x5A,0x7A,0xF0,0x14,0x67 };
80
81unsigned char iso_test_7[WHIRLPOOL_DIGEST_LENGTH] = {
82 0x46,0x6E,0xF1,0x8B,0xAB,0xB0,0x15,0x4D,
83 0x25,0xB9,0xD3,0x8A,0x64,0x14,0xF5,0xC0,
84 0x87,0x84,0x37,0x2B,0xCC,0xB2,0x04,0xD6,
85 0x54,0x9C,0x4A,0xFA,0xDB,0x60,0x14,0x29,
86 0x4D,0x5B,0xD8,0xDF,0x2A,0x6C,0x44,0xE5,
87 0x38,0xCD,0x04,0x7B,0x26,0x81,0xA5,0x1A,
88 0x2C,0x60,0x48,0x1E,0x88,0xC5,0xA2,0x0B,
89 0x2C,0x2A,0x80,0xCF,0x3A,0x9A,0x08,0x3B };
90
91unsigned char iso_test_8[WHIRLPOOL_DIGEST_LENGTH] = {
92 0x2A,0x98,0x7E,0xA4,0x0F,0x91,0x70,0x61,
93 0xF5,0xD6,0xF0,0xA0,0xE4,0x64,0x4F,0x48,
94 0x8A,0x7A,0x5A,0x52,0xDE,0xEE,0x65,0x62,
95 0x07,0xC5,0x62,0xF9,0x88,0xE9,0x5C,0x69,
96 0x16,0xBD,0xC8,0x03,0x1B,0xC5,0xBE,0x1B,
97 0x7B,0x94,0x76,0x39,0xFE,0x05,0x0B,0x56,
98 0x93,0x9B,0xAA,0xA0,0xAD,0xFF,0x9A,0xE6,
99 0x74,0x5B,0x7B,0x18,0x1C,0x3B,0xE3,0xFD };
100
101unsigned char iso_test_9[WHIRLPOOL_DIGEST_LENGTH] = {
102 0x0C,0x99,0x00,0x5B,0xEB,0x57,0xEF,0xF5,
103 0x0A,0x7C,0xF0,0x05,0x56,0x0D,0xDF,0x5D,
104 0x29,0x05,0x7F,0xD8,0x6B,0x20,0xBF,0xD6,
105 0x2D,0xEC,0xA0,0xF1,0xCC,0xEA,0x4A,0xF5,
106 0x1F,0xC1,0x54,0x90,0xED,0xDC,0x47,0xAF,
107 0x32,0xBB,0x2B,0x66,0xC3,0x4F,0xF9,0xAD,
108 0x8C,0x60,0x08,0xAD,0x67,0x7F,0x77,0x12,
109 0x69,0x53,0xB2,0x26,0xE4,0xED,0x8B,0x01 };
110
111int main (int argc,char *argv[])
112{ unsigned char md[WHIRLPOOL_DIGEST_LENGTH];
113 int i;
114 WHIRLPOOL_CTX ctx;
115
116#ifdef OPENSSL_IA32_SSE2
117 /* Alternative to this is to call OpenSSL_add_all_algorithms...
118 * The below code is retained exclusively for debugging purposes. */
119 { char *env;
120
121 if ((env=getenv("OPENSSL_ia32cap")))
122 OPENSSL_ia32cap = strtoul (env,NULL,0);
123 }
124#endif
125
126 fprintf(stdout,"Testing Whirlpool ");
127
128 WHIRLPOOL("",0,md);
129 if (memcmp(md,iso_test_1,sizeof(iso_test_1)))
130 { fflush(stdout);
131 fprintf(stderr,"\nTEST 1 of 9 failed.\n");
132 return 1;
133 }
134 else
135 fprintf(stdout,"."); fflush(stdout);
136
137 WHIRLPOOL("a",1,md);
138 if (memcmp(md,iso_test_2,sizeof(iso_test_2)))
139 { fflush(stdout);
140 fprintf(stderr,"\nTEST 2 of 9 failed.\n");
141 return 1;
142 }
143 else
144 fprintf(stdout,"."); fflush(stdout);
145
146 WHIRLPOOL("abc",3,md);
147 if (memcmp(md,iso_test_3,sizeof(iso_test_3)))
148 { fflush(stdout);
149 fprintf(stderr,"\nTEST 3 of 9 failed.\n");
150 return 1;
151 }
152 else
153 fprintf(stdout,"."); fflush(stdout);
154
155 WHIRLPOOL("message digest",14,md);
156 if (memcmp(md,iso_test_4,sizeof(iso_test_4)))
157 { fflush(stdout);
158 fprintf(stderr,"\nTEST 4 of 9 failed.\n");
159 return 1;
160 }
161 else
162 fprintf(stdout,"."); fflush(stdout);
163
164 WHIRLPOOL("abcdefghijklmnopqrstuvwxyz",26,md);
165 if (memcmp(md,iso_test_5,sizeof(iso_test_5)))
166 { fflush(stdout);
167 fprintf(stderr,"\nTEST 5 of 9 failed.\n");
168 return 1;
169 }
170 else
171 fprintf(stdout,"."); fflush(stdout);
172
173 WHIRLPOOL( "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
174 "abcdefghijklmnopqrstuvwxyz"
175 "0123456789",62,md);
176 if (memcmp(md,iso_test_6,sizeof(iso_test_6)))
177 { fflush(stdout);
178 fprintf(stderr,"\nTEST 6 of 9 failed.\n");
179 return 1;
180 }
181 else
182 fprintf(stdout,"."); fflush(stdout);
183
184 WHIRLPOOL( "1234567890""1234567890""1234567890""1234567890"
185 "1234567890""1234567890""1234567890""1234567890",80,md);
186 if (memcmp(md,iso_test_7,sizeof(iso_test_7)))
187 { fflush(stdout);
188 fprintf(stderr,"\nTEST 7 of 9 failed.\n");
189 return 1;
190 }
191 else
192 fprintf(stdout,"."); fflush(stdout);
193
194 WHIRLPOOL("abcdbcdecdefdefgefghfghighijhijk",32,md);
195 if (memcmp(md,iso_test_8,sizeof(iso_test_8)))
196 { fflush(stdout);
197 fprintf(stderr,"\nTEST 8 of 9 failed.\n");
198 return 1;
199 }
200 else
201 fprintf(stdout,"."); fflush(stdout);
202
203 WHIRLPOOL_Init (&ctx);
204 for (i=0;i<1000000;i+=288)
205 WHIRLPOOL_Update (&ctx, "aaaaaaaa""aaaaaaaa""aaaaaaaa""aaaaaaaa"
206 "aaaaaaaa""aaaaaaaa""aaaaaaaa""aaaaaaaa"
207 "aaaaaaaa""aaaaaaaa""aaaaaaaa""aaaaaaaa"
208 "aaaaaaaa""aaaaaaaa""aaaaaaaa""aaaaaaaa"
209 "aaaaaaaa""aaaaaaaa""aaaaaaaa""aaaaaaaa"
210 "aaaaaaaa""aaaaaaaa""aaaaaaaa""aaaaaaaa"
211 "aaaaaaaa""aaaaaaaa""aaaaaaaa""aaaaaaaa"
212 "aaaaaaaa""aaaaaaaa""aaaaaaaa""aaaaaaaa"
213 "aaaaaaaa""aaaaaaaa""aaaaaaaa""aaaaaaaa",
214 (1000000-i)<288?1000000-i:288);
215 WHIRLPOOL_Final (md,&ctx);
216 if (memcmp(md,iso_test_9,sizeof(iso_test_9)))
217 { fflush(stdout);
218 fprintf(stderr,"\nTEST 9 of 9 failed.\n");
219 return 1;
220 }
221 else
222 fprintf(stdout,"."); fflush(stdout);
223
224 fprintf(stdout," passed.\n"); fflush(stdout);
225
226 return 0;
227}
228#endif
diff --git a/src/lib/libcrypto/x509/Makefile b/src/lib/libcrypto/x509/Makefile
new file mode 100644
index 0000000000..72c82278f4
--- /dev/null
+++ b/src/lib/libcrypto/x509/Makefile
@@ -0,0 +1,407 @@
1#
2# OpenSSL/crypto/x509/Makefile
3#
4
5DIR= x509
6TOP= ../..
7CC= cc
8INCLUDES= -I.. -I$(TOP) -I../../include
9CFLAG=-g
10MAKEFILE= Makefile
11AR= ar r
12
13CFLAGS= $(INCLUDES) $(CFLAG)
14
15GENERAL=Makefile README
16TEST=
17APPS=
18
19LIB=$(TOP)/libcrypto.a
20LIBSRC= x509_def.c x509_d2.c x509_r2x.c x509_cmp.c \
21 x509_obj.c x509_req.c x509spki.c x509_vfy.c \
22 x509_set.c x509cset.c x509rset.c x509_err.c \
23 x509name.c x509_v3.c x509_ext.c x509_att.c \
24 x509type.c x509_lu.c x_all.c x509_txt.c \
25 x509_trs.c by_file.c by_dir.c x509_vpm.c
26LIBOBJ= x509_def.o x509_d2.o x509_r2x.o x509_cmp.o \
27 x509_obj.o x509_req.o x509spki.o x509_vfy.o \
28 x509_set.o x509cset.o x509rset.o x509_err.o \
29 x509name.o x509_v3.o x509_ext.o x509_att.o \
30 x509type.o x509_lu.o x_all.o x509_txt.o \
31 x509_trs.o by_file.o by_dir.o x509_vpm.o
32
33SRC= $(LIBSRC)
34
35EXHEADER= x509.h x509_vfy.h
36HEADER= $(EXHEADER)
37
38ALL= $(GENERAL) $(SRC) $(HEADER)
39
40top:
41 (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all)
42
43all: lib
44
45lib: $(LIBOBJ)
46 $(AR) $(LIB) $(LIBOBJ)
47 $(RANLIB) $(LIB) || echo Never mind.
48 @touch lib
49
50files:
51 $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
52
53links:
54 @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
55 @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
56 @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
57
58install:
59 @[ -n "$(INSTALLTOP)" ] # should be set by top Makefile...
60 @headerlist="$(EXHEADER)"; for i in $$headerlist ; \
61 do \
62 (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
63 chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
64 done;
65
66tags:
67 ctags $(SRC)
68
69tests:
70
71lint:
72 lint -DLINT $(INCLUDES) $(SRC)>fluff
73
74depend:
75 @[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile...
76 $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
77
78dclean:
79 $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
80 mv -f Makefile.new $(MAKEFILE)
81
82clean:
83 rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
84
85# DO NOT DELETE THIS LINE -- make depend depends on it.
86
87by_dir.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
88by_dir.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
89by_dir.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
90by_dir.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
91by_dir.o: ../../include/openssl/err.h ../../include/openssl/evp.h
92by_dir.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
93by_dir.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
94by_dir.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
95by_dir.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
96by_dir.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
97by_dir.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
98by_dir.o: ../../include/openssl/x509_vfy.h ../cryptlib.h by_dir.c
99by_file.o: ../../e_os.h ../../include/openssl/asn1.h
100by_file.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
101by_file.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
102by_file.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
103by_file.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
104by_file.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
105by_file.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
106by_file.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
107by_file.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pem.h
108by_file.o: ../../include/openssl/pem2.h ../../include/openssl/pkcs7.h
109by_file.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
110by_file.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
111by_file.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
112by_file.o: ../cryptlib.h by_file.c
113x509_att.o: ../../e_os.h ../../include/openssl/asn1.h
114x509_att.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
115x509_att.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
116x509_att.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
117x509_att.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
118x509_att.o: ../../include/openssl/err.h ../../include/openssl/evp.h
119x509_att.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
120x509_att.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
121x509_att.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
122x509_att.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
123x509_att.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
124x509_att.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
125x509_att.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
126x509_att.o: ../cryptlib.h x509_att.c
127x509_cmp.o: ../../e_os.h ../../include/openssl/asn1.h
128x509_cmp.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
129x509_cmp.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
130x509_cmp.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
131x509_cmp.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
132x509_cmp.o: ../../include/openssl/err.h ../../include/openssl/evp.h
133x509_cmp.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
134x509_cmp.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
135x509_cmp.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
136x509_cmp.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
137x509_cmp.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
138x509_cmp.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
139x509_cmp.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
140x509_cmp.o: ../cryptlib.h x509_cmp.c
141x509_d2.o: ../../e_os.h ../../include/openssl/asn1.h
142x509_d2.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
143x509_d2.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
144x509_d2.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
145x509_d2.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
146x509_d2.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
147x509_d2.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
148x509_d2.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
149x509_d2.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
150x509_d2.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
151x509_d2.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
152x509_d2.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
153x509_d2.o: ../cryptlib.h x509_d2.c
154x509_def.o: ../../e_os.h ../../include/openssl/asn1.h
155x509_def.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
156x509_def.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
157x509_def.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
158x509_def.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
159x509_def.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
160x509_def.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
161x509_def.o: ../../include/openssl/opensslconf.h
162x509_def.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
163x509_def.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
164x509_def.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
165x509_def.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
166x509_def.o: ../../include/openssl/x509_vfy.h ../cryptlib.h x509_def.c
167x509_err.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
168x509_err.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
169x509_err.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
170x509_err.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
171x509_err.o: ../../include/openssl/err.h ../../include/openssl/evp.h
172x509_err.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
173x509_err.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
174x509_err.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
175x509_err.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
176x509_err.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
177x509_err.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
178x509_err.o: ../../include/openssl/x509_vfy.h x509_err.c
179x509_ext.o: ../../e_os.h ../../include/openssl/asn1.h
180x509_ext.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
181x509_ext.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
182x509_ext.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
183x509_ext.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
184x509_ext.o: ../../include/openssl/err.h ../../include/openssl/evp.h
185x509_ext.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
186x509_ext.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
187x509_ext.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
188x509_ext.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
189x509_ext.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
190x509_ext.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
191x509_ext.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
192x509_ext.o: ../cryptlib.h x509_ext.c
193x509_lu.o: ../../e_os.h ../../include/openssl/asn1.h
194x509_lu.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
195x509_lu.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
196x509_lu.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
197x509_lu.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
198x509_lu.o: ../../include/openssl/err.h ../../include/openssl/evp.h
199x509_lu.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
200x509_lu.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
201x509_lu.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
202x509_lu.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
203x509_lu.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
204x509_lu.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
205x509_lu.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
206x509_lu.o: ../cryptlib.h x509_lu.c
207x509_obj.o: ../../e_os.h ../../include/openssl/asn1.h
208x509_obj.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
209x509_obj.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
210x509_obj.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
211x509_obj.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
212x509_obj.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
213x509_obj.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
214x509_obj.o: ../../include/openssl/opensslconf.h
215x509_obj.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
216x509_obj.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
217x509_obj.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
218x509_obj.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
219x509_obj.o: ../../include/openssl/x509_vfy.h ../cryptlib.h x509_obj.c
220x509_r2x.o: ../../e_os.h ../../include/openssl/asn1.h
221x509_r2x.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
222x509_r2x.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
223x509_r2x.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
224x509_r2x.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
225x509_r2x.o: ../../include/openssl/err.h ../../include/openssl/evp.h
226x509_r2x.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
227x509_r2x.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
228x509_r2x.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
229x509_r2x.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
230x509_r2x.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
231x509_r2x.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
232x509_r2x.o: ../../include/openssl/x509_vfy.h ../cryptlib.h x509_r2x.c
233x509_req.o: ../../e_os.h ../../include/openssl/asn1.h
234x509_req.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
235x509_req.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
236x509_req.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
237x509_req.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
238x509_req.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
239x509_req.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
240x509_req.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
241x509_req.o: ../../include/openssl/opensslconf.h
242x509_req.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
243x509_req.o: ../../include/openssl/pem.h ../../include/openssl/pem2.h
244x509_req.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
245x509_req.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
246x509_req.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
247x509_req.o: ../../include/openssl/x509_vfy.h ../cryptlib.h x509_req.c
248x509_set.o: ../../e_os.h ../../include/openssl/asn1.h
249x509_set.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
250x509_set.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
251x509_set.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
252x509_set.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
253x509_set.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
254x509_set.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
255x509_set.o: ../../include/openssl/opensslconf.h
256x509_set.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
257x509_set.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
258x509_set.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
259x509_set.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
260x509_set.o: ../../include/openssl/x509_vfy.h ../cryptlib.h x509_set.c
261x509_trs.o: ../../e_os.h ../../include/openssl/asn1.h
262x509_trs.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
263x509_trs.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
264x509_trs.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
265x509_trs.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
266x509_trs.o: ../../include/openssl/err.h ../../include/openssl/evp.h
267x509_trs.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
268x509_trs.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
269x509_trs.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
270x509_trs.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
271x509_trs.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
272x509_trs.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
273x509_trs.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
274x509_trs.o: ../cryptlib.h x509_trs.c
275x509_txt.o: ../../e_os.h ../../include/openssl/asn1.h
276x509_txt.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
277x509_txt.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
278x509_txt.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
279x509_txt.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
280x509_txt.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
281x509_txt.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
282x509_txt.o: ../../include/openssl/opensslconf.h
283x509_txt.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
284x509_txt.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
285x509_txt.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
286x509_txt.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
287x509_txt.o: ../../include/openssl/x509_vfy.h ../cryptlib.h x509_txt.c
288x509_v3.o: ../../e_os.h ../../include/openssl/asn1.h
289x509_v3.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
290x509_v3.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
291x509_v3.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
292x509_v3.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
293x509_v3.o: ../../include/openssl/err.h ../../include/openssl/evp.h
294x509_v3.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
295x509_v3.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
296x509_v3.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
297x509_v3.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
298x509_v3.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
299x509_v3.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
300x509_v3.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
301x509_v3.o: ../cryptlib.h x509_v3.c
302x509_vfy.o: ../../e_os.h ../../include/openssl/asn1.h
303x509_vfy.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
304x509_vfy.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
305x509_vfy.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
306x509_vfy.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
307x509_vfy.o: ../../include/openssl/err.h ../../include/openssl/evp.h
308x509_vfy.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
309x509_vfy.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
310x509_vfy.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
311x509_vfy.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
312x509_vfy.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
313x509_vfy.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
314x509_vfy.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
315x509_vfy.o: ../cryptlib.h x509_vfy.c
316x509_vpm.o: ../../e_os.h ../../include/openssl/asn1.h
317x509_vpm.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
318x509_vpm.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
319x509_vpm.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
320x509_vpm.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
321x509_vpm.o: ../../include/openssl/err.h ../../include/openssl/evp.h
322x509_vpm.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
323x509_vpm.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
324x509_vpm.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
325x509_vpm.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
326x509_vpm.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
327x509_vpm.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
328x509_vpm.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
329x509_vpm.o: ../cryptlib.h x509_vpm.c
330x509cset.o: ../../e_os.h ../../include/openssl/asn1.h
331x509cset.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
332x509cset.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
333x509cset.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
334x509cset.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
335x509cset.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
336x509cset.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
337x509cset.o: ../../include/openssl/opensslconf.h
338x509cset.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
339x509cset.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
340x509cset.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
341x509cset.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
342x509cset.o: ../../include/openssl/x509_vfy.h ../cryptlib.h x509cset.c
343x509name.o: ../../e_os.h ../../include/openssl/asn1.h
344x509name.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
345x509name.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
346x509name.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
347x509name.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
348x509name.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
349x509name.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
350x509name.o: ../../include/openssl/opensslconf.h
351x509name.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
352x509name.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
353x509name.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
354x509name.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
355x509name.o: ../../include/openssl/x509_vfy.h ../cryptlib.h x509name.c
356x509rset.o: ../../e_os.h ../../include/openssl/asn1.h
357x509rset.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
358x509rset.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
359x509rset.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
360x509rset.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
361x509rset.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
362x509rset.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
363x509rset.o: ../../include/openssl/opensslconf.h
364x509rset.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
365x509rset.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
366x509rset.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
367x509rset.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
368x509rset.o: ../../include/openssl/x509_vfy.h ../cryptlib.h x509rset.c
369x509spki.o: ../../e_os.h ../../include/openssl/asn1.h
370x509spki.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
371x509spki.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
372x509spki.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
373x509spki.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
374x509spki.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
375x509spki.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
376x509spki.o: ../../include/openssl/opensslconf.h
377x509spki.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
378x509spki.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
379x509spki.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
380x509spki.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
381x509spki.o: ../../include/openssl/x509_vfy.h ../cryptlib.h x509spki.c
382x509type.o: ../../e_os.h ../../include/openssl/asn1.h
383x509type.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
384x509type.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
385x509type.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
386x509type.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
387x509type.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
388x509type.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
389x509type.o: ../../include/openssl/opensslconf.h
390x509type.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
391x509type.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
392x509type.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
393x509type.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
394x509type.o: ../../include/openssl/x509_vfy.h ../cryptlib.h x509type.c
395x_all.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
396x_all.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
397x_all.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
398x_all.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
399x_all.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
400x_all.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
401x_all.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
402x_all.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
403x_all.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
404x_all.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
405x_all.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
406x_all.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
407x_all.o: ../../include/openssl/x509_vfy.h ../cryptlib.h x_all.c
diff --git a/src/lib/libcrypto/x509/by_dir.c b/src/lib/libcrypto/x509/by_dir.c
index c6602dae4f..27ca5150c1 100644
--- a/src/lib/libcrypto/x509/by_dir.c
+++ b/src/lib/libcrypto/x509/by_dir.c
@@ -218,7 +218,7 @@ static int add_cert_dir(BY_DIR *ctx, const char *dir, int type)
218 218
219 s=dir; 219 s=dir;
220 p=s; 220 p=s;
221 do 221 for (;;p++)
222 { 222 {
223 if ((*p == LIST_SEPARATOR_CHAR) || (*p == '\0')) 223 if ((*p == LIST_SEPARATOR_CHAR) || (*p == '\0'))
224 { 224 {
@@ -264,7 +264,9 @@ static int add_cert_dir(BY_DIR *ctx, const char *dir, int type)
264 return 0; 264 return 0;
265 } 265 }
266 } 266 }
267 } while (*p++ != '\0'); 267 if (*p == '\0')
268 break;
269 }
268 return 1; 270 return 1;
269 } 271 }
270 272
diff --git a/src/lib/libcrypto/x509/x509_cmp.c b/src/lib/libcrypto/x509/x509_cmp.c
index 352aa37434..7c2aaee2e9 100644
--- a/src/lib/libcrypto/x509/x509_cmp.c
+++ b/src/lib/libcrypto/x509/x509_cmp.c
@@ -86,9 +86,10 @@ unsigned long X509_issuer_and_serial_hash(X509 *a)
86 86
87 EVP_MD_CTX_init(&ctx); 87 EVP_MD_CTX_init(&ctx);
88 f=X509_NAME_oneline(a->cert_info->issuer,NULL,0); 88 f=X509_NAME_oneline(a->cert_info->issuer,NULL,0);
89 ret=strlen(f);
89 if (!EVP_DigestInit_ex(&ctx, EVP_md5(), NULL)) 90 if (!EVP_DigestInit_ex(&ctx, EVP_md5(), NULL))
90 goto err; 91 goto err;
91 if (!EVP_DigestUpdate(&ctx,(unsigned char *)f,strlen(f))) 92 if (!EVP_DigestUpdate(&ctx,(unsigned char *)f,ret))
92 goto err; 93 goto err;
93 OPENSSL_free(f); 94 OPENSSL_free(f);
94 if(!EVP_DigestUpdate(&ctx,(unsigned char *)a->cert_info->serialNumber->data, 95 if(!EVP_DigestUpdate(&ctx,(unsigned char *)a->cert_info->serialNumber->data,
@@ -248,14 +249,14 @@ unsigned long X509_NAME_hash_old(X509_NAME *x)
248 i2d_X509_NAME(x,NULL); 249 i2d_X509_NAME(x,NULL);
249 EVP_MD_CTX_init(&md_ctx); 250 EVP_MD_CTX_init(&md_ctx);
250 EVP_MD_CTX_set_flags(&md_ctx, EVP_MD_CTX_FLAG_NON_FIPS_ALLOW); 251 EVP_MD_CTX_set_flags(&md_ctx, EVP_MD_CTX_FLAG_NON_FIPS_ALLOW);
251 if (EVP_DigestInit_ex(&md_ctx, EVP_md5(), NULL) 252 EVP_DigestInit_ex(&md_ctx, EVP_md5(), NULL);
252 && EVP_DigestUpdate(&md_ctx, x->bytes->data, x->bytes->length) 253 EVP_DigestUpdate(&md_ctx, x->bytes->data, x->bytes->length);
253 && EVP_DigestFinal_ex(&md_ctx,md,NULL)) 254 EVP_DigestFinal_ex(&md_ctx,md,NULL);
254 ret=(((unsigned long)md[0] )|((unsigned long)md[1]<<8L)|
255 ((unsigned long)md[2]<<16L)|((unsigned long)md[3]<<24L)
256 )&0xffffffffL;
257 EVP_MD_CTX_cleanup(&md_ctx); 255 EVP_MD_CTX_cleanup(&md_ctx);
258 256
257 ret=( ((unsigned long)md[0] )|((unsigned long)md[1]<<8L)|
258 ((unsigned long)md[2]<<16L)|((unsigned long)md[3]<<24L)
259 )&0xffffffffL;
259 return(ret); 260 return(ret);
260 } 261 }
261#endif 262#endif
diff --git a/src/lib/libcrypto/x509/x509_vfy.c b/src/lib/libcrypto/x509/x509_vfy.c
index 920066aeba..b0779db023 100644
--- a/src/lib/libcrypto/x509/x509_vfy.c
+++ b/src/lib/libcrypto/x509/x509_vfy.c
@@ -694,7 +694,6 @@ static int check_cert(X509_STORE_CTX *ctx)
694 X509_CRL *crl = NULL, *dcrl = NULL; 694 X509_CRL *crl = NULL, *dcrl = NULL;
695 X509 *x; 695 X509 *x;
696 int ok, cnum; 696 int ok, cnum;
697 unsigned int last_reasons;
698 cnum = ctx->error_depth; 697 cnum = ctx->error_depth;
699 x = sk_X509_value(ctx->chain, cnum); 698 x = sk_X509_value(ctx->chain, cnum);
700 ctx->current_cert = x; 699 ctx->current_cert = x;
@@ -703,7 +702,6 @@ static int check_cert(X509_STORE_CTX *ctx)
703 ctx->current_reasons = 0; 702 ctx->current_reasons = 0;
704 while (ctx->current_reasons != CRLDP_ALL_REASONS) 703 while (ctx->current_reasons != CRLDP_ALL_REASONS)
705 { 704 {
706 last_reasons = ctx->current_reasons;
707 /* Try to retrieve relevant CRL */ 705 /* Try to retrieve relevant CRL */
708 if (ctx->get_crl) 706 if (ctx->get_crl)
709 ok = ctx->get_crl(ctx, &crl, x); 707 ok = ctx->get_crl(ctx, &crl, x);
@@ -747,15 +745,6 @@ static int check_cert(X509_STORE_CTX *ctx)
747 X509_CRL_free(dcrl); 745 X509_CRL_free(dcrl);
748 crl = NULL; 746 crl = NULL;
749 dcrl = NULL; 747 dcrl = NULL;
750 /* If reasons not updated we wont get anywhere by
751 * another iteration, so exit loop.
752 */
753 if (last_reasons == ctx->current_reasons)
754 {
755 ctx->error = X509_V_ERR_UNABLE_TO_GET_CRL;
756 ok = ctx->verify_cb(0, ctx);
757 goto err;
758 }
759 } 748 }
760 err: 749 err:
761 X509_CRL_free(crl); 750 X509_CRL_free(crl);
@@ -883,7 +872,7 @@ static int crl_extension_match(X509_CRL *a, X509_CRL *b, int nid)
883 { 872 {
884 ASN1_OCTET_STRING *exta, *extb; 873 ASN1_OCTET_STRING *exta, *extb;
885 int i; 874 int i;
886 i = X509_CRL_get_ext_by_NID(a, nid, -1); 875 i = X509_CRL_get_ext_by_NID(a, nid, 0);
887 if (i >= 0) 876 if (i >= 0)
888 { 877 {
889 /* Can't have multiple occurrences */ 878 /* Can't have multiple occurrences */
@@ -894,7 +883,7 @@ static int crl_extension_match(X509_CRL *a, X509_CRL *b, int nid)
894 else 883 else
895 exta = NULL; 884 exta = NULL;
896 885
897 i = X509_CRL_get_ext_by_NID(b, nid, -1); 886 i = X509_CRL_get_ext_by_NID(b, nid, 0);
898 887
899 if (i >= 0) 888 if (i >= 0)
900 { 889 {
@@ -1462,9 +1451,10 @@ static int cert_crl(X509_STORE_CTX *ctx, X509_CRL *crl, X509 *x)
1462 * a certificate was revoked. This has since been changed since 1451 * a certificate was revoked. This has since been changed since
1463 * critical extension can change the meaning of CRL entries. 1452 * critical extension can change the meaning of CRL entries.
1464 */ 1453 */
1465 if (!(ctx->param->flags & X509_V_FLAG_IGNORE_CRITICAL) 1454 if (crl->flags & EXFLAG_CRITICAL)
1466 && (crl->flags & EXFLAG_CRITICAL))
1467 { 1455 {
1456 if (ctx->param->flags & X509_V_FLAG_IGNORE_CRITICAL)
1457 return 1;
1468 ctx->error = X509_V_ERR_UNHANDLED_CRITICAL_CRL_EXTENSION; 1458 ctx->error = X509_V_ERR_UNHANDLED_CRITICAL_CRL_EXTENSION;
1469 ok = ctx->verify_cb(0, ctx); 1459 ok = ctx->verify_cb(0, ctx);
1470 if(!ok) 1460 if(!ok)
diff --git a/src/lib/libcrypto/x509/x_all.c b/src/lib/libcrypto/x509/x_all.c
index e06602d65a..b94aeeb873 100644
--- a/src/lib/libcrypto/x509/x_all.c
+++ b/src/lib/libcrypto/x509/x_all.c
@@ -97,7 +97,6 @@ int X509_sign(X509 *x, EVP_PKEY *pkey, const EVP_MD *md)
97 97
98int X509_sign_ctx(X509 *x, EVP_MD_CTX *ctx) 98int X509_sign_ctx(X509 *x, EVP_MD_CTX *ctx)
99 { 99 {
100 x->cert_info->enc.modified = 1;
101 return ASN1_item_sign_ctx(ASN1_ITEM_rptr(X509_CINF), 100 return ASN1_item_sign_ctx(ASN1_ITEM_rptr(X509_CINF),
102 x->cert_info->signature, 101 x->cert_info->signature,
103 x->sig_alg, x->signature, x->cert_info, ctx); 102 x->sig_alg, x->signature, x->cert_info, ctx);
@@ -124,7 +123,6 @@ int X509_CRL_sign(X509_CRL *x, EVP_PKEY *pkey, const EVP_MD *md)
124 123
125int X509_CRL_sign_ctx(X509_CRL *x, EVP_MD_CTX *ctx) 124int X509_CRL_sign_ctx(X509_CRL *x, EVP_MD_CTX *ctx)
126 { 125 {
127 x->crl->enc.modified = 1;
128 return ASN1_item_sign_ctx(ASN1_ITEM_rptr(X509_CRL_INFO), 126 return ASN1_item_sign_ctx(ASN1_ITEM_rptr(X509_CRL_INFO),
129 x->crl->sig_alg, x->sig_alg, x->signature, x->crl, ctx); 127 x->crl->sig_alg, x->sig_alg, x->signature, x->crl, ctx);
130 } 128 }
diff --git a/src/lib/libcrypto/x509v3.cnf b/src/lib/libcrypto/x509v3.cnf
new file mode 100644
index 0000000000..8c6b775da1
--- /dev/null
+++ b/src/lib/libcrypto/x509v3.cnf
@@ -0,0 +1,29 @@
1# default settings
2CERTPATHLEN = 1
3CERTUSAGE = digitalSignature,keyCertSign,cRLSign
4EXTCERTUSAGE = serverAuth,clientAuth
5CERTIP = 0.0.0.0
6CERTFQDN = nohost.nodomain
7
8# This section should be referenced when building an x509v3 CA
9# Certificate.
10# The default path length and the key usage can be overriden
11# modified by setting the CERTPATHLEN and CERTUSAGE environment
12# variables.
13[x509v3_CA]
14basicConstraints=critical,CA:true,pathlen:$ENV::CERTPATHLEN
15keyUsage=$ENV::CERTUSAGE
16
17# This section should be referenced to add an IP Address
18# as an alternate subject name, needed by isakmpd
19# The address must be provided in the CERTIP environment variable
20[x509v3_IPAddr]
21subjectAltName=IP:$ENV::CERTIP
22extendedKeyUsage=$ENV::EXTCERTUSAGE
23
24# This section should be referenced to add a FQDN hostname
25# as an alternate subject name, needed by isakmpd
26# The address must be provided in the CERTFQDN environment variable
27[x509v3_FQDN]
28subjectAltName=DNS:$ENV::CERTFQDN
29extendedKeyUsage=$ENV::EXTCERTUSAGE
diff --git a/src/lib/libcrypto/x509v3/Makefile b/src/lib/libcrypto/x509v3/Makefile
new file mode 100644
index 0000000000..556ef351bf
--- /dev/null
+++ b/src/lib/libcrypto/x509v3/Makefile
@@ -0,0 +1,591 @@
1#
2# OpenSSL/crypto/x509v3/Makefile
3#
4
5DIR= x509v3
6TOP= ../..
7CC= cc
8INCLUDES= -I.. -I$(TOP) -I../../include
9CFLAG=-g
10MAKEFILE= Makefile
11AR= ar r
12
13CFLAGS= $(INCLUDES) $(CFLAG)
14
15GENERAL=Makefile README
16TEST=
17APPS=
18
19LIB=$(TOP)/libcrypto.a
20LIBSRC= v3_bcons.c v3_bitst.c v3_conf.c v3_extku.c v3_ia5.c v3_lib.c \
21v3_prn.c v3_utl.c v3err.c v3_genn.c v3_alt.c v3_skey.c v3_akey.c v3_pku.c \
22v3_int.c v3_enum.c v3_sxnet.c v3_cpols.c v3_crld.c v3_purp.c v3_info.c \
23v3_ocsp.c v3_akeya.c v3_pmaps.c v3_pcons.c v3_ncons.c v3_pcia.c v3_pci.c \
24pcy_cache.c pcy_node.c pcy_data.c pcy_map.c pcy_tree.c pcy_lib.c \
25v3_asid.c v3_addr.c
26LIBOBJ= v3_bcons.o v3_bitst.o v3_conf.o v3_extku.o v3_ia5.o v3_lib.o \
27v3_prn.o v3_utl.o v3err.o v3_genn.o v3_alt.o v3_skey.o v3_akey.o v3_pku.o \
28v3_int.o v3_enum.o v3_sxnet.o v3_cpols.o v3_crld.o v3_purp.o v3_info.o \
29v3_ocsp.o v3_akeya.o v3_pmaps.o v3_pcons.o v3_ncons.o v3_pcia.o v3_pci.o \
30pcy_cache.o pcy_node.o pcy_data.o pcy_map.o pcy_tree.o pcy_lib.o \
31v3_asid.o v3_addr.o
32
33SRC= $(LIBSRC)
34
35EXHEADER= x509v3.h
36HEADER= $(EXHEADER) pcy_int.h
37
38ALL= $(GENERAL) $(SRC) $(HEADER)
39
40top:
41 (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all)
42
43all: lib
44
45lib: $(LIBOBJ)
46 $(AR) $(LIB) $(LIBOBJ)
47 $(RANLIB) $(LIB) || echo Never mind.
48 @touch lib
49
50files:
51 $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
52
53links:
54 @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
55 @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
56 @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
57
58install:
59 @[ -n "$(INSTALLTOP)" ] # should be set by top Makefile...
60 @headerlist="$(EXHEADER)"; for i in $$headerlist ; \
61 do \
62 (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
63 chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
64 done;
65
66tags:
67 ctags $(SRC)
68
69tests:
70
71lint:
72 lint -DLINT $(INCLUDES) $(SRC)>fluff
73
74depend:
75 @[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile...
76 $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
77
78dclean:
79 $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
80 mv -f Makefile.new $(MAKEFILE)
81
82clean:
83 rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
84
85# DO NOT DELETE THIS LINE -- make depend depends on it.
86
87pcy_cache.o: ../../e_os.h ../../include/openssl/asn1.h
88pcy_cache.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
89pcy_cache.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
90pcy_cache.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
91pcy_cache.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
92pcy_cache.o: ../../include/openssl/err.h ../../include/openssl/evp.h
93pcy_cache.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
94pcy_cache.o: ../../include/openssl/objects.h
95pcy_cache.o: ../../include/openssl/opensslconf.h
96pcy_cache.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
97pcy_cache.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
98pcy_cache.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
99pcy_cache.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
100pcy_cache.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
101pcy_cache.o: ../cryptlib.h pcy_cache.c pcy_int.h
102pcy_data.o: ../../e_os.h ../../include/openssl/asn1.h
103pcy_data.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
104pcy_data.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
105pcy_data.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
106pcy_data.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
107pcy_data.o: ../../include/openssl/err.h ../../include/openssl/evp.h
108pcy_data.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
109pcy_data.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
110pcy_data.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
111pcy_data.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
112pcy_data.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
113pcy_data.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
114pcy_data.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
115pcy_data.o: ../cryptlib.h pcy_data.c pcy_int.h
116pcy_lib.o: ../../e_os.h ../../include/openssl/asn1.h
117pcy_lib.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
118pcy_lib.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
119pcy_lib.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
120pcy_lib.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
121pcy_lib.o: ../../include/openssl/err.h ../../include/openssl/evp.h
122pcy_lib.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
123pcy_lib.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
124pcy_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
125pcy_lib.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
126pcy_lib.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
127pcy_lib.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
128pcy_lib.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
129pcy_lib.o: ../cryptlib.h pcy_int.h pcy_lib.c
130pcy_map.o: ../../e_os.h ../../include/openssl/asn1.h
131pcy_map.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
132pcy_map.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
133pcy_map.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
134pcy_map.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
135pcy_map.o: ../../include/openssl/err.h ../../include/openssl/evp.h
136pcy_map.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
137pcy_map.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
138pcy_map.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
139pcy_map.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
140pcy_map.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
141pcy_map.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
142pcy_map.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
143pcy_map.o: ../cryptlib.h pcy_int.h pcy_map.c
144pcy_node.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
145pcy_node.o: ../../include/openssl/buffer.h ../../include/openssl/conf.h
146pcy_node.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
147pcy_node.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
148pcy_node.o: ../../include/openssl/ecdsa.h ../../include/openssl/evp.h
149pcy_node.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
150pcy_node.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
151pcy_node.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
152pcy_node.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
153pcy_node.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
154pcy_node.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
155pcy_node.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
156pcy_node.o: pcy_int.h pcy_node.c
157pcy_tree.o: ../../e_os.h ../../include/openssl/asn1.h
158pcy_tree.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
159pcy_tree.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
160pcy_tree.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
161pcy_tree.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
162pcy_tree.o: ../../include/openssl/err.h ../../include/openssl/evp.h
163pcy_tree.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
164pcy_tree.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
165pcy_tree.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
166pcy_tree.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
167pcy_tree.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
168pcy_tree.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
169pcy_tree.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
170pcy_tree.o: ../cryptlib.h pcy_int.h pcy_tree.c
171v3_addr.o: ../../e_os.h ../../include/openssl/asn1.h
172v3_addr.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
173v3_addr.o: ../../include/openssl/buffer.h ../../include/openssl/conf.h
174v3_addr.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
175v3_addr.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
176v3_addr.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
177v3_addr.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
178v3_addr.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
179v3_addr.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
180v3_addr.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
181v3_addr.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
182v3_addr.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
183v3_addr.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
184v3_addr.o: ../../include/openssl/x509v3.h ../cryptlib.h v3_addr.c
185v3_akey.o: ../../e_os.h ../../include/openssl/asn1.h
186v3_akey.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
187v3_akey.o: ../../include/openssl/buffer.h ../../include/openssl/conf.h
188v3_akey.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
189v3_akey.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
190v3_akey.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
191v3_akey.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
192v3_akey.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
193v3_akey.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
194v3_akey.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
195v3_akey.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
196v3_akey.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
197v3_akey.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
198v3_akey.o: ../../include/openssl/x509v3.h ../cryptlib.h v3_akey.c
199v3_akeya.o: ../../e_os.h ../../include/openssl/asn1.h
200v3_akeya.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
201v3_akeya.o: ../../include/openssl/buffer.h ../../include/openssl/conf.h
202v3_akeya.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
203v3_akeya.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
204v3_akeya.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
205v3_akeya.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
206v3_akeya.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
207v3_akeya.o: ../../include/openssl/opensslconf.h
208v3_akeya.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
209v3_akeya.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
210v3_akeya.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
211v3_akeya.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
212v3_akeya.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
213v3_akeya.o: ../cryptlib.h v3_akeya.c
214v3_alt.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
215v3_alt.o: ../../include/openssl/buffer.h ../../include/openssl/conf.h
216v3_alt.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
217v3_alt.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
218v3_alt.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
219v3_alt.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
220v3_alt.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
221v3_alt.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
222v3_alt.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
223v3_alt.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
224v3_alt.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
225v3_alt.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
226v3_alt.o: ../../include/openssl/x509v3.h ../cryptlib.h v3_alt.c
227v3_asid.o: ../../e_os.h ../../include/openssl/asn1.h
228v3_asid.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
229v3_asid.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
230v3_asid.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
231v3_asid.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
232v3_asid.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
233v3_asid.o: ../../include/openssl/err.h ../../include/openssl/evp.h
234v3_asid.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
235v3_asid.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
236v3_asid.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
237v3_asid.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
238v3_asid.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
239v3_asid.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
240v3_asid.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
241v3_asid.o: ../cryptlib.h v3_asid.c
242v3_bcons.o: ../../e_os.h ../../include/openssl/asn1.h
243v3_bcons.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
244v3_bcons.o: ../../include/openssl/buffer.h ../../include/openssl/conf.h
245v3_bcons.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
246v3_bcons.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
247v3_bcons.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
248v3_bcons.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
249v3_bcons.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
250v3_bcons.o: ../../include/openssl/opensslconf.h
251v3_bcons.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
252v3_bcons.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
253v3_bcons.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
254v3_bcons.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
255v3_bcons.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
256v3_bcons.o: ../cryptlib.h v3_bcons.c
257v3_bitst.o: ../../e_os.h ../../include/openssl/asn1.h
258v3_bitst.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
259v3_bitst.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
260v3_bitst.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
261v3_bitst.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
262v3_bitst.o: ../../include/openssl/err.h ../../include/openssl/evp.h
263v3_bitst.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
264v3_bitst.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
265v3_bitst.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
266v3_bitst.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
267v3_bitst.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
268v3_bitst.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
269v3_bitst.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
270v3_bitst.o: ../cryptlib.h v3_bitst.c
271v3_conf.o: ../../e_os.h ../../include/openssl/asn1.h
272v3_conf.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
273v3_conf.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
274v3_conf.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
275v3_conf.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
276v3_conf.o: ../../include/openssl/err.h ../../include/openssl/evp.h
277v3_conf.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
278v3_conf.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
279v3_conf.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
280v3_conf.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
281v3_conf.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
282v3_conf.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
283v3_conf.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
284v3_conf.o: ../cryptlib.h v3_conf.c
285v3_cpols.o: ../../e_os.h ../../include/openssl/asn1.h
286v3_cpols.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
287v3_cpols.o: ../../include/openssl/buffer.h ../../include/openssl/conf.h
288v3_cpols.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
289v3_cpols.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
290v3_cpols.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
291v3_cpols.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
292v3_cpols.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
293v3_cpols.o: ../../include/openssl/opensslconf.h
294v3_cpols.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
295v3_cpols.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
296v3_cpols.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
297v3_cpols.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
298v3_cpols.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
299v3_cpols.o: ../cryptlib.h pcy_int.h v3_cpols.c
300v3_crld.o: ../../e_os.h ../../include/openssl/asn1.h
301v3_crld.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
302v3_crld.o: ../../include/openssl/buffer.h ../../include/openssl/conf.h
303v3_crld.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
304v3_crld.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
305v3_crld.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
306v3_crld.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
307v3_crld.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
308v3_crld.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
309v3_crld.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
310v3_crld.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
311v3_crld.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
312v3_crld.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
313v3_crld.o: ../../include/openssl/x509v3.h ../cryptlib.h v3_crld.c
314v3_enum.o: ../../e_os.h ../../include/openssl/asn1.h
315v3_enum.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
316v3_enum.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
317v3_enum.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
318v3_enum.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
319v3_enum.o: ../../include/openssl/err.h ../../include/openssl/evp.h
320v3_enum.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
321v3_enum.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
322v3_enum.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
323v3_enum.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
324v3_enum.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
325v3_enum.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
326v3_enum.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
327v3_enum.o: ../cryptlib.h v3_enum.c
328v3_extku.o: ../../e_os.h ../../include/openssl/asn1.h
329v3_extku.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
330v3_extku.o: ../../include/openssl/buffer.h ../../include/openssl/conf.h
331v3_extku.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
332v3_extku.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
333v3_extku.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
334v3_extku.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
335v3_extku.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
336v3_extku.o: ../../include/openssl/opensslconf.h
337v3_extku.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
338v3_extku.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
339v3_extku.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
340v3_extku.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
341v3_extku.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
342v3_extku.o: ../cryptlib.h v3_extku.c
343v3_genn.o: ../../e_os.h ../../include/openssl/asn1.h
344v3_genn.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
345v3_genn.o: ../../include/openssl/buffer.h ../../include/openssl/conf.h
346v3_genn.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
347v3_genn.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
348v3_genn.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
349v3_genn.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
350v3_genn.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
351v3_genn.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
352v3_genn.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
353v3_genn.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
354v3_genn.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
355v3_genn.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
356v3_genn.o: ../../include/openssl/x509v3.h ../cryptlib.h v3_genn.c
357v3_ia5.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
358v3_ia5.o: ../../include/openssl/buffer.h ../../include/openssl/conf.h
359v3_ia5.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
360v3_ia5.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
361v3_ia5.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
362v3_ia5.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
363v3_ia5.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
364v3_ia5.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
365v3_ia5.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
366v3_ia5.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
367v3_ia5.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
368v3_ia5.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
369v3_ia5.o: ../../include/openssl/x509v3.h ../cryptlib.h v3_ia5.c
370v3_info.o: ../../e_os.h ../../include/openssl/asn1.h
371v3_info.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
372v3_info.o: ../../include/openssl/buffer.h ../../include/openssl/conf.h
373v3_info.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
374v3_info.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
375v3_info.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
376v3_info.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
377v3_info.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
378v3_info.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
379v3_info.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
380v3_info.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
381v3_info.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
382v3_info.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
383v3_info.o: ../../include/openssl/x509v3.h ../cryptlib.h v3_info.c
384v3_int.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
385v3_int.o: ../../include/openssl/buffer.h ../../include/openssl/conf.h
386v3_int.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
387v3_int.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
388v3_int.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
389v3_int.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
390v3_int.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
391v3_int.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
392v3_int.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
393v3_int.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
394v3_int.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
395v3_int.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
396v3_int.o: ../../include/openssl/x509v3.h ../cryptlib.h v3_int.c
397v3_lib.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
398v3_lib.o: ../../include/openssl/buffer.h ../../include/openssl/conf.h
399v3_lib.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
400v3_lib.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
401v3_lib.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
402v3_lib.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
403v3_lib.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
404v3_lib.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
405v3_lib.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
406v3_lib.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
407v3_lib.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
408v3_lib.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
409v3_lib.o: ../../include/openssl/x509v3.h ../cryptlib.h ext_dat.h v3_lib.c
410v3_ncons.o: ../../e_os.h ../../include/openssl/asn1.h
411v3_ncons.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
412v3_ncons.o: ../../include/openssl/buffer.h ../../include/openssl/conf.h
413v3_ncons.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
414v3_ncons.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
415v3_ncons.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
416v3_ncons.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
417v3_ncons.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
418v3_ncons.o: ../../include/openssl/opensslconf.h
419v3_ncons.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
420v3_ncons.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
421v3_ncons.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
422v3_ncons.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
423v3_ncons.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
424v3_ncons.o: ../cryptlib.h v3_ncons.c
425v3_ocsp.o: ../../e_os.h ../../include/openssl/asn1.h
426v3_ocsp.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
427v3_ocsp.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
428v3_ocsp.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
429v3_ocsp.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
430v3_ocsp.o: ../../include/openssl/err.h ../../include/openssl/evp.h
431v3_ocsp.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
432v3_ocsp.o: ../../include/openssl/objects.h ../../include/openssl/ocsp.h
433v3_ocsp.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
434v3_ocsp.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
435v3_ocsp.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
436v3_ocsp.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
437v3_ocsp.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
438v3_ocsp.o: ../../include/openssl/x509v3.h ../cryptlib.h v3_ocsp.c
439v3_pci.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
440v3_pci.o: ../../include/openssl/buffer.h ../../include/openssl/conf.h
441v3_pci.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
442v3_pci.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
443v3_pci.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
444v3_pci.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
445v3_pci.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
446v3_pci.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
447v3_pci.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
448v3_pci.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
449v3_pci.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
450v3_pci.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
451v3_pci.o: ../../include/openssl/x509v3.h ../cryptlib.h v3_pci.c
452v3_pcia.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h
453v3_pcia.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
454v3_pcia.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
455v3_pcia.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
456v3_pcia.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
457v3_pcia.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
458v3_pcia.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
459v3_pcia.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
460v3_pcia.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
461v3_pcia.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
462v3_pcia.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
463v3_pcia.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
464v3_pcia.o: ../../include/openssl/x509v3.h v3_pcia.c
465v3_pcons.o: ../../e_os.h ../../include/openssl/asn1.h
466v3_pcons.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
467v3_pcons.o: ../../include/openssl/buffer.h ../../include/openssl/conf.h
468v3_pcons.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
469v3_pcons.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
470v3_pcons.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
471v3_pcons.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
472v3_pcons.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
473v3_pcons.o: ../../include/openssl/opensslconf.h
474v3_pcons.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
475v3_pcons.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
476v3_pcons.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
477v3_pcons.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
478v3_pcons.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
479v3_pcons.o: ../cryptlib.h v3_pcons.c
480v3_pku.o: ../../e_os.h ../../include/openssl/asn1.h
481v3_pku.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
482v3_pku.o: ../../include/openssl/buffer.h ../../include/openssl/conf.h
483v3_pku.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
484v3_pku.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
485v3_pku.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
486v3_pku.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
487v3_pku.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
488v3_pku.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
489v3_pku.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
490v3_pku.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
491v3_pku.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
492v3_pku.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
493v3_pku.o: ../../include/openssl/x509v3.h ../cryptlib.h v3_pku.c
494v3_pmaps.o: ../../e_os.h ../../include/openssl/asn1.h
495v3_pmaps.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
496v3_pmaps.o: ../../include/openssl/buffer.h ../../include/openssl/conf.h
497v3_pmaps.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
498v3_pmaps.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
499v3_pmaps.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
500v3_pmaps.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
501v3_pmaps.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
502v3_pmaps.o: ../../include/openssl/opensslconf.h
503v3_pmaps.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
504v3_pmaps.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
505v3_pmaps.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
506v3_pmaps.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
507v3_pmaps.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
508v3_pmaps.o: ../cryptlib.h v3_pmaps.c
509v3_prn.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
510v3_prn.o: ../../include/openssl/buffer.h ../../include/openssl/conf.h
511v3_prn.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
512v3_prn.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
513v3_prn.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
514v3_prn.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
515v3_prn.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
516v3_prn.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
517v3_prn.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
518v3_prn.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
519v3_prn.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
520v3_prn.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
521v3_prn.o: ../../include/openssl/x509v3.h ../cryptlib.h v3_prn.c
522v3_purp.o: ../../e_os.h ../../include/openssl/asn1.h
523v3_purp.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
524v3_purp.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
525v3_purp.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
526v3_purp.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
527v3_purp.o: ../../include/openssl/err.h ../../include/openssl/evp.h
528v3_purp.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
529v3_purp.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
530v3_purp.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
531v3_purp.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
532v3_purp.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
533v3_purp.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
534v3_purp.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
535v3_purp.o: ../cryptlib.h v3_purp.c
536v3_skey.o: ../../e_os.h ../../include/openssl/asn1.h
537v3_skey.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
538v3_skey.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
539v3_skey.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
540v3_skey.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
541v3_skey.o: ../../include/openssl/err.h ../../include/openssl/evp.h
542v3_skey.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
543v3_skey.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
544v3_skey.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
545v3_skey.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
546v3_skey.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
547v3_skey.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
548v3_skey.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
549v3_skey.o: ../cryptlib.h v3_skey.c
550v3_sxnet.o: ../../e_os.h ../../include/openssl/asn1.h
551v3_sxnet.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
552v3_sxnet.o: ../../include/openssl/buffer.h ../../include/openssl/conf.h
553v3_sxnet.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
554v3_sxnet.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
555v3_sxnet.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
556v3_sxnet.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
557v3_sxnet.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
558v3_sxnet.o: ../../include/openssl/opensslconf.h
559v3_sxnet.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
560v3_sxnet.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
561v3_sxnet.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
562v3_sxnet.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
563v3_sxnet.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
564v3_sxnet.o: ../cryptlib.h v3_sxnet.c
565v3_utl.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
566v3_utl.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
567v3_utl.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
568v3_utl.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
569v3_utl.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
570v3_utl.o: ../../include/openssl/err.h ../../include/openssl/evp.h
571v3_utl.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
572v3_utl.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
573v3_utl.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
574v3_utl.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
575v3_utl.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
576v3_utl.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h
577v3_utl.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
578v3_utl.o: ../cryptlib.h v3_utl.c
579v3err.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
580v3err.o: ../../include/openssl/buffer.h ../../include/openssl/conf.h
581v3err.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
582v3err.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
583v3err.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h
584v3err.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
585v3err.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
586v3err.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
587v3err.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
588v3err.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
589v3err.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
590v3err.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
591v3err.o: ../../include/openssl/x509v3.h v3err.c
diff --git a/src/lib/libcrypto/x509v3/tabtest.c b/src/lib/libcrypto/x509v3/tabtest.c
new file mode 100644
index 0000000000..5ed6eb6891
--- /dev/null
+++ b/src/lib/libcrypto/x509v3/tabtest.c
@@ -0,0 +1,88 @@
1/* tabtest.c */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project 1999.
4 */
5/* ====================================================================
6 * Copyright (c) 1999 The OpenSSL Project. All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 *
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 *
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in
17 * the documentation and/or other materials provided with the
18 * distribution.
19 *
20 * 3. All advertising materials mentioning features or use of this
21 * software must display the following acknowledgment:
22 * "This product includes software developed by the OpenSSL Project
23 * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
24 *
25 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
26 * endorse or promote products derived from this software without
27 * prior written permission. For written permission, please contact
28 * licensing@OpenSSL.org.
29 *
30 * 5. Products derived from this software may not be called "OpenSSL"
31 * nor may "OpenSSL" appear in their names without prior written
32 * permission of the OpenSSL Project.
33 *
34 * 6. Redistributions of any form whatsoever must retain the following
35 * acknowledgment:
36 * "This product includes software developed by the OpenSSL Project
37 * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
38 *
39 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
40 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
41 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
42 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
43 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
44 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
45 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
46 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
47 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
48 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
49 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50 * OF THE POSSIBILITY OF SUCH DAMAGE.
51 * ====================================================================
52 *
53 * This product includes cryptographic software written by Eric Young
54 * (eay@cryptsoft.com). This product includes software written by Tim
55 * Hudson (tjh@cryptsoft.com).
56 *
57 */
58
59/* Simple program to check the ext_dat.h is correct and print out
60 * problems if it is not.
61 */
62
63#include <stdio.h>
64
65#include <openssl/x509v3.h>
66
67#include "ext_dat.h"
68
69main()
70{
71 int i, prev = -1, bad = 0;
72 X509V3_EXT_METHOD **tmp;
73 i = sizeof(standard_exts) / sizeof(X509V3_EXT_METHOD *);
74 if(i != STANDARD_EXTENSION_COUNT)
75 fprintf(stderr, "Extension number invalid expecting %d\n", i);
76 tmp = standard_exts;
77 for(i = 0; i < STANDARD_EXTENSION_COUNT; i++, tmp++) {
78 if((*tmp)->ext_nid < prev) bad = 1;
79 prev = (*tmp)->ext_nid;
80
81 }
82 if(bad) {
83 tmp = standard_exts;
84 fprintf(stderr, "Extensions out of order!\n");
85 for(i = 0; i < STANDARD_EXTENSION_COUNT; i++, tmp++)
86 printf("%d : %s\n", (*tmp)->ext_nid, OBJ_nid2sn((*tmp)->ext_nid));
87 } else fprintf(stderr, "Order OK\n");
88}
diff --git a/src/lib/libcrypto/x509v3/v3_addr.c b/src/lib/libcrypto/x509v3/v3_addr.c
new file mode 100644
index 0000000000..df46a4983b
--- /dev/null
+++ b/src/lib/libcrypto/x509v3/v3_addr.c
@@ -0,0 +1,1338 @@
1/*
2 * Contributed to the OpenSSL Project by the American Registry for
3 * Internet Numbers ("ARIN").
4 */
5/* ====================================================================
6 * Copyright (c) 2006 The OpenSSL Project. All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 *
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 *
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in
17 * the documentation and/or other materials provided with the
18 * distribution.
19 *
20 * 3. All advertising materials mentioning features or use of this
21 * software must display the following acknowledgment:
22 * "This product includes software developed by the OpenSSL Project
23 * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
24 *
25 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
26 * endorse or promote products derived from this software without
27 * prior written permission. For written permission, please contact
28 * licensing@OpenSSL.org.
29 *
30 * 5. Products derived from this software may not be called "OpenSSL"
31 * nor may "OpenSSL" appear in their names without prior written
32 * permission of the OpenSSL Project.
33 *
34 * 6. Redistributions of any form whatsoever must retain the following
35 * acknowledgment:
36 * "This product includes software developed by the OpenSSL Project
37 * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
38 *
39 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
40 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
41 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
42 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
43 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
44 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
45 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
46 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
47 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
48 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
49 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50 * OF THE POSSIBILITY OF SUCH DAMAGE.
51 * ====================================================================
52 *
53 * This product includes cryptographic software written by Eric Young
54 * (eay@cryptsoft.com). This product includes software written by Tim
55 * Hudson (tjh@cryptsoft.com).
56 */
57
58/*
59 * Implementation of RFC 3779 section 2.2.
60 */
61
62#include <stdio.h>
63#include <stdlib.h>
64
65#include "cryptlib.h"
66#include <openssl/conf.h>
67#include <openssl/asn1.h>
68#include <openssl/asn1t.h>
69#include <openssl/buffer.h>
70#include <openssl/x509v3.h>
71
72#ifndef OPENSSL_NO_RFC3779
73
74/*
75 * OpenSSL ASN.1 template translation of RFC 3779 2.2.3.
76 */
77
78ASN1_SEQUENCE(IPAddressRange) = {
79 ASN1_SIMPLE(IPAddressRange, min, ASN1_BIT_STRING),
80 ASN1_SIMPLE(IPAddressRange, max, ASN1_BIT_STRING)
81} ASN1_SEQUENCE_END(IPAddressRange)
82
83ASN1_CHOICE(IPAddressOrRange) = {
84 ASN1_SIMPLE(IPAddressOrRange, u.addressPrefix, ASN1_BIT_STRING),
85 ASN1_SIMPLE(IPAddressOrRange, u.addressRange, IPAddressRange)
86} ASN1_CHOICE_END(IPAddressOrRange)
87
88ASN1_CHOICE(IPAddressChoice) = {
89 ASN1_SIMPLE(IPAddressChoice, u.inherit, ASN1_NULL),
90 ASN1_SEQUENCE_OF(IPAddressChoice, u.addressesOrRanges, IPAddressOrRange)
91} ASN1_CHOICE_END(IPAddressChoice)
92
93ASN1_SEQUENCE(IPAddressFamily) = {
94 ASN1_SIMPLE(IPAddressFamily, addressFamily, ASN1_OCTET_STRING),
95 ASN1_SIMPLE(IPAddressFamily, ipAddressChoice, IPAddressChoice)
96} ASN1_SEQUENCE_END(IPAddressFamily)
97
98ASN1_ITEM_TEMPLATE(IPAddrBlocks) =
99 ASN1_EX_TEMPLATE_TYPE(ASN1_TFLG_SEQUENCE_OF, 0,
100 IPAddrBlocks, IPAddressFamily)
101ASN1_ITEM_TEMPLATE_END(IPAddrBlocks)
102
103IMPLEMENT_ASN1_FUNCTIONS(IPAddressRange)
104IMPLEMENT_ASN1_FUNCTIONS(IPAddressOrRange)
105IMPLEMENT_ASN1_FUNCTIONS(IPAddressChoice)
106IMPLEMENT_ASN1_FUNCTIONS(IPAddressFamily)
107
108/*
109 * How much buffer space do we need for a raw address?
110 */
111#define ADDR_RAW_BUF_LEN 16
112
113/*
114 * What's the address length associated with this AFI?
115 */
116static int length_from_afi(const unsigned afi)
117{
118 switch (afi) {
119 case IANA_AFI_IPV4:
120 return 4;
121 case IANA_AFI_IPV6:
122 return 16;
123 default:
124 return 0;
125 }
126}
127
128/*
129 * Extract the AFI from an IPAddressFamily.
130 */
131unsigned int v3_addr_get_afi(const IPAddressFamily *f)
132{
133 return ((f != NULL &&
134 f->addressFamily != NULL &&
135 f->addressFamily->data != NULL)
136 ? ((f->addressFamily->data[0] << 8) |
137 (f->addressFamily->data[1]))
138 : 0);
139}
140
141/*
142 * Expand the bitstring form of an address into a raw byte array.
143 * At the moment this is coded for simplicity, not speed.
144 */
145static int addr_expand(unsigned char *addr,
146 const ASN1_BIT_STRING *bs,
147 const int length,
148 const unsigned char fill)
149{
150 if (bs->length < 0 || bs->length > length)
151 return 0;
152 if (bs->length > 0) {
153 memcpy(addr, bs->data, bs->length);
154 if ((bs->flags & 7) != 0) {
155 unsigned char mask = 0xFF >> (8 - (bs->flags & 7));
156 if (fill == 0)
157 addr[bs->length - 1] &= ~mask;
158 else
159 addr[bs->length - 1] |= mask;
160 }
161 }
162 memset(addr + bs->length, fill, length - bs->length);
163 return 1;
164}
165
166/*
167 * Extract the prefix length from a bitstring.
168 */
169#define addr_prefixlen(bs) ((int) ((bs)->length * 8 - ((bs)->flags & 7)))
170
171/*
172 * i2r handler for one address bitstring.
173 */
174static int i2r_address(BIO *out,
175 const unsigned afi,
176 const unsigned char fill,
177 const ASN1_BIT_STRING *bs)
178{
179 unsigned char addr[ADDR_RAW_BUF_LEN];
180 int i, n;
181
182 if (bs->length < 0)
183 return 0;
184 switch (afi) {
185 case IANA_AFI_IPV4:
186 if (!addr_expand(addr, bs, 4, fill))
187 return 0;
188 BIO_printf(out, "%d.%d.%d.%d", addr[0], addr[1], addr[2], addr[3]);
189 break;
190 case IANA_AFI_IPV6:
191 if (!addr_expand(addr, bs, 16, fill))
192 return 0;
193 for (n = 16; n > 1 && addr[n-1] == 0x00 && addr[n-2] == 0x00; n -= 2)
194 ;
195 for (i = 0; i < n; i += 2)
196 BIO_printf(out, "%x%s", (addr[i] << 8) | addr[i+1], (i < 14 ? ":" : ""));
197 if (i < 16)
198 BIO_puts(out, ":");
199 if (i == 0)
200 BIO_puts(out, ":");
201 break;
202 default:
203 for (i = 0; i < bs->length; i++)
204 BIO_printf(out, "%s%02x", (i > 0 ? ":" : ""), bs->data[i]);
205 BIO_printf(out, "[%d]", (int) (bs->flags & 7));
206 break;
207 }
208 return 1;
209}
210
211/*
212 * i2r handler for a sequence of addresses and ranges.
213 */
214static int i2r_IPAddressOrRanges(BIO *out,
215 const int indent,
216 const IPAddressOrRanges *aors,
217 const unsigned afi)
218{
219 int i;
220 for (i = 0; i < sk_IPAddressOrRange_num(aors); i++) {
221 const IPAddressOrRange *aor = sk_IPAddressOrRange_value(aors, i);
222 BIO_printf(out, "%*s", indent, "");
223 switch (aor->type) {
224 case IPAddressOrRange_addressPrefix:
225 if (!i2r_address(out, afi, 0x00, aor->u.addressPrefix))
226 return 0;
227 BIO_printf(out, "/%d\n", addr_prefixlen(aor->u.addressPrefix));
228 continue;
229 case IPAddressOrRange_addressRange:
230 if (!i2r_address(out, afi, 0x00, aor->u.addressRange->min))
231 return 0;
232 BIO_puts(out, "-");
233 if (!i2r_address(out, afi, 0xFF, aor->u.addressRange->max))
234 return 0;
235 BIO_puts(out, "\n");
236 continue;
237 }
238 }
239 return 1;
240}
241
242/*
243 * i2r handler for an IPAddrBlocks extension.
244 */
245static int i2r_IPAddrBlocks(const X509V3_EXT_METHOD *method,
246 void *ext,
247 BIO *out,
248 int indent)
249{
250 const IPAddrBlocks *addr = ext;
251 int i;
252 for (i = 0; i < sk_IPAddressFamily_num(addr); i++) {
253 IPAddressFamily *f = sk_IPAddressFamily_value(addr, i);
254 const unsigned int afi = v3_addr_get_afi(f);
255 switch (afi) {
256 case IANA_AFI_IPV4:
257 BIO_printf(out, "%*sIPv4", indent, "");
258 break;
259 case IANA_AFI_IPV6:
260 BIO_printf(out, "%*sIPv6", indent, "");
261 break;
262 default:
263 BIO_printf(out, "%*sUnknown AFI %u", indent, "", afi);
264 break;
265 }
266 if (f->addressFamily->length > 2) {
267 switch (f->addressFamily->data[2]) {
268 case 1:
269 BIO_puts(out, " (Unicast)");
270 break;
271 case 2:
272 BIO_puts(out, " (Multicast)");
273 break;
274 case 3:
275 BIO_puts(out, " (Unicast/Multicast)");
276 break;
277 case 4:
278 BIO_puts(out, " (MPLS)");
279 break;
280 case 64:
281 BIO_puts(out, " (Tunnel)");
282 break;
283 case 65:
284 BIO_puts(out, " (VPLS)");
285 break;
286 case 66:
287 BIO_puts(out, " (BGP MDT)");
288 break;
289 case 128:
290 BIO_puts(out, " (MPLS-labeled VPN)");
291 break;
292 default:
293 BIO_printf(out, " (Unknown SAFI %u)",
294 (unsigned) f->addressFamily->data[2]);
295 break;
296 }
297 }
298 switch (f->ipAddressChoice->type) {
299 case IPAddressChoice_inherit:
300 BIO_puts(out, ": inherit\n");
301 break;
302 case IPAddressChoice_addressesOrRanges:
303 BIO_puts(out, ":\n");
304 if (!i2r_IPAddressOrRanges(out,
305 indent + 2,
306 f->ipAddressChoice->u.addressesOrRanges,
307 afi))
308 return 0;
309 break;
310 }
311 }
312 return 1;
313}
314
315/*
316 * Sort comparison function for a sequence of IPAddressOrRange
317 * elements.
318 *
319 * There's no sane answer we can give if addr_expand() fails, and an
320 * assertion failure on externally supplied data is seriously uncool,
321 * so we just arbitrarily declare that if given invalid inputs this
322 * function returns -1. If this messes up your preferred sort order
323 * for garbage input, tough noogies.
324 */
325static int IPAddressOrRange_cmp(const IPAddressOrRange *a,
326 const IPAddressOrRange *b,
327 const int length)
328{
329 unsigned char addr_a[ADDR_RAW_BUF_LEN], addr_b[ADDR_RAW_BUF_LEN];
330 int prefixlen_a = 0, prefixlen_b = 0;
331 int r;
332
333 switch (a->type) {
334 case IPAddressOrRange_addressPrefix:
335 if (!addr_expand(addr_a, a->u.addressPrefix, length, 0x00))
336 return -1;
337 prefixlen_a = addr_prefixlen(a->u.addressPrefix);
338 break;
339 case IPAddressOrRange_addressRange:
340 if (!addr_expand(addr_a, a->u.addressRange->min, length, 0x00))
341 return -1;
342 prefixlen_a = length * 8;
343 break;
344 }
345
346 switch (b->type) {
347 case IPAddressOrRange_addressPrefix:
348 if (!addr_expand(addr_b, b->u.addressPrefix, length, 0x00))
349 return -1;
350 prefixlen_b = addr_prefixlen(b->u.addressPrefix);
351 break;
352 case IPAddressOrRange_addressRange:
353 if (!addr_expand(addr_b, b->u.addressRange->min, length, 0x00))
354 return -1;
355 prefixlen_b = length * 8;
356 break;
357 }
358
359 if ((r = memcmp(addr_a, addr_b, length)) != 0)
360 return r;
361 else
362 return prefixlen_a - prefixlen_b;
363}
364
365/*
366 * IPv4-specific closure over IPAddressOrRange_cmp, since sk_sort()
367 * comparision routines are only allowed two arguments.
368 */
369static int v4IPAddressOrRange_cmp(const IPAddressOrRange * const *a,
370 const IPAddressOrRange * const *b)
371{
372 return IPAddressOrRange_cmp(*a, *b, 4);
373}
374
375/*
376 * IPv6-specific closure over IPAddressOrRange_cmp, since sk_sort()
377 * comparision routines are only allowed two arguments.
378 */
379static int v6IPAddressOrRange_cmp(const IPAddressOrRange * const *a,
380 const IPAddressOrRange * const *b)
381{
382 return IPAddressOrRange_cmp(*a, *b, 16);
383}
384
385/*
386 * Calculate whether a range collapses to a prefix.
387 * See last paragraph of RFC 3779 2.2.3.7.
388 */
389static int range_should_be_prefix(const unsigned char *min,
390 const unsigned char *max,
391 const int length)
392{
393 unsigned char mask;
394 int i, j;
395
396 OPENSSL_assert(memcmp(min, max, length) <= 0);
397 for (i = 0; i < length && min[i] == max[i]; i++)
398 ;
399 for (j = length - 1; j >= 0 && min[j] == 0x00 && max[j] == 0xFF; j--)
400 ;
401 if (i < j)
402 return -1;
403 if (i > j)
404 return i * 8;
405 mask = min[i] ^ max[i];
406 switch (mask) {
407 case 0x01: j = 7; break;
408 case 0x03: j = 6; break;
409 case 0x07: j = 5; break;
410 case 0x0F: j = 4; break;
411 case 0x1F: j = 3; break;
412 case 0x3F: j = 2; break;
413 case 0x7F: j = 1; break;
414 default: return -1;
415 }
416 if ((min[i] & mask) != 0 || (max[i] & mask) != mask)
417 return -1;
418 else
419 return i * 8 + j;
420}
421
422/*
423 * Construct a prefix.
424 */
425static int make_addressPrefix(IPAddressOrRange **result,
426 unsigned char *addr,
427 const int prefixlen)
428{
429 int bytelen = (prefixlen + 7) / 8, bitlen = prefixlen % 8;
430 IPAddressOrRange *aor = IPAddressOrRange_new();
431
432 if (aor == NULL)
433 return 0;
434 aor->type = IPAddressOrRange_addressPrefix;
435 if (aor->u.addressPrefix == NULL &&
436 (aor->u.addressPrefix = ASN1_BIT_STRING_new()) == NULL)
437 goto err;
438 if (!ASN1_BIT_STRING_set(aor->u.addressPrefix, addr, bytelen))
439 goto err;
440 aor->u.addressPrefix->flags &= ~7;
441 aor->u.addressPrefix->flags |= ASN1_STRING_FLAG_BITS_LEFT;
442 if (bitlen > 0) {
443 aor->u.addressPrefix->data[bytelen - 1] &= ~(0xFF >> bitlen);
444 aor->u.addressPrefix->flags |= 8 - bitlen;
445 }
446
447 *result = aor;
448 return 1;
449
450 err:
451 IPAddressOrRange_free(aor);
452 return 0;
453}
454
455/*
456 * Construct a range. If it can be expressed as a prefix,
457 * return a prefix instead. Doing this here simplifies
458 * the rest of the code considerably.
459 */
460static int make_addressRange(IPAddressOrRange **result,
461 unsigned char *min,
462 unsigned char *max,
463 const int length)
464{
465 IPAddressOrRange *aor;
466 int i, prefixlen;
467
468 if ((prefixlen = range_should_be_prefix(min, max, length)) >= 0)
469 return make_addressPrefix(result, min, prefixlen);
470
471 if ((aor = IPAddressOrRange_new()) == NULL)
472 return 0;
473 aor->type = IPAddressOrRange_addressRange;
474 OPENSSL_assert(aor->u.addressRange == NULL);
475 if ((aor->u.addressRange = IPAddressRange_new()) == NULL)
476 goto err;
477 if (aor->u.addressRange->min == NULL &&
478 (aor->u.addressRange->min = ASN1_BIT_STRING_new()) == NULL)
479 goto err;
480 if (aor->u.addressRange->max == NULL &&
481 (aor->u.addressRange->max = ASN1_BIT_STRING_new()) == NULL)
482 goto err;
483
484 for (i = length; i > 0 && min[i - 1] == 0x00; --i)
485 ;
486 if (!ASN1_BIT_STRING_set(aor->u.addressRange->min, min, i))
487 goto err;
488 aor->u.addressRange->min->flags &= ~7;
489 aor->u.addressRange->min->flags |= ASN1_STRING_FLAG_BITS_LEFT;
490 if (i > 0) {
491 unsigned char b = min[i - 1];
492 int j = 1;
493 while ((b & (0xFFU >> j)) != 0)
494 ++j;
495 aor->u.addressRange->min->flags |= 8 - j;
496 }
497
498 for (i = length; i > 0 && max[i - 1] == 0xFF; --i)
499 ;
500 if (!ASN1_BIT_STRING_set(aor->u.addressRange->max, max, i))
501 goto err;
502 aor->u.addressRange->max->flags &= ~7;
503 aor->u.addressRange->max->flags |= ASN1_STRING_FLAG_BITS_LEFT;
504 if (i > 0) {
505 unsigned char b = max[i - 1];
506 int j = 1;
507 while ((b & (0xFFU >> j)) != (0xFFU >> j))
508 ++j;
509 aor->u.addressRange->max->flags |= 8 - j;
510 }
511
512 *result = aor;
513 return 1;
514
515 err:
516 IPAddressOrRange_free(aor);
517 return 0;
518}
519
520/*
521 * Construct a new address family or find an existing one.
522 */
523static IPAddressFamily *make_IPAddressFamily(IPAddrBlocks *addr,
524 const unsigned afi,
525 const unsigned *safi)
526{
527 IPAddressFamily *f;
528 unsigned char key[3];
529 unsigned keylen;
530 int i;
531
532 key[0] = (afi >> 8) & 0xFF;
533 key[1] = afi & 0xFF;
534 if (safi != NULL) {
535 key[2] = *safi & 0xFF;
536 keylen = 3;
537 } else {
538 keylen = 2;
539 }
540
541 for (i = 0; i < sk_IPAddressFamily_num(addr); i++) {
542 f = sk_IPAddressFamily_value(addr, i);
543 OPENSSL_assert(f->addressFamily->data != NULL);
544 if (f->addressFamily->length == keylen &&
545 !memcmp(f->addressFamily->data, key, keylen))
546 return f;
547 }
548
549 if ((f = IPAddressFamily_new()) == NULL)
550 goto err;
551 if (f->ipAddressChoice == NULL &&
552 (f->ipAddressChoice = IPAddressChoice_new()) == NULL)
553 goto err;
554 if (f->addressFamily == NULL &&
555 (f->addressFamily = ASN1_OCTET_STRING_new()) == NULL)
556 goto err;
557 if (!ASN1_OCTET_STRING_set(f->addressFamily, key, keylen))
558 goto err;
559 if (!sk_IPAddressFamily_push(addr, f))
560 goto err;
561
562 return f;
563
564 err:
565 IPAddressFamily_free(f);
566 return NULL;
567}
568
569/*
570 * Add an inheritance element.
571 */
572int v3_addr_add_inherit(IPAddrBlocks *addr,
573 const unsigned afi,
574 const unsigned *safi)
575{
576 IPAddressFamily *f = make_IPAddressFamily(addr, afi, safi);
577 if (f == NULL ||
578 f->ipAddressChoice == NULL ||
579 (f->ipAddressChoice->type == IPAddressChoice_addressesOrRanges &&
580 f->ipAddressChoice->u.addressesOrRanges != NULL))
581 return 0;
582 if (f->ipAddressChoice->type == IPAddressChoice_inherit &&
583 f->ipAddressChoice->u.inherit != NULL)
584 return 1;
585 if (f->ipAddressChoice->u.inherit == NULL &&
586 (f->ipAddressChoice->u.inherit = ASN1_NULL_new()) == NULL)
587 return 0;
588 f->ipAddressChoice->type = IPAddressChoice_inherit;
589 return 1;
590}
591
592/*
593 * Construct an IPAddressOrRange sequence, or return an existing one.
594 */
595static IPAddressOrRanges *make_prefix_or_range(IPAddrBlocks *addr,
596 const unsigned afi,
597 const unsigned *safi)
598{
599 IPAddressFamily *f = make_IPAddressFamily(addr, afi, safi);
600 IPAddressOrRanges *aors = NULL;
601
602 if (f == NULL ||
603 f->ipAddressChoice == NULL ||
604 (f->ipAddressChoice->type == IPAddressChoice_inherit &&
605 f->ipAddressChoice->u.inherit != NULL))
606 return NULL;
607 if (f->ipAddressChoice->type == IPAddressChoice_addressesOrRanges)
608 aors = f->ipAddressChoice->u.addressesOrRanges;
609 if (aors != NULL)
610 return aors;
611 if ((aors = sk_IPAddressOrRange_new_null()) == NULL)
612 return NULL;
613 switch (afi) {
614 case IANA_AFI_IPV4:
615 (void) sk_IPAddressOrRange_set_cmp_func(aors, v4IPAddressOrRange_cmp);
616 break;
617 case IANA_AFI_IPV6:
618 (void) sk_IPAddressOrRange_set_cmp_func(aors, v6IPAddressOrRange_cmp);
619 break;
620 }
621 f->ipAddressChoice->type = IPAddressChoice_addressesOrRanges;
622 f->ipAddressChoice->u.addressesOrRanges = aors;
623 return aors;
624}
625
626/*
627 * Add a prefix.
628 */
629int v3_addr_add_prefix(IPAddrBlocks *addr,
630 const unsigned afi,
631 const unsigned *safi,
632 unsigned char *a,
633 const int prefixlen)
634{
635 IPAddressOrRanges *aors = make_prefix_or_range(addr, afi, safi);
636 IPAddressOrRange *aor;
637 if (aors == NULL || !make_addressPrefix(&aor, a, prefixlen))
638 return 0;
639 if (sk_IPAddressOrRange_push(aors, aor))
640 return 1;
641 IPAddressOrRange_free(aor);
642 return 0;
643}
644
645/*
646 * Add a range.
647 */
648int v3_addr_add_range(IPAddrBlocks *addr,
649 const unsigned afi,
650 const unsigned *safi,
651 unsigned char *min,
652 unsigned char *max)
653{
654 IPAddressOrRanges *aors = make_prefix_or_range(addr, afi, safi);
655 IPAddressOrRange *aor;
656 int length = length_from_afi(afi);
657 if (aors == NULL)
658 return 0;
659 if (!make_addressRange(&aor, min, max, length))
660 return 0;
661 if (sk_IPAddressOrRange_push(aors, aor))
662 return 1;
663 IPAddressOrRange_free(aor);
664 return 0;
665}
666
667/*
668 * Extract min and max values from an IPAddressOrRange.
669 */
670static int extract_min_max(IPAddressOrRange *aor,
671 unsigned char *min,
672 unsigned char *max,
673 int length)
674{
675 if (aor == NULL || min == NULL || max == NULL)
676 return 0;
677 switch (aor->type) {
678 case IPAddressOrRange_addressPrefix:
679 return (addr_expand(min, aor->u.addressPrefix, length, 0x00) &&
680 addr_expand(max, aor->u.addressPrefix, length, 0xFF));
681 case IPAddressOrRange_addressRange:
682 return (addr_expand(min, aor->u.addressRange->min, length, 0x00) &&
683 addr_expand(max, aor->u.addressRange->max, length, 0xFF));
684 }
685 return 0;
686}
687
688/*
689 * Public wrapper for extract_min_max().
690 */
691int v3_addr_get_range(IPAddressOrRange *aor,
692 const unsigned afi,
693 unsigned char *min,
694 unsigned char *max,
695 const int length)
696{
697 int afi_length = length_from_afi(afi);
698 if (aor == NULL || min == NULL || max == NULL ||
699 afi_length == 0 || length < afi_length ||
700 (aor->type != IPAddressOrRange_addressPrefix &&
701 aor->type != IPAddressOrRange_addressRange) ||
702 !extract_min_max(aor, min, max, afi_length))
703 return 0;
704
705 return afi_length;
706}
707
708/*
709 * Sort comparision function for a sequence of IPAddressFamily.
710 *
711 * The last paragraph of RFC 3779 2.2.3.3 is slightly ambiguous about
712 * the ordering: I can read it as meaning that IPv6 without a SAFI
713 * comes before IPv4 with a SAFI, which seems pretty weird. The
714 * examples in appendix B suggest that the author intended the
715 * null-SAFI rule to apply only within a single AFI, which is what I
716 * would have expected and is what the following code implements.
717 */
718static int IPAddressFamily_cmp(const IPAddressFamily * const *a_,
719 const IPAddressFamily * const *b_)
720{
721 const ASN1_OCTET_STRING *a = (*a_)->addressFamily;
722 const ASN1_OCTET_STRING *b = (*b_)->addressFamily;
723 int len = ((a->length <= b->length) ? a->length : b->length);
724 int cmp = memcmp(a->data, b->data, len);
725 return cmp ? cmp : a->length - b->length;
726}
727
728/*
729 * Check whether an IPAddrBLocks is in canonical form.
730 */
731int v3_addr_is_canonical(IPAddrBlocks *addr)
732{
733 unsigned char a_min[ADDR_RAW_BUF_LEN], a_max[ADDR_RAW_BUF_LEN];
734 unsigned char b_min[ADDR_RAW_BUF_LEN], b_max[ADDR_RAW_BUF_LEN];
735 IPAddressOrRanges *aors;
736 int i, j, k;
737
738 /*
739 * Empty extension is cannonical.
740 */
741 if (addr == NULL)
742 return 1;
743
744 /*
745 * Check whether the top-level list is in order.
746 */
747 for (i = 0; i < sk_IPAddressFamily_num(addr) - 1; i++) {
748 const IPAddressFamily *a = sk_IPAddressFamily_value(addr, i);
749 const IPAddressFamily *b = sk_IPAddressFamily_value(addr, i + 1);
750 if (IPAddressFamily_cmp(&a, &b) >= 0)
751 return 0;
752 }
753
754 /*
755 * Top level's ok, now check each address family.
756 */
757 for (i = 0; i < sk_IPAddressFamily_num(addr); i++) {
758 IPAddressFamily *f = sk_IPAddressFamily_value(addr, i);
759 int length = length_from_afi(v3_addr_get_afi(f));
760
761 /*
762 * Inheritance is canonical. Anything other than inheritance or
763 * a SEQUENCE OF IPAddressOrRange is an ASN.1 error or something.
764 */
765 if (f == NULL || f->ipAddressChoice == NULL)
766 return 0;
767 switch (f->ipAddressChoice->type) {
768 case IPAddressChoice_inherit:
769 continue;
770 case IPAddressChoice_addressesOrRanges:
771 break;
772 default:
773 return 0;
774 }
775
776 /*
777 * It's an IPAddressOrRanges sequence, check it.
778 */
779 aors = f->ipAddressChoice->u.addressesOrRanges;
780 if (sk_IPAddressOrRange_num(aors) == 0)
781 return 0;
782 for (j = 0; j < sk_IPAddressOrRange_num(aors) - 1; j++) {
783 IPAddressOrRange *a = sk_IPAddressOrRange_value(aors, j);
784 IPAddressOrRange *b = sk_IPAddressOrRange_value(aors, j + 1);
785
786 if (!extract_min_max(a, a_min, a_max, length) ||
787 !extract_min_max(b, b_min, b_max, length))
788 return 0;
789
790 /*
791 * Punt misordered list, overlapping start, or inverted range.
792 */
793 if (memcmp(a_min, b_min, length) >= 0 ||
794 memcmp(a_min, a_max, length) > 0 ||
795 memcmp(b_min, b_max, length) > 0)
796 return 0;
797
798 /*
799 * Punt if adjacent or overlapping. Check for adjacency by
800 * subtracting one from b_min first.
801 */
802 for (k = length - 1; k >= 0 && b_min[k]-- == 0x00; k--)
803 ;
804 if (memcmp(a_max, b_min, length) >= 0)
805 return 0;
806
807 /*
808 * Check for range that should be expressed as a prefix.
809 */
810 if (a->type == IPAddressOrRange_addressRange &&
811 range_should_be_prefix(a_min, a_max, length) >= 0)
812 return 0;
813 }
814
815 /*
816 * Check range to see if it's inverted or should be a
817 * prefix.
818 */
819 j = sk_IPAddressOrRange_num(aors) - 1;
820 {
821 IPAddressOrRange *a = sk_IPAddressOrRange_value(aors, j);
822 if (a != NULL && a->type == IPAddressOrRange_addressRange) {
823 if (!extract_min_max(a, a_min, a_max, length))
824 return 0;
825 if (memcmp(a_min, a_max, length) > 0 ||
826 range_should_be_prefix(a_min, a_max, length) >= 0)
827 return 0;
828 }
829 }
830 }
831
832 /*
833 * If we made it through all that, we're happy.
834 */
835 return 1;
836}
837
838/*
839 * Whack an IPAddressOrRanges into canonical form.
840 */
841static int IPAddressOrRanges_canonize(IPAddressOrRanges *aors,
842 const unsigned afi)
843{
844 int i, j, length = length_from_afi(afi);
845
846 /*
847 * Sort the IPAddressOrRanges sequence.
848 */
849 sk_IPAddressOrRange_sort(aors);
850
851 /*
852 * Clean up representation issues, punt on duplicates or overlaps.
853 */
854 for (i = 0; i < sk_IPAddressOrRange_num(aors) - 1; i++) {
855 IPAddressOrRange *a = sk_IPAddressOrRange_value(aors, i);
856 IPAddressOrRange *b = sk_IPAddressOrRange_value(aors, i + 1);
857 unsigned char a_min[ADDR_RAW_BUF_LEN], a_max[ADDR_RAW_BUF_LEN];
858 unsigned char b_min[ADDR_RAW_BUF_LEN], b_max[ADDR_RAW_BUF_LEN];
859
860 if (!extract_min_max(a, a_min, a_max, length) ||
861 !extract_min_max(b, b_min, b_max, length))
862 return 0;
863
864 /*
865 * Punt inverted ranges.
866 */
867 if (memcmp(a_min, a_max, length) > 0 ||
868 memcmp(b_min, b_max, length) > 0)
869 return 0;
870
871 /*
872 * Punt overlaps.
873 */
874 if (memcmp(a_max, b_min, length) >= 0)
875 return 0;
876
877 /*
878 * Merge if a and b are adjacent. We check for
879 * adjacency by subtracting one from b_min first.
880 */
881 for (j = length - 1; j >= 0 && b_min[j]-- == 0x00; j--)
882 ;
883 if (memcmp(a_max, b_min, length) == 0) {
884 IPAddressOrRange *merged;
885 if (!make_addressRange(&merged, a_min, b_max, length))
886 return 0;
887 (void) sk_IPAddressOrRange_set(aors, i, merged);
888 (void) sk_IPAddressOrRange_delete(aors, i + 1);
889 IPAddressOrRange_free(a);
890 IPAddressOrRange_free(b);
891 --i;
892 continue;
893 }
894 }
895
896 /*
897 * Check for inverted final range.
898 */
899 j = sk_IPAddressOrRange_num(aors) - 1;
900 {
901 IPAddressOrRange *a = sk_IPAddressOrRange_value(aors, j);
902 if (a != NULL && a->type == IPAddressOrRange_addressRange) {
903 unsigned char a_min[ADDR_RAW_BUF_LEN], a_max[ADDR_RAW_BUF_LEN];
904 extract_min_max(a, a_min, a_max, length);
905 if (memcmp(a_min, a_max, length) > 0)
906 return 0;
907 }
908 }
909
910 return 1;
911}
912
913/*
914 * Whack an IPAddrBlocks extension into canonical form.
915 */
916int v3_addr_canonize(IPAddrBlocks *addr)
917{
918 int i;
919 for (i = 0; i < sk_IPAddressFamily_num(addr); i++) {
920 IPAddressFamily *f = sk_IPAddressFamily_value(addr, i);
921 if (f->ipAddressChoice->type == IPAddressChoice_addressesOrRanges &&
922 !IPAddressOrRanges_canonize(f->ipAddressChoice->u.addressesOrRanges,
923 v3_addr_get_afi(f)))
924 return 0;
925 }
926 (void) sk_IPAddressFamily_set_cmp_func(addr, IPAddressFamily_cmp);
927 sk_IPAddressFamily_sort(addr);
928 OPENSSL_assert(v3_addr_is_canonical(addr));
929 return 1;
930}
931
932/*
933 * v2i handler for the IPAddrBlocks extension.
934 */
935static void *v2i_IPAddrBlocks(const struct v3_ext_method *method,
936 struct v3_ext_ctx *ctx,
937 STACK_OF(CONF_VALUE) *values)
938{
939 static const char v4addr_chars[] = "0123456789.";
940 static const char v6addr_chars[] = "0123456789.:abcdefABCDEF";
941 IPAddrBlocks *addr = NULL;
942 char *s = NULL, *t;
943 int i;
944
945 if ((addr = sk_IPAddressFamily_new(IPAddressFamily_cmp)) == NULL) {
946 X509V3err(X509V3_F_V2I_IPADDRBLOCKS, ERR_R_MALLOC_FAILURE);
947 return NULL;
948 }
949
950 for (i = 0; i < sk_CONF_VALUE_num(values); i++) {
951 CONF_VALUE *val = sk_CONF_VALUE_value(values, i);
952 unsigned char min[ADDR_RAW_BUF_LEN], max[ADDR_RAW_BUF_LEN];
953 unsigned afi, *safi = NULL, safi_;
954 const char *addr_chars;
955 int prefixlen, i1, i2, delim, length;
956
957 if ( !name_cmp(val->name, "IPv4")) {
958 afi = IANA_AFI_IPV4;
959 } else if (!name_cmp(val->name, "IPv6")) {
960 afi = IANA_AFI_IPV6;
961 } else if (!name_cmp(val->name, "IPv4-SAFI")) {
962 afi = IANA_AFI_IPV4;
963 safi = &safi_;
964 } else if (!name_cmp(val->name, "IPv6-SAFI")) {
965 afi = IANA_AFI_IPV6;
966 safi = &safi_;
967 } else {
968 X509V3err(X509V3_F_V2I_IPADDRBLOCKS, X509V3_R_EXTENSION_NAME_ERROR);
969 X509V3_conf_err(val);
970 goto err;
971 }
972
973 switch (afi) {
974 case IANA_AFI_IPV4:
975 addr_chars = v4addr_chars;
976 break;
977 case IANA_AFI_IPV6:
978 addr_chars = v6addr_chars;
979 break;
980 }
981
982 length = length_from_afi(afi);
983
984 /*
985 * Handle SAFI, if any, and BUF_strdup() so we can null-terminate
986 * the other input values.
987 */
988 if (safi != NULL) {
989 *safi = strtoul(val->value, &t, 0);
990 t += strspn(t, " \t");
991 if (*safi > 0xFF || *t++ != ':') {
992 X509V3err(X509V3_F_V2I_IPADDRBLOCKS, X509V3_R_INVALID_SAFI);
993 X509V3_conf_err(val);
994 goto err;
995 }
996 t += strspn(t, " \t");
997 s = BUF_strdup(t);
998 } else {
999 s = BUF_strdup(val->value);
1000 }
1001 if (s == NULL) {
1002 X509V3err(X509V3_F_V2I_IPADDRBLOCKS, ERR_R_MALLOC_FAILURE);
1003 goto err;
1004 }
1005
1006 /*
1007 * Check for inheritance. Not worth additional complexity to
1008 * optimize this (seldom-used) case.
1009 */
1010 if (!strcmp(s, "inherit")) {
1011 if (!v3_addr_add_inherit(addr, afi, safi)) {
1012 X509V3err(X509V3_F_V2I_IPADDRBLOCKS, X509V3_R_INVALID_INHERITANCE);
1013 X509V3_conf_err(val);
1014 goto err;
1015 }
1016 OPENSSL_free(s);
1017 s = NULL;
1018 continue;
1019 }
1020
1021 i1 = strspn(s, addr_chars);
1022 i2 = i1 + strspn(s + i1, " \t");
1023 delim = s[i2++];
1024 s[i1] = '\0';
1025
1026 if (a2i_ipadd(min, s) != length) {
1027 X509V3err(X509V3_F_V2I_IPADDRBLOCKS, X509V3_R_INVALID_IPADDRESS);
1028 X509V3_conf_err(val);
1029 goto err;
1030 }
1031
1032 switch (delim) {
1033 case '/':
1034 prefixlen = (int) strtoul(s + i2, &t, 10);
1035 if (t == s + i2 || *t != '\0') {
1036 X509V3err(X509V3_F_V2I_IPADDRBLOCKS, X509V3_R_EXTENSION_VALUE_ERROR);
1037 X509V3_conf_err(val);
1038 goto err;
1039 }
1040 if (!v3_addr_add_prefix(addr, afi, safi, min, prefixlen)) {
1041 X509V3err(X509V3_F_V2I_IPADDRBLOCKS, ERR_R_MALLOC_FAILURE);
1042 goto err;
1043 }
1044 break;
1045 case '-':
1046 i1 = i2 + strspn(s + i2, " \t");
1047 i2 = i1 + strspn(s + i1, addr_chars);
1048 if (i1 == i2 || s[i2] != '\0') {
1049 X509V3err(X509V3_F_V2I_IPADDRBLOCKS, X509V3_R_EXTENSION_VALUE_ERROR);
1050 X509V3_conf_err(val);
1051 goto err;
1052 }
1053 if (a2i_ipadd(max, s + i1) != length) {
1054 X509V3err(X509V3_F_V2I_IPADDRBLOCKS, X509V3_R_INVALID_IPADDRESS);
1055 X509V3_conf_err(val);
1056 goto err;
1057 }
1058 if (memcmp(min, max, length_from_afi(afi)) > 0) {
1059 X509V3err(X509V3_F_V2I_IPADDRBLOCKS, X509V3_R_EXTENSION_VALUE_ERROR);
1060 X509V3_conf_err(val);
1061 goto err;
1062 }
1063 if (!v3_addr_add_range(addr, afi, safi, min, max)) {
1064 X509V3err(X509V3_F_V2I_IPADDRBLOCKS, ERR_R_MALLOC_FAILURE);
1065 goto err;
1066 }
1067 break;
1068 case '\0':
1069 if (!v3_addr_add_prefix(addr, afi, safi, min, length * 8)) {
1070 X509V3err(X509V3_F_V2I_IPADDRBLOCKS, ERR_R_MALLOC_FAILURE);
1071 goto err;
1072 }
1073 break;
1074 default:
1075 X509V3err(X509V3_F_V2I_IPADDRBLOCKS, X509V3_R_EXTENSION_VALUE_ERROR);
1076 X509V3_conf_err(val);
1077 goto err;
1078 }
1079
1080 OPENSSL_free(s);
1081 s = NULL;
1082 }
1083
1084 /*
1085 * Canonize the result, then we're done.
1086 */
1087 if (!v3_addr_canonize(addr))
1088 goto err;
1089 return addr;
1090
1091 err:
1092 OPENSSL_free(s);
1093 sk_IPAddressFamily_pop_free(addr, IPAddressFamily_free);
1094 return NULL;
1095}
1096
1097/*
1098 * OpenSSL dispatch
1099 */
1100const X509V3_EXT_METHOD v3_addr = {
1101 NID_sbgp_ipAddrBlock, /* nid */
1102 0, /* flags */
1103 ASN1_ITEM_ref(IPAddrBlocks), /* template */
1104 0, 0, 0, 0, /* old functions, ignored */
1105 0, /* i2s */
1106 0, /* s2i */
1107 0, /* i2v */
1108 v2i_IPAddrBlocks, /* v2i */
1109 i2r_IPAddrBlocks, /* i2r */
1110 0, /* r2i */
1111 NULL /* extension-specific data */
1112};
1113
1114/*
1115 * Figure out whether extension sues inheritance.
1116 */
1117int v3_addr_inherits(IPAddrBlocks *addr)
1118{
1119 int i;
1120 if (addr == NULL)
1121 return 0;
1122 for (i = 0; i < sk_IPAddressFamily_num(addr); i++) {
1123 IPAddressFamily *f = sk_IPAddressFamily_value(addr, i);
1124 if (f->ipAddressChoice->type == IPAddressChoice_inherit)
1125 return 1;
1126 }
1127 return 0;
1128}
1129
1130/*
1131 * Figure out whether parent contains child.
1132 */
1133static int addr_contains(IPAddressOrRanges *parent,
1134 IPAddressOrRanges *child,
1135 int length)
1136{
1137 unsigned char p_min[ADDR_RAW_BUF_LEN], p_max[ADDR_RAW_BUF_LEN];
1138 unsigned char c_min[ADDR_RAW_BUF_LEN], c_max[ADDR_RAW_BUF_LEN];
1139 int p, c;
1140
1141 if (child == NULL || parent == child)
1142 return 1;
1143 if (parent == NULL)
1144 return 0;
1145
1146 p = 0;
1147 for (c = 0; c < sk_IPAddressOrRange_num(child); c++) {
1148 if (!extract_min_max(sk_IPAddressOrRange_value(child, c),
1149 c_min, c_max, length))
1150 return -1;
1151 for (;; p++) {
1152 if (p >= sk_IPAddressOrRange_num(parent))
1153 return 0;
1154 if (!extract_min_max(sk_IPAddressOrRange_value(parent, p),
1155 p_min, p_max, length))
1156 return 0;
1157 if (memcmp(p_max, c_max, length) < 0)
1158 continue;
1159 if (memcmp(p_min, c_min, length) > 0)
1160 return 0;
1161 break;
1162 }
1163 }
1164
1165 return 1;
1166}
1167
1168/*
1169 * Test whether a is a subset of b.
1170 */
1171int v3_addr_subset(IPAddrBlocks *a, IPAddrBlocks *b)
1172{
1173 int i;
1174 if (a == NULL || a == b)
1175 return 1;
1176 if (b == NULL || v3_addr_inherits(a) || v3_addr_inherits(b))
1177 return 0;
1178 (void) sk_IPAddressFamily_set_cmp_func(b, IPAddressFamily_cmp);
1179 for (i = 0; i < sk_IPAddressFamily_num(a); i++) {
1180 IPAddressFamily *fa = sk_IPAddressFamily_value(a, i);
1181 int j = sk_IPAddressFamily_find(b, fa);
1182 IPAddressFamily *fb;
1183 fb = sk_IPAddressFamily_value(b, j);
1184 if (fb == NULL)
1185 return 0;
1186 if (!addr_contains(fb->ipAddressChoice->u.addressesOrRanges,
1187 fa->ipAddressChoice->u.addressesOrRanges,
1188 length_from_afi(v3_addr_get_afi(fb))))
1189 return 0;
1190 }
1191 return 1;
1192}
1193
1194/*
1195 * Validation error handling via callback.
1196 */
1197#define validation_err(_err_) \
1198 do { \
1199 if (ctx != NULL) { \
1200 ctx->error = _err_; \
1201 ctx->error_depth = i; \
1202 ctx->current_cert = x; \
1203 ret = ctx->verify_cb(0, ctx); \
1204 } else { \
1205 ret = 0; \
1206 } \
1207 if (!ret) \
1208 goto done; \
1209 } while (0)
1210
1211/*
1212 * Core code for RFC 3779 2.3 path validation.
1213 */
1214static int v3_addr_validate_path_internal(X509_STORE_CTX *ctx,
1215 STACK_OF(X509) *chain,
1216 IPAddrBlocks *ext)
1217{
1218 IPAddrBlocks *child = NULL;
1219 int i, j, ret = 1;
1220 X509 *x;
1221
1222 OPENSSL_assert(chain != NULL && sk_X509_num(chain) > 0);
1223 OPENSSL_assert(ctx != NULL || ext != NULL);
1224 OPENSSL_assert(ctx == NULL || ctx->verify_cb != NULL);
1225
1226 /*
1227 * Figure out where to start. If we don't have an extension to
1228 * check, we're done. Otherwise, check canonical form and
1229 * set up for walking up the chain.
1230 */
1231 if (ext != NULL) {
1232 i = -1;
1233 x = NULL;
1234 } else {
1235 i = 0;
1236 x = sk_X509_value(chain, i);
1237 OPENSSL_assert(x != NULL);
1238 if ((ext = x->rfc3779_addr) == NULL)
1239 goto done;
1240 }
1241 if (!v3_addr_is_canonical(ext))
1242 validation_err(X509_V_ERR_INVALID_EXTENSION);
1243 (void) sk_IPAddressFamily_set_cmp_func(ext, IPAddressFamily_cmp);
1244 if ((child = sk_IPAddressFamily_dup(ext)) == NULL) {
1245 X509V3err(X509V3_F_V3_ADDR_VALIDATE_PATH_INTERNAL, ERR_R_MALLOC_FAILURE);
1246 ret = 0;
1247 goto done;
1248 }
1249
1250 /*
1251 * Now walk up the chain. No cert may list resources that its
1252 * parent doesn't list.
1253 */
1254 for (i++; i < sk_X509_num(chain); i++) {
1255 x = sk_X509_value(chain, i);
1256 OPENSSL_assert(x != NULL);
1257 if (!v3_addr_is_canonical(x->rfc3779_addr))
1258 validation_err(X509_V_ERR_INVALID_EXTENSION);
1259 if (x->rfc3779_addr == NULL) {
1260 for (j = 0; j < sk_IPAddressFamily_num(child); j++) {
1261 IPAddressFamily *fc = sk_IPAddressFamily_value(child, j);
1262 if (fc->ipAddressChoice->type != IPAddressChoice_inherit) {
1263 validation_err(X509_V_ERR_UNNESTED_RESOURCE);
1264 break;
1265 }
1266 }
1267 continue;
1268 }
1269 (void) sk_IPAddressFamily_set_cmp_func(x->rfc3779_addr, IPAddressFamily_cmp);
1270 for (j = 0; j < sk_IPAddressFamily_num(child); j++) {
1271 IPAddressFamily *fc = sk_IPAddressFamily_value(child, j);
1272 int k = sk_IPAddressFamily_find(x->rfc3779_addr, fc);
1273 IPAddressFamily *fp = sk_IPAddressFamily_value(x->rfc3779_addr, k);
1274 if (fp == NULL) {
1275 if (fc->ipAddressChoice->type == IPAddressChoice_addressesOrRanges) {
1276 validation_err(X509_V_ERR_UNNESTED_RESOURCE);
1277 break;
1278 }
1279 continue;
1280 }
1281 if (fp->ipAddressChoice->type == IPAddressChoice_addressesOrRanges) {
1282 if (fc->ipAddressChoice->type == IPAddressChoice_inherit ||
1283 addr_contains(fp->ipAddressChoice->u.addressesOrRanges,
1284 fc->ipAddressChoice->u.addressesOrRanges,
1285 length_from_afi(v3_addr_get_afi(fc))))
1286 sk_IPAddressFamily_set(child, j, fp);
1287 else
1288 validation_err(X509_V_ERR_UNNESTED_RESOURCE);
1289 }
1290 }
1291 }
1292
1293 /*
1294 * Trust anchor can't inherit.
1295 */
1296 OPENSSL_assert(x != NULL);
1297 if (x->rfc3779_addr != NULL) {
1298 for (j = 0; j < sk_IPAddressFamily_num(x->rfc3779_addr); j++) {
1299 IPAddressFamily *fp = sk_IPAddressFamily_value(x->rfc3779_addr, j);
1300 if (fp->ipAddressChoice->type == IPAddressChoice_inherit &&
1301 sk_IPAddressFamily_find(child, fp) >= 0)
1302 validation_err(X509_V_ERR_UNNESTED_RESOURCE);
1303 }
1304 }
1305
1306 done:
1307 sk_IPAddressFamily_free(child);
1308 return ret;
1309}
1310
1311#undef validation_err
1312
1313/*
1314 * RFC 3779 2.3 path validation -- called from X509_verify_cert().
1315 */
1316int v3_addr_validate_path(X509_STORE_CTX *ctx)
1317{
1318 return v3_addr_validate_path_internal(ctx, ctx->chain, NULL);
1319}
1320
1321/*
1322 * RFC 3779 2.3 path validation of an extension.
1323 * Test whether chain covers extension.
1324 */
1325int v3_addr_validate_resource_set(STACK_OF(X509) *chain,
1326 IPAddrBlocks *ext,
1327 int allow_inheritance)
1328{
1329 if (ext == NULL)
1330 return 1;
1331 if (chain == NULL || sk_X509_num(chain) == 0)
1332 return 0;
1333 if (!allow_inheritance && v3_addr_inherits(ext))
1334 return 0;
1335 return v3_addr_validate_path_internal(NULL, chain, ext);
1336}
1337
1338#endif /* OPENSSL_NO_RFC3779 */
diff --git a/src/lib/libcrypto/x509v3/v3_alt.c b/src/lib/libcrypto/x509v3/v3_alt.c
index d29d94338e..91aefcddc1 100644
--- a/src/lib/libcrypto/x509v3/v3_alt.c
+++ b/src/lib/libcrypto/x509v3/v3_alt.c
@@ -153,9 +153,9 @@ STACK_OF(CONF_VALUE) *i2v_GENERAL_NAME(X509V3_EXT_METHOD *method,
153 BIO_snprintf(htmp, sizeof htmp, 153 BIO_snprintf(htmp, sizeof htmp,
154 "%X", p[0] << 8 | p[1]); 154 "%X", p[0] << 8 | p[1]);
155 p += 2; 155 p += 2;
156 strcat(oline, htmp); 156 strlcat(oline, htmp, sizeof(oline));
157 if (i != 7) 157 if (i != 7)
158 strcat(oline, ":"); 158 strlcat(oline, ":", sizeof(oline));
159 } 159 }
160 } 160 }
161 else 161 else
diff --git a/src/lib/libcrypto/x509v3/v3_asid.c b/src/lib/libcrypto/x509v3/v3_asid.c
new file mode 100644
index 0000000000..1587e8ed72
--- /dev/null
+++ b/src/lib/libcrypto/x509v3/v3_asid.c
@@ -0,0 +1,890 @@
1/*
2 * Contributed to the OpenSSL Project by the American Registry for
3 * Internet Numbers ("ARIN").
4 */
5/* ====================================================================
6 * Copyright (c) 2006 The OpenSSL Project. All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 *
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 *
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in
17 * the documentation and/or other materials provided with the
18 * distribution.
19 *
20 * 3. All advertising materials mentioning features or use of this
21 * software must display the following acknowledgment:
22 * "This product includes software developed by the OpenSSL Project
23 * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
24 *
25 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
26 * endorse or promote products derived from this software without
27 * prior written permission. For written permission, please contact
28 * licensing@OpenSSL.org.
29 *
30 * 5. Products derived from this software may not be called "OpenSSL"
31 * nor may "OpenSSL" appear in their names without prior written
32 * permission of the OpenSSL Project.
33 *
34 * 6. Redistributions of any form whatsoever must retain the following
35 * acknowledgment:
36 * "This product includes software developed by the OpenSSL Project
37 * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
38 *
39 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
40 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
41 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
42 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
43 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
44 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
45 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
46 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
47 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
48 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
49 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50 * OF THE POSSIBILITY OF SUCH DAMAGE.
51 * ====================================================================
52 *
53 * This product includes cryptographic software written by Eric Young
54 * (eay@cryptsoft.com). This product includes software written by Tim
55 * Hudson (tjh@cryptsoft.com).
56 */
57
58/*
59 * Implementation of RFC 3779 section 3.2.
60 */
61
62#include <stdio.h>
63#include <string.h>
64#include "cryptlib.h"
65#include <openssl/conf.h>
66#include <openssl/asn1.h>
67#include <openssl/asn1t.h>
68#include <openssl/x509v3.h>
69#include <openssl/x509.h>
70#include <openssl/bn.h>
71
72#ifndef OPENSSL_NO_RFC3779
73
74/*
75 * OpenSSL ASN.1 template translation of RFC 3779 3.2.3.
76 */
77
78ASN1_SEQUENCE(ASRange) = {
79 ASN1_SIMPLE(ASRange, min, ASN1_INTEGER),
80 ASN1_SIMPLE(ASRange, max, ASN1_INTEGER)
81} ASN1_SEQUENCE_END(ASRange)
82
83ASN1_CHOICE(ASIdOrRange) = {
84 ASN1_SIMPLE(ASIdOrRange, u.id, ASN1_INTEGER),
85 ASN1_SIMPLE(ASIdOrRange, u.range, ASRange)
86} ASN1_CHOICE_END(ASIdOrRange)
87
88ASN1_CHOICE(ASIdentifierChoice) = {
89 ASN1_SIMPLE(ASIdentifierChoice, u.inherit, ASN1_NULL),
90 ASN1_SEQUENCE_OF(ASIdentifierChoice, u.asIdsOrRanges, ASIdOrRange)
91} ASN1_CHOICE_END(ASIdentifierChoice)
92
93ASN1_SEQUENCE(ASIdentifiers) = {
94 ASN1_EXP_OPT(ASIdentifiers, asnum, ASIdentifierChoice, 0),
95 ASN1_EXP_OPT(ASIdentifiers, rdi, ASIdentifierChoice, 1)
96} ASN1_SEQUENCE_END(ASIdentifiers)
97
98IMPLEMENT_ASN1_FUNCTIONS(ASRange)
99IMPLEMENT_ASN1_FUNCTIONS(ASIdOrRange)
100IMPLEMENT_ASN1_FUNCTIONS(ASIdentifierChoice)
101IMPLEMENT_ASN1_FUNCTIONS(ASIdentifiers)
102
103/*
104 * i2r method for an ASIdentifierChoice.
105 */
106static int i2r_ASIdentifierChoice(BIO *out,
107 ASIdentifierChoice *choice,
108 int indent,
109 const char *msg)
110{
111 int i;
112 char *s;
113 if (choice == NULL)
114 return 1;
115 BIO_printf(out, "%*s%s:\n", indent, "", msg);
116 switch (choice->type) {
117 case ASIdentifierChoice_inherit:
118 BIO_printf(out, "%*sinherit\n", indent + 2, "");
119 break;
120 case ASIdentifierChoice_asIdsOrRanges:
121 for (i = 0; i < sk_ASIdOrRange_num(choice->u.asIdsOrRanges); i++) {
122 ASIdOrRange *aor = sk_ASIdOrRange_value(choice->u.asIdsOrRanges, i);
123 switch (aor->type) {
124 case ASIdOrRange_id:
125 if ((s = i2s_ASN1_INTEGER(NULL, aor->u.id)) == NULL)
126 return 0;
127 BIO_printf(out, "%*s%s\n", indent + 2, "", s);
128 OPENSSL_free(s);
129 break;
130 case ASIdOrRange_range:
131 if ((s = i2s_ASN1_INTEGER(NULL, aor->u.range->min)) == NULL)
132 return 0;
133 BIO_printf(out, "%*s%s-", indent + 2, "", s);
134 OPENSSL_free(s);
135 if ((s = i2s_ASN1_INTEGER(NULL, aor->u.range->max)) == NULL)
136 return 0;
137 BIO_printf(out, "%s\n", s);
138 OPENSSL_free(s);
139 break;
140 default:
141 return 0;
142 }
143 }
144 break;
145 default:
146 return 0;
147 }
148 return 1;
149}
150
151/*
152 * i2r method for an ASIdentifier extension.
153 */
154static int i2r_ASIdentifiers(const X509V3_EXT_METHOD *method,
155 void *ext,
156 BIO *out,
157 int indent)
158{
159 ASIdentifiers *asid = ext;
160 return (i2r_ASIdentifierChoice(out, asid->asnum, indent,
161 "Autonomous System Numbers") &&
162 i2r_ASIdentifierChoice(out, asid->rdi, indent,
163 "Routing Domain Identifiers"));
164}
165
166/*
167 * Sort comparision function for a sequence of ASIdOrRange elements.
168 */
169static int ASIdOrRange_cmp(const ASIdOrRange * const *a_,
170 const ASIdOrRange * const *b_)
171{
172 const ASIdOrRange *a = *a_, *b = *b_;
173
174 OPENSSL_assert((a->type == ASIdOrRange_id && a->u.id != NULL) ||
175 (a->type == ASIdOrRange_range && a->u.range != NULL &&
176 a->u.range->min != NULL && a->u.range->max != NULL));
177
178 OPENSSL_assert((b->type == ASIdOrRange_id && b->u.id != NULL) ||
179 (b->type == ASIdOrRange_range && b->u.range != NULL &&
180 b->u.range->min != NULL && b->u.range->max != NULL));
181
182 if (a->type == ASIdOrRange_id && b->type == ASIdOrRange_id)
183 return ASN1_INTEGER_cmp(a->u.id, b->u.id);
184
185 if (a->type == ASIdOrRange_range && b->type == ASIdOrRange_range) {
186 int r = ASN1_INTEGER_cmp(a->u.range->min, b->u.range->min);
187 return r != 0 ? r : ASN1_INTEGER_cmp(a->u.range->max, b->u.range->max);
188 }
189
190 if (a->type == ASIdOrRange_id)
191 return ASN1_INTEGER_cmp(a->u.id, b->u.range->min);
192 else
193 return ASN1_INTEGER_cmp(a->u.range->min, b->u.id);
194}
195
196/*
197 * Add an inherit element.
198 */
199int v3_asid_add_inherit(ASIdentifiers *asid, int which)
200{
201 ASIdentifierChoice **choice;
202 if (asid == NULL)
203 return 0;
204 switch (which) {
205 case V3_ASID_ASNUM:
206 choice = &asid->asnum;
207 break;
208 case V3_ASID_RDI:
209 choice = &asid->rdi;
210 break;
211 default:
212 return 0;
213 }
214 if (*choice == NULL) {
215 if ((*choice = ASIdentifierChoice_new()) == NULL)
216 return 0;
217 OPENSSL_assert((*choice)->u.inherit == NULL);
218 if (((*choice)->u.inherit = ASN1_NULL_new()) == NULL)
219 return 0;
220 (*choice)->type = ASIdentifierChoice_inherit;
221 }
222 return (*choice)->type == ASIdentifierChoice_inherit;
223}
224
225/*
226 * Add an ID or range to an ASIdentifierChoice.
227 */
228int v3_asid_add_id_or_range(ASIdentifiers *asid,
229 int which,
230 ASN1_INTEGER *min,
231 ASN1_INTEGER *max)
232{
233 ASIdentifierChoice **choice;
234 ASIdOrRange *aor;
235 if (asid == NULL)
236 return 0;
237 switch (which) {
238 case V3_ASID_ASNUM:
239 choice = &asid->asnum;
240 break;
241 case V3_ASID_RDI:
242 choice = &asid->rdi;
243 break;
244 default:
245 return 0;
246 }
247 if (*choice != NULL && (*choice)->type == ASIdentifierChoice_inherit)
248 return 0;
249 if (*choice == NULL) {
250 if ((*choice = ASIdentifierChoice_new()) == NULL)
251 return 0;
252 OPENSSL_assert((*choice)->u.asIdsOrRanges == NULL);
253 (*choice)->u.asIdsOrRanges = sk_ASIdOrRange_new(ASIdOrRange_cmp);
254 if ((*choice)->u.asIdsOrRanges == NULL)
255 return 0;
256 (*choice)->type = ASIdentifierChoice_asIdsOrRanges;
257 }
258 if ((aor = ASIdOrRange_new()) == NULL)
259 return 0;
260 if (max == NULL) {
261 aor->type = ASIdOrRange_id;
262 aor->u.id = min;
263 } else {
264 aor->type = ASIdOrRange_range;
265 if ((aor->u.range = ASRange_new()) == NULL)
266 goto err;
267 ASN1_INTEGER_free(aor->u.range->min);
268 aor->u.range->min = min;
269 ASN1_INTEGER_free(aor->u.range->max);
270 aor->u.range->max = max;
271 }
272 if (!(sk_ASIdOrRange_push((*choice)->u.asIdsOrRanges, aor)))
273 goto err;
274 return 1;
275
276 err:
277 ASIdOrRange_free(aor);
278 return 0;
279}
280
281/*
282 * Extract min and max values from an ASIdOrRange.
283 */
284static void extract_min_max(ASIdOrRange *aor,
285 ASN1_INTEGER **min,
286 ASN1_INTEGER **max)
287{
288 OPENSSL_assert(aor != NULL && min != NULL && max != NULL);
289 switch (aor->type) {
290 case ASIdOrRange_id:
291 *min = aor->u.id;
292 *max = aor->u.id;
293 return;
294 case ASIdOrRange_range:
295 *min = aor->u.range->min;
296 *max = aor->u.range->max;
297 return;
298 }
299}
300
301/*
302 * Check whether an ASIdentifierChoice is in canonical form.
303 */
304static int ASIdentifierChoice_is_canonical(ASIdentifierChoice *choice)
305{
306 ASN1_INTEGER *a_max_plus_one = NULL;
307 BIGNUM *bn = NULL;
308 int i, ret = 0;
309
310 /*
311 * Empty element or inheritance is canonical.
312 */
313 if (choice == NULL || choice->type == ASIdentifierChoice_inherit)
314 return 1;
315
316 /*
317 * If not a list, or if empty list, it's broken.
318 */
319 if (choice->type != ASIdentifierChoice_asIdsOrRanges ||
320 sk_ASIdOrRange_num(choice->u.asIdsOrRanges) == 0)
321 return 0;
322
323 /*
324 * It's a list, check it.
325 */
326 for (i = 0; i < sk_ASIdOrRange_num(choice->u.asIdsOrRanges) - 1; i++) {
327 ASIdOrRange *a = sk_ASIdOrRange_value(choice->u.asIdsOrRanges, i);
328 ASIdOrRange *b = sk_ASIdOrRange_value(choice->u.asIdsOrRanges, i + 1);
329 ASN1_INTEGER *a_min, *a_max, *b_min, *b_max;
330
331 extract_min_max(a, &a_min, &a_max);
332 extract_min_max(b, &b_min, &b_max);
333
334 /*
335 * Punt misordered list, overlapping start, or inverted range.
336 */
337 if (ASN1_INTEGER_cmp(a_min, b_min) >= 0 ||
338 ASN1_INTEGER_cmp(a_min, a_max) > 0 ||
339 ASN1_INTEGER_cmp(b_min, b_max) > 0)
340 goto done;
341
342 /*
343 * Calculate a_max + 1 to check for adjacency.
344 */
345 if ((bn == NULL && (bn = BN_new()) == NULL) ||
346 ASN1_INTEGER_to_BN(a_max, bn) == NULL ||
347 !BN_add_word(bn, 1) ||
348 (a_max_plus_one = BN_to_ASN1_INTEGER(bn, a_max_plus_one)) == NULL) {
349 X509V3err(X509V3_F_ASIDENTIFIERCHOICE_IS_CANONICAL,
350 ERR_R_MALLOC_FAILURE);
351 goto done;
352 }
353
354 /*
355 * Punt if adjacent or overlapping.
356 */
357 if (ASN1_INTEGER_cmp(a_max_plus_one, b_min) >= 0)
358 goto done;
359 }
360
361 /*
362 * Check for inverted range.
363 */
364 i = sk_ASIdOrRange_num(choice->u.asIdsOrRanges) - 1;
365 {
366 ASIdOrRange *a = sk_ASIdOrRange_value(choice->u.asIdsOrRanges, i);
367 ASN1_INTEGER *a_min, *a_max;
368 if (a != NULL && a->type == ASIdOrRange_range) {
369 extract_min_max(a, &a_min, &a_max);
370 if (ASN1_INTEGER_cmp(a_min, a_max) > 0)
371 goto done;
372 }
373 }
374
375 ret = 1;
376
377 done:
378 ASN1_INTEGER_free(a_max_plus_one);
379 BN_free(bn);
380 return ret;
381}
382
383/*
384 * Check whether an ASIdentifier extension is in canonical form.
385 */
386int v3_asid_is_canonical(ASIdentifiers *asid)
387{
388 return (asid == NULL ||
389 (ASIdentifierChoice_is_canonical(asid->asnum) &&
390 ASIdentifierChoice_is_canonical(asid->rdi)));
391}
392
393/*
394 * Whack an ASIdentifierChoice into canonical form.
395 */
396static int ASIdentifierChoice_canonize(ASIdentifierChoice *choice)
397{
398 ASN1_INTEGER *a_max_plus_one = NULL;
399 BIGNUM *bn = NULL;
400 int i, ret = 0;
401
402 /*
403 * Nothing to do for empty element or inheritance.
404 */
405 if (choice == NULL || choice->type == ASIdentifierChoice_inherit)
406 return 1;
407
408 /*
409 * If not a list, or if empty list, it's broken.
410 */
411 if (choice->type != ASIdentifierChoice_asIdsOrRanges ||
412 sk_ASIdOrRange_num(choice->u.asIdsOrRanges) == 0) {
413 X509V3err(X509V3_F_ASIDENTIFIERCHOICE_CANONIZE,
414 X509V3_R_EXTENSION_VALUE_ERROR);
415 return 0;
416 }
417
418 /*
419 * We have a non-empty list. Sort it.
420 */
421 sk_ASIdOrRange_sort(choice->u.asIdsOrRanges);
422
423 /*
424 * Now check for errors and suboptimal encoding, rejecting the
425 * former and fixing the latter.
426 */
427 for (i = 0; i < sk_ASIdOrRange_num(choice->u.asIdsOrRanges) - 1; i++) {
428 ASIdOrRange *a = sk_ASIdOrRange_value(choice->u.asIdsOrRanges, i);
429 ASIdOrRange *b = sk_ASIdOrRange_value(choice->u.asIdsOrRanges, i + 1);
430 ASN1_INTEGER *a_min, *a_max, *b_min, *b_max;
431
432 extract_min_max(a, &a_min, &a_max);
433 extract_min_max(b, &b_min, &b_max);
434
435 /*
436 * Make sure we're properly sorted (paranoia).
437 */
438 OPENSSL_assert(ASN1_INTEGER_cmp(a_min, b_min) <= 0);
439
440 /*
441 * Punt inverted ranges.
442 */
443 if (ASN1_INTEGER_cmp(a_min, a_max) > 0 ||
444 ASN1_INTEGER_cmp(b_min, b_max) > 0)
445 goto done;
446
447 /*
448 * Check for overlaps.
449 */
450 if (ASN1_INTEGER_cmp(a_max, b_min) >= 0) {
451 X509V3err(X509V3_F_ASIDENTIFIERCHOICE_CANONIZE,
452 X509V3_R_EXTENSION_VALUE_ERROR);
453 goto done;
454 }
455
456 /*
457 * Calculate a_max + 1 to check for adjacency.
458 */
459 if ((bn == NULL && (bn = BN_new()) == NULL) ||
460 ASN1_INTEGER_to_BN(a_max, bn) == NULL ||
461 !BN_add_word(bn, 1) ||
462 (a_max_plus_one = BN_to_ASN1_INTEGER(bn, a_max_plus_one)) == NULL) {
463 X509V3err(X509V3_F_ASIDENTIFIERCHOICE_CANONIZE, ERR_R_MALLOC_FAILURE);
464 goto done;
465 }
466
467 /*
468 * If a and b are adjacent, merge them.
469 */
470 if (ASN1_INTEGER_cmp(a_max_plus_one, b_min) == 0) {
471 ASRange *r;
472 switch (a->type) {
473 case ASIdOrRange_id:
474 if ((r = OPENSSL_malloc(sizeof(ASRange))) == NULL) {
475 X509V3err(X509V3_F_ASIDENTIFIERCHOICE_CANONIZE,
476 ERR_R_MALLOC_FAILURE);
477 goto done;
478 }
479 r->min = a_min;
480 r->max = b_max;
481 a->type = ASIdOrRange_range;
482 a->u.range = r;
483 break;
484 case ASIdOrRange_range:
485 ASN1_INTEGER_free(a->u.range->max);
486 a->u.range->max = b_max;
487 break;
488 }
489 switch (b->type) {
490 case ASIdOrRange_id:
491 b->u.id = NULL;
492 break;
493 case ASIdOrRange_range:
494 b->u.range->max = NULL;
495 break;
496 }
497 ASIdOrRange_free(b);
498 (void) sk_ASIdOrRange_delete(choice->u.asIdsOrRanges, i + 1);
499 i--;
500 continue;
501 }
502 }
503
504 /*
505 * Check for final inverted range.
506 */
507 i = sk_ASIdOrRange_num(choice->u.asIdsOrRanges) - 1;
508 {
509 ASIdOrRange *a = sk_ASIdOrRange_value(choice->u.asIdsOrRanges, i);
510 ASN1_INTEGER *a_min, *a_max;
511 if (a != NULL && a->type == ASIdOrRange_range) {
512 extract_min_max(a, &a_min, &a_max);
513 if (ASN1_INTEGER_cmp(a_min, a_max) > 0)
514 goto done;
515 }
516 }
517
518 OPENSSL_assert(ASIdentifierChoice_is_canonical(choice)); /* Paranoia */
519
520 ret = 1;
521
522 done:
523 ASN1_INTEGER_free(a_max_plus_one);
524 BN_free(bn);
525 return ret;
526}
527
528/*
529 * Whack an ASIdentifier extension into canonical form.
530 */
531int v3_asid_canonize(ASIdentifiers *asid)
532{
533 return (asid == NULL ||
534 (ASIdentifierChoice_canonize(asid->asnum) &&
535 ASIdentifierChoice_canonize(asid->rdi)));
536}
537
538/*
539 * v2i method for an ASIdentifier extension.
540 */
541static void *v2i_ASIdentifiers(const struct v3_ext_method *method,
542 struct v3_ext_ctx *ctx,
543 STACK_OF(CONF_VALUE) *values)
544{
545 ASN1_INTEGER *min = NULL, *max = NULL;
546 ASIdentifiers *asid = NULL;
547 int i;
548
549 if ((asid = ASIdentifiers_new()) == NULL) {
550 X509V3err(X509V3_F_V2I_ASIDENTIFIERS, ERR_R_MALLOC_FAILURE);
551 return NULL;
552 }
553
554 for (i = 0; i < sk_CONF_VALUE_num(values); i++) {
555 CONF_VALUE *val = sk_CONF_VALUE_value(values, i);
556 int i1, i2, i3, is_range, which;
557
558 /*
559 * Figure out whether this is an AS or an RDI.
560 */
561 if ( !name_cmp(val->name, "AS")) {
562 which = V3_ASID_ASNUM;
563 } else if (!name_cmp(val->name, "RDI")) {
564 which = V3_ASID_RDI;
565 } else {
566 X509V3err(X509V3_F_V2I_ASIDENTIFIERS, X509V3_R_EXTENSION_NAME_ERROR);
567 X509V3_conf_err(val);
568 goto err;
569 }
570
571 /*
572 * Handle inheritance.
573 */
574 if (!strcmp(val->value, "inherit")) {
575 if (v3_asid_add_inherit(asid, which))
576 continue;
577 X509V3err(X509V3_F_V2I_ASIDENTIFIERS, X509V3_R_INVALID_INHERITANCE);
578 X509V3_conf_err(val);
579 goto err;
580 }
581
582 /*
583 * Number, range, or mistake, pick it apart and figure out which.
584 */
585 i1 = strspn(val->value, "0123456789");
586 if (val->value[i1] == '\0') {
587 is_range = 0;
588 } else {
589 is_range = 1;
590 i2 = i1 + strspn(val->value + i1, " \t");
591 if (val->value[i2] != '-') {
592 X509V3err(X509V3_F_V2I_ASIDENTIFIERS, X509V3_R_INVALID_ASNUMBER);
593 X509V3_conf_err(val);
594 goto err;
595 }
596 i2++;
597 i2 = i2 + strspn(val->value + i2, " \t");
598 i3 = i2 + strspn(val->value + i2, "0123456789");
599 if (val->value[i3] != '\0') {
600 X509V3err(X509V3_F_V2I_ASIDENTIFIERS, X509V3_R_INVALID_ASRANGE);
601 X509V3_conf_err(val);
602 goto err;
603 }
604 }
605
606 /*
607 * Syntax is ok, read and add it.
608 */
609 if (!is_range) {
610 if (!X509V3_get_value_int(val, &min)) {
611 X509V3err(X509V3_F_V2I_ASIDENTIFIERS, ERR_R_MALLOC_FAILURE);
612 goto err;
613 }
614 } else {
615 char *s = BUF_strdup(val->value);
616 if (s == NULL) {
617 X509V3err(X509V3_F_V2I_ASIDENTIFIERS, ERR_R_MALLOC_FAILURE);
618 goto err;
619 }
620 s[i1] = '\0';
621 min = s2i_ASN1_INTEGER(NULL, s);
622 max = s2i_ASN1_INTEGER(NULL, s + i2);
623 OPENSSL_free(s);
624 if (min == NULL || max == NULL) {
625 X509V3err(X509V3_F_V2I_ASIDENTIFIERS, ERR_R_MALLOC_FAILURE);
626 goto err;
627 }
628 if (ASN1_INTEGER_cmp(min, max) > 0) {
629 X509V3err(X509V3_F_V2I_ASIDENTIFIERS, X509V3_R_EXTENSION_VALUE_ERROR);
630 goto err;
631 }
632 }
633 if (!v3_asid_add_id_or_range(asid, which, min, max)) {
634 X509V3err(X509V3_F_V2I_ASIDENTIFIERS, ERR_R_MALLOC_FAILURE);
635 goto err;
636 }
637 min = max = NULL;
638 }
639
640 /*
641 * Canonize the result, then we're done.
642 */
643 if (!v3_asid_canonize(asid))
644 goto err;
645 return asid;
646
647 err:
648 ASIdentifiers_free(asid);
649 ASN1_INTEGER_free(min);
650 ASN1_INTEGER_free(max);
651 return NULL;
652}
653
654/*
655 * OpenSSL dispatch.
656 */
657const X509V3_EXT_METHOD v3_asid = {
658 NID_sbgp_autonomousSysNum, /* nid */
659 0, /* flags */
660 ASN1_ITEM_ref(ASIdentifiers), /* template */
661 0, 0, 0, 0, /* old functions, ignored */
662 0, /* i2s */
663 0, /* s2i */
664 0, /* i2v */
665 v2i_ASIdentifiers, /* v2i */
666 i2r_ASIdentifiers, /* i2r */
667 0, /* r2i */
668 NULL /* extension-specific data */
669};
670
671/*
672 * Figure out whether extension uses inheritance.
673 */
674int v3_asid_inherits(ASIdentifiers *asid)
675{
676 return (asid != NULL &&
677 ((asid->asnum != NULL &&
678 asid->asnum->type == ASIdentifierChoice_inherit) ||
679 (asid->rdi != NULL &&
680 asid->rdi->type == ASIdentifierChoice_inherit)));
681}
682
683/*
684 * Figure out whether parent contains child.
685 */
686static int asid_contains(ASIdOrRanges *parent, ASIdOrRanges *child)
687{
688 ASN1_INTEGER *p_min, *p_max, *c_min, *c_max;
689 int p, c;
690
691 if (child == NULL || parent == child)
692 return 1;
693 if (parent == NULL)
694 return 0;
695
696 p = 0;
697 for (c = 0; c < sk_ASIdOrRange_num(child); c++) {
698 extract_min_max(sk_ASIdOrRange_value(child, c), &c_min, &c_max);
699 for (;; p++) {
700 if (p >= sk_ASIdOrRange_num(parent))
701 return 0;
702 extract_min_max(sk_ASIdOrRange_value(parent, p), &p_min, &p_max);
703 if (ASN1_INTEGER_cmp(p_max, c_max) < 0)
704 continue;
705 if (ASN1_INTEGER_cmp(p_min, c_min) > 0)
706 return 0;
707 break;
708 }
709 }
710
711 return 1;
712}
713
714/*
715 * Test whether a is a subet of b.
716 */
717int v3_asid_subset(ASIdentifiers *a, ASIdentifiers *b)
718{
719 return (a == NULL ||
720 a == b ||
721 (b != NULL &&
722 !v3_asid_inherits(a) &&
723 !v3_asid_inherits(b) &&
724 asid_contains(b->asnum->u.asIdsOrRanges,
725 a->asnum->u.asIdsOrRanges) &&
726 asid_contains(b->rdi->u.asIdsOrRanges,
727 a->rdi->u.asIdsOrRanges)));
728}
729
730/*
731 * Validation error handling via callback.
732 */
733#define validation_err(_err_) \
734 do { \
735 if (ctx != NULL) { \
736 ctx->error = _err_; \
737 ctx->error_depth = i; \
738 ctx->current_cert = x; \
739 ret = ctx->verify_cb(0, ctx); \
740 } else { \
741 ret = 0; \
742 } \
743 if (!ret) \
744 goto done; \
745 } while (0)
746
747/*
748 * Core code for RFC 3779 3.3 path validation.
749 */
750static int v3_asid_validate_path_internal(X509_STORE_CTX *ctx,
751 STACK_OF(X509) *chain,
752 ASIdentifiers *ext)
753{
754 ASIdOrRanges *child_as = NULL, *child_rdi = NULL;
755 int i, ret = 1, inherit_as = 0, inherit_rdi = 0;
756 X509 *x;
757
758 OPENSSL_assert(chain != NULL && sk_X509_num(chain) > 0);
759 OPENSSL_assert(ctx != NULL || ext != NULL);
760 OPENSSL_assert(ctx == NULL || ctx->verify_cb != NULL);
761
762 /*
763 * Figure out where to start. If we don't have an extension to
764 * check, we're done. Otherwise, check canonical form and
765 * set up for walking up the chain.
766 */
767 if (ext != NULL) {
768 i = -1;
769 x = NULL;
770 } else {
771 i = 0;
772 x = sk_X509_value(chain, i);
773 OPENSSL_assert(x != NULL);
774 if ((ext = x->rfc3779_asid) == NULL)
775 goto done;
776 }
777 if (!v3_asid_is_canonical(ext))
778 validation_err(X509_V_ERR_INVALID_EXTENSION);
779 if (ext->asnum != NULL) {
780 switch (ext->asnum->type) {
781 case ASIdentifierChoice_inherit:
782 inherit_as = 1;
783 break;
784 case ASIdentifierChoice_asIdsOrRanges:
785 child_as = ext->asnum->u.asIdsOrRanges;
786 break;
787 }
788 }
789 if (ext->rdi != NULL) {
790 switch (ext->rdi->type) {
791 case ASIdentifierChoice_inherit:
792 inherit_rdi = 1;
793 break;
794 case ASIdentifierChoice_asIdsOrRanges:
795 child_rdi = ext->rdi->u.asIdsOrRanges;
796 break;
797 }
798 }
799
800 /*
801 * Now walk up the chain. Extensions must be in canonical form, no
802 * cert may list resources that its parent doesn't list.
803 */
804 for (i++; i < sk_X509_num(chain); i++) {
805 x = sk_X509_value(chain, i);
806 OPENSSL_assert(x != NULL);
807 if (x->rfc3779_asid == NULL) {
808 if (child_as != NULL || child_rdi != NULL)
809 validation_err(X509_V_ERR_UNNESTED_RESOURCE);
810 continue;
811 }
812 if (!v3_asid_is_canonical(x->rfc3779_asid))
813 validation_err(X509_V_ERR_INVALID_EXTENSION);
814 if (x->rfc3779_asid->asnum == NULL && child_as != NULL) {
815 validation_err(X509_V_ERR_UNNESTED_RESOURCE);
816 child_as = NULL;
817 inherit_as = 0;
818 }
819 if (x->rfc3779_asid->asnum != NULL &&
820 x->rfc3779_asid->asnum->type == ASIdentifierChoice_asIdsOrRanges) {
821 if (inherit_as ||
822 asid_contains(x->rfc3779_asid->asnum->u.asIdsOrRanges, child_as)) {
823 child_as = x->rfc3779_asid->asnum->u.asIdsOrRanges;
824 inherit_as = 0;
825 } else {
826 validation_err(X509_V_ERR_UNNESTED_RESOURCE);
827 }
828 }
829 if (x->rfc3779_asid->rdi == NULL && child_rdi != NULL) {
830 validation_err(X509_V_ERR_UNNESTED_RESOURCE);
831 child_rdi = NULL;
832 inherit_rdi = 0;
833 }
834 if (x->rfc3779_asid->rdi != NULL &&
835 x->rfc3779_asid->rdi->type == ASIdentifierChoice_asIdsOrRanges) {
836 if (inherit_rdi ||
837 asid_contains(x->rfc3779_asid->rdi->u.asIdsOrRanges, child_rdi)) {
838 child_rdi = x->rfc3779_asid->rdi->u.asIdsOrRanges;
839 inherit_rdi = 0;
840 } else {
841 validation_err(X509_V_ERR_UNNESTED_RESOURCE);
842 }
843 }
844 }
845
846 /*
847 * Trust anchor can't inherit.
848 */
849 OPENSSL_assert(x != NULL);
850 if (x->rfc3779_asid != NULL) {
851 if (x->rfc3779_asid->asnum != NULL &&
852 x->rfc3779_asid->asnum->type == ASIdentifierChoice_inherit)
853 validation_err(X509_V_ERR_UNNESTED_RESOURCE);
854 if (x->rfc3779_asid->rdi != NULL &&
855 x->rfc3779_asid->rdi->type == ASIdentifierChoice_inherit)
856 validation_err(X509_V_ERR_UNNESTED_RESOURCE);
857 }
858
859 done:
860 return ret;
861}
862
863#undef validation_err
864
865/*
866 * RFC 3779 3.3 path validation -- called from X509_verify_cert().
867 */
868int v3_asid_validate_path(X509_STORE_CTX *ctx)
869{
870 return v3_asid_validate_path_internal(ctx, ctx->chain, NULL);
871}
872
873/*
874 * RFC 3779 3.3 path validation of an extension.
875 * Test whether chain covers extension.
876 */
877int v3_asid_validate_resource_set(STACK_OF(X509) *chain,
878 ASIdentifiers *ext,
879 int allow_inheritance)
880{
881 if (ext == NULL)
882 return 1;
883 if (chain == NULL || sk_X509_num(chain) == 0)
884 return 0;
885 if (!allow_inheritance && v3_asid_inherits(ext))
886 return 0;
887 return v3_asid_validate_path_internal(NULL, chain, ext);
888}
889
890#endif /* OPENSSL_NO_RFC3779 */
diff --git a/src/lib/libcrypto/x509v3/v3_purp.c b/src/lib/libcrypto/x509v3/v3_purp.c
index ad688657e0..181bd34979 100644
--- a/src/lib/libcrypto/x509v3/v3_purp.c
+++ b/src/lib/libcrypto/x509v3/v3_purp.c
@@ -474,11 +474,11 @@ static void x509v3_cache_extensions(X509 *x)
474 for (i = 0; i < X509_get_ext_count(x); i++) 474 for (i = 0; i < X509_get_ext_count(x); i++)
475 { 475 {
476 ex = X509_get_ext(x, i); 476 ex = X509_get_ext(x, i);
477 if (!X509_EXTENSION_get_critical(ex))
478 continue;
477 if (OBJ_obj2nid(X509_EXTENSION_get_object(ex)) 479 if (OBJ_obj2nid(X509_EXTENSION_get_object(ex))
478 == NID_freshest_crl) 480 == NID_freshest_crl)
479 x->ex_flags |= EXFLAG_FRESHEST; 481 x->ex_flags |= EXFLAG_FRESHEST;
480 if (!X509_EXTENSION_get_critical(ex))
481 continue;
482 if (!X509_supported_extension(ex)) 482 if (!X509_supported_extension(ex))
483 { 483 {
484 x->ex_flags |= EXFLAG_CRITICAL; 484 x->ex_flags |= EXFLAG_CRITICAL;
diff --git a/src/lib/libcrypto/x509v3/v3conf.c b/src/lib/libcrypto/x509v3/v3conf.c
new file mode 100644
index 0000000000..a9e6ca3542
--- /dev/null
+++ b/src/lib/libcrypto/x509v3/v3conf.c
@@ -0,0 +1,127 @@
1/* v3conf.c */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project 1999.
4 */
5/* ====================================================================
6 * Copyright (c) 1999 The OpenSSL Project. All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 *
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 *
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in
17 * the documentation and/or other materials provided with the
18 * distribution.
19 *
20 * 3. All advertising materials mentioning features or use of this
21 * software must display the following acknowledgment:
22 * "This product includes software developed by the OpenSSL Project
23 * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
24 *
25 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
26 * endorse or promote products derived from this software without
27 * prior written permission. For written permission, please contact
28 * licensing@OpenSSL.org.
29 *
30 * 5. Products derived from this software may not be called "OpenSSL"
31 * nor may "OpenSSL" appear in their names without prior written
32 * permission of the OpenSSL Project.
33 *
34 * 6. Redistributions of any form whatsoever must retain the following
35 * acknowledgment:
36 * "This product includes software developed by the OpenSSL Project
37 * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
38 *
39 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
40 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
41 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
42 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
43 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
44 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
45 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
46 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
47 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
48 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
49 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50 * OF THE POSSIBILITY OF SUCH DAMAGE.
51 * ====================================================================
52 *
53 * This product includes cryptographic software written by Eric Young
54 * (eay@cryptsoft.com). This product includes software written by Tim
55 * Hudson (tjh@cryptsoft.com).
56 *
57 */
58
59
60#include <stdio.h>
61#include "cryptlib.h"
62#include <openssl/asn1.h>
63#include <openssl/conf.h>
64#include <openssl/x509.h>
65#include <openssl/x509v3.h>
66
67/* Test application to add extensions from a config file */
68
69int main(int argc, char **argv)
70{
71 LHASH *conf;
72 X509 *cert;
73 FILE *inf;
74 char *conf_file;
75 int i;
76 int count;
77 X509_EXTENSION *ext;
78 X509V3_add_standard_extensions();
79 ERR_load_crypto_strings();
80 if(!argv[1]) {
81 fprintf(stderr, "Usage: v3conf cert.pem [file.cnf]\n");
82 exit(1);
83 }
84 conf_file = argv[2];
85 if(!conf_file) conf_file = "test.cnf";
86 conf = CONF_load(NULL, "test.cnf", NULL);
87 if(!conf) {
88 fprintf(stderr, "Error opening Config file %s\n", conf_file);
89 ERR_print_errors_fp(stderr);
90 exit(1);
91 }
92
93 inf = fopen(argv[1], "r");
94 if(!inf) {
95 fprintf(stderr, "Can't open certificate file %s\n", argv[1]);
96 exit(1);
97 }
98 cert = PEM_read_X509(inf, NULL, NULL);
99 if(!cert) {
100 fprintf(stderr, "Error reading certificate file %s\n", argv[1]);
101 exit(1);
102 }
103 fclose(inf);
104
105 sk_pop_free(cert->cert_info->extensions, X509_EXTENSION_free);
106 cert->cert_info->extensions = NULL;
107
108 if(!X509V3_EXT_add_conf(conf, NULL, "test_section", cert)) {
109 fprintf(stderr, "Error adding extensions\n");
110 ERR_print_errors_fp(stderr);
111 exit(1);
112 }
113
114 count = X509_get_ext_count(cert);
115 printf("%d extensions\n", count);
116 for(i = 0; i < count; i++) {
117 ext = X509_get_ext(cert, i);
118 printf("%s", OBJ_nid2ln(OBJ_obj2nid(ext->object)));
119 if(ext->critical) printf(",critical:\n");
120 else printf(":\n");
121 X509V3_EXT_print_fp(stdout, ext, 0, 0);
122 printf("\n");
123
124 }
125 return 0;
126}
127
diff --git a/src/lib/libcrypto/x509v3/v3prin.c b/src/lib/libcrypto/x509v3/v3prin.c
new file mode 100644
index 0000000000..d5ff268296
--- /dev/null
+++ b/src/lib/libcrypto/x509v3/v3prin.c
@@ -0,0 +1,99 @@
1/* v3prin.c */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project 1999.
4 */
5/* ====================================================================
6 * Copyright (c) 1999 The OpenSSL Project. All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 *
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 *
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in
17 * the documentation and/or other materials provided with the
18 * distribution.
19 *
20 * 3. All advertising materials mentioning features or use of this
21 * software must display the following acknowledgment:
22 * "This product includes software developed by the OpenSSL Project
23 * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
24 *
25 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
26 * endorse or promote products derived from this software without
27 * prior written permission. For written permission, please contact
28 * licensing@OpenSSL.org.
29 *
30 * 5. Products derived from this software may not be called "OpenSSL"
31 * nor may "OpenSSL" appear in their names without prior written
32 * permission of the OpenSSL Project.
33 *
34 * 6. Redistributions of any form whatsoever must retain the following
35 * acknowledgment:
36 * "This product includes software developed by the OpenSSL Project
37 * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
38 *
39 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
40 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
41 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
42 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
43 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
44 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
45 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
46 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
47 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
48 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
49 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50 * OF THE POSSIBILITY OF SUCH DAMAGE.
51 * ====================================================================
52 *
53 * This product includes cryptographic software written by Eric Young
54 * (eay@cryptsoft.com). This product includes software written by Tim
55 * Hudson (tjh@cryptsoft.com).
56 *
57 */
58
59
60
61#include <stdio.h>
62#include <openssl/asn1.h>
63#include <openssl/conf.h>
64#include <openssl/x509.h>
65#include <openssl/x509v3.h>
66
67int main(int argc, char **argv)
68{
69 X509 *cert;
70 FILE *inf;
71 int i, count;
72 X509_EXTENSION *ext;
73 X509V3_add_standard_extensions();
74 ERR_load_crypto_strings();
75 if(!argv[1]) {
76 fprintf(stderr, "Usage v3prin cert.pem\n");
77 exit(1);
78 }
79 if(!(inf = fopen(argv[1], "r"))) {
80 fprintf(stderr, "Can't open %s\n", argv[1]);
81 exit(1);
82 }
83 if(!(cert = PEM_read_X509(inf, NULL, NULL))) {
84 fprintf(stderr, "Can't read certificate %s\n", argv[1]);
85 ERR_print_errors_fp(stderr);
86 exit(1);
87 }
88 fclose(inf);
89 count = X509_get_ext_count(cert);
90 printf("%d extensions\n", count);
91 for(i = 0; i < count; i++) {
92 ext = X509_get_ext(cert, i);
93 printf("%s\n", OBJ_nid2ln(OBJ_obj2nid(ext->object)));
94 if(!X509V3_EXT_print_fp(stdout, ext, 0, 0)) ERR_print_errors_fp(stderr);
95 printf("\n");
96
97 }
98 return 0;
99}
diff --git a/src/lib/libcrypto/x86_64cpuid.pl b/src/lib/libcrypto/x86_64cpuid.pl
index 6ebfd017ea..7b7b93b223 100644
--- a/src/lib/libcrypto/x86_64cpuid.pl
+++ b/src/lib/libcrypto/x86_64cpuid.pl
@@ -11,8 +11,7 @@ $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1;
11( $xlate="${dir}perlasm/x86_64-xlate.pl" and -f $xlate) or 11( $xlate="${dir}perlasm/x86_64-xlate.pl" and -f $xlate) or
12die "can't locate x86_64-xlate.pl"; 12die "can't locate x86_64-xlate.pl";
13 13
14open OUT,"| \"$^X\" $xlate $flavour $output"; 14open STDOUT,"| $^X $xlate $flavour $output";
15*STDOUT=*OUT;
16 15
17($arg1,$arg2,$arg3,$arg4)=$win64?("%rcx","%rdx","%r8", "%r9") : # Win64 order 16($arg1,$arg2,$arg3,$arg4)=$win64?("%rcx","%rdx","%r8", "%r9") : # Win64 order
18 ("%rdi","%rsi","%rdx","%rcx"); # Unix order 17 ("%rdi","%rsi","%rdx","%rcx"); # Unix order