summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto')
-rw-r--r--src/lib/libcrypto/Makefile.ssl218
-rw-r--r--src/lib/libcrypto/acss/acss.h47
-rw-r--r--src/lib/libcrypto/acss/acss_enc.c177
-rw-r--r--src/lib/libcrypto/acss/acss_skey.c86
-rw-r--r--src/lib/libcrypto/aes/Makefile103
-rw-r--r--src/lib/libcrypto/aes/Makefile.ssl103
-rw-r--r--src/lib/libcrypto/aes/aes_cbc.c2
-rw-r--r--src/lib/libcrypto/asn1/Makefile1150
-rw-r--r--src/lib/libcrypto/asn1/Makefile.ssl1152
-rw-r--r--src/lib/libcrypto/asn1/a_bytes.c2
-rw-r--r--src/lib/libcrypto/asn1/a_gentm.c246
-rw-r--r--src/lib/libcrypto/asn1/a_hdr.c119
-rw-r--r--src/lib/libcrypto/asn1/a_meth.c84
-rw-r--r--src/lib/libcrypto/asn1/a_utctm.c303
-rw-r--r--src/lib/libcrypto/asn1/asn1.h2
-rw-r--r--src/lib/libcrypto/asn1/asn1_err.c324
-rw-r--r--src/lib/libcrypto/asn1/f.c80
-rw-r--r--src/lib/libcrypto/asn1/p8_key.c131
-rw-r--r--src/lib/libcrypto/asn1/t_x509.c2
-rw-r--r--src/lib/libcrypto/asn1/tasn_dec.c78
-rw-r--r--src/lib/libcrypto/asn1/tasn_enc.c9
-rw-r--r--src/lib/libcrypto/asn1/x_cinf.c201
-rw-r--r--src/lib/libcrypto/bf/Makefile116
-rw-r--r--src/lib/libcrypto/bf/Makefile.ssl115
-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.c328
-rw-r--r--src/lib/libcrypto/bf/bf_skey.c1
-rw-r--r--src/lib/libcrypto/bf/bfs.cpp67
-rw-r--r--src/lib/libcrypto/bf/bfspeed.c274
-rw-r--r--src/lib/libcrypto/bf/bftest.c536
-rw-r--r--src/lib/libcrypto/bio/Makefile214
-rw-r--r--src/lib/libcrypto/bio/Makefile.ssl216
-rw-r--r--src/lib/libcrypto/bio/b_print.c13
-rw-r--r--src/lib/libcrypto/bio/bio_err.c130
-rw-r--r--src/lib/libcrypto/bio/bss_conn.c2
-rw-r--r--src/lib/libcrypto/bio/bss_rtcp.c294
-rw-r--r--src/lib/libcrypto/bn/Makefile333
-rw-r--r--src/lib/libcrypto/bn/Makefile.ssl326
-rw-r--r--src/lib/libcrypto/bn/asm/README27
-rw-r--r--src/lib/libcrypto/bn/asm/alpha.s3199
-rw-r--r--src/lib/libcrypto/bn/asm/alpha.s.works533
-rw-r--r--src/lib/libcrypto/bn/asm/alpha.works/add.pl119
-rw-r--r--src/lib/libcrypto/bn/asm/alpha.works/div.pl144
-rw-r--r--src/lib/libcrypto/bn/asm/alpha.works/mul.pl116
-rw-r--r--src/lib/libcrypto/bn/asm/alpha.works/mul_add.pl120
-rw-r--r--src/lib/libcrypto/bn/asm/alpha.works/mul_c4.pl213
-rw-r--r--src/lib/libcrypto/bn/asm/alpha.works/mul_c4.works.pl98
-rw-r--r--src/lib/libcrypto/bn/asm/alpha.works/mul_c8.pl177
-rw-r--r--src/lib/libcrypto/bn/asm/alpha.works/sqr.pl113
-rw-r--r--src/lib/libcrypto/bn/asm/alpha.works/sqr_c4.pl109
-rw-r--r--src/lib/libcrypto/bn/asm/alpha.works/sqr_c8.pl132
-rw-r--r--src/lib/libcrypto/bn/asm/alpha.works/sub.pl108
-rw-r--r--src/lib/libcrypto/bn/asm/alpha/add.pl118
-rw-r--r--src/lib/libcrypto/bn/asm/alpha/div.pl144
-rw-r--r--src/lib/libcrypto/bn/asm/alpha/mul.pl104
-rw-r--r--src/lib/libcrypto/bn/asm/alpha/mul_add.pl123
-rw-r--r--src/lib/libcrypto/bn/asm/alpha/mul_c4.pl215
-rw-r--r--src/lib/libcrypto/bn/asm/alpha/mul_c4.works.pl98
-rw-r--r--src/lib/libcrypto/bn/asm/alpha/mul_c8.pl177
-rw-r--r--src/lib/libcrypto/bn/asm/alpha/sqr.pl113
-rw-r--r--src/lib/libcrypto/bn/asm/alpha/sqr_c4.pl109
-rw-r--r--src/lib/libcrypto/bn/asm/alpha/sqr_c8.pl132
-rw-r--r--src/lib/libcrypto/bn/asm/alpha/sub.pl108
-rw-r--r--src/lib/libcrypto/bn/asm/bn-alpha.pl571
-rw-r--r--src/lib/libcrypto/bn/asm/ca.pl33
-rw-r--r--src/lib/libcrypto/bn/asm/co-alpha.pl116
-rw-r--r--src/lib/libcrypto/bn/asm/mips1.s539
-rw-r--r--src/lib/libcrypto/bn/asm/mips3.s2201
-rw-r--r--src/lib/libcrypto/bn/asm/pa-risc.s710
-rw-r--r--src/lib/libcrypto/bn/asm/r3000.s646
-rw-r--r--src/lib/libcrypto/bn/asm/sparcv8plus.S16
-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.h34
-rw-r--r--src/lib/libcrypto/bn/bn.mul19
-rw-r--r--src/lib/libcrypto/bn/bn_asm.c2
-rw-r--r--src/lib/libcrypto/bn/bn_err.c92
-rw-r--r--src/lib/libcrypto/bn/bn_exp.c244
-rw-r--r--src/lib/libcrypto/bn/bn_lcl.h39
-rw-r--r--src/lib/libcrypto/bn/bn_mont.c20
-rw-r--r--src/lib/libcrypto/bn/bn_prime.c4
-rw-r--r--src/lib/libcrypto/bn/bn_print.c6
-rw-r--r--src/lib/libcrypto/bn/bn_word.c6
-rw-r--r--src/lib/libcrypto/bn/bnspeed.c233
-rw-r--r--src/lib/libcrypto/bn/bntest.c1234
-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.c187
-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/Makefile92
-rw-r--r--src/lib/libcrypto/buffer/Makefile.ssl94
-rw-r--r--src/lib/libcrypto/buffer/buf_err.c16
-rw-r--r--src/lib/libcrypto/cast/Makefile121
-rw-r--r--src/lib/libcrypto/cast/Makefile.ssl120
-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/c_skey.c1
-rw-r--r--src/lib/libcrypto/cast/cast_lcl.h21
-rw-r--r--src/lib/libcrypto/cast/cast_spd.c275
-rw-r--r--src/lib/libcrypto/cast/castopts.c339
-rw-r--r--src/lib/libcrypto/cast/casts.cpp70
-rw-r--r--src/lib/libcrypto/cast/casttest.c232
-rw-r--r--src/lib/libcrypto/comp/Makefile113
-rw-r--r--src/lib/libcrypto/comp/Makefile.ssl114
-rw-r--r--src/lib/libcrypto/comp/c_zlib.c88
-rw-r--r--src/lib/libcrypto/conf/Makefile181
-rw-r--r--src/lib/libcrypto/conf/Makefile.ssl183
-rw-r--r--src/lib/libcrypto/conf/cnf_save.c106
-rw-r--r--src/lib/libcrypto/conf/conf_def.c13
-rw-r--r--src/lib/libcrypto/conf/conf_err.c78
-rw-r--r--src/lib/libcrypto/conf/test.c98
-rw-r--r--src/lib/libcrypto/cpt_err.c30
-rw-r--r--src/lib/libcrypto/cryptlib.c218
-rw-r--r--src/lib/libcrypto/cryptlib.h4
-rw-r--r--src/lib/libcrypto/crypto-lib.com1284
-rw-r--r--src/lib/libcrypto/crypto.h5
-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/Makefile314
-rw-r--r--src/lib/libcrypto/des/Makefile.ssl316
-rw-r--r--src/lib/libcrypto/des/README54
-rw-r--r--src/lib/libcrypto/des/VERSION412
-rw-r--r--src/lib/libcrypto/des/asm/des-586.pl12
-rw-r--r--src/lib/libcrypto/des/asm/des686.pl230
-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.com1003
-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.c2
-rw-r--r--src/lib/libcrypto/des/des_locl.h2
-rw-r--r--src/lib/libcrypto/des/des_old.c271
-rw-r--r--src/lib/libcrypto/des/des_old.h441
-rw-r--r--src/lib/libcrypto/des/des_old2.c82
-rw-r--r--src/lib/libcrypto/des/des_opts.c604
-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.c948
-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.c139
-rw-r--r--src/lib/libcrypto/des/read_pwd.c521
-rw-r--r--src/lib/libcrypto/des/rpc_des.h131
-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/speed.c310
-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/Makefile131
-rw-r--r--src/lib/libcrypto/dh/Makefile.ssl133
-rw-r--r--src/lib/libcrypto/dh/dh.h17
-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/dh_check.c22
-rw-r--r--src/lib/libcrypto/dh/dh_err.c27
-rw-r--r--src/lib/libcrypto/dh/dh_key.c70
-rw-r--r--src/lib/libcrypto/dh/dhtest.c212
-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/EVP_DigestInit.pod6
-rw-r--r--src/lib/libcrypto/doc/EVP_EncryptInit.pod6
-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/Makefile173
-rw-r--r--src/lib/libcrypto/dsa/Makefile.ssl171
-rw-r--r--src/lib/libcrypto/dsa/README4
-rw-r--r--src/lib/libcrypto/dsa/dsa.h14
-rw-r--r--src/lib/libcrypto/dsa/dsa_err.c42
-rw-r--r--src/lib/libcrypto/dsa/dsa_key.c16
-rw-r--r--src/lib/libcrypto/dsa/dsa_ossl.c55
-rw-r--r--src/lib/libcrypto/dsa/dsa_sign.c6
-rw-r--r--src/lib/libcrypto/dsa/dsa_vrf.c3
-rw-r--r--src/lib/libcrypto/dsa/dsagen.c111
-rw-r--r--src/lib/libcrypto/dsa/dsatest.c242
-rw-r--r--src/lib/libcrypto/dsa/fips186a.txt122
-rw-r--r--src/lib/libcrypto/dso/Makefile140
-rw-r--r--src/lib/libcrypto/dso/Makefile.ssl142
-rw-r--r--src/lib/libcrypto/dso/README22
-rw-r--r--src/lib/libcrypto/dso/dso_dl.c284
-rw-r--r--src/lib/libcrypto/dso/dso_dlfcn.c42
-rw-r--r--src/lib/libcrypto/dso/dso_err.c96
-rw-r--r--src/lib/libcrypto/dso/dso_vms.c379
-rw-r--r--src/lib/libcrypto/dso/dso_win32.c279
-rw-r--r--src/lib/libcrypto/ebcdic.c218
-rw-r--r--src/lib/libcrypto/ebcdic.h19
-rw-r--r--src/lib/libcrypto/ec/Makefile126
-rw-r--r--src/lib/libcrypto/ec/Makefile.ssl128
-rw-r--r--src/lib/libcrypto/ec/ec_err.c124
-rw-r--r--src/lib/libcrypto/ec/ecp_recp.c133
-rw-r--r--src/lib/libcrypto/ec/ectest.c643
-rw-r--r--src/lib/libcrypto/engine/Makefile536
-rw-r--r--src/lib/libcrypto/engine/Makefile.ssl538
-rw-r--r--src/lib/libcrypto/engine/eng_cnf.c2
-rw-r--r--src/lib/libcrypto/engine/eng_err.c158
-rw-r--r--src/lib/libcrypto/engine/enginetest.c283
-rw-r--r--src/lib/libcrypto/engine/hw.ec8
-rw-r--r--src/lib/libcrypto/engine/hw_4758_cca.c969
-rw-r--r--src/lib/libcrypto/engine/hw_4758_cca_err.c149
-rw-r--r--src/lib/libcrypto/engine/hw_4758_cca_err.h93
-rw-r--r--src/lib/libcrypto/engine/hw_aep.c1119
-rw-r--r--src/lib/libcrypto/engine/hw_aep_err.c157
-rw-r--r--src/lib/libcrypto/engine/hw_aep_err.h101
-rw-r--r--src/lib/libcrypto/engine/hw_atalla.c594
-rw-r--r--src/lib/libcrypto/engine/hw_atalla_err.c145
-rw-r--r--src/lib/libcrypto/engine/hw_atalla_err.h89
-rw-r--r--src/lib/libcrypto/engine/hw_cryptodev.c1354
-rw-r--r--src/lib/libcrypto/engine/hw_cswift.c997
-rw-r--r--src/lib/libcrypto/engine/hw_cswift_err.c149
-rw-r--r--src/lib/libcrypto/engine/hw_cswift_err.h93
-rw-r--r--src/lib/libcrypto/engine/hw_ncipher.c1388
-rw-r--r--src/lib/libcrypto/engine/hw_ncipher_err.c157
-rw-r--r--src/lib/libcrypto/engine/hw_ncipher_err.h101
-rw-r--r--src/lib/libcrypto/engine/hw_nuron.c418
-rw-r--r--src/lib/libcrypto/engine/hw_nuron_err.c142
-rw-r--r--src/lib/libcrypto/engine/hw_nuron_err.h86
-rw-r--r--src/lib/libcrypto/engine/hw_sureware.c1039
-rw-r--r--src/lib/libcrypto/engine/hw_sureware_err.c150
-rw-r--r--src/lib/libcrypto/engine/hw_sureware_err.h94
-rw-r--r--src/lib/libcrypto/engine/hw_ubsec.c1060
-rw-r--r--src/lib/libcrypto/engine/hw_ubsec_err.c151
-rw-r--r--src/lib/libcrypto/engine/hw_ubsec_err.h95
-rw-r--r--src/lib/libcrypto/engine/tb_dsa.c2
-rw-r--r--src/lib/libcrypto/engine/vendor_defns/aep.h178
-rw-r--r--src/lib/libcrypto/engine/vendor_defns/atalla.h48
-rw-r--r--src/lib/libcrypto/engine/vendor_defns/cswift.h234
-rw-r--r--src/lib/libcrypto/engine/vendor_defns/hw_4758_cca.h149
-rw-r--r--src/lib/libcrypto/engine/vendor_defns/hw_ubsec.h100
-rw-r--r--src/lib/libcrypto/engine/vendor_defns/hwcryptohook.h486
-rw-r--r--src/lib/libcrypto/engine/vendor_defns/sureware.h239
-rw-r--r--src/lib/libcrypto/err/Makefile118
-rw-r--r--src/lib/libcrypto/err/Makefile.ssl119
-rw-r--r--src/lib/libcrypto/err/err.c6
-rw-r--r--src/lib/libcrypto/err/openssl.ec2
-rw-r--r--src/lib/libcrypto/evp/Makefile1076
-rw-r--r--src/lib/libcrypto/evp/Makefile.ssl1059
-rw-r--r--src/lib/libcrypto/evp/bio_enc.c2
-rw-r--r--src/lib/libcrypto/evp/bio_ok.c575
-rw-r--r--src/lib/libcrypto/evp/c_allc.c188
-rw-r--r--src/lib/libcrypto/evp/c_alld.c103
-rw-r--r--src/lib/libcrypto/evp/e_acss.c85
-rw-r--r--src/lib/libcrypto/evp/e_aes.c6
-rw-r--r--src/lib/libcrypto/evp/e_dsa.c71
-rw-r--r--src/lib/libcrypto/evp/e_rc5.c125
-rw-r--r--src/lib/libcrypto/evp/encode.c2
-rw-r--r--src/lib/libcrypto/evp/evp.h78
-rw-r--r--src/lib/libcrypto/evp/evp_acnf.c73
-rw-r--r--src/lib/libcrypto/evp/evp_err.c158
-rw-r--r--src/lib/libcrypto/evp/evp_key.c3
-rw-r--r--src/lib/libcrypto/evp/evp_test.c422
-rw-r--r--src/lib/libcrypto/evp/evptests.txt288
-rw-r--r--src/lib/libcrypto/evp/m_dss1.c9
-rw-r--r--src/lib/libcrypto/evp/m_md2.c97
-rw-r--r--src/lib/libcrypto/evp/m_mdc2.c97
-rw-r--r--src/lib/libcrypto/evp/m_sha.c96
-rw-r--r--src/lib/libcrypto/evp/m_sha1.c119
-rw-r--r--src/lib/libcrypto/evp/openbsd_hw.c446
-rw-r--r--src/lib/libcrypto/evp/p5_crpt2.c11
-rw-r--r--src/lib/libcrypto/hmac/Makefile99
-rw-r--r--src/lib/libcrypto/hmac/Makefile.ssl101
-rw-r--r--src/lib/libcrypto/hmac/hmac.c12
-rw-r--r--src/lib/libcrypto/hmac/hmac.h4
-rw-r--r--src/lib/libcrypto/hmac/hmactest.c175
-rw-r--r--src/lib/libcrypto/idea/Makefile92
-rw-r--r--src/lib/libcrypto/idea/Makefile.ssl91
-rw-r--r--src/lib/libcrypto/idea/ideatest.c232
-rw-r--r--src/lib/libcrypto/idea/version12
-rw-r--r--src/lib/libcrypto/install.com138
-rw-r--r--src/lib/libcrypto/krb5/Makefile88
-rw-r--r--src/lib/libcrypto/krb5/Makefile.ssl90
-rw-r--r--src/lib/libcrypto/lhash/Makefile91
-rw-r--r--src/lib/libcrypto/lhash/Makefile.ssl93
-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/md2/Makefile93
-rw-r--r--src/lib/libcrypto/md2/Makefile.ssl93
-rw-r--r--src/lib/libcrypto/md2/md2.c124
-rw-r--r--src/lib/libcrypto/md2/md2.h94
-rw-r--r--src/lib/libcrypto/md2/md2_dgst.c229
-rw-r--r--src/lib/libcrypto/md2/md2_one.c93
-rw-r--r--src/lib/libcrypto/md2/md2test.c139
-rw-r--r--src/lib/libcrypto/md4/Makefile92
-rw-r--r--src/lib/libcrypto/md4/Makefile.ssl91
-rw-r--r--src/lib/libcrypto/md4/md4.c127
-rw-r--r--src/lib/libcrypto/md4/md4_one.c3
-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/Makefile128
-rw-r--r--src/lib/libcrypto/md5/Makefile.ssl127
-rw-r--r--src/lib/libcrypto/md5/asm/md5-sparcv9.S1031
-rw-r--r--src/lib/libcrypto/md5/md5.c127
-rw-r--r--src/lib/libcrypto/md5/md5_one.c3
-rw-r--r--src/lib/libcrypto/md5/md5s.cpp78
-rw-r--r--src/lib/libcrypto/md5/md5test.c136
-rw-r--r--src/lib/libcrypto/mdc2/Makefile98
-rw-r--r--src/lib/libcrypto/mdc2/Makefile.ssl98
-rw-r--r--src/lib/libcrypto/mdc2/mdc2.h97
-rw-r--r--src/lib/libcrypto/mdc2/mdc2test.c146
-rw-r--r--src/lib/libcrypto/mem.c401
-rw-r--r--src/lib/libcrypto/o_str.h67
-rw-r--r--src/lib/libcrypto/objects/Makefile122
-rw-r--r--src/lib/libcrypto/objects/Makefile.ssl123
-rw-r--r--src/lib/libcrypto/objects/obj_err.c28
-rw-r--r--src/lib/libcrypto/objects/obj_mac.num16
-rw-r--r--src/lib/libcrypto/objects/objects.pl13
-rw-r--r--src/lib/libcrypto/objects/objects.txt20
-rw-r--r--src/lib/libcrypto/ocsp/Makefile291
-rw-r--r--src/lib/libcrypto/ocsp/Makefile.ssl293
-rw-r--r--src/lib/libcrypto/ocsp/ocsp_err.c104
-rw-r--r--src/lib/libcrypto/opensslconf.h.in158
-rw-r--r--src/lib/libcrypto/opensslv.h6
-rw-r--r--src/lib/libcrypto/pem/Makefile335
-rw-r--r--src/lib/libcrypto/pem/Makefile.ssl336
-rw-r--r--src/lib/libcrypto/pem/pem_err.c88
-rw-r--r--src/lib/libcrypto/perlasm/alpha.pl434
-rw-r--r--src/lib/libcrypto/perlasm/x86asm.pl10
-rw-r--r--src/lib/libcrypto/perlasm/x86ms.pl380
-rw-r--r--src/lib/libcrypto/perlasm/x86nasm.pl362
-rw-r--r--src/lib/libcrypto/perlasm/x86unix.pl628
-rw-r--r--src/lib/libcrypto/pkcs12/Makefile415
-rw-r--r--src/lib/libcrypto/pkcs12/Makefile.ssl417
-rw-r--r--src/lib/libcrypto/pkcs12/p12_add.c11
-rw-r--r--src/lib/libcrypto/pkcs12/p12_crt.c10
-rw-r--r--src/lib/libcrypto/pkcs12/p12_mutl.c6
-rw-r--r--src/lib/libcrypto/pkcs12/pk12err.c107
-rw-r--r--src/lib/libcrypto/pkcs12/pkcs12.h3
-rw-r--r--src/lib/libcrypto/pkcs7/Makefile241
-rw-r--r--src/lib/libcrypto/pkcs7/Makefile.ssl243
-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/pk7_mime.c24
-rw-r--r--src/lib/libcrypto/pkcs7/pk7_smime.c6
-rw-r--r--src/lib/libcrypto/pkcs7/pkcs7err.c146
-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/rand/Makefile196
-rw-r--r--src/lib/libcrypto/rand/Makefile.ssl196
-rw-r--r--src/lib/libcrypto/rand/md_rand.c581
-rw-r--r--src/lib/libcrypto/rand/rand_egd.c303
-rw-r--r--src/lib/libcrypto/rand/rand_err.c28
-rw-r--r--src/lib/libcrypto/rand/rand_lcl.h158
-rw-r--r--src/lib/libcrypto/rand/rand_lib.c26
-rw-r--r--src/lib/libcrypto/rand/rand_os2.c147
-rw-r--r--src/lib/libcrypto/rand/rand_unix.c281
-rw-r--r--src/lib/libcrypto/rand/rand_vms.c136
-rw-r--r--src/lib/libcrypto/rand/rand_win.c747
-rw-r--r--src/lib/libcrypto/rand/randfile.c6
-rw-r--r--src/lib/libcrypto/rand/randtest.c216
-rw-r--r--src/lib/libcrypto/rc2/Makefile92
-rw-r--r--src/lib/libcrypto/rc2/Makefile.ssl91
-rw-r--r--src/lib/libcrypto/rc2/rc2_skey.c1
-rw-r--r--src/lib/libcrypto/rc2/rc2speed.c274
-rw-r--r--src/lib/libcrypto/rc2/rc2test.c271
-rw-r--r--src/lib/libcrypto/rc2/tab.c86
-rw-r--r--src/lib/libcrypto/rc4/Makefile128
-rw-r--r--src/lib/libcrypto/rc4/Makefile.ssl110
-rwxr-xr-xsrc/lib/libcrypto/rc4/asm/rc4-amd64.pl227
-rw-r--r--src/lib/libcrypto/rc4/asm/rc4-ia64.S160
-rw-r--r--src/lib/libcrypto/rc4/rc4.c192
-rw-r--r--src/lib/libcrypto/rc4/rc4.h4
-rw-r--r--src/lib/libcrypto/rc4/rc4_enc.c4
-rw-r--r--src/lib/libcrypto/rc4/rc4_skey.c5
-rw-r--r--src/lib/libcrypto/rc4/rc4s.cpp73
-rw-r--r--src/lib/libcrypto/rc4/rc4speed.c250
-rw-r--r--src/lib/libcrypto/rc4/rc4test.c203
-rw-r--r--src/lib/libcrypto/rc4/rrc4.doc278
-rw-r--r--src/lib/libcrypto/rc5/Makefile110
-rw-r--r--src/lib/libcrypto/rc5/Makefile.ssl108
-rw-r--r--src/lib/libcrypto/rc5/rc5.h119
-rw-r--r--src/lib/libcrypto/rc5/rc5_locl.h207
-rw-r--r--src/lib/libcrypto/rc5/rc5s.cpp70
-rw-r--r--src/lib/libcrypto/rc5/rc5test.c386
-rw-r--r--src/lib/libcrypto/ripemd/Makefile111
-rw-r--r--src/lib/libcrypto/ripemd/Makefile.ssl108
-rw-r--r--src/lib/libcrypto/ripemd/README2
-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.c4
-rw-r--r--src/lib/libcrypto/ripemd/rmd_one.c3
-rw-r--r--src/lib/libcrypto/ripemd/rmdtest.c145
-rw-r--r--src/lib/libcrypto/rsa/Makefile269
-rw-r--r--src/lib/libcrypto/rsa/Makefile.ssl241
-rw-r--r--src/lib/libcrypto/rsa/rsa.h67
-rw-r--r--src/lib/libcrypto/rsa/rsa_eay.c247
-rw-r--r--src/lib/libcrypto/rsa/rsa_err.c135
-rw-r--r--src/lib/libcrypto/rsa/rsa_gen.c3
-rw-r--r--src/lib/libcrypto/rsa/rsa_null.c150
-rw-r--r--src/lib/libcrypto/rsa/rsa_oaep.c32
-rw-r--r--src/lib/libcrypto/rsa/rsa_test.c317
-rw-r--r--src/lib/libcrypto/sha/Makefile127
-rw-r--r--src/lib/libcrypto/sha/Makefile.ssl116
-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.c5
-rw-r--r--src/lib/libcrypto/sha/sha1s.cpp82
-rw-r--r--src/lib/libcrypto/sha/sha1test.c174
-rw-r--r--src/lib/libcrypto/sha/sha_dgst.c73
-rw-r--r--src/lib/libcrypto/sha/sha_one.c77
-rw-r--r--src/lib/libcrypto/sha/shatest.c174
-rw-r--r--src/lib/libcrypto/stack/Makefile86
-rw-r--r--src/lib/libcrypto/stack/Makefile.ssl88
-rw-r--r--src/lib/libcrypto/stack/safestack.h53
-rw-r--r--src/lib/libcrypto/symhacks.h275
-rw-r--r--src/lib/libcrypto/threads/README14
-rw-r--r--src/lib/libcrypto/threads/mttest.c1096
-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.com9
-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/tmdiff.c249
-rw-r--r--src/lib/libcrypto/tmdiff.h81
-rw-r--r--src/lib/libcrypto/txt_db/Makefile86
-rw-r--r--src/lib/libcrypto/txt_db/Makefile.ssl88
-rw-r--r--src/lib/libcrypto/ui/Makefile115
-rw-r--r--src/lib/libcrypto/ui/Makefile.ssl117
-rw-r--r--src/lib/libcrypto/ui/ui_compat.c67
-rw-r--r--src/lib/libcrypto/ui/ui_err.c48
-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/checkhash.pl222
-rw-r--r--src/lib/libcrypto/util/ck_errf.pl45
-rw-r--r--src/lib/libcrypto/util/clean-depend.pl54
-rw-r--r--src/lib/libcrypto/util/cygwin.sh127
-rw-r--r--src/lib/libcrypto/util/deleof.pl7
-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/domd34
-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/files.pl61
-rw-r--r--src/lib/libcrypto/util/fipslink.pl78
-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.num2869
-rw-r--r--src/lib/libcrypto/util/mk1mf.pl944
-rw-r--r--src/lib/libcrypto/util/mkcerts.sh220
-rw-r--r--src/lib/libcrypto/util/mkdef.pl1404
-rw-r--r--src/lib/libcrypto/util/mkdir-p.pl33
-rw-r--r--src/lib/libcrypto/util/mkerr.pl37
-rw-r--r--src/lib/libcrypto/util/mkfiles.pl125
-rw-r--r--src/lib/libcrypto/util/mklink.pl70
-rwxr-xr-xsrc/lib/libcrypto/util/opensslwrap.sh22
-rw-r--r--src/lib/libcrypto/util/perlpath.pl35
-rw-r--r--src/lib/libcrypto/util/pl/BC-16.pl151
-rw-r--r--src/lib/libcrypto/util/pl/BC-32.pl140
-rw-r--r--src/lib/libcrypto/util/pl/Mingw32.pl109
-rw-r--r--src/lib/libcrypto/util/pl/OS2-EMX.pl124
-rw-r--r--src/lib/libcrypto/util/pl/VC-16.pl177
-rw-r--r--src/lib/libcrypto/util/pl/VC-32-GMAKE.pl222
-rw-r--r--src/lib/libcrypto/util/pl/VC-32.pl145
-rw-r--r--src/lib/libcrypto/util/pl/VC-CE.pl116
-rw-r--r--src/lib/libcrypto/util/pl/linux.pl109
-rw-r--r--src/lib/libcrypto/util/pl/ultrix.pl43
-rw-r--r--src/lib/libcrypto/util/pl/unix.pl101
-rw-r--r--src/lib/libcrypto/util/pod2man.pl1183
-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.pl195
-rwxr-xr-xsrc/lib/libcrypto/util/shlib_wrap.sh70
-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.num217
-rw-r--r--src/lib/libcrypto/util/tab_num.pl17
-rw-r--r--src/lib/libcrypto/util/x86asm.sh42
-rw-r--r--src/lib/libcrypto/x509/Makefile592
-rw-r--r--src/lib/libcrypto/x509/Makefile.ssl594
-rw-r--r--src/lib/libcrypto/x509/by_dir.c15
-rw-r--r--src/lib/libcrypto/x509/x509_err.c138
-rw-r--r--src/lib/libcrypto/x509/x509_vfy.c2
-rw-r--r--src/lib/libcrypto/x509v3/Makefile645
-rw-r--r--src/lib/libcrypto/x509v3/Makefile.ssl603
-rw-r--r--src/lib/libcrypto/x509v3/tabtest.c88
-rw-r--r--src/lib/libcrypto/x509v3/v3_cpols.c9
-rw-r--r--src/lib/libcrypto/x509v3/v3_utl.c2
-rw-r--r--src/lib/libcrypto/x509v3/v3conf.c127
-rw-r--r--src/lib/libcrypto/x509v3/v3err.c210
-rw-r--r--src/lib/libcrypto/x509v3/v3prin.c99
542 files changed, 101795 insertions, 2694 deletions
diff --git a/src/lib/libcrypto/Makefile.ssl b/src/lib/libcrypto/Makefile.ssl
new file mode 100644
index 0000000000..b9951a4600
--- /dev/null
+++ b/src/lib/libcrypto/Makefile.ssl
@@ -0,0 +1,218 @@
1#
2# SSLeay/crypto/Makefile
3#
4
5DIR= crypto
6TOP= ..
7CC= cc
8INCLUDE= -I. -I$(TOP) -I../include
9INCLUDES= -I.. -I../.. -I../../include
10CFLAG= -g
11INSTALL_PREFIX=
12OPENSSLDIR= /usr/local/ssl
13INSTALLTOP= /usr/local/ssl
14MAKE= make -f Makefile.ssl
15MAKEDEPPROG= makedepend
16MAKEDEPEND= $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG)
17MAKEFILE= Makefile.ssl
18RM= rm -f
19AR= ar r
20
21PEX_LIBS=
22EX_LIBS=
23
24CFLAGS= $(INCLUDE) $(CFLAG)
25
26
27LIBS=
28
29SDIRS= md2 md5 sha mdc2 hmac ripemd \
30 des rc2 rc4 rc5 idea bf cast \
31 bn ec rsa dsa dh dso engine aes \
32 buffer bio stack lhash rand err objects \
33 evp asn1 pem x509 x509v3 conf txt_db pkcs7 pkcs12 comp ocsp ui krb5
34
35GENERAL=Makefile README crypto-lib.com install.com
36
37LIB= $(TOP)/libcrypto.a
38SHARED_LIB= libcrypto$(SHLIB_EXT)
39LIBSRC= cryptlib.c mem.c mem_clr.c mem_dbg.c cversion.c ex_data.c tmdiff.c cpt_err.c ebcdic.c uid.c o_time.c
40LIBOBJ= cryptlib.o mem.o mem_clr.o mem_dbg.o cversion.o ex_data.o tmdiff.o cpt_err.o ebcdic.o uid.o o_time.o
41
42SRC= $(LIBSRC)
43
44EXHEADER= crypto.h tmdiff.h opensslv.h opensslconf.h ebcdic.h symhacks.h \
45 ossl_typ.h
46HEADER= cryptlib.h buildinf.h md32_common.h o_time.h $(EXHEADER)
47
48ALL= $(GENERAL) $(SRC) $(HEADER)
49
50top:
51 @(cd ..; $(MAKE) DIRS=$(DIR) all)
52
53all: shared
54
55buildinf.h: ../Makefile.ssl
56 ( echo "#ifndef MK1MF_BUILD"; \
57 echo ' /* auto-generated by crypto/Makefile.ssl 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
63testapps:
64 if echo ${SDIRS} | fgrep ' des '; \
65 then cd des && $(MAKE) CC='$(CC)' INCLUDES='${INCLUDES}' CFLAG='${CFLAG}' INSTALLTOP='${INSTALLTOP}' PEX_LIBS='${PEX_LIBS}' EX_LIBS='${EX_LIBS}' BN_ASM='${BN_ASM}' DES_ENC='${DES_ENC}' SHA1_ASM_OBJ='${SHA1_ASM_OBJ}' MD5_ASM_OBJ='${MD5_ASM_OBJ}' RMD160_ASM_OBJ='${RMD160_ASM_OBJ}' BF_ENC='${BF_ENC}' CAST_ENC='${CAST_ENC}' RC4_ENC='${RC4_ENC}' RC5_ENC='${RC5_ENC}' AR='${AR}' PROCESSOR='${PROCESSOR}' PERL='${PERL}' RANLIB='${RANLIB}' des; fi
66 cd pkcs7 && $(MAKE) CC='$(CC)' INCLUDES='${INCLUDES}' CFLAG='${CFLAG}' INSTALLTOP='${INSTALLTOP}' PEX_LIBS='${PEX_LIBS}' EX_LIBS='${EX_LIBS}' BN_ASM='${BN_ASM}' DES_ENC='${DES_ENC}' SHA1_ASM_OBJ='${SHA1_ASM_OBJ}' MD5_ASM_OBJ='${MD5_ASM_OBJ}' RMD160_ASM_OBJ='${RMD160_ASM_OBJ}' BF_ENC='${BF_ENC}' CAST_ENC='${CAST_ENC}' RC4_ENC='${RC4_ENC}' RC5_ENC='${RC5_ENC}' AR='${AR}' PROCESSOR='${PROCESSOR}' PERL='${PERL}' RANLIB='${RANLIB}' testapps
67
68subdirs:
69 @for i in $(SDIRS) ;\
70 do \
71 (cd $$i && echo "making all in crypto/$$i..." && \
72 $(MAKE) CC='$(CC)' INCLUDES='${INCLUDES}' CFLAG='${CFLAG}' INSTALLTOP='${INSTALLTOP}' PEX_LIBS='${PEX_LIBS}' EX_LIBS='${EX_LIBS}' BN_ASM='${BN_ASM}' DES_ENC='${DES_ENC}' SHA1_ASM_OBJ='${SHA1_ASM_OBJ}' MD5_ASM_OBJ='${MD5_ASM_OBJ}' RMD160_ASM_OBJ='${RMD160_ASM_OBJ}' BF_ENC='${BF_ENC}' CAST_ENC='${CAST_ENC}' RC4_ENC='${RC4_ENC}' RC5_ENC='${RC5_ENC}' AR='${AR}' PROCESSOR='${PROCESSOR}' PERL='${PERL}' RANLIB='${RANLIB}' all ) || exit 1; \
73 done;
74
75files:
76 $(PERL) $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO
77 @for i in $(SDIRS) ;\
78 do \
79 (cd $$i && echo "making 'files' in crypto/$$i..." && \
80 $(MAKE) PERL='${PERL}' files ); \
81 done;
82
83links:
84 @sh $(TOP)/util/point.sh Makefile.ssl Makefile
85 @$(PERL) $(TOP)/util/mklink.pl ../include/openssl $(EXHEADER)
86 @$(PERL) $(TOP)/util/mklink.pl ../test $(TEST)
87 @$(PERL) $(TOP)/util/mklink.pl ../apps $(APPS)
88 @sh $(TOP)/util/point.sh Makefile.ssl Makefile
89 @for i in $(SDIRS); do \
90 (cd $$i && echo "making links in crypto/$$i..." && \
91 $(MAKE) CC='$(CC)' INCLUDES='${INCLUDES}' CFLAG='${CFLAG}' INSTALLTOP='${INSTALLTOP}' PEX_LIBS='${PEX_LIBS}' EX_LIBS='${EX_LIBS}' BN_ASM='${BN_ASM}' DES_ENC='${DES_ENC}' SHA1_ASM_OBJ='${SHA1_ASM_OBJ}' MD5_ASM_OBJ='${MD5_ASM_OBJ}' RMD160_ASM_OBJ='${RMD160_ASM_OBJ}' BF_ENC='${BF_ENC}' CAST_ENC='${CAST_ENC}' RC4_ENC='${RC4_ENC}' RC5_ENC='${RC5_ENC}' AR='${AR}' PERL='${PERL}' links ); \
92 done;
93
94lib: $(LIBOBJ)
95 $(AR) $(LIB) $(LIBOBJ)
96 $(RANLIB) $(LIB) || echo Never mind.
97 @touch lib
98
99shared: buildinf.h lib subdirs
100 if [ -n "$(SHARED_LIBS)" ]; then \
101 (cd ..; $(MAKE) $(SHARED_LIB)); \
102 fi
103
104libs:
105 @for i in $(SDIRS) ;\
106 do \
107 (cd $$i && echo "making libs in crypto/$$i..." && \
108 $(MAKE) CC='$(CC)' CFLAG='${CFLAG}' INSTALL_PREFIX='${INSTALL_PREFIX}' INSTALLTOP='${INSTALLTOP}' PEX_LIBS='${PEX_LIBS}' EX_LIBS='${EX_LIBS}' AR='${AR}' lib ); \
109 done;
110
111tests:
112 @for i in $(SDIRS) ;\
113 do \
114 (cd $$i && echo "making tests in crypto/$$i..." && \
115 $(MAKE) CC='$(CC)' CFLAG='${CFLAG}' INSTALLTOP='${INSTALLTOP}' PEX_LIBS='${PEX_LIBS}' EX_LIBS='${EX_LIBS}' AR='${AR}' tests ); \
116 done;
117
118install:
119 @for i in $(EXHEADER) ;\
120 do \
121 (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
122 chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
123 done;
124 @for i in $(SDIRS) ;\
125 do \
126 (cd $$i && echo "making install in crypto/$$i..." && \
127 $(MAKE) CC='$(CC)' CFLAG='${CFLAG}' INSTALL_PREFIX='${INSTALL_PREFIX}' INSTALLTOP='${INSTALLTOP}' PEX_LIBS='${PEX_LIBS}' EX_LIBS='${EX_LIBS}' install ); \
128 done;
129
130lint:
131 @for i in $(SDIRS) ;\
132 do \
133 (cd $$i && echo "making lint in crypto/$$i..." && \
134 $(MAKE) CC='$(CC)' CFLAG='${CFLAG}' INSTALLTOP='${INSTALLTOP}' PEX_LIBS='${PEX_LIBS}' EX_LIBS='${EX_LIBS}' lint ); \
135 done;
136
137depend:
138 if [ ! -f buildinf.h ]; then touch buildinf.h; fi # fake buildinf.h if it does not exist
139 $(MAKEDEPEND) -- $(CFLAG) $(INCLUDE) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
140 if [ ! -s buildinf.h ]; then rm buildinf.h; fi
141 @for i in $(SDIRS) ;\
142 do \
143 (cd $$i && echo "making depend in crypto/$$i..." && \
144 $(MAKE) MAKEFILE='${MAKEFILE}' INCLUDES='${INCLUDES}' CFLAG='${CFLAG}' DEPFLAG='${DEPFLAG}' MAKEDEPPROG='${MAKEDEPPROG}' KRB5_INCLUDES='${KRB5_INCLUDES}' PERL='${PERL}' depend ); \
145 done;
146
147clean:
148 rm -f buildinf.h *.o */*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
149 @for i in $(SDIRS) ;\
150 do \
151 (cd $$i && echo "making clean in crypto/$$i..." && \
152 $(MAKE) CC='$(CC)' CFLAG='${CFLAG}' INSTALLTOP='${INSTALLTOP}' PEX_LIBS='${PEX_LIBS}' EX_LIBS='${EX_LIBS}' clean ); \
153 done;
154
155dclean:
156 $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
157 mv -f Makefile.new $(MAKEFILE)
158 @for i in $(SDIRS) ;\
159 do \
160 (cd $$i && echo "making dclean in crypto/$$i..." && \
161 $(MAKE) PERL='${PERL}' CC='$(CC)' CFLAG='${CFLAG}' INSTALLTOP='${INSTALLTOP}' PEX_LIBS='${PEX_LIBS}' EX_LIBS='${EX_LIBS}' dclean ); \
162 done;
163
164# DO NOT DELETE THIS LINE -- make depend depends on it.
165
166cpt_err.o: ../include/openssl/bio.h ../include/openssl/crypto.h
167cpt_err.o: ../include/openssl/e_os2.h ../include/openssl/err.h
168cpt_err.o: ../include/openssl/lhash.h ../include/openssl/opensslconf.h
169cpt_err.o: ../include/openssl/opensslv.h ../include/openssl/safestack.h
170cpt_err.o: ../include/openssl/stack.h ../include/openssl/symhacks.h cpt_err.c
171cryptlib.o: ../e_os.h ../include/openssl/bio.h ../include/openssl/buffer.h
172cryptlib.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
173cryptlib.o: ../include/openssl/err.h ../include/openssl/lhash.h
174cryptlib.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
175cryptlib.o: ../include/openssl/safestack.h ../include/openssl/stack.h
176cryptlib.o: ../include/openssl/symhacks.h cryptlib.c cryptlib.h
177cversion.o: ../e_os.h ../include/openssl/bio.h ../include/openssl/buffer.h
178cversion.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
179cversion.o: ../include/openssl/err.h ../include/openssl/lhash.h
180cversion.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
181cversion.o: ../include/openssl/safestack.h ../include/openssl/stack.h
182cversion.o: ../include/openssl/symhacks.h buildinf.h cryptlib.h cversion.c
183ebcdic.o: ../include/openssl/e_os2.h ../include/openssl/opensslconf.h ebcdic.c
184ex_data.o: ../e_os.h ../include/openssl/bio.h ../include/openssl/buffer.h
185ex_data.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
186ex_data.o: ../include/openssl/err.h ../include/openssl/lhash.h
187ex_data.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
188ex_data.o: ../include/openssl/safestack.h ../include/openssl/stack.h
189ex_data.o: ../include/openssl/symhacks.h cryptlib.h ex_data.c
190mem.o: ../e_os.h ../include/openssl/bio.h ../include/openssl/buffer.h
191mem.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
192mem.o: ../include/openssl/err.h ../include/openssl/lhash.h
193mem.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
194mem.o: ../include/openssl/safestack.h ../include/openssl/stack.h
195mem.o: ../include/openssl/symhacks.h cryptlib.h mem.c
196mem_clr.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
197mem_clr.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
198mem_clr.o: ../include/openssl/safestack.h ../include/openssl/stack.h
199mem_clr.o: ../include/openssl/symhacks.h mem_clr.c
200mem_dbg.o: ../e_os.h ../include/openssl/bio.h ../include/openssl/buffer.h
201mem_dbg.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
202mem_dbg.o: ../include/openssl/err.h ../include/openssl/lhash.h
203mem_dbg.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
204mem_dbg.o: ../include/openssl/safestack.h ../include/openssl/stack.h
205mem_dbg.o: ../include/openssl/symhacks.h cryptlib.h mem_dbg.c
206o_time.o: ../include/openssl/e_os2.h ../include/openssl/opensslconf.h o_time.c
207o_time.o: o_time.h
208tmdiff.o: ../e_os.h ../include/openssl/bio.h ../include/openssl/buffer.h
209tmdiff.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
210tmdiff.o: ../include/openssl/err.h ../include/openssl/lhash.h
211tmdiff.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
212tmdiff.o: ../include/openssl/safestack.h ../include/openssl/stack.h
213tmdiff.o: ../include/openssl/symhacks.h ../include/openssl/tmdiff.h cryptlib.h
214tmdiff.o: tmdiff.c
215uid.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
216uid.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
217uid.o: ../include/openssl/safestack.h ../include/openssl/stack.h
218uid.o: ../include/openssl/symhacks.h uid.c
diff --git a/src/lib/libcrypto/acss/acss.h b/src/lib/libcrypto/acss/acss.h
new file mode 100644
index 0000000000..c2d3550796
--- /dev/null
+++ b/src/lib/libcrypto/acss/acss.h
@@ -0,0 +1,47 @@
1/* $OpenBSD: acss.h,v 1.4 2005/04/25 13:20:52 miod Exp $ */
2/*
3 * Copyright (c) 2004 The OpenBSD project
4 *
5 * Permission to use, copy, modify, and distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
8 *
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 */
17
18#ifndef _ACSS_H_
19#define _ACSS_H_
20
21#ifdef OPENSSL_NO_ACSS
22#error acss is disabled.
23#endif
24
25/* 40bit key */
26#define ACSS_KEYSIZE 5
27
28/* modes of acss */
29#define ACSS_MODE0 0
30#define ACSS_MODE1 1
31#define ACSS_MODE2 2
32#define ACSS_MODE3 3
33
34typedef struct acss_key_st {
35 unsigned int lfsr17; /* current state of lfsrs */
36 unsigned int lfsr25;
37 unsigned int lfsrsum;
38 unsigned char seed[ACSS_KEYSIZE];
39 unsigned char data[ACSS_KEYSIZE];
40 int encrypt;
41 int mode;
42} ACSS_KEY;
43
44void acss_setkey(ACSS_KEY *, const unsigned char *, int, int);
45void acss(ACSS_KEY *, unsigned long, const unsigned char *, unsigned char *);
46
47#endif /* ifndef _ACSS_H_ */
diff --git a/src/lib/libcrypto/acss/acss_enc.c b/src/lib/libcrypto/acss/acss_enc.c
new file mode 100644
index 0000000000..829830bc54
--- /dev/null
+++ b/src/lib/libcrypto/acss/acss_enc.c
@@ -0,0 +1,177 @@
1/* $OpenBSD: acss_enc.c,v 1.4 2004/02/13 10:05:44 hshoexer Exp $ */
2/*
3 * Copyright (c) 2004 The OpenBSD project
4 *
5 * Permission to use, copy, modify, and distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
8 *
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 */
17
18#include <openssl/acss.h>
19
20/* decryption sbox */
21static unsigned char sboxdec[] = {
22 0x33, 0x73, 0x3b, 0x26, 0x63, 0x23, 0x6b, 0x76,
23 0x3e, 0x7e, 0x36, 0x2b, 0x6e, 0x2e, 0x66, 0x7b,
24 0xd3, 0x93, 0xdb, 0x06, 0x43, 0x03, 0x4b, 0x96,
25 0xde, 0x9e, 0xd6, 0x0b, 0x4e, 0x0e, 0x46, 0x9b,
26 0x57, 0x17, 0x5f, 0x82, 0xc7, 0x87, 0xcf, 0x12,
27 0x5a, 0x1a, 0x52, 0x8f, 0xca, 0x8a, 0xc2, 0x1f,
28 0xd9, 0x99, 0xd1, 0x00, 0x49, 0x09, 0x41, 0x90,
29 0xd8, 0x98, 0xd0, 0x01, 0x48, 0x08, 0x40, 0x91,
30 0x3d, 0x7d, 0x35, 0x24, 0x6d, 0x2d, 0x65, 0x74,
31 0x3c, 0x7c, 0x34, 0x25, 0x6c, 0x2c, 0x64, 0x75,
32 0xdd, 0x9d, 0xd5, 0x04, 0x4d, 0x0d, 0x45, 0x94,
33 0xdc, 0x9c, 0xd4, 0x05, 0x4c, 0x0c, 0x44, 0x95,
34 0x59, 0x19, 0x51, 0x80, 0xc9, 0x89, 0xc1, 0x10,
35 0x58, 0x18, 0x50, 0x81, 0xc8, 0x88, 0xc0, 0x11,
36 0xd7, 0x97, 0xdf, 0x02, 0x47, 0x07, 0x4f, 0x92,
37 0xda, 0x9a, 0xd2, 0x0f, 0x4a, 0x0a, 0x42, 0x9f,
38 0x53, 0x13, 0x5b, 0x86, 0xc3, 0x83, 0xcb, 0x16,
39 0x5e, 0x1e, 0x56, 0x8b, 0xce, 0x8e, 0xc6, 0x1b,
40 0xb3, 0xf3, 0xbb, 0xa6, 0xe3, 0xa3, 0xeb, 0xf6,
41 0xbe, 0xfe, 0xb6, 0xab, 0xee, 0xae, 0xe6, 0xfb,
42 0x37, 0x77, 0x3f, 0x22, 0x67, 0x27, 0x6f, 0x72,
43 0x3a, 0x7a, 0x32, 0x2f, 0x6a, 0x2a, 0x62, 0x7f,
44 0xb9, 0xf9, 0xb1, 0xa0, 0xe9, 0xa9, 0xe1, 0xf0,
45 0xb8, 0xf8, 0xb0, 0xa1, 0xe8, 0xa8, 0xe0, 0xf1,
46 0x5d, 0x1d, 0x55, 0x84, 0xcd, 0x8d, 0xc5, 0x14,
47 0x5c, 0x1c, 0x54, 0x85, 0xcc, 0x8c, 0xc4, 0x15,
48 0xbd, 0xfd, 0xb5, 0xa4, 0xed, 0xad, 0xe5, 0xf4,
49 0xbc, 0xfc, 0xb4, 0xa5, 0xec, 0xac, 0xe4, 0xf5,
50 0x39, 0x79, 0x31, 0x20, 0x69, 0x29, 0x61, 0x70,
51 0x38, 0x78, 0x30, 0x21, 0x68, 0x28, 0x60, 0x71,
52 0xb7, 0xf7, 0xbf, 0xa2, 0xe7, 0xa7, 0xef, 0xf2,
53 0xba, 0xfa, 0xb2, 0xaf, 0xea, 0xaa, 0xe2, 0xff
54};
55
56/* encryption sbox */
57static unsigned char sboxenc[] = {
58 0x33, 0x3b, 0x73, 0x15, 0x53, 0x5b, 0x13, 0x75,
59 0x3d, 0x35, 0x7d, 0x1b, 0x5d, 0x55, 0x1d, 0x7b,
60 0x67, 0x6f, 0x27, 0x81, 0xc7, 0xcf, 0x87, 0x21,
61 0x69, 0x61, 0x29, 0x8f, 0xc9, 0xc1, 0x89, 0x2f,
62 0xe3, 0xeb, 0xa3, 0x05, 0x43, 0x4b, 0x03, 0xa5,
63 0xed, 0xe5, 0xad, 0x0b, 0x4d, 0x45, 0x0d, 0xab,
64 0xea, 0xe2, 0xaa, 0x00, 0x4a, 0x42, 0x0a, 0xa0,
65 0xe8, 0xe0, 0xa8, 0x02, 0x48, 0x40, 0x08, 0xa2,
66 0x3e, 0x36, 0x7e, 0x14, 0x5e, 0x56, 0x1e, 0x74,
67 0x3c, 0x34, 0x7c, 0x16, 0x5c, 0x54, 0x1c, 0x76,
68 0x6a, 0x62, 0x2a, 0x80, 0xca, 0xc2, 0x8a, 0x20,
69 0x68, 0x60, 0x28, 0x82, 0xc8, 0xc0, 0x88, 0x22,
70 0xee, 0xe6, 0xae, 0x04, 0x4e, 0x46, 0x0e, 0xa4,
71 0xec, 0xe4, 0xac, 0x06, 0x4c, 0x44, 0x0c, 0xa6,
72 0xe7, 0xef, 0xa7, 0x01, 0x47, 0x4f, 0x07, 0xa1,
73 0xe9, 0xe1, 0xa9, 0x0f, 0x49, 0x41, 0x09, 0xaf,
74 0x63, 0x6b, 0x23, 0x85, 0xc3, 0xcb, 0x83, 0x25,
75 0x6d, 0x65, 0x2d, 0x8b, 0xcd, 0xc5, 0x8d, 0x2b,
76 0x37, 0x3f, 0x77, 0x11, 0x57, 0x5f, 0x17, 0x71,
77 0x39, 0x31, 0x79, 0x1f, 0x59, 0x51, 0x19, 0x7f,
78 0xb3, 0xbb, 0xf3, 0x95, 0xd3, 0xdb, 0x93, 0xf5,
79 0xbd, 0xb5, 0xfd, 0x9b, 0xdd, 0xd5, 0x9d, 0xfb,
80 0xba, 0xb2, 0xfa, 0x90, 0xda, 0xd2, 0x9a, 0xf0,
81 0xb8, 0xb0, 0xf8, 0x92, 0xd8, 0xd0, 0x98, 0xf2,
82 0x6e, 0x66, 0x2e, 0x84, 0xce, 0xc6, 0x8e, 0x24,
83 0x6c, 0x64, 0x2c, 0x86, 0xcc, 0xc4, 0x8c, 0x26,
84 0x3a, 0x32, 0x7a, 0x10, 0x5a, 0x52, 0x1a, 0x70,
85 0x38, 0x30, 0x78, 0x12, 0x58, 0x50, 0x18, 0x72,
86 0xbe, 0xb6, 0xfe, 0x94, 0xde, 0xd6, 0x9e, 0xf4,
87 0xbc, 0xb4, 0xfc, 0x96, 0xdc, 0xd4, 0x9c, 0xf6,
88 0xb7, 0xbf, 0xf7, 0x91, 0xd7, 0xdf, 0x97, 0xf1,
89 0xb9, 0xb1, 0xf9, 0x9f, 0xd9, 0xd1, 0x99, 0xff
90};
91
92/*
93 * Two linear feedback shift registers are used:
94 *
95 * lfsr17: polynomial of degree 17, primitive modulo 2 (listed in Schneier)
96 * x^15 + x + 1
97 * lfsr25: polynomial of degree 25, not know if primitive modulo 2
98 * x^13 + x^5 + x^4 + x + 1
99 *
100 * Output bits are discarded, instead the feedback bits are added to produce
101 * the cipher stream. Depending on the mode, feedback bytes may be inverted
102 * bit-wise before addition.
103 *
104 * The lfsrs are seeded with bytes from the raw key:
105 *
106 * lfsr17: byte 0[0:7] at bit 9
107 * byte 1[0:7] at bit 0
108 *
109 * lfsr25: byte 2[0:4] at bit 16
110 * byte 2[5:7] at bit 22
111 * byte 3[0:7] at bit 8
112 * byte 4[0:7] at bit 0
113 *
114 * To prevent 0 cycles, 1's are inject at bit 8 in lfrs17 and bit 21 in
115 * lfsr25.
116 *
117 */
118
119void
120acss(ACSS_KEY *key, unsigned long len, const unsigned char *in,
121 unsigned char *out)
122{
123 unsigned long i;
124 unsigned long lfsr17tmp, lfsr25tmp, lfsrsumtmp;
125
126 lfsrsumtmp = lfsr17tmp = lfsr25tmp = 0;
127
128 /* keystream is sum of lfsrs */
129 for (i = 0; i < len; i++) {
130 lfsr17tmp = key->lfsr17 ^ (key->lfsr17 >> 14);
131 key->lfsr17 = (key->lfsr17 >> 8)
132 ^ (lfsr17tmp << 9)
133 ^ (lfsr17tmp << 12)
134 ^ (lfsr17tmp << 15);
135 key->lfsr17 &= 0x1ffff; /* 17 bit LFSR */
136
137 lfsr25tmp = key->lfsr25
138 ^ (key->lfsr25 >> 3)
139 ^ (key->lfsr25 >> 4)
140 ^ (key->lfsr25 >> 12);
141 key->lfsr25 = (key->lfsr25 >> 8) ^ (lfsr25tmp << 17);
142 key->lfsr25 &= 0x1ffffff; /* 25 bit LFSR */
143
144 lfsrsumtmp = key->lfsrsum;
145
146 /* addition */
147 switch (key->mode) {
148 case ACSS_MODE3:
149 key->lfsrsum = 0xff & ~(key->lfsr17 >> 9);
150 key->lfsrsum += 0xff & ~(key->lfsr25 >> 17);
151 break;
152 case ACSS_MODE2:
153 key->lfsrsum = key->lfsr17 >> 9;
154 key->lfsrsum += 0xff & ~(key->lfsr25 >> 17);
155 break;
156 case ACSS_MODE1:
157 key->lfsrsum = 0xff & ~(key->lfsr17 >> 9);
158 key->lfsrsum += key->lfsr25 >> 17;
159 break;
160 case ACSS_MODE0:
161 default:
162 key->lfsrsum = key->lfsr17 >> 9;
163 key->lfsrsum += key->lfsr25 >> 17;
164 break;
165 }
166 key->lfsrsum += (lfsrsumtmp >> 8);
167
168 if (in == (unsigned char *)0)
169 /* generate only a keystream */
170 out[i] = key->lfsrsum & 0xff;
171 else if (key->encrypt) {
172 out[i] = sboxenc[(in[i] ^ key->lfsrsum) & 0xff];
173 } else {
174 out[i] = (sboxdec[in[i]] ^ key->lfsrsum) & 0xff;
175 }
176 }
177}
diff --git a/src/lib/libcrypto/acss/acss_skey.c b/src/lib/libcrypto/acss/acss_skey.c
new file mode 100644
index 0000000000..08e5685fcf
--- /dev/null
+++ b/src/lib/libcrypto/acss/acss_skey.c
@@ -0,0 +1,86 @@
1/* $OpenBSD: acss_skey.c,v 1.2 2004/01/23 19:23:33 hshoexer Exp $ */
2/*
3 * Copyright (c) 2004 The OpenBSD project
4 *
5 * Permission to use, copy, modify, and distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
8 *
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 */
17
18#include <openssl/acss.h>
19
20static unsigned char reverse[] = {
21 0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0,
22 0x10, 0x90, 0x50, 0xd0, 0x30, 0xb0, 0x70, 0xf0,
23 0x08, 0x88, 0x48, 0xc8, 0x28, 0xa8, 0x68, 0xe8,
24 0x18, 0x98, 0x58, 0xd8, 0x38, 0xb8, 0x78, 0xf8,
25 0x04, 0x84, 0x44, 0xc4, 0x24, 0xa4, 0x64, 0xe4,
26 0x14, 0x94, 0x54, 0xd4, 0x34, 0xb4, 0x74, 0xf4,
27 0x0c, 0x8c, 0x4c, 0xcc, 0x2c, 0xac, 0x6c, 0xec,
28 0x1c, 0x9c, 0x5c, 0xdc, 0x3c, 0xbc, 0x7c, 0xfc,
29 0x02, 0x82, 0x42, 0xc2, 0x22, 0xa2, 0x62, 0xe2,
30 0x12, 0x92, 0x52, 0xd2, 0x32, 0xb2, 0x72, 0xf2,
31 0x0a, 0x8a, 0x4a, 0xca, 0x2a, 0xaa, 0x6a, 0xea,
32 0x1a, 0x9a, 0x5a, 0xda, 0x3a, 0xba, 0x7a, 0xfa,
33 0x06, 0x86, 0x46, 0xc6, 0x26, 0xa6, 0x66, 0xe6,
34 0x16, 0x96, 0x56, 0xd6, 0x36, 0xb6, 0x76, 0xf6,
35 0x0e, 0x8e, 0x4e, 0xce, 0x2e, 0xae, 0x6e, 0xee,
36 0x1e, 0x9e, 0x5e, 0xde, 0x3e, 0xbe, 0x7e, 0xfe,
37 0x01, 0x81, 0x41, 0xc1, 0x21, 0xa1, 0x61, 0xe1,
38 0x11, 0x91, 0x51, 0xd1, 0x31, 0xb1, 0x71, 0xf1,
39 0x09, 0x89, 0x49, 0xc9, 0x29, 0xa9, 0x69, 0xe9,
40 0x19, 0x99, 0x59, 0xd9, 0x39, 0xb9, 0x79, 0xf9,
41 0x05, 0x85, 0x45, 0xc5, 0x25, 0xa5, 0x65, 0xe5,
42 0x15, 0x95, 0x55, 0xd5, 0x35, 0xb5, 0x75, 0xf5,
43 0x0d, 0x8d, 0x4d, 0xcd, 0x2d, 0xad, 0x6d, 0xed,
44 0x1d, 0x9d, 0x5d, 0xdd, 0x3d, 0xbd, 0x7d, 0xfd,
45 0x03, 0x83, 0x43, 0xc3, 0x23, 0xa3, 0x63, 0xe3,
46 0x13, 0x93, 0x53, 0xd3, 0x33, 0xb3, 0x73, 0xf3,
47 0x0b, 0x8b, 0x4b, 0xcb, 0x2b, 0xab, 0x6b, 0xeb,
48 0x1b, 0x9b, 0x5b, 0xdb, 0x3b, 0xbb, 0x7b, 0xfb,
49 0x07, 0x87, 0x47, 0xc7, 0x27, 0xa7, 0x67, 0xe7,
50 0x17, 0x97, 0x57, 0xd7, 0x37, 0xb7, 0x77, 0xf7,
51 0x0f, 0x8f, 0x4f, 0xcf, 0x2f, 0xaf, 0x6f, 0xef,
52 0x1f, 0x9f, 0x5f, 0xdf, 0x3f, 0xbf, 0x7f, 0xff
53};
54
55static void
56acss_seed(ACSS_KEY *key)
57{
58 int i;
59
60 for (i = 0; i < ACSS_KEYSIZE; i++)
61 key->seed[i] = reverse[key->data[i]];
62
63 /* seed lfsrs */
64 key->lfsr17 = key->seed[1]
65 | (key->seed[0] << 9)
66 | (1 << 8); /* inject 1 at bit 9 */
67 key->lfsr25 = key->seed[4]
68 | (key->seed[3] << 8)
69 | ((key->seed[2] & 0x1f) << 16)
70 | ((key->seed[2] & 0xe0) << 17)
71 | (1 << 21); /* inject 1 at bit 22 */
72
73 key->lfsrsum = 0;
74}
75
76void
77acss_setkey(ACSS_KEY *key, const unsigned char *data, int enc, int mode)
78{
79 memcpy(key->data, data, sizeof(key->data));
80
81 if (enc != -1)
82 key->encrypt = enc;
83 key->mode = mode;
84
85 acss_seed(key);
86}
diff --git a/src/lib/libcrypto/aes/Makefile b/src/lib/libcrypto/aes/Makefile
new file mode 100644
index 0000000000..a37c6f66a2
--- /dev/null
+++ b/src/lib/libcrypto/aes/Makefile
@@ -0,0 +1,103 @@
1#
2# crypto/aes/Makefile
3#
4
5DIR= aes
6TOP= ../..
7CC= cc
8CPP= $(CC) -E
9INCLUDES=
10CFLAG=-g
11INSTALL_PREFIX=
12OPENSSLDIR= /usr/local/ssl
13INSTALLTOP= /usr/local/ssl
14MAKEDEPPROG= makedepend
15MAKEDEPEND= $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG)
16MAKEFILE= Makefile
17AR= ar r
18
19# CFLAGS= -mpentiumpro $(INCLUDES) $(CFLAG) -O3 -fexpensive-optimizations -funroll-loops -fforce-addr
20CFLAGS= $(INCLUDES) $(CFLAG)
21
22GENERAL=Makefile
23#TEST=aestest.c
24TEST=
25APPS=
26
27LIB=$(TOP)/libcrypto.a
28LIBSRC=aes_core.c aes_misc.c aes_ecb.c aes_cbc.c aes_cfb.c aes_ofb.c aes_ctr.c
29LIBOBJ=aes_core.o aes_misc.o aes_ecb.o aes_cbc.o aes_cfb.o aes_ofb.o aes_ctr.o
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
48$(LIBOBJ): $(LIBSRC)
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: installs
59
60installs:
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 $(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
87aes_cbc.o: ../../include/openssl/aes.h ../../include/openssl/e_os2.h
88aes_cbc.o: ../../include/openssl/opensslconf.h aes_cbc.c aes_locl.h
89aes_cfb.o: ../../e_os.h ../../include/openssl/aes.h
90aes_cfb.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslconf.h
91aes_cfb.o: aes_cfb.c aes_locl.h
92aes_core.o: ../../include/openssl/aes.h ../../include/openssl/e_os2.h
93aes_core.o: ../../include/openssl/fips.h ../../include/openssl/opensslconf.h
94aes_core.o: aes_core.c aes_locl.h
95aes_ctr.o: ../../include/openssl/aes.h ../../include/openssl/e_os2.h
96aes_ctr.o: ../../include/openssl/opensslconf.h aes_ctr.c aes_locl.h
97aes_ecb.o: ../../include/openssl/aes.h ../../include/openssl/e_os2.h
98aes_ecb.o: ../../include/openssl/opensslconf.h aes_ecb.c aes_locl.h
99aes_misc.o: ../../include/openssl/aes.h ../../include/openssl/e_os2.h
100aes_misc.o: ../../include/openssl/opensslconf.h
101aes_misc.o: ../../include/openssl/opensslv.h aes_locl.h aes_misc.c
102aes_ofb.o: ../../include/openssl/aes.h ../../include/openssl/e_os2.h
103aes_ofb.o: ../../include/openssl/opensslconf.h aes_locl.h aes_ofb.c
diff --git a/src/lib/libcrypto/aes/Makefile.ssl b/src/lib/libcrypto/aes/Makefile.ssl
new file mode 100644
index 0000000000..f353aeb697
--- /dev/null
+++ b/src/lib/libcrypto/aes/Makefile.ssl
@@ -0,0 +1,103 @@
1#
2# crypto/aes/Makefile
3#
4
5DIR= aes
6TOP= ../..
7CC= cc
8CPP= $(CC) -E
9INCLUDES=
10CFLAG=-g
11INSTALL_PREFIX=
12OPENSSLDIR= /usr/local/ssl
13INSTALLTOP= /usr/local/ssl
14MAKE= make -f Makefile.ssl
15MAKEDEPPROG= makedepend
16MAKEDEPEND= $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG)
17MAKEFILE= Makefile.ssl
18AR= ar r
19
20# CFLAGS= -mpentiumpro $(INCLUDES) $(CFLAG) -O3 -fexpensive-optimizations -funroll-loops -fforce-addr
21CFLAGS= $(INCLUDES) $(CFLAG)
22
23GENERAL=Makefile
24#TEST=aestest.c
25TEST=
26APPS=
27
28LIB=$(TOP)/libcrypto.a
29LIBSRC=aes_core.c aes_misc.c aes_ecb.c aes_cbc.c aes_cfb.c aes_ofb.c aes_ctr.c
30LIBOBJ=aes_core.o aes_misc.o aes_ecb.o aes_cbc.o aes_cfb.o aes_ofb.o aes_ctr.o
31
32SRC= $(LIBSRC)
33
34EXHEADER= aes.h
35HEADER= aes_locl.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
49$(LIBOBJ): $(LIBSRC)
50
51files:
52 $(PERL) $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO
53
54links:
55 @sh $(TOP)/util/point.sh Makefile.ssl Makefile
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: installs
61
62installs:
63 @for i in $(EXHEADER) ; \
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 $(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
89aes_cbc.o: ../../include/openssl/aes.h ../../include/openssl/e_os2.h
90aes_cbc.o: ../../include/openssl/opensslconf.h aes_cbc.c aes_locl.h
91aes_cfb.o: ../../include/openssl/aes.h ../../include/openssl/e_os2.h
92aes_cfb.o: ../../include/openssl/opensslconf.h aes_cfb.c aes_locl.h
93aes_core.o: ../../include/openssl/aes.h ../../include/openssl/e_os2.h
94aes_core.o: ../../include/openssl/opensslconf.h aes_core.c aes_locl.h
95aes_ctr.o: ../../include/openssl/aes.h ../../include/openssl/e_os2.h
96aes_ctr.o: ../../include/openssl/opensslconf.h aes_ctr.c aes_locl.h
97aes_ecb.o: ../../include/openssl/aes.h ../../include/openssl/e_os2.h
98aes_ecb.o: ../../include/openssl/opensslconf.h aes_ecb.c aes_locl.h
99aes_misc.o: ../../include/openssl/aes.h ../../include/openssl/e_os2.h
100aes_misc.o: ../../include/openssl/opensslconf.h
101aes_misc.o: ../../include/openssl/opensslv.h aes_locl.h aes_misc.c
102aes_ofb.o: ../../include/openssl/aes.h ../../include/openssl/e_os2.h
103aes_ofb.o: ../../include/openssl/opensslconf.h aes_locl.h aes_ofb.c
diff --git a/src/lib/libcrypto/aes/aes_cbc.c b/src/lib/libcrypto/aes/aes_cbc.c
index 373864cd4b..d2ba6bcdb4 100644
--- a/src/lib/libcrypto/aes/aes_cbc.c
+++ b/src/lib/libcrypto/aes/aes_cbc.c
@@ -59,7 +59,6 @@
59#include <openssl/aes.h> 59#include <openssl/aes.h>
60#include "aes_locl.h" 60#include "aes_locl.h"
61 61
62#if !defined(OPENSSL_FIPS_AES_ASM)
63void AES_cbc_encrypt(const unsigned char *in, unsigned char *out, 62void AES_cbc_encrypt(const unsigned char *in, unsigned char *out,
64 const unsigned long length, const AES_KEY *key, 63 const unsigned long length, const AES_KEY *key,
65 unsigned char *ivec, const int enc) { 64 unsigned char *ivec, const int enc) {
@@ -130,4 +129,3 @@ void AES_cbc_encrypt(const unsigned char *in, unsigned char *out,
130 } 129 }
131 } 130 }
132} 131}
133#endif
diff --git a/src/lib/libcrypto/asn1/Makefile b/src/lib/libcrypto/asn1/Makefile
new file mode 100644
index 0000000000..d1c2d8f490
--- /dev/null
+++ b/src/lib/libcrypto/asn1/Makefile
@@ -0,0 +1,1150 @@
1#
2# OpenSSL/crypto/asn1/Makefile
3#
4
5DIR= asn1
6TOP= ../..
7CC= cc
8INCLUDES= -I.. -I$(TOP) -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
18CFLAGS= $(INCLUDES) $(CFLAG)
19
20GENERAL=Makefile README
21TEST=
22APPS=
23
24LIB=$(TOP)/libcrypto.a
25LIBSRC= a_object.c a_bitstr.c a_utctm.c a_gentm.c a_time.c a_int.c a_octet.c \
26 a_print.c a_type.c a_set.c a_dup.c a_d2i_fp.c a_i2d_fp.c \
27 a_enum.c a_utf8.c a_sign.c a_digest.c a_verify.c a_mbstr.c a_strex.c \
28 x_algor.c x_val.c x_pubkey.c x_sig.c x_req.c x_attrib.c x_bignum.c \
29 x_long.c x_name.c x_x509.c x_x509a.c x_crl.c x_info.c x_spki.c nsseq.c \
30 d2i_pu.c d2i_pr.c i2d_pu.c i2d_pr.c\
31 t_req.c t_x509.c t_x509a.c t_crl.c t_pkey.c t_spki.c t_bitst.c \
32 tasn_new.c tasn_fre.c tasn_enc.c tasn_dec.c tasn_utl.c tasn_typ.c \
33 f_int.c f_string.c n_pkey.c \
34 f_enum.c a_hdr.c x_pkey.c a_bool.c x_exten.c \
35 asn1_par.c asn1_lib.c asn1_err.c a_meth.c a_bytes.c a_strnid.c \
36 evp_asn1.c asn_pack.c p5_pbe.c p5_pbev2.c p8_pkey.c asn_moid.c
37LIBOBJ= a_object.o a_bitstr.o a_utctm.o a_gentm.o a_time.o a_int.o a_octet.o \
38 a_print.o a_type.o a_set.o a_dup.o a_d2i_fp.o a_i2d_fp.o \
39 a_enum.o a_utf8.o a_sign.o a_digest.o a_verify.o a_mbstr.o a_strex.o \
40 x_algor.o x_val.o x_pubkey.o x_sig.o x_req.o x_attrib.o x_bignum.o \
41 x_long.o x_name.o x_x509.o x_x509a.o x_crl.o x_info.o x_spki.o nsseq.o \
42 d2i_pu.o d2i_pr.o i2d_pu.o i2d_pr.o \
43 t_req.o t_x509.o t_x509a.o t_crl.o t_pkey.o t_spki.o t_bitst.o \
44 tasn_new.o tasn_fre.o tasn_enc.o tasn_dec.o tasn_utl.o tasn_typ.o \
45 f_int.o f_string.o n_pkey.o \
46 f_enum.o a_hdr.o x_pkey.o a_bool.o x_exten.o \
47 asn1_par.o asn1_lib.o asn1_err.o a_meth.o a_bytes.o a_strnid.o \
48 evp_asn1.o asn_pack.o p5_pbe.o p5_pbev2.o p8_pkey.o asn_moid.o
49
50SRC= $(LIBSRC)
51
52EXHEADER= asn1.h asn1_mac.h asn1t.h
53HEADER= $(EXHEADER)
54
55ALL= $(GENERAL) $(SRC) $(HEADER)
56
57top:
58 (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all)
59
60test: test.c
61 cc -g -I../../include -c test.c
62 cc -g -I../../include -o test test.o -L../.. -lcrypto
63
64pk: pk.c
65 cc -g -I../../include -c pk.c
66 cc -g -I../../include -o pk pk.o -L../.. -lcrypto
67
68all: lib
69
70lib: $(LIBOBJ)
71 $(AR) $(LIB) $(LIBOBJ)
72 $(RANLIB) $(LIB) || echo Never mind.
73 @touch lib
74
75files:
76 $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
77
78links:
79 @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
80 @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
81 @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
82
83install:
84 @headerlist="$(EXHEADER)"; for i in $$headerlist ; \
85 do \
86 (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
87 chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
88 done;
89
90tags:
91 ctags $(SRC)
92
93tests:
94
95lint:
96 lint -DLINT $(INCLUDES) $(SRC)>fluff
97
98depend:
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 *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
107
108
109# DO NOT DELETE THIS LINE -- make depend depends on it.
110
111a_bitstr.o: ../../e_os.h ../../include/openssl/asn1.h
112a_bitstr.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
113a_bitstr.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
114a_bitstr.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
115a_bitstr.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
116a_bitstr.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
117a_bitstr.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
118a_bitstr.o: ../../include/openssl/symhacks.h ../cryptlib.h a_bitstr.c
119a_bool.o: ../../e_os.h ../../include/openssl/asn1.h
120a_bool.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
121a_bool.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
122a_bool.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
123a_bool.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
124a_bool.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
125a_bool.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
126a_bool.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
127a_bool.o: ../cryptlib.h a_bool.c
128a_bytes.o: ../../e_os.h ../../include/openssl/asn1.h
129a_bytes.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
130a_bytes.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
131a_bytes.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
132a_bytes.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
133a_bytes.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
134a_bytes.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
135a_bytes.o: ../../include/openssl/symhacks.h ../cryptlib.h a_bytes.c
136a_d2i_fp.o: ../../e_os.h ../../include/openssl/asn1.h
137a_d2i_fp.o: ../../include/openssl/asn1_mac.h ../../include/openssl/bio.h
138a_d2i_fp.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
139a_d2i_fp.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
140a_d2i_fp.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
141a_d2i_fp.o: ../../include/openssl/opensslconf.h
142a_d2i_fp.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
143a_d2i_fp.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
144a_d2i_fp.o: ../../include/openssl/symhacks.h ../cryptlib.h a_d2i_fp.c
145a_digest.o: ../../e_os.h ../../include/openssl/aes.h
146a_digest.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
147a_digest.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
148a_digest.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
149a_digest.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
150a_digest.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
151a_digest.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
152a_digest.o: ../../include/openssl/err.h ../../include/openssl/evp.h
153a_digest.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
154a_digest.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
155a_digest.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
156a_digest.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
157a_digest.o: ../../include/openssl/opensslconf.h
158a_digest.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
159a_digest.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
160a_digest.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
161a_digest.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
162a_digest.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
163a_digest.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
164a_digest.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
165a_digest.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
166a_digest.o: ../cryptlib.h a_digest.c
167a_dup.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
168a_dup.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
169a_dup.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
170a_dup.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
171a_dup.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
172a_dup.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
173a_dup.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
174a_dup.o: ../cryptlib.h a_dup.c
175a_enum.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
176a_enum.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
177a_enum.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
178a_enum.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
179a_enum.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
180a_enum.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
181a_enum.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
182a_enum.o: ../cryptlib.h a_enum.c
183a_gentm.o: ../../e_os.h ../../include/openssl/asn1.h
184a_gentm.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
185a_gentm.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
186a_gentm.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
187a_gentm.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
188a_gentm.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
189a_gentm.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
190a_gentm.o: ../../include/openssl/symhacks.h ../cryptlib.h ../o_time.h a_gentm.c
191a_hdr.o: ../../e_os.h ../../include/openssl/asn1.h
192a_hdr.o: ../../include/openssl/asn1_mac.h ../../include/openssl/bio.h
193a_hdr.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
194a_hdr.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
195a_hdr.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
196a_hdr.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
197a_hdr.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
198a_hdr.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
199a_hdr.o: ../cryptlib.h a_hdr.c
200a_i2d_fp.o: ../../e_os.h ../../include/openssl/asn1.h
201a_i2d_fp.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
202a_i2d_fp.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
203a_i2d_fp.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
204a_i2d_fp.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
205a_i2d_fp.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
206a_i2d_fp.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
207a_i2d_fp.o: ../../include/openssl/symhacks.h ../cryptlib.h a_i2d_fp.c
208a_int.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
209a_int.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
210a_int.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
211a_int.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
212a_int.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
213a_int.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
214a_int.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
215a_int.o: ../cryptlib.h a_int.c
216a_mbstr.o: ../../e_os.h ../../include/openssl/asn1.h
217a_mbstr.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
218a_mbstr.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
219a_mbstr.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
220a_mbstr.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
221a_mbstr.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
222a_mbstr.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
223a_mbstr.o: ../../include/openssl/symhacks.h ../cryptlib.h a_mbstr.c
224a_meth.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
225a_meth.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
226a_meth.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
227a_meth.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
228a_meth.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
229a_meth.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
230a_meth.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
231a_meth.o: ../cryptlib.h a_meth.c
232a_object.o: ../../e_os.h ../../include/openssl/asn1.h
233a_object.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
234a_object.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
235a_object.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
236a_object.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
237a_object.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
238a_object.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
239a_object.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
240a_object.o: ../../include/openssl/symhacks.h ../cryptlib.h a_object.c
241a_octet.o: ../../e_os.h ../../include/openssl/asn1.h
242a_octet.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
243a_octet.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
244a_octet.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
245a_octet.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
246a_octet.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
247a_octet.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
248a_octet.o: ../../include/openssl/symhacks.h ../cryptlib.h a_octet.c
249a_print.o: ../../e_os.h ../../include/openssl/asn1.h
250a_print.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
251a_print.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
252a_print.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
253a_print.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
254a_print.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
255a_print.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
256a_print.o: ../../include/openssl/symhacks.h ../cryptlib.h a_print.c
257a_set.o: ../../e_os.h ../../include/openssl/asn1.h
258a_set.o: ../../include/openssl/asn1_mac.h ../../include/openssl/bio.h
259a_set.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
260a_set.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
261a_set.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
262a_set.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
263a_set.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
264a_set.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
265a_set.o: ../cryptlib.h a_set.c
266a_sign.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
267a_sign.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
268a_sign.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
269a_sign.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
270a_sign.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
271a_sign.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
272a_sign.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
273a_sign.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
274a_sign.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
275a_sign.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
276a_sign.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
277a_sign.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
278a_sign.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
279a_sign.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
280a_sign.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
281a_sign.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
282a_sign.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
283a_sign.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
284a_sign.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
285a_sign.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
286a_sign.o: ../cryptlib.h a_sign.c
287a_strex.o: ../../e_os.h ../../include/openssl/aes.h
288a_strex.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
289a_strex.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
290a_strex.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
291a_strex.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
292a_strex.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
293a_strex.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
294a_strex.o: ../../include/openssl/err.h ../../include/openssl/evp.h
295a_strex.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
296a_strex.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
297a_strex.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
298a_strex.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
299a_strex.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
300a_strex.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
301a_strex.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
302a_strex.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
303a_strex.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
304a_strex.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
305a_strex.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
306a_strex.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h
307a_strex.o: ../../include/openssl/x509_vfy.h ../cryptlib.h a_strex.c charmap.h
308a_strnid.o: ../../e_os.h ../../include/openssl/asn1.h
309a_strnid.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
310a_strnid.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
311a_strnid.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
312a_strnid.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
313a_strnid.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
314a_strnid.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
315a_strnid.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
316a_strnid.o: ../../include/openssl/symhacks.h ../cryptlib.h a_strnid.c
317a_time.o: ../../e_os.h ../../include/openssl/asn1.h
318a_time.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
319a_time.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
320a_time.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
321a_time.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
322a_time.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
323a_time.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
324a_time.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
325a_time.o: ../cryptlib.h ../o_time.h a_time.c
326a_type.o: ../../e_os.h ../../include/openssl/asn1.h
327a_type.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
328a_type.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
329a_type.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
330a_type.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
331a_type.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
332a_type.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
333a_type.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
334a_type.o: ../cryptlib.h a_type.c
335a_utctm.o: ../../e_os.h ../../include/openssl/asn1.h
336a_utctm.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
337a_utctm.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
338a_utctm.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
339a_utctm.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
340a_utctm.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
341a_utctm.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
342a_utctm.o: ../../include/openssl/symhacks.h ../cryptlib.h ../o_time.h a_utctm.c
343a_utf8.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
344a_utf8.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
345a_utf8.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
346a_utf8.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
347a_utf8.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
348a_utf8.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
349a_utf8.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
350a_utf8.o: ../cryptlib.h a_utf8.c
351a_verify.o: ../../e_os.h ../../include/openssl/aes.h
352a_verify.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
353a_verify.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
354a_verify.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
355a_verify.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
356a_verify.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
357a_verify.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
358a_verify.o: ../../include/openssl/err.h ../../include/openssl/evp.h
359a_verify.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
360a_verify.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
361a_verify.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
362a_verify.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
363a_verify.o: ../../include/openssl/opensslconf.h
364a_verify.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
365a_verify.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
366a_verify.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
367a_verify.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
368a_verify.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
369a_verify.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
370a_verify.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
371a_verify.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
372a_verify.o: ../cryptlib.h a_verify.c
373asn1_err.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
374asn1_err.o: ../../include/openssl/bn.h ../../include/openssl/crypto.h
375asn1_err.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
376asn1_err.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
377asn1_err.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
378asn1_err.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
379asn1_err.o: ../../include/openssl/symhacks.h asn1_err.c
380asn1_lib.o: ../../e_os.h ../../include/openssl/asn1.h
381asn1_lib.o: ../../include/openssl/asn1_mac.h ../../include/openssl/bio.h
382asn1_lib.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
383asn1_lib.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
384asn1_lib.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
385asn1_lib.o: ../../include/openssl/opensslconf.h
386asn1_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
387asn1_lib.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
388asn1_lib.o: ../../include/openssl/symhacks.h ../cryptlib.h asn1_lib.c
389asn1_par.o: ../../e_os.h ../../include/openssl/asn1.h
390asn1_par.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
391asn1_par.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
392asn1_par.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
393asn1_par.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
394asn1_par.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
395asn1_par.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
396asn1_par.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
397asn1_par.o: ../../include/openssl/symhacks.h ../cryptlib.h asn1_par.c
398asn_moid.o: ../../e_os.h ../../include/openssl/aes.h
399asn_moid.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
400asn_moid.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
401asn_moid.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
402asn_moid.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
403asn_moid.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
404asn_moid.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
405asn_moid.o: ../../include/openssl/dso.h ../../include/openssl/e_os2.h
406asn_moid.o: ../../include/openssl/err.h ../../include/openssl/evp.h
407asn_moid.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
408asn_moid.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
409asn_moid.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
410asn_moid.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
411asn_moid.o: ../../include/openssl/opensslconf.h
412asn_moid.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
413asn_moid.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
414asn_moid.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
415asn_moid.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
416asn_moid.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
417asn_moid.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
418asn_moid.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
419asn_moid.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
420asn_moid.o: ../cryptlib.h asn_moid.c
421asn_pack.o: ../../e_os.h ../../include/openssl/asn1.h
422asn_pack.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
423asn_pack.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
424asn_pack.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
425asn_pack.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
426asn_pack.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
427asn_pack.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
428asn_pack.o: ../../include/openssl/symhacks.h ../cryptlib.h asn_pack.c
429d2i_pr.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
430d2i_pr.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
431d2i_pr.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
432d2i_pr.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
433d2i_pr.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
434d2i_pr.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
435d2i_pr.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
436d2i_pr.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
437d2i_pr.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
438d2i_pr.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
439d2i_pr.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
440d2i_pr.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
441d2i_pr.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
442d2i_pr.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
443d2i_pr.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
444d2i_pr.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
445d2i_pr.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
446d2i_pr.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
447d2i_pr.o: ../../include/openssl/ui_compat.h ../cryptlib.h d2i_pr.c
448d2i_pu.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
449d2i_pu.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
450d2i_pu.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
451d2i_pu.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
452d2i_pu.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
453d2i_pu.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
454d2i_pu.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
455d2i_pu.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
456d2i_pu.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
457d2i_pu.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
458d2i_pu.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
459d2i_pu.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
460d2i_pu.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
461d2i_pu.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
462d2i_pu.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
463d2i_pu.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
464d2i_pu.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
465d2i_pu.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
466d2i_pu.o: ../../include/openssl/ui_compat.h ../cryptlib.h d2i_pu.c
467evp_asn1.o: ../../e_os.h ../../include/openssl/asn1.h
468evp_asn1.o: ../../include/openssl/asn1_mac.h ../../include/openssl/bio.h
469evp_asn1.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
470evp_asn1.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
471evp_asn1.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
472evp_asn1.o: ../../include/openssl/opensslconf.h
473evp_asn1.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
474evp_asn1.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
475evp_asn1.o: ../../include/openssl/symhacks.h ../cryptlib.h evp_asn1.c
476f_enum.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
477f_enum.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
478f_enum.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
479f_enum.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
480f_enum.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
481f_enum.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
482f_enum.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
483f_enum.o: ../cryptlib.h f_enum.c
484f_int.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
485f_int.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
486f_int.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
487f_int.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
488f_int.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
489f_int.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
490f_int.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
491f_int.o: ../cryptlib.h f_int.c
492f_string.o: ../../e_os.h ../../include/openssl/asn1.h
493f_string.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
494f_string.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
495f_string.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
496f_string.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
497f_string.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
498f_string.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
499f_string.o: ../../include/openssl/symhacks.h ../cryptlib.h f_string.c
500i2d_pr.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
501i2d_pr.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
502i2d_pr.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
503i2d_pr.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
504i2d_pr.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
505i2d_pr.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
506i2d_pr.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
507i2d_pr.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
508i2d_pr.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
509i2d_pr.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
510i2d_pr.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
511i2d_pr.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
512i2d_pr.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
513i2d_pr.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
514i2d_pr.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
515i2d_pr.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
516i2d_pr.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
517i2d_pr.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
518i2d_pr.o: ../../include/openssl/ui_compat.h ../cryptlib.h i2d_pr.c
519i2d_pu.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
520i2d_pu.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
521i2d_pu.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
522i2d_pu.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
523i2d_pu.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
524i2d_pu.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
525i2d_pu.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
526i2d_pu.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
527i2d_pu.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
528i2d_pu.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
529i2d_pu.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
530i2d_pu.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
531i2d_pu.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
532i2d_pu.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
533i2d_pu.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
534i2d_pu.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
535i2d_pu.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
536i2d_pu.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
537i2d_pu.o: ../../include/openssl/ui_compat.h ../cryptlib.h i2d_pu.c
538n_pkey.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
539n_pkey.o: ../../include/openssl/asn1_mac.h ../../include/openssl/asn1t.h
540n_pkey.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
541n_pkey.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
542n_pkey.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
543n_pkey.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
544n_pkey.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
545n_pkey.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
546n_pkey.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
547n_pkey.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
548n_pkey.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
549n_pkey.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
550n_pkey.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
551n_pkey.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
552n_pkey.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
553n_pkey.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
554n_pkey.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
555n_pkey.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
556n_pkey.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
557n_pkey.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
558n_pkey.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
559n_pkey.o: ../cryptlib.h n_pkey.c
560nsseq.o: ../../include/openssl/aes.h ../../include/openssl/asn1.h
561nsseq.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
562nsseq.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
563nsseq.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
564nsseq.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
565nsseq.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
566nsseq.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
567nsseq.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
568nsseq.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
569nsseq.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
570nsseq.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
571nsseq.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
572nsseq.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
573nsseq.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
574nsseq.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
575nsseq.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
576nsseq.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
577nsseq.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
578nsseq.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
579nsseq.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h nsseq.c
580p5_pbe.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
581p5_pbe.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
582p5_pbe.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
583p5_pbe.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
584p5_pbe.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
585p5_pbe.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
586p5_pbe.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
587p5_pbe.o: ../../include/openssl/err.h ../../include/openssl/evp.h
588p5_pbe.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
589p5_pbe.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
590p5_pbe.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
591p5_pbe.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
592p5_pbe.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
593p5_pbe.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
594p5_pbe.o: ../../include/openssl/rand.h ../../include/openssl/rc2.h
595p5_pbe.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
596p5_pbe.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
597p5_pbe.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
598p5_pbe.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
599p5_pbe.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
600p5_pbe.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
601p5_pbe.o: ../cryptlib.h p5_pbe.c
602p5_pbev2.o: ../../e_os.h ../../include/openssl/aes.h
603p5_pbev2.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h
604p5_pbev2.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
605p5_pbev2.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
606p5_pbev2.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
607p5_pbev2.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
608p5_pbev2.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
609p5_pbev2.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
610p5_pbev2.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
611p5_pbev2.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
612p5_pbev2.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
613p5_pbev2.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
614p5_pbev2.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
615p5_pbev2.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
616p5_pbev2.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h
617p5_pbev2.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
618p5_pbev2.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
619p5_pbev2.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
620p5_pbev2.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
621p5_pbev2.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
622p5_pbev2.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h
623p5_pbev2.o: ../../include/openssl/x509_vfy.h ../cryptlib.h p5_pbev2.c
624p8_pkey.o: ../../e_os.h ../../include/openssl/aes.h
625p8_pkey.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h
626p8_pkey.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
627p8_pkey.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
628p8_pkey.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
629p8_pkey.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
630p8_pkey.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
631p8_pkey.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
632p8_pkey.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
633p8_pkey.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
634p8_pkey.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
635p8_pkey.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
636p8_pkey.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
637p8_pkey.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
638p8_pkey.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
639p8_pkey.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
640p8_pkey.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
641p8_pkey.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
642p8_pkey.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
643p8_pkey.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
644p8_pkey.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
645p8_pkey.o: ../cryptlib.h p8_pkey.c
646t_bitst.o: ../../e_os.h ../../include/openssl/aes.h
647t_bitst.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
648t_bitst.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
649t_bitst.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
650t_bitst.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
651t_bitst.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
652t_bitst.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
653t_bitst.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
654t_bitst.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
655t_bitst.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
656t_bitst.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
657t_bitst.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
658t_bitst.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
659t_bitst.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
660t_bitst.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
661t_bitst.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
662t_bitst.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
663t_bitst.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
664t_bitst.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
665t_bitst.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
666t_bitst.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
667t_bitst.o: ../../include/openssl/x509v3.h ../cryptlib.h t_bitst.c
668t_crl.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
669t_crl.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
670t_crl.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
671t_crl.o: ../../include/openssl/cast.h ../../include/openssl/conf.h
672t_crl.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
673t_crl.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
674t_crl.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
675t_crl.o: ../../include/openssl/err.h ../../include/openssl/evp.h
676t_crl.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
677t_crl.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
678t_crl.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
679t_crl.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
680t_crl.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
681t_crl.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
682t_crl.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
683t_crl.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
684t_crl.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
685t_crl.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
686t_crl.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
687t_crl.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h
688t_crl.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
689t_crl.o: ../cryptlib.h t_crl.c
690t_pkey.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
691t_pkey.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
692t_pkey.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
693t_pkey.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
694t_pkey.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
695t_pkey.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
696t_pkey.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rsa.h
697t_pkey.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
698t_pkey.o: ../../include/openssl/symhacks.h ../cryptlib.h t_pkey.c
699t_req.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
700t_req.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
701t_req.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
702t_req.o: ../../include/openssl/cast.h ../../include/openssl/conf.h
703t_req.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
704t_req.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
705t_req.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
706t_req.o: ../../include/openssl/err.h ../../include/openssl/evp.h
707t_req.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
708t_req.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
709t_req.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
710t_req.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
711t_req.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
712t_req.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
713t_req.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
714t_req.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
715t_req.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
716t_req.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
717t_req.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
718t_req.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h
719t_req.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
720t_req.o: ../cryptlib.h t_req.c
721t_spki.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
722t_spki.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
723t_spki.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
724t_spki.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
725t_spki.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
726t_spki.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
727t_spki.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
728t_spki.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
729t_spki.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
730t_spki.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
731t_spki.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
732t_spki.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
733t_spki.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
734t_spki.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
735t_spki.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
736t_spki.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
737t_spki.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
738t_spki.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
739t_spki.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
740t_spki.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
741t_spki.o: ../cryptlib.h t_spki.c
742t_x509.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
743t_x509.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
744t_x509.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
745t_x509.o: ../../include/openssl/cast.h ../../include/openssl/conf.h
746t_x509.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
747t_x509.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
748t_x509.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
749t_x509.o: ../../include/openssl/err.h ../../include/openssl/evp.h
750t_x509.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
751t_x509.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
752t_x509.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
753t_x509.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
754t_x509.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
755t_x509.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
756t_x509.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
757t_x509.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
758t_x509.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
759t_x509.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
760t_x509.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
761t_x509.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h
762t_x509.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
763t_x509.o: ../cryptlib.h t_x509.c
764t_x509a.o: ../../e_os.h ../../include/openssl/aes.h
765t_x509a.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
766t_x509a.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
767t_x509a.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
768t_x509a.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
769t_x509a.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
770t_x509a.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
771t_x509a.o: ../../include/openssl/err.h ../../include/openssl/evp.h
772t_x509a.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
773t_x509a.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
774t_x509a.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
775t_x509a.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
776t_x509a.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
777t_x509a.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
778t_x509a.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
779t_x509a.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
780t_x509a.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
781t_x509a.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
782t_x509a.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
783t_x509a.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h
784t_x509a.o: ../../include/openssl/x509_vfy.h ../cryptlib.h t_x509a.c
785tasn_dec.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h
786tasn_dec.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
787tasn_dec.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
788tasn_dec.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
789tasn_dec.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
790tasn_dec.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
791tasn_dec.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
792tasn_dec.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
793tasn_dec.o: ../../include/openssl/symhacks.h tasn_dec.c
794tasn_enc.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h
795tasn_enc.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
796tasn_enc.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
797tasn_enc.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
798tasn_enc.o: ../../include/openssl/opensslconf.h
799tasn_enc.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
800tasn_enc.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
801tasn_enc.o: ../../include/openssl/symhacks.h tasn_enc.c
802tasn_fre.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h
803tasn_fre.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
804tasn_fre.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
805tasn_fre.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
806tasn_fre.o: ../../include/openssl/opensslconf.h
807tasn_fre.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
808tasn_fre.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
809tasn_fre.o: ../../include/openssl/symhacks.h tasn_fre.c
810tasn_new.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h
811tasn_new.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
812tasn_new.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
813tasn_new.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
814tasn_new.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
815tasn_new.o: ../../include/openssl/opensslconf.h
816tasn_new.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
817tasn_new.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
818tasn_new.o: ../../include/openssl/symhacks.h tasn_new.c
819tasn_typ.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h
820tasn_typ.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
821tasn_typ.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
822tasn_typ.o: ../../include/openssl/opensslconf.h
823tasn_typ.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
824tasn_typ.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
825tasn_typ.o: ../../include/openssl/symhacks.h tasn_typ.c
826tasn_utl.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h
827tasn_utl.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
828tasn_utl.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
829tasn_utl.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
830tasn_utl.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
831tasn_utl.o: ../../include/openssl/opensslconf.h
832tasn_utl.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
833tasn_utl.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
834tasn_utl.o: ../../include/openssl/symhacks.h tasn_utl.c
835x_algor.o: ../../include/openssl/aes.h ../../include/openssl/asn1.h
836x_algor.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
837x_algor.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
838x_algor.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
839x_algor.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
840x_algor.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
841x_algor.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
842x_algor.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
843x_algor.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
844x_algor.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
845x_algor.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
846x_algor.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
847x_algor.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
848x_algor.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
849x_algor.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
850x_algor.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
851x_algor.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
852x_algor.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
853x_algor.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
854x_algor.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
855x_algor.o: x_algor.c
856x_attrib.o: ../../e_os.h ../../include/openssl/aes.h
857x_attrib.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h
858x_attrib.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
859x_attrib.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
860x_attrib.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
861x_attrib.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
862x_attrib.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
863x_attrib.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
864x_attrib.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
865x_attrib.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
866x_attrib.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
867x_attrib.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
868x_attrib.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
869x_attrib.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
870x_attrib.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
871x_attrib.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
872x_attrib.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
873x_attrib.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
874x_attrib.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
875x_attrib.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
876x_attrib.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
877x_attrib.o: ../cryptlib.h x_attrib.c
878x_bignum.o: ../../e_os.h ../../include/openssl/asn1.h
879x_bignum.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
880x_bignum.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
881x_bignum.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
882x_bignum.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
883x_bignum.o: ../../include/openssl/opensslconf.h
884x_bignum.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
885x_bignum.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
886x_bignum.o: ../../include/openssl/symhacks.h ../cryptlib.h x_bignum.c
887x_crl.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
888x_crl.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
889x_crl.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
890x_crl.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
891x_crl.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
892x_crl.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
893x_crl.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
894x_crl.o: ../../include/openssl/err.h ../../include/openssl/evp.h
895x_crl.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
896x_crl.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
897x_crl.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
898x_crl.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
899x_crl.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
900x_crl.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
901x_crl.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
902x_crl.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
903x_crl.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
904x_crl.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
905x_crl.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
906x_crl.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h
907x_crl.o: ../../include/openssl/x509_vfy.h ../cryptlib.h x_crl.c
908x_exten.o: ../../include/openssl/aes.h ../../include/openssl/asn1.h
909x_exten.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
910x_exten.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
911x_exten.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
912x_exten.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
913x_exten.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
914x_exten.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
915x_exten.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
916x_exten.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
917x_exten.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
918x_exten.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
919x_exten.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
920x_exten.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
921x_exten.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
922x_exten.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
923x_exten.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
924x_exten.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
925x_exten.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
926x_exten.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
927x_exten.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
928x_exten.o: x_exten.c
929x_info.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
930x_info.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
931x_info.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
932x_info.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
933x_info.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
934x_info.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
935x_info.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
936x_info.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
937x_info.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
938x_info.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
939x_info.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
940x_info.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
941x_info.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
942x_info.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
943x_info.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
944x_info.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
945x_info.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
946x_info.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
947x_info.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
948x_info.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
949x_info.o: ../cryptlib.h x_info.c
950x_long.o: ../../e_os.h ../../include/openssl/asn1.h
951x_long.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
952x_long.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
953x_long.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
954x_long.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
955x_long.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
956x_long.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
957x_long.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
958x_long.o: ../cryptlib.h x_long.c
959x_name.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
960x_name.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
961x_name.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
962x_name.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
963x_name.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
964x_name.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
965x_name.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
966x_name.o: ../../include/openssl/err.h ../../include/openssl/evp.h
967x_name.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
968x_name.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
969x_name.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
970x_name.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
971x_name.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
972x_name.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
973x_name.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
974x_name.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
975x_name.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
976x_name.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
977x_name.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
978x_name.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h
979x_name.o: ../../include/openssl/x509_vfy.h ../cryptlib.h x_name.c
980x_pkey.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
981x_pkey.o: ../../include/openssl/asn1_mac.h ../../include/openssl/bio.h
982x_pkey.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
983x_pkey.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
984x_pkey.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
985x_pkey.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
986x_pkey.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
987x_pkey.o: ../../include/openssl/err.h ../../include/openssl/evp.h
988x_pkey.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
989x_pkey.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
990x_pkey.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
991x_pkey.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
992x_pkey.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
993x_pkey.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
994x_pkey.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
995x_pkey.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
996x_pkey.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
997x_pkey.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
998x_pkey.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
999x_pkey.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h
1000x_pkey.o: ../../include/openssl/x509_vfy.h ../cryptlib.h x_pkey.c
1001x_pubkey.o: ../../e_os.h ../../include/openssl/aes.h
1002x_pubkey.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h
1003x_pubkey.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
1004x_pubkey.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
1005x_pubkey.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
1006x_pubkey.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
1007x_pubkey.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
1008x_pubkey.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
1009x_pubkey.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
1010x_pubkey.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
1011x_pubkey.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
1012x_pubkey.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
1013x_pubkey.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
1014x_pubkey.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
1015x_pubkey.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
1016x_pubkey.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
1017x_pubkey.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
1018x_pubkey.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
1019x_pubkey.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
1020x_pubkey.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
1021x_pubkey.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
1022x_pubkey.o: ../cryptlib.h x_pubkey.c
1023x_req.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
1024x_req.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
1025x_req.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
1026x_req.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
1027x_req.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
1028x_req.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
1029x_req.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
1030x_req.o: ../../include/openssl/err.h ../../include/openssl/evp.h
1031x_req.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
1032x_req.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
1033x_req.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
1034x_req.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
1035x_req.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
1036x_req.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
1037x_req.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
1038x_req.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
1039x_req.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
1040x_req.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
1041x_req.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
1042x_req.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h
1043x_req.o: ../../include/openssl/x509_vfy.h ../cryptlib.h x_req.c
1044x_sig.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
1045x_sig.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
1046x_sig.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
1047x_sig.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
1048x_sig.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
1049x_sig.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
1050x_sig.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
1051x_sig.o: ../../include/openssl/err.h ../../include/openssl/evp.h
1052x_sig.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
1053x_sig.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
1054x_sig.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
1055x_sig.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
1056x_sig.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
1057x_sig.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
1058x_sig.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
1059x_sig.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
1060x_sig.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
1061x_sig.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
1062x_sig.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
1063x_sig.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h
1064x_sig.o: ../../include/openssl/x509_vfy.h ../cryptlib.h x_sig.c
1065x_spki.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
1066x_spki.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
1067x_spki.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
1068x_spki.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
1069x_spki.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
1070x_spki.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
1071x_spki.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
1072x_spki.o: ../../include/openssl/err.h ../../include/openssl/evp.h
1073x_spki.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
1074x_spki.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
1075x_spki.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
1076x_spki.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
1077x_spki.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
1078x_spki.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
1079x_spki.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
1080x_spki.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
1081x_spki.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
1082x_spki.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
1083x_spki.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
1084x_spki.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h
1085x_spki.o: ../../include/openssl/x509_vfy.h ../cryptlib.h x_spki.c
1086x_val.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
1087x_val.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
1088x_val.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
1089x_val.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
1090x_val.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
1091x_val.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
1092x_val.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
1093x_val.o: ../../include/openssl/err.h ../../include/openssl/evp.h
1094x_val.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
1095x_val.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
1096x_val.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
1097x_val.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
1098x_val.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
1099x_val.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
1100x_val.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
1101x_val.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
1102x_val.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
1103x_val.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
1104x_val.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
1105x_val.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h
1106x_val.o: ../../include/openssl/x509_vfy.h ../cryptlib.h x_val.c
1107x_x509.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
1108x_x509.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
1109x_x509.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
1110x_x509.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
1111x_x509.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
1112x_x509.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
1113x_x509.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
1114x_x509.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
1115x_x509.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
1116x_x509.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
1117x_x509.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
1118x_x509.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
1119x_x509.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
1120x_x509.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
1121x_x509.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
1122x_x509.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
1123x_x509.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
1124x_x509.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
1125x_x509.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
1126x_x509.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
1127x_x509.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
1128x_x509.o: ../../include/openssl/x509v3.h ../cryptlib.h x_x509.c
1129x_x509a.o: ../../e_os.h ../../include/openssl/aes.h
1130x_x509a.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h
1131x_x509a.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
1132x_x509a.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
1133x_x509a.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
1134x_x509a.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
1135x_x509a.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
1136x_x509a.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
1137x_x509a.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
1138x_x509a.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
1139x_x509a.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
1140x_x509a.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
1141x_x509a.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
1142x_x509a.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
1143x_x509a.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
1144x_x509a.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
1145x_x509a.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
1146x_x509a.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
1147x_x509a.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
1148x_x509a.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
1149x_x509a.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
1150x_x509a.o: ../cryptlib.h x_x509a.c
diff --git a/src/lib/libcrypto/asn1/Makefile.ssl b/src/lib/libcrypto/asn1/Makefile.ssl
new file mode 100644
index 0000000000..cb45194d48
--- /dev/null
+++ b/src/lib/libcrypto/asn1/Makefile.ssl
@@ -0,0 +1,1152 @@
1#
2# SSLeay/crypto/asn1/Makefile
3#
4
5DIR= asn1
6TOP= ../..
7CC= cc
8INCLUDES= -I.. -I$(TOP) -I../../include
9CFLAG=-g
10INSTALL_PREFIX=
11OPENSSLDIR= /usr/local/ssl
12INSTALLTOP=/usr/local/ssl
13MAKE= make -f Makefile.ssl
14MAKEDEPPROG= makedepend
15MAKEDEPEND= $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG)
16MAKEFILE= Makefile.ssl
17AR= ar r
18
19CFLAGS= $(INCLUDES) $(CFLAG)
20
21GENERAL=Makefile README
22TEST=
23APPS=
24
25LIB=$(TOP)/libcrypto.a
26LIBSRC= a_object.c a_bitstr.c a_utctm.c a_gentm.c a_time.c a_int.c a_octet.c \
27 a_print.c a_type.c a_set.c a_dup.c a_d2i_fp.c a_i2d_fp.c \
28 a_enum.c a_utf8.c a_sign.c a_digest.c a_verify.c a_mbstr.c a_strex.c \
29 x_algor.c x_val.c x_pubkey.c x_sig.c x_req.c x_attrib.c x_bignum.c \
30 x_long.c x_name.c x_x509.c x_x509a.c x_crl.c x_info.c x_spki.c nsseq.c \
31 d2i_pu.c d2i_pr.c i2d_pu.c i2d_pr.c\
32 t_req.c t_x509.c t_x509a.c t_crl.c t_pkey.c t_spki.c t_bitst.c \
33 tasn_new.c tasn_fre.c tasn_enc.c tasn_dec.c tasn_utl.c tasn_typ.c \
34 f_int.c f_string.c n_pkey.c \
35 f_enum.c a_hdr.c x_pkey.c a_bool.c x_exten.c \
36 asn1_par.c asn1_lib.c asn1_err.c a_meth.c a_bytes.c a_strnid.c \
37 evp_asn1.c asn_pack.c p5_pbe.c p5_pbev2.c p8_pkey.c asn_moid.c
38LIBOBJ= a_object.o a_bitstr.o a_utctm.o a_gentm.o a_time.o a_int.o a_octet.o \
39 a_print.o a_type.o a_set.o a_dup.o a_d2i_fp.o a_i2d_fp.o \
40 a_enum.o a_utf8.o a_sign.o a_digest.o a_verify.o a_mbstr.o a_strex.o \
41 x_algor.o x_val.o x_pubkey.o x_sig.o x_req.o x_attrib.o x_bignum.o \
42 x_long.o x_name.o x_x509.o x_x509a.o x_crl.o x_info.o x_spki.o nsseq.o \
43 d2i_pu.o d2i_pr.o i2d_pu.o i2d_pr.o \
44 t_req.o t_x509.o t_x509a.o t_crl.o t_pkey.o t_spki.o t_bitst.o \
45 tasn_new.o tasn_fre.o tasn_enc.o tasn_dec.o tasn_utl.o tasn_typ.o \
46 f_int.o f_string.o n_pkey.o \
47 f_enum.o a_hdr.o x_pkey.o a_bool.o x_exten.o \
48 asn1_par.o asn1_lib.o asn1_err.o a_meth.o a_bytes.o a_strnid.o \
49 evp_asn1.o asn_pack.o p5_pbe.o p5_pbev2.o p8_pkey.o asn_moid.o
50
51SRC= $(LIBSRC)
52
53EXHEADER= asn1.h asn1_mac.h asn1t.h
54HEADER= $(EXHEADER)
55
56ALL= $(GENERAL) $(SRC) $(HEADER)
57
58top:
59 (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all)
60
61test: test.c
62 cc -g -I../../include -c test.c
63 cc -g -I../../include -o test test.o -L../.. -lcrypto
64
65pk: pk.c
66 cc -g -I../../include -c pk.c
67 cc -g -I../../include -o pk pk.o -L../.. -lcrypto
68
69all: lib
70
71lib: $(LIBOBJ)
72 $(AR) $(LIB) $(LIBOBJ)
73 $(RANLIB) $(LIB) || echo Never mind.
74 @touch lib
75
76files:
77 $(PERL) $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO
78
79links:
80 @sh $(TOP)/util/point.sh Makefile.ssl Makefile
81 @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
82 @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
83 @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
84
85install:
86 @for i in $(EXHEADER) ; \
87 do \
88 (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
89 chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
90 done;
91
92tags:
93 ctags $(SRC)
94
95tests:
96
97lint:
98 lint -DLINT $(INCLUDES) $(SRC)>fluff
99
100depend:
101 $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
102
103dclean:
104 $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
105 mv -f Makefile.new $(MAKEFILE)
106
107clean:
108 rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
109
110
111# DO NOT DELETE THIS LINE -- make depend depends on it.
112
113a_bitstr.o: ../../e_os.h ../../include/openssl/asn1.h
114a_bitstr.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
115a_bitstr.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
116a_bitstr.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
117a_bitstr.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
118a_bitstr.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
119a_bitstr.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
120a_bitstr.o: ../../include/openssl/symhacks.h ../cryptlib.h a_bitstr.c
121a_bool.o: ../../e_os.h ../../include/openssl/asn1.h
122a_bool.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
123a_bool.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
124a_bool.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
125a_bool.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
126a_bool.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
127a_bool.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
128a_bool.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
129a_bool.o: ../cryptlib.h a_bool.c
130a_bytes.o: ../../e_os.h ../../include/openssl/asn1.h
131a_bytes.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
132a_bytes.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
133a_bytes.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
134a_bytes.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
135a_bytes.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
136a_bytes.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
137a_bytes.o: ../../include/openssl/symhacks.h ../cryptlib.h a_bytes.c
138a_d2i_fp.o: ../../e_os.h ../../include/openssl/asn1.h
139a_d2i_fp.o: ../../include/openssl/asn1_mac.h ../../include/openssl/bio.h
140a_d2i_fp.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
141a_d2i_fp.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
142a_d2i_fp.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
143a_d2i_fp.o: ../../include/openssl/opensslconf.h
144a_d2i_fp.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
145a_d2i_fp.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
146a_d2i_fp.o: ../../include/openssl/symhacks.h ../cryptlib.h a_d2i_fp.c
147a_digest.o: ../../e_os.h ../../include/openssl/aes.h
148a_digest.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
149a_digest.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
150a_digest.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
151a_digest.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
152a_digest.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
153a_digest.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
154a_digest.o: ../../include/openssl/err.h ../../include/openssl/evp.h
155a_digest.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
156a_digest.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
157a_digest.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
158a_digest.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
159a_digest.o: ../../include/openssl/opensslconf.h
160a_digest.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
161a_digest.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
162a_digest.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
163a_digest.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
164a_digest.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
165a_digest.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
166a_digest.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
167a_digest.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
168a_digest.o: ../cryptlib.h a_digest.c
169a_dup.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
170a_dup.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
171a_dup.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
172a_dup.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
173a_dup.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
174a_dup.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
175a_dup.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
176a_dup.o: ../cryptlib.h a_dup.c
177a_enum.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
178a_enum.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
179a_enum.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
180a_enum.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
181a_enum.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
182a_enum.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
183a_enum.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
184a_enum.o: ../cryptlib.h a_enum.c
185a_gentm.o: ../../e_os.h ../../include/openssl/asn1.h
186a_gentm.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
187a_gentm.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
188a_gentm.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
189a_gentm.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
190a_gentm.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
191a_gentm.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
192a_gentm.o: ../../include/openssl/symhacks.h ../cryptlib.h ../o_time.h a_gentm.c
193a_hdr.o: ../../e_os.h ../../include/openssl/asn1.h
194a_hdr.o: ../../include/openssl/asn1_mac.h ../../include/openssl/bio.h
195a_hdr.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
196a_hdr.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
197a_hdr.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
198a_hdr.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
199a_hdr.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
200a_hdr.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
201a_hdr.o: ../cryptlib.h a_hdr.c
202a_i2d_fp.o: ../../e_os.h ../../include/openssl/asn1.h
203a_i2d_fp.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
204a_i2d_fp.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
205a_i2d_fp.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
206a_i2d_fp.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
207a_i2d_fp.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
208a_i2d_fp.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
209a_i2d_fp.o: ../../include/openssl/symhacks.h ../cryptlib.h a_i2d_fp.c
210a_int.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
211a_int.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
212a_int.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
213a_int.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
214a_int.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
215a_int.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
216a_int.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
217a_int.o: ../cryptlib.h a_int.c
218a_mbstr.o: ../../e_os.h ../../include/openssl/asn1.h
219a_mbstr.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
220a_mbstr.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
221a_mbstr.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
222a_mbstr.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
223a_mbstr.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
224a_mbstr.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
225a_mbstr.o: ../../include/openssl/symhacks.h ../cryptlib.h a_mbstr.c
226a_meth.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
227a_meth.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
228a_meth.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
229a_meth.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
230a_meth.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
231a_meth.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
232a_meth.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
233a_meth.o: ../cryptlib.h a_meth.c
234a_object.o: ../../e_os.h ../../include/openssl/asn1.h
235a_object.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
236a_object.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
237a_object.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
238a_object.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
239a_object.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
240a_object.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
241a_object.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
242a_object.o: ../../include/openssl/symhacks.h ../cryptlib.h a_object.c
243a_octet.o: ../../e_os.h ../../include/openssl/asn1.h
244a_octet.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
245a_octet.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
246a_octet.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
247a_octet.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
248a_octet.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
249a_octet.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
250a_octet.o: ../../include/openssl/symhacks.h ../cryptlib.h a_octet.c
251a_print.o: ../../e_os.h ../../include/openssl/asn1.h
252a_print.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
253a_print.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
254a_print.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
255a_print.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
256a_print.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
257a_print.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
258a_print.o: ../../include/openssl/symhacks.h ../cryptlib.h a_print.c
259a_set.o: ../../e_os.h ../../include/openssl/asn1.h
260a_set.o: ../../include/openssl/asn1_mac.h ../../include/openssl/bio.h
261a_set.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
262a_set.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
263a_set.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
264a_set.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
265a_set.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
266a_set.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
267a_set.o: ../cryptlib.h a_set.c
268a_sign.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
269a_sign.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
270a_sign.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
271a_sign.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
272a_sign.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
273a_sign.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
274a_sign.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
275a_sign.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
276a_sign.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
277a_sign.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
278a_sign.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
279a_sign.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
280a_sign.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
281a_sign.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
282a_sign.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
283a_sign.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
284a_sign.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
285a_sign.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
286a_sign.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
287a_sign.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
288a_sign.o: ../cryptlib.h a_sign.c
289a_strex.o: ../../e_os.h ../../include/openssl/aes.h
290a_strex.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
291a_strex.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
292a_strex.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
293a_strex.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
294a_strex.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
295a_strex.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
296a_strex.o: ../../include/openssl/err.h ../../include/openssl/evp.h
297a_strex.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
298a_strex.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
299a_strex.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
300a_strex.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
301a_strex.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
302a_strex.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
303a_strex.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
304a_strex.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
305a_strex.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
306a_strex.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
307a_strex.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
308a_strex.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h
309a_strex.o: ../../include/openssl/x509_vfy.h ../cryptlib.h a_strex.c charmap.h
310a_strnid.o: ../../e_os.h ../../include/openssl/asn1.h
311a_strnid.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
312a_strnid.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
313a_strnid.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
314a_strnid.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
315a_strnid.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
316a_strnid.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
317a_strnid.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
318a_strnid.o: ../../include/openssl/symhacks.h ../cryptlib.h a_strnid.c
319a_time.o: ../../e_os.h ../../include/openssl/asn1.h
320a_time.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
321a_time.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
322a_time.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
323a_time.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
324a_time.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
325a_time.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
326a_time.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
327a_time.o: ../cryptlib.h ../o_time.h a_time.c
328a_type.o: ../../e_os.h ../../include/openssl/asn1.h
329a_type.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
330a_type.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
331a_type.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
332a_type.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
333a_type.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
334a_type.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
335a_type.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
336a_type.o: ../cryptlib.h a_type.c
337a_utctm.o: ../../e_os.h ../../include/openssl/asn1.h
338a_utctm.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
339a_utctm.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
340a_utctm.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
341a_utctm.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
342a_utctm.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
343a_utctm.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
344a_utctm.o: ../../include/openssl/symhacks.h ../cryptlib.h ../o_time.h a_utctm.c
345a_utf8.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
346a_utf8.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
347a_utf8.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
348a_utf8.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
349a_utf8.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
350a_utf8.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
351a_utf8.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
352a_utf8.o: ../cryptlib.h a_utf8.c
353a_verify.o: ../../e_os.h ../../include/openssl/aes.h
354a_verify.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
355a_verify.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
356a_verify.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
357a_verify.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
358a_verify.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
359a_verify.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
360a_verify.o: ../../include/openssl/err.h ../../include/openssl/evp.h
361a_verify.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
362a_verify.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
363a_verify.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
364a_verify.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
365a_verify.o: ../../include/openssl/opensslconf.h
366a_verify.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
367a_verify.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
368a_verify.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
369a_verify.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
370a_verify.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
371a_verify.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
372a_verify.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
373a_verify.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
374a_verify.o: ../cryptlib.h a_verify.c
375asn1_err.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
376asn1_err.o: ../../include/openssl/bn.h ../../include/openssl/crypto.h
377asn1_err.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
378asn1_err.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
379asn1_err.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
380asn1_err.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
381asn1_err.o: ../../include/openssl/symhacks.h asn1_err.c
382asn1_lib.o: ../../e_os.h ../../include/openssl/asn1.h
383asn1_lib.o: ../../include/openssl/asn1_mac.h ../../include/openssl/bio.h
384asn1_lib.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
385asn1_lib.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
386asn1_lib.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
387asn1_lib.o: ../../include/openssl/opensslconf.h
388asn1_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
389asn1_lib.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
390asn1_lib.o: ../../include/openssl/symhacks.h ../cryptlib.h asn1_lib.c
391asn1_par.o: ../../e_os.h ../../include/openssl/asn1.h
392asn1_par.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
393asn1_par.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
394asn1_par.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
395asn1_par.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
396asn1_par.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
397asn1_par.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
398asn1_par.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
399asn1_par.o: ../../include/openssl/symhacks.h ../cryptlib.h asn1_par.c
400asn_moid.o: ../../e_os.h ../../include/openssl/aes.h
401asn_moid.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
402asn_moid.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
403asn_moid.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
404asn_moid.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
405asn_moid.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
406asn_moid.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
407asn_moid.o: ../../include/openssl/dso.h ../../include/openssl/e_os2.h
408asn_moid.o: ../../include/openssl/err.h ../../include/openssl/evp.h
409asn_moid.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
410asn_moid.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
411asn_moid.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
412asn_moid.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
413asn_moid.o: ../../include/openssl/opensslconf.h
414asn_moid.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
415asn_moid.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
416asn_moid.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
417asn_moid.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
418asn_moid.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
419asn_moid.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
420asn_moid.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
421asn_moid.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
422asn_moid.o: ../cryptlib.h asn_moid.c
423asn_pack.o: ../../e_os.h ../../include/openssl/asn1.h
424asn_pack.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
425asn_pack.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
426asn_pack.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
427asn_pack.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
428asn_pack.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
429asn_pack.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
430asn_pack.o: ../../include/openssl/symhacks.h ../cryptlib.h asn_pack.c
431d2i_pr.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
432d2i_pr.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
433d2i_pr.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
434d2i_pr.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
435d2i_pr.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
436d2i_pr.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
437d2i_pr.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
438d2i_pr.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
439d2i_pr.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
440d2i_pr.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
441d2i_pr.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
442d2i_pr.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
443d2i_pr.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
444d2i_pr.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
445d2i_pr.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
446d2i_pr.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
447d2i_pr.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
448d2i_pr.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
449d2i_pr.o: ../../include/openssl/ui_compat.h ../cryptlib.h d2i_pr.c
450d2i_pu.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
451d2i_pu.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
452d2i_pu.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
453d2i_pu.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
454d2i_pu.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
455d2i_pu.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
456d2i_pu.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
457d2i_pu.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
458d2i_pu.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
459d2i_pu.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
460d2i_pu.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
461d2i_pu.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
462d2i_pu.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
463d2i_pu.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
464d2i_pu.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
465d2i_pu.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
466d2i_pu.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
467d2i_pu.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
468d2i_pu.o: ../../include/openssl/ui_compat.h ../cryptlib.h d2i_pu.c
469evp_asn1.o: ../../e_os.h ../../include/openssl/asn1.h
470evp_asn1.o: ../../include/openssl/asn1_mac.h ../../include/openssl/bio.h
471evp_asn1.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
472evp_asn1.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
473evp_asn1.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
474evp_asn1.o: ../../include/openssl/opensslconf.h
475evp_asn1.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
476evp_asn1.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
477evp_asn1.o: ../../include/openssl/symhacks.h ../cryptlib.h evp_asn1.c
478f_enum.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
479f_enum.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
480f_enum.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
481f_enum.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
482f_enum.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
483f_enum.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
484f_enum.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
485f_enum.o: ../cryptlib.h f_enum.c
486f_int.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
487f_int.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
488f_int.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
489f_int.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
490f_int.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
491f_int.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
492f_int.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
493f_int.o: ../cryptlib.h f_int.c
494f_string.o: ../../e_os.h ../../include/openssl/asn1.h
495f_string.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
496f_string.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
497f_string.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
498f_string.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
499f_string.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
500f_string.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
501f_string.o: ../../include/openssl/symhacks.h ../cryptlib.h f_string.c
502i2d_pr.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
503i2d_pr.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
504i2d_pr.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
505i2d_pr.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
506i2d_pr.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
507i2d_pr.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
508i2d_pr.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
509i2d_pr.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
510i2d_pr.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
511i2d_pr.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
512i2d_pr.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
513i2d_pr.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
514i2d_pr.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
515i2d_pr.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
516i2d_pr.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
517i2d_pr.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
518i2d_pr.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
519i2d_pr.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
520i2d_pr.o: ../../include/openssl/ui_compat.h ../cryptlib.h i2d_pr.c
521i2d_pu.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
522i2d_pu.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
523i2d_pu.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
524i2d_pu.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
525i2d_pu.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
526i2d_pu.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
527i2d_pu.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
528i2d_pu.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
529i2d_pu.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
530i2d_pu.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
531i2d_pu.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
532i2d_pu.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
533i2d_pu.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
534i2d_pu.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
535i2d_pu.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
536i2d_pu.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
537i2d_pu.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
538i2d_pu.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
539i2d_pu.o: ../../include/openssl/ui_compat.h ../cryptlib.h i2d_pu.c
540n_pkey.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
541n_pkey.o: ../../include/openssl/asn1_mac.h ../../include/openssl/asn1t.h
542n_pkey.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
543n_pkey.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
544n_pkey.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
545n_pkey.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
546n_pkey.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
547n_pkey.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
548n_pkey.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
549n_pkey.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
550n_pkey.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
551n_pkey.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
552n_pkey.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
553n_pkey.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
554n_pkey.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
555n_pkey.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
556n_pkey.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
557n_pkey.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
558n_pkey.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
559n_pkey.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
560n_pkey.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
561n_pkey.o: ../cryptlib.h n_pkey.c
562nsseq.o: ../../include/openssl/aes.h ../../include/openssl/asn1.h
563nsseq.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
564nsseq.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
565nsseq.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
566nsseq.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
567nsseq.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
568nsseq.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
569nsseq.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
570nsseq.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
571nsseq.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
572nsseq.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
573nsseq.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
574nsseq.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
575nsseq.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
576nsseq.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
577nsseq.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
578nsseq.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
579nsseq.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
580nsseq.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
581nsseq.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h nsseq.c
582p5_pbe.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
583p5_pbe.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
584p5_pbe.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
585p5_pbe.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
586p5_pbe.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
587p5_pbe.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
588p5_pbe.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
589p5_pbe.o: ../../include/openssl/err.h ../../include/openssl/evp.h
590p5_pbe.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
591p5_pbe.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
592p5_pbe.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
593p5_pbe.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
594p5_pbe.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
595p5_pbe.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
596p5_pbe.o: ../../include/openssl/rand.h ../../include/openssl/rc2.h
597p5_pbe.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
598p5_pbe.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
599p5_pbe.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
600p5_pbe.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
601p5_pbe.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
602p5_pbe.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
603p5_pbe.o: ../cryptlib.h p5_pbe.c
604p5_pbev2.o: ../../e_os.h ../../include/openssl/aes.h
605p5_pbev2.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h
606p5_pbev2.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
607p5_pbev2.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
608p5_pbev2.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
609p5_pbev2.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
610p5_pbev2.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
611p5_pbev2.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
612p5_pbev2.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
613p5_pbev2.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
614p5_pbev2.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
615p5_pbev2.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
616p5_pbev2.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
617p5_pbev2.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
618p5_pbev2.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h
619p5_pbev2.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
620p5_pbev2.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
621p5_pbev2.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
622p5_pbev2.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
623p5_pbev2.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
624p5_pbev2.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h
625p5_pbev2.o: ../../include/openssl/x509_vfy.h ../cryptlib.h p5_pbev2.c
626p8_pkey.o: ../../e_os.h ../../include/openssl/aes.h
627p8_pkey.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h
628p8_pkey.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
629p8_pkey.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
630p8_pkey.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
631p8_pkey.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
632p8_pkey.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
633p8_pkey.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
634p8_pkey.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
635p8_pkey.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
636p8_pkey.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
637p8_pkey.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
638p8_pkey.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
639p8_pkey.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
640p8_pkey.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
641p8_pkey.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
642p8_pkey.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
643p8_pkey.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
644p8_pkey.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
645p8_pkey.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
646p8_pkey.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
647p8_pkey.o: ../cryptlib.h p8_pkey.c
648t_bitst.o: ../../e_os.h ../../include/openssl/aes.h
649t_bitst.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
650t_bitst.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
651t_bitst.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
652t_bitst.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
653t_bitst.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
654t_bitst.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
655t_bitst.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
656t_bitst.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
657t_bitst.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
658t_bitst.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
659t_bitst.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
660t_bitst.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
661t_bitst.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
662t_bitst.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
663t_bitst.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
664t_bitst.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
665t_bitst.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
666t_bitst.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
667t_bitst.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
668t_bitst.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
669t_bitst.o: ../../include/openssl/x509v3.h ../cryptlib.h t_bitst.c
670t_crl.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
671t_crl.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
672t_crl.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
673t_crl.o: ../../include/openssl/cast.h ../../include/openssl/conf.h
674t_crl.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
675t_crl.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
676t_crl.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
677t_crl.o: ../../include/openssl/err.h ../../include/openssl/evp.h
678t_crl.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
679t_crl.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
680t_crl.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
681t_crl.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
682t_crl.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
683t_crl.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
684t_crl.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
685t_crl.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
686t_crl.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
687t_crl.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
688t_crl.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
689t_crl.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h
690t_crl.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
691t_crl.o: ../cryptlib.h t_crl.c
692t_pkey.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
693t_pkey.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
694t_pkey.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
695t_pkey.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
696t_pkey.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
697t_pkey.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
698t_pkey.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rsa.h
699t_pkey.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
700t_pkey.o: ../../include/openssl/symhacks.h ../cryptlib.h t_pkey.c
701t_req.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
702t_req.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
703t_req.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
704t_req.o: ../../include/openssl/cast.h ../../include/openssl/conf.h
705t_req.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
706t_req.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
707t_req.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
708t_req.o: ../../include/openssl/err.h ../../include/openssl/evp.h
709t_req.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
710t_req.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
711t_req.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
712t_req.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
713t_req.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
714t_req.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
715t_req.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
716t_req.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
717t_req.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
718t_req.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
719t_req.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
720t_req.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h
721t_req.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
722t_req.o: ../cryptlib.h t_req.c
723t_spki.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
724t_spki.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
725t_spki.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
726t_spki.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
727t_spki.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
728t_spki.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
729t_spki.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
730t_spki.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
731t_spki.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
732t_spki.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
733t_spki.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
734t_spki.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
735t_spki.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
736t_spki.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
737t_spki.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
738t_spki.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
739t_spki.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
740t_spki.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
741t_spki.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
742t_spki.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
743t_spki.o: ../cryptlib.h t_spki.c
744t_x509.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
745t_x509.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
746t_x509.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
747t_x509.o: ../../include/openssl/cast.h ../../include/openssl/conf.h
748t_x509.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
749t_x509.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
750t_x509.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
751t_x509.o: ../../include/openssl/err.h ../../include/openssl/evp.h
752t_x509.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
753t_x509.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
754t_x509.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
755t_x509.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
756t_x509.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
757t_x509.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
758t_x509.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
759t_x509.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
760t_x509.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
761t_x509.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
762t_x509.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
763t_x509.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h
764t_x509.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
765t_x509.o: ../cryptlib.h t_x509.c
766t_x509a.o: ../../e_os.h ../../include/openssl/aes.h
767t_x509a.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
768t_x509a.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
769t_x509a.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
770t_x509a.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
771t_x509a.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
772t_x509a.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
773t_x509a.o: ../../include/openssl/err.h ../../include/openssl/evp.h
774t_x509a.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
775t_x509a.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
776t_x509a.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
777t_x509a.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
778t_x509a.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
779t_x509a.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
780t_x509a.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
781t_x509a.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
782t_x509a.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
783t_x509a.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
784t_x509a.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
785t_x509a.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h
786t_x509a.o: ../../include/openssl/x509_vfy.h ../cryptlib.h t_x509a.c
787tasn_dec.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h
788tasn_dec.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
789tasn_dec.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
790tasn_dec.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
791tasn_dec.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
792tasn_dec.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
793tasn_dec.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
794tasn_dec.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
795tasn_dec.o: ../../include/openssl/symhacks.h tasn_dec.c
796tasn_enc.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h
797tasn_enc.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
798tasn_enc.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
799tasn_enc.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
800tasn_enc.o: ../../include/openssl/opensslconf.h
801tasn_enc.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
802tasn_enc.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
803tasn_enc.o: ../../include/openssl/symhacks.h tasn_enc.c
804tasn_fre.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h
805tasn_fre.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
806tasn_fre.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
807tasn_fre.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
808tasn_fre.o: ../../include/openssl/opensslconf.h
809tasn_fre.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
810tasn_fre.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
811tasn_fre.o: ../../include/openssl/symhacks.h tasn_fre.c
812tasn_new.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h
813tasn_new.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
814tasn_new.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
815tasn_new.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
816tasn_new.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
817tasn_new.o: ../../include/openssl/opensslconf.h
818tasn_new.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
819tasn_new.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
820tasn_new.o: ../../include/openssl/symhacks.h tasn_new.c
821tasn_typ.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h
822tasn_typ.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
823tasn_typ.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
824tasn_typ.o: ../../include/openssl/opensslconf.h
825tasn_typ.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
826tasn_typ.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
827tasn_typ.o: ../../include/openssl/symhacks.h tasn_typ.c
828tasn_utl.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h
829tasn_utl.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
830tasn_utl.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
831tasn_utl.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
832tasn_utl.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
833tasn_utl.o: ../../include/openssl/opensslconf.h
834tasn_utl.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
835tasn_utl.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
836tasn_utl.o: ../../include/openssl/symhacks.h tasn_utl.c
837x_algor.o: ../../include/openssl/aes.h ../../include/openssl/asn1.h
838x_algor.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
839x_algor.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
840x_algor.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
841x_algor.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
842x_algor.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
843x_algor.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
844x_algor.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
845x_algor.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
846x_algor.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
847x_algor.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
848x_algor.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
849x_algor.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
850x_algor.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
851x_algor.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
852x_algor.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
853x_algor.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
854x_algor.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
855x_algor.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
856x_algor.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
857x_algor.o: x_algor.c
858x_attrib.o: ../../e_os.h ../../include/openssl/aes.h
859x_attrib.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h
860x_attrib.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
861x_attrib.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
862x_attrib.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
863x_attrib.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
864x_attrib.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
865x_attrib.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
866x_attrib.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
867x_attrib.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
868x_attrib.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
869x_attrib.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
870x_attrib.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
871x_attrib.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
872x_attrib.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
873x_attrib.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
874x_attrib.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
875x_attrib.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
876x_attrib.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
877x_attrib.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
878x_attrib.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
879x_attrib.o: ../cryptlib.h x_attrib.c
880x_bignum.o: ../../e_os.h ../../include/openssl/asn1.h
881x_bignum.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
882x_bignum.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
883x_bignum.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
884x_bignum.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
885x_bignum.o: ../../include/openssl/opensslconf.h
886x_bignum.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
887x_bignum.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
888x_bignum.o: ../../include/openssl/symhacks.h ../cryptlib.h x_bignum.c
889x_crl.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
890x_crl.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
891x_crl.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
892x_crl.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
893x_crl.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
894x_crl.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
895x_crl.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
896x_crl.o: ../../include/openssl/err.h ../../include/openssl/evp.h
897x_crl.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
898x_crl.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
899x_crl.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
900x_crl.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
901x_crl.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
902x_crl.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
903x_crl.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
904x_crl.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
905x_crl.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
906x_crl.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
907x_crl.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
908x_crl.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h
909x_crl.o: ../../include/openssl/x509_vfy.h ../cryptlib.h x_crl.c
910x_exten.o: ../../include/openssl/aes.h ../../include/openssl/asn1.h
911x_exten.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
912x_exten.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
913x_exten.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
914x_exten.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
915x_exten.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
916x_exten.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
917x_exten.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
918x_exten.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
919x_exten.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
920x_exten.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
921x_exten.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
922x_exten.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
923x_exten.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
924x_exten.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
925x_exten.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
926x_exten.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
927x_exten.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
928x_exten.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
929x_exten.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
930x_exten.o: x_exten.c
931x_info.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
932x_info.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
933x_info.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
934x_info.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
935x_info.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
936x_info.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
937x_info.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
938x_info.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
939x_info.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
940x_info.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
941x_info.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
942x_info.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
943x_info.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
944x_info.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
945x_info.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
946x_info.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
947x_info.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
948x_info.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
949x_info.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
950x_info.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
951x_info.o: ../cryptlib.h x_info.c
952x_long.o: ../../e_os.h ../../include/openssl/asn1.h
953x_long.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
954x_long.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
955x_long.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
956x_long.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
957x_long.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
958x_long.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
959x_long.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
960x_long.o: ../cryptlib.h x_long.c
961x_name.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
962x_name.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
963x_name.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
964x_name.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
965x_name.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
966x_name.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
967x_name.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
968x_name.o: ../../include/openssl/err.h ../../include/openssl/evp.h
969x_name.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
970x_name.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
971x_name.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
972x_name.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
973x_name.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
974x_name.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
975x_name.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
976x_name.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
977x_name.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
978x_name.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
979x_name.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
980x_name.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h
981x_name.o: ../../include/openssl/x509_vfy.h ../cryptlib.h x_name.c
982x_pkey.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
983x_pkey.o: ../../include/openssl/asn1_mac.h ../../include/openssl/bio.h
984x_pkey.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
985x_pkey.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
986x_pkey.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
987x_pkey.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
988x_pkey.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
989x_pkey.o: ../../include/openssl/err.h ../../include/openssl/evp.h
990x_pkey.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
991x_pkey.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
992x_pkey.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
993x_pkey.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
994x_pkey.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
995x_pkey.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
996x_pkey.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
997x_pkey.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
998x_pkey.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
999x_pkey.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
1000x_pkey.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
1001x_pkey.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h
1002x_pkey.o: ../../include/openssl/x509_vfy.h ../cryptlib.h x_pkey.c
1003x_pubkey.o: ../../e_os.h ../../include/openssl/aes.h
1004x_pubkey.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h
1005x_pubkey.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
1006x_pubkey.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
1007x_pubkey.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
1008x_pubkey.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
1009x_pubkey.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
1010x_pubkey.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
1011x_pubkey.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
1012x_pubkey.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
1013x_pubkey.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
1014x_pubkey.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
1015x_pubkey.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
1016x_pubkey.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
1017x_pubkey.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
1018x_pubkey.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
1019x_pubkey.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
1020x_pubkey.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
1021x_pubkey.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
1022x_pubkey.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
1023x_pubkey.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
1024x_pubkey.o: ../cryptlib.h x_pubkey.c
1025x_req.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
1026x_req.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
1027x_req.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
1028x_req.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
1029x_req.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
1030x_req.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
1031x_req.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
1032x_req.o: ../../include/openssl/err.h ../../include/openssl/evp.h
1033x_req.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
1034x_req.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
1035x_req.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
1036x_req.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
1037x_req.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
1038x_req.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
1039x_req.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
1040x_req.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
1041x_req.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
1042x_req.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
1043x_req.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
1044x_req.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h
1045x_req.o: ../../include/openssl/x509_vfy.h ../cryptlib.h x_req.c
1046x_sig.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
1047x_sig.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
1048x_sig.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
1049x_sig.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
1050x_sig.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
1051x_sig.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
1052x_sig.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
1053x_sig.o: ../../include/openssl/err.h ../../include/openssl/evp.h
1054x_sig.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
1055x_sig.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
1056x_sig.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
1057x_sig.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
1058x_sig.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
1059x_sig.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
1060x_sig.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
1061x_sig.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
1062x_sig.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
1063x_sig.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
1064x_sig.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
1065x_sig.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h
1066x_sig.o: ../../include/openssl/x509_vfy.h ../cryptlib.h x_sig.c
1067x_spki.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
1068x_spki.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
1069x_spki.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
1070x_spki.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
1071x_spki.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
1072x_spki.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
1073x_spki.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
1074x_spki.o: ../../include/openssl/err.h ../../include/openssl/evp.h
1075x_spki.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
1076x_spki.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
1077x_spki.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
1078x_spki.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
1079x_spki.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
1080x_spki.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
1081x_spki.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
1082x_spki.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
1083x_spki.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
1084x_spki.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
1085x_spki.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
1086x_spki.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h
1087x_spki.o: ../../include/openssl/x509_vfy.h ../cryptlib.h x_spki.c
1088x_val.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
1089x_val.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
1090x_val.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
1091x_val.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
1092x_val.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
1093x_val.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
1094x_val.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
1095x_val.o: ../../include/openssl/err.h ../../include/openssl/evp.h
1096x_val.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
1097x_val.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
1098x_val.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
1099x_val.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
1100x_val.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
1101x_val.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
1102x_val.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
1103x_val.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
1104x_val.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
1105x_val.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
1106x_val.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
1107x_val.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h
1108x_val.o: ../../include/openssl/x509_vfy.h ../cryptlib.h x_val.c
1109x_x509.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
1110x_x509.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
1111x_x509.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
1112x_x509.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
1113x_x509.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
1114x_x509.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
1115x_x509.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
1116x_x509.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
1117x_x509.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
1118x_x509.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
1119x_x509.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
1120x_x509.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
1121x_x509.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
1122x_x509.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
1123x_x509.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
1124x_x509.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
1125x_x509.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
1126x_x509.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
1127x_x509.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
1128x_x509.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
1129x_x509.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
1130x_x509.o: ../../include/openssl/x509v3.h ../cryptlib.h x_x509.c
1131x_x509a.o: ../../e_os.h ../../include/openssl/aes.h
1132x_x509a.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h
1133x_x509a.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
1134x_x509a.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
1135x_x509a.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
1136x_x509a.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
1137x_x509a.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
1138x_x509a.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
1139x_x509a.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
1140x_x509a.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
1141x_x509a.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
1142x_x509a.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
1143x_x509a.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
1144x_x509a.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
1145x_x509a.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
1146x_x509a.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
1147x_x509a.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
1148x_x509a.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
1149x_x509a.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
1150x_x509a.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
1151x_x509a.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
1152x_x509a.o: ../cryptlib.h x_x509a.c
diff --git a/src/lib/libcrypto/asn1/a_bytes.c b/src/lib/libcrypto/asn1/a_bytes.c
index afd27b80e1..2407f7c87a 100644
--- a/src/lib/libcrypto/asn1/a_bytes.c
+++ b/src/lib/libcrypto/asn1/a_bytes.c
@@ -78,7 +78,7 @@ ASN1_STRING *d2i_ASN1_type_bytes(ASN1_STRING **a, unsigned char **pp,
78 78
79 if (tag >= 32) 79 if (tag >= 32)
80 { 80 {
81 i=ASN1_R_TAG_VALUE_TOO_HIGH;; 81 i=ASN1_R_TAG_VALUE_TOO_HIGH;
82 goto err; 82 goto err;
83 } 83 }
84 if (!(ASN1_tag2bit(tag) & type)) 84 if (!(ASN1_tag2bit(tag) & type))
diff --git a/src/lib/libcrypto/asn1/a_gentm.c b/src/lib/libcrypto/asn1/a_gentm.c
new file mode 100644
index 0000000000..0dfd576211
--- /dev/null
+++ b/src/lib/libcrypto/asn1/a_gentm.c
@@ -0,0 +1,246 @@
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 int min[9]={ 0, 0, 1, 1, 0, 0, 0, 0, 0};
121 static 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 return(o == l);
180err:
181 return(0);
182 }
183
184int ASN1_GENERALIZEDTIME_set_string(ASN1_GENERALIZEDTIME *s, char *str)
185 {
186 ASN1_GENERALIZEDTIME t;
187
188 t.type=V_ASN1_GENERALIZEDTIME;
189 t.length=strlen(str);
190 t.data=(unsigned char *)str;
191 if (ASN1_GENERALIZEDTIME_check(&t))
192 {
193 if (s != NULL)
194 {
195 if (!ASN1_STRING_set((ASN1_STRING *)s,
196 (unsigned char *)str,t.length))
197 return 0;
198 s->type=V_ASN1_GENERALIZEDTIME;
199 }
200 return(1);
201 }
202 else
203 return(0);
204 }
205
206ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_set(ASN1_GENERALIZEDTIME *s,
207 time_t t)
208 {
209 char *p;
210 struct tm *ts;
211 struct tm data;
212 size_t len = 20;
213
214 if (s == NULL)
215 s=M_ASN1_GENERALIZEDTIME_new();
216 if (s == NULL)
217 return(NULL);
218
219 ts=OPENSSL_gmtime(&t, &data);
220 if (ts == NULL)
221 return(NULL);
222
223 p=(char *)s->data;
224 if ((p == NULL) || ((size_t)s->length < len))
225 {
226 p=OPENSSL_malloc(len);
227 if (p == NULL)
228 {
229 ASN1err(ASN1_F_ASN1_GENERALIZEDTIME_SET,
230 ERR_R_MALLOC_FAILURE);
231 return(NULL);
232 }
233 if (s->data != NULL)
234 OPENSSL_free(s->data);
235 s->data=(unsigned char *)p;
236 }
237
238 BIO_snprintf(p,len,"%04d%02d%02d%02d%02d%02dZ",ts->tm_year + 1900,
239 ts->tm_mon+1,ts->tm_mday,ts->tm_hour,ts->tm_min,ts->tm_sec);
240 s->length=strlen(p);
241 s->type=V_ASN1_GENERALIZEDTIME;
242#ifdef CHARSET_EBCDIC_not
243 ebcdic2ascii(s->data, s->data, s->length);
244#endif
245 return(s);
246 }
diff --git a/src/lib/libcrypto/asn1/a_hdr.c b/src/lib/libcrypto/asn1/a_hdr.c
new file mode 100644
index 0000000000..b1aad81f77
--- /dev/null
+++ b/src/lib/libcrypto/asn1/a_hdr.c
@@ -0,0 +1,119 @@
1/* crypto/asn1/a_hdr.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/asn1_mac.h>
62#include <openssl/asn1.h>
63
64int i2d_ASN1_HEADER(ASN1_HEADER *a, unsigned char **pp)
65 {
66 M_ASN1_I2D_vars(a);
67
68 M_ASN1_I2D_len(a->header, i2d_ASN1_OCTET_STRING);
69 M_ASN1_I2D_len(a->data, a->meth->i2d);
70
71 M_ASN1_I2D_seq_total();
72
73 M_ASN1_I2D_put(a->header, i2d_ASN1_OCTET_STRING);
74 M_ASN1_I2D_put(a->data, a->meth->i2d);
75
76 M_ASN1_I2D_finish();
77 }
78
79ASN1_HEADER *d2i_ASN1_HEADER(ASN1_HEADER **a, unsigned char **pp,
80 long length)
81 {
82 M_ASN1_D2I_vars(a,ASN1_HEADER *,ASN1_HEADER_new);
83
84 M_ASN1_D2I_Init();
85 M_ASN1_D2I_start_sequence();
86 M_ASN1_D2I_get(ret->header,d2i_ASN1_OCTET_STRING);
87 if (ret->meth != NULL)
88 {
89 M_ASN1_D2I_get(ret->data,ret->meth->d2i);
90 }
91 else
92 {
93 if (a != NULL) (*a)=ret;
94 return(ret);
95 }
96 M_ASN1_D2I_Finish(a,ASN1_HEADER_free,ASN1_F_D2I_ASN1_HEADER);
97 }
98
99ASN1_HEADER *ASN1_HEADER_new(void)
100 {
101 ASN1_HEADER *ret=NULL;
102 ASN1_CTX c;
103
104 M_ASN1_New_Malloc(ret,ASN1_HEADER);
105 M_ASN1_New(ret->header,M_ASN1_OCTET_STRING_new);
106 ret->meth=NULL;
107 ret->data=NULL;
108 return(ret);
109 M_ASN1_New_Error(ASN1_F_ASN1_HEADER_NEW);
110 }
111
112void ASN1_HEADER_free(ASN1_HEADER *a)
113 {
114 if (a == NULL) return;
115 M_ASN1_OCTET_STRING_free(a->header);
116 if (a->meth != NULL)
117 a->meth->destroy(a->data);
118 OPENSSL_free(a);
119 }
diff --git a/src/lib/libcrypto/asn1/a_meth.c b/src/lib/libcrypto/asn1/a_meth.c
new file mode 100644
index 0000000000..63158e9cab
--- /dev/null
+++ b/src/lib/libcrypto/asn1/a_meth.c
@@ -0,0 +1,84 @@
1/* crypto/asn1/a_meth.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/buffer.h>
62#include <openssl/asn1.h>
63
64static ASN1_METHOD ia5string_meth={
65 (int (*)()) i2d_ASN1_IA5STRING,
66 (char *(*)()) d2i_ASN1_IA5STRING,
67 (char *(*)()) ASN1_STRING_new,
68 (void (*)()) ASN1_STRING_free};
69
70static ASN1_METHOD bit_string_meth={
71 (int (*)()) i2d_ASN1_BIT_STRING,
72 (char *(*)()) d2i_ASN1_BIT_STRING,
73 (char *(*)()) ASN1_STRING_new,
74 (void (*)()) ASN1_STRING_free};
75
76ASN1_METHOD *ASN1_IA5STRING_asn1_meth(void)
77 {
78 return(&ia5string_meth);
79 }
80
81ASN1_METHOD *ASN1_BIT_STRING_asn1_meth(void)
82 {
83 return(&bit_string_meth);
84 }
diff --git a/src/lib/libcrypto/asn1/a_utctm.c b/src/lib/libcrypto/asn1/a_utctm.c
new file mode 100644
index 0000000000..7b25fed331
--- /dev/null
+++ b/src/lib/libcrypto/asn1/a_utctm.c
@@ -0,0 +1,303 @@
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 int min[8]={ 0, 1, 1, 0, 0, 0, 0, 0};
118 static 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, 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 char *p;
190 struct tm *ts;
191 struct tm data;
192 size_t len = 20;
193
194 if (s == NULL)
195 s=M_ASN1_UTCTIME_new();
196 if (s == NULL)
197 return(NULL);
198
199 ts=OPENSSL_gmtime(&t, &data);
200 if (ts == NULL)
201 return(NULL);
202
203 p=(char *)s->data;
204 if ((p == NULL) || ((size_t)s->length < len))
205 {
206 p=OPENSSL_malloc(len);
207 if (p == NULL)
208 {
209 ASN1err(ASN1_F_ASN1_UTCTIME_SET,ERR_R_MALLOC_FAILURE);
210 return(NULL);
211 }
212 if (s->data != NULL)
213 OPENSSL_free(s->data);
214 s->data=(unsigned char *)p;
215 }
216
217 BIO_snprintf(p,len,"%02d%02d%02d%02d%02d%02dZ",ts->tm_year%100,
218 ts->tm_mon+1,ts->tm_mday,ts->tm_hour,ts->tm_min,ts->tm_sec);
219 s->length=strlen(p);
220 s->type=V_ASN1_UTCTIME;
221#ifdef CHARSET_EBCDIC_not
222 ebcdic2ascii(s->data, s->data, s->length);
223#endif
224 return(s);
225 }
226
227
228int ASN1_UTCTIME_cmp_time_t(const ASN1_UTCTIME *s, time_t t)
229 {
230 struct tm *tm;
231 struct tm data;
232 int offset;
233 int year;
234
235#define g2(p) (((p)[0]-'0')*10+(p)[1]-'0')
236
237 if (s->data[12] == 'Z')
238 offset=0;
239 else
240 {
241 offset = g2(s->data+13)*60+g2(s->data+15);
242 if (s->data[12] == '-')
243 offset = -offset;
244 }
245
246 t -= offset*60; /* FIXME: may overflow in extreme cases */
247
248 tm = OPENSSL_gmtime(&t, &data);
249
250#define return_cmp(a,b) if ((a)<(b)) return -1; else if ((a)>(b)) return 1
251 year = g2(s->data);
252 if (year < 50)
253 year += 100;
254 return_cmp(year, tm->tm_year);
255 return_cmp(g2(s->data+2) - 1, tm->tm_mon);
256 return_cmp(g2(s->data+4), tm->tm_mday);
257 return_cmp(g2(s->data+6), tm->tm_hour);
258 return_cmp(g2(s->data+8), tm->tm_min);
259 return_cmp(g2(s->data+10), tm->tm_sec);
260#undef g2
261#undef return_cmp
262
263 return 0;
264 }
265
266
267#if 0
268time_t ASN1_UTCTIME_get(const ASN1_UTCTIME *s)
269 {
270 struct tm tm;
271 int offset;
272
273 memset(&tm,'\0',sizeof tm);
274
275#define g2(p) (((p)[0]-'0')*10+(p)[1]-'0')
276 tm.tm_year=g2(s->data);
277 if(tm.tm_year < 50)
278 tm.tm_year+=100;
279 tm.tm_mon=g2(s->data+2)-1;
280 tm.tm_mday=g2(s->data+4);
281 tm.tm_hour=g2(s->data+6);
282 tm.tm_min=g2(s->data+8);
283 tm.tm_sec=g2(s->data+10);
284 if(s->data[12] == 'Z')
285 offset=0;
286 else
287 {
288 offset=g2(s->data+13)*60+g2(s->data+15);
289 if(s->data[12] == '-')
290 offset= -offset;
291 }
292#undef g2
293
294 return mktime(&tm)-offset*60; /* FIXME: mktime assumes the current timezone
295 * instead of UTC, and unless we rewrite OpenSSL
296 * in Lisp we cannot locally change the timezone
297 * without possibly interfering with other parts
298 * of the program. timegm, which uses UTC, is
299 * non-standard.
300 * Also time_t is inappropriate for general
301 * UTC times because it may a 32 bit type. */
302 }
303#endif
diff --git a/src/lib/libcrypto/asn1/asn1.h b/src/lib/libcrypto/asn1/asn1.h
index 0184b475a7..ceaeb4cbe3 100644
--- a/src/lib/libcrypto/asn1/asn1.h
+++ b/src/lib/libcrypto/asn1/asn1.h
@@ -962,7 +962,6 @@ void ERR_load_ASN1_strings(void);
962#define ASN1_F_ASN1_DUP 111 962#define ASN1_F_ASN1_DUP 111
963#define ASN1_F_ASN1_ENUMERATED_SET 112 963#define ASN1_F_ASN1_ENUMERATED_SET 112
964#define ASN1_F_ASN1_ENUMERATED_TO_BN 113 964#define ASN1_F_ASN1_ENUMERATED_TO_BN 113
965#define ASN1_F_ASN1_FIND_END 182
966#define ASN1_F_ASN1_GENERALIZEDTIME_SET 178 965#define ASN1_F_ASN1_GENERALIZEDTIME_SET 178
967#define ASN1_F_ASN1_GET_OBJECT 114 966#define ASN1_F_ASN1_GET_OBJECT 114
968#define ASN1_F_ASN1_HEADER_NEW 115 967#define ASN1_F_ASN1_HEADER_NEW 115
@@ -1076,7 +1075,6 @@ void ERR_load_ASN1_strings(void);
1076#define ASN1_R_MISSING_SECOND_NUMBER 138 1075#define ASN1_R_MISSING_SECOND_NUMBER 138
1077#define ASN1_R_MSTRING_NOT_UNIVERSAL 139 1076#define ASN1_R_MSTRING_NOT_UNIVERSAL 139
1078#define ASN1_R_MSTRING_WRONG_TAG 140 1077#define ASN1_R_MSTRING_WRONG_TAG 140
1079#define ASN1_R_NESTED_ASN1_STRING 174
1080#define ASN1_R_NON_HEX_CHARACTERS 141 1078#define ASN1_R_NON_HEX_CHARACTERS 141
1081#define ASN1_R_NOT_ENOUGH_DATA 142 1079#define ASN1_R_NOT_ENOUGH_DATA 142
1082#define ASN1_R_NO_MATCHING_CHOICE_TYPE 143 1080#define ASN1_R_NO_MATCHING_CHOICE_TYPE 143
diff --git a/src/lib/libcrypto/asn1/asn1_err.c b/src/lib/libcrypto/asn1/asn1_err.c
index 315d0a0807..3b57c8fbae 100644
--- a/src/lib/libcrypto/asn1/asn1_err.c
+++ b/src/lib/libcrypto/asn1/asn1_err.c
@@ -1,6 +1,6 @@
1/* crypto/asn1/asn1_err.c */ 1/* crypto/asn1/asn1_err.c */
2/* ==================================================================== 2/* ====================================================================
3 * Copyright (c) 1999-2005 The OpenSSL Project. All rights reserved. 3 * Copyright (c) 1999-2004 The OpenSSL Project. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
@@ -64,175 +64,169 @@
64 64
65/* BEGIN ERROR CODES */ 65/* BEGIN ERROR CODES */
66#ifndef OPENSSL_NO_ERR 66#ifndef OPENSSL_NO_ERR
67
68#define ERR_FUNC(func) ERR_PACK(ERR_LIB_ASN1,func,0)
69#define ERR_REASON(reason) ERR_PACK(ERR_LIB_ASN1,0,reason)
70
71static ERR_STRING_DATA ASN1_str_functs[]= 67static ERR_STRING_DATA ASN1_str_functs[]=
72 { 68 {
73{ERR_FUNC(ASN1_F_A2D_ASN1_OBJECT), "a2d_ASN1_OBJECT"}, 69{ERR_PACK(0,ASN1_F_A2D_ASN1_OBJECT,0), "a2d_ASN1_OBJECT"},
74{ERR_FUNC(ASN1_F_A2I_ASN1_ENUMERATED), "a2i_ASN1_ENUMERATED"}, 70{ERR_PACK(0,ASN1_F_A2I_ASN1_ENUMERATED,0), "a2i_ASN1_ENUMERATED"},
75{ERR_FUNC(ASN1_F_A2I_ASN1_INTEGER), "a2i_ASN1_INTEGER"}, 71{ERR_PACK(0,ASN1_F_A2I_ASN1_INTEGER,0), "a2i_ASN1_INTEGER"},
76{ERR_FUNC(ASN1_F_A2I_ASN1_STRING), "a2i_ASN1_STRING"}, 72{ERR_PACK(0,ASN1_F_A2I_ASN1_STRING,0), "a2i_ASN1_STRING"},
77{ERR_FUNC(ASN1_F_ASN1_BIT_STRING_SET_BIT), "ASN1_BIT_STRING_set_bit"}, 73{ERR_PACK(0,ASN1_F_ASN1_BIT_STRING_SET_BIT,0), "ASN1_BIT_STRING_set_bit"},
78{ERR_FUNC(ASN1_F_ASN1_CHECK_TLEN), "ASN1_CHECK_TLEN"}, 74{ERR_PACK(0,ASN1_F_ASN1_CHECK_TLEN,0), "ASN1_CHECK_TLEN"},
79{ERR_FUNC(ASN1_F_ASN1_COLLATE_PRIMITIVE), "ASN1_COLLATE_PRIMITIVE"}, 75{ERR_PACK(0,ASN1_F_ASN1_COLLATE_PRIMITIVE,0), "ASN1_COLLATE_PRIMITIVE"},
80{ERR_FUNC(ASN1_F_ASN1_COLLECT), "ASN1_COLLECT"}, 76{ERR_PACK(0,ASN1_F_ASN1_COLLECT,0), "ASN1_COLLECT"},
81{ERR_FUNC(ASN1_F_ASN1_D2I_BIO), "ASN1_d2i_bio"}, 77{ERR_PACK(0,ASN1_F_ASN1_D2I_BIO,0), "ASN1_d2i_bio"},
82{ERR_FUNC(ASN1_F_ASN1_D2I_EX_PRIMITIVE), "ASN1_D2I_EX_PRIMITIVE"}, 78{ERR_PACK(0,ASN1_F_ASN1_D2I_EX_PRIMITIVE,0), "ASN1_D2I_EX_PRIMITIVE"},
83{ERR_FUNC(ASN1_F_ASN1_D2I_FP), "ASN1_d2i_fp"}, 79{ERR_PACK(0,ASN1_F_ASN1_D2I_FP,0), "ASN1_d2i_fp"},
84{ERR_FUNC(ASN1_F_ASN1_DIGEST), "ASN1_digest"}, 80{ERR_PACK(0,ASN1_F_ASN1_DIGEST,0), "ASN1_digest"},
85{ERR_FUNC(ASN1_F_ASN1_DO_ADB), "ASN1_DO_ADB"}, 81{ERR_PACK(0,ASN1_F_ASN1_DO_ADB,0), "ASN1_DO_ADB"},
86{ERR_FUNC(ASN1_F_ASN1_DUP), "ASN1_dup"}, 82{ERR_PACK(0,ASN1_F_ASN1_DUP,0), "ASN1_dup"},
87{ERR_FUNC(ASN1_F_ASN1_ENUMERATED_SET), "ASN1_ENUMERATED_set"}, 83{ERR_PACK(0,ASN1_F_ASN1_ENUMERATED_SET,0), "ASN1_ENUMERATED_set"},
88{ERR_FUNC(ASN1_F_ASN1_ENUMERATED_TO_BN), "ASN1_ENUMERATED_to_BN"}, 84{ERR_PACK(0,ASN1_F_ASN1_ENUMERATED_TO_BN,0), "ASN1_ENUMERATED_to_BN"},
89{ERR_FUNC(ASN1_F_ASN1_FIND_END), "ASN1_FIND_END"}, 85{ERR_PACK(0,ASN1_F_ASN1_GENERALIZEDTIME_SET,0), "ASN1_GENERALIZEDTIME_set"},
90{ERR_FUNC(ASN1_F_ASN1_GENERALIZEDTIME_SET), "ASN1_GENERALIZEDTIME_set"}, 86{ERR_PACK(0,ASN1_F_ASN1_GET_OBJECT,0), "ASN1_get_object"},
91{ERR_FUNC(ASN1_F_ASN1_GET_OBJECT), "ASN1_get_object"}, 87{ERR_PACK(0,ASN1_F_ASN1_HEADER_NEW,0), "ASN1_HEADER_new"},
92{ERR_FUNC(ASN1_F_ASN1_HEADER_NEW), "ASN1_HEADER_new"}, 88{ERR_PACK(0,ASN1_F_ASN1_I2D_BIO,0), "ASN1_i2d_bio"},
93{ERR_FUNC(ASN1_F_ASN1_I2D_BIO), "ASN1_i2d_bio"}, 89{ERR_PACK(0,ASN1_F_ASN1_I2D_FP,0), "ASN1_i2d_fp"},
94{ERR_FUNC(ASN1_F_ASN1_I2D_FP), "ASN1_i2d_fp"}, 90{ERR_PACK(0,ASN1_F_ASN1_INTEGER_SET,0), "ASN1_INTEGER_set"},
95{ERR_FUNC(ASN1_F_ASN1_INTEGER_SET), "ASN1_INTEGER_set"}, 91{ERR_PACK(0,ASN1_F_ASN1_INTEGER_TO_BN,0), "ASN1_INTEGER_to_BN"},
96{ERR_FUNC(ASN1_F_ASN1_INTEGER_TO_BN), "ASN1_INTEGER_to_BN"}, 92{ERR_PACK(0,ASN1_F_ASN1_ITEM_EX_D2I,0), "ASN1_ITEM_EX_D2I"},
97{ERR_FUNC(ASN1_F_ASN1_ITEM_EX_D2I), "ASN1_ITEM_EX_D2I"}, 93{ERR_PACK(0,ASN1_F_ASN1_ITEM_NEW,0), "ASN1_item_new"},
98{ERR_FUNC(ASN1_F_ASN1_ITEM_NEW), "ASN1_item_new"}, 94{ERR_PACK(0,ASN1_F_ASN1_MBSTRING_COPY,0), "ASN1_mbstring_copy"},
99{ERR_FUNC(ASN1_F_ASN1_MBSTRING_COPY), "ASN1_mbstring_copy"}, 95{ERR_PACK(0,ASN1_F_ASN1_OBJECT_NEW,0), "ASN1_OBJECT_new"},
100{ERR_FUNC(ASN1_F_ASN1_OBJECT_NEW), "ASN1_OBJECT_new"}, 96{ERR_PACK(0,ASN1_F_ASN1_PACK_STRING,0), "ASN1_pack_string"},
101{ERR_FUNC(ASN1_F_ASN1_PACK_STRING), "ASN1_pack_string"}, 97{ERR_PACK(0,ASN1_F_ASN1_PBE_SET,0), "ASN1_PBE_SET"},
102{ERR_FUNC(ASN1_F_ASN1_PBE_SET), "ASN1_PBE_SET"}, 98{ERR_PACK(0,ASN1_F_ASN1_SEQ_PACK,0), "ASN1_seq_pack"},
103{ERR_FUNC(ASN1_F_ASN1_SEQ_PACK), "ASN1_seq_pack"}, 99{ERR_PACK(0,ASN1_F_ASN1_SEQ_UNPACK,0), "ASN1_seq_unpack"},
104{ERR_FUNC(ASN1_F_ASN1_SEQ_UNPACK), "ASN1_seq_unpack"}, 100{ERR_PACK(0,ASN1_F_ASN1_SIGN,0), "ASN1_sign"},
105{ERR_FUNC(ASN1_F_ASN1_SIGN), "ASN1_sign"}, 101{ERR_PACK(0,ASN1_F_ASN1_STRING_SET,0), "ASN1_STRING_set"},
106{ERR_FUNC(ASN1_F_ASN1_STRING_SET), "ASN1_STRING_set"}, 102{ERR_PACK(0,ASN1_F_ASN1_STRING_TABLE_ADD,0), "ASN1_STRING_TABLE_add"},
107{ERR_FUNC(ASN1_F_ASN1_STRING_TABLE_ADD), "ASN1_STRING_TABLE_add"}, 103{ERR_PACK(0,ASN1_F_ASN1_STRING_TYPE_NEW,0), "ASN1_STRING_type_new"},
108{ERR_FUNC(ASN1_F_ASN1_STRING_TYPE_NEW), "ASN1_STRING_type_new"}, 104{ERR_PACK(0,ASN1_F_ASN1_TEMPLATE_D2I,0), "ASN1_TEMPLATE_D2I"},
109{ERR_FUNC(ASN1_F_ASN1_TEMPLATE_D2I), "ASN1_TEMPLATE_D2I"}, 105{ERR_PACK(0,ASN1_F_ASN1_TEMPLATE_EX_D2I,0), "ASN1_TEMPLATE_EX_D2I"},
110{ERR_FUNC(ASN1_F_ASN1_TEMPLATE_EX_D2I), "ASN1_TEMPLATE_EX_D2I"}, 106{ERR_PACK(0,ASN1_F_ASN1_TEMPLATE_NEW,0), "ASN1_TEMPLATE_NEW"},
111{ERR_FUNC(ASN1_F_ASN1_TEMPLATE_NEW), "ASN1_TEMPLATE_NEW"}, 107{ERR_PACK(0,ASN1_F_ASN1_TIME_SET,0), "ASN1_TIME_set"},
112{ERR_FUNC(ASN1_F_ASN1_TIME_SET), "ASN1_TIME_set"}, 108{ERR_PACK(0,ASN1_F_ASN1_TYPE_GET_INT_OCTETSTRING,0), "ASN1_TYPE_get_int_octetstring"},
113{ERR_FUNC(ASN1_F_ASN1_TYPE_GET_INT_OCTETSTRING), "ASN1_TYPE_get_int_octetstring"}, 109{ERR_PACK(0,ASN1_F_ASN1_TYPE_GET_OCTETSTRING,0), "ASN1_TYPE_get_octetstring"},
114{ERR_FUNC(ASN1_F_ASN1_TYPE_GET_OCTETSTRING), "ASN1_TYPE_get_octetstring"}, 110{ERR_PACK(0,ASN1_F_ASN1_UNPACK_STRING,0), "ASN1_unpack_string"},
115{ERR_FUNC(ASN1_F_ASN1_UNPACK_STRING), "ASN1_unpack_string"}, 111{ERR_PACK(0,ASN1_F_ASN1_UTCTIME_SET,0), "ASN1_UTCTIME_set"},
116{ERR_FUNC(ASN1_F_ASN1_UTCTIME_SET), "ASN1_UTCTIME_set"}, 112{ERR_PACK(0,ASN1_F_ASN1_VERIFY,0), "ASN1_verify"},
117{ERR_FUNC(ASN1_F_ASN1_VERIFY), "ASN1_verify"}, 113{ERR_PACK(0,ASN1_F_BN_TO_ASN1_ENUMERATED,0), "BN_to_ASN1_ENUMERATED"},
118{ERR_FUNC(ASN1_F_BN_TO_ASN1_ENUMERATED), "BN_to_ASN1_ENUMERATED"}, 114{ERR_PACK(0,ASN1_F_BN_TO_ASN1_INTEGER,0), "BN_to_ASN1_INTEGER"},
119{ERR_FUNC(ASN1_F_BN_TO_ASN1_INTEGER), "BN_to_ASN1_INTEGER"}, 115{ERR_PACK(0,ASN1_F_COLLECT_DATA,0), "COLLECT_DATA"},
120{ERR_FUNC(ASN1_F_COLLECT_DATA), "COLLECT_DATA"}, 116{ERR_PACK(0,ASN1_F_D2I_ASN1_BIT_STRING,0), "D2I_ASN1_BIT_STRING"},
121{ERR_FUNC(ASN1_F_D2I_ASN1_BIT_STRING), "D2I_ASN1_BIT_STRING"}, 117{ERR_PACK(0,ASN1_F_D2I_ASN1_BOOLEAN,0), "d2i_ASN1_BOOLEAN"},
122{ERR_FUNC(ASN1_F_D2I_ASN1_BOOLEAN), "d2i_ASN1_BOOLEAN"}, 118{ERR_PACK(0,ASN1_F_D2I_ASN1_BYTES,0), "d2i_ASN1_bytes"},
123{ERR_FUNC(ASN1_F_D2I_ASN1_BYTES), "d2i_ASN1_bytes"}, 119{ERR_PACK(0,ASN1_F_D2I_ASN1_GENERALIZEDTIME,0), "D2I_ASN1_GENERALIZEDTIME"},
124{ERR_FUNC(ASN1_F_D2I_ASN1_GENERALIZEDTIME), "D2I_ASN1_GENERALIZEDTIME"}, 120{ERR_PACK(0,ASN1_F_D2I_ASN1_HEADER,0), "d2i_ASN1_HEADER"},
125{ERR_FUNC(ASN1_F_D2I_ASN1_HEADER), "d2i_ASN1_HEADER"}, 121{ERR_PACK(0,ASN1_F_D2I_ASN1_INTEGER,0), "D2I_ASN1_INTEGER"},
126{ERR_FUNC(ASN1_F_D2I_ASN1_INTEGER), "D2I_ASN1_INTEGER"}, 122{ERR_PACK(0,ASN1_F_D2I_ASN1_OBJECT,0), "d2i_ASN1_OBJECT"},
127{ERR_FUNC(ASN1_F_D2I_ASN1_OBJECT), "d2i_ASN1_OBJECT"}, 123{ERR_PACK(0,ASN1_F_D2I_ASN1_SET,0), "d2i_ASN1_SET"},
128{ERR_FUNC(ASN1_F_D2I_ASN1_SET), "d2i_ASN1_SET"}, 124{ERR_PACK(0,ASN1_F_D2I_ASN1_TYPE_BYTES,0), "d2i_ASN1_type_bytes"},
129{ERR_FUNC(ASN1_F_D2I_ASN1_TYPE_BYTES), "d2i_ASN1_type_bytes"}, 125{ERR_PACK(0,ASN1_F_D2I_ASN1_UINTEGER,0), "d2i_ASN1_UINTEGER"},
130{ERR_FUNC(ASN1_F_D2I_ASN1_UINTEGER), "d2i_ASN1_UINTEGER"}, 126{ERR_PACK(0,ASN1_F_D2I_ASN1_UTCTIME,0), "D2I_ASN1_UTCTIME"},
131{ERR_FUNC(ASN1_F_D2I_ASN1_UTCTIME), "D2I_ASN1_UTCTIME"}, 127{ERR_PACK(0,ASN1_F_D2I_NETSCAPE_RSA,0), "d2i_Netscape_RSA"},
132{ERR_FUNC(ASN1_F_D2I_NETSCAPE_RSA), "d2i_Netscape_RSA"}, 128{ERR_PACK(0,ASN1_F_D2I_NETSCAPE_RSA_2,0), "D2I_NETSCAPE_RSA_2"},
133{ERR_FUNC(ASN1_F_D2I_NETSCAPE_RSA_2), "D2I_NETSCAPE_RSA_2"}, 129{ERR_PACK(0,ASN1_F_D2I_PRIVATEKEY,0), "d2i_PrivateKey"},
134{ERR_FUNC(ASN1_F_D2I_PRIVATEKEY), "d2i_PrivateKey"}, 130{ERR_PACK(0,ASN1_F_D2I_PUBLICKEY,0), "d2i_PublicKey"},
135{ERR_FUNC(ASN1_F_D2I_PUBLICKEY), "d2i_PublicKey"}, 131{ERR_PACK(0,ASN1_F_D2I_X509,0), "D2I_X509"},
136{ERR_FUNC(ASN1_F_D2I_X509), "D2I_X509"}, 132{ERR_PACK(0,ASN1_F_D2I_X509_CINF,0), "D2I_X509_CINF"},
137{ERR_FUNC(ASN1_F_D2I_X509_CINF), "D2I_X509_CINF"}, 133{ERR_PACK(0,ASN1_F_D2I_X509_NAME,0), "D2I_X509_NAME"},
138{ERR_FUNC(ASN1_F_D2I_X509_NAME), "D2I_X509_NAME"}, 134{ERR_PACK(0,ASN1_F_D2I_X509_PKEY,0), "d2i_X509_PKEY"},
139{ERR_FUNC(ASN1_F_D2I_X509_PKEY), "d2i_X509_PKEY"}, 135{ERR_PACK(0,ASN1_F_I2D_ASN1_SET,0), "i2d_ASN1_SET"},
140{ERR_FUNC(ASN1_F_I2D_ASN1_SET), "i2d_ASN1_SET"}, 136{ERR_PACK(0,ASN1_F_I2D_ASN1_TIME,0), "I2D_ASN1_TIME"},
141{ERR_FUNC(ASN1_F_I2D_ASN1_TIME), "I2D_ASN1_TIME"}, 137{ERR_PACK(0,ASN1_F_I2D_DSA_PUBKEY,0), "i2d_DSA_PUBKEY"},
142{ERR_FUNC(ASN1_F_I2D_DSA_PUBKEY), "i2d_DSA_PUBKEY"}, 138{ERR_PACK(0,ASN1_F_I2D_NETSCAPE_RSA,0), "i2d_Netscape_RSA"},
143{ERR_FUNC(ASN1_F_I2D_NETSCAPE_RSA), "i2d_Netscape_RSA"}, 139{ERR_PACK(0,ASN1_F_I2D_PRIVATEKEY,0), "i2d_PrivateKey"},
144{ERR_FUNC(ASN1_F_I2D_PRIVATEKEY), "i2d_PrivateKey"}, 140{ERR_PACK(0,ASN1_F_I2D_PUBLICKEY,0), "i2d_PublicKey"},
145{ERR_FUNC(ASN1_F_I2D_PUBLICKEY), "i2d_PublicKey"}, 141{ERR_PACK(0,ASN1_F_I2D_RSA_PUBKEY,0), "i2d_RSA_PUBKEY"},
146{ERR_FUNC(ASN1_F_I2D_RSA_PUBKEY), "i2d_RSA_PUBKEY"}, 142{ERR_PACK(0,ASN1_F_LONG_C2I,0), "LONG_C2I"},
147{ERR_FUNC(ASN1_F_LONG_C2I), "LONG_C2I"}, 143{ERR_PACK(0,ASN1_F_OID_MODULE_INIT,0), "OID_MODULE_INIT"},
148{ERR_FUNC(ASN1_F_OID_MODULE_INIT), "OID_MODULE_INIT"}, 144{ERR_PACK(0,ASN1_F_PKCS5_PBE2_SET,0), "PKCS5_pbe2_set"},
149{ERR_FUNC(ASN1_F_PKCS5_PBE2_SET), "PKCS5_pbe2_set"}, 145{ERR_PACK(0,ASN1_F_X509_CINF_NEW,0), "X509_CINF_NEW"},
150{ERR_FUNC(ASN1_F_X509_CINF_NEW), "X509_CINF_NEW"}, 146{ERR_PACK(0,ASN1_F_X509_CRL_ADD0_REVOKED,0), "X509_CRL_add0_revoked"},
151{ERR_FUNC(ASN1_F_X509_CRL_ADD0_REVOKED), "X509_CRL_add0_revoked"}, 147{ERR_PACK(0,ASN1_F_X509_INFO_NEW,0), "X509_INFO_new"},
152{ERR_FUNC(ASN1_F_X509_INFO_NEW), "X509_INFO_new"}, 148{ERR_PACK(0,ASN1_F_X509_NAME_NEW,0), "X509_NAME_NEW"},
153{ERR_FUNC(ASN1_F_X509_NAME_NEW), "X509_NAME_NEW"}, 149{ERR_PACK(0,ASN1_F_X509_NEW,0), "X509_NEW"},
154{ERR_FUNC(ASN1_F_X509_NEW), "X509_NEW"}, 150{ERR_PACK(0,ASN1_F_X509_PKEY_NEW,0), "X509_PKEY_new"},
155{ERR_FUNC(ASN1_F_X509_PKEY_NEW), "X509_PKEY_new"},
156{0,NULL} 151{0,NULL}
157 }; 152 };
158 153
159static ERR_STRING_DATA ASN1_str_reasons[]= 154static ERR_STRING_DATA ASN1_str_reasons[]=
160 { 155 {
161{ERR_REASON(ASN1_R_ADDING_OBJECT) ,"adding object"}, 156{ASN1_R_ADDING_OBJECT ,"adding object"},
162{ERR_REASON(ASN1_R_AUX_ERROR) ,"aux error"}, 157{ASN1_R_AUX_ERROR ,"aux error"},
163{ERR_REASON(ASN1_R_BAD_CLASS) ,"bad class"}, 158{ASN1_R_BAD_CLASS ,"bad class"},
164{ERR_REASON(ASN1_R_BAD_OBJECT_HEADER) ,"bad object header"}, 159{ASN1_R_BAD_OBJECT_HEADER ,"bad object header"},
165{ERR_REASON(ASN1_R_BAD_PASSWORD_READ) ,"bad password read"}, 160{ASN1_R_BAD_PASSWORD_READ ,"bad password read"},
166{ERR_REASON(ASN1_R_BAD_TAG) ,"bad tag"}, 161{ASN1_R_BAD_TAG ,"bad tag"},
167{ERR_REASON(ASN1_R_BN_LIB) ,"bn lib"}, 162{ASN1_R_BN_LIB ,"bn lib"},
168{ERR_REASON(ASN1_R_BOOLEAN_IS_WRONG_LENGTH),"boolean is wrong length"}, 163{ASN1_R_BOOLEAN_IS_WRONG_LENGTH ,"boolean is wrong length"},
169{ERR_REASON(ASN1_R_BUFFER_TOO_SMALL) ,"buffer too small"}, 164{ASN1_R_BUFFER_TOO_SMALL ,"buffer too small"},
170{ERR_REASON(ASN1_R_CIPHER_HAS_NO_OBJECT_IDENTIFIER),"cipher has no object identifier"}, 165{ASN1_R_CIPHER_HAS_NO_OBJECT_IDENTIFIER ,"cipher has no object identifier"},
171{ERR_REASON(ASN1_R_DATA_IS_WRONG) ,"data is wrong"}, 166{ASN1_R_DATA_IS_WRONG ,"data is wrong"},
172{ERR_REASON(ASN1_R_DECODE_ERROR) ,"decode error"}, 167{ASN1_R_DECODE_ERROR ,"decode error"},
173{ERR_REASON(ASN1_R_DECODING_ERROR) ,"decoding error"}, 168{ASN1_R_DECODING_ERROR ,"decoding error"},
174{ERR_REASON(ASN1_R_ENCODE_ERROR) ,"encode error"}, 169{ASN1_R_ENCODE_ERROR ,"encode error"},
175{ERR_REASON(ASN1_R_ERROR_GETTING_TIME) ,"error getting time"}, 170{ASN1_R_ERROR_GETTING_TIME ,"error getting time"},
176{ERR_REASON(ASN1_R_ERROR_LOADING_SECTION),"error loading section"}, 171{ASN1_R_ERROR_LOADING_SECTION ,"error loading section"},
177{ERR_REASON(ASN1_R_ERROR_PARSING_SET_ELEMENT),"error parsing set element"}, 172{ASN1_R_ERROR_PARSING_SET_ELEMENT ,"error parsing set element"},
178{ERR_REASON(ASN1_R_ERROR_SETTING_CIPHER_PARAMS),"error setting cipher params"}, 173{ASN1_R_ERROR_SETTING_CIPHER_PARAMS ,"error setting cipher params"},
179{ERR_REASON(ASN1_R_EXPECTING_AN_INTEGER) ,"expecting an integer"}, 174{ASN1_R_EXPECTING_AN_INTEGER ,"expecting an integer"},
180{ERR_REASON(ASN1_R_EXPECTING_AN_OBJECT) ,"expecting an object"}, 175{ASN1_R_EXPECTING_AN_OBJECT ,"expecting an object"},
181{ERR_REASON(ASN1_R_EXPECTING_A_BOOLEAN) ,"expecting a boolean"}, 176{ASN1_R_EXPECTING_A_BOOLEAN ,"expecting a boolean"},
182{ERR_REASON(ASN1_R_EXPECTING_A_TIME) ,"expecting a time"}, 177{ASN1_R_EXPECTING_A_TIME ,"expecting a time"},
183{ERR_REASON(ASN1_R_EXPLICIT_LENGTH_MISMATCH),"explicit length mismatch"}, 178{ASN1_R_EXPLICIT_LENGTH_MISMATCH ,"explicit length mismatch"},
184{ERR_REASON(ASN1_R_EXPLICIT_TAG_NOT_CONSTRUCTED),"explicit tag not constructed"}, 179{ASN1_R_EXPLICIT_TAG_NOT_CONSTRUCTED ,"explicit tag not constructed"},
185{ERR_REASON(ASN1_R_FIELD_MISSING) ,"field missing"}, 180{ASN1_R_FIELD_MISSING ,"field missing"},
186{ERR_REASON(ASN1_R_FIRST_NUM_TOO_LARGE) ,"first num too large"}, 181{ASN1_R_FIRST_NUM_TOO_LARGE ,"first num too large"},
187{ERR_REASON(ASN1_R_HEADER_TOO_LONG) ,"header too long"}, 182{ASN1_R_HEADER_TOO_LONG ,"header too long"},
188{ERR_REASON(ASN1_R_ILLEGAL_CHARACTERS) ,"illegal characters"}, 183{ASN1_R_ILLEGAL_CHARACTERS ,"illegal characters"},
189{ERR_REASON(ASN1_R_ILLEGAL_NULL) ,"illegal null"}, 184{ASN1_R_ILLEGAL_NULL ,"illegal null"},
190{ERR_REASON(ASN1_R_ILLEGAL_OPTIONAL_ANY) ,"illegal optional any"}, 185{ASN1_R_ILLEGAL_OPTIONAL_ANY ,"illegal optional any"},
191{ERR_REASON(ASN1_R_ILLEGAL_OPTIONS_ON_ITEM_TEMPLATE),"illegal options on item template"}, 186{ASN1_R_ILLEGAL_OPTIONS_ON_ITEM_TEMPLATE ,"illegal options on item template"},
192{ERR_REASON(ASN1_R_ILLEGAL_TAGGED_ANY) ,"illegal tagged any"}, 187{ASN1_R_ILLEGAL_TAGGED_ANY ,"illegal tagged any"},
193{ERR_REASON(ASN1_R_INTEGER_TOO_LARGE_FOR_LONG),"integer too large for long"}, 188{ASN1_R_INTEGER_TOO_LARGE_FOR_LONG ,"integer too large for long"},
194{ERR_REASON(ASN1_R_INVALID_BMPSTRING_LENGTH),"invalid bmpstring length"}, 189{ASN1_R_INVALID_BMPSTRING_LENGTH ,"invalid bmpstring length"},
195{ERR_REASON(ASN1_R_INVALID_DIGIT) ,"invalid digit"}, 190{ASN1_R_INVALID_DIGIT ,"invalid digit"},
196{ERR_REASON(ASN1_R_INVALID_SEPARATOR) ,"invalid separator"}, 191{ASN1_R_INVALID_SEPARATOR ,"invalid separator"},
197{ERR_REASON(ASN1_R_INVALID_TIME_FORMAT) ,"invalid time format"}, 192{ASN1_R_INVALID_TIME_FORMAT ,"invalid time format"},
198{ERR_REASON(ASN1_R_INVALID_UNIVERSALSTRING_LENGTH),"invalid universalstring length"}, 193{ASN1_R_INVALID_UNIVERSALSTRING_LENGTH ,"invalid universalstring length"},
199{ERR_REASON(ASN1_R_INVALID_UTF8STRING) ,"invalid utf8string"}, 194{ASN1_R_INVALID_UTF8STRING ,"invalid utf8string"},
200{ERR_REASON(ASN1_R_IV_TOO_LARGE) ,"iv too large"}, 195{ASN1_R_IV_TOO_LARGE ,"iv too large"},
201{ERR_REASON(ASN1_R_LENGTH_ERROR) ,"length error"}, 196{ASN1_R_LENGTH_ERROR ,"length error"},
202{ERR_REASON(ASN1_R_MISSING_EOC) ,"missing eoc"}, 197{ASN1_R_MISSING_EOC ,"missing eoc"},
203{ERR_REASON(ASN1_R_MISSING_SECOND_NUMBER),"missing second number"}, 198{ASN1_R_MISSING_SECOND_NUMBER ,"missing second number"},
204{ERR_REASON(ASN1_R_MSTRING_NOT_UNIVERSAL),"mstring not universal"}, 199{ASN1_R_MSTRING_NOT_UNIVERSAL ,"mstring not universal"},
205{ERR_REASON(ASN1_R_MSTRING_WRONG_TAG) ,"mstring wrong tag"}, 200{ASN1_R_MSTRING_WRONG_TAG ,"mstring wrong tag"},
206{ERR_REASON(ASN1_R_NESTED_ASN1_STRING) ,"nested asn1 string"}, 201{ASN1_R_NON_HEX_CHARACTERS ,"non hex characters"},
207{ERR_REASON(ASN1_R_NON_HEX_CHARACTERS) ,"non hex characters"}, 202{ASN1_R_NOT_ENOUGH_DATA ,"not enough data"},
208{ERR_REASON(ASN1_R_NOT_ENOUGH_DATA) ,"not enough data"}, 203{ASN1_R_NO_MATCHING_CHOICE_TYPE ,"no matching choice type"},
209{ERR_REASON(ASN1_R_NO_MATCHING_CHOICE_TYPE),"no matching choice type"}, 204{ASN1_R_NULL_IS_WRONG_LENGTH ,"null is wrong length"},
210{ERR_REASON(ASN1_R_NULL_IS_WRONG_LENGTH) ,"null is wrong length"}, 205{ASN1_R_ODD_NUMBER_OF_CHARS ,"odd number of chars"},
211{ERR_REASON(ASN1_R_ODD_NUMBER_OF_CHARS) ,"odd number of chars"}, 206{ASN1_R_PRIVATE_KEY_HEADER_MISSING ,"private key header missing"},
212{ERR_REASON(ASN1_R_PRIVATE_KEY_HEADER_MISSING),"private key header missing"}, 207{ASN1_R_SECOND_NUMBER_TOO_LARGE ,"second number too large"},
213{ERR_REASON(ASN1_R_SECOND_NUMBER_TOO_LARGE),"second number too large"}, 208{ASN1_R_SEQUENCE_LENGTH_MISMATCH ,"sequence length mismatch"},
214{ERR_REASON(ASN1_R_SEQUENCE_LENGTH_MISMATCH),"sequence length mismatch"}, 209{ASN1_R_SEQUENCE_NOT_CONSTRUCTED ,"sequence not constructed"},
215{ERR_REASON(ASN1_R_SEQUENCE_NOT_CONSTRUCTED),"sequence not constructed"}, 210{ASN1_R_SHORT_LINE ,"short line"},
216{ERR_REASON(ASN1_R_SHORT_LINE) ,"short line"}, 211{ASN1_R_STRING_TOO_LONG ,"string too long"},
217{ERR_REASON(ASN1_R_STRING_TOO_LONG) ,"string too long"}, 212{ASN1_R_STRING_TOO_SHORT ,"string too short"},
218{ERR_REASON(ASN1_R_STRING_TOO_SHORT) ,"string too short"}, 213{ASN1_R_TAG_VALUE_TOO_HIGH ,"tag value too high"},
219{ERR_REASON(ASN1_R_TAG_VALUE_TOO_HIGH) ,"tag value too high"}, 214{ASN1_R_THE_ASN1_OBJECT_IDENTIFIER_IS_NOT_KNOWN_FOR_THIS_MD,"the asn1 object identifier is not known for this md"},
220{ERR_REASON(ASN1_R_THE_ASN1_OBJECT_IDENTIFIER_IS_NOT_KNOWN_FOR_THIS_MD),"the asn1 object identifier is not known for this md"}, 215{ASN1_R_TOO_LONG ,"too long"},
221{ERR_REASON(ASN1_R_TOO_LONG) ,"too long"}, 216{ASN1_R_TYPE_NOT_CONSTRUCTED ,"type not constructed"},
222{ERR_REASON(ASN1_R_TYPE_NOT_CONSTRUCTED) ,"type not constructed"}, 217{ASN1_R_UNABLE_TO_DECODE_RSA_KEY ,"unable to decode rsa key"},
223{ERR_REASON(ASN1_R_UNABLE_TO_DECODE_RSA_KEY),"unable to decode rsa key"}, 218{ASN1_R_UNABLE_TO_DECODE_RSA_PRIVATE_KEY ,"unable to decode rsa private key"},
224{ERR_REASON(ASN1_R_UNABLE_TO_DECODE_RSA_PRIVATE_KEY),"unable to decode rsa private key"}, 219{ASN1_R_UNEXPECTED_EOC ,"unexpected eoc"},
225{ERR_REASON(ASN1_R_UNEXPECTED_EOC) ,"unexpected eoc"}, 220{ASN1_R_UNKNOWN_FORMAT ,"unknown format"},
226{ERR_REASON(ASN1_R_UNKNOWN_FORMAT) ,"unknown format"}, 221{ASN1_R_UNKNOWN_MESSAGE_DIGEST_ALGORITHM ,"unknown message digest algorithm"},
227{ERR_REASON(ASN1_R_UNKNOWN_MESSAGE_DIGEST_ALGORITHM),"unknown message digest algorithm"}, 222{ASN1_R_UNKNOWN_OBJECT_TYPE ,"unknown object type"},
228{ERR_REASON(ASN1_R_UNKNOWN_OBJECT_TYPE) ,"unknown object type"}, 223{ASN1_R_UNKNOWN_PUBLIC_KEY_TYPE ,"unknown public key type"},
229{ERR_REASON(ASN1_R_UNKNOWN_PUBLIC_KEY_TYPE),"unknown public key type"}, 224{ASN1_R_UNSUPPORTED_ANY_DEFINED_BY_TYPE ,"unsupported any defined by type"},
230{ERR_REASON(ASN1_R_UNSUPPORTED_ANY_DEFINED_BY_TYPE),"unsupported any defined by type"}, 225{ASN1_R_UNSUPPORTED_CIPHER ,"unsupported cipher"},
231{ERR_REASON(ASN1_R_UNSUPPORTED_CIPHER) ,"unsupported cipher"}, 226{ASN1_R_UNSUPPORTED_ENCRYPTION_ALGORITHM ,"unsupported encryption algorithm"},
232{ERR_REASON(ASN1_R_UNSUPPORTED_ENCRYPTION_ALGORITHM),"unsupported encryption algorithm"}, 227{ASN1_R_UNSUPPORTED_PUBLIC_KEY_TYPE ,"unsupported public key type"},
233{ERR_REASON(ASN1_R_UNSUPPORTED_PUBLIC_KEY_TYPE),"unsupported public key type"}, 228{ASN1_R_WRONG_TAG ,"wrong tag"},
234{ERR_REASON(ASN1_R_WRONG_TAG) ,"wrong tag"}, 229{ASN1_R_WRONG_TYPE ,"wrong type"},
235{ERR_REASON(ASN1_R_WRONG_TYPE) ,"wrong type"},
236{0,NULL} 230{0,NULL}
237 }; 231 };
238 232
@@ -246,8 +240,8 @@ void ERR_load_ASN1_strings(void)
246 { 240 {
247 init=0; 241 init=0;
248#ifndef OPENSSL_NO_ERR 242#ifndef OPENSSL_NO_ERR
249 ERR_load_strings(0,ASN1_str_functs); 243 ERR_load_strings(ERR_LIB_ASN1,ASN1_str_functs);
250 ERR_load_strings(0,ASN1_str_reasons); 244 ERR_load_strings(ERR_LIB_ASN1,ASN1_str_reasons);
251#endif 245#endif
252 246
253 } 247 }
diff --git a/src/lib/libcrypto/asn1/f.c b/src/lib/libcrypto/asn1/f.c
new file mode 100644
index 0000000000..82bccdfd51
--- /dev/null
+++ b/src/lib/libcrypto/asn1/f.c
@@ -0,0 +1,80 @@
1/* crypto/asn1/f.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 <openssl/asn1.h>
60#include <openssl/err.h>
61
62main()
63 {
64 ASN1_TYPE *at;
65 char buf[512];
66 int n;
67 long l;
68
69 at=ASN1_TYPE_new();
70
71 n=ASN1_TYPE_set_int_octetstring(at,98736,"01234567",8);
72 printf("%d\n",n);
73 n=ASN1_TYPE_get_int_octetstring(at,&l,buf,8);
74 buf[8]='\0';
75 printf("%ld %d %d\n",l,n,buf[8]);
76 buf[8]='\0';
77 printf("%s\n",buf);
78 ERR_load_crypto_strings();
79 ERR_print_errors_fp(stderr);
80 }
diff --git a/src/lib/libcrypto/asn1/p8_key.c b/src/lib/libcrypto/asn1/p8_key.c
new file mode 100644
index 0000000000..3a31248e14
--- /dev/null
+++ b/src/lib/libcrypto/asn1/p8_key.c
@@ -0,0 +1,131 @@
1/* crypto/asn1/p8_key.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/asn1_mac.h>
62#include <openssl/objects.h>
63
64int i2d_X509_KEY(X509 *a, unsigned char **pp)
65 {
66 M_ASN1_I2D_vars(a);
67
68 M_ASN1_I2D_len(a->cert_info, i2d_X509_CINF);
69 M_ASN1_I2D_len(a->sig_alg, i2d_X509_ALGOR);
70 M_ASN1_I2D_len(a->signature, i2d_ASN1_BIT_STRING);
71
72 M_ASN1_I2D_seq_total();
73
74 M_ASN1_I2D_put(a->cert_info, i2d_X509_CINF);
75 M_ASN1_I2D_put(a->sig_alg, i2d_X509_ALGOR);
76 M_ASN1_I2D_put(a->signature, i2d_ASN1_BIT_STRING);
77
78 M_ASN1_I2D_finish();
79 }
80
81X509 *d2i_X509_KEY(X509 **a, unsigned char **pp, long length)
82 {
83 M_ASN1_D2I_vars(a,X509 *,X509_new);
84
85 M_ASN1_D2I_Init();
86 M_ASN1_D2I_start_sequence();
87 M_ASN1_D2I_get(ret->cert_info,d2i_X509_CINF);
88 M_ASN1_D2I_get(ret->sig_alg,d2i_X509_ALGOR);
89 M_ASN1_D2I_get(ret->signature,d2i_ASN1_BIT_STRING);
90 M_ASN1_D2I_Finish(a,X509_free,ASN1_F_D2I_X509);
91 }
92
93X509 *X509_KEY_new(void)
94 {
95 X509_KEY *ret=NULL;
96
97 M_ASN1_New_OPENSSL_malloc(ret,X509_KEY);
98 ret->references=1;
99 ret->type=NID
100 M_ASN1_New(ret->cert_info,X509_CINF_new);
101 M_ASN1_New(ret->sig_alg,X509_ALGOR_new);
102 M_ASN1_New(ret->signature,ASN1_BIT_STRING_new);
103 return(ret);
104 M_ASN1_New_Error(ASN1_F_X509_NEW);
105 }
106
107void X509_KEY_free(X509 *a)
108 {
109 int i;
110
111 if (a == NULL) return;
112
113 i=CRYPTO_add_lock(&a->references,-1,CRYPTO_LOCK_X509_KEY);
114#ifdef REF_PRINT
115 REF_PRINT("X509_KEY",a);
116#endif
117 if (i > 0) return;
118#ifdef REF_CHECK
119 if (i < 0)
120 {
121 fprintf(stderr,"X509_KEY_free, bad reference count\n");
122 abort();
123 }
124#endif
125
126 X509_CINF_free(a->cert_info);
127 X509_ALGOR_free(a->sig_alg);
128 ASN1_BIT_STRING_free(a->signature);
129 OPENSSL_free(a);
130 }
131
diff --git a/src/lib/libcrypto/asn1/t_x509.c b/src/lib/libcrypto/asn1/t_x509.c
index d1034c47f8..30f68561b7 100644
--- a/src/lib/libcrypto/asn1/t_x509.c
+++ b/src/lib/libcrypto/asn1/t_x509.c
@@ -321,7 +321,7 @@ int X509_signature_print(BIO *bp, X509_ALGOR *sigalg, ASN1_STRING *sig)
321int ASN1_STRING_print(BIO *bp, ASN1_STRING *v) 321int ASN1_STRING_print(BIO *bp, ASN1_STRING *v)
322 { 322 {
323 int i,n; 323 int i,n;
324 char buf[80],*p;; 324 char buf[80],*p;
325 325
326 if (v == NULL) return(0); 326 if (v == NULL) return(0);
327 n=0; 327 n=0;
diff --git a/src/lib/libcrypto/asn1/tasn_dec.c b/src/lib/libcrypto/asn1/tasn_dec.c
index c22501fc63..2426cb6253 100644
--- a/src/lib/libcrypto/asn1/tasn_dec.c
+++ b/src/lib/libcrypto/asn1/tasn_dec.c
@@ -66,7 +66,6 @@
66#include <openssl/err.h> 66#include <openssl/err.h>
67 67
68static int asn1_check_eoc(unsigned char **in, long len); 68static int asn1_check_eoc(unsigned char **in, long len);
69static int asn1_find_end(unsigned char **in, long len, char inf);
70static int asn1_collect(BUF_MEM *buf, unsigned char **in, long len, char inf, int tag, int aclass); 69static int asn1_collect(BUF_MEM *buf, unsigned char **in, long len, char inf, int tag, int aclass);
71static int collect_data(BUF_MEM *buf, unsigned char **p, long plen); 70static int collect_data(BUF_MEM *buf, unsigned char **p, long plen);
72static int asn1_check_tlen(long *olen, int *otag, unsigned char *oclass, char *inf, char *cst, 71static int asn1_check_tlen(long *olen, int *otag, unsigned char *oclass, char *inf, char *cst,
@@ -645,7 +644,7 @@ static int asn1_d2i_ex_primitive(ASN1_VALUE **pval, unsigned char **in, long inl
645 cont = *in; 644 cont = *in;
646 /* If indefinite length constructed find the real end */ 645 /* If indefinite length constructed find the real end */
647 if(inf) { 646 if(inf) {
648 if(!asn1_find_end(&p, plen, inf)) goto err; 647 if(!asn1_collect(NULL, &p, plen, inf, -1, -1)) goto err;
649 len = p - cont; 648 len = p - cont;
650 } else { 649 } else {
651 len = p - cont + plen; 650 len = p - cont + plen;
@@ -808,66 +807,12 @@ int asn1_ex_c2i(ASN1_VALUE **pval, unsigned char *cont, int len, int utype, char
808 return ret; 807 return ret;
809} 808}
810 809
811/* This function finds the end of an ASN1 structure when passed its maximum
812 * length, whether it is indefinite length and a pointer to the content.
813 * This is more efficient than calling asn1_collect because it does not
814 * recurse on each indefinite length header.
815 */
816
817static int asn1_find_end(unsigned char **in, long len, char inf)
818 {
819 int expected_eoc;
820 long plen;
821 unsigned char *p = *in, *q;
822 /* If not indefinite length constructed just add length */
823 if (inf == 0)
824 {
825 *in += len;
826 return 1;
827 }
828 expected_eoc = 1;
829 /* Indefinite length constructed form. Find the end when enough EOCs
830 * are found. If more indefinite length constructed headers
831 * are encountered increment the expected eoc count otherwise justi
832 * skip to the end of the data.
833 */
834 while (len > 0)
835 {
836 if(asn1_check_eoc(&p, len))
837 {
838 expected_eoc--;
839 if (expected_eoc == 0)
840 break;
841 len -= 2;
842 continue;
843 }
844 q = p;
845 /* Just read in a header: only care about the length */
846 if(!asn1_check_tlen(&plen, NULL, NULL, &inf, NULL, &p, len,
847 -1, 0, 0, NULL))
848 {
849 ASN1err(ASN1_F_ASN1_FIND_END, ERR_R_NESTED_ASN1_ERROR);
850 return 0;
851 }
852 if (inf)
853 expected_eoc++;
854 else
855 p += plen;
856 len -= p - q;
857 }
858 if (expected_eoc)
859 {
860 ASN1err(ASN1_F_ASN1_FIND_END, ASN1_R_MISSING_EOC);
861 return 0;
862 }
863 *in = p;
864 return 1;
865 }
866
867/* This function collects the asn1 data from a constructred string 810/* This function collects the asn1 data from a constructred string
868 * type into a buffer. The values of 'in' and 'len' should refer 811 * type into a buffer. The values of 'in' and 'len' should refer
869 * to the contents of the constructed type and 'inf' should be set 812 * to the contents of the constructed type and 'inf' should be set
870 * if it is indefinite length. 813 * if it is indefinite length. If 'buf' is NULL then we just want
814 * to find the end of the current structure: useful for indefinite
815 * length constructed stuff.
871 */ 816 */
872 817
873static int asn1_collect(BUF_MEM *buf, unsigned char **in, long len, char inf, int tag, int aclass) 818static int asn1_collect(BUF_MEM *buf, unsigned char **in, long len, char inf, int tag, int aclass)
@@ -877,6 +822,11 @@ static int asn1_collect(BUF_MEM *buf, unsigned char **in, long len, char inf, in
877 char cst, ininf; 822 char cst, ininf;
878 p = *in; 823 p = *in;
879 inf &= 1; 824 inf &= 1;
825 /* If no buffer and not indefinite length constructed just pass over the encoded data */
826 if(!buf && !inf) {
827 *in += len;
828 return 1;
829 }
880 while(len > 0) { 830 while(len > 0) {
881 q = p; 831 q = p;
882 /* Check for EOC */ 832 /* Check for EOC */
@@ -895,15 +845,9 @@ static int asn1_collect(BUF_MEM *buf, unsigned char **in, long len, char inf, in
895 } 845 }
896 /* If indefinite length constructed update max length */ 846 /* If indefinite length constructed update max length */
897 if(cst) { 847 if(cst) {
898#ifdef OPENSSL_ALLOW_NESTED_ASN1_STRINGS 848 if(!asn1_collect(buf, &p, plen, ininf, tag, aclass)) return 0;
899 if (!asn1_collect(buf, &p, plen, ininf, tag, aclass))
900 return 0;
901#else
902 ASN1err(ASN1_F_ASN1_COLLECT, ASN1_R_NESTED_ASN1_STRING);
903 return 0;
904#endif
905 } else { 849 } else {
906 if(plen && !collect_data(buf, &p, plen)) return 0; 850 if(!collect_data(buf, &p, plen)) return 0;
907 } 851 }
908 len -= p - q; 852 len -= p - q;
909 } 853 }
diff --git a/src/lib/libcrypto/asn1/tasn_enc.c b/src/lib/libcrypto/asn1/tasn_enc.c
index c675c3c832..f6c8ddef0a 100644
--- a/src/lib/libcrypto/asn1/tasn_enc.c
+++ b/src/lib/libcrypto/asn1/tasn_enc.c
@@ -445,12 +445,9 @@ int asn1_ex_i2c(ASN1_VALUE **pval, unsigned char *cout, int *putype, const ASN1_
445 case V_ASN1_BOOLEAN: 445 case V_ASN1_BOOLEAN:
446 tbool = (ASN1_BOOLEAN *)pval; 446 tbool = (ASN1_BOOLEAN *)pval;
447 if(*tbool == -1) return -1; 447 if(*tbool == -1) return -1;
448 if (it->utype != V_ASN1_ANY) 448 /* Default handling if value == size field then omit */
449 { 449 if(*tbool && (it->size > 0)) return -1;
450 /* Default handling if value == size field then omit */ 450 if(!*tbool && !it->size) return -1;
451 if(*tbool && (it->size > 0)) return -1;
452 if(!*tbool && !it->size) return -1;
453 }
454 c = (unsigned char)*tbool; 451 c = (unsigned char)*tbool;
455 cont = &c; 452 cont = &c;
456 len = 1; 453 len = 1;
diff --git a/src/lib/libcrypto/asn1/x_cinf.c b/src/lib/libcrypto/asn1/x_cinf.c
new file mode 100644
index 0000000000..339a110eef
--- /dev/null
+++ b/src/lib/libcrypto/asn1/x_cinf.c
@@ -0,0 +1,201 @@
1/* crypto/asn1/x_cinf.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/asn1_mac.h>
62#include <openssl/x509.h>
63
64int i2d_X509_CINF(X509_CINF *a, unsigned char **pp)
65 {
66 int v1=0,v2=0;
67 M_ASN1_I2D_vars(a);
68
69 M_ASN1_I2D_len_EXP_opt(a->version,i2d_ASN1_INTEGER,0,v1);
70 M_ASN1_I2D_len(a->serialNumber, i2d_ASN1_INTEGER);
71 M_ASN1_I2D_len(a->signature, i2d_X509_ALGOR);
72 M_ASN1_I2D_len(a->issuer, i2d_X509_NAME);
73 M_ASN1_I2D_len(a->validity, i2d_X509_VAL);
74 M_ASN1_I2D_len(a->subject, i2d_X509_NAME);
75 M_ASN1_I2D_len(a->key, i2d_X509_PUBKEY);
76 M_ASN1_I2D_len_IMP_opt(a->issuerUID, i2d_ASN1_BIT_STRING);
77 M_ASN1_I2D_len_IMP_opt(a->subjectUID, i2d_ASN1_BIT_STRING);
78 M_ASN1_I2D_len_EXP_SEQUENCE_opt_type(X509_EXTENSION,a->extensions,
79 i2d_X509_EXTENSION,3,
80 V_ASN1_SEQUENCE,v2);
81
82 M_ASN1_I2D_seq_total();
83
84 M_ASN1_I2D_put_EXP_opt(a->version,i2d_ASN1_INTEGER,0,v1);
85 M_ASN1_I2D_put(a->serialNumber, i2d_ASN1_INTEGER);
86 M_ASN1_I2D_put(a->signature, i2d_X509_ALGOR);
87 M_ASN1_I2D_put(a->issuer, i2d_X509_NAME);
88 M_ASN1_I2D_put(a->validity, i2d_X509_VAL);
89 M_ASN1_I2D_put(a->subject, i2d_X509_NAME);
90 M_ASN1_I2D_put(a->key, i2d_X509_PUBKEY);
91 M_ASN1_I2D_put_IMP_opt(a->issuerUID, i2d_ASN1_BIT_STRING,1);
92 M_ASN1_I2D_put_IMP_opt(a->subjectUID, i2d_ASN1_BIT_STRING,2);
93 M_ASN1_I2D_put_EXP_SEQUENCE_opt_type(X509_EXTENSION,a->extensions,
94 i2d_X509_EXTENSION,3,
95 V_ASN1_SEQUENCE,v2);
96
97 M_ASN1_I2D_finish();
98 }
99
100X509_CINF *d2i_X509_CINF(X509_CINF **a, unsigned char **pp, long length)
101 {
102 int ver=0;
103 M_ASN1_D2I_vars(a,X509_CINF *,X509_CINF_new);
104
105 M_ASN1_D2I_Init();
106 M_ASN1_D2I_start_sequence();
107 /* we have the optional version field */
108 if (M_ASN1_next == (V_ASN1_CONTEXT_SPECIFIC | V_ASN1_CONSTRUCTED | 0))
109 {
110 M_ASN1_D2I_get_EXP_opt(ret->version,d2i_ASN1_INTEGER,0);
111 if (ret->version->data != NULL)
112 ver=ret->version->data[0];
113 }
114 else
115 {
116 if (ret->version != NULL)
117 {
118 M_ASN1_INTEGER_free(ret->version);
119 ret->version=NULL;
120 }
121 }
122 M_ASN1_D2I_get(ret->serialNumber,d2i_ASN1_INTEGER);
123 M_ASN1_D2I_get(ret->signature,d2i_X509_ALGOR);
124 M_ASN1_D2I_get(ret->issuer,d2i_X509_NAME);
125 M_ASN1_D2I_get(ret->validity,d2i_X509_VAL);
126 M_ASN1_D2I_get(ret->subject,d2i_X509_NAME);
127 M_ASN1_D2I_get(ret->key,d2i_X509_PUBKEY);
128 if (ver >= 1) /* version 2 extensions */
129 {
130 if (ret->issuerUID != NULL)
131 {
132 M_ASN1_BIT_STRING_free(ret->issuerUID);
133 ret->issuerUID=NULL;
134 }
135 if (ret->subjectUID != NULL)
136 {
137 M_ASN1_BIT_STRING_free(ret->subjectUID);
138 ret->subjectUID=NULL;
139 }
140 M_ASN1_D2I_get_IMP_opt(ret->issuerUID,d2i_ASN1_BIT_STRING, 1,
141 V_ASN1_BIT_STRING);
142 M_ASN1_D2I_get_IMP_opt(ret->subjectUID,d2i_ASN1_BIT_STRING, 2,
143 V_ASN1_BIT_STRING);
144 }
145/* Note: some broken certificates include extensions but don't set
146 * the version number properly. By bypassing this check they can
147 * be parsed.
148 */
149
150#ifdef VERSION_EXT_CHECK
151 if (ver >= 2) /* version 3 extensions */
152#endif
153 {
154 if (ret->extensions != NULL)
155 while (sk_X509_EXTENSION_num(ret->extensions))
156 X509_EXTENSION_free(
157 sk_X509_EXTENSION_pop(ret->extensions));
158 M_ASN1_D2I_get_EXP_set_opt_type(X509_EXTENSION,ret->extensions,
159 d2i_X509_EXTENSION,
160 X509_EXTENSION_free,3,
161 V_ASN1_SEQUENCE);
162 }
163 M_ASN1_D2I_Finish(a,X509_CINF_free,ASN1_F_D2I_X509_CINF);
164 }
165
166X509_CINF *X509_CINF_new(void)
167 {
168 X509_CINF *ret=NULL;
169 ASN1_CTX c;
170
171 M_ASN1_New_Malloc(ret,X509_CINF);
172 ret->version=NULL;
173 M_ASN1_New(ret->serialNumber,M_ASN1_INTEGER_new);
174 M_ASN1_New(ret->signature,X509_ALGOR_new);
175 M_ASN1_New(ret->issuer,X509_NAME_new);
176 M_ASN1_New(ret->validity,X509_VAL_new);
177 M_ASN1_New(ret->subject,X509_NAME_new);
178 M_ASN1_New(ret->key,X509_PUBKEY_new);
179 ret->issuerUID=NULL;
180 ret->subjectUID=NULL;
181 ret->extensions=NULL;
182 return(ret);
183 M_ASN1_New_Error(ASN1_F_X509_CINF_NEW);
184 }
185
186void X509_CINF_free(X509_CINF *a)
187 {
188 if (a == NULL) return;
189 M_ASN1_INTEGER_free(a->version);
190 M_ASN1_INTEGER_free(a->serialNumber);
191 X509_ALGOR_free(a->signature);
192 X509_NAME_free(a->issuer);
193 X509_VAL_free(a->validity);
194 X509_NAME_free(a->subject);
195 X509_PUBKEY_free(a->key);
196 M_ASN1_BIT_STRING_free(a->issuerUID);
197 M_ASN1_BIT_STRING_free(a->subjectUID);
198 sk_X509_EXTENSION_pop_free(a->extensions,X509_EXTENSION_free);
199 OPENSSL_free(a);
200 }
201
diff --git a/src/lib/libcrypto/bf/Makefile b/src/lib/libcrypto/bf/Makefile
new file mode 100644
index 0000000000..42e2c050f8
--- /dev/null
+++ b/src/lib/libcrypto/bf/Makefile
@@ -0,0 +1,116 @@
1#
2# OpenSSL/crypto/blowfish/Makefile
3#
4
5DIR= bf
6TOP= ../..
7CC= cc
8CPP= $(CC) -E
9INCLUDES=
10CFLAG=-g
11INSTALL_PREFIX=
12OPENSSLDIR= /usr/local/ssl
13INSTALLTOP=/usr/local/ssl
14MAKEDEPPROG= makedepend
15MAKEDEPEND= $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG)
16MAKEFILE= Makefile
17AR= ar r
18
19BF_ENC= bf_enc.o
20# or use
21#DES_ENC= bx86-elf.o
22
23CFLAGS= $(INCLUDES) $(CFLAG)
24ASFLAGS= $(INCLUDES) $(ASFLAG)
25
26GENERAL=Makefile
27TEST=bftest.c
28APPS=
29
30LIB=$(TOP)/libcrypto.a
31LIBSRC=bf_skey.c bf_ecb.c bf_enc.c bf_cfb64.c bf_ofb64.c
32LIBOBJ=bf_skey.o bf_ecb.o $(BF_ENC) bf_cfb64.o bf_ofb64.o
33
34SRC= $(LIBSRC)
35
36EXHEADER= blowfish.h
37HEADER= bf_pi.h bf_locl.h $(EXHEADER)
38
39ALL= $(GENERAL) $(SRC) $(HEADER)
40
41top:
42 (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all)
43
44all: lib
45
46lib: $(LIBOBJ)
47 $(AR) $(LIB) $(LIBOBJ)
48 $(RANLIB) $(LIB) || echo Never mind.
49 @touch lib
50
51# elf
52asm/bx86-elf.s: asm/bf-586.pl ../perlasm/x86asm.pl ../perlasm/cbc.pl
53 (cd asm; $(PERL) bf-586.pl elf $(CFLAGS) $(PROCESSOR) > bx86-elf.s)
54
55# a.out
56asm/bx86-out.o: asm/bx86unix.cpp
57 $(CPP) -DOUT asm/bx86unix.cpp | as -o asm/bx86-out.o
58
59# bsdi
60asm/bx86bsdi.o: asm/bx86unix.cpp
61 $(CPP) -DBSDI asm/bx86unix.cpp | sed 's/ :/:/' | as -o asm/bx86bsdi.o
62
63asm/bx86unix.cpp: asm/bf-586.pl ../perlasm/x86asm.pl ../perlasm/cbc.pl
64 (cd asm; $(PERL) bf-586.pl cpp $(PROCESSOR) >bx86unix.cpp)
65
66files:
67 $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
68
69links:
70 @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
71 @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
72 @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
73
74install: installs
75
76installs:
77 @headerlist="$(EXHEADER)"; for i in $$headerlist ; \
78 do \
79 (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
80 chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
81 done;
82
83tags:
84 ctags $(SRC)
85
86tests:
87
88lint:
89 lint -DLINT $(INCLUDES) $(SRC)>fluff
90
91depend:
92 $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
93
94dclean:
95 $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
96 mv -f Makefile.new $(MAKEFILE)
97
98clean:
99 rm -f asm/bx86unix.cpp asm/*-elf.* *.o asm/*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
100
101# DO NOT DELETE THIS LINE -- make depend depends on it.
102
103bf_cfb64.o: ../../include/openssl/blowfish.h ../../include/openssl/e_os2.h
104bf_cfb64.o: ../../include/openssl/opensslconf.h bf_cfb64.c bf_locl.h
105bf_ecb.o: ../../include/openssl/blowfish.h ../../include/openssl/e_os2.h
106bf_ecb.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
107bf_ecb.o: bf_ecb.c bf_locl.h
108bf_enc.o: ../../include/openssl/blowfish.h ../../include/openssl/e_os2.h
109bf_enc.o: ../../include/openssl/opensslconf.h bf_enc.c bf_locl.h
110bf_ofb64.o: ../../include/openssl/blowfish.h ../../include/openssl/e_os2.h
111bf_ofb64.o: ../../include/openssl/opensslconf.h bf_locl.h bf_ofb64.c
112bf_skey.o: ../../include/openssl/blowfish.h ../../include/openssl/crypto.h
113bf_skey.o: ../../include/openssl/e_os2.h ../../include/openssl/fips.h
114bf_skey.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
115bf_skey.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
116bf_skey.o: ../../include/openssl/symhacks.h bf_locl.h bf_pi.h bf_skey.c
diff --git a/src/lib/libcrypto/bf/Makefile.ssl b/src/lib/libcrypto/bf/Makefile.ssl
new file mode 100644
index 0000000000..be3ad77a05
--- /dev/null
+++ b/src/lib/libcrypto/bf/Makefile.ssl
@@ -0,0 +1,115 @@
1#
2# SSLeay/crypto/blowfish/Makefile
3#
4
5DIR= bf
6TOP= ../..
7CC= cc
8CPP= $(CC) -E
9INCLUDES=
10CFLAG=-g
11INSTALL_PREFIX=
12OPENSSLDIR= /usr/local/ssl
13INSTALLTOP=/usr/local/ssl
14MAKE= make -f Makefile.ssl
15MAKEDEPPROG= makedepend
16MAKEDEPEND= $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG)
17MAKEFILE= Makefile.ssl
18AR= ar r
19
20BF_ENC= bf_enc.o
21# or use
22#DES_ENC= bx86-elf.o
23
24CFLAGS= $(INCLUDES) $(CFLAG)
25ASFLAGS= $(INCLUDES) $(ASFLAG)
26
27GENERAL=Makefile
28TEST=bftest.c
29APPS=
30
31LIB=$(TOP)/libcrypto.a
32LIBSRC=bf_skey.c bf_ecb.c bf_enc.c bf_cfb64.c bf_ofb64.c
33LIBOBJ=bf_skey.o bf_ecb.o $(BF_ENC) bf_cfb64.o bf_ofb64.o
34
35SRC= $(LIBSRC)
36
37EXHEADER= blowfish.h
38HEADER= bf_pi.h bf_locl.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
52# elf
53asm/bx86-elf.s: asm/bf-586.pl ../perlasm/x86asm.pl ../perlasm/cbc.pl
54 (cd asm; $(PERL) bf-586.pl elf $(CFLAGS) $(PROCESSOR) > bx86-elf.s)
55
56# a.out
57asm/bx86-out.o: asm/bx86unix.cpp
58 $(CPP) -DOUT asm/bx86unix.cpp | as -o asm/bx86-out.o
59
60# bsdi
61asm/bx86bsdi.o: asm/bx86unix.cpp
62 $(CPP) -DBSDI asm/bx86unix.cpp | sed 's/ :/:/' | as -o asm/bx86bsdi.o
63
64asm/bx86unix.cpp: asm/bf-586.pl ../perlasm/x86asm.pl ../perlasm/cbc.pl
65 (cd asm; $(PERL) bf-586.pl cpp $(PROCESSOR) >bx86unix.cpp)
66
67files:
68 $(PERL) $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO
69
70links:
71 @sh $(TOP)/util/point.sh Makefile.ssl Makefile
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: installs
77
78installs:
79 @for i in $(EXHEADER) ; \
80 do \
81 (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
82 chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
83 done;
84
85tags:
86 ctags $(SRC)
87
88tests:
89
90lint:
91 lint -DLINT $(INCLUDES) $(SRC)>fluff
92
93depend:
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 asm/bx86unix.cpp asm/*-elf.* *.o asm/*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
102
103# DO NOT DELETE THIS LINE -- make depend depends on it.
104
105bf_cfb64.o: ../../include/openssl/blowfish.h ../../include/openssl/e_os2.h
106bf_cfb64.o: ../../include/openssl/opensslconf.h bf_cfb64.c bf_locl.h
107bf_ecb.o: ../../include/openssl/blowfish.h ../../include/openssl/e_os2.h
108bf_ecb.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
109bf_ecb.o: bf_ecb.c bf_locl.h
110bf_enc.o: ../../include/openssl/blowfish.h ../../include/openssl/e_os2.h
111bf_enc.o: ../../include/openssl/opensslconf.h bf_enc.c bf_locl.h
112bf_ofb64.o: ../../include/openssl/blowfish.h ../../include/openssl/e_os2.h
113bf_ofb64.o: ../../include/openssl/opensslconf.h bf_locl.h bf_ofb64.c
114bf_skey.o: ../../include/openssl/blowfish.h ../../include/openssl/e_os2.h
115bf_skey.o: ../../include/openssl/opensslconf.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 b556642c94..b5a4760d09 100644
--- a/src/lib/libcrypto/bf/asm/bf-586.pl
+++ b/src/lib/libcrypto/bf/asm/bf-586.pl
@@ -18,7 +18,7 @@ $tmp4="edx";
18 18
19&BF_encrypt("BF_encrypt",1); 19&BF_encrypt("BF_encrypt",1);
20&BF_encrypt("BF_decrypt",0); 20&BF_encrypt("BF_decrypt",0);
21&cbc("BF_cbc_encrypt","BF_encrypt","BF_decrypt",1,4,5,3,-1,-1); 21&cbc("BF_cbc_encrypt","BF_encrypt","BF_decrypt",1,4,5,3,-1,-1) unless $main'openbsd;
22&asm_finish(); 22&asm_finish();
23 23
24sub BF_encrypt 24sub 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..171dada2ca
--- /dev/null
+++ b/src/lib/libcrypto/bf/bf_opts.c
@@ -0,0 +1,328 @@
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#include <signal.h>
73#ifndef _IRIX
74#include <time.h>
75#endif
76#ifdef TIMES
77#include <sys/types.h>
78#include <sys/times.h>
79#endif
80
81/* Depending on the VMS version, the tms structure is perhaps defined.
82 The __TMS macro will show if it was. If it wasn't defined, we should
83 undefine TIMES, since that tells the rest of the program how things
84 should be handled. -- Richard Levitte */
85#if defined(OPENSSL_SYS_VMS_DECC) && !defined(__TMS)
86#undef TIMES
87#endif
88
89#ifndef TIMES
90#include <sys/timeb.h>
91#endif
92
93#if defined(sun) || defined(__ultrix)
94#define _POSIX_SOURCE
95#include <limits.h>
96#include <sys/param.h>
97#endif
98
99#include <openssl/blowfish.h>
100
101#define BF_DEFAULT_OPTIONS
102
103#undef BF_ENC
104#define BF_encrypt BF_encrypt_normal
105#undef HEADER_BF_LOCL_H
106#include "bf_enc.c"
107
108#define BF_PTR
109#undef BF_PTR2
110#undef BF_ENC
111#undef BF_encrypt
112#define BF_encrypt BF_encrypt_ptr
113#undef HEADER_BF_LOCL_H
114#include "bf_enc.c"
115
116#undef BF_PTR
117#define BF_PTR2
118#undef BF_ENC
119#undef BF_encrypt
120#define BF_encrypt BF_encrypt_ptr2
121#undef HEADER_BF_LOCL_H
122#include "bf_enc.c"
123
124/* The following if from times(3) man page. It may need to be changed */
125#ifndef HZ
126# ifndef CLK_TCK
127# ifndef _BSD_CLK_TCK_ /* FreeBSD fix */
128# define HZ 100.0
129# else /* _BSD_CLK_TCK_ */
130# define HZ ((double)_BSD_CLK_TCK_)
131# endif
132# else /* CLK_TCK */
133# define HZ ((double)CLK_TCK)
134# endif
135#endif
136
137#define BUFSIZE ((long)1024)
138long run=0;
139
140double Time_F(int s);
141#ifdef SIGALRM
142#if defined(__STDC__) || defined(sgi)
143#define SIGRETTYPE void
144#else
145#define SIGRETTYPE int
146#endif
147
148SIGRETTYPE sig_done(int sig);
149SIGRETTYPE sig_done(int sig)
150 {
151 signal(SIGALRM,sig_done);
152 run=0;
153#ifdef LINT
154 sig=sig;
155#endif
156 }
157#endif
158
159#define START 0
160#define STOP 1
161
162double Time_F(int s)
163 {
164 double ret;
165#ifdef TIMES
166 static struct tms tstart,tend;
167
168 if (s == START)
169 {
170 times(&tstart);
171 return(0);
172 }
173 else
174 {
175 times(&tend);
176 ret=((double)(tend.tms_utime-tstart.tms_utime))/HZ;
177 return((ret == 0.0)?1e-6:ret);
178 }
179#else /* !times() */
180 static struct timeb tstart,tend;
181 long i;
182
183 if (s == START)
184 {
185 ftime(&tstart);
186 return(0);
187 }
188 else
189 {
190 ftime(&tend);
191 i=(long)tend.millitm-(long)tstart.millitm;
192 ret=((double)(tend.time-tstart.time))+((double)i)/1000.0;
193 return((ret == 0.0)?1e-6:ret);
194 }
195#endif
196 }
197
198#ifdef SIGALRM
199#define print_name(name) fprintf(stderr,"Doing %s's for 10 seconds\n",name); alarm(10);
200#else
201#define print_name(name) fprintf(stderr,"Doing %s %ld times\n",name,cb);
202#endif
203
204#define time_it(func,name,index) \
205 print_name(name); \
206 Time_F(START); \
207 for (count=0,run=1; COND(cb); count+=4) \
208 { \
209 unsigned long d[2]; \
210 func(d,&sch); \
211 func(d,&sch); \
212 func(d,&sch); \
213 func(d,&sch); \
214 } \
215 tm[index]=Time_F(STOP); \
216 fprintf(stderr,"%ld %s's in %.2f second\n",count,name,tm[index]); \
217 tm[index]=((double)COUNT(cb))/tm[index];
218
219#define print_it(name,index) \
220 fprintf(stderr,"%s bytes per sec = %12.2f (%5.1fuS)\n",name, \
221 tm[index]*8,1.0e6/tm[index]);
222
223int main(int argc, char **argv)
224 {
225 long count;
226 static unsigned char buf[BUFSIZE];
227 static char key[16]={ 0x12,0x34,0x56,0x78,0x9a,0xbc,0xde,0xf0,
228 0x12,0x34,0x56,0x78,0x9a,0xbc,0xde,0xf0};
229 BF_KEY sch;
230 double d,tm[16],max=0;
231 int rank[16];
232 char *str[16];
233 int max_idx=0,i,num=0,j;
234#ifndef SIGALARM
235 long ca,cb,cc,cd,ce;
236#endif
237
238 for (i=0; i<12; i++)
239 {
240 tm[i]=0.0;
241 rank[i]=0;
242 }
243
244#ifndef TIMES
245 fprintf(stderr,"To get the most accurate results, try to run this\n");
246 fprintf(stderr,"program when this computer is idle.\n");
247#endif
248
249 BF_set_key(&sch,16,key);
250
251#ifndef SIGALRM
252 fprintf(stderr,"First we calculate the approximate speed ...\n");
253 count=10;
254 do {
255 long i;
256 unsigned long data[2];
257
258 count*=2;
259 Time_F(START);
260 for (i=count; i; i--)
261 BF_encrypt(data,&sch);
262 d=Time_F(STOP);
263 } while (d < 3.0);
264 ca=count;
265 cb=count*3;
266 cc=count*3*8/BUFSIZE+1;
267 cd=count*8/BUFSIZE+1;
268
269 ce=count/20+1;
270#define COND(d) (count != (d))
271#define COUNT(d) (d)
272#else
273#define COND(c) (run)
274#define COUNT(d) (count)
275 signal(SIGALRM,sig_done);
276 alarm(10);
277#endif
278
279 time_it(BF_encrypt_normal, "BF_encrypt_normal ", 0);
280 time_it(BF_encrypt_ptr, "BF_encrypt_ptr ", 1);
281 time_it(BF_encrypt_ptr2, "BF_encrypt_ptr2 ", 2);
282 num+=3;
283
284 str[0]="<nothing>";
285 print_it("BF_encrypt_normal ",0);
286 max=tm[0];
287 max_idx=0;
288 str[1]="ptr ";
289 print_it("BF_encrypt_ptr ",1);
290 if (max < tm[1]) { max=tm[1]; max_idx=1; }
291 str[2]="ptr2 ";
292 print_it("BF_encrypt_ptr2 ",2);
293 if (max < tm[2]) { max=tm[2]; max_idx=2; }
294
295 printf("options BF ecb/s\n");
296 printf("%s %12.2f 100.0%%\n",str[max_idx],tm[max_idx]);
297 d=tm[max_idx];
298 tm[max_idx]= -2.0;
299 max= -1.0;
300 for (;;)
301 {
302 for (i=0; i<3; i++)
303 {
304 if (max < tm[i]) { max=tm[i]; j=i; }
305 }
306 if (max < 0.0) break;
307 printf("%s %12.2f %4.1f%%\n",str[j],tm[j],tm[j]/d*100.0);
308 tm[j]= -2.0;
309 max= -1.0;
310 }
311
312 switch (max_idx)
313 {
314 case 0:
315 printf("-DBF_DEFAULT_OPTIONS\n");
316 break;
317 case 1:
318 printf("-DBF_PTR\n");
319 break;
320 case 2:
321 printf("-DBF_PTR2\n");
322 break;
323 }
324 exit(0);
325#if defined(LINT) || defined(OPENSSL_SYS_MSDOS)
326 return(0);
327#endif
328 }
diff --git a/src/lib/libcrypto/bf/bf_skey.c b/src/lib/libcrypto/bf/bf_skey.c
index 1931aba83f..fc5bebefce 100644
--- a/src/lib/libcrypto/bf/bf_skey.c
+++ b/src/lib/libcrypto/bf/bf_skey.c
@@ -60,7 +60,6 @@
60#include <string.h> 60#include <string.h>
61#include <openssl/crypto.h> 61#include <openssl/crypto.h>
62#include <openssl/blowfish.h> 62#include <openssl/blowfish.h>
63#include <openssl/fips.h>
64#include "bf_locl.h" 63#include "bf_locl.h"
65#include "bf_pi.h" 64#include "bf_pi.h"
66 65
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..f346af64f3
--- /dev/null
+++ b/src/lib/libcrypto/bf/bfspeed.c
@@ -0,0 +1,274 @@
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#include <signal.h>
73#ifndef _IRIX
74#include <time.h>
75#endif
76#ifdef TIMES
77#include <sys/types.h>
78#include <sys/times.h>
79#endif
80
81/* Depending on the VMS version, the tms structure is perhaps defined.
82 The __TMS macro will show if it was. If it wasn't defined, we should
83 undefine TIMES, since that tells the rest of the program how things
84 should be handled. -- Richard Levitte */
85#if defined(OPENSSL_SYS_VMS_DECC) && !defined(__TMS)
86#undef TIMES
87#endif
88
89#ifndef TIMES
90#include <sys/timeb.h>
91#endif
92
93#if defined(sun) || defined(__ultrix)
94#define _POSIX_SOURCE
95#include <limits.h>
96#include <sys/param.h>
97#endif
98
99#include <openssl/blowfish.h>
100
101/* The following if from times(3) man page. It may need to be changed */
102#ifndef HZ
103#ifndef CLK_TCK
104#define HZ 100.0
105#else /* CLK_TCK */
106#define HZ ((double)CLK_TCK)
107#endif
108#endif
109
110#define BUFSIZE ((long)1024)
111long run=0;
112
113double Time_F(int s);
114#ifdef SIGALRM
115#if defined(__STDC__) || defined(sgi) || defined(_AIX)
116#define SIGRETTYPE void
117#else
118#define SIGRETTYPE int
119#endif
120
121SIGRETTYPE sig_done(int sig);
122SIGRETTYPE sig_done(int sig)
123 {
124 signal(SIGALRM,sig_done);
125 run=0;
126#ifdef LINT
127 sig=sig;
128#endif
129 }
130#endif
131
132#define START 0
133#define STOP 1
134
135double Time_F(int s)
136 {
137 double ret;
138#ifdef TIMES
139 static struct tms tstart,tend;
140
141 if (s == START)
142 {
143 times(&tstart);
144 return(0);
145 }
146 else
147 {
148 times(&tend);
149 ret=((double)(tend.tms_utime-tstart.tms_utime))/HZ;
150 return((ret == 0.0)?1e-6:ret);
151 }
152#else /* !times() */
153 static struct timeb tstart,tend;
154 long i;
155
156 if (s == START)
157 {
158 ftime(&tstart);
159 return(0);
160 }
161 else
162 {
163 ftime(&tend);
164 i=(long)tend.millitm-(long)tstart.millitm;
165 ret=((double)(tend.time-tstart.time))+((double)i)/1e3;
166 return((ret == 0.0)?1e-6:ret);
167 }
168#endif
169 }
170
171int main(int argc, char **argv)
172 {
173 long count;
174 static unsigned char buf[BUFSIZE];
175 static unsigned char key[] ={
176 0x12,0x34,0x56,0x78,0x9a,0xbc,0xde,0xf0,
177 0xfe,0xdc,0xba,0x98,0x76,0x54,0x32,0x10,
178 };
179 BF_KEY sch;
180 double a,b,c,d;
181#ifndef SIGALRM
182 long ca,cb,cc;
183#endif
184
185#ifndef TIMES
186 printf("To get the most accurate results, try to run this\n");
187 printf("program when this computer is idle.\n");
188#endif
189
190#ifndef SIGALRM
191 printf("First we calculate the approximate speed ...\n");
192 BF_set_key(&sch,16,key);
193 count=10;
194 do {
195 long i;
196 BF_LONG data[2];
197
198 count*=2;
199 Time_F(START);
200 for (i=count; i; i--)
201 BF_encrypt(data,&sch);
202 d=Time_F(STOP);
203 } while (d < 3.0);
204 ca=count/512;
205 cb=count;
206 cc=count*8/BUFSIZE+1;
207 printf("Doing BF_set_key %ld times\n",ca);
208#define COND(d) (count != (d))
209#define COUNT(d) (d)
210#else
211#define COND(c) (run)
212#define COUNT(d) (count)
213 signal(SIGALRM,sig_done);
214 printf("Doing BF_set_key for 10 seconds\n");
215 alarm(10);
216#endif
217
218 Time_F(START);
219 for (count=0,run=1; COND(ca); count+=4)
220 {
221 BF_set_key(&sch,16,key);
222 BF_set_key(&sch,16,key);
223 BF_set_key(&sch,16,key);
224 BF_set_key(&sch,16,key);
225 }
226 d=Time_F(STOP);
227 printf("%ld BF_set_key's in %.2f seconds\n",count,d);
228 a=((double)COUNT(ca))/d;
229
230#ifdef SIGALRM
231 printf("Doing BF_encrypt's for 10 seconds\n");
232 alarm(10);
233#else
234 printf("Doing BF_encrypt %ld times\n",cb);
235#endif
236 Time_F(START);
237 for (count=0,run=1; COND(cb); count+=4)
238 {
239 BF_LONG data[2];
240
241 BF_encrypt(data,&sch);
242 BF_encrypt(data,&sch);
243 BF_encrypt(data,&sch);
244 BF_encrypt(data,&sch);
245 }
246 d=Time_F(STOP);
247 printf("%ld BF_encrypt's in %.2f second\n",count,d);
248 b=((double)COUNT(cb)*8)/d;
249
250#ifdef SIGALRM
251 printf("Doing BF_cbc_encrypt on %ld byte blocks for 10 seconds\n",
252 BUFSIZE);
253 alarm(10);
254#else
255 printf("Doing BF_cbc_encrypt %ld times on %ld byte blocks\n",cc,
256 BUFSIZE);
257#endif
258 Time_F(START);
259 for (count=0,run=1; COND(cc); count++)
260 BF_cbc_encrypt(buf,buf,BUFSIZE,&sch,
261 &(key[0]),BF_ENCRYPT);
262 d=Time_F(STOP);
263 printf("%ld BF_cbc_encrypt's of %ld byte blocks in %.2f second\n",
264 count,BUFSIZE,d);
265 c=((double)COUNT(cc)*BUFSIZE)/d;
266
267 printf("Blowfish set_key per sec = %12.3f (%9.3fuS)\n",a,1.0e6/a);
268 printf("Blowfish raw ecb bytes per sec = %12.3f (%9.3fuS)\n",b,8.0e6/b);
269 printf("Blowfish cbc bytes per sec = %12.3f (%9.3fuS)\n",c,8.0e6/c);
270 exit(0);
271#if defined(LINT) || defined(OPENSSL_SYS_MSDOS)
272 return(0);
273#endif
274 }
diff --git a/src/lib/libcrypto/bf/bftest.c b/src/lib/libcrypto/bf/bftest.c
new file mode 100644
index 0000000000..24d526b14b
--- /dev/null
+++ b/src/lib/libcrypto/bf/bftest.c
@@ -0,0 +1,536 @@
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
66#include "../e_os.h"
67
68#ifdef OPENSSL_NO_BF
69int main(int argc, char *argv[])
70{
71 printf("No BF support\n");
72 return(0);
73}
74#else
75#include <openssl/blowfish.h>
76
77#ifdef CHARSET_EBCDIC
78#include <openssl/ebcdic.h>
79#endif
80
81static char *bf_key[2]={
82 "abcdefghijklmnopqrstuvwxyz",
83 "Who is John Galt?"
84 };
85
86/* big endian */
87static BF_LONG bf_plain[2][2]={
88 {0x424c4f57L,0x46495348L},
89 {0xfedcba98L,0x76543210L}
90 };
91
92static BF_LONG bf_cipher[2][2]={
93 {0x324ed0feL,0xf413a203L},
94 {0xcc91732bL,0x8022f684L}
95 };
96/************/
97
98/* Lets use the DES test vectors :-) */
99#define NUM_TESTS 34
100static unsigned char ecb_data[NUM_TESTS][8]={
101 {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
102 {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF},
103 {0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
104 {0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11},
105 {0x01,0x23,0x45,0x67,0x89,0xAB,0xCD,0xEF},
106 {0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11},
107 {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
108 {0xFE,0xDC,0xBA,0x98,0x76,0x54,0x32,0x10},
109 {0x7C,0xA1,0x10,0x45,0x4A,0x1A,0x6E,0x57},
110 {0x01,0x31,0xD9,0x61,0x9D,0xC1,0x37,0x6E},
111 {0x07,0xA1,0x13,0x3E,0x4A,0x0B,0x26,0x86},
112 {0x38,0x49,0x67,0x4C,0x26,0x02,0x31,0x9E},
113 {0x04,0xB9,0x15,0xBA,0x43,0xFE,0xB5,0xB6},
114 {0x01,0x13,0xB9,0x70,0xFD,0x34,0xF2,0xCE},
115 {0x01,0x70,0xF1,0x75,0x46,0x8F,0xB5,0xE6},
116 {0x43,0x29,0x7F,0xAD,0x38,0xE3,0x73,0xFE},
117 {0x07,0xA7,0x13,0x70,0x45,0xDA,0x2A,0x16},
118 {0x04,0x68,0x91,0x04,0xC2,0xFD,0x3B,0x2F},
119 {0x37,0xD0,0x6B,0xB5,0x16,0xCB,0x75,0x46},
120 {0x1F,0x08,0x26,0x0D,0x1A,0xC2,0x46,0x5E},
121 {0x58,0x40,0x23,0x64,0x1A,0xBA,0x61,0x76},
122 {0x02,0x58,0x16,0x16,0x46,0x29,0xB0,0x07},
123 {0x49,0x79,0x3E,0xBC,0x79,0xB3,0x25,0x8F},
124 {0x4F,0xB0,0x5E,0x15,0x15,0xAB,0x73,0xA7},
125 {0x49,0xE9,0x5D,0x6D,0x4C,0xA2,0x29,0xBF},
126 {0x01,0x83,0x10,0xDC,0x40,0x9B,0x26,0xD6},
127 {0x1C,0x58,0x7F,0x1C,0x13,0x92,0x4F,0xEF},
128 {0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01},
129 {0x1F,0x1F,0x1F,0x1F,0x0E,0x0E,0x0E,0x0E},
130 {0xE0,0xFE,0xE0,0xFE,0xF1,0xFE,0xF1,0xFE},
131 {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
132 {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF},
133 {0x01,0x23,0x45,0x67,0x89,0xAB,0xCD,0xEF},
134 {0xFE,0xDC,0xBA,0x98,0x76,0x54,0x32,0x10}};
135
136static unsigned char plain_data[NUM_TESTS][8]={
137 {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
138 {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF},
139 {0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x01},
140 {0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11},
141 {0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11},
142 {0x01,0x23,0x45,0x67,0x89,0xAB,0xCD,0xEF},
143 {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
144 {0x01,0x23,0x45,0x67,0x89,0xAB,0xCD,0xEF},
145 {0x01,0xA1,0xD6,0xD0,0x39,0x77,0x67,0x42},
146 {0x5C,0xD5,0x4C,0xA8,0x3D,0xEF,0x57,0xDA},
147 {0x02,0x48,0xD4,0x38,0x06,0xF6,0x71,0x72},
148 {0x51,0x45,0x4B,0x58,0x2D,0xDF,0x44,0x0A},
149 {0x42,0xFD,0x44,0x30,0x59,0x57,0x7F,0xA2},
150 {0x05,0x9B,0x5E,0x08,0x51,0xCF,0x14,0x3A},
151 {0x07,0x56,0xD8,0xE0,0x77,0x47,0x61,0xD2},
152 {0x76,0x25,0x14,0xB8,0x29,0xBF,0x48,0x6A},
153 {0x3B,0xDD,0x11,0x90,0x49,0x37,0x28,0x02},
154 {0x26,0x95,0x5F,0x68,0x35,0xAF,0x60,0x9A},
155 {0x16,0x4D,0x5E,0x40,0x4F,0x27,0x52,0x32},
156 {0x6B,0x05,0x6E,0x18,0x75,0x9F,0x5C,0xCA},
157 {0x00,0x4B,0xD6,0xEF,0x09,0x17,0x60,0x62},
158 {0x48,0x0D,0x39,0x00,0x6E,0xE7,0x62,0xF2},
159 {0x43,0x75,0x40,0xC8,0x69,0x8F,0x3C,0xFA},
160 {0x07,0x2D,0x43,0xA0,0x77,0x07,0x52,0x92},
161 {0x02,0xFE,0x55,0x77,0x81,0x17,0xF1,0x2A},
162 {0x1D,0x9D,0x5C,0x50,0x18,0xF7,0x28,0xC2},
163 {0x30,0x55,0x32,0x28,0x6D,0x6F,0x29,0x5A},
164 {0x01,0x23,0x45,0x67,0x89,0xAB,0xCD,0xEF},
165 {0x01,0x23,0x45,0x67,0x89,0xAB,0xCD,0xEF},
166 {0x01,0x23,0x45,0x67,0x89,0xAB,0xCD,0xEF},
167 {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF},
168 {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
169 {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
170 {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}};
171
172static unsigned char cipher_data[NUM_TESTS][8]={
173 {0x4E,0xF9,0x97,0x45,0x61,0x98,0xDD,0x78},
174 {0x51,0x86,0x6F,0xD5,0xB8,0x5E,0xCB,0x8A},
175 {0x7D,0x85,0x6F,0x9A,0x61,0x30,0x63,0xF2},
176 {0x24,0x66,0xDD,0x87,0x8B,0x96,0x3C,0x9D},
177 {0x61,0xF9,0xC3,0x80,0x22,0x81,0xB0,0x96},
178 {0x7D,0x0C,0xC6,0x30,0xAF,0xDA,0x1E,0xC7},
179 {0x4E,0xF9,0x97,0x45,0x61,0x98,0xDD,0x78},
180 {0x0A,0xCE,0xAB,0x0F,0xC6,0xA0,0xA2,0x8D},
181 {0x59,0xC6,0x82,0x45,0xEB,0x05,0x28,0x2B},
182 {0xB1,0xB8,0xCC,0x0B,0x25,0x0F,0x09,0xA0},
183 {0x17,0x30,0xE5,0x77,0x8B,0xEA,0x1D,0xA4},
184 {0xA2,0x5E,0x78,0x56,0xCF,0x26,0x51,0xEB},
185 {0x35,0x38,0x82,0xB1,0x09,0xCE,0x8F,0x1A},
186 {0x48,0xF4,0xD0,0x88,0x4C,0x37,0x99,0x18},
187 {0x43,0x21,0x93,0xB7,0x89,0x51,0xFC,0x98},
188 {0x13,0xF0,0x41,0x54,0xD6,0x9D,0x1A,0xE5},
189 {0x2E,0xED,0xDA,0x93,0xFF,0xD3,0x9C,0x79},
190 {0xD8,0x87,0xE0,0x39,0x3C,0x2D,0xA6,0xE3},
191 {0x5F,0x99,0xD0,0x4F,0x5B,0x16,0x39,0x69},
192 {0x4A,0x05,0x7A,0x3B,0x24,0xD3,0x97,0x7B},
193 {0x45,0x20,0x31,0xC1,0xE4,0xFA,0xDA,0x8E},
194 {0x75,0x55,0xAE,0x39,0xF5,0x9B,0x87,0xBD},
195 {0x53,0xC5,0x5F,0x9C,0xB4,0x9F,0xC0,0x19},
196 {0x7A,0x8E,0x7B,0xFA,0x93,0x7E,0x89,0xA3},
197 {0xCF,0x9C,0x5D,0x7A,0x49,0x86,0xAD,0xB5},
198 {0xD1,0xAB,0xB2,0x90,0x65,0x8B,0xC7,0x78},
199 {0x55,0xCB,0x37,0x74,0xD1,0x3E,0xF2,0x01},
200 {0xFA,0x34,0xEC,0x48,0x47,0xB2,0x68,0xB2},
201 {0xA7,0x90,0x79,0x51,0x08,0xEA,0x3C,0xAE},
202 {0xC3,0x9E,0x07,0x2D,0x9F,0xAC,0x63,0x1D},
203 {0x01,0x49,0x33,0xE0,0xCD,0xAF,0xF6,0xE4},
204 {0xF2,0x1E,0x9A,0x77,0xB7,0x1C,0x49,0xBC},
205 {0x24,0x59,0x46,0x88,0x57,0x54,0x36,0x9A},
206 {0x6B,0x5C,0x5A,0x9C,0x5D,0x9E,0x0A,0x5A},
207 };
208
209static unsigned char cbc_key [16]={
210 0x01,0x23,0x45,0x67,0x89,0xab,0xcd,0xef,
211 0xf0,0xe1,0xd2,0xc3,0xb4,0xa5,0x96,0x87};
212static unsigned char cbc_iv [8]={0xfe,0xdc,0xba,0x98,0x76,0x54,0x32,0x10};
213static char cbc_data[40]="7654321 Now is the time for ";
214static unsigned char cbc_ok[32]={
215 0x6B,0x77,0xB4,0xD6,0x30,0x06,0xDE,0xE6,
216 0x05,0xB1,0x56,0xE2,0x74,0x03,0x97,0x93,
217 0x58,0xDE,0xB9,0xE7,0x15,0x46,0x16,0xD9,
218 0x59,0xF1,0x65,0x2B,0xD5,0xFF,0x92,0xCC};
219
220static unsigned char cfb64_ok[]={
221 0xE7,0x32,0x14,0xA2,0x82,0x21,0x39,0xCA,
222 0xF2,0x6E,0xCF,0x6D,0x2E,0xB9,0xE7,0x6E,
223 0x3D,0xA3,0xDE,0x04,0xD1,0x51,0x72,0x00,
224 0x51,0x9D,0x57,0xA6,0xC3};
225
226static unsigned char ofb64_ok[]={
227 0xE7,0x32,0x14,0xA2,0x82,0x21,0x39,0xCA,
228 0x62,0xB3,0x43,0xCC,0x5B,0x65,0x58,0x73,
229 0x10,0xDD,0x90,0x8D,0x0C,0x24,0x1B,0x22,
230 0x63,0xC2,0xCF,0x80,0xDA};
231
232#define KEY_TEST_NUM 25
233static unsigned char key_test[KEY_TEST_NUM]={
234 0xf0,0xe1,0xd2,0xc3,0xb4,0xa5,0x96,0x87,
235 0x78,0x69,0x5a,0x4b,0x3c,0x2d,0x1e,0x0f,
236 0x00,0x11,0x22,0x33,0x44,0x55,0x66,0x77,
237 0x88};
238
239static unsigned char key_data[8]=
240 {0xFE,0xDC,0xBA,0x98,0x76,0x54,0x32,0x10};
241
242static unsigned char key_out[KEY_TEST_NUM][8]={
243 {0xF9,0xAD,0x59,0x7C,0x49,0xDB,0x00,0x5E},
244 {0xE9,0x1D,0x21,0xC1,0xD9,0x61,0xA6,0xD6},
245 {0xE9,0xC2,0xB7,0x0A,0x1B,0xC6,0x5C,0xF3},
246 {0xBE,0x1E,0x63,0x94,0x08,0x64,0x0F,0x05},
247 {0xB3,0x9E,0x44,0x48,0x1B,0xDB,0x1E,0x6E},
248 {0x94,0x57,0xAA,0x83,0xB1,0x92,0x8C,0x0D},
249 {0x8B,0xB7,0x70,0x32,0xF9,0x60,0x62,0x9D},
250 {0xE8,0x7A,0x24,0x4E,0x2C,0xC8,0x5E,0x82},
251 {0x15,0x75,0x0E,0x7A,0x4F,0x4E,0xC5,0x77},
252 {0x12,0x2B,0xA7,0x0B,0x3A,0xB6,0x4A,0xE0},
253 {0x3A,0x83,0x3C,0x9A,0xFF,0xC5,0x37,0xF6},
254 {0x94,0x09,0xDA,0x87,0xA9,0x0F,0x6B,0xF2},
255 {0x88,0x4F,0x80,0x62,0x50,0x60,0xB8,0xB4},
256 {0x1F,0x85,0x03,0x1C,0x19,0xE1,0x19,0x68},
257 {0x79,0xD9,0x37,0x3A,0x71,0x4C,0xA3,0x4F},
258 {0x93,0x14,0x28,0x87,0xEE,0x3B,0xE1,0x5C},
259 {0x03,0x42,0x9E,0x83,0x8C,0xE2,0xD1,0x4B},
260 {0xA4,0x29,0x9E,0x27,0x46,0x9F,0xF6,0x7B},
261 {0xAF,0xD5,0xAE,0xD1,0xC1,0xBC,0x96,0xA8},
262 {0x10,0x85,0x1C,0x0E,0x38,0x58,0xDA,0x9F},
263 {0xE6,0xF5,0x1E,0xD7,0x9B,0x9D,0xB2,0x1F},
264 {0x64,0xA6,0xE1,0x4A,0xFD,0x36,0xB4,0x6F},
265 {0x80,0xC7,0xD7,0xD4,0x5A,0x54,0x79,0xAD},
266 {0x05,0x04,0x4B,0x62,0xFA,0x52,0xD0,0x80},
267 };
268
269static int test(void );
270static int print_test_data(void );
271int main(int argc, char *argv[])
272 {
273 int ret;
274
275 if (argc > 1)
276 ret=print_test_data();
277 else
278 ret=test();
279
280 EXIT(ret);
281 return(0);
282 }
283
284static int print_test_data(void)
285 {
286 unsigned int i,j;
287
288 printf("ecb test data\n");
289 printf("key bytes\t\tclear bytes\t\tcipher bytes\n");
290 for (i=0; i<NUM_TESTS; i++)
291 {
292 for (j=0; j<8; j++)
293 printf("%02X",ecb_data[i][j]);
294 printf("\t");
295 for (j=0; j<8; j++)
296 printf("%02X",plain_data[i][j]);
297 printf("\t");
298 for (j=0; j<8; j++)
299 printf("%02X",cipher_data[i][j]);
300 printf("\n");
301 }
302
303 printf("set_key test data\n");
304 printf("data[8]= ");
305 for (j=0; j<8; j++)
306 printf("%02X",key_data[j]);
307 printf("\n");
308 for (i=0; i<KEY_TEST_NUM-1; i++)
309 {
310 printf("c=");
311 for (j=0; j<8; j++)
312 printf("%02X",key_out[i][j]);
313 printf(" k[%2u]=",i+1);
314 for (j=0; j<i+1; j++)
315 printf("%02X",key_test[j]);
316 printf("\n");
317 }
318
319 printf("\nchaining mode test data\n");
320 printf("key[16] = ");
321 for (j=0; j<16; j++)
322 printf("%02X",cbc_key[j]);
323 printf("\niv[8] = ");
324 for (j=0; j<8; j++)
325 printf("%02X",cbc_iv[j]);
326 printf("\ndata[%d] = '%s'",(int)strlen(cbc_data)+1,cbc_data);
327 printf("\ndata[%d] = ",(int)strlen(cbc_data)+1);
328 for (j=0; j<strlen(cbc_data)+1; j++)
329 printf("%02X",cbc_data[j]);
330 printf("\n");
331 printf("cbc cipher text\n");
332 printf("cipher[%d]= ",32);
333 for (j=0; j<32; j++)
334 printf("%02X",cbc_ok[j]);
335 printf("\n");
336
337 printf("cfb64 cipher text\n");
338 printf("cipher[%d]= ",(int)strlen(cbc_data)+1);
339 for (j=0; j<strlen(cbc_data)+1; j++)
340 printf("%02X",cfb64_ok[j]);
341 printf("\n");
342
343 printf("ofb64 cipher text\n");
344 printf("cipher[%d]= ",(int)strlen(cbc_data)+1);
345 for (j=0; j<strlen(cbc_data)+1; j++)
346 printf("%02X",ofb64_ok[j]);
347 printf("\n");
348 return(0);
349 }
350
351static int test(void)
352 {
353 unsigned char cbc_in[40],cbc_out[40],iv[8];
354 int i,n,err=0;
355 BF_KEY key;
356 BF_LONG data[2];
357 unsigned char out[8];
358 BF_LONG len;
359
360#ifdef CHARSET_EBCDIC
361 ebcdic2ascii(cbc_data, cbc_data, strlen(cbc_data));
362#endif
363
364 printf("testing blowfish in raw ecb mode\n");
365 for (n=0; n<2; n++)
366 {
367#ifdef CHARSET_EBCDIC
368 ebcdic2ascii(bf_key[n], bf_key[n], strlen(bf_key[n]));
369#endif
370 BF_set_key(&key,strlen(bf_key[n]),(unsigned char *)bf_key[n]);
371
372 data[0]=bf_plain[n][0];
373 data[1]=bf_plain[n][1];
374 BF_encrypt(data,&key);
375 if (memcmp(&(bf_cipher[n][0]),&(data[0]),8) != 0)
376 {
377 printf("BF_encrypt error encrypting\n");
378 printf("got :");
379 for (i=0; i<2; i++)
380 printf("%08lX ",(unsigned long)data[i]);
381 printf("\n");
382 printf("expected:");
383 for (i=0; i<2; i++)
384 printf("%08lX ",(unsigned long)bf_cipher[n][i]);
385 err=1;
386 printf("\n");
387 }
388
389 BF_decrypt(&(data[0]),&key);
390 if (memcmp(&(bf_plain[n][0]),&(data[0]),8) != 0)
391 {
392 printf("BF_encrypt error decrypting\n");
393 printf("got :");
394 for (i=0; i<2; i++)
395 printf("%08lX ",(unsigned long)data[i]);
396 printf("\n");
397 printf("expected:");
398 for (i=0; i<2; i++)
399 printf("%08lX ",(unsigned long)bf_plain[n][i]);
400 printf("\n");
401 err=1;
402 }
403 }
404
405 printf("testing blowfish in ecb mode\n");
406
407 for (n=0; n<NUM_TESTS; n++)
408 {
409 BF_set_key(&key,8,ecb_data[n]);
410
411 BF_ecb_encrypt(&(plain_data[n][0]),out,&key,BF_ENCRYPT);
412 if (memcmp(&(cipher_data[n][0]),out,8) != 0)
413 {
414 printf("BF_ecb_encrypt blowfish error encrypting\n");
415 printf("got :");
416 for (i=0; i<8; i++)
417 printf("%02X ",out[i]);
418 printf("\n");
419 printf("expected:");
420 for (i=0; i<8; i++)
421 printf("%02X ",cipher_data[n][i]);
422 err=1;
423 printf("\n");
424 }
425
426 BF_ecb_encrypt(out,out,&key,BF_DECRYPT);
427 if (memcmp(&(plain_data[n][0]),out,8) != 0)
428 {
429 printf("BF_ecb_encrypt error decrypting\n");
430 printf("got :");
431 for (i=0; i<8; i++)
432 printf("%02X ",out[i]);
433 printf("\n");
434 printf("expected:");
435 for (i=0; i<8; i++)
436 printf("%02X ",plain_data[n][i]);
437 printf("\n");
438 err=1;
439 }
440 }
441
442 printf("testing blowfish set_key\n");
443 for (n=1; n<KEY_TEST_NUM; n++)
444 {
445 BF_set_key(&key,n,key_test);
446 BF_ecb_encrypt(key_data,out,&key,BF_ENCRYPT);
447 /* mips-sgi-irix6.5-gcc vv -mabi=64 bug workaround */
448 if (memcmp(out,&(key_out[i=n-1][0]),8) != 0)
449 {
450 printf("blowfish setkey error\n");
451 err=1;
452 }
453 }
454
455 printf("testing blowfish in cbc mode\n");
456 len=strlen(cbc_data)+1;
457
458 BF_set_key(&key,16,cbc_key);
459 memset(cbc_in,0,sizeof cbc_in);
460 memset(cbc_out,0,sizeof cbc_out);
461 memcpy(iv,cbc_iv,sizeof iv);
462 BF_cbc_encrypt((unsigned char *)cbc_data,cbc_out,len,
463 &key,iv,BF_ENCRYPT);
464 if (memcmp(cbc_out,cbc_ok,32) != 0)
465 {
466 err=1;
467 printf("BF_cbc_encrypt encrypt error\n");
468 for (i=0; i<32; i++) printf("0x%02X,",cbc_out[i]);
469 }
470 memcpy(iv,cbc_iv,8);
471 BF_cbc_encrypt(cbc_out,cbc_in,len,
472 &key,iv,BF_DECRYPT);
473 if (memcmp(cbc_in,cbc_data,strlen(cbc_data)+1) != 0)
474 {
475 printf("BF_cbc_encrypt decrypt error\n");
476 err=1;
477 }
478
479 printf("testing blowfish in cfb64 mode\n");
480
481 BF_set_key(&key,16,cbc_key);
482 memset(cbc_in,0,40);
483 memset(cbc_out,0,40);
484 memcpy(iv,cbc_iv,8);
485 n=0;
486 BF_cfb64_encrypt((unsigned char *)cbc_data,cbc_out,(long)13,
487 &key,iv,&n,BF_ENCRYPT);
488 BF_cfb64_encrypt((unsigned char *)&(cbc_data[13]),&(cbc_out[13]),len-13,
489 &key,iv,&n,BF_ENCRYPT);
490 if (memcmp(cbc_out,cfb64_ok,(int)len) != 0)
491 {
492 err=1;
493 printf("BF_cfb64_encrypt encrypt error\n");
494 for (i=0; i<(int)len; i++) printf("0x%02X,",cbc_out[i]);
495 }
496 n=0;
497 memcpy(iv,cbc_iv,8);
498 BF_cfb64_encrypt(cbc_out,cbc_in,17,
499 &key,iv,&n,BF_DECRYPT);
500 BF_cfb64_encrypt(&(cbc_out[17]),&(cbc_in[17]),len-17,
501 &key,iv,&n,BF_DECRYPT);
502 if (memcmp(cbc_in,cbc_data,(int)len) != 0)
503 {
504 printf("BF_cfb64_encrypt decrypt error\n");
505 err=1;
506 }
507
508 printf("testing blowfish in ofb64\n");
509
510 BF_set_key(&key,16,cbc_key);
511 memset(cbc_in,0,40);
512 memset(cbc_out,0,40);
513 memcpy(iv,cbc_iv,8);
514 n=0;
515 BF_ofb64_encrypt((unsigned char *)cbc_data,cbc_out,(long)13,&key,iv,&n);
516 BF_ofb64_encrypt((unsigned char *)&(cbc_data[13]),
517 &(cbc_out[13]),len-13,&key,iv,&n);
518 if (memcmp(cbc_out,ofb64_ok,(int)len) != 0)
519 {
520 err=1;
521 printf("BF_ofb64_encrypt encrypt error\n");
522 for (i=0; i<(int)len; i++) printf("0x%02X,",cbc_out[i]);
523 }
524 n=0;
525 memcpy(iv,cbc_iv,8);
526 BF_ofb64_encrypt(cbc_out,cbc_in,17,&key,iv,&n);
527 BF_ofb64_encrypt(&(cbc_out[17]),&(cbc_in[17]),len-17,&key,iv,&n);
528 if (memcmp(cbc_in,cbc_data,(int)len) != 0)
529 {
530 printf("BF_ofb64_encrypt decrypt error\n");
531 err=1;
532 }
533
534 return(err);
535 }
536#endif
diff --git a/src/lib/libcrypto/bio/Makefile b/src/lib/libcrypto/bio/Makefile
new file mode 100644
index 0000000000..a565154499
--- /dev/null
+++ b/src/lib/libcrypto/bio/Makefile
@@ -0,0 +1,214 @@
1#
2# OpenSSL/crypto/bio/Makefile
3#
4
5DIR= bio
6TOP= ../..
7CC= cc
8INCLUDES= -I.. -I$(TOP) -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
18CFLAGS= $(INCLUDES) $(CFLAG)
19
20GENERAL=Makefile
21TEST=
22APPS=
23
24LIB=$(TOP)/libcrypto.a
25LIBSRC= bio_lib.c bio_cb.c bio_err.c \
26 bss_mem.c bss_null.c bss_fd.c \
27 bss_file.c bss_sock.c bss_conn.c \
28 bf_null.c bf_buff.c b_print.c b_dump.c \
29 b_sock.c bss_acpt.c bf_nbio.c bss_log.c bss_bio.c
30# bf_lbuf.c
31LIBOBJ= bio_lib.o bio_cb.o bio_err.o \
32 bss_mem.o bss_null.o bss_fd.o \
33 bss_file.o bss_sock.o bss_conn.o \
34 bf_null.o bf_buff.o b_print.o b_dump.o \
35 b_sock.o bss_acpt.o bf_nbio.o bss_log.o bss_bio.o
36# bf_lbuf.o
37
38SRC= $(LIBSRC)
39
40EXHEADER= bio.h
41HEADER= bss_file.c $(EXHEADER)
42
43ALL= $(GENERAL) $(SRC) $(HEADER)
44
45top:
46 (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all)
47
48all: lib
49
50lib: $(LIBOBJ)
51 $(AR) $(LIB) $(LIBOBJ)
52 $(RANLIB) $(LIB) || echo Never mind.
53 @touch lib
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 @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
73tests:
74
75lint:
76 lint -DLINT $(INCLUDES) $(SRC)>fluff
77
78depend:
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
90b_dump.o: ../../e_os.h ../../include/openssl/bio.h
91b_dump.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
92b_dump.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
93b_dump.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
94b_dump.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
95b_dump.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
96b_dump.o: ../cryptlib.h b_dump.c
97b_print.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h
98b_print.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
99b_print.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
100b_print.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
101b_print.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
102b_print.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
103b_print.o: ../cryptlib.h b_print.c
104b_sock.o: ../../e_os.h ../../include/openssl/bio.h
105b_sock.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
106b_sock.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
107b_sock.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
108b_sock.o: ../../include/openssl/opensslv.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/safestack.h
116bf_buff.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
117bf_buff.o: ../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/safestack.h
131bf_null.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
132bf_null.o: ../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/safestack.h
138bio_cb.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
139bio_cb.o: ../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/safestack.h
144bio_err.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
145bio_err.o: 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/safestack.h
151bio_lib.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
152bio_lib.o: ../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/safestack.h
158bss_acpt.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
159bss_acpt.o: ../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/safestack.h ../../include/openssl/stack.h
165bss_bio.o: ../../include/openssl/symhacks.h bss_bio.c
166bss_conn.o: ../../e_os.h ../../include/openssl/bio.h
167bss_conn.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
168bss_conn.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
169bss_conn.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
170bss_conn.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
171bss_conn.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
172bss_conn.o: ../cryptlib.h bss_conn.c
173bss_fd.o: ../../e_os.h ../../include/openssl/bio.h
174bss_fd.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
175bss_fd.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
176bss_fd.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
177bss_fd.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
178bss_fd.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
179bss_fd.o: ../cryptlib.h bss_fd.c
180bss_file.o: ../../e_os.h ../../include/openssl/bio.h
181bss_file.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
182bss_file.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
183bss_file.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
184bss_file.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
185bss_file.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
186bss_file.o: ../cryptlib.h bss_file.c
187bss_log.o: ../../e_os.h ../../include/openssl/bio.h
188bss_log.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
189bss_log.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
190bss_log.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
191bss_log.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
192bss_log.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
193bss_log.o: ../cryptlib.h bss_log.c
194bss_mem.o: ../../e_os.h ../../include/openssl/bio.h
195bss_mem.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
196bss_mem.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
197bss_mem.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
198bss_mem.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
199bss_mem.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
200bss_mem.o: ../cryptlib.h bss_mem.c
201bss_null.o: ../../e_os.h ../../include/openssl/bio.h
202bss_null.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
203bss_null.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
204bss_null.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
205bss_null.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
206bss_null.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
207bss_null.o: ../cryptlib.h bss_null.c
208bss_sock.o: ../../e_os.h ../../include/openssl/bio.h
209bss_sock.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
210bss_sock.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
211bss_sock.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
212bss_sock.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
213bss_sock.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
214bss_sock.o: ../cryptlib.h bss_sock.c
diff --git a/src/lib/libcrypto/bio/Makefile.ssl b/src/lib/libcrypto/bio/Makefile.ssl
new file mode 100644
index 0000000000..d0b9e297b0
--- /dev/null
+++ b/src/lib/libcrypto/bio/Makefile.ssl
@@ -0,0 +1,216 @@
1#
2# SSLeay/crypto/bio/Makefile
3#
4
5DIR= bio
6TOP= ../..
7CC= cc
8INCLUDES= -I.. -I$(TOP) -I../../include
9CFLAG=-g
10INSTALL_PREFIX=
11OPENSSLDIR= /usr/local/ssl
12INSTALLTOP=/usr/local/ssl
13MAKE= make -f Makefile.ssl
14MAKEDEPPROG= makedepend
15MAKEDEPEND= $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG)
16MAKEFILE= Makefile.ssl
17AR= ar r
18
19CFLAGS= $(INCLUDES) $(CFLAG)
20
21GENERAL=Makefile
22TEST=
23APPS=
24
25LIB=$(TOP)/libcrypto.a
26LIBSRC= bio_lib.c bio_cb.c bio_err.c \
27 bss_mem.c bss_null.c bss_fd.c \
28 bss_file.c bss_sock.c bss_conn.c \
29 bf_null.c bf_buff.c b_print.c b_dump.c \
30 b_sock.c bss_acpt.c bf_nbio.c bss_log.c bss_bio.c
31# bf_lbuf.c
32LIBOBJ= bio_lib.o bio_cb.o bio_err.o \
33 bss_mem.o bss_null.o bss_fd.o \
34 bss_file.o bss_sock.o bss_conn.o \
35 bf_null.o bf_buff.o b_print.o b_dump.o \
36 b_sock.o bss_acpt.o bf_nbio.o bss_log.o bss_bio.o
37# bf_lbuf.o
38
39SRC= $(LIBSRC)
40
41EXHEADER= bio.h
42HEADER= bss_file.c $(EXHEADER)
43
44ALL= $(GENERAL) $(SRC) $(HEADER)
45
46top:
47 (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all)
48
49all: lib
50
51lib: $(LIBOBJ)
52 $(AR) $(LIB) $(LIBOBJ)
53 $(RANLIB) $(LIB) || echo Never mind.
54 @touch lib
55
56files:
57 $(PERL) $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO
58
59links:
60 @sh $(TOP)/util/point.sh Makefile.ssl Makefile
61 @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
62 @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
63 @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
64
65install:
66 @for i in $(EXHEADER); \
67 do \
68 (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
69 chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
70 done;
71
72tags:
73 ctags $(SRC)
74
75tests:
76
77lint:
78 lint -DLINT $(INCLUDES) $(SRC)>fluff
79
80depend:
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 *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
89
90# DO NOT DELETE THIS LINE -- make depend depends on it.
91
92b_dump.o: ../../e_os.h ../../include/openssl/bio.h
93b_dump.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
94b_dump.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
95b_dump.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
96b_dump.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
97b_dump.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
98b_dump.o: ../cryptlib.h b_dump.c
99b_print.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h
100b_print.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
101b_print.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
102b_print.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
103b_print.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
104b_print.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
105b_print.o: ../cryptlib.h b_print.c
106b_sock.o: ../../e_os.h ../../include/openssl/bio.h
107b_sock.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
108b_sock.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
109b_sock.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
110b_sock.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
111b_sock.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
112b_sock.o: ../cryptlib.h b_sock.c
113bf_buff.o: ../../e_os.h ../../include/openssl/bio.h
114bf_buff.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
115bf_buff.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
116bf_buff.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
117bf_buff.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
118bf_buff.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
119bf_buff.o: ../cryptlib.h bf_buff.c
120bf_nbio.o: ../../e_os.h ../../include/openssl/bio.h
121bf_nbio.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
122bf_nbio.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
123bf_nbio.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
124bf_nbio.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
125bf_nbio.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h
126bf_nbio.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
127bf_nbio.o: ../cryptlib.h bf_nbio.c
128bf_null.o: ../../e_os.h ../../include/openssl/bio.h
129bf_null.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
130bf_null.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
131bf_null.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
132bf_null.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
133bf_null.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
134bf_null.o: ../cryptlib.h bf_null.c
135bio_cb.o: ../../e_os.h ../../include/openssl/bio.h
136bio_cb.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
137bio_cb.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
138bio_cb.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
139bio_cb.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
140bio_cb.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
141bio_cb.o: ../cryptlib.h bio_cb.c
142bio_err.o: ../../include/openssl/bio.h ../../include/openssl/crypto.h
143bio_err.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
144bio_err.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
145bio_err.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
146bio_err.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
147bio_err.o: bio_err.c
148bio_lib.o: ../../e_os.h ../../include/openssl/bio.h
149bio_lib.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
150bio_lib.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
151bio_lib.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
152bio_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
153bio_lib.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
154bio_lib.o: ../cryptlib.h bio_lib.c
155bss_acpt.o: ../../e_os.h ../../include/openssl/bio.h
156bss_acpt.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
157bss_acpt.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
158bss_acpt.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
159bss_acpt.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
160bss_acpt.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
161bss_acpt.o: ../cryptlib.h bss_acpt.c
162bss_bio.o: ../../e_os.h ../../include/openssl/bio.h
163bss_bio.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
164bss_bio.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
165bss_bio.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
166bss_bio.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
167bss_bio.o: ../../include/openssl/symhacks.h bss_bio.c
168bss_conn.o: ../../e_os.h ../../include/openssl/bio.h
169bss_conn.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
170bss_conn.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
171bss_conn.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
172bss_conn.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
173bss_conn.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
174bss_conn.o: ../cryptlib.h bss_conn.c
175bss_fd.o: ../../e_os.h ../../include/openssl/bio.h
176bss_fd.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
177bss_fd.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
178bss_fd.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
179bss_fd.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
180bss_fd.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
181bss_fd.o: ../cryptlib.h bss_fd.c
182bss_file.o: ../../e_os.h ../../include/openssl/bio.h
183bss_file.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
184bss_file.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
185bss_file.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
186bss_file.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
187bss_file.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
188bss_file.o: ../cryptlib.h bss_file.c
189bss_log.o: ../../e_os.h ../../include/openssl/bio.h
190bss_log.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
191bss_log.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
192bss_log.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
193bss_log.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
194bss_log.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
195bss_log.o: ../cryptlib.h bss_log.c
196bss_mem.o: ../../e_os.h ../../include/openssl/bio.h
197bss_mem.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
198bss_mem.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
199bss_mem.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
200bss_mem.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
201bss_mem.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
202bss_mem.o: ../cryptlib.h bss_mem.c
203bss_null.o: ../../e_os.h ../../include/openssl/bio.h
204bss_null.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
205bss_null.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
206bss_null.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
207bss_null.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
208bss_null.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
209bss_null.o: ../cryptlib.h bss_null.c
210bss_sock.o: ../../e_os.h ../../include/openssl/bio.h
211bss_sock.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
212bss_sock.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
213bss_sock.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
214bss_sock.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
215bss_sock.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
216bss_sock.o: ../cryptlib.h bss_sock.c
diff --git a/src/lib/libcrypto/bio/b_print.c b/src/lib/libcrypto/bio/b_print.c
index 165f046295..8b753e7ca0 100644
--- a/src/lib/libcrypto/bio/b_print.c
+++ b/src/lib/libcrypto/bio/b_print.c
@@ -576,7 +576,7 @@ abs_val(LDOUBLE value)
576} 576}
577 577
578static LDOUBLE 578static LDOUBLE
579pow_10(int in_exp) 579pow10(int in_exp)
580{ 580{
581 LDOUBLE result = 1; 581 LDOUBLE result = 1;
582 while (in_exp) { 582 while (in_exp) {
@@ -639,11 +639,11 @@ fmtfp(
639 639
640 /* we "cheat" by converting the fractional part to integer by 640 /* we "cheat" by converting the fractional part to integer by
641 multiplying by a factor of 10 */ 641 multiplying by a factor of 10 */
642 fracpart = roundv((pow_10(max)) * (ufvalue - intpart)); 642 fracpart = roundv((pow10(max)) * (ufvalue - intpart));
643 643
644 if (fracpart >= (long)pow_10(max)) { 644 if (fracpart >= (long)pow10(max)) {
645 intpart++; 645 intpart++;
646 fracpart -= (long)pow_10(max); 646 fracpart -= (long)pow10(max);
647 } 647 }
648 648
649 /* convert integer part */ 649 /* convert integer part */
@@ -806,6 +806,7 @@ int BIO_vprintf (BIO *bio, const char *format, va_list args)
806 } 806 }
807 807
808/* As snprintf is not available everywhere, we provide our own implementation. 808/* As snprintf is not available everywhere, we provide our own implementation.
809 * In case of overflow or error, this returns -1.
809 * This function has nothing to do with BIOs, but it's closely related 810 * This function has nothing to do with BIOs, but it's closely related
810 * to BIO_printf, and we need *some* name prefix ... 811 * to BIO_printf, and we need *some* name prefix ...
811 * (XXX the function should be renamed, but to what?) */ 812 * (XXX the function should be renamed, but to what?) */
@@ -830,10 +831,10 @@ int BIO_vsnprintf(char *buf, size_t n, const char *format, va_list args)
830 _dopr(&buf, NULL, &n, &retlen, &truncated, format, args); 831 _dopr(&buf, NULL, &n, &retlen, &truncated, format, args);
831 832
832 if (truncated) 833 if (truncated)
833 /* In case of truncation, return -1 like traditional snprintf. 834 /* In case of truncation, return -1 unlike traditional snprintf.
834 * (Current drafts for ISO/IEC 9899 say snprintf should return 835 * (Current drafts for ISO/IEC 9899 say snprintf should return
835 * the number of characters that would have been written, 836 * the number of characters that would have been written,
836 * had the buffer been large enough.) */ 837 * had the buffer been large enough, as it did historically.) */
837 return -1; 838 return -1;
838 else 839 else
839 return (retlen <= INT_MAX) ? (int)retlen : -1; 840 return (retlen <= INT_MAX) ? (int)retlen : -1;
diff --git a/src/lib/libcrypto/bio/bio_err.c b/src/lib/libcrypto/bio/bio_err.c
index 8859a58ae4..68a119d895 100644
--- a/src/lib/libcrypto/bio/bio_err.c
+++ b/src/lib/libcrypto/bio/bio_err.c
@@ -1,6 +1,6 @@
1/* crypto/bio/bio_err.c */ 1/* crypto/bio/bio_err.c */
2/* ==================================================================== 2/* ====================================================================
3 * Copyright (c) 1999-2005 The OpenSSL Project. All rights reserved. 3 * Copyright (c) 1999 The OpenSSL Project. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
@@ -64,77 +64,73 @@
64 64
65/* BEGIN ERROR CODES */ 65/* BEGIN ERROR CODES */
66#ifndef OPENSSL_NO_ERR 66#ifndef OPENSSL_NO_ERR
67
68#define ERR_FUNC(func) ERR_PACK(ERR_LIB_BIO,func,0)
69#define ERR_REASON(reason) ERR_PACK(ERR_LIB_BIO,0,reason)
70
71static ERR_STRING_DATA BIO_str_functs[]= 67static ERR_STRING_DATA BIO_str_functs[]=
72 { 68 {
73{ERR_FUNC(BIO_F_ACPT_STATE), "ACPT_STATE"}, 69{ERR_PACK(0,BIO_F_ACPT_STATE,0), "ACPT_STATE"},
74{ERR_FUNC(BIO_F_BIO_ACCEPT), "BIO_accept"}, 70{ERR_PACK(0,BIO_F_BIO_ACCEPT,0), "BIO_accept"},
75{ERR_FUNC(BIO_F_BIO_BER_GET_HEADER), "BIO_BER_GET_HEADER"}, 71{ERR_PACK(0,BIO_F_BIO_BER_GET_HEADER,0), "BIO_BER_GET_HEADER"},
76{ERR_FUNC(BIO_F_BIO_CTRL), "BIO_ctrl"}, 72{ERR_PACK(0,BIO_F_BIO_CTRL,0), "BIO_ctrl"},
77{ERR_FUNC(BIO_F_BIO_GETHOSTBYNAME), "BIO_gethostbyname"}, 73{ERR_PACK(0,BIO_F_BIO_GETHOSTBYNAME,0), "BIO_gethostbyname"},
78{ERR_FUNC(BIO_F_BIO_GETS), "BIO_gets"}, 74{ERR_PACK(0,BIO_F_BIO_GETS,0), "BIO_gets"},
79{ERR_FUNC(BIO_F_BIO_GET_ACCEPT_SOCKET), "BIO_get_accept_socket"}, 75{ERR_PACK(0,BIO_F_BIO_GET_ACCEPT_SOCKET,0), "BIO_get_accept_socket"},
80{ERR_FUNC(BIO_F_BIO_GET_HOST_IP), "BIO_get_host_ip"}, 76{ERR_PACK(0,BIO_F_BIO_GET_HOST_IP,0), "BIO_get_host_ip"},
81{ERR_FUNC(BIO_F_BIO_GET_PORT), "BIO_get_port"}, 77{ERR_PACK(0,BIO_F_BIO_GET_PORT,0), "BIO_get_port"},
82{ERR_FUNC(BIO_F_BIO_MAKE_PAIR), "BIO_MAKE_PAIR"}, 78{ERR_PACK(0,BIO_F_BIO_MAKE_PAIR,0), "BIO_MAKE_PAIR"},
83{ERR_FUNC(BIO_F_BIO_NEW), "BIO_new"}, 79{ERR_PACK(0,BIO_F_BIO_NEW,0), "BIO_new"},
84{ERR_FUNC(BIO_F_BIO_NEW_FILE), "BIO_new_file"}, 80{ERR_PACK(0,BIO_F_BIO_NEW_FILE,0), "BIO_new_file"},
85{ERR_FUNC(BIO_F_BIO_NEW_MEM_BUF), "BIO_new_mem_buf"}, 81{ERR_PACK(0,BIO_F_BIO_NEW_MEM_BUF,0), "BIO_new_mem_buf"},
86{ERR_FUNC(BIO_F_BIO_NREAD), "BIO_nread"}, 82{ERR_PACK(0,BIO_F_BIO_NREAD,0), "BIO_nread"},
87{ERR_FUNC(BIO_F_BIO_NREAD0), "BIO_nread0"}, 83{ERR_PACK(0,BIO_F_BIO_NREAD0,0), "BIO_nread0"},
88{ERR_FUNC(BIO_F_BIO_NWRITE), "BIO_nwrite"}, 84{ERR_PACK(0,BIO_F_BIO_NWRITE,0), "BIO_nwrite"},
89{ERR_FUNC(BIO_F_BIO_NWRITE0), "BIO_nwrite0"}, 85{ERR_PACK(0,BIO_F_BIO_NWRITE0,0), "BIO_nwrite0"},
90{ERR_FUNC(BIO_F_BIO_PUTS), "BIO_puts"}, 86{ERR_PACK(0,BIO_F_BIO_PUTS,0), "BIO_puts"},
91{ERR_FUNC(BIO_F_BIO_READ), "BIO_read"}, 87{ERR_PACK(0,BIO_F_BIO_READ,0), "BIO_read"},
92{ERR_FUNC(BIO_F_BIO_SOCK_INIT), "BIO_sock_init"}, 88{ERR_PACK(0,BIO_F_BIO_SOCK_INIT,0), "BIO_sock_init"},
93{ERR_FUNC(BIO_F_BIO_WRITE), "BIO_write"}, 89{ERR_PACK(0,BIO_F_BIO_WRITE,0), "BIO_write"},
94{ERR_FUNC(BIO_F_BUFFER_CTRL), "BUFFER_CTRL"}, 90{ERR_PACK(0,BIO_F_BUFFER_CTRL,0), "BUFFER_CTRL"},
95{ERR_FUNC(BIO_F_CONN_CTRL), "CONN_CTRL"}, 91{ERR_PACK(0,BIO_F_CONN_CTRL,0), "CONN_CTRL"},
96{ERR_FUNC(BIO_F_CONN_STATE), "CONN_STATE"}, 92{ERR_PACK(0,BIO_F_CONN_STATE,0), "CONN_STATE"},
97{ERR_FUNC(BIO_F_FILE_CTRL), "FILE_CTRL"}, 93{ERR_PACK(0,BIO_F_FILE_CTRL,0), "FILE_CTRL"},
98{ERR_FUNC(BIO_F_FILE_READ), "FILE_READ"}, 94{ERR_PACK(0,BIO_F_FILE_READ,0), "FILE_READ"},
99{ERR_FUNC(BIO_F_LINEBUFFER_CTRL), "LINEBUFFER_CTRL"}, 95{ERR_PACK(0,BIO_F_LINEBUFFER_CTRL,0), "LINEBUFFER_CTRL"},
100{ERR_FUNC(BIO_F_MEM_READ), "MEM_READ"}, 96{ERR_PACK(0,BIO_F_MEM_READ,0), "MEM_READ"},
101{ERR_FUNC(BIO_F_MEM_WRITE), "MEM_WRITE"}, 97{ERR_PACK(0,BIO_F_MEM_WRITE,0), "MEM_WRITE"},
102{ERR_FUNC(BIO_F_SSL_NEW), "SSL_new"}, 98{ERR_PACK(0,BIO_F_SSL_NEW,0), "SSL_new"},
103{ERR_FUNC(BIO_F_WSASTARTUP), "WSASTARTUP"}, 99{ERR_PACK(0,BIO_F_WSASTARTUP,0), "WSASTARTUP"},
104{0,NULL} 100{0,NULL}
105 }; 101 };
106 102
107static ERR_STRING_DATA BIO_str_reasons[]= 103static ERR_STRING_DATA BIO_str_reasons[]=
108 { 104 {
109{ERR_REASON(BIO_R_ACCEPT_ERROR) ,"accept error"}, 105{BIO_R_ACCEPT_ERROR ,"accept error"},
110{ERR_REASON(BIO_R_BAD_FOPEN_MODE) ,"bad fopen mode"}, 106{BIO_R_BAD_FOPEN_MODE ,"bad fopen mode"},
111{ERR_REASON(BIO_R_BAD_HOSTNAME_LOOKUP) ,"bad hostname lookup"}, 107{BIO_R_BAD_HOSTNAME_LOOKUP ,"bad hostname lookup"},
112{ERR_REASON(BIO_R_BROKEN_PIPE) ,"broken pipe"}, 108{BIO_R_BROKEN_PIPE ,"broken pipe"},
113{ERR_REASON(BIO_R_CONNECT_ERROR) ,"connect error"}, 109{BIO_R_CONNECT_ERROR ,"connect error"},
114{ERR_REASON(BIO_R_EOF_ON_MEMORY_BIO) ,"EOF on memory BIO"}, 110{BIO_R_EOF_ON_MEMORY_BIO ,"EOF on memory BIO"},
115{ERR_REASON(BIO_R_ERROR_SETTING_NBIO) ,"error setting nbio"}, 111{BIO_R_ERROR_SETTING_NBIO ,"error setting nbio"},
116{ERR_REASON(BIO_R_ERROR_SETTING_NBIO_ON_ACCEPTED_SOCKET),"error setting nbio on accepted socket"}, 112{BIO_R_ERROR_SETTING_NBIO_ON_ACCEPTED_SOCKET,"error setting nbio on accepted socket"},
117{ERR_REASON(BIO_R_ERROR_SETTING_NBIO_ON_ACCEPT_SOCKET),"error setting nbio on accept socket"}, 113{BIO_R_ERROR_SETTING_NBIO_ON_ACCEPT_SOCKET,"error setting nbio on accept socket"},
118{ERR_REASON(BIO_R_GETHOSTBYNAME_ADDR_IS_NOT_AF_INET),"gethostbyname addr is not af inet"}, 114{BIO_R_GETHOSTBYNAME_ADDR_IS_NOT_AF_INET ,"gethostbyname addr is not af inet"},
119{ERR_REASON(BIO_R_INVALID_ARGUMENT) ,"invalid argument"}, 115{BIO_R_INVALID_ARGUMENT ,"invalid argument"},
120{ERR_REASON(BIO_R_INVALID_IP_ADDRESS) ,"invalid ip address"}, 116{BIO_R_INVALID_IP_ADDRESS ,"invalid ip address"},
121{ERR_REASON(BIO_R_IN_USE) ,"in use"}, 117{BIO_R_IN_USE ,"in use"},
122{ERR_REASON(BIO_R_KEEPALIVE) ,"keepalive"}, 118{BIO_R_KEEPALIVE ,"keepalive"},
123{ERR_REASON(BIO_R_NBIO_CONNECT_ERROR) ,"nbio connect error"}, 119{BIO_R_NBIO_CONNECT_ERROR ,"nbio connect error"},
124{ERR_REASON(BIO_R_NO_ACCEPT_PORT_SPECIFIED),"no accept port specified"}, 120{BIO_R_NO_ACCEPT_PORT_SPECIFIED ,"no accept port specified"},
125{ERR_REASON(BIO_R_NO_HOSTNAME_SPECIFIED) ,"no hostname specified"}, 121{BIO_R_NO_HOSTNAME_SPECIFIED ,"no hostname specified"},
126{ERR_REASON(BIO_R_NO_PORT_DEFINED) ,"no port defined"}, 122{BIO_R_NO_PORT_DEFINED ,"no port defined"},
127{ERR_REASON(BIO_R_NO_PORT_SPECIFIED) ,"no port specified"}, 123{BIO_R_NO_PORT_SPECIFIED ,"no port specified"},
128{ERR_REASON(BIO_R_NO_SUCH_FILE) ,"no such file"}, 124{BIO_R_NO_SUCH_FILE ,"no such file"},
129{ERR_REASON(BIO_R_NULL_PARAMETER) ,"null parameter"}, 125{BIO_R_NULL_PARAMETER ,"null parameter"},
130{ERR_REASON(BIO_R_TAG_MISMATCH) ,"tag mismatch"}, 126{BIO_R_TAG_MISMATCH ,"tag mismatch"},
131{ERR_REASON(BIO_R_UNABLE_TO_BIND_SOCKET) ,"unable to bind socket"}, 127{BIO_R_UNABLE_TO_BIND_SOCKET ,"unable to bind socket"},
132{ERR_REASON(BIO_R_UNABLE_TO_CREATE_SOCKET),"unable to create socket"}, 128{BIO_R_UNABLE_TO_CREATE_SOCKET ,"unable to create socket"},
133{ERR_REASON(BIO_R_UNABLE_TO_LISTEN_SOCKET),"unable to listen socket"}, 129{BIO_R_UNABLE_TO_LISTEN_SOCKET ,"unable to listen socket"},
134{ERR_REASON(BIO_R_UNINITIALIZED) ,"uninitialized"}, 130{BIO_R_UNINITIALIZED ,"uninitialized"},
135{ERR_REASON(BIO_R_UNSUPPORTED_METHOD) ,"unsupported method"}, 131{BIO_R_UNSUPPORTED_METHOD ,"unsupported method"},
136{ERR_REASON(BIO_R_WRITE_TO_READ_ONLY_BIO),"write to read only BIO"}, 132{BIO_R_WRITE_TO_READ_ONLY_BIO ,"write to read only BIO"},
137{ERR_REASON(BIO_R_WSASTARTUP) ,"WSAStartup"}, 133{BIO_R_WSASTARTUP ,"WSAStartup"},
138{0,NULL} 134{0,NULL}
139 }; 135 };
140 136
@@ -148,8 +144,8 @@ void ERR_load_BIO_strings(void)
148 { 144 {
149 init=0; 145 init=0;
150#ifndef OPENSSL_NO_ERR 146#ifndef OPENSSL_NO_ERR
151 ERR_load_strings(0,BIO_str_functs); 147 ERR_load_strings(ERR_LIB_BIO,BIO_str_functs);
152 ERR_load_strings(0,BIO_str_reasons); 148 ERR_load_strings(ERR_LIB_BIO,BIO_str_reasons);
153#endif 149#endif
154 150
155 } 151 }
diff --git a/src/lib/libcrypto/bio/bss_conn.c b/src/lib/libcrypto/bio/bss_conn.c
index 216780ed5e..f5d0e759e2 100644
--- a/src/lib/libcrypto/bio/bss_conn.c
+++ b/src/lib/libcrypto/bio/bss_conn.c
@@ -469,7 +469,7 @@ static long conn_ctrl(BIO *b, int cmd, long num, void *ptr)
469 break; 469 break;
470 case BIO_C_DO_STATE_MACHINE: 470 case BIO_C_DO_STATE_MACHINE:
471 /* use this one to start the connection */ 471 /* use this one to start the connection */
472 if (data->state != BIO_CONN_S_OK) 472 if (!data->state != BIO_CONN_S_OK)
473 ret=(long)conn_state(b,data); 473 ret=(long)conn_state(b,data);
474 else 474 else
475 ret=1; 475 ret=1;
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..9969d242cc
--- /dev/null
+++ b/src/lib/libcrypto/bn/Makefile
@@ -0,0 +1,333 @@
1#
2# OpenSSL/crypto/bn/Makefile
3#
4
5DIR= bn
6TOP= ../..
7CC= cc
8CPP= $(CC) -E
9INCLUDES= -I.. -I$(TOP) -I../../include
10CFLAG=-g
11INSTALL_PREFIX=
12OPENSSLDIR= /usr/local/ssl
13INSTALLTOP=/usr/local/ssl
14MAKEDEPPROG= makedepend
15MAKEDEPEND= $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG)
16MAKEFILE= Makefile
17AR= ar r
18
19BN_ASM= bn_asm.o
20# or use
21#BN_ASM= bn86-elf.o
22
23CFLAGS= $(INCLUDES) $(CFLAG)
24ASFLAGS= $(INCLUDES) $(ASFLAG)
25
26GENERAL=Makefile
27TEST=bntest.c exptest.c
28APPS=
29
30LIB=$(TOP)/libcrypto.a
31LIBSRC= bn_add.c bn_div.c bn_exp.c bn_lib.c bn_ctx.c bn_mul.c bn_mod.c \
32 bn_print.c bn_rand.c bn_shift.c bn_word.c bn_blind.c \
33 bn_kron.c bn_sqrt.c bn_gcd.c bn_prime.c bn_err.c bn_sqr.c bn_asm.c \
34 bn_recp.c bn_mont.c bn_mpi.c bn_exp2.c bn_x931p.c
35
36LIBOBJ= bn_add.o bn_div.o bn_exp.o bn_lib.o bn_ctx.o bn_mul.o bn_mod.o \
37 bn_print.o bn_rand.o bn_shift.o bn_word.o bn_blind.o \
38 bn_kron.o bn_sqrt.o bn_gcd.o bn_prime.o bn_err.o bn_sqr.o $(BN_ASM) \
39 bn_recp.o bn_mont.o bn_mpi.o bn_exp2.o bn_x931p.o
40
41SRC= $(LIBSRC)
42
43EXHEADER= bn.h
44HEADER= bn_lcl.h bn_prime.h $(EXHEADER)
45
46ALL= $(GENERAL) $(SRC) $(HEADER)
47
48top:
49 (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all)
50
51all: lib
52
53bn_prime.h: bn_prime.pl
54 $(PERL) bn_prime.pl >bn_prime.h
55
56divtest: divtest.c ../../libcrypto.a
57 cc -I../../include divtest.c -o divtest ../../libcrypto.a
58
59bnbug: bnbug.c ../../libcrypto.a top
60 cc -g -I../../include bnbug.c -o bnbug ../../libcrypto.a
61
62lib: $(LIBOBJ)
63 $(AR) $(LIB) $(LIBOBJ)
64 $(RANLIB) $(LIB) || echo Never mind.
65 @touch lib
66
67# elf
68asm/bn86-elf.s: asm/bn-586.pl ../perlasm/x86asm.pl
69 (cd asm; $(PERL) bn-586.pl elf $(CFLAGS) > bn86-elf.s)
70
71asm/co86-elf.s: asm/co-586.pl ../perlasm/x86asm.pl
72 (cd asm; $(PERL) co-586.pl elf $(CFLAGS) > co86-elf.s)
73
74# a.out
75asm/bn86-out.o: asm/bn86unix.cpp
76 $(CPP) -DOUT asm/bn86unix.cpp | as -o asm/bn86-out.o
77
78asm/co86-out.o: asm/co86unix.cpp
79 $(CPP) -DOUT asm/co86unix.cpp | as -o asm/co86-out.o
80
81# bsdi
82asm/bn86bsdi.o: asm/bn86unix.cpp
83 $(CPP) -DBSDI asm/bn86unix.cpp | sed 's/ :/:/' | as -o asm/bn86bsdi.o
84
85asm/co86bsdi.o: asm/co86unix.cpp
86 $(CPP) -DBSDI asm/co86unix.cpp | sed 's/ :/:/' | as -o asm/co86bsdi.o
87
88asm/bn86unix.cpp: asm/bn-586.pl ../perlasm/x86asm.pl
89 (cd asm; $(PERL) bn-586.pl cpp >bn86unix.cpp )
90
91asm/co86unix.cpp: asm/co-586.pl ../perlasm/x86asm.pl
92 (cd asm; $(PERL) co-586.pl cpp >co86unix.cpp )
93
94asm/sparcv8.o: asm/sparcv8.S
95
96asm/sparcv8plus.o: asm/sparcv8plus.S
97
98# Old GNU assembler doesn't understand V9 instructions, so we
99# hire /usr/ccs/bin/as to do the job. Note that option is called
100# *-gcc27, but even gcc 2>=8 users may experience similar problem
101# if they didn't bother to upgrade GNU assembler. Such users should
102# not choose this option, but be adviced to *remove* GNU assembler
103# or upgrade it.
104asm/sparcv8plus-gcc27.o: asm/sparcv8plus.S
105 $(CC) $(ASFLAGS) -E asm/sparcv8plus.S | \
106 /usr/ccs/bin/as -xarch=v8plus - -o asm/sparcv8plus-gcc27.o
107
108
109asm/ia64.o: asm/ia64.S
110
111# Some compiler drivers (most notably HP-UX and Intel C++) don't
112# understand .S extension:-( I wish I could pipe output from cc -E,
113# but it's too compiler driver/ABI dependent to cover with a single
114# rule... <appro@fy.chalmers.se>
115asm/ia64-cpp.o: asm/ia64.S
116 $(CC) $(ASFLAGS) -E asm/ia64.S > /tmp/ia64.$$$$.s && \
117 $(CC) $(ASFLAGS) -c -o asm/ia64-cpp.o /tmp/ia64.$$$$.s; \
118 rm -f /tmp/ia64.$$$$.s
119
120asm/x86_64-gcc.o: asm/x86_64-gcc.c
121 $(CC) $(ASFLAGS) -c -o $@ $<
122
123asm/pa-risc2W.o: asm/pa-risc2W.s
124 /usr/ccs/bin/as -o asm/pa-risc2W.o asm/pa-risc2W.s
125
126asm/linux_ppc32.s: asm/ppc.pl; $(PERL) $< $@
127asm/linux_ppc64.s: asm/ppc.pl; $(PERL) $< $@
128asm/aix_ppc32.s: asm/ppc.pl; $(PERL) asm/ppc.pl $@
129asm/aix_ppc64.s: asm/ppc.pl; $(PERL) asm/ppc.pl $@
130asm/osx_ppc32.s: asm/ppc.pl; $(PERL) $< $@
131
132files:
133 $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
134
135links:
136 @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
137 @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
138 @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
139
140install:
141 @headerlist="$(EXHEADER)"; for i in $$headerlist ; \
142 do \
143 (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
144 chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
145 done;
146
147exptest:
148 rm -f exptest
149 gcc -I../../include -g2 -ggdb -o exptest exptest.c ../../libcrypto.a
150
151div:
152 rm -f a.out
153 gcc -I.. -g div.c ../../libcrypto.a
154
155tags:
156 ctags $(SRC)
157
158tests:
159
160lint:
161 lint -DLINT $(INCLUDES) $(SRC)>fluff
162
163depend:
164 $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
165
166dclean:
167 $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
168 mv -f Makefile.new $(MAKEFILE)
169
170clean:
171 rm -f asm/co86unix.cpp asm/bn86unix.cpp asm/*-elf.* *.o */*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff bn_asm.s
172
173# DO NOT DELETE THIS LINE -- make depend depends on it.
174
175bn_add.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h
176bn_add.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
177bn_add.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
178bn_add.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
179bn_add.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
180bn_add.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
181bn_add.o: ../cryptlib.h bn_add.c bn_lcl.h
182bn_asm.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h
183bn_asm.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
184bn_asm.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
185bn_asm.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
186bn_asm.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
187bn_asm.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
188bn_asm.o: ../cryptlib.h bn_asm.c bn_lcl.h
189bn_blind.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h
190bn_blind.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
191bn_blind.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
192bn_blind.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
193bn_blind.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
194bn_blind.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
195bn_blind.o: ../cryptlib.h bn_blind.c bn_lcl.h
196bn_ctx.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h
197bn_ctx.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
198bn_ctx.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
199bn_ctx.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
200bn_ctx.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
201bn_ctx.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
202bn_ctx.o: ../cryptlib.h bn_ctx.c bn_lcl.h
203bn_div.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h
204bn_div.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
205bn_div.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
206bn_div.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
207bn_div.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
208bn_div.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
209bn_div.o: ../cryptlib.h bn_div.c bn_lcl.h
210bn_err.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
211bn_err.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
212bn_err.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
213bn_err.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
214bn_err.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
215bn_err.o: ../../include/openssl/symhacks.h bn_err.c
216bn_exp.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h
217bn_exp.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
218bn_exp.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
219bn_exp.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
220bn_exp.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
221bn_exp.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
222bn_exp.o: ../cryptlib.h bn_exp.c bn_lcl.h
223bn_exp2.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h
224bn_exp2.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
225bn_exp2.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
226bn_exp2.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
227bn_exp2.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
228bn_exp2.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
229bn_exp2.o: ../cryptlib.h bn_exp2.c bn_lcl.h
230bn_gcd.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h
231bn_gcd.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
232bn_gcd.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
233bn_gcd.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
234bn_gcd.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
235bn_gcd.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
236bn_gcd.o: ../cryptlib.h bn_gcd.c bn_lcl.h
237bn_kron.o: ../../include/openssl/bn.h ../../include/openssl/e_os2.h
238bn_kron.o: ../../include/openssl/opensslconf.h bn_kron.c bn_lcl.h
239bn_lib.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h
240bn_lib.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
241bn_lib.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
242bn_lib.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
243bn_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
244bn_lib.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
245bn_lib.o: ../cryptlib.h bn_lcl.h bn_lib.c
246bn_mod.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h
247bn_mod.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
248bn_mod.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
249bn_mod.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
250bn_mod.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
251bn_mod.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
252bn_mod.o: ../cryptlib.h bn_lcl.h bn_mod.c
253bn_mont.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h
254bn_mont.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
255bn_mont.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
256bn_mont.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
257bn_mont.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
258bn_mont.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
259bn_mont.o: ../cryptlib.h bn_lcl.h bn_mont.c
260bn_mpi.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h
261bn_mpi.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
262bn_mpi.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
263bn_mpi.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
264bn_mpi.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
265bn_mpi.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
266bn_mpi.o: ../cryptlib.h bn_lcl.h bn_mpi.c
267bn_mul.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h
268bn_mul.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
269bn_mul.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
270bn_mul.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
271bn_mul.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
272bn_mul.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
273bn_mul.o: ../cryptlib.h bn_lcl.h bn_mul.c
274bn_prime.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h
275bn_prime.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
276bn_prime.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
277bn_prime.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
278bn_prime.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
279bn_prime.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h
280bn_prime.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
281bn_prime.o: ../cryptlib.h bn_lcl.h bn_prime.c bn_prime.h
282bn_print.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h
283bn_print.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
284bn_print.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
285bn_print.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
286bn_print.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
287bn_print.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
288bn_print.o: ../cryptlib.h bn_lcl.h bn_print.c
289bn_rand.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h
290bn_rand.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
291bn_rand.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
292bn_rand.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
293bn_rand.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
294bn_rand.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h
295bn_rand.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
296bn_rand.o: ../cryptlib.h bn_lcl.h bn_rand.c
297bn_recp.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h
298bn_recp.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
299bn_recp.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
300bn_recp.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
301bn_recp.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
302bn_recp.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
303bn_recp.o: ../cryptlib.h bn_lcl.h bn_recp.c
304bn_shift.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h
305bn_shift.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
306bn_shift.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
307bn_shift.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
308bn_shift.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
309bn_shift.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
310bn_shift.o: ../cryptlib.h bn_lcl.h bn_shift.c
311bn_sqr.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h
312bn_sqr.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
313bn_sqr.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
314bn_sqr.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
315bn_sqr.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
316bn_sqr.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
317bn_sqr.o: ../cryptlib.h bn_lcl.h bn_sqr.c
318bn_sqrt.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h
319bn_sqrt.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
320bn_sqrt.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
321bn_sqrt.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
322bn_sqrt.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
323bn_sqrt.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
324bn_sqrt.o: ../cryptlib.h bn_lcl.h bn_sqrt.c
325bn_word.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h
326bn_word.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
327bn_word.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
328bn_word.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
329bn_word.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
330bn_word.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
331bn_word.o: ../cryptlib.h bn_lcl.h bn_word.c
332bn_x931p.o: ../../include/openssl/bn.h ../../include/openssl/e_os2.h
333bn_x931p.o: ../../include/openssl/opensslconf.h bn_x931p.c
diff --git a/src/lib/libcrypto/bn/Makefile.ssl b/src/lib/libcrypto/bn/Makefile.ssl
new file mode 100644
index 0000000000..50892ef44c
--- /dev/null
+++ b/src/lib/libcrypto/bn/Makefile.ssl
@@ -0,0 +1,326 @@
1#
2# SSLeay/crypto/bn/Makefile
3#
4
5DIR= bn
6TOP= ../..
7CC= cc
8CPP= $(CC) -E
9INCLUDES= -I.. -I$(TOP) -I../../include
10CFLAG=-g
11INSTALL_PREFIX=
12OPENSSLDIR= /usr/local/ssl
13INSTALLTOP=/usr/local/ssl
14MAKE= make -f Makefile.ssl
15MAKEDEPPROG= makedepend
16MAKEDEPEND= $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG)
17MAKEFILE= Makefile.ssl
18AR= ar r
19
20BN_ASM= bn_asm.o
21# or use
22#BN_ASM= bn86-elf.o
23
24CFLAGS= $(INCLUDES) $(CFLAG)
25ASFLAGS= $(INCLUDES) $(ASFLAG)
26
27GENERAL=Makefile
28TEST=bntest.c exptest.c
29APPS=
30
31LIB=$(TOP)/libcrypto.a
32LIBSRC= bn_add.c bn_div.c bn_exp.c bn_lib.c bn_ctx.c bn_mul.c bn_mod.c \
33 bn_print.c bn_rand.c bn_shift.c bn_word.c bn_blind.c \
34 bn_kron.c bn_sqrt.c bn_gcd.c bn_prime.c bn_err.c bn_sqr.c bn_asm.c \
35 bn_recp.c bn_mont.c bn_mpi.c bn_exp2.c
36
37LIBOBJ= bn_add.o bn_div.o bn_exp.o bn_lib.o bn_ctx.o bn_mul.o bn_mod.o \
38 bn_print.o bn_rand.o bn_shift.o bn_word.o bn_blind.o \
39 bn_kron.o bn_sqrt.o bn_gcd.o bn_prime.o bn_err.o bn_sqr.o $(BN_ASM) \
40 bn_recp.o bn_mont.o bn_mpi.o bn_exp2.o
41
42SRC= $(LIBSRC)
43
44EXHEADER= bn.h
45HEADER= bn_lcl.h bn_prime.h $(EXHEADER)
46
47ALL= $(GENERAL) $(SRC) $(HEADER)
48
49top:
50 (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all)
51
52all: lib
53
54bn_prime.h: bn_prime.pl
55 $(PERL) bn_prime.pl >bn_prime.h
56
57divtest: divtest.c ../../libcrypto.a
58 cc -I../../include divtest.c -o divtest ../../libcrypto.a
59
60bnbug: bnbug.c ../../libcrypto.a top
61 cc -g -I../../include bnbug.c -o bnbug ../../libcrypto.a
62
63lib: $(LIBOBJ)
64 $(AR) $(LIB) $(LIBOBJ)
65 $(RANLIB) $(LIB) || echo Never mind.
66 @touch lib
67
68# elf
69asm/bn86-elf.s: asm/bn-586.pl ../perlasm/x86asm.pl
70 (cd asm; $(PERL) bn-586.pl elf $(CFLAGS) > bn86-elf.s)
71
72asm/co86-elf.s: asm/co-586.pl ../perlasm/x86asm.pl
73 (cd asm; $(PERL) co-586.pl elf $(CFLAGS) > co86-elf.s)
74
75# a.out
76asm/bn86-out.o: asm/bn86unix.cpp
77 $(CPP) -DOUT asm/bn86unix.cpp | as -o asm/bn86-out.o
78
79asm/co86-out.o: asm/co86unix.cpp
80 $(CPP) -DOUT asm/co86unix.cpp | as -o asm/co86-out.o
81
82# bsdi
83asm/bn86bsdi.o: asm/bn86unix.cpp
84 $(CPP) -DBSDI asm/bn86unix.cpp | sed 's/ :/:/' | as -o asm/bn86bsdi.o
85
86asm/co86bsdi.o: asm/co86unix.cpp
87 $(CPP) -DBSDI asm/co86unix.cpp | sed 's/ :/:/' | as -o asm/co86bsdi.o
88
89asm/bn86unix.cpp: asm/bn-586.pl ../perlasm/x86asm.pl
90 (cd asm; $(PERL) bn-586.pl cpp >bn86unix.cpp )
91
92asm/co86unix.cpp: asm/co-586.pl ../perlasm/x86asm.pl
93 (cd asm; $(PERL) co-586.pl cpp >co86unix.cpp )
94
95asm/sparcv8.o: asm/sparcv8.S
96
97asm/sparcv8plus.o: asm/sparcv8plus.S
98
99# Old GNU assembler doesn't understand V9 instructions, so we
100# hire /usr/ccs/bin/as to do the job. Note that option is called
101# *-gcc27, but even gcc 2>=8 users may experience similar problem
102# if they didn't bother to upgrade GNU assembler. Such users should
103# not choose this option, but be adviced to *remove* GNU assembler
104# or upgrade it.
105asm/sparcv8plus-gcc27.o: asm/sparcv8plus.S
106 $(CC) $(ASFLAGS) -E asm/sparcv8plus.S | \
107 /usr/ccs/bin/as -xarch=v8plus - -o asm/sparcv8plus-gcc27.o
108
109
110asm/ia64.o: asm/ia64.S
111
112# Some compiler drivers (most notably HP-UX and Intel C++) don't
113# understand .S extension:-( I wish I could pipe output from cc -E,
114# but it's too compiler driver/ABI dependent to cover with a single
115# rule... <appro@fy.chalmers.se>
116asm/ia64-cpp.o: asm/ia64.S
117 $(CC) $(ASFLAGS) -E asm/ia64.S > /tmp/ia64.$$$$.s && \
118 $(CC) $(ASFLAGS) -c -o asm/ia64-cpp.o /tmp/ia64.$$$$.s; \
119 rm -f /tmp/ia64.$$$$.s
120
121asm/x86_64-gcc.o: asm/x86_64-gcc.c
122
123asm/pa-risc2W.o: asm/pa-risc2W.s
124 /usr/ccs/bin/as -o asm/pa-rics2W.o asm/pa-risc2W.s
125
126files:
127 $(PERL) $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO
128
129links:
130 @sh $(TOP)/util/point.sh Makefile.ssl Makefile
131 @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
132 @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
133 @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
134
135install:
136 @for i in $(EXHEADER) ; \
137 do \
138 (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
139 chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
140 done;
141
142exptest:
143 rm -f exptest
144 gcc -I../../include -g2 -ggdb -o exptest exptest.c ../../libcrypto.a
145
146div:
147 rm -f a.out
148 gcc -I.. -g div.c ../../libcrypto.a
149
150tags:
151 ctags $(SRC)
152
153tests:
154
155lint:
156 lint -DLINT $(INCLUDES) $(SRC)>fluff
157
158depend:
159 $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
160
161dclean:
162 $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
163 mv -f Makefile.new $(MAKEFILE)
164
165clean:
166 rm -f asm/co86unix.cpp asm/bn86unix.cpp asm/*-elf.* *.o */*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff bn_asm.s
167
168# DO NOT DELETE THIS LINE -- make depend depends on it.
169
170bn_add.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h
171bn_add.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
172bn_add.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
173bn_add.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
174bn_add.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
175bn_add.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
176bn_add.o: ../cryptlib.h bn_add.c bn_lcl.h
177bn_asm.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h
178bn_asm.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
179bn_asm.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
180bn_asm.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
181bn_asm.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
182bn_asm.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
183bn_asm.o: ../cryptlib.h bn_asm.c bn_lcl.h
184bn_blind.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h
185bn_blind.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
186bn_blind.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
187bn_blind.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
188bn_blind.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
189bn_blind.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
190bn_blind.o: ../cryptlib.h bn_blind.c bn_lcl.h
191bn_ctx.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h
192bn_ctx.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
193bn_ctx.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
194bn_ctx.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
195bn_ctx.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
196bn_ctx.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
197bn_ctx.o: ../cryptlib.h bn_ctx.c bn_lcl.h
198bn_div.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h
199bn_div.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
200bn_div.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
201bn_div.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
202bn_div.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
203bn_div.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
204bn_div.o: ../cryptlib.h bn_div.c bn_lcl.h
205bn_err.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
206bn_err.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
207bn_err.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
208bn_err.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
209bn_err.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
210bn_err.o: ../../include/openssl/symhacks.h bn_err.c
211bn_exp.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h
212bn_exp.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
213bn_exp.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
214bn_exp.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
215bn_exp.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
216bn_exp.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
217bn_exp.o: ../cryptlib.h bn_exp.c bn_lcl.h
218bn_exp2.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h
219bn_exp2.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
220bn_exp2.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
221bn_exp2.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
222bn_exp2.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
223bn_exp2.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
224bn_exp2.o: ../cryptlib.h bn_exp2.c bn_lcl.h
225bn_gcd.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h
226bn_gcd.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
227bn_gcd.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
228bn_gcd.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
229bn_gcd.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
230bn_gcd.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
231bn_gcd.o: ../cryptlib.h bn_gcd.c bn_lcl.h
232bn_kron.o: ../../include/openssl/bn.h ../../include/openssl/e_os2.h
233bn_kron.o: ../../include/openssl/opensslconf.h bn_kron.c bn_lcl.h
234bn_lib.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h
235bn_lib.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
236bn_lib.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
237bn_lib.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
238bn_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
239bn_lib.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
240bn_lib.o: ../cryptlib.h bn_lcl.h bn_lib.c
241bn_mod.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h
242bn_mod.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
243bn_mod.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
244bn_mod.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
245bn_mod.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
246bn_mod.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
247bn_mod.o: ../cryptlib.h bn_lcl.h bn_mod.c
248bn_mont.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h
249bn_mont.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
250bn_mont.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
251bn_mont.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
252bn_mont.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
253bn_mont.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
254bn_mont.o: ../cryptlib.h bn_lcl.h bn_mont.c
255bn_mpi.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h
256bn_mpi.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
257bn_mpi.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
258bn_mpi.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
259bn_mpi.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
260bn_mpi.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
261bn_mpi.o: ../cryptlib.h bn_lcl.h bn_mpi.c
262bn_mul.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h
263bn_mul.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
264bn_mul.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
265bn_mul.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
266bn_mul.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
267bn_mul.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
268bn_mul.o: ../cryptlib.h bn_lcl.h bn_mul.c
269bn_prime.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h
270bn_prime.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
271bn_prime.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
272bn_prime.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
273bn_prime.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
274bn_prime.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h
275bn_prime.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
276bn_prime.o: ../cryptlib.h bn_lcl.h bn_prime.c bn_prime.h
277bn_print.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h
278bn_print.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
279bn_print.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
280bn_print.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
281bn_print.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
282bn_print.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
283bn_print.o: ../cryptlib.h bn_lcl.h bn_print.c
284bn_rand.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h
285bn_rand.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
286bn_rand.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
287bn_rand.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
288bn_rand.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
289bn_rand.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h
290bn_rand.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
291bn_rand.o: ../cryptlib.h bn_lcl.h bn_rand.c
292bn_recp.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h
293bn_recp.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
294bn_recp.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
295bn_recp.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
296bn_recp.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
297bn_recp.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
298bn_recp.o: ../cryptlib.h bn_lcl.h bn_recp.c
299bn_shift.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h
300bn_shift.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
301bn_shift.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
302bn_shift.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
303bn_shift.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
304bn_shift.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
305bn_shift.o: ../cryptlib.h bn_lcl.h bn_shift.c
306bn_sqr.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h
307bn_sqr.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
308bn_sqr.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
309bn_sqr.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
310bn_sqr.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
311bn_sqr.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
312bn_sqr.o: ../cryptlib.h bn_lcl.h bn_sqr.c
313bn_sqrt.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h
314bn_sqrt.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
315bn_sqrt.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
316bn_sqrt.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
317bn_sqrt.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
318bn_sqrt.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
319bn_sqrt.o: ../cryptlib.h bn_lcl.h bn_sqrt.c
320bn_word.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h
321bn_word.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
322bn_word.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
323bn_word.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
324bn_word.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
325bn_word.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
326bn_word.o: ../cryptlib.h bn_lcl.h bn_word.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/alpha.s b/src/lib/libcrypto/bn/asm/alpha.s
new file mode 100644
index 0000000000..555ff0b92d
--- /dev/null
+++ b/src/lib/libcrypto/bn/asm/alpha.s
@@ -0,0 +1,3199 @@
1 # DEC Alpha assember
2 # The bn_div_words is actually gcc output but the other parts are hand done.
3 # Thanks to tzeruch@ceddec.com for sending me the gcc output for
4 # bn_div_words.
5 # I've gone back and re-done most of routines.
6 # The key thing to remeber for the 164 CPU is that while a
7 # multiply operation takes 8 cycles, another one can only be issued
8 # after 4 cycles have elapsed. I've done modification to help
9 # improve this. Also, normally, a ld instruction will not be available
10 # for about 3 cycles.
11 .file 1 "bn_asm.c"
12 .set noat
13gcc2_compiled.:
14__gnu_compiled_c:
15 .text
16 .align 3
17 .globl bn_mul_add_words
18 .ent bn_mul_add_words
19bn_mul_add_words:
20bn_mul_add_words..ng:
21 .frame $30,0,$26,0
22 .prologue 0
23 .align 5
24 subq $18,4,$18
25 bis $31,$31,$0
26 blt $18,$43 # if we are -1, -2, -3 or -4 goto tail code
27 ldq $20,0($17) # 1 1
28 ldq $1,0($16) # 1 1
29 .align 3
30$42:
31 mulq $20,$19,$5 # 1 2 1 ######
32 ldq $21,8($17) # 2 1
33 ldq $2,8($16) # 2 1
34 umulh $20,$19,$20 # 1 2 ######
35 ldq $27,16($17) # 3 1
36 ldq $3,16($16) # 3 1
37 mulq $21,$19,$6 # 2 2 1 ######
38 ldq $28,24($17) # 4 1
39 addq $1,$5,$1 # 1 2 2
40 ldq $4,24($16) # 4 1
41 umulh $21,$19,$21 # 2 2 ######
42 cmpult $1,$5,$22 # 1 2 3 1
43 addq $20,$22,$20 # 1 3 1
44 addq $1,$0,$1 # 1 2 3 1
45 mulq $27,$19,$7 # 3 2 1 ######
46 cmpult $1,$0,$0 # 1 2 3 2
47 addq $2,$6,$2 # 2 2 2
48 addq $20,$0,$0 # 1 3 2
49 cmpult $2,$6,$23 # 2 2 3 1
50 addq $21,$23,$21 # 2 3 1
51 umulh $27,$19,$27 # 3 2 ######
52 addq $2,$0,$2 # 2 2 3 1
53 cmpult $2,$0,$0 # 2 2 3 2
54 subq $18,4,$18
55 mulq $28,$19,$8 # 4 2 1 ######
56 addq $21,$0,$0 # 2 3 2
57 addq $3,$7,$3 # 3 2 2
58 addq $16,32,$16
59 cmpult $3,$7,$24 # 3 2 3 1
60 stq $1,-32($16) # 1 2 4
61 umulh $28,$19,$28 # 4 2 ######
62 addq $27,$24,$27 # 3 3 1
63 addq $3,$0,$3 # 3 2 3 1
64 stq $2,-24($16) # 2 2 4
65 cmpult $3,$0,$0 # 3 2 3 2
66 stq $3,-16($16) # 3 2 4
67 addq $4,$8,$4 # 4 2 2
68 addq $27,$0,$0 # 3 3 2
69 cmpult $4,$8,$25 # 4 2 3 1
70 addq $17,32,$17
71 addq $28,$25,$28 # 4 3 1
72 addq $4,$0,$4 # 4 2 3 1
73 cmpult $4,$0,$0 # 4 2 3 2
74 stq $4,-8($16) # 4 2 4
75 addq $28,$0,$0 # 4 3 2
76 blt $18,$43
77
78 ldq $20,0($17) # 1 1
79 ldq $1,0($16) # 1 1
80
81 br $42
82
83 .align 4
84$45:
85 ldq $20,0($17) # 4 1
86 ldq $1,0($16) # 4 1
87 mulq $20,$19,$5 # 4 2 1
88 subq $18,1,$18
89 addq $16,8,$16
90 addq $17,8,$17
91 umulh $20,$19,$20 # 4 2
92 addq $1,$5,$1 # 4 2 2
93 cmpult $1,$5,$22 # 4 2 3 1
94 addq $20,$22,$20 # 4 3 1
95 addq $1,$0,$1 # 4 2 3 1
96 cmpult $1,$0,$0 # 4 2 3 2
97 addq $20,$0,$0 # 4 3 2
98 stq $1,-8($16) # 4 2 4
99 bgt $18,$45
100 ret $31,($26),1 # else exit
101
102 .align 4
103$43:
104 addq $18,4,$18
105 bgt $18,$45 # goto tail code
106 ret $31,($26),1 # else exit
107
108 .end bn_mul_add_words
109 .align 3
110 .globl bn_mul_words
111 .ent bn_mul_words
112bn_mul_words:
113bn_mul_words..ng:
114 .frame $30,0,$26,0
115 .prologue 0
116 .align 5
117 subq $18,4,$18
118 bis $31,$31,$0
119 blt $18,$143 # if we are -1, -2, -3 or -4 goto tail code
120 ldq $20,0($17) # 1 1
121 .align 3
122$142:
123
124 mulq $20,$19,$5 # 1 2 1 #####
125 ldq $21,8($17) # 2 1
126 ldq $27,16($17) # 3 1
127 umulh $20,$19,$20 # 1 2 #####
128 ldq $28,24($17) # 4 1
129 mulq $21,$19,$6 # 2 2 1 #####
130 addq $5,$0,$5 # 1 2 3 1
131 subq $18,4,$18
132 cmpult $5,$0,$0 # 1 2 3 2
133 umulh $21,$19,$21 # 2 2 #####
134 addq $20,$0,$0 # 1 3 2
135 addq $17,32,$17
136 addq $6,$0,$6 # 2 2 3 1
137 mulq $27,$19,$7 # 3 2 1 #####
138 cmpult $6,$0,$0 # 2 2 3 2
139 addq $21,$0,$0 # 2 3 2
140 addq $16,32,$16
141 umulh $27,$19,$27 # 3 2 #####
142 stq $5,-32($16) # 1 2 4
143 mulq $28,$19,$8 # 4 2 1 #####
144 addq $7,$0,$7 # 3 2 3 1
145 stq $6,-24($16) # 2 2 4
146 cmpult $7,$0,$0 # 3 2 3 2
147 umulh $28,$19,$28 # 4 2 #####
148 addq $27,$0,$0 # 3 3 2
149 stq $7,-16($16) # 3 2 4
150 addq $8,$0,$8 # 4 2 3 1
151 cmpult $8,$0,$0 # 4 2 3 2
152
153 addq $28,$0,$0 # 4 3 2
154
155 stq $8,-8($16) # 4 2 4
156
157 blt $18,$143
158
159 ldq $20,0($17) # 1 1
160
161 br $142
162
163 .align 4
164$145:
165 ldq $20,0($17) # 4 1
166 mulq $20,$19,$5 # 4 2 1
167 subq $18,1,$18
168 umulh $20,$19,$20 # 4 2
169 addq $5,$0,$5 # 4 2 3 1
170 addq $16,8,$16
171 cmpult $5,$0,$0 # 4 2 3 2
172 addq $17,8,$17
173 addq $20,$0,$0 # 4 3 2
174 stq $5,-8($16) # 4 2 4
175
176 bgt $18,$145
177 ret $31,($26),1 # else exit
178
179 .align 4
180$143:
181 addq $18,4,$18
182 bgt $18,$145 # goto tail code
183 ret $31,($26),1 # else exit
184
185 .end bn_mul_words
186 .align 3
187 .globl bn_sqr_words
188 .ent bn_sqr_words
189bn_sqr_words:
190bn_sqr_words..ng:
191 .frame $30,0,$26,0
192 .prologue 0
193
194 subq $18,4,$18
195 blt $18,$543 # if we are -1, -2, -3 or -4 goto tail code
196 ldq $20,0($17) # 1 1
197 .align 3
198$542:
199 mulq $20,$20,$5 ######
200 ldq $21,8($17) # 1 1
201 subq $18,4
202 umulh $20,$20,$1 ######
203 ldq $27,16($17) # 1 1
204 mulq $21,$21,$6 ######
205 ldq $28,24($17) # 1 1
206 stq $5,0($16) # r[0]
207 umulh $21,$21,$2 ######
208 stq $1,8($16) # r[1]
209 mulq $27,$27,$7 ######
210 stq $6,16($16) # r[0]
211 umulh $27,$27,$3 ######
212 stq $2,24($16) # r[1]
213 mulq $28,$28,$8 ######
214 stq $7,32($16) # r[0]
215 umulh $28,$28,$4 ######
216 stq $3,40($16) # r[1]
217
218 addq $16,64,$16
219 addq $17,32,$17
220 stq $8,-16($16) # r[0]
221 stq $4,-8($16) # r[1]
222
223 blt $18,$543
224 ldq $20,0($17) # 1 1
225 br $542
226
227$442:
228 ldq $20,0($17) # a[0]
229 mulq $20,$20,$5 # a[0]*w low part r2
230 addq $16,16,$16
231 addq $17,8,$17
232 subq $18,1,$18
233 umulh $20,$20,$1 # a[0]*w high part r3
234 stq $5,-16($16) # r[0]
235 stq $1,-8($16) # r[1]
236
237 bgt $18,$442
238 ret $31,($26),1 # else exit
239
240 .align 4
241$543:
242 addq $18,4,$18
243 bgt $18,$442 # goto tail code
244 ret $31,($26),1 # else exit
245 .end bn_sqr_words
246
247 .align 3
248 .globl bn_add_words
249 .ent bn_add_words
250bn_add_words:
251bn_add_words..ng:
252 .frame $30,0,$26,0
253 .prologue 0
254
255 subq $19,4,$19
256 bis $31,$31,$0 # carry = 0
257 blt $19,$900
258 ldq $5,0($17) # a[0]
259 ldq $1,0($18) # b[1]
260 .align 3
261$901:
262 addq $1,$5,$1 # r=a+b;
263 ldq $6,8($17) # a[1]
264 cmpult $1,$5,$22 # did we overflow?
265 ldq $2,8($18) # b[1]
266 addq $1,$0,$1 # c+= overflow
267 ldq $7,16($17) # a[2]
268 cmpult $1,$0,$0 # overflow?
269 ldq $3,16($18) # b[2]
270 addq $0,$22,$0
271 ldq $8,24($17) # a[3]
272 addq $2,$6,$2 # r=a+b;
273 ldq $4,24($18) # b[3]
274 cmpult $2,$6,$23 # did we overflow?
275 addq $3,$7,$3 # r=a+b;
276 addq $2,$0,$2 # c+= overflow
277 cmpult $3,$7,$24 # did we overflow?
278 cmpult $2,$0,$0 # overflow?
279 addq $4,$8,$4 # r=a+b;
280 addq $0,$23,$0
281 cmpult $4,$8,$25 # did we overflow?
282 addq $3,$0,$3 # c+= overflow
283 stq $1,0($16) # r[0]=c
284 cmpult $3,$0,$0 # overflow?
285 stq $2,8($16) # r[1]=c
286 addq $0,$24,$0
287 stq $3,16($16) # r[2]=c
288 addq $4,$0,$4 # c+= overflow
289 subq $19,4,$19 # loop--
290 cmpult $4,$0,$0 # overflow?
291 addq $17,32,$17 # a++
292 addq $0,$25,$0
293 stq $4,24($16) # r[3]=c
294 addq $18,32,$18 # b++
295 addq $16,32,$16 # r++
296
297 blt $19,$900
298 ldq $5,0($17) # a[0]
299 ldq $1,0($18) # b[1]
300 br $901
301 .align 4
302$945:
303 ldq $5,0($17) # a[0]
304 ldq $1,0($18) # b[1]
305 addq $1,$5,$1 # r=a+b;
306 subq $19,1,$19 # loop--
307 addq $1,$0,$1 # c+= overflow
308 addq $17,8,$17 # a++
309 cmpult $1,$5,$22 # did we overflow?
310 cmpult $1,$0,$0 # overflow?
311 addq $18,8,$18 # b++
312 stq $1,0($16) # r[0]=c
313 addq $0,$22,$0
314 addq $16,8,$16 # r++
315
316 bgt $19,$945
317 ret $31,($26),1 # else exit
318
319$900:
320 addq $19,4,$19
321 bgt $19,$945 # goto tail code
322 ret $31,($26),1 # else exit
323 .end bn_add_words
324
325 #
326 # What follows was taken directly from the C compiler with a few
327 # hacks to redo the lables.
328 #
329.text
330 .align 3
331 .globl bn_div_words
332 .ent bn_div_words
333bn_div_words:
334 ldgp $29,0($27)
335bn_div_words..ng:
336 lda $30,-48($30)
337 .frame $30,48,$26,0
338 stq $26,0($30)
339 stq $9,8($30)
340 stq $10,16($30)
341 stq $11,24($30)
342 stq $12,32($30)
343 stq $13,40($30)
344 .mask 0x4003e00,-48
345 .prologue 1
346 bis $16,$16,$9
347 bis $17,$17,$10
348 bis $18,$18,$11
349 bis $31,$31,$13
350 bis $31,2,$12
351 bne $11,$119
352 lda $0,-1
353 br $31,$136
354 .align 4
355$119:
356 bis $11,$11,$16
357 jsr $26,BN_num_bits_word
358 ldgp $29,0($26)
359 subq $0,64,$1
360 beq $1,$120
361 bis $31,1,$1
362 sll $1,$0,$1
363 cmpule $9,$1,$1
364 bne $1,$120
365 # lda $16,_IO_stderr_
366 # lda $17,$C32
367 # bis $0,$0,$18
368 # jsr $26,fprintf
369 # ldgp $29,0($26)
370 jsr $26,abort
371 ldgp $29,0($26)
372 .align 4
373$120:
374 bis $31,64,$3
375 cmpult $9,$11,$2
376 subq $3,$0,$1
377 addl $1,$31,$0
378 subq $9,$11,$1
379 cmoveq $2,$1,$9
380 beq $0,$122
381 zapnot $0,15,$2
382 subq $3,$0,$1
383 sll $11,$2,$11
384 sll $9,$2,$3
385 srl $10,$1,$1
386 sll $10,$2,$10
387 bis $3,$1,$9
388$122:
389 srl $11,32,$5
390 zapnot $11,15,$6
391 lda $7,-1
392 .align 5
393$123:
394 srl $9,32,$1
395 subq $1,$5,$1
396 bne $1,$126
397 zapnot $7,15,$27
398 br $31,$127
399 .align 4
400$126:
401 bis $9,$9,$24
402 bis $5,$5,$25
403 divqu $24,$25,$27
404$127:
405 srl $10,32,$4
406 .align 5
407$128:
408 mulq $27,$5,$1
409 subq $9,$1,$3
410 zapnot $3,240,$1
411 bne $1,$129
412 mulq $6,$27,$2
413 sll $3,32,$1
414 addq $1,$4,$1
415 cmpule $2,$1,$2
416 bne $2,$129
417 subq $27,1,$27
418 br $31,$128
419 .align 4
420$129:
421 mulq $27,$6,$1
422 mulq $27,$5,$4
423 srl $1,32,$3
424 sll $1,32,$1
425 addq $4,$3,$4
426 cmpult $10,$1,$2
427 subq $10,$1,$10
428 addq $2,$4,$2
429 cmpult $9,$2,$1
430 bis $2,$2,$4
431 beq $1,$134
432 addq $9,$11,$9
433 subq $27,1,$27
434$134:
435 subl $12,1,$12
436 subq $9,$4,$9
437 beq $12,$124
438 sll $27,32,$13
439 sll $9,32,$2
440 srl $10,32,$1
441 sll $10,32,$10
442 bis $2,$1,$9
443 br $31,$123
444 .align 4
445$124:
446 bis $13,$27,$0
447$136:
448 ldq $26,0($30)
449 ldq $9,8($30)
450 ldq $10,16($30)
451 ldq $11,24($30)
452 ldq $12,32($30)
453 ldq $13,40($30)
454 addq $30,48,$30
455 ret $31,($26),1
456 .end bn_div_words
457
458 .set noat
459 .text
460 .align 3
461 .globl bn_sub_words
462 .ent bn_sub_words
463bn_sub_words:
464bn_sub_words..ng:
465 .frame $30,0,$26,0
466 .prologue 0
467
468 subq $19, 4, $19
469 bis $31, $31, $0
470 blt $19, $100
471 ldq $1, 0($17)
472 ldq $2, 0($18)
473$101:
474 ldq $3, 8($17)
475 cmpult $1, $2, $4
476 ldq $5, 8($18)
477 subq $1, $2, $1
478 ldq $6, 16($17)
479 cmpult $1, $0, $2
480 ldq $7, 16($18)
481 subq $1, $0, $23
482 ldq $8, 24($17)
483 addq $2, $4, $0
484 cmpult $3, $5, $24
485 subq $3, $5, $3
486 ldq $22, 24($18)
487 cmpult $3, $0, $5
488 subq $3, $0, $25
489 addq $5, $24, $0
490 cmpult $6, $7, $27
491 subq $6, $7, $6
492 stq $23, 0($16)
493 cmpult $6, $0, $7
494 subq $6, $0, $28
495 addq $7, $27, $0
496 cmpult $8, $22, $21
497 subq $8, $22, $8
498 stq $25, 8($16)
499 cmpult $8, $0, $22
500 subq $8, $0, $20
501 addq $22, $21, $0
502 stq $28, 16($16)
503 subq $19, 4, $19
504 stq $20, 24($16)
505 addq $17, 32, $17
506 addq $18, 32, $18
507 addq $16, 32, $16
508 blt $19, $100
509 ldq $1, 0($17)
510 ldq $2, 0($18)
511 br $101
512$102:
513 ldq $1, 0($17)
514 ldq $2, 0($18)
515 cmpult $1, $2, $27
516 subq $1, $2, $1
517 cmpult $1, $0, $2
518 subq $1, $0, $1
519 stq $1, 0($16)
520 addq $2, $27, $0
521 addq $17, 8, $17
522 addq $18, 8, $18
523 addq $16, 8, $16
524 subq $19, 1, $19
525 bgt $19, $102
526 ret $31,($26),1
527$100:
528 addq $19, 4, $19
529 bgt $19, $102
530$103:
531 ret $31,($26),1
532 .end bn_sub_words
533 .text
534 .align 3
535 .globl bn_mul_comba4
536 .ent bn_mul_comba4
537bn_mul_comba4:
538bn_mul_comba4..ng:
539 .frame $30,0,$26,0
540 .prologue 0
541
542 ldq $0, 0($17)
543 ldq $1, 0($18)
544 ldq $2, 8($17)
545 ldq $3, 8($18)
546 ldq $4, 16($17)
547 ldq $5, 16($18)
548 ldq $6, 24($17)
549 ldq $7, 24($18)
550 bis $31, $31, $23
551 mulq $0, $1, $8
552 umulh $0, $1, $22
553 stq $8, 0($16)
554 bis $31, $31, $8
555 mulq $0, $3, $24
556 umulh $0, $3, $25
557 addq $22, $24, $22
558 cmpult $22, $24, $27
559 addq $27, $25, $25
560 addq $23, $25, $23
561 cmpult $23, $25, $28
562 addq $8, $28, $8
563 mulq $2, $1, $21
564 umulh $2, $1, $20
565 addq $22, $21, $22
566 cmpult $22, $21, $19
567 addq $19, $20, $20
568 addq $23, $20, $23
569 cmpult $23, $20, $17
570 addq $8, $17, $8
571 stq $22, 8($16)
572 bis $31, $31, $22
573 mulq $2, $3, $18
574 umulh $2, $3, $24
575 addq $23, $18, $23
576 cmpult $23, $18, $27
577 addq $27, $24, $24
578 addq $8, $24, $8
579 cmpult $8, $24, $25
580 addq $22, $25, $22
581 mulq $0, $5, $28
582 umulh $0, $5, $21
583 addq $23, $28, $23
584 cmpult $23, $28, $19
585 addq $19, $21, $21
586 addq $8, $21, $8
587 cmpult $8, $21, $20
588 addq $22, $20, $22
589 mulq $4, $1, $17
590 umulh $4, $1, $18
591 addq $23, $17, $23
592 cmpult $23, $17, $27
593 addq $27, $18, $18
594 addq $8, $18, $8
595 cmpult $8, $18, $24
596 addq $22, $24, $22
597 stq $23, 16($16)
598 bis $31, $31, $23
599 mulq $0, $7, $25
600 umulh $0, $7, $28
601 addq $8, $25, $8
602 cmpult $8, $25, $19
603 addq $19, $28, $28
604 addq $22, $28, $22
605 cmpult $22, $28, $21
606 addq $23, $21, $23
607 mulq $2, $5, $20
608 umulh $2, $5, $17
609 addq $8, $20, $8
610 cmpult $8, $20, $27
611 addq $27, $17, $17
612 addq $22, $17, $22
613 cmpult $22, $17, $18
614 addq $23, $18, $23
615 mulq $4, $3, $24
616 umulh $4, $3, $25
617 addq $8, $24, $8
618 cmpult $8, $24, $19
619 addq $19, $25, $25
620 addq $22, $25, $22
621 cmpult $22, $25, $28
622 addq $23, $28, $23
623 mulq $6, $1, $21
624 umulh $6, $1, $0
625 addq $8, $21, $8
626 cmpult $8, $21, $20
627 addq $20, $0, $0
628 addq $22, $0, $22
629 cmpult $22, $0, $27
630 addq $23, $27, $23
631 stq $8, 24($16)
632 bis $31, $31, $8
633 mulq $2, $7, $17
634 umulh $2, $7, $18
635 addq $22, $17, $22
636 cmpult $22, $17, $24
637 addq $24, $18, $18
638 addq $23, $18, $23
639 cmpult $23, $18, $19
640 addq $8, $19, $8
641 mulq $4, $5, $25
642 umulh $4, $5, $28
643 addq $22, $25, $22
644 cmpult $22, $25, $21
645 addq $21, $28, $28
646 addq $23, $28, $23
647 cmpult $23, $28, $20
648 addq $8, $20, $8
649 mulq $6, $3, $0
650 umulh $6, $3, $27
651 addq $22, $0, $22
652 cmpult $22, $0, $1
653 addq $1, $27, $27
654 addq $23, $27, $23
655 cmpult $23, $27, $17
656 addq $8, $17, $8
657 stq $22, 32($16)
658 bis $31, $31, $22
659 mulq $4, $7, $24
660 umulh $4, $7, $18
661 addq $23, $24, $23
662 cmpult $23, $24, $19
663 addq $19, $18, $18
664 addq $8, $18, $8
665 cmpult $8, $18, $2
666 addq $22, $2, $22
667 mulq $6, $5, $25
668 umulh $6, $5, $21
669 addq $23, $25, $23
670 cmpult $23, $25, $28
671 addq $28, $21, $21
672 addq $8, $21, $8
673 cmpult $8, $21, $20
674 addq $22, $20, $22
675 stq $23, 40($16)
676 bis $31, $31, $23
677 mulq $6, $7, $0
678 umulh $6, $7, $1
679 addq $8, $0, $8
680 cmpult $8, $0, $27
681 addq $27, $1, $1
682 addq $22, $1, $22
683 cmpult $22, $1, $17
684 addq $23, $17, $23
685 stq $8, 48($16)
686 stq $22, 56($16)
687 ret $31,($26),1
688 .end bn_mul_comba4
689 .text
690 .align 3
691 .globl bn_mul_comba8
692 .ent bn_mul_comba8
693bn_mul_comba8:
694bn_mul_comba8..ng:
695 .frame $30,0,$26,0
696 .prologue 0
697 ldq $1, 0($17)
698 ldq $2, 0($18)
699 zapnot $1, 15, $7
700 srl $2, 32, $8
701 mulq $8, $7, $22
702 srl $1, 32, $6
703 zapnot $2, 15, $5
704 mulq $5, $6, $4
705 mulq $7, $5, $24
706 addq $22, $4, $22
707 cmpult $22, $4, $1
708 mulq $6, $8, $3
709 beq $1, $173
710 bis $31, 1, $1
711 sll $1, 32, $1
712 addq $3, $1, $3
713$173:
714 sll $22, 32, $4
715 addq $24, $4, $24
716 stq $24, 0($16)
717 ldq $2, 0($17)
718 ldq $1, 8($18)
719 zapnot $2, 15, $7
720 srl $1, 32, $8
721 mulq $8, $7, $25
722 zapnot $1, 15, $5
723 mulq $7, $5, $0
724 srl $2, 32, $6
725 mulq $5, $6, $23
726 mulq $6, $8, $6
727 srl $22, 32, $1
728 cmpult $24, $4, $2
729 addq $3, $1, $3
730 addq $2, $3, $22
731 addq $25, $23, $25
732 cmpult $25, $23, $1
733 bis $31, 1, $2
734 beq $1, $177
735 sll $2, 32, $1
736 addq $6, $1, $6
737$177:
738 sll $25, 32, $23
739 ldq $1, 0($18)
740 addq $0, $23, $0
741 bis $0, $0, $7
742 ldq $3, 8($17)
743 addq $22, $7, $22
744 srl $1, 32, $8
745 cmpult $22, $7, $4
746 zapnot $3, 15, $7
747 mulq $8, $7, $28
748 zapnot $1, 15, $5
749 mulq $7, $5, $21
750 srl $25, 32, $1
751 cmpult $0, $23, $2
752 addq $6, $1, $6
753 addq $2, $6, $6
754 addq $4, $6, $24
755 srl $3, 32, $6
756 mulq $5, $6, $2
757 mulq $6, $8, $6
758 addq $28, $2, $28
759 cmpult $28, $2, $1
760 bis $31, 1, $2
761 beq $1, $181
762 sll $2, 32, $1
763 addq $6, $1, $6
764$181:
765 sll $28, 32, $2
766 addq $21, $2, $21
767 bis $21, $21, $7
768 addq $22, $7, $22
769 stq $22, 8($16)
770 ldq $3, 16($17)
771 ldq $1, 0($18)
772 cmpult $22, $7, $4
773 zapnot $3, 15, $7
774 srl $1, 32, $8
775 mulq $8, $7, $22
776 zapnot $1, 15, $5
777 mulq $7, $5, $20
778 srl $28, 32, $1
779 cmpult $21, $2, $2
780 addq $6, $1, $6
781 addq $2, $6, $6
782 addq $4, $6, $6
783 addq $24, $6, $24
784 cmpult $24, $6, $23
785 srl $3, 32, $6
786 mulq $5, $6, $2
787 mulq $6, $8, $6
788 addq $22, $2, $22
789 cmpult $22, $2, $1
790 bis $31, 1, $2
791 beq $1, $185
792 sll $2, 32, $1
793 addq $6, $1, $6
794$185:
795 sll $22, 32, $2
796 ldq $1, 8($18)
797 addq $20, $2, $20
798 bis $20, $20, $7
799 ldq $4, 8($17)
800 addq $24, $7, $24
801 srl $1, 32, $8
802 cmpult $24, $7, $3
803 zapnot $4, 15, $7
804 mulq $8, $7, $25
805 zapnot $1, 15, $5
806 mulq $7, $5, $0
807 srl $22, 32, $1
808 cmpult $20, $2, $2
809 addq $6, $1, $6
810 addq $2, $6, $6
811 addq $3, $6, $6
812 addq $23, $6, $23
813 cmpult $23, $6, $22
814 srl $4, 32, $6
815 mulq $5, $6, $5
816 bis $31, 1, $21
817 addq $25, $5, $25
818 cmpult $25, $5, $1
819 mulq $6, $8, $6
820 beq $1, $189
821 sll $21, 32, $1
822 addq $6, $1, $6
823$189:
824 sll $25, 32, $5
825 ldq $2, 16($18)
826 addq $0, $5, $0
827 bis $0, $0, $7
828 ldq $4, 0($17)
829 addq $24, $7, $24
830 srl $2, 32, $8
831 cmpult $24, $7, $3
832 zapnot $4, 15, $7
833 mulq $8, $7, $28
834 srl $25, 32, $1
835 addq $6, $1, $6
836 cmpult $0, $5, $1
837 zapnot $2, 15, $5
838 addq $1, $6, $6
839 addq $3, $6, $6
840 addq $23, $6, $23
841 cmpult $23, $6, $1
842 srl $4, 32, $6
843 mulq $5, $6, $25
844 mulq $7, $5, $2
845 addq $1, $22, $22
846 addq $28, $25, $28
847 cmpult $28, $25, $1
848 mulq $6, $8, $6
849 beq $1, $193
850 sll $21, 32, $1
851 addq $6, $1, $6
852$193:
853 sll $28, 32, $25
854 addq $2, $25, $2
855 bis $2, $2, $7
856 addq $24, $7, $24
857 stq $24, 16($16)
858 ldq $4, 0($17)
859 ldq $5, 24($18)
860 cmpult $24, $7, $3
861 zapnot $4, 15, $7
862 srl $5, 32, $8
863 mulq $8, $7, $0
864 srl $28, 32, $1
865 cmpult $2, $25, $2
866 addq $6, $1, $6
867 addq $2, $6, $6
868 addq $3, $6, $6
869 addq $23, $6, $23
870 cmpult $23, $6, $1
871 srl $4, 32, $6
872 zapnot $5, 15, $5
873 mulq $5, $6, $24
874 mulq $7, $5, $2
875 addq $1, $22, $22
876 addq $0, $24, $0
877 cmpult $0, $24, $1
878 mulq $6, $8, $6
879 beq $1, $197
880 sll $21, 32, $1
881 addq $6, $1, $6
882$197:
883 sll $0, 32, $24
884 ldq $1, 16($18)
885 addq $2, $24, $2
886 bis $2, $2, $7
887 ldq $4, 8($17)
888 addq $23, $7, $23
889 srl $1, 32, $8
890 cmpult $23, $7, $3
891 zapnot $4, 15, $7
892 mulq $8, $7, $25
893 zapnot $1, 15, $5
894 mulq $7, $5, $21
895 srl $0, 32, $1
896 cmpult $2, $24, $2
897 addq $6, $1, $6
898 addq $2, $6, $6
899 addq $3, $6, $6
900 addq $22, $6, $22
901 cmpult $22, $6, $24
902 srl $4, 32, $6
903 mulq $5, $6, $5
904 bis $31, 1, $20
905 addq $25, $5, $25
906 cmpult $25, $5, $1
907 mulq $6, $8, $6
908 beq $1, $201
909 sll $20, 32, $1
910 addq $6, $1, $6
911$201:
912 sll $25, 32, $5
913 ldq $2, 8($18)
914 addq $21, $5, $21
915 bis $21, $21, $7
916 ldq $4, 16($17)
917 addq $23, $7, $23
918 srl $2, 32, $8
919 cmpult $23, $7, $3
920 zapnot $4, 15, $7
921 mulq $8, $7, $28
922 srl $25, 32, $1
923 addq $6, $1, $6
924 cmpult $21, $5, $1
925 zapnot $2, 15, $5
926 addq $1, $6, $6
927 addq $3, $6, $6
928 addq $22, $6, $22
929 cmpult $22, $6, $1
930 srl $4, 32, $6
931 mulq $5, $6, $25
932 mulq $7, $5, $5
933 addq $1, $24, $24
934 addq $28, $25, $28
935 cmpult $28, $25, $1
936 mulq $6, $8, $6
937 beq $1, $205
938 sll $20, 32, $1
939 addq $6, $1, $6
940$205:
941 sll $28, 32, $25
942 ldq $2, 0($18)
943 addq $5, $25, $5
944 bis $5, $5, $7
945 ldq $4, 24($17)
946 addq $23, $7, $23
947 srl $2, 32, $8
948 cmpult $23, $7, $3
949 zapnot $4, 15, $7
950 mulq $8, $7, $0
951 srl $28, 32, $1
952 addq $6, $1, $6
953 cmpult $5, $25, $1
954 zapnot $2, 15, $5
955 addq $1, $6, $6
956 addq $3, $6, $6
957 addq $22, $6, $22
958 cmpult $22, $6, $1
959 srl $4, 32, $6
960 mulq $5, $6, $25
961 mulq $7, $5, $2
962 addq $1, $24, $24
963 addq $0, $25, $0
964 cmpult $0, $25, $1
965 mulq $6, $8, $6
966 beq $1, $209
967 sll $20, 32, $1
968 addq $6, $1, $6
969$209:
970 sll $0, 32, $25
971 addq $2, $25, $2
972 bis $2, $2, $7
973 addq $23, $7, $23
974 stq $23, 24($16)
975 ldq $4, 32($17)
976 ldq $5, 0($18)
977 cmpult $23, $7, $3
978 zapnot $4, 15, $7
979 srl $5, 32, $8
980 mulq $8, $7, $28
981 srl $0, 32, $1
982 cmpult $2, $25, $2
983 addq $6, $1, $6
984 addq $2, $6, $6
985 addq $3, $6, $6
986 addq $22, $6, $22
987 cmpult $22, $6, $1
988 srl $4, 32, $6
989 zapnot $5, 15, $5
990 mulq $5, $6, $23
991 mulq $7, $5, $2
992 addq $1, $24, $24
993 addq $28, $23, $28
994 cmpult $28, $23, $1
995 mulq $6, $8, $6
996 beq $1, $213
997 sll $20, 32, $1
998 addq $6, $1, $6
999$213:
1000 sll $28, 32, $23
1001 ldq $1, 8($18)
1002 addq $2, $23, $2
1003 bis $2, $2, $7
1004 ldq $4, 24($17)
1005 addq $22, $7, $22
1006 srl $1, 32, $8
1007 cmpult $22, $7, $3
1008 zapnot $4, 15, $7
1009 mulq $8, $7, $25
1010 zapnot $1, 15, $5
1011 mulq $7, $5, $0
1012 srl $28, 32, $1
1013 cmpult $2, $23, $2
1014 addq $6, $1, $6
1015 addq $2, $6, $6
1016 addq $3, $6, $6
1017 addq $24, $6, $24
1018 cmpult $24, $6, $23
1019 srl $4, 32, $6
1020 mulq $5, $6, $5
1021 bis $31, 1, $21
1022 addq $25, $5, $25
1023 cmpult $25, $5, $1
1024 mulq $6, $8, $6
1025 beq $1, $217
1026 sll $21, 32, $1
1027 addq $6, $1, $6
1028$217:
1029 sll $25, 32, $5
1030 ldq $2, 16($18)
1031 addq $0, $5, $0
1032 bis $0, $0, $7
1033 ldq $4, 16($17)
1034 addq $22, $7, $22
1035 srl $2, 32, $8
1036 cmpult $22, $7, $3
1037 zapnot $4, 15, $7
1038 mulq $8, $7, $28
1039 srl $25, 32, $1
1040 addq $6, $1, $6
1041 cmpult $0, $5, $1
1042 zapnot $2, 15, $5
1043 addq $1, $6, $6
1044 addq $3, $6, $6
1045 addq $24, $6, $24
1046 cmpult $24, $6, $1
1047 srl $4, 32, $6
1048 mulq $5, $6, $25
1049 mulq $7, $5, $5
1050 addq $1, $23, $23
1051 addq $28, $25, $28
1052 cmpult $28, $25, $1
1053 mulq $6, $8, $6
1054 beq $1, $221
1055 sll $21, 32, $1
1056 addq $6, $1, $6
1057$221:
1058 sll $28, 32, $25
1059 ldq $2, 24($18)
1060 addq $5, $25, $5
1061 bis $5, $5, $7
1062 ldq $4, 8($17)
1063 addq $22, $7, $22
1064 srl $2, 32, $8
1065 cmpult $22, $7, $3
1066 zapnot $4, 15, $7
1067 mulq $8, $7, $0
1068 srl $28, 32, $1
1069 addq $6, $1, $6
1070 cmpult $5, $25, $1
1071 zapnot $2, 15, $5
1072 addq $1, $6, $6
1073 addq $3, $6, $6
1074 addq $24, $6, $24
1075 cmpult $24, $6, $1
1076 srl $4, 32, $6
1077 mulq $5, $6, $25
1078 mulq $7, $5, $5
1079 addq $1, $23, $23
1080 addq $0, $25, $0
1081 cmpult $0, $25, $1
1082 mulq $6, $8, $6
1083 beq $1, $225
1084 sll $21, 32, $1
1085 addq $6, $1, $6
1086$225:
1087 sll $0, 32, $25
1088 ldq $2, 32($18)
1089 addq $5, $25, $5
1090 bis $5, $5, $7
1091 ldq $4, 0($17)
1092 addq $22, $7, $22
1093 srl $2, 32, $8
1094 cmpult $22, $7, $3
1095 zapnot $4, 15, $7
1096 mulq $8, $7, $28
1097 srl $0, 32, $1
1098 addq $6, $1, $6
1099 cmpult $5, $25, $1
1100 zapnot $2, 15, $5
1101 addq $1, $6, $6
1102 addq $3, $6, $6
1103 addq $24, $6, $24
1104 cmpult $24, $6, $1
1105 srl $4, 32, $6
1106 mulq $5, $6, $25
1107 mulq $7, $5, $2
1108 addq $1, $23, $23
1109 addq $28, $25, $28
1110 cmpult $28, $25, $1
1111 mulq $6, $8, $6
1112 beq $1, $229
1113 sll $21, 32, $1
1114 addq $6, $1, $6
1115$229:
1116 sll $28, 32, $25
1117 addq $2, $25, $2
1118 bis $2, $2, $7
1119 addq $22, $7, $22
1120 stq $22, 32($16)
1121 ldq $4, 0($17)
1122 ldq $5, 40($18)
1123 cmpult $22, $7, $3
1124 zapnot $4, 15, $7
1125 srl $5, 32, $8
1126 mulq $8, $7, $0
1127 srl $28, 32, $1
1128 cmpult $2, $25, $2
1129 addq $6, $1, $6
1130 addq $2, $6, $6
1131 addq $3, $6, $6
1132 addq $24, $6, $24
1133 cmpult $24, $6, $1
1134 srl $4, 32, $6
1135 zapnot $5, 15, $5
1136 mulq $5, $6, $22
1137 mulq $7, $5, $2
1138 addq $1, $23, $23
1139 addq $0, $22, $0
1140 cmpult $0, $22, $1
1141 mulq $6, $8, $6
1142 beq $1, $233
1143 sll $21, 32, $1
1144 addq $6, $1, $6
1145$233:
1146 sll $0, 32, $22
1147 ldq $1, 32($18)
1148 addq $2, $22, $2
1149 bis $2, $2, $7
1150 ldq $4, 8($17)
1151 addq $24, $7, $24
1152 srl $1, 32, $8
1153 cmpult $24, $7, $3
1154 zapnot $4, 15, $7
1155 mulq $8, $7, $25
1156 zapnot $1, 15, $5
1157 mulq $7, $5, $21
1158 srl $0, 32, $1
1159 cmpult $2, $22, $2
1160 addq $6, $1, $6
1161 addq $2, $6, $6
1162 addq $3, $6, $6
1163 addq $23, $6, $23
1164 cmpult $23, $6, $22
1165 srl $4, 32, $6
1166 mulq $5, $6, $5
1167 bis $31, 1, $20
1168 addq $25, $5, $25
1169 cmpult $25, $5, $1
1170 mulq $6, $8, $6
1171 beq $1, $237
1172 sll $20, 32, $1
1173 addq $6, $1, $6
1174$237:
1175 sll $25, 32, $5
1176 ldq $2, 24($18)
1177 addq $21, $5, $21
1178 bis $21, $21, $7
1179 ldq $4, 16($17)
1180 addq $24, $7, $24
1181 srl $2, 32, $8
1182 cmpult $24, $7, $3
1183 zapnot $4, 15, $7
1184 mulq $8, $7, $28
1185 srl $25, 32, $1
1186 addq $6, $1, $6
1187 cmpult $21, $5, $1
1188 zapnot $2, 15, $5
1189 addq $1, $6, $6
1190 addq $3, $6, $6
1191 addq $23, $6, $23
1192 cmpult $23, $6, $1
1193 srl $4, 32, $6
1194 mulq $5, $6, $25
1195 mulq $7, $5, $5
1196 addq $1, $22, $22
1197 addq $28, $25, $28
1198 cmpult $28, $25, $1
1199 mulq $6, $8, $6
1200 beq $1, $241
1201 sll $20, 32, $1
1202 addq $6, $1, $6
1203$241:
1204 sll $28, 32, $25
1205 ldq $2, 16($18)
1206 addq $5, $25, $5
1207 bis $5, $5, $7
1208 ldq $4, 24($17)
1209 addq $24, $7, $24
1210 srl $2, 32, $8
1211 cmpult $24, $7, $3
1212 zapnot $4, 15, $7
1213 mulq $8, $7, $0
1214 srl $28, 32, $1
1215 addq $6, $1, $6
1216 cmpult $5, $25, $1
1217 zapnot $2, 15, $5
1218 addq $1, $6, $6
1219 addq $3, $6, $6
1220 addq $23, $6, $23
1221 cmpult $23, $6, $1
1222 srl $4, 32, $6
1223 mulq $5, $6, $25
1224 mulq $7, $5, $5
1225 addq $1, $22, $22
1226 addq $0, $25, $0
1227 cmpult $0, $25, $1
1228 mulq $6, $8, $6
1229 beq $1, $245
1230 sll $20, 32, $1
1231 addq $6, $1, $6
1232$245:
1233 sll $0, 32, $25
1234 ldq $2, 8($18)
1235 addq $5, $25, $5
1236 bis $5, $5, $7
1237 ldq $4, 32($17)
1238 addq $24, $7, $24
1239 srl $2, 32, $8
1240 cmpult $24, $7, $3
1241 zapnot $4, 15, $7
1242 mulq $8, $7, $28
1243 srl $0, 32, $1
1244 addq $6, $1, $6
1245 cmpult $5, $25, $1
1246 zapnot $2, 15, $5
1247 addq $1, $6, $6
1248 addq $3, $6, $6
1249 addq $23, $6, $23
1250 cmpult $23, $6, $1
1251 srl $4, 32, $6
1252 mulq $5, $6, $25
1253 mulq $7, $5, $5
1254 addq $1, $22, $22
1255 addq $28, $25, $28
1256 cmpult $28, $25, $1
1257 mulq $6, $8, $6
1258 beq $1, $249
1259 sll $20, 32, $1
1260 addq $6, $1, $6
1261$249:
1262 sll $28, 32, $25
1263 ldq $2, 0($18)
1264 addq $5, $25, $5
1265 bis $5, $5, $7
1266 ldq $4, 40($17)
1267 addq $24, $7, $24
1268 srl $2, 32, $8
1269 cmpult $24, $7, $3
1270 zapnot $4, 15, $7
1271 mulq $8, $7, $0
1272 srl $28, 32, $1
1273 addq $6, $1, $6
1274 cmpult $5, $25, $1
1275 zapnot $2, 15, $5
1276 addq $1, $6, $6
1277 addq $3, $6, $6
1278 addq $23, $6, $23
1279 cmpult $23, $6, $1
1280 srl $4, 32, $6
1281 mulq $5, $6, $25
1282 mulq $7, $5, $2
1283 addq $1, $22, $22
1284 addq $0, $25, $0
1285 cmpult $0, $25, $1
1286 mulq $6, $8, $6
1287 beq $1, $253
1288 sll $20, 32, $1
1289 addq $6, $1, $6
1290$253:
1291 sll $0, 32, $25
1292 addq $2, $25, $2
1293 bis $2, $2, $7
1294 addq $24, $7, $24
1295 stq $24, 40($16)
1296 ldq $4, 48($17)
1297 ldq $5, 0($18)
1298 cmpult $24, $7, $3
1299 zapnot $4, 15, $7
1300 srl $5, 32, $8
1301 mulq $8, $7, $28
1302 srl $0, 32, $1
1303 cmpult $2, $25, $2
1304 addq $6, $1, $6
1305 addq $2, $6, $6
1306 addq $3, $6, $6
1307 addq $23, $6, $23
1308 cmpult $23, $6, $1
1309 srl $4, 32, $6
1310 zapnot $5, 15, $5
1311 mulq $5, $6, $24
1312 mulq $7, $5, $2
1313 addq $1, $22, $22
1314 addq $28, $24, $28
1315 cmpult $28, $24, $1
1316 mulq $6, $8, $6
1317 beq $1, $257
1318 sll $20, 32, $1
1319 addq $6, $1, $6
1320$257:
1321 sll $28, 32, $24
1322 ldq $1, 8($18)
1323 addq $2, $24, $2
1324 bis $2, $2, $7
1325 ldq $4, 40($17)
1326 addq $23, $7, $23
1327 srl $1, 32, $8
1328 cmpult $23, $7, $3
1329 zapnot $4, 15, $7
1330 mulq $8, $7, $25
1331 zapnot $1, 15, $5
1332 mulq $7, $5, $0
1333 srl $28, 32, $1
1334 cmpult $2, $24, $2
1335 addq $6, $1, $6
1336 addq $2, $6, $6
1337 addq $3, $6, $6
1338 addq $22, $6, $22
1339 cmpult $22, $6, $24
1340 srl $4, 32, $6
1341 mulq $5, $6, $5
1342 bis $31, 1, $21
1343 addq $25, $5, $25
1344 cmpult $25, $5, $1
1345 mulq $6, $8, $6
1346 beq $1, $261
1347 sll $21, 32, $1
1348 addq $6, $1, $6
1349$261:
1350 sll $25, 32, $5
1351 ldq $2, 16($18)
1352 addq $0, $5, $0
1353 bis $0, $0, $7
1354 ldq $4, 32($17)
1355 addq $23, $7, $23
1356 srl $2, 32, $8
1357 cmpult $23, $7, $3
1358 zapnot $4, 15, $7
1359 mulq $8, $7, $28
1360 srl $25, 32, $1
1361 addq $6, $1, $6
1362 cmpult $0, $5, $1
1363 zapnot $2, 15, $5
1364 addq $1, $6, $6
1365 addq $3, $6, $6
1366 addq $22, $6, $22
1367 cmpult $22, $6, $1
1368 srl $4, 32, $6
1369 mulq $5, $6, $25
1370 mulq $7, $5, $5
1371 addq $1, $24, $24
1372 addq $28, $25, $28
1373 cmpult $28, $25, $1
1374 mulq $6, $8, $6
1375 beq $1, $265
1376 sll $21, 32, $1
1377 addq $6, $1, $6
1378$265:
1379 sll $28, 32, $25
1380 ldq $2, 24($18)
1381 addq $5, $25, $5
1382 bis $5, $5, $7
1383 ldq $4, 24($17)
1384 addq $23, $7, $23
1385 srl $2, 32, $8
1386 cmpult $23, $7, $3
1387 zapnot $4, 15, $7
1388 mulq $8, $7, $0
1389 srl $28, 32, $1
1390 addq $6, $1, $6
1391 cmpult $5, $25, $1
1392 zapnot $2, 15, $5
1393 addq $1, $6, $6
1394 addq $3, $6, $6
1395 addq $22, $6, $22
1396 cmpult $22, $6, $1
1397 srl $4, 32, $6
1398 mulq $5, $6, $25
1399 mulq $7, $5, $5
1400 addq $1, $24, $24
1401 addq $0, $25, $0
1402 cmpult $0, $25, $1
1403 mulq $6, $8, $6
1404 beq $1, $269
1405 sll $21, 32, $1
1406 addq $6, $1, $6
1407$269:
1408 sll $0, 32, $25
1409 ldq $2, 32($18)
1410 addq $5, $25, $5
1411 bis $5, $5, $7
1412 ldq $4, 16($17)
1413 addq $23, $7, $23
1414 srl $2, 32, $8
1415 cmpult $23, $7, $3
1416 zapnot $4, 15, $7
1417 mulq $8, $7, $28
1418 srl $0, 32, $1
1419 addq $6, $1, $6
1420 cmpult $5, $25, $1
1421 zapnot $2, 15, $5
1422 addq $1, $6, $6
1423 addq $3, $6, $6
1424 addq $22, $6, $22
1425 cmpult $22, $6, $1
1426 srl $4, 32, $6
1427 mulq $5, $6, $25
1428 mulq $7, $5, $5
1429 addq $1, $24, $24
1430 addq $28, $25, $28
1431 cmpult $28, $25, $1
1432 mulq $6, $8, $6
1433 beq $1, $273
1434 sll $21, 32, $1
1435 addq $6, $1, $6
1436$273:
1437 sll $28, 32, $25
1438 ldq $2, 40($18)
1439 addq $5, $25, $5
1440 bis $5, $5, $7
1441 ldq $4, 8($17)
1442 addq $23, $7, $23
1443 srl $2, 32, $8
1444 cmpult $23, $7, $3
1445 zapnot $4, 15, $7
1446 mulq $8, $7, $0
1447 srl $28, 32, $1
1448 addq $6, $1, $6
1449 cmpult $5, $25, $1
1450 zapnot $2, 15, $5
1451 addq $1, $6, $6
1452 addq $3, $6, $6
1453 addq $22, $6, $22
1454 cmpult $22, $6, $1
1455 srl $4, 32, $6
1456 mulq $5, $6, $25
1457 mulq $7, $5, $5
1458 addq $1, $24, $24
1459 addq $0, $25, $0
1460 cmpult $0, $25, $1
1461 mulq $6, $8, $6
1462 beq $1, $277
1463 sll $21, 32, $1
1464 addq $6, $1, $6
1465$277:
1466 sll $0, 32, $25
1467 ldq $2, 48($18)
1468 addq $5, $25, $5
1469 bis $5, $5, $7
1470 ldq $4, 0($17)
1471 addq $23, $7, $23
1472 srl $2, 32, $8
1473 cmpult $23, $7, $3
1474 zapnot $4, 15, $7
1475 mulq $8, $7, $28
1476 srl $0, 32, $1
1477 addq $6, $1, $6
1478 cmpult $5, $25, $1
1479 zapnot $2, 15, $5
1480 addq $1, $6, $6
1481 addq $3, $6, $6
1482 addq $22, $6, $22
1483 cmpult $22, $6, $1
1484 srl $4, 32, $6
1485 mulq $5, $6, $25
1486 mulq $7, $5, $2
1487 addq $1, $24, $24
1488 addq $28, $25, $28
1489 cmpult $28, $25, $1
1490 mulq $6, $8, $6
1491 beq $1, $281
1492 sll $21, 32, $1
1493 addq $6, $1, $6
1494$281:
1495 sll $28, 32, $25
1496 addq $2, $25, $2
1497 bis $2, $2, $7
1498 addq $23, $7, $23
1499 stq $23, 48($16)
1500 ldq $4, 0($17)
1501 ldq $5, 56($18)
1502 cmpult $23, $7, $3
1503 zapnot $4, 15, $7
1504 srl $5, 32, $8
1505 mulq $8, $7, $0
1506 srl $28, 32, $1
1507 cmpult $2, $25, $2
1508 addq $6, $1, $6
1509 addq $2, $6, $6
1510 addq $3, $6, $6
1511 addq $22, $6, $22
1512 cmpult $22, $6, $1
1513 srl $4, 32, $6
1514 zapnot $5, 15, $5
1515 mulq $5, $6, $23
1516 mulq $7, $5, $2
1517 addq $1, $24, $24
1518 addq $0, $23, $0
1519 cmpult $0, $23, $1
1520 mulq $6, $8, $6
1521 beq $1, $285
1522 sll $21, 32, $1
1523 addq $6, $1, $6
1524$285:
1525 sll $0, 32, $23
1526 ldq $1, 48($18)
1527 addq $2, $23, $2
1528 bis $2, $2, $7
1529 ldq $4, 8($17)
1530 addq $22, $7, $22
1531 srl $1, 32, $8
1532 cmpult $22, $7, $3
1533 zapnot $4, 15, $7
1534 mulq $8, $7, $25
1535 zapnot $1, 15, $5
1536 mulq $7, $5, $21
1537 srl $0, 32, $1
1538 cmpult $2, $23, $2
1539 addq $6, $1, $6
1540 addq $2, $6, $6
1541 addq $3, $6, $6
1542 addq $24, $6, $24
1543 cmpult $24, $6, $23
1544 srl $4, 32, $6
1545 mulq $5, $6, $5
1546 bis $31, 1, $20
1547 addq $25, $5, $25
1548 cmpult $25, $5, $1
1549 mulq $6, $8, $6
1550 beq $1, $289
1551 sll $20, 32, $1
1552 addq $6, $1, $6
1553$289:
1554 sll $25, 32, $5
1555 ldq $2, 40($18)
1556 addq $21, $5, $21
1557 bis $21, $21, $7
1558 ldq $4, 16($17)
1559 addq $22, $7, $22
1560 srl $2, 32, $8
1561 cmpult $22, $7, $3
1562 zapnot $4, 15, $7
1563 mulq $8, $7, $28
1564 srl $25, 32, $1
1565 addq $6, $1, $6
1566 cmpult $21, $5, $1
1567 zapnot $2, 15, $5
1568 addq $1, $6, $6
1569 addq $3, $6, $6
1570 addq $24, $6, $24
1571 cmpult $24, $6, $1
1572 srl $4, 32, $6
1573 mulq $5, $6, $25
1574 mulq $7, $5, $5
1575 addq $1, $23, $23
1576 addq $28, $25, $28
1577 cmpult $28, $25, $1
1578 mulq $6, $8, $6
1579 beq $1, $293
1580 sll $20, 32, $1
1581 addq $6, $1, $6
1582$293:
1583 sll $28, 32, $25
1584 ldq $2, 32($18)
1585 addq $5, $25, $5
1586 bis $5, $5, $7
1587 ldq $4, 24($17)
1588 addq $22, $7, $22
1589 srl $2, 32, $8
1590 cmpult $22, $7, $3
1591 zapnot $4, 15, $7
1592 mulq $8, $7, $0
1593 srl $28, 32, $1
1594 addq $6, $1, $6
1595 cmpult $5, $25, $1
1596 zapnot $2, 15, $5
1597 addq $1, $6, $6
1598 addq $3, $6, $6
1599 addq $24, $6, $24
1600 cmpult $24, $6, $1
1601 srl $4, 32, $6
1602 mulq $5, $6, $25
1603 mulq $7, $5, $5
1604 addq $1, $23, $23
1605 addq $0, $25, $0
1606 cmpult $0, $25, $1
1607 mulq $6, $8, $6
1608 beq $1, $297
1609 sll $20, 32, $1
1610 addq $6, $1, $6
1611$297:
1612 sll $0, 32, $25
1613 ldq $2, 24($18)
1614 addq $5, $25, $5
1615 bis $5, $5, $7
1616 ldq $4, 32($17)
1617 addq $22, $7, $22
1618 srl $2, 32, $8
1619 cmpult $22, $7, $3
1620 zapnot $4, 15, $7
1621 mulq $8, $7, $28
1622 srl $0, 32, $1
1623 addq $6, $1, $6
1624 cmpult $5, $25, $1
1625 zapnot $2, 15, $5
1626 addq $1, $6, $6
1627 addq $3, $6, $6
1628 addq $24, $6, $24
1629 cmpult $24, $6, $1
1630 srl $4, 32, $6
1631 mulq $5, $6, $25
1632 mulq $7, $5, $5
1633 addq $1, $23, $23
1634 addq $28, $25, $28
1635 cmpult $28, $25, $1
1636 mulq $6, $8, $6
1637 beq $1, $301
1638 sll $20, 32, $1
1639 addq $6, $1, $6
1640$301:
1641 sll $28, 32, $25
1642 ldq $2, 16($18)
1643 addq $5, $25, $5
1644 bis $5, $5, $7
1645 ldq $4, 40($17)
1646 addq $22, $7, $22
1647 srl $2, 32, $8
1648 cmpult $22, $7, $3
1649 zapnot $4, 15, $7
1650 mulq $8, $7, $0
1651 srl $28, 32, $1
1652 addq $6, $1, $6
1653 cmpult $5, $25, $1
1654 zapnot $2, 15, $5
1655 addq $1, $6, $6
1656 addq $3, $6, $6
1657 addq $24, $6, $24
1658 cmpult $24, $6, $1
1659 srl $4, 32, $6
1660 mulq $5, $6, $25
1661 mulq $7, $5, $5
1662 addq $1, $23, $23
1663 addq $0, $25, $0
1664 cmpult $0, $25, $1
1665 mulq $6, $8, $6
1666 beq $1, $305
1667 sll $20, 32, $1
1668 addq $6, $1, $6
1669$305:
1670 sll $0, 32, $25
1671 ldq $2, 8($18)
1672 addq $5, $25, $5
1673 bis $5, $5, $7
1674 ldq $4, 48($17)
1675 addq $22, $7, $22
1676 srl $2, 32, $8
1677 cmpult $22, $7, $3
1678 zapnot $4, 15, $7
1679 mulq $8, $7, $28
1680 srl $0, 32, $1
1681 addq $6, $1, $6
1682 cmpult $5, $25, $1
1683 zapnot $2, 15, $5
1684 addq $1, $6, $6
1685 addq $3, $6, $6
1686 addq $24, $6, $24
1687 cmpult $24, $6, $1
1688 srl $4, 32, $6
1689 mulq $5, $6, $25
1690 mulq $7, $5, $5
1691 addq $1, $23, $23
1692 addq $28, $25, $28
1693 cmpult $28, $25, $1
1694 mulq $6, $8, $6
1695 beq $1, $309
1696 sll $20, 32, $1
1697 addq $6, $1, $6
1698$309:
1699 sll $28, 32, $25
1700 ldq $2, 0($18)
1701 addq $5, $25, $5
1702 bis $5, $5, $7
1703 ldq $4, 56($17)
1704 addq $22, $7, $22
1705 srl $2, 32, $8
1706 cmpult $22, $7, $3
1707 zapnot $4, 15, $7
1708 mulq $8, $7, $0
1709 srl $28, 32, $1
1710 addq $6, $1, $6
1711 cmpult $5, $25, $1
1712 zapnot $2, 15, $5
1713 addq $1, $6, $6
1714 addq $3, $6, $6
1715 addq $24, $6, $24
1716 cmpult $24, $6, $1
1717 srl $4, 32, $6
1718 mulq $5, $6, $25
1719 mulq $7, $5, $2
1720 addq $1, $23, $23
1721 addq $0, $25, $0
1722 cmpult $0, $25, $1
1723 mulq $6, $8, $6
1724 beq $1, $313
1725 sll $20, 32, $1
1726 addq $6, $1, $6
1727$313:
1728 sll $0, 32, $25
1729 addq $2, $25, $2
1730 bis $2, $2, $7
1731 addq $22, $7, $22
1732 stq $22, 56($16)
1733 ldq $4, 56($17)
1734 ldq $5, 8($18)
1735 cmpult $22, $7, $3
1736 zapnot $4, 15, $7
1737 srl $5, 32, $8
1738 mulq $8, $7, $28
1739 srl $0, 32, $1
1740 cmpult $2, $25, $2
1741 addq $6, $1, $6
1742 addq $2, $6, $6
1743 addq $3, $6, $6
1744 addq $24, $6, $24
1745 cmpult $24, $6, $1
1746 srl $4, 32, $6
1747 zapnot $5, 15, $5
1748 mulq $5, $6, $22
1749 mulq $7, $5, $2
1750 addq $1, $23, $23
1751 addq $28, $22, $28
1752 cmpult $28, $22, $1
1753 mulq $6, $8, $6
1754 beq $1, $317
1755 sll $20, 32, $1
1756 addq $6, $1, $6
1757$317:
1758 sll $28, 32, $22
1759 ldq $1, 16($18)
1760 addq $2, $22, $2
1761 bis $2, $2, $7
1762 ldq $4, 48($17)
1763 addq $24, $7, $24
1764 srl $1, 32, $8
1765 cmpult $24, $7, $3
1766 zapnot $4, 15, $7
1767 mulq $8, $7, $25
1768 zapnot $1, 15, $5
1769 mulq $7, $5, $0
1770 srl $28, 32, $1
1771 cmpult $2, $22, $2
1772 addq $6, $1, $6
1773 addq $2, $6, $6
1774 addq $3, $6, $6
1775 addq $23, $6, $23
1776 cmpult $23, $6, $22
1777 srl $4, 32, $6
1778 mulq $5, $6, $5
1779 bis $31, 1, $21
1780 addq $25, $5, $25
1781 cmpult $25, $5, $1
1782 mulq $6, $8, $6
1783 beq $1, $321
1784 sll $21, 32, $1
1785 addq $6, $1, $6
1786$321:
1787 sll $25, 32, $5
1788 ldq $2, 24($18)
1789 addq $0, $5, $0
1790 bis $0, $0, $7
1791 ldq $4, 40($17)
1792 addq $24, $7, $24
1793 srl $2, 32, $8
1794 cmpult $24, $7, $3
1795 zapnot $4, 15, $7
1796 mulq $8, $7, $28
1797 srl $25, 32, $1
1798 addq $6, $1, $6
1799 cmpult $0, $5, $1
1800 zapnot $2, 15, $5
1801 addq $1, $6, $6
1802 addq $3, $6, $6
1803 addq $23, $6, $23
1804 cmpult $23, $6, $1
1805 srl $4, 32, $6
1806 mulq $5, $6, $25
1807 mulq $7, $5, $5
1808 addq $1, $22, $22
1809 addq $28, $25, $28
1810 cmpult $28, $25, $1
1811 mulq $6, $8, $6
1812 beq $1, $325
1813 sll $21, 32, $1
1814 addq $6, $1, $6
1815$325:
1816 sll $28, 32, $25
1817 ldq $2, 32($18)
1818 addq $5, $25, $5
1819 bis $5, $5, $7
1820 ldq $4, 32($17)
1821 addq $24, $7, $24
1822 srl $2, 32, $8
1823 cmpult $24, $7, $3
1824 zapnot $4, 15, $7
1825 mulq $8, $7, $0
1826 srl $28, 32, $1
1827 addq $6, $1, $6
1828 cmpult $5, $25, $1
1829 zapnot $2, 15, $5
1830 addq $1, $6, $6
1831 addq $3, $6, $6
1832 addq $23, $6, $23
1833 cmpult $23, $6, $1
1834 srl $4, 32, $6
1835 mulq $5, $6, $25
1836 mulq $7, $5, $5
1837 addq $1, $22, $22
1838 addq $0, $25, $0
1839 cmpult $0, $25, $1
1840 mulq $6, $8, $6
1841 beq $1, $329
1842 sll $21, 32, $1
1843 addq $6, $1, $6
1844$329:
1845 sll $0, 32, $25
1846 ldq $2, 40($18)
1847 addq $5, $25, $5
1848 bis $5, $5, $7
1849 ldq $4, 24($17)
1850 addq $24, $7, $24
1851 srl $2, 32, $8
1852 cmpult $24, $7, $3
1853 zapnot $4, 15, $7
1854 mulq $8, $7, $28
1855 srl $0, 32, $1
1856 addq $6, $1, $6
1857 cmpult $5, $25, $1
1858 zapnot $2, 15, $5
1859 addq $1, $6, $6
1860 addq $3, $6, $6
1861 addq $23, $6, $23
1862 cmpult $23, $6, $1
1863 srl $4, 32, $6
1864 mulq $5, $6, $25
1865 mulq $7, $5, $5
1866 addq $1, $22, $22
1867 addq $28, $25, $28
1868 cmpult $28, $25, $1
1869 mulq $6, $8, $6
1870 beq $1, $333
1871 sll $21, 32, $1
1872 addq $6, $1, $6
1873$333:
1874 sll $28, 32, $25
1875 ldq $2, 48($18)
1876 addq $5, $25, $5
1877 bis $5, $5, $7
1878 ldq $4, 16($17)
1879 addq $24, $7, $24
1880 srl $2, 32, $8
1881 cmpult $24, $7, $3
1882 zapnot $4, 15, $7
1883 mulq $8, $7, $0
1884 srl $28, 32, $1
1885 addq $6, $1, $6
1886 cmpult $5, $25, $1
1887 zapnot $2, 15, $5
1888 addq $1, $6, $6
1889 addq $3, $6, $6
1890 addq $23, $6, $23
1891 cmpult $23, $6, $1
1892 srl $4, 32, $6
1893 mulq $5, $6, $25
1894 mulq $7, $5, $5
1895 addq $1, $22, $22
1896 addq $0, $25, $0
1897 cmpult $0, $25, $1
1898 mulq $6, $8, $6
1899 beq $1, $337
1900 sll $21, 32, $1
1901 addq $6, $1, $6
1902$337:
1903 sll $0, 32, $25
1904 ldq $2, 56($18)
1905 addq $5, $25, $5
1906 bis $5, $5, $7
1907 ldq $4, 8($17)
1908 addq $24, $7, $24
1909 srl $2, 32, $8
1910 cmpult $24, $7, $3
1911 zapnot $4, 15, $7
1912 mulq $8, $7, $28
1913 srl $0, 32, $1
1914 addq $6, $1, $6
1915 cmpult $5, $25, $1
1916 zapnot $2, 15, $5
1917 addq $1, $6, $6
1918 addq $3, $6, $6
1919 addq $23, $6, $23
1920 cmpult $23, $6, $1
1921 srl $4, 32, $6
1922 mulq $5, $6, $25
1923 mulq $7, $5, $2
1924 addq $1, $22, $22
1925 addq $28, $25, $28
1926 cmpult $28, $25, $1
1927 mulq $6, $8, $6
1928 beq $1, $341
1929 sll $21, 32, $1
1930 addq $6, $1, $6
1931$341:
1932 sll $28, 32, $25
1933 addq $2, $25, $2
1934 bis $2, $2, $7
1935 addq $24, $7, $24
1936 stq $24, 64($16)
1937 ldq $4, 16($17)
1938 ldq $5, 56($18)
1939 cmpult $24, $7, $3
1940 zapnot $4, 15, $7
1941 srl $5, 32, $8
1942 mulq $8, $7, $0
1943 srl $28, 32, $1
1944 cmpult $2, $25, $2
1945 addq $6, $1, $6
1946 addq $2, $6, $6
1947 addq $3, $6, $6
1948 addq $23, $6, $23
1949 cmpult $23, $6, $1
1950 srl $4, 32, $6
1951 zapnot $5, 15, $5
1952 mulq $5, $6, $24
1953 mulq $7, $5, $2
1954 addq $1, $22, $22
1955 addq $0, $24, $0
1956 cmpult $0, $24, $1
1957 mulq $6, $8, $6
1958 beq $1, $345
1959 sll $21, 32, $1
1960 addq $6, $1, $6
1961$345:
1962 sll $0, 32, $24
1963 ldq $1, 48($18)
1964 addq $2, $24, $2
1965 bis $2, $2, $7
1966 ldq $4, 24($17)
1967 addq $23, $7, $23
1968 srl $1, 32, $8
1969 cmpult $23, $7, $3
1970 zapnot $4, 15, $7
1971 mulq $8, $7, $25
1972 zapnot $1, 15, $5
1973 mulq $7, $5, $21
1974 srl $0, 32, $1
1975 cmpult $2, $24, $2
1976 addq $6, $1, $6
1977 addq $2, $6, $6
1978 addq $3, $6, $6
1979 addq $22, $6, $22
1980 cmpult $22, $6, $24
1981 srl $4, 32, $6
1982 mulq $5, $6, $5
1983 bis $31, 1, $20
1984 addq $25, $5, $25
1985 cmpult $25, $5, $1
1986 mulq $6, $8, $6
1987 beq $1, $349
1988 sll $20, 32, $1
1989 addq $6, $1, $6
1990$349:
1991 sll $25, 32, $5
1992 ldq $2, 40($18)
1993 addq $21, $5, $21
1994 bis $21, $21, $7
1995 ldq $4, 32($17)
1996 addq $23, $7, $23
1997 srl $2, 32, $8
1998 cmpult $23, $7, $3
1999 zapnot $4, 15, $7
2000 mulq $8, $7, $28
2001 srl $25, 32, $1
2002 addq $6, $1, $6
2003 cmpult $21, $5, $1
2004 zapnot $2, 15, $5
2005 addq $1, $6, $6
2006 addq $3, $6, $6
2007 addq $22, $6, $22
2008 cmpult $22, $6, $1
2009 srl $4, 32, $6
2010 mulq $5, $6, $25
2011 mulq $7, $5, $5
2012 addq $1, $24, $24
2013 addq $28, $25, $28
2014 cmpult $28, $25, $1
2015 mulq $6, $8, $6
2016 beq $1, $353
2017 sll $20, 32, $1
2018 addq $6, $1, $6
2019$353:
2020 sll $28, 32, $25
2021 ldq $2, 32($18)
2022 addq $5, $25, $5
2023 bis $5, $5, $7
2024 ldq $4, 40($17)
2025 addq $23, $7, $23
2026 srl $2, 32, $8
2027 cmpult $23, $7, $3
2028 zapnot $4, 15, $7
2029 mulq $8, $7, $0
2030 srl $28, 32, $1
2031 addq $6, $1, $6
2032 cmpult $5, $25, $1
2033 zapnot $2, 15, $5
2034 addq $1, $6, $6
2035 addq $3, $6, $6
2036 addq $22, $6, $22
2037 cmpult $22, $6, $1
2038 srl $4, 32, $6
2039 mulq $5, $6, $25
2040 mulq $7, $5, $5
2041 addq $1, $24, $24
2042 addq $0, $25, $0
2043 cmpult $0, $25, $1
2044 mulq $6, $8, $6
2045 beq $1, $357
2046 sll $20, 32, $1
2047 addq $6, $1, $6
2048$357:
2049 sll $0, 32, $25
2050 ldq $2, 24($18)
2051 addq $5, $25, $5
2052 bis $5, $5, $7
2053 ldq $4, 48($17)
2054 addq $23, $7, $23
2055 srl $2, 32, $8
2056 cmpult $23, $7, $3
2057 zapnot $4, 15, $7
2058 mulq $8, $7, $28
2059 srl $0, 32, $1
2060 addq $6, $1, $6
2061 cmpult $5, $25, $1
2062 zapnot $2, 15, $5
2063 addq $1, $6, $6
2064 addq $3, $6, $6
2065 addq $22, $6, $22
2066 cmpult $22, $6, $1
2067 srl $4, 32, $6
2068 mulq $5, $6, $25
2069 mulq $7, $5, $5
2070 addq $1, $24, $24
2071 addq $28, $25, $28
2072 cmpult $28, $25, $1
2073 mulq $6, $8, $6
2074 beq $1, $361
2075 sll $20, 32, $1
2076 addq $6, $1, $6
2077$361:
2078 sll $28, 32, $25
2079 ldq $2, 16($18)
2080 addq $5, $25, $5
2081 bis $5, $5, $7
2082 ldq $4, 56($17)
2083 addq $23, $7, $23
2084 srl $2, 32, $8
2085 cmpult $23, $7, $3
2086 zapnot $4, 15, $7
2087 mulq $8, $7, $0
2088 srl $28, 32, $1
2089 addq $6, $1, $6
2090 cmpult $5, $25, $1
2091 zapnot $2, 15, $5
2092 addq $1, $6, $6
2093 addq $3, $6, $6
2094 addq $22, $6, $22
2095 cmpult $22, $6, $1
2096 srl $4, 32, $6
2097 mulq $5, $6, $25
2098 mulq $7, $5, $2
2099 addq $1, $24, $24
2100 addq $0, $25, $0
2101 cmpult $0, $25, $1
2102 mulq $6, $8, $6
2103 beq $1, $365
2104 sll $20, 32, $1
2105 addq $6, $1, $6
2106$365:
2107 sll $0, 32, $25
2108 addq $2, $25, $2
2109 bis $2, $2, $7
2110 addq $23, $7, $23
2111 stq $23, 72($16)
2112 ldq $4, 56($17)
2113 ldq $5, 24($18)
2114 cmpult $23, $7, $3
2115 zapnot $4, 15, $7
2116 srl $5, 32, $8
2117 mulq $8, $7, $28
2118 srl $0, 32, $1
2119 cmpult $2, $25, $2
2120 addq $6, $1, $6
2121 addq $2, $6, $6
2122 addq $3, $6, $6
2123 addq $22, $6, $22
2124 cmpult $22, $6, $1
2125 srl $4, 32, $6
2126 zapnot $5, 15, $5
2127 mulq $5, $6, $23
2128 mulq $7, $5, $2
2129 addq $1, $24, $24
2130 addq $28, $23, $28
2131 cmpult $28, $23, $1
2132 mulq $6, $8, $6
2133 beq $1, $369
2134 sll $20, 32, $1
2135 addq $6, $1, $6
2136$369:
2137 sll $28, 32, $23
2138 ldq $1, 32($18)
2139 addq $2, $23, $2
2140 bis $2, $2, $7
2141 ldq $4, 48($17)
2142 addq $22, $7, $22
2143 srl $1, 32, $8
2144 cmpult $22, $7, $3
2145 zapnot $4, 15, $7
2146 mulq $8, $7, $25
2147 zapnot $1, 15, $5
2148 mulq $7, $5, $0
2149 srl $28, 32, $1
2150 cmpult $2, $23, $2
2151 addq $6, $1, $6
2152 addq $2, $6, $6
2153 addq $3, $6, $6
2154 addq $24, $6, $24
2155 cmpult $24, $6, $23
2156 srl $4, 32, $6
2157 mulq $5, $6, $5
2158 bis $31, 1, $21
2159 addq $25, $5, $25
2160 cmpult $25, $5, $1
2161 mulq $6, $8, $6
2162 beq $1, $373
2163 sll $21, 32, $1
2164 addq $6, $1, $6
2165$373:
2166 sll $25, 32, $5
2167 ldq $2, 40($18)
2168 addq $0, $5, $0
2169 bis $0, $0, $7
2170 ldq $4, 40($17)
2171 addq $22, $7, $22
2172 srl $2, 32, $8
2173 cmpult $22, $7, $3
2174 zapnot $4, 15, $7
2175 mulq $8, $7, $28
2176 srl $25, 32, $1
2177 addq $6, $1, $6
2178 cmpult $0, $5, $1
2179 zapnot $2, 15, $5
2180 addq $1, $6, $6
2181 addq $3, $6, $6
2182 addq $24, $6, $24
2183 cmpult $24, $6, $1
2184 srl $4, 32, $6
2185 mulq $5, $6, $25
2186 mulq $7, $5, $5
2187 addq $1, $23, $23
2188 addq $28, $25, $28
2189 cmpult $28, $25, $1
2190 mulq $6, $8, $6
2191 beq $1, $377
2192 sll $21, 32, $1
2193 addq $6, $1, $6
2194$377:
2195 sll $28, 32, $25
2196 ldq $2, 48($18)
2197 addq $5, $25, $5
2198 bis $5, $5, $7
2199 ldq $4, 32($17)
2200 addq $22, $7, $22
2201 srl $2, 32, $8
2202 cmpult $22, $7, $3
2203 zapnot $4, 15, $7
2204 mulq $8, $7, $0
2205 srl $28, 32, $1
2206 addq $6, $1, $6
2207 cmpult $5, $25, $1
2208 zapnot $2, 15, $5
2209 addq $1, $6, $6
2210 addq $3, $6, $6
2211 addq $24, $6, $24
2212 cmpult $24, $6, $1
2213 srl $4, 32, $6
2214 mulq $5, $6, $25
2215 mulq $7, $5, $5
2216 addq $1, $23, $23
2217 addq $0, $25, $0
2218 cmpult $0, $25, $1
2219 mulq $6, $8, $6
2220 beq $1, $381
2221 sll $21, 32, $1
2222 addq $6, $1, $6
2223$381:
2224 sll $0, 32, $25
2225 ldq $2, 56($18)
2226 addq $5, $25, $5
2227 bis $5, $5, $7
2228 ldq $4, 24($17)
2229 addq $22, $7, $22
2230 srl $2, 32, $8
2231 cmpult $22, $7, $3
2232 zapnot $4, 15, $7
2233 mulq $8, $7, $28
2234 srl $0, 32, $1
2235 addq $6, $1, $6
2236 cmpult $5, $25, $1
2237 zapnot $2, 15, $5
2238 addq $1, $6, $6
2239 addq $3, $6, $6
2240 addq $24, $6, $24
2241 cmpult $24, $6, $1
2242 srl $4, 32, $6
2243 mulq $5, $6, $25
2244 mulq $7, $5, $2
2245 addq $1, $23, $23
2246 addq $28, $25, $28
2247 cmpult $28, $25, $1
2248 mulq $6, $8, $6
2249 beq $1, $385
2250 sll $21, 32, $1
2251 addq $6, $1, $6
2252$385:
2253 sll $28, 32, $25
2254 addq $2, $25, $2
2255 bis $2, $2, $7
2256 addq $22, $7, $22
2257 stq $22, 80($16)
2258 ldq $4, 32($17)
2259 ldq $5, 56($18)
2260 cmpult $22, $7, $3
2261 zapnot $4, 15, $7
2262 srl $5, 32, $8
2263 mulq $8, $7, $0
2264 srl $28, 32, $1
2265 cmpult $2, $25, $2
2266 addq $6, $1, $6
2267 addq $2, $6, $6
2268 addq $3, $6, $6
2269 addq $24, $6, $24
2270 cmpult $24, $6, $1
2271 srl $4, 32, $6
2272 zapnot $5, 15, $5
2273 mulq $5, $6, $22
2274 mulq $7, $5, $2
2275 addq $1, $23, $23
2276 addq $0, $22, $0
2277 cmpult $0, $22, $1
2278 mulq $6, $8, $6
2279 beq $1, $389
2280 sll $21, 32, $1
2281 addq $6, $1, $6
2282$389:
2283 sll $0, 32, $22
2284 ldq $1, 48($18)
2285 addq $2, $22, $2
2286 bis $2, $2, $7
2287 ldq $4, 40($17)
2288 addq $24, $7, $24
2289 srl $1, 32, $8
2290 cmpult $24, $7, $3
2291 zapnot $4, 15, $7
2292 mulq $8, $7, $25
2293 zapnot $1, 15, $5
2294 mulq $7, $5, $21
2295 srl $0, 32, $1
2296 cmpult $2, $22, $2
2297 addq $6, $1, $6
2298 addq $2, $6, $6
2299 addq $3, $6, $6
2300 addq $23, $6, $23
2301 cmpult $23, $6, $22
2302 srl $4, 32, $6
2303 mulq $5, $6, $5
2304 bis $31, 1, $20
2305 addq $25, $5, $25
2306 cmpult $25, $5, $1
2307 mulq $6, $8, $6
2308 beq $1, $393
2309 sll $20, 32, $1
2310 addq $6, $1, $6
2311$393:
2312 sll $25, 32, $5
2313 ldq $2, 40($18)
2314 addq $21, $5, $21
2315 bis $21, $21, $7
2316 ldq $4, 48($17)
2317 addq $24, $7, $24
2318 srl $2, 32, $8
2319 cmpult $24, $7, $3
2320 zapnot $4, 15, $7
2321 mulq $8, $7, $28
2322 srl $25, 32, $1
2323 addq $6, $1, $6
2324 cmpult $21, $5, $1
2325 zapnot $2, 15, $5
2326 addq $1, $6, $6
2327 addq $3, $6, $6
2328 addq $23, $6, $23
2329 cmpult $23, $6, $1
2330 srl $4, 32, $6
2331 mulq $5, $6, $25
2332 mulq $7, $5, $5
2333 addq $1, $22, $22
2334 addq $28, $25, $28
2335 cmpult $28, $25, $1
2336 mulq $6, $8, $6
2337 beq $1, $397
2338 sll $20, 32, $1
2339 addq $6, $1, $6
2340$397:
2341 sll $28, 32, $25
2342 ldq $2, 32($18)
2343 addq $5, $25, $5
2344 bis $5, $5, $7
2345 ldq $4, 56($17)
2346 addq $24, $7, $24
2347 srl $2, 32, $8
2348 cmpult $24, $7, $3
2349 zapnot $4, 15, $7
2350 mulq $8, $7, $21
2351 srl $28, 32, $1
2352 addq $6, $1, $6
2353 cmpult $5, $25, $1
2354 zapnot $2, 15, $5
2355 addq $1, $6, $6
2356 addq $3, $6, $6
2357 addq $23, $6, $23
2358 cmpult $23, $6, $1
2359 srl $4, 32, $6
2360 mulq $5, $6, $25
2361 mulq $7, $5, $2
2362 addq $1, $22, $22
2363 addq $21, $25, $21
2364 cmpult $21, $25, $1
2365 mulq $6, $8, $6
2366 beq $1, $401
2367 sll $20, 32, $1
2368 addq $6, $1, $6
2369$401:
2370 sll $21, 32, $25
2371 addq $2, $25, $2
2372 bis $2, $2, $7
2373 addq $24, $7, $24
2374 stq $24, 88($16)
2375 ldq $4, 56($17)
2376 ldq $5, 40($18)
2377 cmpult $24, $7, $3
2378 zapnot $4, 15, $7
2379 srl $5, 32, $8
2380 mulq $8, $7, $0
2381 srl $21, 32, $1
2382 cmpult $2, $25, $2
2383 addq $6, $1, $6
2384 addq $2, $6, $6
2385 addq $3, $6, $6
2386 addq $23, $6, $23
2387 cmpult $23, $6, $1
2388 srl $4, 32, $6
2389 zapnot $5, 15, $5
2390 mulq $5, $6, $24
2391 mulq $7, $5, $5
2392 addq $1, $22, $22
2393 addq $0, $24, $0
2394 cmpult $0, $24, $1
2395 mulq $6, $8, $6
2396 beq $1, $405
2397 sll $20, 32, $1
2398 addq $6, $1, $6
2399$405:
2400 sll $0, 32, $24
2401 ldq $2, 48($18)
2402 addq $5, $24, $5
2403 bis $5, $5, $7
2404 ldq $4, 48($17)
2405 addq $23, $7, $23
2406 srl $2, 32, $8
2407 cmpult $23, $7, $3
2408 zapnot $4, 15, $7
2409 mulq $8, $7, $28
2410 srl $0, 32, $1
2411 addq $6, $1, $6
2412 cmpult $5, $24, $1
2413 zapnot $2, 15, $5
2414 addq $1, $6, $6
2415 addq $3, $6, $6
2416 addq $22, $6, $22
2417 cmpult $22, $6, $24
2418 srl $4, 32, $6
2419 mulq $5, $6, $25
2420 mulq $7, $5, $5
2421 addq $28, $25, $28
2422 cmpult $28, $25, $1
2423 mulq $6, $8, $6
2424 beq $1, $409
2425 sll $20, 32, $1
2426 addq $6, $1, $6
2427$409:
2428 sll $28, 32, $25
2429 ldq $2, 56($18)
2430 addq $5, $25, $5
2431 bis $5, $5, $7
2432 ldq $4, 40($17)
2433 addq $23, $7, $23
2434 srl $2, 32, $8
2435 cmpult $23, $7, $3
2436 zapnot $4, 15, $7
2437 mulq $8, $7, $0
2438 srl $28, 32, $1
2439 addq $6, $1, $6
2440 cmpult $5, $25, $1
2441 zapnot $2, 15, $5
2442 addq $1, $6, $6
2443 addq $3, $6, $6
2444 addq $22, $6, $22
2445 cmpult $22, $6, $1
2446 srl $4, 32, $6
2447 mulq $5, $6, $25
2448 mulq $7, $5, $2
2449 addq $1, $24, $24
2450 addq $0, $25, $0
2451 cmpult $0, $25, $1
2452 mulq $6, $8, $6
2453 beq $1, $413
2454 sll $20, 32, $1
2455 addq $6, $1, $6
2456$413:
2457 sll $0, 32, $25
2458 addq $2, $25, $2
2459 bis $2, $2, $7
2460 addq $23, $7, $23
2461 stq $23, 96($16)
2462 ldq $4, 48($17)
2463 ldq $5, 56($18)
2464 cmpult $23, $7, $3
2465 zapnot $4, 15, $7
2466 srl $5, 32, $8
2467 mulq $8, $7, $28
2468 srl $0, 32, $1
2469 cmpult $2, $25, $2
2470 addq $6, $1, $6
2471 addq $2, $6, $6
2472 addq $3, $6, $6
2473 addq $22, $6, $22
2474 cmpult $22, $6, $1
2475 srl $4, 32, $6
2476 zapnot $5, 15, $5
2477 mulq $5, $6, $23
2478 mulq $7, $5, $5
2479 addq $1, $24, $24
2480 addq $28, $23, $28
2481 cmpult $28, $23, $1
2482 mulq $6, $8, $6
2483 beq $1, $417
2484 sll $20, 32, $1
2485 addq $6, $1, $6
2486$417:
2487 sll $28, 32, $23
2488 ldq $2, 48($18)
2489 addq $5, $23, $5
2490 bis $5, $5, $7
2491 ldq $4, 56($17)
2492 addq $22, $7, $22
2493 srl $2, 32, $8
2494 cmpult $22, $7, $3
2495 zapnot $4, 15, $7
2496 mulq $8, $7, $0
2497 srl $28, 32, $1
2498 addq $6, $1, $6
2499 cmpult $5, $23, $1
2500 zapnot $2, 15, $5
2501 addq $1, $6, $6
2502 addq $3, $6, $6
2503 addq $24, $6, $24
2504 cmpult $24, $6, $23
2505 srl $4, 32, $6
2506 mulq $5, $6, $25
2507 mulq $7, $5, $2
2508 addq $0, $25, $0
2509 cmpult $0, $25, $1
2510 mulq $6, $8, $6
2511 beq $1, $421
2512 sll $20, 32, $1
2513 addq $6, $1, $6
2514$421:
2515 sll $0, 32, $25
2516 addq $2, $25, $2
2517 bis $2, $2, $7
2518 addq $22, $7, $22
2519 stq $22, 104($16)
2520 ldq $4, 56($17)
2521 ldq $5, 56($18)
2522 cmpult $22, $7, $3
2523 zapnot $4, 15, $7
2524 srl $5, 32, $8
2525 mulq $8, $7, $28
2526 srl $0, 32, $1
2527 cmpult $2, $25, $2
2528 addq $6, $1, $6
2529 addq $2, $6, $6
2530 addq $3, $6, $6
2531 addq $24, $6, $24
2532 cmpult $24, $6, $1
2533 srl $4, 32, $6
2534 zapnot $5, 15, $5
2535 mulq $5, $6, $22
2536 mulq $7, $5, $2
2537 addq $1, $23, $23
2538 addq $28, $22, $28
2539 cmpult $28, $22, $1
2540 mulq $6, $8, $3
2541 beq $1, $425
2542 sll $20, 32, $1
2543 addq $3, $1, $3
2544$425:
2545 sll $28, 32, $22
2546 srl $28, 32, $1
2547 addq $2, $22, $2
2548 addq $3, $1, $3
2549 bis $2, $2, $7
2550 addq $24, $7, $24
2551 cmpult $7, $22, $1
2552 cmpult $24, $7, $2
2553 addq $1, $3, $6
2554 addq $2, $6, $6
2555 stq $24, 112($16)
2556 addq $23, $6, $23
2557 stq $23, 120($16)
2558 ret $31, ($26), 1
2559 .end bn_mul_comba8
2560 .text
2561 .align 3
2562 .globl bn_sqr_comba4
2563 .ent bn_sqr_comba4
2564bn_sqr_comba4:
2565bn_sqr_comba4..ng:
2566 .frame $30,0,$26,0
2567 .prologue 0
2568
2569 ldq $0, 0($17)
2570 ldq $1, 8($17)
2571 ldq $2, 16($17)
2572 ldq $3, 24($17)
2573 bis $31, $31, $6
2574 mulq $0, $0, $4
2575 umulh $0, $0, $5
2576 stq $4, 0($16)
2577 bis $31, $31, $4
2578 mulq $0, $1, $7
2579 umulh $0, $1, $8
2580 cmplt $7, $31, $22
2581 cmplt $8, $31, $23
2582 addq $7, $7, $7
2583 addq $8, $8, $8
2584 addq $8, $22, $8
2585 addq $4, $23, $4
2586 addq $5, $7, $5
2587 addq $6, $8, $6
2588 cmpult $5, $7, $24
2589 cmpult $6, $8, $25
2590 addq $6, $24, $6
2591 addq $4, $25, $4
2592 stq $5, 8($16)
2593 bis $31, $31, $5
2594 mulq $1, $1, $27
2595 umulh $1, $1, $28
2596 addq $6, $27, $6
2597 addq $4, $28, $4
2598 cmpult $6, $27, $21
2599 cmpult $4, $28, $20
2600 addq $4, $21, $4
2601 addq $5, $20, $5
2602 mulq $2, $0, $19
2603 umulh $2, $0, $18
2604 cmplt $19, $31, $17
2605 cmplt $18, $31, $22
2606 addq $19, $19, $19
2607 addq $18, $18, $18
2608 addq $18, $17, $18
2609 addq $5, $22, $5
2610 addq $6, $19, $6
2611 addq $4, $18, $4
2612 cmpult $6, $19, $23
2613 cmpult $4, $18, $7
2614 addq $4, $23, $4
2615 addq $5, $7, $5
2616 stq $6, 16($16)
2617 bis $31, $31, $6
2618 mulq $3, $0, $8
2619 umulh $3, $0, $24
2620 cmplt $8, $31, $25
2621 cmplt $24, $31, $27
2622 addq $8, $8, $8
2623 addq $24, $24, $24
2624 addq $24, $25, $24
2625 addq $6, $27, $6
2626 addq $4, $8, $4
2627 addq $5, $24, $5
2628 cmpult $4, $8, $28
2629 cmpult $5, $24, $21
2630 addq $5, $28, $5
2631 addq $6, $21, $6
2632 mulq $2, $1, $20
2633 umulh $2, $1, $17
2634 cmplt $20, $31, $22
2635 cmplt $17, $31, $19
2636 addq $20, $20, $20
2637 addq $17, $17, $17
2638 addq $17, $22, $17
2639 addq $6, $19, $6
2640 addq $4, $20, $4
2641 addq $5, $17, $5
2642 cmpult $4, $20, $18
2643 cmpult $5, $17, $23
2644 addq $5, $18, $5
2645 addq $6, $23, $6
2646 stq $4, 24($16)
2647 bis $31, $31, $4
2648 mulq $2, $2, $7
2649 umulh $2, $2, $25
2650 addq $5, $7, $5
2651 addq $6, $25, $6
2652 cmpult $5, $7, $27
2653 cmpult $6, $25, $8
2654 addq $6, $27, $6
2655 addq $4, $8, $4
2656 mulq $3, $1, $24
2657 umulh $3, $1, $28
2658 cmplt $24, $31, $21
2659 cmplt $28, $31, $22
2660 addq $24, $24, $24
2661 addq $28, $28, $28
2662 addq $28, $21, $28
2663 addq $4, $22, $4
2664 addq $5, $24, $5
2665 addq $6, $28, $6
2666 cmpult $5, $24, $19
2667 cmpult $6, $28, $20
2668 addq $6, $19, $6
2669 addq $4, $20, $4
2670 stq $5, 32($16)
2671 bis $31, $31, $5
2672 mulq $3, $2, $17
2673 umulh $3, $2, $18
2674 cmplt $17, $31, $23
2675 cmplt $18, $31, $7
2676 addq $17, $17, $17
2677 addq $18, $18, $18
2678 addq $18, $23, $18
2679 addq $5, $7, $5
2680 addq $6, $17, $6
2681 addq $4, $18, $4
2682 cmpult $6, $17, $25
2683 cmpult $4, $18, $27
2684 addq $4, $25, $4
2685 addq $5, $27, $5
2686 stq $6, 40($16)
2687 bis $31, $31, $6
2688 mulq $3, $3, $8
2689 umulh $3, $3, $21
2690 addq $4, $8, $4
2691 addq $5, $21, $5
2692 cmpult $4, $8, $22
2693 cmpult $5, $21, $24
2694 addq $5, $22, $5
2695 addq $6, $24, $6
2696 stq $4, 48($16)
2697 stq $5, 56($16)
2698 ret $31,($26),1
2699 .end bn_sqr_comba4
2700 .text
2701 .align 3
2702 .globl bn_sqr_comba8
2703 .ent bn_sqr_comba8
2704bn_sqr_comba8:
2705bn_sqr_comba8..ng:
2706 .frame $30,0,$26,0
2707 .prologue 0
2708
2709 ldq $0, 0($17)
2710 ldq $1, 8($17)
2711 ldq $2, 16($17)
2712 ldq $3, 24($17)
2713 ldq $4, 32($17)
2714 ldq $5, 40($17)
2715 ldq $6, 48($17)
2716 ldq $7, 56($17)
2717 bis $31, $31, $23
2718 mulq $0, $0, $8
2719 umulh $0, $0, $22
2720 stq $8, 0($16)
2721 bis $31, $31, $8
2722 mulq $1, $0, $24
2723 umulh $1, $0, $25
2724 cmplt $24, $31, $27
2725 cmplt $25, $31, $28
2726 addq $24, $24, $24
2727 addq $25, $25, $25
2728 addq $25, $27, $25
2729 addq $8, $28, $8
2730 addq $22, $24, $22
2731 addq $23, $25, $23
2732 cmpult $22, $24, $21
2733 cmpult $23, $25, $20
2734 addq $23, $21, $23
2735 addq $8, $20, $8
2736 stq $22, 8($16)
2737 bis $31, $31, $22
2738 mulq $1, $1, $19
2739 umulh $1, $1, $18
2740 addq $23, $19, $23
2741 addq $8, $18, $8
2742 cmpult $23, $19, $17
2743 cmpult $8, $18, $27
2744 addq $8, $17, $8
2745 addq $22, $27, $22
2746 mulq $2, $0, $28
2747 umulh $2, $0, $24
2748 cmplt $28, $31, $25
2749 cmplt $24, $31, $21
2750 addq $28, $28, $28
2751 addq $24, $24, $24
2752 addq $24, $25, $24
2753 addq $22, $21, $22
2754 addq $23, $28, $23
2755 addq $8, $24, $8
2756 cmpult $23, $28, $20
2757 cmpult $8, $24, $19
2758 addq $8, $20, $8
2759 addq $22, $19, $22
2760 stq $23, 16($16)
2761 bis $31, $31, $23
2762 mulq $2, $1, $18
2763 umulh $2, $1, $17
2764 cmplt $18, $31, $27
2765 cmplt $17, $31, $25
2766 addq $18, $18, $18
2767 addq $17, $17, $17
2768 addq $17, $27, $17
2769 addq $23, $25, $23
2770 addq $8, $18, $8
2771 addq $22, $17, $22
2772 cmpult $8, $18, $21
2773 cmpult $22, $17, $28
2774 addq $22, $21, $22
2775 addq $23, $28, $23
2776 mulq $3, $0, $24
2777 umulh $3, $0, $20
2778 cmplt $24, $31, $19
2779 cmplt $20, $31, $27
2780 addq $24, $24, $24
2781 addq $20, $20, $20
2782 addq $20, $19, $20
2783 addq $23, $27, $23
2784 addq $8, $24, $8
2785 addq $22, $20, $22
2786 cmpult $8, $24, $25
2787 cmpult $22, $20, $18
2788 addq $22, $25, $22
2789 addq $23, $18, $23
2790 stq $8, 24($16)
2791 bis $31, $31, $8
2792 mulq $2, $2, $17
2793 umulh $2, $2, $21
2794 addq $22, $17, $22
2795 addq $23, $21, $23
2796 cmpult $22, $17, $28
2797 cmpult $23, $21, $19
2798 addq $23, $28, $23
2799 addq $8, $19, $8
2800 mulq $3, $1, $27
2801 umulh $3, $1, $24
2802 cmplt $27, $31, $20
2803 cmplt $24, $31, $25
2804 addq $27, $27, $27
2805 addq $24, $24, $24
2806 addq $24, $20, $24
2807 addq $8, $25, $8
2808 addq $22, $27, $22
2809 addq $23, $24, $23
2810 cmpult $22, $27, $18
2811 cmpult $23, $24, $17
2812 addq $23, $18, $23
2813 addq $8, $17, $8
2814 mulq $4, $0, $21
2815 umulh $4, $0, $28
2816 cmplt $21, $31, $19
2817 cmplt $28, $31, $20
2818 addq $21, $21, $21
2819 addq $28, $28, $28
2820 addq $28, $19, $28
2821 addq $8, $20, $8
2822 addq $22, $21, $22
2823 addq $23, $28, $23
2824 cmpult $22, $21, $25
2825 cmpult $23, $28, $27
2826 addq $23, $25, $23
2827 addq $8, $27, $8
2828 stq $22, 32($16)
2829 bis $31, $31, $22
2830 mulq $3, $2, $24
2831 umulh $3, $2, $18
2832 cmplt $24, $31, $17
2833 cmplt $18, $31, $19
2834 addq $24, $24, $24
2835 addq $18, $18, $18
2836 addq $18, $17, $18
2837 addq $22, $19, $22
2838 addq $23, $24, $23
2839 addq $8, $18, $8
2840 cmpult $23, $24, $20
2841 cmpult $8, $18, $21
2842 addq $8, $20, $8
2843 addq $22, $21, $22
2844 mulq $4, $1, $28
2845 umulh $4, $1, $25
2846 cmplt $28, $31, $27
2847 cmplt $25, $31, $17
2848 addq $28, $28, $28
2849 addq $25, $25, $25
2850 addq $25, $27, $25
2851 addq $22, $17, $22
2852 addq $23, $28, $23
2853 addq $8, $25, $8
2854 cmpult $23, $28, $19
2855 cmpult $8, $25, $24
2856 addq $8, $19, $8
2857 addq $22, $24, $22
2858 mulq $5, $0, $18
2859 umulh $5, $0, $20
2860 cmplt $18, $31, $21
2861 cmplt $20, $31, $27
2862 addq $18, $18, $18
2863 addq $20, $20, $20
2864 addq $20, $21, $20
2865 addq $22, $27, $22
2866 addq $23, $18, $23
2867 addq $8, $20, $8
2868 cmpult $23, $18, $17
2869 cmpult $8, $20, $28
2870 addq $8, $17, $8
2871 addq $22, $28, $22
2872 stq $23, 40($16)
2873 bis $31, $31, $23
2874 mulq $3, $3, $25
2875 umulh $3, $3, $19
2876 addq $8, $25, $8
2877 addq $22, $19, $22
2878 cmpult $8, $25, $24
2879 cmpult $22, $19, $21
2880 addq $22, $24, $22
2881 addq $23, $21, $23
2882 mulq $4, $2, $27
2883 umulh $4, $2, $18
2884 cmplt $27, $31, $20
2885 cmplt $18, $31, $17
2886 addq $27, $27, $27
2887 addq $18, $18, $18
2888 addq $18, $20, $18
2889 addq $23, $17, $23
2890 addq $8, $27, $8
2891 addq $22, $18, $22
2892 cmpult $8, $27, $28
2893 cmpult $22, $18, $25
2894 addq $22, $28, $22
2895 addq $23, $25, $23
2896 mulq $5, $1, $19
2897 umulh $5, $1, $24
2898 cmplt $19, $31, $21
2899 cmplt $24, $31, $20
2900 addq $19, $19, $19
2901 addq $24, $24, $24
2902 addq $24, $21, $24
2903 addq $23, $20, $23
2904 addq $8, $19, $8
2905 addq $22, $24, $22
2906 cmpult $8, $19, $17
2907 cmpult $22, $24, $27
2908 addq $22, $17, $22
2909 addq $23, $27, $23
2910 mulq $6, $0, $18
2911 umulh $6, $0, $28
2912 cmplt $18, $31, $25
2913 cmplt $28, $31, $21
2914 addq $18, $18, $18
2915 addq $28, $28, $28
2916 addq $28, $25, $28
2917 addq $23, $21, $23
2918 addq $8, $18, $8
2919 addq $22, $28, $22
2920 cmpult $8, $18, $20
2921 cmpult $22, $28, $19
2922 addq $22, $20, $22
2923 addq $23, $19, $23
2924 stq $8, 48($16)
2925 bis $31, $31, $8
2926 mulq $4, $3, $24
2927 umulh $4, $3, $17
2928 cmplt $24, $31, $27
2929 cmplt $17, $31, $25
2930 addq $24, $24, $24
2931 addq $17, $17, $17
2932 addq $17, $27, $17
2933 addq $8, $25, $8
2934 addq $22, $24, $22
2935 addq $23, $17, $23
2936 cmpult $22, $24, $21
2937 cmpult $23, $17, $18
2938 addq $23, $21, $23
2939 addq $8, $18, $8
2940 mulq $5, $2, $28
2941 umulh $5, $2, $20
2942 cmplt $28, $31, $19
2943 cmplt $20, $31, $27
2944 addq $28, $28, $28
2945 addq $20, $20, $20
2946 addq $20, $19, $20
2947 addq $8, $27, $8
2948 addq $22, $28, $22
2949 addq $23, $20, $23
2950 cmpult $22, $28, $25
2951 cmpult $23, $20, $24
2952 addq $23, $25, $23
2953 addq $8, $24, $8
2954 mulq $6, $1, $17
2955 umulh $6, $1, $21
2956 cmplt $17, $31, $18
2957 cmplt $21, $31, $19
2958 addq $17, $17, $17
2959 addq $21, $21, $21
2960 addq $21, $18, $21
2961 addq $8, $19, $8
2962 addq $22, $17, $22
2963 addq $23, $21, $23
2964 cmpult $22, $17, $27
2965 cmpult $23, $21, $28
2966 addq $23, $27, $23
2967 addq $8, $28, $8
2968 mulq $7, $0, $20
2969 umulh $7, $0, $25
2970 cmplt $20, $31, $24
2971 cmplt $25, $31, $18
2972 addq $20, $20, $20
2973 addq $25, $25, $25
2974 addq $25, $24, $25
2975 addq $8, $18, $8
2976 addq $22, $20, $22
2977 addq $23, $25, $23
2978 cmpult $22, $20, $19
2979 cmpult $23, $25, $17
2980 addq $23, $19, $23
2981 addq $8, $17, $8
2982 stq $22, 56($16)
2983 bis $31, $31, $22
2984 mulq $4, $4, $21
2985 umulh $4, $4, $27
2986 addq $23, $21, $23
2987 addq $8, $27, $8
2988 cmpult $23, $21, $28
2989 cmpult $8, $27, $24
2990 addq $8, $28, $8
2991 addq $22, $24, $22
2992 mulq $5, $3, $18
2993 umulh $5, $3, $20
2994 cmplt $18, $31, $25
2995 cmplt $20, $31, $19
2996 addq $18, $18, $18
2997 addq $20, $20, $20
2998 addq $20, $25, $20
2999 addq $22, $19, $22
3000 addq $23, $18, $23
3001 addq $8, $20, $8
3002 cmpult $23, $18, $17
3003 cmpult $8, $20, $21
3004 addq $8, $17, $8
3005 addq $22, $21, $22
3006 mulq $6, $2, $27
3007 umulh $6, $2, $28
3008 cmplt $27, $31, $24
3009 cmplt $28, $31, $25
3010 addq $27, $27, $27
3011 addq $28, $28, $28
3012 addq $28, $24, $28
3013 addq $22, $25, $22
3014 addq $23, $27, $23
3015 addq $8, $28, $8
3016 cmpult $23, $27, $19
3017 cmpult $8, $28, $18
3018 addq $8, $19, $8
3019 addq $22, $18, $22
3020 mulq $7, $1, $20
3021 umulh $7, $1, $17
3022 cmplt $20, $31, $21
3023 cmplt $17, $31, $24
3024 addq $20, $20, $20
3025 addq $17, $17, $17
3026 addq $17, $21, $17
3027 addq $22, $24, $22
3028 addq $23, $20, $23
3029 addq $8, $17, $8
3030 cmpult $23, $20, $25
3031 cmpult $8, $17, $27
3032 addq $8, $25, $8
3033 addq $22, $27, $22
3034 stq $23, 64($16)
3035 bis $31, $31, $23
3036 mulq $5, $4, $28
3037 umulh $5, $4, $19
3038 cmplt $28, $31, $18
3039 cmplt $19, $31, $21
3040 addq $28, $28, $28
3041 addq $19, $19, $19
3042 addq $19, $18, $19
3043 addq $23, $21, $23
3044 addq $8, $28, $8
3045 addq $22, $19, $22
3046 cmpult $8, $28, $24
3047 cmpult $22, $19, $20
3048 addq $22, $24, $22
3049 addq $23, $20, $23
3050 mulq $6, $3, $17
3051 umulh $6, $3, $25
3052 cmplt $17, $31, $27
3053 cmplt $25, $31, $18
3054 addq $17, $17, $17
3055 addq $25, $25, $25
3056 addq $25, $27, $25
3057 addq $23, $18, $23
3058 addq $8, $17, $8
3059 addq $22, $25, $22
3060 cmpult $8, $17, $21
3061 cmpult $22, $25, $28
3062 addq $22, $21, $22
3063 addq $23, $28, $23
3064 mulq $7, $2, $19
3065 umulh $7, $2, $24
3066 cmplt $19, $31, $20
3067 cmplt $24, $31, $27
3068 addq $19, $19, $19
3069 addq $24, $24, $24
3070 addq $24, $20, $24
3071 addq $23, $27, $23
3072 addq $8, $19, $8
3073 addq $22, $24, $22
3074 cmpult $8, $19, $18
3075 cmpult $22, $24, $17
3076 addq $22, $18, $22
3077 addq $23, $17, $23
3078 stq $8, 72($16)
3079 bis $31, $31, $8
3080 mulq $5, $5, $25
3081 umulh $5, $5, $21
3082 addq $22, $25, $22
3083 addq $23, $21, $23
3084 cmpult $22, $25, $28
3085 cmpult $23, $21, $20
3086 addq $23, $28, $23
3087 addq $8, $20, $8
3088 mulq $6, $4, $27
3089 umulh $6, $4, $19
3090 cmplt $27, $31, $24
3091 cmplt $19, $31, $18
3092 addq $27, $27, $27
3093 addq $19, $19, $19
3094 addq $19, $24, $19
3095 addq $8, $18, $8
3096 addq $22, $27, $22
3097 addq $23, $19, $23
3098 cmpult $22, $27, $17
3099 cmpult $23, $19, $25
3100 addq $23, $17, $23
3101 addq $8, $25, $8
3102 mulq $7, $3, $21
3103 umulh $7, $3, $28
3104 cmplt $21, $31, $20
3105 cmplt $28, $31, $24
3106 addq $21, $21, $21
3107 addq $28, $28, $28
3108 addq $28, $20, $28
3109 addq $8, $24, $8
3110 addq $22, $21, $22
3111 addq $23, $28, $23
3112 cmpult $22, $21, $18
3113 cmpult $23, $28, $27
3114 addq $23, $18, $23
3115 addq $8, $27, $8
3116 stq $22, 80($16)
3117 bis $31, $31, $22
3118 mulq $6, $5, $19
3119 umulh $6, $5, $17
3120 cmplt $19, $31, $25
3121 cmplt $17, $31, $20
3122 addq $19, $19, $19
3123 addq $17, $17, $17
3124 addq $17, $25, $17
3125 addq $22, $20, $22
3126 addq $23, $19, $23
3127 addq $8, $17, $8
3128 cmpult $23, $19, $24
3129 cmpult $8, $17, $21
3130 addq $8, $24, $8
3131 addq $22, $21, $22
3132 mulq $7, $4, $28
3133 umulh $7, $4, $18
3134 cmplt $28, $31, $27
3135 cmplt $18, $31, $25
3136 addq $28, $28, $28
3137 addq $18, $18, $18
3138 addq $18, $27, $18
3139 addq $22, $25, $22
3140 addq $23, $28, $23
3141 addq $8, $18, $8
3142 cmpult $23, $28, $20
3143 cmpult $8, $18, $19
3144 addq $8, $20, $8
3145 addq $22, $19, $22
3146 stq $23, 88($16)
3147 bis $31, $31, $23
3148 mulq $6, $6, $17
3149 umulh $6, $6, $24
3150 addq $8, $17, $8
3151 addq $22, $24, $22
3152 cmpult $8, $17, $21
3153 cmpult $22, $24, $27
3154 addq $22, $21, $22
3155 addq $23, $27, $23
3156 mulq $7, $5, $25
3157 umulh $7, $5, $28
3158 cmplt $25, $31, $18
3159 cmplt $28, $31, $20
3160 addq $25, $25, $25
3161 addq $28, $28, $28
3162 addq $28, $18, $28
3163 addq $23, $20, $23
3164 addq $8, $25, $8
3165 addq $22, $28, $22
3166 cmpult $8, $25, $19
3167 cmpult $22, $28, $17
3168 addq $22, $19, $22
3169 addq $23, $17, $23
3170 stq $8, 96($16)
3171 bis $31, $31, $8
3172 mulq $7, $6, $24
3173 umulh $7, $6, $21
3174 cmplt $24, $31, $27
3175 cmplt $21, $31, $18
3176 addq $24, $24, $24
3177 addq $21, $21, $21
3178 addq $21, $27, $21
3179 addq $8, $18, $8
3180 addq $22, $24, $22
3181 addq $23, $21, $23
3182 cmpult $22, $24, $20
3183 cmpult $23, $21, $25
3184 addq $23, $20, $23
3185 addq $8, $25, $8
3186 stq $22, 104($16)
3187 bis $31, $31, $22
3188 mulq $7, $7, $28
3189 umulh $7, $7, $19
3190 addq $23, $28, $23
3191 addq $8, $19, $8
3192 cmpult $23, $28, $17
3193 cmpult $8, $19, $27
3194 addq $8, $17, $8
3195 addq $22, $27, $22
3196 stq $23, 112($16)
3197 stq $8, 120($16)
3198 ret $31,($26),1
3199 .end bn_sqr_comba8
diff --git a/src/lib/libcrypto/bn/asm/alpha.s.works b/src/lib/libcrypto/bn/asm/alpha.s.works
new file mode 100644
index 0000000000..ee6c587809
--- /dev/null
+++ b/src/lib/libcrypto/bn/asm/alpha.s.works
@@ -0,0 +1,533 @@
1
2 # DEC Alpha assember
3 # The bn_div64 is actually gcc output but the other parts are hand done.
4 # Thanks to tzeruch@ceddec.com for sending me the gcc output for
5 # bn_div64.
6 # I've gone back and re-done most of routines.
7 # The key thing to remeber for the 164 CPU is that while a
8 # multiply operation takes 8 cycles, another one can only be issued
9 # after 4 cycles have elapsed. I've done modification to help
10 # improve this. Also, normally, a ld instruction will not be available
11 # for about 3 cycles.
12 .file 1 "bn_asm.c"
13 .set noat
14gcc2_compiled.:
15__gnu_compiled_c:
16 .text
17 .align 3
18 .globl bn_mul_add_words
19 .ent bn_mul_add_words
20bn_mul_add_words:
21bn_mul_add_words..ng:
22 .frame $30,0,$26,0
23 .prologue 0
24 .align 5
25 subq $18,4,$18
26 bis $31,$31,$0
27 blt $18,$43 # if we are -1, -2, -3 or -4 goto tail code
28 ldq $20,0($17) # 1 1
29 ldq $1,0($16) # 1 1
30 .align 3
31$42:
32 mulq $20,$19,$5 # 1 2 1 ######
33 ldq $21,8($17) # 2 1
34 ldq $2,8($16) # 2 1
35 umulh $20,$19,$20 # 1 2 ######
36 ldq $27,16($17) # 3 1
37 ldq $3,16($16) # 3 1
38 mulq $21,$19,$6 # 2 2 1 ######
39 ldq $28,24($17) # 4 1
40 addq $1,$5,$1 # 1 2 2
41 ldq $4,24($16) # 4 1
42 umulh $21,$19,$21 # 2 2 ######
43 cmpult $1,$5,$22 # 1 2 3 1
44 addq $20,$22,$20 # 1 3 1
45 addq $1,$0,$1 # 1 2 3 1
46 mulq $27,$19,$7 # 3 2 1 ######
47 cmpult $1,$0,$0 # 1 2 3 2
48 addq $2,$6,$2 # 2 2 2
49 addq $20,$0,$0 # 1 3 2
50 cmpult $2,$6,$23 # 2 2 3 1
51 addq $21,$23,$21 # 2 3 1
52 umulh $27,$19,$27 # 3 2 ######
53 addq $2,$0,$2 # 2 2 3 1
54 cmpult $2,$0,$0 # 2 2 3 2
55 subq $18,4,$18
56 mulq $28,$19,$8 # 4 2 1 ######
57 addq $21,$0,$0 # 2 3 2
58 addq $3,$7,$3 # 3 2 2
59 addq $16,32,$16
60 cmpult $3,$7,$24 # 3 2 3 1
61 stq $1,-32($16) # 1 2 4
62 umulh $28,$19,$28 # 4 2 ######
63 addq $27,$24,$27 # 3 3 1
64 addq $3,$0,$3 # 3 2 3 1
65 stq $2,-24($16) # 2 2 4
66 cmpult $3,$0,$0 # 3 2 3 2
67 stq $3,-16($16) # 3 2 4
68 addq $4,$8,$4 # 4 2 2
69 addq $27,$0,$0 # 3 3 2
70 cmpult $4,$8,$25 # 4 2 3 1
71 addq $17,32,$17
72 addq $28,$25,$28 # 4 3 1
73 addq $4,$0,$4 # 4 2 3 1
74 cmpult $4,$0,$0 # 4 2 3 2
75 stq $4,-8($16) # 4 2 4
76 addq $28,$0,$0 # 4 3 2
77 blt $18,$43
78
79 ldq $20,0($17) # 1 1
80 ldq $1,0($16) # 1 1
81
82 br $42
83
84 .align 4
85$45:
86 ldq $20,0($17) # 4 1
87 ldq $1,0($16) # 4 1
88 mulq $20,$19,$5 # 4 2 1
89 subq $18,1,$18
90 addq $16,8,$16
91 addq $17,8,$17
92 umulh $20,$19,$20 # 4 2
93 addq $1,$5,$1 # 4 2 2
94 cmpult $1,$5,$22 # 4 2 3 1
95 addq $20,$22,$20 # 4 3 1
96 addq $1,$0,$1 # 4 2 3 1
97 cmpult $1,$0,$0 # 4 2 3 2
98 addq $20,$0,$0 # 4 3 2
99 stq $1,-8($16) # 4 2 4
100 bgt $18,$45
101 ret $31,($26),1 # else exit
102
103 .align 4
104$43:
105 addq $18,4,$18
106 bgt $18,$45 # goto tail code
107 ret $31,($26),1 # else exit
108
109 .end bn_mul_add_words
110 .align 3
111 .globl bn_mul_words
112 .ent bn_mul_words
113bn_mul_words:
114bn_mul_words..ng:
115 .frame $30,0,$26,0
116 .prologue 0
117 .align 5
118 subq $18,4,$18
119 bis $31,$31,$0
120 blt $18,$143 # if we are -1, -2, -3 or -4 goto tail code
121 ldq $20,0($17) # 1 1
122 .align 3
123$142:
124
125 mulq $20,$19,$5 # 1 2 1 #####
126 ldq $21,8($17) # 2 1
127 ldq $27,16($17) # 3 1
128 umulh $20,$19,$20 # 1 2 #####
129 ldq $28,24($17) # 4 1
130 mulq $21,$19,$6 # 2 2 1 #####
131 addq $5,$0,$5 # 1 2 3 1
132 subq $18,4,$18
133 cmpult $5,$0,$0 # 1 2 3 2
134 umulh $21,$19,$21 # 2 2 #####
135 addq $20,$0,$0 # 1 3 2
136 addq $17,32,$17
137 addq $6,$0,$6 # 2 2 3 1
138 mulq $27,$19,$7 # 3 2 1 #####
139 cmpult $6,$0,$0 # 2 2 3 2
140 addq $21,$0,$0 # 2 3 2
141 addq $16,32,$16
142 umulh $27,$19,$27 # 3 2 #####
143 stq $5,-32($16) # 1 2 4
144 mulq $28,$19,$8 # 4 2 1 #####
145 addq $7,$0,$7 # 3 2 3 1
146 stq $6,-24($16) # 2 2 4
147 cmpult $7,$0,$0 # 3 2 3 2
148 umulh $28,$19,$28 # 4 2 #####
149 addq $27,$0,$0 # 3 3 2
150 stq $7,-16($16) # 3 2 4
151 addq $8,$0,$8 # 4 2 3 1
152 cmpult $8,$0,$0 # 4 2 3 2
153
154 addq $28,$0,$0 # 4 3 2
155
156 stq $8,-8($16) # 4 2 4
157
158 blt $18,$143
159
160 ldq $20,0($17) # 1 1
161
162 br $142
163
164 .align 4
165$145:
166 ldq $20,0($17) # 4 1
167 mulq $20,$19,$5 # 4 2 1
168 subq $18,1,$18
169 umulh $20,$19,$20 # 4 2
170 addq $5,$0,$5 # 4 2 3 1
171 addq $16,8,$16
172 cmpult $5,$0,$0 # 4 2 3 2
173 addq $17,8,$17
174 addq $20,$0,$0 # 4 3 2
175 stq $5,-8($16) # 4 2 4
176
177 bgt $18,$145
178 ret $31,($26),1 # else exit
179
180 .align 4
181$143:
182 addq $18,4,$18
183 bgt $18,$145 # goto tail code
184 ret $31,($26),1 # else exit
185
186 .end bn_mul_words
187 .align 3
188 .globl bn_sqr_words
189 .ent bn_sqr_words
190bn_sqr_words:
191bn_sqr_words..ng:
192 .frame $30,0,$26,0
193 .prologue 0
194
195 subq $18,4,$18
196 blt $18,$543 # if we are -1, -2, -3 or -4 goto tail code
197 ldq $20,0($17) # 1 1
198 .align 3
199$542:
200 mulq $20,$20,$5 ######
201 ldq $21,8($17) # 1 1
202 subq $18,4
203 umulh $20,$20,$1 ######
204 ldq $27,16($17) # 1 1
205 mulq $21,$21,$6 ######
206 ldq $28,24($17) # 1 1
207 stq $5,0($16) # r[0]
208 umulh $21,$21,$2 ######
209 stq $1,8($16) # r[1]
210 mulq $27,$27,$7 ######
211 stq $6,16($16) # r[0]
212 umulh $27,$27,$3 ######
213 stq $2,24($16) # r[1]
214 mulq $28,$28,$8 ######
215 stq $7,32($16) # r[0]
216 umulh $28,$28,$4 ######
217 stq $3,40($16) # r[1]
218
219 addq $16,64,$16
220 addq $17,32,$17
221 stq $8,-16($16) # r[0]
222 stq $4,-8($16) # r[1]
223
224 blt $18,$543
225 ldq $20,0($17) # 1 1
226 br $542
227
228$442:
229 ldq $20,0($17) # a[0]
230 mulq $20,$20,$5 # a[0]*w low part r2
231 addq $16,16,$16
232 addq $17,8,$17
233 subq $18,1,$18
234 umulh $20,$20,$1 # a[0]*w high part r3
235 stq $5,-16($16) # r[0]
236 stq $1,-8($16) # r[1]
237
238 bgt $18,$442
239 ret $31,($26),1 # else exit
240
241 .align 4
242$543:
243 addq $18,4,$18
244 bgt $18,$442 # goto tail code
245 ret $31,($26),1 # else exit
246 .end bn_sqr_words
247
248 .align 3
249 .globl bn_add_words
250 .ent bn_add_words
251bn_add_words:
252bn_add_words..ng:
253 .frame $30,0,$26,0
254 .prologue 0
255
256 subq $19,4,$19
257 bis $31,$31,$0 # carry = 0
258 blt $19,$900
259 ldq $5,0($17) # a[0]
260 ldq $1,0($18) # b[1]
261 .align 3
262$901:
263 addq $1,$5,$1 # r=a+b;
264 ldq $6,8($17) # a[1]
265 cmpult $1,$5,$22 # did we overflow?
266 ldq $2,8($18) # b[1]
267 addq $1,$0,$1 # c+= overflow
268 ldq $7,16($17) # a[2]
269 cmpult $1,$0,$0 # overflow?
270 ldq $3,16($18) # b[2]
271 addq $0,$22,$0
272 ldq $8,24($17) # a[3]
273 addq $2,$6,$2 # r=a+b;
274 ldq $4,24($18) # b[3]
275 cmpult $2,$6,$23 # did we overflow?
276 addq $3,$7,$3 # r=a+b;
277 addq $2,$0,$2 # c+= overflow
278 cmpult $3,$7,$24 # did we overflow?
279 cmpult $2,$0,$0 # overflow?
280 addq $4,$8,$4 # r=a+b;
281 addq $0,$23,$0
282 cmpult $4,$8,$25 # did we overflow?
283 addq $3,$0,$3 # c+= overflow
284 stq $1,0($16) # r[0]=c
285 cmpult $3,$0,$0 # overflow?
286 stq $2,8($16) # r[1]=c
287 addq $0,$24,$0
288 stq $3,16($16) # r[2]=c
289 addq $4,$0,$4 # c+= overflow
290 subq $19,4,$19 # loop--
291 cmpult $4,$0,$0 # overflow?
292 addq $17,32,$17 # a++
293 addq $0,$25,$0
294 stq $4,24($16) # r[3]=c
295 addq $18,32,$18 # b++
296 addq $16,32,$16 # r++
297
298 blt $19,$900
299 ldq $5,0($17) # a[0]
300 ldq $1,0($18) # b[1]
301 br $901
302 .align 4
303$945:
304 ldq $5,0($17) # a[0]
305 ldq $1,0($18) # b[1]
306 addq $1,$5,$1 # r=a+b;
307 subq $19,1,$19 # loop--
308 addq $1,$0,$1 # c+= overflow
309 addq $17,8,$17 # a++
310 cmpult $1,$5,$22 # did we overflow?
311 cmpult $1,$0,$0 # overflow?
312 addq $18,8,$18 # b++
313 stq $1,0($16) # r[0]=c
314 addq $0,$22,$0
315 addq $16,8,$16 # r++
316
317 bgt $19,$945
318 ret $31,($26),1 # else exit
319
320$900:
321 addq $19,4,$19
322 bgt $19,$945 # goto tail code
323 ret $31,($26),1 # else exit
324 .end bn_add_words
325
326 #
327 # What follows was taken directly from the C compiler with a few
328 # hacks to redo the lables.
329 #
330.text
331 .align 3
332 .globl bn_div64
333 .ent bn_div64
334bn_div64:
335 ldgp $29,0($27)
336bn_div64..ng:
337 lda $30,-48($30)
338 .frame $30,48,$26,0
339 stq $26,0($30)
340 stq $9,8($30)
341 stq $10,16($30)
342 stq $11,24($30)
343 stq $12,32($30)
344 stq $13,40($30)
345 .mask 0x4003e00,-48
346 .prologue 1
347 bis $16,$16,$9
348 bis $17,$17,$10
349 bis $18,$18,$11
350 bis $31,$31,$13
351 bis $31,2,$12
352 bne $11,$119
353 lda $0,-1
354 br $31,$136
355 .align 4
356$119:
357 bis $11,$11,$16
358 jsr $26,BN_num_bits_word
359 ldgp $29,0($26)
360 subq $0,64,$1
361 beq $1,$120
362 bis $31,1,$1
363 sll $1,$0,$1
364 cmpule $9,$1,$1
365 bne $1,$120
366 # lda $16,_IO_stderr_
367 # lda $17,$C32
368 # bis $0,$0,$18
369 # jsr $26,fprintf
370 # ldgp $29,0($26)
371 jsr $26,abort
372 ldgp $29,0($26)
373 .align 4
374$120:
375 bis $31,64,$3
376 cmpult $9,$11,$2
377 subq $3,$0,$1
378 addl $1,$31,$0
379 subq $9,$11,$1
380 cmoveq $2,$1,$9
381 beq $0,$122
382 zapnot $0,15,$2
383 subq $3,$0,$1
384 sll $11,$2,$11
385 sll $9,$2,$3
386 srl $10,$1,$1
387 sll $10,$2,$10
388 bis $3,$1,$9
389$122:
390 srl $11,32,$5
391 zapnot $11,15,$6
392 lda $7,-1
393 .align 5
394$123:
395 srl $9,32,$1
396 subq $1,$5,$1
397 bne $1,$126
398 zapnot $7,15,$27
399 br $31,$127
400 .align 4
401$126:
402 bis $9,$9,$24
403 bis $5,$5,$25
404 divqu $24,$25,$27
405$127:
406 srl $10,32,$4
407 .align 5
408$128:
409 mulq $27,$5,$1
410 subq $9,$1,$3
411 zapnot $3,240,$1
412 bne $1,$129
413 mulq $6,$27,$2
414 sll $3,32,$1
415 addq $1,$4,$1
416 cmpule $2,$1,$2
417 bne $2,$129
418 subq $27,1,$27
419 br $31,$128
420 .align 4
421$129:
422 mulq $27,$6,$1
423 mulq $27,$5,$4
424 srl $1,32,$3
425 sll $1,32,$1
426 addq $4,$3,$4
427 cmpult $10,$1,$2
428 subq $10,$1,$10
429 addq $2,$4,$2
430 cmpult $9,$2,$1
431 bis $2,$2,$4
432 beq $1,$134
433 addq $9,$11,$9
434 subq $27,1,$27
435$134:
436 subl $12,1,$12
437 subq $9,$4,$9
438 beq $12,$124
439 sll $27,32,$13
440 sll $9,32,$2
441 srl $10,32,$1
442 sll $10,32,$10
443 bis $2,$1,$9
444 br $31,$123
445 .align 4
446$124:
447 bis $13,$27,$0
448$136:
449 ldq $26,0($30)
450 ldq $9,8($30)
451 ldq $10,16($30)
452 ldq $11,24($30)
453 ldq $12,32($30)
454 ldq $13,40($30)
455 addq $30,48,$30
456 ret $31,($26),1
457 .end bn_div64
458
459 .set noat
460 .text
461 .align 3
462 .globl bn_sub_words
463 .ent bn_sub_words
464bn_sub_words:
465bn_sub_words..ng:
466 .frame $30,0,$26,0
467 .prologue 0
468
469 subq $19, 4, $19
470 bis $31, $31, $0
471 blt $19, $100
472 ldq $1, 0($17)
473 ldq $2, 0($18)
474$101:
475 ldq $3, 8($17)
476 cmpult $1, $2, $4
477 ldq $5, 8($18)
478 subq $1, $2, $1
479 ldq $6, 16($17)
480 cmpult $1, $0, $2
481 ldq $7, 16($18)
482 subq $1, $0, $23
483 ldq $8, 24($17)
484 addq $2, $4, $0
485 cmpult $3, $5, $24
486 subq $3, $5, $3
487 ldq $22, 24($18)
488 cmpult $3, $0, $5
489 subq $3, $0, $25
490 addq $5, $24, $0
491 cmpult $6, $7, $27
492 subq $6, $7, $6
493 stq $23, 0($16)
494 cmpult $6, $0, $7
495 subq $6, $0, $28
496 addq $7, $27, $0
497 cmpult $8, $22, $21
498 subq $8, $22, $8
499 stq $25, 8($16)
500 cmpult $8, $0, $22
501 subq $8, $0, $20
502 addq $22, $21, $0
503 stq $28, 16($16)
504 subq $19, 4, $19
505 stq $20, 24($16)
506 addq $17, 32, $17
507 addq $18, 32, $18
508 addq $16, 32, $16
509 blt $19, $100
510 ldq $1, 0($17)
511 ldq $2, 0($18)
512 br $101
513$102:
514 ldq $1, 0($17)
515 ldq $2, 0($18)
516 cmpult $1, $2, $27
517 subq $1, $2, $1
518 cmpult $1, $0, $2
519 subq $1, $0, $1
520 stq $1, 0($16)
521 addq $2, $27, $0
522 addq $17, 8, $17
523 addq $18, 8, $18
524 addq $16, 8, $16
525 subq $19, 1, $19
526 bgt $19, $102
527 ret $31,($26),1
528$100:
529 addq $19, 4, $19
530 bgt $19, $102
531$103:
532 ret $31,($26),1
533 .end bn_sub_words
diff --git a/src/lib/libcrypto/bn/asm/alpha.works/add.pl b/src/lib/libcrypto/bn/asm/alpha.works/add.pl
new file mode 100644
index 0000000000..4dc76e6b69
--- /dev/null
+++ b/src/lib/libcrypto/bn/asm/alpha.works/add.pl
@@ -0,0 +1,119 @@
1#!/usr/local/bin/perl
2# alpha assember
3
4sub bn_add_words
5 {
6 local($name)=@_;
7 local($cc,$a,$b,$r);
8
9 &init_pool(4);
10 ($cc)=GR("r0");
11
12 $rp=&wparam(0);
13 $ap=&wparam(1);
14 $bp=&wparam(2);
15 $count=&wparam(3);
16
17 &function_begin($name,"");
18
19 &comment("");
20 &sub($count,4,$count);
21 &mov("zero",$cc);
22 &br(&label("finish"));
23 &blt($count,&label("finish"));
24
25 ($a0,$b0)=&NR(2);
26 &ld($a0,&QWPw(0,$ap));
27 &ld($b0,&QWPw(0,$bp));
28
29##########################################################
30 &set_label("loop");
31
32 ($a1)=&NR(1); &ld($a1,&QWPw(1,$ap));
33 ($b1)=&NR(1); &ld($b1,&QWPw(1,$bp));
34 ($a2)=&NR(1); &ld($a2,&QWPw(2,$ap));
35 ($b2)=&NR(1); &ld($b2,&QWPw(2,$bp));
36 ($a3)=&NR(1); &ld($a3,&QWPw(3,$ap));
37 ($b3)=&NR(1); &ld($b3,&QWPw(3,$bp));
38
39 ($o0,$t0)=&NR(2);
40 &add($a0,$b0,$o0);
41 &cmpult($o0,$b0,$t0);
42 &add($o0,$cc,$o0);
43 &cmpult($o0,$cc,$cc);
44 &add($cc,$t0,$cc); &FR($t0);
45
46 ($t1,$o1)=&NR(2);
47
48 &add($a1,$b1,$o1); &FR($a1);
49 &cmpult($o1,$b1,$t1); &FR($b1);
50 &add($o1,$cc,$o1);
51 &cmpult($o1,$cc,$cc);
52 &add($cc,$t1,$cc); &FR($t1);
53
54 ($t2,$o2)=&NR(2);
55
56 &add($a2,$b2,$o2); &FR($a2);
57 &cmpult($o2,$b2,$t2); &FR($b2);
58 &add($o2,$cc,$o2);
59 &cmpult($o2,$cc,$cc);
60 &add($cc,$t2,$cc); &FR($t2);
61
62 ($t3,$o3)=&NR(2);
63
64 &add($a3,$b3,$o3); &FR($a3);
65 &cmpult($o3,$b3,$t3); &FR($b3);
66 &add($o3,$cc,$o3);
67 &cmpult($o3,$cc,$cc);
68 &add($cc,$t3,$cc); &FR($t3);
69
70 &st($o0,&QWPw(0,$rp)); &FR($o0);
71 &st($o1,&QWPw(0,$rp)); &FR($o1);
72 &st($o2,&QWPw(0,$rp)); &FR($o2);
73 &st($o3,&QWPw(0,$rp)); &FR($o3);
74
75 &sub($count,4,$count); # count-=4
76 &add($ap,4*$QWS,$ap); # count+=4
77 &add($bp,4*$QWS,$bp); # count+=4
78 &add($rp,4*$QWS,$rp); # count+=4
79
80 &blt($count,&label("finish"));
81 &ld($a0,&QWPw(0,$ap));
82 &ld($b0,&QWPw(0,$bp));
83 &br(&label("loop"));
84##################################################
85 # Do the last 0..3 words
86
87 ($t0,$o0)=&NR(2);
88 &set_label("last_loop");
89
90 &ld($a0,&QWPw(0,$ap)); # get a
91 &ld($b0,&QWPw(0,$bp)); # get b
92
93 &add($a0,$b0,$o0);
94 &cmpult($o0,$b0,$t0); # will we borrow?
95 &add($o0,$cc,$o0); # will we borrow?
96 &cmpult($o0,$cc,$cc); # will we borrow?
97 &add($cc,$t0,$cc); # add the borrows
98 &st($o0,&QWPw(0,$rp)); # save
99
100 &add($ap,$QWS,$ap);
101 &add($bp,$QWS,$bp);
102 &add($rp,$QWS,$rp);
103 &sub($count,1,$count);
104 &bgt($count,&label("last_loop"));
105 &function_end_A($name);
106
107######################################################
108 &set_label("finish");
109 &add($count,4,$count);
110 &bgt($count,&label("last_loop"));
111
112 &FR($o0,$t0,$a0,$b0);
113 &set_label("end");
114 &function_end($name);
115
116 &fin_pool;
117 }
118
1191;
diff --git a/src/lib/libcrypto/bn/asm/alpha.works/div.pl b/src/lib/libcrypto/bn/asm/alpha.works/div.pl
new file mode 100644
index 0000000000..7ec144377f
--- /dev/null
+++ b/src/lib/libcrypto/bn/asm/alpha.works/div.pl
@@ -0,0 +1,144 @@
1#!/usr/local/bin/perl
2
3sub bn_div64
4 {
5 local($data)=<<'EOF';
6 #
7 # What follows was taken directly from the C compiler with a few
8 # hacks to redo the lables.
9 #
10.text
11 .set noreorder
12 .set volatile
13 .align 3
14 .globl bn_div64
15 .ent bn_div64
16bn_div64:
17 ldgp $29,0($27)
18bn_div64..ng:
19 lda $30,-48($30)
20 .frame $30,48,$26,0
21 stq $26,0($30)
22 stq $9,8($30)
23 stq $10,16($30)
24 stq $11,24($30)
25 stq $12,32($30)
26 stq $13,40($30)
27 .mask 0x4003e00,-48
28 .prologue 1
29 bis $16,$16,$9
30 bis $17,$17,$10
31 bis $18,$18,$11
32 bis $31,$31,$13
33 bis $31,2,$12
34 bne $11,$9119
35 lda $0,-1
36 br $31,$9136
37 .align 4
38$9119:
39 bis $11,$11,$16
40 jsr $26,BN_num_bits_word
41 ldgp $29,0($26)
42 subq $0,64,$1
43 beq $1,$9120
44 bis $31,1,$1
45 sll $1,$0,$1
46 cmpule $9,$1,$1
47 bne $1,$9120
48 # lda $16,_IO_stderr_
49 # lda $17,$C32
50 # bis $0,$0,$18
51 # jsr $26,fprintf
52 # ldgp $29,0($26)
53 jsr $26,abort
54 ldgp $29,0($26)
55 .align 4
56$9120:
57 bis $31,64,$3
58 cmpult $9,$11,$2
59 subq $3,$0,$1
60 addl $1,$31,$0
61 subq $9,$11,$1
62 cmoveq $2,$1,$9
63 beq $0,$9122
64 zapnot $0,15,$2
65 subq $3,$0,$1
66 sll $11,$2,$11
67 sll $9,$2,$3
68 srl $10,$1,$1
69 sll $10,$2,$10
70 bis $3,$1,$9
71$9122:
72 srl $11,32,$5
73 zapnot $11,15,$6
74 lda $7,-1
75 .align 5
76$9123:
77 srl $9,32,$1
78 subq $1,$5,$1
79 bne $1,$9126
80 zapnot $7,15,$27
81 br $31,$9127
82 .align 4
83$9126:
84 bis $9,$9,$24
85 bis $5,$5,$25
86 divqu $24,$25,$27
87$9127:
88 srl $10,32,$4
89 .align 5
90$9128:
91 mulq $27,$5,$1
92 subq $9,$1,$3
93 zapnot $3,240,$1
94 bne $1,$9129
95 mulq $6,$27,$2
96 sll $3,32,$1
97 addq $1,$4,$1
98 cmpule $2,$1,$2
99 bne $2,$9129
100 subq $27,1,$27
101 br $31,$9128
102 .align 4
103$9129:
104 mulq $27,$6,$1
105 mulq $27,$5,$4
106 srl $1,32,$3
107 sll $1,32,$1
108 addq $4,$3,$4
109 cmpult $10,$1,$2
110 subq $10,$1,$10
111 addq $2,$4,$2
112 cmpult $9,$2,$1
113 bis $2,$2,$4
114 beq $1,$9134
115 addq $9,$11,$9
116 subq $27,1,$27
117$9134:
118 subl $12,1,$12
119 subq $9,$4,$9
120 beq $12,$9124
121 sll $27,32,$13
122 sll $9,32,$2
123 srl $10,32,$1
124 sll $10,32,$10
125 bis $2,$1,$9
126 br $31,$9123
127 .align 4
128$9124:
129 bis $13,$27,$0
130$9136:
131 ldq $26,0($30)
132 ldq $9,8($30)
133 ldq $10,16($30)
134 ldq $11,24($30)
135 ldq $12,32($30)
136 ldq $13,40($30)
137 addq $30,48,$30
138 ret $31,($26),1
139 .end bn_div64
140EOF
141 &asm_add($data);
142 }
143
1441;
diff --git a/src/lib/libcrypto/bn/asm/alpha.works/mul.pl b/src/lib/libcrypto/bn/asm/alpha.works/mul.pl
new file mode 100644
index 0000000000..b182bae452
--- /dev/null
+++ b/src/lib/libcrypto/bn/asm/alpha.works/mul.pl
@@ -0,0 +1,116 @@
1#!/usr/local/bin/perl
2# alpha assember
3
4sub bn_mul_words
5 {
6 local($name)=@_;
7 local($cc,$a,$b,$r,$couny);
8
9 &init_pool(4);
10 ($cc)=GR("r0");
11
12 $rp=&wparam(0);
13 $ap=&wparam(1);
14 $count=&wparam(2);
15 $word=&wparam(3);
16
17 &function_begin($name,"");
18
19 &comment("");
20 &sub($count,4,$count);
21 &mov("zero",$cc);
22 &br(&label("finish"));
23 &blt($count,&label("finish"));
24
25 ($a0,$r0)=&NR(2);
26 &ld($a0,&QWPw(0,$ap));
27 &ld($r0,&QWPw(0,$rp));
28
29$a=<<'EOF';
30##########################################################
31 &set_label("loop");
32
33 ($a1)=&NR(1); &ld($a1,&QWPw(1,$ap));
34 ($b1)=&NR(1); &ld($b1,&QWPw(1,$bp));
35 ($a2)=&NR(1); &ld($a2,&QWPw(2,$ap));
36 ($b2)=&NR(1); &ld($b2,&QWPw(2,$bp));
37 ($a3)=&NR(1); &ld($a3,&QWPw(3,$ap));
38 ($b3)=&NR(1); &ld($b3,&QWPw(3,$bp));
39
40 ($o0,$t0)=&NR(2);
41 &add($a0,$b0,$o0);
42 &cmpult($o0,$b0,$t0);
43 &add($o0,$cc,$o0);
44 &cmpult($o0,$cc,$cc);
45 &add($cc,$t0,$cc); &FR($t0);
46
47 ($t1,$o1)=&NR(2);
48
49 &add($a1,$b1,$o1); &FR($a1);
50 &cmpult($o1,$b1,$t1); &FR($b1);
51 &add($o1,$cc,$o1);
52 &cmpult($o1,$cc,$cc);
53 &add($cc,$t1,$cc); &FR($t1);
54
55 ($t2,$o2)=&NR(2);
56
57 &add($a2,$b2,$o2); &FR($a2);
58 &cmpult($o2,$b2,$t2); &FR($b2);
59 &add($o2,$cc,$o2);
60 &cmpult($o2,$cc,$cc);
61 &add($cc,$t2,$cc); &FR($t2);
62
63 ($t3,$o3)=&NR(2);
64
65 &add($a3,$b3,$o3); &FR($a3);
66 &cmpult($o3,$b3,$t3); &FR($b3);
67 &add($o3,$cc,$o3);
68 &cmpult($o3,$cc,$cc);
69 &add($cc,$t3,$cc); &FR($t3);
70
71 &st($o0,&QWPw(0,$rp)); &FR($o0);
72 &st($o1,&QWPw(0,$rp)); &FR($o1);
73 &st($o2,&QWPw(0,$rp)); &FR($o2);
74 &st($o3,&QWPw(0,$rp)); &FR($o3);
75
76 &sub($count,4,$count); # count-=4
77 &add($ap,4*$QWS,$ap); # count+=4
78 &add($bp,4*$QWS,$bp); # count+=4
79 &add($rp,4*$QWS,$rp); # count+=4
80
81 &blt($count,&label("finish"));
82 &ld($a0,&QWPw(0,$ap));
83 &ld($b0,&QWPw(0,$bp));
84 &br(&label("loop"));
85EOF
86##################################################
87 # Do the last 0..3 words
88
89 &set_label("last_loop");
90
91 &ld(($a0)=&NR(1),&QWPw(0,$ap)); # get a
92 &mul($a0,$word,($l0)=&NR(1));
93 &add($ap,$QWS,$ap);
94 &muh($a0,$word,($h0)=&NR(1)); &FR($a0);
95 &add($l0,$cc,$l0);
96 &add($rp,$QWS,$rp);
97 &sub($count,1,$count);
98 &cmpult($l0,$cc,$cc);
99 &st($l0,&QWPw(-1,$rp)); &FR($l0);
100 &add($h0,$cc,$cc); &FR($h0);
101
102 &bgt($count,&label("last_loop"));
103 &function_end_A($name);
104
105######################################################
106 &set_label("finish");
107 &add($count,4,$count);
108 &bgt($count,&label("last_loop"));
109
110 &set_label("end");
111 &function_end($name);
112
113 &fin_pool;
114 }
115
1161;
diff --git a/src/lib/libcrypto/bn/asm/alpha.works/mul_add.pl b/src/lib/libcrypto/bn/asm/alpha.works/mul_add.pl
new file mode 100644
index 0000000000..e37f6315fb
--- /dev/null
+++ b/src/lib/libcrypto/bn/asm/alpha.works/mul_add.pl
@@ -0,0 +1,120 @@
1#!/usr/local/bin/perl
2# alpha assember
3
4sub bn_mul_add_words
5 {
6 local($name)=@_;
7 local($cc,$a,$b,$r,$couny);
8
9 &init_pool(4);
10 ($cc)=GR("r0");
11
12 $rp=&wparam(0);
13 $ap=&wparam(1);
14 $count=&wparam(2);
15 $word=&wparam(3);
16
17 &function_begin($name,"");
18
19 &comment("");
20 &sub($count,4,$count);
21 &mov("zero",$cc);
22 &br(&label("finish"));
23 &blt($count,&label("finish"));
24
25 ($a0,$r0)=&NR(2);
26 &ld($a0,&QWPw(0,$ap));
27 &ld($r0,&QWPw(0,$rp));
28
29$a=<<'EOF';
30##########################################################
31 &set_label("loop");
32
33 ($a1)=&NR(1); &ld($a1,&QWPw(1,$ap));
34 ($b1)=&NR(1); &ld($b1,&QWPw(1,$bp));
35 ($a2)=&NR(1); &ld($a2,&QWPw(2,$ap));
36 ($b2)=&NR(1); &ld($b2,&QWPw(2,$bp));
37 ($a3)=&NR(1); &ld($a3,&QWPw(3,$ap));
38 ($b3)=&NR(1); &ld($b3,&QWPw(3,$bp));
39
40 ($o0,$t0)=&NR(2);
41 &add($a0,$b0,$o0);
42 &cmpult($o0,$b0,$t0);
43 &add($o0,$cc,$o0);
44 &cmpult($o0,$cc,$cc);
45 &add($cc,$t0,$cc); &FR($t0);
46
47 ($t1,$o1)=&NR(2);
48
49 &add($a1,$b1,$o1); &FR($a1);
50 &cmpult($o1,$b1,$t1); &FR($b1);
51 &add($o1,$cc,$o1);
52 &cmpult($o1,$cc,$cc);
53 &add($cc,$t1,$cc); &FR($t1);
54
55 ($t2,$o2)=&NR(2);
56
57 &add($a2,$b2,$o2); &FR($a2);
58 &cmpult($o2,$b2,$t2); &FR($b2);
59 &add($o2,$cc,$o2);
60 &cmpult($o2,$cc,$cc);
61 &add($cc,$t2,$cc); &FR($t2);
62
63 ($t3,$o3)=&NR(2);
64
65 &add($a3,$b3,$o3); &FR($a3);
66 &cmpult($o3,$b3,$t3); &FR($b3);
67 &add($o3,$cc,$o3);
68 &cmpult($o3,$cc,$cc);
69 &add($cc,$t3,$cc); &FR($t3);
70
71 &st($o0,&QWPw(0,$rp)); &FR($o0);
72 &st($o1,&QWPw(0,$rp)); &FR($o1);
73 &st($o2,&QWPw(0,$rp)); &FR($o2);
74 &st($o3,&QWPw(0,$rp)); &FR($o3);
75
76 &sub($count,4,$count); # count-=4
77 &add($ap,4*$QWS,$ap); # count+=4
78 &add($bp,4*$QWS,$bp); # count+=4
79 &add($rp,4*$QWS,$rp); # count+=4
80
81 &blt($count,&label("finish"));
82 &ld($a0,&QWPw(0,$ap));
83 &ld($b0,&QWPw(0,$bp));
84 &br(&label("loop"));
85EOF
86##################################################
87 # Do the last 0..3 words
88
89 &set_label("last_loop");
90
91 &ld(($a0)=&NR(1),&QWPw(0,$ap)); # get a
92 &ld(($r0)=&NR(1),&QWPw(0,$rp)); # get b
93 &mul($a0,$word,($l0)=&NR(1));
94 &sub($count,1,$count);
95 &add($ap,$QWS,$ap);
96 &muh($a0,$word,($h0)=&NR(1)); &FR($a0);
97 &add($r0,$l0,$r0);
98 &add($rp,$QWS,$rp);
99 &cmpult($r0,$l0,($t0)=&NR(1)); &FR($l0);
100 &add($r0,$cc,$r0);
101 &add($h0,$t0,$h0); &FR($t0);
102 &cmpult($r0,$cc,$cc);
103 &st($r0,&QWPw(-1,$rp)); &FR($r0);
104 &add($h0,$cc,$cc); &FR($h0);
105
106 &bgt($count,&label("last_loop"));
107 &function_end_A($name);
108
109######################################################
110 &set_label("finish");
111 &add($count,4,$count);
112 &bgt($count,&label("last_loop"));
113
114 &set_label("end");
115 &function_end($name);
116
117 &fin_pool;
118 }
119
1201;
diff --git a/src/lib/libcrypto/bn/asm/alpha.works/mul_c4.pl b/src/lib/libcrypto/bn/asm/alpha.works/mul_c4.pl
new file mode 100644
index 0000000000..5efd201281
--- /dev/null
+++ b/src/lib/libcrypto/bn/asm/alpha.works/mul_c4.pl
@@ -0,0 +1,213 @@
1#!/usr/local/bin/perl
2# alpha assember
3
4sub mul_add_c
5 {
6 local($a,$b,$c0,$c1,$c2)=@_;
7 local($l1,$h1,$t1,$t2);
8
9 &mul($a,$b,($l1)=&NR(1));
10 &muh($a,$b,($h1)=&NR(1));
11 &add($c0,$l1,$c0);
12 &cmpult($c0,$l1,($t1)=&NR(1)); &FR($l1);
13 &add($t1,$h1,$h1); &FR($t1);
14 &add($c1,$h1,$c1);
15 &cmpult($c1,$h1,($t2)=&NR(1)); &FR($h1);
16 &add($c2,$t2,$c2); &FR($t2);
17 }
18
19sub bn_mul_comba4
20 {
21 local($name)=@_;
22 local(@a,@b,$r,$c0,$c1,$c2);
23
24 $cnt=1;
25 &init_pool(3);
26
27 $rp=&wparam(0);
28 $ap=&wparam(1);
29 $bp=&wparam(2);
30
31 &function_begin($name,"");
32
33 &comment("");
34
35 &ld(($a[0])=&NR(1),&QWPw(0,$ap));
36 &ld(($b[0])=&NR(1),&QWPw(0,$bp));
37 &ld(($a[1])=&NR(1),&QWPw(1,$ap));
38 &ld(($b[1])=&NR(1),&QWPw(1,$bp));
39 &mul($a[0],$b[0],($r00)=&NR(1));
40 &ld(($a[2])=&NR(1),&QWPw(2,$ap));
41 &ld(($b[2])=&NR(1),&QWPw(2,$bp));
42 &muh($a[0],$b[0],($r01)=&NR(1));
43 &FR($ap); &ld(($a[3])=&NR(1),&QWPw(3,$ap));
44 &FR($bp); &ld(($b[3])=&NR(1),&QWPw(3,$bp));
45 &mul($a[0],$b[1],($r02)=&NR(1));
46
47 ($R,$H1,$H2)=&NR(3);
48
49 &st($r00,&QWPw(0,$rp)); &FR($r00);
50
51 &mov("zero",$R);
52 &mul($a[1],$b[0],($r03)=&NR(1));
53
54 &mov("zero",$H1);
55 &mov("zero",$H0);
56 &add($R,$r01,$R);
57 &muh($a[0],$b[1],($r04)=&NR(1));
58 &cmpult($R,$r01,($t01)=&NR(1)); &FR($r01);
59 &add($R,$r02,$R);
60 &add($H1,$t01,$H1) &FR($t01);
61 &muh($a[1],$b[0],($r05)=&NR(1));
62 &cmpult($R,$r02,($t02)=&NR(1)); &FR($r02);
63 &add($R,$r03,$R);
64 &add($H2,$t02,$H2) &FR($t02);
65 &mul($a[0],$b[2],($r06)=&NR(1));
66 &cmpult($R,$r03,($t03)=&NR(1)); &FR($r03);
67 &add($H1,$t03,$H1) &FR($t03);
68 &st($R,&QWPw(1,$rp));
69 &add($H1,$H2,$R);
70
71 &mov("zero",$H1);
72 &add($R,$r04,$R);
73 &mov("zero",$H2);
74 &mul($a[1],$b[1],($r07)=&NR(1));
75 &cmpult($R,$r04,($t04)=&NR(1)); &FR($r04);
76 &add($R,$r05,$R);
77 &add($H1,$t04,$H1) &FR($t04);
78 &mul($a[2],$b[0],($r08)=&NR(1));
79 &cmpult($R,$r05,($t05)=&NR(1)); &FR($r05);
80 &add($R,$r01,$R);
81 &add($H2,$t05,$H2) &FR($t05);
82 &muh($a[0],$b[2],($r09)=&NR(1));
83 &cmpult($R,$r06,($t06)=&NR(1)); &FR($r06);
84 &add($R,$r07,$R);
85 &add($H1,$t06,$H1) &FR($t06);
86 &muh($a[1],$b[1],($r10)=&NR(1));
87 &cmpult($R,$r07,($t07)=&NR(1)); &FR($r07);
88 &add($R,$r08,$R);
89 &add($H2,$t07,$H2) &FR($t07);
90 &muh($a[2],$b[0],($r11)=&NR(1));
91 &cmpult($R,$r08,($t08)=&NR(1)); &FR($r08);
92 &add($H1,$t08,$H1) &FR($t08);
93 &st($R,&QWPw(2,$rp));
94 &add($H1,$H2,$R);
95
96 &mov("zero",$H1);
97 &add($R,$r09,$R);
98 &mov("zero",$H2);
99 &mul($a[0],$b[3],($r12)=&NR(1));
100 &cmpult($R,$r09,($t09)=&NR(1)); &FR($r09);
101 &add($R,$r10,$R);
102 &add($H1,$t09,$H1) &FR($t09);
103 &mul($a[1],$b[2],($r13)=&NR(1));
104 &cmpult($R,$r10,($t10)=&NR(1)); &FR($r10);
105 &add($R,$r11,$R);
106 &add($H1,$t10,$H1) &FR($t10);
107 &mul($a[2],$b[1],($r14)=&NR(1));
108 &cmpult($R,$r11,($t11)=&NR(1)); &FR($r11);
109 &add($R,$r12,$R);
110 &add($H1,$t11,$H1) &FR($t11);
111 &mul($a[3],$b[0],($r15)=&NR(1));
112 &cmpult($R,$r12,($t12)=&NR(1)); &FR($r12);
113 &add($R,$r13,$R);
114 &add($H1,$t12,$H1) &FR($t12);
115 &muh($a[0],$b[3],($r16)=&NR(1));
116 &cmpult($R,$r13,($t13)=&NR(1)); &FR($r13);
117 &add($R,$r14,$R);
118 &add($H1,$t13,$H1) &FR($t13);
119 &muh($a[1],$b[2],($r17)=&NR(1));
120 &cmpult($R,$r14,($t14)=&NR(1)); &FR($r14);
121 &add($R,$r15,$R);
122 &add($H1,$t14,$H1) &FR($t14);
123 &muh($a[2],$b[1],($r18)=&NR(1));
124 &cmpult($R,$r15,($t15)=&NR(1)); &FR($r15);
125 &add($H1,$t15,$H1) &FR($t15);
126 &st($R,&QWPw(3,$rp));
127 &add($H1,$H2,$R);
128
129 &mov("zero",$H1);
130 &add($R,$r16,$R);
131 &mov("zero",$H2);
132 &muh($a[3],$b[0],($r19)=&NR(1));
133 &cmpult($R,$r16,($t16)=&NR(1)); &FR($r16);
134 &add($R,$r17,$R);
135 &add($H1,$t16,$H1) &FR($t16);
136 &mul($a[1],$b[3],($r20)=&NR(1));
137 &cmpult($R,$r17,($t17)=&NR(1)); &FR($r17);
138 &add($R,$r18,$R);
139 &add($H1,$t17,$H1) &FR($t17);
140 &mul($a[2],$b[2],($r21)=&NR(1));
141 &cmpult($R,$r18,($t18)=&NR(1)); &FR($r18);
142 &add($R,$r19,$R);
143 &add($H1,$t18,$H1) &FR($t18);
144 &mul($a[3],$b[1],($r22)=&NR(1));
145 &cmpult($R,$r19,($t19)=&NR(1)); &FR($r19);
146 &add($R,$r20,$R);
147 &add($H1,$t19,$H1) &FR($t19);
148 &muh($a[1],$b[3],($r23)=&NR(1));
149 &cmpult($R,$r20,($t20)=&NR(1)); &FR($r20);
150 &add($R,$r21,$R);
151 &add($H1,$t20,$H1) &FR($t20);
152 &muh($a[2],$b[2],($r24)=&NR(1));
153 &cmpult($R,$r21,($t21)=&NR(1)); &FR($r21);
154 &add($R,$r22,$R);
155 &add($H1,$t21,$H1) &FR($t21);
156 &muh($a[3],$b[1],($r25)=&NR(1));
157 &cmpult($R,$r22,($t22)=&NR(1)); &FR($r22);
158 &add($H1,$t22,$H1) &FR($t22);
159 &st($R,&QWPw(4,$rp));
160 &add($H1,$H2,$R);
161
162 &mov("zero",$H1);
163 &add($R,$r23,$R);
164 &mov("zero",$H2);
165 &mul($a[2],$b[3],($r26)=&NR(1));
166 &cmpult($R,$r23,($t23)=&NR(1)); &FR($r23);
167 &add($R,$r24,$R);
168 &add($H1,$t23,$H1) &FR($t23);
169 &mul($a[3],$b[2],($r27)=&NR(1));
170 &cmpult($R,$r24,($t24)=&NR(1)); &FR($r24);
171 &add($R,$r25,$R);
172 &add($H1,$t24,$H1) &FR($t24);
173 &muh($a[2],$b[3],($r28)=&NR(1));
174 &cmpult($R,$r25,($t25)=&NR(1)); &FR($r25);
175 &add($R,$r26,$R);
176 &add($H1,$t25,$H1) &FR($t25);
177 &muh($a[3],$b[2],($r29)=&NR(1));
178 &cmpult($R,$r26,($t26)=&NR(1)); &FR($r26);
179 &add($R,$r27,$R);
180 &add($H1,$t26,$H1) &FR($t26);
181 &mul($a[3],$b[3],($r30)=&NR(1));
182 &cmpult($R,$r27,($t27)=&NR(1)); &FR($r27);
183 &add($H1,$t27,$H1) &FR($t27);
184 &st($R,&QWPw(5,$rp));
185 &add($H1,$H2,$R);
186
187 &mov("zero",$H1);
188 &add($R,$r28,$R);
189 &mov("zero",$H2);
190 &muh($a[3],$b[3],($r31)=&NR(1));
191 &cmpult($R,$r28,($t28)=&NR(1)); &FR($r28);
192 &add($R,$r29,$R);
193 &add($H1,$t28,$H1) &FR($t28);
194 ############
195 &cmpult($R,$r29,($t29)=&NR(1)); &FR($r29);
196 &add($R,$r30,$R);
197 &add($H1,$t29,$H1) &FR($t29);
198 ############
199 &cmpult($R,$r30,($t30)=&NR(1)); &FR($r30);
200 &add($H1,$t30,$H1) &FR($t30);
201 &st($R,&QWPw(6,$rp));
202 &add($H1,$H2,$R);
203
204 &add($R,$r31,$R); &FR($r31);
205 &st($R,&QWPw(7,$rp));
206
207 &FR($R,$H1,$H2);
208 &function_end($name);
209
210 &fin_pool;
211 }
212
2131;
diff --git a/src/lib/libcrypto/bn/asm/alpha.works/mul_c4.works.pl b/src/lib/libcrypto/bn/asm/alpha.works/mul_c4.works.pl
new file mode 100644
index 0000000000..79d86dd25c
--- /dev/null
+++ b/src/lib/libcrypto/bn/asm/alpha.works/mul_c4.works.pl
@@ -0,0 +1,98 @@
1#!/usr/local/bin/perl
2# alpha assember
3
4sub mul_add_c
5 {
6 local($a,$b,$c0,$c1,$c2)=@_;
7 local($l1,$h1,$t1,$t2);
8
9print STDERR "count=$cnt\n"; $cnt++;
10 &mul($a,$b,($l1)=&NR(1));
11 &muh($a,$b,($h1)=&NR(1));
12 &add($c0,$l1,$c0);
13 &cmpult($c0,$l1,($t1)=&NR(1)); &FR($l1);
14 &add($t1,$h1,$h1); &FR($t1);
15 &add($c1,$h1,$c1);
16 &cmpult($c1,$h1,($t2)=&NR(1)); &FR($h1);
17 &add($c2,$t2,$c2); &FR($t2);
18 }
19
20sub bn_mul_comba4
21 {
22 local($name)=@_;
23 local(@a,@b,$r,$c0,$c1,$c2);
24
25 $cnt=1;
26 &init_pool(3);
27
28 $rp=&wparam(0);
29 $ap=&wparam(1);
30 $bp=&wparam(2);
31
32 &function_begin($name,"");
33
34 &comment("");
35
36 &ld(($a[0])=&NR(1),&QWPw(0,$ap));
37 &ld(($b[0])=&NR(1),&QWPw(0,$bp));
38 &ld(($a[1])=&NR(1),&QWPw(1,$ap));
39 &ld(($b[1])=&NR(1),&QWPw(1,$bp));
40 &ld(($a[2])=&NR(1),&QWPw(2,$ap));
41 &ld(($b[2])=&NR(1),&QWPw(2,$bp));
42 &ld(($a[3])=&NR(1),&QWPw(3,$ap)); &FR($ap);
43 &ld(($b[3])=&NR(1),&QWPw(3,$bp)); &FR($bp);
44
45 ($c0,$c1,$c2)=&NR(3);
46 &mov("zero",$c2);
47 &mul($a[0],$b[0],$c0);
48 &muh($a[0],$b[0],$c1);
49 &st($c0,&QWPw(0,$rp)); &FR($c0); ($c0)=&NR($c0);
50 ($c0,$c1,$c2)=($c1,$c2,$c0);
51 &mov("zero",$c2);
52
53 &mul_add_c($a[0],$b[1],$c0,$c1,$c2);
54 &mul_add_c($a[1],$b[0],$c0,$c1,$c2);
55 &st($c0,&QWPw(1,$rp)); &FR($c0); ($c0)=&NR($c0);
56 ($c0,$c1,$c2)=($c1,$c2,$c0);
57 &mov("zero",$c2);
58
59 &mul_add_c($a[1],$b[1],$c0,$c1,$c2);
60 &mul_add_c($a[0],$b[2],$c0,$c1,$c2);
61 &mul_add_c($a[2],$b[0],$c0,$c1,$c2);
62 &st($c0,&QWPw(2,$rp)); &FR($c0); ($c0)=&NR($c0);
63 ($c0,$c1,$c2)=($c1,$c2,$c0);
64 &mov("zero",$c2);
65
66 &mul_add_c($a[0],$b[3],$c0,$c1,$c2); &FR($a[0]);
67 &mul_add_c($a[1],$b[2],$c0,$c1,$c2);
68 &mul_add_c($a[2],$b[1],$c0,$c1,$c2);
69 &mul_add_c($a[3],$b[0],$c0,$c1,$c2); &FR($b[0]);
70 &st($c0,&QWPw(3,$rp)); &FR($c0); ($c0)=&NR($c0);
71 ($c0,$c1,$c2)=($c1,$c2,$c0);
72 &mov("zero",$c2);
73
74 &mul_add_c($a[1],$b[3],$c0,$c1,$c2); &FR($a[1]);
75 &mul_add_c($a[2],$b[2],$c0,$c1,$c2);
76 &mul_add_c($a[3],$b[1],$c0,$c1,$c2); &FR($b[1]);
77 &st($c0,&QWPw(4,$rp)); &FR($c0); ($c0)=&NR($c0);
78 ($c0,$c1,$c2)=($c1,$c2,$c0);
79 &mov("zero",$c2);
80
81 &mul_add_c($a[2],$b[3],$c0,$c1,$c2); &FR($a[2]);
82 &mul_add_c($a[3],$b[2],$c0,$c1,$c2); &FR($b[2]);
83 &st($c0,&QWPw(5,$rp)); &FR($c0); ($c0)=&NR($c0);
84 ($c0,$c1,$c2)=($c1,$c2,$c0);
85 &mov("zero",$c2);
86
87 &mul_add_c($a[3],$b[3],$c0,$c1,$c2); &FR($a[3],$b[3]);
88 &st($c0,&QWPw(6,$rp));
89 &st($c1,&QWPw(7,$rp));
90
91 &FR($c0,$c1,$c2);
92
93 &function_end($name);
94
95 &fin_pool;
96 }
97
981;
diff --git a/src/lib/libcrypto/bn/asm/alpha.works/mul_c8.pl b/src/lib/libcrypto/bn/asm/alpha.works/mul_c8.pl
new file mode 100644
index 0000000000..525ca7494b
--- /dev/null
+++ b/src/lib/libcrypto/bn/asm/alpha.works/mul_c8.pl
@@ -0,0 +1,177 @@
1#!/usr/local/bin/perl
2# alpha assember
3
4sub bn_mul_comba8
5 {
6 local($name)=@_;
7 local(@a,@b,$r,$c0,$c1,$c2);
8
9 $cnt=1;
10 &init_pool(3);
11
12 $rp=&wparam(0);
13 $ap=&wparam(1);
14 $bp=&wparam(2);
15
16 &function_begin($name,"");
17
18 &comment("");
19
20 &stack_push(2);
21 &ld(($a[0])=&NR(1),&QWPw(0,$ap));
22 &ld(($b[0])=&NR(1),&QWPw(0,$bp));
23 &st($reg_s0,&swtmp(0)); &FR($reg_s0);
24 &st($reg_s1,&swtmp(1)); &FR($reg_s1);
25 &ld(($a[1])=&NR(1),&QWPw(1,$ap));
26 &ld(($b[1])=&NR(1),&QWPw(1,$bp));
27 &ld(($a[2])=&NR(1),&QWPw(2,$ap));
28 &ld(($b[2])=&NR(1),&QWPw(2,$bp));
29 &ld(($a[3])=&NR(1),&QWPw(3,$ap));
30 &ld(($b[3])=&NR(1),&QWPw(3,$bp));
31 &ld(($a[4])=&NR(1),&QWPw(1,$ap));
32 &ld(($b[4])=&NR(1),&QWPw(1,$bp));
33 &ld(($a[5])=&NR(1),&QWPw(1,$ap));
34 &ld(($b[5])=&NR(1),&QWPw(1,$bp));
35 &ld(($a[6])=&NR(1),&QWPw(1,$ap));
36 &ld(($b[6])=&NR(1),&QWPw(1,$bp));
37 &ld(($a[7])=&NR(1),&QWPw(1,$ap)); &FR($ap);
38 &ld(($b[7])=&NR(1),&QWPw(1,$bp)); &FR($bp);
39
40 ($c0,$c1,$c2)=&NR(3);
41 &mov("zero",$c2);
42 &mul($a[0],$b[0],$c0);
43 &muh($a[0],$b[0],$c1);
44 &st($c0,&QWPw(0,$rp)); &FR($c0); ($c0)=&NR(1);
45 ($c0,$c1,$c2)=($c1,$c2,$c0);
46 &mov("zero",$c2);
47
48 &mul_add_c($a[0],$b[1],$c0,$c1,$c2);
49 &mul_add_c($a[1],$b[0],$c0,$c1,$c2);
50 &st($c0,&QWPw(1,$rp)); &FR($c0); ($c0)=&NR(1);
51 ($c0,$c1,$c2)=($c1,$c2,$c0);
52 &mov("zero",$c2);
53
54 &mul_add_c($a[0],$b[2],$c0,$c1,$c2);
55 &mul_add_c($a[1],$b[1],$c0,$c1,$c2);
56 &mul_add_c($a[2],$b[0],$c0,$c1,$c2);
57 &st($c0,&QWPw(2,$rp)); &FR($c0); ($c0)=&NR(1);
58 ($c0,$c1,$c2)=($c1,$c2,$c0);
59 &mov("zero",$c2);
60
61 &mul_add_c($a[0],$b[3],$c0,$c1,$c2);
62 &mul_add_c($a[1],$b[2],$c0,$c1,$c2);
63 &mul_add_c($a[2],$b[1],$c0,$c1,$c2);
64 &mul_add_c($a[3],$b[0],$c0,$c1,$c2);
65 &st($c0,&QWPw(3,$rp)); &FR($c0); ($c0)=&NR(1);
66 ($c0,$c1,$c2)=($c1,$c2,$c0);
67 &mov("zero",$c2);
68
69 &mul_add_c($a[0],$b[4],$c0,$c1,$c2);
70 &mul_add_c($a[1],$b[3],$c0,$c1,$c2);
71 &mul_add_c($a[2],$b[2],$c0,$c1,$c2);
72 &mul_add_c($a[3],$b[1],$c0,$c1,$c2);
73 &mul_add_c($a[4],$b[0],$c0,$c1,$c2);
74 &st($c0,&QWPw(4,$rp)); &FR($c0); ($c0)=&NR(1);
75 ($c0,$c1,$c2)=($c1,$c2,$c0);
76 &mov("zero",$c2);
77
78 &mul_add_c($a[0],$b[5],$c0,$c1,$c2);
79 &mul_add_c($a[1],$b[4],$c0,$c1,$c2);
80 &mul_add_c($a[2],$b[3],$c0,$c1,$c2);
81 &mul_add_c($a[3],$b[2],$c0,$c1,$c2);
82 &mul_add_c($a[4],$b[1],$c0,$c1,$c2);
83 &mul_add_c($a[5],$b[0],$c0,$c1,$c2);
84 &st($c0,&QWPw(5,$rp)); &FR($c0); ($c0)=&NR(1);
85 ($c0,$c1,$c2)=($c1,$c2,$c0);
86 &mov("zero",$c2);
87
88 &mul_add_c($a[0],$b[6],$c0,$c1,$c2);
89 &mul_add_c($a[1],$b[5],$c0,$c1,$c2);
90 &mul_add_c($a[2],$b[4],$c0,$c1,$c2);
91 &mul_add_c($a[3],$b[3],$c0,$c1,$c2);
92 &mul_add_c($a[4],$b[2],$c0,$c1,$c2);
93 &mul_add_c($a[5],$b[1],$c0,$c1,$c2);
94 &mul_add_c($a[6],$b[0],$c0,$c1,$c2);
95 &st($c0,&QWPw(6,$rp)); &FR($c0); ($c0)=&NR(1);
96 ($c0,$c1,$c2)=($c1,$c2,$c0);
97 &mov("zero",$c2);
98
99 &mul_add_c($a[0],$b[7],$c0,$c1,$c2); &FR($a[0]);
100 &mul_add_c($a[1],$b[6],$c0,$c1,$c2);
101 &mul_add_c($a[2],$b[5],$c0,$c1,$c2);
102 &mul_add_c($a[3],$b[4],$c0,$c1,$c2);
103 &mul_add_c($a[4],$b[3],$c0,$c1,$c2);
104 &mul_add_c($a[5],$b[2],$c0,$c1,$c2);
105 &mul_add_c($a[6],$b[1],$c0,$c1,$c2);
106 &mul_add_c($a[7],$b[0],$c0,$c1,$c2); &FR($b[0]);
107 &st($c0,&QWPw(7,$rp)); &FR($c0); ($c0)=&NR(1);
108 ($c0,$c1,$c2)=($c1,$c2,$c0);
109 &mov("zero",$c2);
110
111 &mul_add_c($a[1],$b[7],$c0,$c1,$c2); &FR($a[1]);
112 &mul_add_c($a[2],$b[6],$c0,$c1,$c2);
113 &mul_add_c($a[3],$b[5],$c0,$c1,$c2);
114 &mul_add_c($a[4],$b[4],$c0,$c1,$c2);
115 &mul_add_c($a[5],$b[3],$c0,$c1,$c2);
116 &mul_add_c($a[6],$b[2],$c0,$c1,$c2);
117 &mul_add_c($a[7],$b[1],$c0,$c1,$c2); &FR($b[1]);
118 &st($c0,&QWPw(8,$rp)); &FR($c0); ($c0)=&NR(1);
119 ($c0,$c1,$c2)=($c1,$c2,$c0);
120 &mov("zero",$c2);
121
122 &mul_add_c($a[2],$b[7],$c0,$c1,$c2); &FR($a[2]);
123 &mul_add_c($a[3],$b[6],$c0,$c1,$c2);
124 &mul_add_c($a[4],$b[5],$c0,$c1,$c2);
125 &mul_add_c($a[5],$b[4],$c0,$c1,$c2);
126 &mul_add_c($a[6],$b[3],$c0,$c1,$c2);
127 &mul_add_c($a[7],$b[2],$c0,$c1,$c2); &FR($b[2]);
128 &st($c0,&QWPw(9,$rp)); &FR($c0); ($c0)=&NR(1);
129 ($c0,$c1,$c2)=($c1,$c2,$c0);
130 &mov("zero",$c2);
131
132 &mul_add_c($a[3],$b[7],$c0,$c1,$c2); &FR($a[3]);
133 &mul_add_c($a[4],$b[6],$c0,$c1,$c2);
134 &mul_add_c($a[5],$b[5],$c0,$c1,$c2);
135 &mul_add_c($a[6],$b[4],$c0,$c1,$c2);
136 &mul_add_c($a[7],$b[3],$c0,$c1,$c2); &FR($b[3]);
137 &st($c0,&QWPw(10,$rp)); &FR($c0); ($c0)=&NR(1);
138 ($c0,$c1,$c2)=($c1,$c2,$c0);
139 &mov("zero",$c2);
140
141 &mul_add_c($a[4],$b[7],$c0,$c1,$c2); &FR($a[4]);
142 &mul_add_c($a[5],$b[6],$c0,$c1,$c2);
143 &mul_add_c($a[6],$b[5],$c0,$c1,$c2);
144 &mul_add_c($a[7],$b[4],$c0,$c1,$c2); &FR($b[4]);
145 &st($c0,&QWPw(11,$rp)); &FR($c0); ($c0)=&NR(1);
146 ($c0,$c1,$c2)=($c1,$c2,$c0);
147 &mov("zero",$c2);
148
149 &mul_add_c($a[5],$b[7],$c0,$c1,$c2); &FR($a[5]);
150 &mul_add_c($a[6],$b[6],$c0,$c1,$c2);
151 &mul_add_c($a[7],$b[5],$c0,$c1,$c2); &FR($b[5]);
152 &st($c0,&QWPw(12,$rp)); &FR($c0); ($c0)=&NR(1);
153 ($c0,$c1,$c2)=($c1,$c2,$c0);
154 &mov("zero",$c2);
155
156 &mul_add_c($a[6],$b[7],$c0,$c1,$c2); &FR($a[6]);
157 &mul_add_c($a[7],$b[6],$c0,$c1,$c2); &FR($b[6]);
158 &st($c0,&QWPw(13,$rp)); &FR($c0); ($c0)=&NR(1);
159 ($c0,$c1,$c2)=($c1,$c2,$c0);
160 &mov("zero",$c2);
161
162 &mul_add_c($a[7],$b[7],$c0,$c1,$c2); &FR($a[7],$b[7]);
163 &st($c0,&QWPw(14,$rp));
164 &st($c1,&QWPw(15,$rp));
165
166 &FR($c0,$c1,$c2);
167
168 &ld($reg_s0,&swtmp(0));
169 &ld($reg_s1,&swtmp(1));
170 &stack_pop(2);
171
172 &function_end($name);
173
174 &fin_pool;
175 }
176
1771;
diff --git a/src/lib/libcrypto/bn/asm/alpha.works/sqr.pl b/src/lib/libcrypto/bn/asm/alpha.works/sqr.pl
new file mode 100644
index 0000000000..a55b696906
--- /dev/null
+++ b/src/lib/libcrypto/bn/asm/alpha.works/sqr.pl
@@ -0,0 +1,113 @@
1#!/usr/local/bin/perl
2# alpha assember
3
4sub bn_sqr_words
5 {
6 local($name)=@_;
7 local($cc,$a,$b,$r,$couny);
8
9 &init_pool(3);
10 ($cc)=GR("r0");
11
12 $rp=&wparam(0);
13 $ap=&wparam(1);
14 $count=&wparam(2);
15
16 &function_begin($name,"");
17
18 &comment("");
19 &sub($count,4,$count);
20 &mov("zero",$cc);
21 &br(&label("finish"));
22 &blt($count,&label("finish"));
23
24 ($a0,$r0)=&NR(2);
25 &ld($a0,&QWPw(0,$ap));
26 &ld($r0,&QWPw(0,$rp));
27
28$a=<<'EOF';
29##########################################################
30 &set_label("loop");
31
32 ($a1)=&NR(1); &ld($a1,&QWPw(1,$ap));
33 ($b1)=&NR(1); &ld($b1,&QWPw(1,$bp));
34 ($a2)=&NR(1); &ld($a2,&QWPw(2,$ap));
35 ($b2)=&NR(1); &ld($b2,&QWPw(2,$bp));
36 ($a3)=&NR(1); &ld($a3,&QWPw(3,$ap));
37 ($b3)=&NR(1); &ld($b3,&QWPw(3,$bp));
38
39 ($o0,$t0)=&NR(2);
40 &add($a0,$b0,$o0);
41 &cmpult($o0,$b0,$t0);
42 &add($o0,$cc,$o0);
43 &cmpult($o0,$cc,$cc);
44 &add($cc,$t0,$cc); &FR($t0);
45
46 ($t1,$o1)=&NR(2);
47
48 &add($a1,$b1,$o1); &FR($a1);
49 &cmpult($o1,$b1,$t1); &FR($b1);
50 &add($o1,$cc,$o1);
51 &cmpult($o1,$cc,$cc);
52 &add($cc,$t1,$cc); &FR($t1);
53
54 ($t2,$o2)=&NR(2);
55
56 &add($a2,$b2,$o2); &FR($a2);
57 &cmpult($o2,$b2,$t2); &FR($b2);
58 &add($o2,$cc,$o2);
59 &cmpult($o2,$cc,$cc);
60 &add($cc,$t2,$cc); &FR($t2);
61
62 ($t3,$o3)=&NR(2);
63
64 &add($a3,$b3,$o3); &FR($a3);
65 &cmpult($o3,$b3,$t3); &FR($b3);
66 &add($o3,$cc,$o3);
67 &cmpult($o3,$cc,$cc);
68 &add($cc,$t3,$cc); &FR($t3);
69
70 &st($o0,&QWPw(0,$rp)); &FR($o0);
71 &st($o1,&QWPw(0,$rp)); &FR($o1);
72 &st($o2,&QWPw(0,$rp)); &FR($o2);
73 &st($o3,&QWPw(0,$rp)); &FR($o3);
74
75 &sub($count,4,$count); # count-=4
76 &add($ap,4*$QWS,$ap); # count+=4
77 &add($bp,4*$QWS,$bp); # count+=4
78 &add($rp,4*$QWS,$rp); # count+=4
79
80 &blt($count,&label("finish"));
81 &ld($a0,&QWPw(0,$ap));
82 &ld($b0,&QWPw(0,$bp));
83 &br(&label("loop"));
84EOF
85##################################################
86 # Do the last 0..3 words
87
88 &set_label("last_loop");
89
90 &ld(($a0)=&NR(1),&QWPw(0,$ap)); # get a
91 &mul($a0,$a0,($l0)=&NR(1));
92 &add($ap,$QWS,$ap);
93 &add($rp,2*$QWS,$rp);
94 &sub($count,1,$count);
95 &muh($a0,$a0,($h0)=&NR(1)); &FR($a0);
96 &st($l0,&QWPw(-2,$rp)); &FR($l0);
97 &st($h0,&QWPw(-1,$rp)); &FR($h0);
98
99 &bgt($count,&label("last_loop"));
100 &function_end_A($name);
101
102######################################################
103 &set_label("finish");
104 &add($count,4,$count);
105 &bgt($count,&label("last_loop"));
106
107 &set_label("end");
108 &function_end($name);
109
110 &fin_pool;
111 }
112
1131;
diff --git a/src/lib/libcrypto/bn/asm/alpha.works/sqr_c4.pl b/src/lib/libcrypto/bn/asm/alpha.works/sqr_c4.pl
new file mode 100644
index 0000000000..bf33f5b503
--- /dev/null
+++ b/src/lib/libcrypto/bn/asm/alpha.works/sqr_c4.pl
@@ -0,0 +1,109 @@
1#!/usr/local/bin/perl
2# alpha assember
3
4sub sqr_add_c
5 {
6 local($a,$c0,$c1,$c2)=@_;
7 local($l1,$h1,$t1,$t2);
8
9 &mul($a,$a,($l1)=&NR(1));
10 &muh($a,$a,($h1)=&NR(1));
11 &add($c0,$l1,$c0);
12 &add($c1,$h1,$c1);
13 &cmpult($c0,$l1,($t1)=&NR(1)); &FR($l1);
14 &cmpult($c1,$h1,($t2)=&NR(1)); &FR($h1);
15 &add($c1,$t1,$c1); &FR($t1);
16 &add($c2,$t2,$c2); &FR($t2);
17 }
18
19sub sqr_add_c2
20 {
21 local($a,$b,$c0,$c1,$c2)=@_;
22 local($l1,$h1,$t1,$t2);
23
24 &mul($a,$b,($l1)=&NR(1));
25 &muh($a,$b,($h1)=&NR(1));
26 &cmplt($l1,"zero",($lc1)=&NR(1));
27 &cmplt($h1,"zero",($hc1)=&NR(1));
28 &add($l1,$l1,$l1);
29 &add($h1,$h1,$h1);
30 &add($h1,$lc1,$h1); &FR($lc1);
31 &add($c2,$hc1,$c2); &FR($hc1);
32
33 &add($c0,$l1,$c0);
34 &add($c1,$h1,$c1);
35 &cmpult($c0,$l1,($lc1)=&NR(1)); &FR($l1);
36 &cmpult($c1,$h1,($hc1)=&NR(1)); &FR($h1);
37
38 &add($c1,$lc1,$c1); &FR($lc1);
39 &add($c2,$hc1,$c2); &FR($hc1);
40 }
41
42
43sub bn_sqr_comba4
44 {
45 local($name)=@_;
46 local(@a,@b,$r,$c0,$c1,$c2);
47
48 $cnt=1;
49 &init_pool(2);
50
51 $rp=&wparam(0);
52 $ap=&wparam(1);
53
54 &function_begin($name,"");
55
56 &comment("");
57
58 &ld(($a[0])=&NR(1),&QWPw(0,$ap));
59 &ld(($a[1])=&NR(1),&QWPw(1,$ap));
60 &ld(($a[2])=&NR(1),&QWPw(2,$ap));
61 &ld(($a[3])=&NR(1),&QWPw(3,$ap)); &FR($ap);
62
63 ($c0,$c1,$c2)=&NR(3);
64
65 &mov("zero",$c2);
66 &mul($a[0],$a[0],$c0);
67 &muh($a[0],$a[0],$c1);
68 &st($c0,&QWPw(0,$rp));
69 ($c0,$c1,$c2)=($c1,$c2,$c0);
70 &mov("zero",$c2);
71
72 &sqr_add_c2($a[0],$a[1],$c0,$c1,$c2);
73 &st($c0,&QWPw(1,$rp));
74 ($c0,$c1,$c2)=($c1,$c2,$c0);
75 &mov("zero",$c2);
76
77 &sqr_add_c($a[1],$c0,$c1,$c2);
78 &sqr_add_c2($a[2],$a[0],$c0,$c1,$c2);
79 &st($c0,&QWPw(2,$rp));
80 ($c0,$c1,$c2)=($c1,$c2,$c0);
81 &mov("zero",$c2);
82
83 &sqr_add_c2($a[3],$a[0],$c0,$c1,$c2);
84 &sqr_add_c2($a[2],$a[1],$c0,$c1,$c2);
85 &st($c0,&QWPw(3,$rp));
86 ($c0,$c1,$c2)=($c1,$c2,$c0);
87 &mov("zero",$c2);
88
89 &sqr_add_c($a[2],$c0,$c1,$c2);
90 &sqr_add_c2($a[3],$a[1],$c0,$c1,$c2);
91 &st($c0,&QWPw(4,$rp));
92 ($c0,$c1,$c2)=($c1,$c2,$c0);
93 &mov("zero",$c2);
94
95 &sqr_add_c2($a[3],$a[2],$c0,$c1,$c2);
96 &st($c0,&QWPw(5,$rp));
97 ($c0,$c1,$c2)=($c1,$c2,$c0);
98 &mov("zero",$c2);
99
100 &sqr_add_c($a[3],$c0,$c1,$c2);
101 &st($c0,&QWPw(6,$rp));
102 &st($c1,&QWPw(7,$rp));
103
104 &function_end($name);
105
106 &fin_pool;
107 }
108
1091;
diff --git a/src/lib/libcrypto/bn/asm/alpha.works/sqr_c8.pl b/src/lib/libcrypto/bn/asm/alpha.works/sqr_c8.pl
new file mode 100644
index 0000000000..b4afe085f1
--- /dev/null
+++ b/src/lib/libcrypto/bn/asm/alpha.works/sqr_c8.pl
@@ -0,0 +1,132 @@
1#!/usr/local/bin/perl
2# alpha assember
3
4sub bn_sqr_comba8
5 {
6 local($name)=@_;
7 local(@a,@b,$r,$c0,$c1,$c2);
8
9 $cnt=1;
10 &init_pool(2);
11
12 $rp=&wparam(0);
13 $ap=&wparam(1);
14
15 &function_begin($name,"");
16
17 &comment("");
18
19 &ld(($a[0])=&NR(1),&QWPw(0,$ap));
20 &ld(($a[1])=&NR(1),&QWPw(1,$ap));
21 &ld(($a[2])=&NR(1),&QWPw(2,$ap));
22 &ld(($a[3])=&NR(1),&QWPw(3,$ap));
23 &ld(($a[4])=&NR(1),&QWPw(4,$ap));
24 &ld(($a[5])=&NR(1),&QWPw(5,$ap));
25 &ld(($a[6])=&NR(1),&QWPw(6,$ap));
26 &ld(($a[7])=&NR(1),&QWPw(7,$ap)); &FR($ap);
27
28 ($c0,$c1,$c2)=&NR(3);
29
30 &mov("zero",$c2);
31 &mul($a[0],$a[0],$c0);
32 &muh($a[0],$a[0],$c1);
33 &st($c0,&QWPw(0,$rp));
34 ($c0,$c1,$c2)=($c1,$c2,$c0);
35 &mov("zero",$c2);
36
37 &sqr_add_c2($a[1],$a[0],$c0,$c1,$c2);
38 &st($c0,&QWPw(1,$rp));
39 ($c0,$c1,$c2)=($c1,$c2,$c0);
40 &mov("zero",$c2);
41
42 &sqr_add_c($a[1],$c0,$c1,$c2);
43 &sqr_add_c2($a[2],$a[0],$c0,$c1,$c2);
44 &st($c0,&QWPw(2,$rp));
45 ($c0,$c1,$c2)=($c1,$c2,$c0);
46 &mov("zero",$c2);
47
48 &sqr_add_c2($a[2],$a[1],$c0,$c1,$c2);
49 &sqr_add_c2($a[3],$a[0],$c0,$c1,$c2);
50 &st($c0,&QWPw(3,$rp));
51 ($c0,$c1,$c2)=($c1,$c2,$c0);
52 &mov("zero",$c2);
53
54 &sqr_add_c($a[2],$c0,$c1,$c2);
55 &sqr_add_c2($a[3],$a[1],$c0,$c1,$c2);
56 &sqr_add_c2($a[4],$a[0],$c0,$c1,$c2);
57 &st($c0,&QWPw(4,$rp));
58 ($c0,$c1,$c2)=($c1,$c2,$c0);
59 &mov("zero",$c2);
60
61 &sqr_add_c2($a[3],$a[2],$c0,$c1,$c2);
62 &sqr_add_c2($a[4],$a[1],$c0,$c1,$c2);
63 &sqr_add_c2($a[5],$a[0],$c0,$c1,$c2);
64 &st($c0,&QWPw(5,$rp));
65 ($c0,$c1,$c2)=($c1,$c2,$c0);
66 &mov("zero",$c2);
67
68 &sqr_add_c($a[3],$c0,$c1,$c2);
69 &sqr_add_c2($a[4],$a[2],$c0,$c1,$c2);
70 &sqr_add_c2($a[5],$a[1],$c0,$c1,$c2);
71 &sqr_add_c2($a[6],$a[0],$c0,$c1,$c2);
72 &st($c0,&QWPw(6,$rp));
73 ($c0,$c1,$c2)=($c1,$c2,$c0);
74 &mov("zero",$c2);
75
76 &sqr_add_c2($a[4],$a[3],$c0,$c1,$c2);
77 &sqr_add_c2($a[5],$a[2],$c0,$c1,$c2);
78 &sqr_add_c2($a[6],$a[1],$c0,$c1,$c2);
79 &sqr_add_c2($a[7],$a[0],$c0,$c1,$c2);
80 &st($c0,&QWPw(7,$rp));
81 ($c0,$c1,$c2)=($c1,$c2,$c0);
82 &mov("zero",$c2);
83
84 &sqr_add_c($a[4],$c0,$c1,$c2);
85 &sqr_add_c2($a[5],$a[3],$c0,$c1,$c2);
86 &sqr_add_c2($a[6],$a[2],$c0,$c1,$c2);
87 &sqr_add_c2($a[7],$a[1],$c0,$c1,$c2);
88 &st($c0,&QWPw(8,$rp));
89 ($c0,$c1,$c2)=($c1,$c2,$c0);
90 &mov("zero",$c2);
91
92 &sqr_add_c2($a[5],$a[4],$c0,$c1,$c2);
93 &sqr_add_c2($a[6],$a[3],$c0,$c1,$c2);
94 &sqr_add_c2($a[7],$a[2],$c0,$c1,$c2);
95 &st($c0,&QWPw(9,$rp));
96 ($c0,$c1,$c2)=($c1,$c2,$c0);
97 &mov("zero",$c2);
98
99 &sqr_add_c($a[5],$c0,$c1,$c2);
100 &sqr_add_c2($a[6],$a[4],$c0,$c1,$c2);
101 &sqr_add_c2($a[7],$a[3],$c0,$c1,$c2);
102 &st($c0,&QWPw(10,$rp));
103 ($c0,$c1,$c2)=($c1,$c2,$c0);
104 &mov("zero",$c2);
105
106 &sqr_add_c2($a[6],$a[5],$c0,$c1,$c2);
107 &sqr_add_c2($a[7],$a[4],$c0,$c1,$c2);
108 &st($c0,&QWPw(11,$rp));
109 ($c0,$c1,$c2)=($c1,$c2,$c0);
110 &mov("zero",$c2);
111
112 &sqr_add_c($a[6],$c0,$c1,$c2);
113 &sqr_add_c2($a[7],$a[5],$c0,$c1,$c2);
114 &st($c0,&QWPw(12,$rp));
115 ($c0,$c1,$c2)=($c1,$c2,$c0);
116 &mov("zero",$c2);
117
118 &sqr_add_c2($a[7],$a[6],$c0,$c1,$c2);
119 &st($c0,&QWPw(13,$rp));
120 ($c0,$c1,$c2)=($c1,$c2,$c0);
121 &mov("zero",$c2);
122
123 &sqr_add_c($a[7],$c0,$c1,$c2);
124 &st($c0,&QWPw(14,$rp));
125 &st($c1,&QWPw(15,$rp));
126
127 &function_end($name);
128
129 &fin_pool;
130 }
131
1321;
diff --git a/src/lib/libcrypto/bn/asm/alpha.works/sub.pl b/src/lib/libcrypto/bn/asm/alpha.works/sub.pl
new file mode 100644
index 0000000000..d998da5c21
--- /dev/null
+++ b/src/lib/libcrypto/bn/asm/alpha.works/sub.pl
@@ -0,0 +1,108 @@
1#!/usr/local/bin/perl
2# alpha assember
3
4sub bn_sub_words
5 {
6 local($name)=@_;
7 local($cc,$a,$b,$r);
8
9 &init_pool(4);
10 ($cc)=GR("r0");
11
12 $rp=&wparam(0);
13 $ap=&wparam(1);
14 $bp=&wparam(2);
15 $count=&wparam(3);
16
17 &function_begin($name,"");
18
19 &comment("");
20 &sub($count,4,$count);
21 &mov("zero",$cc);
22 &blt($count,&label("finish"));
23
24 ($a0,$b0)=&NR(2);
25 &ld($a0,&QWPw(0,$ap));
26 &ld($b0,&QWPw(0,$bp));
27
28##########################################################
29 &set_label("loop");
30
31 ($a1,$tmp,$b1,$a2,$b2,$a3,$b3,$o0)=&NR(8);
32 &ld($a1,&QWPw(1,$ap));
33 &cmpult($a0,$b0,$tmp); # will we borrow?
34 &ld($b1,&QWPw(1,$bp));
35 &sub($a0,$b0,$a0); # do the subtract
36 &ld($a2,&QWPw(2,$ap));
37 &cmpult($a0,$cc,$b0); # will we borrow?
38 &ld($b2,&QWPw(2,$bp));
39 &sub($a0,$cc,$o0); # will we borrow?
40 &ld($a3,&QWPw(3,$ap));
41 &add($b0,$tmp,$cc); ($t1,$o1)=&NR(2); &FR($tmp);
42
43 &cmpult($a1,$b1,$t1); # will we borrow?
44 &sub($a1,$b1,$a1); # do the subtract
45 &ld($b3,&QWPw(3,$bp));
46 &cmpult($a1,$cc,$b1); # will we borrow?
47 &sub($a1,$cc,$o1); # will we borrow?
48 &add($b1,$t1,$cc); ($tmp,$o2)=&NR(2); &FR($t1,$a1,$b1);
49
50 &cmpult($a2,$b2,$tmp); # will we borrow?
51 &sub($a2,$b2,$a2); # do the subtract
52 &st($o0,&QWPw(0,$rp)); &FR($o0); # save
53 &cmpult($a2,$cc,$b2); # will we borrow?
54 &sub($a2,$cc,$o2); # will we borrow?
55 &add($b2,$tmp,$cc); ($t3,$o3)=&NR(2); &FR($tmp,$a2,$b2);
56
57 &cmpult($a3,$b3,$t3); # will we borrow?
58 &sub($a3,$b3,$a3); # do the subtract
59 &st($o1,&QWPw(1,$rp)); &FR($o1);
60 &cmpult($a3,$cc,$b3); # will we borrow?
61 &sub($a3,$cc,$o3); # will we borrow?
62 &add($b3,$t3,$cc); &FR($t3,$a3,$b3);
63
64 &st($o2,&QWPw(2,$rp)); &FR($o2);
65 &sub($count,4,$count); # count-=4
66 &st($o3,&QWPw(3,$rp)); &FR($o3);
67 &add($ap,4*$QWS,$ap); # count+=4
68 &add($bp,4*$QWS,$bp); # count+=4
69 &add($rp,4*$QWS,$rp); # count+=4
70
71 &blt($count,&label("finish"));
72 &ld($a0,&QWPw(0,$ap));
73 &ld($b0,&QWPw(0,$bp));
74 &br(&label("loop"));
75##################################################
76 # Do the last 0..3 words
77
78 &set_label("last_loop");
79
80 &ld($a0,&QWPw(0,$ap)); # get a
81 &ld($b0,&QWPw(0,$bp)); # get b
82 &cmpult($a0,$b0,$tmp); # will we borrow?
83 &sub($a0,$b0,$a0); # do the subtract
84 &cmpult($a0,$cc,$b0); # will we borrow?
85 &sub($a0,$cc,$a0); # will we borrow?
86 &st($a0,&QWPw(0,$rp)); # save
87 &add($b0,$tmp,$cc); # add the borrows
88
89 &add($ap,$QWS,$ap);
90 &add($bp,$QWS,$bp);
91 &add($rp,$QWS,$rp);
92 &sub($count,1,$count);
93 &bgt($count,&label("last_loop"));
94 &function_end_A($name);
95
96######################################################
97 &set_label("finish");
98 &add($count,4,$count);
99 &bgt($count,&label("last_loop"));
100
101 &FR($a0,$b0);
102 &set_label("end");
103 &function_end($name);
104
105 &fin_pool;
106 }
107
1081;
diff --git a/src/lib/libcrypto/bn/asm/alpha/add.pl b/src/lib/libcrypto/bn/asm/alpha/add.pl
new file mode 100644
index 0000000000..13bf516428
--- /dev/null
+++ b/src/lib/libcrypto/bn/asm/alpha/add.pl
@@ -0,0 +1,118 @@
1#!/usr/local/bin/perl
2# alpha assember
3
4sub bn_add_words
5 {
6 local($name)=@_;
7 local($cc,$a,$b,$r);
8
9 &init_pool(4);
10 ($cc)=GR("r0");
11
12 $rp=&wparam(0);
13 $ap=&wparam(1);
14 $bp=&wparam(2);
15 $count=&wparam(3);
16
17 &function_begin($name,"");
18
19 &comment("");
20 &sub($count,4,$count);
21 &mov("zero",$cc);
22 &blt($count,&label("finish"));
23
24 ($a0,$b0)=&NR(2);
25
26##########################################################
27 &set_label("loop");
28
29 &ld(($a0)=&NR(1),&QWPw(0,$ap));
30 &ld(($b0)=&NR(1),&QWPw(0,$bp));
31 &ld(($a1)=&NR(1),&QWPw(1,$ap));
32 &ld(($b1)=&NR(1),&QWPw(1,$bp));
33
34 ($o0,$t0)=&NR(2);
35 &add($a0,$b0,$o0);
36 &ld(($a2)=&NR(1),&QWPw(2,$ap));
37 &cmpult($o0,$b0,$t0);
38 &add($o0,$cc,$o0);
39 &cmpult($o0,$cc,$cc);
40 &ld(($b2)=&NR(1),&QWPw(2,$bp));
41 &add($cc,$t0,$cc); &FR($t0);
42
43 ($t1,$o1)=&NR(2);
44
45 &add($a1,$b1,$o1); &FR($a1);
46 &cmpult($o1,$b1,$t1); &FR($b1);
47 &add($o1,$cc,$o1);
48 &cmpult($o1,$cc,$cc);
49 &ld(($a3)=&NR(1),&QWPw(3,$ap));
50 &add($cc,$t1,$cc); &FR($t1);
51
52 ($t2,$o2)=&NR(2);
53
54 &add($a2,$b2,$o2); &FR($a2);
55 &cmpult($o2,$b2,$t2); &FR($b2);
56 &add($o2,$cc,$o2);
57 &cmpult($o2,$cc,$cc);
58 &ld(($b3)=&NR(1),&QWPw(3,$bp));
59 &st($o0,&QWPw(0,$rp)); &FR($o0);
60 &add($cc,$t2,$cc); &FR($t2);
61
62 ($t3,$o3)=&NR(2);
63
64 &st($o1,&QWPw(0,$rp)); &FR($o1);
65 &add($a3,$b3,$o3); &FR($a3);
66 &cmpult($o3,$b3,$t3); &FR($b3);
67 &add($o3,$cc,$o3);
68 &st($o2,&QWPw(0,$rp)); &FR($o2);
69 &cmpult($o3,$cc,$cc);
70 &st($o3,&QWPw(0,$rp)); &FR($o3);
71 &add($cc,$t3,$cc); &FR($t3);
72
73
74 &sub($count,4,$count); # count-=4
75 &add($ap,4*$QWS,$ap); # count+=4
76 &add($bp,4*$QWS,$bp); # count+=4
77 &add($rp,4*$QWS,$rp); # count+=4
78
79 ###
80 &bge($count,&label("loop"));
81 ###
82 &br(&label("finish"));
83##################################################
84 # Do the last 0..3 words
85
86 ($t0,$o0)=&NR(2);
87 &set_label("last_loop");
88
89 &ld($a0,&QWPw(0,$ap)); # get a
90 &ld($b0,&QWPw(0,$bp)); # get b
91 &add($ap,$QWS,$ap);
92 &add($bp,$QWS,$bp);
93 &add($a0,$b0,$o0);
94 &sub($count,1,$count);
95 &cmpult($o0,$b0,$t0); # will we borrow?
96 &add($o0,$cc,$o0); # will we borrow?
97 &cmpult($o0,$cc,$cc); # will we borrow?
98 &add($rp,$QWS,$rp);
99 &st($o0,&QWPw(-1,$rp)); # save
100 &add($cc,$t0,$cc); # add the borrows
101
102 ###
103 &bgt($count,&label("last_loop"));
104 &function_end_A($name);
105
106######################################################
107 &set_label("finish");
108 &add($count,4,$count);
109 &bgt($count,&label("last_loop"));
110
111 &FR($o0,$t0,$a0,$b0);
112 &set_label("end");
113 &function_end($name);
114
115 &fin_pool;
116 }
117
1181;
diff --git a/src/lib/libcrypto/bn/asm/alpha/div.pl b/src/lib/libcrypto/bn/asm/alpha/div.pl
new file mode 100644
index 0000000000..e9e680897a
--- /dev/null
+++ b/src/lib/libcrypto/bn/asm/alpha/div.pl
@@ -0,0 +1,144 @@
1#!/usr/local/bin/perl
2
3sub bn_div_words
4 {
5 local($data)=<<'EOF';
6 #
7 # What follows was taken directly from the C compiler with a few
8 # hacks to redo the lables.
9 #
10.text
11 .set noreorder
12 .set volatile
13 .align 3
14 .globl bn_div_words
15 .ent bn_div_words
16bn_div_words
17 ldgp $29,0($27)
18bn_div_words.ng:
19 lda $30,-48($30)
20 .frame $30,48,$26,0
21 stq $26,0($30)
22 stq $9,8($30)
23 stq $10,16($30)
24 stq $11,24($30)
25 stq $12,32($30)
26 stq $13,40($30)
27 .mask 0x4003e00,-48
28 .prologue 1
29 bis $16,$16,$9
30 bis $17,$17,$10
31 bis $18,$18,$11
32 bis $31,$31,$13
33 bis $31,2,$12
34 bne $11,$9119
35 lda $0,-1
36 br $31,$9136
37 .align 4
38$9119:
39 bis $11,$11,$16
40 jsr $26,BN_num_bits_word
41 ldgp $29,0($26)
42 subq $0,64,$1
43 beq $1,$9120
44 bis $31,1,$1
45 sll $1,$0,$1
46 cmpule $9,$1,$1
47 bne $1,$9120
48 # lda $16,_IO_stderr_
49 # lda $17,$C32
50 # bis $0,$0,$18
51 # jsr $26,fprintf
52 # ldgp $29,0($26)
53 jsr $26,abort
54 ldgp $29,0($26)
55 .align 4
56$9120:
57 bis $31,64,$3
58 cmpult $9,$11,$2
59 subq $3,$0,$1
60 addl $1,$31,$0
61 subq $9,$11,$1
62 cmoveq $2,$1,$9
63 beq $0,$9122
64 zapnot $0,15,$2
65 subq $3,$0,$1
66 sll $11,$2,$11
67 sll $9,$2,$3
68 srl $10,$1,$1
69 sll $10,$2,$10
70 bis $3,$1,$9
71$9122:
72 srl $11,32,$5
73 zapnot $11,15,$6
74 lda $7,-1
75 .align 5
76$9123:
77 srl $9,32,$1
78 subq $1,$5,$1
79 bne $1,$9126
80 zapnot $7,15,$27
81 br $31,$9127
82 .align 4
83$9126:
84 bis $9,$9,$24
85 bis $5,$5,$25
86 divqu $24,$25,$27
87$9127:
88 srl $10,32,$4
89 .align 5
90$9128:
91 mulq $27,$5,$1
92 subq $9,$1,$3
93 zapnot $3,240,$1
94 bne $1,$9129
95 mulq $6,$27,$2
96 sll $3,32,$1
97 addq $1,$4,$1
98 cmpule $2,$1,$2
99 bne $2,$9129
100 subq $27,1,$27
101 br $31,$9128
102 .align 4
103$9129:
104 mulq $27,$6,$1
105 mulq $27,$5,$4
106 srl $1,32,$3
107 sll $1,32,$1
108 addq $4,$3,$4
109 cmpult $10,$1,$2
110 subq $10,$1,$10
111 addq $2,$4,$2
112 cmpult $9,$2,$1
113 bis $2,$2,$4
114 beq $1,$9134
115 addq $9,$11,$9
116 subq $27,1,$27
117$9134:
118 subl $12,1,$12
119 subq $9,$4,$9
120 beq $12,$9124
121 sll $27,32,$13
122 sll $9,32,$2
123 srl $10,32,$1
124 sll $10,32,$10
125 bis $2,$1,$9
126 br $31,$9123
127 .align 4
128$9124:
129 bis $13,$27,$0
130$9136:
131 ldq $26,0($30)
132 ldq $9,8($30)
133 ldq $10,16($30)
134 ldq $11,24($30)
135 ldq $12,32($30)
136 ldq $13,40($30)
137 addq $30,48,$30
138 ret $31,($26),1
139 .end bn_div_words
140EOF
141 &asm_add($data);
142 }
143
1441;
diff --git a/src/lib/libcrypto/bn/asm/alpha/mul.pl b/src/lib/libcrypto/bn/asm/alpha/mul.pl
new file mode 100644
index 0000000000..76c926566c
--- /dev/null
+++ b/src/lib/libcrypto/bn/asm/alpha/mul.pl
@@ -0,0 +1,104 @@
1#!/usr/local/bin/perl
2# alpha assember
3
4sub bn_mul_words
5 {
6 local($name)=@_;
7 local($cc,$a,$b,$r,$couny);
8
9 &init_pool(4);
10 ($cc)=GR("r0");
11
12 $rp=&wparam(0);
13 $ap=&wparam(1);
14 $count=&wparam(2);
15 $word=&wparam(3);
16
17 &function_begin($name,"");
18
19 &comment("");
20 &sub($count,4,$count);
21 &mov("zero",$cc);
22 ###
23 &blt($count,&label("finish"));
24
25 ($a0)=&NR(1); &ld($a0,&QWPw(0,$ap));
26
27 &set_label("loop");
28
29 ($a1)=&NR(1); &ld($a1,&QWPw(1,$ap));
30 ($a2)=&NR(1); &ld($a2,&QWPw(2,$ap));
31
32 &muh($a0,$word,($h0)=&NR(1)); &FR($a0);
33 ($a3)=&NR(1); &ld($a3,&QWPw(3,$ap));
34 ### wait 8
35 &mul($a0,$word,($l0)=&NR(1)); &FR($a0);
36 ### wait 8
37 &muh($a1,$word,($h1)=&NR(1)); &FR($a1);
38 &add($l0,$cc,$l0); ### wait 8
39 &mul($a1,$word,($l1)=&NR(1)); &FR($a1);
40 &cmpult($l0,$cc,$cc); ### wait 8
41 &muh($a2,$word,($h2)=&NR(1)); &FR($a2);
42 &add($h0,$cc,$cc); &FR($h0); ### wait 8
43 &mul($a2,$word,($l2)=&NR(1)); &FR($a2);
44 &add($l1,$cc,$l1); ### wait 8
45 &st($l0,&QWPw(0,$rp)); &FR($l0);
46 &cmpult($l1,$cc,$cc); ### wait 8
47 &muh($a3,$word,($h3)=&NR(1)); &FR($a3);
48 &add($h1,$cc,$cc); &FR($h1);
49 &mul($a3,$word,($l3)=&NR(1)); &FR($a3);
50 &add($l2,$cc,$l2);
51 &st($l1,&QWPw(1,$rp)); &FR($l1);
52 &cmpult($l2,$cc,$cc);
53 &add($h2,$cc,$cc); &FR($h2);
54 &sub($count,4,$count); # count-=4
55 &st($l2,&QWPw(2,$rp)); &FR($l2);
56 &add($l3,$cc,$l3);
57 &cmpult($l3,$cc,$cc);
58 &add($bp,4*$QWS,$bp); # count+=4
59 &add($h3,$cc,$cc); &FR($h3);
60 &add($ap,4*$QWS,$ap); # count+=4
61 &st($l3,&QWPw(3,$rp)); &FR($l3);
62 &add($rp,4*$QWS,$rp); # count+=4
63 ###
64 &blt($count,&label("finish"));
65 ($a0)=&NR(1); &ld($a0,&QWPw(0,$ap));
66 &br(&label("finish"));
67##################################################
68
69##################################################
70 # Do the last 0..3 words
71
72 &set_label("last_loop");
73
74 &ld(($a0)=&NR(1),&QWPw(0,$ap)); # get a
75 ###
76 ###
77 ###
78 &muh($a0,$word,($h0)=&NR(1));
79 ### Wait 8 for next mul issue
80 &mul($a0,$word,($l0)=&NR(1)); &FR($a0)
81 &add($ap,$QWS,$ap);
82 ### Loose 12 until result is available
83 &add($rp,$QWS,$rp);
84 &sub($count,1,$count);
85 &add($l0,$cc,$l0);
86 ###
87 &st($l0,&QWPw(-1,$rp)); &FR($l0);
88 &cmpult($l0,$cc,$cc);
89 &add($h0,$cc,$cc); &FR($h0);
90 &bgt($count,&label("last_loop"));
91 &function_end_A($name);
92
93######################################################
94 &set_label("finish");
95 &add($count,4,$count);
96 &bgt($count,&label("last_loop"));
97
98 &set_label("end");
99 &function_end($name);
100
101 &fin_pool;
102 }
103
1041;
diff --git a/src/lib/libcrypto/bn/asm/alpha/mul_add.pl b/src/lib/libcrypto/bn/asm/alpha/mul_add.pl
new file mode 100644
index 0000000000..0d6df69bc4
--- /dev/null
+++ b/src/lib/libcrypto/bn/asm/alpha/mul_add.pl
@@ -0,0 +1,123 @@
1#!/usr/local/bin/perl
2# alpha assember
3
4sub bn_mul_add_words
5 {
6 local($name)=@_;
7 local($cc,$a,$b,$r,$couny);
8
9 &init_pool(4);
10 ($cc)=GR("r0");
11
12 $rp=&wparam(0);
13 $ap=&wparam(1);
14 $count=&wparam(2);
15 $word=&wparam(3);
16
17 &function_begin($name,"");
18
19 &comment("");
20 &sub($count,4,$count);
21 &mov("zero",$cc);
22 ###
23 &blt($count,&label("finish"));
24
25 &ld(($a0)=&NR(1),&QWPw(0,$ap));
26
27$a=<<'EOF';
28##########################################################
29 &set_label("loop");
30
31 &ld(($r0)=&NR(1),&QWPw(0,$rp));
32 &ld(($a1)=&NR(1),&QWPw(1,$ap));
33 &muh($a0,$word,($h0)=&NR(1));
34 &ld(($r1)=&NR(1),&QWPw(1,$rp));
35 &ld(($a2)=&NR(1),&QWPw(2,$ap));
36 ###
37 &mul($a0,$word,($l0)=&NR(1)); &FR($a0);
38 &ld(($r2)=&NR(1),&QWPw(2,$rp));
39 &muh($a1,$word,($h1)=&NR(1));
40 &ld(($a3)=&NR(1),&QWPw(3,$ap));
41 &mul($a1,$word,($l1)=&NR(1)); &FR($a1);
42 &ld(($r3)=&NR(1),&QWPw(3,$rp));
43 &add($r0,$l0,$r0);
44 &add($r1,$l1,$r1);
45 &cmpult($r0,$l0,($t0)=&NR(1)); &FR($l0);
46 &cmpult($r1,$l1,($t1)=&NR(1)); &FR($l1);
47 &muh($a2,$word,($h2)=&NR(1));
48 &add($r0,$cc,$r0);
49 &add($h0,$t0,$h0); &FR($t0);
50 &cmpult($r0,$cc,$cc);
51 &add($h1,$t1,$h1); &FR($t1);
52 &add($h0,$cc,$cc); &FR($h0);
53 &mul($a2,$word,($l2)=&NR(1)); &FR($a2);
54 &add($r1,$cc,$r1);
55 &cmpult($r1,$cc,$cc);
56 &add($r2,$l2,$r2);
57 &add($h1,$cc,$cc); &FR($h1);
58 &cmpult($r2,$l2,($t2)=&NR(1)); &FR($l2);
59 &muh($a3,$word,($h3)=&NR(1));
60 &add($r2,$cc,$r2);
61 &st($r0,&QWPw(0,$rp)); &FR($r0);
62 &add($h2,$t2,$h2); &FR($t2);
63 &st($r1,&QWPw(1,$rp)); &FR($r1);
64 &cmpult($r2,$cc,$cc);
65 &mul($a3,$word,($l3)=&NR(1)); &FR($a3);
66 &add($h2,$cc,$cc); &FR($h2);
67 &st($r2,&QWPw(2,$rp)); &FR($r2);
68 &sub($count,4,$count); # count-=4
69 &add($rp,4*$QWS,$rp); # count+=4
70 &add($r3,$l3,$r3);
71 &add($ap,4*$QWS,$ap); # count+=4
72 &cmpult($r3,$l3,($t3)=&NR(1)); &FR($l3);
73 &add($r3,$cc,$r3);
74 &add($h3,$t3,$h3); &FR($t3);
75 &cmpult($r3,$cc,$cc);
76 &st($r3,&QWPw(-1,$rp)); &FR($r3);
77 &add($h3,$cc,$cc); &FR($h3);
78
79 ###
80 &blt($count,&label("finish"));
81 &ld(($a0)=&NR(1),&QWPw(0,$ap));
82 &br(&label("loop"));
83EOF
84##################################################
85 # Do the last 0..3 words
86
87 &set_label("last_loop");
88
89 &ld(($a0)=&NR(1),&QWPw(0,$ap)); # get a
90 &ld(($r0)=&NR(1),&QWPw(0,$rp)); # get b
91 ###
92 ###
93 &muh($a0,$word,($h0)=&NR(1)); &FR($a0);
94 ### wait 8
95 &mul($a0,$word,($l0)=&NR(1)); &FR($a0);
96 &add($rp,$QWS,$rp);
97 &add($ap,$QWS,$ap);
98 &sub($count,1,$count);
99 ### wait 3 until l0 is available
100 &add($r0,$l0,$r0);
101 ###
102 &cmpult($r0,$l0,($t0)=&NR(1)); &FR($l0);
103 &add($r0,$cc,$r0);
104 &add($h0,$t0,$h0); &FR($t0);
105 &cmpult($r0,$cc,$cc);
106 &add($h0,$cc,$cc); &FR($h0);
107
108 &st($r0,&QWPw(-1,$rp)); &FR($r0);
109 &bgt($count,&label("last_loop"));
110 &function_end_A($name);
111
112######################################################
113 &set_label("finish");
114 &add($count,4,$count);
115 &bgt($count,&label("last_loop"));
116
117 &set_label("end");
118 &function_end($name);
119
120 &fin_pool;
121 }
122
1231;
diff --git a/src/lib/libcrypto/bn/asm/alpha/mul_c4.pl b/src/lib/libcrypto/bn/asm/alpha/mul_c4.pl
new file mode 100644
index 0000000000..9cc876ded4
--- /dev/null
+++ b/src/lib/libcrypto/bn/asm/alpha/mul_c4.pl
@@ -0,0 +1,215 @@
1#!/usr/local/bin/perl
2# alpha assember
3
4# upto
5
6sub mul_add_c
7 {
8 local($a,$b,$c0,$c1,$c2)=@_;
9 local($l1,$h1,$t1,$t2);
10
11 &mul($a,$b,($l1)=&NR(1));
12 &muh($a,$b,($h1)=&NR(1));
13 &add($c0,$l1,$c0);
14 &cmpult($c0,$l1,($t1)=&NR(1)); &FR($l1);
15 &add($t1,$h1,$h1); &FR($t1);
16 &add($c1,$h1,$c1);
17 &cmpult($c1,$h1,($t2)=&NR(1)); &FR($h1);
18 &add($c2,$t2,$c2); &FR($t2);
19 }
20
21sub bn_mul_comba4
22 {
23 local($name)=@_;
24 local(@a,@b,$r,$c0,$c1,$c2);
25
26 $cnt=1;
27 &init_pool(3);
28
29 $rp=&wparam(0);
30 $ap=&wparam(1);
31 $bp=&wparam(2);
32
33 &function_begin($name,"");
34
35 &comment("");
36
37 &ld(($a[0])=&NR(1),&QWPw(0,$ap));
38 &ld(($b[0])=&NR(1),&QWPw(0,$bp));
39 &ld(($a[1])=&NR(1),&QWPw(1,$ap));
40 &ld(($b[1])=&NR(1),&QWPw(1,$bp));
41 &mul($a[0],$b[0],($r00)=&NR(1));
42 &ld(($a[2])=&NR(1),&QWPw(2,$ap));
43 &ld(($b[2])=&NR(1),&QWPw(2,$bp));
44 &muh($a[0],$b[0],($r01)=&NR(1));
45 &FR($ap); &ld(($a[3])=&NR(1),&QWPw(3,$ap));
46 &FR($bp); &ld(($b[3])=&NR(1),&QWPw(3,$bp));
47 &mul($a[0],$b[1],($r02)=&NR(1));
48
49 ($R,$H1,$H2)=&NR(3);
50
51 &st($r00,&QWPw(0,$rp)); &FR($r00);
52
53 &mov("zero",$R);
54 &mul($a[1],$b[0],($r03)=&NR(1));
55
56 &mov("zero",$H1);
57 &mov("zero",$H0);
58 &add($R,$r01,$R);
59 &muh($a[0],$b[1],($r04)=&NR(1));
60 &cmpult($R,$r01,($t01)=&NR(1)); &FR($r01);
61 &add($R,$r02,$R);
62 &add($H1,$t01,$H1) &FR($t01);
63 &muh($a[1],$b[0],($r05)=&NR(1));
64 &cmpult($R,$r02,($t02)=&NR(1)); &FR($r02);
65 &add($R,$r03,$R);
66 &add($H2,$t02,$H2) &FR($t02);
67 &mul($a[0],$b[2],($r06)=&NR(1));
68 &cmpult($R,$r03,($t03)=&NR(1)); &FR($r03);
69 &add($H1,$t03,$H1) &FR($t03);
70 &st($R,&QWPw(1,$rp));
71 &add($H1,$H2,$R);
72
73 &mov("zero",$H1);
74 &add($R,$r04,$R);
75 &mov("zero",$H2);
76 &mul($a[1],$b[1],($r07)=&NR(1));
77 &cmpult($R,$r04,($t04)=&NR(1)); &FR($r04);
78 &add($R,$r05,$R);
79 &add($H1,$t04,$H1) &FR($t04);
80 &mul($a[2],$b[0],($r08)=&NR(1));
81 &cmpult($R,$r05,($t05)=&NR(1)); &FR($r05);
82 &add($R,$r01,$R);
83 &add($H2,$t05,$H2) &FR($t05);
84 &muh($a[0],$b[2],($r09)=&NR(1));
85 &cmpult($R,$r06,($t06)=&NR(1)); &FR($r06);
86 &add($R,$r07,$R);
87 &add($H1,$t06,$H1) &FR($t06);
88 &muh($a[1],$b[1],($r10)=&NR(1));
89 &cmpult($R,$r07,($t07)=&NR(1)); &FR($r07);
90 &add($R,$r08,$R);
91 &add($H2,$t07,$H2) &FR($t07);
92 &muh($a[2],$b[0],($r11)=&NR(1));
93 &cmpult($R,$r08,($t08)=&NR(1)); &FR($r08);
94 &add($H1,$t08,$H1) &FR($t08);
95 &st($R,&QWPw(2,$rp));
96 &add($H1,$H2,$R);
97
98 &mov("zero",$H1);
99 &add($R,$r09,$R);
100 &mov("zero",$H2);
101 &mul($a[0],$b[3],($r12)=&NR(1));
102 &cmpult($R,$r09,($t09)=&NR(1)); &FR($r09);
103 &add($R,$r10,$R);
104 &add($H1,$t09,$H1) &FR($t09);
105 &mul($a[1],$b[2],($r13)=&NR(1));
106 &cmpult($R,$r10,($t10)=&NR(1)); &FR($r10);
107 &add($R,$r11,$R);
108 &add($H1,$t10,$H1) &FR($t10);
109 &mul($a[2],$b[1],($r14)=&NR(1));
110 &cmpult($R,$r11,($t11)=&NR(1)); &FR($r11);
111 &add($R,$r12,$R);
112 &add($H1,$t11,$H1) &FR($t11);
113 &mul($a[3],$b[0],($r15)=&NR(1));
114 &cmpult($R,$r12,($t12)=&NR(1)); &FR($r12);
115 &add($R,$r13,$R);
116 &add($H1,$t12,$H1) &FR($t12);
117 &muh($a[0],$b[3],($r16)=&NR(1));
118 &cmpult($R,$r13,($t13)=&NR(1)); &FR($r13);
119 &add($R,$r14,$R);
120 &add($H1,$t13,$H1) &FR($t13);
121 &muh($a[1],$b[2],($r17)=&NR(1));
122 &cmpult($R,$r14,($t14)=&NR(1)); &FR($r14);
123 &add($R,$r15,$R);
124 &add($H1,$t14,$H1) &FR($t14);
125 &muh($a[2],$b[1],($r18)=&NR(1));
126 &cmpult($R,$r15,($t15)=&NR(1)); &FR($r15);
127 &add($H1,$t15,$H1) &FR($t15);
128 &st($R,&QWPw(3,$rp));
129 &add($H1,$H2,$R);
130
131 &mov("zero",$H1);
132 &add($R,$r16,$R);
133 &mov("zero",$H2);
134 &muh($a[3],$b[0],($r19)=&NR(1));
135 &cmpult($R,$r16,($t16)=&NR(1)); &FR($r16);
136 &add($R,$r17,$R);
137 &add($H1,$t16,$H1) &FR($t16);
138 &mul($a[1],$b[3],($r20)=&NR(1));
139 &cmpult($R,$r17,($t17)=&NR(1)); &FR($r17);
140 &add($R,$r18,$R);
141 &add($H1,$t17,$H1) &FR($t17);
142 &mul($a[2],$b[2],($r21)=&NR(1));
143 &cmpult($R,$r18,($t18)=&NR(1)); &FR($r18);
144 &add($R,$r19,$R);
145 &add($H1,$t18,$H1) &FR($t18);
146 &mul($a[3],$b[1],($r22)=&NR(1));
147 &cmpult($R,$r19,($t19)=&NR(1)); &FR($r19);
148 &add($R,$r20,$R);
149 &add($H1,$t19,$H1) &FR($t19);
150 &muh($a[1],$b[3],($r23)=&NR(1));
151 &cmpult($R,$r20,($t20)=&NR(1)); &FR($r20);
152 &add($R,$r21,$R);
153 &add($H1,$t20,$H1) &FR($t20);
154 &muh($a[2],$b[2],($r24)=&NR(1));
155 &cmpult($R,$r21,($t21)=&NR(1)); &FR($r21);
156 &add($R,$r22,$R);
157 &add($H1,$t21,$H1) &FR($t21);
158 &muh($a[3],$b[1],($r25)=&NR(1));
159 &cmpult($R,$r22,($t22)=&NR(1)); &FR($r22);
160 &add($H1,$t22,$H1) &FR($t22);
161 &st($R,&QWPw(4,$rp));
162 &add($H1,$H2,$R);
163
164 &mov("zero",$H1);
165 &add($R,$r23,$R);
166 &mov("zero",$H2);
167 &mul($a[2],$b[3],($r26)=&NR(1));
168 &cmpult($R,$r23,($t23)=&NR(1)); &FR($r23);
169 &add($R,$r24,$R);
170 &add($H1,$t23,$H1) &FR($t23);
171 &mul($a[3],$b[2],($r27)=&NR(1));
172 &cmpult($R,$r24,($t24)=&NR(1)); &FR($r24);
173 &add($R,$r25,$R);
174 &add($H1,$t24,$H1) &FR($t24);
175 &muh($a[2],$b[3],($r28)=&NR(1));
176 &cmpult($R,$r25,($t25)=&NR(1)); &FR($r25);
177 &add($R,$r26,$R);
178 &add($H1,$t25,$H1) &FR($t25);
179 &muh($a[3],$b[2],($r29)=&NR(1));
180 &cmpult($R,$r26,($t26)=&NR(1)); &FR($r26);
181 &add($R,$r27,$R);
182 &add($H1,$t26,$H1) &FR($t26);
183 &mul($a[3],$b[3],($r30)=&NR(1));
184 &cmpult($R,$r27,($t27)=&NR(1)); &FR($r27);
185 &add($H1,$t27,$H1) &FR($t27);
186 &st($R,&QWPw(5,$rp));
187 &add($H1,$H2,$R);
188
189 &mov("zero",$H1);
190 &add($R,$r28,$R);
191 &mov("zero",$H2);
192 &muh($a[3],$b[3],($r31)=&NR(1));
193 &cmpult($R,$r28,($t28)=&NR(1)); &FR($r28);
194 &add($R,$r29,$R);
195 &add($H1,$t28,$H1) &FR($t28);
196 ############
197 &cmpult($R,$r29,($t29)=&NR(1)); &FR($r29);
198 &add($R,$r30,$R);
199 &add($H1,$t29,$H1) &FR($t29);
200 ############
201 &cmpult($R,$r30,($t30)=&NR(1)); &FR($r30);
202 &add($H1,$t30,$H1) &FR($t30);
203 &st($R,&QWPw(6,$rp));
204 &add($H1,$H2,$R);
205
206 &add($R,$r31,$R); &FR($r31);
207 &st($R,&QWPw(7,$rp));
208
209 &FR($R,$H1,$H2);
210 &function_end($name);
211
212 &fin_pool;
213 }
214
2151;
diff --git a/src/lib/libcrypto/bn/asm/alpha/mul_c4.works.pl b/src/lib/libcrypto/bn/asm/alpha/mul_c4.works.pl
new file mode 100644
index 0000000000..79d86dd25c
--- /dev/null
+++ b/src/lib/libcrypto/bn/asm/alpha/mul_c4.works.pl
@@ -0,0 +1,98 @@
1#!/usr/local/bin/perl
2# alpha assember
3
4sub mul_add_c
5 {
6 local($a,$b,$c0,$c1,$c2)=@_;
7 local($l1,$h1,$t1,$t2);
8
9print STDERR "count=$cnt\n"; $cnt++;
10 &mul($a,$b,($l1)=&NR(1));
11 &muh($a,$b,($h1)=&NR(1));
12 &add($c0,$l1,$c0);
13 &cmpult($c0,$l1,($t1)=&NR(1)); &FR($l1);
14 &add($t1,$h1,$h1); &FR($t1);
15 &add($c1,$h1,$c1);
16 &cmpult($c1,$h1,($t2)=&NR(1)); &FR($h1);
17 &add($c2,$t2,$c2); &FR($t2);
18 }
19
20sub bn_mul_comba4
21 {
22 local($name)=@_;
23 local(@a,@b,$r,$c0,$c1,$c2);
24
25 $cnt=1;
26 &init_pool(3);
27
28 $rp=&wparam(0);
29 $ap=&wparam(1);
30 $bp=&wparam(2);
31
32 &function_begin($name,"");
33
34 &comment("");
35
36 &ld(($a[0])=&NR(1),&QWPw(0,$ap));
37 &ld(($b[0])=&NR(1),&QWPw(0,$bp));
38 &ld(($a[1])=&NR(1),&QWPw(1,$ap));
39 &ld(($b[1])=&NR(1),&QWPw(1,$bp));
40 &ld(($a[2])=&NR(1),&QWPw(2,$ap));
41 &ld(($b[2])=&NR(1),&QWPw(2,$bp));
42 &ld(($a[3])=&NR(1),&QWPw(3,$ap)); &FR($ap);
43 &ld(($b[3])=&NR(1),&QWPw(3,$bp)); &FR($bp);
44
45 ($c0,$c1,$c2)=&NR(3);
46 &mov("zero",$c2);
47 &mul($a[0],$b[0],$c0);
48 &muh($a[0],$b[0],$c1);
49 &st($c0,&QWPw(0,$rp)); &FR($c0); ($c0)=&NR($c0);
50 ($c0,$c1,$c2)=($c1,$c2,$c0);
51 &mov("zero",$c2);
52
53 &mul_add_c($a[0],$b[1],$c0,$c1,$c2);
54 &mul_add_c($a[1],$b[0],$c0,$c1,$c2);
55 &st($c0,&QWPw(1,$rp)); &FR($c0); ($c0)=&NR($c0);
56 ($c0,$c1,$c2)=($c1,$c2,$c0);
57 &mov("zero",$c2);
58
59 &mul_add_c($a[1],$b[1],$c0,$c1,$c2);
60 &mul_add_c($a[0],$b[2],$c0,$c1,$c2);
61 &mul_add_c($a[2],$b[0],$c0,$c1,$c2);
62 &st($c0,&QWPw(2,$rp)); &FR($c0); ($c0)=&NR($c0);
63 ($c0,$c1,$c2)=($c1,$c2,$c0);
64 &mov("zero",$c2);
65
66 &mul_add_c($a[0],$b[3],$c0,$c1,$c2); &FR($a[0]);
67 &mul_add_c($a[1],$b[2],$c0,$c1,$c2);
68 &mul_add_c($a[2],$b[1],$c0,$c1,$c2);
69 &mul_add_c($a[3],$b[0],$c0,$c1,$c2); &FR($b[0]);
70 &st($c0,&QWPw(3,$rp)); &FR($c0); ($c0)=&NR($c0);
71 ($c0,$c1,$c2)=($c1,$c2,$c0);
72 &mov("zero",$c2);
73
74 &mul_add_c($a[1],$b[3],$c0,$c1,$c2); &FR($a[1]);
75 &mul_add_c($a[2],$b[2],$c0,$c1,$c2);
76 &mul_add_c($a[3],$b[1],$c0,$c1,$c2); &FR($b[1]);
77 &st($c0,&QWPw(4,$rp)); &FR($c0); ($c0)=&NR($c0);
78 ($c0,$c1,$c2)=($c1,$c2,$c0);
79 &mov("zero",$c2);
80
81 &mul_add_c($a[2],$b[3],$c0,$c1,$c2); &FR($a[2]);
82 &mul_add_c($a[3],$b[2],$c0,$c1,$c2); &FR($b[2]);
83 &st($c0,&QWPw(5,$rp)); &FR($c0); ($c0)=&NR($c0);
84 ($c0,$c1,$c2)=($c1,$c2,$c0);
85 &mov("zero",$c2);
86
87 &mul_add_c($a[3],$b[3],$c0,$c1,$c2); &FR($a[3],$b[3]);
88 &st($c0,&QWPw(6,$rp));
89 &st($c1,&QWPw(7,$rp));
90
91 &FR($c0,$c1,$c2);
92
93 &function_end($name);
94
95 &fin_pool;
96 }
97
981;
diff --git a/src/lib/libcrypto/bn/asm/alpha/mul_c8.pl b/src/lib/libcrypto/bn/asm/alpha/mul_c8.pl
new file mode 100644
index 0000000000..525ca7494b
--- /dev/null
+++ b/src/lib/libcrypto/bn/asm/alpha/mul_c8.pl
@@ -0,0 +1,177 @@
1#!/usr/local/bin/perl
2# alpha assember
3
4sub bn_mul_comba8
5 {
6 local($name)=@_;
7 local(@a,@b,$r,$c0,$c1,$c2);
8
9 $cnt=1;
10 &init_pool(3);
11
12 $rp=&wparam(0);
13 $ap=&wparam(1);
14 $bp=&wparam(2);
15
16 &function_begin($name,"");
17
18 &comment("");
19
20 &stack_push(2);
21 &ld(($a[0])=&NR(1),&QWPw(0,$ap));
22 &ld(($b[0])=&NR(1),&QWPw(0,$bp));
23 &st($reg_s0,&swtmp(0)); &FR($reg_s0);
24 &st($reg_s1,&swtmp(1)); &FR($reg_s1);
25 &ld(($a[1])=&NR(1),&QWPw(1,$ap));
26 &ld(($b[1])=&NR(1),&QWPw(1,$bp));
27 &ld(($a[2])=&NR(1),&QWPw(2,$ap));
28 &ld(($b[2])=&NR(1),&QWPw(2,$bp));
29 &ld(($a[3])=&NR(1),&QWPw(3,$ap));
30 &ld(($b[3])=&NR(1),&QWPw(3,$bp));
31 &ld(($a[4])=&NR(1),&QWPw(1,$ap));
32 &ld(($b[4])=&NR(1),&QWPw(1,$bp));
33 &ld(($a[5])=&NR(1),&QWPw(1,$ap));
34 &ld(($b[5])=&NR(1),&QWPw(1,$bp));
35 &ld(($a[6])=&NR(1),&QWPw(1,$ap));
36 &ld(($b[6])=&NR(1),&QWPw(1,$bp));
37 &ld(($a[7])=&NR(1),&QWPw(1,$ap)); &FR($ap);
38 &ld(($b[7])=&NR(1),&QWPw(1,$bp)); &FR($bp);
39
40 ($c0,$c1,$c2)=&NR(3);
41 &mov("zero",$c2);
42 &mul($a[0],$b[0],$c0);
43 &muh($a[0],$b[0],$c1);
44 &st($c0,&QWPw(0,$rp)); &FR($c0); ($c0)=&NR(1);
45 ($c0,$c1,$c2)=($c1,$c2,$c0);
46 &mov("zero",$c2);
47
48 &mul_add_c($a[0],$b[1],$c0,$c1,$c2);
49 &mul_add_c($a[1],$b[0],$c0,$c1,$c2);
50 &st($c0,&QWPw(1,$rp)); &FR($c0); ($c0)=&NR(1);
51 ($c0,$c1,$c2)=($c1,$c2,$c0);
52 &mov("zero",$c2);
53
54 &mul_add_c($a[0],$b[2],$c0,$c1,$c2);
55 &mul_add_c($a[1],$b[1],$c0,$c1,$c2);
56 &mul_add_c($a[2],$b[0],$c0,$c1,$c2);
57 &st($c0,&QWPw(2,$rp)); &FR($c0); ($c0)=&NR(1);
58 ($c0,$c1,$c2)=($c1,$c2,$c0);
59 &mov("zero",$c2);
60
61 &mul_add_c($a[0],$b[3],$c0,$c1,$c2);
62 &mul_add_c($a[1],$b[2],$c0,$c1,$c2);
63 &mul_add_c($a[2],$b[1],$c0,$c1,$c2);
64 &mul_add_c($a[3],$b[0],$c0,$c1,$c2);
65 &st($c0,&QWPw(3,$rp)); &FR($c0); ($c0)=&NR(1);
66 ($c0,$c1,$c2)=($c1,$c2,$c0);
67 &mov("zero",$c2);
68
69 &mul_add_c($a[0],$b[4],$c0,$c1,$c2);
70 &mul_add_c($a[1],$b[3],$c0,$c1,$c2);
71 &mul_add_c($a[2],$b[2],$c0,$c1,$c2);
72 &mul_add_c($a[3],$b[1],$c0,$c1,$c2);
73 &mul_add_c($a[4],$b[0],$c0,$c1,$c2);
74 &st($c0,&QWPw(4,$rp)); &FR($c0); ($c0)=&NR(1);
75 ($c0,$c1,$c2)=($c1,$c2,$c0);
76 &mov("zero",$c2);
77
78 &mul_add_c($a[0],$b[5],$c0,$c1,$c2);
79 &mul_add_c($a[1],$b[4],$c0,$c1,$c2);
80 &mul_add_c($a[2],$b[3],$c0,$c1,$c2);
81 &mul_add_c($a[3],$b[2],$c0,$c1,$c2);
82 &mul_add_c($a[4],$b[1],$c0,$c1,$c2);
83 &mul_add_c($a[5],$b[0],$c0,$c1,$c2);
84 &st($c0,&QWPw(5,$rp)); &FR($c0); ($c0)=&NR(1);
85 ($c0,$c1,$c2)=($c1,$c2,$c0);
86 &mov("zero",$c2);
87
88 &mul_add_c($a[0],$b[6],$c0,$c1,$c2);
89 &mul_add_c($a[1],$b[5],$c0,$c1,$c2);
90 &mul_add_c($a[2],$b[4],$c0,$c1,$c2);
91 &mul_add_c($a[3],$b[3],$c0,$c1,$c2);
92 &mul_add_c($a[4],$b[2],$c0,$c1,$c2);
93 &mul_add_c($a[5],$b[1],$c0,$c1,$c2);
94 &mul_add_c($a[6],$b[0],$c0,$c1,$c2);
95 &st($c0,&QWPw(6,$rp)); &FR($c0); ($c0)=&NR(1);
96 ($c0,$c1,$c2)=($c1,$c2,$c0);
97 &mov("zero",$c2);
98
99 &mul_add_c($a[0],$b[7],$c0,$c1,$c2); &FR($a[0]);
100 &mul_add_c($a[1],$b[6],$c0,$c1,$c2);
101 &mul_add_c($a[2],$b[5],$c0,$c1,$c2);
102 &mul_add_c($a[3],$b[4],$c0,$c1,$c2);
103 &mul_add_c($a[4],$b[3],$c0,$c1,$c2);
104 &mul_add_c($a[5],$b[2],$c0,$c1,$c2);
105 &mul_add_c($a[6],$b[1],$c0,$c1,$c2);
106 &mul_add_c($a[7],$b[0],$c0,$c1,$c2); &FR($b[0]);
107 &st($c0,&QWPw(7,$rp)); &FR($c0); ($c0)=&NR(1);
108 ($c0,$c1,$c2)=($c1,$c2,$c0);
109 &mov("zero",$c2);
110
111 &mul_add_c($a[1],$b[7],$c0,$c1,$c2); &FR($a[1]);
112 &mul_add_c($a[2],$b[6],$c0,$c1,$c2);
113 &mul_add_c($a[3],$b[5],$c0,$c1,$c2);
114 &mul_add_c($a[4],$b[4],$c0,$c1,$c2);
115 &mul_add_c($a[5],$b[3],$c0,$c1,$c2);
116 &mul_add_c($a[6],$b[2],$c0,$c1,$c2);
117 &mul_add_c($a[7],$b[1],$c0,$c1,$c2); &FR($b[1]);
118 &st($c0,&QWPw(8,$rp)); &FR($c0); ($c0)=&NR(1);
119 ($c0,$c1,$c2)=($c1,$c2,$c0);
120 &mov("zero",$c2);
121
122 &mul_add_c($a[2],$b[7],$c0,$c1,$c2); &FR($a[2]);
123 &mul_add_c($a[3],$b[6],$c0,$c1,$c2);
124 &mul_add_c($a[4],$b[5],$c0,$c1,$c2);
125 &mul_add_c($a[5],$b[4],$c0,$c1,$c2);
126 &mul_add_c($a[6],$b[3],$c0,$c1,$c2);
127 &mul_add_c($a[7],$b[2],$c0,$c1,$c2); &FR($b[2]);
128 &st($c0,&QWPw(9,$rp)); &FR($c0); ($c0)=&NR(1);
129 ($c0,$c1,$c2)=($c1,$c2,$c0);
130 &mov("zero",$c2);
131
132 &mul_add_c($a[3],$b[7],$c0,$c1,$c2); &FR($a[3]);
133 &mul_add_c($a[4],$b[6],$c0,$c1,$c2);
134 &mul_add_c($a[5],$b[5],$c0,$c1,$c2);
135 &mul_add_c($a[6],$b[4],$c0,$c1,$c2);
136 &mul_add_c($a[7],$b[3],$c0,$c1,$c2); &FR($b[3]);
137 &st($c0,&QWPw(10,$rp)); &FR($c0); ($c0)=&NR(1);
138 ($c0,$c1,$c2)=($c1,$c2,$c0);
139 &mov("zero",$c2);
140
141 &mul_add_c($a[4],$b[7],$c0,$c1,$c2); &FR($a[4]);
142 &mul_add_c($a[5],$b[6],$c0,$c1,$c2);
143 &mul_add_c($a[6],$b[5],$c0,$c1,$c2);
144 &mul_add_c($a[7],$b[4],$c0,$c1,$c2); &FR($b[4]);
145 &st($c0,&QWPw(11,$rp)); &FR($c0); ($c0)=&NR(1);
146 ($c0,$c1,$c2)=($c1,$c2,$c0);
147 &mov("zero",$c2);
148
149 &mul_add_c($a[5],$b[7],$c0,$c1,$c2); &FR($a[5]);
150 &mul_add_c($a[6],$b[6],$c0,$c1,$c2);
151 &mul_add_c($a[7],$b[5],$c0,$c1,$c2); &FR($b[5]);
152 &st($c0,&QWPw(12,$rp)); &FR($c0); ($c0)=&NR(1);
153 ($c0,$c1,$c2)=($c1,$c2,$c0);
154 &mov("zero",$c2);
155
156 &mul_add_c($a[6],$b[7],$c0,$c1,$c2); &FR($a[6]);
157 &mul_add_c($a[7],$b[6],$c0,$c1,$c2); &FR($b[6]);
158 &st($c0,&QWPw(13,$rp)); &FR($c0); ($c0)=&NR(1);
159 ($c0,$c1,$c2)=($c1,$c2,$c0);
160 &mov("zero",$c2);
161
162 &mul_add_c($a[7],$b[7],$c0,$c1,$c2); &FR($a[7],$b[7]);
163 &st($c0,&QWPw(14,$rp));
164 &st($c1,&QWPw(15,$rp));
165
166 &FR($c0,$c1,$c2);
167
168 &ld($reg_s0,&swtmp(0));
169 &ld($reg_s1,&swtmp(1));
170 &stack_pop(2);
171
172 &function_end($name);
173
174 &fin_pool;
175 }
176
1771;
diff --git a/src/lib/libcrypto/bn/asm/alpha/sqr.pl b/src/lib/libcrypto/bn/asm/alpha/sqr.pl
new file mode 100644
index 0000000000..a55b696906
--- /dev/null
+++ b/src/lib/libcrypto/bn/asm/alpha/sqr.pl
@@ -0,0 +1,113 @@
1#!/usr/local/bin/perl
2# alpha assember
3
4sub bn_sqr_words
5 {
6 local($name)=@_;
7 local($cc,$a,$b,$r,$couny);
8
9 &init_pool(3);
10 ($cc)=GR("r0");
11
12 $rp=&wparam(0);
13 $ap=&wparam(1);
14 $count=&wparam(2);
15
16 &function_begin($name,"");
17
18 &comment("");
19 &sub($count,4,$count);
20 &mov("zero",$cc);
21 &br(&label("finish"));
22 &blt($count,&label("finish"));
23
24 ($a0,$r0)=&NR(2);
25 &ld($a0,&QWPw(0,$ap));
26 &ld($r0,&QWPw(0,$rp));
27
28$a=<<'EOF';
29##########################################################
30 &set_label("loop");
31
32 ($a1)=&NR(1); &ld($a1,&QWPw(1,$ap));
33 ($b1)=&NR(1); &ld($b1,&QWPw(1,$bp));
34 ($a2)=&NR(1); &ld($a2,&QWPw(2,$ap));
35 ($b2)=&NR(1); &ld($b2,&QWPw(2,$bp));
36 ($a3)=&NR(1); &ld($a3,&QWPw(3,$ap));
37 ($b3)=&NR(1); &ld($b3,&QWPw(3,$bp));
38
39 ($o0,$t0)=&NR(2);
40 &add($a0,$b0,$o0);
41 &cmpult($o0,$b0,$t0);
42 &add($o0,$cc,$o0);
43 &cmpult($o0,$cc,$cc);
44 &add($cc,$t0,$cc); &FR($t0);
45
46 ($t1,$o1)=&NR(2);
47
48 &add($a1,$b1,$o1); &FR($a1);
49 &cmpult($o1,$b1,$t1); &FR($b1);
50 &add($o1,$cc,$o1);
51 &cmpult($o1,$cc,$cc);
52 &add($cc,$t1,$cc); &FR($t1);
53
54 ($t2,$o2)=&NR(2);
55
56 &add($a2,$b2,$o2); &FR($a2);
57 &cmpult($o2,$b2,$t2); &FR($b2);
58 &add($o2,$cc,$o2);
59 &cmpult($o2,$cc,$cc);
60 &add($cc,$t2,$cc); &FR($t2);
61
62 ($t3,$o3)=&NR(2);
63
64 &add($a3,$b3,$o3); &FR($a3);
65 &cmpult($o3,$b3,$t3); &FR($b3);
66 &add($o3,$cc,$o3);
67 &cmpult($o3,$cc,$cc);
68 &add($cc,$t3,$cc); &FR($t3);
69
70 &st($o0,&QWPw(0,$rp)); &FR($o0);
71 &st($o1,&QWPw(0,$rp)); &FR($o1);
72 &st($o2,&QWPw(0,$rp)); &FR($o2);
73 &st($o3,&QWPw(0,$rp)); &FR($o3);
74
75 &sub($count,4,$count); # count-=4
76 &add($ap,4*$QWS,$ap); # count+=4
77 &add($bp,4*$QWS,$bp); # count+=4
78 &add($rp,4*$QWS,$rp); # count+=4
79
80 &blt($count,&label("finish"));
81 &ld($a0,&QWPw(0,$ap));
82 &ld($b0,&QWPw(0,$bp));
83 &br(&label("loop"));
84EOF
85##################################################
86 # Do the last 0..3 words
87
88 &set_label("last_loop");
89
90 &ld(($a0)=&NR(1),&QWPw(0,$ap)); # get a
91 &mul($a0,$a0,($l0)=&NR(1));
92 &add($ap,$QWS,$ap);
93 &add($rp,2*$QWS,$rp);
94 &sub($count,1,$count);
95 &muh($a0,$a0,($h0)=&NR(1)); &FR($a0);
96 &st($l0,&QWPw(-2,$rp)); &FR($l0);
97 &st($h0,&QWPw(-1,$rp)); &FR($h0);
98
99 &bgt($count,&label("last_loop"));
100 &function_end_A($name);
101
102######################################################
103 &set_label("finish");
104 &add($count,4,$count);
105 &bgt($count,&label("last_loop"));
106
107 &set_label("end");
108 &function_end($name);
109
110 &fin_pool;
111 }
112
1131;
diff --git a/src/lib/libcrypto/bn/asm/alpha/sqr_c4.pl b/src/lib/libcrypto/bn/asm/alpha/sqr_c4.pl
new file mode 100644
index 0000000000..bf33f5b503
--- /dev/null
+++ b/src/lib/libcrypto/bn/asm/alpha/sqr_c4.pl
@@ -0,0 +1,109 @@
1#!/usr/local/bin/perl
2# alpha assember
3
4sub sqr_add_c
5 {
6 local($a,$c0,$c1,$c2)=@_;
7 local($l1,$h1,$t1,$t2);
8
9 &mul($a,$a,($l1)=&NR(1));
10 &muh($a,$a,($h1)=&NR(1));
11 &add($c0,$l1,$c0);
12 &add($c1,$h1,$c1);
13 &cmpult($c0,$l1,($t1)=&NR(1)); &FR($l1);
14 &cmpult($c1,$h1,($t2)=&NR(1)); &FR($h1);
15 &add($c1,$t1,$c1); &FR($t1);
16 &add($c2,$t2,$c2); &FR($t2);
17 }
18
19sub sqr_add_c2
20 {
21 local($a,$b,$c0,$c1,$c2)=@_;
22 local($l1,$h1,$t1,$t2);
23
24 &mul($a,$b,($l1)=&NR(1));
25 &muh($a,$b,($h1)=&NR(1));
26 &cmplt($l1,"zero",($lc1)=&NR(1));
27 &cmplt($h1,"zero",($hc1)=&NR(1));
28 &add($l1,$l1,$l1);
29 &add($h1,$h1,$h1);
30 &add($h1,$lc1,$h1); &FR($lc1);
31 &add($c2,$hc1,$c2); &FR($hc1);
32
33 &add($c0,$l1,$c0);
34 &add($c1,$h1,$c1);
35 &cmpult($c0,$l1,($lc1)=&NR(1)); &FR($l1);
36 &cmpult($c1,$h1,($hc1)=&NR(1)); &FR($h1);
37
38 &add($c1,$lc1,$c1); &FR($lc1);
39 &add($c2,$hc1,$c2); &FR($hc1);
40 }
41
42
43sub bn_sqr_comba4
44 {
45 local($name)=@_;
46 local(@a,@b,$r,$c0,$c1,$c2);
47
48 $cnt=1;
49 &init_pool(2);
50
51 $rp=&wparam(0);
52 $ap=&wparam(1);
53
54 &function_begin($name,"");
55
56 &comment("");
57
58 &ld(($a[0])=&NR(1),&QWPw(0,$ap));
59 &ld(($a[1])=&NR(1),&QWPw(1,$ap));
60 &ld(($a[2])=&NR(1),&QWPw(2,$ap));
61 &ld(($a[3])=&NR(1),&QWPw(3,$ap)); &FR($ap);
62
63 ($c0,$c1,$c2)=&NR(3);
64
65 &mov("zero",$c2);
66 &mul($a[0],$a[0],$c0);
67 &muh($a[0],$a[0],$c1);
68 &st($c0,&QWPw(0,$rp));
69 ($c0,$c1,$c2)=($c1,$c2,$c0);
70 &mov("zero",$c2);
71
72 &sqr_add_c2($a[0],$a[1],$c0,$c1,$c2);
73 &st($c0,&QWPw(1,$rp));
74 ($c0,$c1,$c2)=($c1,$c2,$c0);
75 &mov("zero",$c2);
76
77 &sqr_add_c($a[1],$c0,$c1,$c2);
78 &sqr_add_c2($a[2],$a[0],$c0,$c1,$c2);
79 &st($c0,&QWPw(2,$rp));
80 ($c0,$c1,$c2)=($c1,$c2,$c0);
81 &mov("zero",$c2);
82
83 &sqr_add_c2($a[3],$a[0],$c0,$c1,$c2);
84 &sqr_add_c2($a[2],$a[1],$c0,$c1,$c2);
85 &st($c0,&QWPw(3,$rp));
86 ($c0,$c1,$c2)=($c1,$c2,$c0);
87 &mov("zero",$c2);
88
89 &sqr_add_c($a[2],$c0,$c1,$c2);
90 &sqr_add_c2($a[3],$a[1],$c0,$c1,$c2);
91 &st($c0,&QWPw(4,$rp));
92 ($c0,$c1,$c2)=($c1,$c2,$c0);
93 &mov("zero",$c2);
94
95 &sqr_add_c2($a[3],$a[2],$c0,$c1,$c2);
96 &st($c0,&QWPw(5,$rp));
97 ($c0,$c1,$c2)=($c1,$c2,$c0);
98 &mov("zero",$c2);
99
100 &sqr_add_c($a[3],$c0,$c1,$c2);
101 &st($c0,&QWPw(6,$rp));
102 &st($c1,&QWPw(7,$rp));
103
104 &function_end($name);
105
106 &fin_pool;
107 }
108
1091;
diff --git a/src/lib/libcrypto/bn/asm/alpha/sqr_c8.pl b/src/lib/libcrypto/bn/asm/alpha/sqr_c8.pl
new file mode 100644
index 0000000000..b4afe085f1
--- /dev/null
+++ b/src/lib/libcrypto/bn/asm/alpha/sqr_c8.pl
@@ -0,0 +1,132 @@
1#!/usr/local/bin/perl
2# alpha assember
3
4sub bn_sqr_comba8
5 {
6 local($name)=@_;
7 local(@a,@b,$r,$c0,$c1,$c2);
8
9 $cnt=1;
10 &init_pool(2);
11
12 $rp=&wparam(0);
13 $ap=&wparam(1);
14
15 &function_begin($name,"");
16
17 &comment("");
18
19 &ld(($a[0])=&NR(1),&QWPw(0,$ap));
20 &ld(($a[1])=&NR(1),&QWPw(1,$ap));
21 &ld(($a[2])=&NR(1),&QWPw(2,$ap));
22 &ld(($a[3])=&NR(1),&QWPw(3,$ap));
23 &ld(($a[4])=&NR(1),&QWPw(4,$ap));
24 &ld(($a[5])=&NR(1),&QWPw(5,$ap));
25 &ld(($a[6])=&NR(1),&QWPw(6,$ap));
26 &ld(($a[7])=&NR(1),&QWPw(7,$ap)); &FR($ap);
27
28 ($c0,$c1,$c2)=&NR(3);
29
30 &mov("zero",$c2);
31 &mul($a[0],$a[0],$c0);
32 &muh($a[0],$a[0],$c1);
33 &st($c0,&QWPw(0,$rp));
34 ($c0,$c1,$c2)=($c1,$c2,$c0);
35 &mov("zero",$c2);
36
37 &sqr_add_c2($a[1],$a[0],$c0,$c1,$c2);
38 &st($c0,&QWPw(1,$rp));
39 ($c0,$c1,$c2)=($c1,$c2,$c0);
40 &mov("zero",$c2);
41
42 &sqr_add_c($a[1],$c0,$c1,$c2);
43 &sqr_add_c2($a[2],$a[0],$c0,$c1,$c2);
44 &st($c0,&QWPw(2,$rp));
45 ($c0,$c1,$c2)=($c1,$c2,$c0);
46 &mov("zero",$c2);
47
48 &sqr_add_c2($a[2],$a[1],$c0,$c1,$c2);
49 &sqr_add_c2($a[3],$a[0],$c0,$c1,$c2);
50 &st($c0,&QWPw(3,$rp));
51 ($c0,$c1,$c2)=($c1,$c2,$c0);
52 &mov("zero",$c2);
53
54 &sqr_add_c($a[2],$c0,$c1,$c2);
55 &sqr_add_c2($a[3],$a[1],$c0,$c1,$c2);
56 &sqr_add_c2($a[4],$a[0],$c0,$c1,$c2);
57 &st($c0,&QWPw(4,$rp));
58 ($c0,$c1,$c2)=($c1,$c2,$c0);
59 &mov("zero",$c2);
60
61 &sqr_add_c2($a[3],$a[2],$c0,$c1,$c2);
62 &sqr_add_c2($a[4],$a[1],$c0,$c1,$c2);
63 &sqr_add_c2($a[5],$a[0],$c0,$c1,$c2);
64 &st($c0,&QWPw(5,$rp));
65 ($c0,$c1,$c2)=($c1,$c2,$c0);
66 &mov("zero",$c2);
67
68 &sqr_add_c($a[3],$c0,$c1,$c2);
69 &sqr_add_c2($a[4],$a[2],$c0,$c1,$c2);
70 &sqr_add_c2($a[5],$a[1],$c0,$c1,$c2);
71 &sqr_add_c2($a[6],$a[0],$c0,$c1,$c2);
72 &st($c0,&QWPw(6,$rp));
73 ($c0,$c1,$c2)=($c1,$c2,$c0);
74 &mov("zero",$c2);
75
76 &sqr_add_c2($a[4],$a[3],$c0,$c1,$c2);
77 &sqr_add_c2($a[5],$a[2],$c0,$c1,$c2);
78 &sqr_add_c2($a[6],$a[1],$c0,$c1,$c2);
79 &sqr_add_c2($a[7],$a[0],$c0,$c1,$c2);
80 &st($c0,&QWPw(7,$rp));
81 ($c0,$c1,$c2)=($c1,$c2,$c0);
82 &mov("zero",$c2);
83
84 &sqr_add_c($a[4],$c0,$c1,$c2);
85 &sqr_add_c2($a[5],$a[3],$c0,$c1,$c2);
86 &sqr_add_c2($a[6],$a[2],$c0,$c1,$c2);
87 &sqr_add_c2($a[7],$a[1],$c0,$c1,$c2);
88 &st($c0,&QWPw(8,$rp));
89 ($c0,$c1,$c2)=($c1,$c2,$c0);
90 &mov("zero",$c2);
91
92 &sqr_add_c2($a[5],$a[4],$c0,$c1,$c2);
93 &sqr_add_c2($a[6],$a[3],$c0,$c1,$c2);
94 &sqr_add_c2($a[7],$a[2],$c0,$c1,$c2);
95 &st($c0,&QWPw(9,$rp));
96 ($c0,$c1,$c2)=($c1,$c2,$c0);
97 &mov("zero",$c2);
98
99 &sqr_add_c($a[5],$c0,$c1,$c2);
100 &sqr_add_c2($a[6],$a[4],$c0,$c1,$c2);
101 &sqr_add_c2($a[7],$a[3],$c0,$c1,$c2);
102 &st($c0,&QWPw(10,$rp));
103 ($c0,$c1,$c2)=($c1,$c2,$c0);
104 &mov("zero",$c2);
105
106 &sqr_add_c2($a[6],$a[5],$c0,$c1,$c2);
107 &sqr_add_c2($a[7],$a[4],$c0,$c1,$c2);
108 &st($c0,&QWPw(11,$rp));
109 ($c0,$c1,$c2)=($c1,$c2,$c0);
110 &mov("zero",$c2);
111
112 &sqr_add_c($a[6],$c0,$c1,$c2);
113 &sqr_add_c2($a[7],$a[5],$c0,$c1,$c2);
114 &st($c0,&QWPw(12,$rp));
115 ($c0,$c1,$c2)=($c1,$c2,$c0);
116 &mov("zero",$c2);
117
118 &sqr_add_c2($a[7],$a[6],$c0,$c1,$c2);
119 &st($c0,&QWPw(13,$rp));
120 ($c0,$c1,$c2)=($c1,$c2,$c0);
121 &mov("zero",$c2);
122
123 &sqr_add_c($a[7],$c0,$c1,$c2);
124 &st($c0,&QWPw(14,$rp));
125 &st($c1,&QWPw(15,$rp));
126
127 &function_end($name);
128
129 &fin_pool;
130 }
131
1321;
diff --git a/src/lib/libcrypto/bn/asm/alpha/sub.pl b/src/lib/libcrypto/bn/asm/alpha/sub.pl
new file mode 100644
index 0000000000..d998da5c21
--- /dev/null
+++ b/src/lib/libcrypto/bn/asm/alpha/sub.pl
@@ -0,0 +1,108 @@
1#!/usr/local/bin/perl
2# alpha assember
3
4sub bn_sub_words
5 {
6 local($name)=@_;
7 local($cc,$a,$b,$r);
8
9 &init_pool(4);
10 ($cc)=GR("r0");
11
12 $rp=&wparam(0);
13 $ap=&wparam(1);
14 $bp=&wparam(2);
15 $count=&wparam(3);
16
17 &function_begin($name,"");
18
19 &comment("");
20 &sub($count,4,$count);
21 &mov("zero",$cc);
22 &blt($count,&label("finish"));
23
24 ($a0,$b0)=&NR(2);
25 &ld($a0,&QWPw(0,$ap));
26 &ld($b0,&QWPw(0,$bp));
27
28##########################################################
29 &set_label("loop");
30
31 ($a1,$tmp,$b1,$a2,$b2,$a3,$b3,$o0)=&NR(8);
32 &ld($a1,&QWPw(1,$ap));
33 &cmpult($a0,$b0,$tmp); # will we borrow?
34 &ld($b1,&QWPw(1,$bp));
35 &sub($a0,$b0,$a0); # do the subtract
36 &ld($a2,&QWPw(2,$ap));
37 &cmpult($a0,$cc,$b0); # will we borrow?
38 &ld($b2,&QWPw(2,$bp));
39 &sub($a0,$cc,$o0); # will we borrow?
40 &ld($a3,&QWPw(3,$ap));
41 &add($b0,$tmp,$cc); ($t1,$o1)=&NR(2); &FR($tmp);
42
43 &cmpult($a1,$b1,$t1); # will we borrow?
44 &sub($a1,$b1,$a1); # do the subtract
45 &ld($b3,&QWPw(3,$bp));
46 &cmpult($a1,$cc,$b1); # will we borrow?
47 &sub($a1,$cc,$o1); # will we borrow?
48 &add($b1,$t1,$cc); ($tmp,$o2)=&NR(2); &FR($t1,$a1,$b1);
49
50 &cmpult($a2,$b2,$tmp); # will we borrow?
51 &sub($a2,$b2,$a2); # do the subtract
52 &st($o0,&QWPw(0,$rp)); &FR($o0); # save
53 &cmpult($a2,$cc,$b2); # will we borrow?
54 &sub($a2,$cc,$o2); # will we borrow?
55 &add($b2,$tmp,$cc); ($t3,$o3)=&NR(2); &FR($tmp,$a2,$b2);
56
57 &cmpult($a3,$b3,$t3); # will we borrow?
58 &sub($a3,$b3,$a3); # do the subtract
59 &st($o1,&QWPw(1,$rp)); &FR($o1);
60 &cmpult($a3,$cc,$b3); # will we borrow?
61 &sub($a3,$cc,$o3); # will we borrow?
62 &add($b3,$t3,$cc); &FR($t3,$a3,$b3);
63
64 &st($o2,&QWPw(2,$rp)); &FR($o2);
65 &sub($count,4,$count); # count-=4
66 &st($o3,&QWPw(3,$rp)); &FR($o3);
67 &add($ap,4*$QWS,$ap); # count+=4
68 &add($bp,4*$QWS,$bp); # count+=4
69 &add($rp,4*$QWS,$rp); # count+=4
70
71 &blt($count,&label("finish"));
72 &ld($a0,&QWPw(0,$ap));
73 &ld($b0,&QWPw(0,$bp));
74 &br(&label("loop"));
75##################################################
76 # Do the last 0..3 words
77
78 &set_label("last_loop");
79
80 &ld($a0,&QWPw(0,$ap)); # get a
81 &ld($b0,&QWPw(0,$bp)); # get b
82 &cmpult($a0,$b0,$tmp); # will we borrow?
83 &sub($a0,$b0,$a0); # do the subtract
84 &cmpult($a0,$cc,$b0); # will we borrow?
85 &sub($a0,$cc,$a0); # will we borrow?
86 &st($a0,&QWPw(0,$rp)); # save
87 &add($b0,$tmp,$cc); # add the borrows
88
89 &add($ap,$QWS,$ap);
90 &add($bp,$QWS,$bp);
91 &add($rp,$QWS,$rp);
92 &sub($count,1,$count);
93 &bgt($count,&label("last_loop"));
94 &function_end_A($name);
95
96######################################################
97 &set_label("finish");
98 &add($count,4,$count);
99 &bgt($count,&label("last_loop"));
100
101 &FR($a0,$b0);
102 &set_label("end");
103 &function_end($name);
104
105 &fin_pool;
106 }
107
1081;
diff --git a/src/lib/libcrypto/bn/asm/bn-alpha.pl b/src/lib/libcrypto/bn/asm/bn-alpha.pl
new file mode 100644
index 0000000000..302edf2376
--- /dev/null
+++ b/src/lib/libcrypto/bn/asm/bn-alpha.pl
@@ -0,0 +1,571 @@
1#!/usr/local/bin/perl
2# I have this in perl so I can use more usefull register names and then convert
3# them into alpha registers.
4#
5
6$d=&data();
7$d =~ s/CC/0/g;
8$d =~ s/R1/1/g;
9$d =~ s/R2/2/g;
10$d =~ s/R3/3/g;
11$d =~ s/R4/4/g;
12$d =~ s/L1/5/g;
13$d =~ s/L2/6/g;
14$d =~ s/L3/7/g;
15$d =~ s/L4/8/g;
16$d =~ s/O1/22/g;
17$d =~ s/O2/23/g;
18$d =~ s/O3/24/g;
19$d =~ s/O4/25/g;
20$d =~ s/A1/20/g;
21$d =~ s/A2/21/g;
22$d =~ s/A3/27/g;
23$d =~ s/A4/28/g;
24if (0){
25}
26
27print $d;
28
29sub data
30 {
31 local($data)=<<'EOF';
32
33 # DEC Alpha assember
34 # The bn_div_words is actually gcc output but the other parts are hand done.
35 # Thanks to tzeruch@ceddec.com for sending me the gcc output for
36 # bn_div_words.
37 # I've gone back and re-done most of routines.
38 # The key thing to remeber for the 164 CPU is that while a
39 # multiply operation takes 8 cycles, another one can only be issued
40 # after 4 cycles have elapsed. I've done modification to help
41 # improve this. Also, normally, a ld instruction will not be available
42 # for about 3 cycles.
43 .file 1 "bn_asm.c"
44 .set noat
45gcc2_compiled.:
46__gnu_compiled_c:
47 .text
48 .align 3
49 .globl bn_mul_add_words
50 .ent bn_mul_add_words
51bn_mul_add_words:
52bn_mul_add_words..ng:
53 .frame $30,0,$26,0
54 .prologue 0
55 .align 5
56 subq $18,4,$18
57 bis $31,$31,$CC
58 blt $18,$43 # if we are -1, -2, -3 or -4 goto tail code
59 ldq $A1,0($17) # 1 1
60 ldq $R1,0($16) # 1 1
61 .align 3
62$42:
63 mulq $A1,$19,$L1 # 1 2 1 ######
64 ldq $A2,8($17) # 2 1
65 ldq $R2,8($16) # 2 1
66 umulh $A1,$19,$A1 # 1 2 ######
67 ldq $A3,16($17) # 3 1
68 ldq $R3,16($16) # 3 1
69 mulq $A2,$19,$L2 # 2 2 1 ######
70 ldq $A4,24($17) # 4 1
71 addq $R1,$L1,$R1 # 1 2 2
72 ldq $R4,24($16) # 4 1
73 umulh $A2,$19,$A2 # 2 2 ######
74 cmpult $R1,$L1,$O1 # 1 2 3 1
75 addq $A1,$O1,$A1 # 1 3 1
76 addq $R1,$CC,$R1 # 1 2 3 1
77 mulq $A3,$19,$L3 # 3 2 1 ######
78 cmpult $R1,$CC,$CC # 1 2 3 2
79 addq $R2,$L2,$R2 # 2 2 2
80 addq $A1,$CC,$CC # 1 3 2
81 cmpult $R2,$L2,$O2 # 2 2 3 1
82 addq $A2,$O2,$A2 # 2 3 1
83 umulh $A3,$19,$A3 # 3 2 ######
84 addq $R2,$CC,$R2 # 2 2 3 1
85 cmpult $R2,$CC,$CC # 2 2 3 2
86 subq $18,4,$18
87 mulq $A4,$19,$L4 # 4 2 1 ######
88 addq $A2,$CC,$CC # 2 3 2
89 addq $R3,$L3,$R3 # 3 2 2
90 addq $16,32,$16
91 cmpult $R3,$L3,$O3 # 3 2 3 1
92 stq $R1,-32($16) # 1 2 4
93 umulh $A4,$19,$A4 # 4 2 ######
94 addq $A3,$O3,$A3 # 3 3 1
95 addq $R3,$CC,$R3 # 3 2 3 1
96 stq $R2,-24($16) # 2 2 4
97 cmpult $R3,$CC,$CC # 3 2 3 2
98 stq $R3,-16($16) # 3 2 4
99 addq $R4,$L4,$R4 # 4 2 2
100 addq $A3,$CC,$CC # 3 3 2
101 cmpult $R4,$L4,$O4 # 4 2 3 1
102 addq $17,32,$17
103 addq $A4,$O4,$A4 # 4 3 1
104 addq $R4,$CC,$R4 # 4 2 3 1
105 cmpult $R4,$CC,$CC # 4 2 3 2
106 stq $R4,-8($16) # 4 2 4
107 addq $A4,$CC,$CC # 4 3 2
108 blt $18,$43
109
110 ldq $A1,0($17) # 1 1
111 ldq $R1,0($16) # 1 1
112
113 br $42
114
115 .align 4
116$45:
117 ldq $A1,0($17) # 4 1
118 ldq $R1,0($16) # 4 1
119 mulq $A1,$19,$L1 # 4 2 1
120 subq $18,1,$18
121 addq $16,8,$16
122 addq $17,8,$17
123 umulh $A1,$19,$A1 # 4 2
124 addq $R1,$L1,$R1 # 4 2 2
125 cmpult $R1,$L1,$O1 # 4 2 3 1
126 addq $A1,$O1,$A1 # 4 3 1
127 addq $R1,$CC,$R1 # 4 2 3 1
128 cmpult $R1,$CC,$CC # 4 2 3 2
129 addq $A1,$CC,$CC # 4 3 2
130 stq $R1,-8($16) # 4 2 4
131 bgt $18,$45
132 ret $31,($26),1 # else exit
133
134 .align 4
135$43:
136 addq $18,4,$18
137 bgt $18,$45 # goto tail code
138 ret $31,($26),1 # else exit
139
140 .end bn_mul_add_words
141 .align 3
142 .globl bn_mul_words
143 .ent bn_mul_words
144bn_mul_words:
145bn_mul_words..ng:
146 .frame $30,0,$26,0
147 .prologue 0
148 .align 5
149 subq $18,4,$18
150 bis $31,$31,$CC
151 blt $18,$143 # if we are -1, -2, -3 or -4 goto tail code
152 ldq $A1,0($17) # 1 1
153 .align 3
154$142:
155
156 mulq $A1,$19,$L1 # 1 2 1 #####
157 ldq $A2,8($17) # 2 1
158 ldq $A3,16($17) # 3 1
159 umulh $A1,$19,$A1 # 1 2 #####
160 ldq $A4,24($17) # 4 1
161 mulq $A2,$19,$L2 # 2 2 1 #####
162 addq $L1,$CC,$L1 # 1 2 3 1
163 subq $18,4,$18
164 cmpult $L1,$CC,$CC # 1 2 3 2
165 umulh $A2,$19,$A2 # 2 2 #####
166 addq $A1,$CC,$CC # 1 3 2
167 addq $17,32,$17
168 addq $L2,$CC,$L2 # 2 2 3 1
169 mulq $A3,$19,$L3 # 3 2 1 #####
170 cmpult $L2,$CC,$CC # 2 2 3 2
171 addq $A2,$CC,$CC # 2 3 2
172 addq $16,32,$16
173 umulh $A3,$19,$A3 # 3 2 #####
174 stq $L1,-32($16) # 1 2 4
175 mulq $A4,$19,$L4 # 4 2 1 #####
176 addq $L3,$CC,$L3 # 3 2 3 1
177 stq $L2,-24($16) # 2 2 4
178 cmpult $L3,$CC,$CC # 3 2 3 2
179 umulh $A4,$19,$A4 # 4 2 #####
180 addq $A3,$CC,$CC # 3 3 2
181 stq $L3,-16($16) # 3 2 4
182 addq $L4,$CC,$L4 # 4 2 3 1
183 cmpult $L4,$CC,$CC # 4 2 3 2
184
185 addq $A4,$CC,$CC # 4 3 2
186
187 stq $L4,-8($16) # 4 2 4
188
189 blt $18,$143
190
191 ldq $A1,0($17) # 1 1
192
193 br $142
194
195 .align 4
196$145:
197 ldq $A1,0($17) # 4 1
198 mulq $A1,$19,$L1 # 4 2 1
199 subq $18,1,$18
200 umulh $A1,$19,$A1 # 4 2
201 addq $L1,$CC,$L1 # 4 2 3 1
202 addq $16,8,$16
203 cmpult $L1,$CC,$CC # 4 2 3 2
204 addq $17,8,$17
205 addq $A1,$CC,$CC # 4 3 2
206 stq $L1,-8($16) # 4 2 4
207
208 bgt $18,$145
209 ret $31,($26),1 # else exit
210
211 .align 4
212$143:
213 addq $18,4,$18
214 bgt $18,$145 # goto tail code
215 ret $31,($26),1 # else exit
216
217 .end bn_mul_words
218 .align 3
219 .globl bn_sqr_words
220 .ent bn_sqr_words
221bn_sqr_words:
222bn_sqr_words..ng:
223 .frame $30,0,$26,0
224 .prologue 0
225
226 subq $18,4,$18
227 blt $18,$543 # if we are -1, -2, -3 or -4 goto tail code
228 ldq $A1,0($17) # 1 1
229 .align 3
230$542:
231 mulq $A1,$A1,$L1 ######
232 ldq $A2,8($17) # 1 1
233 subq $18,4
234 umulh $A1,$A1,$R1 ######
235 ldq $A3,16($17) # 1 1
236 mulq $A2,$A2,$L2 ######
237 ldq $A4,24($17) # 1 1
238 stq $L1,0($16) # r[0]
239 umulh $A2,$A2,$R2 ######
240 stq $R1,8($16) # r[1]
241 mulq $A3,$A3,$L3 ######
242 stq $L2,16($16) # r[0]
243 umulh $A3,$A3,$R3 ######
244 stq $R2,24($16) # r[1]
245 mulq $A4,$A4,$L4 ######
246 stq $L3,32($16) # r[0]
247 umulh $A4,$A4,$R4 ######
248 stq $R3,40($16) # r[1]
249
250 addq $16,64,$16
251 addq $17,32,$17
252 stq $L4,-16($16) # r[0]
253 stq $R4,-8($16) # r[1]
254
255 blt $18,$543
256 ldq $A1,0($17) # 1 1
257 br $542
258
259$442:
260 ldq $A1,0($17) # a[0]
261 mulq $A1,$A1,$L1 # a[0]*w low part r2
262 addq $16,16,$16
263 addq $17,8,$17
264 subq $18,1,$18
265 umulh $A1,$A1,$R1 # a[0]*w high part r3
266 stq $L1,-16($16) # r[0]
267 stq $R1,-8($16) # r[1]
268
269 bgt $18,$442
270 ret $31,($26),1 # else exit
271
272 .align 4
273$543:
274 addq $18,4,$18
275 bgt $18,$442 # goto tail code
276 ret $31,($26),1 # else exit
277 .end bn_sqr_words
278
279 .align 3
280 .globl bn_add_words
281 .ent bn_add_words
282bn_add_words:
283bn_add_words..ng:
284 .frame $30,0,$26,0
285 .prologue 0
286
287 subq $19,4,$19
288 bis $31,$31,$CC # carry = 0
289 blt $19,$900
290 ldq $L1,0($17) # a[0]
291 ldq $R1,0($18) # b[1]
292 .align 3
293$901:
294 addq $R1,$L1,$R1 # r=a+b;
295 ldq $L2,8($17) # a[1]
296 cmpult $R1,$L1,$O1 # did we overflow?
297 ldq $R2,8($18) # b[1]
298 addq $R1,$CC,$R1 # c+= overflow
299 ldq $L3,16($17) # a[2]
300 cmpult $R1,$CC,$CC # overflow?
301 ldq $R3,16($18) # b[2]
302 addq $CC,$O1,$CC
303 ldq $L4,24($17) # a[3]
304 addq $R2,$L2,$R2 # r=a+b;
305 ldq $R4,24($18) # b[3]
306 cmpult $R2,$L2,$O2 # did we overflow?
307 addq $R3,$L3,$R3 # r=a+b;
308 addq $R2,$CC,$R2 # c+= overflow
309 cmpult $R3,$L3,$O3 # did we overflow?
310 cmpult $R2,$CC,$CC # overflow?
311 addq $R4,$L4,$R4 # r=a+b;
312 addq $CC,$O2,$CC
313 cmpult $R4,$L4,$O4 # did we overflow?
314 addq $R3,$CC,$R3 # c+= overflow
315 stq $R1,0($16) # r[0]=c
316 cmpult $R3,$CC,$CC # overflow?
317 stq $R2,8($16) # r[1]=c
318 addq $CC,$O3,$CC
319 stq $R3,16($16) # r[2]=c
320 addq $R4,$CC,$R4 # c+= overflow
321 subq $19,4,$19 # loop--
322 cmpult $R4,$CC,$CC # overflow?
323 addq $17,32,$17 # a++
324 addq $CC,$O4,$CC
325 stq $R4,24($16) # r[3]=c
326 addq $18,32,$18 # b++
327 addq $16,32,$16 # r++
328
329 blt $19,$900
330 ldq $L1,0($17) # a[0]
331 ldq $R1,0($18) # b[1]
332 br $901
333 .align 4
334$945:
335 ldq $L1,0($17) # a[0]
336 ldq $R1,0($18) # b[1]
337 addq $R1,$L1,$R1 # r=a+b;
338 subq $19,1,$19 # loop--
339 addq $R1,$CC,$R1 # c+= overflow
340 addq $17,8,$17 # a++
341 cmpult $R1,$L1,$O1 # did we overflow?
342 cmpult $R1,$CC,$CC # overflow?
343 addq $18,8,$18 # b++
344 stq $R1,0($16) # r[0]=c
345 addq $CC,$O1,$CC
346 addq $16,8,$16 # r++
347
348 bgt $19,$945
349 ret $31,($26),1 # else exit
350
351$900:
352 addq $19,4,$19
353 bgt $19,$945 # goto tail code
354 ret $31,($26),1 # else exit
355 .end bn_add_words
356
357 .align 3
358 .globl bn_sub_words
359 .ent bn_sub_words
360bn_sub_words:
361bn_sub_words..ng:
362 .frame $30,0,$26,0
363 .prologue 0
364
365 subq $19,4,$19
366 bis $31,$31,$CC # carry = 0
367 br $800
368 blt $19,$800
369 ldq $L1,0($17) # a[0]
370 ldq $R1,0($18) # b[1]
371 .align 3
372$801:
373 addq $R1,$L1,$R1 # r=a+b;
374 ldq $L2,8($17) # a[1]
375 cmpult $R1,$L1,$O1 # did we overflow?
376 ldq $R2,8($18) # b[1]
377 addq $R1,$CC,$R1 # c+= overflow
378 ldq $L3,16($17) # a[2]
379 cmpult $R1,$CC,$CC # overflow?
380 ldq $R3,16($18) # b[2]
381 addq $CC,$O1,$CC
382 ldq $L4,24($17) # a[3]
383 addq $R2,$L2,$R2 # r=a+b;
384 ldq $R4,24($18) # b[3]
385 cmpult $R2,$L2,$O2 # did we overflow?
386 addq $R3,$L3,$R3 # r=a+b;
387 addq $R2,$CC,$R2 # c+= overflow
388 cmpult $R3,$L3,$O3 # did we overflow?
389 cmpult $R2,$CC,$CC # overflow?
390 addq $R4,$L4,$R4 # r=a+b;
391 addq $CC,$O2,$CC
392 cmpult $R4,$L4,$O4 # did we overflow?
393 addq $R3,$CC,$R3 # c+= overflow
394 stq $R1,0($16) # r[0]=c
395 cmpult $R3,$CC,$CC # overflow?
396 stq $R2,8($16) # r[1]=c
397 addq $CC,$O3,$CC
398 stq $R3,16($16) # r[2]=c
399 addq $R4,$CC,$R4 # c+= overflow
400 subq $19,4,$19 # loop--
401 cmpult $R4,$CC,$CC # overflow?
402 addq $17,32,$17 # a++
403 addq $CC,$O4,$CC
404 stq $R4,24($16) # r[3]=c
405 addq $18,32,$18 # b++
406 addq $16,32,$16 # r++
407
408 blt $19,$800
409 ldq $L1,0($17) # a[0]
410 ldq $R1,0($18) # b[1]
411 br $801
412 .align 4
413$845:
414 ldq $L1,0($17) # a[0]
415 ldq $R1,0($18) # b[1]
416 cmpult $L1,$R1,$O1 # will we borrow?
417 subq $L1,$R1,$R1 # r=a-b;
418 subq $19,1,$19 # loop--
419 cmpult $R1,$CC,$O2 # will we borrow?
420 subq $R1,$CC,$R1 # c+= overflow
421 addq $17,8,$17 # a++
422 addq $18,8,$18 # b++
423 stq $R1,0($16) # r[0]=c
424 addq $O2,$O1,$CC
425 addq $16,8,$16 # r++
426
427 bgt $19,$845
428 ret $31,($26),1 # else exit
429
430$800:
431 addq $19,4,$19
432 bgt $19,$845 # goto tail code
433 ret $31,($26),1 # else exit
434 .end bn_sub_words
435
436 #
437 # What follows was taken directly from the C compiler with a few
438 # hacks to redo the lables.
439 #
440.text
441 .align 3
442 .globl bn_div_words
443 .ent bn_div_words
444bn_div_words:
445 ldgp $29,0($27)
446bn_div_words..ng:
447 lda $30,-48($30)
448 .frame $30,48,$26,0
449 stq $26,0($30)
450 stq $9,8($30)
451 stq $10,16($30)
452 stq $11,24($30)
453 stq $12,32($30)
454 stq $13,40($30)
455 .mask 0x4003e00,-48
456 .prologue 1
457 bis $16,$16,$9
458 bis $17,$17,$10
459 bis $18,$18,$11
460 bis $31,$31,$13
461 bis $31,2,$12
462 bne $11,$119
463 lda $0,-1
464 br $31,$136
465 .align 4
466$119:
467 bis $11,$11,$16
468 jsr $26,BN_num_bits_word
469 ldgp $29,0($26)
470 subq $0,64,$1
471 beq $1,$120
472 bis $31,1,$1
473 sll $1,$0,$1
474 cmpule $9,$1,$1
475 bne $1,$120
476 # lda $16,_IO_stderr_
477 # lda $17,$C32
478 # bis $0,$0,$18
479 # jsr $26,fprintf
480 # ldgp $29,0($26)
481 jsr $26,abort
482 ldgp $29,0($26)
483 .align 4
484$120:
485 bis $31,64,$3
486 cmpult $9,$11,$2
487 subq $3,$0,$1
488 addl $1,$31,$0
489 subq $9,$11,$1
490 cmoveq $2,$1,$9
491 beq $0,$122
492 zapnot $0,15,$2
493 subq $3,$0,$1
494 sll $11,$2,$11
495 sll $9,$2,$3
496 srl $10,$1,$1
497 sll $10,$2,$10
498 bis $3,$1,$9
499$122:
500 srl $11,32,$5
501 zapnot $11,15,$6
502 lda $7,-1
503 .align 5
504$123:
505 srl $9,32,$1
506 subq $1,$5,$1
507 bne $1,$126
508 zapnot $7,15,$27
509 br $31,$127
510 .align 4
511$126:
512 bis $9,$9,$24
513 bis $5,$5,$25
514 divqu $24,$25,$27
515$127:
516 srl $10,32,$4
517 .align 5
518$128:
519 mulq $27,$5,$1
520 subq $9,$1,$3
521 zapnot $3,240,$1
522 bne $1,$129
523 mulq $6,$27,$2
524 sll $3,32,$1
525 addq $1,$4,$1
526 cmpule $2,$1,$2
527 bne $2,$129
528 subq $27,1,$27
529 br $31,$128
530 .align 4
531$129:
532 mulq $27,$6,$1
533 mulq $27,$5,$4
534 srl $1,32,$3
535 sll $1,32,$1
536 addq $4,$3,$4
537 cmpult $10,$1,$2
538 subq $10,$1,$10
539 addq $2,$4,$2
540 cmpult $9,$2,$1
541 bis $2,$2,$4
542 beq $1,$134
543 addq $9,$11,$9
544 subq $27,1,$27
545$134:
546 subl $12,1,$12
547 subq $9,$4,$9
548 beq $12,$124
549 sll $27,32,$13
550 sll $9,32,$2
551 srl $10,32,$1
552 sll $10,32,$10
553 bis $2,$1,$9
554 br $31,$123
555 .align 4
556$124:
557 bis $13,$27,$0
558$136:
559 ldq $26,0($30)
560 ldq $9,8($30)
561 ldq $10,16($30)
562 ldq $11,24($30)
563 ldq $12,32($30)
564 ldq $13,40($30)
565 addq $30,48,$30
566 ret $31,($26),1
567 .end bn_div_words
568EOF
569 return($data);
570 }
571
diff --git a/src/lib/libcrypto/bn/asm/ca.pl b/src/lib/libcrypto/bn/asm/ca.pl
new file mode 100644
index 0000000000..c1ce67a6b4
--- /dev/null
+++ b/src/lib/libcrypto/bn/asm/ca.pl
@@ -0,0 +1,33 @@
1#!/usr/local/bin/perl
2# I have this in perl so I can use more usefull register names and then convert
3# them into alpha registers.
4#
5
6push(@INC,"perlasm","../../perlasm");
7require "alpha.pl";
8require "alpha/mul_add.pl";
9require "alpha/mul.pl";
10require "alpha/sqr.pl";
11require "alpha/add.pl";
12require "alpha/sub.pl";
13require "alpha/mul_c8.pl";
14require "alpha/mul_c4.pl";
15require "alpha/sqr_c4.pl";
16require "alpha/sqr_c8.pl";
17require "alpha/div.pl";
18
19&asm_init($ARGV[0],$0);
20
21&bn_mul_words("bn_mul_words");
22&bn_sqr_words("bn_sqr_words");
23&bn_mul_add_words("bn_mul_add_words");
24&bn_add_words("bn_add_words");
25&bn_sub_words("bn_sub_words");
26&bn_div_words("bn_div_words");
27&bn_mul_comba8("bn_mul_comba8");
28&bn_mul_comba4("bn_mul_comba4");
29&bn_sqr_comba4("bn_sqr_comba4");
30&bn_sqr_comba8("bn_sqr_comba8");
31
32&asm_finish();
33
diff --git a/src/lib/libcrypto/bn/asm/co-alpha.pl b/src/lib/libcrypto/bn/asm/co-alpha.pl
new file mode 100644
index 0000000000..67dad3e3d5
--- /dev/null
+++ b/src/lib/libcrypto/bn/asm/co-alpha.pl
@@ -0,0 +1,116 @@
1#!/usr/local/bin/perl
2# I have this in perl so I can use more usefull register names and then convert
3# them into alpha registers.
4#
5
6push(@INC,"perlasm","../../perlasm");
7require "alpha.pl";
8
9&asm_init($ARGV[0],$0);
10
11print &bn_sub_words("bn_sub_words");
12
13&asm_finish();
14
15sub bn_sub_words
16 {
17 local($name)=@_;
18 local($cc,$a,$b,$r);
19
20 $cc="r0";
21 $a0="r1"; $b0="r5"; $r0="r9"; $tmp="r13";
22 $a1="r2"; $b1="r6"; $r1="r10"; $t1="r14";
23 $a2="r3"; $b2="r7"; $r2="r11";
24 $a3="r4"; $b3="r8"; $r3="r12"; $t3="r15";
25
26 $rp=&wparam(0);
27 $ap=&wparam(1);
28 $bp=&wparam(2);
29 $count=&wparam(3);
30
31 &function_begin($name,"");
32
33 &comment("");
34 &sub($count,4,$count);
35 &mov("zero",$cc);
36 &blt($count,&label("finish"));
37
38 &ld($a0,&QWPw(0,$ap));
39 &ld($b0,&QWPw(0,$bp));
40
41##########################################################
42 &set_label("loop");
43
44 &ld($a1,&QWPw(1,$ap));
45 &cmpult($a0,$b0,$tmp); # will we borrow?
46 &ld($b1,&QWPw(1,$bp));
47 &sub($a0,$b0,$a0); # do the subtract
48 &ld($a2,&QWPw(2,$ap));
49 &cmpult($a0,$cc,$b0); # will we borrow?
50 &ld($b2,&QWPw(2,$bp));
51 &sub($a0,$cc,$a0); # will we borrow?
52 &ld($a3,&QWPw(3,$ap));
53 &add($b0,$tmp,$cc); # add the borrows
54
55 &cmpult($a1,$b1,$t1); # will we borrow?
56 &sub($a1,$b1,$a1); # do the subtract
57 &ld($b3,&QWPw(3,$bp));
58 &cmpult($a1,$cc,$b1); # will we borrow?
59 &sub($a1,$cc,$a1); # will we borrow?
60 &add($b1,$t1,$cc); # add the borrows
61
62 &cmpult($a2,$b2,$tmp); # will we borrow?
63 &sub($a2,$b2,$a2); # do the subtract
64 &st($a0,&QWPw(0,$rp)); # save
65 &cmpult($a2,$cc,$b2); # will we borrow?
66 &sub($a2,$cc,$a2); # will we borrow?
67 &add($b2,$tmp,$cc); # add the borrows
68
69 &cmpult($a3,$b3,$t3); # will we borrow?
70 &sub($a3,$b3,$a3); # do the subtract
71 &st($a1,&QWPw(1,$rp)); # save
72 &cmpult($a3,$cc,$b3); # will we borrow?
73 &sub($a3,$cc,$a3); # will we borrow?
74 &add($b3,$t3,$cc); # add the borrows
75
76 &st($a2,&QWPw(2,$rp)); # save
77 &sub($count,4,$count); # count-=4
78 &st($a3,&QWPw(3,$rp)); # save
79 &add($ap,4*$QWS,$ap); # count+=4
80 &add($bp,4*$QWS,$bp); # count+=4
81 &add($rp,4*$QWS,$rp); # count+=4
82
83 &blt($count,&label("finish"));
84 &ld($a0,&QWPw(0,$ap));
85 &ld($b0,&QWPw(0,$bp));
86 &br(&label("loop"));
87##################################################
88 # Do the last 0..3 words
89
90 &set_label("last_loop");
91
92 &ld($a0,&QWPw(0,$ap)); # get a
93 &ld($b0,&QWPw(0,$bp)); # get b
94 &cmpult($a0,$b0,$tmp); # will we borrow?
95 &sub($a0,$b0,$a0); # do the subtract
96 &cmpult($a0,$cc,$b0); # will we borrow?
97 &sub($a0,$cc,$a0); # will we borrow?
98 &st($a0,&QWPw(0,$rp)); # save
99 &add($b0,$tmp,$cc); # add the borrows
100
101 &add($ap,$QWS,$ap);
102 &add($bp,$QWS,$bp);
103 &add($rp,$QWS,$rp);
104 &sub($count,1,$count);
105 &bgt($count,&label("last_loop"));
106 &function_end_A($name);
107
108######################################################
109 &set_label("finish");
110 &add($count,4,$count);
111 &bgt($count,&label("last_loop"));
112
113 &set_label("end");
114 &function_end($name);
115 }
116
diff --git a/src/lib/libcrypto/bn/asm/mips1.s b/src/lib/libcrypto/bn/asm/mips1.s
new file mode 100644
index 0000000000..44fa1254c7
--- /dev/null
+++ b/src/lib/libcrypto/bn/asm/mips1.s
@@ -0,0 +1,539 @@
1/* This assember is for R2000/R3000 machines, or higher ones that do
2 * no want to do any 64 bit arithmatic.
3 * Make sure that the SSLeay bignum library is compiled with
4 * THIRTY_TWO_BIT set.
5 * This must either be compiled with the system CC, or, if you use GNU gas,
6 * cc -E mips1.s|gas -o mips1.o
7 */
8 .set reorder
9 .set noat
10
11#define R1 $1
12#define CC $2
13#define R2 $3
14#define R3 $8
15#define R4 $9
16#define L1 $10
17#define L2 $11
18#define L3 $12
19#define L4 $13
20#define H1 $14
21#define H2 $15
22#define H3 $24
23#define H4 $25
24
25#define P1 $4
26#define P2 $5
27#define P3 $6
28#define P4 $7
29
30 .align 2
31 .ent bn_mul_add_words
32 .globl bn_mul_add_words
33.text
34bn_mul_add_words:
35 .frame $sp,0,$31
36 .mask 0x00000000,0
37 .fmask 0x00000000,0
38
39 #blt P3,4,$lab34
40
41 subu R1,P3,4
42 move CC,$0
43 bltz R1,$lab34
44$lab2:
45 lw R1,0(P1)
46 lw L1,0(P2)
47 lw R2,4(P1)
48 lw L2,4(P2)
49 lw R3,8(P1)
50 lw L3,8(P2)
51 lw R4,12(P1)
52 lw L4,12(P2)
53 multu L1,P4
54 addu R1,R1,CC
55 mflo L1
56 sltu CC,R1,CC
57 addu R1,R1,L1
58 mfhi H1
59 sltu L1,R1,L1
60 sw R1,0(P1)
61 addu CC,CC,L1
62 multu L2,P4
63 addu CC,H1,CC
64 mflo L2
65 addu R2,R2,CC
66 sltu CC,R2,CC
67 mfhi H2
68 addu R2,R2,L2
69 addu P2,P2,16
70 sltu L2,R2,L2
71 sw R2,4(P1)
72 addu CC,CC,L2
73 multu L3,P4
74 addu CC,H2,CC
75 mflo L3
76 addu R3,R3,CC
77 sltu CC,R3,CC
78 mfhi H3
79 addu R3,R3,L3
80 addu P1,P1,16
81 sltu L3,R3,L3
82 sw R3,-8(P1)
83 addu CC,CC,L3
84 multu L4,P4
85 addu CC,H3,CC
86 mflo L4
87 addu R4,R4,CC
88 sltu CC,R4,CC
89 mfhi H4
90 addu R4,R4,L4
91 subu P3,P3,4
92 sltu L4,R4,L4
93 addu CC,CC,L4
94 addu CC,H4,CC
95
96 subu R1,P3,4
97 sw R4,-4(P1) # delay slot
98 bgez R1,$lab2
99
100 bleu P3,0,$lab3
101 .align 2
102$lab33:
103 lw L1,0(P2)
104 lw R1,0(P1)
105 multu L1,P4
106 addu R1,R1,CC
107 sltu CC,R1,CC
108 addu P1,P1,4
109 mflo L1
110 mfhi H1
111 addu R1,R1,L1
112 addu P2,P2,4
113 sltu L1,R1,L1
114 subu P3,P3,1
115 addu CC,CC,L1
116 sw R1,-4(P1)
117 addu CC,H1,CC
118 bgtz P3,$lab33
119 j $31
120 .align 2
121$lab3:
122 j $31
123 .align 2
124$lab34:
125 bgt P3,0,$lab33
126 j $31
127 .end bn_mul_add_words
128
129 .align 2
130 # Program Unit: bn_mul_words
131 .ent bn_mul_words
132 .globl bn_mul_words
133.text
134bn_mul_words:
135 .frame $sp,0,$31
136 .mask 0x00000000,0
137 .fmask 0x00000000,0
138
139 subu P3,P3,4
140 move CC,$0
141 bltz P3,$lab45
142$lab44:
143 lw L1,0(P2)
144 lw L2,4(P2)
145 lw L3,8(P2)
146 lw L4,12(P2)
147 multu L1,P4
148 subu P3,P3,4
149 mflo L1
150 mfhi H1
151 addu L1,L1,CC
152 multu L2,P4
153 sltu CC,L1,CC
154 sw L1,0(P1)
155 addu CC,H1,CC
156 mflo L2
157 mfhi H2
158 addu L2,L2,CC
159 multu L3,P4
160 sltu CC,L2,CC
161 sw L2,4(P1)
162 addu CC,H2,CC
163 mflo L3
164 mfhi H3
165 addu L3,L3,CC
166 multu L4,P4
167 sltu CC,L3,CC
168 sw L3,8(P1)
169 addu CC,H3,CC
170 mflo L4
171 mfhi H4
172 addu L4,L4,CC
173 addu P1,P1,16
174 sltu CC,L4,CC
175 addu P2,P2,16
176 addu CC,H4,CC
177 sw L4,-4(P1)
178
179 bgez P3,$lab44
180 b $lab45
181$lab46:
182 lw L1,0(P2)
183 addu P1,P1,4
184 multu L1,P4
185 addu P2,P2,4
186 mflo L1
187 mfhi H1
188 addu L1,L1,CC
189 subu P3,P3,1
190 sltu CC,L1,CC
191 sw L1,-4(P1)
192 addu CC,H1,CC
193 bgtz P3,$lab46
194 j $31
195$lab45:
196 addu P3,P3,4
197 bgtz P3,$lab46
198 j $31
199 .align 2
200 .end bn_mul_words
201
202 # Program Unit: bn_sqr_words
203 .ent bn_sqr_words
204 .globl bn_sqr_words
205.text
206bn_sqr_words:
207 .frame $sp,0,$31
208 .mask 0x00000000,0
209 .fmask 0x00000000,0
210
211 subu P3,P3,4
212 bltz P3,$lab55
213$lab54:
214 lw L1,0(P2)
215 lw L2,4(P2)
216 lw L3,8(P2)
217 lw L4,12(P2)
218
219 multu L1,L1
220 subu P3,P3,4
221 mflo L1
222 mfhi H1
223 sw L1,0(P1)
224 sw H1,4(P1)
225
226 multu L2,L2
227 addu P1,P1,32
228 mflo L2
229 mfhi H2
230 sw L2,-24(P1)
231 sw H2,-20(P1)
232
233 multu L3,L3
234 addu P2,P2,16
235 mflo L3
236 mfhi H3
237 sw L3,-16(P1)
238 sw H3,-12(P1)
239
240 multu L4,L4
241
242 mflo L4
243 mfhi H4
244 sw L4,-8(P1)
245 sw H4,-4(P1)
246
247 bgtz P3,$lab54
248 b $lab55
249$lab56:
250 lw L1,0(P2)
251 addu P1,P1,8
252 multu L1,L1
253 addu P2,P2,4
254 subu P3,P3,1
255 mflo L1
256 mfhi H1
257 sw L1,-8(P1)
258 sw H1,-4(P1)
259
260 bgtz P3,$lab56
261 j $31
262$lab55:
263 addu P3,P3,4
264 bgtz P3,$lab56
265 j $31
266 .align 2
267 .end bn_sqr_words
268
269 # Program Unit: bn_add_words
270 .ent bn_add_words
271 .globl bn_add_words
272.text
273bn_add_words: # 0x590
274 .frame $sp,0,$31
275 .mask 0x00000000,0
276 .fmask 0x00000000,0
277
278 subu P4,P4,4
279 move CC,$0
280 bltz P4,$lab65
281$lab64:
282 lw L1,0(P2)
283 lw R1,0(P3)
284 lw L2,4(P2)
285 lw R2,4(P3)
286
287 addu L1,L1,CC
288 lw L3,8(P2)
289 sltu CC,L1,CC
290 addu L1,L1,R1
291 sltu R1,L1,R1
292 lw R3,8(P3)
293 addu CC,CC,R1
294 lw L4,12(P2)
295
296 addu L2,L2,CC
297 lw R4,12(P3)
298 sltu CC,L2,CC
299 addu L2,L2,R2
300 sltu R2,L2,R2
301 sw L1,0(P1)
302 addu CC,CC,R2
303 addu P1,P1,16
304 addu L3,L3,CC
305 sw L2,-12(P1)
306
307 sltu CC,L3,CC
308 addu L3,L3,R3
309 sltu R3,L3,R3
310 addu P2,P2,16
311 addu CC,CC,R3
312
313 addu L4,L4,CC
314 addu P3,P3,16
315 sltu CC,L4,CC
316 addu L4,L4,R4
317 subu P4,P4,4
318 sltu R4,L4,R4
319 sw L3,-8(P1)
320 addu CC,CC,R4
321 sw L4,-4(P1)
322
323 bgtz P4,$lab64
324 b $lab65
325$lab66:
326 lw L1,0(P2)
327 lw R1,0(P3)
328 addu L1,L1,CC
329 addu P1,P1,4
330 sltu CC,L1,CC
331 addu P2,P2,4
332 addu P3,P3,4
333 addu L1,L1,R1
334 subu P4,P4,1
335 sltu R1,L1,R1
336 sw L1,-4(P1)
337 addu CC,CC,R1
338
339 bgtz P4,$lab66
340 j $31
341$lab65:
342 addu P4,P4,4
343 bgtz P4,$lab66
344 j $31
345 .end bn_add_words
346
347 # Program Unit: bn_div64
348 .set at
349 .set reorder
350 .text
351 .align 2
352 .globl bn_div64
353 # 321 {
354 .ent bn_div64 2
355bn_div64:
356 subu $sp, 64
357 sw $31, 56($sp)
358 sw $16, 48($sp)
359 .mask 0x80010000, -56
360 .frame $sp, 64, $31
361 move $9, $4
362 move $12, $5
363 move $16, $6
364 # 322 BN_ULONG dh,dl,q,ret=0,th,tl,t;
365 move $31, $0
366 # 323 int i,count=2;
367 li $13, 2
368 # 324
369 # 325 if (d == 0) return(BN_MASK2);
370 bne $16, 0, $80
371 li $2, -1
372 b $93
373$80:
374 # 326
375 # 327 i=BN_num_bits_word(d);
376 move $4, $16
377 sw $31, 16($sp)
378 sw $9, 24($sp)
379 sw $12, 32($sp)
380 sw $13, 40($sp)
381 .livereg 0x800ff0e,0xfff
382 jal BN_num_bits_word
383 li $4, 32
384 lw $31, 16($sp)
385 lw $9, 24($sp)
386 lw $12, 32($sp)
387 lw $13, 40($sp)
388 move $3, $2
389 # 328 if ((i != BN_BITS2) && (h > (BN_ULONG)1<<i))
390 beq $2, $4, $81
391 li $14, 1
392 sll $15, $14, $2
393 bleu $9, $15, $81
394 # 329 {
395 # 330 #if !defined(NO_STDIO) && !defined(WIN16)
396 # 331 fprintf(stderr,"Division would overflow (%d)\n",i);
397 # 332 #endif
398 # 333 abort();
399 sw $3, 8($sp)
400 sw $9, 24($sp)
401 sw $12, 32($sp)
402 sw $13, 40($sp)
403 sw $31, 26($sp)
404 .livereg 0xff0e,0xfff
405 jal abort
406 lw $3, 8($sp)
407 li $4, 32
408 lw $9, 24($sp)
409 lw $12, 32($sp)
410 lw $13, 40($sp)
411 lw $31, 26($sp)
412 # 334 }
413$81:
414 # 335 i=BN_BITS2-i;
415 subu $3, $4, $3
416 # 336 if (h >= d) h-=d;
417 bltu $9, $16, $82
418 subu $9, $9, $16
419$82:
420 # 337
421 # 338 if (i)
422 beq $3, 0, $83
423 # 339 {
424 # 340 d<<=i;
425 sll $16, $16, $3
426 # 341 h=(h<<i)|(l>>(BN_BITS2-i));
427 sll $24, $9, $3
428 subu $25, $4, $3
429 srl $14, $12, $25
430 or $9, $24, $14
431 # 342 l<<=i;
432 sll $12, $12, $3
433 # 343 }
434$83:
435 # 344 dh=(d&BN_MASK2h)>>BN_BITS4;
436 # 345 dl=(d&BN_MASK2l);
437 and $8, $16, -65536
438 srl $8, $8, 16
439 and $10, $16, 65535
440 li $6, -65536
441$84:
442 # 346 for (;;)
443 # 347 {
444 # 348 if ((h>>BN_BITS4) == dh)
445 srl $15, $9, 16
446 bne $8, $15, $85
447 # 349 q=BN_MASK2l;
448 li $5, 65535
449 b $86
450$85:
451 # 350 else
452 # 351 q=h/dh;
453 divu $5, $9, $8
454$86:
455 # 352
456 # 353 for (;;)
457 # 354 {
458 # 355 t=(h-q*dh);
459 mul $4, $5, $8
460 subu $2, $9, $4
461 move $3, $2
462 # 356 if ((t&BN_MASK2h) ||
463 # 357 ((dl*q) <= (
464 # 358 (t<<BN_BITS4)+
465 # 359 ((l&BN_MASK2h)>>BN_BITS4))))
466 and $25, $2, $6
467 bne $25, $0, $87
468 mul $24, $10, $5
469 sll $14, $3, 16
470 and $15, $12, $6
471 srl $25, $15, 16
472 addu $15, $14, $25
473 bgtu $24, $15, $88
474$87:
475 # 360 break;
476 mul $3, $10, $5
477 b $89
478$88:
479 # 361 q--;
480 addu $5, $5, -1
481 # 362 }
482 b $86
483$89:
484 # 363 th=q*dh;
485 # 364 tl=q*dl;
486 # 365 t=(tl>>BN_BITS4);
487 # 366 tl=(tl<<BN_BITS4)&BN_MASK2h;
488 sll $14, $3, 16
489 and $2, $14, $6
490 move $11, $2
491 # 367 th+=t;
492 srl $25, $3, 16
493 addu $7, $4, $25
494 # 368
495 # 369 if (l < tl) th++;
496 bgeu $12, $2, $90
497 addu $7, $7, 1
498$90:
499 # 370 l-=tl;
500 subu $12, $12, $11
501 # 371 if (h < th)
502 bgeu $9, $7, $91
503 # 372 {
504 # 373 h+=d;
505 addu $9, $9, $16
506 # 374 q--;
507 addu $5, $5, -1
508 # 375 }
509$91:
510 # 376 h-=th;
511 subu $9, $9, $7
512 # 377
513 # 378 if (--count == 0) break;
514 addu $13, $13, -1
515 beq $13, 0, $92
516 # 379
517 # 380 ret=q<<BN_BITS4;
518 sll $31, $5, 16
519 # 381 h=((h<<BN_BITS4)|(l>>BN_BITS4))&BN_MASK2;
520 sll $24, $9, 16
521 srl $15, $12, 16
522 or $9, $24, $15
523 # 382 l=(l&BN_MASK2l)<<BN_BITS4;
524 and $12, $12, 65535
525 sll $12, $12, 16
526 # 383 }
527 b $84
528$92:
529 # 384 ret|=q;
530 or $31, $31, $5
531 # 385 return(ret);
532 move $2, $31
533$93:
534 lw $16, 48($sp)
535 lw $31, 56($sp)
536 addu $sp, 64
537 j $31
538 .end bn_div64
539
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/pa-risc.s b/src/lib/libcrypto/bn/asm/pa-risc.s
new file mode 100644
index 0000000000..775130a191
--- /dev/null
+++ b/src/lib/libcrypto/bn/asm/pa-risc.s
@@ -0,0 +1,710 @@
1 .SPACE $PRIVATE$
2 .SUBSPA $DATA$,QUAD=1,ALIGN=8,ACCESS=31
3 .SUBSPA $BSS$,QUAD=1,ALIGN=8,ACCESS=31,ZERO,SORT=82
4 .SPACE $TEXT$
5 .SUBSPA $LIT$,QUAD=0,ALIGN=8,ACCESS=44
6 .SUBSPA $CODE$,QUAD=0,ALIGN=8,ACCESS=44,CODE_ONLY
7 .IMPORT $global$,DATA
8 .IMPORT $$dyncall,MILLICODE
9; gcc_compiled.:
10 .SPACE $TEXT$
11 .SUBSPA $CODE$
12
13 .align 4
14 .EXPORT bn_mul_add_words,ENTRY,PRIV_LEV=3,ARGW0=GR,ARGW1=GR,ARGW2=GR,ARGW3=GR,RTNVAL=GR
15bn_mul_add_words
16 .PROC
17 .CALLINFO FRAME=0,CALLS,SAVE_RP
18 .ENTRY
19 stw %r2,-20(0,%r30)
20 ldi 0,%r28
21 extru %r23,31,16,%r2
22 stw %r2,-16(0,%r30)
23 extru %r23,15,16,%r23
24 ldil L'65536,%r31
25 fldws -16(0,%r30),%fr11R
26 stw %r23,-16(0,%r30)
27 ldo 12(%r25),%r29
28 ldo 12(%r26),%r23
29 fldws -16(0,%r30),%fr11L
30L$0002
31 ldw 0(0,%r25),%r19
32 extru %r19,31,16,%r20
33 stw %r20,-16(0,%r30)
34 extru %r19,15,16,%r19
35 fldws -16(0,%r30),%fr22L
36 stw %r19,-16(0,%r30)
37 xmpyu %fr22L,%fr11R,%fr8
38 fldws -16(0,%r30),%fr22L
39 fstws %fr8R,-16(0,%r30)
40 xmpyu %fr11R,%fr22L,%fr10
41 ldw -16(0,%r30),%r2
42 stw %r20,-16(0,%r30)
43 xmpyu %fr22L,%fr11L,%fr9
44 fldws -16(0,%r30),%fr22L
45 fstws %fr10R,-16(0,%r30)
46 copy %r2,%r22
47 ldw -16(0,%r30),%r2
48 fstws %fr9R,-16(0,%r30)
49 xmpyu %fr11L,%fr22L,%fr8
50 copy %r2,%r19
51 ldw -16(0,%r30),%r2
52 fstws %fr8R,-16(0,%r30)
53 copy %r2,%r20
54 ldw -16(0,%r30),%r2
55 addl %r2,%r19,%r21
56 comclr,<<= %r19,%r21,0
57 addl %r20,%r31,%r20
58L$0005
59 extru %r21,15,16,%r19
60 addl %r20,%r19,%r20
61 zdep %r21,15,16,%r19
62 addl %r22,%r19,%r22
63 comclr,<<= %r19,%r22,0
64 addi,tr 1,%r20,%r19
65 copy %r20,%r19
66 addl %r22,%r28,%r20
67 comclr,<<= %r28,%r20,0
68 addi 1,%r19,%r19
69 ldw 0(0,%r26),%r28
70 addl %r20,%r28,%r20
71 comclr,<<= %r28,%r20,0
72 addi,tr 1,%r19,%r28
73 copy %r19,%r28
74 addib,= -1,%r24,L$0003
75 stw %r20,0(0,%r26)
76 ldw -8(0,%r29),%r19
77 extru %r19,31,16,%r20
78 stw %r20,-16(0,%r30)
79 extru %r19,15,16,%r19
80 fldws -16(0,%r30),%fr22L
81 stw %r19,-16(0,%r30)
82 xmpyu %fr22L,%fr11R,%fr8
83 fldws -16(0,%r30),%fr22L
84 fstws %fr8R,-16(0,%r30)
85 xmpyu %fr11R,%fr22L,%fr10
86 ldw -16(0,%r30),%r2
87 stw %r20,-16(0,%r30)
88 xmpyu %fr22L,%fr11L,%fr9
89 fldws -16(0,%r30),%fr22L
90 fstws %fr10R,-16(0,%r30)
91 copy %r2,%r22
92 ldw -16(0,%r30),%r2
93 fstws %fr9R,-16(0,%r30)
94 xmpyu %fr11L,%fr22L,%fr8
95 copy %r2,%r19
96 ldw -16(0,%r30),%r2
97 fstws %fr8R,-16(0,%r30)
98 copy %r2,%r20
99 ldw -16(0,%r30),%r2
100 addl %r2,%r19,%r21
101 comclr,<<= %r19,%r21,0
102 addl %r20,%r31,%r20
103L$0010
104 extru %r21,15,16,%r19
105 addl %r20,%r19,%r20
106 zdep %r21,15,16,%r19
107 addl %r22,%r19,%r22
108 comclr,<<= %r19,%r22,0
109 addi,tr 1,%r20,%r19
110 copy %r20,%r19
111 addl %r22,%r28,%r20
112 comclr,<<= %r28,%r20,0
113 addi 1,%r19,%r19
114 ldw -8(0,%r23),%r28
115 addl %r20,%r28,%r20
116 comclr,<<= %r28,%r20,0
117 addi,tr 1,%r19,%r28
118 copy %r19,%r28
119 addib,= -1,%r24,L$0003
120 stw %r20,-8(0,%r23)
121 ldw -4(0,%r29),%r19
122 extru %r19,31,16,%r20
123 stw %r20,-16(0,%r30)
124 extru %r19,15,16,%r19
125 fldws -16(0,%r30),%fr22L
126 stw %r19,-16(0,%r30)
127 xmpyu %fr22L,%fr11R,%fr8
128 fldws -16(0,%r30),%fr22L
129 fstws %fr8R,-16(0,%r30)
130 xmpyu %fr11R,%fr22L,%fr10
131 ldw -16(0,%r30),%r2
132 stw %r20,-16(0,%r30)
133 xmpyu %fr22L,%fr11L,%fr9
134 fldws -16(0,%r30),%fr22L
135 fstws %fr10R,-16(0,%r30)
136 copy %r2,%r22
137 ldw -16(0,%r30),%r2
138 fstws %fr9R,-16(0,%r30)
139 xmpyu %fr11L,%fr22L,%fr8
140 copy %r2,%r19
141 ldw -16(0,%r30),%r2
142 fstws %fr8R,-16(0,%r30)
143 copy %r2,%r20
144 ldw -16(0,%r30),%r2
145 addl %r2,%r19,%r21
146 comclr,<<= %r19,%r21,0
147 addl %r20,%r31,%r20
148L$0015
149 extru %r21,15,16,%r19
150 addl %r20,%r19,%r20
151 zdep %r21,15,16,%r19
152 addl %r22,%r19,%r22
153 comclr,<<= %r19,%r22,0
154 addi,tr 1,%r20,%r19
155 copy %r20,%r19
156 addl %r22,%r28,%r20
157 comclr,<<= %r28,%r20,0
158 addi 1,%r19,%r19
159 ldw -4(0,%r23),%r28
160 addl %r20,%r28,%r20
161 comclr,<<= %r28,%r20,0
162 addi,tr 1,%r19,%r28
163 copy %r19,%r28
164 addib,= -1,%r24,L$0003
165 stw %r20,-4(0,%r23)
166 ldw 0(0,%r29),%r19
167 extru %r19,31,16,%r20
168 stw %r20,-16(0,%r30)
169 extru %r19,15,16,%r19
170 fldws -16(0,%r30),%fr22L
171 stw %r19,-16(0,%r30)
172 xmpyu %fr22L,%fr11R,%fr8
173 fldws -16(0,%r30),%fr22L
174 fstws %fr8R,-16(0,%r30)
175 xmpyu %fr11R,%fr22L,%fr10
176 ldw -16(0,%r30),%r2
177 stw %r20,-16(0,%r30)
178 xmpyu %fr22L,%fr11L,%fr9
179 fldws -16(0,%r30),%fr22L
180 fstws %fr10R,-16(0,%r30)
181 copy %r2,%r22
182 ldw -16(0,%r30),%r2
183 fstws %fr9R,-16(0,%r30)
184 xmpyu %fr11L,%fr22L,%fr8
185 copy %r2,%r19
186 ldw -16(0,%r30),%r2
187 fstws %fr8R,-16(0,%r30)
188 copy %r2,%r20
189 ldw -16(0,%r30),%r2
190 addl %r2,%r19,%r21
191 comclr,<<= %r19,%r21,0
192 addl %r20,%r31,%r20
193L$0020
194 extru %r21,15,16,%r19
195 addl %r20,%r19,%r20
196 zdep %r21,15,16,%r19
197 addl %r22,%r19,%r22
198 comclr,<<= %r19,%r22,0
199 addi,tr 1,%r20,%r19
200 copy %r20,%r19
201 addl %r22,%r28,%r20
202 comclr,<<= %r28,%r20,0
203 addi 1,%r19,%r19
204 ldw 0(0,%r23),%r28
205 addl %r20,%r28,%r20
206 comclr,<<= %r28,%r20,0
207 addi,tr 1,%r19,%r28
208 copy %r19,%r28
209 addib,= -1,%r24,L$0003
210 stw %r20,0(0,%r23)
211 ldo 16(%r29),%r29
212 ldo 16(%r25),%r25
213 ldo 16(%r23),%r23
214 bl L$0002,0
215 ldo 16(%r26),%r26
216L$0003
217 ldw -20(0,%r30),%r2
218 bv,n 0(%r2)
219 .EXIT
220 .PROCEND
221 .align 4
222 .EXPORT bn_mul_words,ENTRY,PRIV_LEV=3,ARGW0=GR,ARGW1=GR,ARGW2=GR,ARGW3=GR,RTNVAL=GR
223bn_mul_words
224 .PROC
225 .CALLINFO FRAME=0,CALLS,SAVE_RP
226 .ENTRY
227 stw %r2,-20(0,%r30)
228 ldi 0,%r28
229 extru %r23,31,16,%r2
230 stw %r2,-16(0,%r30)
231 extru %r23,15,16,%r23
232 ldil L'65536,%r31
233 fldws -16(0,%r30),%fr11R
234 stw %r23,-16(0,%r30)
235 ldo 12(%r26),%r29
236 ldo 12(%r25),%r23
237 fldws -16(0,%r30),%fr11L
238L$0026
239 ldw 0(0,%r25),%r19
240 extru %r19,31,16,%r20
241 stw %r20,-16(0,%r30)
242 extru %r19,15,16,%r19
243 fldws -16(0,%r30),%fr22L
244 stw %r19,-16(0,%r30)
245 xmpyu %fr22L,%fr11R,%fr8
246 fldws -16(0,%r30),%fr22L
247 fstws %fr8R,-16(0,%r30)
248 xmpyu %fr11R,%fr22L,%fr10
249 ldw -16(0,%r30),%r2
250 stw %r20,-16(0,%r30)
251 xmpyu %fr22L,%fr11L,%fr9
252 fldws -16(0,%r30),%fr22L
253 fstws %fr10R,-16(0,%r30)
254 copy %r2,%r22
255 ldw -16(0,%r30),%r2
256 fstws %fr9R,-16(0,%r30)
257 xmpyu %fr11L,%fr22L,%fr8
258 copy %r2,%r19
259 ldw -16(0,%r30),%r2
260 fstws %fr8R,-16(0,%r30)
261 copy %r2,%r20
262 ldw -16(0,%r30),%r2
263 addl %r2,%r19,%r21
264 comclr,<<= %r19,%r21,0
265 addl %r20,%r31,%r20
266L$0029
267 extru %r21,15,16,%r19
268 addl %r20,%r19,%r20
269 zdep %r21,15,16,%r19
270 addl %r22,%r19,%r22
271 comclr,<<= %r19,%r22,0
272 addi,tr 1,%r20,%r19
273 copy %r20,%r19
274 addl %r22,%r28,%r20
275 comclr,<<= %r28,%r20,0
276 addi,tr 1,%r19,%r28
277 copy %r19,%r28
278 addib,= -1,%r24,L$0027
279 stw %r20,0(0,%r26)
280 ldw -8(0,%r23),%r19
281 extru %r19,31,16,%r20
282 stw %r20,-16(0,%r30)
283 extru %r19,15,16,%r19
284 fldws -16(0,%r30),%fr22L
285 stw %r19,-16(0,%r30)
286 xmpyu %fr22L,%fr11R,%fr8
287 fldws -16(0,%r30),%fr22L
288 fstws %fr8R,-16(0,%r30)
289 xmpyu %fr11R,%fr22L,%fr10
290 ldw -16(0,%r30),%r2
291 stw %r20,-16(0,%r30)
292 xmpyu %fr22L,%fr11L,%fr9
293 fldws -16(0,%r30),%fr22L
294 fstws %fr10R,-16(0,%r30)
295 copy %r2,%r22
296 ldw -16(0,%r30),%r2
297 fstws %fr9R,-16(0,%r30)
298 xmpyu %fr11L,%fr22L,%fr8
299 copy %r2,%r19
300 ldw -16(0,%r30),%r2
301 fstws %fr8R,-16(0,%r30)
302 copy %r2,%r20
303 ldw -16(0,%r30),%r2
304 addl %r2,%r19,%r21
305 comclr,<<= %r19,%r21,0
306 addl %r20,%r31,%r20
307L$0033
308 extru %r21,15,16,%r19
309 addl %r20,%r19,%r20
310 zdep %r21,15,16,%r19
311 addl %r22,%r19,%r22
312 comclr,<<= %r19,%r22,0
313 addi,tr 1,%r20,%r19
314 copy %r20,%r19
315 addl %r22,%r28,%r20
316 comclr,<<= %r28,%r20,0
317 addi,tr 1,%r19,%r28
318 copy %r19,%r28
319 addib,= -1,%r24,L$0027
320 stw %r20,-8(0,%r29)
321 ldw -4(0,%r23),%r19
322 extru %r19,31,16,%r20
323 stw %r20,-16(0,%r30)
324 extru %r19,15,16,%r19
325 fldws -16(0,%r30),%fr22L
326 stw %r19,-16(0,%r30)
327 xmpyu %fr22L,%fr11R,%fr8
328 fldws -16(0,%r30),%fr22L
329 fstws %fr8R,-16(0,%r30)
330 xmpyu %fr11R,%fr22L,%fr10
331 ldw -16(0,%r30),%r2
332 stw %r20,-16(0,%r30)
333 xmpyu %fr22L,%fr11L,%fr9
334 fldws -16(0,%r30),%fr22L
335 fstws %fr10R,-16(0,%r30)
336 copy %r2,%r22
337 ldw -16(0,%r30),%r2
338 fstws %fr9R,-16(0,%r30)
339 xmpyu %fr11L,%fr22L,%fr8
340 copy %r2,%r19
341 ldw -16(0,%r30),%r2
342 fstws %fr8R,-16(0,%r30)
343 copy %r2,%r20
344 ldw -16(0,%r30),%r2
345 addl %r2,%r19,%r21
346 comclr,<<= %r19,%r21,0
347 addl %r20,%r31,%r20
348L$0037
349 extru %r21,15,16,%r19
350 addl %r20,%r19,%r20
351 zdep %r21,15,16,%r19
352 addl %r22,%r19,%r22
353 comclr,<<= %r19,%r22,0
354 addi,tr 1,%r20,%r19
355 copy %r20,%r19
356 addl %r22,%r28,%r20
357 comclr,<<= %r28,%r20,0
358 addi,tr 1,%r19,%r28
359 copy %r19,%r28
360 addib,= -1,%r24,L$0027
361 stw %r20,-4(0,%r29)
362 ldw 0(0,%r23),%r19
363 extru %r19,31,16,%r20
364 stw %r20,-16(0,%r30)
365 extru %r19,15,16,%r19
366 fldws -16(0,%r30),%fr22L
367 stw %r19,-16(0,%r30)
368 xmpyu %fr22L,%fr11R,%fr8
369 fldws -16(0,%r30),%fr22L
370 fstws %fr8R,-16(0,%r30)
371 xmpyu %fr11R,%fr22L,%fr10
372 ldw -16(0,%r30),%r2
373 stw %r20,-16(0,%r30)
374 xmpyu %fr22L,%fr11L,%fr9
375 fldws -16(0,%r30),%fr22L
376 fstws %fr10R,-16(0,%r30)
377 copy %r2,%r22
378 ldw -16(0,%r30),%r2
379 fstws %fr9R,-16(0,%r30)
380 xmpyu %fr11L,%fr22L,%fr8
381 copy %r2,%r19
382 ldw -16(0,%r30),%r2
383 fstws %fr8R,-16(0,%r30)
384 copy %r2,%r20
385 ldw -16(0,%r30),%r2
386 addl %r2,%r19,%r21
387 comclr,<<= %r19,%r21,0
388 addl %r20,%r31,%r20
389L$0041
390 extru %r21,15,16,%r19
391 addl %r20,%r19,%r20
392 zdep %r21,15,16,%r19
393 addl %r22,%r19,%r22
394 comclr,<<= %r19,%r22,0
395 addi,tr 1,%r20,%r19
396 copy %r20,%r19
397 addl %r22,%r28,%r20
398 comclr,<<= %r28,%r20,0
399 addi,tr 1,%r19,%r28
400 copy %r19,%r28
401 addib,= -1,%r24,L$0027
402 stw %r20,0(0,%r29)
403 ldo 16(%r23),%r23
404 ldo 16(%r25),%r25
405 ldo 16(%r29),%r29
406 bl L$0026,0
407 ldo 16(%r26),%r26
408L$0027
409 ldw -20(0,%r30),%r2
410 bv,n 0(%r2)
411 .EXIT
412 .PROCEND
413 .align 4
414 .EXPORT bn_sqr_words,ENTRY,PRIV_LEV=3,ARGW0=GR,ARGW1=GR,ARGW2=GR
415bn_sqr_words
416 .PROC
417 .CALLINFO FRAME=0,NO_CALLS
418 .ENTRY
419 ldo 28(%r26),%r23
420 ldo 12(%r25),%r28
421L$0046
422 ldw 0(0,%r25),%r21
423 extru %r21,31,16,%r22
424 stw %r22,-16(0,%r30)
425 extru %r21,15,16,%r21
426 fldws -16(0,%r30),%fr10L
427 stw %r21,-16(0,%r30)
428 fldws -16(0,%r30),%fr10R
429 xmpyu %fr10L,%fr10R,%fr8
430 fstws %fr8R,-16(0,%r30)
431 ldw -16(0,%r30),%r29
432 stw %r22,-16(0,%r30)
433 fldws -16(0,%r30),%fr10R
434 stw %r21,-16(0,%r30)
435 copy %r29,%r19
436 xmpyu %fr10L,%fr10R,%fr8
437 fldws -16(0,%r30),%fr10L
438 stw %r21,-16(0,%r30)
439 fldws -16(0,%r30),%fr10R
440 fstws %fr8R,-16(0,%r30)
441 extru %r19,16,17,%r20
442 zdep %r19,14,15,%r19
443 ldw -16(0,%r30),%r29
444 xmpyu %fr10L,%fr10R,%fr9
445 addl %r29,%r19,%r22
446 stw %r22,0(0,%r26)
447 fstws %fr9R,-16(0,%r30)
448 ldw -16(0,%r30),%r29
449 addl %r29,%r20,%r21
450 comclr,<<= %r19,%r22,0
451 addi 1,%r21,%r21
452 addib,= -1,%r24,L$0057
453 stw %r21,-24(0,%r23)
454 ldw -8(0,%r28),%r21
455 extru %r21,31,16,%r22
456 stw %r22,-16(0,%r30)
457 extru %r21,15,16,%r21
458 fldws -16(0,%r30),%fr10L
459 stw %r21,-16(0,%r30)
460 fldws -16(0,%r30),%fr10R
461 xmpyu %fr10L,%fr10R,%fr8
462 fstws %fr8R,-16(0,%r30)
463 ldw -16(0,%r30),%r29
464 stw %r22,-16(0,%r30)
465 fldws -16(0,%r30),%fr10R
466 stw %r21,-16(0,%r30)
467 copy %r29,%r19
468 xmpyu %fr10L,%fr10R,%fr8
469 fldws -16(0,%r30),%fr10L
470 stw %r21,-16(0,%r30)
471 fldws -16(0,%r30),%fr10R
472 fstws %fr8R,-16(0,%r30)
473 extru %r19,16,17,%r20
474 zdep %r19,14,15,%r19
475 ldw -16(0,%r30),%r29
476 xmpyu %fr10L,%fr10R,%fr9
477 addl %r29,%r19,%r22
478 stw %r22,-20(0,%r23)
479 fstws %fr9R,-16(0,%r30)
480 ldw -16(0,%r30),%r29
481 addl %r29,%r20,%r21
482 comclr,<<= %r19,%r22,0
483 addi 1,%r21,%r21
484 addib,= -1,%r24,L$0057
485 stw %r21,-16(0,%r23)
486 ldw -4(0,%r28),%r21
487 extru %r21,31,16,%r22
488 stw %r22,-16(0,%r30)
489 extru %r21,15,16,%r21
490 fldws -16(0,%r30),%fr10L
491 stw %r21,-16(0,%r30)
492 fldws -16(0,%r30),%fr10R
493 xmpyu %fr10L,%fr10R,%fr8
494 fstws %fr8R,-16(0,%r30)
495 ldw -16(0,%r30),%r29
496 stw %r22,-16(0,%r30)
497 fldws -16(0,%r30),%fr10R
498 stw %r21,-16(0,%r30)
499 copy %r29,%r19
500 xmpyu %fr10L,%fr10R,%fr8
501 fldws -16(0,%r30),%fr10L
502 stw %r21,-16(0,%r30)
503 fldws -16(0,%r30),%fr10R
504 fstws %fr8R,-16(0,%r30)
505 extru %r19,16,17,%r20
506 zdep %r19,14,15,%r19
507 ldw -16(0,%r30),%r29
508 xmpyu %fr10L,%fr10R,%fr9
509 addl %r29,%r19,%r22
510 stw %r22,-12(0,%r23)
511 fstws %fr9R,-16(0,%r30)
512 ldw -16(0,%r30),%r29
513 addl %r29,%r20,%r21
514 comclr,<<= %r19,%r22,0
515 addi 1,%r21,%r21
516 addib,= -1,%r24,L$0057
517 stw %r21,-8(0,%r23)
518 ldw 0(0,%r28),%r21
519 extru %r21,31,16,%r22
520 stw %r22,-16(0,%r30)
521 extru %r21,15,16,%r21
522 fldws -16(0,%r30),%fr10L
523 stw %r21,-16(0,%r30)
524 fldws -16(0,%r30),%fr10R
525 xmpyu %fr10L,%fr10R,%fr8
526 fstws %fr8R,-16(0,%r30)
527 ldw -16(0,%r30),%r29
528 stw %r22,-16(0,%r30)
529 fldws -16(0,%r30),%fr10R
530 stw %r21,-16(0,%r30)
531 copy %r29,%r19
532 xmpyu %fr10L,%fr10R,%fr8
533 fldws -16(0,%r30),%fr10L
534 stw %r21,-16(0,%r30)
535 fldws -16(0,%r30),%fr10R
536 fstws %fr8R,-16(0,%r30)
537 extru %r19,16,17,%r20
538 zdep %r19,14,15,%r19
539 ldw -16(0,%r30),%r29
540 xmpyu %fr10L,%fr10R,%fr9
541 addl %r29,%r19,%r22
542 stw %r22,-4(0,%r23)
543 fstws %fr9R,-16(0,%r30)
544 ldw -16(0,%r30),%r29
545 addl %r29,%r20,%r21
546 comclr,<<= %r19,%r22,0
547 addi 1,%r21,%r21
548 addib,= -1,%r24,L$0057
549 stw %r21,0(0,%r23)
550 ldo 16(%r28),%r28
551 ldo 16(%r25),%r25
552 ldo 32(%r23),%r23
553 bl L$0046,0
554 ldo 32(%r26),%r26
555L$0057
556 bv,n 0(%r2)
557 .EXIT
558 .PROCEND
559 .IMPORT BN_num_bits_word,CODE
560 .IMPORT fprintf,CODE
561 .IMPORT __iob,DATA
562 .SPACE $TEXT$
563 .SUBSPA $LIT$
564
565 .align 4
566L$C0000
567 .STRING "Division would overflow\x0a\x00"
568 .IMPORT abort,CODE
569 .SPACE $TEXT$
570 .SUBSPA $CODE$
571
572 .align 4
573 .EXPORT bn_div64,ENTRY,PRIV_LEV=3,ARGW0=GR,ARGW1=GR,ARGW2=GR,RTNVAL=GR
574bn_div64
575 .PROC
576 .CALLINFO FRAME=128,CALLS,SAVE_RP,ENTRY_GR=8
577 .ENTRY
578 stw %r2,-20(0,%r30)
579 stwm %r8,128(0,%r30)
580 stw %r7,-124(0,%r30)
581 stw %r4,-112(0,%r30)
582 stw %r3,-108(0,%r30)
583 copy %r26,%r3
584 copy %r25,%r4
585 stw %r6,-120(0,%r30)
586 ldi 0,%r7
587 stw %r5,-116(0,%r30)
588 movb,<> %r24,%r5,L$0059
589 ldi 2,%r6
590 bl L$0076,0
591 ldi -1,%r28
592L$0059
593 .CALL ARGW0=GR
594 bl BN_num_bits_word,%r2
595 copy %r5,%r26
596 ldi 32,%r19
597 comb,= %r19,%r28,L$0060
598 subi 31,%r28,%r19
599 mtsar %r19
600 zvdepi 1,32,%r19
601 comb,>>= %r19,%r3,L$0060
602 addil LR'__iob-$global$+32,%r27
603 ldo RR'__iob-$global$+32(%r1),%r26
604 ldil LR'L$C0000,%r25
605 .CALL ARGW0=GR,ARGW1=GR
606 bl fprintf,%r2
607 ldo RR'L$C0000(%r25),%r25
608 .CALL
609 bl abort,%r2
610 nop
611L$0060
612 comb,>> %r5,%r3,L$0061
613 subi 32,%r28,%r28
614 sub %r3,%r5,%r3
615L$0061
616 comib,= 0,%r28,L$0062
617 subi 31,%r28,%r19
618 mtsar %r19
619 zvdep %r5,32,%r5
620 zvdep %r3,32,%r21
621 subi 32,%r28,%r20
622 mtsar %r20
623 vshd 0,%r4,%r20
624 or %r21,%r20,%r3
625 mtsar %r19
626 zvdep %r4,32,%r4
627L$0062
628 extru %r5,15,16,%r23
629 extru %r5,31,16,%r28
630L$0063
631 extru %r3,15,16,%r19
632 comb,<> %r23,%r19,L$0066
633 copy %r3,%r26
634 bl L$0067,0
635 zdepi -1,31,16,%r29
636L$0066
637 .IMPORT $$divU,MILLICODE
638 bl $$divU,%r31
639 copy %r23,%r25
640L$0067
641 stw %r29,-16(0,%r30)
642 fldws -16(0,%r30),%fr10L
643 stw %r28,-16(0,%r30)
644 fldws -16(0,%r30),%fr10R
645 stw %r23,-16(0,%r30)
646 xmpyu %fr10L,%fr10R,%fr8
647 fldws -16(0,%r30),%fr10R
648 fstws %fr8R,-16(0,%r30)
649 xmpyu %fr10L,%fr10R,%fr9
650 ldw -16(0,%r30),%r8
651 fstws %fr9R,-16(0,%r30)
652 copy %r8,%r22
653 ldw -16(0,%r30),%r8
654 extru %r4,15,16,%r24
655 copy %r8,%r21
656L$0068
657 sub %r3,%r21,%r20
658 copy %r20,%r19
659 depi 0,31,16,%r19
660 comib,<> 0,%r19,L$0069
661 zdep %r20,15,16,%r19
662 addl %r19,%r24,%r19
663 comb,>>= %r19,%r22,L$0069
664 sub %r22,%r28,%r22
665 sub %r21,%r23,%r21
666 bl L$0068,0
667 ldo -1(%r29),%r29
668L$0069
669 stw %r29,-16(0,%r30)
670 fldws -16(0,%r30),%fr10L
671 stw %r28,-16(0,%r30)
672 fldws -16(0,%r30),%fr10R
673 xmpyu %fr10L,%fr10R,%fr8
674 fstws %fr8R,-16(0,%r30)
675 ldw -16(0,%r30),%r8
676 stw %r23,-16(0,%r30)
677 fldws -16(0,%r30),%fr10R
678 copy %r8,%r19
679 xmpyu %fr10L,%fr10R,%fr8
680 fstws %fr8R,-16(0,%r30)
681 extru %r19,15,16,%r20
682 ldw -16(0,%r30),%r8
683 zdep %r19,15,16,%r19
684 addl %r8,%r20,%r20
685 comclr,<<= %r19,%r4,0
686 addi 1,%r20,%r20
687 comb,<<= %r20,%r3,L$0074
688 sub %r4,%r19,%r4
689 addl %r3,%r5,%r3
690 ldo -1(%r29),%r29
691L$0074
692 addib,= -1,%r6,L$0064
693 sub %r3,%r20,%r3
694 zdep %r29,15,16,%r7
695 shd %r3,%r4,16,%r3
696 bl L$0063,0
697 zdep %r4,15,16,%r4
698L$0064
699 or %r7,%r29,%r28
700L$0076
701 ldw -148(0,%r30),%r2
702 ldw -124(0,%r30),%r7
703 ldw -120(0,%r30),%r6
704 ldw -116(0,%r30),%r5
705 ldw -112(0,%r30),%r4
706 ldw -108(0,%r30),%r3
707 bv 0(%r2)
708 ldwm -128(0,%r30),%r8
709 .EXIT
710 .PROCEND
diff --git a/src/lib/libcrypto/bn/asm/r3000.s b/src/lib/libcrypto/bn/asm/r3000.s
new file mode 100644
index 0000000000..e95269afa3
--- /dev/null
+++ b/src/lib/libcrypto/bn/asm/r3000.s
@@ -0,0 +1,646 @@
1 .file 1 "../bn_mulw.c"
2 .set nobopt
3 .option pic2
4
5 # GNU C 2.6.3 [AL 1.1, MM 40] SGI running IRIX 5.0 compiled by GNU C
6
7 # Cc1 defaults:
8 # -mabicalls
9
10 # Cc1 arguments (-G value = 0, Cpu = 3000, ISA = 1):
11 # -quiet -dumpbase -O2 -o
12
13gcc2_compiled.:
14__gnu_compiled_c:
15 .rdata
16
17 .byte 0x24,0x52,0x65,0x76,0x69,0x73,0x69,0x6f
18 .byte 0x6e,0x3a,0x20,0x31,0x2e,0x34,0x39,0x20
19 .byte 0x24,0x0
20
21 .byte 0x24,0x52,0x65,0x76,0x69,0x73,0x69,0x6f
22 .byte 0x6e,0x3a,0x20,0x31,0x2e,0x33,0x34,0x20
23 .byte 0x24,0x0
24
25 .byte 0x24,0x52,0x65,0x76,0x69,0x73,0x69,0x6f
26 .byte 0x6e,0x3a,0x20,0x31,0x2e,0x35,0x20,0x24
27 .byte 0x0
28
29 .byte 0x24,0x52,0x65,0x76,0x69,0x73,0x69,0x6f
30 .byte 0x6e,0x3a,0x20,0x31,0x2e,0x38,0x20,0x24
31 .byte 0x0
32
33 .byte 0x24,0x52,0x65,0x76,0x69,0x73,0x69,0x6f
34 .byte 0x6e,0x3a,0x20,0x31,0x2e,0x32,0x33,0x20
35 .byte 0x24,0x0
36
37 .byte 0x24,0x52,0x65,0x76,0x69,0x73,0x69,0x6f
38 .byte 0x6e,0x3a,0x20,0x31,0x2e,0x37,0x38,0x20
39 .byte 0x24,0x0
40
41 .byte 0x24,0x52,0x65,0x76,0x69,0x73,0x69,0x6f
42 .byte 0x6e,0x3a,0x20,0x33,0x2e,0x37,0x30,0x20
43 .byte 0x24,0x0
44
45 .byte 0x24,0x52,0x65,0x76,0x69,0x73,0x69,0x6f
46 .byte 0x6e,0x3a,0x20,0x31,0x2e,0x32,0x20,0x24
47 .byte 0x0
48
49 .byte 0x24,0x52,0x65,0x76,0x69,0x73,0x69,0x6f
50 .byte 0x6e,0x3a,0x20,0x31,0x2e,0x34,0x20,0x24
51 .byte 0x0
52
53 .byte 0x24,0x52,0x65,0x76,0x69,0x73,0x69,0x6f
54 .byte 0x6e,0x3a,0x20,0x31,0x2e,0x38,0x20,0x24
55 .byte 0x0
56 .text
57 .align 2
58 .globl bn_mul_add_words
59 .ent bn_mul_add_words
60bn_mul_add_words:
61 .frame $sp,0,$31 # vars= 0, regs= 0/0, args= 0, extra= 0
62 .mask 0x00000000,0
63 .fmask 0x00000000,0
64 .set noreorder
65 .cpload $25
66 .set reorder
67 move $12,$4
68 move $14,$5
69 move $9,$6
70 move $13,$7
71 move $8,$0
72 addu $10,$12,12
73 addu $11,$14,12
74$L2:
75 lw $6,0($14)
76 #nop
77 multu $13,$6
78 mfhi $6
79 mflo $7
80 #nop
81 move $5,$8
82 move $4,$0
83 lw $3,0($12)
84 addu $9,$9,-1
85 move $2,$0
86 addu $7,$7,$3
87 sltu $8,$7,$3
88 addu $6,$6,$2
89 addu $6,$6,$8
90 addu $7,$7,$5
91 sltu $2,$7,$5
92 addu $6,$6,$4
93 addu $6,$6,$2
94 srl $3,$6,0
95 move $2,$0
96 move $8,$3
97 .set noreorder
98 .set nomacro
99 beq $9,$0,$L3
100 sw $7,0($12)
101 .set macro
102 .set reorder
103
104 lw $6,-8($11)
105 #nop
106 multu $13,$6
107 mfhi $6
108 mflo $7
109 #nop
110 move $5,$8
111 move $4,$0
112 lw $3,-8($10)
113 addu $9,$9,-1
114 move $2,$0
115 addu $7,$7,$3
116 sltu $8,$7,$3
117 addu $6,$6,$2
118 addu $6,$6,$8
119 addu $7,$7,$5
120 sltu $2,$7,$5
121 addu $6,$6,$4
122 addu $6,$6,$2
123 srl $3,$6,0
124 move $2,$0
125 move $8,$3
126 .set noreorder
127 .set nomacro
128 beq $9,$0,$L3
129 sw $7,-8($10)
130 .set macro
131 .set reorder
132
133 lw $6,-4($11)
134 #nop
135 multu $13,$6
136 mfhi $6
137 mflo $7
138 #nop
139 move $5,$8
140 move $4,$0
141 lw $3,-4($10)
142 addu $9,$9,-1
143 move $2,$0
144 addu $7,$7,$3
145 sltu $8,$7,$3
146 addu $6,$6,$2
147 addu $6,$6,$8
148 addu $7,$7,$5
149 sltu $2,$7,$5
150 addu $6,$6,$4
151 addu $6,$6,$2
152 srl $3,$6,0
153 move $2,$0
154 move $8,$3
155 .set noreorder
156 .set nomacro
157 beq $9,$0,$L3
158 sw $7,-4($10)
159 .set macro
160 .set reorder
161
162 lw $6,0($11)
163 #nop
164 multu $13,$6
165 mfhi $6
166 mflo $7
167 #nop
168 move $5,$8
169 move $4,$0
170 lw $3,0($10)
171 addu $9,$9,-1
172 move $2,$0
173 addu $7,$7,$3
174 sltu $8,$7,$3
175 addu $6,$6,$2
176 addu $6,$6,$8
177 addu $7,$7,$5
178 sltu $2,$7,$5
179 addu $6,$6,$4
180 addu $6,$6,$2
181 srl $3,$6,0
182 move $2,$0
183 move $8,$3
184 .set noreorder
185 .set nomacro
186 beq $9,$0,$L3
187 sw $7,0($10)
188 .set macro
189 .set reorder
190
191 addu $11,$11,16
192 addu $14,$14,16
193 addu $10,$10,16
194 .set noreorder
195 .set nomacro
196 j $L2
197 addu $12,$12,16
198 .set macro
199 .set reorder
200
201$L3:
202 .set noreorder
203 .set nomacro
204 j $31
205 move $2,$8
206 .set macro
207 .set reorder
208
209 .end bn_mul_add_words
210 .align 2
211 .globl bn_mul_words
212 .ent bn_mul_words
213bn_mul_words:
214 .frame $sp,0,$31 # vars= 0, regs= 0/0, args= 0, extra= 0
215 .mask 0x00000000,0
216 .fmask 0x00000000,0
217 .set noreorder
218 .cpload $25
219 .set reorder
220 move $11,$4
221 move $12,$5
222 move $8,$6
223 move $6,$0
224 addu $10,$11,12
225 addu $9,$12,12
226$L10:
227 lw $4,0($12)
228 #nop
229 multu $7,$4
230 mfhi $4
231 mflo $5
232 #nop
233 move $3,$6
234 move $2,$0
235 addu $8,$8,-1
236 addu $5,$5,$3
237 sltu $6,$5,$3
238 addu $4,$4,$2
239 addu $4,$4,$6
240 srl $3,$4,0
241 move $2,$0
242 move $6,$3
243 .set noreorder
244 .set nomacro
245 beq $8,$0,$L11
246 sw $5,0($11)
247 .set macro
248 .set reorder
249
250 lw $4,-8($9)
251 #nop
252 multu $7,$4
253 mfhi $4
254 mflo $5
255 #nop
256 move $3,$6
257 move $2,$0
258 addu $8,$8,-1
259 addu $5,$5,$3
260 sltu $6,$5,$3
261 addu $4,$4,$2
262 addu $4,$4,$6
263 srl $3,$4,0
264 move $2,$0
265 move $6,$3
266 .set noreorder
267 .set nomacro
268 beq $8,$0,$L11
269 sw $5,-8($10)
270 .set macro
271 .set reorder
272
273 lw $4,-4($9)
274 #nop
275 multu $7,$4
276 mfhi $4
277 mflo $5
278 #nop
279 move $3,$6
280 move $2,$0
281 addu $8,$8,-1
282 addu $5,$5,$3
283 sltu $6,$5,$3
284 addu $4,$4,$2
285 addu $4,$4,$6
286 srl $3,$4,0
287 move $2,$0
288 move $6,$3
289 .set noreorder
290 .set nomacro
291 beq $8,$0,$L11
292 sw $5,-4($10)
293 .set macro
294 .set reorder
295
296 lw $4,0($9)
297 #nop
298 multu $7,$4
299 mfhi $4
300 mflo $5
301 #nop
302 move $3,$6
303 move $2,$0
304 addu $8,$8,-1
305 addu $5,$5,$3
306 sltu $6,$5,$3
307 addu $4,$4,$2
308 addu $4,$4,$6
309 srl $3,$4,0
310 move $2,$0
311 move $6,$3
312 .set noreorder
313 .set nomacro
314 beq $8,$0,$L11
315 sw $5,0($10)
316 .set macro
317 .set reorder
318
319 addu $9,$9,16
320 addu $12,$12,16
321 addu $10,$10,16
322 .set noreorder
323 .set nomacro
324 j $L10
325 addu $11,$11,16
326 .set macro
327 .set reorder
328
329$L11:
330 .set noreorder
331 .set nomacro
332 j $31
333 move $2,$6
334 .set macro
335 .set reorder
336
337 .end bn_mul_words
338 .align 2
339 .globl bn_sqr_words
340 .ent bn_sqr_words
341bn_sqr_words:
342 .frame $sp,0,$31 # vars= 0, regs= 0/0, args= 0, extra= 0
343 .mask 0x00000000,0
344 .fmask 0x00000000,0
345 .set noreorder
346 .cpload $25
347 .set reorder
348 move $9,$4
349 addu $7,$9,28
350 addu $8,$5,12
351$L18:
352 lw $2,0($5)
353 #nop
354 multu $2,$2
355 mfhi $2
356 mflo $3
357 #nop
358 addu $6,$6,-1
359 sw $3,0($9)
360 srl $3,$2,0
361 move $2,$0
362 .set noreorder
363 .set nomacro
364 beq $6,$0,$L19
365 sw $3,-24($7)
366 .set macro
367 .set reorder
368
369 lw $2,-8($8)
370 #nop
371 multu $2,$2
372 mfhi $2
373 mflo $3
374 #nop
375 addu $6,$6,-1
376 sw $3,-20($7)
377 srl $3,$2,0
378 move $2,$0
379 .set noreorder
380 .set nomacro
381 beq $6,$0,$L19
382 sw $3,-16($7)
383 .set macro
384 .set reorder
385
386 lw $2,-4($8)
387 #nop
388 multu $2,$2
389 mfhi $2
390 mflo $3
391 #nop
392 addu $6,$6,-1
393 sw $3,-12($7)
394 srl $3,$2,0
395 move $2,$0
396 .set noreorder
397 .set nomacro
398 beq $6,$0,$L19
399 sw $3,-8($7)
400 .set macro
401 .set reorder
402
403 lw $2,0($8)
404 #nop
405 multu $2,$2
406 mfhi $2
407 mflo $3
408 #nop
409 addu $6,$6,-1
410 sw $3,-4($7)
411 srl $3,$2,0
412 move $2,$0
413 .set noreorder
414 .set nomacro
415 beq $6,$0,$L19
416 sw $3,0($7)
417 .set macro
418 .set reorder
419
420 addu $8,$8,16
421 addu $5,$5,16
422 addu $7,$7,32
423 .set noreorder
424 .set nomacro
425 j $L18
426 addu $9,$9,32
427 .set macro
428 .set reorder
429
430$L19:
431 j $31
432 .end bn_sqr_words
433 .rdata
434 .align 2
435$LC0:
436
437 .byte 0x44,0x69,0x76,0x69,0x73,0x69,0x6f,0x6e
438 .byte 0x20,0x77,0x6f,0x75,0x6c,0x64,0x20,0x6f
439 .byte 0x76,0x65,0x72,0x66,0x6c,0x6f,0x77,0xa
440 .byte 0x0
441 .text
442 .align 2
443 .globl bn_div64
444 .ent bn_div64
445bn_div64:
446 .frame $sp,56,$31 # vars= 0, regs= 7/0, args= 16, extra= 8
447 .mask 0x901f0000,-8
448 .fmask 0x00000000,0
449 .set noreorder
450 .cpload $25
451 .set reorder
452 subu $sp,$sp,56
453 .cprestore 16
454 sw $16,24($sp)
455 move $16,$4
456 sw $17,28($sp)
457 move $17,$5
458 sw $18,32($sp)
459 move $18,$6
460 sw $20,40($sp)
461 move $20,$0
462 sw $19,36($sp)
463 li $19,0x00000002 # 2
464 sw $31,48($sp)
465 .set noreorder
466 .set nomacro
467 bne $18,$0,$L26
468 sw $28,44($sp)
469 .set macro
470 .set reorder
471
472 .set noreorder
473 .set nomacro
474 j $L43
475 li $2,-1 # 0xffffffff
476 .set macro
477 .set reorder
478
479$L26:
480 move $4,$18
481 jal BN_num_bits_word
482 move $4,$2
483 li $2,0x00000020 # 32
484 .set noreorder
485 .set nomacro
486 beq $4,$2,$L27
487 li $2,0x00000001 # 1
488 .set macro
489 .set reorder
490
491 sll $2,$2,$4
492 sltu $2,$2,$16
493 .set noreorder
494 .set nomacro
495 beq $2,$0,$L44
496 li $5,0x00000020 # 32
497 .set macro
498 .set reorder
499
500 la $4,__iob+32
501 la $5,$LC0
502 jal fprintf
503 jal abort
504$L27:
505 li $5,0x00000020 # 32
506$L44:
507 sltu $2,$16,$18
508 .set noreorder
509 .set nomacro
510 bne $2,$0,$L28
511 subu $4,$5,$4
512 .set macro
513 .set reorder
514
515 subu $16,$16,$18
516$L28:
517 .set noreorder
518 .set nomacro
519 beq $4,$0,$L29
520 li $10,-65536 # 0xffff0000
521 .set macro
522 .set reorder
523
524 sll $18,$18,$4
525 sll $3,$16,$4
526 subu $2,$5,$4
527 srl $2,$17,$2
528 or $16,$3,$2
529 sll $17,$17,$4
530$L29:
531 srl $7,$18,16
532 andi $9,$18,0xffff
533$L30:
534 srl $2,$16,16
535 .set noreorder
536 .set nomacro
537 beq $2,$7,$L34
538 li $6,0x0000ffff # 65535
539 .set macro
540 .set reorder
541
542 divu $6,$16,$7
543$L34:
544 mult $6,$9
545 mflo $5
546 #nop
547 #nop
548 mult $6,$7
549 and $2,$17,$10
550 srl $8,$2,16
551 mflo $4
552$L35:
553 subu $3,$16,$4
554 and $2,$3,$10
555 .set noreorder
556 .set nomacro
557 bne $2,$0,$L36
558 sll $2,$3,16
559 .set macro
560 .set reorder
561
562 addu $2,$2,$8
563 sltu $2,$2,$5
564 .set noreorder
565 .set nomacro
566 beq $2,$0,$L36
567 subu $5,$5,$9
568 .set macro
569 .set reorder
570
571 subu $4,$4,$7
572 .set noreorder
573 .set nomacro
574 j $L35
575 addu $6,$6,-1
576 .set macro
577 .set reorder
578
579$L36:
580 mult $6,$7
581 mflo $5
582 #nop
583 #nop
584 mult $6,$9
585 mflo $4
586 #nop
587 #nop
588 srl $3,$4,16
589 sll $2,$4,16
590 and $4,$2,$10
591 sltu $2,$17,$4
592 .set noreorder
593 .set nomacro
594 beq $2,$0,$L40
595 addu $5,$5,$3
596 .set macro
597 .set reorder
598
599 addu $5,$5,1
600$L40:
601 sltu $2,$16,$5
602 .set noreorder
603 .set nomacro
604 beq $2,$0,$L41
605 subu $17,$17,$4
606 .set macro
607 .set reorder
608
609 addu $16,$16,$18
610 addu $6,$6,-1
611$L41:
612 addu $19,$19,-1
613 .set noreorder
614 .set nomacro
615 beq $19,$0,$L31
616 subu $16,$16,$5
617 .set macro
618 .set reorder
619
620 sll $20,$6,16
621 sll $3,$16,16
622 srl $2,$17,16
623 or $16,$3,$2
624 .set noreorder
625 .set nomacro
626 j $L30
627 sll $17,$17,16
628 .set macro
629 .set reorder
630
631$L31:
632 or $2,$20,$6
633$L43:
634 lw $31,48($sp)
635 lw $20,40($sp)
636 lw $19,36($sp)
637 lw $18,32($sp)
638 lw $17,28($sp)
639 lw $16,24($sp)
640 addu $sp,$sp,56
641 j $31
642 .end bn_div64
643
644 .globl abort .text
645 .globl fprintf .text
646 .globl BN_num_bits_word .text
diff --git a/src/lib/libcrypto/bn/asm/sparcv8plus.S b/src/lib/libcrypto/bn/asm/sparcv8plus.S
index 8c56e2e7e7..0074dfdb75 100644
--- a/src/lib/libcrypto/bn/asm/sparcv8plus.S
+++ b/src/lib/libcrypto/bn/asm/sparcv8plus.S
@@ -162,14 +162,10 @@
162 * BN_ULONG w; 162 * BN_ULONG w;
163 */ 163 */
164bn_mul_add_words: 164bn_mul_add_words:
165 sra %o2,%g0,%o2 ! signx %o2
166 brgz,a %o2,.L_bn_mul_add_words_proceed 165 brgz,a %o2,.L_bn_mul_add_words_proceed
167 lduw [%o1],%g2 166 lduw [%o1],%g2
168 retl 167 retl
169 clr %o0 168 clr %o0
170 nop
171 nop
172 nop
173 169
174.L_bn_mul_add_words_proceed: 170.L_bn_mul_add_words_proceed:
175 srl %o3,%g0,%o3 ! clruw %o3 171 srl %o3,%g0,%o3 ! clruw %o3
@@ -264,14 +260,10 @@ bn_mul_add_words:
264 * BN_ULONG w; 260 * BN_ULONG w;
265 */ 261 */
266bn_mul_words: 262bn_mul_words:
267 sra %o2,%g0,%o2 ! signx %o2
268 brgz,a %o2,.L_bn_mul_words_proceeed 263 brgz,a %o2,.L_bn_mul_words_proceeed
269 lduw [%o1],%g2 264 lduw [%o1],%g2
270 retl 265 retl
271 clr %o0 266 clr %o0
272 nop
273 nop
274 nop
275 267
276.L_bn_mul_words_proceeed: 268.L_bn_mul_words_proceeed:
277 srl %o3,%g0,%o3 ! clruw %o3 269 srl %o3,%g0,%o3 ! clruw %o3
@@ -352,14 +344,10 @@ bn_mul_words:
352 * int n; 344 * int n;
353 */ 345 */
354bn_sqr_words: 346bn_sqr_words:
355 sra %o2,%g0,%o2 ! signx %o2
356 brgz,a %o2,.L_bn_sqr_words_proceeed 347 brgz,a %o2,.L_bn_sqr_words_proceeed
357 lduw [%o1],%g2 348 lduw [%o1],%g2
358 retl 349 retl
359 clr %o0 350 clr %o0
360 nop
361 nop
362 nop
363 351
364.L_bn_sqr_words_proceeed: 352.L_bn_sqr_words_proceeed:
365 andcc %o2,-4,%g0 353 andcc %o2,-4,%g0
@@ -457,7 +445,6 @@ bn_div_words:
457 * int n; 445 * int n;
458 */ 446 */
459bn_add_words: 447bn_add_words:
460 sra %o3,%g0,%o3 ! signx %o3
461 brgz,a %o3,.L_bn_add_words_proceed 448 brgz,a %o3,.L_bn_add_words_proceed
462 lduw [%o1],%o4 449 lduw [%o1],%o4
463 retl 450 retl
@@ -467,6 +454,7 @@ bn_add_words:
467 andcc %o3,-4,%g0 454 andcc %o3,-4,%g0
468 bz,pn %icc,.L_bn_add_words_tail 455 bz,pn %icc,.L_bn_add_words_tail
469 addcc %g0,0,%g0 ! clear carry flag 456 addcc %g0,0,%g0 ! clear carry flag
457 nop
470 458
471.L_bn_add_words_loop: ! wow! 32 aligned! 459.L_bn_add_words_loop: ! wow! 32 aligned!
472 dec 4,%o3 460 dec 4,%o3
@@ -535,7 +523,6 @@ bn_add_words:
535 * int n; 523 * int n;
536 */ 524 */
537bn_sub_words: 525bn_sub_words:
538 sra %o3,%g0,%o3 ! signx %o3
539 brgz,a %o3,.L_bn_sub_words_proceed 526 brgz,a %o3,.L_bn_sub_words_proceed
540 lduw [%o1],%o4 527 lduw [%o1],%o4
541 retl 528 retl
@@ -545,6 +532,7 @@ bn_sub_words:
545 andcc %o3,-4,%g0 532 andcc %o3,-4,%g0
546 bz,pn %icc,.L_bn_sub_words_tail 533 bz,pn %icc,.L_bn_sub_words_tail
547 addcc %g0,0,%g0 ! clear carry flag 534 addcc %g0,0,%g0 ! clear carry flag
535 nop
548 536
549.L_bn_sub_words_loop: ! wow! 32 aligned! 537.L_bn_sub_words_loop: ! wow! 32 aligned!
550 dec 4,%o3 538 dec 4,%o3
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 1251521c54..3da6d8ced9 100644
--- a/src/lib/libcrypto/bn/bn.h
+++ b/src/lib/libcrypto/bn/bn.h
@@ -225,23 +225,10 @@ extern "C" {
225 225
226#define BN_FLG_MALLOCED 0x01 226#define BN_FLG_MALLOCED 0x01
227#define BN_FLG_STATIC_DATA 0x02 227#define BN_FLG_STATIC_DATA 0x02
228#define BN_FLG_EXP_CONSTTIME 0x04 /* avoid leaking exponent information through timings
229 * (BN_mod_exp_mont() will call BN_mod_exp_mont_consttime) */
230#define BN_FLG_FREE 0x8000 /* used for debuging */ 228#define BN_FLG_FREE 0x8000 /* used for debuging */
231#define BN_set_flags(b,n) ((b)->flags|=(n)) 229#define BN_set_flags(b,n) ((b)->flags|=(n))
232#define BN_get_flags(b,n) ((b)->flags&(n)) 230#define BN_get_flags(b,n) ((b)->flags&(n))
233 231
234/* get a clone of a BIGNUM with changed flags, for *temporary* use only
235 * (the two BIGNUMs cannot not be used in parallel!) */
236#define BN_with_flags(dest,b,n) ((dest)->d=(b)->d, \
237 (dest)->top=(b)->top, \
238 (dest)->dmax=(b)->dmax, \
239 (dest)->neg=(b)->neg, \
240 (dest)->flags=(((dest)->flags & BN_FLG_MALLOCED) \
241 | ((b)->flags & ~BN_FLG_MALLOCED) \
242 | BN_FLG_STATIC_DATA \
243 | (n)))
244
245typedef struct bignum_st 232typedef struct bignum_st
246 { 233 {
247 BN_ULONG *d; /* Pointer to an array of 'BN_BITS2' bit chunks. */ 234 BN_ULONG *d; /* Pointer to an array of 'BN_BITS2' bit chunks. */
@@ -391,8 +378,6 @@ int BN_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
391 const BIGNUM *m,BN_CTX *ctx); 378 const BIGNUM *m,BN_CTX *ctx);
392int BN_mod_exp_mont(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, 379int BN_mod_exp_mont(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
393 const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx); 380 const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx);
394int BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p,
395 const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *in_mont);
396int BN_mod_exp_mont_word(BIGNUM *r, BN_ULONG a, const BIGNUM *p, 381int BN_mod_exp_mont_word(BIGNUM *r, BN_ULONG a, const BIGNUM *p,
397 const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx); 382 const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx);
398int BN_mod_exp2_mont(BIGNUM *r, const BIGNUM *a1, const BIGNUM *p1, 383int BN_mod_exp2_mont(BIGNUM *r, const BIGNUM *a1, const BIGNUM *p1,
@@ -438,19 +423,6 @@ int BN_is_prime_fasttest(const BIGNUM *p,int nchecks,
438 void (*callback)(int,int,void *),BN_CTX *ctx,void *cb_arg, 423 void (*callback)(int,int,void *),BN_CTX *ctx,void *cb_arg,
439 int do_trial_division); 424 int do_trial_division);
440 425
441#ifdef OPENSSL_FIPS
442int BN_X931_derive_prime(BIGNUM *p, BIGNUM *p1, BIGNUM *p2,
443 void (*cb)(int, int, void *), void *cb_arg,
444 const BIGNUM *Xp, const BIGNUM *Xp1, const BIGNUM *Xp2,
445 const BIGNUM *e, BN_CTX *ctx);
446int BN_X931_generate_Xpq(BIGNUM *Xp, BIGNUM *Xq, int nbits, BN_CTX *ctx);
447int BN_X931_generate_prime(BIGNUM *p, BIGNUM *p1, BIGNUM *p2,
448 BIGNUM *Xp1, BIGNUM *Xp2,
449 const BIGNUM *Xp,
450 const BIGNUM *e, BN_CTX *ctx,
451 void (*cb)(int, int, void *), void *cb_arg);
452#endif
453
454BN_MONT_CTX *BN_MONT_CTX_new(void ); 426BN_MONT_CTX *BN_MONT_CTX_new(void );
455void BN_MONT_CTX_init(BN_MONT_CTX *ctx); 427void BN_MONT_CTX_init(BN_MONT_CTX *ctx);
456int BN_mod_mul_montgomery(BIGNUM *r,const BIGNUM *a,const BIGNUM *b, 428int BN_mod_mul_montgomery(BIGNUM *r,const BIGNUM *a,const BIGNUM *b,
@@ -462,8 +434,6 @@ int BN_from_montgomery(BIGNUM *r,const BIGNUM *a,
462void BN_MONT_CTX_free(BN_MONT_CTX *mont); 434void BN_MONT_CTX_free(BN_MONT_CTX *mont);
463int BN_MONT_CTX_set(BN_MONT_CTX *mont,const BIGNUM *mod,BN_CTX *ctx); 435int BN_MONT_CTX_set(BN_MONT_CTX *mont,const BIGNUM *mod,BN_CTX *ctx);
464BN_MONT_CTX *BN_MONT_CTX_copy(BN_MONT_CTX *to,BN_MONT_CTX *from); 436BN_MONT_CTX *BN_MONT_CTX_copy(BN_MONT_CTX *to,BN_MONT_CTX *from);
465BN_MONT_CTX *BN_MONT_CTX_set_locked(BN_MONT_CTX **pmont, int lock,
466 const BIGNUM *mod, BN_CTX *ctx);
467 437
468BN_BLINDING *BN_BLINDING_new(BIGNUM *A,BIGNUM *Ai,BIGNUM *mod); 438BN_BLINDING *BN_BLINDING_new(BIGNUM *A,BIGNUM *Ai,BIGNUM *mod);
469void BN_BLINDING_free(BN_BLINDING *b); 439void BN_BLINDING_free(BN_BLINDING *b);
@@ -540,15 +510,11 @@ void ERR_load_BN_strings(void);
540#define BN_F_BN_CTX_GET 116 510#define BN_F_BN_CTX_GET 116
541#define BN_F_BN_CTX_NEW 106 511#define BN_F_BN_CTX_NEW 106
542#define BN_F_BN_DIV 107 512#define BN_F_BN_DIV 107
543#define BN_F_BN_EXP 123
544#define BN_F_BN_EXPAND2 108 513#define BN_F_BN_EXPAND2 108
545#define BN_F_BN_EXPAND_INTERNAL 120 514#define BN_F_BN_EXPAND_INTERNAL 120
546#define BN_F_BN_MOD_EXP2_MONT 118 515#define BN_F_BN_MOD_EXP2_MONT 118
547#define BN_F_BN_MOD_EXP_MONT 109 516#define BN_F_BN_MOD_EXP_MONT 109
548#define BN_F_BN_MOD_EXP_MONT_CONSTTIME 124
549#define BN_F_BN_MOD_EXP_MONT_WORD 117 517#define BN_F_BN_MOD_EXP_MONT_WORD 117
550#define BN_F_BN_MOD_EXP_RECP 125
551#define BN_F_BN_MOD_EXP_SIMPLE 126
552#define BN_F_BN_MOD_INVERSE 110 518#define BN_F_BN_MOD_INVERSE 110
553#define BN_F_BN_MOD_LSHIFT_QUICK 119 519#define BN_F_BN_MOD_LSHIFT_QUICK 119
554#define BN_F_BN_MOD_MUL_RECIPROCAL 111 520#define BN_F_BN_MOD_MUL_RECIPROCAL 111
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_asm.c b/src/lib/libcrypto/bn/bn_asm.c
index 19978085b2..be8aa3ffc5 100644
--- a/src/lib/libcrypto/bn/bn_asm.c
+++ b/src/lib/libcrypto/bn/bn_asm.c
@@ -237,7 +237,7 @@ BN_ULONG bn_div_words(BN_ULONG h, BN_ULONG l, BN_ULONG d)
237 if (d == 0) return(BN_MASK2); 237 if (d == 0) return(BN_MASK2);
238 238
239 i=BN_num_bits_word(d); 239 i=BN_num_bits_word(d);
240 assert((i == BN_BITS2) || (h <= (BN_ULONG)1<<i)); 240 assert((i == BN_BITS2) || (h > (BN_ULONG)1<<i));
241 241
242 i=BN_BITS2-i; 242 i=BN_BITS2-i;
243 if (h >= d) h-=d; 243 if (h >= d) h-=d;
diff --git a/src/lib/libcrypto/bn/bn_err.c b/src/lib/libcrypto/bn/bn_err.c
index 5dfac00c88..fb84ee96d8 100644
--- a/src/lib/libcrypto/bn/bn_err.c
+++ b/src/lib/libcrypto/bn/bn_err.c
@@ -1,6 +1,6 @@
1/* crypto/bn/bn_err.c */ 1/* crypto/bn/bn_err.c */
2/* ==================================================================== 2/* ====================================================================
3 * Copyright (c) 1999-2005 The OpenSSL Project. All rights reserved. 3 * Copyright (c) 1999 The OpenSSL Project. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
@@ -64,60 +64,52 @@
64 64
65/* BEGIN ERROR CODES */ 65/* BEGIN ERROR CODES */
66#ifndef OPENSSL_NO_ERR 66#ifndef OPENSSL_NO_ERR
67
68#define ERR_FUNC(func) ERR_PACK(ERR_LIB_BN,func,0)
69#define ERR_REASON(reason) ERR_PACK(ERR_LIB_BN,0,reason)
70
71static ERR_STRING_DATA BN_str_functs[]= 67static ERR_STRING_DATA BN_str_functs[]=
72 { 68 {
73{ERR_FUNC(BN_F_BN_BLINDING_CONVERT), "BN_BLINDING_convert"}, 69{ERR_PACK(0,BN_F_BN_BLINDING_CONVERT,0), "BN_BLINDING_convert"},
74{ERR_FUNC(BN_F_BN_BLINDING_INVERT), "BN_BLINDING_invert"}, 70{ERR_PACK(0,BN_F_BN_BLINDING_INVERT,0), "BN_BLINDING_invert"},
75{ERR_FUNC(BN_F_BN_BLINDING_NEW), "BN_BLINDING_new"}, 71{ERR_PACK(0,BN_F_BN_BLINDING_NEW,0), "BN_BLINDING_new"},
76{ERR_FUNC(BN_F_BN_BLINDING_UPDATE), "BN_BLINDING_update"}, 72{ERR_PACK(0,BN_F_BN_BLINDING_UPDATE,0), "BN_BLINDING_update"},
77{ERR_FUNC(BN_F_BN_BN2DEC), "BN_bn2dec"}, 73{ERR_PACK(0,BN_F_BN_BN2DEC,0), "BN_bn2dec"},
78{ERR_FUNC(BN_F_BN_BN2HEX), "BN_bn2hex"}, 74{ERR_PACK(0,BN_F_BN_BN2HEX,0), "BN_bn2hex"},
79{ERR_FUNC(BN_F_BN_CTX_GET), "BN_CTX_get"}, 75{ERR_PACK(0,BN_F_BN_CTX_GET,0), "BN_CTX_get"},
80{ERR_FUNC(BN_F_BN_CTX_NEW), "BN_CTX_new"}, 76{ERR_PACK(0,BN_F_BN_CTX_NEW,0), "BN_CTX_new"},
81{ERR_FUNC(BN_F_BN_DIV), "BN_div"}, 77{ERR_PACK(0,BN_F_BN_DIV,0), "BN_div"},
82{ERR_FUNC(BN_F_BN_EXP), "BN_exp"}, 78{ERR_PACK(0,BN_F_BN_EXPAND2,0), "bn_expand2"},
83{ERR_FUNC(BN_F_BN_EXPAND2), "bn_expand2"}, 79{ERR_PACK(0,BN_F_BN_EXPAND_INTERNAL,0), "BN_EXPAND_INTERNAL"},
84{ERR_FUNC(BN_F_BN_EXPAND_INTERNAL), "BN_EXPAND_INTERNAL"}, 80{ERR_PACK(0,BN_F_BN_MOD_EXP2_MONT,0), "BN_mod_exp2_mont"},
85{ERR_FUNC(BN_F_BN_MOD_EXP2_MONT), "BN_mod_exp2_mont"}, 81{ERR_PACK(0,BN_F_BN_MOD_EXP_MONT,0), "BN_mod_exp_mont"},
86{ERR_FUNC(BN_F_BN_MOD_EXP_MONT), "BN_mod_exp_mont"}, 82{ERR_PACK(0,BN_F_BN_MOD_EXP_MONT_WORD,0), "BN_mod_exp_mont_word"},
87{ERR_FUNC(BN_F_BN_MOD_EXP_MONT_CONSTTIME), "BN_mod_exp_mont_consttime"}, 83{ERR_PACK(0,BN_F_BN_MOD_INVERSE,0), "BN_mod_inverse"},
88{ERR_FUNC(BN_F_BN_MOD_EXP_MONT_WORD), "BN_mod_exp_mont_word"}, 84{ERR_PACK(0,BN_F_BN_MOD_LSHIFT_QUICK,0), "BN_mod_lshift_quick"},
89{ERR_FUNC(BN_F_BN_MOD_EXP_RECP), "BN_mod_exp_recp"}, 85{ERR_PACK(0,BN_F_BN_MOD_MUL_RECIPROCAL,0), "BN_mod_mul_reciprocal"},
90{ERR_FUNC(BN_F_BN_MOD_EXP_SIMPLE), "BN_mod_exp_simple"}, 86{ERR_PACK(0,BN_F_BN_MOD_SQRT,0), "BN_mod_sqrt"},
91{ERR_FUNC(BN_F_BN_MOD_INVERSE), "BN_mod_inverse"}, 87{ERR_PACK(0,BN_F_BN_MPI2BN,0), "BN_mpi2bn"},
92{ERR_FUNC(BN_F_BN_MOD_LSHIFT_QUICK), "BN_mod_lshift_quick"}, 88{ERR_PACK(0,BN_F_BN_NEW,0), "BN_new"},
93{ERR_FUNC(BN_F_BN_MOD_MUL_RECIPROCAL), "BN_mod_mul_reciprocal"}, 89{ERR_PACK(0,BN_F_BN_RAND,0), "BN_rand"},
94{ERR_FUNC(BN_F_BN_MOD_SQRT), "BN_mod_sqrt"}, 90{ERR_PACK(0,BN_F_BN_RAND_RANGE,0), "BN_rand_range"},
95{ERR_FUNC(BN_F_BN_MPI2BN), "BN_mpi2bn"}, 91{ERR_PACK(0,BN_F_BN_USUB,0), "BN_usub"},
96{ERR_FUNC(BN_F_BN_NEW), "BN_new"},
97{ERR_FUNC(BN_F_BN_RAND), "BN_rand"},
98{ERR_FUNC(BN_F_BN_RAND_RANGE), "BN_rand_range"},
99{ERR_FUNC(BN_F_BN_USUB), "BN_usub"},
100{0,NULL} 92{0,NULL}
101 }; 93 };
102 94
103static ERR_STRING_DATA BN_str_reasons[]= 95static ERR_STRING_DATA BN_str_reasons[]=
104 { 96 {
105{ERR_REASON(BN_R_ARG2_LT_ARG3) ,"arg2 lt arg3"}, 97{BN_R_ARG2_LT_ARG3 ,"arg2 lt arg3"},
106{ERR_REASON(BN_R_BAD_RECIPROCAL) ,"bad reciprocal"}, 98{BN_R_BAD_RECIPROCAL ,"bad reciprocal"},
107{ERR_REASON(BN_R_BIGNUM_TOO_LONG) ,"bignum too long"}, 99{BN_R_BIGNUM_TOO_LONG ,"bignum too long"},
108{ERR_REASON(BN_R_CALLED_WITH_EVEN_MODULUS),"called with even modulus"}, 100{BN_R_CALLED_WITH_EVEN_MODULUS ,"called with even modulus"},
109{ERR_REASON(BN_R_DIV_BY_ZERO) ,"div by zero"}, 101{BN_R_DIV_BY_ZERO ,"div by zero"},
110{ERR_REASON(BN_R_ENCODING_ERROR) ,"encoding error"}, 102{BN_R_ENCODING_ERROR ,"encoding error"},
111{ERR_REASON(BN_R_EXPAND_ON_STATIC_BIGNUM_DATA),"expand on static bignum data"}, 103{BN_R_EXPAND_ON_STATIC_BIGNUM_DATA ,"expand on static bignum data"},
112{ERR_REASON(BN_R_INPUT_NOT_REDUCED) ,"input not reduced"}, 104{BN_R_INPUT_NOT_REDUCED ,"input not reduced"},
113{ERR_REASON(BN_R_INVALID_LENGTH) ,"invalid length"}, 105{BN_R_INVALID_LENGTH ,"invalid length"},
114{ERR_REASON(BN_R_INVALID_RANGE) ,"invalid range"}, 106{BN_R_INVALID_RANGE ,"invalid range"},
115{ERR_REASON(BN_R_NOT_A_SQUARE) ,"not a square"}, 107{BN_R_NOT_A_SQUARE ,"not a square"},
116{ERR_REASON(BN_R_NOT_INITIALIZED) ,"not initialized"}, 108{BN_R_NOT_INITIALIZED ,"not initialized"},
117{ERR_REASON(BN_R_NO_INVERSE) ,"no inverse"}, 109{BN_R_NO_INVERSE ,"no inverse"},
118{ERR_REASON(BN_R_P_IS_NOT_PRIME) ,"p is not prime"}, 110{BN_R_P_IS_NOT_PRIME ,"p is not prime"},
119{ERR_REASON(BN_R_TOO_MANY_ITERATIONS) ,"too many iterations"}, 111{BN_R_TOO_MANY_ITERATIONS ,"too many iterations"},
120{ERR_REASON(BN_R_TOO_MANY_TEMPORARY_VARIABLES),"too many temporary variables"}, 112{BN_R_TOO_MANY_TEMPORARY_VARIABLES ,"too many temporary variables"},
121{0,NULL} 113{0,NULL}
122 }; 114 };
123 115
@@ -131,8 +123,8 @@ void ERR_load_BN_strings(void)
131 { 123 {
132 init=0; 124 init=0;
133#ifndef OPENSSL_NO_ERR 125#ifndef OPENSSL_NO_ERR
134 ERR_load_strings(0,BN_str_functs); 126 ERR_load_strings(ERR_LIB_BN,BN_str_functs);
135 ERR_load_strings(0,BN_str_reasons); 127 ERR_load_strings(ERR_LIB_BN,BN_str_reasons);
136#endif 128#endif
137 129
138 } 130 }
diff --git a/src/lib/libcrypto/bn/bn_exp.c b/src/lib/libcrypto/bn/bn_exp.c
index 9e1e88abe8..afdfd580fb 100644
--- a/src/lib/libcrypto/bn/bn_exp.c
+++ b/src/lib/libcrypto/bn/bn_exp.c
@@ -56,7 +56,7 @@
56 * [including the GNU Public Licence.] 56 * [including the GNU Public Licence.]
57 */ 57 */
58/* ==================================================================== 58/* ====================================================================
59 * Copyright (c) 1998-2005 The OpenSSL Project. All rights reserved. 59 * Copyright (c) 1998-2000 The OpenSSL Project. All rights reserved.
60 * 60 *
61 * Redistribution and use in source and binary forms, with or without 61 * Redistribution and use in source and binary forms, with or without
62 * modification, are permitted provided that the following conditions 62 * modification, are permitted provided that the following conditions
@@ -113,7 +113,6 @@
113#include "cryptlib.h" 113#include "cryptlib.h"
114#include "bn_lcl.h" 114#include "bn_lcl.h"
115 115
116/* maximum precomputation table size for *variable* sliding windows */
117#define TABLE_SIZE 32 116#define TABLE_SIZE 32
118 117
119/* this one works - simple but works */ 118/* this one works - simple but works */
@@ -122,13 +121,6 @@ int BN_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx)
122 int i,bits,ret=0; 121 int i,bits,ret=0;
123 BIGNUM *v,*rr; 122 BIGNUM *v,*rr;
124 123
125 if (BN_get_flags(p, BN_FLG_EXP_CONSTTIME) != 0)
126 {
127 /* BN_FLG_EXP_CONSTTIME only supported by BN_mod_exp_mont() */
128 BNerr(BN_F_BN_EXP,ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
129 return -1;
130 }
131
132 BN_CTX_start(ctx); 124 BN_CTX_start(ctx);
133 if ((r == a) || (r == p)) 125 if ((r == a) || (r == p))
134 rr = BN_CTX_get(ctx); 126 rr = BN_CTX_get(ctx);
@@ -212,7 +204,7 @@ int BN_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, const BIGNUM *m,
212 if (BN_is_odd(m)) 204 if (BN_is_odd(m))
213 { 205 {
214# ifdef MONT_EXP_WORD 206# ifdef MONT_EXP_WORD
215 if (a->top == 1 && !a->neg && (BN_get_flags(p, BN_FLG_EXP_CONSTTIME) == 0)) 207 if (a->top == 1 && !a->neg)
216 { 208 {
217 BN_ULONG A = a->d[0]; 209 BN_ULONG A = a->d[0];
218 ret=BN_mod_exp_mont_word(r,A,p,m,ctx,NULL); 210 ret=BN_mod_exp_mont_word(r,A,p,m,ctx,NULL);
@@ -242,13 +234,6 @@ int BN_mod_exp_recp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
242 BIGNUM val[TABLE_SIZE]; 234 BIGNUM val[TABLE_SIZE];
243 BN_RECP_CTX recp; 235 BN_RECP_CTX recp;
244 236
245 if (BN_get_flags(p, BN_FLG_EXP_CONSTTIME) != 0)
246 {
247 /* BN_FLG_EXP_CONSTTIME only supported by BN_mod_exp_mont() */
248 BNerr(BN_F_BN_MOD_EXP_RECP,ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
249 return -1;
250 }
251
252 bits=BN_num_bits(p); 237 bits=BN_num_bits(p);
253 238
254 if (bits == 0) 239 if (bits == 0)
@@ -376,11 +361,6 @@ int BN_mod_exp_mont(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p,
376 BIGNUM val[TABLE_SIZE]; 361 BIGNUM val[TABLE_SIZE];
377 BN_MONT_CTX *mont=NULL; 362 BN_MONT_CTX *mont=NULL;
378 363
379 if (BN_get_flags(p, BN_FLG_EXP_CONSTTIME) != 0)
380 {
381 return BN_mod_exp_mont_consttime(rr, a, p, m, ctx, in_mont);
382 }
383
384 bn_check_top(a); 364 bn_check_top(a);
385 bn_check_top(p); 365 bn_check_top(p);
386 bn_check_top(m); 366 bn_check_top(m);
@@ -513,212 +493,6 @@ err:
513 return(ret); 493 return(ret);
514 } 494 }
515 495
516
517/* BN_mod_exp_mont_consttime() stores the precomputed powers in a specific layout
518 * so that accessing any of these table values shows the same access pattern as far
519 * as cache lines are concerned. The following functions are used to transfer a BIGNUM
520 * from/to that table. */
521
522static int MOD_EXP_CTIME_COPY_TO_PREBUF(BIGNUM *b, int top, unsigned char *buf, int idx, int width)
523 {
524 size_t i, j;
525
526 if (bn_wexpand(b, top) == NULL)
527 return 0;
528 while (b->top < top)
529 {
530 b->d[b->top++] = 0;
531 }
532
533 for (i = 0, j=idx; i < top * sizeof b->d[0]; i++, j+=width)
534 {
535 buf[j] = ((unsigned char*)b->d)[i];
536 }
537
538 bn_fix_top(b);
539 return 1;
540 }
541
542static int MOD_EXP_CTIME_COPY_FROM_PREBUF(BIGNUM *b, int top, unsigned char *buf, int idx, int width)
543 {
544 size_t i, j;
545
546 if (bn_wexpand(b, top) == NULL)
547 return 0;
548
549 for (i=0, j=idx; i < top * sizeof b->d[0]; i++, j+=width)
550 {
551 ((unsigned char*)b->d)[i] = buf[j];
552 }
553
554 b->top = top;
555 bn_fix_top(b);
556 return 1;
557 }
558
559/* Given a pointer value, compute the next address that is a cache line multiple. */
560#define MOD_EXP_CTIME_ALIGN(x_) \
561 ((unsigned char*)(x_) + (MOD_EXP_CTIME_MIN_CACHE_LINE_WIDTH - (((BN_ULONG)(x_)) & (MOD_EXP_CTIME_MIN_CACHE_LINE_MASK))))
562
563/* This variant of BN_mod_exp_mont() uses fixed windows and the special
564 * precomputation memory layout to limit data-dependency to a minimum
565 * to protect secret exponents (cf. the hyper-threading timing attacks
566 * pointed out by Colin Percival,
567 * http://www.daemonology.net/hyperthreading-considered-harmful/)
568 */
569int BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p,
570 const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *in_mont)
571 {
572 int i,bits,ret=0,idx,window,wvalue;
573 int top;
574 BIGNUM *r;
575 const BIGNUM *aa;
576 BN_MONT_CTX *mont=NULL;
577
578 int numPowers;
579 unsigned char *powerbufFree=NULL;
580 int powerbufLen = 0;
581 unsigned char *powerbuf=NULL;
582 BIGNUM *computeTemp=NULL, *am=NULL;
583
584 bn_check_top(a);
585 bn_check_top(p);
586 bn_check_top(m);
587
588 top = m->top;
589
590 if (!(m->d[0] & 1))
591 {
592 BNerr(BN_F_BN_MOD_EXP_MONT_CONSTTIME,BN_R_CALLED_WITH_EVEN_MODULUS);
593 return(0);
594 }
595 bits=BN_num_bits(p);
596 if (bits == 0)
597 {
598 ret = BN_one(rr);
599 return ret;
600 }
601
602 /* Initialize BIGNUM context and allocate intermediate result */
603 BN_CTX_start(ctx);
604 r = BN_CTX_get(ctx);
605 if (r == NULL) goto err;
606
607 /* Allocate a montgomery context if it was not supplied by the caller.
608 * If this is not done, things will break in the montgomery part.
609 */
610 if (in_mont != NULL)
611 mont=in_mont;
612 else
613 {
614 if ((mont=BN_MONT_CTX_new()) == NULL) goto err;
615 if (!BN_MONT_CTX_set(mont,m,ctx)) goto err;
616 }
617
618 /* Get the window size to use with size of p. */
619 window = BN_window_bits_for_ctime_exponent_size(bits);
620
621 /* Allocate a buffer large enough to hold all of the pre-computed
622 * powers of a.
623 */
624 numPowers = 1 << window;
625 powerbufLen = sizeof(m->d[0])*top*numPowers;
626 if ((powerbufFree=(unsigned char*)OPENSSL_malloc(powerbufLen+MOD_EXP_CTIME_MIN_CACHE_LINE_WIDTH)) == NULL)
627 goto err;
628
629 powerbuf = MOD_EXP_CTIME_ALIGN(powerbufFree);
630 memset(powerbuf, 0, powerbufLen);
631
632 /* Initialize the intermediate result. Do this early to save double conversion,
633 * once each for a^0 and intermediate result.
634 */
635 if (!BN_to_montgomery(r,BN_value_one(),mont,ctx)) goto err;
636 if (!MOD_EXP_CTIME_COPY_TO_PREBUF(r, top, powerbuf, 0, numPowers)) goto err;
637
638 /* Initialize computeTemp as a^1 with montgomery precalcs */
639 computeTemp = BN_CTX_get(ctx);
640 am = BN_CTX_get(ctx);
641 if (computeTemp==NULL || am==NULL) goto err;
642
643 if (a->neg || BN_ucmp(a,m) >= 0)
644 {
645 if (!BN_mod(am,a,m,ctx))
646 goto err;
647 aa= am;
648 }
649 else
650 aa=a;
651 if (!BN_to_montgomery(am,aa,mont,ctx)) goto err;
652 if (!BN_copy(computeTemp, am)) goto err;
653 if (!MOD_EXP_CTIME_COPY_TO_PREBUF(am, top, powerbuf, 1, numPowers)) goto err;
654
655 /* If the window size is greater than 1, then calculate
656 * val[i=2..2^winsize-1]. Powers are computed as a*a^(i-1)
657 * (even powers could instead be computed as (a^(i/2))^2
658 * to use the slight performance advantage of sqr over mul).
659 */
660 if (window > 1)
661 {
662 for (i=2; i<numPowers; i++)
663 {
664 /* Calculate a^i = a^(i-1) * a */
665 if (!BN_mod_mul_montgomery(computeTemp,am,computeTemp,mont,ctx))
666 goto err;
667 if (!MOD_EXP_CTIME_COPY_TO_PREBUF(computeTemp, top, powerbuf, i, numPowers)) goto err;
668 }
669 }
670
671 /* Adjust the number of bits up to a multiple of the window size.
672 * If the exponent length is not a multiple of the window size, then
673 * this pads the most significant bits with zeros to normalize the
674 * scanning loop to there's no special cases.
675 *
676 * * NOTE: Making the window size a power of two less than the native
677 * * word size ensures that the padded bits won't go past the last
678 * * word in the internal BIGNUM structure. Going past the end will
679 * * still produce the correct result, but causes a different branch
680 * * to be taken in the BN_is_bit_set function.
681 */
682 bits = ((bits+window-1)/window)*window;
683 idx=bits-1; /* The top bit of the window */
684
685 /* Scan the exponent one window at a time starting from the most
686 * significant bits.
687 */
688 while (idx >= 0)
689 {
690 wvalue=0; /* The 'value' of the window */
691
692 /* Scan the window, squaring the result as we go */
693 for (i=0; i<window; i++,idx--)
694 {
695 if (!BN_mod_mul_montgomery(r,r,r,mont,ctx)) goto err;
696 wvalue = (wvalue<<1)+BN_is_bit_set(p,idx);
697 }
698
699 /* Fetch the appropriate pre-computed value from the pre-buf */
700 if (!MOD_EXP_CTIME_COPY_FROM_PREBUF(computeTemp, top, powerbuf, wvalue, numPowers)) goto err;
701
702 /* Multiply the result into the intermediate result */
703 if (!BN_mod_mul_montgomery(r,r,computeTemp,mont,ctx)) goto err;
704 }
705
706 /* Convert the final result from montgomery to standard format */
707 if (!BN_from_montgomery(rr,r,mont,ctx)) goto err;
708 ret=1;
709err:
710 if ((in_mont == NULL) && (mont != NULL)) BN_MONT_CTX_free(mont);
711 if (powerbuf!=NULL)
712 {
713 OPENSSL_cleanse(powerbuf,powerbufLen);
714 OPENSSL_free(powerbufFree);
715 }
716 if (am!=NULL) BN_clear(am);
717 if (computeTemp!=NULL) BN_clear(computeTemp);
718 BN_CTX_end(ctx);
719 return(ret);
720 }
721
722int BN_mod_exp_mont_word(BIGNUM *rr, BN_ULONG a, const BIGNUM *p, 496int BN_mod_exp_mont_word(BIGNUM *rr, BN_ULONG a, const BIGNUM *p,
723 const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *in_mont) 497 const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *in_mont)
724 { 498 {
@@ -743,13 +517,6 @@ int BN_mod_exp_mont_word(BIGNUM *rr, BN_ULONG a, const BIGNUM *p,
743#define BN_TO_MONTGOMERY_WORD(r, w, mont) \ 517#define BN_TO_MONTGOMERY_WORD(r, w, mont) \
744 (BN_set_word(r, (w)) && BN_to_montgomery(r, r, (mont), ctx)) 518 (BN_set_word(r, (w)) && BN_to_montgomery(r, r, (mont), ctx))
745 519
746 if (BN_get_flags(p, BN_FLG_EXP_CONSTTIME) != 0)
747 {
748 /* BN_FLG_EXP_CONSTTIME only supported by BN_mod_exp_mont() */
749 BNerr(BN_F_BN_MOD_EXP_MONT_WORD,ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
750 return -1;
751 }
752
753 bn_check_top(p); 520 bn_check_top(p);
754 bn_check_top(m); 521 bn_check_top(m);
755 522
@@ -877,13 +644,6 @@ int BN_mod_exp_simple(BIGNUM *r,
877 BIGNUM *d; 644 BIGNUM *d;
878 BIGNUM val[TABLE_SIZE]; 645 BIGNUM val[TABLE_SIZE];
879 646
880 if (BN_get_flags(p, BN_FLG_EXP_CONSTTIME) != 0)
881 {
882 /* BN_FLG_EXP_CONSTTIME only supported by BN_mod_exp_mont() */
883 BNerr(BN_F_BN_MOD_EXP_SIMPLE,ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
884 return -1;
885 }
886
887 bits=BN_num_bits(p); 647 bits=BN_num_bits(p);
888 648
889 if (bits == 0) 649 if (bits == 0)
diff --git a/src/lib/libcrypto/bn/bn_lcl.h b/src/lib/libcrypto/bn/bn_lcl.h
index a84998f2bd..253e195e23 100644
--- a/src/lib/libcrypto/bn/bn_lcl.h
+++ b/src/lib/libcrypto/bn/bn_lcl.h
@@ -177,45 +177,6 @@ struct bignum_ctx
177 177
178 178
179 179
180/* BN_mod_exp_mont_conttime is based on the assumption that the
181 * L1 data cache line width of the target processor is at least
182 * the following value.
183 */
184#define MOD_EXP_CTIME_MIN_CACHE_LINE_WIDTH ( 64 )
185#define MOD_EXP_CTIME_MIN_CACHE_LINE_MASK (MOD_EXP_CTIME_MIN_CACHE_LINE_WIDTH - 1)
186
187/* Window sizes optimized for fixed window size modular exponentiation
188 * algorithm (BN_mod_exp_mont_consttime).
189 *
190 * To achieve the security goals of BN_mode_exp_mont_consttime, the
191 * maximum size of the window must not exceed
192 * log_2(MOD_EXP_CTIME_MIN_CACHE_LINE_WIDTH).
193 *
194 * Window size thresholds are defined for cache line sizes of 32 and 64,
195 * cache line sizes where log_2(32)=5 and log_2(64)=6 respectively. A
196 * window size of 7 should only be used on processors that have a 128
197 * byte or greater cache line size.
198 */
199#if MOD_EXP_CTIME_MIN_CACHE_LINE_WIDTH == 64
200
201# define BN_window_bits_for_ctime_exponent_size(b) \
202 ((b) > 937 ? 6 : \
203 (b) > 306 ? 5 : \
204 (b) > 89 ? 4 : \
205 (b) > 22 ? 3 : 1)
206# define BN_MAX_WINDOW_BITS_FOR_CTIME_EXPONENT_SIZE (6)
207
208#elif MOD_EXP_CTIME_MIN_CACHE_LINE_WIDTH == 32
209
210# define BN_window_bits_for_ctime_exponent_size(b) \
211 ((b) > 306 ? 5 : \
212 (b) > 89 ? 4 : \
213 (b) > 22 ? 3 : 1)
214# define BN_MAX_WINDOW_BITS_FOR_CTIME_EXPONENT_SIZE (5)
215
216#endif
217
218
219/* Pentium pro 16,16,16,32,64 */ 180/* Pentium pro 16,16,16,32,64 */
220/* Alpha 16,16,16,16.64 */ 181/* Alpha 16,16,16,16.64 */
221#define BN_MULL_SIZE_NORMAL (16) /* 32 */ 182#define BN_MULL_SIZE_NORMAL (16) /* 32 */
diff --git a/src/lib/libcrypto/bn/bn_mont.c b/src/lib/libcrypto/bn/bn_mont.c
index 3572e5a690..b79b1b60da 100644
--- a/src/lib/libcrypto/bn/bn_mont.c
+++ b/src/lib/libcrypto/bn/bn_mont.c
@@ -347,23 +347,3 @@ BN_MONT_CTX *BN_MONT_CTX_copy(BN_MONT_CTX *to, BN_MONT_CTX *from)
347 return(to); 347 return(to);
348 } 348 }
349 349
350BN_MONT_CTX *BN_MONT_CTX_set_locked(BN_MONT_CTX **pmont, int lock,
351 const BIGNUM *mod, BN_CTX *ctx)
352 {
353 if (*pmont)
354 return *pmont;
355 CRYPTO_w_lock(lock);
356 if (!*pmont)
357 {
358 *pmont = BN_MONT_CTX_new();
359 if (*pmont && !BN_MONT_CTX_set(*pmont, mod, ctx))
360 {
361 BN_MONT_CTX_free(*pmont);
362 *pmont = NULL;
363 }
364 }
365 CRYPTO_w_unlock(lock);
366 return *pmont;
367 }
368
369
diff --git a/src/lib/libcrypto/bn/bn_prime.c b/src/lib/libcrypto/bn/bn_prime.c
index e072d9255c..f422172f16 100644
--- a/src/lib/libcrypto/bn/bn_prime.c
+++ b/src/lib/libcrypto/bn/bn_prime.c
@@ -234,7 +234,9 @@ int BN_is_prime_fasttest(const BIGNUM *a, int checks,
234 234
235 /* first look for small factors */ 235 /* first look for small factors */
236 if (!BN_is_odd(a)) 236 if (!BN_is_odd(a))
237 return 0; 237 /* a is even => a is prime if and only if a == 2 */
238 return BN_is_word(a, 2);
239
238 if (do_trial_division) 240 if (do_trial_division)
239 { 241 {
240 for (i = 1; i < NUMPRIMES; i++) 242 for (i = 1; i < NUMPRIMES; i++)
diff --git a/src/lib/libcrypto/bn/bn_print.c b/src/lib/libcrypto/bn/bn_print.c
index 0d942603b1..acba7ed7ee 100644
--- a/src/lib/libcrypto/bn/bn_print.c
+++ b/src/lib/libcrypto/bn/bn_print.c
@@ -79,7 +79,7 @@ char *BN_bn2hex(const BIGNUM *a)
79 } 79 }
80 p=buf; 80 p=buf;
81 if (a->neg) *(p++)='-'; 81 if (a->neg) *(p++)='-';
82 if (a->top == 0) *(p++)='0'; 82 if (BN_is_zero(a)) *(p++)='0';
83 for (i=a->top-1; i >=0; i--) 83 for (i=a->top-1; i >=0; i--)
84 { 84 {
85 for (j=BN_BITS2-8; j >= 0; j-=8) 85 for (j=BN_BITS2-8; j >= 0; j-=8)
@@ -123,7 +123,7 @@ char *BN_bn2dec(const BIGNUM *a)
123 p=buf; 123 p=buf;
124 lp=bn_data; 124 lp=bn_data;
125 if (t->neg) *(p++)='-'; 125 if (t->neg) *(p++)='-';
126 if (t->top == 0) 126 if (BN_is_zero(t))
127 { 127 {
128 *(p++)='0'; 128 *(p++)='0';
129 *(p++)='\0'; 129 *(p++)='\0';
@@ -300,7 +300,7 @@ int BN_print(BIO *bp, const BIGNUM *a)
300 int ret=0; 300 int ret=0;
301 301
302 if ((a->neg) && (BIO_write(bp,"-",1) != 1)) goto end; 302 if ((a->neg) && (BIO_write(bp,"-",1) != 1)) goto end;
303 if ((a->top == 0) && (BIO_write(bp,"0",1) != 1)) goto end; 303 if ((BN_is_zero(a)) && (BIO_write(bp,"0",1) != 1)) goto end;
304 for (i=a->top-1; i >=0; i--) 304 for (i=a->top-1; i >=0; i--)
305 { 305 {
306 for (j=BN_BITS2-4; j >= 0; j-=4) 306 for (j=BN_BITS2-4; j >= 0; j-=4)
diff --git a/src/lib/libcrypto/bn/bn_word.c b/src/lib/libcrypto/bn/bn_word.c
index 988e0ca7b3..de610ce54c 100644
--- a/src/lib/libcrypto/bn/bn_word.c
+++ b/src/lib/libcrypto/bn/bn_word.c
@@ -110,6 +110,9 @@ int BN_add_word(BIGNUM *a, BN_ULONG w)
110 BN_ULONG l; 110 BN_ULONG l;
111 int i; 111 int i;
112 112
113 if ((w & BN_MASK2) == 0)
114 return(1);
115
113 if (a->neg) 116 if (a->neg)
114 { 117 {
115 a->neg=0; 118 a->neg=0;
@@ -143,6 +146,9 @@ int BN_sub_word(BIGNUM *a, BN_ULONG w)
143 { 146 {
144 int i; 147 int i;
145 148
149 if ((w & BN_MASK2) == 0)
150 return(1);
151
146 if (BN_is_zero(a) || a->neg) 152 if (BN_is_zero(a) || a->neg)
147 { 153 {
148 a->neg=0; 154 a->neg=0;
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..79d813d85e
--- /dev/null
+++ b/src/lib/libcrypto/bn/bntest.c
@@ -0,0 +1,1234 @@
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#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/x509.h>
69#include <openssl/err.h>
70
71const int num0 = 100; /* number of tests */
72const int num1 = 50; /* additional tests for some functions */
73const int num2 = 5; /* number of tests for slow functions */
74
75int test_add(BIO *bp);
76int test_sub(BIO *bp);
77int test_lshift1(BIO *bp);
78int test_lshift(BIO *bp,BN_CTX *ctx,BIGNUM *a_);
79int test_rshift1(BIO *bp);
80int test_rshift(BIO *bp,BN_CTX *ctx);
81int test_div(BIO *bp,BN_CTX *ctx);
82int test_div_recp(BIO *bp,BN_CTX *ctx);
83int test_mul(BIO *bp);
84int test_sqr(BIO *bp,BN_CTX *ctx);
85int test_mont(BIO *bp,BN_CTX *ctx);
86int test_mod(BIO *bp,BN_CTX *ctx);
87int test_mod_mul(BIO *bp,BN_CTX *ctx);
88int test_mod_exp(BIO *bp,BN_CTX *ctx);
89int test_exp(BIO *bp,BN_CTX *ctx);
90int test_kron(BIO *bp,BN_CTX *ctx);
91int test_sqrt(BIO *bp,BN_CTX *ctx);
92int rand_neg(void);
93static int results=0;
94
95static unsigned char lst[]="\xC6\x4F\x43\x04\x2A\xEA\xCA\x6E\x58\x36\x80\x5B\xE8\xC9"
96"\x9B\x04\x5D\x48\x36\xC2\xFD\x16\xC9\x64\xF0";
97
98static const char rnd_seed[] = "string to make the random number generator think it has entropy";
99
100static void message(BIO *out, char *m)
101 {
102 fprintf(stderr, "test %s\n", m);
103 BIO_puts(out, "print \"test ");
104 BIO_puts(out, m);
105 BIO_puts(out, "\\n\"\n");
106 }
107
108int main(int argc, char *argv[])
109 {
110 BN_CTX *ctx;
111 BIO *out;
112 char *outfile=NULL;
113
114 results = 0;
115
116 RAND_seed(rnd_seed, sizeof rnd_seed); /* or BN_generate_prime may fail */
117
118 argc--;
119 argv++;
120 while (argc >= 1)
121 {
122 if (strcmp(*argv,"-results") == 0)
123 results=1;
124 else if (strcmp(*argv,"-out") == 0)
125 {
126 if (--argc < 1) break;
127 outfile= *(++argv);
128 }
129 argc--;
130 argv++;
131 }
132
133
134 ctx=BN_CTX_new();
135 if (ctx == NULL) EXIT(1);
136
137 out=BIO_new(BIO_s_file());
138 if (out == NULL) EXIT(1);
139 if (outfile == NULL)
140 {
141 BIO_set_fp(out,stdout,BIO_NOCLOSE);
142 }
143 else
144 {
145 if (!BIO_write_filename(out,outfile))
146 {
147 perror(outfile);
148 EXIT(1);
149 }
150 }
151
152 if (!results)
153 BIO_puts(out,"obase=16\nibase=16\n");
154
155 message(out,"BN_add");
156 if (!test_add(out)) goto err;
157 BIO_flush(out);
158
159 message(out,"BN_sub");
160 if (!test_sub(out)) goto err;
161 BIO_flush(out);
162
163 message(out,"BN_lshift1");
164 if (!test_lshift1(out)) goto err;
165 BIO_flush(out);
166
167 message(out,"BN_lshift (fixed)");
168 if (!test_lshift(out,ctx,BN_bin2bn(lst,sizeof(lst)-1,NULL)))
169 goto err;
170 BIO_flush(out);
171
172 message(out,"BN_lshift");
173 if (!test_lshift(out,ctx,NULL)) goto err;
174 BIO_flush(out);
175
176 message(out,"BN_rshift1");
177 if (!test_rshift1(out)) goto err;
178 BIO_flush(out);
179
180 message(out,"BN_rshift");
181 if (!test_rshift(out,ctx)) goto err;
182 BIO_flush(out);
183
184 message(out,"BN_sqr");
185 if (!test_sqr(out,ctx)) goto err;
186 BIO_flush(out);
187
188 message(out,"BN_mul");
189 if (!test_mul(out)) goto err;
190 BIO_flush(out);
191
192 message(out,"BN_div");
193 if (!test_div(out,ctx)) goto err;
194 BIO_flush(out);
195
196 message(out,"BN_div_recp");
197 if (!test_div_recp(out,ctx)) goto err;
198 BIO_flush(out);
199
200 message(out,"BN_mod");
201 if (!test_mod(out,ctx)) goto err;
202 BIO_flush(out);
203
204 message(out,"BN_mod_mul");
205 if (!test_mod_mul(out,ctx)) goto err;
206 BIO_flush(out);
207
208 message(out,"BN_mont");
209 if (!test_mont(out,ctx)) goto err;
210 BIO_flush(out);
211
212 message(out,"BN_mod_exp");
213 if (!test_mod_exp(out,ctx)) goto err;
214 BIO_flush(out);
215
216 message(out,"BN_exp");
217 if (!test_exp(out,ctx)) goto err;
218 BIO_flush(out);
219
220 message(out,"BN_kronecker");
221 if (!test_kron(out,ctx)) goto err;
222 BIO_flush(out);
223
224 message(out,"BN_mod_sqrt");
225 if (!test_sqrt(out,ctx)) goto err;
226 BIO_flush(out);
227
228 BN_CTX_free(ctx);
229 BIO_free(out);
230
231/**/
232 EXIT(0);
233err:
234 BIO_puts(out,"1\n"); /* make sure the Perl script fed by bc notices
235 * the failure, see test_bn in test/Makefile */
236 BIO_flush(out);
237 ERR_load_crypto_strings();
238 ERR_print_errors_fp(stderr);
239 EXIT(1);
240 return(1);
241 }
242
243int test_add(BIO *bp)
244 {
245 BIGNUM a,b,c;
246 int i;
247
248 BN_init(&a);
249 BN_init(&b);
250 BN_init(&c);
251
252 BN_bntest_rand(&a,512,0,0);
253 for (i=0; i<num0; i++)
254 {
255 BN_bntest_rand(&b,450+i,0,0);
256 a.neg=rand_neg();
257 b.neg=rand_neg();
258 BN_add(&c,&a,&b);
259 if (bp != NULL)
260 {
261 if (!results)
262 {
263 BN_print(bp,&a);
264 BIO_puts(bp," + ");
265 BN_print(bp,&b);
266 BIO_puts(bp," - ");
267 }
268 BN_print(bp,&c);
269 BIO_puts(bp,"\n");
270 }
271 a.neg=!a.neg;
272 b.neg=!b.neg;
273 BN_add(&c,&c,&b);
274 BN_add(&c,&c,&a);
275 if(!BN_is_zero(&c))
276 {
277 fprintf(stderr,"Add test failed!\n");
278 return 0;
279 }
280 }
281 BN_free(&a);
282 BN_free(&b);
283 BN_free(&c);
284 return(1);
285 }
286
287int test_sub(BIO *bp)
288 {
289 BIGNUM a,b,c;
290 int i;
291
292 BN_init(&a);
293 BN_init(&b);
294 BN_init(&c);
295
296 for (i=0; i<num0+num1; i++)
297 {
298 if (i < num1)
299 {
300 BN_bntest_rand(&a,512,0,0);
301 BN_copy(&b,&a);
302 if (BN_set_bit(&a,i)==0) return(0);
303 BN_add_word(&b,i);
304 }
305 else
306 {
307 BN_bntest_rand(&b,400+i-num1,0,0);
308 a.neg=rand_neg();
309 b.neg=rand_neg();
310 }
311 BN_sub(&c,&a,&b);
312 if (bp != NULL)
313 {
314 if (!results)
315 {
316 BN_print(bp,&a);
317 BIO_puts(bp," - ");
318 BN_print(bp,&b);
319 BIO_puts(bp," - ");
320 }
321 BN_print(bp,&c);
322 BIO_puts(bp,"\n");
323 }
324 BN_add(&c,&c,&b);
325 BN_sub(&c,&c,&a);
326 if(!BN_is_zero(&c))
327 {
328 fprintf(stderr,"Subtract test failed!\n");
329 return 0;
330 }
331 }
332 BN_free(&a);
333 BN_free(&b);
334 BN_free(&c);
335 return(1);
336 }
337
338int test_div(BIO *bp, BN_CTX *ctx)
339 {
340 BIGNUM a,b,c,d,e;
341 int i;
342
343 BN_init(&a);
344 BN_init(&b);
345 BN_init(&c);
346 BN_init(&d);
347 BN_init(&e);
348
349 for (i=0; i<num0+num1; i++)
350 {
351 if (i < num1)
352 {
353 BN_bntest_rand(&a,400,0,0);
354 BN_copy(&b,&a);
355 BN_lshift(&a,&a,i);
356 BN_add_word(&a,i);
357 }
358 else
359 BN_bntest_rand(&b,50+3*(i-num1),0,0);
360 a.neg=rand_neg();
361 b.neg=rand_neg();
362 BN_div(&d,&c,&a,&b,ctx);
363 if (bp != NULL)
364 {
365 if (!results)
366 {
367 BN_print(bp,&a);
368 BIO_puts(bp," / ");
369 BN_print(bp,&b);
370 BIO_puts(bp," - ");
371 }
372 BN_print(bp,&d);
373 BIO_puts(bp,"\n");
374
375 if (!results)
376 {
377 BN_print(bp,&a);
378 BIO_puts(bp," % ");
379 BN_print(bp,&b);
380 BIO_puts(bp," - ");
381 }
382 BN_print(bp,&c);
383 BIO_puts(bp,"\n");
384 }
385 BN_mul(&e,&d,&b,ctx);
386 BN_add(&d,&e,&c);
387 BN_sub(&d,&d,&a);
388 if(!BN_is_zero(&d))
389 {
390 fprintf(stderr,"Division test failed!\n");
391 return 0;
392 }
393 }
394 BN_free(&a);
395 BN_free(&b);
396 BN_free(&c);
397 BN_free(&d);
398 BN_free(&e);
399 return(1);
400 }
401
402int test_div_recp(BIO *bp, BN_CTX *ctx)
403 {
404 BIGNUM a,b,c,d,e;
405 BN_RECP_CTX recp;
406 int i;
407
408 BN_RECP_CTX_init(&recp);
409 BN_init(&a);
410 BN_init(&b);
411 BN_init(&c);
412 BN_init(&d);
413 BN_init(&e);
414
415 for (i=0; i<num0+num1; i++)
416 {
417 if (i < num1)
418 {
419 BN_bntest_rand(&a,400,0,0);
420 BN_copy(&b,&a);
421 BN_lshift(&a,&a,i);
422 BN_add_word(&a,i);
423 }
424 else
425 BN_bntest_rand(&b,50+3*(i-num1),0,0);
426 a.neg=rand_neg();
427 b.neg=rand_neg();
428 BN_RECP_CTX_set(&recp,&b,ctx);
429 BN_div_recp(&d,&c,&a,&recp,ctx);
430 if (bp != NULL)
431 {
432 if (!results)
433 {
434 BN_print(bp,&a);
435 BIO_puts(bp," / ");
436 BN_print(bp,&b);
437 BIO_puts(bp," - ");
438 }
439 BN_print(bp,&d);
440 BIO_puts(bp,"\n");
441
442 if (!results)
443 {
444 BN_print(bp,&a);
445 BIO_puts(bp," % ");
446 BN_print(bp,&b);
447 BIO_puts(bp," - ");
448 }
449 BN_print(bp,&c);
450 BIO_puts(bp,"\n");
451 }
452 BN_mul(&e,&d,&b,ctx);
453 BN_add(&d,&e,&c);
454 BN_sub(&d,&d,&a);
455 if(!BN_is_zero(&d))
456 {
457 fprintf(stderr,"Reciprocal division test failed!\n");
458 fprintf(stderr,"a=");
459 BN_print_fp(stderr,&a);
460 fprintf(stderr,"\nb=");
461 BN_print_fp(stderr,&b);
462 fprintf(stderr,"\n");
463 return 0;
464 }
465 }
466 BN_free(&a);
467 BN_free(&b);
468 BN_free(&c);
469 BN_free(&d);
470 BN_free(&e);
471 BN_RECP_CTX_free(&recp);
472 return(1);
473 }
474
475int test_mul(BIO *bp)
476 {
477 BIGNUM a,b,c,d,e;
478 int i;
479 BN_CTX *ctx;
480
481 ctx = BN_CTX_new();
482 if (ctx == NULL) EXIT(1);
483
484 BN_init(&a);
485 BN_init(&b);
486 BN_init(&c);
487 BN_init(&d);
488 BN_init(&e);
489
490 for (i=0; i<num0+num1; i++)
491 {
492 if (i <= num1)
493 {
494 BN_bntest_rand(&a,100,0,0);
495 BN_bntest_rand(&b,100,0,0);
496 }
497 else
498 BN_bntest_rand(&b,i-num1,0,0);
499 a.neg=rand_neg();
500 b.neg=rand_neg();
501 BN_mul(&c,&a,&b,ctx);
502 if (bp != NULL)
503 {
504 if (!results)
505 {
506 BN_print(bp,&a);
507 BIO_puts(bp," * ");
508 BN_print(bp,&b);
509 BIO_puts(bp," - ");
510 }
511 BN_print(bp,&c);
512 BIO_puts(bp,"\n");
513 }
514 BN_div(&d,&e,&c,&a,ctx);
515 BN_sub(&d,&d,&b);
516 if(!BN_is_zero(&d) || !BN_is_zero(&e))
517 {
518 fprintf(stderr,"Multiplication test failed!\n");
519 return 0;
520 }
521 }
522 BN_free(&a);
523 BN_free(&b);
524 BN_free(&c);
525 BN_free(&d);
526 BN_free(&e);
527 BN_CTX_free(ctx);
528 return(1);
529 }
530
531int test_sqr(BIO *bp, BN_CTX *ctx)
532 {
533 BIGNUM a,c,d,e;
534 int i;
535
536 BN_init(&a);
537 BN_init(&c);
538 BN_init(&d);
539 BN_init(&e);
540
541 for (i=0; i<num0; i++)
542 {
543 BN_bntest_rand(&a,40+i*10,0,0);
544 a.neg=rand_neg();
545 BN_sqr(&c,&a,ctx);
546 if (bp != NULL)
547 {
548 if (!results)
549 {
550 BN_print(bp,&a);
551 BIO_puts(bp," * ");
552 BN_print(bp,&a);
553 BIO_puts(bp," - ");
554 }
555 BN_print(bp,&c);
556 BIO_puts(bp,"\n");
557 }
558 BN_div(&d,&e,&c,&a,ctx);
559 BN_sub(&d,&d,&a);
560 if(!BN_is_zero(&d) || !BN_is_zero(&e))
561 {
562 fprintf(stderr,"Square test failed!\n");
563 return 0;
564 }
565 }
566 BN_free(&a);
567 BN_free(&c);
568 BN_free(&d);
569 BN_free(&e);
570 return(1);
571 }
572
573int test_mont(BIO *bp, BN_CTX *ctx)
574 {
575 BIGNUM a,b,c,d,A,B;
576 BIGNUM n;
577 int i;
578 BN_MONT_CTX *mont;
579
580 BN_init(&a);
581 BN_init(&b);
582 BN_init(&c);
583 BN_init(&d);
584 BN_init(&A);
585 BN_init(&B);
586 BN_init(&n);
587
588 mont=BN_MONT_CTX_new();
589
590 BN_bntest_rand(&a,100,0,0); /**/
591 BN_bntest_rand(&b,100,0,0); /**/
592 for (i=0; i<num2; i++)
593 {
594 int bits = (200*(i+1))/num2;
595
596 if (bits == 0)
597 continue;
598 BN_bntest_rand(&n,bits,0,1);
599 BN_MONT_CTX_set(mont,&n,ctx);
600
601 BN_nnmod(&a,&a,&n,ctx);
602 BN_nnmod(&b,&b,&n,ctx);
603
604 BN_to_montgomery(&A,&a,mont,ctx);
605 BN_to_montgomery(&B,&b,mont,ctx);
606
607 BN_mod_mul_montgomery(&c,&A,&B,mont,ctx);/**/
608 BN_from_montgomery(&A,&c,mont,ctx);/**/
609 if (bp != NULL)
610 {
611 if (!results)
612 {
613#ifdef undef
614fprintf(stderr,"%d * %d %% %d\n",
615BN_num_bits(&a),
616BN_num_bits(&b),
617BN_num_bits(mont->N));
618#endif
619 BN_print(bp,&a);
620 BIO_puts(bp," * ");
621 BN_print(bp,&b);
622 BIO_puts(bp," % ");
623 BN_print(bp,&(mont->N));
624 BIO_puts(bp," - ");
625 }
626 BN_print(bp,&A);
627 BIO_puts(bp,"\n");
628 }
629 BN_mod_mul(&d,&a,&b,&n,ctx);
630 BN_sub(&d,&d,&A);
631 if(!BN_is_zero(&d))
632 {
633 fprintf(stderr,"Montgomery multiplication test failed!\n");
634 return 0;
635 }
636 }
637 BN_MONT_CTX_free(mont);
638 BN_free(&a);
639 BN_free(&b);
640 BN_free(&c);
641 BN_free(&d);
642 BN_free(&A);
643 BN_free(&B);
644 BN_free(&n);
645 return(1);
646 }
647
648int test_mod(BIO *bp, BN_CTX *ctx)
649 {
650 BIGNUM *a,*b,*c,*d,*e;
651 int i;
652
653 a=BN_new();
654 b=BN_new();
655 c=BN_new();
656 d=BN_new();
657 e=BN_new();
658
659 BN_bntest_rand(a,1024,0,0); /**/
660 for (i=0; i<num0; i++)
661 {
662 BN_bntest_rand(b,450+i*10,0,0); /**/
663 a->neg=rand_neg();
664 b->neg=rand_neg();
665 BN_mod(c,a,b,ctx);/**/
666 if (bp != NULL)
667 {
668 if (!results)
669 {
670 BN_print(bp,a);
671 BIO_puts(bp," % ");
672 BN_print(bp,b);
673 BIO_puts(bp," - ");
674 }
675 BN_print(bp,c);
676 BIO_puts(bp,"\n");
677 }
678 BN_div(d,e,a,b,ctx);
679 BN_sub(e,e,c);
680 if(!BN_is_zero(e))
681 {
682 fprintf(stderr,"Modulo test failed!\n");
683 return 0;
684 }
685 }
686 BN_free(a);
687 BN_free(b);
688 BN_free(c);
689 BN_free(d);
690 BN_free(e);
691 return(1);
692 }
693
694int test_mod_mul(BIO *bp, BN_CTX *ctx)
695 {
696 BIGNUM *a,*b,*c,*d,*e;
697 int i,j;
698
699 a=BN_new();
700 b=BN_new();
701 c=BN_new();
702 d=BN_new();
703 e=BN_new();
704
705 for (j=0; j<3; j++) {
706 BN_bntest_rand(c,1024,0,0); /**/
707 for (i=0; i<num0; i++)
708 {
709 BN_bntest_rand(a,475+i*10,0,0); /**/
710 BN_bntest_rand(b,425+i*11,0,0); /**/
711 a->neg=rand_neg();
712 b->neg=rand_neg();
713 if (!BN_mod_mul(e,a,b,c,ctx))
714 {
715 unsigned long l;
716
717 while ((l=ERR_get_error()))
718 fprintf(stderr,"ERROR:%s\n",
719 ERR_error_string(l,NULL));
720 EXIT(1);
721 }
722 if (bp != NULL)
723 {
724 if (!results)
725 {
726 BN_print(bp,a);
727 BIO_puts(bp," * ");
728 BN_print(bp,b);
729 BIO_puts(bp," % ");
730 BN_print(bp,c);
731 if ((a->neg ^ b->neg) && !BN_is_zero(e))
732 {
733 /* If (a*b) % c is negative, c must be added
734 * in order to obtain the normalized remainder
735 * (new with OpenSSL 0.9.7, previous versions of
736 * BN_mod_mul could generate negative results)
737 */
738 BIO_puts(bp," + ");
739 BN_print(bp,c);
740 }
741 BIO_puts(bp," - ");
742 }
743 BN_print(bp,e);
744 BIO_puts(bp,"\n");
745 }
746 BN_mul(d,a,b,ctx);
747 BN_sub(d,d,e);
748 BN_div(a,b,d,c,ctx);
749 if(!BN_is_zero(b))
750 {
751 fprintf(stderr,"Modulo multiply test failed!\n");
752 ERR_print_errors_fp(stderr);
753 return 0;
754 }
755 }
756 }
757 BN_free(a);
758 BN_free(b);
759 BN_free(c);
760 BN_free(d);
761 BN_free(e);
762 return(1);
763 }
764
765int test_mod_exp(BIO *bp, BN_CTX *ctx)
766 {
767 BIGNUM *a,*b,*c,*d,*e;
768 int i;
769
770 a=BN_new();
771 b=BN_new();
772 c=BN_new();
773 d=BN_new();
774 e=BN_new();
775
776 BN_bntest_rand(c,30,0,1); /* must be odd for montgomery */
777 for (i=0; i<num2; i++)
778 {
779 BN_bntest_rand(a,20+i*5,0,0); /**/
780 BN_bntest_rand(b,2+i,0,0); /**/
781
782 if (!BN_mod_exp(d,a,b,c,ctx))
783 return(0);
784
785 if (bp != NULL)
786 {
787 if (!results)
788 {
789 BN_print(bp,a);
790 BIO_puts(bp," ^ ");
791 BN_print(bp,b);
792 BIO_puts(bp," % ");
793 BN_print(bp,c);
794 BIO_puts(bp," - ");
795 }
796 BN_print(bp,d);
797 BIO_puts(bp,"\n");
798 }
799 BN_exp(e,a,b,ctx);
800 BN_sub(e,e,d);
801 BN_div(a,b,e,c,ctx);
802 if(!BN_is_zero(b))
803 {
804 fprintf(stderr,"Modulo exponentiation test failed!\n");
805 return 0;
806 }
807 }
808 BN_free(a);
809 BN_free(b);
810 BN_free(c);
811 BN_free(d);
812 BN_free(e);
813 return(1);
814 }
815
816int test_exp(BIO *bp, BN_CTX *ctx)
817 {
818 BIGNUM *a,*b,*d,*e,*one;
819 int i;
820
821 a=BN_new();
822 b=BN_new();
823 d=BN_new();
824 e=BN_new();
825 one=BN_new();
826 BN_one(one);
827
828 for (i=0; i<num2; i++)
829 {
830 BN_bntest_rand(a,20+i*5,0,0); /**/
831 BN_bntest_rand(b,2+i,0,0); /**/
832
833 if (!BN_exp(d,a,b,ctx))
834 return(0);
835
836 if (bp != NULL)
837 {
838 if (!results)
839 {
840 BN_print(bp,a);
841 BIO_puts(bp," ^ ");
842 BN_print(bp,b);
843 BIO_puts(bp," - ");
844 }
845 BN_print(bp,d);
846 BIO_puts(bp,"\n");
847 }
848 BN_one(e);
849 for( ; !BN_is_zero(b) ; BN_sub(b,b,one))
850 BN_mul(e,e,a,ctx);
851 BN_sub(e,e,d);
852 if(!BN_is_zero(e))
853 {
854 fprintf(stderr,"Exponentiation test failed!\n");
855 return 0;
856 }
857 }
858 BN_free(a);
859 BN_free(b);
860 BN_free(d);
861 BN_free(e);
862 BN_free(one);
863 return(1);
864 }
865
866static void genprime_cb(int p, int n, void *arg)
867 {
868 char c='*';
869
870 if (p == 0) c='.';
871 if (p == 1) c='+';
872 if (p == 2) c='*';
873 if (p == 3) c='\n';
874 putc(c, stderr);
875 fflush(stderr);
876 (void)n;
877 (void)arg;
878 }
879
880int test_kron(BIO *bp, BN_CTX *ctx)
881 {
882 BIGNUM *a,*b,*r,*t;
883 int i;
884 int legendre, kronecker;
885 int ret = 0;
886
887 a = BN_new();
888 b = BN_new();
889 r = BN_new();
890 t = BN_new();
891 if (a == NULL || b == NULL || r == NULL || t == NULL) goto err;
892
893 /* We test BN_kronecker(a, b, ctx) just for b odd (Jacobi symbol).
894 * In this case we know that if b is prime, then BN_kronecker(a, b, ctx)
895 * is congruent to $a^{(b-1)/2}$, modulo $b$ (Legendre symbol).
896 * So we generate a random prime b and compare these values
897 * for a number of random a's. (That is, we run the Solovay-Strassen
898 * primality test to confirm that b is prime, except that we
899 * don't want to test whether b is prime but whether BN_kronecker
900 * works.) */
901
902 if (!BN_generate_prime(b, 512, 0, NULL, NULL, genprime_cb, NULL)) goto err;
903 b->neg = rand_neg();
904 putc('\n', stderr);
905
906 for (i = 0; i < num0; i++)
907 {
908 if (!BN_bntest_rand(a, 512, 0, 0)) goto err;
909 a->neg = rand_neg();
910
911 /* t := (|b|-1)/2 (note that b is odd) */
912 if (!BN_copy(t, b)) goto err;
913 t->neg = 0;
914 if (!BN_sub_word(t, 1)) goto err;
915 if (!BN_rshift1(t, t)) goto err;
916 /* r := a^t mod b */
917 b->neg=0;
918
919 if (!BN_mod_exp_recp(r, a, t, b, ctx)) goto err;
920 b->neg=1;
921
922 if (BN_is_word(r, 1))
923 legendre = 1;
924 else if (BN_is_zero(r))
925 legendre = 0;
926 else
927 {
928 if (!BN_add_word(r, 1)) goto err;
929 if (0 != BN_ucmp(r, b))
930 {
931 fprintf(stderr, "Legendre symbol computation failed\n");
932 goto err;
933 }
934 legendre = -1;
935 }
936
937 kronecker = BN_kronecker(a, b, ctx);
938 if (kronecker < -1) goto err;
939 /* we actually need BN_kronecker(a, |b|) */
940 if (a->neg && b->neg)
941 kronecker = -kronecker;
942
943 if (legendre != kronecker)
944 {
945 fprintf(stderr, "legendre != kronecker; a = ");
946 BN_print_fp(stderr, a);
947 fprintf(stderr, ", b = ");
948 BN_print_fp(stderr, b);
949 fprintf(stderr, "\n");
950 goto err;
951 }
952
953 putc('.', stderr);
954 fflush(stderr);
955 }
956
957 putc('\n', stderr);
958 fflush(stderr);
959 ret = 1;
960 err:
961 if (a != NULL) BN_free(a);
962 if (b != NULL) BN_free(b);
963 if (r != NULL) BN_free(r);
964 if (t != NULL) BN_free(t);
965 return ret;
966 }
967
968int test_sqrt(BIO *bp, BN_CTX *ctx)
969 {
970 BIGNUM *a,*p,*r;
971 int i, j;
972 int ret = 0;
973
974 a = BN_new();
975 p = BN_new();
976 r = BN_new();
977 if (a == NULL || p == NULL || r == NULL) goto err;
978
979 for (i = 0; i < 16; i++)
980 {
981 if (i < 8)
982 {
983 unsigned primes[8] = { 2, 3, 5, 7, 11, 13, 17, 19 };
984
985 if (!BN_set_word(p, primes[i])) goto err;
986 }
987 else
988 {
989 if (!BN_set_word(a, 32)) goto err;
990 if (!BN_set_word(r, 2*i + 1)) goto err;
991
992 if (!BN_generate_prime(p, 256, 0, a, r, genprime_cb, NULL)) goto err;
993 putc('\n', stderr);
994 }
995 p->neg = rand_neg();
996
997 for (j = 0; j < num2; j++)
998 {
999 /* construct 'a' such that it is a square modulo p,
1000 * but in general not a proper square and not reduced modulo p */
1001 if (!BN_bntest_rand(r, 256, 0, 3)) goto err;
1002 if (!BN_nnmod(r, r, p, ctx)) goto err;
1003 if (!BN_mod_sqr(r, r, p, ctx)) goto err;
1004 if (!BN_bntest_rand(a, 256, 0, 3)) goto err;
1005 if (!BN_nnmod(a, a, p, ctx)) goto err;
1006 if (!BN_mod_sqr(a, a, p, ctx)) goto err;
1007 if (!BN_mul(a, a, r, ctx)) goto err;
1008 if (rand_neg())
1009 if (!BN_sub(a, a, p)) goto err;
1010
1011 if (!BN_mod_sqrt(r, a, p, ctx)) goto err;
1012 if (!BN_mod_sqr(r, r, p, ctx)) goto err;
1013
1014 if (!BN_nnmod(a, a, p, ctx)) goto err;
1015
1016 if (BN_cmp(a, r) != 0)
1017 {
1018 fprintf(stderr, "BN_mod_sqrt failed: a = ");
1019 BN_print_fp(stderr, a);
1020 fprintf(stderr, ", r = ");
1021 BN_print_fp(stderr, r);
1022 fprintf(stderr, ", p = ");
1023 BN_print_fp(stderr, p);
1024 fprintf(stderr, "\n");
1025 goto err;
1026 }
1027
1028 putc('.', stderr);
1029 fflush(stderr);
1030 }
1031
1032 putc('\n', stderr);
1033 fflush(stderr);
1034 }
1035 ret = 1;
1036 err:
1037 if (a != NULL) BN_free(a);
1038 if (p != NULL) BN_free(p);
1039 if (r != NULL) BN_free(r);
1040 return ret;
1041 }
1042
1043int test_lshift(BIO *bp,BN_CTX *ctx,BIGNUM *a_)
1044 {
1045 BIGNUM *a,*b,*c,*d;
1046 int i;
1047
1048 b=BN_new();
1049 c=BN_new();
1050 d=BN_new();
1051 BN_one(c);
1052
1053 if(a_)
1054 a=a_;
1055 else
1056 {
1057 a=BN_new();
1058 BN_bntest_rand(a,200,0,0); /**/
1059 a->neg=rand_neg();
1060 }
1061 for (i=0; i<num0; i++)
1062 {
1063 BN_lshift(b,a,i+1);
1064 BN_add(c,c,c);
1065 if (bp != NULL)
1066 {
1067 if (!results)
1068 {
1069 BN_print(bp,a);
1070 BIO_puts(bp," * ");
1071 BN_print(bp,c);
1072 BIO_puts(bp," - ");
1073 }
1074 BN_print(bp,b);
1075 BIO_puts(bp,"\n");
1076 }
1077 BN_mul(d,a,c,ctx);
1078 BN_sub(d,d,b);
1079 if(!BN_is_zero(d))
1080 {
1081 fprintf(stderr,"Left shift test failed!\n");
1082 fprintf(stderr,"a=");
1083 BN_print_fp(stderr,a);
1084 fprintf(stderr,"\nb=");
1085 BN_print_fp(stderr,b);
1086 fprintf(stderr,"\nc=");
1087 BN_print_fp(stderr,c);
1088 fprintf(stderr,"\nd=");
1089 BN_print_fp(stderr,d);
1090 fprintf(stderr,"\n");
1091 return 0;
1092 }
1093 }
1094 BN_free(a);
1095 BN_free(b);
1096 BN_free(c);
1097 BN_free(d);
1098 return(1);
1099 }
1100
1101int test_lshift1(BIO *bp)
1102 {
1103 BIGNUM *a,*b,*c;
1104 int i;
1105
1106 a=BN_new();
1107 b=BN_new();
1108 c=BN_new();
1109
1110 BN_bntest_rand(a,200,0,0); /**/
1111 a->neg=rand_neg();
1112 for (i=0; i<num0; i++)
1113 {
1114 BN_lshift1(b,a);
1115 if (bp != NULL)
1116 {
1117 if (!results)
1118 {
1119 BN_print(bp,a);
1120 BIO_puts(bp," * 2");
1121 BIO_puts(bp," - ");
1122 }
1123 BN_print(bp,b);
1124 BIO_puts(bp,"\n");
1125 }
1126 BN_add(c,a,a);
1127 BN_sub(a,b,c);
1128 if(!BN_is_zero(a))
1129 {
1130 fprintf(stderr,"Left shift one test failed!\n");
1131 return 0;
1132 }
1133
1134 BN_copy(a,b);
1135 }
1136 BN_free(a);
1137 BN_free(b);
1138 BN_free(c);
1139 return(1);
1140 }
1141
1142int test_rshift(BIO *bp,BN_CTX *ctx)
1143 {
1144 BIGNUM *a,*b,*c,*d,*e;
1145 int i;
1146
1147 a=BN_new();
1148 b=BN_new();
1149 c=BN_new();
1150 d=BN_new();
1151 e=BN_new();
1152 BN_one(c);
1153
1154 BN_bntest_rand(a,200,0,0); /**/
1155 a->neg=rand_neg();
1156 for (i=0; i<num0; i++)
1157 {
1158 BN_rshift(b,a,i+1);
1159 BN_add(c,c,c);
1160 if (bp != NULL)
1161 {
1162 if (!results)
1163 {
1164 BN_print(bp,a);
1165 BIO_puts(bp," / ");
1166 BN_print(bp,c);
1167 BIO_puts(bp," - ");
1168 }
1169 BN_print(bp,b);
1170 BIO_puts(bp,"\n");
1171 }
1172 BN_div(d,e,a,c,ctx);
1173 BN_sub(d,d,b);
1174 if(!BN_is_zero(d))
1175 {
1176 fprintf(stderr,"Right shift test failed!\n");
1177 return 0;
1178 }
1179 }
1180 BN_free(a);
1181 BN_free(b);
1182 BN_free(c);
1183 BN_free(d);
1184 BN_free(e);
1185 return(1);
1186 }
1187
1188int test_rshift1(BIO *bp)
1189 {
1190 BIGNUM *a,*b,*c;
1191 int i;
1192
1193 a=BN_new();
1194 b=BN_new();
1195 c=BN_new();
1196
1197 BN_bntest_rand(a,200,0,0); /**/
1198 a->neg=rand_neg();
1199 for (i=0; i<num0; i++)
1200 {
1201 BN_rshift1(b,a);
1202 if (bp != NULL)
1203 {
1204 if (!results)
1205 {
1206 BN_print(bp,a);
1207 BIO_puts(bp," / 2");
1208 BIO_puts(bp," - ");
1209 }
1210 BN_print(bp,b);
1211 BIO_puts(bp,"\n");
1212 }
1213 BN_sub(c,a,b);
1214 BN_sub(c,c,b);
1215 if(!BN_is_zero(c) && !BN_abs_is_word(c, 1))
1216 {
1217 fprintf(stderr,"Right shift one test failed!\n");
1218 return 0;
1219 }
1220 BN_copy(a,b);
1221 }
1222 BN_free(a);
1223 BN_free(b);
1224 BN_free(c);
1225 return(1);
1226 }
1227
1228int rand_neg(void)
1229 {
1230 static unsigned int neg=0;
1231 static int sign[8]={0,0,0,1,1,0,1,1};
1232
1233 return(sign[(neg++)%8]);
1234 }
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..07a1bcf51c
--- /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.3fms %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..b09cf88705
--- /dev/null
+++ b/src/lib/libcrypto/bn/exptest.c
@@ -0,0 +1,187 @@
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_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_recp=BN_new();
92 r_simple=BN_new();
93 a=BN_new();
94 b=BN_new();
95 m=BN_new();
96 if ( (r_mont == NULL) || (r_recp == NULL) ||
97 (a == NULL) || (b == NULL))
98 goto err;
99
100 out=BIO_new(BIO_s_file());
101
102 if (out == NULL) EXIT(1);
103 BIO_set_fp(out,stdout,BIO_NOCLOSE);
104
105 for (i=0; i<200; i++)
106 {
107 RAND_bytes(&c,1);
108 c=(c%BN_BITS)-BN_BITS2;
109 BN_rand(a,NUM_BITS+c,0,0);
110
111 RAND_bytes(&c,1);
112 c=(c%BN_BITS)-BN_BITS2;
113 BN_rand(b,NUM_BITS+c,0,0);
114
115 RAND_bytes(&c,1);
116 c=(c%BN_BITS)-BN_BITS2;
117 BN_rand(m,NUM_BITS+c,0,1);
118
119 BN_mod(a,a,m,ctx);
120 BN_mod(b,b,m,ctx);
121
122 ret=BN_mod_exp_mont(r_mont,a,b,m,ctx,NULL);
123 if (ret <= 0)
124 {
125 printf("BN_mod_exp_mont() problems\n");
126 ERR_print_errors(out);
127 EXIT(1);
128 }
129
130 ret=BN_mod_exp_recp(r_recp,a,b,m,ctx);
131 if (ret <= 0)
132 {
133 printf("BN_mod_exp_recp() problems\n");
134 ERR_print_errors(out);
135 EXIT(1);
136 }
137
138 ret=BN_mod_exp_simple(r_simple,a,b,m,ctx);
139 if (ret <= 0)
140 {
141 printf("BN_mod_exp_simple() problems\n");
142 ERR_print_errors(out);
143 EXIT(1);
144 }
145
146 if (BN_cmp(r_simple, r_mont) == 0
147 && BN_cmp(r_simple,r_recp) == 0)
148 {
149 printf(".");
150 fflush(stdout);
151 }
152 else
153 {
154 if (BN_cmp(r_simple,r_mont) != 0)
155 printf("\nsimple and mont results differ\n");
156 if (BN_cmp(r_simple,r_recp) != 0)
157 printf("\nsimple and recp results differ\n");
158
159 printf("a (%3d) = ",BN_num_bits(a)); BN_print(out,a);
160 printf("\nb (%3d) = ",BN_num_bits(b)); BN_print(out,b);
161 printf("\nm (%3d) = ",BN_num_bits(m)); BN_print(out,m);
162 printf("\nsimple ="); BN_print(out,r_simple);
163 printf("\nrecp ="); BN_print(out,r_recp);
164 printf("\nmont ="); BN_print(out,r_mont);
165 printf("\n");
166 EXIT(1);
167 }
168 }
169 BN_free(r_mont);
170 BN_free(r_recp);
171 BN_free(r_simple);
172 BN_free(a);
173 BN_free(b);
174 BN_free(m);
175 BN_CTX_free(ctx);
176 ERR_remove_state(0);
177 CRYPTO_mem_leaks(out);
178 BIO_free(out);
179 printf(" done\n");
180 EXIT(0);
181err:
182 ERR_load_crypto_strings();
183 ERR_print_errors(out);
184 EXIT(1);
185 return(1);
186 }
187
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..4b53c595a3
--- /dev/null
+++ b/src/lib/libcrypto/buffer/Makefile
@@ -0,0 +1,92 @@
1#
2# OpenSSL/crypto/buffer/Makefile
3#
4
5DIR= buffer
6TOP= ../..
7CC= cc
8INCLUDES= -I.. -I$(TOP) -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
18CFLAGS= $(INCLUDES) $(CFLAG)
19
20GENERAL=Makefile
21TEST=
22APPS=
23
24LIB=$(TOP)/libcrypto.a
25LIBSRC= buffer.c buf_err.c
26LIBOBJ= buffer.o buf_err.o
27
28SRC= $(LIBSRC)
29
30EXHEADER= buffer.h
31HEADER= $(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
45files:
46 $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
47
48links:
49 @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
50 @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
51 @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
52
53install:
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 $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(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
80buf_err.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
81buf_err.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
82buf_err.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
83buf_err.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
84buf_err.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
85buf_err.o: ../../include/openssl/symhacks.h buf_err.c
86buffer.o: ../../e_os.h ../../include/openssl/bio.h
87buffer.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
88buffer.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
89buffer.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
90buffer.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
91buffer.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
92buffer.o: ../cryptlib.h buffer.c
diff --git a/src/lib/libcrypto/buffer/Makefile.ssl b/src/lib/libcrypto/buffer/Makefile.ssl
new file mode 100644
index 0000000000..b131ca3078
--- /dev/null
+++ b/src/lib/libcrypto/buffer/Makefile.ssl
@@ -0,0 +1,94 @@
1#
2# SSLeay/crypto/buffer/Makefile
3#
4
5DIR= buffer
6TOP= ../..
7CC= cc
8INCLUDES= -I.. -I$(TOP) -I../../include
9CFLAG=-g
10INSTALL_PREFIX=
11OPENSSLDIR= /usr/local/ssl
12INSTALLTOP=/usr/local/ssl
13MAKE= make -f Makefile.ssl
14MAKEDEPPROG= makedepend
15MAKEDEPEND= $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG)
16MAKEFILE= Makefile.ssl
17AR= ar r
18
19CFLAGS= $(INCLUDES) $(CFLAG)
20
21GENERAL=Makefile
22TEST=
23APPS=
24
25LIB=$(TOP)/libcrypto.a
26LIBSRC= buffer.c buf_err.c
27LIBOBJ= buffer.o buf_err.o
28
29SRC= $(LIBSRC)
30
31EXHEADER= buffer.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.ssl >> $(TOP)/MINFO
48
49links:
50 @sh $(TOP)/util/point.sh Makefile.ssl Makefile
51 @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
52 @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
53 @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
54
55install:
56 @for i in $(EXHEADER) ; \
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 $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
72
73dclean:
74 $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
75 mv -f Makefile.new $(MAKEFILE)
76
77clean:
78 rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
79
80# DO NOT DELETE THIS LINE -- make depend depends on it.
81
82buf_err.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
83buf_err.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
84buf_err.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
85buf_err.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
86buf_err.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
87buf_err.o: ../../include/openssl/symhacks.h buf_err.c
88buffer.o: ../../e_os.h ../../include/openssl/bio.h
89buffer.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
90buffer.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
91buffer.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
92buffer.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
93buffer.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
94buffer.o: ../cryptlib.h buffer.c
diff --git a/src/lib/libcrypto/buffer/buf_err.c b/src/lib/libcrypto/buffer/buf_err.c
index 1fc32a6861..5eee653e14 100644
--- a/src/lib/libcrypto/buffer/buf_err.c
+++ b/src/lib/libcrypto/buffer/buf_err.c
@@ -1,6 +1,6 @@
1/* crypto/buffer/buf_err.c */ 1/* crypto/buffer/buf_err.c */
2/* ==================================================================== 2/* ====================================================================
3 * Copyright (c) 1999-2005 The OpenSSL Project. All rights reserved. 3 * Copyright (c) 1999 The OpenSSL Project. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
@@ -64,15 +64,11 @@
64 64
65/* BEGIN ERROR CODES */ 65/* BEGIN ERROR CODES */
66#ifndef OPENSSL_NO_ERR 66#ifndef OPENSSL_NO_ERR
67
68#define ERR_FUNC(func) ERR_PACK(ERR_LIB_BUF,func,0)
69#define ERR_REASON(reason) ERR_PACK(ERR_LIB_BUF,0,reason)
70
71static ERR_STRING_DATA BUF_str_functs[]= 67static ERR_STRING_DATA BUF_str_functs[]=
72 { 68 {
73{ERR_FUNC(BUF_F_BUF_MEM_GROW), "BUF_MEM_grow"}, 69{ERR_PACK(0,BUF_F_BUF_MEM_GROW,0), "BUF_MEM_grow"},
74{ERR_FUNC(BUF_F_BUF_MEM_NEW), "BUF_MEM_new"}, 70{ERR_PACK(0,BUF_F_BUF_MEM_NEW,0), "BUF_MEM_new"},
75{ERR_FUNC(BUF_F_BUF_STRDUP), "BUF_strdup"}, 71{ERR_PACK(0,BUF_F_BUF_STRDUP,0), "BUF_strdup"},
76{0,NULL} 72{0,NULL}
77 }; 73 };
78 74
@@ -91,8 +87,8 @@ void ERR_load_BUF_strings(void)
91 { 87 {
92 init=0; 88 init=0;
93#ifndef OPENSSL_NO_ERR 89#ifndef OPENSSL_NO_ERR
94 ERR_load_strings(0,BUF_str_functs); 90 ERR_load_strings(ERR_LIB_BUF,BUF_str_functs);
95 ERR_load_strings(0,BUF_str_reasons); 91 ERR_load_strings(ERR_LIB_BUF,BUF_str_reasons);
96#endif 92#endif
97 93
98 } 94 }
diff --git a/src/lib/libcrypto/cast/Makefile b/src/lib/libcrypto/cast/Makefile
new file mode 100644
index 0000000000..b388f6271c
--- /dev/null
+++ b/src/lib/libcrypto/cast/Makefile
@@ -0,0 +1,121 @@
1#
2# OpenSSL/crypto/cast/Makefile
3#
4
5DIR= cast
6TOP= ../..
7CC= cc
8CPP= $(CC) -E
9INCLUDES=
10CFLAG=-g
11INSTALL_PREFIX=
12OPENSSLDIR= /usr/local/ssl
13INSTALLTOP=/usr/local/ssl
14MAKEDEPPROG= makedepend
15MAKEDEPEND= $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG)
16MAKEFILE= Makefile
17AR= ar r
18
19CAST_ENC=c_enc.o
20# or use
21#CAST_ENC=asm/cx86-elf.o
22#CAST_ENC=asm/cx86-out.o
23#CAST_ENC=asm/cx86-sol.o
24#CAST_ENC=asm/cx86bdsi.o
25
26CFLAGS= $(INCLUDES) $(CFLAG)
27ASFLAGS= $(INCLUDES) $(ASFLAG)
28
29GENERAL=Makefile
30TEST=casttest.c
31APPS=
32
33LIB=$(TOP)/libcrypto.a
34LIBSRC=c_skey.c c_ecb.c c_enc.c c_cfb64.c c_ofb64.c
35LIBOBJ=c_skey.o c_ecb.o $(CAST_ENC) c_cfb64.o c_ofb64.o
36
37SRC= $(LIBSRC)
38
39EXHEADER= cast.h
40HEADER= cast_s.h cast_lcl.h $(EXHEADER)
41
42ALL= $(GENERAL) $(SRC) $(HEADER)
43
44top:
45 (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all)
46
47all: lib
48
49lib: $(LIBOBJ)
50 $(AR) $(LIB) $(LIBOBJ)
51 $(RANLIB) $(LIB) || echo Never mind.
52 @touch lib
53
54# elf
55asm/cx86-elf.s: asm/cast-586.pl ../perlasm/x86asm.pl ../perlasm/cbc.pl
56 (cd asm; $(PERL) cast-586.pl elf $(CLAGS) $(PROCESSOR) > cx86-elf.s)
57
58# a.out
59asm/cx86-out.o: asm/cx86unix.cpp
60 $(CPP) -DOUT asm/cx86unix.cpp | as -o asm/cx86-out.o
61
62# bsdi
63asm/cx86bsdi.o: asm/cx86unix.cpp
64 $(CPP) -DBSDI asm/cx86unix.cpp | sed 's/ :/:/' | as -o asm/cx86bsdi.o
65
66asm/cx86unix.cpp: asm/cast-586.pl ../perlasm/x86asm.pl ../perlasm/cbc.pl
67 (cd asm; $(PERL) cast-586.pl cpp $(PROCESSOR) >cx86unix.cpp)
68
69files:
70 $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
71
72links:
73 @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
74 @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
75 @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
76
77install:
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 $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
94
95dclean:
96 $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
97 mv -f Makefile.new $(MAKEFILE)
98
99clean:
100 rm -f asm/cx86unix.cpp asm/*-elf.* *.o asm/*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
101
102# DO NOT DELETE THIS LINE -- make depend depends on it.
103
104c_cfb64.o: ../../e_os.h ../../include/openssl/cast.h
105c_cfb64.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslconf.h
106c_cfb64.o: c_cfb64.c cast_lcl.h
107c_ecb.o: ../../e_os.h ../../include/openssl/cast.h
108c_ecb.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslconf.h
109c_ecb.o: ../../include/openssl/opensslv.h c_ecb.c cast_lcl.h
110c_enc.o: ../../e_os.h ../../include/openssl/cast.h
111c_enc.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslconf.h
112c_enc.o: c_enc.c cast_lcl.h
113c_ofb64.o: ../../e_os.h ../../include/openssl/cast.h
114c_ofb64.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslconf.h
115c_ofb64.o: c_ofb64.c cast_lcl.h
116c_skey.o: ../../e_os.h ../../include/openssl/cast.h
117c_skey.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
118c_skey.o: ../../include/openssl/fips.h ../../include/openssl/opensslconf.h
119c_skey.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
120c_skey.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
121c_skey.o: c_skey.c cast_lcl.h cast_s.h
diff --git a/src/lib/libcrypto/cast/Makefile.ssl b/src/lib/libcrypto/cast/Makefile.ssl
new file mode 100644
index 0000000000..98393a37ba
--- /dev/null
+++ b/src/lib/libcrypto/cast/Makefile.ssl
@@ -0,0 +1,120 @@
1#
2# SSLeay/crypto/cast/Makefile
3#
4
5DIR= cast
6TOP= ../..
7CC= cc
8CPP= $(CC) -E
9INCLUDES=
10CFLAG=-g
11INSTALL_PREFIX=
12OPENSSLDIR= /usr/local/ssl
13INSTALLTOP=/usr/local/ssl
14MAKE= make -f Makefile.ssl
15MAKEDEPPROG= makedepend
16MAKEDEPEND= $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG)
17MAKEFILE= Makefile.ssl
18AR= ar r
19
20CAST_ENC=c_enc.o
21# or use
22#CAST_ENC=asm/cx86-elf.o
23#CAST_ENC=asm/cx86-out.o
24#CAST_ENC=asm/cx86-sol.o
25#CAST_ENC=asm/cx86bdsi.o
26
27CFLAGS= $(INCLUDES) $(CFLAG)
28ASFLAGS= $(INCLUDES) $(ASFLAG)
29
30GENERAL=Makefile
31TEST=casttest.c
32APPS=
33
34LIB=$(TOP)/libcrypto.a
35LIBSRC=c_skey.c c_ecb.c c_enc.c c_cfb64.c c_ofb64.c
36LIBOBJ=c_skey.o c_ecb.o $(CAST_ENC) c_cfb64.o c_ofb64.o
37
38SRC= $(LIBSRC)
39
40EXHEADER= cast.h
41HEADER= cast_s.h cast_lcl.h $(EXHEADER)
42
43ALL= $(GENERAL) $(SRC) $(HEADER)
44
45top:
46 (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all)
47
48all: lib
49
50lib: $(LIBOBJ)
51 $(AR) $(LIB) $(LIBOBJ)
52 $(RANLIB) $(LIB) || echo Never mind.
53 @touch lib
54
55# elf
56asm/cx86-elf.s: asm/cast-586.pl ../perlasm/x86asm.pl ../perlasm/cbc.pl
57 (cd asm; $(PERL) cast-586.pl elf $(CLAGS) $(PROCESSOR) > cx86-elf.s)
58
59# a.out
60asm/cx86-out.o: asm/cx86unix.cpp
61 $(CPP) -DOUT asm/cx86unix.cpp | as -o asm/cx86-out.o
62
63# bsdi
64asm/cx86bsdi.o: asm/cx86unix.cpp
65 $(CPP) -DBSDI asm/cx86unix.cpp | sed 's/ :/:/' | as -o asm/cx86bsdi.o
66
67asm/cx86unix.cpp: asm/cast-586.pl ../perlasm/x86asm.pl ../perlasm/cbc.pl
68 (cd asm; $(PERL) cast-586.pl cpp $(PROCESSOR) >cx86unix.cpp)
69
70files:
71 $(PERL) $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO
72
73links:
74 @sh $(TOP)/util/point.sh Makefile.ssl Makefile
75 @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
76 @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
77 @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
78
79install:
80 @for i in $(EXHEADER) ; \
81 do \
82 (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
83 chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
84 done;
85
86tags:
87 ctags $(SRC)
88
89tests:
90
91lint:
92 lint -DLINT $(INCLUDES) $(SRC)>fluff
93
94depend:
95 $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
96
97dclean:
98 $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
99 mv -f Makefile.new $(MAKEFILE)
100
101clean:
102 rm -f asm/cx86unix.cpp asm/*-elf.* *.o asm/*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
103
104# DO NOT DELETE THIS LINE -- make depend depends on it.
105
106c_cfb64.o: ../../e_os.h ../../include/openssl/cast.h
107c_cfb64.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslconf.h
108c_cfb64.o: c_cfb64.c cast_lcl.h
109c_ecb.o: ../../e_os.h ../../include/openssl/cast.h
110c_ecb.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslconf.h
111c_ecb.o: ../../include/openssl/opensslv.h c_ecb.c cast_lcl.h
112c_enc.o: ../../e_os.h ../../include/openssl/cast.h
113c_enc.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslconf.h
114c_enc.o: c_enc.c cast_lcl.h
115c_ofb64.o: ../../e_os.h ../../include/openssl/cast.h
116c_ofb64.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslconf.h
117c_ofb64.o: c_ofb64.c cast_lcl.h
118c_skey.o: ../../e_os.h ../../include/openssl/cast.h
119c_skey.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslconf.h
120c_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 6be0bfe572..0ed55d1905 100644
--- a/src/lib/libcrypto/cast/asm/cast-586.pl
+++ b/src/lib/libcrypto/cast/asm/cast-586.pl
@@ -28,7 +28,7 @@ $S4="CAST_S_table3";
28 28
29&CAST_encrypt("CAST_encrypt",1); 29&CAST_encrypt("CAST_encrypt",1);
30&CAST_encrypt("CAST_decrypt",0); 30&CAST_encrypt("CAST_decrypt",0);
31&cbc("CAST_cbc_encrypt","CAST_encrypt","CAST_decrypt",1,4,5,3,-1,-1); 31&cbc("CAST_cbc_encrypt","CAST_encrypt","CAST_decrypt",1,4,5,3,-1,-1) unless $main'openbsd;
32 32
33&asm_finish(); 33&asm_finish();
34 34
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 0fe2cffecc..e80f65b698 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, CAST_KEY *key) 63void CAST_encrypt(CAST_LONG *data, CAST_KEY *key)
63 { 64 {
64 register CAST_LONG l,r,*k,t; 65 register CAST_LONG l,r,*k,t;
@@ -122,6 +123,7 @@ void CAST_decrypt(CAST_LONG *data, CAST_KEY *key)
122 data[1]=l&0xffffffffL; 123 data[1]=l&0xffffffffL;
123 data[0]=r&0xffffffffL; 124 data[0]=r&0xffffffffL;
124 } 125 }
126#endif
125 127
126void CAST_cbc_encrypt(const unsigned char *in, unsigned char *out, long length, 128void CAST_cbc_encrypt(const unsigned char *in, unsigned char *out, long length,
127 CAST_KEY *ks, unsigned char *iv, int enc) 129 CAST_KEY *ks, unsigned char *iv, int enc)
diff --git a/src/lib/libcrypto/cast/c_skey.c b/src/lib/libcrypto/cast/c_skey.c
index db9b7573e0..dc4791a8cf 100644
--- a/src/lib/libcrypto/cast/c_skey.c
+++ b/src/lib/libcrypto/cast/c_skey.c
@@ -57,7 +57,6 @@
57 */ 57 */
58 58
59#include <openssl/crypto.h> 59#include <openssl/crypto.h>
60#include <openssl/fips.h>
61#include <openssl/cast.h> 60#include <openssl/cast.h>
62 61
63#include "cast_lcl.h" 62#include "cast_lcl.h"
diff --git a/src/lib/libcrypto/cast/cast_lcl.h b/src/lib/libcrypto/cast/cast_lcl.h
index e756021a33..37f41cc6a4 100644
--- a/src/lib/libcrypto/cast/cast_lcl.h
+++ b/src/lib/libcrypto/cast/cast_lcl.h
@@ -64,6 +64,11 @@
64#endif 64#endif
65 65
66 66
67#ifdef OPENSSL_BUILD_SHLIBCRYPTO
68# undef OPENSSL_EXTERN
69# define OPENSSL_EXTERN OPENSSL_EXPORT
70#endif
71
67#undef c2l 72#undef c2l
68#define c2l(c,l) (l =((unsigned long)(*((c)++))) , \ 73#define c2l(c,l) (l =((unsigned long)(*((c)++))) , \
69 l|=((unsigned long)(*((c)++)))<< 8L, \ 74 l|=((unsigned long)(*((c)++)))<< 8L, \
@@ -217,11 +222,11 @@
217 } 222 }
218#endif 223#endif
219 224
220extern const CAST_LONG CAST_S_table0[256]; 225OPENSSL_EXTERN const CAST_LONG CAST_S_table0[256];
221extern const CAST_LONG CAST_S_table1[256]; 226OPENSSL_EXTERN const CAST_LONG CAST_S_table1[256];
222extern const CAST_LONG CAST_S_table2[256]; 227OPENSSL_EXTERN const CAST_LONG CAST_S_table2[256];
223extern const CAST_LONG CAST_S_table3[256]; 228OPENSSL_EXTERN const CAST_LONG CAST_S_table3[256];
224extern const CAST_LONG CAST_S_table4[256]; 229OPENSSL_EXTERN const CAST_LONG CAST_S_table4[256];
225extern const CAST_LONG CAST_S_table5[256]; 230OPENSSL_EXTERN const CAST_LONG CAST_S_table5[256];
226extern const CAST_LONG CAST_S_table6[256]; 231OPENSSL_EXTERN const CAST_LONG CAST_S_table6[256];
227extern const CAST_LONG CAST_S_table7[256]; 232OPENSSL_EXTERN const CAST_LONG CAST_S_table7[256];
diff --git a/src/lib/libcrypto/cast/cast_spd.c b/src/lib/libcrypto/cast/cast_spd.c
new file mode 100644
index 0000000000..76abf50d98
--- /dev/null
+++ b/src/lib/libcrypto/cast/cast_spd.c
@@ -0,0 +1,275 @@
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#include <signal.h>
73#ifndef _IRIX
74#include <time.h>
75#endif
76#ifdef TIMES
77#include <sys/types.h>
78#include <sys/times.h>
79#endif
80
81/* Depending on the VMS version, the tms structure is perhaps defined.
82 The __TMS macro will show if it was. If it wasn't defined, we should
83 undefine TIMES, since that tells the rest of the program how things
84 should be handled. -- Richard Levitte */
85#if defined(OPENSSL_SYS_VMS_DECC) && !defined(__TMS)
86#undef TIMES
87#endif
88
89#ifndef TIMES
90#include <sys/timeb.h>
91#endif
92
93#if defined(sun) || defined(__ultrix)
94#define _POSIX_SOURCE
95#include <limits.h>
96#include <sys/param.h>
97#endif
98
99#include <openssl/cast.h>
100
101/* The following if from times(3) man page. It may need to be changed */
102#ifndef HZ
103#ifndef CLK_TCK
104#define HZ 100.0
105#else /* CLK_TCK */
106#define HZ ((double)CLK_TCK)
107#endif
108#endif
109
110#define BUFSIZE ((long)1024)
111long run=0;
112
113double Time_F(int s);
114#ifdef SIGALRM
115#if defined(__STDC__) || defined(sgi) || defined(_AIX)
116#define SIGRETTYPE void
117#else
118#define SIGRETTYPE int
119#endif
120
121SIGRETTYPE sig_done(int sig);
122SIGRETTYPE sig_done(int sig)
123 {
124 signal(SIGALRM,sig_done);
125 run=0;
126#ifdef LINT
127 sig=sig;
128#endif
129 }
130#endif
131
132#define START 0
133#define STOP 1
134
135double Time_F(int s)
136 {
137 double ret;
138#ifdef TIMES
139 static struct tms tstart,tend;
140
141 if (s == START)
142 {
143 times(&tstart);
144 return(0);
145 }
146 else
147 {
148 times(&tend);
149 ret=((double)(tend.tms_utime-tstart.tms_utime))/HZ;
150 return((ret == 0.0)?1e-6:ret);
151 }
152#else /* !times() */
153 static struct timeb tstart,tend;
154 long i;
155
156 if (s == START)
157 {
158 ftime(&tstart);
159 return(0);
160 }
161 else
162 {
163 ftime(&tend);
164 i=(long)tend.millitm-(long)tstart.millitm;
165 ret=((double)(tend.time-tstart.time))+((double)i)/1e3;
166 return((ret == 0.0)?1e-6:ret);
167 }
168#endif
169 }
170
171int main(int argc, char **argv)
172 {
173 long count;
174 static unsigned char buf[BUFSIZE];
175 static unsigned char key[] ={
176 0x12,0x34,0x56,0x78,0x9a,0xbc,0xde,0xf0,
177 0xfe,0xdc,0xba,0x98,0x76,0x54,0x32,0x10,
178 };
179 CAST_KEY sch;
180 double a,b,c,d;
181#ifndef SIGALRM
182 long ca,cb,cc;
183#endif
184
185#ifndef TIMES
186 printf("To get the most accurate results, try to run this\n");
187 printf("program when this computer is idle.\n");
188#endif
189
190#ifndef SIGALRM
191 printf("First we calculate the approximate speed ...\n");
192 CAST_set_key(&sch,16,key);
193 count=10;
194 do {
195 long i;
196 CAST_LONG data[2];
197
198 count*=2;
199 Time_F(START);
200 for (i=count; i; i--)
201 CAST_encrypt(data,&sch);
202 d=Time_F(STOP);
203 } while (d < 3.0);
204 ca=count/512;
205 cb=count;
206 cc=count*8/BUFSIZE+1;
207 printf("Doing CAST_set_key %ld times\n",ca);
208#define COND(d) (count != (d))
209#define COUNT(d) (d)
210#else
211#define COND(c) (run)
212#define COUNT(d) (count)
213 signal(SIGALRM,sig_done);
214 printf("Doing CAST_set_key for 10 seconds\n");
215 alarm(10);
216#endif
217
218 Time_F(START);
219 for (count=0,run=1; COND(ca); count+=4)
220 {
221 CAST_set_key(&sch,16,key);
222 CAST_set_key(&sch,16,key);
223 CAST_set_key(&sch,16,key);
224 CAST_set_key(&sch,16,key);
225 }
226 d=Time_F(STOP);
227 printf("%ld cast set_key's in %.2f seconds\n",count,d);
228 a=((double)COUNT(ca))/d;
229
230#ifdef SIGALRM
231 printf("Doing CAST_encrypt's for 10 seconds\n");
232 alarm(10);
233#else
234 printf("Doing CAST_encrypt %ld times\n",cb);
235#endif
236 Time_F(START);
237 for (count=0,run=1; COND(cb); count+=4)
238 {
239 CAST_LONG data[2];
240
241 CAST_encrypt(data,&sch);
242 CAST_encrypt(data,&sch);
243 CAST_encrypt(data,&sch);
244 CAST_encrypt(data,&sch);
245 }
246 d=Time_F(STOP);
247 printf("%ld CAST_encrypt's in %.2f second\n",count,d);
248 b=((double)COUNT(cb)*8)/d;
249
250#ifdef SIGALRM
251 printf("Doing CAST_cbc_encrypt on %ld byte blocks for 10 seconds\n",
252 BUFSIZE);
253 alarm(10);
254#else
255 printf("Doing CAST_cbc_encrypt %ld times on %ld byte blocks\n",cc,
256 BUFSIZE);
257#endif
258 Time_F(START);
259 for (count=0,run=1; COND(cc); count++)
260 CAST_cbc_encrypt(buf,buf,BUFSIZE,&sch,
261 &(key[0]),CAST_ENCRYPT);
262 d=Time_F(STOP);
263 printf("%ld CAST_cbc_encrypt's of %ld byte blocks in %.2f second\n",
264 count,BUFSIZE,d);
265 c=((double)COUNT(cc)*BUFSIZE)/d;
266
267 printf("CAST set_key per sec = %12.2f (%9.3fuS)\n",a,1.0e6/a);
268 printf("CAST raw ecb bytes per sec = %12.2f (%9.3fuS)\n",b,8.0e6/b);
269 printf("CAST cbc bytes per sec = %12.2f (%9.3fuS)\n",c,8.0e6/c);
270 exit(0);
271#if defined(LINT) || defined(OPENSSL_SYS_MSDOS)
272 return(0);
273#endif
274 }
275
diff --git a/src/lib/libcrypto/cast/castopts.c b/src/lib/libcrypto/cast/castopts.c
new file mode 100644
index 0000000000..1b858d153b
--- /dev/null
+++ b/src/lib/libcrypto/cast/castopts.c
@@ -0,0 +1,339 @@
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#include <signal.h>
73#ifndef _IRIX
74#include <time.h>
75#endif
76#ifdef TIMES
77#include <sys/types.h>
78#include <sys/times.h>
79#endif
80
81/* Depending on the VMS version, the tms structure is perhaps defined.
82 The __TMS macro will show if it was. If it wasn't defined, we should
83 undefine TIMES, since that tells the rest of the program how things
84 should be handled. -- Richard Levitte */
85#if defined(OPENSSL_SYS_VMS_DECC) && !defined(__TMS)
86#undef TIMES
87#endif
88
89#ifndef TIMES
90#include <sys/timeb.h>
91#endif
92
93#if defined(sun) || defined(__ultrix)
94#define _POSIX_SOURCE
95#include <limits.h>
96#include <sys/param.h>
97#endif
98
99#include <openssl/cast.h>
100
101#define CAST_DEFAULT_OPTIONS
102
103#undef E_CAST
104#define CAST_encrypt CAST_encrypt_normal
105#define CAST_decrypt CAST_decrypt_normal
106#define CAST_cbc_encrypt CAST_cbc_encrypt_normal
107#undef HEADER_CAST_LOCL_H
108#include "c_enc.c"
109
110#define CAST_PTR
111#undef CAST_PTR2
112#undef E_CAST
113#undef CAST_encrypt
114#undef CAST_decrypt
115#undef CAST_cbc_encrypt
116#define CAST_encrypt CAST_encrypt_ptr
117#define CAST_decrypt CAST_decrypt_ptr
118#define CAST_cbc_encrypt CAST_cbc_encrypt_ptr
119#undef HEADER_CAST_LOCL_H
120#include "c_enc.c"
121
122#undef CAST_PTR
123#define CAST_PTR2
124#undef E_CAST
125#undef CAST_encrypt
126#undef CAST_decrypt
127#undef CAST_cbc_encrypt
128#define CAST_encrypt CAST_encrypt_ptr2
129#define CAST_decrypt CAST_decrypt_ptr2
130#define CAST_cbc_encrypt CAST_cbc_encrypt_ptr2
131#undef HEADER_CAST_LOCL_H
132#include "c_enc.c"
133
134/* The following if from times(3) man page. It may need to be changed */
135#ifndef HZ
136# ifndef CLK_TCK
137# ifndef _BSD_CLK_TCK_ /* FreeBSD fix */
138# define HZ 100.0
139# else /* _BSD_CLK_TCK_ */
140# define HZ ((double)_BSD_CLK_TCK_)
141# endif
142# else /* CLK_TCK */
143# define HZ ((double)CLK_TCK)
144# endif
145#endif
146
147#define BUFSIZE ((long)1024)
148long run=0;
149
150double Time_F(int s);
151#ifdef SIGALRM
152#if defined(__STDC__) || defined(sgi)
153#define SIGRETTYPE void
154#else
155#define SIGRETTYPE int
156#endif
157
158SIGRETTYPE sig_done(int sig);
159SIGRETTYPE sig_done(int sig)
160 {
161 signal(SIGALRM,sig_done);
162 run=0;
163#ifdef LINT
164 sig=sig;
165#endif
166 }
167#endif
168
169#define START 0
170#define STOP 1
171
172double Time_F(int s)
173 {
174 double ret;
175#ifdef TIMES
176 static struct tms tstart,tend;
177
178 if (s == START)
179 {
180 times(&tstart);
181 return(0);
182 }
183 else
184 {
185 times(&tend);
186 ret=((double)(tend.tms_utime-tstart.tms_utime))/HZ;
187 return((ret == 0.0)?1e-6:ret);
188 }
189#else /* !times() */
190 static struct timeb tstart,tend;
191 long i;
192
193 if (s == START)
194 {
195 ftime(&tstart);
196 return(0);
197 }
198 else
199 {
200 ftime(&tend);
201 i=(long)tend.millitm-(long)tstart.millitm;
202 ret=((double)(tend.time-tstart.time))+((double)i)/1000.0;
203 return((ret == 0.0)?1e-6:ret);
204 }
205#endif
206 }
207
208#ifdef SIGALRM
209#define print_name(name) fprintf(stderr,"Doing %s's for 10 seconds\n",name); alarm(10);
210#else
211#define print_name(name) fprintf(stderr,"Doing %s %ld times\n",name,cb);
212#endif
213
214#define time_it(func,name,index) \
215 print_name(name); \
216 Time_F(START); \
217 for (count=0,run=1; COND(cb); count+=4) \
218 { \
219 unsigned long d[2]; \
220 func(d,&sch); \
221 func(d,&sch); \
222 func(d,&sch); \
223 func(d,&sch); \
224 } \
225 tm[index]=Time_F(STOP); \
226 fprintf(stderr,"%ld %s's in %.2f second\n",count,name,tm[index]); \
227 tm[index]=((double)COUNT(cb))/tm[index];
228
229#define print_it(name,index) \
230 fprintf(stderr,"%s bytes per sec = %12.2f (%5.1fuS)\n",name, \
231 tm[index]*8,1.0e6/tm[index]);
232
233int main(int argc, char **argv)
234 {
235 long count;
236 static unsigned char buf[BUFSIZE];
237 static char key[16]={ 0x12,0x34,0x56,0x78,0x9a,0xbc,0xde,0xf0,
238 0x12,0x34,0x56,0x78,0x9a,0xbc,0xde,0xf0};
239 CAST_KEY sch;
240 double d,tm[16],max=0;
241 int rank[16];
242 char *str[16];
243 int max_idx=0,i,num=0,j;
244#ifndef SIGALARM
245 long ca,cb,cc,cd,ce;
246#endif
247
248 for (i=0; i<12; i++)
249 {
250 tm[i]=0.0;
251 rank[i]=0;
252 }
253
254#ifndef TIMES
255 fprintf(stderr,"To get the most accurate results, try to run this\n");
256 fprintf(stderr,"program when this computer is idle.\n");
257#endif
258
259 CAST_set_key(&sch,16,key);
260
261#ifndef SIGALRM
262 fprintf(stderr,"First we calculate the approximate speed ...\n");
263 count=10;
264 do {
265 long i;
266 unsigned long data[2];
267
268 count*=2;
269 Time_F(START);
270 for (i=count; i; i--)
271 CAST_encrypt(data,&sch);
272 d=Time_F(STOP);
273 } while (d < 3.0);
274 ca=count;
275 cb=count*3;
276 cc=count*3*8/BUFSIZE+1;
277 cd=count*8/BUFSIZE+1;
278
279 ce=count/20+1;
280#define COND(d) (count != (d))
281#define COUNT(d) (d)
282#else
283#define COND(c) (run)
284#define COUNT(d) (count)
285 signal(SIGALRM,sig_done);
286 alarm(10);
287#endif
288
289 time_it(CAST_encrypt_normal, "CAST_encrypt_normal ", 0);
290 time_it(CAST_encrypt_ptr, "CAST_encrypt_ptr ", 1);
291 time_it(CAST_encrypt_ptr2, "CAST_encrypt_ptr2 ", 2);
292 num+=3;
293
294 str[0]="<nothing>";
295 print_it("CAST_encrypt_normal ",0);
296 max=tm[0];
297 max_idx=0;
298 str[1]="ptr ";
299 print_it("CAST_encrypt_ptr ",1);
300 if (max < tm[1]) { max=tm[1]; max_idx=1; }
301 str[2]="ptr2 ";
302 print_it("CAST_encrypt_ptr2 ",2);
303 if (max < tm[2]) { max=tm[2]; max_idx=2; }
304
305 printf("options CAST ecb/s\n");
306 printf("%s %12.2f 100.0%%\n",str[max_idx],tm[max_idx]);
307 d=tm[max_idx];
308 tm[max_idx]= -2.0;
309 max= -1.0;
310 for (;;)
311 {
312 for (i=0; i<3; i++)
313 {
314 if (max < tm[i]) { max=tm[i]; j=i; }
315 }
316 if (max < 0.0) break;
317 printf("%s %12.2f %4.1f%%\n",str[j],tm[j],tm[j]/d*100.0);
318 tm[j]= -2.0;
319 max= -1.0;
320 }
321
322 switch (max_idx)
323 {
324 case 0:
325 printf("-DCAST_DEFAULT_OPTIONS\n");
326 break;
327 case 1:
328 printf("-DCAST_PTR\n");
329 break;
330 case 2:
331 printf("-DCAST_PTR2\n");
332 break;
333 }
334 exit(0);
335#if defined(LINT) || defined(OPENSSL_SYS_MSDOS)
336 return(0);
337#endif
338 }
339
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..83e5a16c73
--- /dev/null
+++ b/src/lib/libcrypto/cast/casttest.c
@@ -0,0 +1,232 @@
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
63#include "../e_os.h"
64
65#ifdef OPENSSL_NO_CAST
66int main(int argc, char *argv[])
67{
68 printf("No CAST support\n");
69 return(0);
70}
71#else
72#include <openssl/cast.h>
73
74#define FULL_TEST
75
76static unsigned char k[16]={
77 0x01,0x23,0x45,0x67,0x12,0x34,0x56,0x78,
78 0x23,0x45,0x67,0x89,0x34,0x56,0x78,0x9A
79 };
80
81static unsigned char in[8]={ 0x01,0x23,0x45,0x67,0x89,0xAB,0xCD,0xEF};
82
83static int k_len[3]={16,10,5};
84static unsigned char c[3][8]={
85 {0x23,0x8B,0x4F,0xE5,0x84,0x7E,0x44,0xB2},
86 {0xEB,0x6A,0x71,0x1A,0x2C,0x02,0x27,0x1B},
87 {0x7A,0xC8,0x16,0xD1,0x6E,0x9B,0x30,0x2E},
88 };
89static unsigned char out[80];
90
91static unsigned char in_a[16]={
92 0x01,0x23,0x45,0x67,0x12,0x34,0x56,0x78,
93 0x23,0x45,0x67,0x89,0x34,0x56,0x78,0x9A};
94static unsigned char in_b[16]={
95 0x01,0x23,0x45,0x67,0x12,0x34,0x56,0x78,
96 0x23,0x45,0x67,0x89,0x34,0x56,0x78,0x9A};
97
98static unsigned char c_a[16]={
99 0xEE,0xA9,0xD0,0xA2,0x49,0xFD,0x3B,0xA6,
100 0xB3,0x43,0x6F,0xB8,0x9D,0x6D,0xCA,0x92};
101static unsigned char c_b[16]={
102 0xB2,0xC9,0x5E,0xB0,0x0C,0x31,0xAD,0x71,
103 0x80,0xAC,0x05,0xB8,0xE8,0x3D,0x69,0x6E};
104
105#if 0
106char *text="Hello to all people out there";
107
108static unsigned char cfb_key[16]={
109 0xe1,0xf0,0xc3,0xd2,0xa5,0xb4,0x87,0x96,
110 0x69,0x78,0x4b,0x5a,0x2d,0x3c,0x0f,0x1e,
111 };
112static unsigned char cfb_iv[80]={0x34,0x12,0x78,0x56,0xab,0x90,0xef,0xcd};
113static unsigned char cfb_buf1[40],cfb_buf2[40],cfb_tmp[8];
114#define CFB_TEST_SIZE 24
115static unsigned char plain[CFB_TEST_SIZE]=
116 {
117 0x4e,0x6f,0x77,0x20,0x69,0x73,
118 0x20,0x74,0x68,0x65,0x20,0x74,
119 0x69,0x6d,0x65,0x20,0x66,0x6f,
120 0x72,0x20,0x61,0x6c,0x6c,0x20
121 };
122static unsigned char cfb_cipher64[CFB_TEST_SIZE]={
123 0x59,0xD8,0xE2,0x65,0x00,0x58,0x6C,0x3F,
124 0x2C,0x17,0x25,0xD0,0x1A,0x38,0xB7,0x2A,
125 0x39,0x61,0x37,0xDC,0x79,0xFB,0x9F,0x45
126
127/* 0xF9,0x78,0x32,0xB5,0x42,0x1A,0x6B,0x38,
128 0x9A,0x44,0xD6,0x04,0x19,0x43,0xC4,0xD9,
129 0x3D,0x1E,0xAE,0x47,0xFC,0xCF,0x29,0x0B,*/
130 };
131#endif
132
133int main(int argc, char *argv[])
134 {
135#ifdef FULL_TEST
136 long l;
137 CAST_KEY key_b;
138#endif
139 int i,z,err=0;
140 CAST_KEY key;
141
142 for (z=0; z<3; z++)
143 {
144 CAST_set_key(&key,k_len[z],k);
145
146 CAST_ecb_encrypt(in,out,&key,CAST_ENCRYPT);
147 if (memcmp(out,&(c[z][0]),8) != 0)
148 {
149 printf("ecb cast error encrypting for keysize %d\n",k_len[z]*8);
150 printf("got :");
151 for (i=0; i<8; i++)
152 printf("%02X ",out[i]);
153 printf("\n");
154 printf("expected:");
155 for (i=0; i<8; i++)
156 printf("%02X ",c[z][i]);
157 err=20;
158 printf("\n");
159 }
160
161 CAST_ecb_encrypt(out,out,&key,CAST_DECRYPT);
162 if (memcmp(out,in,8) != 0)
163 {
164 printf("ecb cast error decrypting for keysize %d\n",k_len[z]*8);
165 printf("got :");
166 for (i=0; i<8; i++)
167 printf("%02X ",out[i]);
168 printf("\n");
169 printf("expected:");
170 for (i=0; i<8; i++)
171 printf("%02X ",in[i]);
172 printf("\n");
173 err=3;
174 }
175 }
176 if (err == 0)
177 printf("ecb cast5 ok\n");
178
179#ifdef FULL_TEST
180 {
181 unsigned char out_a[16],out_b[16];
182 static char *hex="0123456789ABCDEF";
183
184 printf("This test will take some time....");
185 fflush(stdout);
186 memcpy(out_a,in_a,sizeof(in_a));
187 memcpy(out_b,in_b,sizeof(in_b));
188 i=1;
189
190 for (l=0; l<1000000L; l++)
191 {
192 CAST_set_key(&key_b,16,out_b);
193 CAST_ecb_encrypt(&(out_a[0]),&(out_a[0]),&key_b,CAST_ENCRYPT);
194 CAST_ecb_encrypt(&(out_a[8]),&(out_a[8]),&key_b,CAST_ENCRYPT);
195 CAST_set_key(&key,16,out_a);
196 CAST_ecb_encrypt(&(out_b[0]),&(out_b[0]),&key,CAST_ENCRYPT);
197 CAST_ecb_encrypt(&(out_b[8]),&(out_b[8]),&key,CAST_ENCRYPT);
198 if ((l & 0xffff) == 0xffff)
199 {
200 printf("%c",hex[i&0x0f]);
201 fflush(stdout);
202 i++;
203 }
204 }
205
206 if ( (memcmp(out_a,c_a,sizeof(c_a)) != 0) ||
207 (memcmp(out_b,c_b,sizeof(c_b)) != 0))
208 {
209 printf("\n");
210 printf("Error\n");
211
212 printf("A out =");
213 for (i=0; i<16; i++) printf("%02X ",out_a[i]);
214 printf("\nactual=");
215 for (i=0; i<16; i++) printf("%02X ",c_a[i]);
216 printf("\n");
217
218 printf("B out =");
219 for (i=0; i<16; i++) printf("%02X ",out_b[i]);
220 printf("\nactual=");
221 for (i=0; i<16; i++) printf("%02X ",c_b[i]);
222 printf("\n");
223 }
224 else
225 printf(" ok\n");
226 }
227#endif
228
229 EXIT(err);
230 return(err);
231 }
232#endif
diff --git a/src/lib/libcrypto/comp/Makefile b/src/lib/libcrypto/comp/Makefile
new file mode 100644
index 0000000000..df1babec5c
--- /dev/null
+++ b/src/lib/libcrypto/comp/Makefile
@@ -0,0 +1,113 @@
1#
2# OpenSSL/crypto/comp/Makefile
3#
4
5DIR= comp
6TOP= ../..
7CC= cc
8INCLUDES= -I.. -I$(TOP) -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
18CFLAGS= $(INCLUDES) $(CFLAG)
19
20GENERAL=Makefile
21TEST=
22APPS=
23
24LIB=$(TOP)/libcrypto.a
25LIBSRC= comp_lib.c comp_err.c \
26 c_rle.c c_zlib.c
27
28LIBOBJ= comp_lib.o comp_err.o \
29 c_rle.o c_zlib.o
30
31SRC= $(LIBSRC)
32
33EXHEADER= comp.h
34HEADER= $(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
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 @headerlist="$(EXHEADER)"; for i in $$headerlist ; \
58 do \
59 (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
60 chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
61 done;
62
63tags:
64 ctags $(SRC)
65
66tests:
67
68lint:
69 lint -DLINT $(INCLUDES) $(SRC)>fluff
70
71depend:
72 $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(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
83c_rle.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
84c_rle.o: ../../include/openssl/bn.h ../../include/openssl/comp.h
85c_rle.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
86c_rle.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
87c_rle.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
88c_rle.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
89c_rle.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h c_rle.c
90c_zlib.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
91c_zlib.o: ../../include/openssl/bn.h ../../include/openssl/comp.h
92c_zlib.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
93c_zlib.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
94c_zlib.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
95c_zlib.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
96c_zlib.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
97c_zlib.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
98c_zlib.o: c_zlib.c
99comp_err.o: ../../include/openssl/bio.h ../../include/openssl/comp.h
100comp_err.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
101comp_err.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
102comp_err.o: ../../include/openssl/opensslconf.h
103comp_err.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
104comp_err.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
105comp_err.o: comp_err.c
106comp_lib.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
107comp_lib.o: ../../include/openssl/bn.h ../../include/openssl/comp.h
108comp_lib.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
109comp_lib.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
110comp_lib.o: ../../include/openssl/opensslconf.h
111comp_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
112comp_lib.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
113comp_lib.o: ../../include/openssl/symhacks.h comp_lib.c
diff --git a/src/lib/libcrypto/comp/Makefile.ssl b/src/lib/libcrypto/comp/Makefile.ssl
new file mode 100644
index 0000000000..f70ba1b285
--- /dev/null
+++ b/src/lib/libcrypto/comp/Makefile.ssl
@@ -0,0 +1,114 @@
1#
2# SSLeay/crypto/comp/Makefile
3#
4
5DIR= comp
6TOP= ../..
7CC= cc
8INCLUDES= -I.. -I$(TOP) -I../../include
9CFLAG=-g
10INSTALL_PREFIX=
11OPENSSLDIR= /usr/local/ssl
12INSTALLTOP=/usr/local/ssl
13MAKE= make -f Makefile.ssl
14MAKEDEPPROG= makedepend
15MAKEDEPEND= $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG)
16MAKEFILE= Makefile.ssl
17AR= ar r
18
19CFLAGS= $(INCLUDES) $(CFLAG)
20
21GENERAL=Makefile
22TEST=
23APPS=
24
25LIB=$(TOP)/libcrypto.a
26LIBSRC= comp_lib.c comp_err.c \
27 c_rle.c c_zlib.c
28
29LIBOBJ= comp_lib.o comp_err.o \
30 c_rle.o c_zlib.o
31
32SRC= $(LIBSRC)
33
34EXHEADER= comp.h
35HEADER= $(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.ssl >> $(TOP)/MINFO
51
52links:
53 @sh $(TOP)/util/point.sh Makefile.ssl Makefile
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 @for i in $(EXHEADER) ; \
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 $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(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 *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
82
83# DO NOT DELETE THIS LINE -- make depend depends on it.
84
85c_rle.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
86c_rle.o: ../../include/openssl/bn.h ../../include/openssl/comp.h
87c_rle.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
88c_rle.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
89c_rle.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
90c_rle.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
91c_rle.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h c_rle.c
92c_zlib.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
93c_zlib.o: ../../include/openssl/bn.h ../../include/openssl/comp.h
94c_zlib.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
95c_zlib.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
96c_zlib.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
97c_zlib.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
98c_zlib.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
99c_zlib.o: c_zlib.c
100comp_err.o: ../../include/openssl/bio.h ../../include/openssl/comp.h
101comp_err.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
102comp_err.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
103comp_err.o: ../../include/openssl/opensslconf.h
104comp_err.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
105comp_err.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
106comp_err.o: comp_err.c
107comp_lib.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
108comp_lib.o: ../../include/openssl/bn.h ../../include/openssl/comp.h
109comp_lib.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
110comp_lib.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
111comp_lib.o: ../../include/openssl/opensslconf.h
112comp_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
113comp_lib.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
114comp_lib.o: ../../include/openssl/symhacks.h comp_lib.c
diff --git a/src/lib/libcrypto/comp/c_zlib.c b/src/lib/libcrypto/comp/c_zlib.c
index 5fcb521ffb..1bd2850d15 100644
--- a/src/lib/libcrypto/comp/c_zlib.c
+++ b/src/lib/libcrypto/comp/c_zlib.c
@@ -51,17 +51,30 @@ static COMP_METHOD zlib_method={
51 */ 51 */
52#if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_WIN32) 52#if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_WIN32)
53# include <windows.h> 53# include <windows.h>
54
55# define Z_CALLCONV _stdcall
56# define ZLIB_SHARED
57#else
58# define Z_CALLCONV
54#endif /* !(OPENSSL_SYS_WINDOWS || OPENSSL_SYS_WIN32) */ 59#endif /* !(OPENSSL_SYS_WINDOWS || OPENSSL_SYS_WIN32) */
55 60
56#ifdef ZLIB_SHARED 61#ifdef ZLIB_SHARED
57#include <openssl/dso.h> 62#include <openssl/dso.h>
58 63
64/* Prototypes for built in stubs */
65static int stub_compress(Bytef *dest,uLongf *destLen,
66 const Bytef *source, uLong sourceLen);
67static int stub_inflateEnd(z_streamp strm);
68static int stub_inflate(z_streamp strm, int flush);
69static int stub_inflateInit_(z_streamp strm, const char * version,
70 int stream_size);
71
59/* Function pointers */ 72/* Function pointers */
60typedef int (*compress_ft)(Bytef *dest,uLongf *destLen, 73typedef int (Z_CALLCONV *compress_ft)(Bytef *dest,uLongf *destLen,
61 const Bytef *source, uLong sourceLen); 74 const Bytef *source, uLong sourceLen);
62typedef int (*inflateEnd_ft)(z_streamp strm); 75typedef int (Z_CALLCONV *inflateEnd_ft)(z_streamp strm);
63typedef int (*inflate_ft)(z_streamp strm, int flush); 76typedef int (Z_CALLCONV *inflate_ft)(z_streamp strm, int flush);
64typedef int (*inflateInit__ft)(z_streamp strm, 77typedef int (Z_CALLCONV *inflateInit__ft)(z_streamp strm,
65 const char * version, int stream_size); 78 const char * version, int stream_size);
66static compress_ft p_compress=NULL; 79static compress_ft p_compress=NULL;
67static inflateEnd_ft p_inflateEnd=NULL; 80static inflateEnd_ft p_inflateEnd=NULL;
@@ -71,10 +84,10 @@ static inflateInit__ft p_inflateInit_=NULL;
71static int zlib_loaded = 0; /* only attempt to init func pts once */ 84static int zlib_loaded = 0; /* only attempt to init func pts once */
72static DSO *zlib_dso = NULL; 85static DSO *zlib_dso = NULL;
73 86
74#define compress p_compress 87#define compress stub_compress
75#define inflateEnd p_inflateEnd 88#define inflateEnd stub_inflateEnd
76#define inflate p_inflate 89#define inflate stub_inflate
77#define inflateInit_ p_inflateInit_ 90#define inflateInit_ stub_inflateInit_
78#endif /* ZLIB_SHARED */ 91#endif /* ZLIB_SHARED */
79 92
80static int zlib_compress_block(COMP_CTX *ctx, unsigned char *out, 93static int zlib_compress_block(COMP_CTX *ctx, unsigned char *out,
@@ -178,6 +191,16 @@ COMP_METHOD *COMP_zlib(void)
178 { 191 {
179#if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_WIN32) 192#if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_WIN32)
180 zlib_dso = DSO_load(NULL, "ZLIB1", NULL, 0); 193 zlib_dso = DSO_load(NULL, "ZLIB1", NULL, 0);
194 if (!zlib_dso)
195 {
196 zlib_dso = DSO_load(NULL, "ZLIB", NULL, 0);
197 if (zlib_dso)
198 {
199 /* Clear the errors from the first failed
200 DSO_load() */
201 ERR_clear_error();
202 }
203 }
181#else 204#else
182 zlib_dso = DSO_load(NULL, "z", NULL, 0); 205 zlib_dso = DSO_load(NULL, "z", NULL, 0);
183#endif 206#endif
@@ -195,21 +218,54 @@ COMP_METHOD *COMP_zlib(void)
195 p_inflateInit_ 218 p_inflateInit_
196 = (inflateInit__ft) DSO_bind_func(zlib_dso, 219 = (inflateInit__ft) DSO_bind_func(zlib_dso,
197 "inflateInit_"); 220 "inflateInit_");
198 221 zlib_loaded++;
199 if (p_compress && p_inflateEnd && p_inflate
200 && p_inflateInit_)
201 zlib_loaded++;
202 } 222 }
203 } 223 }
204 224
205#endif 225#endif
206#ifdef ZLIB_SHARED
207 if (zlib_loaded)
208#endif
209#if defined(ZLIB) || defined(ZLIB_SHARED) 226#if defined(ZLIB) || defined(ZLIB_SHARED)
210 meth = &zlib_method; 227 meth = &zlib_method;
211#endif 228#endif
212 229
213 return(meth); 230 return(meth);
214 } 231 }
215 232
233#ifdef ZLIB_SHARED
234/* Stubs for each function to be dynamicly loaded */
235static int
236stub_compress(Bytef *dest,uLongf *destLen,const Bytef *source, uLong sourceLen)
237 {
238 if (p_compress)
239 return(p_compress(dest,destLen,source,sourceLen));
240 else
241 return(Z_MEM_ERROR);
242 }
243
244static int
245stub_inflateEnd(z_streamp strm)
246 {
247 if ( p_inflateEnd )
248 return(p_inflateEnd(strm));
249 else
250 return(Z_MEM_ERROR);
251 }
252
253static int
254stub_inflate(z_streamp strm, int flush)
255 {
256 if ( p_inflate )
257 return(p_inflate(strm,flush));
258 else
259 return(Z_MEM_ERROR);
260 }
261
262static int
263stub_inflateInit_(z_streamp strm, const char * version, int stream_size)
264 {
265 if ( p_inflateInit_ )
266 return(p_inflateInit_(strm,version,stream_size));
267 else
268 return(Z_MEM_ERROR);
269 }
270
271#endif /* ZLIB_SHARED */
diff --git a/src/lib/libcrypto/conf/Makefile b/src/lib/libcrypto/conf/Makefile
new file mode 100644
index 0000000000..403d12b28c
--- /dev/null
+++ b/src/lib/libcrypto/conf/Makefile
@@ -0,0 +1,181 @@
1#
2# OpenSSL/crypto/conf/Makefile
3#
4
5DIR= conf
6TOP= ../..
7CC= cc
8INCLUDES= -I.. -I$(TOP) -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
18CFLAGS= $(INCLUDES) $(CFLAG)
19
20GENERAL=Makefile
21TEST=
22APPS=
23
24LIB=$(TOP)/libcrypto.a
25LIBSRC= conf_err.c conf_lib.c conf_api.c conf_def.c conf_mod.c \
26 conf_mall.c conf_sap.c
27
28LIBOBJ= conf_err.o conf_lib.o conf_api.o conf_def.o conf_mod.o \
29 conf_mall.o conf_sap.o
30
31SRC= $(LIBSRC)
32
33EXHEADER= conf.h conf_api.h
34HEADER= conf_def.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
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 @headerlist="$(EXHEADER)"; for i in $$headerlist ; \
58 do \
59 (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
60 chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
61 done;
62
63tags:
64 ctags $(SRC)
65
66tests:
67
68lint:
69 lint -DLINT $(INCLUDES) $(SRC)>fluff
70
71depend:
72 $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(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
83conf_api.o: ../../e_os.h ../../include/openssl/bio.h
84conf_api.o: ../../include/openssl/conf.h ../../include/openssl/conf_api.h
85conf_api.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
86conf_api.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
87conf_api.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
88conf_api.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
89conf_api.o: conf_api.c
90conf_def.o: ../../e_os.h ../../include/openssl/bio.h
91conf_def.o: ../../include/openssl/buffer.h ../../include/openssl/conf.h
92conf_def.o: ../../include/openssl/conf_api.h ../../include/openssl/crypto.h
93conf_def.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
94conf_def.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
95conf_def.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
96conf_def.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
97conf_def.o: ../cryptlib.h conf_def.c conf_def.h
98conf_err.o: ../../include/openssl/bio.h ../../include/openssl/conf.h
99conf_err.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
100conf_err.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
101conf_err.o: ../../include/openssl/opensslconf.h
102conf_err.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
103conf_err.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
104conf_err.o: conf_err.c
105conf_lib.o: ../../include/openssl/bio.h ../../include/openssl/conf.h
106conf_lib.o: ../../include/openssl/conf_api.h ../../include/openssl/crypto.h
107conf_lib.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
108conf_lib.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
109conf_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
110conf_lib.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
111conf_lib.o: conf_lib.c
112conf_mall.o: ../../e_os.h ../../include/openssl/aes.h
113conf_mall.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
114conf_mall.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
115conf_mall.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
116conf_mall.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
117conf_mall.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
118conf_mall.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
119conf_mall.o: ../../include/openssl/dso.h ../../include/openssl/e_os2.h
120conf_mall.o: ../../include/openssl/engine.h ../../include/openssl/err.h
121conf_mall.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
122conf_mall.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
123conf_mall.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
124conf_mall.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
125conf_mall.o: ../../include/openssl/objects.h
126conf_mall.o: ../../include/openssl/opensslconf.h
127conf_mall.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
128conf_mall.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h
129conf_mall.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
130conf_mall.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
131conf_mall.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
132conf_mall.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
133conf_mall.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
134conf_mall.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h
135conf_mall.o: ../../include/openssl/x509_vfy.h ../cryptlib.h conf_mall.c
136conf_mod.o: ../../e_os.h ../../include/openssl/aes.h
137conf_mod.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
138conf_mod.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
139conf_mod.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
140conf_mod.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
141conf_mod.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
142conf_mod.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
143conf_mod.o: ../../include/openssl/dso.h ../../include/openssl/e_os2.h
144conf_mod.o: ../../include/openssl/err.h ../../include/openssl/evp.h
145conf_mod.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
146conf_mod.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
147conf_mod.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
148conf_mod.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
149conf_mod.o: ../../include/openssl/opensslconf.h
150conf_mod.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
151conf_mod.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
152conf_mod.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
153conf_mod.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
154conf_mod.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
155conf_mod.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
156conf_mod.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
157conf_mod.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
158conf_mod.o: ../cryptlib.h conf_mod.c
159conf_sap.o: ../../e_os.h ../../include/openssl/aes.h
160conf_sap.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
161conf_sap.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
162conf_sap.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
163conf_sap.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
164conf_sap.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
165conf_sap.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
166conf_sap.o: ../../include/openssl/dso.h ../../include/openssl/e_os2.h
167conf_sap.o: ../../include/openssl/engine.h ../../include/openssl/err.h
168conf_sap.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
169conf_sap.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
170conf_sap.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
171conf_sap.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
172conf_sap.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
173conf_sap.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
174conf_sap.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h
175conf_sap.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
176conf_sap.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
177conf_sap.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
178conf_sap.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
179conf_sap.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
180conf_sap.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h
181conf_sap.o: ../../include/openssl/x509_vfy.h ../cryptlib.h conf_sap.c
diff --git a/src/lib/libcrypto/conf/Makefile.ssl b/src/lib/libcrypto/conf/Makefile.ssl
new file mode 100644
index 0000000000..c5873bc6e7
--- /dev/null
+++ b/src/lib/libcrypto/conf/Makefile.ssl
@@ -0,0 +1,183 @@
1#
2# SSLeay/crypto/conf/Makefile
3#
4
5DIR= conf
6TOP= ../..
7CC= cc
8INCLUDES= -I.. -I$(TOP) -I../../include
9CFLAG=-g
10INSTALL_PREFIX=
11OPENSSLDIR= /usr/local/ssl
12INSTALLTOP=/usr/local/ssl
13MAKE= make -f Makefile.ssl
14MAKEDEPPROG= makedepend
15MAKEDEPEND= $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG)
16MAKEFILE= Makefile.ssl
17AR= ar r
18
19CFLAGS= $(INCLUDES) $(CFLAG)
20
21GENERAL=Makefile
22TEST=
23APPS=
24
25LIB=$(TOP)/libcrypto.a
26LIBSRC= conf_err.c conf_lib.c conf_api.c conf_def.c conf_mod.c \
27 conf_mall.c conf_sap.c
28
29LIBOBJ= conf_err.o conf_lib.o conf_api.o conf_def.o conf_mod.o \
30 conf_mall.o conf_sap.o
31
32SRC= $(LIBSRC)
33
34EXHEADER= conf.h conf_api.h
35HEADER= conf_def.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.ssl >> $(TOP)/MINFO
51
52links:
53 @sh $(TOP)/util/point.sh Makefile.ssl Makefile
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 @for i in $(EXHEADER) ; \
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 $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(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 *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
82
83# DO NOT DELETE THIS LINE -- make depend depends on it.
84
85conf_api.o: ../../e_os.h ../../include/openssl/bio.h
86conf_api.o: ../../include/openssl/conf.h ../../include/openssl/conf_api.h
87conf_api.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
88conf_api.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
89conf_api.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
90conf_api.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
91conf_api.o: conf_api.c
92conf_def.o: ../../e_os.h ../../include/openssl/bio.h
93conf_def.o: ../../include/openssl/buffer.h ../../include/openssl/conf.h
94conf_def.o: ../../include/openssl/conf_api.h ../../include/openssl/crypto.h
95conf_def.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
96conf_def.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
97conf_def.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
98conf_def.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
99conf_def.o: ../cryptlib.h conf_def.c conf_def.h
100conf_err.o: ../../include/openssl/bio.h ../../include/openssl/conf.h
101conf_err.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
102conf_err.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
103conf_err.o: ../../include/openssl/opensslconf.h
104conf_err.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
105conf_err.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
106conf_err.o: conf_err.c
107conf_lib.o: ../../include/openssl/bio.h ../../include/openssl/conf.h
108conf_lib.o: ../../include/openssl/conf_api.h ../../include/openssl/crypto.h
109conf_lib.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
110conf_lib.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
111conf_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
112conf_lib.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
113conf_lib.o: conf_lib.c
114conf_mall.o: ../../e_os.h ../../include/openssl/aes.h
115conf_mall.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
116conf_mall.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
117conf_mall.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
118conf_mall.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
119conf_mall.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
120conf_mall.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
121conf_mall.o: ../../include/openssl/dso.h ../../include/openssl/e_os2.h
122conf_mall.o: ../../include/openssl/engine.h ../../include/openssl/err.h
123conf_mall.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
124conf_mall.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
125conf_mall.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
126conf_mall.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
127conf_mall.o: ../../include/openssl/objects.h
128conf_mall.o: ../../include/openssl/opensslconf.h
129conf_mall.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
130conf_mall.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h
131conf_mall.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
132conf_mall.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
133conf_mall.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
134conf_mall.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
135conf_mall.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
136conf_mall.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h
137conf_mall.o: ../../include/openssl/x509_vfy.h ../cryptlib.h conf_mall.c
138conf_mod.o: ../../e_os.h ../../include/openssl/aes.h
139conf_mod.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
140conf_mod.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
141conf_mod.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
142conf_mod.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
143conf_mod.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
144conf_mod.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
145conf_mod.o: ../../include/openssl/dso.h ../../include/openssl/e_os2.h
146conf_mod.o: ../../include/openssl/err.h ../../include/openssl/evp.h
147conf_mod.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
148conf_mod.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
149conf_mod.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
150conf_mod.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
151conf_mod.o: ../../include/openssl/opensslconf.h
152conf_mod.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
153conf_mod.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
154conf_mod.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
155conf_mod.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
156conf_mod.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
157conf_mod.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
158conf_mod.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
159conf_mod.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
160conf_mod.o: ../cryptlib.h conf_mod.c
161conf_sap.o: ../../e_os.h ../../include/openssl/aes.h
162conf_sap.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
163conf_sap.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
164conf_sap.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
165conf_sap.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
166conf_sap.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
167conf_sap.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
168conf_sap.o: ../../include/openssl/dso.h ../../include/openssl/e_os2.h
169conf_sap.o: ../../include/openssl/engine.h ../../include/openssl/err.h
170conf_sap.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
171conf_sap.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
172conf_sap.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
173conf_sap.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
174conf_sap.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
175conf_sap.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
176conf_sap.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h
177conf_sap.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
178conf_sap.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
179conf_sap.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
180conf_sap.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
181conf_sap.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
182conf_sap.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h
183conf_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_def.c b/src/lib/libcrypto/conf/conf_def.c
index 2464f8ed90..b5a876ae68 100644
--- a/src/lib/libcrypto/conf/conf_def.c
+++ b/src/lib/libcrypto/conf/conf_def.c
@@ -613,13 +613,13 @@ static int str_copy(CONF *conf, char *section, char **pto, char *from)
613 e++; 613 e++;
614 } 614 }
615 /* So at this point we have 615 /* So at this point we have
616 * np which is the start of the name string which is 616 * ns which is the start of the name string which is
617 * '\0' terminated. 617 * '\0' terminated.
618 * cp which is the start of the section string which is 618 * cs which is the start of the section string which is
619 * '\0' terminated. 619 * '\0' terminated.
620 * e is the 'next point after'. 620 * e is the 'next point after'.
621 * r and rr are the chars replaced by the '\0' 621 * r and s are the chars replaced by the '\0'
622 * rp and rrp is where 'r' and 'rr' came from. 622 * rp and sp is where 'r' and 's' came from.
623 */ 623 */
624 p=_CONF_get_string(conf,cp,np); 624 p=_CONF_get_string(conf,cp,np);
625 if (rrp != NULL) *rrp=rr; 625 if (rrp != NULL) *rrp=rr;
@@ -638,11 +638,6 @@ static int str_copy(CONF *conf, char *section, char **pto, char *from)
638 points at. /RL */ 638 points at. /RL */
639 len -= e-from; 639 len -= e-from;
640 from=e; 640 from=e;
641
642 /* In case there were no braces or parenthesis around
643 the variable reference, we have to put back the
644 character that was replaced with a '\0'. /RL */
645 *rp = r;
646 } 641 }
647 else 642 else
648 buf->data[to++]= *(from++); 643 buf->data[to++]= *(from++);
diff --git a/src/lib/libcrypto/conf/conf_err.c b/src/lib/libcrypto/conf/conf_err.c
index f5e2ca4bf0..ee07bfe9d9 100644
--- a/src/lib/libcrypto/conf/conf_err.c
+++ b/src/lib/libcrypto/conf/conf_err.c
@@ -1,6 +1,6 @@
1/* crypto/conf/conf_err.c */ 1/* crypto/conf/conf_err.c */
2/* ==================================================================== 2/* ====================================================================
3 * Copyright (c) 1999-2005 The OpenSSL Project. All rights reserved. 3 * Copyright (c) 1999 The OpenSSL Project. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
@@ -64,51 +64,47 @@
64 64
65/* BEGIN ERROR CODES */ 65/* BEGIN ERROR CODES */
66#ifndef OPENSSL_NO_ERR 66#ifndef OPENSSL_NO_ERR
67
68#define ERR_FUNC(func) ERR_PACK(ERR_LIB_CONF,func,0)
69#define ERR_REASON(reason) ERR_PACK(ERR_LIB_CONF,0,reason)
70
71static ERR_STRING_DATA CONF_str_functs[]= 67static ERR_STRING_DATA CONF_str_functs[]=
72 { 68 {
73{ERR_FUNC(CONF_F_CONF_DUMP_FP), "CONF_dump_fp"}, 69{ERR_PACK(0,CONF_F_CONF_DUMP_FP,0), "CONF_dump_fp"},
74{ERR_FUNC(CONF_F_CONF_LOAD), "CONF_load"}, 70{ERR_PACK(0,CONF_F_CONF_LOAD,0), "CONF_load"},
75{ERR_FUNC(CONF_F_CONF_LOAD_BIO), "CONF_load_bio"}, 71{ERR_PACK(0,CONF_F_CONF_LOAD_BIO,0), "CONF_load_bio"},
76{ERR_FUNC(CONF_F_CONF_LOAD_FP), "CONF_load_fp"}, 72{ERR_PACK(0,CONF_F_CONF_LOAD_FP,0), "CONF_load_fp"},
77{ERR_FUNC(CONF_F_CONF_MODULES_LOAD), "CONF_modules_load"}, 73{ERR_PACK(0,CONF_F_CONF_MODULES_LOAD,0), "CONF_modules_load"},
78{ERR_FUNC(CONF_F_MODULE_INIT), "MODULE_INIT"}, 74{ERR_PACK(0,CONF_F_MODULE_INIT,0), "MODULE_INIT"},
79{ERR_FUNC(CONF_F_MODULE_LOAD_DSO), "MODULE_LOAD_DSO"}, 75{ERR_PACK(0,CONF_F_MODULE_LOAD_DSO,0), "MODULE_LOAD_DSO"},
80{ERR_FUNC(CONF_F_MODULE_RUN), "MODULE_RUN"}, 76{ERR_PACK(0,CONF_F_MODULE_RUN,0), "MODULE_RUN"},
81{ERR_FUNC(CONF_F_NCONF_DUMP_BIO), "NCONF_dump_bio"}, 77{ERR_PACK(0,CONF_F_NCONF_DUMP_BIO,0), "NCONF_dump_bio"},
82{ERR_FUNC(CONF_F_NCONF_DUMP_FP), "NCONF_dump_fp"}, 78{ERR_PACK(0,CONF_F_NCONF_DUMP_FP,0), "NCONF_dump_fp"},
83{ERR_FUNC(CONF_F_NCONF_GET_NUMBER), "NCONF_get_number"}, 79{ERR_PACK(0,CONF_F_NCONF_GET_NUMBER,0), "NCONF_get_number"},
84{ERR_FUNC(CONF_F_NCONF_GET_NUMBER_E), "NCONF_get_number_e"}, 80{ERR_PACK(0,CONF_F_NCONF_GET_NUMBER_E,0), "NCONF_get_number_e"},
85{ERR_FUNC(CONF_F_NCONF_GET_SECTION), "NCONF_get_section"}, 81{ERR_PACK(0,CONF_F_NCONF_GET_SECTION,0), "NCONF_get_section"},
86{ERR_FUNC(CONF_F_NCONF_GET_STRING), "NCONF_get_string"}, 82{ERR_PACK(0,CONF_F_NCONF_GET_STRING,0), "NCONF_get_string"},
87{ERR_FUNC(CONF_F_NCONF_LOAD), "NCONF_load"}, 83{ERR_PACK(0,CONF_F_NCONF_LOAD,0), "NCONF_load"},
88{ERR_FUNC(CONF_F_NCONF_LOAD_BIO), "NCONF_load_bio"}, 84{ERR_PACK(0,CONF_F_NCONF_LOAD_BIO,0), "NCONF_load_bio"},
89{ERR_FUNC(CONF_F_NCONF_LOAD_FP), "NCONF_load_fp"}, 85{ERR_PACK(0,CONF_F_NCONF_LOAD_FP,0), "NCONF_load_fp"},
90{ERR_FUNC(CONF_F_NCONF_NEW), "NCONF_new"}, 86{ERR_PACK(0,CONF_F_NCONF_NEW,0), "NCONF_new"},
91{ERR_FUNC(CONF_F_STR_COPY), "STR_COPY"}, 87{ERR_PACK(0,CONF_F_STR_COPY,0), "STR_COPY"},
92{0,NULL} 88{0,NULL}
93 }; 89 };
94 90
95static ERR_STRING_DATA CONF_str_reasons[]= 91static ERR_STRING_DATA CONF_str_reasons[]=
96 { 92 {
97{ERR_REASON(CONF_R_ERROR_LOADING_DSO) ,"error loading dso"}, 93{CONF_R_ERROR_LOADING_DSO ,"error loading dso"},
98{ERR_REASON(CONF_R_MISSING_CLOSE_SQUARE_BRACKET),"missing close square bracket"}, 94{CONF_R_MISSING_CLOSE_SQUARE_BRACKET ,"missing close square bracket"},
99{ERR_REASON(CONF_R_MISSING_EQUAL_SIGN) ,"missing equal sign"}, 95{CONF_R_MISSING_EQUAL_SIGN ,"missing equal sign"},
100{ERR_REASON(CONF_R_MISSING_FINISH_FUNCTION),"missing finish function"}, 96{CONF_R_MISSING_FINISH_FUNCTION ,"missing finish function"},
101{ERR_REASON(CONF_R_MISSING_INIT_FUNCTION),"missing init function"}, 97{CONF_R_MISSING_INIT_FUNCTION ,"missing init function"},
102{ERR_REASON(CONF_R_MODULE_INITIALIZATION_ERROR),"module initialization error"}, 98{CONF_R_MODULE_INITIALIZATION_ERROR ,"module initialization error"},
103{ERR_REASON(CONF_R_NO_CLOSE_BRACE) ,"no close brace"}, 99{CONF_R_NO_CLOSE_BRACE ,"no close brace"},
104{ERR_REASON(CONF_R_NO_CONF) ,"no conf"}, 100{CONF_R_NO_CONF ,"no conf"},
105{ERR_REASON(CONF_R_NO_CONF_OR_ENVIRONMENT_VARIABLE),"no conf or environment variable"}, 101{CONF_R_NO_CONF_OR_ENVIRONMENT_VARIABLE ,"no conf or environment variable"},
106{ERR_REASON(CONF_R_NO_SECTION) ,"no section"}, 102{CONF_R_NO_SECTION ,"no section"},
107{ERR_REASON(CONF_R_NO_SUCH_FILE) ,"no such file"}, 103{CONF_R_NO_SUCH_FILE ,"no such file"},
108{ERR_REASON(CONF_R_NO_VALUE) ,"no value"}, 104{CONF_R_NO_VALUE ,"no value"},
109{ERR_REASON(CONF_R_UNABLE_TO_CREATE_NEW_SECTION),"unable to create new section"}, 105{CONF_R_UNABLE_TO_CREATE_NEW_SECTION ,"unable to create new section"},
110{ERR_REASON(CONF_R_UNKNOWN_MODULE_NAME) ,"unknown module name"}, 106{CONF_R_UNKNOWN_MODULE_NAME ,"unknown module name"},
111{ERR_REASON(CONF_R_VARIABLE_HAS_NO_VALUE),"variable has no value"}, 107{CONF_R_VARIABLE_HAS_NO_VALUE ,"variable has no value"},
112{0,NULL} 108{0,NULL}
113 }; 109 };
114 110
@@ -122,8 +118,8 @@ void ERR_load_CONF_strings(void)
122 { 118 {
123 init=0; 119 init=0;
124#ifndef OPENSSL_NO_ERR 120#ifndef OPENSSL_NO_ERR
125 ERR_load_strings(0,CONF_str_functs); 121 ERR_load_strings(ERR_LIB_CONF,CONF_str_functs);
126 ERR_load_strings(0,CONF_str_reasons); 122 ERR_load_strings(ERR_LIB_CONF,CONF_str_reasons);
127#endif 123#endif
128 124
129 } 125 }
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/cpt_err.c b/src/lib/libcrypto/cpt_err.c
index 06a6109cce..1b4a1cb4d4 100644
--- a/src/lib/libcrypto/cpt_err.c
+++ b/src/lib/libcrypto/cpt_err.c
@@ -1,6 +1,6 @@
1/* crypto/cpt_err.c */ 1/* crypto/cpt_err.c */
2/* ==================================================================== 2/* ====================================================================
3 * Copyright (c) 1999-2005 The OpenSSL Project. All rights reserved. 3 * Copyright (c) 1999 The OpenSSL Project. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
@@ -64,27 +64,23 @@
64 64
65/* BEGIN ERROR CODES */ 65/* BEGIN ERROR CODES */
66#ifndef OPENSSL_NO_ERR 66#ifndef OPENSSL_NO_ERR
67
68#define ERR_FUNC(func) ERR_PACK(ERR_LIB_CRYPTO,func,0)
69#define ERR_REASON(reason) ERR_PACK(ERR_LIB_CRYPTO,0,reason)
70
71static ERR_STRING_DATA CRYPTO_str_functs[]= 67static ERR_STRING_DATA CRYPTO_str_functs[]=
72 { 68 {
73{ERR_FUNC(CRYPTO_F_CRYPTO_GET_EX_NEW_INDEX), "CRYPTO_get_ex_new_index"}, 69{ERR_PACK(0,CRYPTO_F_CRYPTO_GET_EX_NEW_INDEX,0), "CRYPTO_get_ex_new_index"},
74{ERR_FUNC(CRYPTO_F_CRYPTO_GET_NEW_DYNLOCKID), "CRYPTO_get_new_dynlockid"}, 70{ERR_PACK(0,CRYPTO_F_CRYPTO_GET_NEW_DYNLOCKID,0), "CRYPTO_get_new_dynlockid"},
75{ERR_FUNC(CRYPTO_F_CRYPTO_GET_NEW_LOCKID), "CRYPTO_get_new_lockid"}, 71{ERR_PACK(0,CRYPTO_F_CRYPTO_GET_NEW_LOCKID,0), "CRYPTO_get_new_lockid"},
76{ERR_FUNC(CRYPTO_F_CRYPTO_SET_EX_DATA), "CRYPTO_set_ex_data"}, 72{ERR_PACK(0,CRYPTO_F_CRYPTO_SET_EX_DATA,0), "CRYPTO_set_ex_data"},
77{ERR_FUNC(CRYPTO_F_DEF_ADD_INDEX), "DEF_ADD_INDEX"}, 73{ERR_PACK(0,CRYPTO_F_DEF_ADD_INDEX,0), "DEF_ADD_INDEX"},
78{ERR_FUNC(CRYPTO_F_DEF_GET_CLASS), "DEF_GET_CLASS"}, 74{ERR_PACK(0,CRYPTO_F_DEF_GET_CLASS,0), "DEF_GET_CLASS"},
79{ERR_FUNC(CRYPTO_F_INT_DUP_EX_DATA), "INT_DUP_EX_DATA"}, 75{ERR_PACK(0,CRYPTO_F_INT_DUP_EX_DATA,0), "INT_DUP_EX_DATA"},
80{ERR_FUNC(CRYPTO_F_INT_FREE_EX_DATA), "INT_FREE_EX_DATA"}, 76{ERR_PACK(0,CRYPTO_F_INT_FREE_EX_DATA,0), "INT_FREE_EX_DATA"},
81{ERR_FUNC(CRYPTO_F_INT_NEW_EX_DATA), "INT_NEW_EX_DATA"}, 77{ERR_PACK(0,CRYPTO_F_INT_NEW_EX_DATA,0), "INT_NEW_EX_DATA"},
82{0,NULL} 78{0,NULL}
83 }; 79 };
84 80
85static ERR_STRING_DATA CRYPTO_str_reasons[]= 81static ERR_STRING_DATA CRYPTO_str_reasons[]=
86 { 82 {
87{ERR_REASON(CRYPTO_R_NO_DYNLOCK_CREATE_CALLBACK),"no dynlock create callback"}, 83{CRYPTO_R_NO_DYNLOCK_CREATE_CALLBACK ,"no dynlock create callback"},
88{0,NULL} 84{0,NULL}
89 }; 85 };
90 86
@@ -98,8 +94,8 @@ void ERR_load_CRYPTO_strings(void)
98 { 94 {
99 init=0; 95 init=0;
100#ifndef OPENSSL_NO_ERR 96#ifndef OPENSSL_NO_ERR
101 ERR_load_strings(0,CRYPTO_str_functs); 97 ERR_load_strings(ERR_LIB_CRYPTO,CRYPTO_str_functs);
102 ERR_load_strings(0,CRYPTO_str_reasons); 98 ERR_load_strings(ERR_LIB_CRYPTO,CRYPTO_str_reasons);
103#endif 99#endif
104 100
105 } 101 }
diff --git a/src/lib/libcrypto/cryptlib.c b/src/lib/libcrypto/cryptlib.c
index e63bbe8dba..fef0afb29f 100644
--- a/src/lib/libcrypto/cryptlib.c
+++ b/src/lib/libcrypto/cryptlib.c
@@ -480,8 +480,6 @@ const char *CRYPTO_get_lock_name(int type)
480 return(sk_value(app_locks,type-CRYPTO_NUM_LOCKS)); 480 return(sk_value(app_locks,type-CRYPTO_NUM_LOCKS));
481 } 481 }
482 482
483int OPENSSL_NONPIC_relocated=0;
484
485#if defined(_WIN32) && defined(_WINDLL) 483#if defined(_WIN32) && defined(_WINDLL)
486 484
487/* All we really need to do is remove the 'error' state when a thread 485/* All we really need to do is remove the 'error' state when a thread
@@ -493,21 +491,6 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason,
493 switch(fdwReason) 491 switch(fdwReason)
494 { 492 {
495 case DLL_PROCESS_ATTACH: 493 case DLL_PROCESS_ATTACH:
496#if defined(_WIN32_WINNT)
497 {
498 IMAGE_DOS_HEADER *dos_header = (IMAGE_DOS_HEADER *)hinstDLL;
499 IMAGE_NT_HEADERS *nt_headers;
500
501 if (dos_header->e_magic==IMAGE_DOS_SIGNATURE)
502 {
503 nt_headers = (IMAGE_NT_HEADERS *)((char *)dos_header
504 + dos_header->e_lfanew);
505 if (nt_headers->Signature==IMAGE_NT_SIGNATURE &&
506 hinstDLL!=(HINSTANCE)(nt_headers->OptionalHeader.ImageBase))
507 OPENSSL_NONPIC_relocated=1;
508 }
509 }
510#endif
511 break; 494 break;
512 case DLL_THREAD_ATTACH: 495 case DLL_THREAD_ATTACH:
513 break; 496 break;
@@ -521,160 +504,18 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason,
521 } 504 }
522#endif 505#endif
523 506
524#if defined(_WIN32)
525#include <tchar.h>
526
527#if defined(_WIN32_WINNT) && _WIN32_WINNT>=0x0333
528static int IsService(void)
529{ HWINSTA h;
530 DWORD len;
531 WCHAR *name;
532
533 (void)GetDesktopWindow(); /* return value is ignored */
534
535 h = GetProcessWindowStation();
536 if (h==NULL) return -1;
537
538 if (GetUserObjectInformationW (h,UOI_NAME,NULL,0,&len) ||
539 GetLastError() != ERROR_INSUFFICIENT_BUFFER)
540 return -1;
541
542 if (len>512) return -1; /* paranoia */
543 len++,len&=~1; /* paranoia */
544#ifdef _MSC_VER
545 name=(WCHAR *)_alloca(len+sizeof(WCHAR));
546#else
547 name=(WCHAR *)alloca(len+sizeof(WCHAR));
548#endif
549 if (!GetUserObjectInformationW (h,UOI_NAME,name,len,&len))
550 return -1;
551
552 len++,len&=~1; /* paranoia */
553 name[len/sizeof(WCHAR)]=L'\0'; /* paranoia */
554#if 1
555 /* This doesn't cover "interactive" services [working with real
556 * WinSta0's] nor programs started non-interactively by Task
557 * Scheduler [those are working with SAWinSta]. */
558 if (wcsstr(name,L"Service-0x")) return 1;
559#else
560 /* This covers all non-interactive programs such as services. */
561 if (!wcsstr(name,L"WinSta0")) return 1;
562#endif
563 else return 0;
564}
565#endif
566
567void OPENSSL_showfatal (const char *fmta,...)
568{ va_list ap;
569 TCHAR buf[256];
570 const TCHAR *fmt;
571 HANDLE h;
572
573 if ((h=GetStdHandle(STD_ERROR_HANDLE)) != NULL &&
574 GetFileType(h)!=FILE_TYPE_UNKNOWN)
575 { /* must be console application */
576 va_start (ap,fmta);
577 vfprintf (stderr,fmta,ap);
578 va_end (ap);
579 return;
580 }
581
582 if (sizeof(TCHAR)==sizeof(char))
583 fmt=(const TCHAR *)fmta;
584 else do
585 { int keepgoing;
586 size_t len_0=strlen(fmta)+1,i;
587 WCHAR *fmtw;
588
589#ifdef _MSC_VER
590 fmtw = (WCHAR *)_alloca (len_0*sizeof(WCHAR));
591#else
592 fmtw = (WCHAR *)alloca (len_0*sizeof(WCHAR));
593#endif
594 if (fmtw == NULL) { fmt=(const TCHAR *)L"no stack?"; break; }
595
596#ifndef OPENSSL_NO_MULTIBYTE
597 if (!MultiByteToWideChar(CP_ACP,0,fmta,len_0,fmtw,len_0))
598#endif
599 for (i=0;i<len_0;i++) fmtw[i]=(WCHAR)fmta[i];
600
601 for (i=0;i<len_0;i++)
602 { if (fmtw[i]==L'%') do
603 { keepgoing=0;
604 switch (fmtw[i+1])
605 { case L'0': case L'1': case L'2': case L'3': case L'4':
606 case L'5': case L'6': case L'7': case L'8': case L'9':
607 case L'.': case L'*':
608 case L'-': i++; keepgoing=1; break;
609 case L's': fmtw[i+1]=L'S'; break;
610 case L'S': fmtw[i+1]=L's'; break;
611 case L'c': fmtw[i+1]=L'C'; break;
612 case L'C': fmtw[i+1]=L'c'; break;
613 }
614 } while (keepgoing);
615 }
616 fmt = (const TCHAR *)fmtw;
617 } while (0);
618
619 va_start (ap,fmta);
620 _vsntprintf (buf,sizeof(buf)/sizeof(TCHAR)-1,fmt,ap);
621 buf [sizeof(buf)/sizeof(TCHAR)-1] = _T('\0');
622 va_end (ap);
623
624#if defined(_WIN32_WINNT) && _WIN32_WINNT>=0x0333
625 /* this -------------v--- guards NT-specific calls */
626 if (GetVersion() < 0x80000000 && IsService())
627 { HANDLE h = RegisterEventSource(0,_T("OPENSSL"));
628 const TCHAR *pmsg=buf;
629 ReportEvent(h,EVENTLOG_ERROR_TYPE,0,0,0,1,0,&pmsg,0);
630 DeregisterEventSource(h);
631 }
632 else
633#endif
634 { MSGBOXPARAMS m;
635
636 m.cbSize = sizeof(m);
637 m.hwndOwner = NULL;
638 m.lpszCaption = _T("OpenSSL: FATAL");
639 m.dwStyle = MB_OK;
640 m.hInstance = NULL;
641 m.lpszIcon = IDI_ERROR;
642 m.dwContextHelpId = 0;
643 m.lpfnMsgBoxCallback = NULL;
644 m.dwLanguageId = MAKELANGID(LANG_ENGLISH,SUBLANG_ENGLISH_US);
645 m.lpszText = buf;
646
647 MessageBoxIndirect (&m);
648 }
649}
650#else
651void OPENSSL_showfatal (const char *fmta,...)
652{ va_list ap;
653
654 va_start (ap,fmta);
655 vfprintf (stderr,fmta,ap);
656 va_end (ap);
657}
658#endif
659
660void OpenSSLDie(const char *file,int line,const char *assertion) 507void OpenSSLDie(const char *file,int line,const char *assertion)
661 { 508 {
662 OPENSSL_showfatal( 509 fprintf(stderr,
663 "%s(%d): OpenSSL internal error, assertion failed: %s\n", 510 "%s(%d): OpenSSL internal error, assertion failed: %s\n",
664 file,line,assertion); 511 file,line,assertion);
665 abort(); 512 abort();
666 } 513 }
667 514
668void *OPENSSL_stderr(void) { return stderr; }
669
670#ifdef OPENSSL_FIPS 515#ifdef OPENSSL_FIPS
671
672void fips_w_lock(void) { CRYPTO_w_lock(CRYPTO_LOCK_FIPS); }
673void fips_w_unlock(void) { CRYPTO_w_unlock(CRYPTO_LOCK_FIPS); }
674void fips_r_lock(void) { CRYPTO_r_lock(CRYPTO_LOCK_FIPS); }
675void fips_r_unlock(void) { CRYPTO_r_unlock(CRYPTO_LOCK_FIPS); }
676
677static int fips_started = 0; 516static int fips_started = 0;
517static int fips_mode = 0;
518static void *fips_rand_check = 0;
678static unsigned long fips_thread = 0; 519static unsigned long fips_thread = 0;
679 520
680void fips_set_started(void) 521void fips_set_started(void)
@@ -735,10 +576,57 @@ int fips_clear_owning_thread(void)
735 return ret; 576 return ret;
736 } 577 }
737 578
738unsigned char *fips_signature_witness(void) 579void fips_set_mode(int onoff)
580 {
581 int owning_thread = fips_is_owning_thread();
582
583 if (fips_is_started())
584 {
585 if (!owning_thread) CRYPTO_w_lock(CRYPTO_LOCK_FIPS);
586 fips_mode = onoff;
587 if (!owning_thread) CRYPTO_w_unlock(CRYPTO_LOCK_FIPS);
588 }
589 }
590
591void fips_set_rand_check(void *rand_check)
592 {
593 int owning_thread = fips_is_owning_thread();
594
595 if (fips_is_started())
596 {
597 if (!owning_thread) CRYPTO_w_lock(CRYPTO_LOCK_FIPS);
598 fips_rand_check = rand_check;
599 if (!owning_thread) CRYPTO_w_unlock(CRYPTO_LOCK_FIPS);
600 }
601 }
602
603int FIPS_mode(void)
604 {
605 int ret = 0;
606 int owning_thread = fips_is_owning_thread();
607
608 if (fips_is_started())
609 {
610 if (!owning_thread) CRYPTO_r_lock(CRYPTO_LOCK_FIPS);
611 ret = fips_mode;
612 if (!owning_thread) CRYPTO_r_unlock(CRYPTO_LOCK_FIPS);
613 }
614 return ret;
615 }
616
617void *FIPS_rand_check(void)
739 { 618 {
740 extern unsigned char FIPS_signature[]; 619 void *ret = 0;
741 return FIPS_signature; 620 int owning_thread = fips_is_owning_thread();
621
622 if (fips_is_started())
623 {
624 if (!owning_thread) CRYPTO_r_lock(CRYPTO_LOCK_FIPS);
625 ret = fips_rand_check;
626 if (!owning_thread) CRYPTO_r_unlock(CRYPTO_LOCK_FIPS);
627 }
628 return ret;
742 } 629 }
630
743#endif /* OPENSSL_FIPS */ 631#endif /* OPENSSL_FIPS */
744 632
diff --git a/src/lib/libcrypto/cryptlib.h b/src/lib/libcrypto/cryptlib.h
index 6f59e08ca6..0d6b9d59f0 100644
--- a/src/lib/libcrypto/cryptlib.h
+++ b/src/lib/libcrypto/cryptlib.h
@@ -93,10 +93,6 @@ extern "C" {
93#define DECIMAL_SIZE(type) ((sizeof(type)*8+2)/3+1) 93#define DECIMAL_SIZE(type) ((sizeof(type)*8+2)/3+1)
94#define HEX_SIZE(type) (sizeof(type)*2) 94#define HEX_SIZE(type) (sizeof(type)*2)
95 95
96void OPENSSL_showfatal(const char *,...);
97void *OPENSSL_stderr(void);
98extern int OPENSSL_NONPIC_relocated;
99
100#ifdef __cplusplus 96#ifdef __cplusplus
101} 97}
102#endif 98#endif
diff --git a/src/lib/libcrypto/crypto-lib.com b/src/lib/libcrypto/crypto-lib.com
new file mode 100644
index 0000000000..c044ce0099
--- /dev/null
+++ b/src/lib/libcrypto/crypto-lib.com
@@ -0,0 +1,1284 @@
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$!
10$! This command files compiles and creates the "[.xxx.EXE.CRYPTO]LIBCRYPTO.OLB"
11$! library for OpenSSL. The "xxx" denotes the machine architecture of AXP
12$! or VAX.
13$!
14$! It was re-written so it would try to determine what "C" compiler to use
15$! or you can specify which "C" compiler to use.
16$!
17$! Specify the following as P1 to build just that part or ALL to just
18$! build everything.
19$!
20$! LIBRARY To just compile the [.xxx.EXE.CRYPTO]LIBCRYPTO.OLB Library.
21$! APPS To just compile the [.xxx.EXE.CRYPTO]*.EXE
22$! ALL To do both LIBRARY and APPS
23$!
24$! Specify DEBUG or NODEBUG as P2 to compile with or without debugger
25$! information.
26$!
27$! Specify which compiler at P3 to try to compile under.
28$!
29$! VAXC For VAX C.
30$! DECC For DEC C.
31$! GNUC For GNU C.
32$!
33$! If you don't speficy a compiler, it will try to determine which
34$! "C" compiler to use.
35$!
36$! P4, if defined, sets a TCP/IP library to use, through one of the following
37$! keywords:
38$!
39$! UCX for UCX
40$! TCPIP for TCPIP (post UCX)
41$! SOCKETSHR for SOCKETSHR+NETLIB
42$!
43$! P5, if defined, sets a compiler thread NOT needed on OpenVMS 7.1 (and up)
44$!
45$! P6, if defined, sets a choice of crypto methods to compile.
46$! WARNING: this should only be done to recompile some part of an already
47$! fully compiled library.
48$!
49$!
50$! Define A TCP/IP Library That We Will Need To Link To.
51$! (That Is, If We Need To Link To One.)
52$!
53$ TCPIP_LIB = ""
54$!
55$! Check Which Architecture We Are Using.
56$!
57$ IF (F$GETSYI("CPU").GE.128)
58$ THEN
59$!
60$! The Architecture Is AXP
61$!
62$ ARCH := AXP
63$!
64$! Else...
65$!
66$ ELSE
67$!
68$! The Architecture Is VAX.
69$!
70$ ARCH := VAX
71$!
72$! End The Architecture Check.
73$!
74$ ENDIF
75$!
76$! Define The Different Encryption Types.
77$!
78$ ENCRYPT_TYPES = "Basic,MD2,MD4,MD5,SHA,MDC2,HMAC,RIPEMD,"+ -
79 "DES,RC2,RC4,RC5,IDEA,BF,CAST,"+ -
80 "BN,EC,RSA,DSA,DH,DSO,ENGINE,AES,"+ -
81 "BUFFER,BIO,STACK,LHASH,RAND,ERR,OBJECTS,"+ -
82 "EVP,EVP_2,ASN1,ASN1_2,PEM,X509,X509V3,"+ -
83 "CONF,TXT_DB,PKCS7,PKCS12,COMP,OCSP,UI,KRB5"
84$!
85$! Check To Make Sure We Have Valid Command Line Parameters.
86$!
87$ GOSUB CHECK_OPTIONS
88$!
89$! Initialise logical names and such
90$!
91$ GOSUB INITIALISE
92$!
93$! Tell The User What Kind of Machine We Run On.
94$!
95$ WRITE SYS$OUTPUT "Compiling On A ",ARCH," Machine."
96$!
97$! Define The OBJ Directory.
98$!
99$ OBJ_DIR := SYS$DISK:[-.'ARCH'.OBJ.CRYPTO]
100$!
101$! Check To See If The Architecture Specific OBJ Directory Exists.
102$!
103$ IF (F$PARSE(OBJ_DIR).EQS."")
104$ THEN
105$!
106$! It Dosen't Exist, So Create It.
107$!
108$ CREATE/DIR 'OBJ_DIR'
109$!
110$! End The Architecture Specific OBJ Directory Check.
111$!
112$ ENDIF
113$!
114$! Define The EXE Directory.
115$!
116$ EXE_DIR := SYS$DISK:[-.'ARCH'.EXE.CRYPTO]
117$!
118$! Check To See If The Architecture Specific Directory Exists.
119$!
120$ IF (F$PARSE(EXE_DIR).EQS."")
121$ THEN
122$!
123$! It Dosen't Exist, So Create It.
124$!
125$ CREATE/DIRECTORY 'EXE_DIR'
126$!
127$! End The Architecture Specific Directory Check.
128$!
129$ ENDIF
130$!
131$! Define The Library Name.
132$!
133$ LIB_NAME := 'EXE_DIR'LIBCRYPTO.OLB
134$!
135$! Define The CRYPTO-LIB We Are To Use.
136$!
137$ CRYPTO_LIB := 'EXE_DIR'LIBCRYPTO.OLB
138$!
139$! Check To See If We Already Have A "[.xxx.EXE.CRYPTO]LIBCRYPTO.OLB" Library...
140$!
141$ IF (F$SEARCH(LIB_NAME).EQS."")
142$ THEN
143$!
144$! Guess Not, Create The Library.
145$!
146$ LIBRARY/CREATE/OBJECT 'LIB_NAME'
147$!
148$! End The Library Check.
149$!
150$ ENDIF
151$!
152$! Build our options file for the application
153$!
154$ GOSUB CHECK_OPT_FILE
155$!
156$! Define The Different Encryption "library" Strings.
157$!
158$ APPS_DES = "DES/DES,CBC3_ENC"
159$ APPS_PKCS7 = "ENC/ENC;DEC/DEC;SIGN/SIGN;VERIFY/VERIFY,EXAMPLE"
160$
161$ LIB_ = "cryptlib,mem,mem_clr,mem_dbg,cversion,ex_data,tmdiff,cpt_err,ebcdic,uid,o_time,o_str"
162$ LIB_MD2 = "md2_dgst,md2_one"
163$ LIB_MD4 = "md4_dgst,md4_one"
164$ LIB_MD5 = "md5_dgst,md5_one"
165$ LIB_SHA = "sha_dgst,sha1dgst,sha_one,sha1_one"
166$ LIB_MDC2 = "mdc2dgst,mdc2_one"
167$ LIB_HMAC = "hmac"
168$ LIB_RIPEMD = "rmd_dgst,rmd_one"
169$ LIB_DES = "set_key,ecb_enc,cbc_enc,"+ -
170 "ecb3_enc,cfb64enc,cfb64ede,cfb_enc,ofb64ede,"+ -
171 "enc_read,enc_writ,ofb64enc,"+ -
172 "ofb_enc,str2key,pcbc_enc,qud_cksm,rand_key,"+ -
173 "des_enc,fcrypt_b,"+ -
174 "fcrypt,xcbc_enc,rpc_enc,cbc_cksm,"+ -
175 "ede_cbcm_enc,des_old,des_old2,read2pwd"
176$ LIB_RC2 = "rc2_ecb,rc2_skey,rc2_cbc,rc2cfb64,rc2ofb64"
177$ LIB_RC4 = "rc4_skey,rc4_enc"
178$ LIB_RC5 = "rc5_skey,rc5_ecb,rc5_enc,rc5cfb64,rc5ofb64"
179$ LIB_IDEA = "i_cbc,i_cfb64,i_ofb64,i_ecb,i_skey"
180$ LIB_BF = "bf_skey,bf_ecb,bf_enc,bf_cfb64,bf_ofb64"
181$ LIB_CAST = "c_skey,c_ecb,c_enc,c_cfb64,c_ofb64"
182$ LIB_BN_ASM = "[.asm]vms.mar,vms-helper"
183$ IF F$TRNLNM("OPENSSL_NO_ASM").OR.ARCH.EQS."AXP" THEN LIB_BN_ASM = "bn_asm"
184$ LIB_BN = "bn_add,bn_div,bn_exp,bn_lib,bn_ctx,bn_mul,bn_mod,"+ -
185 "bn_print,bn_rand,bn_shift,bn_word,bn_blind,"+ -
186 "bn_kron,bn_sqrt,bn_gcd,bn_prime,bn_err,bn_sqr,"+LIB_BN_ASM+","+ -
187 "bn_recp,bn_mont,bn_mpi,bn_exp2"
188$ LIB_RSA = "rsa_eay,rsa_gen,rsa_lib,rsa_sign,rsa_saos,rsa_err,"+ -
189 "rsa_pk1,rsa_ssl,rsa_none,rsa_oaep,rsa_chk,rsa_null,"+ -
190 "rsa_asn1"
191$ LIB_EC = "ec_lib,ecp_smpl,ecp_mont,ecp_recp,ecp_nist,ec_cvt,ec_mult,"+ -
192 "ec_err"
193$ LIB_DSA = "dsa_gen,dsa_key,dsa_lib,dsa_asn1,dsa_vrf,dsa_sign,dsa_err,dsa_ossl"
194$ LIB_DH = "dh_asn1,dh_gen,dh_key,dh_lib,dh_check,dh_err"
195$ LIB_DSO = "dso_dl,dso_dlfcn,dso_err,dso_lib,dso_null,"+ -
196 "dso_openssl,dso_win32,dso_vms"
197$ LIB_ENGINE = "eng_err,eng_lib,eng_list,eng_init,eng_ctrl,"+ -
198 "eng_table,eng_pkey,eng_fat,eng_all,"+ -
199 "tb_rsa,tb_dsa,tb_dh,tb_rand,tb_cipher,tb_digest,"+ -
200 "eng_openssl,eng_dyn,eng_cnf,"+ -
201 "hw_atalla,hw_cswift,hw_ncipher,hw_nuron,hw_ubsec,"+ -
202 "hw_cryptodev,hw_aep,hw_sureware,hw_4758_cca"
203$ LIB_AES = "aes_core,aes_misc,aes_ecb,aes_cbc,aes_cfb,aes_ofb,aes_ctr"
204$ LIB_BUFFER = "buffer,buf_err"
205$ LIB_BIO = "bio_lib,bio_cb,bio_err,"+ -
206 "bss_mem,bss_null,bss_fd,"+ -
207 "bss_file,bss_sock,bss_conn,"+ -
208 "bf_null,bf_buff,b_print,b_dump,"+ -
209 "b_sock,bss_acpt,bf_nbio,bss_rtcp,bss_bio,bss_log,"+ -
210 "bf_lbuf"
211$ LIB_STACK = "stack"
212$ LIB_LHASH = "lhash,lh_stats"
213$ LIB_RAND = "md_rand,randfile,rand_lib,rand_err,rand_egd,"+ -
214 "rand_vms"
215$ LIB_ERR = "err,err_all,err_prn"
216$ LIB_OBJECTS = "o_names,obj_dat,obj_lib,obj_err"
217$ LIB_EVP = "encode,digest,evp_enc,evp_key,evp_acnf,"+ -
218 "e_des,e_bf,e_idea,e_des3,"+ -
219 "e_rc4,e_aes,names,"+ -
220 "e_xcbc_d,e_rc2,e_cast,e_rc5"
221$ LIB_EVP_2 = "m_null,m_md2,m_md4,m_md5,m_sha,m_sha1," + -
222 "m_dss,m_dss1,m_mdc2,m_ripemd,"+ -
223 "p_open,p_seal,p_sign,p_verify,p_lib,p_enc,p_dec,"+ -
224 "bio_md,bio_b64,bio_enc,evp_err,e_null,"+ -
225 "c_all,c_allc,c_alld,evp_lib,bio_ok,"+-
226 "evp_pkey,evp_pbe,p5_crpt,p5_crpt2"
227$ LIB_ASN1 = "a_object,a_bitstr,a_utctm,a_gentm,a_time,a_int,a_octet,"+ -
228 "a_print,a_type,a_set,a_dup,a_d2i_fp,a_i2d_fp,"+ -
229 "a_enum,a_utf8,a_sign,a_digest,a_verify,a_mbstr,a_strex,"+ -
230 "x_algor,x_val,x_pubkey,x_sig,x_req,x_attrib,x_bignum,"+ -
231 "x_long,x_name,x_x509,x_x509a,x_crl,x_info,x_spki,nsseq,"+ -
232 "d2i_pu,d2i_pr,i2d_pu,i2d_pr"
233$ LIB_ASN1_2 = "t_req,t_x509,t_x509a,t_crl,t_pkey,t_spki,t_bitst,"+ -
234 "tasn_new,tasn_fre,tasn_enc,tasn_dec,tasn_utl,tasn_typ,"+ -
235 "f_int,f_string,n_pkey,"+ -
236 "f_enum,a_hdr,x_pkey,a_bool,x_exten,"+ -
237 "asn1_par,asn1_lib,asn1_err,a_meth,a_bytes,a_strnid,"+ -
238 "evp_asn1,asn_pack,p5_pbe,p5_pbev2,p8_pkey,asn_moid"
239$ LIB_PEM = "pem_sign,pem_seal,pem_info,pem_lib,pem_all,pem_err,"+ -
240 "pem_x509,pem_xaux,pem_oth,pem_pk8,pem_pkey"
241$ LIB_X509 = "x509_def,x509_d2,x509_r2x,x509_cmp,"+ -
242 "x509_obj,x509_req,x509spki,x509_vfy,"+ -
243 "x509_set,x509cset,x509rset,x509_err,"+ -
244 "x509name,x509_v3,x509_ext,x509_att,"+ -
245 "x509type,x509_lu,x_all,x509_txt,"+ -
246 "x509_trs,by_file,by_dir"
247$ LIB_X509V3 = "v3_bcons,v3_bitst,v3_conf,v3_extku,v3_ia5,v3_lib,"+ -
248 "v3_prn,v3_utl,v3err,v3_genn,v3_alt,v3_skey,v3_akey,v3_pku,"+ -
249 "v3_int,v3_enum,v3_sxnet,v3_cpols,v3_crld,v3_purp,v3_info,"+ -
250 "v3_ocsp,v3_akeya,v3_pcia,v3_pci"
251$ LIB_CONF = "conf_err,conf_lib,conf_api,conf_def,conf_mod,conf_mall,conf_sap"
252$ LIB_TXT_DB = "txt_db"
253$ LIB_PKCS7 = "pk7_asn1,pk7_lib,pkcs7err,pk7_doit,pk7_smime,pk7_attr,"+ -
254 "pk7_mime"
255$ LIB_PKCS12 = "p12_add,p12_asn,p12_attr,p12_crpt,p12_crt,p12_decr,"+ -
256 "p12_init,p12_key,p12_kiss,p12_mutl,"+ -
257 "p12_utl,p12_npas,pk12err,p12_p8d,p12_p8e"
258$ LIB_COMP = "comp_lib,comp_err,"+ -
259 "c_rle,c_zlib"
260$ LIB_OCSP = "ocsp_asn,ocsp_ext,ocsp_ht,ocsp_lib,ocsp_cl,"+ -
261 "ocsp_srv,ocsp_prn,ocsp_vfy,ocsp_err"
262$ LIB_UI_COMPAT = ",ui_compat"
263$ LIB_UI = "ui_err,ui_lib,ui_openssl,ui_util"+LIB_UI_COMPAT
264$ LIB_KRB5 = "krb5_asn"
265$!
266$! Setup exceptional compilations
267$!
268$ COMPILEWITH_CC3 = ",bss_rtcp,"
269$ COMPILEWITH_CC4 = ",a_utctm,bss_log,o_time,"
270$ COMPILEWITH_CC5 = ",md2_dgst,md4_dgst,md5_dgst,mdc2dgst," + -
271 "sha_dgst,sha1dgst,rmd_dgst,bf_enc,"
272$!
273$! Figure Out What Other Modules We Are To Build.
274$!
275$ BUILD_SET:
276$!
277$! Define A Module Counter.
278$!
279$ MODULE_COUNTER = 0
280$!
281$! Top Of The Loop.
282$!
283$ MODULE_NEXT:
284$!
285$! Extract The Module Name From The Encryption List.
286$!
287$ MODULE_NAME = F$ELEMENT(MODULE_COUNTER,",",ENCRYPT_TYPES)
288$ IF MODULE_NAME.EQS."Basic" THEN MODULE_NAME = ""
289$ MODULE_NAME1 = MODULE_NAME
290$!
291$! Check To See If We Are At The End Of The Module List.
292$!
293$ IF (MODULE_NAME.EQS.",")
294$ THEN
295$!
296$! We Are At The End Of The Module List, Go To MODULE_DONE.
297$!
298$ GOTO MODULE_DONE
299$!
300$! End The Module List Check.
301$!
302$ ENDIF
303$!
304$! Increment The Moudle Counter.
305$!
306$ MODULE_COUNTER = MODULE_COUNTER + 1
307$!
308$! Create The Library and Apps Module Names.
309$!
310$ LIB_MODULE = "LIB_" + MODULE_NAME
311$ APPS_MODULE = "APPS_" + MODULE_NAME
312$ IF (MODULE_NAME.EQS."ASN1_2")
313$ THEN
314$ MODULE_NAME = "ASN1"
315$ ENDIF
316$ IF (MODULE_NAME.EQS."EVP_2")
317$ THEN
318$ MODULE_NAME = "EVP"
319$ ENDIF
320$!
321$! Set state (can be LIB and APPS)
322$!
323$ STATE = "LIB"
324$ IF BUILDALL .EQS. "APPS" THEN STATE = "APPS"
325$!
326$! Check if the library module name actually is defined
327$!
328$ IF F$TYPE('LIB_MODULE') .EQS. ""
329$ THEN
330$ WRITE SYS$ERROR ""
331$ WRITE SYS$ERROR "The module ",MODULE_NAME," does not exist. Continuing..."
332$ WRITE SYS$ERROR ""
333$ GOTO MODULE_NEXT
334$ ENDIF
335$!
336$! Top Of The Module Loop.
337$!
338$ MODULE_AGAIN:
339$!
340$! Tell The User What Module We Are Building.
341$!
342$ IF (MODULE_NAME1.NES."")
343$ THEN
344$ IF STATE .EQS. "LIB"
345$ THEN
346$ WRITE SYS$OUTPUT "Compiling The ",MODULE_NAME1," Library Files. (",BUILDALL,",",STATE,")"
347$ ELSE IF F$TYPE('APPS_MODULE') .NES. ""
348$ THEN
349$ WRITE SYS$OUTPUT "Compiling The ",MODULE_NAME1," Applications. (",BUILDALL,",",STATE,")"
350$ ENDIF
351$ ENDIF
352$ ENDIF
353$!
354$! Define A File Counter And Set It To "0".
355$!
356$ FILE_COUNTER = 0
357$ APPLICATION = ""
358$ APPLICATION_COUNTER = 0
359$!
360$! Top Of The File Loop.
361$!
362$ NEXT_FILE:
363$!
364$! Look in the LIB_MODULE is we're in state LIB
365$!
366$ IF STATE .EQS. "LIB"
367$ THEN
368$!
369$! O.K, Extract The File Name From The File List.
370$!
371$ FILE_NAME = F$ELEMENT(FILE_COUNTER,",",'LIB_MODULE')
372$!
373$! else
374$!
375$ ELSE
376$ FILE_NAME = ","
377$!
378$ IF F$TYPE('APPS_MODULE') .NES. ""
379$ THEN
380$!
381$! Extract The File Name From The File List.
382$! This part is a bit more complicated.
383$!
384$ IF APPLICATION .EQS. ""
385$ THEN
386$ APPLICATION = F$ELEMENT(APPLICATION_COUNTER,";",'APPS_MODULE')
387$ APPLICATION_COUNTER = APPLICATION_COUNTER + 1
388$ APPLICATION_OBJECTS = F$ELEMENT(1,"/",APPLICATION)
389$ APPLICATION = F$ELEMENT(0,"/",APPLICATION)
390$ FILE_COUNTER = 0
391$ ENDIF
392$
393$! WRITE SYS$OUTPUT "DEBUG: SHOW SYMBOL APPLICATION*"
394$! SHOW SYMBOL APPLICATION*
395$!
396$ IF APPLICATION .NES. ";"
397$ THEN
398$ FILE_NAME = F$ELEMENT(FILE_COUNTER,",",APPLICATION_OBJECTS)
399$ IF FILE_NAME .EQS. ","
400$ THEN
401$ APPLICATION = ""
402$ GOTO NEXT_FILE
403$ ENDIF
404$ ENDIF
405$ ENDIF
406$ ENDIF
407$!
408$! Check To See If We Are At The End Of The File List.
409$!
410$ IF (FILE_NAME.EQS.",")
411$ THEN
412$!
413$! We Are At The End Of The File List, Change State Or Goto FILE_DONE.
414$!
415$ IF STATE .EQS. "LIB" .AND. BUILDALL .NES. "LIBRARY"
416$ THEN
417$ STATE = "APPS"
418$ GOTO MODULE_AGAIN
419$ ELSE
420$ GOTO FILE_DONE
421$ ENDIF
422$!
423$! End The File List Check.
424$!
425$ ENDIF
426$!
427$! Increment The Counter.
428$!
429$ FILE_COUNTER = FILE_COUNTER + 1
430$!
431$! Create The Source File Name.
432$!
433$ TMP_FILE_NAME = F$ELEMENT(1,"]",FILE_NAME)
434$ IF TMP_FILE_NAME .EQS. "]" THEN TMP_FILE_NAME = FILE_NAME
435$ IF F$ELEMENT(0,".",TMP_FILE_NAME) .EQS. TMP_FILE_NAME THEN -
436 FILE_NAME = FILE_NAME + ".c"
437$ IF (MODULE_NAME.NES."")
438$ THEN
439$ SOURCE_FILE = "SYS$DISK:[." + MODULE_NAME+ "]" + FILE_NAME
440$ ELSE
441$ SOURCE_FILE = "SYS$DISK:[]" + FILE_NAME
442$ ENDIF
443$ SOURCE_FILE = SOURCE_FILE - "]["
444$!
445$! Create The Object File Name.
446$!
447$ OBJECT_FILE = OBJ_DIR + F$PARSE(FILE_NAME,,,"NAME","SYNTAX_ONLY") + ".OBJ"
448$ ON WARNING THEN GOTO NEXT_FILE
449$!
450$! Check To See If The File We Want To Compile Is Actually There.
451$!
452$ IF (F$SEARCH(SOURCE_FILE).EQS."")
453$ THEN
454$!
455$! Tell The User That The File Doesn't Exist.
456$!
457$ WRITE SYS$OUTPUT ""
458$ WRITE SYS$OUTPUT "The File ",SOURCE_FILE," Doesn't Exist."
459$ WRITE SYS$OUTPUT ""
460$!
461$! Exit The Build.
462$!
463$ GOTO EXIT
464$!
465$! End The File Exist Check.
466$!
467$ ENDIF
468$!
469$! Tell The User We Are Compiling The File.
470$!
471$ IF (MODULE_NAME.EQS."")
472$ THEN
473$ WRITE SYS$OUTPUT "Compiling The ",FILE_NAME," File. (",BUILDALL,",",STATE,")"
474$ ENDIF
475$ IF (MODULE_NAME.NES."")
476$ THEN
477$ WRITE SYS$OUTPUT " ",FILE_NAME,""
478$ ENDIF
479$!
480$! Compile The File.
481$!
482$ ON ERROR THEN GOTO NEXT_FILE
483$ FILE_NAME0 = F$ELEMENT(0,".",FILE_NAME)
484$ IF FILE_NAME - ".mar" .NES. FILE_NAME
485$ THEN
486$ MACRO/OBJECT='OBJECT_FILE' 'SOURCE_FILE'
487$ ELSE
488$ IF COMPILEWITH_CC3 - FILE_NAME0 .NES. COMPILEWITH_CC3
489$ THEN
490$ CC3/OBJECT='OBJECT_FILE' 'SOURCE_FILE'
491$ ELSE
492$ IF COMPILEWITH_CC4 - FILE_NAME0 .NES. COMPILEWITH_CC4
493$ THEN
494$ CC4/OBJECT='OBJECT_FILE' 'SOURCE_FILE'
495$ ELSE
496$ IF COMPILEWITH_CC5 - FILE_NAME0 .NES. COMPILEWITH_CC5
497$ THEN
498$ CC5/OBJECT='OBJECT_FILE' 'SOURCE_FILE'
499$ ELSE
500$ CC/OBJECT='OBJECT_FILE' 'SOURCE_FILE'
501$ ENDIF
502$ ENDIF
503$ ENDIF
504$ ENDIF
505$ IF STATE .EQS. "LIB"
506$ THEN
507$!
508$! Add It To The Library.
509$!
510$ LIBRARY/REPLACE 'LIB_NAME' 'OBJECT_FILE'
511$!
512$! Time To Clean Up The Object File.
513$!
514$ DELETE 'OBJECT_FILE';*
515$ ENDIF
516$!
517$! Go Back And Do It Again.
518$!
519$ GOTO NEXT_FILE
520$!
521$! All Done With This Library Part.
522$!
523$ FILE_DONE:
524$!
525$! Time To Build Some Applications
526$!
527$ IF F$TYPE('APPS_MODULE') .NES. "" .AND. BUILDALL .NES. "LIBRARY"
528$ THEN
529$ APPLICATION_COUNTER = 0
530$ NEXT_APPLICATION:
531$ APPLICATION = F$ELEMENT(APPLICATION_COUNTER,";",'APPS_MODULE')
532$ IF APPLICATION .EQS. ";" THEN GOTO APPLICATION_DONE
533$
534$ APPLICATION_COUNTER = APPLICATION_COUNTER + 1
535$ APPLICATION_OBJECTS = F$ELEMENT(1,"/",APPLICATION)
536$ APPLICATION = F$ELEMENT(0,"/",APPLICATION)
537$
538$! WRITE SYS$OUTPUT "DEBUG: SHOW SYMBOL APPLICATION*"
539$! SHOW SYMBOL APPLICATION*
540$!
541$! Tell the user what happens
542$!
543$ WRITE SYS$OUTPUT " ",APPLICATION,".exe"
544$!
545$! Link The Program.
546$!
547$ ON ERROR THEN GOTO NEXT_APPLICATION
548$!
549$! Check To See If We Are To Link With A Specific TCP/IP Library.
550$!
551$ IF (TCPIP_LIB.NES."")
552$ THEN
553$!
554$! Link With A TCP/IP Library.
555$!
556$ LINK/'DEBUGGER'/'TRACEBACK'/EXE='EXE_DIR''APPLICATION'.EXE -
557 'OBJ_DIR''APPLICATION_OBJECTS', -
558 'CRYPTO_LIB'/LIBRARY, -
559 'TCPIP_LIB','OPT_FILE'/OPTION
560$!
561$! Else...
562$!
563$ ELSE
564$!
565$! Don't Link With A TCP/IP Library.
566$!
567$ LINK/'DEBUGGER'/'TRACEBACK'/EXE='EXE_DIR''APPLICATION'.EXE -
568 'OBJ_DIR''APPLICATION_OBJECTS',-
569 'CRYPTO_LIB'/LIBRARY, -
570 'OPT_FILE'/OPTION
571$!
572$! End The TCP/IP Library Check.
573$!
574$ ENDIF
575$ GOTO NEXT_APPLICATION
576$ APPLICATION_DONE:
577$ ENDIF
578$!
579$! Go Back And Get The Next Module.
580$!
581$ GOTO MODULE_NEXT
582$!
583$! All Done With This Module.
584$!
585$ MODULE_DONE:
586$!
587$! Tell The User That We Are All Done.
588$!
589$ WRITE SYS$OUTPUT "All Done..."
590$ EXIT:
591$ GOSUB CLEANUP
592$ EXIT
593$!
594$! Check For The Link Option FIle.
595$!
596$ CHECK_OPT_FILE:
597$!
598$! Check To See If We Need To Make A VAX C Option File.
599$!
600$ IF (COMPILER.EQS."VAXC")
601$ THEN
602$!
603$! Check To See If We Already Have A VAX C Linker Option File.
604$!
605$ IF (F$SEARCH(OPT_FILE).EQS."")
606$ THEN
607$!
608$! We Need A VAX C Linker Option File.
609$!
610$ CREATE 'OPT_FILE'
611$DECK
612!
613! Default System Options File To Link Agianst
614! The Sharable VAX C Runtime Library.
615!
616SYS$SHARE:VAXCRTL.EXE/SHARE
617$EOD
618$!
619$! End The Option File Check.
620$!
621$ ENDIF
622$!
623$! End The VAXC Check.
624$!
625$ ENDIF
626$!
627$! Check To See If We Need A GNU C Option File.
628$!
629$ IF (COMPILER.EQS."GNUC")
630$ THEN
631$!
632$! Check To See If We Already Have A GNU C Linker Option File.
633$!
634$ IF (F$SEARCH(OPT_FILE).EQS."")
635$ THEN
636$!
637$! We Need A GNU C Linker Option File.
638$!
639$ CREATE 'OPT_FILE'
640$DECK
641!
642! Default System Options File To Link Agianst
643! The Sharable C Runtime Library.
644!
645GNU_CC:[000000]GCCLIB/LIBRARY
646SYS$SHARE:VAXCRTL/SHARE
647$EOD
648$!
649$! End The Option File Check.
650$!
651$ ENDIF
652$!
653$! End The GNU C Check.
654$!
655$ ENDIF
656$!
657$! Check To See If We Need A DEC C Option File.
658$!
659$ IF (COMPILER.EQS."DECC")
660$ THEN
661$!
662$! Check To See If We Already Have A DEC C Linker Option File.
663$!
664$ IF (F$SEARCH(OPT_FILE).EQS."")
665$ THEN
666$!
667$! Figure Out If We Need An AXP Or A VAX Linker Option File.
668$!
669$ IF ARCH .EQS. "VAX"
670$ THEN
671$!
672$! We Need A DEC C Linker Option File For VAX.
673$!
674$ CREATE 'OPT_FILE'
675$DECK
676!
677! Default System Options File To Link Agianst
678! The Sharable DEC C Runtime Library.
679!
680SYS$SHARE:DECC$SHR.EXE/SHARE
681$EOD
682$!
683$! Else...
684$!
685$ ELSE
686$!
687$! Create The AXP Linker Option File.
688$!
689$ CREATE 'OPT_FILE'
690$DECK
691!
692! Default System Options File For AXP To Link Agianst
693! The Sharable C Runtime Library.
694!
695SYS$SHARE:CMA$OPEN_LIB_SHR/SHARE
696SYS$SHARE:CMA$OPEN_RTL/SHARE
697$EOD
698$!
699$! End The VAX/AXP DEC C Option File Check.
700$!
701$ ENDIF
702$!
703$! End The Option File Search.
704$!
705$ ENDIF
706$!
707$! End The DEC C Check.
708$!
709$ ENDIF
710$!
711$! Tell The User What Linker Option File We Are Using.
712$!
713$ WRITE SYS$OUTPUT "Using Linker Option File ",OPT_FILE,"."
714$!
715$! Time To RETURN.
716$!
717$ RETURN
718$!
719$! Check The User's Options.
720$!
721$ CHECK_OPTIONS:
722$!
723$! Check To See If P1 Is Blank.
724$!
725$ IF (P1.EQS."ALL")
726$ THEN
727$!
728$! P1 Is Blank, So Build Everything.
729$!
730$ BUILDALL = "TRUE"
731$!
732$! Else...
733$!
734$ ELSE
735$!
736$! Else, Check To See If P1 Has A Valid Arguement.
737$!
738$ IF (P1.EQS."LIBRARY").OR.(P1.EQS."APPS")
739$ THEN
740$!
741$! A Valid Arguement.
742$!
743$ BUILDALL = P1
744$!
745$! Else...
746$!
747$ ELSE
748$!
749$! Tell The User We Don't Know What They Want.
750$!
751$ WRITE SYS$OUTPUT ""
752$ WRITE SYS$OUTPUT "The Option ",P1," Is Invalid. The Valid Options Are:"
753$ WRITE SYS$OUTPUT ""
754$ WRITE SYS$OUTPUT " ALL : Just Build Everything."
755$ WRITE SYS$OUTPUT " LIBRARY : To Compile Just The [.xxx.EXE.CRYPTO]LIBCRYPTO.OLB Library."
756$ WRITE SYS$OUTPUT " APPS : To Compile Just The [.xxx.EXE.CRYPTO]*.EXE Programs."
757$ WRITE SYS$OUTPUT ""
758$ WRITE SYS$OUTPUT " Where 'xxx' Stands For:"
759$ WRITE SYS$OUTPUT ""
760$ WRITE SYS$OUTPUT " AXP : Alpha Architecture."
761$ WRITE SYS$OUTPUT " VAX : VAX Architecture."
762$ WRITE SYS$OUTPUT ""
763$!
764$! Time To EXIT.
765$!
766$ EXIT
767$!
768$! End The Valid Arguement Check.
769$!
770$ ENDIF
771$!
772$! End The P1 Check.
773$!
774$ ENDIF
775$!
776$! Check To See If P2 Is Blank.
777$!
778$ IF (P2.EQS."NODEBUG")
779$ THEN
780$!
781$! P2 Is NODEBUG, So Compile Without The Debugger Information.
782$!
783$ DEBUGGER = "NODEBUG"
784$ TRACEBACK = "NOTRACEBACK"
785$ GCC_OPTIMIZE = "OPTIMIZE"
786$ CC_OPTIMIZE = "OPTIMIZE"
787$ MACRO_OPTIMIZE = "OPTIMIZE"
788$ WRITE SYS$OUTPUT "No Debugger Information Will Be Produced During Compile."
789$ WRITE SYS$OUTPUT "Compiling With Compiler Optimization."
790$ ELSE
791$!
792$! Check To See If We Are To Compile With Debugger Information.
793$!
794$ IF (P2.EQS."DEBUG")
795$ THEN
796$!
797$! Compile With Debugger Information.
798$!
799$ DEBUGGER = "DEBUG"
800$ TRACEBACK = "TRACEBACK"
801$ GCC_OPTIMIZE = "NOOPTIMIZE"
802$ CC_OPTIMIZE = "NOOPTIMIZE"
803$ MACRO_OPTIMIZE = "NOOPTIMIZE"
804$ WRITE SYS$OUTPUT "Debugger Information Will Be Produced During Compile."
805$ WRITE SYS$OUTPUT "Compiling Without Compiler Optimization."
806$ ELSE
807$!
808$! They Entered An Invalid Option..
809$!
810$ WRITE SYS$OUTPUT ""
811$ WRITE SYS$OUTPUT "The Option ",P2," Is Invalid. The Valid Options Are:"
812$ WRITE SYS$OUTPUT ""
813$ WRITE SYS$OUTPUT " DEBUG : Compile With The Debugger Information."
814$ WRITE SYS$OUTPUT " NODEBUG : Compile Without The Debugger Information."
815$ WRITE SYS$OUTPUT ""
816$!
817$! Time To EXIT.
818$!
819$ EXIT
820$!
821$! End The Valid Arguement Check.
822$!
823$ ENDIF
824$!
825$! End The P2 Check.
826$!
827$ ENDIF
828$!
829$! Special Threads For OpenVMS v7.1 Or Later
830$!
831$! Written By: Richard Levitte
832$! richard@levitte.org
833$!
834$!
835$! Check To See If We Have A Option For P5.
836$!
837$ IF (P5.EQS."")
838$ THEN
839$!
840$! Get The Version Of VMS We Are Using.
841$!
842$ ISSEVEN :=
843$ TMP = F$ELEMENT(0,"-",F$EXTRACT(1,4,F$GETSYI("VERSION")))
844$ TMP = F$INTEGER(F$ELEMENT(0,".",TMP)+F$ELEMENT(1,".",TMP))
845$!
846$! Check To See If The VMS Version Is v7.1 Or Later.
847$!
848$ IF (TMP.GE.71)
849$ THEN
850$!
851$! We Have OpenVMS v7.1 Or Later, So Use The Special Threads.
852$!
853$ ISSEVEN := ,PTHREAD_USE_D4
854$!
855$! End The VMS Version Check.
856$!
857$ ENDIF
858$!
859$! End The P5 Check.
860$!
861$ ENDIF
862$!
863$! Check To See If P3 Is Blank.
864$!
865$ IF (P3.EQS."")
866$ THEN
867$!
868$! O.K., The User Didn't Specify A Compiler, Let's Try To
869$! Find Out Which One To Use.
870$!
871$! Check To See If We Have GNU C.
872$!
873$ IF (F$TRNLNM("GNU_CC").NES."")
874$ THEN
875$!
876$! Looks Like GNUC, Set To Use GNUC.
877$!
878$ P3 = "GNUC"
879$!
880$! Else...
881$!
882$ ELSE
883$!
884$! Check To See If We Have VAXC Or DECC.
885$!
886$ IF (ARCH.EQS."AXP").OR.(F$TRNLNM("DECC$CC_DEFAULT").NES."")
887$ THEN
888$!
889$! Looks Like DECC, Set To Use DECC.
890$!
891$ P3 = "DECC"
892$!
893$! Else...
894$!
895$ ELSE
896$!
897$! Looks Like VAXC, Set To Use VAXC.
898$!
899$ P3 = "VAXC"
900$!
901$! End The VAXC Compiler Check.
902$!
903$ ENDIF
904$!
905$! End The DECC & VAXC Compiler Check.
906$!
907$ ENDIF
908$!
909$! End The Compiler Check.
910$!
911$ ENDIF
912$!
913$! Check To See If We Have A Option For P4.
914$!
915$ IF (P4.EQS."")
916$ THEN
917$!
918$! Find out what socket library we have available
919$!
920$ IF F$PARSE("SOCKETSHR:") .NES. ""
921$ THEN
922$!
923$! We have SOCKETSHR, and it is my opinion that it's the best to use.
924$!
925$ P4 = "SOCKETSHR"
926$!
927$! Tell the user
928$!
929$ WRITE SYS$OUTPUT "Using SOCKETSHR for TCP/IP"
930$!
931$! Else, let's look for something else
932$!
933$ ELSE
934$!
935$! Like UCX (the reason to do this before Multinet is that the UCX
936$! emulation is easier to use...)
937$!
938$ IF F$TRNLNM("UCX$IPC_SHR") .NES. "" -
939 .OR. F$PARSE("SYS$SHARE:UCX$IPC_SHR.EXE") .NES. "" -
940 .OR. F$PARSE("SYS$LIBRARY:UCX$IPC.OLB") .NES. ""
941$ THEN
942$!
943$! Last resort: a UCX or UCX-compatible library
944$!
945$ P4 = "UCX"
946$!
947$! Tell the user
948$!
949$ WRITE SYS$OUTPUT "Using UCX or an emulation thereof for TCP/IP"
950$!
951$! That was all...
952$!
953$ ENDIF
954$ ENDIF
955$ ENDIF
956$!
957$! Set Up Initial CC Definitions, Possibly With User Ones
958$!
959$ CCDEFS = "TCPIP_TYPE_''P4',DSO_VMS"
960$ IF F$TYPE(USER_CCDEFS) .NES. "" THEN CCDEFS = CCDEFS + "," + USER_CCDEFS
961$ CCEXTRAFLAGS = ""
962$ IF F$TYPE(USER_CCFLAGS) .NES. "" THEN CCEXTRAFLAGS = USER_CCFLAGS
963$ CCDISABLEWARNINGS = "LONGLONGTYPE,LONGLONGSUFX"
964$ IF F$TYPE(USER_CCDISABLEWARNINGS) .NES. "" THEN -
965 CCDISABLEWARNINGS = CCDISABLEWARNINGS + "," + USER_CCDISABLEWARNINGS
966$!
967$! Check To See If The User Entered A Valid Paramter.
968$!
969$ IF (P3.EQS."VAXC").OR.(P3.EQS."DECC").OR.(P3.EQS."GNUC")
970$ THEN
971$!
972$! Check To See If The User Wanted DECC.
973$!
974$ IF (P3.EQS."DECC")
975$ THEN
976$!
977$! Looks Like DECC, Set To Use DECC.
978$!
979$ COMPILER = "DECC"
980$!
981$! Tell The User We Are Using DECC.
982$!
983$ WRITE SYS$OUTPUT "Using DECC 'C' Compiler."
984$!
985$! Use DECC...
986$!
987$ CC = "CC"
988$ IF ARCH.EQS."VAX" .AND. F$TRNLNM("DECC$CC_DEFAULT").NES."/DECC" -
989 THEN CC = "CC/DECC"
990$ CC = CC + "/''CC_OPTIMIZE'/''DEBUGGER'/STANDARD=ANSI89" + -
991 "/NOLIST/PREFIX=ALL" + -
992 "/INCLUDE=(SYS$DISK:[],SYS$DISK:[-],SYS$DISK:[.ENGINE.VENDOR_DEFNS],SYS$DISK:[.EVP])" + -
993 CCEXTRAFLAGS
994$!
995$! Define The Linker Options File Name.
996$!
997$ OPT_FILE = "SYS$DISK:[]VAX_DECC_OPTIONS.OPT"
998$!
999$! End DECC Check.
1000$!
1001$ ENDIF
1002$!
1003$! Check To See If We Are To Use VAXC.
1004$!
1005$ IF (P3.EQS."VAXC")
1006$ THEN
1007$!
1008$! Looks Like VAXC, Set To Use VAXC.
1009$!
1010$ COMPILER = "VAXC"
1011$!
1012$! Tell The User We Are Using VAX C.
1013$!
1014$ WRITE SYS$OUTPUT "Using VAXC 'C' Compiler."
1015$!
1016$! Compile Using VAXC.
1017$!
1018$ CC = "CC"
1019$ IF ARCH.EQS."AXP"
1020$ THEN
1021$ WRITE SYS$OUTPUT "There is no VAX C on Alpha!"
1022$ EXIT
1023$ ENDIF
1024$ IF F$TRNLNM("DECC$CC_DEFAULT").EQS."/DECC" THEN CC = "CC/VAXC"
1025$ CC = CC + "/''CC_OPTIMIZE'/''DEBUGGER'/NOLIST" + -
1026 "/INCLUDE=(SYS$DISK:[],SYS$DISK:[-],SYS$DISK:[.ENGINE.VENDOR_DEFNS])" + -
1027 CCEXTRAFLAGS
1028$ CCDEFS = """VAXC""," + CCDEFS
1029$!
1030$! Define <sys> As SYS$COMMON:[SYSLIB]
1031$!
1032$ DEFINE/NOLOG SYS SYS$COMMON:[SYSLIB]
1033$!
1034$! Define The Linker Options File Name.
1035$!
1036$ OPT_FILE = "SYS$DISK:[]VAX_VAXC_OPTIONS.OPT"
1037$!
1038$! End VAXC Check
1039$!
1040$ ENDIF
1041$!
1042$! Check To See If We Are To Use GNU C.
1043$!
1044$ IF (P3.EQS."GNUC")
1045$ THEN
1046$!
1047$! Looks Like GNUC, Set To Use GNUC.
1048$!
1049$ COMPILER = "GNUC"
1050$!
1051$! Tell The User We Are Using GNUC.
1052$!
1053$ WRITE SYS$OUTPUT "Using GNU 'C' Compiler."
1054$!
1055$! Use GNU C...
1056$!
1057$ CC = "GCC/NOCASE_HACK/''GCC_OPTIMIZE'/''DEBUGGER'/NOLIST" + -
1058 "/INCLUDE=(SYS$DISK:[],SYS$DISK:[-],SYS$DISK:[.ENGINE.VENDOR_DEFNS])" + -
1059 CCEXTRAFLAGS
1060$!
1061$! Define The Linker Options File Name.
1062$!
1063$ OPT_FILE = "SYS$DISK:[]VAX_GNUC_OPTIONS.OPT"
1064$!
1065$! End The GNU C Check.
1066$!
1067$ ENDIF
1068$!
1069$! Set up default defines
1070$!
1071$ CCDEFS = """FLAT_INC=1""," + CCDEFS
1072$!
1073$! Finish up the definition of CC.
1074$!
1075$ IF COMPILER .EQS. "DECC"
1076$ THEN
1077$ IF CCDISABLEWARNINGS .EQS. ""
1078$ THEN
1079$ CC4DISABLEWARNINGS = "DOLLARID"
1080$ ELSE
1081$ CC4DISABLEWARNINGS = CCDISABLEWARNINGS + ",DOLLARID"
1082$ CCDISABLEWARNINGS = "/WARNING=(DISABLE=(" + CCDISABLEWARNINGS + "))"
1083$ ENDIF
1084$ CC4DISABLEWARNINGS = "/WARNING=(DISABLE=(" + CC4DISABLEWARNINGS + "))"
1085$ ELSE
1086$ CCDISABLEWARNINGS = ""
1087$ CC4DISABLEWARNINGS = ""
1088$ ENDIF
1089$ CC3 = CC + "/DEFINE=(" + CCDEFS + ISSEVEN + ")" + CCDISABLEWARNINGS
1090$ CC = CC + "/DEFINE=(" + CCDEFS + ")" + CCDISABLEWARNINGS
1091$ IF ARCH .EQS. "VAX" .AND. COMPILER .EQS. "DECC" .AND. P2 .NES. "DEBUG"
1092$ THEN
1093$ CC5 = CC + "/OPTIMIZE=NODISJOINT"
1094$ ELSE
1095$ CC5 = CC + "/NOOPTIMIZE"
1096$ ENDIF
1097$ CC4 = CC - CCDISABLEWARNINGS + CC4DISABLEWARNINGS
1098$!
1099$! Show user the result
1100$!
1101$ WRITE/SYMBOL SYS$OUTPUT "Main C Compiling Command: ",CC
1102$!
1103$! Else The User Entered An Invalid Arguement.
1104$!
1105$ ELSE
1106$!
1107$! Tell The User We Don't Know What They Want.
1108$!
1109$ WRITE SYS$OUTPUT ""
1110$ WRITE SYS$OUTPUT "The Option ",P3," Is Invalid. The Valid Options Are:"
1111$ WRITE SYS$OUTPUT ""
1112$ WRITE SYS$OUTPUT " VAXC : To Compile With VAX C."
1113$ WRITE SYS$OUTPUT " DECC : To Compile With DEC C."
1114$ WRITE SYS$OUTPUT " GNUC : To Compile With GNU C."
1115$ WRITE SYS$OUTPUT ""
1116$!
1117$! Time To EXIT.
1118$!
1119$ EXIT
1120$!
1121$! End The Valid Arguement Check.
1122$!
1123$ ENDIF
1124$!
1125$! Build a MACRO command for the architecture at hand
1126$!
1127$ IF ARCH .EQS. "VAX" THEN MACRO = "MACRO/''DEBUGGER'"
1128$ IF ARCH .EQS. "AXP" THEN MACRO = "MACRO/MIGRATION/''DEBUGGER'/''MACRO_OPTIMIZE'"
1129$!
1130$! Show user the result
1131$!
1132$ WRITE/SYMBOL SYS$OUTPUT "Main MACRO Compiling Command: ",MACRO
1133$!
1134$! Time to check the contents, and to make sure we get the correct library.
1135$!
1136$ IF P4.EQS."SOCKETSHR" .OR. P4.EQS."MULTINET" .OR. P4.EQS."UCX" -
1137 .OR. P4.EQS."TCPIP" .OR. P4.EQS."NONE"
1138$ THEN
1139$!
1140$! Check to see if SOCKETSHR was chosen
1141$!
1142$ IF P4.EQS."SOCKETSHR"
1143$ THEN
1144$!
1145$! Set the library to use SOCKETSHR
1146$!
1147$ TCPIP_LIB = "SYS$DISK:[-.VMS]SOCKETSHR_SHR.OPT/OPT"
1148$!
1149$! Done with SOCKETSHR
1150$!
1151$ ENDIF
1152$!
1153$! Check to see if MULTINET was chosen
1154$!
1155$ IF P4.EQS."MULTINET"
1156$ THEN
1157$!
1158$! Set the library to use UCX emulation.
1159$!
1160$ P4 = "UCX"
1161$!
1162$! Done with MULTINET
1163$!
1164$ ENDIF
1165$!
1166$! Check to see if UCX was chosen
1167$!
1168$ IF P4.EQS."UCX"
1169$ THEN
1170$!
1171$! Set the library to use UCX.
1172$!
1173$ TCPIP_LIB = "SYS$DISK:[-.VMS]UCX_SHR_DECC.OPT/OPT"
1174$ IF F$TRNLNM("UCX$IPC_SHR") .NES. ""
1175$ THEN
1176$ TCPIP_LIB = "SYS$DISK:[-.VMS]UCX_SHR_DECC_LOG.OPT/OPT"
1177$ ELSE
1178$ IF COMPILER .NES. "DECC" .AND. ARCH .EQS. "VAX" THEN -
1179 TCPIP_LIB = "SYS$DISK:[-.VMS]UCX_SHR_VAXC.OPT/OPT"
1180$ ENDIF
1181$!
1182$! Done with UCX
1183$!
1184$ ENDIF
1185$!
1186$! Check to see if TCPIP was chosen
1187$!
1188$ IF P4.EQS."TCPIP"
1189$ THEN
1190$!
1191$! Set the library to use TCPIP (post UCX).
1192$!
1193$ TCPIP_LIB = "SYS$DISK:[-.VMS]TCPIP_SHR_DECC.OPT/OPT"
1194$!
1195$! Done with TCPIP
1196$!
1197$ ENDIF
1198$!
1199$! Check to see if NONE was chosen
1200$!
1201$ IF P4.EQS."NONE"
1202$ THEN
1203$!
1204$! Do not use a TCPIP library.
1205$!
1206$ TCPIP_LIB = ""
1207$!
1208$! Done with TCPIP
1209$!
1210$ ENDIF
1211$!
1212$! Print info
1213$!
1214$ WRITE SYS$OUTPUT "TCP/IP library spec: ", TCPIP_LIB
1215$!
1216$! Else The User Entered An Invalid Arguement.
1217$!
1218$ ELSE
1219$!
1220$! Tell The User We Don't Know What They Want.
1221$!
1222$ WRITE SYS$OUTPUT ""
1223$ WRITE SYS$OUTPUT "The Option ",P4," Is Invalid. The Valid Options Are:"
1224$ WRITE SYS$OUTPUT ""
1225$ WRITE SYS$OUTPUT " SOCKETSHR : To link with SOCKETSHR TCP/IP library."
1226$ WRITE SYS$OUTPUT " UCX : To link with UCX TCP/IP library."
1227$ WRITE SYS$OUTPUT " TCPIP : To link with TCPIP (post UCX) TCP/IP library."
1228$ WRITE SYS$OUTPUT ""
1229$!
1230$! Time To EXIT.
1231$!
1232$ EXIT
1233$!
1234$! Done with TCP/IP libraries
1235$!
1236$ ENDIF
1237$!
1238$! Check if the user wanted to compile just a subset of all the encryption
1239$! methods.
1240$!
1241$ IF P6 .NES. ""
1242$ THEN
1243$ ENCRYPT_TYPES = P6
1244$ ENDIF
1245$!
1246$! Time To RETURN...
1247$!
1248$ RETURN
1249$!
1250$ INITIALISE:
1251$!
1252$! Save old value of the logical name OPENSSL
1253$!
1254$ __SAVE_OPENSSL = F$TRNLNM("OPENSSL","LNM$PROCESS_TABLE")
1255$!
1256$! Save directory information
1257$!
1258$ __HERE = F$PARSE(F$PARSE("A.;",F$ENVIRONMENT("PROCEDURE"))-"A.;","[]A.;") - "A.;"
1259$ __HERE = F$EDIT(__HERE,"UPCASE")
1260$ __TOP = __HERE - "CRYPTO]"
1261$ __INCLUDE = __TOP + "INCLUDE.OPENSSL]"
1262$!
1263$! Set up the logical name OPENSSL to point at the include directory
1264$!
1265$ DEFINE OPENSSL/NOLOG '__INCLUDE'
1266$!
1267$! Done
1268$!
1269$ RETURN
1270$!
1271$ CLEANUP:
1272$!
1273$! Restore the logical name OPENSSL if it had a value
1274$!
1275$ IF __SAVE_OPENSSL .EQS. ""
1276$ THEN
1277$ DEASSIGN OPENSSL
1278$ ELSE
1279$ DEFINE/NOLOG OPENSSL '__SAVE_OPENSSL'
1280$ ENDIF
1281$!
1282$! Done
1283$!
1284$ RETURN
diff --git a/src/lib/libcrypto/crypto.h b/src/lib/libcrypto/crypto.h
index 22fd939e65..4d1dfac7f1 100644
--- a/src/lib/libcrypto/crypto.h
+++ b/src/lib/libcrypto/crypto.h
@@ -434,9 +434,12 @@ void CRYPTO_mem_leaks_cb(CRYPTO_MEM_LEAK_CB *cb);
434 434
435/* die if we have to */ 435/* die if we have to */
436void OpenSSLDie(const char *file,int line,const char *assertion); 436void OpenSSLDie(const char *file,int line,const char *assertion);
437#define OPENSSL_assert(e) (void)((e) ? 0 : (OpenSSLDie(__FILE__, __LINE__, #e),1)) 437#define OPENSSL_assert(e) ((e) ? (void)0 : OpenSSLDie(__FILE__, __LINE__, #e))
438 438
439#ifdef OPENSSL_FIPS 439#ifdef OPENSSL_FIPS
440int FIPS_mode(void);
441void *FIPS_rand_check(void);
442
440#define FIPS_ERROR_IGNORED(alg) OpenSSLDie(__FILE__, __LINE__, \ 443#define FIPS_ERROR_IGNORED(alg) OpenSSLDie(__FILE__, __LINE__, \
441 alg " previous FIPS forbidden algorithm error ignored"); 444 alg " previous FIPS forbidden algorithm error ignored");
442 445
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..1c2e1f75b9
--- /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 - 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..32457d775c
--- /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 relevent 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..800af0b123
--- /dev/null
+++ b/src/lib/libcrypto/des/Makefile
@@ -0,0 +1,314 @@
1#
2# OpenSSL/crypto/des/Makefile
3#
4
5DIR= des
6TOP= ../..
7CC= cc
8CPP= $(CC) -E
9INCLUDES=-I$(TOP) -I../../include
10CFLAG=-g
11INSTALL_PREFIX=
12OPENSSLDIR= /usr/local/ssl
13INSTALLTOP=/usr/local/ssl
14MAKEDEPPROG= makedepend
15MAKEDEPEND= $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG)
16MAKEFILE= Makefile
17AR= ar r
18RANLIB= ranlib
19DES_ENC= des_enc.o fcrypt_b.o
20# or use
21#DES_ENC= dx86-elf.o yx86-elf.o
22
23CFLAGS= $(INCLUDES) $(CFLAG)
24ASFLAGS= $(INCLUDES) $(ASFLAG)
25
26GENERAL=Makefile
27TEST=destest.c
28APPS=
29
30LIB=$(TOP)/libcrypto.a
31LIBSRC= cbc_cksm.c cbc_enc.c cfb64enc.c cfb_enc.c \
32 ecb3_enc.c ecb_enc.c enc_read.c enc_writ.c \
33 fcrypt.c ofb64enc.c ofb_enc.c pcbc_enc.c \
34 qud_cksm.c rand_key.c rpc_enc.c set_key.c \
35 des_enc.c fcrypt_b.c \
36 xcbc_enc.c \
37 str2key.c cfb64ede.c ofb64ede.c ede_cbcm_enc.c des_old.c des_old2.c \
38 read2pwd.c
39
40LIBOBJ= set_key.o ecb_enc.o cbc_enc.o \
41 ecb3_enc.o cfb64enc.o cfb64ede.o cfb_enc.o ofb64ede.o \
42 enc_read.o enc_writ.o ofb64enc.o \
43 ofb_enc.o str2key.o pcbc_enc.o qud_cksm.o rand_key.o \
44 ${DES_ENC} \
45 fcrypt.o xcbc_enc.o rpc_enc.o cbc_cksm.o \
46 ede_cbcm_enc.o des_old.o des_old2.o read2pwd.o
47
48SRC= $(LIBSRC)
49
50EXHEADER= des.h des_old.h
51HEADER= des_locl.h rpc_des.h spr.h des_ver.h $(EXHEADER)
52
53ALL= $(GENERAL) $(SRC) $(HEADER)
54
55top:
56 (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all)
57
58all: lib
59
60lib: $(LIBOBJ)
61 $(AR) $(LIB) $(LIBOBJ)
62 $(RANLIB) $(LIB) || echo Never mind.
63 @touch lib
64
65des: des.o cbc3_enc.o lib
66 $(CC) $(CFLAGS) -o des des.o cbc3_enc.o $(LIB)
67
68# elf
69asm/dx86-elf.s: asm/des-586.pl ../perlasm/x86asm.pl ../perlasm/cbc.pl
70 (cd asm; $(PERL) des-586.pl elf $(CFLAGS) > dx86-elf.s)
71
72asm/yx86-elf.s: asm/crypt586.pl ../perlasm/x86asm.pl ../perlasm/cbc.pl
73 (cd asm; $(PERL) crypt586.pl elf $(CFLAGS) > yx86-elf.s)
74
75# a.out
76asm/dx86-out.o: asm/dx86unix.cpp
77 $(CPP) -DOUT asm/dx86unix.cpp | as -o asm/dx86-out.o
78
79asm/yx86-out.o: asm/yx86unix.cpp
80 $(CPP) -DOUT asm/yx86unix.cpp | as -o asm/yx86-out.o
81
82# bsdi
83asm/dx86bsdi.o: asm/dx86unix.cpp
84 $(CPP) -DBSDI asm/dx86unix.cpp | sed 's/ :/:/' | as -o asm/dx86bsdi.o
85
86asm/yx86bsdi.o: asm/yx86unix.cpp
87 $(CPP) -DBSDI asm/yx86unix.cpp | sed 's/ :/:/' | as -o asm/yx86bsdi.o
88
89asm/dx86unix.cpp: asm/des-586.pl ../perlasm/x86asm.pl ../perlasm/cbc.pl
90 (cd asm; $(PERL) des-586.pl cpp >dx86unix.cpp)
91
92asm/yx86unix.cpp: asm/crypt586.pl ../perlasm/x86asm.pl
93 (cd asm; $(PERL) crypt586.pl cpp >yx86unix.cpp)
94
95files:
96 $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
97
98links:
99 @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
100 @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
101 @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
102
103install: installs
104
105installs:
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 $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
122
123dclean:
124 $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
125 mv -f Makefile.new $(MAKEFILE)
126
127clean:
128 rm -f asm/dx86unix.cpp asm/yx86unix.cpp asm/*-elf.* *.o asm/*.o *.obj des lib tags core .pure .nfs* *.old *.bak fluff
129
130# DO NOT DELETE THIS LINE -- make depend depends on it.
131
132cbc_cksm.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
133cbc_cksm.o: ../../include/openssl/des_old.h ../../include/openssl/e_os2.h
134cbc_cksm.o: ../../include/openssl/opensslconf.h
135cbc_cksm.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
136cbc_cksm.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
137cbc_cksm.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
138cbc_cksm.o: cbc_cksm.c des_locl.h
139cbc_enc.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
140cbc_enc.o: ../../include/openssl/des_old.h ../../include/openssl/e_os2.h
141cbc_enc.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
142cbc_enc.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
143cbc_enc.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
144cbc_enc.o: ../../include/openssl/ui_compat.h cbc_enc.c des_locl.h ncbc_enc.c
145cfb64ede.o: ../../e_os.h ../../include/openssl/crypto.h
146cfb64ede.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
147cfb64ede.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslconf.h
148cfb64ede.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
149cfb64ede.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
150cfb64ede.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
151cfb64ede.o: cfb64ede.c des_locl.h
152cfb64enc.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
153cfb64enc.o: ../../include/openssl/des_old.h ../../include/openssl/e_os2.h
154cfb64enc.o: ../../include/openssl/opensslconf.h
155cfb64enc.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
156cfb64enc.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
157cfb64enc.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
158cfb64enc.o: cfb64enc.c des_locl.h
159cfb_enc.o: ../../e_os.h ../../include/openssl/crypto.h
160cfb_enc.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
161cfb_enc.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslconf.h
162cfb_enc.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
163cfb_enc.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
164cfb_enc.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
165cfb_enc.o: cfb_enc.c des_locl.h
166des_enc.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
167des_enc.o: ../../include/openssl/des_old.h ../../include/openssl/e_os2.h
168des_enc.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
169des_enc.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
170des_enc.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
171des_enc.o: ../../include/openssl/ui_compat.h des_enc.c des_locl.h ncbc_enc.c
172des_old.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
173des_old.o: ../../include/openssl/des_old.h ../../include/openssl/e_os2.h
174des_old.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
175des_old.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rand.h
176des_old.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
177des_old.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
178des_old.o: ../../include/openssl/ui_compat.h des_old.c
179des_old2.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
180des_old2.o: ../../include/openssl/des_old.h ../../include/openssl/e_os2.h
181des_old2.o: ../../include/openssl/opensslconf.h
182des_old2.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
183des_old2.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h
184des_old2.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
185des_old2.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
186des_old2.o: des_old2.c
187ecb3_enc.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
188ecb3_enc.o: ../../include/openssl/des_old.h ../../include/openssl/e_os2.h
189ecb3_enc.o: ../../include/openssl/opensslconf.h
190ecb3_enc.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
191ecb3_enc.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
192ecb3_enc.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
193ecb3_enc.o: des_locl.h ecb3_enc.c
194ecb_enc.o: ../../include/openssl/bio.h ../../include/openssl/crypto.h
195ecb_enc.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
196ecb_enc.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslconf.h
197ecb_enc.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
198ecb_enc.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
199ecb_enc.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
200ecb_enc.o: des_locl.h des_ver.h ecb_enc.c spr.h
201ede_cbcm_enc.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
202ede_cbcm_enc.o: ../../include/openssl/des_old.h ../../include/openssl/e_os2.h
203ede_cbcm_enc.o: ../../include/openssl/opensslconf.h
204ede_cbcm_enc.o: ../../include/openssl/opensslv.h
205ede_cbcm_enc.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
206ede_cbcm_enc.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
207ede_cbcm_enc.o: ../../include/openssl/ui_compat.h des_locl.h ede_cbcm_enc.c
208enc_read.o: ../../e_os.h ../../include/openssl/bio.h
209enc_read.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
210enc_read.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
211enc_read.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
212enc_read.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
213enc_read.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
214enc_read.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
215enc_read.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
216enc_read.o: ../cryptlib.h des_locl.h enc_read.c
217enc_writ.o: ../../e_os.h ../../include/openssl/bio.h
218enc_writ.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
219enc_writ.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
220enc_writ.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
221enc_writ.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
222enc_writ.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
223enc_writ.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h
224enc_writ.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
225enc_writ.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
226enc_writ.o: ../cryptlib.h des_locl.h enc_writ.c
227fcrypt.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
228fcrypt.o: ../../include/openssl/des_old.h ../../include/openssl/e_os2.h
229fcrypt.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
230fcrypt.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
231fcrypt.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
232fcrypt.o: ../../include/openssl/ui_compat.h des_locl.h fcrypt.c
233fcrypt_b.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
234fcrypt_b.o: ../../include/openssl/des_old.h ../../include/openssl/e_os2.h
235fcrypt_b.o: ../../include/openssl/opensslconf.h
236fcrypt_b.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
237fcrypt_b.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
238fcrypt_b.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
239fcrypt_b.o: des_locl.h fcrypt_b.c
240ofb64ede.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
241ofb64ede.o: ../../include/openssl/des_old.h ../../include/openssl/e_os2.h
242ofb64ede.o: ../../include/openssl/opensslconf.h
243ofb64ede.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
244ofb64ede.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
245ofb64ede.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
246ofb64ede.o: des_locl.h ofb64ede.c
247ofb64enc.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
248ofb64enc.o: ../../include/openssl/des_old.h ../../include/openssl/e_os2.h
249ofb64enc.o: ../../include/openssl/opensslconf.h
250ofb64enc.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
251ofb64enc.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
252ofb64enc.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
253ofb64enc.o: des_locl.h ofb64enc.c
254ofb_enc.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
255ofb_enc.o: ../../include/openssl/des_old.h ../../include/openssl/e_os2.h
256ofb_enc.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
257ofb_enc.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
258ofb_enc.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
259ofb_enc.o: ../../include/openssl/ui_compat.h des_locl.h ofb_enc.c
260pcbc_enc.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
261pcbc_enc.o: ../../include/openssl/des_old.h ../../include/openssl/e_os2.h
262pcbc_enc.o: ../../include/openssl/opensslconf.h
263pcbc_enc.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
264pcbc_enc.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
265pcbc_enc.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
266pcbc_enc.o: des_locl.h pcbc_enc.c
267qud_cksm.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
268qud_cksm.o: ../../include/openssl/des_old.h ../../include/openssl/e_os2.h
269qud_cksm.o: ../../include/openssl/opensslconf.h
270qud_cksm.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
271qud_cksm.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
272qud_cksm.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
273qud_cksm.o: des_locl.h qud_cksm.c
274rand_key.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
275rand_key.o: ../../include/openssl/des_old.h ../../include/openssl/e_os2.h
276rand_key.o: ../../include/openssl/opensslconf.h
277rand_key.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
278rand_key.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h
279rand_key.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
280rand_key.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
281rand_key.o: rand_key.c
282read2pwd.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
283read2pwd.o: ../../include/openssl/des_old.h ../../include/openssl/e_os2.h
284read2pwd.o: ../../include/openssl/opensslconf.h
285read2pwd.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
286read2pwd.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
287read2pwd.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
288read2pwd.o: read2pwd.c
289rpc_enc.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
290rpc_enc.o: ../../include/openssl/des_old.h ../../include/openssl/e_os2.h
291rpc_enc.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
292rpc_enc.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
293rpc_enc.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
294rpc_enc.o: ../../include/openssl/ui_compat.h des_locl.h des_ver.h rpc_des.h
295rpc_enc.o: rpc_enc.c
296set_key.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
297set_key.o: ../../include/openssl/des_old.h ../../include/openssl/e_os2.h
298set_key.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
299set_key.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
300set_key.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
301set_key.o: ../../include/openssl/ui_compat.h des_locl.h set_key.c
302str2key.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
303str2key.o: ../../include/openssl/des_old.h ../../include/openssl/e_os2.h
304str2key.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
305str2key.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
306str2key.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
307str2key.o: ../../include/openssl/ui_compat.h des_locl.h str2key.c
308xcbc_enc.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
309xcbc_enc.o: ../../include/openssl/des_old.h ../../include/openssl/e_os2.h
310xcbc_enc.o: ../../include/openssl/opensslconf.h
311xcbc_enc.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
312xcbc_enc.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
313xcbc_enc.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
314xcbc_enc.o: des_locl.h xcbc_enc.c
diff --git a/src/lib/libcrypto/des/Makefile.ssl b/src/lib/libcrypto/des/Makefile.ssl
new file mode 100644
index 0000000000..0d9ba2b42f
--- /dev/null
+++ b/src/lib/libcrypto/des/Makefile.ssl
@@ -0,0 +1,316 @@
1#
2# SSLeay/crypto/des/Makefile
3#
4
5DIR= des
6TOP= ../..
7CC= cc
8CPP= $(CC) -E
9INCLUDES=-I$(TOP) -I../../include
10CFLAG=-g
11INSTALL_PREFIX=
12OPENSSLDIR= /usr/local/ssl
13INSTALLTOP=/usr/local/ssl
14MAKE= make -f Makefile.ssl
15MAKEDEPPROG= makedepend
16MAKEDEPEND= $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG)
17MAKEFILE= Makefile.ssl
18AR= ar r
19RANLIB= ranlib
20DES_ENC= des_enc.o fcrypt_b.o
21# or use
22#DES_ENC= dx86-elf.o yx86-elf.o
23
24CFLAGS= $(INCLUDES) $(CFLAG)
25ASFLAGS= $(INCLUDES) $(ASFLAG)
26
27GENERAL=Makefile
28TEST=destest.c
29APPS=
30
31LIB=$(TOP)/libcrypto.a
32LIBSRC= cbc_cksm.c cbc_enc.c cfb64enc.c cfb_enc.c \
33 ecb3_enc.c ecb_enc.c enc_read.c enc_writ.c \
34 fcrypt.c ofb64enc.c ofb_enc.c pcbc_enc.c \
35 qud_cksm.c rand_key.c rpc_enc.c set_key.c \
36 des_enc.c fcrypt_b.c \
37 xcbc_enc.c \
38 str2key.c cfb64ede.c ofb64ede.c ede_cbcm_enc.c des_old.c des_old2.c \
39 read2pwd.c
40
41LIBOBJ= set_key.o ecb_enc.o cbc_enc.o \
42 ecb3_enc.o cfb64enc.o cfb64ede.o cfb_enc.o ofb64ede.o \
43 enc_read.o enc_writ.o ofb64enc.o \
44 ofb_enc.o str2key.o pcbc_enc.o qud_cksm.o rand_key.o \
45 ${DES_ENC} \
46 fcrypt.o xcbc_enc.o rpc_enc.o cbc_cksm.o \
47 ede_cbcm_enc.o des_old.o des_old2.o read2pwd.o
48
49SRC= $(LIBSRC)
50
51EXHEADER= des.h des_old.h
52HEADER= des_locl.h rpc_des.h spr.h des_ver.h $(EXHEADER)
53
54ALL= $(GENERAL) $(SRC) $(HEADER)
55
56top:
57 (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all)
58
59all: lib
60
61lib: $(LIBOBJ)
62 $(AR) $(LIB) $(LIBOBJ)
63 $(RANLIB) $(LIB) || echo Never mind.
64 @touch lib
65
66des: des.o cbc3_enc.o lib
67 $(CC) $(CFLAGS) -o des des.o cbc3_enc.o $(LIB)
68
69# elf
70asm/dx86-elf.s: asm/des-586.pl ../perlasm/x86asm.pl ../perlasm/cbc.pl
71 (cd asm; $(PERL) des-586.pl elf $(CFLAGS) > dx86-elf.s)
72
73asm/yx86-elf.s: asm/crypt586.pl ../perlasm/x86asm.pl ../perlasm/cbc.pl
74 (cd asm; $(PERL) crypt586.pl elf $(CFLAGS) > yx86-elf.s)
75
76# a.out
77asm/dx86-out.o: asm/dx86unix.cpp
78 $(CPP) -DOUT asm/dx86unix.cpp | as -o asm/dx86-out.o
79
80asm/yx86-out.o: asm/yx86unix.cpp
81 $(CPP) -DOUT asm/yx86unix.cpp | as -o asm/yx86-out.o
82
83# bsdi
84asm/dx86bsdi.o: asm/dx86unix.cpp
85 $(CPP) -DBSDI asm/dx86unix.cpp | sed 's/ :/:/' | as -o asm/dx86bsdi.o
86
87asm/yx86bsdi.o: asm/yx86unix.cpp
88 $(CPP) -DBSDI asm/yx86unix.cpp | sed 's/ :/:/' | as -o asm/yx86bsdi.o
89
90asm/dx86unix.cpp: asm/des-586.pl ../perlasm/x86asm.pl ../perlasm/cbc.pl
91 (cd asm; $(PERL) des-586.pl cpp >dx86unix.cpp)
92
93asm/yx86unix.cpp: asm/crypt586.pl ../perlasm/x86asm.pl
94 (cd asm; $(PERL) crypt586.pl cpp >yx86unix.cpp)
95
96files:
97 $(PERL) $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO
98
99links:
100 @sh $(TOP)/util/point.sh Makefile.ssl Makefile
101 @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
102 @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
103 @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
104
105install: installs
106
107installs:
108 @for i in $(EXHEADER) ; \
109 do \
110 (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
111 chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
112 done;
113
114tags:
115 ctags $(SRC)
116
117tests:
118
119lint:
120 lint -DLINT $(INCLUDES) $(SRC)>fluff
121
122depend:
123 $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
124
125dclean:
126 $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
127 mv -f Makefile.new $(MAKEFILE)
128
129clean:
130 rm -f asm/dx86unix.cpp asm/yx86unix.cpp asm/*-elf.* *.o asm/*.o *.obj des lib tags core .pure .nfs* *.old *.bak fluff
131
132# DO NOT DELETE THIS LINE -- make depend depends on it.
133
134cbc_cksm.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
135cbc_cksm.o: ../../include/openssl/des_old.h ../../include/openssl/e_os2.h
136cbc_cksm.o: ../../include/openssl/opensslconf.h
137cbc_cksm.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
138cbc_cksm.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
139cbc_cksm.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
140cbc_cksm.o: cbc_cksm.c des_locl.h
141cbc_enc.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
142cbc_enc.o: ../../include/openssl/des_old.h ../../include/openssl/e_os2.h
143cbc_enc.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
144cbc_enc.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
145cbc_enc.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
146cbc_enc.o: ../../include/openssl/ui_compat.h cbc_enc.c des_locl.h ncbc_enc.c
147cfb64ede.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
148cfb64ede.o: ../../include/openssl/des_old.h ../../include/openssl/e_os2.h
149cfb64ede.o: ../../include/openssl/opensslconf.h
150cfb64ede.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
151cfb64ede.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
152cfb64ede.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
153cfb64ede.o: cfb64ede.c des_locl.h
154cfb64enc.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
155cfb64enc.o: ../../include/openssl/des_old.h ../../include/openssl/e_os2.h
156cfb64enc.o: ../../include/openssl/opensslconf.h
157cfb64enc.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
158cfb64enc.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
159cfb64enc.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
160cfb64enc.o: cfb64enc.c des_locl.h
161cfb_enc.o: ../../e_os.h ../../include/openssl/crypto.h
162cfb_enc.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
163cfb_enc.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslconf.h
164cfb_enc.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
165cfb_enc.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
166cfb_enc.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
167cfb_enc.o: cfb_enc.c des_locl.h
168des_enc.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
169des_enc.o: ../../include/openssl/des_old.h ../../include/openssl/e_os2.h
170des_enc.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
171des_enc.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
172des_enc.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
173des_enc.o: ../../include/openssl/ui_compat.h des_enc.c des_locl.h ncbc_enc.c
174des_old.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
175des_old.o: ../../include/openssl/des_old.h ../../include/openssl/e_os2.h
176des_old.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
177des_old.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rand.h
178des_old.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
179des_old.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
180des_old.o: ../../include/openssl/ui_compat.h des_old.c
181des_old2.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
182des_old2.o: ../../include/openssl/des_old.h ../../include/openssl/e_os2.h
183des_old2.o: ../../include/openssl/opensslconf.h
184des_old2.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
185des_old2.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h
186des_old2.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
187des_old2.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
188des_old2.o: des_old2.c
189ecb3_enc.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
190ecb3_enc.o: ../../include/openssl/des_old.h ../../include/openssl/e_os2.h
191ecb3_enc.o: ../../include/openssl/opensslconf.h
192ecb3_enc.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
193ecb3_enc.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
194ecb3_enc.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
195ecb3_enc.o: des_locl.h ecb3_enc.c
196ecb_enc.o: ../../include/openssl/bio.h ../../include/openssl/crypto.h
197ecb_enc.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
198ecb_enc.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslconf.h
199ecb_enc.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
200ecb_enc.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
201ecb_enc.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
202ecb_enc.o: des_locl.h des_ver.h ecb_enc.c spr.h
203ede_cbcm_enc.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
204ede_cbcm_enc.o: ../../include/openssl/des_old.h ../../include/openssl/e_os2.h
205ede_cbcm_enc.o: ../../include/openssl/opensslconf.h
206ede_cbcm_enc.o: ../../include/openssl/opensslv.h
207ede_cbcm_enc.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
208ede_cbcm_enc.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
209ede_cbcm_enc.o: ../../include/openssl/ui_compat.h des_locl.h ede_cbcm_enc.c
210enc_read.o: ../../e_os.h ../../include/openssl/bio.h
211enc_read.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
212enc_read.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
213enc_read.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
214enc_read.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
215enc_read.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
216enc_read.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
217enc_read.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
218enc_read.o: ../cryptlib.h des_locl.h enc_read.c
219enc_writ.o: ../../e_os.h ../../include/openssl/bio.h
220enc_writ.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
221enc_writ.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
222enc_writ.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
223enc_writ.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
224enc_writ.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
225enc_writ.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h
226enc_writ.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
227enc_writ.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
228enc_writ.o: ../cryptlib.h des_locl.h enc_writ.c
229fcrypt.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
230fcrypt.o: ../../include/openssl/des_old.h ../../include/openssl/e_os2.h
231fcrypt.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
232fcrypt.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
233fcrypt.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
234fcrypt.o: ../../include/openssl/ui_compat.h des_locl.h fcrypt.c
235fcrypt_b.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
236fcrypt_b.o: ../../include/openssl/des_old.h ../../include/openssl/e_os2.h
237fcrypt_b.o: ../../include/openssl/opensslconf.h
238fcrypt_b.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
239fcrypt_b.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
240fcrypt_b.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
241fcrypt_b.o: des_locl.h fcrypt_b.c
242ofb64ede.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
243ofb64ede.o: ../../include/openssl/des_old.h ../../include/openssl/e_os2.h
244ofb64ede.o: ../../include/openssl/opensslconf.h
245ofb64ede.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
246ofb64ede.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
247ofb64ede.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
248ofb64ede.o: des_locl.h ofb64ede.c
249ofb64enc.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
250ofb64enc.o: ../../include/openssl/des_old.h ../../include/openssl/e_os2.h
251ofb64enc.o: ../../include/openssl/opensslconf.h
252ofb64enc.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
253ofb64enc.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
254ofb64enc.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
255ofb64enc.o: des_locl.h ofb64enc.c
256ofb_enc.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
257ofb_enc.o: ../../include/openssl/des_old.h ../../include/openssl/e_os2.h
258ofb_enc.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
259ofb_enc.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
260ofb_enc.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
261ofb_enc.o: ../../include/openssl/ui_compat.h des_locl.h ofb_enc.c
262pcbc_enc.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
263pcbc_enc.o: ../../include/openssl/des_old.h ../../include/openssl/e_os2.h
264pcbc_enc.o: ../../include/openssl/opensslconf.h
265pcbc_enc.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
266pcbc_enc.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
267pcbc_enc.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
268pcbc_enc.o: des_locl.h pcbc_enc.c
269qud_cksm.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
270qud_cksm.o: ../../include/openssl/des_old.h ../../include/openssl/e_os2.h
271qud_cksm.o: ../../include/openssl/opensslconf.h
272qud_cksm.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
273qud_cksm.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
274qud_cksm.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
275qud_cksm.o: des_locl.h qud_cksm.c
276rand_key.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
277rand_key.o: ../../include/openssl/des_old.h ../../include/openssl/e_os2.h
278rand_key.o: ../../include/openssl/opensslconf.h
279rand_key.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
280rand_key.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h
281rand_key.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
282rand_key.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
283rand_key.o: rand_key.c
284read2pwd.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
285read2pwd.o: ../../include/openssl/des_old.h ../../include/openssl/e_os2.h
286read2pwd.o: ../../include/openssl/opensslconf.h
287read2pwd.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
288read2pwd.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
289read2pwd.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
290read2pwd.o: read2pwd.c
291rpc_enc.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
292rpc_enc.o: ../../include/openssl/des_old.h ../../include/openssl/e_os2.h
293rpc_enc.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
294rpc_enc.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
295rpc_enc.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
296rpc_enc.o: ../../include/openssl/ui_compat.h des_locl.h des_ver.h rpc_des.h
297rpc_enc.o: rpc_enc.c
298set_key.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
299set_key.o: ../../include/openssl/des_old.h ../../include/openssl/e_os2.h
300set_key.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
301set_key.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
302set_key.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
303set_key.o: ../../include/openssl/ui_compat.h des_locl.h set_key.c
304str2key.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
305str2key.o: ../../include/openssl/des_old.h ../../include/openssl/e_os2.h
306str2key.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
307str2key.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
308str2key.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
309str2key.o: ../../include/openssl/ui_compat.h des_locl.h str2key.c
310xcbc_enc.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
311xcbc_enc.o: ../../include/openssl/des_old.h ../../include/openssl/e_os2.h
312xcbc_enc.o: ../../include/openssl/opensslconf.h
313xcbc_enc.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
314xcbc_enc.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
315xcbc_enc.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
316xcbc_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/des-586.pl b/src/lib/libcrypto/des/asm/des-586.pl
index b75d3c6b3a..60d577cc8d 100644
--- a/src/lib/libcrypto/des/asm/des-586.pl
+++ b/src/lib/libcrypto/des/asm/des-586.pl
@@ -22,10 +22,14 @@ $R="esi";
22&external_label("DES_SPtrans"); 22&external_label("DES_SPtrans");
23&DES_encrypt("DES_encrypt1",1); 23&DES_encrypt("DES_encrypt1",1);
24&DES_encrypt("DES_encrypt2",0); 24&DES_encrypt("DES_encrypt2",0);
25&DES_encrypt3("DES_encrypt3",1); 25
26&DES_encrypt3("DES_decrypt3",0); 26if (!$main'openbsd)
27&cbc("DES_ncbc_encrypt","DES_encrypt1","DES_encrypt1",0,4,5,3,5,-1); 27 {
28&cbc("DES_ede3_cbc_encrypt","DES_encrypt3","DES_decrypt3",0,6,7,3,4,5); 28 &DES_encrypt3("DES_encrypt3",1);
29 &DES_encrypt3("DES_decrypt3",0);
30 &cbc("DES_ncbc_encrypt","DES_encrypt1","DES_encrypt1",0,4,5,3,5,-1);
31 &cbc("DES_ede3_cbc_encrypt","DES_encrypt3","DES_decrypt3",0,6,7,3,4,5);
32 }
29 33
30&asm_finish(); 34&asm_finish();
31 35
diff --git a/src/lib/libcrypto/des/asm/des686.pl b/src/lib/libcrypto/des/asm/des686.pl
new file mode 100644
index 0000000000..d3ad5d5edd
--- /dev/null
+++ b/src/lib/libcrypto/des/asm/des686.pl
@@ -0,0 +1,230 @@
1#!/usr/local/bin/perl
2
3$prog="des686.pl";
4
5# base code is in microsft
6# op dest, source
7# format.
8#
9
10# WILL NOT WORK ANYMORE WITH desboth.pl
11require "desboth.pl";
12
13if ( ($ARGV[0] eq "elf"))
14 { require "x86unix.pl"; }
15elsif ( ($ARGV[0] eq "a.out"))
16 { $aout=1; require "x86unix.pl"; }
17elsif ( ($ARGV[0] eq "sol"))
18 { $sol=1; require "x86unix.pl"; }
19elsif ( ($ARGV[0] eq "cpp"))
20 { $cpp=1; require "x86unix.pl"; }
21elsif ( ($ARGV[0] eq "win32"))
22 { require "x86ms.pl"; }
23else
24 {
25 print STDERR <<"EOF";
26Pick one target type from
27 elf - linux, FreeBSD etc
28 a.out - old linux
29 sol - x86 solaris
30 cpp - format so x86unix.cpp can be used
31 win32 - Windows 95/Windows NT
32EOF
33 exit(1);
34 }
35
36&comment("Don't even think of reading this code");
37&comment("It was automatically generated by $prog");
38&comment("Which is a perl program used to generate the x86 assember for");
39&comment("any of elf, a.out, Win32, or Solaris");
40&comment("It can be found in SSLeay 0.6.5+ or in libdes 3.26+");
41&comment("eric <eay\@cryptsoft.com>");
42&comment("");
43
44&file("dx86xxxx");
45
46$L="edi";
47$R="esi";
48
49&DES_encrypt("DES_encrypt1",1);
50&DES_encrypt("DES_encrypt2",0);
51
52&DES_encrypt3("DES_encrypt3",1);
53&DES_encrypt3("DES_decrypt3",0);
54
55&file_end();
56
57sub DES_encrypt
58 {
59 local($name,$do_ip)=@_;
60
61 &function_begin($name,"EXTRN _DES_SPtrans:DWORD");
62
63 &comment("");
64 &comment("Load the 2 words");
65 &mov("eax",&wparam(0));
66 &mov($L,&DWP(0,"eax","",0));
67 &mov($R,&DWP(4,"eax","",0));
68
69 $ksp=&wparam(1);
70
71 if ($do_ip)
72 {
73 &comment("");
74 &comment("IP");
75 &IP_new($L,$R,"eax");
76 }
77
78 &comment("");
79 &comment("fixup rotate");
80 &rotl($R,3);
81 &rotl($L,3);
82 &exch($L,$R);
83
84 &comment("");
85 &comment("load counter, key_schedule and enc flag");
86 &mov("eax",&wparam(2)); # get encrypt flag
87 &mov("ebp",&wparam(1)); # get ks
88 &cmp("eax","0");
89 &je(&label("start_decrypt"));
90
91 # encrypting part
92
93 for ($i=0; $i<16; $i+=2)
94 {
95 &comment("");
96 &comment("Round $i");
97 &D_ENCRYPT($L,$R,$i*2,"ebp","DES_SPtrans","ecx","edx","eax","ebx");
98
99 &comment("");
100 &comment("Round ".sprintf("%d",$i+1));
101 &D_ENCRYPT($R,$L,($i+1)*2,"ebp","DES_SPtrans","ecx","edx","eax","ebx");
102 }
103 &jmp(&label("end"));
104
105 &set_label("start_decrypt");
106
107 for ($i=15; $i>0; $i-=2)
108 {
109 &comment("");
110 &comment("Round $i");
111 &D_ENCRYPT($L,$R,$i*2,"ebp","DES_SPtrans","ecx","edx","eax","ebx");
112 &comment("");
113 &comment("Round ".sprintf("%d",$i-1));
114 &D_ENCRYPT($R,$L,($i-1)*2,"ebp","DES_SPtrans","ecx","edx","eax","ebx");
115 }
116
117 &set_label("end");
118
119 &comment("");
120 &comment("Fixup");
121 &rotr($L,3); # r
122 &rotr($R,3); # l
123
124 if ($do_ip)
125 {
126 &comment("");
127 &comment("FP");
128 &FP_new($R,$L,"eax");
129 }
130
131 &mov("eax",&wparam(0));
132 &mov(&DWP(0,"eax","",0),$L);
133 &mov(&DWP(4,"eax","",0),$R);
134
135 &function_end($name);
136 }
137
138
139# The logic is to load R into 2 registers and operate on both at the same time.
140# We also load the 2 R's into 2 more registers so we can do the 'move word down a byte'
141# while also masking the other copy and doing a lookup. We then also accumulate the
142# L value in 2 registers then combine them at the end.
143sub D_ENCRYPT
144 {
145 local($L,$R,$S,$ks,$desSP,$u,$t,$tmp1,$tmp2,$tmp3)=@_;
146
147 &mov( $u, &DWP(&n2a($S*4),$ks,"",0));
148 &mov( $t, &DWP(&n2a(($S+1)*4),$ks,"",0));
149 &xor( $u, $R );
150 &xor( $t, $R );
151 &rotr( $t, 4 );
152
153 # the numbers at the end of the line are origional instruction order
154 &mov( $tmp2, $u ); # 1 2
155 &mov( $tmp1, $t ); # 1 1
156 &and( $tmp2, "0xfc" ); # 1 4
157 &and( $tmp1, "0xfc" ); # 1 3
158 &shr( $t, 8 ); # 1 5
159 &xor( $L, &DWP("0x100+$desSP",$tmp1,"",0)); # 1 7
160 &shr( $u, 8 ); # 1 6
161 &mov( $tmp1, &DWP(" $desSP",$tmp2,"",0)); # 1 8
162
163 &mov( $tmp2, $u ); # 2 2
164 &xor( $L, $tmp1 ); # 1 9
165 &and( $tmp2, "0xfc" ); # 2 4
166 &mov( $tmp1, $t ); # 2 1
167 &and( $tmp1, "0xfc" ); # 2 3
168 &shr( $t, 8 ); # 2 5
169 &xor( $L, &DWP("0x300+$desSP",$tmp1,"",0)); # 2 7
170 &shr( $u, 8 ); # 2 6
171 &mov( $tmp1, &DWP("0x200+$desSP",$tmp2,"",0)); # 2 8
172 &mov( $tmp2, $u ); # 3 2
173
174 &xor( $L, $tmp1 ); # 2 9
175 &and( $tmp2, "0xfc" ); # 3 4
176
177 &mov( $tmp1, $t ); # 3 1
178 &shr( $u, 8 ); # 3 6
179 &and( $tmp1, "0xfc" ); # 3 3
180 &shr( $t, 8 ); # 3 5
181 &xor( $L, &DWP("0x500+$desSP",$tmp1,"",0)); # 3 7
182 &mov( $tmp1, &DWP("0x400+$desSP",$tmp2,"",0)); # 3 8
183
184 &and( $t, "0xfc" ); # 4 1
185 &xor( $L, $tmp1 ); # 3 9
186
187 &and( $u, "0xfc" ); # 4 2
188 &xor( $L, &DWP("0x700+$desSP",$t,"",0)); # 4 3
189 &xor( $L, &DWP("0x600+$desSP",$u,"",0)); # 4 4
190 }
191
192sub PERM_OP
193 {
194 local($a,$b,$tt,$shift,$mask)=@_;
195
196 &mov( $tt, $a );
197 &shr( $tt, $shift );
198 &xor( $tt, $b );
199 &and( $tt, $mask );
200 &xor( $b, $tt );
201 &shl( $tt, $shift );
202 &xor( $a, $tt );
203 }
204
205sub IP_new
206 {
207 local($l,$r,$tt)=@_;
208
209 &PERM_OP($r,$l,$tt, 4,"0x0f0f0f0f");
210 &PERM_OP($l,$r,$tt,16,"0x0000ffff");
211 &PERM_OP($r,$l,$tt, 2,"0x33333333");
212 &PERM_OP($l,$r,$tt, 8,"0x00ff00ff");
213 &PERM_OP($r,$l,$tt, 1,"0x55555555");
214 }
215
216sub FP_new
217 {
218 local($l,$r,$tt)=@_;
219
220 &PERM_OP($l,$r,$tt, 1,"0x55555555");
221 &PERM_OP($r,$l,$tt, 8,"0x00ff00ff");
222 &PERM_OP($l,$r,$tt, 2,"0x33333333");
223 &PERM_OP($r,$l,$tt,16,"0x0000ffff");
224 &PERM_OP($l,$r,$tt, 4,"0x0f0f0f0f");
225 }
226
227sub n2a
228 {
229 sprintf("%d",$_[0]);
230 }
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..fc2c35a1ce
--- /dev/null
+++ b/src/lib/libcrypto/des/des-lib.com
@@ -0,0 +1,1003 @@
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 AXP 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").GE.128)
49$ THEN
50$!
51$! The Architecture Is AXP.
52$!
53$ ARCH := AXP
54$!
55$! Else...
56$!
57$ ELSE
58$!
59$! The Architecture Is VAX.
60$!
61$ ARCH := VAX
62$!
63$! End The Architecture Check.
64$!
65$ ENDIF
66$!
67$! Check To Make Sure We Have Valid Command Line Parameters.
68$!
69$ GOSUB CHECK_OPTIONS
70$!
71$! Tell The User What Kind of Machine We Run On.
72$!
73$ WRITE SYS$OUTPUT "Compiling On A ",ARCH," Machine."
74$!
75$! Define The OBJ Directory Name.
76$!
77$ OBJ_DIR := SYS$DISK:[--.'ARCH'.OBJ.CRYPTO.DES]
78$!
79$! Check To See If The Architecture Specific OBJ Directory Exists.
80$!
81$ IF (F$PARSE(OBJ_DIR).EQS."")
82$ THEN
83$!
84$! It Dosen't Exist, So Create It.
85$!
86$ CREATE/DIR 'OBJ_DIR'
87$!
88$! End The Architecture Specific OBJ Directory Check.
89$!
90$ ENDIF
91$!
92$! Define The EXE Directory Name.
93$!
94$ EXE_DIR :== SYS$DISK:[--.'ARCH'.EXE.CRYPTO.DES]
95$!
96$! Check To See If The Architecture Specific Directory Exists.
97$!
98$ IF (F$PARSE(EXE_DIR).EQS."")
99$ THEN
100$!
101$! It Dosen't Exist, So Create It.
102$!
103$ CREATE/DIR 'EXE_DIR'
104$!
105$! End The Architecture Specific Directory Check.
106$!
107$ ENDIF
108$!
109$! Define The Library Name.
110$!
111$ LIB_NAME := 'EXE_DIR'LIBDES.OLB
112$!
113$! Check To See What We Are To Do.
114$!
115$ IF (BUILDALL.EQS."TRUE")
116$ THEN
117$!
118$! Since Nothing Special Was Specified, Do Everything.
119$!
120$ GOSUB LIBRARY
121$ GOSUB DESTEST
122$ GOSUB SPEED
123$ GOSUB RPW
124$ GOSUB DES
125$ GOSUB DES_OPTS
126$!
127$! Else...
128$!
129$ ELSE
130$!
131$! Build Just What The User Wants Us To Build.
132$!
133$ GOSUB 'BUILDALL'
134$!
135$! End The BUILDALL Check.
136$!
137$ ENDIF
138$!
139$! Time To EXIT.
140$!
141$ EXIT
142$ LIBRARY:
143$!
144$! Tell The User That We Are Compiling.
145$!
146$ WRITE SYS$OUTPUT "Compiling The ",LIB_NAME," Files."
147$!
148$! Check To See If We Already Have A "[.xxx.EXE.CRYPTO.DES]LIBDES.OLB" Library...
149$!
150$ IF (F$SEARCH(LIB_NAME).EQS."")
151$ THEN
152$!
153$! Guess Not, Create The Library.
154$!
155$ LIBRARY/CREATE/OBJECT 'LIB_NAME'
156$!
157$! End The Library Exist Check.
158$!
159$ ENDIF
160$!
161$! Define The DES Library Files.
162$!
163$ LIB_DES = "set_key,ecb_enc,cbc_enc,"+ -
164 "ecb3_enc,cfb64enc,cfb64ede,cfb_enc,ofb64ede,"+ -
165 "enc_read,enc_writ,ofb64enc,"+ -
166 "ofb_enc,str2key,pcbc_enc,qud_cksm,rand_key,"+ -
167 "des_enc,fcrypt_b,read2pwd,"+ -
168 "fcrypt,xcbc_enc,read_pwd,rpc_enc,cbc_cksm,supp"
169$!
170$! Define A File Counter And Set It To "0".
171$!
172$ FILE_COUNTER = 0
173$!
174$! Top Of The File Loop.
175$!
176$ NEXT_FILE:
177$!
178$! O.K, Extract The File Name From The File List.
179$!
180$ FILE_NAME = F$ELEMENT(FILE_COUNTER,",",LIB_DES)
181$!
182$! Check To See If We Are At The End Of The File List.
183$!
184$ IF (FILE_NAME.EQS.",") THEN GOTO FILE_DONE
185$!
186$! Increment The Counter.
187$!
188$ FILE_COUNTER = FILE_COUNTER + 1
189$!
190$! Create The Source File Name.
191$!
192$ SOURCE_FILE = "SYS$DISK:[]" + FILE_NAME + ".C"
193$!
194$! Tell The User We Are Compiling The Source File.
195$!
196$ WRITE SYS$OUTPUT " ",FILE_NAME,".C"
197$!
198$! Create The Object File Name.
199$!
200$ OBJECT_FILE = OBJ_DIR + FILE_NAME + "." + ARCH + "OBJ"
201$ ON WARNING THEN GOTO NEXT_FILE
202$!
203$! Check To See If The File We Want To Compile Actually Exists.
204$!
205$ IF (F$SEARCH(SOURCE_FILE).EQS."")
206$ THEN
207$!
208$! Tell The User That The File Dosen't Exist.
209$!
210$ WRITE SYS$OUTPUT ""
211$ WRITE SYS$OUTPUT "The File ",SOURCE_FILE," Dosen't Exist."
212$ WRITE SYS$OUTPUT ""
213$!
214$! Exit The Build.
215$!
216$ EXIT
217$!
218$! End The File Exists Check.
219$!
220$ ENDIF
221$!
222$! Compile The File.
223$!
224$ ON ERROR THEN GOTO NEXT_FILE
225$ CC/OBJECT='OBJECT_FILE' 'SOURCE_FILE'
226$!
227$! Add It To The Library.
228$!
229$ LIBRARY/REPLACE/OBJECT 'LIB_NAME' 'OBJECT_FILE'
230$!
231$! Time To Clean Up The Object File.
232$!
233$ DELETE 'OBJECT_FILE';*
234$!
235$! Go Back And Do It Again.
236$!
237$ GOTO NEXT_FILE
238$!
239$! All Done With This Library Part.
240$!
241$ FILE_DONE:
242$!
243$! Tell The User That We Are All Done.
244$!
245$ WRITE SYS$OUTPUT "Library ",LIB_NAME," Built."
246$!
247$! All Done, Time To Return.
248$!
249$ RETURN
250$!
251$! Compile The DESTEST Program.
252$!
253$ DESTEST:
254$!
255$! Check To See If We Have The Proper Libraries.
256$!
257$ GOSUB LIB_CHECK
258$!
259$! Check To See If We Have A Linker Option File.
260$!
261$ GOSUB CHECK_OPT_FILE
262$!
263$! Check To See If The File We Want To Compile Actually Exists.
264$!
265$ IF (F$SEARCH("SYS$DISK:[]DESTEST.C").EQS."")
266$ THEN
267$!
268$! Tell The User That The File Dosen't Exist.
269$!
270$ WRITE SYS$OUTPUT ""
271$ WRITE SYS$OUTPUT "The File DESTEST.C Dosen't Exist."
272$ WRITE SYS$OUTPUT ""
273$!
274$! Exit The Build.
275$!
276$ EXIT
277$!
278$! End The DESTEST.C File Check.
279$!
280$ ENDIF
281$!
282$! Tell The User What We Are Building.
283$!
284$ WRITE SYS$OUTPUT "Building ",EXE_DIR,"DESTEST.EXE"
285$!
286$! Compile The DESTEST Program.
287$!
288$ CC/OBJECT='OBJ_DIR'DESTEST.OBJ SYS$DISK:[]DESTEST.C
289$!
290$! Link The DESTEST Program.
291$!
292$ LINK/'DEBUGGER'/'TRACEBACK'/CONTIGUOUS/EXE='EXE_DIR'DESTEST.EXE -
293 'OBJ_DIR'DESTEST.OBJ,'LIB_NAME'/LIBRARY,'OPT_FILE'/OPTION
294$!
295$! All Done, Time To Return.
296$!
297$ RETURN
298$!
299$! Compile The SPEED Program.
300$!
301$ SPEED:
302$!
303$! Check To See If We Have The Proper Libraries.
304$!
305$ GOSUB LIB_CHECK
306$!
307$! Check To See If We Have A Linker Option File.
308$!
309$ GOSUB CHECK_OPT_FILE
310$!
311$! Check To See If The File We Want To Compile Actually Exists.
312$!
313$ IF (F$SEARCH("SYS$DISK:[]SPEED.C").EQS."")
314$ THEN
315$!
316$! Tell The User That The File Dosen't Exist.
317$!
318$ WRITE SYS$OUTPUT ""
319$ WRITE SYS$OUTPUT "The File SPEED.C Dosen't Exist."
320$ WRITE SYS$OUTPUT ""
321$!
322$! Exit The Build.
323$!
324$ EXIT
325$!
326$! End The SPEED.C File Check.
327$!
328$ ENDIF
329$!
330$! Tell The User What We Are Building.
331$!
332$ WRITE SYS$OUTPUT "Building ",EXE_DIR,"SPEED.EXE"
333$!
334$! Compile The SPEED Program.
335$!
336$ CC/OBJECT='OBJ_DIR'SPEED.OBJ SYS$DISK:[]SPEED.C
337$!
338$! Link The SPEED Program.
339$!
340$ LINK/'DEBUGGER'/'TRACEBACK'/CONTIGUOUS/EXE='EXE_DIR'SPEED.EXE -
341 'OBJ_DIR'SPEED.OBJ,'LIB_NAME'/LIBRARY,'OPT_FILE'/OPTION
342$!
343$! All Done, Time To Return.
344$!
345$ RETURN
346$!
347$! Compile The RPW Program.
348$!
349$ RPW:
350$!
351$! Check To See If We Have The Proper Libraries.
352$!
353$ GOSUB LIB_CHECK
354$!
355$! Check To See If We Have A Linker Option File.
356$!
357$ GOSUB CHECK_OPT_FILE
358$!
359$! Check To See If The File We Want To Compile Actually Exists.
360$!
361$ IF (F$SEARCH("SYS$DISK:[]RPW.C").EQS."")
362$ THEN
363$!
364$! Tell The User That The File Dosen't Exist.
365$!
366$ WRITE SYS$OUTPUT ""
367$ WRITE SYS$OUTPUT "The File RPW.C Dosen't Exist."
368$ WRITE SYS$OUTPUT ""
369$!
370$! Exit The Build.
371$!
372$ EXIT
373$!
374$! End The RPW.C File Check.
375$!
376$ ENDIF
377$!
378$! Tell The User What We Are Building.
379$!
380$ WRITE SYS$OUTPUT "Building ",EXE_DIR,"RPW.EXE"
381$!
382$! Compile The RPW Program.
383$!
384$ CC/OBJECT='OBJ_DIR'RPW.OBJ SYS$DISK:[]RPW.C
385$!
386$! Link The RPW Program.
387$!
388$ LINK/'DEBUGGER'/'TRACEBACK'/CONTIGUOUS/EXE='EXE_DIR'RPW.EXE -
389 'OBJ_DIR'RPW.OBJ,'LIB_NAME'/LIBRARY,'OPT_FILE'/OPTION
390$!
391$! All Done, Time To Return.
392$!
393$ RETURN
394$!
395$! Compile The DES Program.
396$!
397$ DES:
398$!
399$! Check To See If We Have The Proper Libraries.
400$!
401$ GOSUB LIB_CHECK
402$!
403$! Check To See If We Have A Linker Option File.
404$!
405$ GOSUB CHECK_OPT_FILE
406$!
407$! Check To See If The File We Want To Compile Actually Exists.
408$!
409$ IF (F$SEARCH("SYS$DISK:[]DES.C").EQS."")
410$ THEN
411$!
412$! Tell The User That The File Dosen't Exist.
413$!
414$ WRITE SYS$OUTPUT ""
415$ WRITE SYS$OUTPUT "The File DES.C Dosen't Exist."
416$ WRITE SYS$OUTPUT ""
417$!
418$! Exit The Build.
419$!
420$ EXIT
421$!
422$! End The DES.C File Check.
423$!
424$ ENDIF
425$!
426$! Tell The User What We Are Building.
427$!
428$ WRITE SYS$OUTPUT "Building ",EXE_DIR,"DES.EXE"
429$!
430$! Compile The DES Program.
431$!
432$ CC/OBJECT='OBJ_DIR'DES.OBJ SYS$DISK:[]DES.C
433$ CC/OBJECT='OBJ_DIR'DES.OBJ SYS$DISK:[]CBC3_ENC.C
434$!
435$! Link The DES Program.
436$!
437$ LINK/'DEBUGGER'/'TRACEBACK'/CONTIGUOUS/EXE='EXE_DIR'DES.EXE -
438 'OBJ_DIR'DES.OBJ,'OBJ_DIR'CBC3_ENC.OBJ,-
439 'LIB_NAME'/LIBRARY,'OPT_FILE'/OPTION
440$!
441$! All Done, Time To Return.
442$!
443$ RETURN
444$!
445$! Compile The DES_OPTS Program.
446$!
447$ DES_OPTS:
448$!
449$! Check To See If We Have The Proper Libraries.
450$!
451$ GOSUB LIB_CHECK
452$!
453$! Check To See If We Have A Linker Option File.
454$!
455$ GOSUB CHECK_OPT_FILE
456$!
457$! Check To See If The File We Want To Compile Actually Exists.
458$!
459$ IF (F$SEARCH("SYS$DISK:[]DES_OPTS.C").EQS."")
460$ THEN
461$!
462$! Tell The User That The File Dosen't Exist.
463$!
464$ WRITE SYS$OUTPUT ""
465$ WRITE SYS$OUTPUT "The File DES_OPTS.C Dosen't Exist."
466$ WRITE SYS$OUTPUT ""
467$!
468$! Exit The Build.
469$!
470$ EXIT
471$!
472$! End The DES_OPTS.C File Check.
473$!
474$ ENDIF
475$!
476$! Tell The User What We Are Building.
477$!
478$ WRITE SYS$OUTPUT "Building ",EXE_DIR,"DES_OPTS.EXE"
479$!
480$! Compile The DES_OPTS Program.
481$!
482$ CC/OBJECT='OBJ_DIR'DES_OPTS.OBJ SYS$DISK:[]DES_OPTS.C
483$!
484$! Link The DES_OPTS Program.
485$!
486$ LINK/'DEBUGGER'/'TRACEBACK'/CONTIGUOUS/EXE='EXE_DIR'DES_OPTS.EXE -
487 'OBJ_DIR'DES_OPTS.OBJ,'LIB_NAME'/LIBRARY,'OPT_FILE'/OPTION
488$!
489$! All Done, Time To Return.
490$!
491$ RETURN
492$ EXIT
493$!
494$! Check For The Link Option FIle.
495$!
496$ CHECK_OPT_FILE:
497$!
498$! Check To See If We Need To Make A VAX C Option File.
499$!
500$ IF (COMPILER.EQS."VAXC")
501$ THEN
502$!
503$! Check To See If We Already Have A VAX C Linker Option File.
504$!
505$ IF (F$SEARCH(OPT_FILE).EQS."")
506$ THEN
507$!
508$! We Need A VAX C Linker Option File.
509$!
510$ CREATE 'OPT_FILE'
511$DECK
512!
513! Default System Options File To Link Agianst
514! The Sharable VAX C Runtime Library.
515!
516SYS$SHARE:VAXCRTL.EXE/SHARE
517$EOD
518$!
519$! End The Option File Check.
520$!
521$ ENDIF
522$!
523$! End The VAXC Check.
524$!
525$ ENDIF
526$!
527$! Check To See If We Need A GNU C Option File.
528$!
529$ IF (COMPILER.EQS."GNUC")
530$ THEN
531$!
532$! Check To See If We Already Have A GNU C Linker Option File.
533$!
534$ IF (F$SEARCH(OPT_FILE).EQS."")
535$ THEN
536$!
537$! We Need A GNU C Linker Option File.
538$!
539$ CREATE 'OPT_FILE'
540$DECK
541!
542! Default System Options File To Link Agianst
543! The Sharable C Runtime Library.
544!
545GNU_CC:[000000]GCCLIB/LIBRARY
546SYS$SHARE:VAXCRTL/SHARE
547$EOD
548$!
549$! End The Option File Check.
550$!
551$ ENDIF
552$!
553$! End The GNU C Check.
554$!
555$ ENDIF
556$!
557$! Check To See If We Need A DEC C Option File.
558$!
559$ IF (COMPILER.EQS."DECC")
560$ THEN
561$!
562$! Check To See If We Already Have A DEC C Linker Option File.
563$!
564$ IF (F$SEARCH(OPT_FILE).EQS."")
565$ THEN
566$!
567$! Figure Out If We Need An AXP Or A VAX Linker Option File.
568$!
569$ IF (F$GETSYI("CPU").LT.128)
570$ THEN
571$!
572$! We Need A DEC C Linker Option File For VAX.
573$!
574$ CREATE 'OPT_FILE'
575$DECK
576!
577! Default System Options File To Link Agianst
578! The Sharable DEC C Runtime Library.
579!
580SYS$SHARE:DECC$SHR.EXE/SHARE
581$EOD
582$!
583$! Else...
584$!
585$ ELSE
586$!
587$! Create The AXP Linker Option File.
588$!
589$ CREATE 'OPT_FILE'
590$DECK
591!
592! Default System Options File For AXP To Link Agianst
593! The Sharable C Runtime Library.
594!
595SYS$SHARE:CMA$OPEN_LIB_SHR/SHARE
596SYS$SHARE:CMA$OPEN_RTL/SHARE
597$EOD
598$!
599$! End The VAX/AXP DEC C Option File Check.
600$!
601$ ENDIF
602$!
603$! End The Option File Search.
604$!
605$ ENDIF
606$!
607$! End The DEC C Check.
608$!
609$ ENDIF
610$!
611$! Tell The User What Linker Option File We Are Using.
612$!
613$ WRITE SYS$OUTPUT "Using Linker Option File ",OPT_FILE,"."
614$!
615$! Time To RETURN.
616$!
617$ RETURN
618$!
619$! Library Check.
620$!
621$ LIB_CHECK:
622$!
623$! Look For The Library LIBDES.OLB.
624$!
625$ IF (F$SEARCH(LIB_NAME).EQS."")
626$ THEN
627$!
628$! Tell The User We Can't Find The [.xxx.CRYPTO.DES]LIBDES.OLB Library.
629$!
630$ WRITE SYS$OUTPUT ""
631$ WRITE SYS$OUTPUT "Can't Find The Library ",LIB_NAME,"."
632$ WRITE SYS$OUTPUT "We Can't Link Without It."
633$ WRITE SYS$OUTPUT ""
634$!
635$! Since We Can't Link Without It, Exit.
636$!
637$ EXIT
638$ ENDIF
639$!
640$! Time To Return.
641$!
642$ RETURN
643$!
644$! Check The User's Options.
645$!
646$ CHECK_OPTIONS:
647$!
648$! Check To See If We Are To "Just Build Everything".
649$!
650$ IF (P1.EQS."ALL")
651$ THEN
652$!
653$! P1 Is "ALL", So Build Everything.
654$!
655$ BUILDALL = "TRUE"
656$!
657$! Else...
658$!
659$ ELSE
660$!
661$! Else, Check To See If P1 Has A Valid Arguement.
662$!
663$ IF (P1.EQS."LIBRARY").OR.(P1.EQS."DESTEST").OR.(P1.EQS."SPEED") -
664 .OR.(P1.EQS."RPW").OR.(P1.EQS."DES").OR.(P1.EQS."DES_OPTS")
665$ THEN
666$!
667$! A Valid Arguement.
668$!
669$ BUILDALL = P1
670$!
671$! Else...
672$!
673$ ELSE
674$!
675$! Tell The User We Don't Know What They Want.
676$!
677$ WRITE SYS$OUTPUT ""
678$ WRITE SYS$OUTPUT "The Option ",P1," Is Invalid. The Valid Options Are:"
679$ WRITE SYS$OUTPUT ""
680$ WRITE SYS$OUTPUT " ALL : Just Build Everything.
681$ WRITE SYS$OUTPUT " LIBRARY : To Compile Just The [.xxx.EXE.CRYPTO.DES]LIBDES.OLB Library."
682$ WRITE SYS$OUTPUT " DESTEST : To Compile Just The [.xxx.EXE.CRYPTO.DES]DESTEST.EXE Program."
683$ WRITE SYS$OUTPUT " SPEED : To Compile Just The [.xxx.EXE.CRYPTO.DES]SPEED.EXE Program."
684$ WRITE SYS$OUTPUT " RPW : To Compile Just The [.xxx.EXE.CRYPTO.DES]RPW.EXE Program."
685$ WRITE SYS$OUTPUT " DES : To Compile Just The [.xxx.EXE.CRYPTO.DES]DES.EXE Program."
686$ WRITE SYS$OUTPUT " DES_OPTS : To Compile Just The [.xxx.EXE.CRYTPO.DES]DES_OPTS.EXE Program."
687$ WRITE SYS$OUTPUT ""
688$ WRITE SYS$OUTPUT " Where 'xxx' Stands For: "
689$ WRITE SYS$OUTPUT ""
690$ WRITE SYS$OUTPUT " AXP : Alpha Architecture."
691$ WRITE SYS$OUTPUT " VAX : VAX Architecture."
692$ WRITE SYS$OUTPUT ""
693$!
694$! Time To EXIT.
695$!
696$ EXIT
697$!
698$! End The Valid Arguement Check.
699$!
700$ ENDIF
701$!
702$! End The P1 Check.
703$!
704$ ENDIF
705$!
706$! Check To See If We Are To Compile Without Debugger Information.
707$!
708$ IF (P2.EQS."NODEBUG")
709$ THEN
710$!
711$! P2 Is Blank, So Compile Without Debugger Information.
712$!
713$ DEBUGGER = "NODEBUG"
714$ TRACEBACK = "NOTRACEBACK"
715$ GCC_OPTIMIZE = "OPTIMIZE"
716$ CC_OPTIMIZE = "OPTIMIZE"
717$ WRITE SYS$OUTPUT "No Debugger Information Will Be Produced During Compile."
718$ WRITE SYS$OUTPUT "Compiling With Compiler Optimization."
719$!
720$! Else...
721$!
722$ ELSE
723$!
724$! Check To See If We Are To Compile With Debugger Information.
725$!
726$ IF (P2.EQS."DEBUG")
727$ THEN
728$!
729$! Compile With Debugger Information.
730$!
731$ DEBUGGER = "DEBUG"
732$ TRACEBACK = "TRACEBACK"
733$ GCC_OPTIMIZE = "NOOPTIMIZE"
734$ CC_OPTIMIZE = "NOOPTIMIZE"
735$ WRITE SYS$OUTPUT "Debugger Information Will Be Produced During Compile."
736$ WRITE SYS$OUTPUT "Compiling Without Compiler Optimization."
737$!
738$! Else...
739$!
740$ ELSE
741$!
742$! Tell The User Entered An Invalid Option..
743$!
744$ WRITE SYS$OUTPUT ""
745$ WRITE SYS$OUTPUT "The Option ",P2," Is Invalid. The Valid Options Are:"
746$ WRITE SYS$OUTPUT ""
747$ WRITE SYS$OUTPUT " DEBUG : Compile With The Debugger Information."
748$ WRITE SYS$OUTPUT " NODEBUG : Compile Without The Debugger Information."
749$ WRITE SYS$OUTPUT ""
750$!
751$! Time To EXIT.
752$!
753$ EXIT
754$!
755$! End The Valid Arguement Check.
756$!
757$ ENDIF
758$!
759$! End The P2 Check.
760$!
761$ ENDIF
762$!
763$! Special Threads For OpenVMS v7.1 Or Later.
764$!
765$! Written By: Richard Levitte
766$! richard@levitte.org
767$!
768$!
769$! Check To See If We Have A Option For P4.
770$!
771$ IF (P4.EQS."")
772$ THEN
773$!
774$! Get The Version Of VMS We Are Using.
775$!
776$ ISSEVEN := ""
777$ TMP = F$ELEMENT(0,"-",F$EXTRACT(1,4,F$GETSYI("VERSION")))
778$ TMP = F$INTEGER(F$ELEMENT(0,".",TMP)+F$ELEMENT(1,".",TMP))
779$!
780$! Check To See If The VMS Version Is v7.1 Or Later.
781$!
782$ IF (TMP.GE.71)
783$ THEN
784$!
785$! We Have OpenVMS v7.1 Or Later, So Use The Special Threads.
786$!
787$ ISSEVEN := ,PTHREAD_USE_D4
788$!
789$! End The VMS Version Check.
790$!
791$ ENDIF
792$!
793$! End The P4 Check.
794$!
795$ ENDIF
796$!
797$! Check To See If P3 Is Blank.
798$!
799$ IF (P3.EQS."")
800$ THEN
801$!
802$! O.K., The User Didn't Specify A Compiler, Let's Try To
803$! Find Out Which One To Use.
804$!
805$! Check To See If We Have GNU C.
806$!
807$ IF (F$TRNLNM("GNU_CC").NES."")
808$ THEN
809$!
810$! Looks Like GNUC, Set To Use GNUC.
811$!
812$ P3 = "GNUC"
813$!
814$! Else...
815$!
816$ ELSE
817$!
818$! Check To See If We Have VAXC Or DECC.
819$!
820$ IF (ARCH.EQS."AXP").OR.(F$TRNLNM("DECC$CC_DEFAULT").NES."")
821$ THEN
822$!
823$! Looks Like DECC, Set To Use DECC.
824$!
825$ P3 = "DECC"
826$!
827$! Else...
828$!
829$ ELSE
830$!
831$! Looks Like VAXC, Set To Use VAXC.
832$!
833$ P3 = "VAXC"
834$!
835$! End The VAXC Compiler Check.
836$!
837$ ENDIF
838$!
839$! End The DECC & VAXC Compiler Check.
840$!
841$ ENDIF
842$!
843$! End The Compiler Check.
844$!
845$ ENDIF
846$!
847$! Set Up Initial CC Definitions, Possibly With User Ones
848$!
849$ CCDEFS = ""
850$ IF F$TYPE(USER_CCDEFS) .NES. "" THEN CCDEFS = USER_CCDEFS
851$ CCEXTRAFLAGS = ""
852$ IF F$TYPE(USER_CCFLAGS) .NES. "" THEN CCEXTRAFLAGS = USER_CCFLAGS
853$ CCDISABLEWARNINGS = ""
854$ IF F$TYPE(USER_CCDISABLEWARNINGS) .NES. "" THEN -
855 CCDISABLEWARNINGS = USER_CCDISABLEWARNINGS
856$!
857$! Check To See If The User Entered A Valid Paramter.
858$!
859$ IF (P3.EQS."VAXC").OR.(P3.EQS."DECC").OR.(P3.EQS."GNUC")
860$ THEN
861$!
862$! Check To See If The User Wanted DECC.
863$!
864$ IF (P3.EQS."DECC")
865$ THEN
866$!
867$! Looks Like DECC, Set To Use DECC.
868$!
869$ COMPILER = "DECC"
870$!
871$! Tell The User We Are Using DECC.
872$!
873$ WRITE SYS$OUTPUT "Using DECC 'C' Compiler."
874$!
875$! Use DECC...
876$!
877$ CC = "CC"
878$ IF ARCH.EQS."VAX" .AND. F$TRNLNM("DECC$CC_DEFAULT").NES."/DECC" -
879 THEN CC = "CC/DECC"
880$ CC = CC + "/''CC_OPTIMIZE'/''DEBUGGER'/STANDARD=ANSI89" + -
881 "/NOLIST/PREFIX=ALL" + CCEXTRAFLAGS
882$!
883$! Define The Linker Options File Name.
884$!
885$ OPT_FILE = "SYS$DISK:[]VAX_DECC_OPTIONS.OPT"
886$!
887$! End DECC Check.
888$!
889$ ENDIF
890$!
891$! Check To See If We Are To Use VAXC.
892$!
893$ IF (P3.EQS."VAXC")
894$ THEN
895$!
896$! Looks Like VAXC, Set To Use VAXC.
897$!
898$ COMPILER = "VAXC"
899$!
900$! Tell The User We Are Using VAX C.
901$!
902$ WRITE SYS$OUTPUT "Using VAXC 'C' Compiler."
903$!
904$! Compile Using VAXC.
905$!
906$ CC = "CC"
907$ IF ARCH.EQS."AXP"
908$ THEN
909$ WRITE SYS$OUTPUT "There is no VAX C on Alpha!"
910$ EXIT
911$ ENDIF
912$ IF F$TRNLNM("DECC$CC_DEFAULT").EQS."/DECC" THEN CC = "CC/VAXC"
913$ CC = CC + "/''CC_OPTIMIZE'/''DEBUGGER'/NOLIST" + CCEXTRAFLAGS
914$ CCDEFS = """VAXC""," + CCDEFS
915$!
916$! Define <sys> As SYS$COMMON:[SYSLIB]
917$!
918$ DEFINE/NOLOG SYS SYS$COMMON:[SYSLIB]
919$!
920$! Define The Linker Options File Name.
921$!
922$ OPT_FILE = "SYS$DISK:[]VAX_VAXC_OPTIONS.OPT"
923$!
924$! End VAXC Check
925$!
926$ ENDIF
927$!
928$! Check To See If We Are To Use GNU C.
929$!
930$ IF (P3.EQS."GNUC")
931$ THEN
932$!
933$! Looks Like GNUC, Set To Use GNUC.
934$!
935$ COMPILER = "GNUC"
936$!
937$! Tell The User We Are Using GNUC.
938$!
939$ WRITE SYS$OUTPUT "Using GNU 'C' Compiler."
940$!
941$! Use GNU C...
942$!
943$ CC = "GCC/NOCASE_HACK/''GCC_OPTIMIZE'/''DEBUGGER'/NOLIST" + CCEXTRAFLAGS
944$!
945$! Define The Linker Options File Name.
946$!
947$ OPT_FILE = "SYS$DISK:[]VAX_GNUC_OPTIONS.OPT"
948$!
949$! End The GNU C Check.
950$!
951$ ENDIF
952$!
953$! Set up default defines
954$!
955$ CCDEFS = """FLAT_INC=1""," + CCDEFS
956$!
957$! Finish up the definition of CC.
958$!
959$ IF COMPILER .EQS. "DECC"
960$ THEN
961$ IF CCDISABLEWARNINGS .EQS. ""
962$ THEN
963$ CC4DISABLEWARNINGS = "DOLLARID"
964$ ELSE
965$ CC4DISABLEWARNINGS = CCDISABLEWARNINGS + ",DOLLARID"
966$ CCDISABLEWARNINGS = "/WARNING=(DISABLE=(" + CCDISABLEWARNINGS + "))"
967$ ENDIF
968$ CC4DISABLEWARNINGS = "/WARNING=(DISABLE=(" + CC4DISABLEWARNINGS + "))"
969$ ELSE
970$ CCDISABLEWARNINGS = ""
971$ CC4DISABLEWARNINGS = ""
972$ ENDIF
973$ CC = CC + "/DEFINE=(" + CCDEFS + ")" + CCDISABLEWARNINGS
974$!
975$! Show user the result
976$!
977$ WRITE SYS$OUTPUT "Main Compiling Command: ",CC
978$!
979$! Else The User Entered An Invalid Arguement.
980$!
981$ ELSE
982$!
983$! Tell The User We Don't Know What They Want.
984$!
985$ WRITE SYS$OUTPUT ""
986$ WRITE SYS$OUTPUT "The Option ",P3," Is Invalid. The Valid Options Are:"
987$ WRITE SYS$OUTPUT ""
988$ WRITE SYS$OUTPUT " VAXC : To Compile With VAX C."
989$ WRITE SYS$OUTPUT " DECC : To Compile With DEC C."
990$ WRITE SYS$OUTPUT " GNUC : To Compile With GNU C."
991$ WRITE SYS$OUTPUT ""
992$!
993$! Time To EXIT.
994$!
995$ EXIT
996$!
997$! End The P3 Check.
998$!
999$ ENDIF
1000$!
1001$! Time To RETURN...
1002$!
1003$ 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 c5df1c9c7b..81bd874edd 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#ifdef OPENSSL_NO_DES 62#ifdef OPENSSL_NO_DES
63#error DES is disabled. 63#error DES is disabled.
@@ -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 72be2d98d7..6a49ec4a55 100644
--- a/src/lib/libcrypto/des/des_enc.c
+++ b/src/lib/libcrypto/des/des_enc.c
@@ -59,6 +59,7 @@
59#include "des_locl.h" 59#include "des_locl.h"
60 60
61#ifndef OPENSSL_FIPS 61#ifndef OPENSSL_FIPS
62#ifndef OPENBSD_DES_ASM
62 63
63void DES_encrypt1(DES_LONG *data, DES_key_schedule *ks, int enc) 64void DES_encrypt1(DES_LONG *data, DES_key_schedule *ks, int enc)
64 { 65 {
@@ -248,6 +249,7 @@ void DES_encrypt2(DES_LONG *data, DES_key_schedule *ks, int enc)
248 data[1]=ROTATE(r,3)&0xffffffffL; 249 data[1]=ROTATE(r,3)&0xffffffffL;
249 l=r=t=u=0; 250 l=r=t=u=0;
250 } 251 }
252#endif
251 253
252void DES_encrypt3(DES_LONG *data, DES_key_schedule *ks1, 254void DES_encrypt3(DES_LONG *data, DES_key_schedule *ks1,
253 DES_key_schedule *ks2, DES_key_schedule *ks3) 255 DES_key_schedule *ks2, DES_key_schedule *ks3)
diff --git a/src/lib/libcrypto/des/des_locl.h b/src/lib/libcrypto/des/des_locl.h
index 8f04b18c50..e44e8e98b2 100644
--- a/src/lib/libcrypto/des/des_locl.h
+++ b/src/lib/libcrypto/des/des_locl.h
@@ -421,7 +421,7 @@
421 PERM_OP(l,r,tt, 4,0x0f0f0f0fL); \ 421 PERM_OP(l,r,tt, 4,0x0f0f0f0fL); \
422 } 422 }
423 423
424extern const DES_LONG DES_SPtrans[8][64]; 424OPENSSL_EXTERN const DES_LONG DES_SPtrans[8][64];
425 425
426void fcrypt_body(DES_LONG *out,DES_key_schedule *ks, 426void fcrypt_body(DES_LONG *out,DES_key_schedule *ks,
427 DES_LONG Eswap0, DES_LONG Eswap1); 427 DES_LONG Eswap0, DES_LONG Eswap1);
diff --git a/src/lib/libcrypto/des/des_old.c b/src/lib/libcrypto/des/des_old.c
new file mode 100644
index 0000000000..88e9802aad
--- /dev/null
+++ b/src/lib/libcrypto/des/des_old.c
@@ -0,0 +1,271 @@
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 unsigned char *)input, (unsigned char *)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
172void _ossl_old_des_xwhite_in2out(_ossl_old_des_cblock (*des_key), _ossl_old_des_cblock (*in_white),
173 _ossl_old_des_cblock (*out_white))
174 {
175 DES_xwhite_in2out(des_key, in_white, out_white);
176 }
177
178int _ossl_old_des_enc_read(int fd,char *buf,int len,des_key_schedule sched,
179 _ossl_old_des_cblock *iv)
180 {
181 return DES_enc_read(fd, buf, len, (DES_key_schedule *)sched, iv);
182 }
183int _ossl_old_des_enc_write(int fd,char *buf,int len,des_key_schedule sched,
184 _ossl_old_des_cblock *iv)
185 {
186 return DES_enc_write(fd, buf, len, (DES_key_schedule *)sched, iv);
187 }
188char *_ossl_old_des_fcrypt(const char *buf,const char *salt, char *ret)
189 {
190 return DES_fcrypt(buf, salt, ret);
191 }
192char *_ossl_old_des_crypt(const char *buf,const char *salt)
193 {
194 return DES_crypt(buf, salt);
195 }
196char *_ossl_old_crypt(const char *buf,const char *salt)
197 {
198 return DES_crypt(buf, salt);
199 }
200void _ossl_old_des_ofb_encrypt(unsigned char *in,unsigned char *out,
201 int numbits,long length,des_key_schedule schedule,_ossl_old_des_cblock *ivec)
202 {
203 DES_ofb_encrypt(in, out, numbits, length, (DES_key_schedule *)schedule,
204 ivec);
205 }
206void _ossl_old_des_pcbc_encrypt(_ossl_old_des_cblock *input,_ossl_old_des_cblock *output,long length,
207 des_key_schedule schedule,_ossl_old_des_cblock *ivec,int enc)
208 {
209 DES_pcbc_encrypt((unsigned char *)input, (unsigned char *)output,
210 length, (DES_key_schedule *)schedule, ivec, enc);
211 }
212DES_LONG _ossl_old_des_quad_cksum(_ossl_old_des_cblock *input,_ossl_old_des_cblock *output,
213 long length,int out_count,_ossl_old_des_cblock *seed)
214 {
215 return DES_quad_cksum((unsigned char *)input, output, length,
216 out_count, seed);
217 }
218void _ossl_old_des_random_seed(_ossl_old_des_cblock key)
219 {
220 RAND_seed(key, sizeof(_ossl_old_des_cblock));
221 }
222void _ossl_old_des_random_key(_ossl_old_des_cblock ret)
223 {
224 DES_random_key((DES_cblock *)ret);
225 }
226int _ossl_old_des_read_password(_ossl_old_des_cblock *key, const char *prompt,
227 int verify)
228 {
229 return DES_read_password(key, prompt, verify);
230 }
231int _ossl_old_des_read_2passwords(_ossl_old_des_cblock *key1, _ossl_old_des_cblock *key2,
232 const char *prompt, int verify)
233 {
234 return DES_read_2passwords(key1, key2, prompt, verify);
235 }
236void _ossl_old_des_set_odd_parity(_ossl_old_des_cblock *key)
237 {
238 DES_set_odd_parity(key);
239 }
240int _ossl_old_des_is_weak_key(_ossl_old_des_cblock *key)
241 {
242 return DES_is_weak_key(key);
243 }
244int _ossl_old_des_set_key(_ossl_old_des_cblock *key,des_key_schedule schedule)
245 {
246 return DES_set_key(key, (DES_key_schedule *)schedule);
247 }
248int _ossl_old_des_key_sched(_ossl_old_des_cblock *key,des_key_schedule schedule)
249 {
250 return DES_key_sched(key, (DES_key_schedule *)schedule);
251 }
252void _ossl_old_des_string_to_key(char *str,_ossl_old_des_cblock *key)
253 {
254 DES_string_to_key(str, key);
255 }
256void _ossl_old_des_string_to_2keys(char *str,_ossl_old_des_cblock *key1,_ossl_old_des_cblock *key2)
257 {
258 DES_string_to_2keys(str, key1, key2);
259 }
260void _ossl_old_des_cfb64_encrypt(unsigned char *in, unsigned char *out, long length,
261 des_key_schedule schedule, _ossl_old_des_cblock *ivec, int *num, int enc)
262 {
263 DES_cfb64_encrypt(in, out, length, (DES_key_schedule *)schedule,
264 ivec, num, enc);
265 }
266void _ossl_old_des_ofb64_encrypt(unsigned char *in, unsigned char *out, long length,
267 des_key_schedule schedule, _ossl_old_des_cblock *ivec, int *num)
268 {
269 DES_ofb64_encrypt(in, out, length, (DES_key_schedule *)schedule,
270 ivec, num);
271 }
diff --git a/src/lib/libcrypto/des/des_old.h b/src/lib/libcrypto/des/des_old.h
new file mode 100644
index 0000000000..1d8bf65101
--- /dev/null
+++ b/src/lib/libcrypto/des/des_old.h
@@ -0,0 +1,441 @@
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#ifdef OPENSSL_NO_DES
95#error DES is disabled.
96#endif
97
98#ifndef HEADER_DES_H
99#error You must include des.h, not des_old.h directly.
100#endif
101
102#ifdef _KERBEROS_DES_H
103#error <openssl/des_old.h> replaces <kerberos/des.h>.
104#endif
105
106#include <openssl/opensslconf.h> /* DES_LONG */
107#include <openssl/e_os2.h> /* OPENSSL_EXTERN */
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
119typedef unsigned char _ossl_old_des_cblock[8];
120typedef struct _ossl_old_des_ks_struct
121 {
122 union {
123 _ossl_old_des_cblock _;
124 /* make sure things are correct size on machines with
125 * 8 byte longs */
126 DES_LONG pad[2];
127 } ks;
128 } _ossl_old_des_key_schedule[16];
129
130#ifndef OPENSSL_DES_LIBDES_COMPATIBILITY
131#define des_cblock DES_cblock
132#define const_des_cblock const_DES_cblock
133#define des_key_schedule DES_key_schedule
134#define des_ecb3_encrypt(i,o,k1,k2,k3,e)\
135 DES_ecb3_encrypt((i),(o),&(k1),&(k2),&(k3),(e))
136#define des_ede3_cbc_encrypt(i,o,l,k1,k2,k3,iv,e)\
137 DES_ede3_cbc_encrypt((i),(o),(l),&(k1),&(k2),&(k3),(iv),(e))
138#define des_ede3_cbcm_encrypt(i,o,l,k1,k2,k3,iv1,iv2,e)\
139 DES_ede3_cbcm_encrypt((i),(o),(l),&(k1),&(k2),&(k3),(iv1),(iv2),(e))
140#define des_ede3_cfb64_encrypt(i,o,l,k1,k2,k3,iv,n,e)\
141 DES_ede3_cfb64_encrypt((i),(o),(l),&(k1),&(k2),&(k3),(iv),(n),(e))
142#define des_ede3_ofb64_encrypt(i,o,l,k1,k2,k3,iv,n)\
143 DES_ede3_ofb64_encrypt((i),(o),(l),&(k1),&(k2),&(k3),(iv),(n))
144#define des_options()\
145 DES_options()
146#define des_cbc_cksum(i,o,l,k,iv)\
147 DES_cbc_cksum((i),(o),(l),&(k),(iv))
148#define des_cbc_encrypt(i,o,l,k,iv,e)\
149 DES_cbc_encrypt((i),(o),(l),&(k),(iv),(e))
150#define des_ncbc_encrypt(i,o,l,k,iv,e)\
151 DES_ncbc_encrypt((i),(o),(l),&(k),(iv),(e))
152#define des_xcbc_encrypt(i,o,l,k,iv,inw,outw,e)\
153 DES_xcbc_encrypt((i),(o),(l),&(k),(iv),(inw),(outw),(e))
154#define des_cfb_encrypt(i,o,n,l,k,iv,e)\
155 DES_cfb_encrypt((i),(o),(n),(l),&(k),(iv),(e))
156#define des_ecb_encrypt(i,o,k,e)\
157 DES_ecb_encrypt((i),(o),&(k),(e))
158#define des_encrypt1(d,k,e)\
159 DES_encrypt1((d),&(k),(e))
160#define des_encrypt2(d,k,e)\
161 DES_encrypt2((d),&(k),(e))
162#define des_encrypt3(d,k1,k2,k3)\
163 DES_encrypt3((d),&(k1),&(k2),&(k3))
164#define des_decrypt3(d,k1,k2,k3)\
165 DES_decrypt3((d),&(k1),&(k2),&(k3))
166#define des_xwhite_in2out(k,i,o)\
167 DES_xwhite_in2out((k),(i),(o))
168#define des_enc_read(f,b,l,k,iv)\
169 DES_enc_read((f),(b),(l),&(k),(iv))
170#define des_enc_write(f,b,l,k,iv)\
171 DES_enc_write((f),(b),(l),&(k),(iv))
172#define des_fcrypt(b,s,r)\
173 DES_fcrypt((b),(s),(r))
174#define des_crypt(b,s)\
175 DES_crypt((b),(s))
176#if 0
177#if !defined(PERL5) && !defined(__FreeBSD__) && !defined(NeXT) && !defined(__OpenBSD__)
178#define crypt(b,s)\
179 DES_crypt((b),(s))
180#endif
181#endif
182#define des_ofb_encrypt(i,o,n,l,k,iv)\
183 DES_ofb_encrypt((i),(o),(n),(l),&(k),(iv))
184#define des_pcbc_encrypt(i,o,l,k,iv,e)\
185 DES_pcbc_encrypt((i),(o),(l),&(k),(iv),(e))
186#define des_quad_cksum(i,o,l,c,s)\
187 DES_quad_cksum((i),(o),(l),(c),(s))
188#define des_random_seed(k)\
189 _ossl_096_des_random_seed((k))
190#define des_random_key(r)\
191 DES_random_key((r))
192#define des_read_password(k,p,v) \
193 DES_read_password((k),(p),(v))
194#define des_read_2passwords(k1,k2,p,v) \
195 DES_read_2passwords((k1),(k2),(p),(v))
196#define des_set_odd_parity(k)\
197 DES_set_odd_parity((k))
198#define des_check_key_parity(k)\
199 DES_check_key_parity((k))
200#define des_is_weak_key(k)\
201 DES_is_weak_key((k))
202#define des_set_key(k,ks)\
203 DES_set_key((k),&(ks))
204#define des_key_sched(k,ks)\
205 DES_key_sched((k),&(ks))
206#define des_set_key_checked(k,ks)\
207 DES_set_key_checked((k),&(ks))
208#define des_set_key_unchecked(k,ks)\
209 DES_set_key_unchecked((k),&(ks))
210#define des_string_to_key(s,k)\
211 DES_string_to_key((s),(k))
212#define des_string_to_2keys(s,k1,k2)\
213 DES_string_to_2keys((s),(k1),(k2))
214#define des_cfb64_encrypt(i,o,l,ks,iv,n,e)\
215 DES_cfb64_encrypt((i),(o),(l),&(ks),(iv),(n),(e))
216#define des_ofb64_encrypt(i,o,l,ks,iv,n)\
217 DES_ofb64_encrypt((i),(o),(l),&(ks),(iv),(n))
218
219
220#define des_ecb2_encrypt(i,o,k1,k2,e) \
221 des_ecb3_encrypt((i),(o),(k1),(k2),(k1),(e))
222
223#define des_ede2_cbc_encrypt(i,o,l,k1,k2,iv,e) \
224 des_ede3_cbc_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(e))
225
226#define des_ede2_cfb64_encrypt(i,o,l,k1,k2,iv,n,e) \
227 des_ede3_cfb64_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(n),(e))
228
229#define des_ede2_ofb64_encrypt(i,o,l,k1,k2,iv,n) \
230 des_ede3_ofb64_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(n))
231
232#define des_check_key DES_check_key
233#define des_rw_mode DES_rw_mode
234#else /* libdes compatibility */
235/* Map all symbol names to _ossl_old_des_* form, so we avoid all
236 clashes with libdes */
237#define des_cblock _ossl_old_des_cblock
238#define des_key_schedule _ossl_old_des_key_schedule
239#define des_ecb3_encrypt(i,o,k1,k2,k3,e)\
240 _ossl_old_des_ecb3_encrypt((i),(o),(k1),(k2),(k3),(e))
241#define des_ede3_cbc_encrypt(i,o,l,k1,k2,k3,iv,e)\
242 _ossl_old_des_ede3_cbc_encrypt((i),(o),(l),(k1),(k2),(k3),(iv),(e))
243#define des_ede3_cfb64_encrypt(i,o,l,k1,k2,k3,iv,n,e)\
244 _ossl_old_des_ede3_cfb64_encrypt((i),(o),(l),(k1),(k2),(k3),(iv),(n),(e))
245#define des_ede3_ofb64_encrypt(i,o,l,k1,k2,k3,iv,n)\
246 _ossl_old_des_ede3_ofb64_encrypt((i),(o),(l),(k1),(k2),(k3),(iv),(n))
247#define des_options()\
248 _ossl_old_des_options()
249#define des_cbc_cksum(i,o,l,k,iv)\
250 _ossl_old_des_cbc_cksum((i),(o),(l),(k),(iv))
251#define des_cbc_encrypt(i,o,l,k,iv,e)\
252 _ossl_old_des_cbc_encrypt((i),(o),(l),(k),(iv),(e))
253#define des_ncbc_encrypt(i,o,l,k,iv,e)\
254 _ossl_old_des_ncbc_encrypt((i),(o),(l),(k),(iv),(e))
255#define des_xcbc_encrypt(i,o,l,k,iv,inw,outw,e)\
256 _ossl_old_des_xcbc_encrypt((i),(o),(l),(k),(iv),(inw),(outw),(e))
257#define des_cfb_encrypt(i,o,n,l,k,iv,e)\
258 _ossl_old_des_cfb_encrypt((i),(o),(n),(l),(k),(iv),(e))
259#define des_ecb_encrypt(i,o,k,e)\
260 _ossl_old_des_ecb_encrypt((i),(o),(k),(e))
261#define des_encrypt(d,k,e)\
262 _ossl_old_des_encrypt((d),(k),(e))
263#define des_encrypt2(d,k,e)\
264 _ossl_old_des_encrypt2((d),(k),(e))
265#define des_encrypt3(d,k1,k2,k3)\
266 _ossl_old_des_encrypt3((d),(k1),(k2),(k3))
267#define des_decrypt3(d,k1,k2,k3)\
268 _ossl_old_des_decrypt3((d),(k1),(k2),(k3))
269#define des_xwhite_in2out(k,i,o)\
270 _ossl_old_des_xwhite_in2out((k),(i),(o))
271#define des_enc_read(f,b,l,k,iv)\
272 _ossl_old_des_enc_read((f),(b),(l),(k),(iv))
273#define des_enc_write(f,b,l,k,iv)\
274 _ossl_old_des_enc_write((f),(b),(l),(k),(iv))
275#define des_fcrypt(b,s,r)\
276 _ossl_old_des_fcrypt((b),(s),(r))
277#define des_crypt(b,s)\
278 _ossl_old_des_crypt((b),(s))
279#if 0
280#define crypt(b,s)\
281 _ossl_old_crypt((b),(s))
282#endif
283#define des_ofb_encrypt(i,o,n,l,k,iv)\
284 _ossl_old_des_ofb_encrypt((i),(o),(n),(l),(k),(iv))
285#define des_pcbc_encrypt(i,o,l,k,iv,e)\
286 _ossl_old_des_pcbc_encrypt((i),(o),(l),(k),(iv),(e))
287#define des_quad_cksum(i,o,l,c,s)\
288 _ossl_old_des_quad_cksum((i),(o),(l),(c),(s))
289#define des_random_seed(k)\
290 _ossl_old_des_random_seed((k))
291#define des_random_key(r)\
292 _ossl_old_des_random_key((r))
293#define des_read_password(k,p,v) \
294 _ossl_old_des_read_password((k),(p),(v))
295#define des_read_2passwords(k1,k2,p,v) \
296 _ossl_old_des_read_2passwords((k1),(k2),(p),(v))
297#define des_set_odd_parity(k)\
298 _ossl_old_des_set_odd_parity((k))
299#define des_is_weak_key(k)\
300 _ossl_old_des_is_weak_key((k))
301#define des_set_key(k,ks)\
302 _ossl_old_des_set_key((k),(ks))
303#define des_key_sched(k,ks)\
304 _ossl_old_des_key_sched((k),(ks))
305#define des_string_to_key(s,k)\
306 _ossl_old_des_string_to_key((s),(k))
307#define des_string_to_2keys(s,k1,k2)\
308 _ossl_old_des_string_to_2keys((s),(k1),(k2))
309#define des_cfb64_encrypt(i,o,l,ks,iv,n,e)\
310 _ossl_old_des_cfb64_encrypt((i),(o),(l),(ks),(iv),(n),(e))
311#define des_ofb64_encrypt(i,o,l,ks,iv,n)\
312 _ossl_old_des_ofb64_encrypt((i),(o),(l),(ks),(iv),(n))
313
314
315#define des_ecb2_encrypt(i,o,k1,k2,e) \
316 des_ecb3_encrypt((i),(o),(k1),(k2),(k1),(e))
317
318#define des_ede2_cbc_encrypt(i,o,l,k1,k2,iv,e) \
319 des_ede3_cbc_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(e))
320
321#define des_ede2_cfb64_encrypt(i,o,l,k1,k2,iv,n,e) \
322 des_ede3_cfb64_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(n),(e))
323
324#define des_ede2_ofb64_encrypt(i,o,l,k1,k2,iv,n) \
325 des_ede3_ofb64_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(n))
326
327#define des_check_key DES_check_key
328#define des_rw_mode DES_rw_mode
329#endif
330
331const char *_ossl_old_des_options(void);
332void _ossl_old_des_ecb3_encrypt(_ossl_old_des_cblock *input,_ossl_old_des_cblock *output,
333 _ossl_old_des_key_schedule ks1,_ossl_old_des_key_schedule ks2,
334 _ossl_old_des_key_schedule ks3, int enc);
335DES_LONG _ossl_old_des_cbc_cksum(_ossl_old_des_cblock *input,_ossl_old_des_cblock *output,
336 long length,_ossl_old_des_key_schedule schedule,_ossl_old_des_cblock *ivec);
337void _ossl_old_des_cbc_encrypt(_ossl_old_des_cblock *input,_ossl_old_des_cblock *output,long length,
338 _ossl_old_des_key_schedule schedule,_ossl_old_des_cblock *ivec,int enc);
339void _ossl_old_des_ncbc_encrypt(_ossl_old_des_cblock *input,_ossl_old_des_cblock *output,long length,
340 _ossl_old_des_key_schedule schedule,_ossl_old_des_cblock *ivec,int enc);
341void _ossl_old_des_xcbc_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,
343 _ossl_old_des_cblock *inw,_ossl_old_des_cblock *outw,int enc);
344void _ossl_old_des_cfb_encrypt(unsigned char *in,unsigned char *out,int numbits,
345 long length,_ossl_old_des_key_schedule schedule,_ossl_old_des_cblock *ivec,int enc);
346void _ossl_old_des_ecb_encrypt(_ossl_old_des_cblock *input,_ossl_old_des_cblock *output,
347 _ossl_old_des_key_schedule ks,int enc);
348void _ossl_old_des_encrypt(DES_LONG *data,_ossl_old_des_key_schedule ks, int enc);
349void _ossl_old_des_encrypt2(DES_LONG *data,_ossl_old_des_key_schedule ks, int enc);
350void _ossl_old_des_encrypt3(DES_LONG *data, _ossl_old_des_key_schedule ks1,
351 _ossl_old_des_key_schedule ks2, _ossl_old_des_key_schedule ks3);
352void _ossl_old_des_decrypt3(DES_LONG *data, _ossl_old_des_key_schedule ks1,
353 _ossl_old_des_key_schedule ks2, _ossl_old_des_key_schedule ks3);
354void _ossl_old_des_ede3_cbc_encrypt(_ossl_old_des_cblock *input, _ossl_old_des_cblock *output,
355 long length, _ossl_old_des_key_schedule ks1, _ossl_old_des_key_schedule ks2,
356 _ossl_old_des_key_schedule ks3, _ossl_old_des_cblock *ivec, int enc);
357void _ossl_old_des_ede3_cfb64_encrypt(unsigned char *in, unsigned char *out,
358 long length, _ossl_old_des_key_schedule ks1, _ossl_old_des_key_schedule ks2,
359 _ossl_old_des_key_schedule ks3, _ossl_old_des_cblock *ivec, int *num, int enc);
360void _ossl_old_des_ede3_ofb64_encrypt(unsigned char *in, unsigned char *out,
361 long length, _ossl_old_des_key_schedule ks1, _ossl_old_des_key_schedule ks2,
362 _ossl_old_des_key_schedule ks3, _ossl_old_des_cblock *ivec, int *num);
363
364void _ossl_old_des_xwhite_in2out(_ossl_old_des_cblock (*des_key), _ossl_old_des_cblock (*in_white),
365 _ossl_old_des_cblock (*out_white));
366
367int _ossl_old_des_enc_read(int fd,char *buf,int len,_ossl_old_des_key_schedule sched,
368 _ossl_old_des_cblock *iv);
369int _ossl_old_des_enc_write(int fd,char *buf,int len,_ossl_old_des_key_schedule sched,
370 _ossl_old_des_cblock *iv);
371char *_ossl_old_des_fcrypt(const char *buf,const char *salt, char *ret);
372char *_ossl_old_des_crypt(const char *buf,const char *salt);
373#if !defined(PERL5) && !defined(NeXT)
374char *_ossl_old_crypt(const char *buf,const char *salt);
375#endif
376void _ossl_old_des_ofb_encrypt(unsigned char *in,unsigned char *out,
377 int numbits,long length,_ossl_old_des_key_schedule schedule,_ossl_old_des_cblock *ivec);
378void _ossl_old_des_pcbc_encrypt(_ossl_old_des_cblock *input,_ossl_old_des_cblock *output,long length,
379 _ossl_old_des_key_schedule schedule,_ossl_old_des_cblock *ivec,int enc);
380DES_LONG _ossl_old_des_quad_cksum(_ossl_old_des_cblock *input,_ossl_old_des_cblock *output,
381 long length,int out_count,_ossl_old_des_cblock *seed);
382void _ossl_old_des_random_seed(_ossl_old_des_cblock key);
383void _ossl_old_des_random_key(_ossl_old_des_cblock ret);
384int _ossl_old_des_read_password(_ossl_old_des_cblock *key,const char *prompt,int verify);
385int _ossl_old_des_read_2passwords(_ossl_old_des_cblock *key1,_ossl_old_des_cblock *key2,
386 const char *prompt,int verify);
387void _ossl_old_des_set_odd_parity(_ossl_old_des_cblock *key);
388int _ossl_old_des_is_weak_key(_ossl_old_des_cblock *key);
389int _ossl_old_des_set_key(_ossl_old_des_cblock *key,_ossl_old_des_key_schedule schedule);
390int _ossl_old_des_key_sched(_ossl_old_des_cblock *key,_ossl_old_des_key_schedule schedule);
391void _ossl_old_des_string_to_key(char *str,_ossl_old_des_cblock *key);
392void _ossl_old_des_string_to_2keys(char *str,_ossl_old_des_cblock *key1,_ossl_old_des_cblock *key2);
393void _ossl_old_des_cfb64_encrypt(unsigned char *in, unsigned char *out, long length,
394 _ossl_old_des_key_schedule schedule, _ossl_old_des_cblock *ivec, int *num, int enc);
395void _ossl_old_des_ofb64_encrypt(unsigned char *in, unsigned char *out, long length,
396 _ossl_old_des_key_schedule schedule, _ossl_old_des_cblock *ivec, int *num);
397
398void _ossl_096_des_random_seed(des_cblock *key);
399
400/* The following definitions provide compatibility with the MIT Kerberos
401 * library. The _ossl_old_des_key_schedule structure is not binary compatible. */
402
403#define _KERBEROS_DES_H
404
405#define KRBDES_ENCRYPT DES_ENCRYPT
406#define KRBDES_DECRYPT DES_DECRYPT
407
408#ifdef KERBEROS
409# define ENCRYPT DES_ENCRYPT
410# define DECRYPT DES_DECRYPT
411#endif
412
413#ifndef NCOMPAT
414# define C_Block des_cblock
415# define Key_schedule des_key_schedule
416# define KEY_SZ DES_KEY_SZ
417# define string_to_key des_string_to_key
418# define read_pw_string des_read_pw_string
419# define random_key des_random_key
420# define pcbc_encrypt des_pcbc_encrypt
421# define set_key des_set_key
422# define key_sched des_key_sched
423# define ecb_encrypt des_ecb_encrypt
424# define cbc_encrypt des_cbc_encrypt
425# define ncbc_encrypt des_ncbc_encrypt
426# define xcbc_encrypt des_xcbc_encrypt
427# define cbc_cksum des_cbc_cksum
428# define quad_cksum des_quad_cksum
429# define check_parity des_check_key_parity
430#endif
431
432#define des_fixup_key_parity DES_fixup_key_parity
433
434#ifdef __cplusplus
435}
436#endif
437
438/* for DES_read_pw_string et al */
439#include <openssl/ui_compat.h>
440
441#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..79278b920e
--- /dev/null
+++ b/src/lib/libcrypto/des/des_opts.c
@@ -0,0 +1,604 @@
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#include <signal.h>
75#ifndef _IRIX
76#include <time.h>
77#endif
78#ifdef TIMES
79#include <sys/types.h>
80#include <sys/times.h>
81#endif
82
83/* Depending on the VMS version, the tms structure is perhaps defined.
84 The __TMS macro will show if it was. If it wasn't defined, we should
85 undefine TIMES, since that tells the rest of the program how things
86 should be handled. -- Richard Levitte */
87#if defined(OPENSSL_SYS_VMS_DECC) && !defined(__TMS)
88#undef TIMES
89#endif
90
91#ifndef TIMES
92#include <sys/timeb.h>
93#endif
94
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/des.h>
103#include "spr.h"
104
105#define DES_DEFAULT_OPTIONS
106
107#if !defined(PART1) && !defined(PART2) && !defined(PART3) && !defined(PART4)
108#define PART1
109#define PART2
110#define PART3
111#define PART4
112#endif
113
114#ifdef PART1
115
116#undef DES_UNROLL
117#undef DES_RISC1
118#undef DES_RISC2
119#undef DES_PTR
120#undef D_ENCRYPT
121#define DES_encrypt1 des_encrypt_u4_cisc_idx
122#define DES_encrypt2 des_encrypt2_u4_cisc_idx
123#define DES_encrypt3 des_encrypt3_u4_cisc_idx
124#define DES_decrypt3 des_decrypt3_u4_cisc_idx
125#undef HEADER_DES_LOCL_H
126#include "des_enc.c"
127
128#define DES_UNROLL
129#undef DES_RISC1
130#undef DES_RISC2
131#undef DES_PTR
132#undef D_ENCRYPT
133#undef DES_encrypt1
134#undef DES_encrypt2
135#undef DES_encrypt3
136#undef DES_decrypt3
137#define DES_encrypt1 des_encrypt_u16_cisc_idx
138#define DES_encrypt2 des_encrypt2_u16_cisc_idx
139#define DES_encrypt3 des_encrypt3_u16_cisc_idx
140#define DES_decrypt3 des_decrypt3_u16_cisc_idx
141#undef HEADER_DES_LOCL_H
142#include "des_enc.c"
143
144#undef DES_UNROLL
145#define DES_RISC1
146#undef DES_RISC2
147#undef DES_PTR
148#undef D_ENCRYPT
149#undef DES_encrypt1
150#undef DES_encrypt2
151#undef DES_encrypt3
152#undef DES_decrypt3
153#define DES_encrypt1 des_encrypt_u4_risc1_idx
154#define DES_encrypt2 des_encrypt2_u4_risc1_idx
155#define DES_encrypt3 des_encrypt3_u4_risc1_idx
156#define DES_decrypt3 des_decrypt3_u4_risc1_idx
157#undef HEADER_DES_LOCL_H
158#include "des_enc.c"
159
160#endif
161
162#ifdef PART2
163
164#undef DES_UNROLL
165#undef DES_RISC1
166#define DES_RISC2
167#undef DES_PTR
168#undef D_ENCRYPT
169#undef DES_encrypt1
170#undef DES_encrypt2
171#undef DES_encrypt3
172#undef DES_decrypt3
173#define DES_encrypt1 des_encrypt_u4_risc2_idx
174#define DES_encrypt2 des_encrypt2_u4_risc2_idx
175#define DES_encrypt3 des_encrypt3_u4_risc2_idx
176#define DES_decrypt3 des_decrypt3_u4_risc2_idx
177#undef HEADER_DES_LOCL_H
178#include "des_enc.c"
179
180#define DES_UNROLL
181#define DES_RISC1
182#undef DES_RISC2
183#undef DES_PTR
184#undef D_ENCRYPT
185#undef DES_encrypt1
186#undef DES_encrypt2
187#undef DES_encrypt3
188#undef DES_decrypt3
189#define DES_encrypt1 des_encrypt_u16_risc1_idx
190#define DES_encrypt2 des_encrypt2_u16_risc1_idx
191#define DES_encrypt3 des_encrypt3_u16_risc1_idx
192#define DES_decrypt3 des_decrypt3_u16_risc1_idx
193#undef HEADER_DES_LOCL_H
194#include "des_enc.c"
195
196#define DES_UNROLL
197#undef DES_RISC1
198#define DES_RISC2
199#undef DES_PTR
200#undef D_ENCRYPT
201#undef DES_encrypt1
202#undef DES_encrypt2
203#undef DES_encrypt3
204#undef DES_decrypt3
205#define DES_encrypt1 des_encrypt_u16_risc2_idx
206#define DES_encrypt2 des_encrypt2_u16_risc2_idx
207#define DES_encrypt3 des_encrypt3_u16_risc2_idx
208#define DES_decrypt3 des_decrypt3_u16_risc2_idx
209#undef HEADER_DES_LOCL_H
210#include "des_enc.c"
211
212#endif
213
214#ifdef PART3
215
216#undef DES_UNROLL
217#undef DES_RISC1
218#undef DES_RISC2
219#define DES_PTR
220#undef D_ENCRYPT
221#undef DES_encrypt1
222#undef DES_encrypt2
223#undef DES_encrypt3
224#undef DES_decrypt3
225#define DES_encrypt1 des_encrypt_u4_cisc_ptr
226#define DES_encrypt2 des_encrypt2_u4_cisc_ptr
227#define DES_encrypt3 des_encrypt3_u4_cisc_ptr
228#define DES_decrypt3 des_decrypt3_u4_cisc_ptr
229#undef HEADER_DES_LOCL_H
230#include "des_enc.c"
231
232#define DES_UNROLL
233#undef DES_RISC1
234#undef DES_RISC2
235#define DES_PTR
236#undef D_ENCRYPT
237#undef DES_encrypt1
238#undef DES_encrypt2
239#undef DES_encrypt3
240#undef DES_decrypt3
241#define DES_encrypt1 des_encrypt_u16_cisc_ptr
242#define DES_encrypt2 des_encrypt2_u16_cisc_ptr
243#define DES_encrypt3 des_encrypt3_u16_cisc_ptr
244#define DES_decrypt3 des_decrypt3_u16_cisc_ptr
245#undef HEADER_DES_LOCL_H
246#include "des_enc.c"
247
248#undef DES_UNROLL
249#define DES_RISC1
250#undef DES_RISC2
251#define DES_PTR
252#undef D_ENCRYPT
253#undef DES_encrypt1
254#undef DES_encrypt2
255#undef DES_encrypt3
256#undef DES_decrypt3
257#define DES_encrypt1 des_encrypt_u4_risc1_ptr
258#define DES_encrypt2 des_encrypt2_u4_risc1_ptr
259#define DES_encrypt3 des_encrypt3_u4_risc1_ptr
260#define DES_decrypt3 des_decrypt3_u4_risc1_ptr
261#undef HEADER_DES_LOCL_H
262#include "des_enc.c"
263
264#endif
265
266#ifdef PART4
267
268#undef DES_UNROLL
269#undef DES_RISC1
270#define DES_RISC2
271#define DES_PTR
272#undef D_ENCRYPT
273#undef DES_encrypt1
274#undef DES_encrypt2
275#undef DES_encrypt3
276#undef DES_decrypt3
277#define DES_encrypt1 des_encrypt_u4_risc2_ptr
278#define DES_encrypt2 des_encrypt2_u4_risc2_ptr
279#define DES_encrypt3 des_encrypt3_u4_risc2_ptr
280#define DES_decrypt3 des_decrypt3_u4_risc2_ptr
281#undef HEADER_DES_LOCL_H
282#include "des_enc.c"
283
284#define DES_UNROLL
285#define DES_RISC1
286#undef DES_RISC2
287#define DES_PTR
288#undef D_ENCRYPT
289#undef DES_encrypt1
290#undef DES_encrypt2
291#undef DES_encrypt3
292#undef DES_decrypt3
293#define DES_encrypt1 des_encrypt_u16_risc1_ptr
294#define DES_encrypt2 des_encrypt2_u16_risc1_ptr
295#define DES_encrypt3 des_encrypt3_u16_risc1_ptr
296#define DES_decrypt3 des_decrypt3_u16_risc1_ptr
297#undef HEADER_DES_LOCL_H
298#include "des_enc.c"
299
300#define DES_UNROLL
301#undef DES_RISC1
302#define DES_RISC2
303#define DES_PTR
304#undef D_ENCRYPT
305#undef DES_encrypt1
306#undef DES_encrypt2
307#undef DES_encrypt3
308#undef DES_decrypt3
309#define DES_encrypt1 des_encrypt_u16_risc2_ptr
310#define DES_encrypt2 des_encrypt2_u16_risc2_ptr
311#define DES_encrypt3 des_encrypt3_u16_risc2_ptr
312#define DES_decrypt3 des_decrypt3_u16_risc2_ptr
313#undef HEADER_DES_LOCL_H
314#include "des_enc.c"
315
316#endif
317
318/* The following if from times(3) man page. It may need to be changed */
319#ifndef HZ
320# ifndef CLK_TCK
321# ifndef _BSD_CLK_TCK_ /* FreeBSD fix */
322# define HZ 100.0
323# else /* _BSD_CLK_TCK_ */
324# define HZ ((double)_BSD_CLK_TCK_)
325# endif
326# else /* CLK_TCK */
327# define HZ ((double)CLK_TCK)
328# endif
329#endif
330
331#define BUFSIZE ((long)1024)
332long run=0;
333
334double Time_F(int s);
335#ifdef SIGALRM
336#if defined(__STDC__) || defined(sgi)
337#define SIGRETTYPE void
338#else
339#define SIGRETTYPE int
340#endif
341
342SIGRETTYPE sig_done(int sig);
343SIGRETTYPE sig_done(int sig)
344 {
345 signal(SIGALRM,sig_done);
346 run=0;
347#ifdef LINT
348 sig=sig;
349#endif
350 }
351#endif
352
353#define START 0
354#define STOP 1
355
356double Time_F(int s)
357 {
358 double ret;
359#ifdef TIMES
360 static struct tms tstart,tend;
361
362 if (s == START)
363 {
364 times(&tstart);
365 return(0);
366 }
367 else
368 {
369 times(&tend);
370 ret=((double)(tend.tms_utime-tstart.tms_utime))/HZ;
371 return((ret == 0.0)?1e-6:ret);
372 }
373#else /* !times() */
374 static struct timeb tstart,tend;
375 long i;
376
377 if (s == START)
378 {
379 ftime(&tstart);
380 return(0);
381 }
382 else
383 {
384 ftime(&tend);
385 i=(long)tend.millitm-(long)tstart.millitm;
386 ret=((double)(tend.time-tstart.time))+((double)i)/1000.0;
387 return((ret == 0.0)?1e-6:ret);
388 }
389#endif
390 }
391
392#ifdef SIGALRM
393#define print_name(name) fprintf(stderr,"Doing %s's for 10 seconds\n",name); alarm(10);
394#else
395#define print_name(name) fprintf(stderr,"Doing %s %ld times\n",name,cb);
396#endif
397
398#define time_it(func,name,index) \
399 print_name(name); \
400 Time_F(START); \
401 for (count=0,run=1; COND(cb); count++) \
402 { \
403 unsigned long d[2]; \
404 func(d,&sch,DES_ENCRYPT); \
405 } \
406 tm[index]=Time_F(STOP); \
407 fprintf(stderr,"%ld %s's in %.2f second\n",count,name,tm[index]); \
408 tm[index]=((double)COUNT(cb))/tm[index];
409
410#define print_it(name,index) \
411 fprintf(stderr,"%s bytes per sec = %12.2f (%5.1fuS)\n",name, \
412 tm[index]*8,1.0e6/tm[index]);
413
414int main(int argc, char **argv)
415 {
416 long count;
417 static unsigned char buf[BUFSIZE];
418 static DES_cblock key ={0x12,0x34,0x56,0x78,0x9a,0xbc,0xde,0xf0};
419 static DES_cblock key2={0x34,0x56,0x78,0x9a,0xbc,0xde,0xf0,0x12};
420 static DES_cblock key3={0x56,0x78,0x9a,0xbc,0xde,0xf0,0x12,0x34};
421 DES_key_schedule sch,sch2,sch3;
422 double d,tm[16],max=0;
423 int rank[16];
424 char *str[16];
425 int max_idx=0,i,num=0,j;
426#ifndef SIGALARM
427 long ca,cb,cc,cd,ce;
428#endif
429
430 for (i=0; i<12; i++)
431 {
432 tm[i]=0.0;
433 rank[i]=0;
434 }
435
436#ifndef TIMES
437 fprintf(stderr,"To get the most accurate results, try to run this\n");
438 fprintf(stderr,"program when this computer is idle.\n");
439#endif
440
441 DES_set_key_unchecked(&key,&sch);
442 DES_set_key_unchecked(&key2,&sch2);
443 DES_set_key_unchecked(&key3,&sch3);
444
445#ifndef SIGALRM
446 fprintf(stderr,"First we calculate the approximate speed ...\n");
447 DES_set_key_unchecked(&key,sch);
448 count=10;
449 do {
450 long i;
451 unsigned long data[2];
452
453 count*=2;
454 Time_F(START);
455 for (i=count; i; i--)
456 DES_encrypt1(data,&(sch[0]),DES_ENCRYPT);
457 d=Time_F(STOP);
458 } while (d < 3.0);
459 ca=count;
460 cb=count*3;
461 cc=count*3*8/BUFSIZE+1;
462 cd=count*8/BUFSIZE+1;
463
464 ce=count/20+1;
465#define COND(d) (count != (d))
466#define COUNT(d) (d)
467#else
468#define COND(c) (run)
469#define COUNT(d) (count)
470 signal(SIGALRM,sig_done);
471 alarm(10);
472#endif
473
474#ifdef PART1
475 time_it(des_encrypt_u4_cisc_idx, "des_encrypt_u4_cisc_idx ", 0);
476 time_it(des_encrypt_u16_cisc_idx, "des_encrypt_u16_cisc_idx ", 1);
477 time_it(des_encrypt_u4_risc1_idx, "des_encrypt_u4_risc1_idx ", 2);
478 num+=3;
479#endif
480#ifdef PART2
481 time_it(des_encrypt_u16_risc1_idx,"des_encrypt_u16_risc1_idx", 3);
482 time_it(des_encrypt_u4_risc2_idx, "des_encrypt_u4_risc2_idx ", 4);
483 time_it(des_encrypt_u16_risc2_idx,"des_encrypt_u16_risc2_idx", 5);
484 num+=3;
485#endif
486#ifdef PART3
487 time_it(des_encrypt_u4_cisc_ptr, "des_encrypt_u4_cisc_ptr ", 6);
488 time_it(des_encrypt_u16_cisc_ptr, "des_encrypt_u16_cisc_ptr ", 7);
489 time_it(des_encrypt_u4_risc1_ptr, "des_encrypt_u4_risc1_ptr ", 8);
490 num+=3;
491#endif
492#ifdef PART4
493 time_it(des_encrypt_u16_risc1_ptr,"des_encrypt_u16_risc1_ptr", 9);
494 time_it(des_encrypt_u4_risc2_ptr, "des_encrypt_u4_risc2_ptr ",10);
495 time_it(des_encrypt_u16_risc2_ptr,"des_encrypt_u16_risc2_ptr",11);
496 num+=3;
497#endif
498
499#ifdef PART1
500 str[0]=" 4 c i";
501 print_it("des_encrypt_u4_cisc_idx ",0);
502 max=tm[0];
503 max_idx=0;
504 str[1]="16 c i";
505 print_it("des_encrypt_u16_cisc_idx ",1);
506 if (max < tm[1]) { max=tm[1]; max_idx=1; }
507 str[2]=" 4 r1 i";
508 print_it("des_encrypt_u4_risc1_idx ",2);
509 if (max < tm[2]) { max=tm[2]; max_idx=2; }
510#endif
511#ifdef PART2
512 str[3]="16 r1 i";
513 print_it("des_encrypt_u16_risc1_idx",3);
514 if (max < tm[3]) { max=tm[3]; max_idx=3; }
515 str[4]=" 4 r2 i";
516 print_it("des_encrypt_u4_risc2_idx ",4);
517 if (max < tm[4]) { max=tm[4]; max_idx=4; }
518 str[5]="16 r2 i";
519 print_it("des_encrypt_u16_risc2_idx",5);
520 if (max < tm[5]) { max=tm[5]; max_idx=5; }
521#endif
522#ifdef PART3
523 str[6]=" 4 c p";
524 print_it("des_encrypt_u4_cisc_ptr ",6);
525 if (max < tm[6]) { max=tm[6]; max_idx=6; }
526 str[7]="16 c p";
527 print_it("des_encrypt_u16_cisc_ptr ",7);
528 if (max < tm[7]) { max=tm[7]; max_idx=7; }
529 str[8]=" 4 r1 p";
530 print_it("des_encrypt_u4_risc1_ptr ",8);
531 if (max < tm[8]) { max=tm[8]; max_idx=8; }
532#endif
533#ifdef PART4
534 str[9]="16 r1 p";
535 print_it("des_encrypt_u16_risc1_ptr",9);
536 if (max < tm[9]) { max=tm[9]; max_idx=9; }
537 str[10]=" 4 r2 p";
538 print_it("des_encrypt_u4_risc2_ptr ",10);
539 if (max < tm[10]) { max=tm[10]; max_idx=10; }
540 str[11]="16 r2 p";
541 print_it("des_encrypt_u16_risc2_ptr",11);
542 if (max < tm[11]) { max=tm[11]; max_idx=11; }
543#endif
544 printf("options des ecb/s\n");
545 printf("%s %12.2f 100.0%%\n",str[max_idx],tm[max_idx]);
546 d=tm[max_idx];
547 tm[max_idx]= -2.0;
548 max= -1.0;
549 for (;;)
550 {
551 for (i=0; i<12; i++)
552 {
553 if (max < tm[i]) { max=tm[i]; j=i; }
554 }
555 if (max < 0.0) break;
556 printf("%s %12.2f %4.1f%%\n",str[j],tm[j],tm[j]/d*100.0);
557 tm[j]= -2.0;
558 max= -1.0;
559 }
560
561 switch (max_idx)
562 {
563 case 0:
564 printf("-DDES_DEFAULT_OPTIONS\n");
565 break;
566 case 1:
567 printf("-DDES_UNROLL\n");
568 break;
569 case 2:
570 printf("-DDES_RISC1\n");
571 break;
572 case 3:
573 printf("-DDES_UNROLL -DDES_RISC1\n");
574 break;
575 case 4:
576 printf("-DDES_RISC2\n");
577 break;
578 case 5:
579 printf("-DDES_UNROLL -DDES_RISC2\n");
580 break;
581 case 6:
582 printf("-DDES_PTR\n");
583 break;
584 case 7:
585 printf("-DDES_UNROLL -DDES_PTR\n");
586 break;
587 case 8:
588 printf("-DDES_RISC1 -DDES_PTR\n");
589 break;
590 case 9:
591 printf("-DDES_UNROLL -DDES_RISC1 -DDES_PTR\n");
592 break;
593 case 10:
594 printf("-DDES_RISC2 -DDES_PTR\n");
595 break;
596 case 11:
597 printf("-DDES_UNROLL -DDES_RISC2 -DDES_PTR\n");
598 break;
599 }
600 exit(0);
601#if defined(LINT) || defined(OPENSSL_SYS_MSDOS)
602 return(0);
603#endif
604 }
diff --git a/src/lib/libcrypto/des/des_ver.h b/src/lib/libcrypto/des/des_ver.h
new file mode 100644
index 0000000000..379bbadda2
--- /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..e3e9d77f14
--- /dev/null
+++ b/src/lib/libcrypto/des/destest.c
@@ -0,0 +1,948 @@
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 i,j,err=0;
337 des_cblock in,out,outin,iv3,iv2;
338 des_key_schedule ks,ks2,ks3;
339 unsigned char cbc_in[40];
340 unsigned char cbc_out[40];
341 DES_LONG cs;
342 unsigned char cret[8];
343#ifdef _CRAY
344 struct {
345 int a:32;
346 int b:32;
347 } lqret[2];
348#else
349 DES_LONG lqret[4];
350#endif
351 int num;
352 char *str;
353
354#ifndef OPENSSL_NO_DESCBCM
355 printf("Doing cbcm\n");
356 if ((j=DES_set_key_checked(&cbc_key,&ks)) != 0)
357 {
358 printf("Key error %d\n",j);
359 err=1;
360 }
361 if ((j=DES_set_key_checked(&cbc2_key,&ks2)) != 0)
362 {
363 printf("Key error %d\n",j);
364 err=1;
365 }
366 if ((j=DES_set_key_checked(&cbc3_key,&ks3)) != 0)
367 {
368 printf("Key error %d\n",j);
369 err=1;
370 }
371 memset(cbc_out,0,40);
372 memset(cbc_in,0,40);
373 i=strlen((char *)cbc_data)+1;
374 /* i=((i+7)/8)*8; */
375 memcpy(iv3,cbc_iv,sizeof(cbc_iv));
376 memset(iv2,'\0',sizeof iv2);
377
378 DES_ede3_cbcm_encrypt(cbc_data,cbc_out,16L,&ks,&ks2,&ks3,&iv3,&iv2,
379 DES_ENCRYPT);
380 DES_ede3_cbcm_encrypt(&cbc_data[16],&cbc_out[16],i-16,&ks,&ks2,&ks3,
381 &iv3,&iv2,DES_ENCRYPT);
382 /* if (memcmp(cbc_out,cbc3_ok,
383 (unsigned int)(strlen((char *)cbc_data)+1+7)/8*8) != 0)
384 {
385 printf("des_ede3_cbc_encrypt encrypt error\n");
386 err=1;
387 }
388 */
389 memcpy(iv3,cbc_iv,sizeof(cbc_iv));
390 memset(iv2,'\0',sizeof iv2);
391 DES_ede3_cbcm_encrypt(cbc_out,cbc_in,i,&ks,&ks2,&ks3,&iv3,&iv2,DES_DECRYPT);
392 if (memcmp(cbc_in,cbc_data,strlen((char *)cbc_data)+1) != 0)
393 {
394 int n;
395
396 printf("des_ede3_cbcm_encrypt decrypt error\n");
397 for(n=0 ; n < i ; ++n)
398 printf(" %02x",cbc_data[n]);
399 printf("\n");
400 for(n=0 ; n < i ; ++n)
401 printf(" %02x",cbc_in[n]);
402 printf("\n");
403 err=1;
404 }
405#endif
406
407 printf("Doing ecb\n");
408 for (i=0; i<NUM_TESTS; i++)
409 {
410 DES_set_key_unchecked(&key_data[i],&ks);
411 memcpy(in,plain_data[i],8);
412 memset(out,0,8);
413 memset(outin,0,8);
414 des_ecb_encrypt(&in,&out,ks,DES_ENCRYPT);
415 des_ecb_encrypt(&out,&outin,ks,DES_DECRYPT);
416
417 if (memcmp(out,cipher_data[i],8) != 0)
418 {
419 printf("Encryption error %2d\nk=%s p=%s o=%s act=%s\n",
420 i+1,pt(key_data[i]),pt(in),pt(cipher_data[i]),
421 pt(out));
422 err=1;
423 }
424 if (memcmp(in,outin,8) != 0)
425 {
426 printf("Decryption error %2d\nk=%s p=%s o=%s act=%s\n",
427 i+1,pt(key_data[i]),pt(out),pt(in),pt(outin));
428 err=1;
429 }
430 }
431
432#ifndef LIBDES_LIT
433 printf("Doing ede ecb\n");
434 for (i=0; i<(NUM_TESTS-2); i++)
435 {
436 DES_set_key_unchecked(&key_data[i],&ks);
437 DES_set_key_unchecked(&key_data[i+1],&ks2);
438 DES_set_key_unchecked(&key_data[i+2],&ks3);
439 memcpy(in,plain_data[i],8);
440 memset(out,0,8);
441 memset(outin,0,8);
442 des_ecb2_encrypt(in,out,ks,ks2,DES_ENCRYPT);
443 des_ecb2_encrypt(out,outin,ks,ks2,DES_DECRYPT);
444
445 if (memcmp(out,cipher_ecb2[i],8) != 0)
446 {
447 printf("Encryption error %2d\nk=%s p=%s o=%s act=%s\n",
448 i+1,pt(key_data[i]),pt(in),pt(cipher_ecb2[i]),
449 pt(out));
450 err=1;
451 }
452 if (memcmp(in,outin,8) != 0)
453 {
454 printf("Decryption error %2d\nk=%s p=%s o=%s act=%s\n",
455 i+1,pt(key_data[i]),pt(out),pt(in),pt(outin));
456 err=1;
457 }
458 }
459#endif
460
461 printf("Doing cbc\n");
462 if ((j=DES_set_key_checked(&cbc_key,&ks)) != 0)
463 {
464 printf("Key error %d\n",j);
465 err=1;
466 }
467 memset(cbc_out,0,40);
468 memset(cbc_in,0,40);
469 memcpy(iv3,cbc_iv,sizeof(cbc_iv));
470 des_ncbc_encrypt(cbc_data,cbc_out,strlen((char *)cbc_data)+1,ks,
471 &iv3,DES_ENCRYPT);
472 if (memcmp(cbc_out,cbc_ok,32) != 0)
473 {
474 printf("cbc_encrypt encrypt error\n");
475 err=1;
476 }
477
478 memcpy(iv3,cbc_iv,sizeof(cbc_iv));
479 des_ncbc_encrypt(cbc_out,cbc_in,strlen((char *)cbc_data)+1,ks,
480 &iv3,DES_DECRYPT);
481 if (memcmp(cbc_in,cbc_data,strlen((char *)cbc_data)) != 0)
482 {
483 printf("cbc_encrypt decrypt error\n");
484 err=1;
485 }
486
487#ifndef LIBDES_LIT
488 printf("Doing desx cbc\n");
489 if ((j=DES_set_key_checked(&cbc_key,&ks)) != 0)
490 {
491 printf("Key error %d\n",j);
492 err=1;
493 }
494 memset(cbc_out,0,40);
495 memset(cbc_in,0,40);
496 memcpy(iv3,cbc_iv,sizeof(cbc_iv));
497 des_xcbc_encrypt(cbc_data,cbc_out,strlen((char *)cbc_data)+1,ks,
498 &iv3,&cbc2_key,&cbc3_key, DES_ENCRYPT);
499 if (memcmp(cbc_out,xcbc_ok,32) != 0)
500 {
501 printf("des_xcbc_encrypt encrypt error\n");
502 err=1;
503 }
504 memcpy(iv3,cbc_iv,sizeof(cbc_iv));
505 des_xcbc_encrypt(cbc_out,cbc_in,strlen((char *)cbc_data)+1,ks,
506 &iv3,&cbc2_key,&cbc3_key, DES_DECRYPT);
507 if (memcmp(cbc_in,cbc_data,strlen((char *)cbc_data)+1) != 0)
508 {
509 printf("des_xcbc_encrypt decrypt error\n");
510 err=1;
511 }
512#endif
513
514 printf("Doing ede cbc\n");
515 if ((j=DES_set_key_checked(&cbc_key,&ks)) != 0)
516 {
517 printf("Key error %d\n",j);
518 err=1;
519 }
520 if ((j=DES_set_key_checked(&cbc2_key,&ks2)) != 0)
521 {
522 printf("Key error %d\n",j);
523 err=1;
524 }
525 if ((j=DES_set_key_checked(&cbc3_key,&ks3)) != 0)
526 {
527 printf("Key error %d\n",j);
528 err=1;
529 }
530 memset(cbc_out,0,40);
531 memset(cbc_in,0,40);
532 i=strlen((char *)cbc_data)+1;
533 /* i=((i+7)/8)*8; */
534 memcpy(iv3,cbc_iv,sizeof(cbc_iv));
535
536 des_ede3_cbc_encrypt(cbc_data,cbc_out,16L,ks,ks2,ks3,&iv3,
537 DES_ENCRYPT);
538 des_ede3_cbc_encrypt(&(cbc_data[16]),&(cbc_out[16]),i-16,ks,ks2,ks3,
539 &iv3,DES_ENCRYPT);
540 if (memcmp(cbc_out,cbc3_ok,
541 (unsigned int)(strlen((char *)cbc_data)+1+7)/8*8) != 0)
542 {
543 int n;
544
545 printf("des_ede3_cbc_encrypt encrypt error\n");
546 for(n=0 ; n < i ; ++n)
547 printf(" %02x",cbc_out[n]);
548 printf("\n");
549 for(n=0 ; n < i ; ++n)
550 printf(" %02x",cbc3_ok[n]);
551 printf("\n");
552 err=1;
553 }
554
555 memcpy(iv3,cbc_iv,sizeof(cbc_iv));
556 des_ede3_cbc_encrypt(cbc_out,cbc_in,i,ks,ks2,ks3,&iv3,DES_DECRYPT);
557 if (memcmp(cbc_in,cbc_data,strlen((char *)cbc_data)+1) != 0)
558 {
559 int n;
560
561 printf("des_ede3_cbc_encrypt decrypt error\n");
562 for(n=0 ; n < i ; ++n)
563 printf(" %02x",cbc_data[n]);
564 printf("\n");
565 for(n=0 ; n < i ; ++n)
566 printf(" %02x",cbc_in[n]);
567 printf("\n");
568 err=1;
569 }
570
571#ifndef LIBDES_LIT
572 printf("Doing pcbc\n");
573 if ((j=DES_set_key_checked(&cbc_key,&ks)) != 0)
574 {
575 printf("Key error %d\n",j);
576 err=1;
577 }
578 memset(cbc_out,0,40);
579 memset(cbc_in,0,40);
580 des_pcbc_encrypt(cbc_data,cbc_out,strlen((char *)cbc_data)+1,ks,
581 &cbc_iv,DES_ENCRYPT);
582 if (memcmp(cbc_out,pcbc_ok,32) != 0)
583 {
584 printf("pcbc_encrypt encrypt error\n");
585 err=1;
586 }
587 des_pcbc_encrypt(cbc_out,cbc_in,strlen((char *)cbc_data)+1,ks,&cbc_iv,
588 DES_DECRYPT);
589 if (memcmp(cbc_in,cbc_data,strlen((char *)cbc_data)+1) != 0)
590 {
591 printf("pcbc_encrypt decrypt error\n");
592 err=1;
593 }
594
595 printf("Doing ");
596 printf("cfb8 ");
597 err+=cfb_test(8,cfb_cipher8);
598 printf("cfb16 ");
599 err+=cfb_test(16,cfb_cipher16);
600 printf("cfb32 ");
601 err+=cfb_test(32,cfb_cipher32);
602 printf("cfb48 ");
603 err+=cfb_test(48,cfb_cipher48);
604 printf("cfb64 ");
605 err+=cfb_test(64,cfb_cipher64);
606
607 printf("cfb64() ");
608 err+=cfb64_test(cfb_cipher64);
609
610 memcpy(cfb_tmp,cfb_iv,sizeof(cfb_iv));
611 for (i=0; i<sizeof(plain); i++)
612 des_cfb_encrypt(&(plain[i]),&(cfb_buf1[i]),
613 8,1,ks,&cfb_tmp,DES_ENCRYPT);
614 if (memcmp(cfb_cipher8,cfb_buf1,sizeof(plain)) != 0)
615 {
616 printf("cfb_encrypt small encrypt error\n");
617 err=1;
618 }
619
620 memcpy(cfb_tmp,cfb_iv,sizeof(cfb_iv));
621 for (i=0; i<sizeof(plain); i++)
622 des_cfb_encrypt(&(cfb_buf1[i]),&(cfb_buf2[i]),
623 8,1,ks,&cfb_tmp,DES_DECRYPT);
624 if (memcmp(plain,cfb_buf2,sizeof(plain)) != 0)
625 {
626 printf("cfb_encrypt small decrypt error\n");
627 err=1;
628 }
629
630 printf("ede_cfb64() ");
631 err+=ede_cfb64_test(cfb_cipher64);
632
633 printf("done\n");
634
635 printf("Doing ofb\n");
636 DES_set_key_checked(&ofb_key,&ks);
637 memcpy(ofb_tmp,ofb_iv,sizeof(ofb_iv));
638 des_ofb_encrypt(plain,ofb_buf1,64,sizeof(plain)/8,ks,&ofb_tmp);
639 if (memcmp(ofb_cipher,ofb_buf1,sizeof(ofb_buf1)) != 0)
640 {
641 printf("ofb_encrypt encrypt error\n");
642printf("%02X %02X %02X %02X %02X %02X %02X %02X\n",
643ofb_buf1[8+0], ofb_buf1[8+1], ofb_buf1[8+2], ofb_buf1[8+3],
644ofb_buf1[8+4], ofb_buf1[8+5], ofb_buf1[8+6], ofb_buf1[8+7]);
645printf("%02X %02X %02X %02X %02X %02X %02X %02X\n",
646ofb_buf1[8+0], ofb_cipher[8+1], ofb_cipher[8+2], ofb_cipher[8+3],
647ofb_buf1[8+4], ofb_cipher[8+5], ofb_cipher[8+6], ofb_cipher[8+7]);
648 err=1;
649 }
650 memcpy(ofb_tmp,ofb_iv,sizeof(ofb_iv));
651 des_ofb_encrypt(ofb_buf1,ofb_buf2,64,sizeof(ofb_buf1)/8,ks,&ofb_tmp);
652 if (memcmp(plain,ofb_buf2,sizeof(ofb_buf2)) != 0)
653 {
654 printf("ofb_encrypt decrypt error\n");
655printf("%02X %02X %02X %02X %02X %02X %02X %02X\n",
656ofb_buf2[8+0], ofb_buf2[8+1], ofb_buf2[8+2], ofb_buf2[8+3],
657ofb_buf2[8+4], ofb_buf2[8+5], ofb_buf2[8+6], ofb_buf2[8+7]);
658printf("%02X %02X %02X %02X %02X %02X %02X %02X\n",
659plain[8+0], plain[8+1], plain[8+2], plain[8+3],
660plain[8+4], plain[8+5], plain[8+6], plain[8+7]);
661 err=1;
662 }
663
664 printf("Doing ofb64\n");
665 DES_set_key_checked(&ofb_key,&ks);
666 memcpy(ofb_tmp,ofb_iv,sizeof(ofb_iv));
667 memset(ofb_buf1,0,sizeof(ofb_buf1));
668 memset(ofb_buf2,0,sizeof(ofb_buf1));
669 num=0;
670 for (i=0; i<sizeof(plain); i++)
671 {
672 des_ofb64_encrypt(&(plain[i]),&(ofb_buf1[i]),1,ks,&ofb_tmp,
673 &num);
674 }
675 if (memcmp(ofb_cipher,ofb_buf1,sizeof(ofb_buf1)) != 0)
676 {
677 printf("ofb64_encrypt encrypt error\n");
678 err=1;
679 }
680 memcpy(ofb_tmp,ofb_iv,sizeof(ofb_iv));
681 num=0;
682 des_ofb64_encrypt(ofb_buf1,ofb_buf2,sizeof(ofb_buf1),ks,&ofb_tmp,
683 &num);
684 if (memcmp(plain,ofb_buf2,sizeof(ofb_buf2)) != 0)
685 {
686 printf("ofb64_encrypt decrypt error\n");
687 err=1;
688 }
689
690 printf("Doing ede_ofb64\n");
691 DES_set_key_checked(&ofb_key,&ks);
692 memcpy(ofb_tmp,ofb_iv,sizeof(ofb_iv));
693 memset(ofb_buf1,0,sizeof(ofb_buf1));
694 memset(ofb_buf2,0,sizeof(ofb_buf1));
695 num=0;
696 for (i=0; i<sizeof(plain); i++)
697 {
698 des_ede3_ofb64_encrypt(&(plain[i]),&(ofb_buf1[i]),1,ks,ks,
699 ks,&ofb_tmp,&num);
700 }
701 if (memcmp(ofb_cipher,ofb_buf1,sizeof(ofb_buf1)) != 0)
702 {
703 printf("ede_ofb64_encrypt encrypt error\n");
704 err=1;
705 }
706 memcpy(ofb_tmp,ofb_iv,sizeof(ofb_iv));
707 num=0;
708 des_ede3_ofb64_encrypt(ofb_buf1,ofb_buf2,sizeof(ofb_buf1),ks,ks,ks,
709 &ofb_tmp,&num);
710 if (memcmp(plain,ofb_buf2,sizeof(ofb_buf2)) != 0)
711 {
712 printf("ede_ofb64_encrypt decrypt error\n");
713 err=1;
714 }
715
716 printf("Doing cbc_cksum\n");
717 DES_set_key_checked(&cbc_key,&ks);
718 cs=des_cbc_cksum(cbc_data,&cret,strlen((char *)cbc_data),ks,&cbc_iv);
719 if (cs != cbc_cksum_ret)
720 {
721 printf("bad return value (%08lX), should be %08lX\n",
722 (unsigned long)cs,(unsigned long)cbc_cksum_ret);
723 err=1;
724 }
725 if (memcmp(cret,cbc_cksum_data,8) != 0)
726 {
727 printf("bad cbc_cksum block returned\n");
728 err=1;
729 }
730
731 printf("Doing quad_cksum\n");
732 cs=des_quad_cksum(cbc_data,(des_cblock *)lqret,
733 (long)strlen((char *)cbc_data),2,(des_cblock *)cbc_iv);
734 if (cs != 0x70d7a63aL)
735 {
736 printf("quad_cksum error, ret %08lx should be 70d7a63a\n",
737 (unsigned long)cs);
738 err=1;
739 }
740#ifdef _CRAY
741 if (lqret[0].a != 0x327eba8dL)
742 {
743 printf("quad_cksum error, out[0] %08lx is not %08lx\n",
744 (unsigned long)lqret[0].a,0x327eba8dUL);
745 err=1;
746 }
747 if (lqret[0].b != 0x201a49ccL)
748 {
749 printf("quad_cksum error, out[1] %08lx is not %08lx\n",
750 (unsigned long)lqret[0].b,0x201a49ccUL);
751 err=1;
752 }
753 if (lqret[1].a != 0x70d7a63aL)
754 {
755 printf("quad_cksum error, out[2] %08lx is not %08lx\n",
756 (unsigned long)lqret[1].a,0x70d7a63aUL);
757 err=1;
758 }
759 if (lqret[1].b != 0x501c2c26L)
760 {
761 printf("quad_cksum error, out[3] %08lx is not %08lx\n",
762 (unsigned long)lqret[1].b,0x501c2c26UL);
763 err=1;
764 }
765#else
766 if (lqret[0] != 0x327eba8dL)
767 {
768 printf("quad_cksum error, out[0] %08lx is not %08lx\n",
769 (unsigned long)lqret[0],0x327eba8dUL);
770 err=1;
771 }
772 if (lqret[1] != 0x201a49ccL)
773 {
774 printf("quad_cksum error, out[1] %08lx is not %08lx\n",
775 (unsigned long)lqret[1],0x201a49ccUL);
776 err=1;
777 }
778 if (lqret[2] != 0x70d7a63aL)
779 {
780 printf("quad_cksum error, out[2] %08lx is not %08lx\n",
781 (unsigned long)lqret[2],0x70d7a63aUL);
782 err=1;
783 }
784 if (lqret[3] != 0x501c2c26L)
785 {
786 printf("quad_cksum error, out[3] %08lx is not %08lx\n",
787 (unsigned long)lqret[3],0x501c2c26UL);
788 err=1;
789 }
790#endif
791#endif
792
793 printf("input word alignment test");
794 for (i=0; i<4; i++)
795 {
796 printf(" %d",i);
797 des_ncbc_encrypt(&(cbc_out[i]),cbc_in,
798 strlen((char *)cbc_data)+1,ks,
799 &cbc_iv,DES_ENCRYPT);
800 }
801 printf("\noutput word alignment test");
802 for (i=0; i<4; i++)
803 {
804 printf(" %d",i);
805 des_ncbc_encrypt(cbc_out,&(cbc_in[i]),
806 strlen((char *)cbc_data)+1,ks,
807 &cbc_iv,DES_ENCRYPT);
808 }
809 printf("\n");
810 printf("fast crypt test ");
811 str=crypt("testing","ef");
812 if (strcmp("efGnQx2725bI2",str) != 0)
813 {
814 printf("fast crypt error, %s should be efGnQx2725bI2\n",str);
815 err=1;
816 }
817 str=crypt("bca76;23","yA");
818 if (strcmp("yA1Rp/1hZXIJk",str) != 0)
819 {
820 printf("fast crypt error, %s should be yA1Rp/1hZXIJk\n",str);
821 err=1;
822 }
823 printf("\n");
824 return(err);
825 }
826
827static char *pt(unsigned char *p)
828 {
829 static char bufs[10][20];
830 static int bnum=0;
831 char *ret;
832 int i;
833 static char *f="0123456789ABCDEF";
834
835 ret= &(bufs[bnum++][0]);
836 bnum%=10;
837 for (i=0; i<8; i++)
838 {
839 ret[i*2]=f[(p[i]>>4)&0xf];
840 ret[i*2+1]=f[p[i]&0xf];
841 }
842 ret[16]='\0';
843 return(ret);
844 }
845
846#ifndef LIBDES_LIT
847
848static int cfb_test(int bits, unsigned char *cfb_cipher)
849 {
850 des_key_schedule ks;
851 int i,err=0;
852
853 DES_set_key_checked(&cfb_key,&ks);
854 memcpy(cfb_tmp,cfb_iv,sizeof(cfb_iv));
855 des_cfb_encrypt(plain,cfb_buf1,bits,sizeof(plain),ks,&cfb_tmp,
856 DES_ENCRYPT);
857 if (memcmp(cfb_cipher,cfb_buf1,sizeof(plain)) != 0)
858 {
859 err=1;
860 printf("cfb_encrypt encrypt error\n");
861 for (i=0; i<24; i+=8)
862 printf("%s\n",pt(&(cfb_buf1[i])));
863 }
864 memcpy(cfb_tmp,cfb_iv,sizeof(cfb_iv));
865 des_cfb_encrypt(cfb_buf1,cfb_buf2,bits,sizeof(plain),ks,&cfb_tmp,
866 DES_DECRYPT);
867 if (memcmp(plain,cfb_buf2,sizeof(plain)) != 0)
868 {
869 err=1;
870 printf("cfb_encrypt decrypt error\n");
871 for (i=0; i<24; i+=8)
872 printf("%s\n",pt(&(cfb_buf1[i])));
873 }
874 return(err);
875 }
876
877static int cfb64_test(unsigned char *cfb_cipher)
878 {
879 des_key_schedule ks;
880 int err=0,i,n;
881
882 DES_set_key_checked(&cfb_key,&ks);
883 memcpy(cfb_tmp,cfb_iv,sizeof(cfb_iv));
884 n=0;
885 des_cfb64_encrypt(plain,cfb_buf1,12,ks,&cfb_tmp,&n,DES_ENCRYPT);
886 des_cfb64_encrypt(&(plain[12]),&(cfb_buf1[12]),sizeof(plain)-12,ks,
887 &cfb_tmp,&n,DES_ENCRYPT);
888 if (memcmp(cfb_cipher,cfb_buf1,sizeof(plain)) != 0)
889 {
890 err=1;
891 printf("cfb_encrypt encrypt error\n");
892 for (i=0; i<24; i+=8)
893 printf("%s\n",pt(&(cfb_buf1[i])));
894 }
895 memcpy(cfb_tmp,cfb_iv,sizeof(cfb_iv));
896 n=0;
897 des_cfb64_encrypt(cfb_buf1,cfb_buf2,17,ks,&cfb_tmp,&n,DES_DECRYPT);
898 des_cfb64_encrypt(&(cfb_buf1[17]),&(cfb_buf2[17]),
899 sizeof(plain)-17,ks,&cfb_tmp,&n,DES_DECRYPT);
900 if (memcmp(plain,cfb_buf2,sizeof(plain)) != 0)
901 {
902 err=1;
903 printf("cfb_encrypt decrypt error\n");
904 for (i=0; i<24; i+=8)
905 printf("%s\n",pt(&(cfb_buf2[i])));
906 }
907 return(err);
908 }
909
910static int ede_cfb64_test(unsigned char *cfb_cipher)
911 {
912 des_key_schedule ks;
913 int err=0,i,n;
914
915 DES_set_key_checked(&cfb_key,&ks);
916 memcpy(cfb_tmp,cfb_iv,sizeof(cfb_iv));
917 n=0;
918 des_ede3_cfb64_encrypt(plain,cfb_buf1,12,ks,ks,ks,&cfb_tmp,&n,
919 DES_ENCRYPT);
920 des_ede3_cfb64_encrypt(&(plain[12]),&(cfb_buf1[12]),
921 sizeof(plain)-12,ks,ks,ks,
922 &cfb_tmp,&n,DES_ENCRYPT);
923 if (memcmp(cfb_cipher,cfb_buf1,sizeof(plain)) != 0)
924 {
925 err=1;
926 printf("ede_cfb_encrypt encrypt error\n");
927 for (i=0; i<24; i+=8)
928 printf("%s\n",pt(&(cfb_buf1[i])));
929 }
930 memcpy(cfb_tmp,cfb_iv,sizeof(cfb_iv));
931 n=0;
932 des_ede3_cfb64_encrypt(cfb_buf1,cfb_buf2,(long)17,ks,ks,ks,
933 &cfb_tmp,&n,DES_DECRYPT);
934 des_ede3_cfb64_encrypt(&(cfb_buf1[17]),&(cfb_buf2[17]),
935 sizeof(plain)-17,ks,ks,ks,
936 &cfb_tmp,&n,DES_DECRYPT);
937 if (memcmp(plain,cfb_buf2,sizeof(plain)) != 0)
938 {
939 err=1;
940 printf("ede_cfb_encrypt decrypt error\n");
941 for (i=0; i<24; i+=8)
942 printf("%s\n",pt(&(cfb_buf2[i])));
943 }
944 return(err);
945 }
946
947#endif
948#endif
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..3a63c4016c
--- /dev/null
+++ b/src/lib/libcrypto/des/read2pwd.c
@@ -0,0 +1,139 @@
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
116int DES_read_password(DES_cblock *key, const char *prompt, int verify)
117 {
118 int ok;
119 char buf[BUFSIZ],buff[BUFSIZ];
120
121 if ((ok=UI_UTIL_read_pw(buf,buff,BUFSIZ,prompt,verify)) == 0)
122 DES_string_to_key(buf,key);
123 OPENSSL_cleanse(buf,BUFSIZ);
124 OPENSSL_cleanse(buff,BUFSIZ);
125 return(ok);
126 }
127
128int DES_read_2passwords(DES_cblock *key1, DES_cblock *key2, const char *prompt,
129 int verify)
130 {
131 int ok;
132 char buf[BUFSIZ],buff[BUFSIZ];
133
134 if ((ok=UI_UTIL_read_pw(buf,buff,BUFSIZ,prompt,verify)) == 0)
135 DES_string_to_2keys(buf,key1,key2);
136 OPENSSL_cleanse(buf,BUFSIZ);
137 OPENSSL_cleanse(buff,BUFSIZ);
138 return(ok);
139 }
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..4cbb4d2dcd
--- /dev/null
+++ b/src/lib/libcrypto/des/rpc_des.h
@@ -0,0 +1,131 @@
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 * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
62 * unrestricted use provided that this legend is included on all tape
63 * media and as a part of the software program in whole or part. Users
64 * may copy or modify Sun RPC without charge, but are not authorized
65 * to license or distribute it to anyone else except as part of a product or
66 * program developed by the user.
67 *
68 * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
69 * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
70 * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
71 *
72 * Sun RPC is provided with no support and without any obligation on the
73 * part of Sun Microsystems, Inc. to assist in its use, correction,
74 * modification or enhancement.
75 *
76 * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
77 * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
78 * OR ANY PART THEREOF.
79 *
80 * In no event will Sun Microsystems, Inc. be liable for any lost revenue
81 * or profits or other special, indirect and consequential damages, even if
82 * Sun has been advised of the possibility of such damages.
83 *
84 * Sun Microsystems, Inc.
85 * 2550 Garcia Avenue
86 * Mountain View, California 94043
87 */
88/*
89 * Generic DES driver interface
90 * Keep this file hardware independent!
91 * Copyright (c) 1986 by Sun Microsystems, Inc.
92 */
93
94#define DES_MAXLEN 65536 /* maximum # of bytes to encrypt */
95#define DES_QUICKLEN 16 /* maximum # of bytes to encrypt quickly */
96
97#ifdef HEADER_DES_H
98#undef ENCRYPT
99#undef DECRYPT
100#endif
101
102enum desdir { ENCRYPT, DECRYPT };
103enum desmode { CBC, ECB };
104
105/*
106 * parameters to ioctl call
107 */
108struct desparams {
109 unsigned char des_key[8]; /* key (with low bit parity) */
110 enum desdir des_dir; /* direction */
111 enum desmode des_mode; /* mode */
112 unsigned char des_ivec[8]; /* input vector */
113 unsigned des_len; /* number of bytes to crypt */
114 union {
115 unsigned char UDES_data[DES_QUICKLEN];
116 unsigned char *UDES_buf;
117 } UDES;
118# define des_data UDES.UDES_data /* direct data here if quick */
119# define des_buf UDES.UDES_buf /* otherwise, pointer to data */
120};
121
122/*
123 * Encrypt an arbitrary sized buffer
124 */
125#define DESIOCBLOCK _IOWR(d, 6, struct desparams)
126
127/*
128 * Encrypt of small amount of data, quickly
129 */
130#define DESIOCQUICK _IOWR(d, 7, struct desparams)
131
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/speed.c b/src/lib/libcrypto/des/speed.c
new file mode 100644
index 0000000000..48fc1d49fc
--- /dev/null
+++ b/src/lib/libcrypto/des/speed.c
@@ -0,0 +1,310 @@
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#include <signal.h>
73#ifndef _IRIX
74#include <time.h>
75#endif
76#ifdef TIMES
77#include <sys/types.h>
78#include <sys/times.h>
79#endif
80
81/* Depending on the VMS version, the tms structure is perhaps defined.
82 The __TMS macro will show if it was. If it wasn't defined, we should
83 undefine TIMES, since that tells the rest of the program how things
84 should be handled. -- Richard Levitte */
85#if defined(OPENSSL_SYS_VMS_DECC) && !defined(__TMS)
86#undef TIMES
87#endif
88
89#ifndef TIMES
90#include <sys/timeb.h>
91#endif
92
93#if defined(sun) || defined(__ultrix)
94#define _POSIX_SOURCE
95#include <limits.h>
96#include <sys/param.h>
97#endif
98
99#include <openssl/des.h>
100
101/* The following if from times(3) man page. It may need to be changed */
102#ifndef HZ
103# ifndef CLK_TCK
104# ifndef _BSD_CLK_TCK_ /* FreeBSD fix */
105# define HZ 100.0
106# else /* _BSD_CLK_TCK_ */
107# define HZ ((double)_BSD_CLK_TCK_)
108# endif
109# else /* CLK_TCK */
110# define HZ ((double)CLK_TCK)
111# endif
112#endif
113
114#define BUFSIZE ((long)1024)
115long run=0;
116
117double Time_F(int s);
118#ifdef SIGALRM
119#if defined(__STDC__) || defined(sgi) || defined(_AIX)
120#define SIGRETTYPE void
121#else
122#define SIGRETTYPE int
123#endif
124
125SIGRETTYPE sig_done(int sig);
126SIGRETTYPE sig_done(int sig)
127 {
128 signal(SIGALRM,sig_done);
129 run=0;
130#ifdef LINT
131 sig=sig;
132#endif
133 }
134#endif
135
136#define START 0
137#define STOP 1
138
139double Time_F(int s)
140 {
141 double ret;
142#ifdef TIMES
143 static struct tms tstart,tend;
144
145 if (s == START)
146 {
147 times(&tstart);
148 return(0);
149 }
150 else
151 {
152 times(&tend);
153 ret=((double)(tend.tms_utime-tstart.tms_utime))/HZ;
154 return((ret == 0.0)?1e-6:ret);
155 }
156#else /* !times() */
157 static struct timeb tstart,tend;
158 long i;
159
160 if (s == START)
161 {
162 ftime(&tstart);
163 return(0);
164 }
165 else
166 {
167 ftime(&tend);
168 i=(long)tend.millitm-(long)tstart.millitm;
169 ret=((double)(tend.time-tstart.time))+((double)i)/1e3;
170 return((ret == 0.0)?1e-6:ret);
171 }
172#endif
173 }
174
175int main(int argc, char **argv)
176 {
177 long count;
178 static unsigned char buf[BUFSIZE];
179 static DES_cblock key ={0x12,0x34,0x56,0x78,0x9a,0xbc,0xde,0xf0};
180 static DES_cblock key2={0x34,0x56,0x78,0x9a,0xbc,0xde,0xf0,0x12};
181 static DES_cblock key3={0x56,0x78,0x9a,0xbc,0xde,0xf0,0x12,0x34};
182 DES_key_schedule sch,sch2,sch3;
183 double a,b,c,d,e;
184#ifndef SIGALRM
185 long ca,cb,cc,cd,ce;
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 DES_set_key_unchecked(&key2,&sch2);
194 DES_set_key_unchecked(&key3,&sch3);
195
196#ifndef SIGALRM
197 printf("First we calculate the approximate speed ...\n");
198 DES_set_key_unchecked(&key,&sch);
199 count=10;
200 do {
201 long i;
202 DES_LONG data[2];
203
204 count*=2;
205 Time_F(START);
206 for (i=count; i; i--)
207 DES_encrypt1(data,&sch,DES_ENCRYPT);
208 d=Time_F(STOP);
209 } while (d < 3.0);
210 ca=count;
211 cb=count*3;
212 cc=count*3*8/BUFSIZE+1;
213 cd=count*8/BUFSIZE+1;
214 ce=count/20+1;
215 printf("Doing set_key %ld times\n",ca);
216#define COND(d) (count != (d))
217#define COUNT(d) (d)
218#else
219#define COND(c) (run)
220#define COUNT(d) (count)
221 signal(SIGALRM,sig_done);
222 printf("Doing set_key for 10 seconds\n");
223 alarm(10);
224#endif
225
226 Time_F(START);
227 for (count=0,run=1; COND(ca); count++)
228 DES_set_key_unchecked(&key,&sch);
229 d=Time_F(STOP);
230 printf("%ld set_key's in %.2f seconds\n",count,d);
231 a=((double)COUNT(ca))/d;
232
233#ifdef SIGALRM
234 printf("Doing DES_encrypt's for 10 seconds\n");
235 alarm(10);
236#else
237 printf("Doing DES_encrypt %ld times\n",cb);
238#endif
239 Time_F(START);
240 for (count=0,run=1; COND(cb); count++)
241 {
242 DES_LONG data[2];
243
244 DES_encrypt1(data,&sch,DES_ENCRYPT);
245 }
246 d=Time_F(STOP);
247 printf("%ld DES_encrypt's in %.2f second\n",count,d);
248 b=((double)COUNT(cb)*8)/d;
249
250#ifdef SIGALRM
251 printf("Doing DES_cbc_encrypt on %ld byte blocks for 10 seconds\n",
252 BUFSIZE);
253 alarm(10);
254#else
255 printf("Doing DES_cbc_encrypt %ld times on %ld byte blocks\n",cc,
256 BUFSIZE);
257#endif
258 Time_F(START);
259 for (count=0,run=1; COND(cc); count++)
260 DES_ncbc_encrypt(buf,buf,BUFSIZE,&sch,
261 &key,DES_ENCRYPT);
262 d=Time_F(STOP);
263 printf("%ld DES_cbc_encrypt's of %ld byte blocks in %.2f second\n",
264 count,BUFSIZE,d);
265 c=((double)COUNT(cc)*BUFSIZE)/d;
266
267#ifdef SIGALRM
268 printf("Doing DES_ede_cbc_encrypt on %ld byte blocks for 10 seconds\n",
269 BUFSIZE);
270 alarm(10);
271#else
272 printf("Doing DES_ede_cbc_encrypt %ld times on %ld byte blocks\n",cd,
273 BUFSIZE);
274#endif
275 Time_F(START);
276 for (count=0,run=1; COND(cd); count++)
277 DES_ede3_cbc_encrypt(buf,buf,BUFSIZE,
278 &sch,
279 &sch2,
280 &sch3,
281 &key,
282 DES_ENCRYPT);
283 d=Time_F(STOP);
284 printf("%ld DES_ede_cbc_encrypt's of %ld byte blocks in %.2f second\n",
285 count,BUFSIZE,d);
286 d=((double)COUNT(cd)*BUFSIZE)/d;
287
288#ifdef SIGALRM
289 printf("Doing crypt for 10 seconds\n");
290 alarm(10);
291#else
292 printf("Doing crypt %ld times\n",ce);
293#endif
294 Time_F(START);
295 for (count=0,run=1; COND(ce); count++)
296 crypt("testing1","ef");
297 e=Time_F(STOP);
298 printf("%ld crypts in %.2f second\n",count,e);
299 e=((double)COUNT(ce))/e;
300
301 printf("set_key per sec = %12.2f (%9.3fuS)\n",a,1.0e6/a);
302 printf("DES raw ecb bytes per sec = %12.2f (%9.3fuS)\n",b,8.0e6/b);
303 printf("DES cbc bytes per sec = %12.2f (%9.3fuS)\n",c,8.0e6/c);
304 printf("DES ede cbc bytes per sec = %12.2f (%9.3fuS)\n",d,8.0e6/d);
305 printf("crypt per sec = %12.2f (%9.3fuS)\n",e,1.0e6/e);
306 exit(0);
307#if defined(LINT) || defined(OPENSSL_SYS_MSDOS)
308 return(0);
309#endif
310 }
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..352678b94a
--- /dev/null
+++ b/src/lib/libcrypto/dh/Makefile
@@ -0,0 +1,131 @@
1#
2# OpenSSL/crypto/dh/Makefile
3#
4
5DIR= dh
6TOP= ../..
7CC= cc
8INCLUDES= -I.. -I$(TOP) -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
18CFLAGS= $(INCLUDES) $(CFLAG)
19
20GENERAL=Makefile
21TEST= dhtest.c
22APPS=
23
24LIB=$(TOP)/libcrypto.a
25LIBSRC= dh_asn1.c dh_gen.c dh_key.c dh_lib.c dh_check.c dh_err.c
26LIBOBJ= dh_asn1.o dh_gen.o dh_key.o dh_lib.o dh_check.o dh_err.o
27
28SRC= $(LIBSRC)
29
30EXHEADER= dh.h
31HEADER= $(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
45files:
46 $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
47
48links:
49 @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
50 @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
51 @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
52
53install:
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 $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(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 */*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
77
78# DO NOT DELETE THIS LINE -- make depend depends on it.
79
80dh_asn1.o: ../../e_os.h ../../include/openssl/asn1.h
81dh_asn1.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
82dh_asn1.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
83dh_asn1.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
84dh_asn1.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
85dh_asn1.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
86dh_asn1.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
87dh_asn1.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
88dh_asn1.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
89dh_asn1.o: ../../include/openssl/symhacks.h ../cryptlib.h dh_asn1.c
90dh_check.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h
91dh_check.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
92dh_check.o: ../../include/openssl/dh.h ../../include/openssl/e_os2.h
93dh_check.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
94dh_check.o: ../../include/openssl/opensslconf.h
95dh_check.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
96dh_check.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
97dh_check.o: ../../include/openssl/symhacks.h ../cryptlib.h dh_check.c
98dh_err.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
99dh_err.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
100dh_err.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
101dh_err.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
102dh_err.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
103dh_err.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
104dh_err.o: ../../include/openssl/symhacks.h dh_err.c
105dh_gen.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h
106dh_gen.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
107dh_gen.o: ../../include/openssl/dh.h ../../include/openssl/e_os2.h
108dh_gen.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
109dh_gen.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
110dh_gen.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
111dh_gen.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
112dh_gen.o: ../cryptlib.h dh_gen.c
113dh_key.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h
114dh_key.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
115dh_key.o: ../../include/openssl/dh.h ../../include/openssl/e_os2.h
116dh_key.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
117dh_key.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
118dh_key.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rand.h
119dh_key.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
120dh_key.o: ../../include/openssl/symhacks.h ../cryptlib.h dh_key.c
121dh_lib.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
122dh_lib.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
123dh_lib.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
124dh_lib.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
125dh_lib.o: ../../include/openssl/engine.h ../../include/openssl/err.h
126dh_lib.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
127dh_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
128dh_lib.o: ../../include/openssl/rand.h ../../include/openssl/rsa.h
129dh_lib.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
130dh_lib.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
131dh_lib.o: ../cryptlib.h dh_lib.c
diff --git a/src/lib/libcrypto/dh/Makefile.ssl b/src/lib/libcrypto/dh/Makefile.ssl
new file mode 100644
index 0000000000..e05fc01a12
--- /dev/null
+++ b/src/lib/libcrypto/dh/Makefile.ssl
@@ -0,0 +1,133 @@
1#
2# SSLeay/crypto/dh/Makefile
3#
4
5DIR= dh
6TOP= ../..
7CC= cc
8INCLUDES= -I.. -I$(TOP) -I../../include
9CFLAG=-g
10INSTALL_PREFIX=
11OPENSSLDIR= /usr/local/ssl
12INSTALLTOP=/usr/local/ssl
13MAKE= make -f Makefile.ssl
14MAKEDEPPROG= makedepend
15MAKEDEPEND= $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG)
16MAKEFILE= Makefile.ssl
17AR= ar r
18
19CFLAGS= $(INCLUDES) $(CFLAG)
20
21GENERAL=Makefile
22TEST= dhtest.c
23APPS=
24
25LIB=$(TOP)/libcrypto.a
26LIBSRC= dh_asn1.c dh_gen.c dh_key.c dh_lib.c dh_check.c dh_err.c
27LIBOBJ= dh_asn1.o dh_gen.o dh_key.o dh_lib.o dh_check.o dh_err.o
28
29SRC= $(LIBSRC)
30
31EXHEADER= dh.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.ssl >> $(TOP)/MINFO
48
49links:
50 @sh $(TOP)/util/point.sh Makefile.ssl Makefile
51 @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
52 @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
53 @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
54
55install:
56 @for i in $(EXHEADER) ; \
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 $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
72
73dclean:
74 $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
75 mv -f Makefile.new $(MAKEFILE)
76
77clean:
78 rm -f *.o */*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
79
80# DO NOT DELETE THIS LINE -- make depend depends on it.
81
82dh_asn1.o: ../../e_os.h ../../include/openssl/asn1.h
83dh_asn1.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
84dh_asn1.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
85dh_asn1.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
86dh_asn1.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
87dh_asn1.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
88dh_asn1.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
89dh_asn1.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
90dh_asn1.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
91dh_asn1.o: ../../include/openssl/symhacks.h ../cryptlib.h dh_asn1.c
92dh_check.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h
93dh_check.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
94dh_check.o: ../../include/openssl/dh.h ../../include/openssl/e_os2.h
95dh_check.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
96dh_check.o: ../../include/openssl/opensslconf.h
97dh_check.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
98dh_check.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
99dh_check.o: ../../include/openssl/symhacks.h ../cryptlib.h dh_check.c
100dh_err.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
101dh_err.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
102dh_err.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
103dh_err.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
104dh_err.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
105dh_err.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
106dh_err.o: ../../include/openssl/symhacks.h dh_err.c
107dh_gen.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h
108dh_gen.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
109dh_gen.o: ../../include/openssl/dh.h ../../include/openssl/e_os2.h
110dh_gen.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
111dh_gen.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
112dh_gen.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
113dh_gen.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
114dh_gen.o: ../cryptlib.h dh_gen.c
115dh_key.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h
116dh_key.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
117dh_key.o: ../../include/openssl/dh.h ../../include/openssl/e_os2.h
118dh_key.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
119dh_key.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
120dh_key.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rand.h
121dh_key.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
122dh_key.o: ../../include/openssl/symhacks.h ../cryptlib.h dh_key.c
123dh_lib.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
124dh_lib.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
125dh_lib.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
126dh_lib.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
127dh_lib.o: ../../include/openssl/engine.h ../../include/openssl/err.h
128dh_lib.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
129dh_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
130dh_lib.o: ../../include/openssl/rand.h ../../include/openssl/rsa.h
131dh_lib.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
132dh_lib.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
133dh_lib.o: ../cryptlib.h dh_lib.c
diff --git a/src/lib/libcrypto/dh/dh.h b/src/lib/libcrypto/dh/dh.h
index 92c7481e10..0aff7fe21f 100644
--- a/src/lib/libcrypto/dh/dh.h
+++ b/src/lib/libcrypto/dh/dh.h
@@ -70,14 +70,7 @@
70#include <openssl/crypto.h> 70#include <openssl/crypto.h>
71#include <openssl/ossl_typ.h> 71#include <openssl/ossl_typ.h>
72 72
73#define DH_FLAG_CACHE_MONT_P 0x01 73#define DH_FLAG_CACHE_MONT_P 0x01
74#define DH_FLAG_NO_EXP_CONSTTIME 0x02 /* new with 0.9.7h; the built-in DH
75 * implementation now uses constant time
76 * modular exponentiation for secret exponents
77 * by default. This flag causes the
78 * faster variable sliding window method to
79 * be used for all exponents.
80 */
81 74
82#ifdef __cplusplus 75#ifdef __cplusplus
83extern "C" { 76extern "C" {
@@ -108,7 +101,7 @@ struct dh_st
108 int version; 101 int version;
109 BIGNUM *p; 102 BIGNUM *p;
110 BIGNUM *g; 103 BIGNUM *g;
111 long length; /* optional */ 104 int length; /* optional */
112 BIGNUM *pub_key; /* g^x */ 105 BIGNUM *pub_key; /* g^x */
113 BIGNUM *priv_key; /* x */ 106 BIGNUM *priv_key; /* x */
114 107
@@ -137,6 +130,10 @@ struct dh_st
137#define DH_UNABLE_TO_CHECK_GENERATOR 0x04 130#define DH_UNABLE_TO_CHECK_GENERATOR 0x04
138#define DH_NOT_SUITABLE_GENERATOR 0x08 131#define DH_NOT_SUITABLE_GENERATOR 0x08
139 132
133/* DH_check_pub_key error codes */
134#define DH_CHECK_PUBKEY_TOO_SMALL 0x01
135#define DH_CHECK_PUBKEY_TOO_LARGE 0x02
136
140/* primes p where (p-1)/2 is prime too are called "safe"; we define 137/* primes p where (p-1)/2 is prime too are called "safe"; we define
141 this for backward compatibility: */ 138 this for backward compatibility: */
142#define DH_CHECK_P_NOT_STRONG_PRIME DH_CHECK_P_NOT_SAFE_PRIME 139#define DH_CHECK_P_NOT_STRONG_PRIME DH_CHECK_P_NOT_SAFE_PRIME
@@ -175,6 +172,7 @@ void *DH_get_ex_data(DH *d, int idx);
175DH * DH_generate_parameters(int prime_len,int generator, 172DH * DH_generate_parameters(int prime_len,int generator,
176 void (*callback)(int,int,void *),void *cb_arg); 173 void (*callback)(int,int,void *),void *cb_arg);
177int DH_check(const DH *dh,int *codes); 174int DH_check(const DH *dh,int *codes);
175int DH_check_pub_key(const DH *dh,const BIGNUM *pub_key, int *codes);
178int DH_generate_key(DH *dh); 176int DH_generate_key(DH *dh);
179int DH_compute_key(unsigned char *key,const BIGNUM *pub_key,DH *dh); 177int DH_compute_key(unsigned char *key,const BIGNUM *pub_key,DH *dh);
180DH * d2i_DHparams(DH **a,const unsigned char **pp, long length); 178DH * d2i_DHparams(DH **a,const unsigned char **pp, long length);
@@ -207,6 +205,7 @@ void ERR_load_DH_strings(void);
207/* Reason codes. */ 205/* Reason codes. */
208#define DH_R_BAD_GENERATOR 101 206#define DH_R_BAD_GENERATOR 101
209#define DH_R_NO_PRIVATE_VALUE 100 207#define DH_R_NO_PRIVATE_VALUE 100
208#define DH_R_INVALID_PUBKEY 102
210 209
211#ifdef __cplusplus 210#ifdef __cplusplus
212} 211}
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/dh_check.c b/src/lib/libcrypto/dh/dh_check.c
index a7e9920efb..17debff62d 100644
--- a/src/lib/libcrypto/dh/dh_check.c
+++ b/src/lib/libcrypto/dh/dh_check.c
@@ -121,4 +121,26 @@ err:
121 return(ok); 121 return(ok);
122 } 122 }
123 123
124int DH_check_pub_key(const DH *dh, const BIGNUM *pub_key, int *ret)
125 {
126 int ok=0;
127 BIGNUM *q=NULL;
128
129 *ret=0;
130 q=BN_new();
131 if (q == NULL) goto err;
132 BN_set_word(q,1);
133 if (BN_cmp(pub_key,q) <= 0)
134 *ret|=DH_CHECK_PUBKEY_TOO_SMALL;
135 BN_copy(q,dh->p);
136 BN_sub_word(q,1);
137 if (BN_cmp(pub_key,q) >= 0)
138 *ret|=DH_CHECK_PUBKEY_TOO_LARGE;
139
140 ok = 1;
141err:
142 if (q != NULL) BN_free(q);
143 return(ok);
144 }
145
124#endif 146#endif
diff --git a/src/lib/libcrypto/dh/dh_err.c b/src/lib/libcrypto/dh/dh_err.c
index 83ccb41221..914b8a9c53 100644
--- a/src/lib/libcrypto/dh/dh_err.c
+++ b/src/lib/libcrypto/dh/dh_err.c
@@ -1,6 +1,6 @@
1/* crypto/dh/dh_err.c */ 1/* crypto/dh/dh_err.c */
2/* ==================================================================== 2/* ====================================================================
3 * Copyright (c) 1999-2005 The OpenSSL Project. All rights reserved. 3 * Copyright (c) 1999-2003 The OpenSSL Project. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
@@ -64,25 +64,22 @@
64 64
65/* BEGIN ERROR CODES */ 65/* BEGIN ERROR CODES */
66#ifndef OPENSSL_NO_ERR 66#ifndef OPENSSL_NO_ERR
67
68#define ERR_FUNC(func) ERR_PACK(ERR_LIB_DH,func,0)
69#define ERR_REASON(reason) ERR_PACK(ERR_LIB_DH,0,reason)
70
71static ERR_STRING_DATA DH_str_functs[]= 67static ERR_STRING_DATA DH_str_functs[]=
72 { 68 {
73{ERR_FUNC(DH_F_DHPARAMS_PRINT), "DHparams_print"}, 69{ERR_PACK(0,DH_F_DHPARAMS_PRINT,0), "DHparams_print"},
74{ERR_FUNC(DH_F_DHPARAMS_PRINT_FP), "DHparams_print_fp"}, 70{ERR_PACK(0,DH_F_DHPARAMS_PRINT_FP,0), "DHparams_print_fp"},
75{ERR_FUNC(DH_F_DH_COMPUTE_KEY), "DH_compute_key"}, 71{ERR_PACK(0,DH_F_DH_COMPUTE_KEY,0), "DH_compute_key"},
76{ERR_FUNC(DH_F_DH_GENERATE_KEY), "DH_generate_key"}, 72{ERR_PACK(0,DH_F_DH_GENERATE_KEY,0), "DH_generate_key"},
77{ERR_FUNC(DH_F_DH_GENERATE_PARAMETERS), "DH_generate_parameters"}, 73{ERR_PACK(0,DH_F_DH_GENERATE_PARAMETERS,0), "DH_generate_parameters"},
78{ERR_FUNC(DH_F_DH_NEW_METHOD), "DH_new_method"}, 74{ERR_PACK(0,DH_F_DH_NEW_METHOD,0), "DH_new_method"},
79{0,NULL} 75{0,NULL}
80 }; 76 };
81 77
82static ERR_STRING_DATA DH_str_reasons[]= 78static ERR_STRING_DATA DH_str_reasons[]=
83 { 79 {
84{ERR_REASON(DH_R_BAD_GENERATOR) ,"bad generator"}, 80{DH_R_BAD_GENERATOR ,"bad generator"},
85{ERR_REASON(DH_R_NO_PRIVATE_VALUE) ,"no private value"}, 81{DH_R_NO_PRIVATE_VALUE ,"no private value"},
82{DH_R_INVALID_PUBKEY ,"invalid public key"},
86{0,NULL} 83{0,NULL}
87 }; 84 };
88 85
@@ -96,8 +93,8 @@ void ERR_load_DH_strings(void)
96 { 93 {
97 init=0; 94 init=0;
98#ifndef OPENSSL_NO_ERR 95#ifndef OPENSSL_NO_ERR
99 ERR_load_strings(0,DH_str_functs); 96 ERR_load_strings(ERR_LIB_DH,DH_str_functs);
100 ERR_load_strings(0,DH_str_reasons); 97 ERR_load_strings(ERR_LIB_DH,DH_str_reasons);
101#endif 98#endif
102 99
103 } 100 }
diff --git a/src/lib/libcrypto/dh/dh_key.c b/src/lib/libcrypto/dh/dh_key.c
index 3a39f7c8ca..648766a6ec 100644
--- a/src/lib/libcrypto/dh/dh_key.c
+++ b/src/lib/libcrypto/dh/dh_key.c
@@ -105,7 +105,7 @@ static int generate_key(DH *dh)
105 int generate_new_key=0; 105 int generate_new_key=0;
106 unsigned l; 106 unsigned l;
107 BN_CTX *ctx; 107 BN_CTX *ctx;
108 BN_MONT_CTX *mont=NULL; 108 BN_MONT_CTX *mont;
109 BIGNUM *pub_key=NULL,*priv_key=NULL; 109 BIGNUM *pub_key=NULL,*priv_key=NULL;
110 110
111 ctx = BN_CTX_new(); 111 ctx = BN_CTX_new();
@@ -128,37 +128,21 @@ static int generate_key(DH *dh)
128 else 128 else
129 pub_key=dh->pub_key; 129 pub_key=dh->pub_key;
130 130
131 131 if ((dh->method_mont_p == NULL) && (dh->flags & DH_FLAG_CACHE_MONT_P))
132 if (dh->flags & DH_FLAG_CACHE_MONT_P)
133 { 132 {
134 mont = BN_MONT_CTX_set_locked( 133 if ((dh->method_mont_p=(char *)BN_MONT_CTX_new()) != NULL)
135 (BN_MONT_CTX **)&dh->method_mont_p, 134 if (!BN_MONT_CTX_set((BN_MONT_CTX *)dh->method_mont_p,
136 CRYPTO_LOCK_DH, dh->p, ctx); 135 dh->p,ctx)) goto err;
137 if (!mont)
138 goto err;
139 } 136 }
137 mont=(BN_MONT_CTX *)dh->method_mont_p;
140 138
141 if (generate_new_key) 139 if (generate_new_key)
142 { 140 {
143 l = dh->length ? dh->length : BN_num_bits(dh->p)-1; /* secret exponent length */ 141 l = dh->length ? dh->length : BN_num_bits(dh->p)-1; /* secret exponent length */
144 if (!BN_rand(priv_key, l, 0, 0)) goto err; 142 if (!BN_rand(priv_key, l, 0, 0)) goto err;
145 } 143 }
146 144 if (!dh->meth->bn_mod_exp(dh, pub_key, dh->g, priv_key,dh->p,ctx,mont))
147 { 145 goto err;
148 BIGNUM local_prk;
149 BIGNUM *prk;
150
151 if ((dh->flags & DH_FLAG_NO_EXP_CONSTTIME) == 0)
152 {
153 BN_init(&local_prk);
154 prk = &local_prk;
155 BN_with_flags(prk, priv_key, BN_FLG_EXP_CONSTTIME);
156 }
157 else
158 prk = priv_key;
159
160 if (!dh->meth->bn_mod_exp(dh, pub_key, dh->g, prk, dh->p, ctx, mont)) goto err;
161 }
162 146
163 dh->pub_key=pub_key; 147 dh->pub_key=pub_key;
164 dh->priv_key=priv_key; 148 dh->priv_key=priv_key;
@@ -176,9 +160,10 @@ err:
176static int compute_key(unsigned char *key, const BIGNUM *pub_key, DH *dh) 160static int compute_key(unsigned char *key, const BIGNUM *pub_key, DH *dh)
177 { 161 {
178 BN_CTX *ctx; 162 BN_CTX *ctx;
179 BN_MONT_CTX *mont=NULL; 163 BN_MONT_CTX *mont;
180 BIGNUM *tmp; 164 BIGNUM *tmp;
181 int ret= -1; 165 int ret= -1;
166 int check_result;
182 167
183 ctx = BN_CTX_new(); 168 ctx = BN_CTX_new();
184 if (ctx == NULL) goto err; 169 if (ctx == NULL) goto err;
@@ -190,21 +175,20 @@ static int compute_key(unsigned char *key, const BIGNUM *pub_key, DH *dh)
190 DHerr(DH_F_DH_COMPUTE_KEY,DH_R_NO_PRIVATE_VALUE); 175 DHerr(DH_F_DH_COMPUTE_KEY,DH_R_NO_PRIVATE_VALUE);
191 goto err; 176 goto err;
192 } 177 }
193 178 if ((dh->method_mont_p == NULL) && (dh->flags & DH_FLAG_CACHE_MONT_P))
194 if (dh->flags & DH_FLAG_CACHE_MONT_P)
195 { 179 {
196 mont = BN_MONT_CTX_set_locked( 180 if ((dh->method_mont_p=(char *)BN_MONT_CTX_new()) != NULL)
197 (BN_MONT_CTX **)&dh->method_mont_p, 181 if (!BN_MONT_CTX_set((BN_MONT_CTX *)dh->method_mont_p,
198 CRYPTO_LOCK_DH, dh->p, ctx); 182 dh->p,ctx)) goto err;
199 if ((dh->flags & DH_FLAG_NO_EXP_CONSTTIME) == 0)
200 {
201 /* XXX */
202 BN_set_flags(dh->priv_key, BN_FLG_EXP_CONSTTIME);
203 }
204 if (!mont)
205 goto err;
206 } 183 }
207 184
185 mont=(BN_MONT_CTX *)dh->method_mont_p;
186
187 if (!DH_check_pub_key(dh, pub_key, &check_result) || check_result)
188 {
189 DHerr(DH_F_DH_COMPUTE_KEY,DH_R_INVALID_PUBKEY);
190 goto err;
191 }
208 if (!dh->meth->bn_mod_exp(dh, tmp, pub_key, dh->priv_key,dh->p,ctx,mont)) 192 if (!dh->meth->bn_mod_exp(dh, tmp, pub_key, dh->priv_key,dh->p,ctx,mont))
209 { 193 {
210 DHerr(DH_F_DH_COMPUTE_KEY,ERR_R_BN_LIB); 194 DHerr(DH_F_DH_COMPUTE_KEY,ERR_R_BN_LIB);
@@ -213,11 +197,8 @@ static int compute_key(unsigned char *key, const BIGNUM *pub_key, DH *dh)
213 197
214 ret=BN_bn2bin(tmp,key); 198 ret=BN_bn2bin(tmp,key);
215err: 199err:
216 if (ctx != NULL) 200 BN_CTX_end(ctx);
217 { 201 BN_CTX_free(ctx);
218 BN_CTX_end(ctx);
219 BN_CTX_free(ctx);
220 }
221 return(ret); 202 return(ret);
222 } 203 }
223 204
@@ -226,10 +207,7 @@ static int dh_bn_mod_exp(const DH *dh, BIGNUM *r,
226 const BIGNUM *m, BN_CTX *ctx, 207 const BIGNUM *m, BN_CTX *ctx,
227 BN_MONT_CTX *m_ctx) 208 BN_MONT_CTX *m_ctx)
228 { 209 {
229 /* If a is only one word long and constant time is false, use the faster 210 if (a->top == 1)
230 * exponenentiation function.
231 */
232 if (a->top == 1 && ((dh->flags & DH_FLAG_NO_EXP_CONSTTIME) != 0))
233 { 211 {
234 BN_ULONG A = a->d[0]; 212 BN_ULONG A = a->d[0];
235 return BN_mod_exp_mont_word(r,A,p,m,ctx,m_ctx); 213 return BN_mod_exp_mont_word(r,A,p,m,ctx,m_ctx);
diff --git a/src/lib/libcrypto/dh/dhtest.c b/src/lib/libcrypto/dh/dhtest.c
new file mode 100644
index 0000000000..d75077f9fa
--- /dev/null
+++ b/src/lib/libcrypto/dh/dhtest.c
@@ -0,0 +1,212 @@
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#include <stdio.h>
60#include <stdlib.h>
61#include <string.h>
62
63#include "../e_os.h"
64
65#include <openssl/crypto.h>
66#include <openssl/bio.h>
67#include <openssl/bn.h>
68#include <openssl/rand.h>
69#include <openssl/err.h>
70
71#ifdef OPENSSL_NO_DH
72int main(int argc, char *argv[])
73{
74 printf("No DH support\n");
75 return(0);
76}
77#else
78#include <openssl/dh.h>
79
80#ifdef OPENSSL_SYS_WIN16
81#define MS_CALLBACK _far _loadds
82#else
83#define MS_CALLBACK
84#endif
85
86static void MS_CALLBACK cb(int p, int n, void *arg);
87
88static const char rnd_seed[] = "string to make the random number generator think it has entropy";
89
90int main(int argc, char *argv[])
91 {
92 DH *a;
93 DH *b=NULL;
94 char buf[12];
95 unsigned char *abuf=NULL,*bbuf=NULL;
96 int i,alen,blen,aout,bout,ret=1;
97 BIO *out;
98
99 CRYPTO_malloc_debug_init();
100 CRYPTO_dbg_set_options(V_CRYPTO_MDEBUG_ALL);
101 CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON);
102
103#ifdef OPENSSL_SYS_WIN32
104 CRYPTO_malloc_init();
105#endif
106
107 RAND_seed(rnd_seed, sizeof rnd_seed);
108
109 out=BIO_new(BIO_s_file());
110 if (out == NULL) EXIT(1);
111 BIO_set_fp(out,stdout,BIO_NOCLOSE);
112
113 a=DH_generate_parameters(64,DH_GENERATOR_5,cb,out);
114 if (a == NULL) goto err;
115
116 if (!DH_check(a, &i)) goto err;
117 if (i & DH_CHECK_P_NOT_PRIME)
118 BIO_puts(out, "p value is not prime\n");
119 if (i & DH_CHECK_P_NOT_SAFE_PRIME)
120 BIO_puts(out, "p value is not a safe prime\n");
121 if (i & DH_UNABLE_TO_CHECK_GENERATOR)
122 BIO_puts(out, "unable to check the generator value\n");
123 if (i & DH_NOT_SUITABLE_GENERATOR)
124 BIO_puts(out, "the g value is not a generator\n");
125
126 BIO_puts(out,"\np =");
127 BN_print(out,a->p);
128 BIO_puts(out,"\ng =");
129 BN_print(out,a->g);
130 BIO_puts(out,"\n");
131
132 b=DH_new();
133 if (b == NULL) goto err;
134
135 b->p=BN_dup(a->p);
136 b->g=BN_dup(a->g);
137 if ((b->p == NULL) || (b->g == NULL)) goto err;
138
139 if (!DH_generate_key(a)) goto err;
140 BIO_puts(out,"pri 1=");
141 BN_print(out,a->priv_key);
142 BIO_puts(out,"\npub 1=");
143 BN_print(out,a->pub_key);
144 BIO_puts(out,"\n");
145
146 if (!DH_generate_key(b)) goto err;
147 BIO_puts(out,"pri 2=");
148 BN_print(out,b->priv_key);
149 BIO_puts(out,"\npub 2=");
150 BN_print(out,b->pub_key);
151 BIO_puts(out,"\n");
152
153 alen=DH_size(a);
154 abuf=(unsigned char *)OPENSSL_malloc(alen);
155 aout=DH_compute_key(abuf,b->pub_key,a);
156
157 BIO_puts(out,"key1 =");
158 for (i=0; i<aout; i++)
159 {
160 sprintf(buf,"%02X",abuf[i]);
161 BIO_puts(out,buf);
162 }
163 BIO_puts(out,"\n");
164
165 blen=DH_size(b);
166 bbuf=(unsigned char *)OPENSSL_malloc(blen);
167 bout=DH_compute_key(bbuf,a->pub_key,b);
168
169 BIO_puts(out,"key2 =");
170 for (i=0; i<bout; i++)
171 {
172 sprintf(buf,"%02X",bbuf[i]);
173 BIO_puts(out,buf);
174 }
175 BIO_puts(out,"\n");
176 if ((aout < 4) || (bout != aout) || (memcmp(abuf,bbuf,aout) != 0))
177 {
178 fprintf(stderr,"Error in DH routines\n");
179 ret=1;
180 }
181 else
182 ret=0;
183err:
184 ERR_print_errors_fp(stderr);
185
186 if (abuf != NULL) OPENSSL_free(abuf);
187 if (bbuf != NULL) OPENSSL_free(bbuf);
188 if(b != NULL) DH_free(b);
189 if(a != NULL) DH_free(a);
190 BIO_free(out);
191 CRYPTO_cleanup_all_ex_data();
192 ERR_remove_state(0);
193 CRYPTO_mem_leaks_fp(stderr);
194 EXIT(ret);
195 return(ret);
196 }
197
198static void MS_CALLBACK cb(int p, int n, void *arg)
199 {
200 char c='*';
201
202 if (p == 0) c='.';
203 if (p == 1) c='+';
204 if (p == 2) c='*';
205 if (p == 3) c='\n';
206 BIO_write((BIO *)arg,&c,1);
207 (void)BIO_flush((BIO *)arg);
208#ifdef LINT
209 p=n;
210#endif
211 }
212#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/EVP_DigestInit.pod b/src/lib/libcrypto/doc/EVP_DigestInit.pod
index 1cb315e739..faa992286b 100644
--- a/src/lib/libcrypto/doc/EVP_DigestInit.pod
+++ b/src/lib/libcrypto/doc/EVP_DigestInit.pod
@@ -236,9 +236,9 @@ even though they are identical digests.
236 236
237=head1 SEE ALSO 237=head1 SEE ALSO
238 238
239L<evp(3)|evp(3)>, L<hmac(3)|hmac(3)>, L<md2(3)|md2(3)>, 239L<evp(3)|evp(3)>, L<HMAC(3)|HMAC(3)>, L<MD2(3)|MD2(3)>,
240L<md5(3)|md5(3)>, L<mdc2(3)|mdc2(3)>, L<ripemd(3)|ripemd(3)>, 240L<MD5(3)|MD5(3)>, L<MDC2(3)|MDC2(3)>, L<RIPEMD160(3)|RIPEMD160(3)>,
241L<sha(3)|sha(3)>, L<dgst(1)|dgst(1)> 241L<SHA1(3)|SHA1(3)>
242 242
243=head1 HISTORY 243=head1 HISTORY
244 244
diff --git a/src/lib/libcrypto/doc/EVP_EncryptInit.pod b/src/lib/libcrypto/doc/EVP_EncryptInit.pod
index 8271d3dfc4..40e525dd56 100644
--- a/src/lib/libcrypto/doc/EVP_EncryptInit.pod
+++ b/src/lib/libcrypto/doc/EVP_EncryptInit.pod
@@ -22,7 +22,7 @@ EVP_CIPHER_CTX_set_padding - EVP cipher routines
22 22
23 #include <openssl/evp.h> 23 #include <openssl/evp.h>
24 24
25 void EVP_CIPHER_CTX_init(EVP_CIPHER_CTX *a); 25 int EVP_CIPHER_CTX_init(EVP_CIPHER_CTX *a);
26 26
27 int EVP_EncryptInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type, 27 int EVP_EncryptInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type,
28 ENGINE *impl, unsigned char *key, unsigned char *iv); 28 ENGINE *impl, unsigned char *key, unsigned char *iv);
@@ -236,8 +236,8 @@ RC5 can be set.
236 236
237=head1 RETURN VALUES 237=head1 RETURN VALUES
238 238
239EVP_EncryptInit_ex(), EVP_EncryptUpdate() and EVP_EncryptFinal_ex() 239EVP_CIPHER_CTX_init, EVP_EncryptInit_ex(), EVP_EncryptUpdate() and
240return 1 for success and 0 for failure. 240EVP_EncryptFinal_ex() return 1 for success and 0 for failure.
241 241
242EVP_DecryptInit_ex() and EVP_DecryptUpdate() return 1 for success and 0 for failure. 242EVP_DecryptInit_ex() and EVP_DecryptUpdate() return 1 for success and 0 for failure.
243EVP_DecryptFinal_ex() returns 0 if the decrypt failed or 1 for success. 243EVP_DecryptFinal_ex() returns 0 if the decrypt failed or 1 for success.
diff --git a/src/lib/libcrypto/doc/EVP_SignInit.pod b/src/lib/libcrypto/doc/EVP_SignInit.pod
index b6e62ce7f6..0bace24938 100644
--- a/src/lib/libcrypto/doc/EVP_SignInit.pod
+++ b/src/lib/libcrypto/doc/EVP_SignInit.pod
@@ -80,10 +80,10 @@ EVP_SignUpdate() could not be made after calling EVP_SignFinal().
80=head1 SEE ALSO 80=head1 SEE ALSO
81 81
82L<EVP_VerifyInit(3)|EVP_VerifyInit(3)>, 82L<EVP_VerifyInit(3)|EVP_VerifyInit(3)>,
83L<EVP_DigestInit(3)|EVP_DigestInit(3)>, L<err(3)|err(3)>, 83L<EVP_DigestInit(3)|EVP_DigestInit(3)>, L<ERR_get_error(3)|ERR_get_error(3)>,
84L<evp(3)|evp(3)>, L<hmac(3)|hmac(3)>, L<md2(3)|md2(3)>, 84L<evp(3)|evp(3)>, L<HMAC(3)|HMAC(3)>, L<MD2(3)|MD2(3)>,
85L<md5(3)|md5(3)>, L<mdc2(3)|mdc2(3)>, L<ripemd(3)|ripemd(3)>, 85L<MD5(3)|MD5(3)>, L<MDC2(3)|MDC2(3)>, L<RIPEMD(3)|RIPEMD(3)>,
86L<sha(3)|sha(3)>, L<dgst(1)|dgst(1)> 86L<SHA1(3)|SHA1(3)>, L<digest(1)|digest(1)>
87 87
88=head1 HISTORY 88=head1 HISTORY
89 89
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..4f10278039
--- /dev/null
+++ b/src/lib/libcrypto/dsa/Makefile
@@ -0,0 +1,173 @@
1#
2# OpenSSL/crypto/dsa/Makefile
3#
4
5DIR= dsa
6TOP= ../..
7CC= cc
8INCLUDES= -I.. -I$(TOP) -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
18CFLAGS= $(INCLUDES) $(CFLAG)
19
20GENERAL=Makefile
21TEST=dsatest.c
22APPS=
23
24LIB=$(TOP)/libcrypto.a
25LIBSRC= dsa_gen.c dsa_key.c dsa_lib.c dsa_asn1.c dsa_vrf.c dsa_sign.c \
26 dsa_err.c dsa_ossl.c
27LIBOBJ= dsa_gen.o dsa_key.o dsa_lib.o dsa_asn1.o dsa_vrf.o dsa_sign.o \
28 dsa_err.o dsa_ossl.o
29
30SRC= $(LIBSRC)
31
32EXHEADER= dsa.h
33HEADER= $(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
47files:
48 $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
49
50links:
51 @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
52 @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
53 @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
54
55install:
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 $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
72
73dclean:
74 $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
75 mv -f Makefile.new $(MAKEFILE)
76
77clean:
78 rm -f *.o */*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
79
80# DO NOT DELETE THIS LINE -- make depend depends on it.
81
82dsa_asn1.o: ../../e_os.h ../../include/openssl/asn1.h
83dsa_asn1.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
84dsa_asn1.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
85dsa_asn1.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
86dsa_asn1.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
87dsa_asn1.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
88dsa_asn1.o: ../../include/openssl/opensslconf.h
89dsa_asn1.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
90dsa_asn1.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
91dsa_asn1.o: ../../include/openssl/symhacks.h ../cryptlib.h dsa_asn1.c
92dsa_err.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
93dsa_err.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
94dsa_err.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
95dsa_err.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
96dsa_err.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
97dsa_err.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
98dsa_err.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
99dsa_err.o: dsa_err.c
100dsa_gen.o: ../../e_os.h ../../include/openssl/aes.h
101dsa_gen.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
102dsa_gen.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
103dsa_gen.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
104dsa_gen.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
105dsa_gen.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
106dsa_gen.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
107dsa_gen.o: ../../include/openssl/err.h ../../include/openssl/evp.h
108dsa_gen.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
109dsa_gen.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
110dsa_gen.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
111dsa_gen.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
112dsa_gen.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
113dsa_gen.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rand.h
114dsa_gen.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
115dsa_gen.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
116dsa_gen.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
117dsa_gen.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
118dsa_gen.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
119dsa_gen.o: ../../include/openssl/ui_compat.h ../cryptlib.h dsa_gen.c
120dsa_key.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h
121dsa_key.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
122dsa_key.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
123dsa_key.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
124dsa_key.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
125dsa_key.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
126dsa_key.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h
127dsa_key.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
128dsa_key.o: ../cryptlib.h dsa_key.c
129dsa_lib.o: ../../e_os.h ../../include/openssl/asn1.h
130dsa_lib.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
131dsa_lib.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
132dsa_lib.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
133dsa_lib.o: ../../include/openssl/e_os2.h ../../include/openssl/engine.h
134dsa_lib.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
135dsa_lib.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
136dsa_lib.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rand.h
137dsa_lib.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
138dsa_lib.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
139dsa_lib.o: ../../include/openssl/ui.h ../cryptlib.h dsa_lib.c
140dsa_ossl.o: ../../e_os.h ../../include/openssl/asn1.h
141dsa_ossl.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
142dsa_ossl.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
143dsa_ossl.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
144dsa_ossl.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
145dsa_ossl.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
146dsa_ossl.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
147dsa_ossl.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h
148dsa_ossl.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
149dsa_ossl.o: ../cryptlib.h dsa_ossl.c
150dsa_sign.o: ../../e_os.h ../../include/openssl/asn1.h
151dsa_sign.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
152dsa_sign.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
153dsa_sign.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
154dsa_sign.o: ../../include/openssl/e_os2.h ../../include/openssl/engine.h
155dsa_sign.o: ../../include/openssl/err.h ../../include/openssl/fips.h
156dsa_sign.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
157dsa_sign.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
158dsa_sign.o: ../../include/openssl/rand.h ../../include/openssl/rsa.h
159dsa_sign.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
160dsa_sign.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
161dsa_sign.o: ../cryptlib.h dsa_sign.c
162dsa_vrf.o: ../../e_os.h ../../include/openssl/asn1.h
163dsa_vrf.o: ../../include/openssl/asn1_mac.h ../../include/openssl/bio.h
164dsa_vrf.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
165dsa_vrf.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
166dsa_vrf.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
167dsa_vrf.o: ../../include/openssl/engine.h ../../include/openssl/err.h
168dsa_vrf.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
169dsa_vrf.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
170dsa_vrf.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rand.h
171dsa_vrf.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
172dsa_vrf.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
173dsa_vrf.o: ../../include/openssl/ui.h ../cryptlib.h dsa_vrf.c
diff --git a/src/lib/libcrypto/dsa/Makefile.ssl b/src/lib/libcrypto/dsa/Makefile.ssl
new file mode 100644
index 0000000000..e5f8a8cf51
--- /dev/null
+++ b/src/lib/libcrypto/dsa/Makefile.ssl
@@ -0,0 +1,171 @@
1#
2# SSLeay/crypto/dsa/Makefile
3#
4
5DIR= dsa
6TOP= ../..
7CC= cc
8INCLUDES= -I.. -I$(TOP) -I../../include
9CFLAG=-g
10INSTALL_PREFIX=
11OPENSSLDIR= /usr/local/ssl
12INSTALLTOP=/usr/local/ssl
13MAKE= make -f Makefile.ssl
14MAKEDEPPROG= makedepend
15MAKEDEPEND= $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG)
16MAKEFILE= Makefile.ssl
17AR= ar r
18
19CFLAGS= $(INCLUDES) $(CFLAG)
20
21GENERAL=Makefile
22TEST=dsatest.c
23APPS=
24
25LIB=$(TOP)/libcrypto.a
26LIBSRC= dsa_gen.c dsa_key.c dsa_lib.c dsa_asn1.c dsa_vrf.c dsa_sign.c \
27 dsa_err.c dsa_ossl.c
28LIBOBJ= dsa_gen.o dsa_key.o dsa_lib.o dsa_asn1.o dsa_vrf.o dsa_sign.o \
29 dsa_err.o dsa_ossl.o
30
31SRC= $(LIBSRC)
32
33EXHEADER= dsa.h
34HEADER= $(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
48files:
49 $(PERL) $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO
50
51links:
52 @sh $(TOP)/util/point.sh Makefile.ssl Makefile
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 @for i in $(EXHEADER) ; \
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 $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
74
75dclean:
76 $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
77 mv -f Makefile.new $(MAKEFILE)
78
79clean:
80 rm -f *.o */*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
81
82# DO NOT DELETE THIS LINE -- make depend depends on it.
83
84dsa_asn1.o: ../../e_os.h ../../include/openssl/asn1.h
85dsa_asn1.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
86dsa_asn1.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
87dsa_asn1.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
88dsa_asn1.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
89dsa_asn1.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
90dsa_asn1.o: ../../include/openssl/opensslconf.h
91dsa_asn1.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
92dsa_asn1.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
93dsa_asn1.o: ../../include/openssl/symhacks.h ../cryptlib.h dsa_asn1.c
94dsa_err.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
95dsa_err.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
96dsa_err.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
97dsa_err.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
98dsa_err.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
99dsa_err.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
100dsa_err.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
101dsa_err.o: dsa_err.c
102dsa_gen.o: ../../e_os.h ../../include/openssl/aes.h
103dsa_gen.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
104dsa_gen.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
105dsa_gen.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
106dsa_gen.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
107dsa_gen.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
108dsa_gen.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
109dsa_gen.o: ../../include/openssl/err.h ../../include/openssl/evp.h
110dsa_gen.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
111dsa_gen.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
112dsa_gen.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
113dsa_gen.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
114dsa_gen.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
115dsa_gen.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rand.h
116dsa_gen.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
117dsa_gen.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
118dsa_gen.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
119dsa_gen.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
120dsa_gen.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
121dsa_gen.o: ../../include/openssl/ui_compat.h ../cryptlib.h dsa_gen.c
122dsa_key.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h
123dsa_key.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
124dsa_key.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
125dsa_key.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
126dsa_key.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
127dsa_key.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
128dsa_key.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h
129dsa_key.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
130dsa_key.o: ../cryptlib.h dsa_key.c
131dsa_lib.o: ../../e_os.h ../../include/openssl/asn1.h
132dsa_lib.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
133dsa_lib.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
134dsa_lib.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
135dsa_lib.o: ../../include/openssl/e_os2.h ../../include/openssl/engine.h
136dsa_lib.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
137dsa_lib.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
138dsa_lib.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rand.h
139dsa_lib.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
140dsa_lib.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
141dsa_lib.o: ../../include/openssl/ui.h ../cryptlib.h dsa_lib.c
142dsa_ossl.o: ../../e_os.h ../../include/openssl/asn1.h
143dsa_ossl.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
144dsa_ossl.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
145dsa_ossl.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
146dsa_ossl.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
147dsa_ossl.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
148dsa_ossl.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
149dsa_ossl.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h
150dsa_ossl.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
151dsa_ossl.o: ../cryptlib.h dsa_ossl.c
152dsa_sign.o: ../../e_os.h ../../include/openssl/asn1.h
153dsa_sign.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
154dsa_sign.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
155dsa_sign.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
156dsa_sign.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
157dsa_sign.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
158dsa_sign.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
159dsa_sign.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h
160dsa_sign.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
161dsa_sign.o: ../cryptlib.h dsa_sign.c
162dsa_vrf.o: ../../e_os.h ../../include/openssl/asn1.h
163dsa_vrf.o: ../../include/openssl/asn1_mac.h ../../include/openssl/bio.h
164dsa_vrf.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
165dsa_vrf.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
166dsa_vrf.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
167dsa_vrf.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
168dsa_vrf.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
169dsa_vrf.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rand.h
170dsa_vrf.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
171dsa_vrf.o: ../../include/openssl/symhacks.h ../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/dsa.h b/src/lib/libcrypto/dsa/dsa.h
index 851e3f0445..225ff391f9 100644
--- a/src/lib/libcrypto/dsa/dsa.h
+++ b/src/lib/libcrypto/dsa/dsa.h
@@ -80,20 +80,6 @@
80#endif 80#endif
81 81
82#define DSA_FLAG_CACHE_MONT_P 0x01 82#define DSA_FLAG_CACHE_MONT_P 0x01
83#define DSA_FLAG_NO_EXP_CONSTTIME 0x02 /* new with 0.9.7h; the built-in DSA
84 * implementation now uses constant time
85 * modular exponentiation for secret exponents
86 * by default. This flag causes the
87 * faster variable sliding window method to
88 * be used for all exponents.
89 */
90
91/* If this flag is set external DSA_METHOD callbacks are allowed in FIPS mode
92 * it is then the applications responsibility to ensure the external method
93 * is compliant.
94 */
95
96#define DSA_FLAG_FIPS_EXTERNAL_METHOD_ALLOW 0x04
97 83
98#if defined(OPENSSL_FIPS) 84#if defined(OPENSSL_FIPS)
99#define FIPS_DSA_SIZE_T int 85#define FIPS_DSA_SIZE_T int
diff --git a/src/lib/libcrypto/dsa/dsa_err.c b/src/lib/libcrypto/dsa/dsa_err.c
index fd42053572..79aa4ff526 100644
--- a/src/lib/libcrypto/dsa/dsa_err.c
+++ b/src/lib/libcrypto/dsa/dsa_err.c
@@ -1,6 +1,6 @@
1/* crypto/dsa/dsa_err.c */ 1/* crypto/dsa/dsa_err.c */
2/* ==================================================================== 2/* ====================================================================
3 * Copyright (c) 1999-2005 The OpenSSL Project. All rights reserved. 3 * Copyright (c) 1999 The OpenSSL Project. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
@@ -64,33 +64,29 @@
64 64
65/* BEGIN ERROR CODES */ 65/* BEGIN ERROR CODES */
66#ifndef OPENSSL_NO_ERR 66#ifndef OPENSSL_NO_ERR
67
68#define ERR_FUNC(func) ERR_PACK(ERR_LIB_DSA,func,0)
69#define ERR_REASON(reason) ERR_PACK(ERR_LIB_DSA,0,reason)
70
71static ERR_STRING_DATA DSA_str_functs[]= 67static ERR_STRING_DATA DSA_str_functs[]=
72 { 68 {
73{ERR_FUNC(DSA_F_D2I_DSA_SIG), "d2i_DSA_SIG"}, 69{ERR_PACK(0,DSA_F_D2I_DSA_SIG,0), "d2i_DSA_SIG"},
74{ERR_FUNC(DSA_F_DSAPARAMS_PRINT), "DSAparams_print"}, 70{ERR_PACK(0,DSA_F_DSAPARAMS_PRINT,0), "DSAparams_print"},
75{ERR_FUNC(DSA_F_DSAPARAMS_PRINT_FP), "DSAparams_print_fp"}, 71{ERR_PACK(0,DSA_F_DSAPARAMS_PRINT_FP,0), "DSAparams_print_fp"},
76{ERR_FUNC(DSA_F_DSA_DO_SIGN), "DSA_do_sign"}, 72{ERR_PACK(0,DSA_F_DSA_DO_SIGN,0), "DSA_do_sign"},
77{ERR_FUNC(DSA_F_DSA_DO_VERIFY), "DSA_do_verify"}, 73{ERR_PACK(0,DSA_F_DSA_DO_VERIFY,0), "DSA_do_verify"},
78{ERR_FUNC(DSA_F_DSA_NEW_METHOD), "DSA_new_method"}, 74{ERR_PACK(0,DSA_F_DSA_NEW_METHOD,0), "DSA_new_method"},
79{ERR_FUNC(DSA_F_DSA_PRINT), "DSA_print"}, 75{ERR_PACK(0,DSA_F_DSA_PRINT,0), "DSA_print"},
80{ERR_FUNC(DSA_F_DSA_PRINT_FP), "DSA_print_fp"}, 76{ERR_PACK(0,DSA_F_DSA_PRINT_FP,0), "DSA_print_fp"},
81{ERR_FUNC(DSA_F_DSA_SIGN), "DSA_sign"}, 77{ERR_PACK(0,DSA_F_DSA_SIGN,0), "DSA_sign"},
82{ERR_FUNC(DSA_F_DSA_SIGN_SETUP), "DSA_sign_setup"}, 78{ERR_PACK(0,DSA_F_DSA_SIGN_SETUP,0), "DSA_sign_setup"},
83{ERR_FUNC(DSA_F_DSA_SIG_NEW), "DSA_SIG_new"}, 79{ERR_PACK(0,DSA_F_DSA_SIG_NEW,0), "DSA_SIG_new"},
84{ERR_FUNC(DSA_F_DSA_VERIFY), "DSA_verify"}, 80{ERR_PACK(0,DSA_F_DSA_VERIFY,0), "DSA_verify"},
85{ERR_FUNC(DSA_F_I2D_DSA_SIG), "i2d_DSA_SIG"}, 81{ERR_PACK(0,DSA_F_I2D_DSA_SIG,0), "i2d_DSA_SIG"},
86{ERR_FUNC(DSA_F_SIG_CB), "SIG_CB"}, 82{ERR_PACK(0,DSA_F_SIG_CB,0), "SIG_CB"},
87{0,NULL} 83{0,NULL}
88 }; 84 };
89 85
90static ERR_STRING_DATA DSA_str_reasons[]= 86static ERR_STRING_DATA DSA_str_reasons[]=
91 { 87 {
92{ERR_REASON(DSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE),"data too large for key size"}, 88{DSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE ,"data too large for key size"},
93{ERR_REASON(DSA_R_MISSING_PARAMETERS) ,"missing parameters"}, 89{DSA_R_MISSING_PARAMETERS ,"missing parameters"},
94{0,NULL} 90{0,NULL}
95 }; 91 };
96 92
@@ -104,8 +100,8 @@ void ERR_load_DSA_strings(void)
104 { 100 {
105 init=0; 101 init=0;
106#ifndef OPENSSL_NO_ERR 102#ifndef OPENSSL_NO_ERR
107 ERR_load_strings(0,DSA_str_functs); 103 ERR_load_strings(ERR_LIB_DSA,DSA_str_functs);
108 ERR_load_strings(0,DSA_str_reasons); 104 ERR_load_strings(ERR_LIB_DSA,DSA_str_reasons);
109#endif 105#endif
110 106
111 } 107 }
diff --git a/src/lib/libcrypto/dsa/dsa_key.c b/src/lib/libcrypto/dsa/dsa_key.c
index 980b6dc2d3..30607ca579 100644
--- a/src/lib/libcrypto/dsa/dsa_key.c
+++ b/src/lib/libcrypto/dsa/dsa_key.c
@@ -90,22 +90,8 @@ int DSA_generate_key(DSA *dsa)
90 } 90 }
91 else 91 else
92 pub_key=dsa->pub_key; 92 pub_key=dsa->pub_key;
93
94 {
95 BIGNUM local_prk;
96 BIGNUM *prk;
97
98 if ((dsa->flags & DSA_FLAG_NO_EXP_CONSTTIME) == 0)
99 {
100 BN_init(&local_prk);
101 prk = &local_prk;
102 BN_with_flags(prk, priv_key, BN_FLG_EXP_CONSTTIME);
103 }
104 else
105 prk = priv_key;
106 93
107 if (!BN_mod_exp(pub_key,dsa->g,prk,dsa->p,ctx)) goto err; 94 if (!BN_mod_exp(pub_key,dsa->g,priv_key,dsa->p,ctx)) goto err;
108 }
109 95
110 dsa->priv_key=priv_key; 96 dsa->priv_key=priv_key;
111 dsa->pub_key=pub_key; 97 dsa->pub_key=pub_key;
diff --git a/src/lib/libcrypto/dsa/dsa_ossl.c b/src/lib/libcrypto/dsa/dsa_ossl.c
index 12509a7083..f1a85afcde 100644
--- a/src/lib/libcrypto/dsa/dsa_ossl.c
+++ b/src/lib/libcrypto/dsa/dsa_ossl.c
@@ -172,7 +172,7 @@ err:
172static int dsa_sign_setup(DSA *dsa, BN_CTX *ctx_in, BIGNUM **kinvp, BIGNUM **rp) 172static int dsa_sign_setup(DSA *dsa, BN_CTX *ctx_in, BIGNUM **kinvp, BIGNUM **rp)
173 { 173 {
174 BN_CTX *ctx; 174 BN_CTX *ctx;
175 BIGNUM k,kq,*K,*kinv=NULL,*r=NULL; 175 BIGNUM k,*kinv=NULL,*r=NULL;
176 int ret=0; 176 int ret=0;
177 177
178 if (!dsa->p || !dsa->q || !dsa->g) 178 if (!dsa->p || !dsa->q || !dsa->g)
@@ -182,7 +182,6 @@ static int dsa_sign_setup(DSA *dsa, BN_CTX *ctx_in, BIGNUM **kinvp, BIGNUM **rp)
182 } 182 }
183 183
184 BN_init(&k); 184 BN_init(&k);
185 BN_init(&kq);
186 185
187 if (ctx_in == NULL) 186 if (ctx_in == NULL)
188 { 187 {
@@ -192,49 +191,22 @@ static int dsa_sign_setup(DSA *dsa, BN_CTX *ctx_in, BIGNUM **kinvp, BIGNUM **rp)
192 ctx=ctx_in; 191 ctx=ctx_in;
193 192
194 if ((r=BN_new()) == NULL) goto err; 193 if ((r=BN_new()) == NULL) goto err;
194 kinv=NULL;
195 195
196 /* Get random k */ 196 /* Get random k */
197 do 197 do
198 if (!BN_rand_range(&k, dsa->q)) goto err; 198 if (!BN_rand_range(&k, dsa->q)) goto err;
199 while (BN_is_zero(&k)); 199 while (BN_is_zero(&k));
200 if ((dsa->flags & DSA_FLAG_NO_EXP_CONSTTIME) == 0)
201 {
202 BN_set_flags(&k, BN_FLG_EXP_CONSTTIME);
203 }
204 200
205 if (dsa->flags & DSA_FLAG_CACHE_MONT_P) 201 if ((dsa->method_mont_p == NULL) && (dsa->flags & DSA_FLAG_CACHE_MONT_P))
206 { 202 {
207 if (!BN_MONT_CTX_set_locked((BN_MONT_CTX **)&dsa->method_mont_p, 203 if ((dsa->method_mont_p=(char *)BN_MONT_CTX_new()) != NULL)
208 CRYPTO_LOCK_DSA, 204 if (!BN_MONT_CTX_set((BN_MONT_CTX *)dsa->method_mont_p,
209 dsa->p, ctx)) 205 dsa->p,ctx)) goto err;
210 goto err;
211 } 206 }
212 207
213 /* Compute r = (g^k mod p) mod q */ 208 /* Compute r = (g^k mod p) mod q */
214 209 if (!dsa->meth->bn_mod_exp(dsa, r,dsa->g,&k,dsa->p,ctx,
215 if ((dsa->flags & DSA_FLAG_NO_EXP_CONSTTIME) == 0)
216 {
217 if (!BN_copy(&kq, &k)) goto err;
218
219 /* We do not want timing information to leak the length of k,
220 * so we compute g^k using an equivalent exponent of fixed length.
221 *
222 * (This is a kludge that we need because the BN_mod_exp_mont()
223 * does not let us specify the desired timing behaviour.) */
224
225 if (!BN_add(&kq, &kq, dsa->q)) goto err;
226 if (BN_num_bits(&kq) <= BN_num_bits(dsa->q))
227 {
228 if (!BN_add(&kq, &kq, dsa->q)) goto err;
229 }
230
231 K = &kq;
232 }
233 else
234 {
235 K = &k;
236 }
237 if (!dsa->meth->bn_mod_exp(dsa, r,dsa->g,K,dsa->p,ctx,
238 (BN_MONT_CTX *)dsa->method_mont_p)) goto err; 210 (BN_MONT_CTX *)dsa->method_mont_p)) goto err;
239 if (!BN_mod(r,r,dsa->q,ctx)) goto err; 211 if (!BN_mod(r,r,dsa->q,ctx)) goto err;
240 212
@@ -257,7 +229,6 @@ err:
257 if (ctx_in == NULL) BN_CTX_free(ctx); 229 if (ctx_in == NULL) BN_CTX_free(ctx);
258 if (kinv != NULL) BN_clear_free(kinv); 230 if (kinv != NULL) BN_clear_free(kinv);
259 BN_clear_free(&k); 231 BN_clear_free(&k);
260 BN_clear_free(&kq);
261 return(ret); 232 return(ret);
262 } 233 }
263 234
@@ -304,15 +275,13 @@ static int dsa_do_verify(const unsigned char *dgst, int dgst_len, DSA_SIG *sig,
304 /* u2 = r * w mod q */ 275 /* u2 = r * w mod q */
305 if (!BN_mod_mul(&u2,sig->r,&u2,dsa->q,ctx)) goto err; 276 if (!BN_mod_mul(&u2,sig->r,&u2,dsa->q,ctx)) goto err;
306 277
307 278 if ((dsa->method_mont_p == NULL) && (dsa->flags & DSA_FLAG_CACHE_MONT_P))
308 if (dsa->flags & DSA_FLAG_CACHE_MONT_P)
309 { 279 {
310 mont = BN_MONT_CTX_set_locked( 280 if ((dsa->method_mont_p=(char *)BN_MONT_CTX_new()) != NULL)
311 (BN_MONT_CTX **)&dsa->method_mont_p, 281 if (!BN_MONT_CTX_set((BN_MONT_CTX *)dsa->method_mont_p,
312 CRYPTO_LOCK_DSA, dsa->p, ctx); 282 dsa->p,ctx)) goto err;
313 if (!mont)
314 goto err;
315 } 283 }
284 mont=(BN_MONT_CTX *)dsa->method_mont_p;
316 285
317#if 0 286#if 0
318 { 287 {
diff --git a/src/lib/libcrypto/dsa/dsa_sign.c b/src/lib/libcrypto/dsa/dsa_sign.c
index 37c65efb20..3c9753bac3 100644
--- a/src/lib/libcrypto/dsa/dsa_sign.c
+++ b/src/lib/libcrypto/dsa/dsa_sign.c
@@ -72,8 +72,7 @@
72DSA_SIG * DSA_do_sign(const unsigned char *dgst, int dlen, DSA *dsa) 72DSA_SIG * DSA_do_sign(const unsigned char *dgst, int dlen, DSA *dsa)
73 { 73 {
74#ifdef OPENSSL_FIPS 74#ifdef OPENSSL_FIPS
75 if(FIPS_mode() && !(dsa->flags & DSA_FLAG_FIPS_EXTERNAL_METHOD_ALLOW) 75 if(FIPS_mode() && !FIPS_dsa_check(dsa))
76 && !FIPS_dsa_check(dsa))
77 return NULL; 76 return NULL;
78#endif 77#endif
79 return dsa->meth->dsa_do_sign(dgst, dlen, dsa); 78 return dsa->meth->dsa_do_sign(dgst, dlen, dsa);
@@ -97,8 +96,7 @@ int DSA_sign(int type, const unsigned char *dgst, int dlen, unsigned char *sig,
97int DSA_sign_setup(DSA *dsa, BN_CTX *ctx_in, BIGNUM **kinvp, BIGNUM **rp) 96int DSA_sign_setup(DSA *dsa, BN_CTX *ctx_in, BIGNUM **kinvp, BIGNUM **rp)
98 { 97 {
99#ifdef OPENSSL_FIPS 98#ifdef OPENSSL_FIPS
100 if(FIPS_mode() && !(dsa->flags & DSA_FLAG_FIPS_EXTERNAL_METHOD_ALLOW) 99 if(FIPS_mode() && !FIPS_dsa_check(dsa))
101 && !FIPS_dsa_check(dsa))
102 return 0; 100 return 0;
103#endif 101#endif
104 return dsa->meth->dsa_sign_setup(dsa, ctx_in, kinvp, rp); 102 return dsa->meth->dsa_sign_setup(dsa, ctx_in, kinvp, rp);
diff --git a/src/lib/libcrypto/dsa/dsa_vrf.c b/src/lib/libcrypto/dsa/dsa_vrf.c
index c9784bed48..8ef0c45025 100644
--- a/src/lib/libcrypto/dsa/dsa_vrf.c
+++ b/src/lib/libcrypto/dsa/dsa_vrf.c
@@ -74,8 +74,7 @@ int DSA_do_verify(const unsigned char *dgst, int dgst_len, DSA_SIG *sig,
74 DSA *dsa) 74 DSA *dsa)
75 { 75 {
76#ifdef OPENSSL_FIPS 76#ifdef OPENSSL_FIPS
77 if(FIPS_mode() && !(dsa->flags & DSA_FLAG_FIPS_EXTERNAL_METHOD_ALLOW) 77 if(FIPS_mode() && !FIPS_dsa_check(dsa))
78 && !FIPS_dsa_check(dsa))
79 return -1; 78 return -1;
80#endif 79#endif
81 return dsa->meth->dsa_do_verify(dgst, dgst_len, sig, dsa); 80 return dsa->meth->dsa_do_verify(dgst, dgst_len, sig, dsa);
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..4734ce4af8
--- /dev/null
+++ b/src/lib/libcrypto/dsa/dsatest.c
@@ -0,0 +1,242 @@
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#include <stdio.h>
60#include <stdlib.h>
61#include <string.h>
62#include <sys/types.h>
63#include <sys/stat.h>
64
65#include "../e_os.h"
66
67#include <openssl/crypto.h>
68#include <openssl/rand.h>
69#include <openssl/bio.h>
70#include <openssl/err.h>
71
72#ifdef OPENSSL_NO_DSA
73int main(int argc, char *argv[])
74{
75 printf("No DSA support\n");
76 return(0);
77}
78#else
79#include <openssl/dsa.h>
80
81#ifdef OPENSSL_SYS_WIN16
82#define MS_CALLBACK _far _loadds
83#else
84#define MS_CALLBACK
85#endif
86
87static void MS_CALLBACK dsa_cb(int p, int n, void *arg);
88
89/* seed, out_p, out_q, out_g are taken from the updated Appendix 5 to
90 * FIPS PUB 186 and also appear in Appendix 5 to FIPS PIB 186-1 */
91static unsigned char seed[20]={
92 0xd5,0x01,0x4e,0x4b,0x60,0xef,0x2b,0xa8,0xb6,0x21,0x1b,0x40,
93 0x62,0xba,0x32,0x24,0xe0,0x42,0x7d,0xd3,
94 };
95
96static unsigned char out_p[]={
97 0x8d,0xf2,0xa4,0x94,0x49,0x22,0x76,0xaa,
98 0x3d,0x25,0x75,0x9b,0xb0,0x68,0x69,0xcb,
99 0xea,0xc0,0xd8,0x3a,0xfb,0x8d,0x0c,0xf7,
100 0xcb,0xb8,0x32,0x4f,0x0d,0x78,0x82,0xe5,
101 0xd0,0x76,0x2f,0xc5,0xb7,0x21,0x0e,0xaf,
102 0xc2,0xe9,0xad,0xac,0x32,0xab,0x7a,0xac,
103 0x49,0x69,0x3d,0xfb,0xf8,0x37,0x24,0xc2,
104 0xec,0x07,0x36,0xee,0x31,0xc8,0x02,0x91,
105 };
106
107static unsigned char out_q[]={
108 0xc7,0x73,0x21,0x8c,0x73,0x7e,0xc8,0xee,
109 0x99,0x3b,0x4f,0x2d,0xed,0x30,0xf4,0x8e,
110 0xda,0xce,0x91,0x5f,
111 };
112
113static unsigned char out_g[]={
114 0x62,0x6d,0x02,0x78,0x39,0xea,0x0a,0x13,
115 0x41,0x31,0x63,0xa5,0x5b,0x4c,0xb5,0x00,
116 0x29,0x9d,0x55,0x22,0x95,0x6c,0xef,0xcb,
117 0x3b,0xff,0x10,0xf3,0x99,0xce,0x2c,0x2e,
118 0x71,0xcb,0x9d,0xe5,0xfa,0x24,0xba,0xbf,
119 0x58,0xe5,0xb7,0x95,0x21,0x92,0x5c,0x9c,
120 0xc4,0x2e,0x9f,0x6f,0x46,0x4b,0x08,0x8c,
121 0xc5,0x72,0xaf,0x53,0xe6,0xd7,0x88,0x02,
122 };
123
124static const unsigned char str1[]="12345678901234567890";
125
126static const char rnd_seed[] = "string to make the random number generator think it has entropy";
127
128static BIO *bio_err=NULL;
129
130int main(int argc, char **argv)
131 {
132 DSA *dsa=NULL;
133 int counter,ret=0,i,j;
134 unsigned char buf[256];
135 unsigned long h;
136 unsigned char sig[256];
137 unsigned int siglen;
138
139 if (bio_err == NULL)
140 bio_err=BIO_new_fp(stderr,BIO_NOCLOSE);
141
142 CRYPTO_malloc_debug_init();
143 CRYPTO_dbg_set_options(V_CRYPTO_MDEBUG_ALL);
144 CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON);
145
146 ERR_load_crypto_strings();
147 RAND_seed(rnd_seed, sizeof rnd_seed);
148
149 BIO_printf(bio_err,"test generation of DSA parameters\n");
150
151 dsa=DSA_generate_parameters(512,seed,20,&counter,&h,dsa_cb,bio_err);
152
153 BIO_printf(bio_err,"seed\n");
154 for (i=0; i<20; i+=4)
155 {
156 BIO_printf(bio_err,"%02X%02X%02X%02X ",
157 seed[i],seed[i+1],seed[i+2],seed[i+3]);
158 }
159 BIO_printf(bio_err,"\ncounter=%d h=%d\n",counter,h);
160
161 if (dsa == NULL) goto end;
162 DSA_print(bio_err,dsa,0);
163 if (counter != 105)
164 {
165 BIO_printf(bio_err,"counter should be 105\n");
166 goto end;
167 }
168 if (h != 2)
169 {
170 BIO_printf(bio_err,"h should be 2\n");
171 goto end;
172 }
173
174 i=BN_bn2bin(dsa->q,buf);
175 j=sizeof(out_q);
176 if ((i != j) || (memcmp(buf,out_q,i) != 0))
177 {
178 BIO_printf(bio_err,"q value is wrong\n");
179 goto end;
180 }
181
182 i=BN_bn2bin(dsa->p,buf);
183 j=sizeof(out_p);
184 if ((i != j) || (memcmp(buf,out_p,i) != 0))
185 {
186 BIO_printf(bio_err,"p value is wrong\n");
187 goto end;
188 }
189
190 i=BN_bn2bin(dsa->g,buf);
191 j=sizeof(out_g);
192 if ((i != j) || (memcmp(buf,out_g,i) != 0))
193 {
194 BIO_printf(bio_err,"g value is wrong\n");
195 goto end;
196 }
197 DSA_generate_key(dsa);
198 DSA_sign(0, str1, 20, sig, &siglen, dsa);
199 if (DSA_verify(0, str1, 20, sig, siglen, dsa) == 1)
200 ret=1;
201end:
202 if (!ret)
203 ERR_print_errors(bio_err);
204 if (dsa != NULL) DSA_free(dsa);
205 CRYPTO_cleanup_all_ex_data();
206 ERR_remove_state(0);
207 ERR_free_strings();
208 CRYPTO_mem_leaks(bio_err);
209 if (bio_err != NULL)
210 {
211 BIO_free(bio_err);
212 bio_err = NULL;
213 }
214 EXIT(!ret);
215 return(0);
216 }
217
218static int cb_exit(int ec)
219 {
220 EXIT(ec);
221 return(0); /* To keep some compilers quiet */
222 }
223
224static void MS_CALLBACK dsa_cb(int p, int n, void *arg)
225 {
226 char c='*';
227 static int ok=0,num=0;
228
229 if (p == 0) { c='.'; num++; };
230 if (p == 1) c='+';
231 if (p == 2) { c='*'; ok++; }
232 if (p == 3) c='\n';
233 BIO_write(arg,&c,1);
234 (void)BIO_flush(arg);
235
236 if (!ok && (p == 0) && (num > 1))
237 {
238 BIO_printf((BIO *)arg,"error in dsatest\n");
239 cb_exit(1);
240 }
241 }
242#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..c16278c3ff
--- /dev/null
+++ b/src/lib/libcrypto/dso/Makefile
@@ -0,0 +1,140 @@
1#
2# OpenSSL/crypto/dso/Makefile
3#
4
5DIR= dso
6TOP= ../..
7CC= cc
8INCLUDES= -I.. -I$(TOP) -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
18CFLAGS= $(INCLUDES) $(CFLAG)
19
20GENERAL=Makefile
21TEST=
22APPS=
23
24LIB=$(TOP)/libcrypto.a
25LIBSRC= dso_dl.c dso_dlfcn.c dso_err.c dso_lib.c dso_null.c \
26 dso_openssl.c dso_win32.c dso_vms.c
27LIBOBJ= dso_dl.o dso_dlfcn.o dso_err.o dso_lib.o dso_null.o \
28 dso_openssl.o dso_win32.o dso_vms.o
29
30SRC= $(LIBSRC)
31
32EXHEADER= dso.h
33HEADER= $(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
47files:
48 $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
49
50links:
51 @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
52 @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
53 @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
54
55install:
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 $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
72
73dclean:
74 $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
75 mv -f Makefile.new $(MAKEFILE)
76
77clean:
78 rm -f *.o */*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
79
80# DO NOT DELETE THIS LINE -- make depend depends on it.
81
82dso_dl.o: ../../e_os.h ../../include/openssl/bio.h
83dso_dl.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
84dso_dl.o: ../../include/openssl/dso.h ../../include/openssl/e_os2.h
85dso_dl.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
86dso_dl.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
87dso_dl.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
88dso_dl.o: ../../include/openssl/symhacks.h ../cryptlib.h dso_dl.c
89dso_dlfcn.o: ../../e_os.h ../../include/openssl/bio.h
90dso_dlfcn.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
91dso_dlfcn.o: ../../include/openssl/dso.h ../../include/openssl/e_os2.h
92dso_dlfcn.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
93dso_dlfcn.o: ../../include/openssl/opensslconf.h
94dso_dlfcn.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
95dso_dlfcn.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
96dso_dlfcn.o: ../cryptlib.h dso_dlfcn.c
97dso_err.o: ../../include/openssl/bio.h ../../include/openssl/crypto.h
98dso_err.o: ../../include/openssl/dso.h ../../include/openssl/e_os2.h
99dso_err.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
100dso_err.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
101dso_err.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
102dso_err.o: ../../include/openssl/symhacks.h dso_err.c
103dso_lib.o: ../../e_os.h ../../include/openssl/bio.h
104dso_lib.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
105dso_lib.o: ../../include/openssl/dso.h ../../include/openssl/e_os2.h
106dso_lib.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
107dso_lib.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
108dso_lib.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
109dso_lib.o: ../../include/openssl/symhacks.h ../cryptlib.h dso_lib.c
110dso_null.o: ../../e_os.h ../../include/openssl/bio.h
111dso_null.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
112dso_null.o: ../../include/openssl/dso.h ../../include/openssl/e_os2.h
113dso_null.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
114dso_null.o: ../../include/openssl/opensslconf.h
115dso_null.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
116dso_null.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
117dso_null.o: ../cryptlib.h dso_null.c
118dso_openssl.o: ../../e_os.h ../../include/openssl/bio.h
119dso_openssl.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
120dso_openssl.o: ../../include/openssl/dso.h ../../include/openssl/e_os2.h
121dso_openssl.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
122dso_openssl.o: ../../include/openssl/opensslconf.h
123dso_openssl.o: ../../include/openssl/opensslv.h
124dso_openssl.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
125dso_openssl.o: ../../include/openssl/symhacks.h ../cryptlib.h dso_openssl.c
126dso_vms.o: ../../e_os.h ../../include/openssl/bio.h
127dso_vms.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
128dso_vms.o: ../../include/openssl/dso.h ../../include/openssl/e_os2.h
129dso_vms.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
130dso_vms.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
131dso_vms.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
132dso_vms.o: ../../include/openssl/symhacks.h ../cryptlib.h dso_vms.c
133dso_win32.o: ../../e_os.h ../../include/openssl/bio.h
134dso_win32.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
135dso_win32.o: ../../include/openssl/dso.h ../../include/openssl/e_os2.h
136dso_win32.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
137dso_win32.o: ../../include/openssl/opensslconf.h
138dso_win32.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
139dso_win32.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
140dso_win32.o: ../cryptlib.h dso_win32.c
diff --git a/src/lib/libcrypto/dso/Makefile.ssl b/src/lib/libcrypto/dso/Makefile.ssl
new file mode 100644
index 0000000000..c0449d184e
--- /dev/null
+++ b/src/lib/libcrypto/dso/Makefile.ssl
@@ -0,0 +1,142 @@
1#
2# SSLeay/crypto/dso/Makefile
3#
4
5DIR= dso
6TOP= ../..
7CC= cc
8INCLUDES= -I.. -I$(TOP) -I../../include
9CFLAG=-g
10INSTALL_PREFIX=
11OPENSSLDIR= /usr/local/ssl
12INSTALLTOP=/usr/local/ssl
13MAKE= make -f Makefile.ssl
14MAKEDEPPROG= makedepend
15MAKEDEPEND= $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG)
16MAKEFILE= Makefile.ssl
17AR= ar r
18
19CFLAGS= $(INCLUDES) $(CFLAG)
20
21GENERAL=Makefile
22TEST=
23APPS=
24
25LIB=$(TOP)/libcrypto.a
26LIBSRC= dso_dl.c dso_dlfcn.c dso_err.c dso_lib.c dso_null.c \
27 dso_openssl.c dso_win32.c dso_vms.c
28LIBOBJ= dso_dl.o dso_dlfcn.o dso_err.o dso_lib.o dso_null.o \
29 dso_openssl.o dso_win32.o dso_vms.o
30
31SRC= $(LIBSRC)
32
33EXHEADER= dso.h
34HEADER= $(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
48files:
49 $(PERL) $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO
50
51links:
52 @sh $(TOP)/util/point.sh Makefile.ssl Makefile
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 @for i in $(EXHEADER) ; \
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 $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
74
75dclean:
76 $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
77 mv -f Makefile.new $(MAKEFILE)
78
79clean:
80 rm -f *.o */*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
81
82# DO NOT DELETE THIS LINE -- make depend depends on it.
83
84dso_dl.o: ../../e_os.h ../../include/openssl/bio.h
85dso_dl.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
86dso_dl.o: ../../include/openssl/dso.h ../../include/openssl/e_os2.h
87dso_dl.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
88dso_dl.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
89dso_dl.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
90dso_dl.o: ../../include/openssl/symhacks.h ../cryptlib.h dso_dl.c
91dso_dlfcn.o: ../../e_os.h ../../include/openssl/bio.h
92dso_dlfcn.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
93dso_dlfcn.o: ../../include/openssl/dso.h ../../include/openssl/e_os2.h
94dso_dlfcn.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
95dso_dlfcn.o: ../../include/openssl/opensslconf.h
96dso_dlfcn.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
97dso_dlfcn.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
98dso_dlfcn.o: ../cryptlib.h dso_dlfcn.c
99dso_err.o: ../../include/openssl/bio.h ../../include/openssl/crypto.h
100dso_err.o: ../../include/openssl/dso.h ../../include/openssl/e_os2.h
101dso_err.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
102dso_err.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
103dso_err.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
104dso_err.o: ../../include/openssl/symhacks.h dso_err.c
105dso_lib.o: ../../e_os.h ../../include/openssl/bio.h
106dso_lib.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
107dso_lib.o: ../../include/openssl/dso.h ../../include/openssl/e_os2.h
108dso_lib.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
109dso_lib.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
110dso_lib.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
111dso_lib.o: ../../include/openssl/symhacks.h ../cryptlib.h dso_lib.c
112dso_null.o: ../../e_os.h ../../include/openssl/bio.h
113dso_null.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
114dso_null.o: ../../include/openssl/dso.h ../../include/openssl/e_os2.h
115dso_null.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
116dso_null.o: ../../include/openssl/opensslconf.h
117dso_null.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
118dso_null.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
119dso_null.o: ../cryptlib.h dso_null.c
120dso_openssl.o: ../../e_os.h ../../include/openssl/bio.h
121dso_openssl.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
122dso_openssl.o: ../../include/openssl/dso.h ../../include/openssl/e_os2.h
123dso_openssl.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
124dso_openssl.o: ../../include/openssl/opensslconf.h
125dso_openssl.o: ../../include/openssl/opensslv.h
126dso_openssl.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
127dso_openssl.o: ../../include/openssl/symhacks.h ../cryptlib.h dso_openssl.c
128dso_vms.o: ../../e_os.h ../../include/openssl/bio.h
129dso_vms.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
130dso_vms.o: ../../include/openssl/dso.h ../../include/openssl/e_os2.h
131dso_vms.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
132dso_vms.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
133dso_vms.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
134dso_vms.o: ../../include/openssl/symhacks.h ../cryptlib.h dso_vms.c
135dso_win32.o: ../../e_os.h ../../include/openssl/bio.h
136dso_win32.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
137dso_win32.o: ../../include/openssl/dso.h ../../include/openssl/e_os2.h
138dso_win32.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
139dso_win32.o: ../../include/openssl/opensslconf.h
140dso_win32.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
141dso_win32.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
142dso_win32.o: ../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_dl.c b/src/lib/libcrypto/dso/dso_dl.c
new file mode 100644
index 0000000000..79d2cb4d8c
--- /dev/null
+++ b/src/lib/libcrypto/dso/dso_dl.c
@@ -0,0 +1,284 @@
1/* dso_dl.c */
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);
87
88static DSO_METHOD dso_meth_dl = {
89 "OpenSSL 'dl' shared library method",
90 dl_load,
91 dl_unload,
92 dl_bind_var,
93 dl_bind_func,
94/* For now, "unbind" doesn't exist */
95#if 0
96 NULL, /* unbind_var */
97 NULL, /* unbind_func */
98#endif
99 NULL, /* ctrl */
100 dl_name_converter,
101 NULL, /* init */
102 NULL /* finish */
103 };
104
105DSO_METHOD *DSO_METHOD_dl(void)
106 {
107 return(&dso_meth_dl);
108 }
109
110/* For this DSO_METHOD, our meth_data STACK will contain;
111 * (i) the handle (shl_t) returned from shl_load().
112 * NB: I checked on HPUX11 and shl_t is itself a pointer
113 * type so the cast is safe.
114 */
115
116static int dl_load(DSO *dso)
117 {
118 shl_t ptr = NULL;
119 /* We don't do any fancy retries or anything, just take the method's
120 * (or DSO's if it has the callback set) best translation of the
121 * platform-independant filename and try once with that. */
122 char *filename= DSO_convert_filename(dso, NULL);
123
124 if(filename == NULL)
125 {
126 DSOerr(DSO_F_DL_LOAD,DSO_R_NO_FILENAME);
127 goto err;
128 }
129 ptr = shl_load(filename, BIND_IMMEDIATE|DYNAMIC_PATH, 0L);
130 if(ptr == NULL)
131 {
132 DSOerr(DSO_F_DL_LOAD,DSO_R_LOAD_FAILED);
133 ERR_add_error_data(4, "filename(", filename, "): ",
134 strerror(errno));
135 goto err;
136 }
137 if(!sk_push(dso->meth_data, (char *)ptr))
138 {
139 DSOerr(DSO_F_DL_LOAD,DSO_R_STACK_ERROR);
140 goto err;
141 }
142 /* Success, stick the converted filename we've loaded under into the DSO
143 * (it also serves as the indicator that we are currently loaded). */
144 dso->loaded_filename = filename;
145 return(1);
146err:
147 /* Cleanup! */
148 if(filename != NULL)
149 OPENSSL_free(filename);
150 if(ptr != NULL)
151 shl_unload(ptr);
152 return(0);
153 }
154
155static int dl_unload(DSO *dso)
156 {
157 shl_t ptr;
158 if(dso == NULL)
159 {
160 DSOerr(DSO_F_DL_UNLOAD,ERR_R_PASSED_NULL_PARAMETER);
161 return(0);
162 }
163 if(sk_num(dso->meth_data) < 1)
164 return(1);
165 /* Is this statement legal? */
166 ptr = (shl_t)sk_pop(dso->meth_data);
167 if(ptr == NULL)
168 {
169 DSOerr(DSO_F_DL_UNLOAD,DSO_R_NULL_HANDLE);
170 /* Should push the value back onto the stack in
171 * case of a retry. */
172 sk_push(dso->meth_data, (char *)ptr);
173 return(0);
174 }
175 shl_unload(ptr);
176 return(1);
177 }
178
179static void *dl_bind_var(DSO *dso, const char *symname)
180 {
181 shl_t ptr;
182 void *sym;
183
184 if((dso == NULL) || (symname == NULL))
185 {
186 DSOerr(DSO_F_DL_BIND_VAR,ERR_R_PASSED_NULL_PARAMETER);
187 return(NULL);
188 }
189 if(sk_num(dso->meth_data) < 1)
190 {
191 DSOerr(DSO_F_DL_BIND_VAR,DSO_R_STACK_ERROR);
192 return(NULL);
193 }
194 ptr = (shl_t)sk_value(dso->meth_data, sk_num(dso->meth_data) - 1);
195 if(ptr == NULL)
196 {
197 DSOerr(DSO_F_DL_BIND_VAR,DSO_R_NULL_HANDLE);
198 return(NULL);
199 }
200 if (shl_findsym(&ptr, symname, TYPE_UNDEFINED, &sym) < 0)
201 {
202 DSOerr(DSO_F_DL_BIND_VAR,DSO_R_SYM_FAILURE);
203 ERR_add_error_data(4, "symname(", symname, "): ",
204 strerror(errno));
205 return(NULL);
206 }
207 return(sym);
208 }
209
210static DSO_FUNC_TYPE dl_bind_func(DSO *dso, const char *symname)
211 {
212 shl_t ptr;
213 void *sym;
214
215 if((dso == NULL) || (symname == NULL))
216 {
217 DSOerr(DSO_F_DL_BIND_FUNC,ERR_R_PASSED_NULL_PARAMETER);
218 return(NULL);
219 }
220 if(sk_num(dso->meth_data) < 1)
221 {
222 DSOerr(DSO_F_DL_BIND_FUNC,DSO_R_STACK_ERROR);
223 return(NULL);
224 }
225 ptr = (shl_t)sk_value(dso->meth_data, sk_num(dso->meth_data) - 1);
226 if(ptr == NULL)
227 {
228 DSOerr(DSO_F_DL_BIND_FUNC,DSO_R_NULL_HANDLE);
229 return(NULL);
230 }
231 if (shl_findsym(&ptr, symname, TYPE_UNDEFINED, &sym) < 0)
232 {
233 DSOerr(DSO_F_DL_BIND_FUNC,DSO_R_SYM_FAILURE);
234 ERR_add_error_data(4, "symname(", symname, "): ",
235 strerror(errno));
236 return(NULL);
237 }
238 return((DSO_FUNC_TYPE)sym);
239 }
240
241/* This function is identical to the one in dso_dlfcn.c, but as it is highly
242 * unlikely that both the "dl" *and* "dlfcn" variants are being compiled at the
243 * same time, there's no great duplicating the code. Figuring out an elegant
244 * way to share one copy of the code would be more difficult and would not
245 * leave the implementations independant. */
246#if defined(__hpux)
247static const char extension[] = ".sl";
248#else
249static const char extension[] = ".so";
250#endif
251static char *dl_name_converter(DSO *dso, const char *filename)
252 {
253 char *translated;
254 int len, rsize, transform;
255
256 len = strlen(filename);
257 rsize = len + 1;
258 transform = (strstr(filename, "/") == NULL);
259 {
260 /* We will convert this to "%s.s?" or "lib%s.s?" */
261 rsize += strlen(extension);/* The length of ".s?" */
262 if ((DSO_flags(dso) & DSO_FLAG_NAME_TRANSLATION_EXT_ONLY) == 0)
263 rsize += 3; /* The length of "lib" */
264 }
265 translated = OPENSSL_malloc(rsize);
266 if(translated == NULL)
267 {
268 DSOerr(DSO_F_DL_NAME_CONVERTER,
269 DSO_R_NAME_TRANSLATION_FAILED);
270 return(NULL);
271 }
272 if(transform)
273 {
274 if ((DSO_flags(dso) & DSO_FLAG_NAME_TRANSLATION_EXT_ONLY) == 0)
275 sprintf(translated, "lib%s%s", filename, extension);
276 else
277 sprintf(translated, "%s%s", filename, extension);
278 }
279 else
280 sprintf(translated, "%s", filename);
281 return(translated);
282 }
283
284#endif /* DSO_DL */
diff --git a/src/lib/libcrypto/dso/dso_dlfcn.c b/src/lib/libcrypto/dso/dso_dlfcn.c
index 0422a4859a..2e72969431 100644
--- a/src/lib/libcrypto/dso/dso_dlfcn.c
+++ b/src/lib/libcrypto/dso/dso_dlfcn.c
@@ -56,10 +56,6 @@
56 * 56 *
57 */ 57 */
58 58
59#ifdef __linux
60#define _GNU_SOURCE
61#endif
62
63#include <stdio.h> 59#include <stdio.h>
64#include "cryptlib.h" 60#include "cryptlib.h"
65#include <openssl/dso.h> 61#include <openssl/dso.h>
@@ -232,7 +228,7 @@ static void *dlfcn_bind_var(DSO *dso, const char *symname)
232static DSO_FUNC_TYPE dlfcn_bind_func(DSO *dso, const char *symname) 228static DSO_FUNC_TYPE dlfcn_bind_func(DSO *dso, const char *symname)
233 { 229 {
234 void *ptr; 230 void *ptr;
235 DSO_FUNC_TYPE sym, *tsym = &sym; 231 DSO_FUNC_TYPE sym;
236 232
237 if((dso == NULL) || (symname == NULL)) 233 if((dso == NULL) || (symname == NULL))
238 { 234 {
@@ -250,7 +246,7 @@ static DSO_FUNC_TYPE dlfcn_bind_func(DSO *dso, const char *symname)
250 DSOerr(DSO_F_DLFCN_BIND_FUNC,DSO_R_NULL_HANDLE); 246 DSOerr(DSO_F_DLFCN_BIND_FUNC,DSO_R_NULL_HANDLE);
251 return(NULL); 247 return(NULL);
252 } 248 }
253 *(void**)(tsym) = dlsym(ptr, symname); 249 sym = (DSO_FUNC_TYPE)dlsym(ptr, symname);
254 if(sym == NULL) 250 if(sym == NULL)
255 { 251 {
256 DSOerr(DSO_F_DLFCN_BIND_FUNC,DSO_R_SYM_FAILURE); 252 DSOerr(DSO_F_DLFCN_BIND_FUNC,DSO_R_SYM_FAILURE);
@@ -285,41 +281,13 @@ static char *dlfcn_name_converter(DSO *dso, const char *filename)
285 if(transform) 281 if(transform)
286 { 282 {
287 if ((DSO_flags(dso) & DSO_FLAG_NAME_TRANSLATION_EXT_ONLY) == 0) 283 if ((DSO_flags(dso) & DSO_FLAG_NAME_TRANSLATION_EXT_ONLY) == 0)
288 sprintf(translated, "lib%s.so", filename); 284 snprintf(translated, rsize, "lib%s.so", filename);
289 else 285 else
290 sprintf(translated, "%s.so", filename); 286 snprintf(translated, rsize, "%s.so", filename);
291 } 287 }
292 else 288 else
293 sprintf(translated, "%s", filename); 289 snprintf(translated, rsize, "%s", filename);
294 return(translated); 290 return(translated);
295 } 291 }
296 292
297#ifdef OPENSSL_FIPS
298static void dlfcn_ref_point(){}
299
300int DSO_pathbyaddr(void *addr,char *path,int sz)
301 {
302 Dl_info dli;
303 int len;
304
305 if (addr == NULL)
306 {
307 union { void(*f)(void); void *p; } t = { dlfcn_ref_point };
308 addr = t.p;
309 }
310
311 if (dladdr(addr,&dli))
312 {
313 len = (int)strlen(dli.dli_fname);
314 if (sz <= 0) return len+1;
315 if (len >= sz) len=sz-1;
316 memcpy(path,dli.dli_fname,len);
317 path[len++]=0;
318 return len;
319 }
320
321 ERR_add_error_data(4, "dlfcn_pathbyaddr(): ", dlerror());
322 return -1;
323 }
324#endif
325#endif /* DSO_DLFCN */ 293#endif /* DSO_DLFCN */
diff --git a/src/lib/libcrypto/dso/dso_err.c b/src/lib/libcrypto/dso/dso_err.c
index 581677cc36..cf452de1aa 100644
--- a/src/lib/libcrypto/dso/dso_err.c
+++ b/src/lib/libcrypto/dso/dso_err.c
@@ -1,6 +1,6 @@
1/* crypto/dso/dso_err.c */ 1/* crypto/dso/dso_err.c */
2/* ==================================================================== 2/* ====================================================================
3 * Copyright (c) 1999-2005 The OpenSSL Project. All rights reserved. 3 * Copyright (c) 1999 The OpenSSL Project. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
@@ -64,60 +64,56 @@
64 64
65/* BEGIN ERROR CODES */ 65/* BEGIN ERROR CODES */
66#ifndef OPENSSL_NO_ERR 66#ifndef OPENSSL_NO_ERR
67
68#define ERR_FUNC(func) ERR_PACK(ERR_LIB_DSO,func,0)
69#define ERR_REASON(reason) ERR_PACK(ERR_LIB_DSO,0,reason)
70
71static ERR_STRING_DATA DSO_str_functs[]= 67static ERR_STRING_DATA DSO_str_functs[]=
72 { 68 {
73{ERR_FUNC(DSO_F_DLFCN_BIND_FUNC), "DLFCN_BIND_FUNC"}, 69{ERR_PACK(0,DSO_F_DLFCN_BIND_FUNC,0), "DLFCN_BIND_FUNC"},
74{ERR_FUNC(DSO_F_DLFCN_BIND_VAR), "DLFCN_BIND_VAR"}, 70{ERR_PACK(0,DSO_F_DLFCN_BIND_VAR,0), "DLFCN_BIND_VAR"},
75{ERR_FUNC(DSO_F_DLFCN_LOAD), "DLFCN_LOAD"}, 71{ERR_PACK(0,DSO_F_DLFCN_LOAD,0), "DLFCN_LOAD"},
76{ERR_FUNC(DSO_F_DLFCN_NAME_CONVERTER), "DLFCN_NAME_CONVERTER"}, 72{ERR_PACK(0,DSO_F_DLFCN_NAME_CONVERTER,0), "DLFCN_NAME_CONVERTER"},
77{ERR_FUNC(DSO_F_DLFCN_UNLOAD), "DLFCN_UNLOAD"}, 73{ERR_PACK(0,DSO_F_DLFCN_UNLOAD,0), "DLFCN_UNLOAD"},
78{ERR_FUNC(DSO_F_DL_BIND_FUNC), "DL_BIND_FUNC"}, 74{ERR_PACK(0,DSO_F_DL_BIND_FUNC,0), "DL_BIND_FUNC"},
79{ERR_FUNC(DSO_F_DL_BIND_VAR), "DL_BIND_VAR"}, 75{ERR_PACK(0,DSO_F_DL_BIND_VAR,0), "DL_BIND_VAR"},
80{ERR_FUNC(DSO_F_DL_LOAD), "DL_LOAD"}, 76{ERR_PACK(0,DSO_F_DL_LOAD,0), "DL_LOAD"},
81{ERR_FUNC(DSO_F_DL_NAME_CONVERTER), "DL_NAME_CONVERTER"}, 77{ERR_PACK(0,DSO_F_DL_NAME_CONVERTER,0), "DL_NAME_CONVERTER"},
82{ERR_FUNC(DSO_F_DL_UNLOAD), "DL_UNLOAD"}, 78{ERR_PACK(0,DSO_F_DL_UNLOAD,0), "DL_UNLOAD"},
83{ERR_FUNC(DSO_F_DSO_BIND_FUNC), "DSO_bind_func"}, 79{ERR_PACK(0,DSO_F_DSO_BIND_FUNC,0), "DSO_bind_func"},
84{ERR_FUNC(DSO_F_DSO_BIND_VAR), "DSO_bind_var"}, 80{ERR_PACK(0,DSO_F_DSO_BIND_VAR,0), "DSO_bind_var"},
85{ERR_FUNC(DSO_F_DSO_CONVERT_FILENAME), "DSO_convert_filename"}, 81{ERR_PACK(0,DSO_F_DSO_CONVERT_FILENAME,0), "DSO_convert_filename"},
86{ERR_FUNC(DSO_F_DSO_CTRL), "DSO_ctrl"}, 82{ERR_PACK(0,DSO_F_DSO_CTRL,0), "DSO_ctrl"},
87{ERR_FUNC(DSO_F_DSO_FREE), "DSO_free"}, 83{ERR_PACK(0,DSO_F_DSO_FREE,0), "DSO_free"},
88{ERR_FUNC(DSO_F_DSO_GET_FILENAME), "DSO_get_filename"}, 84{ERR_PACK(0,DSO_F_DSO_GET_FILENAME,0), "DSO_get_filename"},
89{ERR_FUNC(DSO_F_DSO_GET_LOADED_FILENAME), "DSO_get_loaded_filename"}, 85{ERR_PACK(0,DSO_F_DSO_GET_LOADED_FILENAME,0), "DSO_get_loaded_filename"},
90{ERR_FUNC(DSO_F_DSO_LOAD), "DSO_load"}, 86{ERR_PACK(0,DSO_F_DSO_LOAD,0), "DSO_load"},
91{ERR_FUNC(DSO_F_DSO_NEW_METHOD), "DSO_new_method"}, 87{ERR_PACK(0,DSO_F_DSO_NEW_METHOD,0), "DSO_new_method"},
92{ERR_FUNC(DSO_F_DSO_SET_FILENAME), "DSO_set_filename"}, 88{ERR_PACK(0,DSO_F_DSO_SET_FILENAME,0), "DSO_set_filename"},
93{ERR_FUNC(DSO_F_DSO_SET_NAME_CONVERTER), "DSO_set_name_converter"}, 89{ERR_PACK(0,DSO_F_DSO_SET_NAME_CONVERTER,0), "DSO_set_name_converter"},
94{ERR_FUNC(DSO_F_DSO_UP_REF), "DSO_up_ref"}, 90{ERR_PACK(0,DSO_F_DSO_UP_REF,0), "DSO_up_ref"},
95{ERR_FUNC(DSO_F_VMS_BIND_VAR), "VMS_BIND_VAR"}, 91{ERR_PACK(0,DSO_F_VMS_BIND_VAR,0), "VMS_BIND_VAR"},
96{ERR_FUNC(DSO_F_VMS_LOAD), "VMS_LOAD"}, 92{ERR_PACK(0,DSO_F_VMS_LOAD,0), "VMS_LOAD"},
97{ERR_FUNC(DSO_F_VMS_UNLOAD), "VMS_UNLOAD"}, 93{ERR_PACK(0,DSO_F_VMS_UNLOAD,0), "VMS_UNLOAD"},
98{ERR_FUNC(DSO_F_WIN32_BIND_FUNC), "WIN32_BIND_FUNC"}, 94{ERR_PACK(0,DSO_F_WIN32_BIND_FUNC,0), "WIN32_BIND_FUNC"},
99{ERR_FUNC(DSO_F_WIN32_BIND_VAR), "WIN32_BIND_VAR"}, 95{ERR_PACK(0,DSO_F_WIN32_BIND_VAR,0), "WIN32_BIND_VAR"},
100{ERR_FUNC(DSO_F_WIN32_LOAD), "WIN32_LOAD"}, 96{ERR_PACK(0,DSO_F_WIN32_LOAD,0), "WIN32_LOAD"},
101{ERR_FUNC(DSO_F_WIN32_NAME_CONVERTER), "WIN32_NAME_CONVERTER"}, 97{ERR_PACK(0,DSO_F_WIN32_NAME_CONVERTER,0), "WIN32_NAME_CONVERTER"},
102{ERR_FUNC(DSO_F_WIN32_UNLOAD), "WIN32_UNLOAD"}, 98{ERR_PACK(0,DSO_F_WIN32_UNLOAD,0), "WIN32_UNLOAD"},
103{0,NULL} 99{0,NULL}
104 }; 100 };
105 101
106static ERR_STRING_DATA DSO_str_reasons[]= 102static ERR_STRING_DATA DSO_str_reasons[]=
107 { 103 {
108{ERR_REASON(DSO_R_CTRL_FAILED) ,"control command failed"}, 104{DSO_R_CTRL_FAILED ,"control command failed"},
109{ERR_REASON(DSO_R_DSO_ALREADY_LOADED) ,"dso already loaded"}, 105{DSO_R_DSO_ALREADY_LOADED ,"dso already loaded"},
110{ERR_REASON(DSO_R_FILENAME_TOO_BIG) ,"filename too big"}, 106{DSO_R_FILENAME_TOO_BIG ,"filename too big"},
111{ERR_REASON(DSO_R_FINISH_FAILED) ,"cleanup method function failed"}, 107{DSO_R_FINISH_FAILED ,"cleanup method function failed"},
112{ERR_REASON(DSO_R_LOAD_FAILED) ,"could not load the shared library"}, 108{DSO_R_LOAD_FAILED ,"could not load the shared library"},
113{ERR_REASON(DSO_R_NAME_TRANSLATION_FAILED),"name translation failed"}, 109{DSO_R_NAME_TRANSLATION_FAILED ,"name translation failed"},
114{ERR_REASON(DSO_R_NO_FILENAME) ,"no filename"}, 110{DSO_R_NO_FILENAME ,"no filename"},
115{ERR_REASON(DSO_R_NULL_HANDLE) ,"a null shared library handle was used"}, 111{DSO_R_NULL_HANDLE ,"a null shared library handle was used"},
116{ERR_REASON(DSO_R_SET_FILENAME_FAILED) ,"set filename failed"}, 112{DSO_R_SET_FILENAME_FAILED ,"set filename failed"},
117{ERR_REASON(DSO_R_STACK_ERROR) ,"the meth_data stack is corrupt"}, 113{DSO_R_STACK_ERROR ,"the meth_data stack is corrupt"},
118{ERR_REASON(DSO_R_SYM_FAILURE) ,"could not bind to the requested symbol name"}, 114{DSO_R_SYM_FAILURE ,"could not bind to the requested symbol name"},
119{ERR_REASON(DSO_R_UNLOAD_FAILED) ,"could not unload the shared library"}, 115{DSO_R_UNLOAD_FAILED ,"could not unload the shared library"},
120{ERR_REASON(DSO_R_UNSUPPORTED) ,"functionality not supported"}, 116{DSO_R_UNSUPPORTED ,"functionality not supported"},
121{0,NULL} 117{0,NULL}
122 }; 118 };
123 119
@@ -131,8 +127,8 @@ void ERR_load_DSO_strings(void)
131 { 127 {
132 init=0; 128 init=0;
133#ifndef OPENSSL_NO_ERR 129#ifndef OPENSSL_NO_ERR
134 ERR_load_strings(0,DSO_str_functs); 130 ERR_load_strings(ERR_LIB_DSO,DSO_str_functs);
135 ERR_load_strings(0,DSO_str_reasons); 131 ERR_load_strings(ERR_LIB_DSO,DSO_str_reasons);
136#endif 132#endif
137 133
138 } 134 }
diff --git a/src/lib/libcrypto/dso/dso_vms.c b/src/lib/libcrypto/dso/dso_vms.c
new file mode 100644
index 0000000000..1674619d17
--- /dev/null
+++ b/src/lib/libcrypto/dso/dso_vms.c
@@ -0,0 +1,379 @@
1/* dso_vms.c */
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 <lib$routines.h>
67#include <stsdef.h>
68#include <descrip.h>
69#include <starlet.h>
70#endif
71
72#ifndef OPENSSL_SYS_VMS
73DSO_METHOD *DSO_METHOD_vms(void)
74 {
75 return NULL;
76 }
77#else
78#pragma message disable DOLLARID
79
80static int vms_load(DSO *dso);
81static int vms_unload(DSO *dso);
82static void *vms_bind_var(DSO *dso, const char *symname);
83static DSO_FUNC_TYPE vms_bind_func(DSO *dso, const char *symname);
84#if 0
85static int vms_unbind_var(DSO *dso, char *symname, void *symptr);
86static int vms_unbind_func(DSO *dso, char *symname, DSO_FUNC_TYPE symptr);
87static int vms_init(DSO *dso);
88static int vms_finish(DSO *dso);
89static long vms_ctrl(DSO *dso, int cmd, long larg, void *parg);
90#endif
91static char *vms_name_converter(DSO *dso, const char *filename);
92
93static DSO_METHOD dso_meth_vms = {
94 "OpenSSL 'VMS' shared library method",
95 vms_load,
96 NULL, /* unload */
97 vms_bind_var,
98 vms_bind_func,
99/* For now, "unbind" doesn't exist */
100#if 0
101 NULL, /* unbind_var */
102 NULL, /* unbind_func */
103#endif
104 NULL, /* ctrl */
105 vms_name_converter,
106 NULL, /* init */
107 NULL /* finish */
108 };
109
110/* On VMS, the only "handle" is the file name. LIB$FIND_IMAGE_SYMBOL depends
111 * on the reference to the file name being the same for all calls regarding
112 * one shared image, so we'll just store it in an instance of the following
113 * structure and put a pointer to that instance in the meth_data stack.
114 */
115typedef struct dso_internal_st
116 {
117 /* This should contain the name only, no directory,
118 * no extension, nothing but a name. */
119 struct dsc$descriptor_s filename_dsc;
120 char filename[FILENAME_MAX+1];
121 /* This contains whatever is not in filename, if needed.
122 * Normally not defined. */
123 struct dsc$descriptor_s imagename_dsc;
124 char imagename[FILENAME_MAX+1];
125 } DSO_VMS_INTERNAL;
126
127
128DSO_METHOD *DSO_METHOD_vms(void)
129 {
130 return(&dso_meth_vms);
131 }
132
133static int vms_load(DSO *dso)
134 {
135 void *ptr = NULL;
136 /* See applicable comments in dso_dl.c */
137 char *filename = DSO_convert_filename(dso, NULL);
138 DSO_VMS_INTERNAL *p;
139 const char *sp1, *sp2; /* Search result */
140
141 if(filename == NULL)
142 {
143 DSOerr(DSO_F_DLFCN_LOAD,DSO_R_NO_FILENAME);
144 goto err;
145 }
146
147 /* A file specification may look like this:
148 *
149 * node::dev:[dir-spec]name.type;ver
150 *
151 * or (for compatibility with TOPS-20):
152 *
153 * node::dev:<dir-spec>name.type;ver
154 *
155 * and the dir-spec uses '.' as separator. Also, a dir-spec
156 * may consist of several parts, with mixed use of [] and <>:
157 *
158 * [dir1.]<dir2>
159 *
160 * We need to split the file specification into the name and
161 * the rest (both before and after the name itself).
162 */
163 /* Start with trying to find the end of a dir-spec, and save the
164 position of the byte after in sp1 */
165 sp1 = strrchr(filename, ']');
166 sp2 = strrchr(filename, '>');
167 if (sp1 == NULL) sp1 = sp2;
168 if (sp2 != NULL && sp2 > sp1) sp1 = sp2;
169 if (sp1 == NULL) sp1 = strrchr(filename, ':');
170 if (sp1 == NULL)
171 sp1 = filename;
172 else
173 sp1++; /* The byte after the found character */
174 /* Now, let's see if there's a type, and save the position in sp2 */
175 sp2 = strchr(sp1, '.');
176 /* If we found it, that's where we'll cut. Otherwise, look for a
177 version number and save the position in sp2 */
178 if (sp2 == NULL) sp2 = strchr(sp1, ';');
179 /* If there was still nothing to find, set sp2 to point at the end of
180 the string */
181 if (sp2 == NULL) sp2 = sp1 + strlen(sp1);
182
183 /* Check that we won't get buffer overflows */
184 if (sp2 - sp1 > FILENAME_MAX
185 || (sp1 - filename) + strlen(sp2) > FILENAME_MAX)
186 {
187 DSOerr(DSO_F_VMS_LOAD,DSO_R_FILENAME_TOO_BIG);
188 goto err;
189 }
190
191 p = (DSO_VMS_INTERNAL *)OPENSSL_malloc(sizeof(DSO_VMS_INTERNAL));
192 if(p == NULL)
193 {
194 DSOerr(DSO_F_VMS_LOAD,ERR_R_MALLOC_FAILURE);
195 goto err;
196 }
197
198 strncpy(p->filename, sp1, sp2-sp1);
199 p->filename[sp2-sp1] = '\0';
200
201 strncpy(p->imagename, filename, sp1-filename);
202 p->imagename[sp1-filename] = '\0';
203 strcat(p->imagename, sp2);
204
205 p->filename_dsc.dsc$w_length = strlen(p->filename);
206 p->filename_dsc.dsc$b_dtype = DSC$K_DTYPE_T;
207 p->filename_dsc.dsc$b_class = DSC$K_CLASS_S;
208 p->filename_dsc.dsc$a_pointer = p->filename;
209 p->imagename_dsc.dsc$w_length = strlen(p->imagename);
210 p->imagename_dsc.dsc$b_dtype = DSC$K_DTYPE_T;
211 p->imagename_dsc.dsc$b_class = DSC$K_CLASS_S;
212 p->imagename_dsc.dsc$a_pointer = p->imagename;
213
214 if(!sk_push(dso->meth_data, (char *)p))
215 {
216 DSOerr(DSO_F_VMS_LOAD,DSO_R_STACK_ERROR);
217 goto err;
218 }
219
220 /* Success (for now, we lie. We actually do not know...) */
221 dso->loaded_filename = filename;
222 return(1);
223err:
224 /* Cleanup! */
225 if(p != NULL)
226 OPENSSL_free(p);
227 if(filename != NULL)
228 OPENSSL_free(filename);
229 return(0);
230 }
231
232/* Note that this doesn't actually unload the shared image, as there is no
233 * such thing in VMS. Next time it get loaded again, a new copy will
234 * actually be loaded.
235 */
236static int vms_unload(DSO *dso)
237 {
238 DSO_VMS_INTERNAL *p;
239 if(dso == NULL)
240 {
241 DSOerr(DSO_F_VMS_UNLOAD,ERR_R_PASSED_NULL_PARAMETER);
242 return(0);
243 }
244 if(sk_num(dso->meth_data) < 1)
245 return(1);
246 p = (DSO_VMS_INTERNAL *)sk_pop(dso->meth_data);
247 if(p == NULL)
248 {
249 DSOerr(DSO_F_VMS_UNLOAD,DSO_R_NULL_HANDLE);
250 return(0);
251 }
252 /* Cleanup */
253 OPENSSL_free(p);
254 return(1);
255 }
256
257/* We must do this in a separate function because of the way the exception
258 handler works (it makes this function return */
259static int do_find_symbol(DSO_VMS_INTERNAL *ptr,
260 struct dsc$descriptor_s *symname_dsc, void **sym,
261 unsigned long flags)
262 {
263 /* Make sure that signals are caught and returned instead of
264 aborting the program. The exception handler gets unestablished
265 automatically on return from this function. */
266 lib$establish(lib$sig_to_ret);
267
268 if(ptr->imagename_dsc.dsc$w_length)
269 return lib$find_image_symbol(&ptr->filename_dsc,
270 symname_dsc, sym,
271 &ptr->imagename_dsc, flags);
272 else
273 return lib$find_image_symbol(&ptr->filename_dsc,
274 symname_dsc, sym,
275 0, flags);
276 }
277
278void vms_bind_sym(DSO *dso, const char *symname, void **sym)
279 {
280 DSO_VMS_INTERNAL *ptr;
281 int status;
282#if 0
283 int flags = (1<<4); /* LIB$M_FIS_MIXEDCASE, but this symbol isn't
284 defined in VMS older than 7.0 or so */
285#else
286 int flags = 0;
287#endif
288 struct dsc$descriptor_s symname_dsc;
289 *sym = NULL;
290
291 symname_dsc.dsc$w_length = strlen(symname);
292 symname_dsc.dsc$b_dtype = DSC$K_DTYPE_T;
293 symname_dsc.dsc$b_class = DSC$K_CLASS_S;
294 symname_dsc.dsc$a_pointer = (char *)symname; /* The cast is needed */
295
296 if((dso == NULL) || (symname == NULL))
297 {
298 DSOerr(DSO_F_VMS_BIND_VAR,ERR_R_PASSED_NULL_PARAMETER);
299 return;
300 }
301 if(sk_num(dso->meth_data) < 1)
302 {
303 DSOerr(DSO_F_VMS_BIND_VAR,DSO_R_STACK_ERROR);
304 return;
305 }
306 ptr = (DSO_VMS_INTERNAL *)sk_value(dso->meth_data,
307 sk_num(dso->meth_data) - 1);
308 if(ptr == NULL)
309 {
310 DSOerr(DSO_F_VMS_BIND_VAR,DSO_R_NULL_HANDLE);
311 return;
312 }
313
314 if(dso->flags & DSO_FLAG_UPCASE_SYMBOL) flags = 0;
315
316 status = do_find_symbol(ptr, &symname_dsc, sym, flags);
317
318 if(!$VMS_STATUS_SUCCESS(status))
319 {
320 unsigned short length;
321 char errstring[257];
322 struct dsc$descriptor_s errstring_dsc;
323
324 errstring_dsc.dsc$w_length = sizeof(errstring);
325 errstring_dsc.dsc$b_dtype = DSC$K_DTYPE_T;
326 errstring_dsc.dsc$b_class = DSC$K_CLASS_S;
327 errstring_dsc.dsc$a_pointer = errstring;
328
329 *sym = NULL;
330
331 status = sys$getmsg(status, &length, &errstring_dsc, 1, 0);
332
333 if (!$VMS_STATUS_SUCCESS(status))
334 lib$signal(status); /* This is really bad. Abort! */
335 else
336 {
337 errstring[length] = '\0';
338
339 DSOerr(DSO_F_VMS_BIND_VAR,DSO_R_SYM_FAILURE);
340 if (ptr->imagename_dsc.dsc$w_length)
341 ERR_add_error_data(9,
342 "Symbol ", symname,
343 " in ", ptr->filename,
344 " (", ptr->imagename, ")",
345 ": ", errstring);
346 else
347 ERR_add_error_data(6,
348 "Symbol ", symname,
349 " in ", ptr->filename,
350 ": ", errstring);
351 }
352 return;
353 }
354 return;
355 }
356
357static void *vms_bind_var(DSO *dso, const char *symname)
358 {
359 void *sym = 0;
360 vms_bind_sym(dso, symname, &sym);
361 return sym;
362 }
363
364static DSO_FUNC_TYPE vms_bind_func(DSO *dso, const char *symname)
365 {
366 DSO_FUNC_TYPE sym = 0;
367 vms_bind_sym(dso, symname, (void **)&sym);
368 return sym;
369 }
370
371static char *vms_name_converter(DSO *dso, const char *filename)
372 {
373 int len = strlen(filename);
374 char *not_translated = OPENSSL_malloc(len+1);
375 strcpy(not_translated,filename);
376 return(not_translated);
377 }
378
379#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..3fa90eb27c
--- /dev/null
+++ b/src/lib/libcrypto/dso/dso_win32.c
@@ -0,0 +1,279 @@
1/* dso_win32.c */
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/* Part of the hack in "win32_load" ... */
72#define DSO_MAX_TRANSLATED_SIZE 256
73
74static int win32_load(DSO *dso);
75static int win32_unload(DSO *dso);
76static void *win32_bind_var(DSO *dso, const char *symname);
77static DSO_FUNC_TYPE win32_bind_func(DSO *dso, const char *symname);
78#if 0
79static int win32_unbind_var(DSO *dso, char *symname, void *symptr);
80static int win32_unbind_func(DSO *dso, char *symname, DSO_FUNC_TYPE symptr);
81static int win32_init(DSO *dso);
82static int win32_finish(DSO *dso);
83static long win32_ctrl(DSO *dso, int cmd, long larg, void *parg);
84#endif
85static char *win32_name_converter(DSO *dso, const char *filename);
86
87static DSO_METHOD dso_meth_win32 = {
88 "OpenSSL 'win32' shared library method",
89 win32_load,
90 win32_unload,
91 win32_bind_var,
92 win32_bind_func,
93/* For now, "unbind" doesn't exist */
94#if 0
95 NULL, /* unbind_var */
96 NULL, /* unbind_func */
97#endif
98 NULL, /* ctrl */
99 win32_name_converter,
100 NULL, /* init */
101 NULL /* finish */
102 };
103
104DSO_METHOD *DSO_METHOD_win32(void)
105 {
106 return(&dso_meth_win32);
107 }
108
109/* For this DSO_METHOD, our meth_data STACK will contain;
110 * (i) a pointer to the handle (HINSTANCE) returned from
111 * LoadLibrary(), and copied.
112 */
113
114static int win32_load(DSO *dso)
115 {
116 HINSTANCE h = NULL, *p = NULL;
117 /* See applicable comments from dso_dl.c */
118 char *filename = DSO_convert_filename(dso, NULL);
119
120 if(filename == NULL)
121 {
122 DSOerr(DSO_F_WIN32_LOAD,DSO_R_NO_FILENAME);
123 goto err;
124 }
125 h = LoadLibrary(filename);
126 if(h == NULL)
127 {
128 DSOerr(DSO_F_WIN32_LOAD,DSO_R_LOAD_FAILED);
129 ERR_add_error_data(3, "filename(", filename, ")");
130 goto err;
131 }
132 p = (HINSTANCE *)OPENSSL_malloc(sizeof(HINSTANCE));
133 if(p == NULL)
134 {
135 DSOerr(DSO_F_WIN32_LOAD,ERR_R_MALLOC_FAILURE);
136 goto err;
137 }
138 *p = h;
139 if(!sk_push(dso->meth_data, (char *)p))
140 {
141 DSOerr(DSO_F_WIN32_LOAD,DSO_R_STACK_ERROR);
142 goto err;
143 }
144 /* Success */
145 dso->loaded_filename = filename;
146 return(1);
147err:
148 /* Cleanup !*/
149 if(filename != NULL)
150 OPENSSL_free(filename);
151 if(p != NULL)
152 OPENSSL_free(p);
153 if(h != NULL)
154 FreeLibrary(h);
155 return(0);
156 }
157
158static int win32_unload(DSO *dso)
159 {
160 HINSTANCE *p;
161 if(dso == NULL)
162 {
163 DSOerr(DSO_F_WIN32_UNLOAD,ERR_R_PASSED_NULL_PARAMETER);
164 return(0);
165 }
166 if(sk_num(dso->meth_data) < 1)
167 return(1);
168 p = (HINSTANCE *)sk_pop(dso->meth_data);
169 if(p == NULL)
170 {
171 DSOerr(DSO_F_WIN32_UNLOAD,DSO_R_NULL_HANDLE);
172 return(0);
173 }
174 if(!FreeLibrary(*p))
175 {
176 DSOerr(DSO_F_WIN32_UNLOAD,DSO_R_UNLOAD_FAILED);
177 /* We should push the value back onto the stack in
178 * case of a retry. */
179 sk_push(dso->meth_data, (char *)p);
180 return(0);
181 }
182 /* Cleanup */
183 OPENSSL_free(p);
184 return(1);
185 }
186
187/* Using GetProcAddress for variables? TODO: Check this out in
188 * the Win32 API docs, there's probably a variant for variables. */
189static void *win32_bind_var(DSO *dso, const char *symname)
190 {
191 HINSTANCE *ptr;
192 void *sym;
193
194 if((dso == NULL) || (symname == NULL))
195 {
196 DSOerr(DSO_F_WIN32_BIND_VAR,ERR_R_PASSED_NULL_PARAMETER);
197 return(NULL);
198 }
199 if(sk_num(dso->meth_data) < 1)
200 {
201 DSOerr(DSO_F_WIN32_BIND_VAR,DSO_R_STACK_ERROR);
202 return(NULL);
203 }
204 ptr = (HINSTANCE *)sk_value(dso->meth_data, sk_num(dso->meth_data) - 1);
205 if(ptr == NULL)
206 {
207 DSOerr(DSO_F_WIN32_BIND_VAR,DSO_R_NULL_HANDLE);
208 return(NULL);
209 }
210 sym = GetProcAddress(*ptr, symname);
211 if(sym == NULL)
212 {
213 DSOerr(DSO_F_WIN32_BIND_VAR,DSO_R_SYM_FAILURE);
214 ERR_add_error_data(3, "symname(", symname, ")");
215 return(NULL);
216 }
217 return(sym);
218 }
219
220static DSO_FUNC_TYPE win32_bind_func(DSO *dso, const char *symname)
221 {
222 HINSTANCE *ptr;
223 void *sym;
224
225 if((dso == NULL) || (symname == NULL))
226 {
227 DSOerr(DSO_F_WIN32_BIND_FUNC,ERR_R_PASSED_NULL_PARAMETER);
228 return(NULL);
229 }
230 if(sk_num(dso->meth_data) < 1)
231 {
232 DSOerr(DSO_F_WIN32_BIND_FUNC,DSO_R_STACK_ERROR);
233 return(NULL);
234 }
235 ptr = (HINSTANCE *)sk_value(dso->meth_data, sk_num(dso->meth_data) - 1);
236 if(ptr == NULL)
237 {
238 DSOerr(DSO_F_WIN32_BIND_FUNC,DSO_R_NULL_HANDLE);
239 return(NULL);
240 }
241 sym = GetProcAddress(*ptr, symname);
242 if(sym == NULL)
243 {
244 DSOerr(DSO_F_WIN32_BIND_FUNC,DSO_R_SYM_FAILURE);
245 ERR_add_error_data(3, "symname(", symname, ")");
246 return(NULL);
247 }
248 return((DSO_FUNC_TYPE)sym);
249 }
250
251static char *win32_name_converter(DSO *dso, const char *filename)
252 {
253 char *translated;
254 int len, transform;
255
256 len = strlen(filename);
257 transform = ((strstr(filename, "/") == NULL) &&
258 (strstr(filename, "\\") == NULL) &&
259 (strstr(filename, ":") == NULL));
260 if(transform)
261 /* We will convert this to "%s.dll" */
262 translated = OPENSSL_malloc(len + 5);
263 else
264 /* We will simply duplicate filename */
265 translated = OPENSSL_malloc(len + 1);
266 if(translated == NULL)
267 {
268 DSOerr(DSO_F_WIN32_NAME_CONVERTER,
269 DSO_R_NAME_TRANSLATION_FAILED);
270 return(NULL);
271 }
272 if(transform)
273 sprintf(translated, "%s.dll", filename);
274 else
275 sprintf(translated, "%s", filename);
276 return(translated);
277 }
278
279#endif /* OPENSSL_SYS_WIN32 */
diff --git a/src/lib/libcrypto/ebcdic.c b/src/lib/libcrypto/ebcdic.c
new file mode 100644
index 0000000000..d1bece87f7
--- /dev/null
+++ b/src/lib/libcrypto/ebcdic.c
@@ -0,0 +1,218 @@
1/* crypto/ebcdic.c */
2
3#ifdef CHARSET_EBCDIC
4#include "ebcdic.h"
5/* Initial Port for Apache-1.3 by <Martin.Kraemer@Mch.SNI.De>
6 * Adapted for OpenSSL-0.9.4 by <Martin.Kraemer@Mch.SNI.De>
7 */
8
9#ifdef _OSD_POSIX
10/*
11 "BS2000 OSD" is a POSIX subsystem on a main frame.
12 It is made by Siemens AG, Germany, for their BS2000 mainframe machines.
13 Within the POSIX subsystem, the same character set was chosen as in
14 "native BS2000", namely EBCDIC. (EDF04)
15
16 The name "ASCII" in these routines is misleading: actually, conversion
17 is not between EBCDIC and ASCII, but EBCDIC(EDF04) and ISO-8859.1;
18 that means that (western european) national characters are preserved.
19
20 This table is identical to the one used by rsh/rcp/ftp and other POSIX tools.
21*/
22
23/* Here's the bijective ebcdic-to-ascii table: */
24const unsigned char os_toascii[256] = {
25/*00*/ 0x00, 0x01, 0x02, 0x03, 0x85, 0x09, 0x86, 0x7f,
26 0x87, 0x8d, 0x8e, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /*................*/
27/*10*/ 0x10, 0x11, 0x12, 0x13, 0x8f, 0x0a, 0x08, 0x97,
28 0x18, 0x19, 0x9c, 0x9d, 0x1c, 0x1d, 0x1e, 0x1f, /*................*/
29/*20*/ 0x80, 0x81, 0x82, 0x83, 0x84, 0x92, 0x17, 0x1b,
30 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x05, 0x06, 0x07, /*................*/
31/*30*/ 0x90, 0x91, 0x16, 0x93, 0x94, 0x95, 0x96, 0x04,
32 0x98, 0x99, 0x9a, 0x9b, 0x14, 0x15, 0x9e, 0x1a, /*................*/
33/*40*/ 0x20, 0xa0, 0xe2, 0xe4, 0xe0, 0xe1, 0xe3, 0xe5,
34 0xe7, 0xf1, 0x60, 0x2e, 0x3c, 0x28, 0x2b, 0x7c, /* .........`.<(+|*/
35/*50*/ 0x26, 0xe9, 0xea, 0xeb, 0xe8, 0xed, 0xee, 0xef,
36 0xec, 0xdf, 0x21, 0x24, 0x2a, 0x29, 0x3b, 0x9f, /*&.........!$*);.*/
37/*60*/ 0x2d, 0x2f, 0xc2, 0xc4, 0xc0, 0xc1, 0xc3, 0xc5,
38 0xc7, 0xd1, 0x5e, 0x2c, 0x25, 0x5f, 0x3e, 0x3f, /*-/........^,%_>?*/
39/*70*/ 0xf8, 0xc9, 0xca, 0xcb, 0xc8, 0xcd, 0xce, 0xcf,
40 0xcc, 0xa8, 0x3a, 0x23, 0x40, 0x27, 0x3d, 0x22, /*..........:#@'="*/
41/*80*/ 0xd8, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
42 0x68, 0x69, 0xab, 0xbb, 0xf0, 0xfd, 0xfe, 0xb1, /*.abcdefghi......*/
43/*90*/ 0xb0, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70,
44 0x71, 0x72, 0xaa, 0xba, 0xe6, 0xb8, 0xc6, 0xa4, /*.jklmnopqr......*/
45/*a0*/ 0xb5, 0xaf, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78,
46 0x79, 0x7a, 0xa1, 0xbf, 0xd0, 0xdd, 0xde, 0xae, /*..stuvwxyz......*/
47/*b0*/ 0xa2, 0xa3, 0xa5, 0xb7, 0xa9, 0xa7, 0xb6, 0xbc,
48 0xbd, 0xbe, 0xac, 0x5b, 0x5c, 0x5d, 0xb4, 0xd7, /*...........[\]..*/
49/*c0*/ 0xf9, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,
50 0x48, 0x49, 0xad, 0xf4, 0xf6, 0xf2, 0xf3, 0xf5, /*.ABCDEFGHI......*/
51/*d0*/ 0xa6, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50,
52 0x51, 0x52, 0xb9, 0xfb, 0xfc, 0xdb, 0xfa, 0xff, /*.JKLMNOPQR......*/
53/*e0*/ 0xd9, 0xf7, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58,
54 0x59, 0x5a, 0xb2, 0xd4, 0xd6, 0xd2, 0xd3, 0xd5, /*..STUVWXYZ......*/
55/*f0*/ 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
56 0x38, 0x39, 0xb3, 0x7b, 0xdc, 0x7d, 0xda, 0x7e /*0123456789.{.}.~*/
57};
58
59
60/* The ascii-to-ebcdic table: */
61const unsigned char os_toebcdic[256] = {
62/*00*/ 0x00, 0x01, 0x02, 0x03, 0x37, 0x2d, 0x2e, 0x2f,
63 0x16, 0x05, 0x15, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /*................*/
64/*10*/ 0x10, 0x11, 0x12, 0x13, 0x3c, 0x3d, 0x32, 0x26,
65 0x18, 0x19, 0x3f, 0x27, 0x1c, 0x1d, 0x1e, 0x1f, /*................*/
66/*20*/ 0x40, 0x5a, 0x7f, 0x7b, 0x5b, 0x6c, 0x50, 0x7d,
67 0x4d, 0x5d, 0x5c, 0x4e, 0x6b, 0x60, 0x4b, 0x61, /* !"#$%&'()*+,-./ */
68/*30*/ 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7,
69 0xf8, 0xf9, 0x7a, 0x5e, 0x4c, 0x7e, 0x6e, 0x6f, /*0123456789:;<=>?*/
70/*40*/ 0x7c, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7,
71 0xc8, 0xc9, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, /*@ABCDEFGHIJKLMNO*/
72/*50*/ 0xd7, 0xd8, 0xd9, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6,
73 0xe7, 0xe8, 0xe9, 0xbb, 0xbc, 0xbd, 0x6a, 0x6d, /*PQRSTUVWXYZ[\]^_*/
74/*60*/ 0x4a, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
75 0x88, 0x89, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, /*`abcdefghijklmno*/
76/*70*/ 0x97, 0x98, 0x99, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6,
77 0xa7, 0xa8, 0xa9, 0xfb, 0x4f, 0xfd, 0xff, 0x07, /*pqrstuvwxyz{|}~.*/
78/*80*/ 0x20, 0x21, 0x22, 0x23, 0x24, 0x04, 0x06, 0x08,
79 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x09, 0x0a, 0x14, /*................*/
80/*90*/ 0x30, 0x31, 0x25, 0x33, 0x34, 0x35, 0x36, 0x17,
81 0x38, 0x39, 0x3a, 0x3b, 0x1a, 0x1b, 0x3e, 0x5f, /*................*/
82/*a0*/ 0x41, 0xaa, 0xb0, 0xb1, 0x9f, 0xb2, 0xd0, 0xb5,
83 0x79, 0xb4, 0x9a, 0x8a, 0xba, 0xca, 0xaf, 0xa1, /*................*/
84/*b0*/ 0x90, 0x8f, 0xea, 0xfa, 0xbe, 0xa0, 0xb6, 0xb3,
85 0x9d, 0xda, 0x9b, 0x8b, 0xb7, 0xb8, 0xb9, 0xab, /*................*/
86/*c0*/ 0x64, 0x65, 0x62, 0x66, 0x63, 0x67, 0x9e, 0x68,
87 0x74, 0x71, 0x72, 0x73, 0x78, 0x75, 0x76, 0x77, /*................*/
88/*d0*/ 0xac, 0x69, 0xed, 0xee, 0xeb, 0xef, 0xec, 0xbf,
89 0x80, 0xe0, 0xfe, 0xdd, 0xfc, 0xad, 0xae, 0x59, /*................*/
90/*e0*/ 0x44, 0x45, 0x42, 0x46, 0x43, 0x47, 0x9c, 0x48,
91 0x54, 0x51, 0x52, 0x53, 0x58, 0x55, 0x56, 0x57, /*................*/
92/*f0*/ 0x8c, 0x49, 0xcd, 0xce, 0xcb, 0xcf, 0xcc, 0xe1,
93 0x70, 0xc0, 0xde, 0xdb, 0xdc, 0x8d, 0x8e, 0xdf /*................*/
94};
95
96#else /*_OSD_POSIX*/
97
98/*
99This code does basic character mapping for IBM's TPF and OS/390 operating systems.
100It is a modified version of the BS2000 table.
101
102Bijective EBCDIC (character set IBM-1047) to US-ASCII table:
103This table is bijective - there are no ambigous or duplicate characters.
104*/
105const unsigned char os_toascii[256] = {
106 0x00, 0x01, 0x02, 0x03, 0x85, 0x09, 0x86, 0x7f, /* 00-0f: */
107 0x87, 0x8d, 0x8e, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* ................ */
108 0x10, 0x11, 0x12, 0x13, 0x8f, 0x0a, 0x08, 0x97, /* 10-1f: */
109 0x18, 0x19, 0x9c, 0x9d, 0x1c, 0x1d, 0x1e, 0x1f, /* ................ */
110 0x80, 0x81, 0x82, 0x83, 0x84, 0x92, 0x17, 0x1b, /* 20-2f: */
111 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x05, 0x06, 0x07, /* ................ */
112 0x90, 0x91, 0x16, 0x93, 0x94, 0x95, 0x96, 0x04, /* 30-3f: */
113 0x98, 0x99, 0x9a, 0x9b, 0x14, 0x15, 0x9e, 0x1a, /* ................ */
114 0x20, 0xa0, 0xe2, 0xe4, 0xe0, 0xe1, 0xe3, 0xe5, /* 40-4f: */
115 0xe7, 0xf1, 0xa2, 0x2e, 0x3c, 0x28, 0x2b, 0x7c, /* ...........<(+| */
116 0x26, 0xe9, 0xea, 0xeb, 0xe8, 0xed, 0xee, 0xef, /* 50-5f: */
117 0xec, 0xdf, 0x21, 0x24, 0x2a, 0x29, 0x3b, 0x5e, /* &.........!$*);^ */
118 0x2d, 0x2f, 0xc2, 0xc4, 0xc0, 0xc1, 0xc3, 0xc5, /* 60-6f: */
119 0xc7, 0xd1, 0xa6, 0x2c, 0x25, 0x5f, 0x3e, 0x3f, /* -/.........,%_>? */
120 0xf8, 0xc9, 0xca, 0xcb, 0xc8, 0xcd, 0xce, 0xcf, /* 70-7f: */
121 0xcc, 0x60, 0x3a, 0x23, 0x40, 0x27, 0x3d, 0x22, /* .........`:#@'=" */
122 0xd8, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 80-8f: */
123 0x68, 0x69, 0xab, 0xbb, 0xf0, 0xfd, 0xfe, 0xb1, /* .abcdefghi...... */
124 0xb0, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70, /* 90-9f: */
125 0x71, 0x72, 0xaa, 0xba, 0xe6, 0xb8, 0xc6, 0xa4, /* .jklmnopqr...... */
126 0xb5, 0x7e, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, /* a0-af: */
127 0x79, 0x7a, 0xa1, 0xbf, 0xd0, 0x5b, 0xde, 0xae, /* .~stuvwxyz...[.. */
128 0xac, 0xa3, 0xa5, 0xb7, 0xa9, 0xa7, 0xb6, 0xbc, /* b0-bf: */
129 0xbd, 0xbe, 0xdd, 0xa8, 0xaf, 0x5d, 0xb4, 0xd7, /* .............].. */
130 0x7b, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, /* c0-cf: */
131 0x48, 0x49, 0xad, 0xf4, 0xf6, 0xf2, 0xf3, 0xf5, /* {ABCDEFGHI...... */
132 0x7d, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, /* d0-df: */
133 0x51, 0x52, 0xb9, 0xfb, 0xfc, 0xf9, 0xfa, 0xff, /* }JKLMNOPQR...... */
134 0x5c, 0xf7, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, /* e0-ef: */
135 0x59, 0x5a, 0xb2, 0xd4, 0xd6, 0xd2, 0xd3, 0xd5, /* \.STUVWXYZ...... */
136 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* f0-ff: */
137 0x38, 0x39, 0xb3, 0xdb, 0xdc, 0xd9, 0xda, 0x9f /* 0123456789...... */
138};
139
140
141/*
142The US-ASCII to EBCDIC (character set IBM-1047) table:
143This table is bijective (no ambiguous or duplicate characters)
144*/
145const unsigned char os_toebcdic[256] = {
146 0x00, 0x01, 0x02, 0x03, 0x37, 0x2d, 0x2e, 0x2f, /* 00-0f: */
147 0x16, 0x05, 0x15, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* ................ */
148 0x10, 0x11, 0x12, 0x13, 0x3c, 0x3d, 0x32, 0x26, /* 10-1f: */
149 0x18, 0x19, 0x3f, 0x27, 0x1c, 0x1d, 0x1e, 0x1f, /* ................ */
150 0x40, 0x5a, 0x7f, 0x7b, 0x5b, 0x6c, 0x50, 0x7d, /* 20-2f: */
151 0x4d, 0x5d, 0x5c, 0x4e, 0x6b, 0x60, 0x4b, 0x61, /* !"#$%&'()*+,-./ */
152 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 30-3f: */
153 0xf8, 0xf9, 0x7a, 0x5e, 0x4c, 0x7e, 0x6e, 0x6f, /* 0123456789:;<=>? */
154 0x7c, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 40-4f: */
155 0xc8, 0xc9, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, /* @ABCDEFGHIJKLMNO */
156 0xd7, 0xd8, 0xd9, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, /* 50-5f: */
157 0xe7, 0xe8, 0xe9, 0xad, 0xe0, 0xbd, 0x5f, 0x6d, /* PQRSTUVWXYZ[\]^_ */
158 0x79, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, /* 60-6f: */
159 0x88, 0x89, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, /* `abcdefghijklmno */
160 0x97, 0x98, 0x99, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, /* 70-7f: */
161 0xa7, 0xa8, 0xa9, 0xc0, 0x4f, 0xd0, 0xa1, 0x07, /* pqrstuvwxyz{|}~. */
162 0x20, 0x21, 0x22, 0x23, 0x24, 0x04, 0x06, 0x08, /* 80-8f: */
163 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x09, 0x0a, 0x14, /* ................ */
164 0x30, 0x31, 0x25, 0x33, 0x34, 0x35, 0x36, 0x17, /* 90-9f: */
165 0x38, 0x39, 0x3a, 0x3b, 0x1a, 0x1b, 0x3e, 0xff, /* ................ */
166 0x41, 0xaa, 0x4a, 0xb1, 0x9f, 0xb2, 0x6a, 0xb5, /* a0-af: */
167 0xbb, 0xb4, 0x9a, 0x8a, 0xb0, 0xca, 0xaf, 0xbc, /* ................ */
168 0x90, 0x8f, 0xea, 0xfa, 0xbe, 0xa0, 0xb6, 0xb3, /* b0-bf: */
169 0x9d, 0xda, 0x9b, 0x8b, 0xb7, 0xb8, 0xb9, 0xab, /* ................ */
170 0x64, 0x65, 0x62, 0x66, 0x63, 0x67, 0x9e, 0x68, /* c0-cf: */
171 0x74, 0x71, 0x72, 0x73, 0x78, 0x75, 0x76, 0x77, /* ................ */
172 0xac, 0x69, 0xed, 0xee, 0xeb, 0xef, 0xec, 0xbf, /* d0-df: */
173 0x80, 0xfd, 0xfe, 0xfb, 0xfc, 0xba, 0xae, 0x59, /* ................ */
174 0x44, 0x45, 0x42, 0x46, 0x43, 0x47, 0x9c, 0x48, /* e0-ef: */
175 0x54, 0x51, 0x52, 0x53, 0x58, 0x55, 0x56, 0x57, /* ................ */
176 0x8c, 0x49, 0xcd, 0xce, 0xcb, 0xcf, 0xcc, 0xe1, /* f0-ff: */
177 0x70, 0xdd, 0xde, 0xdb, 0xdc, 0x8d, 0x8e, 0xdf /* ................ */
178};
179#endif /*_OSD_POSIX*/
180
181/* Translate a memory block from EBCDIC (host charset) to ASCII (net charset)
182 * dest and srce may be identical, or separate memory blocks, but
183 * should not overlap. These functions intentionally have an interface
184 * compatible to memcpy(3).
185 */
186
187void *
188ebcdic2ascii(void *dest, const void *srce, size_t count)
189{
190 unsigned char *udest = dest;
191 const unsigned char *usrce = srce;
192
193 while (count-- != 0) {
194 *udest++ = os_toascii[*usrce++];
195 }
196
197 return dest;
198}
199
200void *
201ascii2ebcdic(void *dest, const void *srce, size_t count)
202{
203 unsigned char *udest = dest;
204 const unsigned char *usrce = srce;
205
206 while (count-- != 0) {
207 *udest++ = os_toebcdic[*usrce++];
208 }
209
210 return dest;
211}
212
213#else /*CHARSET_EBCDIC*/
214#include <openssl/e_os2.h>
215#if defined(PEDANTIC) || defined(__DECC) || defined(OPENSSL_SYS_MACOSX)
216static void *dummy=&dummy;
217#endif
218#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..8f03658ad4
--- /dev/null
+++ b/src/lib/libcrypto/ec/Makefile
@@ -0,0 +1,126 @@
1#
2# crypto/ec/Makefile
3#
4
5DIR= ec
6TOP= ../..
7CC= cc
8INCLUDES= -I.. -I$(TOP) -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
18CFLAGS= $(INCLUDES) $(CFLAG)
19
20GENERAL=Makefile
21TEST=ectest.c
22APPS=
23
24LIB=$(TOP)/libcrypto.a
25LIBSRC= ec_lib.c ecp_smpl.c ecp_mont.c ecp_recp.c ecp_nist.c ec_cvt.c ec_mult.c \
26 ec_err.c
27
28LIBOBJ= ec_lib.o ecp_smpl.o ecp_mont.o ecp_recp.o ecp_nist.o ec_cvt.o ec_mult.o \
29 ec_err.o
30
31SRC= $(LIBSRC)
32
33EXHEADER= ec.h
34HEADER= ec_lcl.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
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 @headerlist="$(EXHEADER)"; for i in $$headerlist ; \
58 do \
59 (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
60 chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
61 done;
62
63tags:
64 ctags $(SRC)
65
66tests:
67
68lint:
69 lint -DLINT $(INCLUDES) $(SRC)>fluff
70
71depend:
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
83ec_cvt.o: ../../include/openssl/bn.h ../../include/openssl/e_os2.h
84ec_cvt.o: ../../include/openssl/ec.h ../../include/openssl/opensslconf.h
85ec_cvt.o: ../../include/openssl/symhacks.h ec_cvt.c ec_lcl.h
86ec_err.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
87ec_err.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
88ec_err.o: ../../include/openssl/ec.h ../../include/openssl/err.h
89ec_err.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
90ec_err.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
91ec_err.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
92ec_err.o: ec_err.c
93ec_lib.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
94ec_lib.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
95ec_lib.o: ../../include/openssl/ec.h ../../include/openssl/err.h
96ec_lib.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
97ec_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
98ec_lib.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
99ec_lib.o: ec_lcl.h ec_lib.c
100ec_mult.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
101ec_mult.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
102ec_mult.o: ../../include/openssl/ec.h ../../include/openssl/err.h
103ec_mult.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
104ec_mult.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
105ec_mult.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
106ec_mult.o: ec_lcl.h ec_mult.c
107ecp_mont.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
108ecp_mont.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
109ecp_mont.o: ../../include/openssl/ec.h ../../include/openssl/err.h
110ecp_mont.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
111ecp_mont.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
112ecp_mont.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
113ecp_mont.o: ec_lcl.h ecp_mont.c
114ecp_nist.o: ../../include/openssl/bn.h ../../include/openssl/e_os2.h
115ecp_nist.o: ../../include/openssl/ec.h ../../include/openssl/opensslconf.h
116ecp_nist.o: ../../include/openssl/symhacks.h ec_lcl.h ecp_nist.c
117ecp_recp.o: ../../include/openssl/bn.h ../../include/openssl/e_os2.h
118ecp_recp.o: ../../include/openssl/ec.h ../../include/openssl/opensslconf.h
119ecp_recp.o: ../../include/openssl/symhacks.h ec_lcl.h ecp_recp.c
120ecp_smpl.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
121ecp_smpl.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
122ecp_smpl.o: ../../include/openssl/ec.h ../../include/openssl/err.h
123ecp_smpl.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
124ecp_smpl.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
125ecp_smpl.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
126ecp_smpl.o: ec_lcl.h ecp_smpl.c
diff --git a/src/lib/libcrypto/ec/Makefile.ssl b/src/lib/libcrypto/ec/Makefile.ssl
new file mode 100644
index 0000000000..a2805c47a2
--- /dev/null
+++ b/src/lib/libcrypto/ec/Makefile.ssl
@@ -0,0 +1,128 @@
1#
2# crypto/ec/Makefile
3#
4
5DIR= ec
6TOP= ../..
7CC= cc
8INCLUDES= -I.. -I$(TOP) -I../../include
9CFLAG=-g
10INSTALL_PREFIX=
11OPENSSLDIR= /usr/local/ssl
12INSTALLTOP=/usr/local/ssl
13MAKE= make -f Makefile.ssl
14MAKEDEPPROG= makedepend
15MAKEDEPEND= $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG)
16MAKEFILE= Makefile.ssl
17AR= ar r
18
19CFLAGS= $(INCLUDES) $(CFLAG)
20
21GENERAL=Makefile
22TEST=ectest.c
23APPS=
24
25LIB=$(TOP)/libcrypto.a
26LIBSRC= ec_lib.c ecp_smpl.c ecp_mont.c ecp_recp.c ecp_nist.c ec_cvt.c ec_mult.c \
27 ec_err.c
28
29LIBOBJ= ec_lib.o ecp_smpl.o ecp_mont.o ecp_recp.o ecp_nist.o ec_cvt.o ec_mult.o \
30 ec_err.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.ssl >> $(TOP)/MINFO
51
52links:
53 @sh $(TOP)/util/point.sh Makefile.ssl Makefile
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 @for i in $(EXHEADER) ; \
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 $(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 *.o */*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
82
83# DO NOT DELETE THIS LINE -- make depend depends on it.
84
85ec_cvt.o: ../../include/openssl/bn.h ../../include/openssl/e_os2.h
86ec_cvt.o: ../../include/openssl/ec.h ../../include/openssl/opensslconf.h
87ec_cvt.o: ../../include/openssl/symhacks.h ec_cvt.c ec_lcl.h
88ec_err.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
89ec_err.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
90ec_err.o: ../../include/openssl/ec.h ../../include/openssl/err.h
91ec_err.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
92ec_err.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
93ec_err.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
94ec_err.o: ec_err.c
95ec_lib.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
96ec_lib.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
97ec_lib.o: ../../include/openssl/ec.h ../../include/openssl/err.h
98ec_lib.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
99ec_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
100ec_lib.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
101ec_lib.o: ec_lcl.h ec_lib.c
102ec_mult.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
103ec_mult.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
104ec_mult.o: ../../include/openssl/ec.h ../../include/openssl/err.h
105ec_mult.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
106ec_mult.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
107ec_mult.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
108ec_mult.o: ec_lcl.h ec_mult.c
109ecp_mont.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
110ecp_mont.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
111ecp_mont.o: ../../include/openssl/ec.h ../../include/openssl/err.h
112ecp_mont.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
113ecp_mont.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
114ecp_mont.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
115ecp_mont.o: ec_lcl.h ecp_mont.c
116ecp_nist.o: ../../include/openssl/bn.h ../../include/openssl/e_os2.h
117ecp_nist.o: ../../include/openssl/ec.h ../../include/openssl/opensslconf.h
118ecp_nist.o: ../../include/openssl/symhacks.h ec_lcl.h ecp_nist.c
119ecp_recp.o: ../../include/openssl/bn.h ../../include/openssl/e_os2.h
120ecp_recp.o: ../../include/openssl/ec.h ../../include/openssl/opensslconf.h
121ecp_recp.o: ../../include/openssl/symhacks.h ec_lcl.h ecp_recp.c
122ecp_smpl.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
123ecp_smpl.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
124ecp_smpl.o: ../../include/openssl/ec.h ../../include/openssl/err.h
125ecp_smpl.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
126ecp_smpl.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
127ecp_smpl.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
128ecp_smpl.o: ec_lcl.h ecp_smpl.c
diff --git a/src/lib/libcrypto/ec/ec_err.c b/src/lib/libcrypto/ec/ec_err.c
index 5b70f94382..d37b6aba87 100644
--- a/src/lib/libcrypto/ec/ec_err.c
+++ b/src/lib/libcrypto/ec/ec_err.c
@@ -1,6 +1,6 @@
1/* crypto/ec/ec_err.c */ 1/* crypto/ec/ec_err.c */
2/* ==================================================================== 2/* ====================================================================
3 * Copyright (c) 1999-2005 The OpenSSL Project. All rights reserved. 3 * Copyright (c) 1999 The OpenSSL Project. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
@@ -64,74 +64,70 @@
64 64
65/* BEGIN ERROR CODES */ 65/* BEGIN ERROR CODES */
66#ifndef OPENSSL_NO_ERR 66#ifndef OPENSSL_NO_ERR
67
68#define ERR_FUNC(func) ERR_PACK(ERR_LIB_EC,func,0)
69#define ERR_REASON(reason) ERR_PACK(ERR_LIB_EC,0,reason)
70
71static ERR_STRING_DATA EC_str_functs[]= 67static ERR_STRING_DATA EC_str_functs[]=
72 { 68 {
73{ERR_FUNC(EC_F_COMPUTE_WNAF), "COMPUTE_WNAF"}, 69{ERR_PACK(0,EC_F_COMPUTE_WNAF,0), "COMPUTE_WNAF"},
74{ERR_FUNC(EC_F_EC_GFP_MONT_FIELD_DECODE), "ec_GFp_mont_field_decode"}, 70{ERR_PACK(0,EC_F_EC_GFP_MONT_FIELD_DECODE,0), "ec_GFp_mont_field_decode"},
75{ERR_FUNC(EC_F_EC_GFP_MONT_FIELD_ENCODE), "ec_GFp_mont_field_encode"}, 71{ERR_PACK(0,EC_F_EC_GFP_MONT_FIELD_ENCODE,0), "ec_GFp_mont_field_encode"},
76{ERR_FUNC(EC_F_EC_GFP_MONT_FIELD_MUL), "ec_GFp_mont_field_mul"}, 72{ERR_PACK(0,EC_F_EC_GFP_MONT_FIELD_MUL,0), "ec_GFp_mont_field_mul"},
77{ERR_FUNC(EC_F_EC_GFP_MONT_FIELD_SQR), "ec_GFp_mont_field_sqr"}, 73{ERR_PACK(0,EC_F_EC_GFP_MONT_FIELD_SQR,0), "ec_GFp_mont_field_sqr"},
78{ERR_FUNC(EC_F_EC_GFP_SIMPLE_GROUP_SET_CURVE_GFP), "ec_GFp_simple_group_set_curve_GFp"}, 74{ERR_PACK(0,EC_F_EC_GFP_SIMPLE_GROUP_SET_CURVE_GFP,0), "ec_GFp_simple_group_set_curve_GFp"},
79{ERR_FUNC(EC_F_EC_GFP_SIMPLE_GROUP_SET_GENERATOR), "ec_GFp_simple_group_set_generator"}, 75{ERR_PACK(0,EC_F_EC_GFP_SIMPLE_GROUP_SET_GENERATOR,0), "ec_GFp_simple_group_set_generator"},
80{ERR_FUNC(EC_F_EC_GFP_SIMPLE_MAKE_AFFINE), "ec_GFp_simple_make_affine"}, 76{ERR_PACK(0,EC_F_EC_GFP_SIMPLE_MAKE_AFFINE,0), "ec_GFp_simple_make_affine"},
81{ERR_FUNC(EC_F_EC_GFP_SIMPLE_OCT2POINT), "ec_GFp_simple_oct2point"}, 77{ERR_PACK(0,EC_F_EC_GFP_SIMPLE_OCT2POINT,0), "ec_GFp_simple_oct2point"},
82{ERR_FUNC(EC_F_EC_GFP_SIMPLE_POINT2OCT), "ec_GFp_simple_point2oct"}, 78{ERR_PACK(0,EC_F_EC_GFP_SIMPLE_POINT2OCT,0), "ec_GFp_simple_point2oct"},
83{ERR_FUNC(EC_F_EC_GFP_SIMPLE_POINTS_MAKE_AFFINE), "ec_GFp_simple_points_make_affine"}, 79{ERR_PACK(0,EC_F_EC_GFP_SIMPLE_POINTS_MAKE_AFFINE,0), "ec_GFp_simple_points_make_affine"},
84{ERR_FUNC(EC_F_EC_GFP_SIMPLE_POINT_GET_AFFINE_COORDINATES_GFP), "ec_GFp_simple_point_get_affine_coordinates_GFp"}, 80{ERR_PACK(0,EC_F_EC_GFP_SIMPLE_POINT_GET_AFFINE_COORDINATES_GFP,0), "ec_GFp_simple_point_get_affine_coordinates_GFp"},
85{ERR_FUNC(EC_F_EC_GFP_SIMPLE_POINT_SET_AFFINE_COORDINATES_GFP), "ec_GFp_simple_point_set_affine_coordinates_GFp"}, 81{ERR_PACK(0,EC_F_EC_GFP_SIMPLE_POINT_SET_AFFINE_COORDINATES_GFP,0), "ec_GFp_simple_point_set_affine_coordinates_GFp"},
86{ERR_FUNC(EC_F_EC_GFP_SIMPLE_SET_COMPRESSED_COORDINATES_GFP), "ec_GFp_simple_set_compressed_coordinates_GFp"}, 82{ERR_PACK(0,EC_F_EC_GFP_SIMPLE_SET_COMPRESSED_COORDINATES_GFP,0), "ec_GFp_simple_set_compressed_coordinates_GFp"},
87{ERR_FUNC(EC_F_EC_GROUP_COPY), "EC_GROUP_copy"}, 83{ERR_PACK(0,EC_F_EC_GROUP_COPY,0), "EC_GROUP_copy"},
88{ERR_FUNC(EC_F_EC_GROUP_GET0_GENERATOR), "EC_GROUP_get0_generator"}, 84{ERR_PACK(0,EC_F_EC_GROUP_GET0_GENERATOR,0), "EC_GROUP_get0_generator"},
89{ERR_FUNC(EC_F_EC_GROUP_GET_COFACTOR), "EC_GROUP_get_cofactor"}, 85{ERR_PACK(0,EC_F_EC_GROUP_GET_COFACTOR,0), "EC_GROUP_get_cofactor"},
90{ERR_FUNC(EC_F_EC_GROUP_GET_CURVE_GFP), "EC_GROUP_get_curve_GFp"}, 86{ERR_PACK(0,EC_F_EC_GROUP_GET_CURVE_GFP,0), "EC_GROUP_get_curve_GFp"},
91{ERR_FUNC(EC_F_EC_GROUP_GET_ORDER), "EC_GROUP_get_order"}, 87{ERR_PACK(0,EC_F_EC_GROUP_GET_ORDER,0), "EC_GROUP_get_order"},
92{ERR_FUNC(EC_F_EC_GROUP_NEW), "EC_GROUP_new"}, 88{ERR_PACK(0,EC_F_EC_GROUP_NEW,0), "EC_GROUP_new"},
93{ERR_FUNC(EC_F_EC_GROUP_PRECOMPUTE_MULT), "EC_GROUP_precompute_mult"}, 89{ERR_PACK(0,EC_F_EC_GROUP_PRECOMPUTE_MULT,0), "EC_GROUP_precompute_mult"},
94{ERR_FUNC(EC_F_EC_GROUP_SET_CURVE_GFP), "EC_GROUP_set_curve_GFp"}, 90{ERR_PACK(0,EC_F_EC_GROUP_SET_CURVE_GFP,0), "EC_GROUP_set_curve_GFp"},
95{ERR_FUNC(EC_F_EC_GROUP_SET_EXTRA_DATA), "EC_GROUP_set_extra_data"}, 91{ERR_PACK(0,EC_F_EC_GROUP_SET_EXTRA_DATA,0), "EC_GROUP_set_extra_data"},
96{ERR_FUNC(EC_F_EC_GROUP_SET_GENERATOR), "EC_GROUP_set_generator"}, 92{ERR_PACK(0,EC_F_EC_GROUP_SET_GENERATOR,0), "EC_GROUP_set_generator"},
97{ERR_FUNC(EC_F_EC_POINTS_MAKE_AFFINE), "EC_POINTs_make_affine"}, 93{ERR_PACK(0,EC_F_EC_POINTS_MAKE_AFFINE,0), "EC_POINTs_make_affine"},
98{ERR_FUNC(EC_F_EC_POINTS_MUL), "EC_POINTs_mul"}, 94{ERR_PACK(0,EC_F_EC_POINTS_MUL,0), "EC_POINTs_mul"},
99{ERR_FUNC(EC_F_EC_POINT_ADD), "EC_POINT_add"}, 95{ERR_PACK(0,EC_F_EC_POINT_ADD,0), "EC_POINT_add"},
100{ERR_FUNC(EC_F_EC_POINT_CMP), "EC_POINT_cmp"}, 96{ERR_PACK(0,EC_F_EC_POINT_CMP,0), "EC_POINT_cmp"},
101{ERR_FUNC(EC_F_EC_POINT_COPY), "EC_POINT_copy"}, 97{ERR_PACK(0,EC_F_EC_POINT_COPY,0), "EC_POINT_copy"},
102{ERR_FUNC(EC_F_EC_POINT_DBL), "EC_POINT_dbl"}, 98{ERR_PACK(0,EC_F_EC_POINT_DBL,0), "EC_POINT_dbl"},
103{ERR_FUNC(EC_F_EC_POINT_GET_AFFINE_COORDINATES_GFP), "EC_POINT_get_affine_coordinates_GFp"}, 99{ERR_PACK(0,EC_F_EC_POINT_GET_AFFINE_COORDINATES_GFP,0), "EC_POINT_get_affine_coordinates_GFp"},
104{ERR_FUNC(EC_F_EC_POINT_GET_JPROJECTIVE_COORDINATES_GFP), "EC_POINT_get_Jprojective_coordinates_GFp"}, 100{ERR_PACK(0,EC_F_EC_POINT_GET_JPROJECTIVE_COORDINATES_GFP,0), "EC_POINT_get_Jprojective_coordinates_GFp"},
105{ERR_FUNC(EC_F_EC_POINT_IS_AT_INFINITY), "EC_POINT_is_at_infinity"}, 101{ERR_PACK(0,EC_F_EC_POINT_IS_AT_INFINITY,0), "EC_POINT_is_at_infinity"},
106{ERR_FUNC(EC_F_EC_POINT_IS_ON_CURVE), "EC_POINT_is_on_curve"}, 102{ERR_PACK(0,EC_F_EC_POINT_IS_ON_CURVE,0), "EC_POINT_is_on_curve"},
107{ERR_FUNC(EC_F_EC_POINT_MAKE_AFFINE), "EC_POINT_make_affine"}, 103{ERR_PACK(0,EC_F_EC_POINT_MAKE_AFFINE,0), "EC_POINT_make_affine"},
108{ERR_FUNC(EC_F_EC_POINT_NEW), "EC_POINT_new"}, 104{ERR_PACK(0,EC_F_EC_POINT_NEW,0), "EC_POINT_new"},
109{ERR_FUNC(EC_F_EC_POINT_OCT2POINT), "EC_POINT_oct2point"}, 105{ERR_PACK(0,EC_F_EC_POINT_OCT2POINT,0), "EC_POINT_oct2point"},
110{ERR_FUNC(EC_F_EC_POINT_POINT2OCT), "EC_POINT_point2oct"}, 106{ERR_PACK(0,EC_F_EC_POINT_POINT2OCT,0), "EC_POINT_point2oct"},
111{ERR_FUNC(EC_F_EC_POINT_SET_AFFINE_COORDINATES_GFP), "EC_POINT_set_affine_coordinates_GFp"}, 107{ERR_PACK(0,EC_F_EC_POINT_SET_AFFINE_COORDINATES_GFP,0), "EC_POINT_set_affine_coordinates_GFp"},
112{ERR_FUNC(EC_F_EC_POINT_SET_COMPRESSED_COORDINATES_GFP), "EC_POINT_set_compressed_coordinates_GFp"}, 108{ERR_PACK(0,EC_F_EC_POINT_SET_COMPRESSED_COORDINATES_GFP,0), "EC_POINT_set_compressed_coordinates_GFp"},
113{ERR_FUNC(EC_F_EC_POINT_SET_JPROJECTIVE_COORDINATES_GFP), "EC_POINT_set_Jprojective_coordinates_GFp"}, 109{ERR_PACK(0,EC_F_EC_POINT_SET_JPROJECTIVE_COORDINATES_GFP,0), "EC_POINT_set_Jprojective_coordinates_GFp"},
114{ERR_FUNC(EC_F_EC_POINT_SET_TO_INFINITY), "EC_POINT_set_to_infinity"}, 110{ERR_PACK(0,EC_F_EC_POINT_SET_TO_INFINITY,0), "EC_POINT_set_to_infinity"},
115{ERR_FUNC(EC_F_GFP_MONT_GROUP_SET_CURVE_GFP), "GFP_MONT_GROUP_SET_CURVE_GFP"}, 111{ERR_PACK(0,EC_F_GFP_MONT_GROUP_SET_CURVE_GFP,0), "GFP_MONT_GROUP_SET_CURVE_GFP"},
116{0,NULL} 112{0,NULL}
117 }; 113 };
118 114
119static ERR_STRING_DATA EC_str_reasons[]= 115static ERR_STRING_DATA EC_str_reasons[]=
120 { 116 {
121{ERR_REASON(EC_R_BUFFER_TOO_SMALL) ,"buffer too small"}, 117{EC_R_BUFFER_TOO_SMALL ,"buffer too small"},
122{ERR_REASON(EC_R_INCOMPATIBLE_OBJECTS) ,"incompatible objects"}, 118{EC_R_INCOMPATIBLE_OBJECTS ,"incompatible objects"},
123{ERR_REASON(EC_R_INVALID_ARGUMENT) ,"invalid argument"}, 119{EC_R_INVALID_ARGUMENT ,"invalid argument"},
124{ERR_REASON(EC_R_INVALID_COMPRESSED_POINT),"invalid compressed point"}, 120{EC_R_INVALID_COMPRESSED_POINT ,"invalid compressed point"},
125{ERR_REASON(EC_R_INVALID_COMPRESSION_BIT),"invalid compression bit"}, 121{EC_R_INVALID_COMPRESSION_BIT ,"invalid compression bit"},
126{ERR_REASON(EC_R_INVALID_ENCODING) ,"invalid encoding"}, 122{EC_R_INVALID_ENCODING ,"invalid encoding"},
127{ERR_REASON(EC_R_INVALID_FIELD) ,"invalid field"}, 123{EC_R_INVALID_FIELD ,"invalid field"},
128{ERR_REASON(EC_R_INVALID_FORM) ,"invalid form"}, 124{EC_R_INVALID_FORM ,"invalid form"},
129{ERR_REASON(EC_R_NOT_INITIALIZED) ,"not initialized"}, 125{EC_R_NOT_INITIALIZED ,"not initialized"},
130{ERR_REASON(EC_R_POINT_AT_INFINITY) ,"point at infinity"}, 126{EC_R_POINT_AT_INFINITY ,"point at infinity"},
131{ERR_REASON(EC_R_POINT_IS_NOT_ON_CURVE) ,"point is not on curve"}, 127{EC_R_POINT_IS_NOT_ON_CURVE ,"point is not on curve"},
132{ERR_REASON(EC_R_SLOT_FULL) ,"slot full"}, 128{EC_R_SLOT_FULL ,"slot full"},
133{ERR_REASON(EC_R_UNDEFINED_GENERATOR) ,"undefined generator"}, 129{EC_R_UNDEFINED_GENERATOR ,"undefined generator"},
134{ERR_REASON(EC_R_UNKNOWN_ORDER) ,"unknown order"}, 130{EC_R_UNKNOWN_ORDER ,"unknown order"},
135{0,NULL} 131{0,NULL}
136 }; 132 };
137 133
@@ -145,8 +141,8 @@ void ERR_load_EC_strings(void)
145 { 141 {
146 init=0; 142 init=0;
147#ifndef OPENSSL_NO_ERR 143#ifndef OPENSSL_NO_ERR
148 ERR_load_strings(0,EC_str_functs); 144 ERR_load_strings(ERR_LIB_EC,EC_str_functs);
149 ERR_load_strings(0,EC_str_reasons); 145 ERR_load_strings(ERR_LIB_EC,EC_str_reasons);
150#endif 146#endif
151 147
152 } 148 }
diff --git a/src/lib/libcrypto/ec/ecp_recp.c b/src/lib/libcrypto/ec/ecp_recp.c
new file mode 100644
index 0000000000..fec843b5c8
--- /dev/null
+++ b/src/lib/libcrypto/ec/ecp_recp.c
@@ -0,0 +1,133 @@
1/* crypto/ec/ecp_recp.c */
2/* ====================================================================
3 * Copyright (c) 1998-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 * 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 "ec_lcl.h"
57
58#if 0
59const EC_METHOD *EC_GFp_recp_method(void)
60 {
61 static const EC_METHOD ret = {
62 ec_GFp_recp_group_init,
63 ec_GFp_recp_group_finish,
64 ec_GFp_recp_group_clear_finish,
65 ec_GFp_recp_group_copy,
66 ec_GFp_recp_group_set_curve_GFp,
67 ec_GFp_simple_group_get_curve_GFp,
68 ec_GFp_simple_group_set_generator,
69 ec_GFp_simple_group_get0_generator,
70 ec_GFp_simple_group_get_order,
71 ec_GFp_simple_group_get_cofactor,
72 ec_GFp_simple_point_init,
73 ec_GFp_simple_point_finish,
74 ec_GFp_simple_point_clear_finish,
75 ec_GFp_simple_point_copy,
76 ec_GFp_simple_point_set_to_infinity,
77 ec_GFp_simple_set_Jprojective_coordinates_GFp,
78 ec_GFp_simple_get_Jprojective_coordinates_GFp,
79 ec_GFp_simple_point_set_affine_coordinates_GFp,
80 ec_GFp_simple_point_get_affine_coordinates_GFp,
81 ec_GFp_simple_set_compressed_coordinates_GFp,
82 ec_GFp_simple_point2oct,
83 ec_GFp_simple_oct2point,
84 ec_GFp_simple_add,
85 ec_GFp_simple_dbl,
86 ec_GFp_simple_invert,
87 ec_GFp_simple_is_at_infinity,
88 ec_GFp_simple_is_on_curve,
89 ec_GFp_simple_cmp,
90 ec_GFp_simple_make_affine,
91 ec_GFp_simple_points_make_affine,
92 ec_GFp_recp_field_mul,
93 ec_GFp_recp_field_sqr,
94 0 /* field_encode */,
95 0 /* field_decode */,
96 0 /* field_set_to_one */ };
97
98 return &ret;
99 }
100#endif
101
102int ec_GFp_recp_group_init(EC_GROUP *group)
103 {
104 int ok;
105
106 ok = ec_GFp_simple_group_init(group);
107 group->field_data1 = NULL;
108 return ok;
109 }
110
111
112int ec_GFp_recp_group_set_curve_GFp(EC_GROUP *group, const BIGNUM *p, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx);
113/* TODO */
114
115
116void ec_GFp_recp_group_finish(EC_GROUP *group);
117/* TODO */
118
119
120void ec_GFp_recp_group_clear_finish(EC_GROUP *group);
121/* TODO */
122
123
124int ec_GFp_recp_group_copy(EC_GROUP *dest, const EC_GROUP *src);
125/* TODO */
126
127
128int ec_GFp_recp_field_mul(const EC_GROUP *group, BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx);
129/* TODO */
130
131
132int ec_GFp_recp_field_sqr(const EC_GROUP *group, BIGNUM *r, const BIGNUM *a, BN_CTX *ctx);
133/* TODO */
diff --git a/src/lib/libcrypto/ec/ectest.c b/src/lib/libcrypto/ec/ectest.c
new file mode 100644
index 0000000000..fcf969f3cf
--- /dev/null
+++ b/src/lib/libcrypto/ec/ectest.c
@@ -0,0 +1,643 @@
1/* crypto/ec/ectest.c */
2/* ====================================================================
3 * Copyright (c) 1998-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 * 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 <stdlib.h>
58#ifdef FLAT_INC
59#include "e_os.h"
60#else
61#include "../e_os.h"
62#endif
63#include <string.h>
64#include <time.h>
65
66
67#ifdef OPENSSL_NO_EC
68int main(int argc, char * argv[]) { puts("Elliptic curves are disabled."); return 0; }
69#else
70
71
72#include <openssl/ec.h>
73#ifndef OPENSSL_NO_ENGINE
74#include <openssl/engine.h>
75#endif
76#include <openssl/err.h>
77
78#define ABORT do { \
79 fflush(stdout); \
80 fprintf(stderr, "%s:%d: ABORT\n", __FILE__, __LINE__); \
81 ERR_print_errors_fp(stderr); \
82 EXIT(1); \
83} while (0)
84
85#if 0
86static void timings(EC_GROUP *group, int multi, BN_CTX *ctx)
87 {
88 clock_t clck;
89 int i, j;
90 BIGNUM *s, *s0;
91 EC_POINT *P;
92
93 s = BN_new();
94 s0 = BN_new();
95 if (s == NULL || s0 == NULL) ABORT;
96
97 if (!EC_GROUP_get_curve_GFp(group, s, NULL, NULL, ctx)) ABORT;
98 fprintf(stdout, "Timings for %d bit prime, ", (int)BN_num_bits(s));
99 if (!EC_GROUP_get_order(group, s, ctx)) ABORT;
100 fprintf(stdout, "%d bit scalars ", (int)BN_num_bits(s));
101 fflush(stdout);
102
103 P = EC_POINT_new(group);
104 if (P == NULL) ABORT;
105 EC_POINT_copy(P, EC_GROUP_get0_generator(group));
106
107 clck = clock();
108 for (i = 0; i < 10; i++)
109 {
110 if (!BN_pseudo_rand(s, BN_num_bits(s), 0, 0)) ABORT;
111 if (multi)
112 {
113 if (!BN_pseudo_rand(s0, BN_num_bits(s), 0, 0)) ABORT;
114 }
115 for (j = 0; j < 10; j++)
116 {
117 if (!EC_POINT_mul(group, P, s, multi ? P : NULL, multi ? s0 : NULL, ctx)) ABORT;
118 }
119 fprintf(stdout, ".");
120 fflush(stdout);
121 }
122 fprintf(stdout, "\n");
123
124 clck = clock() - clck;
125
126#ifdef CLOCKS_PER_SEC
127 /* "To determine the time in seconds, the value returned
128 * by the clock function should be divided by the value
129 * of the macro CLOCKS_PER_SEC."
130 * -- ISO/IEC 9899 */
131# define UNIT "s"
132#else
133 /* "`CLOCKS_PER_SEC' undeclared (first use this function)"
134 * -- cc on NeXTstep/OpenStep */
135# define UNIT "units"
136# define CLOCKS_PER_SEC 1
137#endif
138
139 fprintf(stdout, "%i %s in %.2f " UNIT "\n", i*j,
140 multi ? "s*P+t*Q operations" : "point multiplications",
141 (double)clck/CLOCKS_PER_SEC);
142 fprintf(stdout, "average: %.4f " UNIT "\n", (double)clck/(CLOCKS_PER_SEC*i*j));
143
144 EC_POINT_free(P);
145 BN_free(s);
146 BN_free(s0);
147 }
148#endif
149
150int main(int argc, char *argv[])
151 {
152 BN_CTX *ctx = NULL;
153 BIGNUM *p, *a, *b;
154 EC_GROUP *group;
155 EC_GROUP *P_192 = NULL, *P_224 = NULL, *P_256 = NULL, *P_384 = NULL, *P_521 = NULL;
156 EC_POINT *P, *Q, *R;
157 BIGNUM *x, *y, *z;
158 unsigned char buf[100];
159 size_t i, len;
160 int k;
161
162 /* enable memory leak checking unless explicitly disabled */
163 if (!((getenv("OPENSSL_DEBUG_MEMORY") != NULL) && (0 == strcmp(getenv("OPENSSL_DEBUG_MEMORY"), "off"))))
164 {
165 CRYPTO_malloc_debug_init();
166 CRYPTO_set_mem_debug_options(V_CRYPTO_MDEBUG_ALL);
167 }
168 else
169 {
170 /* OPENSSL_DEBUG_MEMORY=off */
171 CRYPTO_set_mem_debug_functions(0, 0, 0, 0, 0);
172 }
173 CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON);
174 ERR_load_crypto_strings();
175
176#if 1 /* optional */
177 ctx = BN_CTX_new();
178 if (!ctx) ABORT;
179#endif
180
181 p = BN_new();
182 a = BN_new();
183 b = BN_new();
184 if (!p || !a || !b) ABORT;
185
186 if (!BN_hex2bn(&p, "17")) ABORT;
187 if (!BN_hex2bn(&a, "1")) ABORT;
188 if (!BN_hex2bn(&b, "1")) ABORT;
189
190 group = EC_GROUP_new(EC_GFp_mont_method()); /* applications should use EC_GROUP_new_curve_GFp
191 * so that the library gets to choose the EC_METHOD */
192 if (!group) ABORT;
193
194 if (!EC_GROUP_set_curve_GFp(group, p, a, b, ctx)) ABORT;
195
196 {
197 EC_GROUP *tmp;
198 tmp = EC_GROUP_new(EC_GROUP_method_of(group));
199 if (!tmp) ABORT;
200 if (!EC_GROUP_copy(tmp, group)) ABORT;
201 EC_GROUP_free(group);
202 group = tmp;
203 }
204
205 if (!EC_GROUP_get_curve_GFp(group, p, a, b, ctx)) ABORT;
206
207 fprintf(stdout, "Curve defined by Weierstrass equation\n y^2 = x^3 + a*x + b (mod 0x");
208 BN_print_fp(stdout, p);
209 fprintf(stdout, ")\n a = 0x");
210 BN_print_fp(stdout, a);
211 fprintf(stdout, "\n b = 0x");
212 BN_print_fp(stdout, b);
213 fprintf(stdout, "\n");
214
215 P = EC_POINT_new(group);
216 Q = EC_POINT_new(group);
217 R = EC_POINT_new(group);
218 if (!P || !Q || !R) ABORT;
219
220 if (!EC_POINT_set_to_infinity(group, P)) ABORT;
221 if (!EC_POINT_is_at_infinity(group, P)) ABORT;
222
223 buf[0] = 0;
224 if (!EC_POINT_oct2point(group, Q, buf, 1, ctx)) ABORT;
225
226 if (!EC_POINT_add(group, P, P, Q, ctx)) ABORT;
227 if (!EC_POINT_is_at_infinity(group, P)) ABORT;
228
229 x = BN_new();
230 y = BN_new();
231 z = BN_new();
232 if (!x || !y || !z) ABORT;
233
234 if (!BN_hex2bn(&x, "D")) ABORT;
235 if (!EC_POINT_set_compressed_coordinates_GFp(group, Q, x, 1, ctx)) ABORT;
236 if (!EC_POINT_is_on_curve(group, Q, ctx))
237 {
238 if (!EC_POINT_get_affine_coordinates_GFp(group, Q, x, y, ctx)) ABORT;
239 fprintf(stderr, "Point is not on curve: x = 0x");
240 BN_print_fp(stderr, x);
241 fprintf(stderr, ", y = 0x");
242 BN_print_fp(stderr, y);
243 fprintf(stderr, "\n");
244 ABORT;
245 }
246
247 fprintf(stdout, "A cyclic subgroup:\n");
248 k = 100;
249 do
250 {
251 if (k-- == 0) ABORT;
252
253 if (EC_POINT_is_at_infinity(group, P))
254 fprintf(stdout, " point at infinity\n");
255 else
256 {
257 if (!EC_POINT_get_affine_coordinates_GFp(group, P, x, y, ctx)) ABORT;
258
259 fprintf(stdout, " x = 0x");
260 BN_print_fp(stdout, x);
261 fprintf(stdout, ", y = 0x");
262 BN_print_fp(stdout, y);
263 fprintf(stdout, "\n");
264 }
265
266 if (!EC_POINT_copy(R, P)) ABORT;
267 if (!EC_POINT_add(group, P, P, Q, ctx)) ABORT;
268
269#if 0 /* optional */
270 {
271 EC_POINT *points[3];
272
273 points[0] = R;
274 points[1] = Q;
275 points[2] = P;
276 if (!EC_POINTs_make_affine(group, 2, points, ctx)) ABORT;
277 }
278#endif
279
280 }
281 while (!EC_POINT_is_at_infinity(group, P));
282
283 if (!EC_POINT_add(group, P, Q, R, ctx)) ABORT;
284 if (!EC_POINT_is_at_infinity(group, P)) ABORT;
285
286 len = EC_POINT_point2oct(group, Q, POINT_CONVERSION_COMPRESSED, buf, sizeof buf, ctx);
287 if (len == 0) ABORT;
288 if (!EC_POINT_oct2point(group, P, buf, len, ctx)) ABORT;
289 if (0 != EC_POINT_cmp(group, P, Q, ctx)) ABORT;
290 fprintf(stdout, "Generator as octect string, compressed form:\n ");
291 for (i = 0; i < len; i++) fprintf(stdout, "%02X", buf[i]);
292
293 len = EC_POINT_point2oct(group, Q, POINT_CONVERSION_UNCOMPRESSED, buf, sizeof buf, ctx);
294 if (len == 0) ABORT;
295 if (!EC_POINT_oct2point(group, P, buf, len, ctx)) ABORT;
296 if (0 != EC_POINT_cmp(group, P, Q, ctx)) ABORT;
297 fprintf(stdout, "\nGenerator as octect string, uncompressed form:\n ");
298 for (i = 0; i < len; i++) fprintf(stdout, "%02X", buf[i]);
299
300 len = EC_POINT_point2oct(group, Q, POINT_CONVERSION_HYBRID, buf, sizeof buf, ctx);
301 if (len == 0) ABORT;
302 if (!EC_POINT_oct2point(group, P, buf, len, ctx)) ABORT;
303 if (0 != EC_POINT_cmp(group, P, Q, ctx)) ABORT;
304 fprintf(stdout, "\nGenerator as octect string, hybrid form:\n ");
305 for (i = 0; i < len; i++) fprintf(stdout, "%02X", buf[i]);
306
307 if (!EC_POINT_get_Jprojective_coordinates_GFp(group, R, x, y, z, ctx)) ABORT;
308 fprintf(stdout, "\nA representation of the inverse of that generator in\nJacobian projective coordinates:\n X = 0x");
309 BN_print_fp(stdout, x);
310 fprintf(stdout, ", Y = 0x");
311 BN_print_fp(stdout, y);
312 fprintf(stdout, ", Z = 0x");
313 BN_print_fp(stdout, z);
314 fprintf(stdout, "\n");
315
316 if (!EC_POINT_invert(group, P, ctx)) ABORT;
317 if (0 != EC_POINT_cmp(group, P, R, ctx)) ABORT;
318
319
320 /* Curve P-192 (FIPS PUB 186-2, App. 6) */
321
322 if (!BN_hex2bn(&p, "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFF")) ABORT;
323 if (1 != BN_is_prime(p, BN_prime_checks, 0, ctx, NULL)) ABORT;
324 if (!BN_hex2bn(&a, "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFC")) ABORT;
325 if (!BN_hex2bn(&b, "64210519E59C80E70FA7E9AB72243049FEB8DEECC146B9B1")) ABORT;
326 if (!EC_GROUP_set_curve_GFp(group, p, a, b, ctx)) ABORT;
327
328 if (!BN_hex2bn(&x, "188DA80EB03090F67CBF20EB43A18800F4FF0AFD82FF1012")) ABORT;
329 if (!EC_POINT_set_compressed_coordinates_GFp(group, P, x, 1, ctx)) ABORT;
330 if (!EC_POINT_is_on_curve(group, P, ctx)) ABORT;
331 if (!BN_hex2bn(&z, "FFFFFFFFFFFFFFFFFFFFFFFF99DEF836146BC9B1B4D22831")) ABORT;
332 if (!EC_GROUP_set_generator(group, P, z, BN_value_one())) ABORT;
333
334 if (!EC_POINT_get_affine_coordinates_GFp(group, P, x, y, ctx)) ABORT;
335 fprintf(stdout, "\nNIST curve P-192 -- Generator:\n x = 0x");
336 BN_print_fp(stdout, x);
337 fprintf(stdout, "\n y = 0x");
338 BN_print_fp(stdout, y);
339 fprintf(stdout, "\n");
340 /* G_y value taken from the standard: */
341 if (!BN_hex2bn(&z, "07192B95FFC8DA78631011ED6B24CDD573F977A11E794811")) ABORT;
342 if (0 != BN_cmp(y, z)) ABORT;
343
344 fprintf(stdout, "verify group order ...");
345 fflush(stdout);
346 if (!EC_GROUP_get_order(group, z, ctx)) ABORT;
347 if (!EC_POINT_mul(group, Q, z, NULL, NULL, ctx)) ABORT;
348 if (!EC_POINT_is_at_infinity(group, Q)) ABORT;
349 fprintf(stdout, ".");
350 fflush(stdout);
351 if (!EC_GROUP_precompute_mult(group, ctx)) ABORT;
352 if (!EC_POINT_mul(group, Q, z, NULL, NULL, ctx)) ABORT;
353 if (!EC_POINT_is_at_infinity(group, Q)) ABORT;
354 fprintf(stdout, " ok\n");
355
356 if (!(P_192 = EC_GROUP_new(EC_GROUP_method_of(group)))) ABORT;
357 if (!EC_GROUP_copy(P_192, group)) ABORT;
358
359
360 /* Curve P-224 (FIPS PUB 186-2, App. 6) */
361
362 if (!BN_hex2bn(&p, "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000001")) ABORT;
363 if (1 != BN_is_prime(p, BN_prime_checks, 0, ctx, NULL)) ABORT;
364 if (!BN_hex2bn(&a, "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFE")) ABORT;
365 if (!BN_hex2bn(&b, "B4050A850C04B3ABF54132565044B0B7D7BFD8BA270B39432355FFB4")) ABORT;
366 if (!EC_GROUP_set_curve_GFp(group, p, a, b, ctx)) ABORT;
367
368 if (!BN_hex2bn(&x, "B70E0CBD6BB4BF7F321390B94A03C1D356C21122343280D6115C1D21")) ABORT;
369 if (!EC_POINT_set_compressed_coordinates_GFp(group, P, x, 0, ctx)) ABORT;
370 if (!EC_POINT_is_on_curve(group, P, ctx)) ABORT;
371 if (!BN_hex2bn(&z, "FFFFFFFFFFFFFFFFFFFFFFFFFFFF16A2E0B8F03E13DD29455C5C2A3D")) ABORT;
372 if (!EC_GROUP_set_generator(group, P, z, BN_value_one())) ABORT;
373
374 if (!EC_POINT_get_affine_coordinates_GFp(group, P, x, y, ctx)) ABORT;
375 fprintf(stdout, "\nNIST curve P-224 -- Generator:\n x = 0x");
376 BN_print_fp(stdout, x);
377 fprintf(stdout, "\n y = 0x");
378 BN_print_fp(stdout, y);
379 fprintf(stdout, "\n");
380 /* G_y value taken from the standard: */
381 if (!BN_hex2bn(&z, "BD376388B5F723FB4C22DFE6CD4375A05A07476444D5819985007E34")) ABORT;
382 if (0 != BN_cmp(y, z)) ABORT;
383
384 fprintf(stdout, "verify group order ...");
385 fflush(stdout);
386 if (!EC_GROUP_get_order(group, z, ctx)) ABORT;
387 if (!EC_POINT_mul(group, Q, z, NULL, NULL, ctx)) ABORT;
388 if (!EC_POINT_is_at_infinity(group, Q)) ABORT;
389 fprintf(stdout, ".");
390 fflush(stdout);
391 if (!EC_GROUP_precompute_mult(group, ctx)) ABORT;
392 if (!EC_POINT_mul(group, Q, z, NULL, NULL, ctx)) ABORT;
393 if (!EC_POINT_is_at_infinity(group, Q)) ABORT;
394 fprintf(stdout, " ok\n");
395
396 if (!(P_224 = EC_GROUP_new(EC_GROUP_method_of(group)))) ABORT;
397 if (!EC_GROUP_copy(P_224, group)) ABORT;
398
399
400 /* Curve P-256 (FIPS PUB 186-2, App. 6) */
401
402 if (!BN_hex2bn(&p, "FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFF")) ABORT;
403 if (1 != BN_is_prime(p, BN_prime_checks, 0, ctx, NULL)) ABORT;
404 if (!BN_hex2bn(&a, "FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFC")) ABORT;
405 if (!BN_hex2bn(&b, "5AC635D8AA3A93E7B3EBBD55769886BC651D06B0CC53B0F63BCE3C3E27D2604B")) ABORT;
406 if (!EC_GROUP_set_curve_GFp(group, p, a, b, ctx)) ABORT;
407
408 if (!BN_hex2bn(&x, "6B17D1F2E12C4247F8BCE6E563A440F277037D812DEB33A0F4A13945D898C296")) ABORT;
409 if (!EC_POINT_set_compressed_coordinates_GFp(group, P, x, 1, ctx)) ABORT;
410 if (!EC_POINT_is_on_curve(group, P, ctx)) ABORT;
411 if (!BN_hex2bn(&z, "FFFFFFFF00000000FFFFFFFFFFFFFFFFBCE6FAADA7179E"
412 "84F3B9CAC2FC632551")) ABORT;
413 if (!EC_GROUP_set_generator(group, P, z, BN_value_one())) ABORT;
414
415 if (!EC_POINT_get_affine_coordinates_GFp(group, P, x, y, ctx)) ABORT;
416 fprintf(stdout, "\nNIST curve P-256 -- Generator:\n x = 0x");
417 BN_print_fp(stdout, x);
418 fprintf(stdout, "\n y = 0x");
419 BN_print_fp(stdout, y);
420 fprintf(stdout, "\n");
421 /* G_y value taken from the standard: */
422 if (!BN_hex2bn(&z, "4FE342E2FE1A7F9B8EE7EB4A7C0F9E162BCE33576B315ECECBB6406837BF51F5")) ABORT;
423 if (0 != BN_cmp(y, z)) ABORT;
424
425 fprintf(stdout, "verify group order ...");
426 fflush(stdout);
427 if (!EC_GROUP_get_order(group, z, ctx)) ABORT;
428 if (!EC_POINT_mul(group, Q, z, NULL, NULL, ctx)) ABORT;
429 if (!EC_POINT_is_at_infinity(group, Q)) ABORT;
430 fprintf(stdout, ".");
431 fflush(stdout);
432 if (!EC_GROUP_precompute_mult(group, ctx)) ABORT;
433 if (!EC_POINT_mul(group, Q, z, NULL, NULL, ctx)) ABORT;
434 if (!EC_POINT_is_at_infinity(group, Q)) ABORT;
435 fprintf(stdout, " ok\n");
436
437 if (!(P_256 = EC_GROUP_new(EC_GROUP_method_of(group)))) ABORT;
438 if (!EC_GROUP_copy(P_256, group)) ABORT;
439
440
441 /* Curve P-384 (FIPS PUB 186-2, App. 6) */
442
443 if (!BN_hex2bn(&p, "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
444 "FFFFFFFFFFFFFFFFFEFFFFFFFF0000000000000000FFFFFFFF")) ABORT;
445 if (1 != BN_is_prime(p, BN_prime_checks, 0, ctx, NULL)) ABORT;
446 if (!BN_hex2bn(&a, "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
447 "FFFFFFFFFFFFFFFFFEFFFFFFFF0000000000000000FFFFFFFC")) ABORT;
448 if (!BN_hex2bn(&b, "B3312FA7E23EE7E4988E056BE3F82D19181D9C6EFE8141"
449 "120314088F5013875AC656398D8A2ED19D2A85C8EDD3EC2AEF")) ABORT;
450 if (!EC_GROUP_set_curve_GFp(group, p, a, b, ctx)) ABORT;
451
452 if (!BN_hex2bn(&x, "AA87CA22BE8B05378EB1C71EF320AD746E1D3B628BA79B"
453 "9859F741E082542A385502F25DBF55296C3A545E3872760AB7")) ABORT;
454 if (!EC_POINT_set_compressed_coordinates_GFp(group, P, x, 1, ctx)) ABORT;
455 if (!EC_POINT_is_on_curve(group, P, ctx)) ABORT;
456 if (!BN_hex2bn(&z, "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
457 "FFC7634D81F4372DDF581A0DB248B0A77AECEC196ACCC52973")) ABORT;
458 if (!EC_GROUP_set_generator(group, P, z, BN_value_one())) ABORT;
459
460 if (!EC_POINT_get_affine_coordinates_GFp(group, P, x, y, ctx)) ABORT;
461 fprintf(stdout, "\nNIST curve P-384 -- Generator:\n x = 0x");
462 BN_print_fp(stdout, x);
463 fprintf(stdout, "\n y = 0x");
464 BN_print_fp(stdout, y);
465 fprintf(stdout, "\n");
466 /* G_y value taken from the standard: */
467 if (!BN_hex2bn(&z, "3617DE4A96262C6F5D9E98BF9292DC29F8F41DBD289A14"
468 "7CE9DA3113B5F0B8C00A60B1CE1D7E819D7A431D7C90EA0E5F")) ABORT;
469 if (0 != BN_cmp(y, z)) ABORT;
470
471 fprintf(stdout, "verify group order ...");
472 fflush(stdout);
473 if (!EC_GROUP_get_order(group, z, ctx)) ABORT;
474 if (!EC_POINT_mul(group, Q, z, NULL, NULL, ctx)) ABORT;
475 if (!EC_POINT_is_at_infinity(group, Q)) ABORT;
476 fprintf(stdout, ".");
477 fflush(stdout);
478 if (!EC_GROUP_precompute_mult(group, ctx)) ABORT;
479 if (!EC_POINT_mul(group, Q, z, NULL, NULL, ctx)) ABORT;
480 if (!EC_POINT_is_at_infinity(group, Q)) ABORT;
481 fprintf(stdout, " ok\n");
482
483 if (!(P_384 = EC_GROUP_new(EC_GROUP_method_of(group)))) ABORT;
484 if (!EC_GROUP_copy(P_384, group)) ABORT;
485
486
487 /* Curve P-521 (FIPS PUB 186-2, App. 6) */
488
489 if (!BN_hex2bn(&p, "1FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
490 "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
491 "FFFFFFFFFFFFFFFFFFFFFFFFFFFF")) ABORT;
492 if (1 != BN_is_prime(p, BN_prime_checks, 0, ctx, NULL)) ABORT;
493 if (!BN_hex2bn(&a, "1FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
494 "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
495 "FFFFFFFFFFFFFFFFFFFFFFFFFFFC")) ABORT;
496 if (!BN_hex2bn(&b, "051953EB9618E1C9A1F929A21A0B68540EEA2DA725B99B"
497 "315F3B8B489918EF109E156193951EC7E937B1652C0BD3BB1BF073573"
498 "DF883D2C34F1EF451FD46B503F00")) ABORT;
499 if (!EC_GROUP_set_curve_GFp(group, p, a, b, ctx)) ABORT;
500
501 if (!BN_hex2bn(&x, "C6858E06B70404E9CD9E3ECB662395B4429C648139053F"
502 "B521F828AF606B4D3DBAA14B5E77EFE75928FE1DC127A2FFA8DE3348B"
503 "3C1856A429BF97E7E31C2E5BD66")) ABORT;
504 if (!EC_POINT_set_compressed_coordinates_GFp(group, P, x, 0, ctx)) ABORT;
505 if (!EC_POINT_is_on_curve(group, P, ctx)) ABORT;
506 if (!BN_hex2bn(&z, "1FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
507 "FFFFFFFFFFFFFFFFFFFFA51868783BF2F966B7FCC0148F709A5D03BB5"
508 "C9B8899C47AEBB6FB71E91386409")) ABORT;
509 if (!EC_GROUP_set_generator(group, P, z, BN_value_one())) ABORT;
510
511 if (!EC_POINT_get_affine_coordinates_GFp(group, P, x, y, ctx)) ABORT;
512 fprintf(stdout, "\nNIST curve P-521 -- Generator:\n x = 0x");
513 BN_print_fp(stdout, x);
514 fprintf(stdout, "\n y = 0x");
515 BN_print_fp(stdout, y);
516 fprintf(stdout, "\n");
517 /* G_y value taken from the standard: */
518 if (!BN_hex2bn(&z, "11839296A789A3BC0045C8A5FB42C7D1BD998F54449579"
519 "B446817AFBD17273E662C97EE72995EF42640C550B9013FAD0761353C"
520 "7086A272C24088BE94769FD16650")) ABORT;
521 if (0 != BN_cmp(y, z)) ABORT;
522
523 fprintf(stdout, "verify group order ...");
524 fflush(stdout);
525 if (!EC_GROUP_get_order(group, z, ctx)) ABORT;
526 if (!EC_POINT_mul(group, Q, z, NULL, NULL, ctx)) ABORT;
527 if (!EC_POINT_is_at_infinity(group, Q)) ABORT;
528 fprintf(stdout, ".");
529 fflush(stdout);
530 if (!EC_GROUP_precompute_mult(group, ctx)) ABORT;
531 if (!EC_POINT_mul(group, Q, z, NULL, NULL, ctx)) ABORT;
532 if (!EC_POINT_is_at_infinity(group, Q)) ABORT;
533 fprintf(stdout, " ok\n");
534
535 if (!(P_521 = EC_GROUP_new(EC_GROUP_method_of(group)))) ABORT;
536 if (!EC_GROUP_copy(P_521, group)) ABORT;
537
538
539 /* more tests using the last curve */
540
541 if (!EC_POINT_copy(Q, P)) ABORT;
542 if (EC_POINT_is_at_infinity(group, Q)) ABORT;
543 if (!EC_POINT_dbl(group, P, P, ctx)) ABORT;
544 if (!EC_POINT_is_on_curve(group, P, ctx)) ABORT;
545 if (!EC_POINT_invert(group, Q, ctx)) ABORT; /* P = -2Q */
546
547 if (!EC_POINT_add(group, R, P, Q, ctx)) ABORT;
548 if (!EC_POINT_add(group, R, R, Q, ctx)) ABORT;
549 if (!EC_POINT_is_at_infinity(group, R)) ABORT; /* R = P + 2Q */
550
551 {
552 const EC_POINT *points[3];
553 const BIGNUM *scalars[3];
554
555 if (EC_POINT_is_at_infinity(group, Q)) ABORT;
556 points[0] = Q;
557 points[1] = Q;
558 points[2] = Q;
559
560 if (!BN_add(y, z, BN_value_one())) ABORT;
561 if (BN_is_odd(y)) ABORT;
562 if (!BN_rshift1(y, y)) ABORT;
563 scalars[0] = y; /* (group order + 1)/2, so y*Q + y*Q = Q */
564 scalars[1] = y;
565
566 fprintf(stdout, "combined multiplication ...");
567 fflush(stdout);
568
569 /* z is still the group order */
570 if (!EC_POINTs_mul(group, P, NULL, 2, points, scalars, ctx)) ABORT;
571 if (!EC_POINTs_mul(group, R, z, 2, points, scalars, ctx)) ABORT;
572 if (0 != EC_POINT_cmp(group, P, R, ctx)) ABORT;
573 if (0 != EC_POINT_cmp(group, R, Q, ctx)) ABORT;
574
575 fprintf(stdout, ".");
576 fflush(stdout);
577
578 if (!BN_pseudo_rand(y, BN_num_bits(y), 0, 0)) ABORT;
579 if (!BN_add(z, z, y)) ABORT;
580 z->neg = 1;
581 scalars[0] = y;
582 scalars[1] = z; /* z = -(order + y) */
583
584 if (!EC_POINTs_mul(group, P, NULL, 2, points, scalars, ctx)) ABORT;
585 if (!EC_POINT_is_at_infinity(group, P)) ABORT;
586
587 fprintf(stdout, ".");
588 fflush(stdout);
589
590 if (!BN_pseudo_rand(x, BN_num_bits(y) - 1, 0, 0)) ABORT;
591 if (!BN_add(z, x, y)) ABORT;
592 z->neg = 1;
593 scalars[0] = x;
594 scalars[1] = y;
595 scalars[2] = z; /* z = -(x+y) */
596
597 if (!EC_POINTs_mul(group, P, NULL, 3, points, scalars, ctx)) ABORT;
598 if (!EC_POINT_is_at_infinity(group, P)) ABORT;
599
600 fprintf(stdout, " ok\n\n");
601 }
602
603
604#if 0
605 timings(P_192, 0, ctx);
606 timings(P_192, 1, ctx);
607 timings(P_224, 0, ctx);
608 timings(P_224, 1, ctx);
609 timings(P_256, 0, ctx);
610 timings(P_256, 1, ctx);
611 timings(P_384, 0, ctx);
612 timings(P_384, 1, ctx);
613 timings(P_521, 0, ctx);
614 timings(P_521, 1, ctx);
615#endif
616
617
618 if (ctx)
619 BN_CTX_free(ctx);
620 BN_free(p); BN_free(a); BN_free(b);
621 EC_GROUP_free(group);
622 EC_POINT_free(P);
623 EC_POINT_free(Q);
624 EC_POINT_free(R);
625 BN_free(x); BN_free(y); BN_free(z);
626
627 if (P_192) EC_GROUP_free(P_192);
628 if (P_224) EC_GROUP_free(P_224);
629 if (P_256) EC_GROUP_free(P_256);
630 if (P_384) EC_GROUP_free(P_384);
631 if (P_521) EC_GROUP_free(P_521);
632
633#ifndef OPENSSL_NO_ENGINE
634 ENGINE_cleanup();
635#endif
636 CRYPTO_cleanup_all_ex_data();
637 ERR_free_strings();
638 ERR_remove_state(0);
639 CRYPTO_mem_leaks_fp(stderr);
640
641 return 0;
642 }
643#endif
diff --git a/src/lib/libcrypto/engine/Makefile b/src/lib/libcrypto/engine/Makefile
new file mode 100644
index 0000000000..38f83f1654
--- /dev/null
+++ b/src/lib/libcrypto/engine/Makefile
@@ -0,0 +1,536 @@
1#
2# OpenSSL/crypto/engine/Makefile
3#
4
5DIR= engine
6TOP= ../..
7CC= cc
8INCLUDES= -I.. -I$(TOP) -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
18CFLAGS= $(INCLUDES) $(CFLAG)
19
20GENERAL=Makefile
21TEST= enginetest.c
22APPS=
23
24LIB=$(TOP)/libcrypto.a
25LIBSRC= eng_err.c eng_lib.c eng_list.c eng_init.c eng_ctrl.c \
26 eng_table.c eng_pkey.c eng_fat.c eng_all.c \
27 tb_rsa.c tb_dsa.c tb_dh.c tb_rand.c tb_cipher.c tb_digest.c \
28 eng_openssl.c eng_dyn.c eng_cnf.c \
29 hw_atalla.c hw_cswift.c hw_ncipher.c hw_nuron.c hw_ubsec.c \
30 hw_cryptodev.c hw_aep.c hw_sureware.c hw_4758_cca.c
31LIBOBJ= eng_err.o eng_lib.o eng_list.o eng_init.o eng_ctrl.o \
32 eng_table.o eng_pkey.o eng_fat.o eng_all.o \
33 tb_rsa.o tb_dsa.o tb_dh.o tb_rand.o tb_cipher.o tb_digest.o \
34 eng_openssl.o eng_dyn.o eng_cnf.o \
35 hw_atalla.o hw_cswift.o hw_ncipher.o hw_nuron.o hw_ubsec.o \
36 hw_cryptodev.o hw_aep.o hw_sureware.o hw_4758_cca.o
37
38SRC= $(LIBSRC)
39
40EXHEADER= engine.h
41HEADER= $(EXHEADER)
42
43ALL= $(GENERAL) $(SRC) $(HEADER)
44
45top:
46 (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all)
47
48all: lib
49
50lib: $(LIBOBJ)
51 $(AR) $(LIB) $(LIBOBJ)
52 $(RANLIB) $(LIB) || echo Never mind.
53 @touch lib
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 @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
73errors:
74 $(PERL) $(TOP)/util/mkerr.pl -conf hw.ec \
75 -nostatic -staticloader -write hw_*.c
76
77tests:
78
79lint:
80 lint -DLINT $(INCLUDES) $(SRC)>fluff
81
82depend:
83 $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
84
85dclean:
86 $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
87 mv -f Makefile.new $(MAKEFILE)
88
89clean:
90 rm -f *.o */*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
91
92# DO NOT DELETE THIS LINE -- make depend depends on it.
93
94eng_all.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
95eng_all.o: ../../include/openssl/bn.h ../../include/openssl/crypto.h
96eng_all.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
97eng_all.o: ../../include/openssl/e_os2.h ../../include/openssl/engine.h
98eng_all.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
99eng_all.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
100eng_all.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rand.h
101eng_all.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
102eng_all.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
103eng_all.o: ../../include/openssl/ui.h eng_all.c eng_int.h
104eng_cnf.o: ../../e_os.h ../../include/openssl/asn1.h
105eng_cnf.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
106eng_cnf.o: ../../include/openssl/buffer.h ../../include/openssl/conf.h
107eng_cnf.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
108eng_cnf.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
109eng_cnf.o: ../../include/openssl/engine.h ../../include/openssl/err.h
110eng_cnf.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
111eng_cnf.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
112eng_cnf.o: ../../include/openssl/rand.h ../../include/openssl/rsa.h
113eng_cnf.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
114eng_cnf.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
115eng_cnf.o: ../cryptlib.h eng_cnf.c
116eng_ctrl.o: ../../e_os.h ../../include/openssl/asn1.h
117eng_ctrl.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
118eng_ctrl.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
119eng_ctrl.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
120eng_ctrl.o: ../../include/openssl/e_os2.h ../../include/openssl/engine.h
121eng_ctrl.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
122eng_ctrl.o: ../../include/openssl/opensslconf.h
123eng_ctrl.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
124eng_ctrl.o: ../../include/openssl/rand.h ../../include/openssl/rsa.h
125eng_ctrl.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
126eng_ctrl.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
127eng_ctrl.o: ../cryptlib.h eng_ctrl.c eng_int.h
128eng_dyn.o: ../../e_os.h ../../include/openssl/asn1.h
129eng_dyn.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
130eng_dyn.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
131eng_dyn.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
132eng_dyn.o: ../../include/openssl/dso.h ../../include/openssl/e_os2.h
133eng_dyn.o: ../../include/openssl/engine.h ../../include/openssl/err.h
134eng_dyn.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
135eng_dyn.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
136eng_dyn.o: ../../include/openssl/rand.h ../../include/openssl/rsa.h
137eng_dyn.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
138eng_dyn.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
139eng_dyn.o: ../cryptlib.h eng_dyn.c eng_int.h
140eng_err.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
141eng_err.o: ../../include/openssl/bn.h ../../include/openssl/crypto.h
142eng_err.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
143eng_err.o: ../../include/openssl/e_os2.h ../../include/openssl/engine.h
144eng_err.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
145eng_err.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
146eng_err.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rand.h
147eng_err.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
148eng_err.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
149eng_err.o: ../../include/openssl/ui.h eng_err.c
150eng_fat.o: ../../e_os.h ../../include/openssl/asn1.h
151eng_fat.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
152eng_fat.o: ../../include/openssl/buffer.h ../../include/openssl/conf.h
153eng_fat.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
154eng_fat.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
155eng_fat.o: ../../include/openssl/engine.h ../../include/openssl/err.h
156eng_fat.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
157eng_fat.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
158eng_fat.o: ../../include/openssl/rand.h ../../include/openssl/rsa.h
159eng_fat.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
160eng_fat.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
161eng_fat.o: ../cryptlib.h eng_fat.c eng_int.h
162eng_init.o: ../../e_os.h ../../include/openssl/asn1.h
163eng_init.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
164eng_init.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
165eng_init.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
166eng_init.o: ../../include/openssl/e_os2.h ../../include/openssl/engine.h
167eng_init.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
168eng_init.o: ../../include/openssl/opensslconf.h
169eng_init.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
170eng_init.o: ../../include/openssl/rand.h ../../include/openssl/rsa.h
171eng_init.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
172eng_init.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
173eng_init.o: ../cryptlib.h eng_init.c eng_int.h
174eng_lib.o: ../../e_os.h ../../include/openssl/asn1.h
175eng_lib.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
176eng_lib.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
177eng_lib.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
178eng_lib.o: ../../include/openssl/e_os2.h ../../include/openssl/engine.h
179eng_lib.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
180eng_lib.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
181eng_lib.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rand.h
182eng_lib.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
183eng_lib.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
184eng_lib.o: ../../include/openssl/ui.h ../cryptlib.h eng_int.h eng_lib.c
185eng_list.o: ../../e_os.h ../../include/openssl/asn1.h
186eng_list.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
187eng_list.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
188eng_list.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
189eng_list.o: ../../include/openssl/e_os2.h ../../include/openssl/engine.h
190eng_list.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
191eng_list.o: ../../include/openssl/opensslconf.h
192eng_list.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
193eng_list.o: ../../include/openssl/rand.h ../../include/openssl/rsa.h
194eng_list.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
195eng_list.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
196eng_list.o: ../cryptlib.h eng_int.h eng_list.c
197eng_openssl.o: ../../e_os.h ../../include/openssl/aes.h
198eng_openssl.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
199eng_openssl.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
200eng_openssl.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
201eng_openssl.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
202eng_openssl.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
203eng_openssl.o: ../../include/openssl/dsa.h ../../include/openssl/dso.h
204eng_openssl.o: ../../include/openssl/e_os2.h ../../include/openssl/engine.h
205eng_openssl.o: ../../include/openssl/err.h ../../include/openssl/evp.h
206eng_openssl.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
207eng_openssl.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
208eng_openssl.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
209eng_openssl.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
210eng_openssl.o: ../../include/openssl/opensslconf.h
211eng_openssl.o: ../../include/openssl/opensslv.h
212eng_openssl.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pem.h
213eng_openssl.o: ../../include/openssl/pem2.h ../../include/openssl/pkcs7.h
214eng_openssl.o: ../../include/openssl/rand.h ../../include/openssl/rc2.h
215eng_openssl.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
216eng_openssl.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
217eng_openssl.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
218eng_openssl.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
219eng_openssl.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
220eng_openssl.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
221eng_openssl.o: ../cryptlib.h eng_openssl.c
222eng_pkey.o: ../../e_os.h ../../include/openssl/asn1.h
223eng_pkey.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
224eng_pkey.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
225eng_pkey.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
226eng_pkey.o: ../../include/openssl/e_os2.h ../../include/openssl/engine.h
227eng_pkey.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
228eng_pkey.o: ../../include/openssl/opensslconf.h
229eng_pkey.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
230eng_pkey.o: ../../include/openssl/rand.h ../../include/openssl/rsa.h
231eng_pkey.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
232eng_pkey.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
233eng_pkey.o: ../cryptlib.h eng_int.h eng_pkey.c
234eng_table.o: ../../include/openssl/aes.h ../../include/openssl/asn1.h
235eng_table.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
236eng_table.o: ../../include/openssl/bn.h ../../include/openssl/cast.h
237eng_table.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
238eng_table.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
239eng_table.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
240eng_table.o: ../../include/openssl/engine.h ../../include/openssl/err.h
241eng_table.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
242eng_table.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
243eng_table.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
244eng_table.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
245eng_table.o: ../../include/openssl/objects.h
246eng_table.o: ../../include/openssl/opensslconf.h
247eng_table.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
248eng_table.o: ../../include/openssl/rand.h ../../include/openssl/rc2.h
249eng_table.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
250eng_table.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
251eng_table.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
252eng_table.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
253eng_table.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
254eng_table.o: eng_int.h eng_table.c
255hw_4758_cca.o: ../../e_os.h ../../include/openssl/aes.h
256hw_4758_cca.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
257hw_4758_cca.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
258hw_4758_cca.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
259hw_4758_cca.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
260hw_4758_cca.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
261hw_4758_cca.o: ../../include/openssl/dsa.h ../../include/openssl/dso.h
262hw_4758_cca.o: ../../include/openssl/e_os2.h ../../include/openssl/engine.h
263hw_4758_cca.o: ../../include/openssl/err.h ../../include/openssl/evp.h
264hw_4758_cca.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
265hw_4758_cca.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
266hw_4758_cca.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
267hw_4758_cca.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
268hw_4758_cca.o: ../../include/openssl/opensslconf.h
269hw_4758_cca.o: ../../include/openssl/opensslv.h
270hw_4758_cca.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
271hw_4758_cca.o: ../../include/openssl/rand.h ../../include/openssl/rc2.h
272hw_4758_cca.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
273hw_4758_cca.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
274hw_4758_cca.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
275hw_4758_cca.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
276hw_4758_cca.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
277hw_4758_cca.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
278hw_4758_cca.o: ../cryptlib.h hw_4758_cca.c hw_4758_cca_err.c hw_4758_cca_err.h
279hw_4758_cca.o: vendor_defns/hw_4758_cca.h
280hw_aep.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
281hw_aep.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
282hw_aep.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
283hw_aep.o: ../../include/openssl/dsa.h ../../include/openssl/dso.h
284hw_aep.o: ../../include/openssl/e_os2.h ../../include/openssl/engine.h
285hw_aep.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
286hw_aep.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
287hw_aep.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rand.h
288hw_aep.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
289hw_aep.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
290hw_aep.o: ../../include/openssl/ui.h hw_aep.c hw_aep_err.c hw_aep_err.h
291hw_aep.o: vendor_defns/aep.h
292hw_atalla.o: ../../e_os.h ../../include/openssl/asn1.h
293hw_atalla.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
294hw_atalla.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
295hw_atalla.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
296hw_atalla.o: ../../include/openssl/dso.h ../../include/openssl/e_os2.h
297hw_atalla.o: ../../include/openssl/engine.h ../../include/openssl/err.h
298hw_atalla.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
299hw_atalla.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
300hw_atalla.o: ../../include/openssl/rand.h ../../include/openssl/rsa.h
301hw_atalla.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
302hw_atalla.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
303hw_atalla.o: ../cryptlib.h hw_atalla.c hw_atalla_err.c hw_atalla_err.h
304hw_atalla.o: vendor_defns/atalla.h
305hw_cryptodev.o: ../../include/openssl/aes.h ../../include/openssl/asn1.h
306hw_cryptodev.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
307hw_cryptodev.o: ../../include/openssl/bn.h ../../include/openssl/cast.h
308hw_cryptodev.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
309hw_cryptodev.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
310hw_cryptodev.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
311hw_cryptodev.o: ../../include/openssl/engine.h ../../include/openssl/err.h
312hw_cryptodev.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
313hw_cryptodev.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
314hw_cryptodev.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
315hw_cryptodev.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
316hw_cryptodev.o: ../../include/openssl/objects.h
317hw_cryptodev.o: ../../include/openssl/opensslconf.h
318hw_cryptodev.o: ../../include/openssl/opensslv.h
319hw_cryptodev.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rand.h
320hw_cryptodev.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
321hw_cryptodev.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
322hw_cryptodev.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
323hw_cryptodev.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
324hw_cryptodev.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
325hw_cryptodev.o: ../../include/openssl/ui_compat.h hw_cryptodev.c
326hw_cswift.o: ../../e_os.h ../../include/openssl/asn1.h
327hw_cswift.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
328hw_cswift.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
329hw_cswift.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
330hw_cswift.o: ../../include/openssl/dso.h ../../include/openssl/e_os2.h
331hw_cswift.o: ../../include/openssl/engine.h ../../include/openssl/err.h
332hw_cswift.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
333hw_cswift.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
334hw_cswift.o: ../../include/openssl/rand.h ../../include/openssl/rsa.h
335hw_cswift.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
336hw_cswift.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
337hw_cswift.o: ../cryptlib.h hw_cswift.c hw_cswift_err.c hw_cswift_err.h
338hw_cswift.o: vendor_defns/cswift.h
339hw_ncipher.o: ../../e_os.h ../../include/openssl/aes.h
340hw_ncipher.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
341hw_ncipher.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
342hw_ncipher.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
343hw_ncipher.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
344hw_ncipher.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
345hw_ncipher.o: ../../include/openssl/dsa.h ../../include/openssl/dso.h
346hw_ncipher.o: ../../include/openssl/e_os2.h ../../include/openssl/engine.h
347hw_ncipher.o: ../../include/openssl/err.h ../../include/openssl/evp.h
348hw_ncipher.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
349hw_ncipher.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
350hw_ncipher.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
351hw_ncipher.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
352hw_ncipher.o: ../../include/openssl/opensslconf.h
353hw_ncipher.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
354hw_ncipher.o: ../../include/openssl/pem.h ../../include/openssl/pem2.h
355hw_ncipher.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h
356hw_ncipher.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
357hw_ncipher.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
358hw_ncipher.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
359hw_ncipher.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
360hw_ncipher.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
361hw_ncipher.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h
362hw_ncipher.o: ../../include/openssl/x509_vfy.h ../cryptlib.h hw_ncipher.c
363hw_ncipher.o: hw_ncipher_err.c hw_ncipher_err.h vendor_defns/hwcryptohook.h
364hw_nuron.o: ../../e_os.h ../../include/openssl/asn1.h
365hw_nuron.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
366hw_nuron.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
367hw_nuron.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
368hw_nuron.o: ../../include/openssl/dso.h ../../include/openssl/e_os2.h
369hw_nuron.o: ../../include/openssl/engine.h ../../include/openssl/err.h
370hw_nuron.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
371hw_nuron.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
372hw_nuron.o: ../../include/openssl/rand.h ../../include/openssl/rsa.h
373hw_nuron.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
374hw_nuron.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
375hw_nuron.o: ../cryptlib.h hw_nuron.c hw_nuron_err.c hw_nuron_err.h
376hw_sureware.o: ../../e_os.h ../../include/openssl/aes.h
377hw_sureware.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
378hw_sureware.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
379hw_sureware.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
380hw_sureware.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
381hw_sureware.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
382hw_sureware.o: ../../include/openssl/dsa.h ../../include/openssl/dso.h
383hw_sureware.o: ../../include/openssl/e_os2.h ../../include/openssl/engine.h
384hw_sureware.o: ../../include/openssl/err.h ../../include/openssl/evp.h
385hw_sureware.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
386hw_sureware.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
387hw_sureware.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
388hw_sureware.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
389hw_sureware.o: ../../include/openssl/opensslconf.h
390hw_sureware.o: ../../include/openssl/opensslv.h
391hw_sureware.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pem.h
392hw_sureware.o: ../../include/openssl/pem2.h ../../include/openssl/pkcs7.h
393hw_sureware.o: ../../include/openssl/rand.h ../../include/openssl/rc2.h
394hw_sureware.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
395hw_sureware.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
396hw_sureware.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
397hw_sureware.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
398hw_sureware.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
399hw_sureware.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
400hw_sureware.o: ../cryptlib.h eng_int.h engine.h hw_sureware.c hw_sureware_err.c
401hw_sureware.o: hw_sureware_err.h vendor_defns/sureware.h
402hw_ubsec.o: ../../e_os.h ../../include/openssl/asn1.h
403hw_ubsec.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
404hw_ubsec.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
405hw_ubsec.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
406hw_ubsec.o: ../../include/openssl/dso.h ../../include/openssl/e_os2.h
407hw_ubsec.o: ../../include/openssl/engine.h ../../include/openssl/err.h
408hw_ubsec.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
409hw_ubsec.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
410hw_ubsec.o: ../../include/openssl/rand.h ../../include/openssl/rsa.h
411hw_ubsec.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
412hw_ubsec.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
413hw_ubsec.o: ../cryptlib.h hw_ubsec.c hw_ubsec_err.c hw_ubsec_err.h
414hw_ubsec.o: vendor_defns/hw_ubsec.h
415tb_cipher.o: ../../include/openssl/aes.h ../../include/openssl/asn1.h
416tb_cipher.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
417tb_cipher.o: ../../include/openssl/bn.h ../../include/openssl/cast.h
418tb_cipher.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
419tb_cipher.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
420tb_cipher.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
421tb_cipher.o: ../../include/openssl/engine.h ../../include/openssl/err.h
422tb_cipher.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
423tb_cipher.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
424tb_cipher.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
425tb_cipher.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
426tb_cipher.o: ../../include/openssl/objects.h
427tb_cipher.o: ../../include/openssl/opensslconf.h
428tb_cipher.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
429tb_cipher.o: ../../include/openssl/rand.h ../../include/openssl/rc2.h
430tb_cipher.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
431tb_cipher.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
432tb_cipher.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
433tb_cipher.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
434tb_cipher.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
435tb_cipher.o: eng_int.h tb_cipher.c
436tb_dh.o: ../../include/openssl/aes.h ../../include/openssl/asn1.h
437tb_dh.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
438tb_dh.o: ../../include/openssl/bn.h ../../include/openssl/cast.h
439tb_dh.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
440tb_dh.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
441tb_dh.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
442tb_dh.o: ../../include/openssl/engine.h ../../include/openssl/err.h
443tb_dh.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
444tb_dh.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
445tb_dh.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
446tb_dh.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
447tb_dh.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
448tb_dh.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
449tb_dh.o: ../../include/openssl/rand.h ../../include/openssl/rc2.h
450tb_dh.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
451tb_dh.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
452tb_dh.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
453tb_dh.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
454tb_dh.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h eng_int.h
455tb_dh.o: tb_dh.c
456tb_digest.o: ../../include/openssl/aes.h ../../include/openssl/asn1.h
457tb_digest.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
458tb_digest.o: ../../include/openssl/bn.h ../../include/openssl/cast.h
459tb_digest.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
460tb_digest.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
461tb_digest.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
462tb_digest.o: ../../include/openssl/engine.h ../../include/openssl/err.h
463tb_digest.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
464tb_digest.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
465tb_digest.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
466tb_digest.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
467tb_digest.o: ../../include/openssl/objects.h
468tb_digest.o: ../../include/openssl/opensslconf.h
469tb_digest.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
470tb_digest.o: ../../include/openssl/rand.h ../../include/openssl/rc2.h
471tb_digest.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
472tb_digest.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
473tb_digest.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
474tb_digest.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
475tb_digest.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
476tb_digest.o: eng_int.h tb_digest.c
477tb_dsa.o: ../../include/openssl/aes.h ../../include/openssl/asn1.h
478tb_dsa.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
479tb_dsa.o: ../../include/openssl/bn.h ../../include/openssl/cast.h
480tb_dsa.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
481tb_dsa.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
482tb_dsa.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
483tb_dsa.o: ../../include/openssl/engine.h ../../include/openssl/err.h
484tb_dsa.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
485tb_dsa.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
486tb_dsa.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
487tb_dsa.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
488tb_dsa.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
489tb_dsa.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
490tb_dsa.o: ../../include/openssl/rand.h ../../include/openssl/rc2.h
491tb_dsa.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
492tb_dsa.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
493tb_dsa.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
494tb_dsa.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
495tb_dsa.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
496tb_dsa.o: eng_int.h tb_dsa.c
497tb_rand.o: ../../include/openssl/aes.h ../../include/openssl/asn1.h
498tb_rand.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
499tb_rand.o: ../../include/openssl/bn.h ../../include/openssl/cast.h
500tb_rand.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
501tb_rand.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
502tb_rand.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
503tb_rand.o: ../../include/openssl/engine.h ../../include/openssl/err.h
504tb_rand.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
505tb_rand.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
506tb_rand.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
507tb_rand.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
508tb_rand.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
509tb_rand.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
510tb_rand.o: ../../include/openssl/rand.h ../../include/openssl/rc2.h
511tb_rand.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
512tb_rand.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
513tb_rand.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
514tb_rand.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
515tb_rand.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
516tb_rand.o: eng_int.h tb_rand.c
517tb_rsa.o: ../../include/openssl/aes.h ../../include/openssl/asn1.h
518tb_rsa.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
519tb_rsa.o: ../../include/openssl/bn.h ../../include/openssl/cast.h
520tb_rsa.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
521tb_rsa.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
522tb_rsa.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
523tb_rsa.o: ../../include/openssl/engine.h ../../include/openssl/err.h
524tb_rsa.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
525tb_rsa.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
526tb_rsa.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
527tb_rsa.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
528tb_rsa.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
529tb_rsa.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
530tb_rsa.o: ../../include/openssl/rand.h ../../include/openssl/rc2.h
531tb_rsa.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
532tb_rsa.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
533tb_rsa.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
534tb_rsa.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
535tb_rsa.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
536tb_rsa.o: eng_int.h tb_rsa.c
diff --git a/src/lib/libcrypto/engine/Makefile.ssl b/src/lib/libcrypto/engine/Makefile.ssl
new file mode 100644
index 0000000000..30a4446ff9
--- /dev/null
+++ b/src/lib/libcrypto/engine/Makefile.ssl
@@ -0,0 +1,538 @@
1#
2# OpenSSL/crypto/engine/Makefile
3#
4
5DIR= engine
6TOP= ../..
7CC= cc
8INCLUDES= -I.. -I$(TOP) -I../../include
9CFLAG=-g
10INSTALL_PREFIX=
11OPENSSLDIR= /usr/local/ssl
12INSTALLTOP=/usr/local/ssl
13MAKE= make -f Makefile.ssl
14MAKEDEPPROG= makedepend
15MAKEDEPEND= $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG)
16MAKEFILE= Makefile.ssl
17AR= ar r
18
19CFLAGS= $(INCLUDES) $(CFLAG)
20
21GENERAL=Makefile
22TEST= enginetest.c
23APPS=
24
25LIB=$(TOP)/libcrypto.a
26LIBSRC= eng_err.c eng_lib.c eng_list.c eng_init.c eng_ctrl.c \
27 eng_table.c eng_pkey.c eng_fat.c eng_all.c \
28 tb_rsa.c tb_dsa.c tb_dh.c tb_rand.c tb_cipher.c tb_digest.c \
29 eng_openssl.c eng_dyn.c eng_cnf.c \
30 hw_atalla.c hw_cswift.c hw_ncipher.c hw_nuron.c hw_ubsec.c \
31 hw_cryptodev.c hw_aep.c hw_sureware.c hw_4758_cca.c
32LIBOBJ= eng_err.o eng_lib.o eng_list.o eng_init.o eng_ctrl.o \
33 eng_table.o eng_pkey.o eng_fat.o eng_all.o \
34 tb_rsa.o tb_dsa.o tb_dh.o tb_rand.o tb_cipher.o tb_digest.o \
35 eng_openssl.o eng_dyn.o eng_cnf.o \
36 hw_atalla.o hw_cswift.o hw_ncipher.o hw_nuron.o hw_ubsec.o \
37 hw_cryptodev.o hw_aep.o hw_sureware.o hw_4758_cca.o
38
39SRC= $(LIBSRC)
40
41EXHEADER= engine.h
42HEADER= $(EXHEADER)
43
44ALL= $(GENERAL) $(SRC) $(HEADER)
45
46top:
47 (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all)
48
49all: lib
50
51lib: $(LIBOBJ)
52 $(AR) $(LIB) $(LIBOBJ)
53 $(RANLIB) $(LIB) || echo Never mind.
54 @touch lib
55
56files:
57 $(PERL) $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO
58
59links:
60 @sh $(TOP)/util/point.sh Makefile.ssl Makefile
61 @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
62 @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
63 @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
64
65install:
66 @for i in $(EXHEADER) ; \
67 do \
68 (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
69 chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
70 done;
71
72tags:
73 ctags $(SRC)
74
75errors:
76 $(PERL) $(TOP)/util/mkerr.pl -conf hw.ec \
77 -nostatic -staticloader -write hw_*.c
78
79tests:
80
81lint:
82 lint -DLINT $(INCLUDES) $(SRC)>fluff
83
84depend:
85 $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
86
87dclean:
88 $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
89 mv -f Makefile.new $(MAKEFILE)
90
91clean:
92 rm -f *.o */*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
93
94# DO NOT DELETE THIS LINE -- make depend depends on it.
95
96eng_all.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
97eng_all.o: ../../include/openssl/bn.h ../../include/openssl/crypto.h
98eng_all.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
99eng_all.o: ../../include/openssl/e_os2.h ../../include/openssl/engine.h
100eng_all.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
101eng_all.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
102eng_all.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rand.h
103eng_all.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
104eng_all.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
105eng_all.o: ../../include/openssl/ui.h eng_all.c eng_int.h
106eng_cnf.o: ../../e_os.h ../../include/openssl/asn1.h
107eng_cnf.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
108eng_cnf.o: ../../include/openssl/buffer.h ../../include/openssl/conf.h
109eng_cnf.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
110eng_cnf.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
111eng_cnf.o: ../../include/openssl/engine.h ../../include/openssl/err.h
112eng_cnf.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
113eng_cnf.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
114eng_cnf.o: ../../include/openssl/rand.h ../../include/openssl/rsa.h
115eng_cnf.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
116eng_cnf.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
117eng_cnf.o: ../cryptlib.h eng_cnf.c
118eng_ctrl.o: ../../e_os.h ../../include/openssl/asn1.h
119eng_ctrl.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
120eng_ctrl.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
121eng_ctrl.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
122eng_ctrl.o: ../../include/openssl/e_os2.h ../../include/openssl/engine.h
123eng_ctrl.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
124eng_ctrl.o: ../../include/openssl/opensslconf.h
125eng_ctrl.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
126eng_ctrl.o: ../../include/openssl/rand.h ../../include/openssl/rsa.h
127eng_ctrl.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
128eng_ctrl.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
129eng_ctrl.o: ../cryptlib.h eng_ctrl.c eng_int.h
130eng_dyn.o: ../../e_os.h ../../include/openssl/asn1.h
131eng_dyn.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
132eng_dyn.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
133eng_dyn.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
134eng_dyn.o: ../../include/openssl/dso.h ../../include/openssl/e_os2.h
135eng_dyn.o: ../../include/openssl/engine.h ../../include/openssl/err.h
136eng_dyn.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
137eng_dyn.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
138eng_dyn.o: ../../include/openssl/rand.h ../../include/openssl/rsa.h
139eng_dyn.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
140eng_dyn.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
141eng_dyn.o: ../cryptlib.h eng_dyn.c eng_int.h
142eng_err.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
143eng_err.o: ../../include/openssl/bn.h ../../include/openssl/crypto.h
144eng_err.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
145eng_err.o: ../../include/openssl/e_os2.h ../../include/openssl/engine.h
146eng_err.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
147eng_err.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
148eng_err.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rand.h
149eng_err.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
150eng_err.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
151eng_err.o: ../../include/openssl/ui.h eng_err.c
152eng_fat.o: ../../e_os.h ../../include/openssl/asn1.h
153eng_fat.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
154eng_fat.o: ../../include/openssl/buffer.h ../../include/openssl/conf.h
155eng_fat.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
156eng_fat.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
157eng_fat.o: ../../include/openssl/engine.h ../../include/openssl/err.h
158eng_fat.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
159eng_fat.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
160eng_fat.o: ../../include/openssl/rand.h ../../include/openssl/rsa.h
161eng_fat.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
162eng_fat.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
163eng_fat.o: ../cryptlib.h eng_fat.c eng_int.h
164eng_init.o: ../../e_os.h ../../include/openssl/asn1.h
165eng_init.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
166eng_init.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
167eng_init.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
168eng_init.o: ../../include/openssl/e_os2.h ../../include/openssl/engine.h
169eng_init.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
170eng_init.o: ../../include/openssl/opensslconf.h
171eng_init.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
172eng_init.o: ../../include/openssl/rand.h ../../include/openssl/rsa.h
173eng_init.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
174eng_init.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
175eng_init.o: ../cryptlib.h eng_init.c eng_int.h
176eng_lib.o: ../../e_os.h ../../include/openssl/asn1.h
177eng_lib.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
178eng_lib.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
179eng_lib.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
180eng_lib.o: ../../include/openssl/e_os2.h ../../include/openssl/engine.h
181eng_lib.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
182eng_lib.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
183eng_lib.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rand.h
184eng_lib.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
185eng_lib.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
186eng_lib.o: ../../include/openssl/ui.h ../cryptlib.h eng_int.h eng_lib.c
187eng_list.o: ../../e_os.h ../../include/openssl/asn1.h
188eng_list.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
189eng_list.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
190eng_list.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
191eng_list.o: ../../include/openssl/e_os2.h ../../include/openssl/engine.h
192eng_list.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
193eng_list.o: ../../include/openssl/opensslconf.h
194eng_list.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
195eng_list.o: ../../include/openssl/rand.h ../../include/openssl/rsa.h
196eng_list.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
197eng_list.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
198eng_list.o: ../cryptlib.h eng_int.h eng_list.c
199eng_openssl.o: ../../e_os.h ../../include/openssl/aes.h
200eng_openssl.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
201eng_openssl.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
202eng_openssl.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
203eng_openssl.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
204eng_openssl.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
205eng_openssl.o: ../../include/openssl/dsa.h ../../include/openssl/dso.h
206eng_openssl.o: ../../include/openssl/e_os2.h ../../include/openssl/engine.h
207eng_openssl.o: ../../include/openssl/err.h ../../include/openssl/evp.h
208eng_openssl.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
209eng_openssl.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
210eng_openssl.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
211eng_openssl.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
212eng_openssl.o: ../../include/openssl/opensslconf.h
213eng_openssl.o: ../../include/openssl/opensslv.h
214eng_openssl.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pem.h
215eng_openssl.o: ../../include/openssl/pem2.h ../../include/openssl/pkcs7.h
216eng_openssl.o: ../../include/openssl/rand.h ../../include/openssl/rc2.h
217eng_openssl.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
218eng_openssl.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
219eng_openssl.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
220eng_openssl.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
221eng_openssl.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
222eng_openssl.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
223eng_openssl.o: ../cryptlib.h eng_openssl.c
224eng_pkey.o: ../../e_os.h ../../include/openssl/asn1.h
225eng_pkey.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
226eng_pkey.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
227eng_pkey.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
228eng_pkey.o: ../../include/openssl/e_os2.h ../../include/openssl/engine.h
229eng_pkey.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
230eng_pkey.o: ../../include/openssl/opensslconf.h
231eng_pkey.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
232eng_pkey.o: ../../include/openssl/rand.h ../../include/openssl/rsa.h
233eng_pkey.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
234eng_pkey.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
235eng_pkey.o: ../cryptlib.h eng_int.h eng_pkey.c
236eng_table.o: ../../include/openssl/aes.h ../../include/openssl/asn1.h
237eng_table.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
238eng_table.o: ../../include/openssl/bn.h ../../include/openssl/cast.h
239eng_table.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
240eng_table.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
241eng_table.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
242eng_table.o: ../../include/openssl/engine.h ../../include/openssl/err.h
243eng_table.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
244eng_table.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
245eng_table.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
246eng_table.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
247eng_table.o: ../../include/openssl/objects.h
248eng_table.o: ../../include/openssl/opensslconf.h
249eng_table.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
250eng_table.o: ../../include/openssl/rand.h ../../include/openssl/rc2.h
251eng_table.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
252eng_table.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
253eng_table.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
254eng_table.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
255eng_table.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
256eng_table.o: eng_int.h eng_table.c
257hw_4758_cca.o: ../../e_os.h ../../include/openssl/aes.h
258hw_4758_cca.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
259hw_4758_cca.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
260hw_4758_cca.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
261hw_4758_cca.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
262hw_4758_cca.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
263hw_4758_cca.o: ../../include/openssl/dsa.h ../../include/openssl/dso.h
264hw_4758_cca.o: ../../include/openssl/e_os2.h ../../include/openssl/engine.h
265hw_4758_cca.o: ../../include/openssl/err.h ../../include/openssl/evp.h
266hw_4758_cca.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
267hw_4758_cca.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
268hw_4758_cca.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
269hw_4758_cca.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
270hw_4758_cca.o: ../../include/openssl/opensslconf.h
271hw_4758_cca.o: ../../include/openssl/opensslv.h
272hw_4758_cca.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
273hw_4758_cca.o: ../../include/openssl/rand.h ../../include/openssl/rc2.h
274hw_4758_cca.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
275hw_4758_cca.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
276hw_4758_cca.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
277hw_4758_cca.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
278hw_4758_cca.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
279hw_4758_cca.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
280hw_4758_cca.o: ../cryptlib.h hw_4758_cca.c hw_4758_cca_err.c hw_4758_cca_err.h
281hw_4758_cca.o: vendor_defns/hw_4758_cca.h
282hw_aep.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
283hw_aep.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
284hw_aep.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
285hw_aep.o: ../../include/openssl/dsa.h ../../include/openssl/dso.h
286hw_aep.o: ../../include/openssl/e_os2.h ../../include/openssl/engine.h
287hw_aep.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
288hw_aep.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
289hw_aep.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rand.h
290hw_aep.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
291hw_aep.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
292hw_aep.o: ../../include/openssl/ui.h hw_aep.c hw_aep_err.c hw_aep_err.h
293hw_aep.o: vendor_defns/aep.h
294hw_atalla.o: ../../e_os.h ../../include/openssl/asn1.h
295hw_atalla.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
296hw_atalla.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
297hw_atalla.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
298hw_atalla.o: ../../include/openssl/dso.h ../../include/openssl/e_os2.h
299hw_atalla.o: ../../include/openssl/engine.h ../../include/openssl/err.h
300hw_atalla.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
301hw_atalla.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
302hw_atalla.o: ../../include/openssl/rand.h ../../include/openssl/rsa.h
303hw_atalla.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
304hw_atalla.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
305hw_atalla.o: ../cryptlib.h hw_atalla.c hw_atalla_err.c hw_atalla_err.h
306hw_atalla.o: vendor_defns/atalla.h
307hw_cryptodev.o: ../../include/openssl/aes.h ../../include/openssl/asn1.h
308hw_cryptodev.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
309hw_cryptodev.o: ../../include/openssl/bn.h ../../include/openssl/cast.h
310hw_cryptodev.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
311hw_cryptodev.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
312hw_cryptodev.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
313hw_cryptodev.o: ../../include/openssl/engine.h ../../include/openssl/err.h
314hw_cryptodev.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
315hw_cryptodev.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
316hw_cryptodev.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
317hw_cryptodev.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
318hw_cryptodev.o: ../../include/openssl/objects.h
319hw_cryptodev.o: ../../include/openssl/opensslconf.h
320hw_cryptodev.o: ../../include/openssl/opensslv.h
321hw_cryptodev.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rand.h
322hw_cryptodev.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
323hw_cryptodev.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
324hw_cryptodev.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
325hw_cryptodev.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
326hw_cryptodev.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
327hw_cryptodev.o: ../../include/openssl/ui_compat.h hw_cryptodev.c
328hw_cswift.o: ../../e_os.h ../../include/openssl/asn1.h
329hw_cswift.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
330hw_cswift.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
331hw_cswift.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
332hw_cswift.o: ../../include/openssl/dso.h ../../include/openssl/e_os2.h
333hw_cswift.o: ../../include/openssl/engine.h ../../include/openssl/err.h
334hw_cswift.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
335hw_cswift.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
336hw_cswift.o: ../../include/openssl/rand.h ../../include/openssl/rsa.h
337hw_cswift.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
338hw_cswift.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
339hw_cswift.o: ../cryptlib.h hw_cswift.c hw_cswift_err.c hw_cswift_err.h
340hw_cswift.o: vendor_defns/cswift.h
341hw_ncipher.o: ../../e_os.h ../../include/openssl/aes.h
342hw_ncipher.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
343hw_ncipher.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
344hw_ncipher.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
345hw_ncipher.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
346hw_ncipher.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
347hw_ncipher.o: ../../include/openssl/dsa.h ../../include/openssl/dso.h
348hw_ncipher.o: ../../include/openssl/e_os2.h ../../include/openssl/engine.h
349hw_ncipher.o: ../../include/openssl/err.h ../../include/openssl/evp.h
350hw_ncipher.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
351hw_ncipher.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
352hw_ncipher.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
353hw_ncipher.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
354hw_ncipher.o: ../../include/openssl/opensslconf.h
355hw_ncipher.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
356hw_ncipher.o: ../../include/openssl/pem.h ../../include/openssl/pem2.h
357hw_ncipher.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h
358hw_ncipher.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
359hw_ncipher.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
360hw_ncipher.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
361hw_ncipher.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
362hw_ncipher.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
363hw_ncipher.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h
364hw_ncipher.o: ../../include/openssl/x509_vfy.h ../cryptlib.h hw_ncipher.c
365hw_ncipher.o: hw_ncipher_err.c hw_ncipher_err.h vendor_defns/hwcryptohook.h
366hw_nuron.o: ../../e_os.h ../../include/openssl/asn1.h
367hw_nuron.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
368hw_nuron.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
369hw_nuron.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
370hw_nuron.o: ../../include/openssl/dso.h ../../include/openssl/e_os2.h
371hw_nuron.o: ../../include/openssl/engine.h ../../include/openssl/err.h
372hw_nuron.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
373hw_nuron.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
374hw_nuron.o: ../../include/openssl/rand.h ../../include/openssl/rsa.h
375hw_nuron.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
376hw_nuron.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
377hw_nuron.o: ../cryptlib.h hw_nuron.c hw_nuron_err.c hw_nuron_err.h
378hw_sureware.o: ../../e_os.h ../../include/openssl/aes.h
379hw_sureware.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
380hw_sureware.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
381hw_sureware.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
382hw_sureware.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
383hw_sureware.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
384hw_sureware.o: ../../include/openssl/dsa.h ../../include/openssl/dso.h
385hw_sureware.o: ../../include/openssl/e_os2.h ../../include/openssl/engine.h
386hw_sureware.o: ../../include/openssl/err.h ../../include/openssl/evp.h
387hw_sureware.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
388hw_sureware.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
389hw_sureware.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
390hw_sureware.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
391hw_sureware.o: ../../include/openssl/opensslconf.h
392hw_sureware.o: ../../include/openssl/opensslv.h
393hw_sureware.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pem.h
394hw_sureware.o: ../../include/openssl/pem2.h ../../include/openssl/pkcs7.h
395hw_sureware.o: ../../include/openssl/rand.h ../../include/openssl/rc2.h
396hw_sureware.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
397hw_sureware.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
398hw_sureware.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
399hw_sureware.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
400hw_sureware.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
401hw_sureware.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
402hw_sureware.o: ../cryptlib.h eng_int.h engine.h hw_sureware.c hw_sureware_err.c
403hw_sureware.o: hw_sureware_err.h vendor_defns/sureware.h
404hw_ubsec.o: ../../e_os.h ../../include/openssl/asn1.h
405hw_ubsec.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
406hw_ubsec.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
407hw_ubsec.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
408hw_ubsec.o: ../../include/openssl/dso.h ../../include/openssl/e_os2.h
409hw_ubsec.o: ../../include/openssl/engine.h ../../include/openssl/err.h
410hw_ubsec.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
411hw_ubsec.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
412hw_ubsec.o: ../../include/openssl/rand.h ../../include/openssl/rsa.h
413hw_ubsec.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
414hw_ubsec.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
415hw_ubsec.o: ../cryptlib.h hw_ubsec.c hw_ubsec_err.c hw_ubsec_err.h
416hw_ubsec.o: vendor_defns/hw_ubsec.h
417tb_cipher.o: ../../include/openssl/aes.h ../../include/openssl/asn1.h
418tb_cipher.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
419tb_cipher.o: ../../include/openssl/bn.h ../../include/openssl/cast.h
420tb_cipher.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
421tb_cipher.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
422tb_cipher.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
423tb_cipher.o: ../../include/openssl/engine.h ../../include/openssl/err.h
424tb_cipher.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
425tb_cipher.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
426tb_cipher.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
427tb_cipher.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
428tb_cipher.o: ../../include/openssl/objects.h
429tb_cipher.o: ../../include/openssl/opensslconf.h
430tb_cipher.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
431tb_cipher.o: ../../include/openssl/rand.h ../../include/openssl/rc2.h
432tb_cipher.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
433tb_cipher.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
434tb_cipher.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
435tb_cipher.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
436tb_cipher.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
437tb_cipher.o: eng_int.h tb_cipher.c
438tb_dh.o: ../../include/openssl/aes.h ../../include/openssl/asn1.h
439tb_dh.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
440tb_dh.o: ../../include/openssl/bn.h ../../include/openssl/cast.h
441tb_dh.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
442tb_dh.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
443tb_dh.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
444tb_dh.o: ../../include/openssl/engine.h ../../include/openssl/err.h
445tb_dh.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
446tb_dh.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
447tb_dh.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
448tb_dh.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
449tb_dh.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
450tb_dh.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
451tb_dh.o: ../../include/openssl/rand.h ../../include/openssl/rc2.h
452tb_dh.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
453tb_dh.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
454tb_dh.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
455tb_dh.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
456tb_dh.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h eng_int.h
457tb_dh.o: tb_dh.c
458tb_digest.o: ../../include/openssl/aes.h ../../include/openssl/asn1.h
459tb_digest.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
460tb_digest.o: ../../include/openssl/bn.h ../../include/openssl/cast.h
461tb_digest.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
462tb_digest.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
463tb_digest.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
464tb_digest.o: ../../include/openssl/engine.h ../../include/openssl/err.h
465tb_digest.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
466tb_digest.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
467tb_digest.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
468tb_digest.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
469tb_digest.o: ../../include/openssl/objects.h
470tb_digest.o: ../../include/openssl/opensslconf.h
471tb_digest.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
472tb_digest.o: ../../include/openssl/rand.h ../../include/openssl/rc2.h
473tb_digest.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
474tb_digest.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
475tb_digest.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
476tb_digest.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
477tb_digest.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
478tb_digest.o: eng_int.h tb_digest.c
479tb_dsa.o: ../../include/openssl/aes.h ../../include/openssl/asn1.h
480tb_dsa.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
481tb_dsa.o: ../../include/openssl/bn.h ../../include/openssl/cast.h
482tb_dsa.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
483tb_dsa.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
484tb_dsa.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
485tb_dsa.o: ../../include/openssl/engine.h ../../include/openssl/err.h
486tb_dsa.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
487tb_dsa.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
488tb_dsa.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
489tb_dsa.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
490tb_dsa.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
491tb_dsa.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
492tb_dsa.o: ../../include/openssl/rand.h ../../include/openssl/rc2.h
493tb_dsa.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
494tb_dsa.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
495tb_dsa.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
496tb_dsa.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
497tb_dsa.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
498tb_dsa.o: eng_int.h tb_dsa.c
499tb_rand.o: ../../include/openssl/aes.h ../../include/openssl/asn1.h
500tb_rand.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
501tb_rand.o: ../../include/openssl/bn.h ../../include/openssl/cast.h
502tb_rand.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
503tb_rand.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
504tb_rand.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
505tb_rand.o: ../../include/openssl/engine.h ../../include/openssl/err.h
506tb_rand.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
507tb_rand.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
508tb_rand.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
509tb_rand.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
510tb_rand.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
511tb_rand.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
512tb_rand.o: ../../include/openssl/rand.h ../../include/openssl/rc2.h
513tb_rand.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
514tb_rand.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
515tb_rand.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
516tb_rand.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
517tb_rand.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
518tb_rand.o: eng_int.h tb_rand.c
519tb_rsa.o: ../../include/openssl/aes.h ../../include/openssl/asn1.h
520tb_rsa.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
521tb_rsa.o: ../../include/openssl/bn.h ../../include/openssl/cast.h
522tb_rsa.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
523tb_rsa.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
524tb_rsa.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
525tb_rsa.o: ../../include/openssl/engine.h ../../include/openssl/err.h
526tb_rsa.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
527tb_rsa.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
528tb_rsa.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
529tb_rsa.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
530tb_rsa.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
531tb_rsa.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
532tb_rsa.o: ../../include/openssl/rand.h ../../include/openssl/rc2.h
533tb_rsa.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
534tb_rsa.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
535tb_rsa.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
536tb_rsa.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
537tb_rsa.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
538tb_rsa.o: eng_int.h tb_rsa.c
diff --git a/src/lib/libcrypto/engine/eng_cnf.c b/src/lib/libcrypto/engine/eng_cnf.c
index 4225760af1..cdf670901a 100644
--- a/src/lib/libcrypto/engine/eng_cnf.c
+++ b/src/lib/libcrypto/engine/eng_cnf.c
@@ -158,7 +158,7 @@ static int int_engine_configure(char *name, char *value, const CONF *cnf)
158 */ 158 */
159 if (!strcmp(ctrlvalue, "EMPTY")) 159 if (!strcmp(ctrlvalue, "EMPTY"))
160 ctrlvalue = NULL; 160 ctrlvalue = NULL;
161 if (!strcmp(ctrlname, "init")) 161 else if (!strcmp(ctrlname, "init"))
162 { 162 {
163 if (!NCONF_get_number_e(cnf, value, "init", &do_init)) 163 if (!NCONF_get_number_e(cnf, value, "init", &do_init))
164 goto err; 164 goto err;
diff --git a/src/lib/libcrypto/engine/eng_err.c b/src/lib/libcrypto/engine/eng_err.c
index fdc0e7be0f..814d95ee32 100644
--- a/src/lib/libcrypto/engine/eng_err.c
+++ b/src/lib/libcrypto/engine/eng_err.c
@@ -1,6 +1,6 @@
1/* crypto/engine/eng_err.c */ 1/* crypto/engine/eng_err.c */
2/* ==================================================================== 2/* ====================================================================
3 * Copyright (c) 1999-2005 The OpenSSL Project. All rights reserved. 3 * Copyright (c) 1999-2002 The OpenSSL Project. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
@@ -64,91 +64,87 @@
64 64
65/* BEGIN ERROR CODES */ 65/* BEGIN ERROR CODES */
66#ifndef OPENSSL_NO_ERR 66#ifndef OPENSSL_NO_ERR
67
68#define ERR_FUNC(func) ERR_PACK(ERR_LIB_ENGINE,func,0)
69#define ERR_REASON(reason) ERR_PACK(ERR_LIB_ENGINE,0,reason)
70
71static ERR_STRING_DATA ENGINE_str_functs[]= 67static ERR_STRING_DATA ENGINE_str_functs[]=
72 { 68 {
73{ERR_FUNC(ENGINE_F_DYNAMIC_CTRL), "DYNAMIC_CTRL"}, 69{ERR_PACK(0,ENGINE_F_DYNAMIC_CTRL,0), "DYNAMIC_CTRL"},
74{ERR_FUNC(ENGINE_F_DYNAMIC_GET_DATA_CTX), "DYNAMIC_GET_DATA_CTX"}, 70{ERR_PACK(0,ENGINE_F_DYNAMIC_GET_DATA_CTX,0), "DYNAMIC_GET_DATA_CTX"},
75{ERR_FUNC(ENGINE_F_DYNAMIC_LOAD), "DYNAMIC_LOAD"}, 71{ERR_PACK(0,ENGINE_F_DYNAMIC_LOAD,0), "DYNAMIC_LOAD"},
76{ERR_FUNC(ENGINE_F_ENGINE_ADD), "ENGINE_add"}, 72{ERR_PACK(0,ENGINE_F_ENGINE_ADD,0), "ENGINE_add"},
77{ERR_FUNC(ENGINE_F_ENGINE_BY_ID), "ENGINE_by_id"}, 73{ERR_PACK(0,ENGINE_F_ENGINE_BY_ID,0), "ENGINE_by_id"},
78{ERR_FUNC(ENGINE_F_ENGINE_CMD_IS_EXECUTABLE), "ENGINE_cmd_is_executable"}, 74{ERR_PACK(0,ENGINE_F_ENGINE_CMD_IS_EXECUTABLE,0), "ENGINE_cmd_is_executable"},
79{ERR_FUNC(ENGINE_F_ENGINE_CTRL), "ENGINE_ctrl"}, 75{ERR_PACK(0,ENGINE_F_ENGINE_CTRL,0), "ENGINE_ctrl"},
80{ERR_FUNC(ENGINE_F_ENGINE_CTRL_CMD), "ENGINE_ctrl_cmd"}, 76{ERR_PACK(0,ENGINE_F_ENGINE_CTRL_CMD,0), "ENGINE_ctrl_cmd"},
81{ERR_FUNC(ENGINE_F_ENGINE_CTRL_CMD_STRING), "ENGINE_ctrl_cmd_string"}, 77{ERR_PACK(0,ENGINE_F_ENGINE_CTRL_CMD_STRING,0), "ENGINE_ctrl_cmd_string"},
82{ERR_FUNC(ENGINE_F_ENGINE_FINISH), "ENGINE_finish"}, 78{ERR_PACK(0,ENGINE_F_ENGINE_FINISH,0), "ENGINE_finish"},
83{ERR_FUNC(ENGINE_F_ENGINE_FREE), "ENGINE_free"}, 79{ERR_PACK(0,ENGINE_F_ENGINE_FREE,0), "ENGINE_free"},
84{ERR_FUNC(ENGINE_F_ENGINE_GET_CIPHER), "ENGINE_get_cipher"}, 80{ERR_PACK(0,ENGINE_F_ENGINE_GET_CIPHER,0), "ENGINE_get_cipher"},
85{ERR_FUNC(ENGINE_F_ENGINE_GET_DEFAULT_TYPE), "ENGINE_GET_DEFAULT_TYPE"}, 81{ERR_PACK(0,ENGINE_F_ENGINE_GET_DEFAULT_TYPE,0), "ENGINE_GET_DEFAULT_TYPE"},
86{ERR_FUNC(ENGINE_F_ENGINE_GET_DIGEST), "ENGINE_get_digest"}, 82{ERR_PACK(0,ENGINE_F_ENGINE_GET_DIGEST,0), "ENGINE_get_digest"},
87{ERR_FUNC(ENGINE_F_ENGINE_GET_NEXT), "ENGINE_get_next"}, 83{ERR_PACK(0,ENGINE_F_ENGINE_GET_NEXT,0), "ENGINE_get_next"},
88{ERR_FUNC(ENGINE_F_ENGINE_GET_PREV), "ENGINE_get_prev"}, 84{ERR_PACK(0,ENGINE_F_ENGINE_GET_PREV,0), "ENGINE_get_prev"},
89{ERR_FUNC(ENGINE_F_ENGINE_INIT), "ENGINE_init"}, 85{ERR_PACK(0,ENGINE_F_ENGINE_INIT,0), "ENGINE_init"},
90{ERR_FUNC(ENGINE_F_ENGINE_LIST_ADD), "ENGINE_LIST_ADD"}, 86{ERR_PACK(0,ENGINE_F_ENGINE_LIST_ADD,0), "ENGINE_LIST_ADD"},
91{ERR_FUNC(ENGINE_F_ENGINE_LIST_REMOVE), "ENGINE_LIST_REMOVE"}, 87{ERR_PACK(0,ENGINE_F_ENGINE_LIST_REMOVE,0), "ENGINE_LIST_REMOVE"},
92{ERR_FUNC(ENGINE_F_ENGINE_LOAD_PRIVATE_KEY), "ENGINE_load_private_key"}, 88{ERR_PACK(0,ENGINE_F_ENGINE_LOAD_PRIVATE_KEY,0), "ENGINE_load_private_key"},
93{ERR_FUNC(ENGINE_F_ENGINE_LOAD_PUBLIC_KEY), "ENGINE_load_public_key"}, 89{ERR_PACK(0,ENGINE_F_ENGINE_LOAD_PUBLIC_KEY,0), "ENGINE_load_public_key"},
94{ERR_FUNC(ENGINE_F_ENGINE_MODULE_INIT), "ENGINE_MODULE_INIT"}, 90{ERR_PACK(0,ENGINE_F_ENGINE_MODULE_INIT,0), "ENGINE_MODULE_INIT"},
95{ERR_FUNC(ENGINE_F_ENGINE_NEW), "ENGINE_new"}, 91{ERR_PACK(0,ENGINE_F_ENGINE_NEW,0), "ENGINE_new"},
96{ERR_FUNC(ENGINE_F_ENGINE_REMOVE), "ENGINE_remove"}, 92{ERR_PACK(0,ENGINE_F_ENGINE_REMOVE,0), "ENGINE_remove"},
97{ERR_FUNC(ENGINE_F_ENGINE_SET_DEFAULT_STRING), "ENGINE_set_default_string"}, 93{ERR_PACK(0,ENGINE_F_ENGINE_SET_DEFAULT_STRING,0), "ENGINE_set_default_string"},
98{ERR_FUNC(ENGINE_F_ENGINE_SET_DEFAULT_TYPE), "ENGINE_SET_DEFAULT_TYPE"}, 94{ERR_PACK(0,ENGINE_F_ENGINE_SET_DEFAULT_TYPE,0), "ENGINE_SET_DEFAULT_TYPE"},
99{ERR_FUNC(ENGINE_F_ENGINE_SET_ID), "ENGINE_set_id"}, 95{ERR_PACK(0,ENGINE_F_ENGINE_SET_ID,0), "ENGINE_set_id"},
100{ERR_FUNC(ENGINE_F_ENGINE_SET_NAME), "ENGINE_set_name"}, 96{ERR_PACK(0,ENGINE_F_ENGINE_SET_NAME,0), "ENGINE_set_name"},
101{ERR_FUNC(ENGINE_F_ENGINE_TABLE_REGISTER), "ENGINE_TABLE_REGISTER"}, 97{ERR_PACK(0,ENGINE_F_ENGINE_TABLE_REGISTER,0), "ENGINE_TABLE_REGISTER"},
102{ERR_FUNC(ENGINE_F_ENGINE_UNLOAD_KEY), "ENGINE_UNLOAD_KEY"}, 98{ERR_PACK(0,ENGINE_F_ENGINE_UNLOAD_KEY,0), "ENGINE_UNLOAD_KEY"},
103{ERR_FUNC(ENGINE_F_ENGINE_UP_REF), "ENGINE_up_ref"}, 99{ERR_PACK(0,ENGINE_F_ENGINE_UP_REF,0), "ENGINE_up_ref"},
104{ERR_FUNC(ENGINE_F_INT_CTRL_HELPER), "INT_CTRL_HELPER"}, 100{ERR_PACK(0,ENGINE_F_INT_CTRL_HELPER,0), "INT_CTRL_HELPER"},
105{ERR_FUNC(ENGINE_F_INT_ENGINE_CONFIGURE), "INT_ENGINE_CONFIGURE"}, 101{ERR_PACK(0,ENGINE_F_INT_ENGINE_CONFIGURE,0), "INT_ENGINE_CONFIGURE"},
106{ERR_FUNC(ENGINE_F_LOG_MESSAGE), "LOG_MESSAGE"}, 102{ERR_PACK(0,ENGINE_F_LOG_MESSAGE,0), "LOG_MESSAGE"},
107{ERR_FUNC(ENGINE_F_SET_DATA_CTX), "SET_DATA_CTX"}, 103{ERR_PACK(0,ENGINE_F_SET_DATA_CTX,0), "SET_DATA_CTX"},
108{0,NULL} 104{0,NULL}
109 }; 105 };
110 106
111static ERR_STRING_DATA ENGINE_str_reasons[]= 107static ERR_STRING_DATA ENGINE_str_reasons[]=
112 { 108 {
113{ERR_REASON(ENGINE_R_ALREADY_LOADED) ,"already loaded"}, 109{ENGINE_R_ALREADY_LOADED ,"already loaded"},
114{ERR_REASON(ENGINE_R_ARGUMENT_IS_NOT_A_NUMBER),"argument is not a number"}, 110{ENGINE_R_ARGUMENT_IS_NOT_A_NUMBER ,"argument is not a number"},
115{ERR_REASON(ENGINE_R_CMD_NOT_EXECUTABLE) ,"cmd not executable"}, 111{ENGINE_R_CMD_NOT_EXECUTABLE ,"cmd not executable"},
116{ERR_REASON(ENGINE_R_COMMAND_TAKES_INPUT),"command takes input"}, 112{ENGINE_R_COMMAND_TAKES_INPUT ,"command takes input"},
117{ERR_REASON(ENGINE_R_COMMAND_TAKES_NO_INPUT),"command takes no input"}, 113{ENGINE_R_COMMAND_TAKES_NO_INPUT ,"command takes no input"},
118{ERR_REASON(ENGINE_R_CONFLICTING_ENGINE_ID),"conflicting engine id"}, 114{ENGINE_R_CONFLICTING_ENGINE_ID ,"conflicting engine id"},
119{ERR_REASON(ENGINE_R_CTRL_COMMAND_NOT_IMPLEMENTED),"ctrl command not implemented"}, 115{ENGINE_R_CTRL_COMMAND_NOT_IMPLEMENTED ,"ctrl command not implemented"},
120{ERR_REASON(ENGINE_R_DH_NOT_IMPLEMENTED) ,"dh not implemented"}, 116{ENGINE_R_DH_NOT_IMPLEMENTED ,"dh not implemented"},
121{ERR_REASON(ENGINE_R_DSA_NOT_IMPLEMENTED),"dsa not implemented"}, 117{ENGINE_R_DSA_NOT_IMPLEMENTED ,"dsa not implemented"},
122{ERR_REASON(ENGINE_R_DSO_FAILURE) ,"DSO failure"}, 118{ENGINE_R_DSO_FAILURE ,"DSO failure"},
123{ERR_REASON(ENGINE_R_DSO_NOT_FOUND) ,"dso not found"}, 119{ENGINE_R_DSO_NOT_FOUND ,"dso not found"},
124{ERR_REASON(ENGINE_R_ENGINES_SECTION_ERROR),"engines section error"}, 120{ENGINE_R_ENGINES_SECTION_ERROR ,"engines section error"},
125{ERR_REASON(ENGINE_R_ENGINE_IS_NOT_IN_LIST),"engine is not in the list"}, 121{ENGINE_R_ENGINE_IS_NOT_IN_LIST ,"engine is not in the list"},
126{ERR_REASON(ENGINE_R_ENGINE_SECTION_ERROR),"engine section error"}, 122{ENGINE_R_ENGINE_SECTION_ERROR ,"engine section error"},
127{ERR_REASON(ENGINE_R_FAILED_LOADING_PRIVATE_KEY),"failed loading private key"}, 123{ENGINE_R_FAILED_LOADING_PRIVATE_KEY ,"failed loading private key"},
128{ERR_REASON(ENGINE_R_FAILED_LOADING_PUBLIC_KEY),"failed loading public key"}, 124{ENGINE_R_FAILED_LOADING_PUBLIC_KEY ,"failed loading public key"},
129{ERR_REASON(ENGINE_R_FINISH_FAILED) ,"finish failed"}, 125{ENGINE_R_FINISH_FAILED ,"finish failed"},
130{ERR_REASON(ENGINE_R_GET_HANDLE_FAILED) ,"could not obtain hardware handle"}, 126{ENGINE_R_GET_HANDLE_FAILED ,"could not obtain hardware handle"},
131{ERR_REASON(ENGINE_R_ID_OR_NAME_MISSING) ,"'id' or 'name' missing"}, 127{ENGINE_R_ID_OR_NAME_MISSING ,"'id' or 'name' missing"},
132{ERR_REASON(ENGINE_R_INIT_FAILED) ,"init failed"}, 128{ENGINE_R_INIT_FAILED ,"init failed"},
133{ERR_REASON(ENGINE_R_INTERNAL_LIST_ERROR),"internal list error"}, 129{ENGINE_R_INTERNAL_LIST_ERROR ,"internal list error"},
134{ERR_REASON(ENGINE_R_INVALID_ARGUMENT) ,"invalid argument"}, 130{ENGINE_R_INVALID_ARGUMENT ,"invalid argument"},
135{ERR_REASON(ENGINE_R_INVALID_CMD_NAME) ,"invalid cmd name"}, 131{ENGINE_R_INVALID_CMD_NAME ,"invalid cmd name"},
136{ERR_REASON(ENGINE_R_INVALID_CMD_NUMBER) ,"invalid cmd number"}, 132{ENGINE_R_INVALID_CMD_NUMBER ,"invalid cmd number"},
137{ERR_REASON(ENGINE_R_INVALID_INIT_VALUE) ,"invalid init value"}, 133{ENGINE_R_INVALID_INIT_VALUE ,"invalid init value"},
138{ERR_REASON(ENGINE_R_INVALID_STRING) ,"invalid string"}, 134{ENGINE_R_INVALID_STRING ,"invalid string"},
139{ERR_REASON(ENGINE_R_NOT_INITIALISED) ,"not initialised"}, 135{ENGINE_R_NOT_INITIALISED ,"not initialised"},
140{ERR_REASON(ENGINE_R_NOT_LOADED) ,"not loaded"}, 136{ENGINE_R_NOT_LOADED ,"not loaded"},
141{ERR_REASON(ENGINE_R_NO_CONTROL_FUNCTION),"no control function"}, 137{ENGINE_R_NO_CONTROL_FUNCTION ,"no control function"},
142{ERR_REASON(ENGINE_R_NO_INDEX) ,"no index"}, 138{ENGINE_R_NO_INDEX ,"no index"},
143{ERR_REASON(ENGINE_R_NO_LOAD_FUNCTION) ,"no load function"}, 139{ENGINE_R_NO_LOAD_FUNCTION ,"no load function"},
144{ERR_REASON(ENGINE_R_NO_REFERENCE) ,"no reference"}, 140{ENGINE_R_NO_REFERENCE ,"no reference"},
145{ERR_REASON(ENGINE_R_NO_SUCH_ENGINE) ,"no such engine"}, 141{ENGINE_R_NO_SUCH_ENGINE ,"no such engine"},
146{ERR_REASON(ENGINE_R_NO_UNLOAD_FUNCTION) ,"no unload function"}, 142{ENGINE_R_NO_UNLOAD_FUNCTION ,"no unload function"},
147{ERR_REASON(ENGINE_R_PROVIDE_PARAMETERS) ,"provide parameters"}, 143{ENGINE_R_PROVIDE_PARAMETERS ,"provide parameters"},
148{ERR_REASON(ENGINE_R_RSA_NOT_IMPLEMENTED),"rsa not implemented"}, 144{ENGINE_R_RSA_NOT_IMPLEMENTED ,"rsa not implemented"},
149{ERR_REASON(ENGINE_R_UNIMPLEMENTED_CIPHER),"unimplemented cipher"}, 145{ENGINE_R_UNIMPLEMENTED_CIPHER ,"unimplemented cipher"},
150{ERR_REASON(ENGINE_R_UNIMPLEMENTED_DIGEST),"unimplemented digest"}, 146{ENGINE_R_UNIMPLEMENTED_DIGEST ,"unimplemented digest"},
151{ERR_REASON(ENGINE_R_VERSION_INCOMPATIBILITY),"version incompatibility"}, 147{ENGINE_R_VERSION_INCOMPATIBILITY ,"version incompatibility"},
152{0,NULL} 148{0,NULL}
153 }; 149 };
154 150
@@ -162,8 +158,8 @@ void ERR_load_ENGINE_strings(void)
162 { 158 {
163 init=0; 159 init=0;
164#ifndef OPENSSL_NO_ERR 160#ifndef OPENSSL_NO_ERR
165 ERR_load_strings(0,ENGINE_str_functs); 161 ERR_load_strings(ERR_LIB_ENGINE,ENGINE_str_functs);
166 ERR_load_strings(0,ENGINE_str_reasons); 162 ERR_load_strings(ERR_LIB_ENGINE,ENGINE_str_reasons);
167#endif 163#endif
168 164
169 } 165 }
diff --git a/src/lib/libcrypto/engine/enginetest.c b/src/lib/libcrypto/engine/enginetest.c
new file mode 100644
index 0000000000..c2d0297392
--- /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
62#ifdef OPENSSL_NO_ENGINE
63int main(int argc, char *argv[])
64{
65 printf("No ENGINE support\n");
66 return(0);
67}
68#else
69#include <openssl/e_os2.h>
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()
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_state(0);
280 CRYPTO_mem_leaks_fp(stderr);
281 return to_return;
282 }
283#endif
diff --git a/src/lib/libcrypto/engine/hw.ec b/src/lib/libcrypto/engine/hw.ec
new file mode 100644
index 0000000000..5481a43918
--- /dev/null
+++ b/src/lib/libcrypto/engine/hw.ec
@@ -0,0 +1,8 @@
1L AEPHK hw_aep_err.h hw_aep_err.c
2L ATALLA hw_atalla_err.h hw_atalla_err.c
3L CSWIFT hw_cswift_err.h hw_cswift_err.c
4L HWCRHK hw_ncipher_err.h hw_ncipher_err.c
5L NURON hw_nuron_err.h hw_nuron_err.c
6L SUREWARE hw_sureware_err.h hw_sureware_err.c
7L UBSEC hw_ubsec_err.h hw_ubsec_err.c
8L CCA4758 hw_4758_cca_err.h hw_4758_cca_err.c
diff --git a/src/lib/libcrypto/engine/hw_4758_cca.c b/src/lib/libcrypto/engine/hw_4758_cca.c
new file mode 100644
index 0000000000..4f5ae8a46d
--- /dev/null
+++ b/src/lib/libcrypto/engine/hw_4758_cca.c
@@ -0,0 +1,969 @@
1/* Author: Maurice Gittens <maurice@gittens.nl> */
2/* ====================================================================
3 * Copyright (c) 1999 The OpenSSL Project. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 *
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in
14 * the documentation and/or other materials provided with the
15 * distribution.
16 *
17 * 3. All advertising materials mentioning features or use of this
18 * software must display the following acknowledgment:
19 * "This product includes software developed by the OpenSSL Project
20 * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
21 *
22 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
23 * endorse or promote products derived from this software without
24 * prior written permission. For written permission, please contact
25 * licensing@OpenSSL.org.
26 *
27 * 5. Products derived from this software may not be called "OpenSSL"
28 * nor may "OpenSSL" appear in their names without prior written
29 * permission of the OpenSSL Project.
30 *
31 * 6. Redistributions of any form whatsoever must retain the following
32 * acknowledgment:
33 * "This product includes software developed by the OpenSSL Project
34 * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
35 *
36 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
37 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
38 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
39 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
40 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
41 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
42 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
43 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
44 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
45 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
46 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
47 * OF THE POSSIBILITY OF SUCH DAMAGE.
48 * ====================================================================
49 *
50 * This product includes cryptographic software written by Eric Young
51 * (eay@cryptsoft.com). This product includes software written by Tim
52 * Hudson (tjh@cryptsoft.com).
53 *
54 */
55
56#include <stdio.h>
57#include <openssl/crypto.h>
58/* #include <openssl/pem.h> */
59#include "cryptlib.h"
60#include <openssl/dso.h>
61#include <openssl/x509.h>
62#include <openssl/objects.h>
63#include <openssl/engine.h>
64
65#ifndef OPENSSL_NO_HW
66#ifndef OPENSSL_NO_HW_4758_CCA
67
68#ifdef FLAT_INC
69#include "hw_4758_cca.h"
70#else
71#include "vendor_defns/hw_4758_cca.h"
72#endif
73
74#include "hw_4758_cca_err.c"
75
76static int ibm_4758_cca_destroy(ENGINE *e);
77static int ibm_4758_cca_init(ENGINE *e);
78static int ibm_4758_cca_finish(ENGINE *e);
79static int ibm_4758_cca_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f)());
80
81/* rsa functions */
82/*---------------*/
83#ifndef OPENSSL_NO_RSA
84static int cca_rsa_pub_enc(int flen, const unsigned char *from,
85 unsigned char *to, RSA *rsa,int padding);
86static int cca_rsa_priv_dec(int flen, const unsigned char *from,
87 unsigned char *to, RSA *rsa,int padding);
88static int cca_rsa_sign(int type, const unsigned char *m, unsigned int m_len,
89 unsigned char *sigret, unsigned int *siglen, const RSA *rsa);
90static int cca_rsa_verify(int dtype, const unsigned char *m, unsigned int m_len,
91 unsigned char *sigbuf, unsigned int siglen, const RSA *rsa);
92
93/* utility functions */
94/*-----------------------*/
95static EVP_PKEY *ibm_4758_load_privkey(ENGINE*, const char*,
96 UI_METHOD *ui_method, void *callback_data);
97static EVP_PKEY *ibm_4758_load_pubkey(ENGINE*, const char*,
98 UI_METHOD *ui_method, void *callback_data);
99
100static int getModulusAndExponent(const unsigned char *token, long *exponentLength,
101 unsigned char *exponent, long *modulusLength,
102 long *modulusFieldLength, unsigned char *modulus);
103#endif
104
105/* RAND number functions */
106/*-----------------------*/
107static int cca_get_random_bytes(unsigned char*, int );
108static int cca_random_status(void);
109
110static void cca_ex_free(void *obj, void *item, CRYPTO_EX_DATA *ad,
111 int idx,long argl, void *argp);
112
113/* Function pointers for CCA verbs */
114/*---------------------------------*/
115#ifndef OPENSSL_NO_RSA
116static F_KEYRECORDREAD keyRecordRead;
117static F_DIGITALSIGNATUREGENERATE digitalSignatureGenerate;
118static F_DIGITALSIGNATUREVERIFY digitalSignatureVerify;
119static F_PUBLICKEYEXTRACT publicKeyExtract;
120static F_PKAENCRYPT pkaEncrypt;
121static F_PKADECRYPT pkaDecrypt;
122#endif
123static F_RANDOMNUMBERGENERATE randomNumberGenerate;
124
125/* static variables */
126/*------------------*/
127static const char *CCA4758_LIB_NAME = NULL;
128static const char *get_CCA4758_LIB_NAME(void)
129 {
130 if(CCA4758_LIB_NAME)
131 return CCA4758_LIB_NAME;
132 return CCA_LIB_NAME;
133 }
134static void free_CCA4758_LIB_NAME(void)
135 {
136 if(CCA4758_LIB_NAME)
137 OPENSSL_free((void*)CCA4758_LIB_NAME);
138 CCA4758_LIB_NAME = NULL;
139 }
140static long set_CCA4758_LIB_NAME(const char *name)
141 {
142 free_CCA4758_LIB_NAME();
143 return (((CCA4758_LIB_NAME = BUF_strdup(name)) != NULL) ? 1 : 0);
144 }
145#ifndef OPENSSL_NO_RSA
146static const char* n_keyRecordRead = CSNDKRR;
147static const char* n_digitalSignatureGenerate = CSNDDSG;
148static const char* n_digitalSignatureVerify = CSNDDSV;
149static const char* n_publicKeyExtract = CSNDPKX;
150static const char* n_pkaEncrypt = CSNDPKE;
151static const char* n_pkaDecrypt = CSNDPKD;
152#endif
153static const char* n_randomNumberGenerate = CSNBRNG;
154
155static int hndidx = -1;
156static DSO *dso = NULL;
157
158/* openssl engine initialization structures */
159/*------------------------------------------*/
160
161#define CCA4758_CMD_SO_PATH ENGINE_CMD_BASE
162static const ENGINE_CMD_DEFN cca4758_cmd_defns[] = {
163 {CCA4758_CMD_SO_PATH,
164 "SO_PATH",
165 "Specifies the path to the '4758cca' shared library",
166 ENGINE_CMD_FLAG_STRING},
167 {0, NULL, NULL, 0}
168 };
169
170#ifndef OPENSSL_NO_RSA
171static RSA_METHOD ibm_4758_cca_rsa =
172 {
173 "IBM 4758 CCA RSA method",
174 cca_rsa_pub_enc,
175 NULL,
176 NULL,
177 cca_rsa_priv_dec,
178 NULL, /*rsa_mod_exp,*/
179 NULL, /*mod_exp_mont,*/
180 NULL, /* init */
181 NULL, /* finish */
182 RSA_FLAG_SIGN_VER, /* flags */
183 NULL, /* app_data */
184 cca_rsa_sign, /* rsa_sign */
185 cca_rsa_verify /* rsa_verify */
186 };
187#endif
188
189static RAND_METHOD ibm_4758_cca_rand =
190 {
191 /* "IBM 4758 RAND method", */
192 NULL, /* seed */
193 cca_get_random_bytes, /* get random bytes from the card */
194 NULL, /* cleanup */
195 NULL, /* add */
196 cca_get_random_bytes, /* pseudo rand */
197 cca_random_status, /* status */
198 };
199
200static const char *engine_4758_cca_id = "4758cca";
201static const char *engine_4758_cca_name = "IBM 4758 CCA hardware engine support";
202
203/* engine implementation */
204/*-----------------------*/
205static int bind_helper(ENGINE *e)
206 {
207 if(!ENGINE_set_id(e, engine_4758_cca_id) ||
208 !ENGINE_set_name(e, engine_4758_cca_name) ||
209#ifndef OPENSSL_NO_RSA
210 !ENGINE_set_RSA(e, &ibm_4758_cca_rsa) ||
211#endif
212 !ENGINE_set_RAND(e, &ibm_4758_cca_rand) ||
213 !ENGINE_set_destroy_function(e, ibm_4758_cca_destroy) ||
214 !ENGINE_set_init_function(e, ibm_4758_cca_init) ||
215 !ENGINE_set_finish_function(e, ibm_4758_cca_finish) ||
216 !ENGINE_set_ctrl_function(e, ibm_4758_cca_ctrl) ||
217 !ENGINE_set_load_privkey_function(e, ibm_4758_load_privkey) ||
218 !ENGINE_set_load_pubkey_function(e, ibm_4758_load_pubkey) ||
219 !ENGINE_set_cmd_defns(e, cca4758_cmd_defns))
220 return 0;
221 /* Ensure the error handling is set up */
222 ERR_load_CCA4758_strings();
223 return 1;
224 }
225
226#ifndef ENGINE_DYNAMIC_SUPPORT
227static ENGINE *engine_4758_cca(void)
228 {
229 ENGINE *ret = ENGINE_new();
230 if(!ret)
231 return NULL;
232 if(!bind_helper(ret))
233 {
234 ENGINE_free(ret);
235 return NULL;
236 }
237 return ret;
238 }
239
240void ENGINE_load_4758cca(void)
241 {
242 ENGINE *e_4758 = engine_4758_cca();
243 if (!e_4758) return;
244 ENGINE_add(e_4758);
245 ENGINE_free(e_4758);
246 ERR_clear_error();
247 }
248#endif
249
250static int ibm_4758_cca_destroy(ENGINE *e)
251 {
252 ERR_unload_CCA4758_strings();
253 free_CCA4758_LIB_NAME();
254 return 1;
255 }
256
257static int ibm_4758_cca_init(ENGINE *e)
258 {
259 if(dso)
260 {
261 CCA4758err(CCA4758_F_IBM_4758_CCA_INIT,CCA4758_R_ALREADY_LOADED);
262 goto err;
263 }
264
265 dso = DSO_load(NULL, get_CCA4758_LIB_NAME(), NULL, 0);
266 if(!dso)
267 {
268 CCA4758err(CCA4758_F_IBM_4758_CCA_INIT,CCA4758_R_DSO_FAILURE);
269 goto err;
270 }
271
272#ifndef OPENSSL_NO_RSA
273 if(!(keyRecordRead = (F_KEYRECORDREAD)
274 DSO_bind_func(dso, n_keyRecordRead)) ||
275 !(randomNumberGenerate = (F_RANDOMNUMBERGENERATE)
276 DSO_bind_func(dso, n_randomNumberGenerate)) ||
277 !(digitalSignatureGenerate = (F_DIGITALSIGNATUREGENERATE)
278 DSO_bind_func(dso, n_digitalSignatureGenerate)) ||
279 !(digitalSignatureVerify = (F_DIGITALSIGNATUREVERIFY)
280 DSO_bind_func(dso, n_digitalSignatureVerify)) ||
281 !(publicKeyExtract = (F_PUBLICKEYEXTRACT)
282 DSO_bind_func(dso, n_publicKeyExtract)) ||
283 !(pkaEncrypt = (F_PKAENCRYPT)
284 DSO_bind_func(dso, n_pkaEncrypt)) ||
285 !(pkaDecrypt = (F_PKADECRYPT)
286 DSO_bind_func(dso, n_pkaDecrypt)))
287 {
288 CCA4758err(CCA4758_F_IBM_4758_CCA_INIT,CCA4758_R_DSO_FAILURE);
289 goto err;
290 }
291#else
292 if(!(randomNumberGenerate = (F_RANDOMNUMBERGENERATE)
293 DSO_bind_func(dso, n_randomNumberGenerate)))
294 {
295 CCA4758err(CCA4758_F_IBM_4758_CCA_INIT,CCA4758_R_DSO_FAILURE);
296 goto err;
297 }
298#endif
299
300 hndidx = RSA_get_ex_new_index(0, "IBM 4758 CCA RSA key handle",
301 NULL, NULL, cca_ex_free);
302
303 return 1;
304err:
305 if(dso)
306 DSO_free(dso);
307 dso = NULL;
308
309 keyRecordRead = (F_KEYRECORDREAD)0;
310 randomNumberGenerate = (F_RANDOMNUMBERGENERATE)0;
311 digitalSignatureGenerate = (F_DIGITALSIGNATUREGENERATE)0;
312 digitalSignatureVerify = (F_DIGITALSIGNATUREVERIFY)0;
313 publicKeyExtract = (F_PUBLICKEYEXTRACT)0;
314 pkaEncrypt = (F_PKAENCRYPT)0;
315 pkaDecrypt = (F_PKADECRYPT)0;
316 return 0;
317 }
318
319static int ibm_4758_cca_finish(ENGINE *e)
320 {
321 free_CCA4758_LIB_NAME();
322 if(!dso)
323 {
324 CCA4758err(CCA4758_F_IBM_4758_CCA_FINISH,
325 CCA4758_R_NOT_LOADED);
326 return 0;
327 }
328 if(!DSO_free(dso))
329 {
330 CCA4758err(CCA4758_F_IBM_4758_CCA_FINISH,
331 CCA4758_R_UNIT_FAILURE);
332 return 0;
333 }
334 dso = NULL;
335 keyRecordRead = (F_KEYRECORDREAD)0;
336 randomNumberGenerate = (F_RANDOMNUMBERGENERATE)0;
337 digitalSignatureGenerate = (F_DIGITALSIGNATUREGENERATE)0;
338 digitalSignatureVerify = (F_DIGITALSIGNATUREVERIFY)0;
339 publicKeyExtract = (F_PUBLICKEYEXTRACT)0;
340 pkaEncrypt = (F_PKAENCRYPT)0;
341 pkaDecrypt = (F_PKADECRYPT)0;
342 return 1;
343 }
344
345static int ibm_4758_cca_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f)())
346 {
347 int initialised = ((dso == NULL) ? 0 : 1);
348 switch(cmd)
349 {
350 case CCA4758_CMD_SO_PATH:
351 if(p == NULL)
352 {
353 CCA4758err(CCA4758_F_IBM_4758_CCA_CTRL,
354 ERR_R_PASSED_NULL_PARAMETER);
355 return 0;
356 }
357 if(initialised)
358 {
359 CCA4758err(CCA4758_F_IBM_4758_CCA_CTRL,
360 CCA4758_R_ALREADY_LOADED);
361 return 0;
362 }
363 return set_CCA4758_LIB_NAME((const char *)p);
364 default:
365 break;
366 }
367 CCA4758err(CCA4758_F_IBM_4758_CCA_CTRL,
368 CCA4758_R_COMMAND_NOT_IMPLEMENTED);
369 return 0;
370 }
371
372#ifndef OPENSSL_NO_RSA
373
374#define MAX_CCA_PKA_TOKEN_SIZE 2500
375
376static EVP_PKEY *ibm_4758_load_privkey(ENGINE* e, const char* key_id,
377 UI_METHOD *ui_method, void *callback_data)
378 {
379 RSA *rtmp = NULL;
380 EVP_PKEY *res = NULL;
381 unsigned char* keyToken = NULL;
382 unsigned char pubKeyToken[MAX_CCA_PKA_TOKEN_SIZE];
383 long pubKeyTokenLength = MAX_CCA_PKA_TOKEN_SIZE;
384 long keyTokenLength = MAX_CCA_PKA_TOKEN_SIZE;
385 long returnCode;
386 long reasonCode;
387 long exitDataLength = 0;
388 long ruleArrayLength = 0;
389 unsigned char exitData[8];
390 unsigned char ruleArray[8];
391 unsigned char keyLabel[64];
392 long keyLabelLength = strlen(key_id);
393 unsigned char modulus[256];
394 long modulusFieldLength = sizeof(modulus);
395 long modulusLength = 0;
396 unsigned char exponent[256];
397 long exponentLength = sizeof(exponent);
398
399 if (keyLabelLength > sizeof(keyLabel))
400 {
401 CCA4758err(CCA4758_F_IBM_4758_CCA_LOAD_PRIVKEY,
402 CCA4758_R_SIZE_TOO_LARGE_OR_TOO_SMALL);
403 return NULL;
404 }
405
406 memset(keyLabel,' ', sizeof(keyLabel));
407 memcpy(keyLabel, key_id, keyLabelLength);
408
409 keyToken = OPENSSL_malloc(MAX_CCA_PKA_TOKEN_SIZE + sizeof(long));
410 if (!keyToken)
411 {
412 CCA4758err(CCA4758_F_IBM_4758_CCA_LOAD_PRIVKEY,
413 ERR_R_MALLOC_FAILURE);
414 goto err;
415 }
416
417 keyRecordRead(&returnCode, &reasonCode, &exitDataLength,
418 exitData, &ruleArrayLength, ruleArray, keyLabel,
419 &keyTokenLength, keyToken+sizeof(long));
420
421 if (returnCode)
422 {
423 CCA4758err(CCA4758_F_IBM_4758_CCA_LOAD_PRIVKEY,
424 CCA4758_R_FAILED_LOADING_PRIVATE_KEY);
425 goto err;
426 }
427
428 publicKeyExtract(&returnCode, &reasonCode, &exitDataLength,
429 exitData, &ruleArrayLength, ruleArray, &keyTokenLength,
430 keyToken+sizeof(long), &pubKeyTokenLength, pubKeyToken);
431
432 if (returnCode)
433 {
434 CCA4758err(CCA4758_F_IBM_4758_CCA_LOAD_PRIVKEY,
435 CCA4758_R_FAILED_LOADING_PRIVATE_KEY);
436 goto err;
437 }
438
439 if (!getModulusAndExponent(pubKeyToken, &exponentLength,
440 exponent, &modulusLength, &modulusFieldLength,
441 modulus))
442 {
443 CCA4758err(CCA4758_F_IBM_4758_CCA_LOAD_PRIVKEY,
444 CCA4758_R_FAILED_LOADING_PRIVATE_KEY);
445 goto err;
446 }
447
448 (*(long*)keyToken) = keyTokenLength;
449 rtmp = RSA_new_method(e);
450 RSA_set_ex_data(rtmp, hndidx, (char *)keyToken);
451
452 rtmp->e = BN_bin2bn(exponent, exponentLength, NULL);
453 rtmp->n = BN_bin2bn(modulus, modulusFieldLength, NULL);
454 rtmp->flags |= RSA_FLAG_EXT_PKEY;
455
456 res = EVP_PKEY_new();
457 EVP_PKEY_assign_RSA(res, rtmp);
458
459 return res;
460err:
461 if (keyToken)
462 OPENSSL_free(keyToken);
463 if (res)
464 EVP_PKEY_free(res);
465 if (rtmp)
466 RSA_free(rtmp);
467 return NULL;
468 }
469
470static EVP_PKEY *ibm_4758_load_pubkey(ENGINE* e, const char* key_id,
471 UI_METHOD *ui_method, void *callback_data)
472 {
473 RSA *rtmp = NULL;
474 EVP_PKEY *res = NULL;
475 unsigned char* keyToken = NULL;
476 long keyTokenLength = MAX_CCA_PKA_TOKEN_SIZE;
477 long returnCode;
478 long reasonCode;
479 long exitDataLength = 0;
480 long ruleArrayLength = 0;
481 unsigned char exitData[8];
482 unsigned char ruleArray[8];
483 unsigned char keyLabel[64];
484 long keyLabelLength = strlen(key_id);
485 unsigned char modulus[512];
486 long modulusFieldLength = sizeof(modulus);
487 long modulusLength = 0;
488 unsigned char exponent[512];
489 long exponentLength = sizeof(exponent);
490
491 if (keyLabelLength > sizeof(keyLabel))
492 {
493 CCA4758err(CCA4758_F_IBM_4758_CCA_LOAD_PRIVKEY,
494 CCA4758_R_SIZE_TOO_LARGE_OR_TOO_SMALL);
495 return NULL;
496 }
497
498 memset(keyLabel,' ', sizeof(keyLabel));
499 memcpy(keyLabel, key_id, keyLabelLength);
500
501 keyToken = OPENSSL_malloc(MAX_CCA_PKA_TOKEN_SIZE + sizeof(long));
502 if (!keyToken)
503 {
504 CCA4758err(CCA4758_F_IBM_4758_CCA_LOAD_PUBKEY,
505 ERR_R_MALLOC_FAILURE);
506 goto err;
507 }
508
509 keyRecordRead(&returnCode, &reasonCode, &exitDataLength, exitData,
510 &ruleArrayLength, ruleArray, keyLabel, &keyTokenLength,
511 keyToken+sizeof(long));
512
513 if (returnCode)
514 {
515 CCA4758err(CCA4758_F_IBM_4758_CCA_LOAD_PRIVKEY,
516 ERR_R_MALLOC_FAILURE);
517 goto err;
518 }
519
520 if (!getModulusAndExponent(keyToken+sizeof(long), &exponentLength,
521 exponent, &modulusLength, &modulusFieldLength, modulus))
522 {
523 CCA4758err(CCA4758_F_IBM_4758_CCA_LOAD_PRIVKEY,
524 CCA4758_R_FAILED_LOADING_PUBLIC_KEY);
525 goto err;
526 }
527
528 (*(long*)keyToken) = keyTokenLength;
529 rtmp = RSA_new_method(e);
530 RSA_set_ex_data(rtmp, hndidx, (char *)keyToken);
531 rtmp->e = BN_bin2bn(exponent, exponentLength, NULL);
532 rtmp->n = BN_bin2bn(modulus, modulusFieldLength, NULL);
533 rtmp->flags |= RSA_FLAG_EXT_PKEY;
534 res = EVP_PKEY_new();
535 EVP_PKEY_assign_RSA(res, rtmp);
536
537 return res;
538err:
539 if (keyToken)
540 OPENSSL_free(keyToken);
541 if (res)
542 EVP_PKEY_free(res);
543 if (rtmp)
544 RSA_free(rtmp);
545 return NULL;
546 }
547
548static int cca_rsa_pub_enc(int flen, const unsigned char *from,
549 unsigned char *to, RSA *rsa,int padding)
550 {
551 long returnCode;
552 long reasonCode;
553 long lflen = flen;
554 long exitDataLength = 0;
555 unsigned char exitData[8];
556 long ruleArrayLength = 1;
557 unsigned char ruleArray[8] = "PKCS-1.2";
558 long dataStructureLength = 0;
559 unsigned char dataStructure[8];
560 long outputLength = RSA_size(rsa);
561 long keyTokenLength;
562 unsigned char* keyToken = (unsigned char*)RSA_get_ex_data(rsa, hndidx);
563
564 keyTokenLength = *(long*)keyToken;
565 keyToken+=sizeof(long);
566
567 pkaEncrypt(&returnCode, &reasonCode, &exitDataLength, exitData,
568 &ruleArrayLength, ruleArray, &lflen, (unsigned char*)from,
569 &dataStructureLength, dataStructure, &keyTokenLength,
570 keyToken, &outputLength, to);
571
572 if (returnCode || reasonCode)
573 return -(returnCode << 16 | reasonCode);
574 return outputLength;
575 }
576
577static int cca_rsa_priv_dec(int flen, const unsigned char *from,
578 unsigned char *to, RSA *rsa,int padding)
579 {
580 long returnCode;
581 long reasonCode;
582 long lflen = flen;
583 long exitDataLength = 0;
584 unsigned char exitData[8];
585 long ruleArrayLength = 1;
586 unsigned char ruleArray[8] = "PKCS-1.2";
587 long dataStructureLength = 0;
588 unsigned char dataStructure[8];
589 long outputLength = RSA_size(rsa);
590 long keyTokenLength;
591 unsigned char* keyToken = (unsigned char*)RSA_get_ex_data(rsa, hndidx);
592
593 keyTokenLength = *(long*)keyToken;
594 keyToken+=sizeof(long);
595
596 pkaDecrypt(&returnCode, &reasonCode, &exitDataLength, exitData,
597 &ruleArrayLength, ruleArray, &lflen, (unsigned char*)from,
598 &dataStructureLength, dataStructure, &keyTokenLength,
599 keyToken, &outputLength, to);
600
601 return (returnCode | reasonCode) ? 0 : 1;
602 }
603
604#define SSL_SIG_LEN 36
605
606static int cca_rsa_verify(int type, const unsigned char *m, unsigned int m_len,
607 unsigned char *sigbuf, unsigned int siglen, const RSA *rsa)
608 {
609 long returnCode;
610 long reasonCode;
611 long lsiglen = siglen;
612 long exitDataLength = 0;
613 unsigned char exitData[8];
614 long ruleArrayLength = 1;
615 unsigned char ruleArray[8] = "PKCS-1.1";
616 long keyTokenLength;
617 unsigned char* keyToken = (unsigned char*)RSA_get_ex_data(rsa, hndidx);
618 long length = SSL_SIG_LEN;
619 long keyLength ;
620 unsigned char *hashBuffer = NULL;
621 X509_SIG sig;
622 ASN1_TYPE parameter;
623 X509_ALGOR algorithm;
624 ASN1_OCTET_STRING digest;
625
626 keyTokenLength = *(long*)keyToken;
627 keyToken+=sizeof(long);
628
629 if (type == NID_md5 || type == NID_sha1)
630 {
631 sig.algor = &algorithm;
632 algorithm.algorithm = OBJ_nid2obj(type);
633
634 if (!algorithm.algorithm)
635 {
636 CCA4758err(CCA4758_F_IBM_4758_CCA_VERIFY,
637 CCA4758_R_UNKNOWN_ALGORITHM_TYPE);
638 return 0;
639 }
640
641 if (!algorithm.algorithm->length)
642 {
643 CCA4758err(CCA4758_F_IBM_4758_CCA_VERIFY,
644 CCA4758_R_ASN1_OID_UNKNOWN_FOR_MD);
645 return 0;
646 }
647
648 parameter.type = V_ASN1_NULL;
649 parameter.value.ptr = NULL;
650 algorithm.parameter = &parameter;
651
652 sig.digest = &digest;
653 sig.digest->data = (unsigned char*)m;
654 sig.digest->length = m_len;
655
656 length = i2d_X509_SIG(&sig, NULL);
657 }
658
659 keyLength = RSA_size(rsa);
660
661 if (length - RSA_PKCS1_PADDING > keyLength)
662 {
663 CCA4758err(CCA4758_F_IBM_4758_CCA_VERIFY,
664 CCA4758_R_SIZE_TOO_LARGE_OR_TOO_SMALL);
665 return 0;
666 }
667
668 switch (type)
669 {
670 case NID_md5_sha1 :
671 if (m_len != SSL_SIG_LEN)
672 {
673 CCA4758err(CCA4758_F_IBM_4758_CCA_VERIFY,
674 CCA4758_R_SIZE_TOO_LARGE_OR_TOO_SMALL);
675 return 0;
676 }
677
678 hashBuffer = (unsigned char *)m;
679 length = m_len;
680 break;
681 case NID_md5 :
682 {
683 unsigned char *ptr;
684 ptr = hashBuffer = OPENSSL_malloc(
685 (unsigned int)keyLength+1);
686 if (!hashBuffer)
687 {
688 CCA4758err(CCA4758_F_IBM_4758_CCA_VERIFY,
689 ERR_R_MALLOC_FAILURE);
690 return 0;
691 }
692
693 i2d_X509_SIG(&sig, &ptr);
694 }
695 break;
696 case NID_sha1 :
697 {
698 unsigned char *ptr;
699 ptr = hashBuffer = OPENSSL_malloc(
700 (unsigned int)keyLength+1);
701 if (!hashBuffer)
702 {
703 CCA4758err(CCA4758_F_IBM_4758_CCA_VERIFY,
704 ERR_R_MALLOC_FAILURE);
705 return 0;
706 }
707 i2d_X509_SIG(&sig, &ptr);
708 }
709 break;
710 default:
711 return 0;
712 }
713
714 digitalSignatureVerify(&returnCode, &reasonCode, &exitDataLength,
715 exitData, &ruleArrayLength, ruleArray, &keyTokenLength,
716 keyToken, &length, hashBuffer, &lsiglen, sigbuf);
717
718 if (type == NID_sha1 || type == NID_md5)
719 {
720 OPENSSL_cleanse(hashBuffer, keyLength+1);
721 OPENSSL_free(hashBuffer);
722 }
723
724 return ((returnCode || reasonCode) ? 0 : 1);
725 }
726
727#define SSL_SIG_LEN 36
728
729static int cca_rsa_sign(int type, const unsigned char *m, unsigned int m_len,
730 unsigned char *sigret, unsigned int *siglen, const RSA *rsa)
731 {
732 long returnCode;
733 long reasonCode;
734 long exitDataLength = 0;
735 unsigned char exitData[8];
736 long ruleArrayLength = 1;
737 unsigned char ruleArray[8] = "PKCS-1.1";
738 long outputLength=256;
739 long outputBitLength;
740 long keyTokenLength;
741 unsigned char *hashBuffer = NULL;
742 unsigned char* keyToken = (unsigned char*)RSA_get_ex_data(rsa, hndidx);
743 long length = SSL_SIG_LEN;
744 long keyLength ;
745 X509_SIG sig;
746 ASN1_TYPE parameter;
747 X509_ALGOR algorithm;
748 ASN1_OCTET_STRING digest;
749
750 keyTokenLength = *(long*)keyToken;
751 keyToken+=sizeof(long);
752
753 if (type == NID_md5 || type == NID_sha1)
754 {
755 sig.algor = &algorithm;
756 algorithm.algorithm = OBJ_nid2obj(type);
757
758 if (!algorithm.algorithm)
759 {
760 CCA4758err(CCA4758_F_IBM_4758_CCA_SIGN,
761 CCA4758_R_UNKNOWN_ALGORITHM_TYPE);
762 return 0;
763 }
764
765 if (!algorithm.algorithm->length)
766 {
767 CCA4758err(CCA4758_F_IBM_4758_CCA_SIGN,
768 CCA4758_R_ASN1_OID_UNKNOWN_FOR_MD);
769 return 0;
770 }
771
772 parameter.type = V_ASN1_NULL;
773 parameter.value.ptr = NULL;
774 algorithm.parameter = &parameter;
775
776 sig.digest = &digest;
777 sig.digest->data = (unsigned char*)m;
778 sig.digest->length = m_len;
779
780 length = i2d_X509_SIG(&sig, NULL);
781 }
782
783 keyLength = RSA_size(rsa);
784
785 if (length - RSA_PKCS1_PADDING > keyLength)
786 {
787 CCA4758err(CCA4758_F_IBM_4758_CCA_SIGN,
788 CCA4758_R_SIZE_TOO_LARGE_OR_TOO_SMALL);
789 return 0;
790 }
791
792 switch (type)
793 {
794 case NID_md5_sha1 :
795 if (m_len != SSL_SIG_LEN)
796 {
797 CCA4758err(CCA4758_F_IBM_4758_CCA_SIGN,
798 CCA4758_R_SIZE_TOO_LARGE_OR_TOO_SMALL);
799 return 0;
800 }
801 hashBuffer = (unsigned char*)m;
802 length = m_len;
803 break;
804 case NID_md5 :
805 {
806 unsigned char *ptr;
807 ptr = hashBuffer = OPENSSL_malloc(
808 (unsigned int)keyLength+1);
809 if (!hashBuffer)
810 {
811 CCA4758err(CCA4758_F_IBM_4758_CCA_VERIFY,
812 ERR_R_MALLOC_FAILURE);
813 return 0;
814 }
815 i2d_X509_SIG(&sig, &ptr);
816 }
817 break;
818 case NID_sha1 :
819 {
820 unsigned char *ptr;
821 ptr = hashBuffer = OPENSSL_malloc(
822 (unsigned int)keyLength+1);
823 if (!hashBuffer)
824 {
825 CCA4758err(CCA4758_F_IBM_4758_CCA_VERIFY,
826 ERR_R_MALLOC_FAILURE);
827 return 0;
828 }
829 i2d_X509_SIG(&sig, &ptr);
830 }
831 break;
832 default:
833 return 0;
834 }
835
836 digitalSignatureGenerate(&returnCode, &reasonCode, &exitDataLength,
837 exitData, &ruleArrayLength, ruleArray, &keyTokenLength,
838 keyToken, &length, hashBuffer, &outputLength, &outputBitLength,
839 sigret);
840
841 if (type == NID_sha1 || type == NID_md5)
842 {
843 OPENSSL_cleanse(hashBuffer, keyLength+1);
844 OPENSSL_free(hashBuffer);
845 }
846
847 *siglen = outputLength;
848
849 return ((returnCode || reasonCode) ? 0 : 1);
850 }
851
852static int getModulusAndExponent(const unsigned char*token, long *exponentLength,
853 unsigned char *exponent, long *modulusLength, long *modulusFieldLength,
854 unsigned char *modulus)
855 {
856 unsigned long len;
857
858 if (*token++ != (char)0x1E) /* internal PKA token? */
859 return 0;
860
861 if (*token++) /* token version must be zero */
862 return 0;
863
864 len = *token++;
865 len = len << 8;
866 len |= (unsigned char)*token++;
867
868 token += 4; /* skip reserved bytes */
869
870 if (*token++ == (char)0x04)
871 {
872 if (*token++) /* token version must be zero */
873 return 0;
874
875 len = *token++;
876 len = len << 8;
877 len |= (unsigned char)*token++;
878
879 token+=2; /* skip reserved section */
880
881 len = *token++;
882 len = len << 8;
883 len |= (unsigned char)*token++;
884
885 *exponentLength = len;
886
887 len = *token++;
888 len = len << 8;
889 len |= (unsigned char)*token++;
890
891 *modulusLength = len;
892
893 len = *token++;
894 len = len << 8;
895 len |= (unsigned char)*token++;
896
897 *modulusFieldLength = len;
898
899 memcpy(exponent, token, *exponentLength);
900 token+= *exponentLength;
901
902 memcpy(modulus, token, *modulusFieldLength);
903 return 1;
904 }
905 return 0;
906 }
907
908#endif /* OPENSSL_NO_RSA */
909
910static int cca_random_status(void)
911 {
912 return 1;
913 }
914
915static int cca_get_random_bytes(unsigned char* buf, int num)
916 {
917 long ret_code;
918 long reason_code;
919 long exit_data_length;
920 unsigned char exit_data[4];
921 unsigned char form[] = "RANDOM ";
922 unsigned char rand_buf[8];
923
924 while(num >= sizeof(rand_buf))
925 {
926 randomNumberGenerate(&ret_code, &reason_code, &exit_data_length,
927 exit_data, form, rand_buf);
928 if (ret_code)
929 return 0;
930 num -= sizeof(rand_buf);
931 memcpy(buf, rand_buf, sizeof(rand_buf));
932 buf += sizeof(rand_buf);
933 }
934
935 if (num)
936 {
937 randomNumberGenerate(&ret_code, &reason_code, NULL, NULL,
938 form, rand_buf);
939 if (ret_code)
940 return 0;
941 memcpy(buf, rand_buf, num);
942 }
943
944 return 1;
945 }
946
947static void cca_ex_free(void *obj, void *item, CRYPTO_EX_DATA *ad, int idx,
948 long argl, void *argp)
949 {
950 if (item)
951 OPENSSL_free(item);
952 }
953
954/* Goo to handle building as a dynamic engine */
955#ifdef ENGINE_DYNAMIC_SUPPORT
956static int bind_fn(ENGINE *e, const char *id)
957 {
958 if(id && (strcmp(id, engine_4758_cca_id) != 0))
959 return 0;
960 if(!bind_helper(e))
961 return 0;
962 return 1;
963 }
964IMPLEMENT_DYNAMIC_CHECK_FN()
965IMPLEMENT_DYNAMIC_BIND_FN(bind_fn)
966#endif /* ENGINE_DYNAMIC_SUPPORT */
967
968#endif /* !OPENSSL_NO_HW_4758_CCA */
969#endif /* !OPENSSL_NO_HW */
diff --git a/src/lib/libcrypto/engine/hw_4758_cca_err.c b/src/lib/libcrypto/engine/hw_4758_cca_err.c
new file mode 100644
index 0000000000..7ea5c63707
--- /dev/null
+++ b/src/lib/libcrypto/engine/hw_4758_cca_err.c
@@ -0,0 +1,149 @@
1/* hw_4758_cca_err.c */
2/* ====================================================================
3 * Copyright (c) 1999-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/* 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 "hw_4758_cca_err.h"
64
65/* BEGIN ERROR CODES */
66#ifndef OPENSSL_NO_ERR
67static ERR_STRING_DATA CCA4758_str_functs[]=
68 {
69{ERR_PACK(0,CCA4758_F_IBM_4758_CCA_CTRL,0), "IBM_4758_CCA_CTRL"},
70{ERR_PACK(0,CCA4758_F_IBM_4758_CCA_FINISH,0), "IBM_4758_CCA_FINISH"},
71{ERR_PACK(0,CCA4758_F_IBM_4758_CCA_INIT,0), "IBM_4758_CCA_INIT"},
72{ERR_PACK(0,CCA4758_F_IBM_4758_CCA_LOAD_PRIVKEY,0), "IBM_4758_CCA_LOAD_PRIVKEY"},
73{ERR_PACK(0,CCA4758_F_IBM_4758_CCA_LOAD_PUBKEY,0), "IBM_4758_CCA_LOAD_PUBKEY"},
74{ERR_PACK(0,CCA4758_F_IBM_4758_CCA_SIGN,0), "IBM_4758_CCA_SIGN"},
75{ERR_PACK(0,CCA4758_F_IBM_4758_CCA_VERIFY,0), "IBM_4758_CCA_VERIFY"},
76{0,NULL}
77 };
78
79static ERR_STRING_DATA CCA4758_str_reasons[]=
80 {
81{CCA4758_R_ALREADY_LOADED ,"already loaded"},
82{CCA4758_R_ASN1_OID_UNKNOWN_FOR_MD ,"asn1 oid unknown for md"},
83{CCA4758_R_COMMAND_NOT_IMPLEMENTED ,"command not implemented"},
84{CCA4758_R_DSO_FAILURE ,"dso failure"},
85{CCA4758_R_FAILED_LOADING_PRIVATE_KEY ,"failed loading private key"},
86{CCA4758_R_FAILED_LOADING_PUBLIC_KEY ,"failed loading public key"},
87{CCA4758_R_NOT_LOADED ,"not loaded"},
88{CCA4758_R_SIZE_TOO_LARGE_OR_TOO_SMALL ,"size too large or too small"},
89{CCA4758_R_UNIT_FAILURE ,"unit failure"},
90{CCA4758_R_UNKNOWN_ALGORITHM_TYPE ,"unknown algorithm type"},
91{0,NULL}
92 };
93
94#endif
95
96#ifdef CCA4758_LIB_NAME
97static ERR_STRING_DATA CCA4758_lib_name[]=
98 {
99{0 ,CCA4758_LIB_NAME},
100{0,NULL}
101 };
102#endif
103
104
105static int CCA4758_lib_error_code=0;
106static int CCA4758_error_init=1;
107
108static void ERR_load_CCA4758_strings(void)
109 {
110 if (CCA4758_lib_error_code == 0)
111 CCA4758_lib_error_code=ERR_get_next_error_library();
112
113 if (CCA4758_error_init)
114 {
115 CCA4758_error_init=0;
116#ifndef OPENSSL_NO_ERR
117 ERR_load_strings(CCA4758_lib_error_code,CCA4758_str_functs);
118 ERR_load_strings(CCA4758_lib_error_code,CCA4758_str_reasons);
119#endif
120
121#ifdef CCA4758_LIB_NAME
122 CCA4758_lib_name->error = ERR_PACK(CCA4758_lib_error_code,0,0);
123 ERR_load_strings(0,CCA4758_lib_name);
124#endif
125 }
126 }
127
128static void ERR_unload_CCA4758_strings(void)
129 {
130 if (CCA4758_error_init == 0)
131 {
132#ifndef OPENSSL_NO_ERR
133 ERR_unload_strings(CCA4758_lib_error_code,CCA4758_str_functs);
134 ERR_unload_strings(CCA4758_lib_error_code,CCA4758_str_reasons);
135#endif
136
137#ifdef CCA4758_LIB_NAME
138 ERR_unload_strings(0,CCA4758_lib_name);
139#endif
140 CCA4758_error_init=1;
141 }
142 }
143
144static void ERR_CCA4758_error(int function, int reason, char *file, int line)
145 {
146 if (CCA4758_lib_error_code == 0)
147 CCA4758_lib_error_code=ERR_get_next_error_library();
148 ERR_PUT_error(CCA4758_lib_error_code,function,reason,file,line);
149 }
diff --git a/src/lib/libcrypto/engine/hw_4758_cca_err.h b/src/lib/libcrypto/engine/hw_4758_cca_err.h
new file mode 100644
index 0000000000..2fc563ab11
--- /dev/null
+++ b/src/lib/libcrypto/engine/hw_4758_cca_err.h
@@ -0,0 +1,93 @@
1/* ====================================================================
2 * Copyright (c) 2001 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_CCA4758_ERR_H
56#define HEADER_CCA4758_ERR_H
57
58/* BEGIN ERROR CODES */
59/* The following lines are auto generated by the script mkerr.pl. Any changes
60 * made after this point may be overwritten when the script is next run.
61 */
62static void ERR_load_CCA4758_strings(void);
63static void ERR_unload_CCA4758_strings(void);
64static void ERR_CCA4758_error(int function, int reason, char *file, int line);
65#define CCA4758err(f,r) ERR_CCA4758_error((f),(r),__FILE__,__LINE__)
66
67/* Error codes for the CCA4758 functions. */
68
69/* Function codes. */
70#define CCA4758_F_IBM_4758_CCA_CTRL 100
71#define CCA4758_F_IBM_4758_CCA_FINISH 101
72#define CCA4758_F_IBM_4758_CCA_INIT 102
73#define CCA4758_F_IBM_4758_CCA_LOAD_PRIVKEY 103
74#define CCA4758_F_IBM_4758_CCA_LOAD_PUBKEY 104
75#define CCA4758_F_IBM_4758_CCA_SIGN 105
76#define CCA4758_F_IBM_4758_CCA_VERIFY 106
77
78/* Reason codes. */
79#define CCA4758_R_ALREADY_LOADED 100
80#define CCA4758_R_ASN1_OID_UNKNOWN_FOR_MD 101
81#define CCA4758_R_COMMAND_NOT_IMPLEMENTED 102
82#define CCA4758_R_DSO_FAILURE 103
83#define CCA4758_R_FAILED_LOADING_PRIVATE_KEY 104
84#define CCA4758_R_FAILED_LOADING_PUBLIC_KEY 105
85#define CCA4758_R_NOT_LOADED 106
86#define CCA4758_R_SIZE_TOO_LARGE_OR_TOO_SMALL 107
87#define CCA4758_R_UNIT_FAILURE 108
88#define CCA4758_R_UNKNOWN_ALGORITHM_TYPE 109
89
90#ifdef __cplusplus
91}
92#endif
93#endif
diff --git a/src/lib/libcrypto/engine/hw_aep.c b/src/lib/libcrypto/engine/hw_aep.c
new file mode 100644
index 0000000000..8b8380a582
--- /dev/null
+++ b/src/lib/libcrypto/engine/hw_aep.c
@@ -0,0 +1,1119 @@
1/* crypto/engine/hw_aep.c */
2/*
3 */
4/* ====================================================================
5 * Copyright (c) 1999 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 * licensing@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 <stdio.h>
59#include <openssl/bn.h>
60#include <string.h>
61
62#include <openssl/e_os2.h>
63#if !defined(OPENSSL_SYS_MSDOS) || defined(__DJGPP__)
64#include <sys/types.h>
65#include <unistd.h>
66#else
67#include <process.h>
68typedef int pid_t;
69#endif
70
71#include <openssl/crypto.h>
72#include <openssl/dso.h>
73#include <openssl/engine.h>
74#include <openssl/buffer.h>
75
76#ifndef OPENSSL_NO_HW
77#ifndef OPENSSL_NO_HW_AEP
78#ifdef FLAT_INC
79#include "aep.h"
80#else
81#include "vendor_defns/aep.h"
82#endif
83
84#define AEP_LIB_NAME "aep engine"
85#define FAIL_TO_SW 0x10101010
86
87#include "hw_aep_err.c"
88
89static int aep_init(ENGINE *e);
90static int aep_finish(ENGINE *e);
91static int aep_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f)());
92static int aep_destroy(ENGINE *e);
93
94static AEP_RV aep_get_connection(AEP_CONNECTION_HNDL_PTR hConnection);
95static AEP_RV aep_return_connection(AEP_CONNECTION_HNDL hConnection);
96static AEP_RV aep_close_connection(AEP_CONNECTION_HNDL hConnection);
97static AEP_RV aep_close_all_connections(int use_engine_lock, int *in_use);
98
99/* BIGNUM stuff */
100static int aep_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
101 const BIGNUM *m, BN_CTX *ctx);
102
103static AEP_RV aep_mod_exp_crt(BIGNUM *r,const BIGNUM *a, const BIGNUM *p,
104 const BIGNUM *q, const BIGNUM *dmp1,const BIGNUM *dmq1,
105 const BIGNUM *iqmp, BN_CTX *ctx);
106
107/* RSA stuff */
108#ifndef OPENSSL_NO_RSA
109static int aep_rsa_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa);
110#endif
111
112/* This function is aliased to mod_exp (with the mont stuff dropped). */
113static int aep_mod_exp_mont(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
114 const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx);
115
116/* DSA stuff */
117#ifndef OPENSSL_NO_DSA
118static int aep_dsa_mod_exp(DSA *dsa, BIGNUM *rr, BIGNUM *a1,
119 BIGNUM *p1, BIGNUM *a2, BIGNUM *p2, BIGNUM *m,
120 BN_CTX *ctx, BN_MONT_CTX *in_mont);
121
122static int aep_mod_exp_dsa(DSA *dsa, BIGNUM *r, BIGNUM *a,
123 const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx,
124 BN_MONT_CTX *m_ctx);
125#endif
126
127/* DH stuff */
128/* This function is aliased to mod_exp (with the DH and mont dropped). */
129#ifndef OPENSSL_NO_DH
130static int aep_mod_exp_dh(const DH *dh, BIGNUM *r, const BIGNUM *a,
131 const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx);
132#endif
133
134/* rand stuff */
135#ifdef AEPRAND
136static int aep_rand(unsigned char *buf, int num);
137static int aep_rand_status(void);
138#endif
139
140/* Bignum conversion stuff */
141static AEP_RV GetBigNumSize(AEP_VOID_PTR ArbBigNum, AEP_U32* BigNumSize);
142static AEP_RV MakeAEPBigNum(AEP_VOID_PTR ArbBigNum, AEP_U32 BigNumSize,
143 unsigned char* AEP_BigNum);
144static AEP_RV ConvertAEPBigNum(void* ArbBigNum, AEP_U32 BigNumSize,
145 unsigned char* AEP_BigNum);
146
147/* The definitions for control commands specific to this engine */
148#define AEP_CMD_SO_PATH ENGINE_CMD_BASE
149static const ENGINE_CMD_DEFN aep_cmd_defns[] =
150 {
151 { AEP_CMD_SO_PATH,
152 "SO_PATH",
153 "Specifies the path to the 'aep' shared library",
154 ENGINE_CMD_FLAG_STRING
155 },
156 {0, NULL, NULL, 0}
157 };
158
159#ifndef OPENSSL_NO_RSA
160/* Our internal RSA_METHOD that we provide pointers to */
161static RSA_METHOD aep_rsa =
162 {
163 "Aep RSA method",
164 NULL, /*rsa_pub_encrypt*/
165 NULL, /*rsa_pub_decrypt*/
166 NULL, /*rsa_priv_encrypt*/
167 NULL, /*rsa_priv_encrypt*/
168 aep_rsa_mod_exp, /*rsa_mod_exp*/
169 aep_mod_exp_mont, /*bn_mod_exp*/
170 NULL, /*init*/
171 NULL, /*finish*/
172 0, /*flags*/
173 NULL, /*app_data*/
174 NULL, /*rsa_sign*/
175 NULL /*rsa_verify*/
176 };
177#endif
178
179#ifndef OPENSSL_NO_DSA
180/* Our internal DSA_METHOD that we provide pointers to */
181static DSA_METHOD aep_dsa =
182 {
183 "Aep DSA method",
184 NULL, /* dsa_do_sign */
185 NULL, /* dsa_sign_setup */
186 NULL, /* dsa_do_verify */
187 aep_dsa_mod_exp, /* dsa_mod_exp */
188 aep_mod_exp_dsa, /* bn_mod_exp */
189 NULL, /* init */
190 NULL, /* finish */
191 0, /* flags */
192 NULL /* app_data */
193 };
194#endif
195
196#ifndef OPENSSL_NO_DH
197/* Our internal DH_METHOD that we provide pointers to */
198static DH_METHOD aep_dh =
199 {
200 "Aep DH method",
201 NULL,
202 NULL,
203 aep_mod_exp_dh,
204 NULL,
205 NULL,
206 0,
207 NULL
208 };
209#endif
210
211#ifdef AEPRAND
212/* our internal RAND_method that we provide pointers to */
213static RAND_METHOD aep_random =
214 {
215 /*"AEP RAND method", */
216 NULL,
217 aep_rand,
218 NULL,
219 NULL,
220 aep_rand,
221 aep_rand_status,
222 };
223#endif
224
225/*Define an array of structures to hold connections*/
226static AEP_CONNECTION_ENTRY aep_app_conn_table[MAX_PROCESS_CONNECTIONS];
227
228/*Used to determine if this is a new process*/
229static pid_t recorded_pid = 0;
230
231#ifdef AEPRAND
232static AEP_U8 rand_block[RAND_BLK_SIZE];
233static AEP_U32 rand_block_bytes = 0;
234#endif
235
236/* Constants used when creating the ENGINE */
237static const char *engine_aep_id = "aep";
238static const char *engine_aep_name = "Aep hardware engine support";
239
240static int max_key_len = 2176;
241
242
243/* This internal function is used by ENGINE_aep() and possibly by the
244 * "dynamic" ENGINE support too */
245static int bind_aep(ENGINE *e)
246 {
247#ifndef OPENSSL_NO_RSA
248 const RSA_METHOD *meth1;
249#endif
250#ifndef OPENSSL_NO_DSA
251 const DSA_METHOD *meth2;
252#endif
253#ifndef OPENSSL_NO_DH
254 const DH_METHOD *meth3;
255#endif
256
257 if(!ENGINE_set_id(e, engine_aep_id) ||
258 !ENGINE_set_name(e, engine_aep_name) ||
259#ifndef OPENSSL_NO_RSA
260 !ENGINE_set_RSA(e, &aep_rsa) ||
261#endif
262#ifndef OPENSSL_NO_DSA
263 !ENGINE_set_DSA(e, &aep_dsa) ||
264#endif
265#ifndef OPENSSL_NO_DH
266 !ENGINE_set_DH(e, &aep_dh) ||
267#endif
268#ifdef AEPRAND
269 !ENGINE_set_RAND(e, &aep_random) ||
270#endif
271 !ENGINE_set_init_function(e, aep_init) ||
272 !ENGINE_set_destroy_function(e, aep_destroy) ||
273 !ENGINE_set_finish_function(e, aep_finish) ||
274 !ENGINE_set_ctrl_function(e, aep_ctrl) ||
275 !ENGINE_set_cmd_defns(e, aep_cmd_defns))
276 return 0;
277
278#ifndef OPENSSL_NO_RSA
279 /* We know that the "PKCS1_SSLeay()" functions hook properly
280 * to the aep-specific mod_exp and mod_exp_crt so we use
281 * those functions. NB: We don't use ENGINE_openssl() or
282 * anything "more generic" because something like the RSAref
283 * code may not hook properly, and if you own one of these
284 * cards then you have the right to do RSA operations on it
285 * anyway! */
286 meth1 = RSA_PKCS1_SSLeay();
287 aep_rsa.rsa_pub_enc = meth1->rsa_pub_enc;
288 aep_rsa.rsa_pub_dec = meth1->rsa_pub_dec;
289 aep_rsa.rsa_priv_enc = meth1->rsa_priv_enc;
290 aep_rsa.rsa_priv_dec = meth1->rsa_priv_dec;
291#endif
292
293
294#ifndef OPENSSL_NO_DSA
295 /* Use the DSA_OpenSSL() method and just hook the mod_exp-ish
296 * bits. */
297 meth2 = DSA_OpenSSL();
298 aep_dsa.dsa_do_sign = meth2->dsa_do_sign;
299 aep_dsa.dsa_sign_setup = meth2->dsa_sign_setup;
300 aep_dsa.dsa_do_verify = meth2->dsa_do_verify;
301
302 aep_dsa = *DSA_get_default_method();
303 aep_dsa.dsa_mod_exp = aep_dsa_mod_exp;
304 aep_dsa.bn_mod_exp = aep_mod_exp_dsa;
305#endif
306
307#ifndef OPENSSL_NO_DH
308 /* Much the same for Diffie-Hellman */
309 meth3 = DH_OpenSSL();
310 aep_dh.generate_key = meth3->generate_key;
311 aep_dh.compute_key = meth3->compute_key;
312 aep_dh.bn_mod_exp = meth3->bn_mod_exp;
313#endif
314
315 /* Ensure the aep error handling is set up */
316 ERR_load_AEPHK_strings();
317
318 return 1;
319}
320
321#ifdef ENGINE_DYNAMIC_SUPPORT
322static int bind_helper(ENGINE *e, const char *id)
323 {
324 if(id && (strcmp(id, engine_aep_id) != 0))
325 return 0;
326 if(!bind_aep(e))
327 return 0;
328 return 1;
329 }
330IMPLEMENT_DYNAMIC_CHECK_FN()
331IMPLEMENT_DYNAMIC_BIND_FN(bind_helper)
332#else
333static ENGINE *engine_aep(void)
334 {
335 ENGINE *ret = ENGINE_new();
336 if(!ret)
337 return NULL;
338 if(!bind_aep(ret))
339 {
340 ENGINE_free(ret);
341 return NULL;
342 }
343 return ret;
344 }
345
346void ENGINE_load_aep(void)
347 {
348 /* Copied from eng_[openssl|dyn].c */
349 ENGINE *toadd = engine_aep();
350 if(!toadd) return;
351 ENGINE_add(toadd);
352 ENGINE_free(toadd);
353 ERR_clear_error();
354 }
355#endif
356
357/* This is a process-global DSO handle used for loading and unloading
358 * the Aep library. NB: This is only set (or unset) during an
359 * init() or finish() call (reference counts permitting) and they're
360 * operating with global locks, so this should be thread-safe
361 * implicitly. */
362static DSO *aep_dso = NULL;
363
364/* These are the static string constants for the DSO file name and the function
365 * symbol names to bind to.
366*/
367static const char *AEP_LIBNAME = NULL;
368static const char *get_AEP_LIBNAME(void)
369 {
370 if(AEP_LIBNAME)
371 return AEP_LIBNAME;
372 return "aep";
373 }
374static void free_AEP_LIBNAME(void)
375 {
376 if(AEP_LIBNAME)
377 OPENSSL_free((void*)AEP_LIBNAME);
378 AEP_LIBNAME = NULL;
379 }
380static long set_AEP_LIBNAME(const char *name)
381 {
382 free_AEP_LIBNAME();
383 return ((AEP_LIBNAME = BUF_strdup(name)) != NULL ? 1 : 0);
384 }
385
386static const char *AEP_F1 = "AEP_ModExp";
387static const char *AEP_F2 = "AEP_ModExpCrt";
388#ifdef AEPRAND
389static const char *AEP_F3 = "AEP_GenRandom";
390#endif
391static const char *AEP_F4 = "AEP_Finalize";
392static const char *AEP_F5 = "AEP_Initialize";
393static const char *AEP_F6 = "AEP_OpenConnection";
394static const char *AEP_F7 = "AEP_SetBNCallBacks";
395static const char *AEP_F8 = "AEP_CloseConnection";
396
397/* These are the function pointers that are (un)set when the library has
398 * successfully (un)loaded. */
399static t_AEP_OpenConnection *p_AEP_OpenConnection = NULL;
400static t_AEP_CloseConnection *p_AEP_CloseConnection = NULL;
401static t_AEP_ModExp *p_AEP_ModExp = NULL;
402static t_AEP_ModExpCrt *p_AEP_ModExpCrt = NULL;
403#ifdef AEPRAND
404static t_AEP_GenRandom *p_AEP_GenRandom = NULL;
405#endif
406static t_AEP_Initialize *p_AEP_Initialize = NULL;
407static t_AEP_Finalize *p_AEP_Finalize = NULL;
408static t_AEP_SetBNCallBacks *p_AEP_SetBNCallBacks = NULL;
409
410/* (de)initialisation functions. */
411static int aep_init(ENGINE *e)
412 {
413 t_AEP_ModExp *p1;
414 t_AEP_ModExpCrt *p2;
415#ifdef AEPRAND
416 t_AEP_GenRandom *p3;
417#endif
418 t_AEP_Finalize *p4;
419 t_AEP_Initialize *p5;
420 t_AEP_OpenConnection *p6;
421 t_AEP_SetBNCallBacks *p7;
422 t_AEP_CloseConnection *p8;
423
424 int to_return = 0;
425
426 if(aep_dso != NULL)
427 {
428 AEPHKerr(AEPHK_F_AEP_INIT,AEPHK_R_ALREADY_LOADED);
429 goto err;
430 }
431 /* Attempt to load libaep.so. */
432
433 aep_dso = DSO_load(NULL, get_AEP_LIBNAME(), NULL, 0);
434
435 if(aep_dso == NULL)
436 {
437 AEPHKerr(AEPHK_F_AEP_INIT,AEPHK_R_NOT_LOADED);
438 goto err;
439 }
440
441 if( !(p1 = (t_AEP_ModExp *) DSO_bind_func( aep_dso,AEP_F1)) ||
442 !(p2 = (t_AEP_ModExpCrt*) DSO_bind_func( aep_dso,AEP_F2)) ||
443#ifdef AEPRAND
444 !(p3 = (t_AEP_GenRandom*) DSO_bind_func( aep_dso,AEP_F3)) ||
445#endif
446 !(p4 = (t_AEP_Finalize*) DSO_bind_func( aep_dso,AEP_F4)) ||
447 !(p5 = (t_AEP_Initialize*) DSO_bind_func( aep_dso,AEP_F5)) ||
448 !(p6 = (t_AEP_OpenConnection*) DSO_bind_func( aep_dso,AEP_F6)) ||
449 !(p7 = (t_AEP_SetBNCallBacks*) DSO_bind_func( aep_dso,AEP_F7)) ||
450 !(p8 = (t_AEP_CloseConnection*) DSO_bind_func( aep_dso,AEP_F8)))
451 {
452 AEPHKerr(AEPHK_F_AEP_INIT,AEPHK_R_NOT_LOADED);
453 goto err;
454 }
455
456 /* Copy the pointers */
457
458 p_AEP_ModExp = p1;
459 p_AEP_ModExpCrt = p2;
460#ifdef AEPRAND
461 p_AEP_GenRandom = p3;
462#endif
463 p_AEP_Finalize = p4;
464 p_AEP_Initialize = p5;
465 p_AEP_OpenConnection = p6;
466 p_AEP_SetBNCallBacks = p7;
467 p_AEP_CloseConnection = p8;
468
469 to_return = 1;
470
471 return to_return;
472
473 err:
474
475 if(aep_dso)
476 DSO_free(aep_dso);
477
478 p_AEP_OpenConnection = NULL;
479 p_AEP_ModExp = NULL;
480 p_AEP_ModExpCrt = NULL;
481#ifdef AEPRAND
482 p_AEP_GenRandom = NULL;
483#endif
484 p_AEP_Initialize = NULL;
485 p_AEP_Finalize = NULL;
486 p_AEP_SetBNCallBacks = NULL;
487 p_AEP_CloseConnection = NULL;
488
489 return to_return;
490 }
491
492/* Destructor (complements the "ENGINE_aep()" constructor) */
493static int aep_destroy(ENGINE *e)
494 {
495 free_AEP_LIBNAME();
496 ERR_unload_AEPHK_strings();
497 return 1;
498 }
499
500static int aep_finish(ENGINE *e)
501 {
502 int to_return = 0, in_use;
503 AEP_RV rv;
504
505 if(aep_dso == NULL)
506 {
507 AEPHKerr(AEPHK_F_AEP_FINISH,AEPHK_R_NOT_LOADED);
508 goto err;
509 }
510
511 rv = aep_close_all_connections(0, &in_use);
512 if (rv != AEP_R_OK)
513 {
514 AEPHKerr(AEPHK_F_AEP_FINISH,AEPHK_R_CLOSE_HANDLES_FAILED);
515 goto err;
516 }
517 if (in_use)
518 {
519 AEPHKerr(AEPHK_F_AEP_FINISH,AEPHK_R_CONNECTIONS_IN_USE);
520 goto err;
521 }
522
523 rv = p_AEP_Finalize();
524 if (rv != AEP_R_OK)
525 {
526 AEPHKerr(AEPHK_F_AEP_FINISH,AEPHK_R_FINALIZE_FAILED);
527 goto err;
528 }
529
530 if(!DSO_free(aep_dso))
531 {
532 AEPHKerr(AEPHK_F_AEP_FINISH,AEPHK_R_UNIT_FAILURE);
533 goto err;
534 }
535
536 aep_dso = NULL;
537 p_AEP_CloseConnection = NULL;
538 p_AEP_OpenConnection = NULL;
539 p_AEP_ModExp = NULL;
540 p_AEP_ModExpCrt = NULL;
541#ifdef AEPRAND
542 p_AEP_GenRandom = NULL;
543#endif
544 p_AEP_Initialize = NULL;
545 p_AEP_Finalize = NULL;
546 p_AEP_SetBNCallBacks = NULL;
547
548 to_return = 1;
549 err:
550 return to_return;
551 }
552
553static int aep_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f)())
554 {
555 int initialised = ((aep_dso == NULL) ? 0 : 1);
556 switch(cmd)
557 {
558 case AEP_CMD_SO_PATH:
559 if(p == NULL)
560 {
561 AEPHKerr(AEPHK_F_AEP_CTRL,
562 ERR_R_PASSED_NULL_PARAMETER);
563 return 0;
564 }
565 if(initialised)
566 {
567 AEPHKerr(AEPHK_F_AEP_CTRL,
568 AEPHK_R_ALREADY_LOADED);
569 return 0;
570 }
571 return set_AEP_LIBNAME((const char*)p);
572 default:
573 break;
574 }
575 AEPHKerr(AEPHK_F_AEP_CTRL,AEPHK_R_CTRL_COMMAND_NOT_IMPLEMENTED);
576 return 0;
577 }
578
579static int aep_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
580 const BIGNUM *m, BN_CTX *ctx)
581 {
582 int to_return = 0;
583 int r_len = 0;
584 AEP_CONNECTION_HNDL hConnection;
585 AEP_RV rv;
586
587 r_len = BN_num_bits(m);
588
589 /* Perform in software if modulus is too large for hardware. */
590
591 if (r_len > max_key_len){
592 AEPHKerr(AEPHK_F_AEP_MOD_EXP, AEPHK_R_SIZE_TOO_LARGE_OR_TOO_SMALL);
593 return BN_mod_exp(r, a, p, m, ctx);
594 }
595
596 /*Grab a connection from the pool*/
597 rv = aep_get_connection(&hConnection);
598 if (rv != AEP_R_OK)
599 {
600 AEPHKerr(AEPHK_F_AEP_MOD_EXP,AEPHK_R_GET_HANDLE_FAILED);
601 return BN_mod_exp(r, a, p, m, ctx);
602 }
603
604 /*To the card with the mod exp*/
605 rv = p_AEP_ModExp(hConnection,(void*)a, (void*)p,(void*)m, (void*)r,NULL);
606
607 if (rv != AEP_R_OK)
608 {
609 AEPHKerr(AEPHK_F_AEP_MOD_EXP,AEPHK_R_MOD_EXP_FAILED);
610 rv = aep_close_connection(hConnection);
611 return BN_mod_exp(r, a, p, m, ctx);
612 }
613
614 /*Return the connection to the pool*/
615 rv = aep_return_connection(hConnection);
616 if (rv != AEP_R_OK)
617 {
618 AEPHKerr(AEPHK_F_AEP_RAND,AEPHK_R_RETURN_CONNECTION_FAILED);
619 goto err;
620 }
621
622 to_return = 1;
623 err:
624 return to_return;
625 }
626
627static AEP_RV aep_mod_exp_crt(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
628 const BIGNUM *q, const BIGNUM *dmp1,
629 const BIGNUM *dmq1,const BIGNUM *iqmp, BN_CTX *ctx)
630 {
631 AEP_RV rv = AEP_R_OK;
632 AEP_CONNECTION_HNDL hConnection;
633
634 /*Grab a connection from the pool*/
635 rv = aep_get_connection(&hConnection);
636 if (rv != AEP_R_OK)
637 {
638 AEPHKerr(AEPHK_F_AEP_MOD_EXP_CRT,AEPHK_R_GET_HANDLE_FAILED);
639 return FAIL_TO_SW;
640 }
641
642 /*To the card with the mod exp*/
643 rv = p_AEP_ModExpCrt(hConnection,(void*)a, (void*)p, (void*)q, (void*)dmp1,(void*)dmq1,
644 (void*)iqmp,(void*)r,NULL);
645 if (rv != AEP_R_OK)
646 {
647 AEPHKerr(AEPHK_F_AEP_MOD_EXP_CRT,AEPHK_R_MOD_EXP_CRT_FAILED);
648 rv = aep_close_connection(hConnection);
649 return FAIL_TO_SW;
650 }
651
652 /*Return the connection to the pool*/
653 rv = aep_return_connection(hConnection);
654 if (rv != AEP_R_OK)
655 {
656 AEPHKerr(AEPHK_F_AEP_RAND,AEPHK_R_RETURN_CONNECTION_FAILED);
657 goto err;
658 }
659
660 err:
661 return rv;
662 }
663
664
665#ifdef AEPRAND
666static int aep_rand(unsigned char *buf,int len )
667 {
668 AEP_RV rv = AEP_R_OK;
669 AEP_CONNECTION_HNDL hConnection;
670
671 CRYPTO_w_lock(CRYPTO_LOCK_RAND);
672
673 /*Can the request be serviced with what's already in the buffer?*/
674 if (len <= rand_block_bytes)
675 {
676 memcpy(buf, &rand_block[RAND_BLK_SIZE - rand_block_bytes], len);
677 rand_block_bytes -= len;
678 CRYPTO_w_unlock(CRYPTO_LOCK_RAND);
679 }
680 else
681 /*If not the get another block of random bytes*/
682 {
683 CRYPTO_w_unlock(CRYPTO_LOCK_RAND);
684
685 rv = aep_get_connection(&hConnection);
686 if (rv != AEP_R_OK)
687 {
688 AEPHKerr(AEPHK_F_AEP_RAND,AEPHK_R_GET_HANDLE_FAILED);
689 goto err_nounlock;
690 }
691
692 if (len > RAND_BLK_SIZE)
693 {
694 rv = p_AEP_GenRandom(hConnection, len, 2, buf, NULL);
695 if (rv != AEP_R_OK)
696 {
697 AEPHKerr(AEPHK_F_AEP_RAND,AEPHK_R_GET_RANDOM_FAILED);
698 goto err_nounlock;
699 }
700 }
701 else
702 {
703 CRYPTO_w_lock(CRYPTO_LOCK_RAND);
704
705 rv = p_AEP_GenRandom(hConnection, RAND_BLK_SIZE, 2, &rand_block[0], NULL);
706 if (rv != AEP_R_OK)
707 {
708 AEPHKerr(AEPHK_F_AEP_RAND,AEPHK_R_GET_RANDOM_FAILED);
709
710 goto err;
711 }
712
713 rand_block_bytes = RAND_BLK_SIZE;
714
715 memcpy(buf, &rand_block[RAND_BLK_SIZE - rand_block_bytes], len);
716 rand_block_bytes -= len;
717
718 CRYPTO_w_unlock(CRYPTO_LOCK_RAND);
719 }
720
721 rv = aep_return_connection(hConnection);
722 if (rv != AEP_R_OK)
723 {
724 AEPHKerr(AEPHK_F_AEP_RAND,AEPHK_R_RETURN_CONNECTION_FAILED);
725
726 goto err_nounlock;
727 }
728 }
729
730 return 1;
731 err:
732 CRYPTO_w_unlock(CRYPTO_LOCK_RAND);
733 err_nounlock:
734 return 0;
735 }
736
737static int aep_rand_status(void)
738{
739 return 1;
740}
741#endif
742
743#ifndef OPENSSL_NO_RSA
744static int aep_rsa_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa)
745 {
746 BN_CTX *ctx = NULL;
747 int to_return = 0;
748 AEP_RV rv = AEP_R_OK;
749
750 if ((ctx = BN_CTX_new()) == NULL)
751 goto err;
752
753 if (!aep_dso)
754 {
755 AEPHKerr(AEPHK_F_AEP_RSA_MOD_EXP,AEPHK_R_NOT_LOADED);
756 goto err;
757 }
758
759 /*See if we have all the necessary bits for a crt*/
760 if (rsa->q && rsa->dmp1 && rsa->dmq1 && rsa->iqmp)
761 {
762 rv = aep_mod_exp_crt(r0,I,rsa->p,rsa->q, rsa->dmp1,rsa->dmq1,rsa->iqmp,ctx);
763
764 if (rv == FAIL_TO_SW){
765 const RSA_METHOD *meth = RSA_PKCS1_SSLeay();
766 to_return = (*meth->rsa_mod_exp)(r0, I, rsa);
767 goto err;
768 }
769 else if (rv != AEP_R_OK)
770 goto err;
771 }
772 else
773 {
774 if (!rsa->d || !rsa->n)
775 {
776 AEPHKerr(AEPHK_F_AEP_RSA_MOD_EXP,AEPHK_R_MISSING_KEY_COMPONENTS);
777 goto err;
778 }
779
780 rv = aep_mod_exp(r0,I,rsa->d,rsa->n,ctx);
781 if (rv != AEP_R_OK)
782 goto err;
783
784 }
785
786 to_return = 1;
787
788 err:
789 if(ctx)
790 BN_CTX_free(ctx);
791 return to_return;
792}
793#endif
794
795#ifndef OPENSSL_NO_DSA
796static int aep_dsa_mod_exp(DSA *dsa, BIGNUM *rr, BIGNUM *a1,
797 BIGNUM *p1, BIGNUM *a2, BIGNUM *p2, BIGNUM *m,
798 BN_CTX *ctx, BN_MONT_CTX *in_mont)
799 {
800 BIGNUM t;
801 int to_return = 0;
802 BN_init(&t);
803
804 /* let rr = a1 ^ p1 mod m */
805 if (!aep_mod_exp(rr,a1,p1,m,ctx)) goto end;
806 /* let t = a2 ^ p2 mod m */
807 if (!aep_mod_exp(&t,a2,p2,m,ctx)) goto end;
808 /* let rr = rr * t mod m */
809 if (!BN_mod_mul(rr,rr,&t,m,ctx)) goto end;
810 to_return = 1;
811 end:
812 BN_free(&t);
813 return to_return;
814 }
815
816static int aep_mod_exp_dsa(DSA *dsa, BIGNUM *r, BIGNUM *a,
817 const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx,
818 BN_MONT_CTX *m_ctx)
819 {
820 return aep_mod_exp(r, a, p, m, ctx);
821 }
822#endif
823
824/* This function is aliased to mod_exp (with the mont stuff dropped). */
825static int aep_mod_exp_mont(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
826 const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx)
827 {
828 return aep_mod_exp(r, a, p, m, ctx);
829 }
830
831#ifndef OPENSSL_NO_DH
832/* This function is aliased to mod_exp (with the dh and mont dropped). */
833static int aep_mod_exp_dh(const DH *dh, BIGNUM *r, const BIGNUM *a,
834 const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx,
835 BN_MONT_CTX *m_ctx)
836 {
837 return aep_mod_exp(r, a, p, m, ctx);
838 }
839#endif
840
841static AEP_RV aep_get_connection(AEP_CONNECTION_HNDL_PTR phConnection)
842 {
843 int count;
844 AEP_RV rv = AEP_R_OK;
845
846 /*Get the current process id*/
847 pid_t curr_pid;
848
849 CRYPTO_w_lock(CRYPTO_LOCK_ENGINE);
850
851 curr_pid = getpid();
852
853 /*Check if this is the first time this is being called from the current
854 process*/
855 if (recorded_pid != curr_pid)
856 {
857 /*Remember our pid so we can check if we're in a new process*/
858 recorded_pid = curr_pid;
859
860 /*Call Finalize to make sure we have not inherited some data
861 from a parent process*/
862 p_AEP_Finalize();
863
864 /*Initialise the AEP API*/
865 rv = p_AEP_Initialize(NULL);
866
867 if (rv != AEP_R_OK)
868 {
869 AEPHKerr(AEPHK_F_AEP_GET_CONNECTION,AEPHK_R_INIT_FAILURE);
870 recorded_pid = 0;
871 goto end;
872 }
873
874 /*Set the AEP big num call back functions*/
875 rv = p_AEP_SetBNCallBacks(&GetBigNumSize, &MakeAEPBigNum,
876 &ConvertAEPBigNum);
877
878 if (rv != AEP_R_OK)
879 {
880 AEPHKerr(AEPHK_F_AEP_GET_CONNECTION,AEPHK_R_SETBNCALLBACK_FAILURE);
881 recorded_pid = 0;
882 goto end;
883 }
884
885#ifdef AEPRAND
886 /*Reset the rand byte count*/
887 rand_block_bytes = 0;
888#endif
889
890 /*Init the structures*/
891 for (count = 0;count < MAX_PROCESS_CONNECTIONS;count ++)
892 {
893 aep_app_conn_table[count].conn_state = NotConnected;
894 aep_app_conn_table[count].conn_hndl = 0;
895 }
896
897 /*Open a connection*/
898 rv = p_AEP_OpenConnection(phConnection);
899
900 if (rv != AEP_R_OK)
901 {
902 AEPHKerr(AEPHK_F_AEP_GET_CONNECTION,AEPHK_R_UNIT_FAILURE);
903 recorded_pid = 0;
904 goto end;
905 }
906
907 aep_app_conn_table[0].conn_state = InUse;
908 aep_app_conn_table[0].conn_hndl = *phConnection;
909 goto end;
910 }
911 /*Check the existing connections to see if we can find a free one*/
912 for (count = 0;count < MAX_PROCESS_CONNECTIONS;count ++)
913 {
914 if (aep_app_conn_table[count].conn_state == Connected)
915 {
916 aep_app_conn_table[count].conn_state = InUse;
917 *phConnection = aep_app_conn_table[count].conn_hndl;
918 goto end;
919 }
920 }
921 /*If no connections available, we're going to have to try
922 to open a new one*/
923 for (count = 0;count < MAX_PROCESS_CONNECTIONS;count ++)
924 {
925 if (aep_app_conn_table[count].conn_state == NotConnected)
926 {
927 /*Open a connection*/
928 rv = p_AEP_OpenConnection(phConnection);
929
930 if (rv != AEP_R_OK)
931 {
932 AEPHKerr(AEPHK_F_AEP_GET_CONNECTION,AEPHK_R_UNIT_FAILURE);
933 goto end;
934 }
935
936 aep_app_conn_table[count].conn_state = InUse;
937 aep_app_conn_table[count].conn_hndl = *phConnection;
938 goto end;
939 }
940 }
941 rv = AEP_R_GENERAL_ERROR;
942 end:
943 CRYPTO_w_unlock(CRYPTO_LOCK_ENGINE);
944 return rv;
945 }
946
947
948static AEP_RV aep_return_connection(AEP_CONNECTION_HNDL hConnection)
949 {
950 int count;
951
952 CRYPTO_w_lock(CRYPTO_LOCK_ENGINE);
953
954 /*Find the connection item that matches this connection handle*/
955 for(count = 0;count < MAX_PROCESS_CONNECTIONS;count ++)
956 {
957 if (aep_app_conn_table[count].conn_hndl == hConnection)
958 {
959 aep_app_conn_table[count].conn_state = Connected;
960 break;
961 }
962 }
963
964 CRYPTO_w_unlock(CRYPTO_LOCK_ENGINE);
965
966 return AEP_R_OK;
967 }
968
969static AEP_RV aep_close_connection(AEP_CONNECTION_HNDL hConnection)
970 {
971 int count;
972 AEP_RV rv = AEP_R_OK;
973
974 CRYPTO_w_lock(CRYPTO_LOCK_ENGINE);
975
976 /*Find the connection item that matches this connection handle*/
977 for(count = 0;count < MAX_PROCESS_CONNECTIONS;count ++)
978 {
979 if (aep_app_conn_table[count].conn_hndl == hConnection)
980 {
981 rv = p_AEP_CloseConnection(aep_app_conn_table[count].conn_hndl);
982 if (rv != AEP_R_OK)
983 goto end;
984 aep_app_conn_table[count].conn_state = NotConnected;
985 aep_app_conn_table[count].conn_hndl = 0;
986 break;
987 }
988 }
989
990 end:
991 CRYPTO_w_unlock(CRYPTO_LOCK_ENGINE);
992 return rv;
993 }
994
995static AEP_RV aep_close_all_connections(int use_engine_lock, int *in_use)
996 {
997 int count;
998 AEP_RV rv = AEP_R_OK;
999
1000 *in_use = 0;
1001 if (use_engine_lock) CRYPTO_w_lock(CRYPTO_LOCK_ENGINE);
1002 for (count = 0;count < MAX_PROCESS_CONNECTIONS;count ++)
1003 {
1004 switch (aep_app_conn_table[count].conn_state)
1005 {
1006 case Connected:
1007 rv = p_AEP_CloseConnection(aep_app_conn_table[count].conn_hndl);
1008 if (rv != AEP_R_OK)
1009 goto end;
1010 aep_app_conn_table[count].conn_state = NotConnected;
1011 aep_app_conn_table[count].conn_hndl = 0;
1012 break;
1013 case InUse:
1014 (*in_use)++;
1015 break;
1016 case NotConnected:
1017 break;
1018 }
1019 }
1020 end:
1021 if (use_engine_lock) CRYPTO_w_unlock(CRYPTO_LOCK_ENGINE);
1022 return rv;
1023 }
1024
1025/*BigNum call back functions, used to convert OpenSSL bignums into AEP bignums.
1026 Note only 32bit Openssl build support*/
1027
1028static AEP_RV GetBigNumSize(AEP_VOID_PTR ArbBigNum, AEP_U32* BigNumSize)
1029 {
1030 BIGNUM* bn;
1031
1032 /*Cast the ArbBigNum pointer to our BIGNUM struct*/
1033 bn = (BIGNUM*) ArbBigNum;
1034
1035#ifdef SIXTY_FOUR_BIT_LONG
1036 *BigNumSize = bn->top << 3;
1037#else
1038 /*Size of the bignum in bytes is equal to the bn->top (no of 32 bit
1039 words) multiplies by 4*/
1040 *BigNumSize = bn->top << 2;
1041#endif
1042
1043 return AEP_R_OK;
1044 }
1045
1046static AEP_RV MakeAEPBigNum(AEP_VOID_PTR ArbBigNum, AEP_U32 BigNumSize,
1047 unsigned char* AEP_BigNum)
1048 {
1049 BIGNUM* bn;
1050
1051#ifndef SIXTY_FOUR_BIT_LONG
1052 unsigned char* buf;
1053 int i;
1054#endif
1055
1056 /*Cast the ArbBigNum pointer to our BIGNUM struct*/
1057 bn = (BIGNUM*) ArbBigNum;
1058
1059#ifdef SIXTY_FOUR_BIT_LONG
1060 memcpy(AEP_BigNum, bn->d, BigNumSize);
1061#else
1062 /*Must copy data into a (monotone) least significant byte first format
1063 performing endian conversion if necessary*/
1064 for(i=0;i<bn->top;i++)
1065 {
1066 buf = (unsigned char*)&bn->d[i];
1067
1068 *((AEP_U32*)AEP_BigNum) = (AEP_U32)
1069 ((unsigned) buf[1] << 8 | buf[0]) |
1070 ((unsigned) buf[3] << 8 | buf[2]) << 16;
1071
1072 AEP_BigNum += 4;
1073 }
1074#endif
1075
1076 return AEP_R_OK;
1077 }
1078
1079/*Turn an AEP Big Num back to a user big num*/
1080static AEP_RV ConvertAEPBigNum(void* ArbBigNum, AEP_U32 BigNumSize,
1081 unsigned char* AEP_BigNum)
1082 {
1083 BIGNUM* bn;
1084#ifndef SIXTY_FOUR_BIT_LONG
1085 int i;
1086#endif
1087
1088 bn = (BIGNUM*)ArbBigNum;
1089
1090 /*Expand the result bn so that it can hold our big num.
1091 Size is in bits*/
1092 bn_expand(bn, (int)(BigNumSize << 3));
1093
1094#ifdef SIXTY_FOUR_BIT_LONG
1095 bn->top = BigNumSize >> 3;
1096
1097 if((BigNumSize & 7) != 0)
1098 bn->top++;
1099
1100 memset(bn->d, 0, bn->top << 3);
1101
1102 memcpy(bn->d, AEP_BigNum, BigNumSize);
1103#else
1104 bn->top = BigNumSize >> 2;
1105
1106 for(i=0;i<bn->top;i++)
1107 {
1108 bn->d[i] = (AEP_U32)
1109 ((unsigned) AEP_BigNum[3] << 8 | AEP_BigNum[2]) << 16 |
1110 ((unsigned) AEP_BigNum[1] << 8 | AEP_BigNum[0]);
1111 AEP_BigNum += 4;
1112 }
1113#endif
1114
1115 return AEP_R_OK;
1116}
1117
1118#endif /* !OPENSSL_NO_HW_AEP */
1119#endif /* !OPENSSL_NO_HW */
diff --git a/src/lib/libcrypto/engine/hw_aep_err.c b/src/lib/libcrypto/engine/hw_aep_err.c
new file mode 100644
index 0000000000..092f532946
--- /dev/null
+++ b/src/lib/libcrypto/engine/hw_aep_err.c
@@ -0,0 +1,157 @@
1/* hw_aep_err.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/* 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 "hw_aep_err.h"
64
65/* BEGIN ERROR CODES */
66#ifndef OPENSSL_NO_ERR
67static ERR_STRING_DATA AEPHK_str_functs[]=
68 {
69{ERR_PACK(0,AEPHK_F_AEP_CTRL,0), "AEP_CTRL"},
70{ERR_PACK(0,AEPHK_F_AEP_FINISH,0), "AEP_FINISH"},
71{ERR_PACK(0,AEPHK_F_AEP_GET_CONNECTION,0), "AEP_GET_CONNECTION"},
72{ERR_PACK(0,AEPHK_F_AEP_INIT,0), "AEP_INIT"},
73{ERR_PACK(0,AEPHK_F_AEP_MOD_EXP,0), "AEP_MOD_EXP"},
74{ERR_PACK(0,AEPHK_F_AEP_MOD_EXP_CRT,0), "AEP_MOD_EXP_CRT"},
75{ERR_PACK(0,AEPHK_F_AEP_RAND,0), "AEP_RAND"},
76{ERR_PACK(0,AEPHK_F_AEP_RSA_MOD_EXP,0), "AEP_RSA_MOD_EXP"},
77{0,NULL}
78 };
79
80static ERR_STRING_DATA AEPHK_str_reasons[]=
81 {
82{AEPHK_R_ALREADY_LOADED ,"already loaded"},
83{AEPHK_R_CLOSE_HANDLES_FAILED ,"close handles failed"},
84{AEPHK_R_CONNECTIONS_IN_USE ,"connections in use"},
85{AEPHK_R_CTRL_COMMAND_NOT_IMPLEMENTED ,"ctrl command not implemented"},
86{AEPHK_R_FINALIZE_FAILED ,"finalize failed"},
87{AEPHK_R_GET_HANDLE_FAILED ,"get handle failed"},
88{AEPHK_R_GET_RANDOM_FAILED ,"get random failed"},
89{AEPHK_R_INIT_FAILURE ,"init failure"},
90{AEPHK_R_MISSING_KEY_COMPONENTS ,"missing key components"},
91{AEPHK_R_MOD_EXP_CRT_FAILED ,"mod exp crt failed"},
92{AEPHK_R_MOD_EXP_FAILED ,"mod exp failed"},
93{AEPHK_R_NOT_LOADED ,"not loaded"},
94{AEPHK_R_OK ,"ok"},
95{AEPHK_R_RETURN_CONNECTION_FAILED ,"return connection failed"},
96{AEPHK_R_SETBNCALLBACK_FAILURE ,"setbncallback failure"},
97{AEPHK_R_SIZE_TOO_LARGE_OR_TOO_SMALL ,"size too large or too small"},
98{AEPHK_R_UNIT_FAILURE ,"unit failure"},
99{0,NULL}
100 };
101
102#endif
103
104#ifdef AEPHK_LIB_NAME
105static ERR_STRING_DATA AEPHK_lib_name[]=
106 {
107{0 ,AEPHK_LIB_NAME},
108{0,NULL}
109 };
110#endif
111
112
113static int AEPHK_lib_error_code=0;
114static int AEPHK_error_init=1;
115
116static void ERR_load_AEPHK_strings(void)
117 {
118 if (AEPHK_lib_error_code == 0)
119 AEPHK_lib_error_code=ERR_get_next_error_library();
120
121 if (AEPHK_error_init)
122 {
123 AEPHK_error_init=0;
124#ifndef OPENSSL_NO_ERR
125 ERR_load_strings(AEPHK_lib_error_code,AEPHK_str_functs);
126 ERR_load_strings(AEPHK_lib_error_code,AEPHK_str_reasons);
127#endif
128
129#ifdef AEPHK_LIB_NAME
130 AEPHK_lib_name->error = ERR_PACK(AEPHK_lib_error_code,0,0);
131 ERR_load_strings(0,AEPHK_lib_name);
132#endif
133 }
134 }
135
136static void ERR_unload_AEPHK_strings(void)
137 {
138 if (AEPHK_error_init == 0)
139 {
140#ifndef OPENSSL_NO_ERR
141 ERR_unload_strings(AEPHK_lib_error_code,AEPHK_str_functs);
142 ERR_unload_strings(AEPHK_lib_error_code,AEPHK_str_reasons);
143#endif
144
145#ifdef AEPHK_LIB_NAME
146 ERR_unload_strings(0,AEPHK_lib_name);
147#endif
148 AEPHK_error_init=1;
149 }
150 }
151
152static void ERR_AEPHK_error(int function, int reason, char *file, int line)
153 {
154 if (AEPHK_lib_error_code == 0)
155 AEPHK_lib_error_code=ERR_get_next_error_library();
156 ERR_PUT_error(AEPHK_lib_error_code,function,reason,file,line);
157 }
diff --git a/src/lib/libcrypto/engine/hw_aep_err.h b/src/lib/libcrypto/engine/hw_aep_err.h
new file mode 100644
index 0000000000..8fe4cf921f
--- /dev/null
+++ b/src/lib/libcrypto/engine/hw_aep_err.h
@@ -0,0 +1,101 @@
1/* ====================================================================
2 * Copyright (c) 2001 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_AEPHK_ERR_H
56#define HEADER_AEPHK_ERR_H
57
58/* BEGIN ERROR CODES */
59/* The following lines are auto generated by the script mkerr.pl. Any changes
60 * made after this point may be overwritten when the script is next run.
61 */
62static void ERR_load_AEPHK_strings(void);
63static void ERR_unload_AEPHK_strings(void);
64static void ERR_AEPHK_error(int function, int reason, char *file, int line);
65#define AEPHKerr(f,r) ERR_AEPHK_error((f),(r),__FILE__,__LINE__)
66
67/* Error codes for the AEPHK functions. */
68
69/* Function codes. */
70#define AEPHK_F_AEP_CTRL 100
71#define AEPHK_F_AEP_FINISH 101
72#define AEPHK_F_AEP_GET_CONNECTION 102
73#define AEPHK_F_AEP_INIT 103
74#define AEPHK_F_AEP_MOD_EXP 104
75#define AEPHK_F_AEP_MOD_EXP_CRT 105
76#define AEPHK_F_AEP_RAND 106
77#define AEPHK_F_AEP_RSA_MOD_EXP 107
78
79/* Reason codes. */
80#define AEPHK_R_ALREADY_LOADED 100
81#define AEPHK_R_CLOSE_HANDLES_FAILED 101
82#define AEPHK_R_CONNECTIONS_IN_USE 102
83#define AEPHK_R_CTRL_COMMAND_NOT_IMPLEMENTED 103
84#define AEPHK_R_FINALIZE_FAILED 104
85#define AEPHK_R_GET_HANDLE_FAILED 105
86#define AEPHK_R_GET_RANDOM_FAILED 106
87#define AEPHK_R_INIT_FAILURE 107
88#define AEPHK_R_MISSING_KEY_COMPONENTS 108
89#define AEPHK_R_MOD_EXP_CRT_FAILED 109
90#define AEPHK_R_MOD_EXP_FAILED 110
91#define AEPHK_R_NOT_LOADED 111
92#define AEPHK_R_OK 112
93#define AEPHK_R_RETURN_CONNECTION_FAILED 113
94#define AEPHK_R_SETBNCALLBACK_FAILURE 114
95#define AEPHK_R_SIZE_TOO_LARGE_OR_TOO_SMALL 116
96#define AEPHK_R_UNIT_FAILURE 115
97
98#ifdef __cplusplus
99}
100#endif
101#endif
diff --git a/src/lib/libcrypto/engine/hw_atalla.c b/src/lib/libcrypto/engine/hw_atalla.c
new file mode 100644
index 0000000000..e9eff9fad1
--- /dev/null
+++ b/src/lib/libcrypto/engine/hw_atalla.c
@@ -0,0 +1,594 @@
1/* crypto/engine/hw_atalla.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 <openssl/crypto.h>
61#include "cryptlib.h"
62#include <openssl/dso.h>
63#include <openssl/engine.h>
64
65#ifndef OPENSSL_NO_HW
66#ifndef OPENSSL_NO_HW_ATALLA
67
68#ifdef FLAT_INC
69#include "atalla.h"
70#else
71#include "vendor_defns/atalla.h"
72#endif
73
74#define ATALLA_LIB_NAME "atalla engine"
75#include "hw_atalla_err.c"
76
77static int atalla_destroy(ENGINE *e);
78static int atalla_init(ENGINE *e);
79static int atalla_finish(ENGINE *e);
80static int atalla_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f)());
81
82/* BIGNUM stuff */
83static int atalla_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
84 const BIGNUM *m, BN_CTX *ctx);
85
86#ifndef OPENSSL_NO_RSA
87/* RSA stuff */
88static int atalla_rsa_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa);
89#endif
90/* This function is aliased to mod_exp (with the mont stuff dropped). */
91static int atalla_mod_exp_mont(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
92 const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx);
93
94#ifndef OPENSSL_NO_DSA
95/* DSA stuff */
96static int atalla_dsa_mod_exp(DSA *dsa, BIGNUM *rr, BIGNUM *a1,
97 BIGNUM *p1, BIGNUM *a2, BIGNUM *p2, BIGNUM *m,
98 BN_CTX *ctx, BN_MONT_CTX *in_mont);
99static int atalla_mod_exp_dsa(DSA *dsa, BIGNUM *r, BIGNUM *a,
100 const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx,
101 BN_MONT_CTX *m_ctx);
102#endif
103
104#ifndef OPENSSL_NO_DH
105/* DH stuff */
106/* This function is alised to mod_exp (with the DH and mont dropped). */
107static int atalla_mod_exp_dh(const DH *dh, BIGNUM *r,
108 const BIGNUM *a, const BIGNUM *p,
109 const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx);
110#endif
111
112/* The definitions for control commands specific to this engine */
113#define ATALLA_CMD_SO_PATH ENGINE_CMD_BASE
114static const ENGINE_CMD_DEFN atalla_cmd_defns[] = {
115 {ATALLA_CMD_SO_PATH,
116 "SO_PATH",
117 "Specifies the path to the 'atasi' shared library",
118 ENGINE_CMD_FLAG_STRING},
119 {0, NULL, NULL, 0}
120 };
121
122#ifndef OPENSSL_NO_RSA
123/* Our internal RSA_METHOD that we provide pointers to */
124static RSA_METHOD atalla_rsa =
125 {
126 "Atalla RSA method",
127 NULL,
128 NULL,
129 NULL,
130 NULL,
131 atalla_rsa_mod_exp,
132 atalla_mod_exp_mont,
133 NULL,
134 NULL,
135 0,
136 NULL,
137 NULL,
138 NULL
139 };
140#endif
141
142#ifndef OPENSSL_NO_DSA
143/* Our internal DSA_METHOD that we provide pointers to */
144static DSA_METHOD atalla_dsa =
145 {
146 "Atalla DSA method",
147 NULL, /* dsa_do_sign */
148 NULL, /* dsa_sign_setup */
149 NULL, /* dsa_do_verify */
150 atalla_dsa_mod_exp, /* dsa_mod_exp */
151 atalla_mod_exp_dsa, /* bn_mod_exp */
152 NULL, /* init */
153 NULL, /* finish */
154 0, /* flags */
155 NULL /* app_data */
156 };
157#endif
158
159#ifndef OPENSSL_NO_DH
160/* Our internal DH_METHOD that we provide pointers to */
161static DH_METHOD atalla_dh =
162 {
163 "Atalla DH method",
164 NULL,
165 NULL,
166 atalla_mod_exp_dh,
167 NULL,
168 NULL,
169 0,
170 NULL
171 };
172#endif
173
174/* Constants used when creating the ENGINE */
175static const char *engine_atalla_id = "atalla";
176static const char *engine_atalla_name = "Atalla hardware engine support";
177
178/* This internal function is used by ENGINE_atalla() and possibly by the
179 * "dynamic" ENGINE support too */
180static int bind_helper(ENGINE *e)
181 {
182#ifndef OPENSSL_NO_RSA
183 const RSA_METHOD *meth1;
184#endif
185#ifndef OPENSSL_NO_DSA
186 const DSA_METHOD *meth2;
187#endif
188#ifndef OPENSSL_NO_DH
189 const DH_METHOD *meth3;
190#endif
191 if(!ENGINE_set_id(e, engine_atalla_id) ||
192 !ENGINE_set_name(e, engine_atalla_name) ||
193#ifndef OPENSSL_NO_RSA
194 !ENGINE_set_RSA(e, &atalla_rsa) ||
195#endif
196#ifndef OPENSSL_NO_DSA
197 !ENGINE_set_DSA(e, &atalla_dsa) ||
198#endif
199#ifndef OPENSSL_NO_DH
200 !ENGINE_set_DH(e, &atalla_dh) ||
201#endif
202 !ENGINE_set_destroy_function(e, atalla_destroy) ||
203 !ENGINE_set_init_function(e, atalla_init) ||
204 !ENGINE_set_finish_function(e, atalla_finish) ||
205 !ENGINE_set_ctrl_function(e, atalla_ctrl) ||
206 !ENGINE_set_cmd_defns(e, atalla_cmd_defns))
207 return 0;
208
209#ifndef OPENSSL_NO_RSA
210 /* We know that the "PKCS1_SSLeay()" functions hook properly
211 * to the atalla-specific mod_exp and mod_exp_crt so we use
212 * those functions. NB: We don't use ENGINE_openssl() or
213 * anything "more generic" because something like the RSAref
214 * code may not hook properly, and if you own one of these
215 * cards then you have the right to do RSA operations on it
216 * anyway! */
217 meth1 = RSA_PKCS1_SSLeay();
218 atalla_rsa.rsa_pub_enc = meth1->rsa_pub_enc;
219 atalla_rsa.rsa_pub_dec = meth1->rsa_pub_dec;
220 atalla_rsa.rsa_priv_enc = meth1->rsa_priv_enc;
221 atalla_rsa.rsa_priv_dec = meth1->rsa_priv_dec;
222#endif
223
224#ifndef OPENSSL_NO_DSA
225 /* Use the DSA_OpenSSL() method and just hook the mod_exp-ish
226 * bits. */
227 meth2 = DSA_OpenSSL();
228 atalla_dsa.dsa_do_sign = meth2->dsa_do_sign;
229 atalla_dsa.dsa_sign_setup = meth2->dsa_sign_setup;
230 atalla_dsa.dsa_do_verify = meth2->dsa_do_verify;
231#endif
232
233#ifndef OPENSSL_NO_DH
234 /* Much the same for Diffie-Hellman */
235 meth3 = DH_OpenSSL();
236 atalla_dh.generate_key = meth3->generate_key;
237 atalla_dh.compute_key = meth3->compute_key;
238#endif
239
240 /* Ensure the atalla error handling is set up */
241 ERR_load_ATALLA_strings();
242 return 1;
243 }
244
245#ifndef ENGINE_DYNAMIC_SUPPORT
246static ENGINE *engine_atalla(void)
247 {
248 ENGINE *ret = ENGINE_new();
249 if(!ret)
250 return NULL;
251 if(!bind_helper(ret))
252 {
253 ENGINE_free(ret);
254 return NULL;
255 }
256 return ret;
257 }
258
259void ENGINE_load_atalla(void)
260 {
261 /* Copied from eng_[openssl|dyn].c */
262 ENGINE *toadd = engine_atalla();
263 if(!toadd) return;
264 ENGINE_add(toadd);
265 ENGINE_free(toadd);
266 ERR_clear_error();
267 }
268#endif
269
270/* This is a process-global DSO handle used for loading and unloading
271 * the Atalla library. NB: This is only set (or unset) during an
272 * init() or finish() call (reference counts permitting) and they're
273 * operating with global locks, so this should be thread-safe
274 * implicitly. */
275static DSO *atalla_dso = NULL;
276
277/* These are the function pointers that are (un)set when the library has
278 * successfully (un)loaded. */
279static tfnASI_GetHardwareConfig *p_Atalla_GetHardwareConfig = NULL;
280static tfnASI_RSAPrivateKeyOpFn *p_Atalla_RSAPrivateKeyOpFn = NULL;
281static tfnASI_GetPerformanceStatistics *p_Atalla_GetPerformanceStatistics = NULL;
282
283/* These are the static string constants for the DSO file name and the function
284 * symbol names to bind to. Regrettably, the DSO name on *nix appears to be
285 * "atasi.so" rather than something more consistent like "libatasi.so". At the
286 * time of writing, I'm not sure what the file name on win32 is but clearly
287 * native name translation is not possible (eg libatasi.so on *nix, and
288 * atasi.dll on win32). For the purposes of testing, I have created a symbollic
289 * link called "libatasi.so" so that we can use native name-translation - a
290 * better solution will be needed. */
291static const char *ATALLA_LIBNAME = NULL;
292static const char *get_ATALLA_LIBNAME(void)
293 {
294 if(ATALLA_LIBNAME)
295 return ATALLA_LIBNAME;
296 return "atasi";
297 }
298static void free_ATALLA_LIBNAME(void)
299 {
300 if(ATALLA_LIBNAME)
301 OPENSSL_free((void*)ATALLA_LIBNAME);
302 ATALLA_LIBNAME = NULL;
303 }
304static long set_ATALLA_LIBNAME(const char *name)
305 {
306 free_ATALLA_LIBNAME();
307 return (((ATALLA_LIBNAME = BUF_strdup(name)) != NULL) ? 1 : 0);
308 }
309static const char *ATALLA_F1 = "ASI_GetHardwareConfig";
310static const char *ATALLA_F2 = "ASI_RSAPrivateKeyOpFn";
311static const char *ATALLA_F3 = "ASI_GetPerformanceStatistics";
312
313/* Destructor (complements the "ENGINE_atalla()" constructor) */
314static int atalla_destroy(ENGINE *e)
315 {
316 free_ATALLA_LIBNAME();
317 /* Unload the atalla error strings so any error state including our
318 * functs or reasons won't lead to a segfault (they simply get displayed
319 * without corresponding string data because none will be found). */
320 ERR_unload_ATALLA_strings();
321 return 1;
322 }
323
324/* (de)initialisation functions. */
325static int atalla_init(ENGINE *e)
326 {
327 tfnASI_GetHardwareConfig *p1;
328 tfnASI_RSAPrivateKeyOpFn *p2;
329 tfnASI_GetPerformanceStatistics *p3;
330 /* Not sure of the origin of this magic value, but Ben's code had it
331 * and it seemed to have been working for a few people. :-) */
332 unsigned int config_buf[1024];
333
334 if(atalla_dso != NULL)
335 {
336 ATALLAerr(ATALLA_F_ATALLA_INIT,ATALLA_R_ALREADY_LOADED);
337 goto err;
338 }
339 /* Attempt to load libatasi.so/atasi.dll/whatever. Needs to be
340 * changed unfortunately because the Atalla drivers don't have
341 * standard library names that can be platform-translated well. */
342 /* TODO: Work out how to actually map to the names the Atalla
343 * drivers really use - for now a symbollic link needs to be
344 * created on the host system from libatasi.so to atasi.so on
345 * unix variants. */
346 atalla_dso = DSO_load(NULL, get_ATALLA_LIBNAME(), NULL, 0);
347 if(atalla_dso == NULL)
348 {
349 ATALLAerr(ATALLA_F_ATALLA_INIT,ATALLA_R_NOT_LOADED);
350 goto err;
351 }
352 if(!(p1 = (tfnASI_GetHardwareConfig *)DSO_bind_func(
353 atalla_dso, ATALLA_F1)) ||
354 !(p2 = (tfnASI_RSAPrivateKeyOpFn *)DSO_bind_func(
355 atalla_dso, ATALLA_F2)) ||
356 !(p3 = (tfnASI_GetPerformanceStatistics *)DSO_bind_func(
357 atalla_dso, ATALLA_F3)))
358 {
359 ATALLAerr(ATALLA_F_ATALLA_INIT,ATALLA_R_NOT_LOADED);
360 goto err;
361 }
362 /* Copy the pointers */
363 p_Atalla_GetHardwareConfig = p1;
364 p_Atalla_RSAPrivateKeyOpFn = p2;
365 p_Atalla_GetPerformanceStatistics = p3;
366 /* Perform a basic test to see if there's actually any unit
367 * running. */
368 if(p1(0L, config_buf) != 0)
369 {
370 ATALLAerr(ATALLA_F_ATALLA_INIT,ATALLA_R_UNIT_FAILURE);
371 goto err;
372 }
373 /* Everything's fine. */
374 return 1;
375err:
376 if(atalla_dso)
377 DSO_free(atalla_dso);
378 p_Atalla_GetHardwareConfig = NULL;
379 p_Atalla_RSAPrivateKeyOpFn = NULL;
380 p_Atalla_GetPerformanceStatistics = NULL;
381 return 0;
382 }
383
384static int atalla_finish(ENGINE *e)
385 {
386 free_ATALLA_LIBNAME();
387 if(atalla_dso == NULL)
388 {
389 ATALLAerr(ATALLA_F_ATALLA_FINISH,ATALLA_R_NOT_LOADED);
390 return 0;
391 }
392 if(!DSO_free(atalla_dso))
393 {
394 ATALLAerr(ATALLA_F_ATALLA_FINISH,ATALLA_R_UNIT_FAILURE);
395 return 0;
396 }
397 atalla_dso = NULL;
398 p_Atalla_GetHardwareConfig = NULL;
399 p_Atalla_RSAPrivateKeyOpFn = NULL;
400 p_Atalla_GetPerformanceStatistics = NULL;
401 return 1;
402 }
403
404static int atalla_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f)())
405 {
406 int initialised = ((atalla_dso == NULL) ? 0 : 1);
407 switch(cmd)
408 {
409 case ATALLA_CMD_SO_PATH:
410 if(p == NULL)
411 {
412 ATALLAerr(ATALLA_F_ATALLA_CTRL,ERR_R_PASSED_NULL_PARAMETER);
413 return 0;
414 }
415 if(initialised)
416 {
417 ATALLAerr(ATALLA_F_ATALLA_CTRL,ATALLA_R_ALREADY_LOADED);
418 return 0;
419 }
420 return set_ATALLA_LIBNAME((const char *)p);
421 default:
422 break;
423 }
424 ATALLAerr(ATALLA_F_ATALLA_CTRL,ATALLA_R_CTRL_COMMAND_NOT_IMPLEMENTED);
425 return 0;
426 }
427
428static int atalla_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
429 const BIGNUM *m, BN_CTX *ctx)
430 {
431 /* I need somewhere to store temporary serialised values for
432 * use with the Atalla API calls. A neat cheat - I'll use
433 * BIGNUMs from the BN_CTX but access their arrays directly as
434 * byte arrays <grin>. This way I don't have to clean anything
435 * up. */
436 BIGNUM *modulus;
437 BIGNUM *exponent;
438 BIGNUM *argument;
439 BIGNUM *result;
440 RSAPrivateKey keydata;
441 int to_return, numbytes;
442
443 modulus = exponent = argument = result = NULL;
444 to_return = 0; /* expect failure */
445
446 if(!atalla_dso)
447 {
448 ATALLAerr(ATALLA_F_ATALLA_MOD_EXP,ATALLA_R_NOT_LOADED);
449 goto err;
450 }
451 /* Prepare the params */
452 BN_CTX_start(ctx);
453 modulus = BN_CTX_get(ctx);
454 exponent = BN_CTX_get(ctx);
455 argument = BN_CTX_get(ctx);
456 result = BN_CTX_get(ctx);
457 if (!result)
458 {
459 ATALLAerr(ATALLA_F_ATALLA_MOD_EXP,ATALLA_R_BN_CTX_FULL);
460 goto err;
461 }
462 if(!bn_wexpand(modulus, m->top) || !bn_wexpand(exponent, m->top) ||
463 !bn_wexpand(argument, m->top) || !bn_wexpand(result, m->top))
464 {
465 ATALLAerr(ATALLA_F_ATALLA_MOD_EXP,ATALLA_R_BN_EXPAND_FAIL);
466 goto err;
467 }
468 /* Prepare the key-data */
469 memset(&keydata, 0,sizeof keydata);
470 numbytes = BN_num_bytes(m);
471 memset(exponent->d, 0, numbytes);
472 memset(modulus->d, 0, numbytes);
473 BN_bn2bin(p, (unsigned char *)exponent->d + numbytes - BN_num_bytes(p));
474 BN_bn2bin(m, (unsigned char *)modulus->d + numbytes - BN_num_bytes(m));
475 keydata.privateExponent.data = (unsigned char *)exponent->d;
476 keydata.privateExponent.len = numbytes;
477 keydata.modulus.data = (unsigned char *)modulus->d;
478 keydata.modulus.len = numbytes;
479 /* Prepare the argument */
480 memset(argument->d, 0, numbytes);
481 memset(result->d, 0, numbytes);
482 BN_bn2bin(a, (unsigned char *)argument->d + numbytes - BN_num_bytes(a));
483 /* Perform the operation */
484 if(p_Atalla_RSAPrivateKeyOpFn(&keydata, (unsigned char *)result->d,
485 (unsigned char *)argument->d,
486 keydata.modulus.len) != 0)
487 {
488 ATALLAerr(ATALLA_F_ATALLA_MOD_EXP,ATALLA_R_REQUEST_FAILED);
489 goto err;
490 }
491 /* Convert the response */
492 BN_bin2bn((unsigned char *)result->d, numbytes, r);
493 to_return = 1;
494err:
495 BN_CTX_end(ctx);
496 return to_return;
497 }
498
499#ifndef OPENSSL_NO_RSA
500static int atalla_rsa_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa)
501 {
502 BN_CTX *ctx = NULL;
503 int to_return = 0;
504
505 if(!atalla_dso)
506 {
507 ATALLAerr(ATALLA_F_ATALLA_RSA_MOD_EXP,ATALLA_R_NOT_LOADED);
508 goto err;
509 }
510 if((ctx = BN_CTX_new()) == NULL)
511 goto err;
512 if(!rsa->d || !rsa->n)
513 {
514 ATALLAerr(ATALLA_F_ATALLA_RSA_MOD_EXP,ATALLA_R_MISSING_KEY_COMPONENTS);
515 goto err;
516 }
517 to_return = atalla_mod_exp(r0, I, rsa->d, rsa->n, ctx);
518err:
519 if(ctx)
520 BN_CTX_free(ctx);
521 return to_return;
522 }
523#endif
524
525#ifndef OPENSSL_NO_DSA
526/* This code was liberated and adapted from the commented-out code in
527 * dsa_ossl.c. Because of the unoptimised form of the Atalla acceleration
528 * (it doesn't have a CRT form for RSA), this function means that an
529 * Atalla system running with a DSA server certificate can handshake
530 * around 5 or 6 times faster/more than an equivalent system running with
531 * RSA. Just check out the "signs" statistics from the RSA and DSA parts
532 * of "openssl speed -engine atalla dsa1024 rsa1024". */
533static int atalla_dsa_mod_exp(DSA *dsa, BIGNUM *rr, BIGNUM *a1,
534 BIGNUM *p1, BIGNUM *a2, BIGNUM *p2, BIGNUM *m,
535 BN_CTX *ctx, BN_MONT_CTX *in_mont)
536 {
537 BIGNUM t;
538 int to_return = 0;
539
540 BN_init(&t);
541 /* let rr = a1 ^ p1 mod m */
542 if (!atalla_mod_exp(rr,a1,p1,m,ctx)) goto end;
543 /* let t = a2 ^ p2 mod m */
544 if (!atalla_mod_exp(&t,a2,p2,m,ctx)) goto end;
545 /* let rr = rr * t mod m */
546 if (!BN_mod_mul(rr,rr,&t,m,ctx)) goto end;
547 to_return = 1;
548end:
549 BN_free(&t);
550 return to_return;
551 }
552
553static int atalla_mod_exp_dsa(DSA *dsa, BIGNUM *r, BIGNUM *a,
554 const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx,
555 BN_MONT_CTX *m_ctx)
556 {
557 return atalla_mod_exp(r, a, p, m, ctx);
558 }
559#endif
560
561/* This function is aliased to mod_exp (with the mont stuff dropped). */
562static int atalla_mod_exp_mont(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
563 const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx)
564 {
565 return atalla_mod_exp(r, a, p, m, ctx);
566 }
567
568#ifndef OPENSSL_NO_DH
569/* This function is aliased to mod_exp (with the dh and mont dropped). */
570static int atalla_mod_exp_dh(const DH *dh, BIGNUM *r,
571 const BIGNUM *a, const BIGNUM *p,
572 const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx)
573 {
574 return atalla_mod_exp(r, a, p, m, ctx);
575 }
576#endif
577
578/* This stuff is needed if this ENGINE is being compiled into a self-contained
579 * shared-library. */
580#ifdef ENGINE_DYNAMIC_SUPPORT
581static int bind_fn(ENGINE *e, const char *id)
582 {
583 if(id && (strcmp(id, engine_atalla_id) != 0))
584 return 0;
585 if(!bind_helper(e))
586 return 0;
587 return 1;
588 }
589IMPLEMENT_DYNAMIC_CHECK_FN()
590IMPLEMENT_DYNAMIC_BIND_FN(bind_fn)
591#endif /* ENGINE_DYNAMIC_SUPPORT */
592
593#endif /* !OPENSSL_NO_HW_ATALLA */
594#endif /* !OPENSSL_NO_HW */
diff --git a/src/lib/libcrypto/engine/hw_atalla_err.c b/src/lib/libcrypto/engine/hw_atalla_err.c
new file mode 100644
index 0000000000..1df9c4570c
--- /dev/null
+++ b/src/lib/libcrypto/engine/hw_atalla_err.c
@@ -0,0 +1,145 @@
1/* hw_atalla_err.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/* 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 "hw_atalla_err.h"
64
65/* BEGIN ERROR CODES */
66#ifndef OPENSSL_NO_ERR
67static ERR_STRING_DATA ATALLA_str_functs[]=
68 {
69{ERR_PACK(0,ATALLA_F_ATALLA_CTRL,0), "ATALLA_CTRL"},
70{ERR_PACK(0,ATALLA_F_ATALLA_FINISH,0), "ATALLA_FINISH"},
71{ERR_PACK(0,ATALLA_F_ATALLA_INIT,0), "ATALLA_INIT"},
72{ERR_PACK(0,ATALLA_F_ATALLA_MOD_EXP,0), "ATALLA_MOD_EXP"},
73{ERR_PACK(0,ATALLA_F_ATALLA_RSA_MOD_EXP,0), "ATALLA_RSA_MOD_EXP"},
74{0,NULL}
75 };
76
77static ERR_STRING_DATA ATALLA_str_reasons[]=
78 {
79{ATALLA_R_ALREADY_LOADED ,"already loaded"},
80{ATALLA_R_BN_CTX_FULL ,"bn ctx full"},
81{ATALLA_R_BN_EXPAND_FAIL ,"bn expand fail"},
82{ATALLA_R_CTRL_COMMAND_NOT_IMPLEMENTED ,"ctrl command not implemented"},
83{ATALLA_R_MISSING_KEY_COMPONENTS ,"missing key components"},
84{ATALLA_R_NOT_LOADED ,"not loaded"},
85{ATALLA_R_REQUEST_FAILED ,"request failed"},
86{ATALLA_R_UNIT_FAILURE ,"unit failure"},
87{0,NULL}
88 };
89
90#endif
91
92#ifdef ATALLA_LIB_NAME
93static ERR_STRING_DATA ATALLA_lib_name[]=
94 {
95{0 ,ATALLA_LIB_NAME},
96{0,NULL}
97 };
98#endif
99
100
101static int ATALLA_lib_error_code=0;
102static int ATALLA_error_init=1;
103
104static void ERR_load_ATALLA_strings(void)
105 {
106 if (ATALLA_lib_error_code == 0)
107 ATALLA_lib_error_code=ERR_get_next_error_library();
108
109 if (ATALLA_error_init)
110 {
111 ATALLA_error_init=0;
112#ifndef OPENSSL_NO_ERR
113 ERR_load_strings(ATALLA_lib_error_code,ATALLA_str_functs);
114 ERR_load_strings(ATALLA_lib_error_code,ATALLA_str_reasons);
115#endif
116
117#ifdef ATALLA_LIB_NAME
118 ATALLA_lib_name->error = ERR_PACK(ATALLA_lib_error_code,0,0);
119 ERR_load_strings(0,ATALLA_lib_name);
120#endif
121 }
122 }
123
124static void ERR_unload_ATALLA_strings(void)
125 {
126 if (ATALLA_error_init == 0)
127 {
128#ifndef OPENSSL_NO_ERR
129 ERR_unload_strings(ATALLA_lib_error_code,ATALLA_str_functs);
130 ERR_unload_strings(ATALLA_lib_error_code,ATALLA_str_reasons);
131#endif
132
133#ifdef ATALLA_LIB_NAME
134 ERR_unload_strings(0,ATALLA_lib_name);
135#endif
136 ATALLA_error_init=1;
137 }
138 }
139
140static void ERR_ATALLA_error(int function, int reason, char *file, int line)
141 {
142 if (ATALLA_lib_error_code == 0)
143 ATALLA_lib_error_code=ERR_get_next_error_library();
144 ERR_PUT_error(ATALLA_lib_error_code,function,reason,file,line);
145 }
diff --git a/src/lib/libcrypto/engine/hw_atalla_err.h b/src/lib/libcrypto/engine/hw_atalla_err.h
new file mode 100644
index 0000000000..cdac052d8c
--- /dev/null
+++ b/src/lib/libcrypto/engine/hw_atalla_err.h
@@ -0,0 +1,89 @@
1/* ====================================================================
2 * Copyright (c) 2001 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_ATALLA_ERR_H
56#define HEADER_ATALLA_ERR_H
57
58/* BEGIN ERROR CODES */
59/* The following lines are auto generated by the script mkerr.pl. Any changes
60 * made after this point may be overwritten when the script is next run.
61 */
62static void ERR_load_ATALLA_strings(void);
63static void ERR_unload_ATALLA_strings(void);
64static void ERR_ATALLA_error(int function, int reason, char *file, int line);
65#define ATALLAerr(f,r) ERR_ATALLA_error((f),(r),__FILE__,__LINE__)
66
67/* Error codes for the ATALLA functions. */
68
69/* Function codes. */
70#define ATALLA_F_ATALLA_CTRL 100
71#define ATALLA_F_ATALLA_FINISH 101
72#define ATALLA_F_ATALLA_INIT 102
73#define ATALLA_F_ATALLA_MOD_EXP 103
74#define ATALLA_F_ATALLA_RSA_MOD_EXP 104
75
76/* Reason codes. */
77#define ATALLA_R_ALREADY_LOADED 100
78#define ATALLA_R_BN_CTX_FULL 101
79#define ATALLA_R_BN_EXPAND_FAIL 102
80#define ATALLA_R_CTRL_COMMAND_NOT_IMPLEMENTED 103
81#define ATALLA_R_MISSING_KEY_COMPONENTS 104
82#define ATALLA_R_NOT_LOADED 105
83#define ATALLA_R_REQUEST_FAILED 106
84#define ATALLA_R_UNIT_FAILURE 107
85
86#ifdef __cplusplus
87}
88#endif
89#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..d3b186c132
--- /dev/null
+++ b/src/lib/libcrypto/engine/hw_cryptodev.c
@@ -0,0 +1,1354 @@
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 <stdio.h>
60#include <unistd.h>
61#include <fcntl.h>
62#include <stdarg.h>
63#include <syslog.h>
64#include <errno.h>
65#include <string.h>
66
67#ifdef __i386__
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
77struct dev_crypto_state {
78 struct session_op d_sess;
79 int d_fd;
80};
81
82struct dev_crypto_cipher {
83 int c_id;
84 int c_nid;
85 int c_ivmax;
86 int c_keylen;
87};
88
89static u_int32_t cryptodev_asymfeat = 0;
90
91static int get_asym_dev_crypto(void);
92static int open_dev_crypto(void);
93static int get_dev_crypto(void);
94static struct dev_crypto_cipher *cipher_nid_to_cryptodev(int nid);
95static int get_cryptodev_ciphers(const int **cnids);
96/*static int get_cryptodev_digests(const int **cnids);*/
97static int cryptodev_usable_ciphers(const int **nids);
98static int cryptodev_usable_digests(const int **nids);
99static int cryptodev_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
100 const unsigned char *in, unsigned int inl);
101static int cryptodev_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
102 const unsigned char *iv, int enc);
103static int cryptodev_cleanup(EVP_CIPHER_CTX *ctx);
104static int cryptodev_engine_ciphers(ENGINE *e, const EVP_CIPHER **cipher,
105 const int **nids, int nid);
106static int cryptodev_engine_digests(ENGINE *e, const EVP_MD **digest,
107 const int **nids, int nid);
108static int bn2crparam(const BIGNUM *a, struct crparam *crp);
109static int crparam2bn(struct crparam *crp, BIGNUM *a);
110static void zapparams(struct crypt_kop *kop);
111static int cryptodev_asym(struct crypt_kop *kop, int rlen, BIGNUM *r,
112 int slen, BIGNUM *s);
113
114static int cryptodev_bn_mod_exp(BIGNUM *r, const BIGNUM *a,
115 const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx);
116static int cryptodev_rsa_nocrt_mod_exp(BIGNUM *r0, const BIGNUM *I,
117 RSA *rsa);
118static int cryptodev_rsa_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa);
119static int cryptodev_dsa_bn_mod_exp(DSA *dsa, BIGNUM *r, BIGNUM *a,
120 const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx);
121static int cryptodev_dsa_dsa_mod_exp(DSA *dsa, BIGNUM *t1, BIGNUM *g,
122 BIGNUM *u1, BIGNUM *pub_key, BIGNUM *u2, BIGNUM *p,
123 BN_CTX *ctx, BN_MONT_CTX *mont);
124static DSA_SIG *cryptodev_dsa_do_sign(const unsigned char *dgst,
125 int dlen, DSA *dsa);
126static int cryptodev_dsa_verify(const unsigned char *dgst, int dgst_len,
127 DSA_SIG *sig, DSA *dsa);
128static int cryptodev_mod_exp_dh(const DH *dh, BIGNUM *r, const BIGNUM *a,
129 const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx,
130 BN_MONT_CTX *m_ctx);
131static int cryptodev_dh_compute_key(unsigned char *key,
132 const BIGNUM *pub_key, DH *dh);
133static int cryptodev_ctrl(ENGINE *e, int cmd, long i, void *p,
134 void (*f)());
135void ENGINE_load_cryptodev(void);
136
137static const ENGINE_CMD_DEFN cryptodev_defns[] = {
138 { 0, NULL, NULL, 0 }
139};
140
141static struct dev_crypto_cipher ciphers[] = {
142 { CRYPTO_DES_CBC, NID_des_cbc, 8, 8, },
143 { CRYPTO_3DES_CBC, NID_des_ede3_cbc, 8, 24, },
144 { CRYPTO_AES_CBC, NID_aes_128_cbc, 16, 16, },
145 { CRYPTO_AES_CBC, NID_aes_192_cbc, 16, 24, },
146 { CRYPTO_AES_CBC, NID_aes_256_cbc, 16, 32, },
147 { CRYPTO_BLF_CBC, NID_bf_cbc, 8, 16, },
148 { CRYPTO_CAST_CBC, NID_cast5_cbc, 8, 16, },
149 { CRYPTO_SKIPJACK_CBC, NID_undef, 0, 0, },
150 { 0, NID_undef, 0, 0, },
151};
152
153#if 0 /* UNUSED */
154static struct {
155 int id;
156 int nid;
157} digests[] = {
158 { CRYPTO_SHA1_HMAC, NID_hmacWithSHA1, },
159 { CRYPTO_RIPEMD160_HMAC, NID_ripemd160, },
160 { CRYPTO_MD5_KPDK, NID_undef, },
161 { CRYPTO_SHA1_KPDK, NID_undef, },
162 { CRYPTO_MD5, NID_md5, },
163 { CRYPTO_SHA1, NID_undef, },
164 { 0, NID_undef, },
165};
166#endif
167
168/*
169 * Return a fd if /dev/crypto seems usable, -1 otherwise.
170 */
171static int
172open_dev_crypto(void)
173{
174 static int fd = -1;
175
176 if (fd == -1) {
177 if ((fd = open("/dev/crypto", O_RDWR, 0)) == -1)
178 return (-1);
179 /* close on exec */
180 if (fcntl(fd, F_SETFD, 1) == -1) {
181 close(fd);
182 fd = -1;
183 return (-1);
184 }
185 }
186 return (fd);
187}
188
189static int
190get_dev_crypto(void)
191{
192 int fd, retfd;
193
194 if ((fd = open_dev_crypto()) == -1)
195 return (-1);
196 if (ioctl(fd, CRIOGET, &retfd) == -1) {
197 close(fd);
198 return (-1);
199 }
200
201 /* close on exec */
202 if (fcntl(retfd, F_SETFD, 1) == -1) {
203 close(retfd);
204 return (-1);
205 }
206 return (retfd);
207}
208
209/* Caching version for asym operations */
210static int
211get_asym_dev_crypto(void)
212{
213 static int fd = -1;
214
215 if (fd == -1)
216 fd = get_dev_crypto();
217 return fd;
218}
219
220/* convert libcrypto nids to cryptodev */
221static struct dev_crypto_cipher *
222cipher_nid_to_cryptodev(int nid)
223{
224 int i;
225
226 for (i = 0; ciphers[i].c_id; i++)
227 if (ciphers[i].c_nid == nid)
228 return (&ciphers[i]);
229 return (NULL);
230}
231
232/*
233 * Find out what ciphers /dev/crypto will let us have a session for.
234 * XXX note, that some of these openssl doesn't deal with yet!
235 * returning them here is harmless, as long as we return NULL
236 * when asked for a handler in the cryptodev_engine_ciphers routine
237 */
238static int
239get_cryptodev_ciphers(const int **cnids)
240{
241 static int nids[CRYPTO_ALGORITHM_MAX];
242 struct session_op sess;
243 int fd, i, count = 0;
244
245 if ((fd = get_dev_crypto()) < 0) {
246 *cnids = NULL;
247 return (0);
248 }
249 memset(&sess, 0, sizeof(sess));
250 sess.key = (caddr_t)"123456781234567812345678";
251
252 for (i = 0; ciphers[i].c_id && count < CRYPTO_ALGORITHM_MAX; i++) {
253 if (ciphers[i].c_nid == NID_undef)
254 continue;
255 sess.cipher = ciphers[i].c_id;
256 sess.keylen = ciphers[i].c_keylen;
257 sess.mac = 0;
258 if (ioctl(fd, CIOCGSESSION, &sess) != -1 &&
259 ioctl(fd, CIOCFSESSION, &sess.ses) != -1)
260 nids[count++] = ciphers[i].c_nid;
261 }
262 close(fd);
263
264#if defined(__i386__)
265 /*
266 * On i386, always check for the VIA C3 AES instructions;
267 * even if /dev/crypto is disabled.
268 */
269 if (check_viac3aes() >= 1) {
270 int have_NID_aes_128_cbc = 0;
271 int have_NID_aes_192_cbc = 0;
272 int have_NID_aes_256_cbc = 0;
273
274 for (i = 0; i < count; i++) {
275 if (nids[i] == NID_aes_128_cbc)
276 have_NID_aes_128_cbc = 1;
277 if (nids[i] == NID_aes_192_cbc)
278 have_NID_aes_192_cbc = 1;
279 if (nids[i] == NID_aes_256_cbc)
280 have_NID_aes_256_cbc = 1;
281 }
282 if (!have_NID_aes_128_cbc)
283 nids[count++] = NID_aes_128_cbc;
284 if (!have_NID_aes_192_cbc)
285 nids[count++] = NID_aes_192_cbc;
286 if (!have_NID_aes_256_cbc)
287 nids[count++] = NID_aes_256_cbc;
288 }
289#endif
290
291 if (count > 0)
292 *cnids = nids;
293 else
294 *cnids = NULL;
295 return (count);
296}
297
298/*
299 * Find out what digests /dev/crypto will let us have a session for.
300 * XXX note, that some of these openssl doesn't deal with yet!
301 * returning them here is harmless, as long as we return NULL
302 * when asked for a handler in the cryptodev_engine_digests routine
303 */
304#if 0 /* UNUSED */
305static int
306get_cryptodev_digests(const int **cnids)
307{
308 static int nids[CRYPTO_ALGORITHM_MAX];
309 struct session_op sess;
310 int fd, i, count = 0;
311
312 if ((fd = get_dev_crypto()) < 0) {
313 *cnids = NULL;
314 return (0);
315 }
316 memset(&sess, 0, sizeof(sess));
317 for (i = 0; digests[i].id && count < CRYPTO_ALGORITHM_MAX; i++) {
318 if (digests[i].nid == NID_undef)
319 continue;
320 sess.mac = digests[i].id;
321 sess.cipher = 0;
322 if (ioctl(fd, CIOCGSESSION, &sess) != -1 &&
323 ioctl(fd, CIOCFSESSION, &sess.ses) != -1)
324 nids[count++] = digests[i].nid;
325 }
326 close(fd);
327
328 if (count > 0)
329 *cnids = nids;
330 else
331 *cnids = NULL;
332 return (count);
333}
334#endif
335
336/*
337 * Find the useable ciphers|digests from dev/crypto - this is the first
338 * thing called by the engine init crud which determines what it
339 * can use for ciphers from this engine. We want to return
340 * only what we can do, anythine else is handled by software.
341 *
342 * If we can't initialize the device to do anything useful for
343 * any reason, we want to return a NULL array, and 0 length,
344 * which forces everything to be done is software. By putting
345 * the initalization of the device in here, we ensure we can
346 * use this engine as the default, and if for whatever reason
347 * /dev/crypto won't do what we want it will just be done in
348 * software
349 *
350 * This can (should) be greatly expanded to perhaps take into
351 * account speed of the device, and what we want to do.
352 * (although the disabling of particular alg's could be controlled
353 * by the device driver with sysctl's.) - this is where we
354 * want most of the decisions made about what we actually want
355 * to use from /dev/crypto.
356 */
357static int
358cryptodev_usable_ciphers(const int **nids)
359{
360 return (get_cryptodev_ciphers(nids));
361}
362
363static int
364cryptodev_usable_digests(const int **nids)
365{
366 /*
367 * XXXX just disable all digests for now, because it sucks.
368 * we need a better way to decide this - i.e. I may not
369 * want digests on slow cards like hifn on fast machines,
370 * but might want them on slow or loaded machines, etc.
371 * will also want them when using crypto cards that don't
372 * suck moose gonads - would be nice to be able to decide something
373 * as reasonable default without having hackery that's card dependent.
374 * of course, the default should probably be just do everything,
375 * with perhaps a sysctl to turn algoritms off (or have them off
376 * by default) on cards that generally suck like the hifn.
377 */
378 *nids = NULL;
379 return (0);
380}
381
382static int
383cryptodev_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
384 const unsigned char *in, unsigned int inl)
385{
386 struct crypt_op cryp;
387 struct dev_crypto_state *state = ctx->cipher_data;
388 struct session_op *sess = &state->d_sess;
389 void *iiv;
390 unsigned char save_iv[EVP_MAX_IV_LENGTH];
391
392 if (state->d_fd < 0)
393 return (0);
394 if (!inl)
395 return (1);
396 if ((inl % ctx->cipher->block_size) != 0)
397 return (0);
398
399 memset(&cryp, 0, sizeof(cryp));
400
401 cryp.ses = sess->ses;
402 cryp.flags = 0;
403 cryp.len = inl;
404 cryp.src = (caddr_t) in;
405 cryp.dst = (caddr_t) out;
406 cryp.mac = 0;
407
408 cryp.op = ctx->encrypt ? COP_ENCRYPT : COP_DECRYPT;
409
410 if (ctx->cipher->iv_len) {
411 cryp.iv = (caddr_t) ctx->iv;
412 if (!ctx->encrypt) {
413 iiv = (void *) in + inl - ctx->cipher->iv_len;
414 memcpy(save_iv, iiv, ctx->cipher->iv_len);
415 }
416 } else
417 cryp.iv = NULL;
418
419 if (ioctl(state->d_fd, CIOCCRYPT, &cryp) == -1) {
420 /* XXX need better errror handling
421 * this can fail for a number of different reasons.
422 */
423 return (0);
424 }
425
426 if (ctx->cipher->iv_len) {
427 if (ctx->encrypt)
428 iiv = (void *) out + inl - ctx->cipher->iv_len;
429 else
430 iiv = save_iv;
431 memcpy(ctx->iv, iiv, ctx->cipher->iv_len);
432 }
433 return (1);
434}
435
436static int
437cryptodev_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
438 const unsigned char *iv, int enc)
439{
440 struct dev_crypto_state *state = ctx->cipher_data;
441 struct session_op *sess = &state->d_sess;
442 struct dev_crypto_cipher *cipher;
443
444 if ((cipher = cipher_nid_to_cryptodev(ctx->cipher->nid)) == NULL)
445 return (0);
446
447 if (ctx->cipher->iv_len > cipher->c_ivmax)
448 return (0);
449
450 if (ctx->key_len != cipher->c_keylen)
451 return (0);
452
453 memset(sess, 0, sizeof(struct session_op));
454
455 if ((state->d_fd = get_dev_crypto()) < 0)
456 return (0);
457
458 sess->key = (unsigned char *)key;
459 sess->keylen = ctx->key_len;
460 sess->cipher = cipher->c_id;
461
462 if (ioctl(state->d_fd, CIOCGSESSION, sess) == -1) {
463 close(state->d_fd);
464 state->d_fd = -1;
465 return (0);
466 }
467 return (1);
468}
469
470/*
471 * free anything we allocated earlier when initting a
472 * session, and close the session.
473 */
474static int
475cryptodev_cleanup(EVP_CIPHER_CTX *ctx)
476{
477 int ret = 0;
478 struct dev_crypto_state *state = ctx->cipher_data;
479 struct session_op *sess = &state->d_sess;
480
481 if (state->d_fd < 0)
482 return (0);
483
484 /* XXX if this ioctl fails, someting's wrong. the invoker
485 * may have called us with a bogus ctx, or we could
486 * have a device that for whatever reason just doesn't
487 * want to play ball - it's not clear what's right
488 * here - should this be an error? should it just
489 * increase a counter, hmm. For right now, we return
490 * 0 - I don't believe that to be "right". we could
491 * call the gorpy openssl lib error handlers that
492 * print messages to users of the library. hmm..
493 */
494
495 if (ioctl(state->d_fd, CIOCFSESSION, &sess->ses) == -1) {
496 ret = 0;
497 } else {
498 ret = 1;
499 }
500 close(state->d_fd);
501 state->d_fd = -1;
502
503 return (ret);
504}
505
506/*
507 * libcrypto EVP stuff - this is how we get wired to EVP so the engine
508 * gets called when libcrypto requests a cipher NID.
509 */
510
511/* DES CBC EVP */
512const EVP_CIPHER cryptodev_des_cbc = {
513 NID_des_cbc,
514 8, 8, 8,
515 EVP_CIPH_CBC_MODE,
516 cryptodev_init_key,
517 cryptodev_cipher,
518 cryptodev_cleanup,
519 sizeof(struct dev_crypto_state),
520 EVP_CIPHER_set_asn1_iv,
521 EVP_CIPHER_get_asn1_iv,
522 NULL
523};
524
525/* 3DES CBC EVP */
526const EVP_CIPHER cryptodev_3des_cbc = {
527 NID_des_ede3_cbc,
528 8, 24, 8,
529 EVP_CIPH_CBC_MODE,
530 cryptodev_init_key,
531 cryptodev_cipher,
532 cryptodev_cleanup,
533 sizeof(struct dev_crypto_state),
534 EVP_CIPHER_set_asn1_iv,
535 EVP_CIPHER_get_asn1_iv,
536 NULL
537};
538
539const EVP_CIPHER cryptodev_bf_cbc = {
540 NID_bf_cbc,
541 8, 16, 8,
542 EVP_CIPH_CBC_MODE,
543 cryptodev_init_key,
544 cryptodev_cipher,
545 cryptodev_cleanup,
546 sizeof(struct dev_crypto_state),
547 EVP_CIPHER_set_asn1_iv,
548 EVP_CIPHER_get_asn1_iv,
549 NULL
550};
551
552const EVP_CIPHER cryptodev_cast_cbc = {
553 NID_cast5_cbc,
554 8, 16, 8,
555 EVP_CIPH_CBC_MODE,
556 cryptodev_init_key,
557 cryptodev_cipher,
558 cryptodev_cleanup,
559 sizeof(struct dev_crypto_state),
560 EVP_CIPHER_set_asn1_iv,
561 EVP_CIPHER_get_asn1_iv,
562 NULL
563};
564
565EVP_CIPHER cryptodev_aes_128_cbc = {
566 NID_aes_128_cbc,
567 16, 16, 16,
568 EVP_CIPH_CBC_MODE,
569 cryptodev_init_key,
570 cryptodev_cipher,
571 cryptodev_cleanup,
572 sizeof(struct dev_crypto_state),
573 EVP_CIPHER_set_asn1_iv,
574 EVP_CIPHER_get_asn1_iv,
575 NULL
576};
577
578EVP_CIPHER cryptodev_aes_192_cbc = {
579 NID_aes_192_cbc,
580 16, 24, 16,
581 EVP_CIPH_CBC_MODE,
582 cryptodev_init_key,
583 cryptodev_cipher,
584 cryptodev_cleanup,
585 sizeof(struct dev_crypto_state),
586 EVP_CIPHER_set_asn1_iv,
587 EVP_CIPHER_get_asn1_iv,
588 NULL
589};
590
591EVP_CIPHER cryptodev_aes_256_cbc = {
592 NID_aes_256_cbc,
593 16, 32, 16,
594 EVP_CIPH_CBC_MODE,
595 cryptodev_init_key,
596 cryptodev_cipher,
597 cryptodev_cleanup,
598 sizeof(struct dev_crypto_state),
599 EVP_CIPHER_set_asn1_iv,
600 EVP_CIPHER_get_asn1_iv,
601 NULL
602};
603
604#if defined(__i386__)
605
606static inline void
607viac3_xcrypt_cbc(int *cw, const void *src, void *dst, void *key, int rep,
608 void *iv)
609{
610#ifdef notdef
611 printf("cw %x[%x %x %x %x] src %x dst %x key %x rep %x iv %x\n",
612 cw, cw[0], cw[1], cw[2], cw[3],
613 src, dst, key, rep, iv);
614#endif
615 /*
616 * Clear bit 30 of EFLAGS.
617 */
618 __asm __volatile("pushfl; popfl");
619
620 /*
621 * Cannot simply place key into "b" register, since the compiler
622 * -pic mode uses that register; so instead we must dance a little.
623 */
624 __asm __volatile("pushl %%ebx; movl %0, %%ebx; rep xcrypt-cbc; popl %%ebx" :
625 : "mr" (key), "a" (iv), "c" (rep), "d" (cw), "S" (src), "D" (dst)
626 : "memory", "cc");
627}
628
629#define ISUNALIGNED(x) ((long)(x)) & 15
630#define DOALIGN(v) ((void *)(((long)(v) + 15) & ~15))
631
632static int
633xcrypt_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
634 const unsigned char *in, unsigned int inl)
635{
636 unsigned char *save_iv_store[EVP_MAX_IV_LENGTH + 15];
637 unsigned char *save_iv = DOALIGN(save_iv_store);
638 unsigned char *ivs_store[EVP_MAX_IV_LENGTH + 15];
639 unsigned char *ivs = DOALIGN(ivs_store);
640 void *iiv, *iv = NULL, *ivp = NULL;
641 const void *usein = in;
642 void *useout = out, *spare;
643 int cws[4 + 3], *cw = DOALIGN(cws);
644
645 if (!inl)
646 return (1);
647 if ((inl % ctx->cipher->block_size) != 0)
648 return (0);
649
650 if (ISUNALIGNED(in) || ISUNALIGNED(out)) {
651 spare = malloc(inl);
652 if (spare == NULL)
653 return (0);
654
655 if (ISUNALIGNED(in)) {
656 bcopy(in, spare, inl);
657 usein = spare;
658 }
659 if (ISUNALIGNED(out))
660 useout = spare;
661 }
662
663 cw[0] = C3_CRYPT_CWLO_ALG_AES | C3_CRYPT_CWLO_KEYGEN_SW |
664 C3_CRYPT_CWLO_NORMAL;
665 cw[0] |= ctx->encrypt ? C3_CRYPT_CWLO_ENCRYPT : C3_CRYPT_CWLO_DECRYPT;
666 cw[1] = cw[2] = cw[3] = 0;
667
668 switch (ctx->key_len * 8) {
669 case 128:
670 cw[0] |= C3_CRYPT_CWLO_KEY128;
671 break;
672 case 192:
673 cw[0] |= C3_CRYPT_CWLO_KEY192;
674 break;
675 case 256:
676 cw[0] |= C3_CRYPT_CWLO_KEY256;
677 break;
678 }
679
680 if (ctx->cipher->iv_len) {
681 iv = (caddr_t) ctx->iv;
682 if (!ctx->encrypt) {
683 iiv = (void *) in + inl - ctx->cipher->iv_len;
684 memcpy(save_iv, iiv, ctx->cipher->iv_len);
685 }
686 }
687
688 ivp = iv;
689 if (ISUNALIGNED(iv)) {
690 bcopy(iv, ivs, ctx->cipher->iv_len);
691 ivp = ivs;
692 }
693
694 viac3_xcrypt_cbc(cw, usein, useout, ctx->cipher_data, inl / 16, ivp);
695
696 if (ISUNALIGNED(out)) {
697 bcopy(spare, out, inl);
698 free(spare);
699 }
700
701 if (ivp == ivs)
702 bcopy(ivp, iv, ctx->cipher->iv_len);
703
704 if (ctx->cipher->iv_len) {
705 if (ctx->encrypt)
706 iiv = (void *) out + inl - ctx->cipher->iv_len;
707 else
708 iiv = save_iv;
709 memcpy(ctx->iv, iiv, ctx->cipher->iv_len);
710 }
711 return (1);
712}
713
714static int
715xcrypt_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
716 const unsigned char *iv, int enc)
717{
718 AES_KEY *k = ctx->cipher_data;
719#ifndef AES_ASM
720 int i;
721#endif
722
723 bzero(k, sizeof *k);
724 if (enc)
725 AES_set_encrypt_key(key, ctx->key_len * 8, k);
726 else
727 AES_set_decrypt_key(key, ctx->key_len * 8, k);
728
729#ifndef AES_ASM
730 /*
731 * XXX Damn OpenSSL byte swaps the expanded key!!
732 *
733 * XXX But only if we're using the C implementation of AES
734 */
735 for (i = 0; i < 4 * (AES_MAXNR + 1); i++)
736 k->rd_key[i] = htonl(k->rd_key[i]);
737#endif
738
739 return (1);
740}
741
742static int
743xcrypt_cleanup(EVP_CIPHER_CTX *ctx)
744{
745 bzero(ctx->cipher_data, ctx->cipher->ctx_size);
746 return (1);
747}
748
749static int
750check_viac3aes(void)
751{
752 int mib[2] = { CTL_MACHDEP, CPU_XCRYPT }, value;
753 size_t size = sizeof(value);
754
755 if (sysctl(mib, sizeof(mib)/sizeof(mib[0]), &value, &size,
756 NULL, 0) < 0)
757 return (0);
758 if (value == 0)
759 return (0);
760
761 if (value & C3_HAS_AES) {
762 cryptodev_aes_128_cbc.init = xcrypt_init_key;
763 cryptodev_aes_128_cbc.do_cipher = xcrypt_cipher;
764 cryptodev_aes_128_cbc.cleanup = xcrypt_cleanup;
765 cryptodev_aes_128_cbc.ctx_size = sizeof(AES_KEY);
766
767 cryptodev_aes_192_cbc.init = xcrypt_init_key;
768 cryptodev_aes_192_cbc.do_cipher = xcrypt_cipher;
769 cryptodev_aes_192_cbc.cleanup = xcrypt_cleanup;
770 cryptodev_aes_192_cbc.ctx_size = sizeof(AES_KEY);
771
772 cryptodev_aes_256_cbc.init = xcrypt_init_key;
773 cryptodev_aes_256_cbc.do_cipher = xcrypt_cipher;
774 cryptodev_aes_256_cbc.cleanup = xcrypt_cleanup;
775 cryptodev_aes_256_cbc.ctx_size = sizeof(AES_KEY);
776 }
777 return (value);
778}
779#endif /* __i386__ */
780
781/*
782 * Registered by the ENGINE when used to find out how to deal with
783 * a particular NID in the ENGINE. this says what we'll do at the
784 * top level - note, that list is restricted by what we answer with
785 */
786static int
787cryptodev_engine_ciphers(ENGINE *e, const EVP_CIPHER **cipher,
788 const int **nids, int nid)
789{
790 if (!cipher)
791 return (cryptodev_usable_ciphers(nids));
792
793 switch (nid) {
794 case NID_des_ede3_cbc:
795 *cipher = &cryptodev_3des_cbc;
796 break;
797 case NID_des_cbc:
798 *cipher = &cryptodev_des_cbc;
799 break;
800 case NID_bf_cbc:
801 *cipher = &cryptodev_bf_cbc;
802 break;
803 case NID_cast5_cbc:
804 *cipher = &cryptodev_cast_cbc;
805 break;
806 case NID_aes_128_cbc:
807 *cipher = &cryptodev_aes_128_cbc;
808 break;
809 case NID_aes_192_cbc:
810 *cipher = &cryptodev_aes_192_cbc;
811 break;
812 case NID_aes_256_cbc:
813 *cipher = &cryptodev_aes_256_cbc;
814 break;
815 default:
816 *cipher = NULL;
817 break;
818 }
819 return (*cipher != NULL);
820}
821
822static int
823cryptodev_engine_digests(ENGINE *e, const EVP_MD **digest,
824 const int **nids, int nid)
825{
826 if (!digest)
827 return (cryptodev_usable_digests(nids));
828
829 switch (nid) {
830 case NID_md5:
831 *digest = NULL; /* need to make a clean md5 critter */
832 break;
833 default:
834 *digest = NULL;
835 break;
836 }
837 return (*digest != NULL);
838}
839
840/*
841 * Convert a BIGNUM to the representation that /dev/crypto needs.
842 * Upon completion of use, the caller is responsible for freeing
843 * crp->crp_p.
844 */
845static int
846bn2crparam(const BIGNUM *a, struct crparam *crp)
847{
848 int i, j, k;
849 ssize_t bytes, bits;
850 u_char *b;
851
852 crp->crp_p = NULL;
853 crp->crp_nbits = 0;
854
855 bits = BN_num_bits(a);
856 bytes = (bits + 7) / 8;
857
858 b = malloc(bytes);
859 if (b == NULL)
860 return (1);
861
862 crp->crp_p = b;
863 crp->crp_nbits = bits;
864
865 for (i = 0, j = 0; i < a->top; i++) {
866 for (k = 0; k < BN_BITS2 / 8; k++) {
867 if ((j + k) >= bytes)
868 return (0);
869 b[j + k] = a->d[i] >> (k * 8);
870 }
871 j += BN_BITS2 / 8;
872 }
873 return (0);
874}
875
876/* Convert a /dev/crypto parameter to a BIGNUM */
877static int
878crparam2bn(struct crparam *crp, BIGNUM *a)
879{
880 u_int8_t *pd;
881 int i, bytes;
882
883 bytes = (crp->crp_nbits + 7) / 8;
884
885 if (bytes == 0)
886 return (-1);
887
888 if ((pd = (u_int8_t *) malloc(bytes)) == NULL)
889 return (-1);
890
891 for (i = 0; i < bytes; i++)
892 pd[i] = crp->crp_p[bytes - i - 1];
893
894 BN_bin2bn(pd, bytes, a);
895 free(pd);
896
897 return (0);
898}
899
900static void
901zapparams(struct crypt_kop *kop)
902{
903 int i;
904
905 for (i = 0; i <= kop->crk_iparams + kop->crk_oparams; i++) {
906 if (kop->crk_param[i].crp_p)
907 free(kop->crk_param[i].crp_p);
908 kop->crk_param[i].crp_p = NULL;
909 kop->crk_param[i].crp_nbits = 0;
910 }
911}
912
913static int
914cryptodev_asym(struct crypt_kop *kop, int rlen, BIGNUM *r, int slen, BIGNUM *s)
915{
916 int fd, ret = -1;
917
918 if ((fd = get_asym_dev_crypto()) < 0)
919 return (ret);
920
921 if (r) {
922 kop->crk_param[kop->crk_iparams].crp_p = calloc(rlen, sizeof(char));
923 kop->crk_param[kop->crk_iparams].crp_nbits = rlen * 8;
924 kop->crk_oparams++;
925 }
926 if (s) {
927 kop->crk_param[kop->crk_iparams+1].crp_p = calloc(slen, sizeof(char));
928 kop->crk_param[kop->crk_iparams+1].crp_nbits = slen * 8;
929 kop->crk_oparams++;
930 }
931
932 if (ioctl(fd, CIOCKEY, kop) == 0) {
933 if (r)
934 crparam2bn(&kop->crk_param[kop->crk_iparams], r);
935 if (s)
936 crparam2bn(&kop->crk_param[kop->crk_iparams+1], s);
937 ret = 0;
938 }
939
940 return (ret);
941}
942
943static int
944cryptodev_bn_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
945 const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *in_mont)
946{
947 struct crypt_kop kop;
948 int ret = 1;
949
950 /* Currently, we know we can do mod exp iff we can do any
951 * asymmetric operations at all.
952 */
953 if (cryptodev_asymfeat == 0) {
954 ret = BN_mod_exp(r, a, p, m, ctx);
955 return (ret);
956 }
957
958 memset(&kop, 0, sizeof kop);
959 kop.crk_op = CRK_MOD_EXP;
960
961 /* inputs: a^p % m */
962 if (bn2crparam(a, &kop.crk_param[0]))
963 goto err;
964 if (bn2crparam(p, &kop.crk_param[1]))
965 goto err;
966 if (bn2crparam(m, &kop.crk_param[2]))
967 goto err;
968 kop.crk_iparams = 3;
969
970 if (cryptodev_asym(&kop, BN_num_bytes(m), r, 0, NULL) == -1) {
971 const RSA_METHOD *meth = RSA_PKCS1_SSLeay();
972 ret = meth->bn_mod_exp(r, a, p, m, ctx, in_mont);
973 }
974err:
975 zapparams(&kop);
976 return (ret);
977}
978
979static int
980cryptodev_rsa_nocrt_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa)
981{
982 int r;
983 BN_CTX *ctx;
984
985 ctx = BN_CTX_new();
986 r = cryptodev_bn_mod_exp(r0, I, rsa->d, rsa->n, ctx, NULL);
987 BN_CTX_free(ctx);
988 return (r);
989}
990
991static int
992cryptodev_rsa_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa)
993{
994 struct crypt_kop kop;
995 int ret = 1;
996
997 if (!rsa->p || !rsa->q || !rsa->dmp1 || !rsa->dmq1 || !rsa->iqmp) {
998 /* XXX 0 means failure?? */
999 return (0);
1000 }
1001
1002 memset(&kop, 0, sizeof kop);
1003 kop.crk_op = CRK_MOD_EXP_CRT;
1004 /* inputs: rsa->p rsa->q I rsa->dmp1 rsa->dmq1 rsa->iqmp */
1005 if (bn2crparam(rsa->p, &kop.crk_param[0]))
1006 goto err;
1007 if (bn2crparam(rsa->q, &kop.crk_param[1]))
1008 goto err;
1009 if (bn2crparam(I, &kop.crk_param[2]))
1010 goto err;
1011 if (bn2crparam(rsa->dmp1, &kop.crk_param[3]))
1012 goto err;
1013 if (bn2crparam(rsa->dmq1, &kop.crk_param[4]))
1014 goto err;
1015 if (bn2crparam(rsa->iqmp, &kop.crk_param[5]))
1016 goto err;
1017 kop.crk_iparams = 6;
1018
1019 if (cryptodev_asym(&kop, BN_num_bytes(rsa->n), r0, 0, NULL) == -1) {
1020 const RSA_METHOD *meth = RSA_PKCS1_SSLeay();
1021 ret = (*meth->rsa_mod_exp)(r0, I, rsa);
1022 }
1023err:
1024 zapparams(&kop);
1025 return (ret);
1026}
1027
1028static RSA_METHOD cryptodev_rsa = {
1029 "cryptodev RSA method",
1030 NULL, /* rsa_pub_enc */
1031 NULL, /* rsa_pub_dec */
1032 NULL, /* rsa_priv_enc */
1033 NULL, /* rsa_priv_dec */
1034 NULL,
1035 NULL,
1036 NULL, /* init */
1037 NULL, /* finish */
1038 0, /* flags */
1039 NULL, /* app_data */
1040 NULL, /* rsa_sign */
1041 NULL /* rsa_verify */
1042};
1043
1044static int
1045cryptodev_dsa_bn_mod_exp(DSA *dsa, BIGNUM *r, BIGNUM *a, const BIGNUM *p,
1046 const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx)
1047{
1048 return (cryptodev_bn_mod_exp(r, a, p, m, ctx, m_ctx));
1049}
1050
1051static int
1052cryptodev_dsa_dsa_mod_exp(DSA *dsa, BIGNUM *t1, BIGNUM *g,
1053 BIGNUM *u1, BIGNUM *pub_key, BIGNUM *u2, BIGNUM *p,
1054 BN_CTX *ctx, BN_MONT_CTX *mont)
1055{
1056 BIGNUM t2;
1057 int ret = 0;
1058
1059 BN_init(&t2);
1060
1061 /* v = ( g^u1 * y^u2 mod p ) mod q */
1062 /* let t1 = g ^ u1 mod p */
1063 ret = 0;
1064
1065 if (!dsa->meth->bn_mod_exp(dsa,t1,dsa->g,u1,dsa->p,ctx,mont))
1066 goto err;
1067
1068 /* let t2 = y ^ u2 mod p */
1069 if (!dsa->meth->bn_mod_exp(dsa,&t2,dsa->pub_key,u2,dsa->p,ctx,mont))
1070 goto err;
1071 /* let u1 = t1 * t2 mod p */
1072 if (!BN_mod_mul(u1,t1,&t2,dsa->p,ctx))
1073 goto err;
1074
1075 BN_copy(t1,u1);
1076
1077 ret = 1;
1078err:
1079 BN_free(&t2);
1080 return(ret);
1081}
1082
1083static DSA_SIG *
1084cryptodev_dsa_do_sign(const unsigned char *dgst, int dlen, DSA *dsa)
1085{
1086 struct crypt_kop kop;
1087 BIGNUM *r = NULL, *s = NULL;
1088 DSA_SIG *dsaret = NULL;
1089
1090 if ((r = BN_new()) == NULL)
1091 goto err;
1092 if ((s = BN_new()) == NULL) {
1093 BN_free(r);
1094 goto err;
1095 }
1096
1097 memset(&kop, 0, sizeof kop);
1098 kop.crk_op = CRK_DSA_SIGN;
1099
1100 /* inputs: dgst dsa->p dsa->q dsa->g dsa->priv_key */
1101 kop.crk_param[0].crp_p = (caddr_t)dgst;
1102 kop.crk_param[0].crp_nbits = dlen * 8;
1103 if (bn2crparam(dsa->p, &kop.crk_param[1]))
1104 goto err;
1105 if (bn2crparam(dsa->q, &kop.crk_param[2]))
1106 goto err;
1107 if (bn2crparam(dsa->g, &kop.crk_param[3]))
1108 goto err;
1109 if (bn2crparam(dsa->priv_key, &kop.crk_param[4]))
1110 goto err;
1111 kop.crk_iparams = 5;
1112
1113 if (cryptodev_asym(&kop, BN_num_bytes(dsa->q), r,
1114 BN_num_bytes(dsa->q), s) == 0) {
1115 dsaret = DSA_SIG_new();
1116 dsaret->r = r;
1117 dsaret->s = s;
1118 } else {
1119 const DSA_METHOD *meth = DSA_OpenSSL();
1120 BN_free(r);
1121 BN_free(s);
1122 dsaret = (meth->dsa_do_sign)(dgst, dlen, dsa);
1123 }
1124err:
1125 kop.crk_param[0].crp_p = NULL;
1126 zapparams(&kop);
1127 return (dsaret);
1128}
1129
1130static int
1131cryptodev_dsa_verify(const unsigned char *dgst, int dlen,
1132 DSA_SIG *sig, DSA *dsa)
1133{
1134 struct crypt_kop kop;
1135 int dsaret = 1;
1136
1137 memset(&kop, 0, sizeof kop);
1138 kop.crk_op = CRK_DSA_VERIFY;
1139
1140 /* inputs: dgst dsa->p dsa->q dsa->g dsa->pub_key sig->r sig->s */
1141 kop.crk_param[0].crp_p = (caddr_t)dgst;
1142 kop.crk_param[0].crp_nbits = dlen * 8;
1143 if (bn2crparam(dsa->p, &kop.crk_param[1]))
1144 goto err;
1145 if (bn2crparam(dsa->q, &kop.crk_param[2]))
1146 goto err;
1147 if (bn2crparam(dsa->g, &kop.crk_param[3]))
1148 goto err;
1149 if (bn2crparam(dsa->pub_key, &kop.crk_param[4]))
1150 goto err;
1151 if (bn2crparam(sig->r, &kop.crk_param[5]))
1152 goto err;
1153 if (bn2crparam(sig->s, &kop.crk_param[6]))
1154 goto err;
1155 kop.crk_iparams = 7;
1156
1157 if (cryptodev_asym(&kop, 0, NULL, 0, NULL) == 0) {
1158 dsaret = kop.crk_status;
1159 } else {
1160 const DSA_METHOD *meth = DSA_OpenSSL();
1161
1162 dsaret = (meth->dsa_do_verify)(dgst, dlen, sig, dsa);
1163 }
1164err:
1165 kop.crk_param[0].crp_p = NULL;
1166 zapparams(&kop);
1167 return (dsaret);
1168}
1169
1170static DSA_METHOD cryptodev_dsa = {
1171 "cryptodev DSA method",
1172 NULL,
1173 NULL, /* dsa_sign_setup */
1174 NULL,
1175 NULL, /* dsa_mod_exp */
1176 NULL,
1177 NULL, /* init */
1178 NULL, /* finish */
1179 0, /* flags */
1180 NULL /* app_data */
1181};
1182
1183static int
1184cryptodev_mod_exp_dh(const DH *dh, BIGNUM *r, const BIGNUM *a,
1185 const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx,
1186 BN_MONT_CTX *m_ctx)
1187{
1188 return (cryptodev_bn_mod_exp(r, a, p, m, ctx, m_ctx));
1189}
1190
1191static int
1192cryptodev_dh_compute_key(unsigned char *key, const BIGNUM *pub_key, DH *dh)
1193{
1194 struct crypt_kop kop;
1195 int dhret = 1;
1196 int fd, keylen;
1197
1198 if ((fd = get_asym_dev_crypto()) < 0) {
1199 const DH_METHOD *meth = DH_OpenSSL();
1200
1201 return ((meth->compute_key)(key, pub_key, dh));
1202 }
1203
1204 keylen = BN_num_bits(dh->p);
1205
1206 memset(&kop, 0, sizeof kop);
1207 kop.crk_op = CRK_DH_COMPUTE_KEY;
1208
1209 /* inputs: dh->priv_key pub_key dh->p key */
1210 if (bn2crparam(dh->priv_key, &kop.crk_param[0]))
1211 goto err;
1212 if (bn2crparam(pub_key, &kop.crk_param[1]))
1213 goto err;
1214 if (bn2crparam(dh->p, &kop.crk_param[2]))
1215 goto err;
1216 kop.crk_iparams = 3;
1217
1218 kop.crk_param[3].crp_p = key;
1219 kop.crk_param[3].crp_nbits = keylen * 8;
1220 kop.crk_oparams = 1;
1221
1222 if (ioctl(fd, CIOCKEY, &kop) == -1) {
1223 const DH_METHOD *meth = DH_OpenSSL();
1224
1225 dhret = (meth->compute_key)(key, pub_key, dh);
1226 }
1227err:
1228 kop.crk_param[3].crp_p = NULL;
1229 zapparams(&kop);
1230 return (dhret);
1231}
1232
1233static DH_METHOD cryptodev_dh = {
1234 "cryptodev DH method",
1235 NULL, /* cryptodev_dh_generate_key */
1236 NULL,
1237 NULL,
1238 NULL,
1239 NULL,
1240 0, /* flags */
1241 NULL /* app_data */
1242};
1243
1244/*
1245 * ctrl right now is just a wrapper that doesn't do much
1246 * but I expect we'll want some options soon.
1247 */
1248static int
1249cryptodev_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f)())
1250{
1251#ifdef HAVE_SYSLOG_R
1252 struct syslog_data sd = SYSLOG_DATA_INIT;
1253#endif
1254
1255 switch (cmd) {
1256 default:
1257#ifdef HAVE_SYSLOG_R
1258 syslog_r(LOG_ERR, &sd,
1259 "cryptodev_ctrl: unknown command %d", cmd);
1260#else
1261 syslog(LOG_ERR, "cryptodev_ctrl: unknown command %d", cmd);
1262#endif
1263 break;
1264 }
1265 return (1);
1266}
1267
1268void
1269ENGINE_load_cryptodev(void)
1270{
1271 ENGINE *engine = ENGINE_new();
1272 int fd;
1273
1274 if (engine == NULL)
1275 return;
1276 if ((fd = get_dev_crypto()) < 0) {
1277 ENGINE_free(engine);
1278 return;
1279 }
1280
1281 /*
1282 * find out what asymmetric crypto algorithms we support
1283 */
1284 if (ioctl(fd, CIOCASYMFEAT, &cryptodev_asymfeat) == -1) {
1285 close(fd);
1286 ENGINE_free(engine);
1287 return;
1288 }
1289 close(fd);
1290
1291 if (!ENGINE_set_id(engine, "cryptodev") ||
1292 !ENGINE_set_name(engine, "BSD cryptodev engine") ||
1293 !ENGINE_set_ciphers(engine, cryptodev_engine_ciphers) ||
1294 !ENGINE_set_digests(engine, cryptodev_engine_digests) ||
1295 !ENGINE_set_ctrl_function(engine, cryptodev_ctrl) ||
1296 !ENGINE_set_cmd_defns(engine, cryptodev_defns)) {
1297 ENGINE_free(engine);
1298 return;
1299 }
1300
1301 if (ENGINE_set_RSA(engine, &cryptodev_rsa)) {
1302 const RSA_METHOD *rsa_meth = RSA_PKCS1_SSLeay();
1303
1304 cryptodev_rsa.bn_mod_exp = rsa_meth->bn_mod_exp;
1305 cryptodev_rsa.rsa_mod_exp = rsa_meth->rsa_mod_exp;
1306 cryptodev_rsa.rsa_pub_enc = rsa_meth->rsa_pub_enc;
1307 cryptodev_rsa.rsa_pub_dec = rsa_meth->rsa_pub_dec;
1308 cryptodev_rsa.rsa_priv_enc = rsa_meth->rsa_priv_enc;
1309 cryptodev_rsa.rsa_priv_dec = rsa_meth->rsa_priv_dec;
1310 if (cryptodev_asymfeat & CRF_MOD_EXP) {
1311 cryptodev_rsa.bn_mod_exp = cryptodev_bn_mod_exp;
1312 if (cryptodev_asymfeat & CRF_MOD_EXP_CRT)
1313 cryptodev_rsa.rsa_mod_exp =
1314 cryptodev_rsa_mod_exp;
1315 else
1316 cryptodev_rsa.rsa_mod_exp =
1317 cryptodev_rsa_nocrt_mod_exp;
1318 }
1319 }
1320
1321 if (ENGINE_set_DSA(engine, &cryptodev_dsa)) {
1322 const DSA_METHOD *meth = DSA_OpenSSL();
1323
1324 memcpy(&cryptodev_dsa, meth, sizeof(DSA_METHOD));
1325 if (cryptodev_asymfeat & CRF_DSA_SIGN)
1326 cryptodev_dsa.dsa_do_sign = cryptodev_dsa_do_sign;
1327 if (cryptodev_asymfeat & CRF_MOD_EXP) {
1328 cryptodev_dsa.bn_mod_exp = cryptodev_dsa_bn_mod_exp;
1329 cryptodev_dsa.dsa_mod_exp = cryptodev_dsa_dsa_mod_exp;
1330 }
1331 if (cryptodev_asymfeat & CRF_DSA_VERIFY)
1332 cryptodev_dsa.dsa_do_verify = cryptodev_dsa_verify;
1333 }
1334
1335 if (ENGINE_set_DH(engine, &cryptodev_dh)){
1336 const DH_METHOD *dh_meth = DH_OpenSSL();
1337
1338 cryptodev_dh.generate_key = dh_meth->generate_key;
1339 cryptodev_dh.compute_key = dh_meth->compute_key;
1340 cryptodev_dh.bn_mod_exp = dh_meth->bn_mod_exp;
1341 if (cryptodev_asymfeat & CRF_MOD_EXP) {
1342 cryptodev_dh.bn_mod_exp = cryptodev_mod_exp_dh;
1343 if (cryptodev_asymfeat & CRF_DH_COMPUTE_KEY)
1344 cryptodev_dh.compute_key =
1345 cryptodev_dh_compute_key;
1346 }
1347 }
1348
1349 ENGINE_add(engine);
1350 ENGINE_free(engine);
1351 ERR_clear_error();
1352}
1353
1354#endif /* HAVE_CRYPTODEV */
diff --git a/src/lib/libcrypto/engine/hw_cswift.c b/src/lib/libcrypto/engine/hw_cswift.c
new file mode 100644
index 0000000000..f128ee5a68
--- /dev/null
+++ b/src/lib/libcrypto/engine/hw_cswift.c
@@ -0,0 +1,997 @@
1/* crypto/engine/hw_cswift.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 <openssl/crypto.h>
61#include "cryptlib.h"
62#include <openssl/dso.h>
63#include <openssl/engine.h>
64
65#ifndef OPENSSL_NO_HW
66#ifndef OPENSSL_NO_HW_CSWIFT
67
68/* Attribution notice: Rainbow have generously allowed me to reproduce
69 * the necessary definitions here from their API. This means the support
70 * can build independently of whether application builders have the
71 * API or hardware. This will allow developers to easily produce software
72 * that has latent hardware support for any users that have accelerators
73 * installed, without the developers themselves needing anything extra.
74 *
75 * I have only clipped the parts from the CryptoSwift header files that
76 * are (or seem) relevant to the CryptoSwift support code. This is
77 * simply to keep the file sizes reasonable.
78 * [Geoff]
79 */
80#ifdef FLAT_INC
81#include "cswift.h"
82#else
83#include "vendor_defns/cswift.h"
84#endif
85
86#define CSWIFT_LIB_NAME "cswift engine"
87#include "hw_cswift_err.c"
88
89static int cswift_destroy(ENGINE *e);
90static int cswift_init(ENGINE *e);
91static int cswift_finish(ENGINE *e);
92static int cswift_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f)());
93
94/* BIGNUM stuff */
95static int cswift_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
96 const BIGNUM *m, BN_CTX *ctx);
97static int cswift_mod_exp_crt(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
98 const BIGNUM *q, const BIGNUM *dmp1, const BIGNUM *dmq1,
99 const BIGNUM *iqmp, BN_CTX *ctx);
100
101#ifndef OPENSSL_NO_RSA
102/* RSA stuff */
103static int cswift_rsa_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa);
104#endif
105/* This function is aliased to mod_exp (with the mont stuff dropped). */
106static int cswift_mod_exp_mont(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
107 const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx);
108
109#ifndef OPENSSL_NO_DSA
110/* DSA stuff */
111static DSA_SIG *cswift_dsa_sign(const unsigned char *dgst, int dlen, DSA *dsa);
112static int cswift_dsa_verify(const unsigned char *dgst, int dgst_len,
113 DSA_SIG *sig, DSA *dsa);
114#endif
115
116#ifndef OPENSSL_NO_DH
117/* DH stuff */
118/* This function is alised to mod_exp (with the DH and mont dropped). */
119static int cswift_mod_exp_dh(const DH *dh, BIGNUM *r,
120 const BIGNUM *a, const BIGNUM *p,
121 const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx);
122#endif
123
124/* RAND stuff */
125static int cswift_rand_bytes(unsigned char *buf, int num);
126static int cswift_rand_status(void);
127
128/* The definitions for control commands specific to this engine */
129#define CSWIFT_CMD_SO_PATH ENGINE_CMD_BASE
130static const ENGINE_CMD_DEFN cswift_cmd_defns[] = {
131 {CSWIFT_CMD_SO_PATH,
132 "SO_PATH",
133 "Specifies the path to the 'cswift' shared library",
134 ENGINE_CMD_FLAG_STRING},
135 {0, NULL, NULL, 0}
136 };
137
138#ifndef OPENSSL_NO_RSA
139/* Our internal RSA_METHOD that we provide pointers to */
140static RSA_METHOD cswift_rsa =
141 {
142 "CryptoSwift RSA method",
143 NULL,
144 NULL,
145 NULL,
146 NULL,
147 cswift_rsa_mod_exp,
148 cswift_mod_exp_mont,
149 NULL,
150 NULL,
151 0,
152 NULL,
153 NULL,
154 NULL
155 };
156#endif
157
158#ifndef OPENSSL_NO_DSA
159/* Our internal DSA_METHOD that we provide pointers to */
160static DSA_METHOD cswift_dsa =
161 {
162 "CryptoSwift DSA method",
163 cswift_dsa_sign,
164 NULL, /* dsa_sign_setup */
165 cswift_dsa_verify,
166 NULL, /* dsa_mod_exp */
167 NULL, /* bn_mod_exp */
168 NULL, /* init */
169 NULL, /* finish */
170 0, /* flags */
171 NULL /* app_data */
172 };
173#endif
174
175#ifndef OPENSSL_NO_DH
176/* Our internal DH_METHOD that we provide pointers to */
177static DH_METHOD cswift_dh =
178 {
179 "CryptoSwift DH method",
180 NULL,
181 NULL,
182 cswift_mod_exp_dh,
183 NULL,
184 NULL,
185 0,
186 NULL
187 };
188#endif
189
190static RAND_METHOD cswift_random =
191 {
192 /* "CryptoSwift RAND method", */
193 NULL,
194 cswift_rand_bytes,
195 NULL,
196 NULL,
197 cswift_rand_bytes,
198 cswift_rand_status,
199 };
200
201
202/* Constants used when creating the ENGINE */
203static const char *engine_cswift_id = "cswift";
204static const char *engine_cswift_name = "CryptoSwift hardware engine support";
205
206/* This internal function is used by ENGINE_cswift() and possibly by the
207 * "dynamic" ENGINE support too */
208static int bind_helper(ENGINE *e)
209 {
210#ifndef OPENSSL_NO_RSA
211 const RSA_METHOD *meth1;
212#endif
213#ifndef OPENSSL_NO_DH
214 const DH_METHOD *meth2;
215#endif
216 if(!ENGINE_set_id(e, engine_cswift_id) ||
217 !ENGINE_set_name(e, engine_cswift_name) ||
218#ifndef OPENSSL_NO_RSA
219 !ENGINE_set_RSA(e, &cswift_rsa) ||
220#endif
221#ifndef OPENSSL_NO_DSA
222 !ENGINE_set_DSA(e, &cswift_dsa) ||
223#endif
224#ifndef OPENSSL_NO_DH
225 !ENGINE_set_DH(e, &cswift_dh) ||
226#endif
227 !ENGINE_set_RAND(e, &cswift_random) ||
228 !ENGINE_set_destroy_function(e, cswift_destroy) ||
229 !ENGINE_set_init_function(e, cswift_init) ||
230 !ENGINE_set_finish_function(e, cswift_finish) ||
231 !ENGINE_set_ctrl_function(e, cswift_ctrl) ||
232 !ENGINE_set_cmd_defns(e, cswift_cmd_defns))
233 return 0;
234
235#ifndef OPENSSL_NO_RSA
236 /* We know that the "PKCS1_SSLeay()" functions hook properly
237 * to the cswift-specific mod_exp and mod_exp_crt so we use
238 * those functions. NB: We don't use ENGINE_openssl() or
239 * anything "more generic" because something like the RSAref
240 * code may not hook properly, and if you own one of these
241 * cards then you have the right to do RSA operations on it
242 * anyway! */
243 meth1 = RSA_PKCS1_SSLeay();
244 cswift_rsa.rsa_pub_enc = meth1->rsa_pub_enc;
245 cswift_rsa.rsa_pub_dec = meth1->rsa_pub_dec;
246 cswift_rsa.rsa_priv_enc = meth1->rsa_priv_enc;
247 cswift_rsa.rsa_priv_dec = meth1->rsa_priv_dec;
248#endif
249
250#ifndef OPENSSL_NO_DH
251 /* Much the same for Diffie-Hellman */
252 meth2 = DH_OpenSSL();
253 cswift_dh.generate_key = meth2->generate_key;
254 cswift_dh.compute_key = meth2->compute_key;
255#endif
256
257 /* Ensure the cswift error handling is set up */
258 ERR_load_CSWIFT_strings();
259 return 1;
260 }
261
262#ifndef ENGINE_DYNAMIC_SUPPORT
263static ENGINE *engine_cswift(void)
264 {
265 ENGINE *ret = ENGINE_new();
266 if(!ret)
267 return NULL;
268 if(!bind_helper(ret))
269 {
270 ENGINE_free(ret);
271 return NULL;
272 }
273 return ret;
274 }
275
276void ENGINE_load_cswift(void)
277 {
278 /* Copied from eng_[openssl|dyn].c */
279 ENGINE *toadd = engine_cswift();
280 if(!toadd) return;
281 ENGINE_add(toadd);
282 ENGINE_free(toadd);
283 ERR_clear_error();
284 }
285#endif
286
287/* This is a process-global DSO handle used for loading and unloading
288 * the CryptoSwift library. NB: This is only set (or unset) during an
289 * init() or finish() call (reference counts permitting) and they're
290 * operating with global locks, so this should be thread-safe
291 * implicitly. */
292static DSO *cswift_dso = NULL;
293
294/* These are the function pointers that are (un)set when the library has
295 * successfully (un)loaded. */
296t_swAcquireAccContext *p_CSwift_AcquireAccContext = NULL;
297t_swAttachKeyParam *p_CSwift_AttachKeyParam = NULL;
298t_swSimpleRequest *p_CSwift_SimpleRequest = NULL;
299t_swReleaseAccContext *p_CSwift_ReleaseAccContext = NULL;
300
301/* Used in the DSO operations. */
302static const char *CSWIFT_LIBNAME = NULL;
303static const char *get_CSWIFT_LIBNAME(void)
304 {
305 if(CSWIFT_LIBNAME)
306 return CSWIFT_LIBNAME;
307 return "swift";
308 }
309static void free_CSWIFT_LIBNAME(void)
310 {
311 if(CSWIFT_LIBNAME)
312 OPENSSL_free((void*)CSWIFT_LIBNAME);
313 CSWIFT_LIBNAME = NULL;
314 }
315static long set_CSWIFT_LIBNAME(const char *name)
316 {
317 free_CSWIFT_LIBNAME();
318 return (((CSWIFT_LIBNAME = BUF_strdup(name)) != NULL) ? 1 : 0);
319 }
320static const char *CSWIFT_F1 = "swAcquireAccContext";
321static const char *CSWIFT_F2 = "swAttachKeyParam";
322static const char *CSWIFT_F3 = "swSimpleRequest";
323static const char *CSWIFT_F4 = "swReleaseAccContext";
324
325
326/* CryptoSwift library functions and mechanics - these are used by the
327 * higher-level functions further down. NB: As and where there's no
328 * error checking, take a look lower down where these functions are
329 * called, the checking and error handling is probably down there. */
330
331/* utility function to obtain a context */
332static int get_context(SW_CONTEXT_HANDLE *hac)
333 {
334 SW_STATUS status;
335
336 status = p_CSwift_AcquireAccContext(hac);
337 if(status != SW_OK)
338 return 0;
339 return 1;
340 }
341
342/* similarly to release one. */
343static void release_context(SW_CONTEXT_HANDLE hac)
344 {
345 p_CSwift_ReleaseAccContext(hac);
346 }
347
348/* Destructor (complements the "ENGINE_cswift()" constructor) */
349static int cswift_destroy(ENGINE *e)
350 {
351 free_CSWIFT_LIBNAME();
352 ERR_unload_CSWIFT_strings();
353 return 1;
354 }
355
356/* (de)initialisation functions. */
357static int cswift_init(ENGINE *e)
358 {
359 SW_CONTEXT_HANDLE hac;
360 t_swAcquireAccContext *p1;
361 t_swAttachKeyParam *p2;
362 t_swSimpleRequest *p3;
363 t_swReleaseAccContext *p4;
364
365 if(cswift_dso != NULL)
366 {
367 CSWIFTerr(CSWIFT_F_CSWIFT_INIT,CSWIFT_R_ALREADY_LOADED);
368 goto err;
369 }
370 /* Attempt to load libswift.so/swift.dll/whatever. */
371 cswift_dso = DSO_load(NULL, get_CSWIFT_LIBNAME(), NULL, 0);
372 if(cswift_dso == NULL)
373 {
374 CSWIFTerr(CSWIFT_F_CSWIFT_INIT,CSWIFT_R_NOT_LOADED);
375 goto err;
376 }
377 if(!(p1 = (t_swAcquireAccContext *)
378 DSO_bind_func(cswift_dso, CSWIFT_F1)) ||
379 !(p2 = (t_swAttachKeyParam *)
380 DSO_bind_func(cswift_dso, CSWIFT_F2)) ||
381 !(p3 = (t_swSimpleRequest *)
382 DSO_bind_func(cswift_dso, CSWIFT_F3)) ||
383 !(p4 = (t_swReleaseAccContext *)
384 DSO_bind_func(cswift_dso, CSWIFT_F4)))
385 {
386 CSWIFTerr(CSWIFT_F_CSWIFT_INIT,CSWIFT_R_NOT_LOADED);
387 goto err;
388 }
389 /* Copy the pointers */
390 p_CSwift_AcquireAccContext = p1;
391 p_CSwift_AttachKeyParam = p2;
392 p_CSwift_SimpleRequest = p3;
393 p_CSwift_ReleaseAccContext = p4;
394 /* Try and get a context - if not, we may have a DSO but no
395 * accelerator! */
396 if(!get_context(&hac))
397 {
398 CSWIFTerr(CSWIFT_F_CSWIFT_INIT,CSWIFT_R_UNIT_FAILURE);
399 goto err;
400 }
401 release_context(hac);
402 /* Everything's fine. */
403 return 1;
404err:
405 if(cswift_dso)
406 DSO_free(cswift_dso);
407 p_CSwift_AcquireAccContext = NULL;
408 p_CSwift_AttachKeyParam = NULL;
409 p_CSwift_SimpleRequest = NULL;
410 p_CSwift_ReleaseAccContext = NULL;
411 return 0;
412 }
413
414static int cswift_finish(ENGINE *e)
415 {
416 free_CSWIFT_LIBNAME();
417 if(cswift_dso == NULL)
418 {
419 CSWIFTerr(CSWIFT_F_CSWIFT_FINISH,CSWIFT_R_NOT_LOADED);
420 return 0;
421 }
422 if(!DSO_free(cswift_dso))
423 {
424 CSWIFTerr(CSWIFT_F_CSWIFT_FINISH,CSWIFT_R_UNIT_FAILURE);
425 return 0;
426 }
427 cswift_dso = NULL;
428 p_CSwift_AcquireAccContext = NULL;
429 p_CSwift_AttachKeyParam = NULL;
430 p_CSwift_SimpleRequest = NULL;
431 p_CSwift_ReleaseAccContext = NULL;
432 return 1;
433 }
434
435static int cswift_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f)())
436 {
437 int initialised = ((cswift_dso == NULL) ? 0 : 1);
438 switch(cmd)
439 {
440 case CSWIFT_CMD_SO_PATH:
441 if(p == NULL)
442 {
443 CSWIFTerr(CSWIFT_F_CSWIFT_CTRL,ERR_R_PASSED_NULL_PARAMETER);
444 return 0;
445 }
446 if(initialised)
447 {
448 CSWIFTerr(CSWIFT_F_CSWIFT_CTRL,CSWIFT_R_ALREADY_LOADED);
449 return 0;
450 }
451 return set_CSWIFT_LIBNAME((const char *)p);
452 default:
453 break;
454 }
455 CSWIFTerr(CSWIFT_F_CSWIFT_CTRL,CSWIFT_R_CTRL_COMMAND_NOT_IMPLEMENTED);
456 return 0;
457 }
458
459/* Un petit mod_exp */
460static int cswift_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
461 const BIGNUM *m, BN_CTX *ctx)
462 {
463 /* I need somewhere to store temporary serialised values for
464 * use with the CryptoSwift API calls. A neat cheat - I'll use
465 * BIGNUMs from the BN_CTX but access their arrays directly as
466 * byte arrays <grin>. This way I don't have to clean anything
467 * up. */
468 BIGNUM *modulus;
469 BIGNUM *exponent;
470 BIGNUM *argument;
471 BIGNUM *result;
472 SW_STATUS sw_status;
473 SW_LARGENUMBER arg, res;
474 SW_PARAM sw_param;
475 SW_CONTEXT_HANDLE hac;
476 int to_return, acquired;
477
478 modulus = exponent = argument = result = NULL;
479 to_return = 0; /* expect failure */
480 acquired = 0;
481
482 if(!get_context(&hac))
483 {
484 CSWIFTerr(CSWIFT_F_CSWIFT_MOD_EXP,CSWIFT_R_UNIT_FAILURE);
485 goto err;
486 }
487 acquired = 1;
488 /* Prepare the params */
489 BN_CTX_start(ctx);
490 modulus = BN_CTX_get(ctx);
491 exponent = BN_CTX_get(ctx);
492 argument = BN_CTX_get(ctx);
493 result = BN_CTX_get(ctx);
494 if(!result)
495 {
496 CSWIFTerr(CSWIFT_F_CSWIFT_MOD_EXP,CSWIFT_R_BN_CTX_FULL);
497 goto err;
498 }
499 if(!bn_wexpand(modulus, m->top) || !bn_wexpand(exponent, p->top) ||
500 !bn_wexpand(argument, a->top) || !bn_wexpand(result, m->top))
501 {
502 CSWIFTerr(CSWIFT_F_CSWIFT_MOD_EXP,CSWIFT_R_BN_EXPAND_FAIL);
503 goto err;
504 }
505 sw_param.type = SW_ALG_EXP;
506 sw_param.up.exp.modulus.nbytes = BN_bn2bin(m,
507 (unsigned char *)modulus->d);
508 sw_param.up.exp.modulus.value = (unsigned char *)modulus->d;
509 sw_param.up.exp.exponent.nbytes = BN_bn2bin(p,
510 (unsigned char *)exponent->d);
511 sw_param.up.exp.exponent.value = (unsigned char *)exponent->d;
512 /* Attach the key params */
513 sw_status = p_CSwift_AttachKeyParam(hac, &sw_param);
514 switch(sw_status)
515 {
516 case SW_OK:
517 break;
518 case SW_ERR_INPUT_SIZE:
519 CSWIFTerr(CSWIFT_F_CSWIFT_MOD_EXP,CSWIFT_R_BAD_KEY_SIZE);
520 goto err;
521 default:
522 {
523 char tmpbuf[DECIMAL_SIZE(sw_status)+1];
524 CSWIFTerr(CSWIFT_F_CSWIFT_MOD_EXP,CSWIFT_R_REQUEST_FAILED);
525 sprintf(tmpbuf, "%ld", sw_status);
526 ERR_add_error_data(2, "CryptoSwift error number is ",tmpbuf);
527 }
528 goto err;
529 }
530 /* Prepare the argument and response */
531 arg.nbytes = BN_bn2bin(a, (unsigned char *)argument->d);
532 arg.value = (unsigned char *)argument->d;
533 res.nbytes = BN_num_bytes(m);
534 memset(result->d, 0, res.nbytes);
535 res.value = (unsigned char *)result->d;
536 /* Perform the operation */
537 if((sw_status = p_CSwift_SimpleRequest(hac, SW_CMD_MODEXP, &arg, 1,
538 &res, 1)) != SW_OK)
539 {
540 char tmpbuf[DECIMAL_SIZE(sw_status)+1];
541 CSWIFTerr(CSWIFT_F_CSWIFT_MOD_EXP,CSWIFT_R_REQUEST_FAILED);
542 sprintf(tmpbuf, "%ld", sw_status);
543 ERR_add_error_data(2, "CryptoSwift error number is ",tmpbuf);
544 goto err;
545 }
546 /* Convert the response */
547 BN_bin2bn((unsigned char *)result->d, res.nbytes, r);
548 to_return = 1;
549err:
550 if(acquired)
551 release_context(hac);
552 BN_CTX_end(ctx);
553 return to_return;
554 }
555
556/* Un petit mod_exp chinois */
557static int cswift_mod_exp_crt(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
558 const BIGNUM *q, const BIGNUM *dmp1,
559 const BIGNUM *dmq1, const BIGNUM *iqmp, BN_CTX *ctx)
560 {
561 SW_STATUS sw_status;
562 SW_LARGENUMBER arg, res;
563 SW_PARAM sw_param;
564 SW_CONTEXT_HANDLE hac;
565 BIGNUM *rsa_p = NULL;
566 BIGNUM *rsa_q = NULL;
567 BIGNUM *rsa_dmp1 = NULL;
568 BIGNUM *rsa_dmq1 = NULL;
569 BIGNUM *rsa_iqmp = NULL;
570 BIGNUM *argument = NULL;
571 BIGNUM *result = NULL;
572 int to_return = 0; /* expect failure */
573 int acquired = 0;
574
575 if(!get_context(&hac))
576 {
577 CSWIFTerr(CSWIFT_F_CSWIFT_MOD_EXP_CRT,CSWIFT_R_UNIT_FAILURE);
578 goto err;
579 }
580 acquired = 1;
581 /* Prepare the params */
582 BN_CTX_start(ctx);
583 rsa_p = BN_CTX_get(ctx);
584 rsa_q = BN_CTX_get(ctx);
585 rsa_dmp1 = BN_CTX_get(ctx);
586 rsa_dmq1 = BN_CTX_get(ctx);
587 rsa_iqmp = BN_CTX_get(ctx);
588 argument = BN_CTX_get(ctx);
589 result = BN_CTX_get(ctx);
590 if(!result)
591 {
592 CSWIFTerr(CSWIFT_F_CSWIFT_MOD_EXP_CRT,CSWIFT_R_BN_CTX_FULL);
593 goto err;
594 }
595 if(!bn_wexpand(rsa_p, p->top) || !bn_wexpand(rsa_q, q->top) ||
596 !bn_wexpand(rsa_dmp1, dmp1->top) ||
597 !bn_wexpand(rsa_dmq1, dmq1->top) ||
598 !bn_wexpand(rsa_iqmp, iqmp->top) ||
599 !bn_wexpand(argument, a->top) ||
600 !bn_wexpand(result, p->top + q->top))
601 {
602 CSWIFTerr(CSWIFT_F_CSWIFT_MOD_EXP_CRT,CSWIFT_R_BN_EXPAND_FAIL);
603 goto err;
604 }
605 sw_param.type = SW_ALG_CRT;
606 sw_param.up.crt.p.nbytes = BN_bn2bin(p, (unsigned char *)rsa_p->d);
607 sw_param.up.crt.p.value = (unsigned char *)rsa_p->d;
608 sw_param.up.crt.q.nbytes = BN_bn2bin(q, (unsigned char *)rsa_q->d);
609 sw_param.up.crt.q.value = (unsigned char *)rsa_q->d;
610 sw_param.up.crt.dmp1.nbytes = BN_bn2bin(dmp1,
611 (unsigned char *)rsa_dmp1->d);
612 sw_param.up.crt.dmp1.value = (unsigned char *)rsa_dmp1->d;
613 sw_param.up.crt.dmq1.nbytes = BN_bn2bin(dmq1,
614 (unsigned char *)rsa_dmq1->d);
615 sw_param.up.crt.dmq1.value = (unsigned char *)rsa_dmq1->d;
616 sw_param.up.crt.iqmp.nbytes = BN_bn2bin(iqmp,
617 (unsigned char *)rsa_iqmp->d);
618 sw_param.up.crt.iqmp.value = (unsigned char *)rsa_iqmp->d;
619 /* Attach the key params */
620 sw_status = p_CSwift_AttachKeyParam(hac, &sw_param);
621 switch(sw_status)
622 {
623 case SW_OK:
624 break;
625 case SW_ERR_INPUT_SIZE:
626 CSWIFTerr(CSWIFT_F_CSWIFT_MOD_EXP_CRT,CSWIFT_R_BAD_KEY_SIZE);
627 goto err;
628 default:
629 {
630 char tmpbuf[DECIMAL_SIZE(sw_status)+1];
631 CSWIFTerr(CSWIFT_F_CSWIFT_MOD_EXP_CRT,CSWIFT_R_REQUEST_FAILED);
632 sprintf(tmpbuf, "%ld", sw_status);
633 ERR_add_error_data(2, "CryptoSwift error number is ",tmpbuf);
634 }
635 goto err;
636 }
637 /* Prepare the argument and response */
638 arg.nbytes = BN_bn2bin(a, (unsigned char *)argument->d);
639 arg.value = (unsigned char *)argument->d;
640 res.nbytes = 2 * BN_num_bytes(p);
641 memset(result->d, 0, res.nbytes);
642 res.value = (unsigned char *)result->d;
643 /* Perform the operation */
644 if((sw_status = p_CSwift_SimpleRequest(hac, SW_CMD_MODEXP_CRT, &arg, 1,
645 &res, 1)) != SW_OK)
646 {
647 char tmpbuf[DECIMAL_SIZE(sw_status)+1];
648 CSWIFTerr(CSWIFT_F_CSWIFT_MOD_EXP_CRT,CSWIFT_R_REQUEST_FAILED);
649 sprintf(tmpbuf, "%ld", sw_status);
650 ERR_add_error_data(2, "CryptoSwift error number is ",tmpbuf);
651 goto err;
652 }
653 /* Convert the response */
654 BN_bin2bn((unsigned char *)result->d, res.nbytes, r);
655 to_return = 1;
656err:
657 if(acquired)
658 release_context(hac);
659 BN_CTX_end(ctx);
660 return to_return;
661 }
662
663#ifndef OPENSSL_NO_RSA
664static int cswift_rsa_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa)
665 {
666 BN_CTX *ctx;
667 int to_return = 0;
668
669 if((ctx = BN_CTX_new()) == NULL)
670 goto err;
671 if(!rsa->p || !rsa->q || !rsa->dmp1 || !rsa->dmq1 || !rsa->iqmp)
672 {
673 CSWIFTerr(CSWIFT_F_CSWIFT_RSA_MOD_EXP,CSWIFT_R_MISSING_KEY_COMPONENTS);
674 goto err;
675 }
676 to_return = cswift_mod_exp_crt(r0, I, rsa->p, rsa->q, rsa->dmp1,
677 rsa->dmq1, rsa->iqmp, ctx);
678err:
679 if(ctx)
680 BN_CTX_free(ctx);
681 return to_return;
682 }
683#endif
684
685/* This function is aliased to mod_exp (with the mont stuff dropped). */
686static int cswift_mod_exp_mont(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
687 const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx)
688 {
689 return cswift_mod_exp(r, a, p, m, ctx);
690 }
691
692#ifndef OPENSSL_NO_DSA
693static DSA_SIG *cswift_dsa_sign(const unsigned char *dgst, int dlen, DSA *dsa)
694 {
695 SW_CONTEXT_HANDLE hac;
696 SW_PARAM sw_param;
697 SW_STATUS sw_status;
698 SW_LARGENUMBER arg, res;
699 unsigned char *ptr;
700 BN_CTX *ctx;
701 BIGNUM *dsa_p = NULL;
702 BIGNUM *dsa_q = NULL;
703 BIGNUM *dsa_g = NULL;
704 BIGNUM *dsa_key = NULL;
705 BIGNUM *result = NULL;
706 DSA_SIG *to_return = NULL;
707 int acquired = 0;
708
709 if((ctx = BN_CTX_new()) == NULL)
710 goto err;
711 if(!get_context(&hac))
712 {
713 CSWIFTerr(CSWIFT_F_CSWIFT_DSA_SIGN,CSWIFT_R_UNIT_FAILURE);
714 goto err;
715 }
716 acquired = 1;
717 /* Prepare the params */
718 BN_CTX_start(ctx);
719 dsa_p = BN_CTX_get(ctx);
720 dsa_q = BN_CTX_get(ctx);
721 dsa_g = BN_CTX_get(ctx);
722 dsa_key = BN_CTX_get(ctx);
723 result = BN_CTX_get(ctx);
724 if(!result)
725 {
726 CSWIFTerr(CSWIFT_F_CSWIFT_DSA_SIGN,CSWIFT_R_BN_CTX_FULL);
727 goto err;
728 }
729 if(!bn_wexpand(dsa_p, dsa->p->top) ||
730 !bn_wexpand(dsa_q, dsa->q->top) ||
731 !bn_wexpand(dsa_g, dsa->g->top) ||
732 !bn_wexpand(dsa_key, dsa->priv_key->top) ||
733 !bn_wexpand(result, dsa->p->top))
734 {
735 CSWIFTerr(CSWIFT_F_CSWIFT_DSA_SIGN,CSWIFT_R_BN_EXPAND_FAIL);
736 goto err;
737 }
738 sw_param.type = SW_ALG_DSA;
739 sw_param.up.dsa.p.nbytes = BN_bn2bin(dsa->p,
740 (unsigned char *)dsa_p->d);
741 sw_param.up.dsa.p.value = (unsigned char *)dsa_p->d;
742 sw_param.up.dsa.q.nbytes = BN_bn2bin(dsa->q,
743 (unsigned char *)dsa_q->d);
744 sw_param.up.dsa.q.value = (unsigned char *)dsa_q->d;
745 sw_param.up.dsa.g.nbytes = BN_bn2bin(dsa->g,
746 (unsigned char *)dsa_g->d);
747 sw_param.up.dsa.g.value = (unsigned char *)dsa_g->d;
748 sw_param.up.dsa.key.nbytes = BN_bn2bin(dsa->priv_key,
749 (unsigned char *)dsa_key->d);
750 sw_param.up.dsa.key.value = (unsigned char *)dsa_key->d;
751 /* Attach the key params */
752 sw_status = p_CSwift_AttachKeyParam(hac, &sw_param);
753 switch(sw_status)
754 {
755 case SW_OK:
756 break;
757 case SW_ERR_INPUT_SIZE:
758 CSWIFTerr(CSWIFT_F_CSWIFT_DSA_SIGN,CSWIFT_R_BAD_KEY_SIZE);
759 goto err;
760 default:
761 {
762 char tmpbuf[DECIMAL_SIZE(sw_status)+1];
763 CSWIFTerr(CSWIFT_F_CSWIFT_DSA_SIGN,CSWIFT_R_REQUEST_FAILED);
764 sprintf(tmpbuf, "%ld", sw_status);
765 ERR_add_error_data(2, "CryptoSwift error number is ",tmpbuf);
766 }
767 goto err;
768 }
769 /* Prepare the argument and response */
770 arg.nbytes = dlen;
771 arg.value = (unsigned char *)dgst;
772 res.nbytes = BN_num_bytes(dsa->p);
773 memset(result->d, 0, res.nbytes);
774 res.value = (unsigned char *)result->d;
775 /* Perform the operation */
776 sw_status = p_CSwift_SimpleRequest(hac, SW_CMD_DSS_SIGN, &arg, 1,
777 &res, 1);
778 if(sw_status != SW_OK)
779 {
780 char tmpbuf[DECIMAL_SIZE(sw_status)+1];
781 CSWIFTerr(CSWIFT_F_CSWIFT_DSA_SIGN,CSWIFT_R_REQUEST_FAILED);
782 sprintf(tmpbuf, "%ld", sw_status);
783 ERR_add_error_data(2, "CryptoSwift error number is ",tmpbuf);
784 goto err;
785 }
786 /* Convert the response */
787 ptr = (unsigned char *)result->d;
788 if((to_return = DSA_SIG_new()) == NULL)
789 goto err;
790 to_return->r = BN_bin2bn((unsigned char *)result->d, 20, NULL);
791 to_return->s = BN_bin2bn((unsigned char *)result->d + 20, 20, NULL);
792
793err:
794 if(acquired)
795 release_context(hac);
796 if(ctx)
797 {
798 BN_CTX_end(ctx);
799 BN_CTX_free(ctx);
800 }
801 return to_return;
802 }
803
804static int cswift_dsa_verify(const unsigned char *dgst, int dgst_len,
805 DSA_SIG *sig, DSA *dsa)
806 {
807 SW_CONTEXT_HANDLE hac;
808 SW_PARAM sw_param;
809 SW_STATUS sw_status;
810 SW_LARGENUMBER arg[2], res;
811 unsigned long sig_result;
812 BN_CTX *ctx;
813 BIGNUM *dsa_p = NULL;
814 BIGNUM *dsa_q = NULL;
815 BIGNUM *dsa_g = NULL;
816 BIGNUM *dsa_key = NULL;
817 BIGNUM *argument = NULL;
818 int to_return = -1;
819 int acquired = 0;
820
821 if((ctx = BN_CTX_new()) == NULL)
822 goto err;
823 if(!get_context(&hac))
824 {
825 CSWIFTerr(CSWIFT_F_CSWIFT_DSA_VERIFY,CSWIFT_R_UNIT_FAILURE);
826 goto err;
827 }
828 acquired = 1;
829 /* Prepare the params */
830 BN_CTX_start(ctx);
831 dsa_p = BN_CTX_get(ctx);
832 dsa_q = BN_CTX_get(ctx);
833 dsa_g = BN_CTX_get(ctx);
834 dsa_key = BN_CTX_get(ctx);
835 argument = BN_CTX_get(ctx);
836 if(!argument)
837 {
838 CSWIFTerr(CSWIFT_F_CSWIFT_DSA_VERIFY,CSWIFT_R_BN_CTX_FULL);
839 goto err;
840 }
841 if(!bn_wexpand(dsa_p, dsa->p->top) ||
842 !bn_wexpand(dsa_q, dsa->q->top) ||
843 !bn_wexpand(dsa_g, dsa->g->top) ||
844 !bn_wexpand(dsa_key, dsa->pub_key->top) ||
845 !bn_wexpand(argument, 40))
846 {
847 CSWIFTerr(CSWIFT_F_CSWIFT_DSA_VERIFY,CSWIFT_R_BN_EXPAND_FAIL);
848 goto err;
849 }
850 sw_param.type = SW_ALG_DSA;
851 sw_param.up.dsa.p.nbytes = BN_bn2bin(dsa->p,
852 (unsigned char *)dsa_p->d);
853 sw_param.up.dsa.p.value = (unsigned char *)dsa_p->d;
854 sw_param.up.dsa.q.nbytes = BN_bn2bin(dsa->q,
855 (unsigned char *)dsa_q->d);
856 sw_param.up.dsa.q.value = (unsigned char *)dsa_q->d;
857 sw_param.up.dsa.g.nbytes = BN_bn2bin(dsa->g,
858 (unsigned char *)dsa_g->d);
859 sw_param.up.dsa.g.value = (unsigned char *)dsa_g->d;
860 sw_param.up.dsa.key.nbytes = BN_bn2bin(dsa->pub_key,
861 (unsigned char *)dsa_key->d);
862 sw_param.up.dsa.key.value = (unsigned char *)dsa_key->d;
863 /* Attach the key params */
864 sw_status = p_CSwift_AttachKeyParam(hac, &sw_param);
865 switch(sw_status)
866 {
867 case SW_OK:
868 break;
869 case SW_ERR_INPUT_SIZE:
870 CSWIFTerr(CSWIFT_F_CSWIFT_DSA_VERIFY,CSWIFT_R_BAD_KEY_SIZE);
871 goto err;
872 default:
873 {
874 char tmpbuf[DECIMAL_SIZE(sw_status)+1];
875 CSWIFTerr(CSWIFT_F_CSWIFT_DSA_VERIFY,CSWIFT_R_REQUEST_FAILED);
876 sprintf(tmpbuf, "%ld", sw_status);
877 ERR_add_error_data(2, "CryptoSwift error number is ",tmpbuf);
878 }
879 goto err;
880 }
881 /* Prepare the argument and response */
882 arg[0].nbytes = dgst_len;
883 arg[0].value = (unsigned char *)dgst;
884 arg[1].nbytes = 40;
885 arg[1].value = (unsigned char *)argument->d;
886 memset(arg[1].value, 0, 40);
887 BN_bn2bin(sig->r, arg[1].value + 20 - BN_num_bytes(sig->r));
888 BN_bn2bin(sig->s, arg[1].value + 40 - BN_num_bytes(sig->s));
889 res.nbytes = 4; /* unsigned long */
890 res.value = (unsigned char *)(&sig_result);
891 /* Perform the operation */
892 sw_status = p_CSwift_SimpleRequest(hac, SW_CMD_DSS_VERIFY, arg, 2,
893 &res, 1);
894 if(sw_status != SW_OK)
895 {
896 char tmpbuf[DECIMAL_SIZE(sw_status)+1];
897 CSWIFTerr(CSWIFT_F_CSWIFT_DSA_VERIFY,CSWIFT_R_REQUEST_FAILED);
898 sprintf(tmpbuf, "%ld", sw_status);
899 ERR_add_error_data(2, "CryptoSwift error number is ",tmpbuf);
900 goto err;
901 }
902 /* Convert the response */
903 to_return = ((sig_result == 0) ? 0 : 1);
904
905err:
906 if(acquired)
907 release_context(hac);
908 if(ctx)
909 {
910 BN_CTX_end(ctx);
911 BN_CTX_free(ctx);
912 }
913 return to_return;
914 }
915#endif
916
917#ifndef OPENSSL_NO_DH
918/* This function is aliased to mod_exp (with the dh and mont dropped). */
919static int cswift_mod_exp_dh(const DH *dh, BIGNUM *r,
920 const BIGNUM *a, const BIGNUM *p,
921 const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx)
922 {
923 return cswift_mod_exp(r, a, p, m, ctx);
924 }
925#endif
926
927/* Random bytes are good */
928static int cswift_rand_bytes(unsigned char *buf, int num)
929{
930 SW_CONTEXT_HANDLE hac;
931 SW_STATUS swrc;
932 SW_LARGENUMBER largenum;
933 size_t nbytes = 0;
934 int acquired = 0;
935 int to_return = 0; /* assume failure */
936
937 if (!get_context(&hac))
938 {
939 CSWIFTerr(CSWIFT_F_CSWIFT_CTRL, CSWIFT_R_UNIT_FAILURE);
940 goto err;
941 }
942 acquired = 1;
943
944 while (nbytes < (size_t)num)
945 {
946 /* tell CryptoSwift how many bytes we want and where we want it.
947 * Note: - CryptoSwift cannot do more than 4096 bytes at a time.
948 * - CryptoSwift can only do multiple of 32-bits. */
949 largenum.value = (SW_BYTE *) buf + nbytes;
950 if (4096 > num - nbytes)
951 largenum.nbytes = num - nbytes;
952 else
953 largenum.nbytes = 4096;
954
955 swrc = p_CSwift_SimpleRequest(hac, SW_CMD_RAND, NULL, 0, &largenum, 1);
956 if (swrc != SW_OK)
957 {
958 char tmpbuf[20];
959 CSWIFTerr(CSWIFT_F_CSWIFT_CTRL, CSWIFT_R_REQUEST_FAILED);
960 sprintf(tmpbuf, "%ld", swrc);
961 ERR_add_error_data(2, "CryptoSwift error number is ", tmpbuf);
962 goto err;
963 }
964
965 nbytes += largenum.nbytes;
966 }
967 to_return = 1; /* success */
968
969err:
970 if (acquired)
971 release_context(hac);
972 return to_return;
973}
974
975static int cswift_rand_status(void)
976{
977 return 1;
978}
979
980
981/* This stuff is needed if this ENGINE is being compiled into a self-contained
982 * shared-library. */
983#ifdef ENGINE_DYNAMIC_SUPPORT
984static int bind_fn(ENGINE *e, const char *id)
985 {
986 if(id && (strcmp(id, engine_cswift_id) != 0))
987 return 0;
988 if(!bind_helper(e))
989 return 0;
990 return 1;
991 }
992IMPLEMENT_DYNAMIC_CHECK_FN()
993IMPLEMENT_DYNAMIC_BIND_FN(bind_fn)
994#endif /* ENGINE_DYNAMIC_SUPPORT */
995
996#endif /* !OPENSSL_NO_HW_CSWIFT */
997#endif /* !OPENSSL_NO_HW */
diff --git a/src/lib/libcrypto/engine/hw_cswift_err.c b/src/lib/libcrypto/engine/hw_cswift_err.c
new file mode 100644
index 0000000000..684f53bf27
--- /dev/null
+++ b/src/lib/libcrypto/engine/hw_cswift_err.c
@@ -0,0 +1,149 @@
1/* hw_cswift_err.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/* 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 "hw_cswift_err.h"
64
65/* BEGIN ERROR CODES */
66#ifndef OPENSSL_NO_ERR
67static ERR_STRING_DATA CSWIFT_str_functs[]=
68 {
69{ERR_PACK(0,CSWIFT_F_CSWIFT_CTRL,0), "CSWIFT_CTRL"},
70{ERR_PACK(0,CSWIFT_F_CSWIFT_DSA_SIGN,0), "CSWIFT_DSA_SIGN"},
71{ERR_PACK(0,CSWIFT_F_CSWIFT_DSA_VERIFY,0), "CSWIFT_DSA_VERIFY"},
72{ERR_PACK(0,CSWIFT_F_CSWIFT_FINISH,0), "CSWIFT_FINISH"},
73{ERR_PACK(0,CSWIFT_F_CSWIFT_INIT,0), "CSWIFT_INIT"},
74{ERR_PACK(0,CSWIFT_F_CSWIFT_MOD_EXP,0), "CSWIFT_MOD_EXP"},
75{ERR_PACK(0,CSWIFT_F_CSWIFT_MOD_EXP_CRT,0), "CSWIFT_MOD_EXP_CRT"},
76{ERR_PACK(0,CSWIFT_F_CSWIFT_RSA_MOD_EXP,0), "CSWIFT_RSA_MOD_EXP"},
77{0,NULL}
78 };
79
80static ERR_STRING_DATA CSWIFT_str_reasons[]=
81 {
82{CSWIFT_R_ALREADY_LOADED ,"already loaded"},
83{CSWIFT_R_BAD_KEY_SIZE ,"bad key size"},
84{CSWIFT_R_BN_CTX_FULL ,"bn ctx full"},
85{CSWIFT_R_BN_EXPAND_FAIL ,"bn expand fail"},
86{CSWIFT_R_CTRL_COMMAND_NOT_IMPLEMENTED ,"ctrl command not implemented"},
87{CSWIFT_R_MISSING_KEY_COMPONENTS ,"missing key components"},
88{CSWIFT_R_NOT_LOADED ,"not loaded"},
89{CSWIFT_R_REQUEST_FAILED ,"request failed"},
90{CSWIFT_R_UNIT_FAILURE ,"unit failure"},
91{0,NULL}
92 };
93
94#endif
95
96#ifdef CSWIFT_LIB_NAME
97static ERR_STRING_DATA CSWIFT_lib_name[]=
98 {
99{0 ,CSWIFT_LIB_NAME},
100{0,NULL}
101 };
102#endif
103
104
105static int CSWIFT_lib_error_code=0;
106static int CSWIFT_error_init=1;
107
108static void ERR_load_CSWIFT_strings(void)
109 {
110 if (CSWIFT_lib_error_code == 0)
111 CSWIFT_lib_error_code=ERR_get_next_error_library();
112
113 if (CSWIFT_error_init)
114 {
115 CSWIFT_error_init=0;
116#ifndef OPENSSL_NO_ERR
117 ERR_load_strings(CSWIFT_lib_error_code,CSWIFT_str_functs);
118 ERR_load_strings(CSWIFT_lib_error_code,CSWIFT_str_reasons);
119#endif
120
121#ifdef CSWIFT_LIB_NAME
122 CSWIFT_lib_name->error = ERR_PACK(CSWIFT_lib_error_code,0,0);
123 ERR_load_strings(0,CSWIFT_lib_name);
124#endif
125 }
126 }
127
128static void ERR_unload_CSWIFT_strings(void)
129 {
130 if (CSWIFT_error_init == 0)
131 {
132#ifndef OPENSSL_NO_ERR
133 ERR_unload_strings(CSWIFT_lib_error_code,CSWIFT_str_functs);
134 ERR_unload_strings(CSWIFT_lib_error_code,CSWIFT_str_reasons);
135#endif
136
137#ifdef CSWIFT_LIB_NAME
138 ERR_unload_strings(0,CSWIFT_lib_name);
139#endif
140 CSWIFT_error_init=1;
141 }
142 }
143
144static void ERR_CSWIFT_error(int function, int reason, char *file, int line)
145 {
146 if (CSWIFT_lib_error_code == 0)
147 CSWIFT_lib_error_code=ERR_get_next_error_library();
148 ERR_PUT_error(CSWIFT_lib_error_code,function,reason,file,line);
149 }
diff --git a/src/lib/libcrypto/engine/hw_cswift_err.h b/src/lib/libcrypto/engine/hw_cswift_err.h
new file mode 100644
index 0000000000..7120c3216f
--- /dev/null
+++ b/src/lib/libcrypto/engine/hw_cswift_err.h
@@ -0,0 +1,93 @@
1/* ====================================================================
2 * Copyright (c) 2001 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_CSWIFT_ERR_H
56#define HEADER_CSWIFT_ERR_H
57
58/* BEGIN ERROR CODES */
59/* The following lines are auto generated by the script mkerr.pl. Any changes
60 * made after this point may be overwritten when the script is next run.
61 */
62static void ERR_load_CSWIFT_strings(void);
63static void ERR_unload_CSWIFT_strings(void);
64static void ERR_CSWIFT_error(int function, int reason, char *file, int line);
65#define CSWIFTerr(f,r) ERR_CSWIFT_error((f),(r),__FILE__,__LINE__)
66
67/* Error codes for the CSWIFT functions. */
68
69/* Function codes. */
70#define CSWIFT_F_CSWIFT_CTRL 100
71#define CSWIFT_F_CSWIFT_DSA_SIGN 101
72#define CSWIFT_F_CSWIFT_DSA_VERIFY 102
73#define CSWIFT_F_CSWIFT_FINISH 103
74#define CSWIFT_F_CSWIFT_INIT 104
75#define CSWIFT_F_CSWIFT_MOD_EXP 105
76#define CSWIFT_F_CSWIFT_MOD_EXP_CRT 106
77#define CSWIFT_F_CSWIFT_RSA_MOD_EXP 107
78
79/* Reason codes. */
80#define CSWIFT_R_ALREADY_LOADED 100
81#define CSWIFT_R_BAD_KEY_SIZE 101
82#define CSWIFT_R_BN_CTX_FULL 102
83#define CSWIFT_R_BN_EXPAND_FAIL 103
84#define CSWIFT_R_CTRL_COMMAND_NOT_IMPLEMENTED 104
85#define CSWIFT_R_MISSING_KEY_COMPONENTS 105
86#define CSWIFT_R_NOT_LOADED 106
87#define CSWIFT_R_REQUEST_FAILED 107
88#define CSWIFT_R_UNIT_FAILURE 108
89
90#ifdef __cplusplus
91}
92#endif
93#endif
diff --git a/src/lib/libcrypto/engine/hw_ncipher.c b/src/lib/libcrypto/engine/hw_ncipher.c
new file mode 100644
index 0000000000..0d1c6b8df0
--- /dev/null
+++ b/src/lib/libcrypto/engine/hw_ncipher.c
@@ -0,0 +1,1388 @@
1/* crypto/engine/hw_ncipher.c -*- mode: C; c-file-style: "eay" -*- */
2/* Written by Richard Levitte (richard@levitte.org), Geoff Thorpe
3 * (geoff@geoffthorpe.net) and Dr Stephen N Henson (shenson@bigfoot.com)
4 * for the OpenSSL project 2000.
5 */
6/* ====================================================================
7 * Copyright (c) 1999-2001 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
60#include <stdio.h>
61#include <string.h>
62#include "cryptlib.h"
63#include <openssl/crypto.h>
64#include <openssl/pem.h>
65#include <openssl/dso.h>
66#include <openssl/engine.h>
67#include <openssl/ui.h>
68
69#ifndef OPENSSL_NO_HW
70#ifndef OPENSSL_NO_HW_NCIPHER
71
72/* Attribution notice: nCipher have said several times that it's OK for
73 * us to implement a general interface to their boxes, and recently declared
74 * their HWCryptoHook to be public, and therefore available for us to use.
75 * Thanks, nCipher.
76 *
77 * The hwcryptohook.h included here is from May 2000.
78 * [Richard Levitte]
79 */
80#ifdef FLAT_INC
81#include "hwcryptohook.h"
82#else
83#include "vendor_defns/hwcryptohook.h"
84#endif
85
86#define HWCRHK_LIB_NAME "hwcrhk engine"
87#include "hw_ncipher_err.c"
88
89static int hwcrhk_destroy(ENGINE *e);
90static int hwcrhk_init(ENGINE *e);
91static int hwcrhk_finish(ENGINE *e);
92static int hwcrhk_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f)());
93
94/* Functions to handle mutexes if have dynamic locks */
95static int hwcrhk_mutex_init(HWCryptoHook_Mutex*, HWCryptoHook_CallerContext*);
96static int hwcrhk_mutex_lock(HWCryptoHook_Mutex*);
97static void hwcrhk_mutex_unlock(HWCryptoHook_Mutex*);
98static void hwcrhk_mutex_destroy(HWCryptoHook_Mutex*);
99#if 1 /* This is a HACK which will disappear in 0.9.8 */
100/* Functions to handle mutexes if only have static locks */
101static int hwcrhk_static_mutex_init(HWCryptoHook_Mutex *m,
102 HWCryptoHook_CallerContext *c);
103static int hwcrhk_static_mutex_lock(HWCryptoHook_Mutex *m);
104static void hwcrhk_static_mutex_unlock(HWCryptoHook_Mutex *m);
105static void hwcrhk_static_mutex_destroy(HWCryptoHook_Mutex *m);
106#endif
107
108/* BIGNUM stuff */
109static int hwcrhk_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
110 const BIGNUM *m, BN_CTX *ctx);
111
112#ifndef OPENSSL_NO_RSA
113/* RSA stuff */
114static int hwcrhk_rsa_mod_exp(BIGNUM *r, const BIGNUM *I, RSA *rsa);
115#endif
116/* This function is aliased to mod_exp (with the mont stuff dropped). */
117static int hwcrhk_mod_exp_mont(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
118 const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx);
119
120#ifndef OPENSSL_NO_DH
121/* DH stuff */
122/* This function is alised to mod_exp (with the DH and mont dropped). */
123static int hwcrhk_mod_exp_dh(const DH *dh, BIGNUM *r,
124 const BIGNUM *a, const BIGNUM *p,
125 const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx);
126#endif
127
128/* RAND stuff */
129static int hwcrhk_rand_bytes(unsigned char *buf, int num);
130static int hwcrhk_rand_status(void);
131
132/* KM stuff */
133static EVP_PKEY *hwcrhk_load_privkey(ENGINE *eng, const char *key_id,
134 UI_METHOD *ui_method, void *callback_data);
135static EVP_PKEY *hwcrhk_load_pubkey(ENGINE *eng, const char *key_id,
136 UI_METHOD *ui_method, void *callback_data);
137static void hwcrhk_ex_free(void *obj, void *item, CRYPTO_EX_DATA *ad,
138 int ind,long argl, void *argp);
139
140/* Interaction stuff */
141static int hwcrhk_insert_card(const char *prompt_info,
142 const char *wrong_info,
143 HWCryptoHook_PassphraseContext *ppctx,
144 HWCryptoHook_CallerContext *cactx);
145static int hwcrhk_get_pass(const char *prompt_info,
146 int *len_io, char *buf,
147 HWCryptoHook_PassphraseContext *ppctx,
148 HWCryptoHook_CallerContext *cactx);
149static void hwcrhk_log_message(void *logstr, const char *message);
150
151/* The definitions for control commands specific to this engine */
152#define HWCRHK_CMD_SO_PATH ENGINE_CMD_BASE
153#define HWCRHK_CMD_FORK_CHECK (ENGINE_CMD_BASE + 1)
154#define HWCRHK_CMD_THREAD_LOCKING (ENGINE_CMD_BASE + 2)
155#define HWCRHK_CMD_SET_USER_INTERFACE (ENGINE_CMD_BASE + 3)
156#define HWCRHK_CMD_SET_CALLBACK_DATA (ENGINE_CMD_BASE + 4)
157static const ENGINE_CMD_DEFN hwcrhk_cmd_defns[] = {
158 {HWCRHK_CMD_SO_PATH,
159 "SO_PATH",
160 "Specifies the path to the 'hwcrhk' shared library",
161 ENGINE_CMD_FLAG_STRING},
162 {HWCRHK_CMD_FORK_CHECK,
163 "FORK_CHECK",
164 "Turns fork() checking on or off (boolean)",
165 ENGINE_CMD_FLAG_NUMERIC},
166 {HWCRHK_CMD_THREAD_LOCKING,
167 "THREAD_LOCKING",
168 "Turns thread-safe locking on or off (boolean)",
169 ENGINE_CMD_FLAG_NUMERIC},
170 {HWCRHK_CMD_SET_USER_INTERFACE,
171 "SET_USER_INTERFACE",
172 "Set the global user interface (internal)",
173 ENGINE_CMD_FLAG_INTERNAL},
174 {HWCRHK_CMD_SET_CALLBACK_DATA,
175 "SET_CALLBACK_DATA",
176 "Set the global user interface extra data (internal)",
177 ENGINE_CMD_FLAG_INTERNAL},
178 {0, NULL, NULL, 0}
179 };
180
181#ifndef OPENSSL_NO_RSA
182/* Our internal RSA_METHOD that we provide pointers to */
183static RSA_METHOD hwcrhk_rsa =
184 {
185 "nCipher RSA method",
186 NULL,
187 NULL,
188 NULL,
189 NULL,
190 hwcrhk_rsa_mod_exp,
191 hwcrhk_mod_exp_mont,
192 NULL,
193 NULL,
194 0,
195 NULL,
196 NULL,
197 NULL
198 };
199#endif
200
201#ifndef OPENSSL_NO_DH
202/* Our internal DH_METHOD that we provide pointers to */
203static DH_METHOD hwcrhk_dh =
204 {
205 "nCipher DH method",
206 NULL,
207 NULL,
208 hwcrhk_mod_exp_dh,
209 NULL,
210 NULL,
211 0,
212 NULL
213 };
214#endif
215
216static RAND_METHOD hwcrhk_rand =
217 {
218 /* "nCipher RAND method", */
219 NULL,
220 hwcrhk_rand_bytes,
221 NULL,
222 NULL,
223 hwcrhk_rand_bytes,
224 hwcrhk_rand_status,
225 };
226
227/* Constants used when creating the ENGINE */
228static const char *engine_hwcrhk_id = "chil";
229static const char *engine_hwcrhk_name = "nCipher hardware engine support";
230
231/* Internal stuff for HWCryptoHook */
232
233/* Some structures needed for proper use of thread locks */
234/* hwcryptohook.h has some typedefs that turn struct HWCryptoHook_MutexValue
235 into HWCryptoHook_Mutex */
236struct HWCryptoHook_MutexValue
237 {
238 int lockid;
239 };
240
241/* hwcryptohook.h has some typedefs that turn
242 struct HWCryptoHook_PassphraseContextValue
243 into HWCryptoHook_PassphraseContext */
244struct HWCryptoHook_PassphraseContextValue
245 {
246 UI_METHOD *ui_method;
247 void *callback_data;
248 };
249
250/* hwcryptohook.h has some typedefs that turn
251 struct HWCryptoHook_CallerContextValue
252 into HWCryptoHook_CallerContext */
253struct HWCryptoHook_CallerContextValue
254 {
255 pem_password_cb *password_callback; /* Deprecated! Only present for
256 backward compatibility! */
257 UI_METHOD *ui_method;
258 void *callback_data;
259 };
260
261/* The MPI structure in HWCryptoHook is pretty compatible with OpenSSL
262 BIGNUM's, so lets define a couple of conversion macros */
263#define BN2MPI(mp, bn) \
264 {mp.size = bn->top * sizeof(BN_ULONG); mp.buf = (unsigned char *)bn->d;}
265#define MPI2BN(bn, mp) \
266 {mp.size = bn->dmax * sizeof(BN_ULONG); mp.buf = (unsigned char *)bn->d;}
267
268static BIO *logstream = NULL;
269static int disable_mutex_callbacks = 0;
270
271/* One might wonder why these are needed, since one can pass down at least
272 a UI_METHOD and a pointer to callback data to the key-loading functions.
273 The thing is that the ModExp and RSAImmed functions can load keys as well,
274 if the data they get is in a special, nCipher-defined format (hint: if you
275 look at the private exponent of the RSA data as a string, you'll see this
276 string: "nCipher KM tool key id", followed by some bytes, followed a key
277 identity string, followed by more bytes. This happens when you use "embed"
278 keys instead of "hwcrhk" keys). Unfortunately, those functions do not take
279 any passphrase or caller context, and our functions can't really take any
280 callback data either. Still, the "insert_card" and "get_passphrase"
281 callbacks may be called down the line, and will need to know what user
282 interface callbacks to call, and having callback data from the application
283 may be a nice thing as well, so we need to keep track of that globally. */
284static HWCryptoHook_CallerContext password_context = { NULL, NULL, NULL };
285
286/* Stuff to pass to the HWCryptoHook library */
287static HWCryptoHook_InitInfo hwcrhk_globals = {
288 HWCryptoHook_InitFlags_SimpleForkCheck, /* Flags */
289 &logstream, /* logstream */
290 sizeof(BN_ULONG), /* limbsize */
291 0, /* mslimb first: false for BNs */
292 -1, /* msbyte first: use native */
293 0, /* Max mutexes, 0 = no small limit */
294 0, /* Max simultaneous, 0 = default */
295
296 /* The next few are mutex stuff: we write wrapper functions
297 around the OS mutex functions. We initialise them to 0
298 here, and change that to actual function pointers in hwcrhk_init()
299 if dynamic locks are supported (that is, if the application
300 programmer has made sure of setting up callbacks bafore starting
301 this engine) *and* if disable_mutex_callbacks hasn't been set by
302 a call to ENGINE_ctrl(ENGINE_CTRL_CHIL_NO_LOCKING). */
303 sizeof(HWCryptoHook_Mutex),
304 0,
305 0,
306 0,
307 0,
308
309 /* The next few are condvar stuff: we write wrapper functions
310 round the OS functions. Currently not implemented and not
311 and absolute necessity even in threaded programs, therefore
312 0'ed. Will hopefully be implemented some day, since it
313 enhances the efficiency of HWCryptoHook. */
314 0, /* sizeof(HWCryptoHook_CondVar), */
315 0, /* hwcrhk_cv_init, */
316 0, /* hwcrhk_cv_wait, */
317 0, /* hwcrhk_cv_signal, */
318 0, /* hwcrhk_cv_broadcast, */
319 0, /* hwcrhk_cv_destroy, */
320
321 hwcrhk_get_pass, /* pass phrase */
322 hwcrhk_insert_card, /* insert a card */
323 hwcrhk_log_message /* Log message */
324};
325
326
327/* Now, to our own code */
328
329/* This internal function is used by ENGINE_ncipher() and possibly by the
330 * "dynamic" ENGINE support too */
331static int bind_helper(ENGINE *e)
332 {
333#ifndef OPENSSL_NO_RSA
334 const RSA_METHOD *meth1;
335#endif
336#ifndef OPENSSL_NO_DH
337 const DH_METHOD *meth2;
338#endif
339 if(!ENGINE_set_id(e, engine_hwcrhk_id) ||
340 !ENGINE_set_name(e, engine_hwcrhk_name) ||
341#ifndef OPENSSL_NO_RSA
342 !ENGINE_set_RSA(e, &hwcrhk_rsa) ||
343#endif
344#ifndef OPENSSL_NO_DH
345 !ENGINE_set_DH(e, &hwcrhk_dh) ||
346#endif
347 !ENGINE_set_RAND(e, &hwcrhk_rand) ||
348 !ENGINE_set_destroy_function(e, hwcrhk_destroy) ||
349 !ENGINE_set_init_function(e, hwcrhk_init) ||
350 !ENGINE_set_finish_function(e, hwcrhk_finish) ||
351 !ENGINE_set_ctrl_function(e, hwcrhk_ctrl) ||
352 !ENGINE_set_load_privkey_function(e, hwcrhk_load_privkey) ||
353 !ENGINE_set_load_pubkey_function(e, hwcrhk_load_pubkey) ||
354 !ENGINE_set_cmd_defns(e, hwcrhk_cmd_defns))
355 return 0;
356
357#ifndef OPENSSL_NO_RSA
358 /* We know that the "PKCS1_SSLeay()" functions hook properly
359 * to the cswift-specific mod_exp and mod_exp_crt so we use
360 * those functions. NB: We don't use ENGINE_openssl() or
361 * anything "more generic" because something like the RSAref
362 * code may not hook properly, and if you own one of these
363 * cards then you have the right to do RSA operations on it
364 * anyway! */
365 meth1 = RSA_PKCS1_SSLeay();
366 hwcrhk_rsa.rsa_pub_enc = meth1->rsa_pub_enc;
367 hwcrhk_rsa.rsa_pub_dec = meth1->rsa_pub_dec;
368 hwcrhk_rsa.rsa_priv_enc = meth1->rsa_priv_enc;
369 hwcrhk_rsa.rsa_priv_dec = meth1->rsa_priv_dec;
370#endif
371
372#ifndef OPENSSL_NO_DH
373 /* Much the same for Diffie-Hellman */
374 meth2 = DH_OpenSSL();
375 hwcrhk_dh.generate_key = meth2->generate_key;
376 hwcrhk_dh.compute_key = meth2->compute_key;
377#endif
378
379 /* Ensure the hwcrhk error handling is set up */
380 ERR_load_HWCRHK_strings();
381 return 1;
382 }
383
384#ifndef ENGINE_DYNAMIC_SUPPORT
385static ENGINE *engine_ncipher(void)
386 {
387 ENGINE *ret = ENGINE_new();
388 if(!ret)
389 return NULL;
390 if(!bind_helper(ret))
391 {
392 ENGINE_free(ret);
393 return NULL;
394 }
395 return ret;
396 }
397
398void ENGINE_load_chil(void)
399 {
400 /* Copied from eng_[openssl|dyn].c */
401 ENGINE *toadd = engine_ncipher();
402 if(!toadd) return;
403 ENGINE_add(toadd);
404 ENGINE_free(toadd);
405 ERR_clear_error();
406 }
407#endif
408
409/* This is a process-global DSO handle used for loading and unloading
410 * the HWCryptoHook library. NB: This is only set (or unset) during an
411 * init() or finish() call (reference counts permitting) and they're
412 * operating with global locks, so this should be thread-safe
413 * implicitly. */
414static DSO *hwcrhk_dso = NULL;
415static HWCryptoHook_ContextHandle hwcrhk_context = 0;
416#ifndef OPENSSL_NO_RSA
417static int hndidx_rsa = -1; /* Index for KM handle. Not really used yet. */
418#endif
419
420/* These are the function pointers that are (un)set when the library has
421 * successfully (un)loaded. */
422static HWCryptoHook_Init_t *p_hwcrhk_Init = NULL;
423static HWCryptoHook_Finish_t *p_hwcrhk_Finish = NULL;
424static HWCryptoHook_ModExp_t *p_hwcrhk_ModExp = NULL;
425#ifndef OPENSSL_NO_RSA
426static HWCryptoHook_RSA_t *p_hwcrhk_RSA = NULL;
427#endif
428static HWCryptoHook_RandomBytes_t *p_hwcrhk_RandomBytes = NULL;
429#ifndef OPENSSL_NO_RSA
430static HWCryptoHook_RSALoadKey_t *p_hwcrhk_RSALoadKey = NULL;
431static HWCryptoHook_RSAGetPublicKey_t *p_hwcrhk_RSAGetPublicKey = NULL;
432static HWCryptoHook_RSAUnloadKey_t *p_hwcrhk_RSAUnloadKey = NULL;
433#endif
434static HWCryptoHook_ModExpCRT_t *p_hwcrhk_ModExpCRT = NULL;
435
436/* Used in the DSO operations. */
437static const char *HWCRHK_LIBNAME = NULL;
438static void free_HWCRHK_LIBNAME(void)
439 {
440 if(HWCRHK_LIBNAME)
441 OPENSSL_free((void*)HWCRHK_LIBNAME);
442 HWCRHK_LIBNAME = NULL;
443 }
444static const char *get_HWCRHK_LIBNAME(void)
445 {
446 if(HWCRHK_LIBNAME)
447 return HWCRHK_LIBNAME;
448 return "nfhwcrhk";
449 }
450static long set_HWCRHK_LIBNAME(const char *name)
451 {
452 free_HWCRHK_LIBNAME();
453 return (((HWCRHK_LIBNAME = BUF_strdup(name)) != NULL) ? 1 : 0);
454 }
455static const char *n_hwcrhk_Init = "HWCryptoHook_Init";
456static const char *n_hwcrhk_Finish = "HWCryptoHook_Finish";
457static const char *n_hwcrhk_ModExp = "HWCryptoHook_ModExp";
458#ifndef OPENSSL_NO_RSA
459static const char *n_hwcrhk_RSA = "HWCryptoHook_RSA";
460#endif
461static const char *n_hwcrhk_RandomBytes = "HWCryptoHook_RandomBytes";
462#ifndef OPENSSL_NO_RSA
463static const char *n_hwcrhk_RSALoadKey = "HWCryptoHook_RSALoadKey";
464static const char *n_hwcrhk_RSAGetPublicKey = "HWCryptoHook_RSAGetPublicKey";
465static const char *n_hwcrhk_RSAUnloadKey = "HWCryptoHook_RSAUnloadKey";
466#endif
467static const char *n_hwcrhk_ModExpCRT = "HWCryptoHook_ModExpCRT";
468
469/* HWCryptoHook library functions and mechanics - these are used by the
470 * higher-level functions further down. NB: As and where there's no
471 * error checking, take a look lower down where these functions are
472 * called, the checking and error handling is probably down there. */
473
474/* utility function to obtain a context */
475static int get_context(HWCryptoHook_ContextHandle *hac,
476 HWCryptoHook_CallerContext *cac)
477 {
478 char tempbuf[1024];
479 HWCryptoHook_ErrMsgBuf rmsg;
480
481 rmsg.buf = tempbuf;
482 rmsg.size = sizeof(tempbuf);
483
484 *hac = p_hwcrhk_Init(&hwcrhk_globals, sizeof(hwcrhk_globals), &rmsg,
485 cac);
486 if (!*hac)
487 return 0;
488 return 1;
489 }
490
491/* similarly to release one. */
492static void release_context(HWCryptoHook_ContextHandle hac)
493 {
494 p_hwcrhk_Finish(hac);
495 }
496
497/* Destructor (complements the "ENGINE_ncipher()" constructor) */
498static int hwcrhk_destroy(ENGINE *e)
499 {
500 free_HWCRHK_LIBNAME();
501 ERR_unload_HWCRHK_strings();
502 return 1;
503 }
504
505/* (de)initialisation functions. */
506static int hwcrhk_init(ENGINE *e)
507 {
508 HWCryptoHook_Init_t *p1;
509 HWCryptoHook_Finish_t *p2;
510 HWCryptoHook_ModExp_t *p3;
511#ifndef OPENSSL_NO_RSA
512 HWCryptoHook_RSA_t *p4;
513 HWCryptoHook_RSALoadKey_t *p5;
514 HWCryptoHook_RSAGetPublicKey_t *p6;
515 HWCryptoHook_RSAUnloadKey_t *p7;
516#endif
517 HWCryptoHook_RandomBytes_t *p8;
518 HWCryptoHook_ModExpCRT_t *p9;
519
520 if(hwcrhk_dso != NULL)
521 {
522 HWCRHKerr(HWCRHK_F_HWCRHK_INIT,HWCRHK_R_ALREADY_LOADED);
523 goto err;
524 }
525 /* Attempt to load libnfhwcrhk.so/nfhwcrhk.dll/whatever. */
526 hwcrhk_dso = DSO_load(NULL, get_HWCRHK_LIBNAME(), NULL, 0);
527 if(hwcrhk_dso == NULL)
528 {
529 HWCRHKerr(HWCRHK_F_HWCRHK_INIT,HWCRHK_R_DSO_FAILURE);
530 goto err;
531 }
532 if(!(p1 = (HWCryptoHook_Init_t *)
533 DSO_bind_func(hwcrhk_dso, n_hwcrhk_Init)) ||
534 !(p2 = (HWCryptoHook_Finish_t *)
535 DSO_bind_func(hwcrhk_dso, n_hwcrhk_Finish)) ||
536 !(p3 = (HWCryptoHook_ModExp_t *)
537 DSO_bind_func(hwcrhk_dso, n_hwcrhk_ModExp)) ||
538#ifndef OPENSSL_NO_RSA
539 !(p4 = (HWCryptoHook_RSA_t *)
540 DSO_bind_func(hwcrhk_dso, n_hwcrhk_RSA)) ||
541 !(p5 = (HWCryptoHook_RSALoadKey_t *)
542 DSO_bind_func(hwcrhk_dso, n_hwcrhk_RSALoadKey)) ||
543 !(p6 = (HWCryptoHook_RSAGetPublicKey_t *)
544 DSO_bind_func(hwcrhk_dso, n_hwcrhk_RSAGetPublicKey)) ||
545 !(p7 = (HWCryptoHook_RSAUnloadKey_t *)
546 DSO_bind_func(hwcrhk_dso, n_hwcrhk_RSAUnloadKey)) ||
547#endif
548 !(p8 = (HWCryptoHook_RandomBytes_t *)
549 DSO_bind_func(hwcrhk_dso, n_hwcrhk_RandomBytes)) ||
550 !(p9 = (HWCryptoHook_ModExpCRT_t *)
551 DSO_bind_func(hwcrhk_dso, n_hwcrhk_ModExpCRT)))
552 {
553 HWCRHKerr(HWCRHK_F_HWCRHK_INIT,HWCRHK_R_DSO_FAILURE);
554 goto err;
555 }
556 /* Copy the pointers */
557 p_hwcrhk_Init = p1;
558 p_hwcrhk_Finish = p2;
559 p_hwcrhk_ModExp = p3;
560#ifndef OPENSSL_NO_RSA
561 p_hwcrhk_RSA = p4;
562 p_hwcrhk_RSALoadKey = p5;
563 p_hwcrhk_RSAGetPublicKey = p6;
564 p_hwcrhk_RSAUnloadKey = p7;
565#endif
566 p_hwcrhk_RandomBytes = p8;
567 p_hwcrhk_ModExpCRT = p9;
568
569 /* Check if the application decided to support dynamic locks,
570 and if it does, use them. */
571 if (disable_mutex_callbacks == 0)
572 {
573 if (CRYPTO_get_dynlock_create_callback() != NULL &&
574 CRYPTO_get_dynlock_lock_callback() != NULL &&
575 CRYPTO_get_dynlock_destroy_callback() != NULL)
576 {
577 hwcrhk_globals.mutex_init = hwcrhk_mutex_init;
578 hwcrhk_globals.mutex_acquire = hwcrhk_mutex_lock;
579 hwcrhk_globals.mutex_release = hwcrhk_mutex_unlock;
580 hwcrhk_globals.mutex_destroy = hwcrhk_mutex_destroy;
581 }
582 else if (CRYPTO_get_locking_callback() != NULL)
583 {
584 HWCRHKerr(HWCRHK_F_HWCRHK_INIT,HWCRHK_R_DYNAMIC_LOCKING_MISSING);
585 ERR_add_error_data(1,"You HAVE to add dynamic locking callbacks via CRYPTO_set_dynlock_{create,lock,destroy}_callback()");
586#if 1 /* This is a HACK which will disappear in 0.9.8 */
587 hwcrhk_globals.maxmutexes = 1; /* Only have one lock */
588 hwcrhk_globals.mutex_init = hwcrhk_static_mutex_init;
589 hwcrhk_globals.mutex_acquire = hwcrhk_static_mutex_lock;
590 hwcrhk_globals.mutex_release = hwcrhk_static_mutex_unlock;
591 hwcrhk_globals.mutex_destroy = hwcrhk_static_mutex_destroy;
592#else
593 goto err;
594#endif
595 }
596 }
597
598 /* Try and get a context - if not, we may have a DSO but no
599 * accelerator! */
600 if(!get_context(&hwcrhk_context, &password_context))
601 {
602 HWCRHKerr(HWCRHK_F_HWCRHK_INIT,HWCRHK_R_UNIT_FAILURE);
603 goto err;
604 }
605 /* Everything's fine. */
606#ifndef OPENSSL_NO_RSA
607 if (hndidx_rsa == -1)
608 hndidx_rsa = RSA_get_ex_new_index(0,
609 "nFast HWCryptoHook RSA key handle",
610 NULL, NULL, hwcrhk_ex_free);
611#endif
612 return 1;
613err:
614 if(hwcrhk_dso)
615 DSO_free(hwcrhk_dso);
616 hwcrhk_dso = NULL;
617 p_hwcrhk_Init = NULL;
618 p_hwcrhk_Finish = NULL;
619 p_hwcrhk_ModExp = NULL;
620#ifndef OPENSSL_NO_RSA
621 p_hwcrhk_RSA = NULL;
622 p_hwcrhk_RSALoadKey = NULL;
623 p_hwcrhk_RSAGetPublicKey = NULL;
624 p_hwcrhk_RSAUnloadKey = NULL;
625#endif
626 p_hwcrhk_ModExpCRT = NULL;
627 p_hwcrhk_RandomBytes = NULL;
628 return 0;
629 }
630
631static int hwcrhk_finish(ENGINE *e)
632 {
633 int to_return = 1;
634 free_HWCRHK_LIBNAME();
635 if(hwcrhk_dso == NULL)
636 {
637 HWCRHKerr(HWCRHK_F_HWCRHK_FINISH,HWCRHK_R_NOT_LOADED);
638 to_return = 0;
639 goto err;
640 }
641 release_context(hwcrhk_context);
642 if(!DSO_free(hwcrhk_dso))
643 {
644 HWCRHKerr(HWCRHK_F_HWCRHK_FINISH,HWCRHK_R_DSO_FAILURE);
645 to_return = 0;
646 goto err;
647 }
648 err:
649 if (logstream)
650 BIO_free(logstream);
651 hwcrhk_dso = NULL;
652 p_hwcrhk_Init = NULL;
653 p_hwcrhk_Finish = NULL;
654 p_hwcrhk_ModExp = NULL;
655#ifndef OPENSSL_NO_RSA
656 p_hwcrhk_RSA = NULL;
657 p_hwcrhk_RSALoadKey = NULL;
658 p_hwcrhk_RSAGetPublicKey = NULL;
659 p_hwcrhk_RSAUnloadKey = NULL;
660#endif
661 p_hwcrhk_ModExpCRT = NULL;
662 p_hwcrhk_RandomBytes = NULL;
663 return to_return;
664 }
665
666static int hwcrhk_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f)())
667 {
668 int to_return = 1;
669
670 switch(cmd)
671 {
672 case HWCRHK_CMD_SO_PATH:
673 if(hwcrhk_dso)
674 {
675 HWCRHKerr(HWCRHK_F_HWCRHK_CTRL,HWCRHK_R_ALREADY_LOADED);
676 return 0;
677 }
678 if(p == NULL)
679 {
680 HWCRHKerr(HWCRHK_F_HWCRHK_CTRL,ERR_R_PASSED_NULL_PARAMETER);
681 return 0;
682 }
683 return set_HWCRHK_LIBNAME((const char *)p);
684 case ENGINE_CTRL_SET_LOGSTREAM:
685 {
686 BIO *bio = (BIO *)p;
687
688 CRYPTO_w_lock(CRYPTO_LOCK_ENGINE);
689 if (logstream)
690 {
691 BIO_free(logstream);
692 logstream = NULL;
693 }
694 if (CRYPTO_add(&bio->references,1,CRYPTO_LOCK_BIO) > 1)
695 logstream = bio;
696 else
697 HWCRHKerr(HWCRHK_F_HWCRHK_CTRL,HWCRHK_R_BIO_WAS_FREED);
698 }
699 CRYPTO_w_unlock(CRYPTO_LOCK_ENGINE);
700 break;
701 case ENGINE_CTRL_SET_PASSWORD_CALLBACK:
702 CRYPTO_w_lock(CRYPTO_LOCK_ENGINE);
703 password_context.password_callback = (pem_password_cb *)f;
704 CRYPTO_w_unlock(CRYPTO_LOCK_ENGINE);
705 break;
706 case ENGINE_CTRL_SET_USER_INTERFACE:
707 case HWCRHK_CMD_SET_USER_INTERFACE:
708 CRYPTO_w_lock(CRYPTO_LOCK_ENGINE);
709 password_context.ui_method = (UI_METHOD *)p;
710 CRYPTO_w_unlock(CRYPTO_LOCK_ENGINE);
711 break;
712 case ENGINE_CTRL_SET_CALLBACK_DATA:
713 case HWCRHK_CMD_SET_CALLBACK_DATA:
714 CRYPTO_w_lock(CRYPTO_LOCK_ENGINE);
715 password_context.callback_data = p;
716 CRYPTO_w_unlock(CRYPTO_LOCK_ENGINE);
717 break;
718 /* this enables or disables the "SimpleForkCheck" flag used in the
719 * initialisation structure. */
720 case ENGINE_CTRL_CHIL_SET_FORKCHECK:
721 case HWCRHK_CMD_FORK_CHECK:
722 CRYPTO_w_lock(CRYPTO_LOCK_ENGINE);
723 if(i)
724 hwcrhk_globals.flags |=
725 HWCryptoHook_InitFlags_SimpleForkCheck;
726 else
727 hwcrhk_globals.flags &=
728 ~HWCryptoHook_InitFlags_SimpleForkCheck;
729 CRYPTO_w_unlock(CRYPTO_LOCK_ENGINE);
730 break;
731 /* This will prevent the initialisation function from "installing"
732 * the mutex-handling callbacks, even if they are available from
733 * within the library (or were provided to the library from the
734 * calling application). This is to remove any baggage for
735 * applications not using multithreading. */
736 case ENGINE_CTRL_CHIL_NO_LOCKING:
737 CRYPTO_w_lock(CRYPTO_LOCK_ENGINE);
738 disable_mutex_callbacks = 1;
739 CRYPTO_w_unlock(CRYPTO_LOCK_ENGINE);
740 break;
741 case HWCRHK_CMD_THREAD_LOCKING:
742 CRYPTO_w_lock(CRYPTO_LOCK_ENGINE);
743 disable_mutex_callbacks = ((i == 0) ? 0 : 1);
744 CRYPTO_w_unlock(CRYPTO_LOCK_ENGINE);
745 break;
746
747 /* The command isn't understood by this engine */
748 default:
749 HWCRHKerr(HWCRHK_F_HWCRHK_CTRL,
750 HWCRHK_R_CTRL_COMMAND_NOT_IMPLEMENTED);
751 to_return = 0;
752 break;
753 }
754
755 return to_return;
756 }
757
758static EVP_PKEY *hwcrhk_load_privkey(ENGINE *eng, const char *key_id,
759 UI_METHOD *ui_method, void *callback_data)
760 {
761#ifndef OPENSSL_NO_RSA
762 RSA *rtmp = NULL;
763#endif
764 EVP_PKEY *res = NULL;
765#ifndef OPENSSL_NO_RSA
766 HWCryptoHook_MPI e, n;
767 HWCryptoHook_RSAKeyHandle *hptr;
768#endif
769#if !defined(OPENSSL_NO_RSA)
770 char tempbuf[1024];
771 HWCryptoHook_ErrMsgBuf rmsg;
772#endif
773 HWCryptoHook_PassphraseContext ppctx;
774
775#if !defined(OPENSSL_NO_RSA)
776 rmsg.buf = tempbuf;
777 rmsg.size = sizeof(tempbuf);
778#endif
779
780 if(!hwcrhk_context)
781 {
782 HWCRHKerr(HWCRHK_F_HWCRHK_LOAD_PRIVKEY,
783 HWCRHK_R_NOT_INITIALISED);
784 goto err;
785 }
786#ifndef OPENSSL_NO_RSA
787 hptr = OPENSSL_malloc(sizeof(HWCryptoHook_RSAKeyHandle));
788 if (!hptr)
789 {
790 HWCRHKerr(HWCRHK_F_HWCRHK_LOAD_PRIVKEY,
791 ERR_R_MALLOC_FAILURE);
792 goto err;
793 }
794 ppctx.ui_method = ui_method;
795 ppctx.callback_data = callback_data;
796 if (p_hwcrhk_RSALoadKey(hwcrhk_context, key_id, hptr,
797 &rmsg, &ppctx))
798 {
799 HWCRHKerr(HWCRHK_F_HWCRHK_LOAD_PRIVKEY,
800 HWCRHK_R_CHIL_ERROR);
801 ERR_add_error_data(1,rmsg.buf);
802 goto err;
803 }
804 if (!*hptr)
805 {
806 HWCRHKerr(HWCRHK_F_HWCRHK_LOAD_PRIVKEY,
807 HWCRHK_R_NO_KEY);
808 goto err;
809 }
810#endif
811#ifndef OPENSSL_NO_RSA
812 rtmp = RSA_new_method(eng);
813 RSA_set_ex_data(rtmp, hndidx_rsa, (char *)hptr);
814 rtmp->e = BN_new();
815 rtmp->n = BN_new();
816 rtmp->flags |= RSA_FLAG_EXT_PKEY;
817 MPI2BN(rtmp->e, e);
818 MPI2BN(rtmp->n, n);
819 if (p_hwcrhk_RSAGetPublicKey(*hptr, &n, &e, &rmsg)
820 != HWCRYPTOHOOK_ERROR_MPISIZE)
821 {
822 HWCRHKerr(HWCRHK_F_HWCRHK_LOAD_PUBKEY,HWCRHK_R_CHIL_ERROR);
823 ERR_add_error_data(1,rmsg.buf);
824 goto err;
825 }
826
827 bn_expand2(rtmp->e, e.size/sizeof(BN_ULONG));
828 bn_expand2(rtmp->n, n.size/sizeof(BN_ULONG));
829 MPI2BN(rtmp->e, e);
830 MPI2BN(rtmp->n, n);
831
832 if (p_hwcrhk_RSAGetPublicKey(*hptr, &n, &e, &rmsg))
833 {
834 HWCRHKerr(HWCRHK_F_HWCRHK_LOAD_PUBKEY,
835 HWCRHK_R_CHIL_ERROR);
836 ERR_add_error_data(1,rmsg.buf);
837 goto err;
838 }
839 rtmp->e->top = e.size / sizeof(BN_ULONG);
840 bn_fix_top(rtmp->e);
841 rtmp->n->top = n.size / sizeof(BN_ULONG);
842 bn_fix_top(rtmp->n);
843
844 res = EVP_PKEY_new();
845 EVP_PKEY_assign_RSA(res, rtmp);
846#endif
847
848 if (!res)
849 HWCRHKerr(HWCRHK_F_HWCRHK_LOAD_PUBKEY,
850 HWCRHK_R_PRIVATE_KEY_ALGORITHMS_DISABLED);
851
852 return res;
853 err:
854 if (res)
855 EVP_PKEY_free(res);
856#ifndef OPENSSL_NO_RSA
857 if (rtmp)
858 RSA_free(rtmp);
859#endif
860 return NULL;
861 }
862
863static EVP_PKEY *hwcrhk_load_pubkey(ENGINE *eng, const char *key_id,
864 UI_METHOD *ui_method, void *callback_data)
865 {
866 EVP_PKEY *res = NULL;
867
868#ifndef OPENSSL_NO_RSA
869 res = hwcrhk_load_privkey(eng, key_id,
870 ui_method, callback_data);
871#endif
872
873 if (res)
874 switch(res->type)
875 {
876#ifndef OPENSSL_NO_RSA
877 case EVP_PKEY_RSA:
878 {
879 RSA *rsa = NULL;
880
881 CRYPTO_w_lock(CRYPTO_LOCK_EVP_PKEY);
882 rsa = res->pkey.rsa;
883 res->pkey.rsa = RSA_new();
884 res->pkey.rsa->n = rsa->n;
885 res->pkey.rsa->e = rsa->e;
886 rsa->n = NULL;
887 rsa->e = NULL;
888 CRYPTO_w_unlock(CRYPTO_LOCK_EVP_PKEY);
889 RSA_free(rsa);
890 }
891 break;
892#endif
893 default:
894 HWCRHKerr(HWCRHK_F_HWCRHK_LOAD_PUBKEY,
895 HWCRHK_R_CTRL_COMMAND_NOT_IMPLEMENTED);
896 goto err;
897 }
898
899 return res;
900 err:
901 if (res)
902 EVP_PKEY_free(res);
903 return NULL;
904 }
905
906/* A little mod_exp */
907static int hwcrhk_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
908 const BIGNUM *m, BN_CTX *ctx)
909 {
910 char tempbuf[1024];
911 HWCryptoHook_ErrMsgBuf rmsg;
912 /* Since HWCryptoHook_MPI is pretty compatible with BIGNUM's,
913 we use them directly, plus a little macro magic. We only
914 thing we need to make sure of is that enough space is allocated. */
915 HWCryptoHook_MPI m_a, m_p, m_n, m_r;
916 int to_return, ret;
917
918 to_return = 0; /* expect failure */
919 rmsg.buf = tempbuf;
920 rmsg.size = sizeof(tempbuf);
921
922 if(!hwcrhk_context)
923 {
924 HWCRHKerr(HWCRHK_F_HWCRHK_MOD_EXP,HWCRHK_R_NOT_INITIALISED);
925 goto err;
926 }
927 /* Prepare the params */
928 bn_expand2(r, m->top); /* Check for error !! */
929 BN2MPI(m_a, a);
930 BN2MPI(m_p, p);
931 BN2MPI(m_n, m);
932 MPI2BN(r, m_r);
933
934 /* Perform the operation */
935 ret = p_hwcrhk_ModExp(hwcrhk_context, m_a, m_p, m_n, &m_r, &rmsg);
936
937 /* Convert the response */
938 r->top = m_r.size / sizeof(BN_ULONG);
939 bn_fix_top(r);
940
941 if (ret < 0)
942 {
943 /* FIXME: When this error is returned, HWCryptoHook is
944 telling us that falling back to software computation
945 might be a good thing. */
946 if(ret == HWCRYPTOHOOK_ERROR_FALLBACK)
947 {
948 HWCRHKerr(HWCRHK_F_HWCRHK_MOD_EXP,HWCRHK_R_REQUEST_FALLBACK);
949 }
950 else
951 {
952 HWCRHKerr(HWCRHK_F_HWCRHK_MOD_EXP,HWCRHK_R_REQUEST_FAILED);
953 }
954 ERR_add_error_data(1,rmsg.buf);
955 goto err;
956 }
957
958 to_return = 1;
959err:
960 return to_return;
961 }
962
963#ifndef OPENSSL_NO_RSA
964static int hwcrhk_rsa_mod_exp(BIGNUM *r, const BIGNUM *I, RSA *rsa)
965 {
966 char tempbuf[1024];
967 HWCryptoHook_ErrMsgBuf rmsg;
968 HWCryptoHook_RSAKeyHandle *hptr;
969 int to_return = 0, ret;
970
971 rmsg.buf = tempbuf;
972 rmsg.size = sizeof(tempbuf);
973
974 if(!hwcrhk_context)
975 {
976 HWCRHKerr(HWCRHK_F_HWCRHK_MOD_EXP,HWCRHK_R_NOT_INITIALISED);
977 goto err;
978 }
979
980 /* This provides support for nForce keys. Since that's opaque data
981 all we do is provide a handle to the proper key and let HWCryptoHook
982 take care of the rest. */
983 if ((hptr = (HWCryptoHook_RSAKeyHandle *) RSA_get_ex_data(rsa, hndidx_rsa))
984 != NULL)
985 {
986 HWCryptoHook_MPI m_a, m_r;
987
988 if(!rsa->n)
989 {
990 HWCRHKerr(HWCRHK_F_HWCRHK_RSA_MOD_EXP,
991 HWCRHK_R_MISSING_KEY_COMPONENTS);
992 goto err;
993 }
994
995 /* Prepare the params */
996 bn_expand2(r, rsa->n->top); /* Check for error !! */
997 BN2MPI(m_a, I);
998 MPI2BN(r, m_r);
999
1000 /* Perform the operation */
1001 ret = p_hwcrhk_RSA(m_a, *hptr, &m_r, &rmsg);
1002
1003 /* Convert the response */
1004 r->top = m_r.size / sizeof(BN_ULONG);
1005 bn_fix_top(r);
1006
1007 if (ret < 0)
1008 {
1009 /* FIXME: When this error is returned, HWCryptoHook is
1010 telling us that falling back to software computation
1011 might be a good thing. */
1012 if(ret == HWCRYPTOHOOK_ERROR_FALLBACK)
1013 {
1014 HWCRHKerr(HWCRHK_F_HWCRHK_RSA_MOD_EXP,
1015 HWCRHK_R_REQUEST_FALLBACK);
1016 }
1017 else
1018 {
1019 HWCRHKerr(HWCRHK_F_HWCRHK_RSA_MOD_EXP,
1020 HWCRHK_R_REQUEST_FAILED);
1021 }
1022 ERR_add_error_data(1,rmsg.buf);
1023 goto err;
1024 }
1025 }
1026 else
1027 {
1028 HWCryptoHook_MPI m_a, m_p, m_q, m_dmp1, m_dmq1, m_iqmp, m_r;
1029
1030 if(!rsa->p || !rsa->q || !rsa->dmp1 || !rsa->dmq1 || !rsa->iqmp)
1031 {
1032 HWCRHKerr(HWCRHK_F_HWCRHK_RSA_MOD_EXP,
1033 HWCRHK_R_MISSING_KEY_COMPONENTS);
1034 goto err;
1035 }
1036
1037 /* Prepare the params */
1038 bn_expand2(r, rsa->n->top); /* Check for error !! */
1039 BN2MPI(m_a, I);
1040 BN2MPI(m_p, rsa->p);
1041 BN2MPI(m_q, rsa->q);
1042 BN2MPI(m_dmp1, rsa->dmp1);
1043 BN2MPI(m_dmq1, rsa->dmq1);
1044 BN2MPI(m_iqmp, rsa->iqmp);
1045 MPI2BN(r, m_r);
1046
1047 /* Perform the operation */
1048 ret = p_hwcrhk_ModExpCRT(hwcrhk_context, m_a, m_p, m_q,
1049 m_dmp1, m_dmq1, m_iqmp, &m_r, &rmsg);
1050
1051 /* Convert the response */
1052 r->top = m_r.size / sizeof(BN_ULONG);
1053 bn_fix_top(r);
1054
1055 if (ret < 0)
1056 {
1057 /* FIXME: When this error is returned, HWCryptoHook is
1058 telling us that falling back to software computation
1059 might be a good thing. */
1060 if(ret == HWCRYPTOHOOK_ERROR_FALLBACK)
1061 {
1062 HWCRHKerr(HWCRHK_F_HWCRHK_RSA_MOD_EXP,
1063 HWCRHK_R_REQUEST_FALLBACK);
1064 }
1065 else
1066 {
1067 HWCRHKerr(HWCRHK_F_HWCRHK_RSA_MOD_EXP,
1068 HWCRHK_R_REQUEST_FAILED);
1069 }
1070 ERR_add_error_data(1,rmsg.buf);
1071 goto err;
1072 }
1073 }
1074 /* If we're here, we must be here with some semblance of success :-) */
1075 to_return = 1;
1076err:
1077 return to_return;
1078 }
1079#endif
1080
1081/* This function is aliased to mod_exp (with the mont stuff dropped). */
1082static int hwcrhk_mod_exp_mont(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
1083 const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx)
1084 {
1085 return hwcrhk_mod_exp(r, a, p, m, ctx);
1086 }
1087
1088#ifndef OPENSSL_NO_DH
1089/* This function is aliased to mod_exp (with the dh and mont dropped). */
1090static int hwcrhk_mod_exp_dh(const DH *dh, BIGNUM *r,
1091 const BIGNUM *a, const BIGNUM *p,
1092 const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx)
1093 {
1094 return hwcrhk_mod_exp(r, a, p, m, ctx);
1095 }
1096#endif
1097
1098/* Random bytes are good */
1099static int hwcrhk_rand_bytes(unsigned char *buf, int num)
1100 {
1101 char tempbuf[1024];
1102 HWCryptoHook_ErrMsgBuf rmsg;
1103 int to_return = 0; /* assume failure */
1104 int ret;
1105
1106 rmsg.buf = tempbuf;
1107 rmsg.size = sizeof(tempbuf);
1108
1109 if(!hwcrhk_context)
1110 {
1111 HWCRHKerr(HWCRHK_F_HWCRHK_RAND_BYTES,HWCRHK_R_NOT_INITIALISED);
1112 goto err;
1113 }
1114
1115 ret = p_hwcrhk_RandomBytes(hwcrhk_context, buf, num, &rmsg);
1116 if (ret < 0)
1117 {
1118 /* FIXME: When this error is returned, HWCryptoHook is
1119 telling us that falling back to software computation
1120 might be a good thing. */
1121 if(ret == HWCRYPTOHOOK_ERROR_FALLBACK)
1122 {
1123 HWCRHKerr(HWCRHK_F_HWCRHK_RAND_BYTES,
1124 HWCRHK_R_REQUEST_FALLBACK);
1125 }
1126 else
1127 {
1128 HWCRHKerr(HWCRHK_F_HWCRHK_RAND_BYTES,
1129 HWCRHK_R_REQUEST_FAILED);
1130 }
1131 ERR_add_error_data(1,rmsg.buf);
1132 goto err;
1133 }
1134 to_return = 1;
1135 err:
1136 return to_return;
1137 }
1138
1139static int hwcrhk_rand_status(void)
1140 {
1141 return 1;
1142 }
1143
1144/* This cleans up an RSA KM key, called when ex_data is freed */
1145
1146static void hwcrhk_ex_free(void *obj, void *item, CRYPTO_EX_DATA *ad,
1147 int ind,long argl, void *argp)
1148{
1149 char tempbuf[1024];
1150 HWCryptoHook_ErrMsgBuf rmsg;
1151#ifndef OPENSSL_NO_RSA
1152 HWCryptoHook_RSAKeyHandle *hptr;
1153#endif
1154#if !defined(OPENSSL_NO_RSA)
1155 int ret;
1156#endif
1157
1158 rmsg.buf = tempbuf;
1159 rmsg.size = sizeof(tempbuf);
1160
1161#ifndef OPENSSL_NO_RSA
1162 hptr = (HWCryptoHook_RSAKeyHandle *) item;
1163 if(hptr)
1164 {
1165 ret = p_hwcrhk_RSAUnloadKey(*hptr, NULL);
1166 OPENSSL_free(hptr);
1167 }
1168#endif
1169}
1170
1171/* Mutex calls: since the HWCryptoHook model closely follows the POSIX model
1172 * these just wrap the POSIX functions and add some logging.
1173 */
1174
1175static int hwcrhk_mutex_init(HWCryptoHook_Mutex* mt,
1176 HWCryptoHook_CallerContext *cactx)
1177 {
1178 mt->lockid = CRYPTO_get_new_dynlockid();
1179 if (mt->lockid == 0)
1180 return 1; /* failure */
1181 return 0; /* success */
1182 }
1183
1184static int hwcrhk_mutex_lock(HWCryptoHook_Mutex *mt)
1185 {
1186 CRYPTO_w_lock(mt->lockid);
1187 return 0;
1188 }
1189
1190static void hwcrhk_mutex_unlock(HWCryptoHook_Mutex * mt)
1191 {
1192 CRYPTO_w_unlock(mt->lockid);
1193 }
1194
1195static void hwcrhk_mutex_destroy(HWCryptoHook_Mutex *mt)
1196 {
1197 CRYPTO_destroy_dynlockid(mt->lockid);
1198 }
1199
1200/* Mutex upcalls to use if the application does not support dynamic locks */
1201
1202static int hwcrhk_static_mutex_init(HWCryptoHook_Mutex *m,
1203 HWCryptoHook_CallerContext *c)
1204 {
1205 return 0;
1206 }
1207static int hwcrhk_static_mutex_lock(HWCryptoHook_Mutex *m)
1208 {
1209 CRYPTO_w_lock(CRYPTO_LOCK_HWCRHK);
1210 return 0;
1211 }
1212static void hwcrhk_static_mutex_unlock(HWCryptoHook_Mutex *m)
1213 {
1214 CRYPTO_w_unlock(CRYPTO_LOCK_HWCRHK);
1215 }
1216static void hwcrhk_static_mutex_destroy(HWCryptoHook_Mutex *m)
1217 {
1218 }
1219
1220static int hwcrhk_get_pass(const char *prompt_info,
1221 int *len_io, char *buf,
1222 HWCryptoHook_PassphraseContext *ppctx,
1223 HWCryptoHook_CallerContext *cactx)
1224 {
1225 pem_password_cb *callback = NULL;
1226 void *callback_data = NULL;
1227 UI_METHOD *ui_method = NULL;
1228
1229 if (cactx)
1230 {
1231 if (cactx->ui_method)
1232 ui_method = cactx->ui_method;
1233 if (cactx->password_callback)
1234 callback = cactx->password_callback;
1235 if (cactx->callback_data)
1236 callback_data = cactx->callback_data;
1237 }
1238 if (ppctx)
1239 {
1240 if (ppctx->ui_method)
1241 {
1242 ui_method = ppctx->ui_method;
1243 callback = NULL;
1244 }
1245 if (ppctx->callback_data)
1246 callback_data = ppctx->callback_data;
1247 }
1248 if (callback == NULL && ui_method == NULL)
1249 {
1250 HWCRHKerr(HWCRHK_F_HWCRHK_GET_PASS,HWCRHK_R_NO_CALLBACK);
1251 return -1;
1252 }
1253
1254 if (ui_method)
1255 {
1256 UI *ui = UI_new_method(ui_method);
1257 if (ui)
1258 {
1259 int ok;
1260 char *prompt = UI_construct_prompt(ui,
1261 "pass phrase", prompt_info);
1262
1263 ok = UI_add_input_string(ui,prompt,
1264 UI_INPUT_FLAG_DEFAULT_PWD,
1265 buf,0,(*len_io) - 1);
1266 UI_add_user_data(ui, callback_data);
1267 UI_ctrl(ui, UI_CTRL_PRINT_ERRORS, 1, 0, 0);
1268
1269 if (ok >= 0)
1270 do
1271 {
1272 ok=UI_process(ui);
1273 }
1274 while (ok < 0 && UI_ctrl(ui, UI_CTRL_IS_REDOABLE, 0, 0, 0));
1275
1276 if (ok >= 0)
1277 *len_io = strlen(buf);
1278
1279 UI_free(ui);
1280 OPENSSL_free(prompt);
1281 }
1282 }
1283 else
1284 {
1285 *len_io = callback(buf, *len_io, 0, callback_data);
1286 }
1287 if(!*len_io)
1288 return -1;
1289 return 0;
1290 }
1291
1292static int hwcrhk_insert_card(const char *prompt_info,
1293 const char *wrong_info,
1294 HWCryptoHook_PassphraseContext *ppctx,
1295 HWCryptoHook_CallerContext *cactx)
1296 {
1297 int ok = -1;
1298 UI *ui;
1299 void *callback_data = NULL;
1300 UI_METHOD *ui_method = NULL;
1301
1302 if (cactx)
1303 {
1304 if (cactx->ui_method)
1305 ui_method = cactx->ui_method;
1306 if (cactx->callback_data)
1307 callback_data = cactx->callback_data;
1308 }
1309 if (ppctx)
1310 {
1311 if (ppctx->ui_method)
1312 ui_method = ppctx->ui_method;
1313 if (ppctx->callback_data)
1314 callback_data = ppctx->callback_data;
1315 }
1316 if (ui_method == NULL)
1317 {
1318 HWCRHKerr(HWCRHK_F_HWCRHK_INSERT_CARD,
1319 HWCRHK_R_NO_CALLBACK);
1320 return -1;
1321 }
1322
1323 ui = UI_new_method(ui_method);
1324
1325 if (ui)
1326 {
1327 char answer;
1328 char buf[BUFSIZ];
1329
1330 if (wrong_info)
1331 BIO_snprintf(buf, sizeof(buf)-1,
1332 "Current card: \"%s\"\n", wrong_info);
1333 ok = UI_dup_info_string(ui, buf);
1334 if (ok >= 0 && prompt_info)
1335 {
1336 BIO_snprintf(buf, sizeof(buf)-1,
1337 "Insert card \"%s\"", prompt_info);
1338 ok = UI_dup_input_boolean(ui, buf,
1339 "\n then hit <enter> or C<enter> to cancel\n",
1340 "\r\n", "Cc", UI_INPUT_FLAG_ECHO, &answer);
1341 }
1342 UI_add_user_data(ui, callback_data);
1343
1344 if (ok >= 0)
1345 ok = UI_process(ui);
1346 UI_free(ui);
1347
1348 if (ok == -2 || (ok >= 0 && answer == 'C'))
1349 ok = 1;
1350 else if (ok < 0)
1351 ok = -1;
1352 else
1353 ok = 0;
1354 }
1355 return ok;
1356 }
1357
1358static void hwcrhk_log_message(void *logstr, const char *message)
1359 {
1360 BIO *lstream = NULL;
1361
1362 CRYPTO_w_lock(CRYPTO_LOCK_BIO);
1363 if (logstr)
1364 lstream=*(BIO **)logstr;
1365 if (lstream)
1366 {
1367 BIO_printf(lstream, "%s\n", message);
1368 }
1369 CRYPTO_w_unlock(CRYPTO_LOCK_BIO);
1370 }
1371
1372/* This stuff is needed if this ENGINE is being compiled into a self-contained
1373 * shared-library. */
1374#ifdef ENGINE_DYNAMIC_SUPPORT
1375static int bind_fn(ENGINE *e, const char *id)
1376 {
1377 if(id && (strcmp(id, engine_hwcrhk_id) != 0))
1378 return 0;
1379 if(!bind_helper(e))
1380 return 0;
1381 return 1;
1382 }
1383IMPLEMENT_DYNAMIC_CHECK_FN()
1384IMPLEMENT_DYNAMIC_BIND_FN(bind_fn)
1385#endif /* ENGINE_DYNAMIC_SUPPORT */
1386
1387#endif /* !OPENSSL_NO_HW_NCIPHER */
1388#endif /* !OPENSSL_NO_HW */
diff --git a/src/lib/libcrypto/engine/hw_ncipher_err.c b/src/lib/libcrypto/engine/hw_ncipher_err.c
new file mode 100644
index 0000000000..5bc94581b7
--- /dev/null
+++ b/src/lib/libcrypto/engine/hw_ncipher_err.c
@@ -0,0 +1,157 @@
1/* hw_ncipher_err.c */
2/* ====================================================================
3 * Copyright (c) 1999-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/* 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 "hw_ncipher_err.h"
64
65/* BEGIN ERROR CODES */
66#ifndef OPENSSL_NO_ERR
67static ERR_STRING_DATA HWCRHK_str_functs[]=
68 {
69{ERR_PACK(0,HWCRHK_F_HWCRHK_CTRL,0), "HWCRHK_CTRL"},
70{ERR_PACK(0,HWCRHK_F_HWCRHK_FINISH,0), "HWCRHK_FINISH"},
71{ERR_PACK(0,HWCRHK_F_HWCRHK_GET_PASS,0), "HWCRHK_GET_PASS"},
72{ERR_PACK(0,HWCRHK_F_HWCRHK_INIT,0), "HWCRHK_INIT"},
73{ERR_PACK(0,HWCRHK_F_HWCRHK_INSERT_CARD,0), "HWCRHK_INSERT_CARD"},
74{ERR_PACK(0,HWCRHK_F_HWCRHK_LOAD_PRIVKEY,0), "HWCRHK_LOAD_PRIVKEY"},
75{ERR_PACK(0,HWCRHK_F_HWCRHK_LOAD_PUBKEY,0), "HWCRHK_LOAD_PUBKEY"},
76{ERR_PACK(0,HWCRHK_F_HWCRHK_MOD_EXP,0), "HWCRHK_MOD_EXP"},
77{ERR_PACK(0,HWCRHK_F_HWCRHK_RAND_BYTES,0), "HWCRHK_RAND_BYTES"},
78{ERR_PACK(0,HWCRHK_F_HWCRHK_RSA_MOD_EXP,0), "HWCRHK_RSA_MOD_EXP"},
79{0,NULL}
80 };
81
82static ERR_STRING_DATA HWCRHK_str_reasons[]=
83 {
84{HWCRHK_R_ALREADY_LOADED ,"already loaded"},
85{HWCRHK_R_BIO_WAS_FREED ,"bio was freed"},
86{HWCRHK_R_CHIL_ERROR ,"chil error"},
87{HWCRHK_R_CTRL_COMMAND_NOT_IMPLEMENTED ,"ctrl command not implemented"},
88{HWCRHK_R_DSO_FAILURE ,"dso failure"},
89{HWCRHK_R_DYNAMIC_LOCKING_MISSING ,"dynamic locking missing"},
90{HWCRHK_R_MISSING_KEY_COMPONENTS ,"missing key components"},
91{HWCRHK_R_NOT_INITIALISED ,"not initialised"},
92{HWCRHK_R_NOT_LOADED ,"not loaded"},
93{HWCRHK_R_NO_CALLBACK ,"no callback"},
94{HWCRHK_R_NO_KEY ,"no key"},
95{HWCRHK_R_PRIVATE_KEY_ALGORITHMS_DISABLED,"private key algorithms disabled"},
96{HWCRHK_R_REQUEST_FAILED ,"request failed"},
97{HWCRHK_R_REQUEST_FALLBACK ,"request fallback"},
98{HWCRHK_R_UNIT_FAILURE ,"unit failure"},
99{0,NULL}
100 };
101
102#endif
103
104#ifdef HWCRHK_LIB_NAME
105static ERR_STRING_DATA HWCRHK_lib_name[]=
106 {
107{0 ,HWCRHK_LIB_NAME},
108{0,NULL}
109 };
110#endif
111
112
113static int HWCRHK_lib_error_code=0;
114static int HWCRHK_error_init=1;
115
116static void ERR_load_HWCRHK_strings(void)
117 {
118 if (HWCRHK_lib_error_code == 0)
119 HWCRHK_lib_error_code=ERR_get_next_error_library();
120
121 if (HWCRHK_error_init)
122 {
123 HWCRHK_error_init=0;
124#ifndef OPENSSL_NO_ERR
125 ERR_load_strings(HWCRHK_lib_error_code,HWCRHK_str_functs);
126 ERR_load_strings(HWCRHK_lib_error_code,HWCRHK_str_reasons);
127#endif
128
129#ifdef HWCRHK_LIB_NAME
130 HWCRHK_lib_name->error = ERR_PACK(HWCRHK_lib_error_code,0,0);
131 ERR_load_strings(0,HWCRHK_lib_name);
132#endif
133 }
134 }
135
136static void ERR_unload_HWCRHK_strings(void)
137 {
138 if (HWCRHK_error_init == 0)
139 {
140#ifndef OPENSSL_NO_ERR
141 ERR_unload_strings(HWCRHK_lib_error_code,HWCRHK_str_functs);
142 ERR_unload_strings(HWCRHK_lib_error_code,HWCRHK_str_reasons);
143#endif
144
145#ifdef HWCRHK_LIB_NAME
146 ERR_unload_strings(0,HWCRHK_lib_name);
147#endif
148 HWCRHK_error_init=1;
149 }
150 }
151
152static void ERR_HWCRHK_error(int function, int reason, char *file, int line)
153 {
154 if (HWCRHK_lib_error_code == 0)
155 HWCRHK_lib_error_code=ERR_get_next_error_library();
156 ERR_PUT_error(HWCRHK_lib_error_code,function,reason,file,line);
157 }
diff --git a/src/lib/libcrypto/engine/hw_ncipher_err.h b/src/lib/libcrypto/engine/hw_ncipher_err.h
new file mode 100644
index 0000000000..d232d02319
--- /dev/null
+++ b/src/lib/libcrypto/engine/hw_ncipher_err.h
@@ -0,0 +1,101 @@
1/* ====================================================================
2 * Copyright (c) 2001 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_HWCRHK_ERR_H
56#define HEADER_HWCRHK_ERR_H
57
58/* BEGIN ERROR CODES */
59/* The following lines are auto generated by the script mkerr.pl. Any changes
60 * made after this point may be overwritten when the script is next run.
61 */
62static void ERR_load_HWCRHK_strings(void);
63static void ERR_unload_HWCRHK_strings(void);
64static void ERR_HWCRHK_error(int function, int reason, char *file, int line);
65#define HWCRHKerr(f,r) ERR_HWCRHK_error((f),(r),__FILE__,__LINE__)
66
67/* Error codes for the HWCRHK functions. */
68
69/* Function codes. */
70#define HWCRHK_F_HWCRHK_CTRL 100
71#define HWCRHK_F_HWCRHK_FINISH 101
72#define HWCRHK_F_HWCRHK_GET_PASS 102
73#define HWCRHK_F_HWCRHK_INIT 103
74#define HWCRHK_F_HWCRHK_INSERT_CARD 104
75#define HWCRHK_F_HWCRHK_LOAD_PRIVKEY 105
76#define HWCRHK_F_HWCRHK_LOAD_PUBKEY 106
77#define HWCRHK_F_HWCRHK_MOD_EXP 107
78#define HWCRHK_F_HWCRHK_RAND_BYTES 108
79#define HWCRHK_F_HWCRHK_RSA_MOD_EXP 109
80
81/* Reason codes. */
82#define HWCRHK_R_ALREADY_LOADED 100
83#define HWCRHK_R_BIO_WAS_FREED 101
84#define HWCRHK_R_CHIL_ERROR 102
85#define HWCRHK_R_CTRL_COMMAND_NOT_IMPLEMENTED 103
86#define HWCRHK_R_DSO_FAILURE 104
87#define HWCRHK_R_DYNAMIC_LOCKING_MISSING 114
88#define HWCRHK_R_MISSING_KEY_COMPONENTS 105
89#define HWCRHK_R_NOT_INITIALISED 106
90#define HWCRHK_R_NOT_LOADED 107
91#define HWCRHK_R_NO_CALLBACK 108
92#define HWCRHK_R_NO_KEY 109
93#define HWCRHK_R_PRIVATE_KEY_ALGORITHMS_DISABLED 110
94#define HWCRHK_R_REQUEST_FAILED 111
95#define HWCRHK_R_REQUEST_FALLBACK 112
96#define HWCRHK_R_UNIT_FAILURE 113
97
98#ifdef __cplusplus
99}
100#endif
101#endif
diff --git a/src/lib/libcrypto/engine/hw_nuron.c b/src/lib/libcrypto/engine/hw_nuron.c
new file mode 100644
index 0000000000..fb9188bfe5
--- /dev/null
+++ b/src/lib/libcrypto/engine/hw_nuron.c
@@ -0,0 +1,418 @@
1/* crypto/engine/hw_nuron.c */
2/* Written by Ben Laurie for the OpenSSL Project, leaning heavily on Geoff
3 * Thorpe's Atalla implementation.
4 */
5/* ====================================================================
6 * Copyright (c) 2000-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 <openssl/crypto.h>
61#include "cryptlib.h"
62#include <openssl/dso.h>
63#include <openssl/engine.h>
64
65
66#ifndef OPENSSL_NO_HW
67#ifndef OPENSSL_NO_HW_NURON
68
69#define NURON_LIB_NAME "nuron engine"
70#include "hw_nuron_err.c"
71
72static const char *NURON_LIBNAME = NULL;
73static const char *get_NURON_LIBNAME(void)
74 {
75 if(NURON_LIBNAME)
76 return NURON_LIBNAME;
77 return "nuronssl";
78 }
79static void free_NURON_LIBNAME(void)
80 {
81 if(NURON_LIBNAME)
82 OPENSSL_free((void*)NURON_LIBNAME);
83 NURON_LIBNAME = NULL;
84 }
85static long set_NURON_LIBNAME(const char *name)
86 {
87 free_NURON_LIBNAME();
88 return (((NURON_LIBNAME = BUF_strdup(name)) != NULL) ? 1 : 0);
89 }
90static const char *NURON_F1 = "nuron_mod_exp";
91
92/* The definitions for control commands specific to this engine */
93#define NURON_CMD_SO_PATH ENGINE_CMD_BASE
94static const ENGINE_CMD_DEFN nuron_cmd_defns[] = {
95 {NURON_CMD_SO_PATH,
96 "SO_PATH",
97 "Specifies the path to the 'nuronssl' shared library",
98 ENGINE_CMD_FLAG_STRING},
99 {0, NULL, NULL, 0}
100 };
101
102typedef int tfnModExp(BIGNUM *r,const BIGNUM *a,const BIGNUM *p,const BIGNUM *m);
103static tfnModExp *pfnModExp = NULL;
104
105static DSO *pvDSOHandle = NULL;
106
107static int nuron_destroy(ENGINE *e)
108 {
109 free_NURON_LIBNAME();
110 ERR_unload_NURON_strings();
111 return 1;
112 }
113
114static int nuron_init(ENGINE *e)
115 {
116 if(pvDSOHandle != NULL)
117 {
118 NURONerr(NURON_F_NURON_INIT,NURON_R_ALREADY_LOADED);
119 return 0;
120 }
121
122 pvDSOHandle = DSO_load(NULL, get_NURON_LIBNAME(), NULL,
123 DSO_FLAG_NAME_TRANSLATION_EXT_ONLY);
124 if(!pvDSOHandle)
125 {
126 NURONerr(NURON_F_NURON_INIT,NURON_R_DSO_NOT_FOUND);
127 return 0;
128 }
129
130 pfnModExp = (tfnModExp *)DSO_bind_func(pvDSOHandle, NURON_F1);
131 if(!pfnModExp)
132 {
133 NURONerr(NURON_F_NURON_INIT,NURON_R_DSO_FUNCTION_NOT_FOUND);
134 return 0;
135 }
136
137 return 1;
138 }
139
140static int nuron_finish(ENGINE *e)
141 {
142 free_NURON_LIBNAME();
143 if(pvDSOHandle == NULL)
144 {
145 NURONerr(NURON_F_NURON_FINISH,NURON_R_NOT_LOADED);
146 return 0;
147 }
148 if(!DSO_free(pvDSOHandle))
149 {
150 NURONerr(NURON_F_NURON_FINISH,NURON_R_DSO_FAILURE);
151 return 0;
152 }
153 pvDSOHandle=NULL;
154 pfnModExp=NULL;
155 return 1;
156 }
157
158static int nuron_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f)())
159 {
160 int initialised = ((pvDSOHandle == NULL) ? 0 : 1);
161 switch(cmd)
162 {
163 case NURON_CMD_SO_PATH:
164 if(p == NULL)
165 {
166 NURONerr(NURON_F_NURON_CTRL,ERR_R_PASSED_NULL_PARAMETER);
167 return 0;
168 }
169 if(initialised)
170 {
171 NURONerr(NURON_F_NURON_CTRL,NURON_R_ALREADY_LOADED);
172 return 0;
173 }
174 return set_NURON_LIBNAME((const char *)p);
175 default:
176 break;
177 }
178 NURONerr(NURON_F_NURON_CTRL,NURON_R_CTRL_COMMAND_NOT_IMPLEMENTED);
179 return 0;
180}
181
182static int nuron_mod_exp(BIGNUM *r,const BIGNUM *a,const BIGNUM *p,
183 const BIGNUM *m,BN_CTX *ctx)
184 {
185 if(!pvDSOHandle)
186 {
187 NURONerr(NURON_F_NURON_MOD_EXP,NURON_R_NOT_LOADED);
188 return 0;
189 }
190 return pfnModExp(r,a,p,m);
191 }
192
193#ifndef OPENSSL_NO_RSA
194static int nuron_rsa_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa)
195 {
196 return nuron_mod_exp(r0,I,rsa->d,rsa->n,NULL);
197 }
198#endif
199
200#ifndef OPENSSL_NO_DSA
201/* This code was liberated and adapted from the commented-out code in
202 * dsa_ossl.c. Because of the unoptimised form of the Atalla acceleration
203 * (it doesn't have a CRT form for RSA), this function means that an
204 * Atalla system running with a DSA server certificate can handshake
205 * around 5 or 6 times faster/more than an equivalent system running with
206 * RSA. Just check out the "signs" statistics from the RSA and DSA parts
207 * of "openssl speed -engine atalla dsa1024 rsa1024". */
208static int nuron_dsa_mod_exp(DSA *dsa, BIGNUM *rr, BIGNUM *a1,
209 BIGNUM *p1, BIGNUM *a2, BIGNUM *p2, BIGNUM *m,
210 BN_CTX *ctx, BN_MONT_CTX *in_mont)
211 {
212 BIGNUM t;
213 int to_return = 0;
214
215 BN_init(&t);
216 /* let rr = a1 ^ p1 mod m */
217 if (!nuron_mod_exp(rr,a1,p1,m,ctx))
218 goto end;
219 /* let t = a2 ^ p2 mod m */
220 if (!nuron_mod_exp(&t,a2,p2,m,ctx))
221 goto end;
222 /* let rr = rr * t mod m */
223 if (!BN_mod_mul(rr,rr,&t,m,ctx))
224 goto end;
225 to_return = 1;
226end:
227 BN_free(&t);
228 return to_return;
229 }
230
231
232static int nuron_mod_exp_dsa(DSA *dsa, BIGNUM *r, BIGNUM *a,
233 const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx,
234 BN_MONT_CTX *m_ctx)
235 {
236 return nuron_mod_exp(r, a, p, m, ctx);
237 }
238#endif
239
240/* This function is aliased to mod_exp (with the mont stuff dropped). */
241static int nuron_mod_exp_mont(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
242 const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx)
243 {
244 return nuron_mod_exp(r, a, p, m, ctx);
245 }
246
247#ifndef OPENSSL_NO_DH
248/* This function is aliased to mod_exp (with the dh and mont dropped). */
249static int nuron_mod_exp_dh(const DH *dh, BIGNUM *r,
250 const BIGNUM *a, const BIGNUM *p,
251 const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx)
252 {
253 return nuron_mod_exp(r, a, p, m, ctx);
254 }
255#endif
256
257#ifndef OPENSSL_NO_RSA
258static RSA_METHOD nuron_rsa =
259 {
260 "Nuron RSA method",
261 NULL,
262 NULL,
263 NULL,
264 NULL,
265 nuron_rsa_mod_exp,
266 nuron_mod_exp_mont,
267 NULL,
268 NULL,
269 0,
270 NULL,
271 NULL,
272 NULL
273 };
274#endif
275
276#ifndef OPENSSL_NO_DSA
277static DSA_METHOD nuron_dsa =
278 {
279 "Nuron DSA method",
280 NULL, /* dsa_do_sign */
281 NULL, /* dsa_sign_setup */
282 NULL, /* dsa_do_verify */
283 nuron_dsa_mod_exp, /* dsa_mod_exp */
284 nuron_mod_exp_dsa, /* bn_mod_exp */
285 NULL, /* init */
286 NULL, /* finish */
287 0, /* flags */
288 NULL /* app_data */
289 };
290#endif
291
292#ifndef OPENSSL_NO_DH
293static DH_METHOD nuron_dh =
294 {
295 "Nuron DH method",
296 NULL,
297 NULL,
298 nuron_mod_exp_dh,
299 NULL,
300 NULL,
301 0,
302 NULL
303 };
304#endif
305
306/* Constants used when creating the ENGINE */
307static const char *engine_nuron_id = "nuron";
308static const char *engine_nuron_name = "Nuron hardware engine support";
309
310/* This internal function is used by ENGINE_nuron() and possibly by the
311 * "dynamic" ENGINE support too */
312static int bind_helper(ENGINE *e)
313 {
314#ifndef OPENSSL_NO_RSA
315 const RSA_METHOD *meth1;
316#endif
317#ifndef OPENSSL_NO_DSA
318 const DSA_METHOD *meth2;
319#endif
320#ifndef OPENSSL_NO_DH
321 const DH_METHOD *meth3;
322#endif
323 if(!ENGINE_set_id(e, engine_nuron_id) ||
324 !ENGINE_set_name(e, engine_nuron_name) ||
325#ifndef OPENSSL_NO_RSA
326 !ENGINE_set_RSA(e, &nuron_rsa) ||
327#endif
328#ifndef OPENSSL_NO_DSA
329 !ENGINE_set_DSA(e, &nuron_dsa) ||
330#endif
331#ifndef OPENSSL_NO_DH
332 !ENGINE_set_DH(e, &nuron_dh) ||
333#endif
334 !ENGINE_set_destroy_function(e, nuron_destroy) ||
335 !ENGINE_set_init_function(e, nuron_init) ||
336 !ENGINE_set_finish_function(e, nuron_finish) ||
337 !ENGINE_set_ctrl_function(e, nuron_ctrl) ||
338 !ENGINE_set_cmd_defns(e, nuron_cmd_defns))
339 return 0;
340
341#ifndef OPENSSL_NO_RSA
342 /* We know that the "PKCS1_SSLeay()" functions hook properly
343 * to the nuron-specific mod_exp and mod_exp_crt so we use
344 * those functions. NB: We don't use ENGINE_openssl() or
345 * anything "more generic" because something like the RSAref
346 * code may not hook properly, and if you own one of these
347 * cards then you have the right to do RSA operations on it
348 * anyway! */
349 meth1=RSA_PKCS1_SSLeay();
350 nuron_rsa.rsa_pub_enc=meth1->rsa_pub_enc;
351 nuron_rsa.rsa_pub_dec=meth1->rsa_pub_dec;
352 nuron_rsa.rsa_priv_enc=meth1->rsa_priv_enc;
353 nuron_rsa.rsa_priv_dec=meth1->rsa_priv_dec;
354#endif
355
356#ifndef OPENSSL_NO_DSA
357 /* Use the DSA_OpenSSL() method and just hook the mod_exp-ish
358 * bits. */
359 meth2=DSA_OpenSSL();
360 nuron_dsa.dsa_do_sign=meth2->dsa_do_sign;
361 nuron_dsa.dsa_sign_setup=meth2->dsa_sign_setup;
362 nuron_dsa.dsa_do_verify=meth2->dsa_do_verify;
363#endif
364
365#ifndef OPENSSL_NO_DH
366 /* Much the same for Diffie-Hellman */
367 meth3=DH_OpenSSL();
368 nuron_dh.generate_key=meth3->generate_key;
369 nuron_dh.compute_key=meth3->compute_key;
370#endif
371
372 /* Ensure the nuron error handling is set up */
373 ERR_load_NURON_strings();
374 return 1;
375 }
376
377#ifndef ENGINE_DYNAMIC_SUPPORT
378static ENGINE *engine_nuron(void)
379 {
380 ENGINE *ret = ENGINE_new();
381 if(!ret)
382 return NULL;
383 if(!bind_helper(ret))
384 {
385 ENGINE_free(ret);
386 return NULL;
387 }
388 return ret;
389 }
390
391void ENGINE_load_nuron(void)
392 {
393 /* Copied from eng_[openssl|dyn].c */
394 ENGINE *toadd = engine_nuron();
395 if(!toadd) return;
396 ENGINE_add(toadd);
397 ENGINE_free(toadd);
398 ERR_clear_error();
399 }
400#endif
401
402/* This stuff is needed if this ENGINE is being compiled into a self-contained
403 * shared-library. */
404#ifdef ENGINE_DYNAMIC_SUPPORT
405static int bind_fn(ENGINE *e, const char *id)
406 {
407 if(id && (strcmp(id, engine_nuron_id) != 0))
408 return 0;
409 if(!bind_helper(e))
410 return 0;
411 return 1;
412 }
413IMPLEMENT_DYNAMIC_CHECK_FN()
414IMPLEMENT_DYNAMIC_BIND_FN(bind_fn)
415#endif /* ENGINE_DYNAMIC_SUPPORT */
416
417#endif /* !OPENSSL_NO_HW_NURON */
418#endif /* !OPENSSL_NO_HW */
diff --git a/src/lib/libcrypto/engine/hw_nuron_err.c b/src/lib/libcrypto/engine/hw_nuron_err.c
new file mode 100644
index 0000000000..df9d7bde76
--- /dev/null
+++ b/src/lib/libcrypto/engine/hw_nuron_err.c
@@ -0,0 +1,142 @@
1/* hw_nuron_err.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/* 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 "hw_nuron_err.h"
64
65/* BEGIN ERROR CODES */
66#ifndef OPENSSL_NO_ERR
67static ERR_STRING_DATA NURON_str_functs[]=
68 {
69{ERR_PACK(0,NURON_F_NURON_CTRL,0), "NURON_CTRL"},
70{ERR_PACK(0,NURON_F_NURON_FINISH,0), "NURON_FINISH"},
71{ERR_PACK(0,NURON_F_NURON_INIT,0), "NURON_INIT"},
72{ERR_PACK(0,NURON_F_NURON_MOD_EXP,0), "NURON_MOD_EXP"},
73{0,NULL}
74 };
75
76static ERR_STRING_DATA NURON_str_reasons[]=
77 {
78{NURON_R_ALREADY_LOADED ,"already loaded"},
79{NURON_R_CTRL_COMMAND_NOT_IMPLEMENTED ,"ctrl command not implemented"},
80{NURON_R_DSO_FAILURE ,"dso failure"},
81{NURON_R_DSO_FUNCTION_NOT_FOUND ,"dso function not found"},
82{NURON_R_DSO_NOT_FOUND ,"dso not found"},
83{NURON_R_NOT_LOADED ,"not loaded"},
84{0,NULL}
85 };
86
87#endif
88
89#ifdef NURON_LIB_NAME
90static ERR_STRING_DATA NURON_lib_name[]=
91 {
92{0 ,NURON_LIB_NAME},
93{0,NULL}
94 };
95#endif
96
97
98static int NURON_lib_error_code=0;
99static int NURON_error_init=1;
100
101static void ERR_load_NURON_strings(void)
102 {
103 if (NURON_lib_error_code == 0)
104 NURON_lib_error_code=ERR_get_next_error_library();
105
106 if (NURON_error_init)
107 {
108 NURON_error_init=0;
109#ifndef OPENSSL_NO_ERR
110 ERR_load_strings(NURON_lib_error_code,NURON_str_functs);
111 ERR_load_strings(NURON_lib_error_code,NURON_str_reasons);
112#endif
113
114#ifdef NURON_LIB_NAME
115 NURON_lib_name->error = ERR_PACK(NURON_lib_error_code,0,0);
116 ERR_load_strings(0,NURON_lib_name);
117#endif
118 }
119 }
120
121static void ERR_unload_NURON_strings(void)
122 {
123 if (NURON_error_init == 0)
124 {
125#ifndef OPENSSL_NO_ERR
126 ERR_unload_strings(NURON_lib_error_code,NURON_str_functs);
127 ERR_unload_strings(NURON_lib_error_code,NURON_str_reasons);
128#endif
129
130#ifdef NURON_LIB_NAME
131 ERR_unload_strings(0,NURON_lib_name);
132#endif
133 NURON_error_init=1;
134 }
135 }
136
137static void ERR_NURON_error(int function, int reason, char *file, int line)
138 {
139 if (NURON_lib_error_code == 0)
140 NURON_lib_error_code=ERR_get_next_error_library();
141 ERR_PUT_error(NURON_lib_error_code,function,reason,file,line);
142 }
diff --git a/src/lib/libcrypto/engine/hw_nuron_err.h b/src/lib/libcrypto/engine/hw_nuron_err.h
new file mode 100644
index 0000000000..a56bfdf303
--- /dev/null
+++ b/src/lib/libcrypto/engine/hw_nuron_err.h
@@ -0,0 +1,86 @@
1/* ====================================================================
2 * Copyright (c) 2001 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_NURON_ERR_H
56#define HEADER_NURON_ERR_H
57
58/* BEGIN ERROR CODES */
59/* The following lines are auto generated by the script mkerr.pl. Any changes
60 * made after this point may be overwritten when the script is next run.
61 */
62static void ERR_load_NURON_strings(void);
63static void ERR_unload_NURON_strings(void);
64static void ERR_NURON_error(int function, int reason, char *file, int line);
65#define NURONerr(f,r) ERR_NURON_error((f),(r),__FILE__,__LINE__)
66
67/* Error codes for the NURON functions. */
68
69/* Function codes. */
70#define NURON_F_NURON_CTRL 100
71#define NURON_F_NURON_FINISH 101
72#define NURON_F_NURON_INIT 102
73#define NURON_F_NURON_MOD_EXP 103
74
75/* Reason codes. */
76#define NURON_R_ALREADY_LOADED 100
77#define NURON_R_CTRL_COMMAND_NOT_IMPLEMENTED 101
78#define NURON_R_DSO_FAILURE 102
79#define NURON_R_DSO_FUNCTION_NOT_FOUND 103
80#define NURON_R_DSO_NOT_FOUND 104
81#define NURON_R_NOT_LOADED 105
82
83#ifdef __cplusplus
84}
85#endif
86#endif
diff --git a/src/lib/libcrypto/engine/hw_sureware.c b/src/lib/libcrypto/engine/hw_sureware.c
new file mode 100644
index 0000000000..fca467e690
--- /dev/null
+++ b/src/lib/libcrypto/engine/hw_sureware.c
@@ -0,0 +1,1039 @@
1/* Written by Corinne Dive-Reclus(cdive@baltimore.com)
2*
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* Written by Corinne Dive-Reclus(cdive@baltimore.com)
36*
37* Copyright@2001 Baltimore Technologies Ltd.
38* All right Reserved.
39* *
40* THIS FILE IS PROVIDED BY BALTIMORE TECHNOLOGIES ``AS IS'' AND *
41* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE *
42* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE *
43* ARE DISCLAIMED. IN NO EVENT SHALL BALTIMORE TECHNOLOGIES BE LIABLE *
44* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL *
45* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS *
46* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) *
47* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT *
48* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY *
49* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF *
50* SUCH DAMAGE. *
51====================================================================*/
52
53#include <stdio.h>
54#include "cryptlib.h"
55#include <openssl/crypto.h>
56#include <openssl/pem.h>
57#include <openssl/dso.h>
58#include "eng_int.h"
59#include "engine.h"
60#include <openssl/engine.h>
61
62#ifndef OPENSSL_NO_HW
63#ifndef OPENSSL_NO_HW_SUREWARE
64
65#ifdef FLAT_INC
66#include "sureware.h"
67#else
68#include "vendor_defns/sureware.h"
69#endif
70
71#define SUREWARE_LIB_NAME "sureware engine"
72#include "hw_sureware_err.c"
73
74static int surewarehk_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f)());
75static int surewarehk_destroy(ENGINE *e);
76static int surewarehk_init(ENGINE *e);
77static int surewarehk_finish(ENGINE *e);
78static int surewarehk_modexp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
79 const BIGNUM *m, BN_CTX *ctx);
80
81/* RSA stuff */
82static int surewarehk_rsa_priv_dec(int flen,const unsigned char *from,unsigned char *to,
83 RSA *rsa,int padding);
84static int surewarehk_rsa_sign(int flen,const unsigned char *from,unsigned char *to,
85 RSA *rsa,int padding);
86
87/* RAND stuff */
88static int surewarehk_rand_bytes(unsigned char *buf, int num);
89static void surewarehk_rand_seed(const void *buf, int num);
90static void surewarehk_rand_add(const void *buf, int num, double entropy);
91
92/* KM stuff */
93static EVP_PKEY *surewarehk_load_privkey(ENGINE *e, const char *key_id,
94 UI_METHOD *ui_method, void *callback_data);
95static EVP_PKEY *surewarehk_load_pubkey(ENGINE *e, const char *key_id,
96 UI_METHOD *ui_method, void *callback_data);
97static void surewarehk_ex_free(void *obj, void *item, CRYPTO_EX_DATA *ad,
98 int idx,long argl, void *argp);
99#if 0
100static void surewarehk_dh_ex_free(void *obj, void *item, CRYPTO_EX_DATA *ad,
101 int idx,long argl, void *argp);
102#endif
103
104#ifndef OPENSSL_NO_RSA
105/* This function is aliased to mod_exp (with the mont stuff dropped). */
106static int surewarehk_mod_exp_mont(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
107 const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx)
108{
109 return surewarehk_modexp(r, a, p, m, ctx);
110}
111
112/* Our internal RSA_METHOD that we provide pointers to */
113static RSA_METHOD surewarehk_rsa =
114 {
115 "SureWare RSA method",
116 NULL, /* pub_enc*/
117 NULL, /* pub_dec*/
118 surewarehk_rsa_sign, /* our rsa_sign is OpenSSL priv_enc*/
119 surewarehk_rsa_priv_dec, /* priv_dec*/
120 NULL, /*mod_exp*/
121 surewarehk_mod_exp_mont, /*mod_exp_mongomery*/
122 NULL, /* init*/
123 NULL, /* finish*/
124 0, /* RSA flag*/
125 NULL,
126 NULL, /* OpenSSL sign*/
127 NULL /* OpenSSL verify*/
128 };
129#endif
130
131#ifndef OPENSSL_NO_DH
132/* Our internal DH_METHOD that we provide pointers to */
133/* This function is aliased to mod_exp (with the dh and mont dropped). */
134static int surewarehk_modexp_dh(const DH *dh, BIGNUM *r, const BIGNUM *a,
135 const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx)
136{
137 return surewarehk_modexp(r, a, p, m, ctx);
138}
139
140static DH_METHOD surewarehk_dh =
141 {
142 "SureWare DH method",
143 NULL,/*gen_key*/
144 NULL,/*agree,*/
145 surewarehk_modexp_dh, /*dh mod exp*/
146 NULL, /* init*/
147 NULL, /* finish*/
148 0, /* flags*/
149 NULL
150 };
151#endif
152
153static RAND_METHOD surewarehk_rand =
154 {
155 /* "SureWare RAND method", */
156 surewarehk_rand_seed,
157 surewarehk_rand_bytes,
158 NULL,/*cleanup*/
159 surewarehk_rand_add,
160 surewarehk_rand_bytes,
161 NULL,/*rand_status*/
162 };
163
164#ifndef OPENSSL_NO_DSA
165/* DSA stuff */
166static DSA_SIG * surewarehk_dsa_do_sign(const unsigned char *dgst, int dlen, DSA *dsa);
167static int surewarehk_dsa_mod_exp(DSA *dsa, BIGNUM *rr, BIGNUM *a1,
168 BIGNUM *p1, BIGNUM *a2, BIGNUM *p2, BIGNUM *m,
169 BN_CTX *ctx, BN_MONT_CTX *in_mont)
170{
171 BIGNUM t;
172 int to_return = 0;
173 BN_init(&t);
174 /* let rr = a1 ^ p1 mod m */
175 if (!surewarehk_modexp(rr,a1,p1,m,ctx)) goto end;
176 /* let t = a2 ^ p2 mod m */
177 if (!surewarehk_modexp(&t,a2,p2,m,ctx)) goto end;
178 /* let rr = rr * t mod m */
179 if (!BN_mod_mul(rr,rr,&t,m,ctx)) goto end;
180 to_return = 1;
181end:
182 BN_free(&t);
183 return to_return;
184}
185
186static DSA_METHOD surewarehk_dsa =
187 {
188 "SureWare DSA method",
189 surewarehk_dsa_do_sign,
190 NULL,/*sign setup*/
191 NULL,/*verify,*/
192 surewarehk_dsa_mod_exp,/*mod exp*/
193 NULL,/*bn mod exp*/
194 NULL, /*init*/
195 NULL,/*finish*/
196 0,
197 NULL,
198 };
199#endif
200
201static const char *engine_sureware_id = "sureware";
202static const char *engine_sureware_name = "SureWare hardware engine support";
203
204/* Now, to our own code */
205
206/* As this is only ever called once, there's no need for locking
207 * (indeed - the lock will already be held by our caller!!!) */
208static int bind_sureware(ENGINE *e)
209{
210#ifndef OPENSSL_NO_RSA
211 const RSA_METHOD *meth1;
212#endif
213#ifndef OPENSSL_NO_DSA
214 const DSA_METHOD *meth2;
215#endif
216#ifndef OPENSSL_NO_DH
217 const DH_METHOD *meth3;
218#endif
219
220 if(!ENGINE_set_id(e, engine_sureware_id) ||
221 !ENGINE_set_name(e, engine_sureware_name) ||
222#ifndef OPENSSL_NO_RSA
223 !ENGINE_set_RSA(e, &surewarehk_rsa) ||
224#endif
225#ifndef OPENSSL_NO_DSA
226 !ENGINE_set_DSA(e, &surewarehk_dsa) ||
227#endif
228#ifndef OPENSSL_NO_DH
229 !ENGINE_set_DH(e, &surewarehk_dh) ||
230#endif
231 !ENGINE_set_RAND(e, &surewarehk_rand) ||
232 !ENGINE_set_destroy_function(e, surewarehk_destroy) ||
233 !ENGINE_set_init_function(e, surewarehk_init) ||
234 !ENGINE_set_finish_function(e, surewarehk_finish) ||
235 !ENGINE_set_ctrl_function(e, surewarehk_ctrl) ||
236 !ENGINE_set_load_privkey_function(e, surewarehk_load_privkey) ||
237 !ENGINE_set_load_pubkey_function(e, surewarehk_load_pubkey))
238 return 0;
239
240#ifndef OPENSSL_NO_RSA
241 /* We know that the "PKCS1_SSLeay()" functions hook properly
242 * to the cswift-specific mod_exp and mod_exp_crt so we use
243 * those functions. NB: We don't use ENGINE_openssl() or
244 * anything "more generic" because something like the RSAref
245 * code may not hook properly, and if you own one of these
246 * cards then you have the right to do RSA operations on it
247 * anyway! */
248 meth1 = RSA_PKCS1_SSLeay();
249 if (meth1)
250 {
251 surewarehk_rsa.rsa_pub_enc = meth1->rsa_pub_enc;
252 surewarehk_rsa.rsa_pub_dec = meth1->rsa_pub_dec;
253 }
254#endif
255
256#ifndef OPENSSL_NO_DSA
257 /* Use the DSA_OpenSSL() method and just hook the mod_exp-ish
258 * bits. */
259 meth2 = DSA_OpenSSL();
260 if (meth2)
261 {
262 surewarehk_dsa.dsa_do_verify = meth2->dsa_do_verify;
263 }
264#endif
265
266#ifndef OPENSSL_NO_DH
267 /* Much the same for Diffie-Hellman */
268 meth3 = DH_OpenSSL();
269 if (meth3)
270 {
271 surewarehk_dh.generate_key = meth3->generate_key;
272 surewarehk_dh.compute_key = meth3->compute_key;
273 }
274#endif
275
276 /* Ensure the sureware error handling is set up */
277 ERR_load_SUREWARE_strings();
278 return 1;
279}
280
281#ifdef ENGINE_DYNAMIC_SUPPORT
282static int bind_helper(ENGINE *e, const char *id)
283 {
284 if(id && (strcmp(id, engine_sureware_id) != 0))
285 return 0;
286 if(!bind_sureware(e))
287 return 0;
288 return 1;
289 }
290IMPLEMENT_DYNAMIC_CHECK_FN()
291IMPLEMENT_DYNAMIC_BIND_FN(bind_helper)
292#else
293static ENGINE *engine_sureware(void)
294 {
295 ENGINE *ret = ENGINE_new();
296 if(!ret)
297 return NULL;
298 if(!bind_sureware(ret))
299 {
300 ENGINE_free(ret);
301 return NULL;
302 }
303 return ret;
304 }
305
306void ENGINE_load_sureware(void)
307 {
308 /* Copied from eng_[openssl|dyn].c */
309 ENGINE *toadd = engine_sureware();
310 if(!toadd) return;
311 ENGINE_add(toadd);
312 ENGINE_free(toadd);
313 ERR_clear_error();
314 }
315#endif
316
317/* This is a process-global DSO handle used for loading and unloading
318 * the SureWareHook library. NB: This is only set (or unset) during an
319 * init() or finish() call (reference counts permitting) and they're
320 * operating with global locks, so this should be thread-safe
321 * implicitly. */
322static DSO *surewarehk_dso = NULL;
323#ifndef OPENSSL_NO_RSA
324static int rsaHndidx = -1; /* Index for KM handle. Not really used yet. */
325#endif
326#ifndef OPENSSL_NO_DSA
327static int dsaHndidx = -1; /* Index for KM handle. Not really used yet. */
328#endif
329
330/* These are the function pointers that are (un)set when the library has
331 * successfully (un)loaded. */
332static SureWareHook_Init_t *p_surewarehk_Init = NULL;
333static SureWareHook_Finish_t *p_surewarehk_Finish = NULL;
334static SureWareHook_Rand_Bytes_t *p_surewarehk_Rand_Bytes = NULL;
335static SureWareHook_Rand_Seed_t *p_surewarehk_Rand_Seed = NULL;
336static SureWareHook_Load_Privkey_t *p_surewarehk_Load_Privkey = NULL;
337static SureWareHook_Info_Pubkey_t *p_surewarehk_Info_Pubkey = NULL;
338static SureWareHook_Load_Rsa_Pubkey_t *p_surewarehk_Load_Rsa_Pubkey = NULL;
339static SureWareHook_Load_Dsa_Pubkey_t *p_surewarehk_Load_Dsa_Pubkey = NULL;
340static SureWareHook_Free_t *p_surewarehk_Free=NULL;
341static SureWareHook_Rsa_Priv_Dec_t *p_surewarehk_Rsa_Priv_Dec=NULL;
342static SureWareHook_Rsa_Sign_t *p_surewarehk_Rsa_Sign=NULL;
343static SureWareHook_Dsa_Sign_t *p_surewarehk_Dsa_Sign=NULL;
344static SureWareHook_Mod_Exp_t *p_surewarehk_Mod_Exp=NULL;
345
346/* Used in the DSO operations. */
347static const char *surewarehk_LIBNAME = "SureWareHook";
348static const char *n_surewarehk_Init = "SureWareHook_Init";
349static const char *n_surewarehk_Finish = "SureWareHook_Finish";
350static const char *n_surewarehk_Rand_Bytes="SureWareHook_Rand_Bytes";
351static const char *n_surewarehk_Rand_Seed="SureWareHook_Rand_Seed";
352static const char *n_surewarehk_Load_Privkey="SureWareHook_Load_Privkey";
353static const char *n_surewarehk_Info_Pubkey="SureWareHook_Info_Pubkey";
354static const char *n_surewarehk_Load_Rsa_Pubkey="SureWareHook_Load_Rsa_Pubkey";
355static const char *n_surewarehk_Load_Dsa_Pubkey="SureWareHook_Load_Dsa_Pubkey";
356static const char *n_surewarehk_Free="SureWareHook_Free";
357static const char *n_surewarehk_Rsa_Priv_Dec="SureWareHook_Rsa_Priv_Dec";
358static const char *n_surewarehk_Rsa_Sign="SureWareHook_Rsa_Sign";
359static const char *n_surewarehk_Dsa_Sign="SureWareHook_Dsa_Sign";
360static const char *n_surewarehk_Mod_Exp="SureWareHook_Mod_Exp";
361static BIO *logstream = NULL;
362
363/* SureWareHook library functions and mechanics - these are used by the
364 * higher-level functions further down. NB: As and where there's no
365 * error checking, take a look lower down where these functions are
366 * called, the checking and error handling is probably down there.
367*/
368static int threadsafe=1;
369static int surewarehk_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f)())
370{
371 int to_return = 1;
372
373 switch(cmd)
374 {
375 case ENGINE_CTRL_SET_LOGSTREAM:
376 {
377 BIO *bio = (BIO *)p;
378 CRYPTO_w_lock(CRYPTO_LOCK_ENGINE);
379 if (logstream)
380 {
381 BIO_free(logstream);
382 logstream = NULL;
383 }
384 if (CRYPTO_add(&bio->references,1,CRYPTO_LOCK_BIO) > 1)
385 logstream = bio;
386 else
387 SUREWAREerr(SUREWARE_F_SUREWAREHK_CTRL,SUREWARE_R_BIO_WAS_FREED);
388 }
389 CRYPTO_w_unlock(CRYPTO_LOCK_ENGINE);
390 break;
391 /* This will prevent the initialisation function from "installing"
392 * the mutex-handling callbacks, even if they are available from
393 * within the library (or were provided to the library from the
394 * calling application). This is to remove any baggage for
395 * applications not using multithreading. */
396 case ENGINE_CTRL_CHIL_NO_LOCKING:
397 CRYPTO_w_lock(CRYPTO_LOCK_ENGINE);
398 threadsafe = 0;
399 CRYPTO_w_unlock(CRYPTO_LOCK_ENGINE);
400 break;
401
402 /* The command isn't understood by this engine */
403 default:
404 SUREWAREerr(SUREWARE_F_SUREWAREHK_CTRL,
405 ENGINE_R_CTRL_COMMAND_NOT_IMPLEMENTED);
406 to_return = 0;
407 break;
408 }
409
410 return to_return;
411}
412
413/* Destructor (complements the "ENGINE_surewarehk()" constructor) */
414static int surewarehk_destroy(ENGINE *e)
415{
416 ERR_unload_SUREWARE_strings();
417 return 1;
418}
419
420/* (de)initialisation functions. */
421static int surewarehk_init(ENGINE *e)
422{
423 char msg[64]="ENGINE_init";
424 SureWareHook_Init_t *p1=NULL;
425 SureWareHook_Finish_t *p2=NULL;
426 SureWareHook_Rand_Bytes_t *p3=NULL;
427 SureWareHook_Rand_Seed_t *p4=NULL;
428 SureWareHook_Load_Privkey_t *p5=NULL;
429 SureWareHook_Load_Rsa_Pubkey_t *p6=NULL;
430 SureWareHook_Free_t *p7=NULL;
431 SureWareHook_Rsa_Priv_Dec_t *p8=NULL;
432 SureWareHook_Rsa_Sign_t *p9=NULL;
433 SureWareHook_Dsa_Sign_t *p12=NULL;
434 SureWareHook_Info_Pubkey_t *p13=NULL;
435 SureWareHook_Load_Dsa_Pubkey_t *p14=NULL;
436 SureWareHook_Mod_Exp_t *p15=NULL;
437
438 if(surewarehk_dso != NULL)
439 {
440 SUREWAREerr(SUREWARE_F_SUREWAREHK_INIT,ENGINE_R_ALREADY_LOADED);
441 goto err;
442 }
443 /* Attempt to load libsurewarehk.so/surewarehk.dll/whatever. */
444 surewarehk_dso = DSO_load(NULL, surewarehk_LIBNAME, NULL, 0);
445 if(surewarehk_dso == NULL)
446 {
447 SUREWAREerr(SUREWARE_F_SUREWAREHK_INIT,ENGINE_R_DSO_FAILURE);
448 goto err;
449 }
450 if(!(p1=(SureWareHook_Init_t*)DSO_bind_func(surewarehk_dso, n_surewarehk_Init)) ||
451 !(p2=(SureWareHook_Finish_t*)DSO_bind_func(surewarehk_dso, n_surewarehk_Finish)) ||
452 !(p3=(SureWareHook_Rand_Bytes_t*)DSO_bind_func(surewarehk_dso, n_surewarehk_Rand_Bytes)) ||
453 !(p4=(SureWareHook_Rand_Seed_t*)DSO_bind_func(surewarehk_dso, n_surewarehk_Rand_Seed)) ||
454 !(p5=(SureWareHook_Load_Privkey_t*)DSO_bind_func(surewarehk_dso, n_surewarehk_Load_Privkey)) ||
455 !(p6=(SureWareHook_Load_Rsa_Pubkey_t*)DSO_bind_func(surewarehk_dso, n_surewarehk_Load_Rsa_Pubkey)) ||
456 !(p7=(SureWareHook_Free_t*)DSO_bind_func(surewarehk_dso, n_surewarehk_Free)) ||
457 !(p8=(SureWareHook_Rsa_Priv_Dec_t*)DSO_bind_func(surewarehk_dso, n_surewarehk_Rsa_Priv_Dec)) ||
458 !(p9=(SureWareHook_Rsa_Sign_t*)DSO_bind_func(surewarehk_dso, n_surewarehk_Rsa_Sign)) ||
459 !(p12=(SureWareHook_Dsa_Sign_t*)DSO_bind_func(surewarehk_dso, n_surewarehk_Dsa_Sign)) ||
460 !(p13=(SureWareHook_Info_Pubkey_t*)DSO_bind_func(surewarehk_dso, n_surewarehk_Info_Pubkey)) ||
461 !(p14=(SureWareHook_Load_Dsa_Pubkey_t*)DSO_bind_func(surewarehk_dso, n_surewarehk_Load_Dsa_Pubkey)) ||
462 !(p15=(SureWareHook_Mod_Exp_t*)DSO_bind_func(surewarehk_dso, n_surewarehk_Mod_Exp)))
463 {
464 SUREWAREerr(SUREWARE_F_SUREWAREHK_INIT,ENGINE_R_DSO_FAILURE);
465 goto err;
466 }
467 /* Copy the pointers */
468 p_surewarehk_Init = p1;
469 p_surewarehk_Finish = p2;
470 p_surewarehk_Rand_Bytes = p3;
471 p_surewarehk_Rand_Seed = p4;
472 p_surewarehk_Load_Privkey = p5;
473 p_surewarehk_Load_Rsa_Pubkey = p6;
474 p_surewarehk_Free = p7;
475 p_surewarehk_Rsa_Priv_Dec = p8;
476 p_surewarehk_Rsa_Sign = p9;
477 p_surewarehk_Dsa_Sign = p12;
478 p_surewarehk_Info_Pubkey = p13;
479 p_surewarehk_Load_Dsa_Pubkey = p14;
480 p_surewarehk_Mod_Exp = p15;
481 /* Contact the hardware and initialises it. */
482 if(p_surewarehk_Init(msg,threadsafe)==SUREWAREHOOK_ERROR_UNIT_FAILURE)
483 {
484 SUREWAREerr(SUREWARE_F_SUREWAREHK_INIT,SUREWARE_R_UNIT_FAILURE);
485 goto err;
486 }
487 if(p_surewarehk_Init(msg,threadsafe)==SUREWAREHOOK_ERROR_UNIT_FAILURE)
488 {
489 SUREWAREerr(SUREWARE_F_SUREWAREHK_INIT,SUREWARE_R_UNIT_FAILURE);
490 goto err;
491 }
492 /* try to load the default private key, if failed does not return a failure but
493 wait for an explicit ENGINE_load_privakey */
494 surewarehk_load_privkey(e,NULL,NULL,NULL);
495
496 /* Everything's fine. */
497#ifndef OPENSSL_NO_RSA
498 if (rsaHndidx == -1)
499 rsaHndidx = RSA_get_ex_new_index(0,
500 "SureWareHook RSA key handle",
501 NULL, NULL, surewarehk_ex_free);
502#endif
503#ifndef OPENSSL_NO_DSA
504 if (dsaHndidx == -1)
505 dsaHndidx = DSA_get_ex_new_index(0,
506 "SureWareHook DSA key handle",
507 NULL, NULL, surewarehk_ex_free);
508#endif
509
510 return 1;
511err:
512 if(surewarehk_dso)
513 DSO_free(surewarehk_dso);
514 surewarehk_dso = NULL;
515 p_surewarehk_Init = NULL;
516 p_surewarehk_Finish = NULL;
517 p_surewarehk_Rand_Bytes = NULL;
518 p_surewarehk_Rand_Seed = NULL;
519 p_surewarehk_Load_Privkey = NULL;
520 p_surewarehk_Load_Rsa_Pubkey = NULL;
521 p_surewarehk_Free = NULL;
522 p_surewarehk_Rsa_Priv_Dec = NULL;
523 p_surewarehk_Rsa_Sign = NULL;
524 p_surewarehk_Dsa_Sign = NULL;
525 p_surewarehk_Info_Pubkey = NULL;
526 p_surewarehk_Load_Dsa_Pubkey = NULL;
527 p_surewarehk_Mod_Exp = NULL;
528 return 0;
529}
530
531static int surewarehk_finish(ENGINE *e)
532{
533 int to_return = 1;
534 if(surewarehk_dso == NULL)
535 {
536 SUREWAREerr(SUREWARE_F_SUREWAREHK_FINISH,ENGINE_R_NOT_LOADED);
537 to_return = 0;
538 goto err;
539 }
540 p_surewarehk_Finish();
541 if(!DSO_free(surewarehk_dso))
542 {
543 SUREWAREerr(SUREWARE_F_SUREWAREHK_FINISH,ENGINE_R_DSO_FAILURE);
544 to_return = 0;
545 goto err;
546 }
547 err:
548 if (logstream)
549 BIO_free(logstream);
550 surewarehk_dso = NULL;
551 p_surewarehk_Init = NULL;
552 p_surewarehk_Finish = NULL;
553 p_surewarehk_Rand_Bytes = NULL;
554 p_surewarehk_Rand_Seed = NULL;
555 p_surewarehk_Load_Privkey = NULL;
556 p_surewarehk_Load_Rsa_Pubkey = NULL;
557 p_surewarehk_Free = NULL;
558 p_surewarehk_Rsa_Priv_Dec = NULL;
559 p_surewarehk_Rsa_Sign = NULL;
560 p_surewarehk_Dsa_Sign = NULL;
561 p_surewarehk_Info_Pubkey = NULL;
562 p_surewarehk_Load_Dsa_Pubkey = NULL;
563 p_surewarehk_Mod_Exp = NULL;
564 return to_return;
565}
566
567static void surewarehk_error_handling(char *const msg,int func,int ret)
568{
569 switch (ret)
570 {
571 case SUREWAREHOOK_ERROR_UNIT_FAILURE:
572 ENGINEerr(func,SUREWARE_R_UNIT_FAILURE);
573 break;
574 case SUREWAREHOOK_ERROR_FALLBACK:
575 ENGINEerr(func,SUREWARE_R_REQUEST_FALLBACK);
576 break;
577 case SUREWAREHOOK_ERROR_DATA_SIZE:
578 ENGINEerr(func,SUREWARE_R_SIZE_TOO_LARGE_OR_TOO_SMALL);
579 break;
580 case SUREWAREHOOK_ERROR_INVALID_PAD:
581 ENGINEerr(func,RSA_R_PADDING_CHECK_FAILED);
582 break;
583 default:
584 ENGINEerr(func,SUREWARE_R_REQUEST_FAILED);
585 break;
586 case 1:/*nothing*/
587 msg[0]='\0';
588 }
589 if (*msg)
590 {
591 ERR_add_error_data(1,msg);
592 if (logstream)
593 {
594 CRYPTO_w_lock(CRYPTO_LOCK_BIO);
595 BIO_write(logstream, msg, strlen(msg));
596 CRYPTO_w_unlock(CRYPTO_LOCK_BIO);
597 }
598 }
599}
600
601static int surewarehk_rand_bytes(unsigned char *buf, int num)
602{
603 int ret=0;
604 char msg[64]="ENGINE_rand_bytes";
605 if(!p_surewarehk_Rand_Bytes)
606 {
607 SUREWAREerr(SUREWARE_F_SUREWAREHK_RAND_BYTES,ENGINE_R_NOT_INITIALISED);
608 }
609 else
610 {
611 ret = p_surewarehk_Rand_Bytes(msg,buf, num);
612 surewarehk_error_handling(msg,SUREWARE_F_SUREWAREHK_RAND_BYTES,ret);
613 }
614 return ret==1 ? 1 : 0;
615}
616
617static void surewarehk_rand_seed(const void *buf, int num)
618{
619 int ret=0;
620 char msg[64]="ENGINE_rand_seed";
621 if(!p_surewarehk_Rand_Seed)
622 {
623 SUREWAREerr(SUREWARE_F_SUREWAREHK_RAND_SEED,ENGINE_R_NOT_INITIALISED);
624 }
625 else
626 {
627 ret = p_surewarehk_Rand_Seed(msg,buf, num);
628 surewarehk_error_handling(msg,SUREWARE_F_SUREWAREHK_RAND_SEED,ret);
629 }
630}
631
632static void surewarehk_rand_add(const void *buf, int num, double entropy)
633{
634 surewarehk_rand_seed(buf,num);
635}
636
637static EVP_PKEY* sureware_load_public(ENGINE *e,const char *key_id,char *hptr,unsigned long el,char keytype)
638{
639 EVP_PKEY *res = NULL;
640#ifndef OPENSSL_NO_RSA
641 RSA *rsatmp = NULL;
642#endif
643#ifndef OPENSSL_NO_DSA
644 DSA *dsatmp=NULL;
645#endif
646 char msg[64]="sureware_load_public";
647 int ret=0;
648 if(!p_surewarehk_Load_Rsa_Pubkey || !p_surewarehk_Load_Dsa_Pubkey)
649 {
650 SUREWAREerr(SUREWARE_F_SUREWAREHK_LOAD_PUBLIC_KEY,ENGINE_R_NOT_INITIALISED);
651 goto err;
652 }
653 switch (keytype)
654 {
655#ifndef OPENSSL_NO_RSA
656 case 1: /*RSA*/
657 /* set private external reference */
658 rsatmp = RSA_new_method(e);
659 RSA_set_ex_data(rsatmp,rsaHndidx,hptr);
660 rsatmp->flags |= RSA_FLAG_EXT_PKEY;
661
662 /* set public big nums*/
663 rsatmp->e = BN_new();
664 rsatmp->n = BN_new();
665 bn_expand2(rsatmp->e, el/sizeof(BN_ULONG));
666 bn_expand2(rsatmp->n, el/sizeof(BN_ULONG));
667 if (!rsatmp->e || rsatmp->e->dmax!=(int)(el/sizeof(BN_ULONG))||
668 !rsatmp->n || rsatmp->n->dmax!=(int)(el/sizeof(BN_ULONG)))
669 goto err;
670 ret=p_surewarehk_Load_Rsa_Pubkey(msg,key_id,el,
671 (unsigned long *)rsatmp->n->d,
672 (unsigned long *)rsatmp->e->d);
673 surewarehk_error_handling(msg,SUREWARE_F_SUREWAREHK_LOAD_PUBLIC_KEY,ret);
674 if (ret!=1)
675 {
676 SUREWAREerr(SUREWARE_F_SUREWAREHK_LOAD_PRIVATE_KEY,ENGINE_R_FAILED_LOADING_PUBLIC_KEY);
677 goto err;
678 }
679 /* normalise pub e and pub n */
680 rsatmp->e->top=el/sizeof(BN_ULONG);
681 bn_fix_top(rsatmp->e);
682 rsatmp->n->top=el/sizeof(BN_ULONG);
683 bn_fix_top(rsatmp->n);
684 /* create an EVP object: engine + rsa key */
685 res = EVP_PKEY_new();
686 EVP_PKEY_assign_RSA(res, rsatmp);
687 break;
688#endif
689
690#ifndef OPENSSL_NO_DSA
691 case 2:/*DSA*/
692 /* set private/public external reference */
693 dsatmp = DSA_new_method(e);
694 DSA_set_ex_data(dsatmp,dsaHndidx,hptr);
695 /*dsatmp->flags |= DSA_FLAG_EXT_PKEY;*/
696
697 /* set public key*/
698 dsatmp->pub_key = BN_new();
699 dsatmp->p = BN_new();
700 dsatmp->q = BN_new();
701 dsatmp->g = BN_new();
702 bn_expand2(dsatmp->pub_key, el/sizeof(BN_ULONG));
703 bn_expand2(dsatmp->p, el/sizeof(BN_ULONG));
704 bn_expand2(dsatmp->q, 20/sizeof(BN_ULONG));
705 bn_expand2(dsatmp->g, el/sizeof(BN_ULONG));
706 if (!dsatmp->pub_key || dsatmp->pub_key->dmax!=(int)(el/sizeof(BN_ULONG))||
707 !dsatmp->p || dsatmp->p->dmax!=(int)(el/sizeof(BN_ULONG)) ||
708 !dsatmp->q || dsatmp->q->dmax!=20/sizeof(BN_ULONG) ||
709 !dsatmp->g || dsatmp->g->dmax!=(int)(el/sizeof(BN_ULONG)))
710 goto err;
711
712 ret=p_surewarehk_Load_Dsa_Pubkey(msg,key_id,el,
713 (unsigned long *)dsatmp->pub_key->d,
714 (unsigned long *)dsatmp->p->d,
715 (unsigned long *)dsatmp->q->d,
716 (unsigned long *)dsatmp->g->d);
717 surewarehk_error_handling(msg,SUREWARE_F_SUREWAREHK_LOAD_PUBLIC_KEY,ret);
718 if (ret!=1)
719 {
720 SUREWAREerr(SUREWARE_F_SUREWAREHK_LOAD_PRIVATE_KEY,ENGINE_R_FAILED_LOADING_PUBLIC_KEY);
721 goto err;
722 }
723 /* set parameters */
724 /* normalise pubkey and parameters in case of */
725 dsatmp->pub_key->top=el/sizeof(BN_ULONG);
726 bn_fix_top(dsatmp->pub_key);
727 dsatmp->p->top=el/sizeof(BN_ULONG);
728 bn_fix_top(dsatmp->p);
729 dsatmp->q->top=20/sizeof(BN_ULONG);
730 bn_fix_top(dsatmp->q);
731 dsatmp->g->top=el/sizeof(BN_ULONG);
732 bn_fix_top(dsatmp->g);
733
734 /* create an EVP object: engine + rsa key */
735 res = EVP_PKEY_new();
736 EVP_PKEY_assign_DSA(res, dsatmp);
737 break;
738#endif
739
740 default:
741 SUREWAREerr(SUREWARE_F_SUREWAREHK_LOAD_PRIVATE_KEY,ENGINE_R_FAILED_LOADING_PRIVATE_KEY);
742 goto err;
743 }
744 return res;
745 err:
746 if (res)
747 EVP_PKEY_free(res);
748#ifndef OPENSSL_NO_RSA
749 if (rsatmp)
750 RSA_free(rsatmp);
751#endif
752#ifndef OPENSSL_NO_DSA
753 if (dsatmp)
754 DSA_free(dsatmp);
755#endif
756 return NULL;
757}
758
759static EVP_PKEY *surewarehk_load_privkey(ENGINE *e, const char *key_id,
760 UI_METHOD *ui_method, void *callback_data)
761{
762 EVP_PKEY *res = NULL;
763 int ret=0;
764 unsigned long el=0;
765 char *hptr=NULL;
766 char keytype=0;
767 char msg[64]="ENGINE_load_privkey";
768
769 if(!p_surewarehk_Load_Privkey)
770 {
771 SUREWAREerr(SUREWARE_F_SUREWAREHK_LOAD_PRIVATE_KEY,ENGINE_R_NOT_INITIALISED);
772 }
773 else
774 {
775 ret=p_surewarehk_Load_Privkey(msg,key_id,&hptr,&el,&keytype);
776 if (ret!=1)
777 {
778 SUREWAREerr(SUREWARE_F_SUREWAREHK_LOAD_PRIVATE_KEY,ENGINE_R_FAILED_LOADING_PRIVATE_KEY);
779 ERR_add_error_data(1,msg);
780 }
781 else
782 res=sureware_load_public(e,key_id,hptr,el,keytype);
783 }
784 return res;
785}
786
787static EVP_PKEY *surewarehk_load_pubkey(ENGINE *e, const char *key_id,
788 UI_METHOD *ui_method, void *callback_data)
789{
790 EVP_PKEY *res = NULL;
791 int ret=0;
792 unsigned long el=0;
793 char *hptr=NULL;
794 char keytype=0;
795 char msg[64]="ENGINE_load_pubkey";
796
797 if(!p_surewarehk_Info_Pubkey)
798 {
799 SUREWAREerr(SUREWARE_F_SUREWAREHK_LOAD_PUBLIC_KEY,ENGINE_R_NOT_INITIALISED);
800 }
801 else
802 {
803 /* call once to identify if DSA or RSA */
804 ret=p_surewarehk_Info_Pubkey(msg,key_id,&el,&keytype);
805 if (ret!=1)
806 {
807 SUREWAREerr(SUREWARE_F_SUREWAREHK_LOAD_PUBLIC_KEY,ENGINE_R_FAILED_LOADING_PUBLIC_KEY);
808 ERR_add_error_data(1,msg);
809 }
810 else
811 res=sureware_load_public(e,key_id,hptr,el,keytype);
812 }
813 return res;
814}
815
816/* This cleans up an RSA/DSA KM key(do not destroy the key into the hardware)
817, called when ex_data is freed */
818static void surewarehk_ex_free(void *obj, void *item, CRYPTO_EX_DATA *ad,
819 int idx,long argl, void *argp)
820{
821 if(!p_surewarehk_Free)
822 {
823 SUREWAREerr(SUREWARE_F_SUREWAREHK_EX_FREE,ENGINE_R_NOT_INITIALISED);
824 }
825 else
826 p_surewarehk_Free((char *)item,0);
827}
828
829#if 0
830/* This cleans up an DH KM key (destroys the key into hardware),
831called when ex_data is freed */
832static void surewarehk_dh_ex_free(void *obj, void *item, CRYPTO_EX_DATA *ad,
833 int idx,long argl, void *argp)
834{
835 if(!p_surewarehk_Free)
836 {
837 SUREWAREerr(SUREWARE_F_SUREWAREHK_EX_FREE,ENGINE_R_NOT_INITIALISED);
838 }
839 else
840 p_surewarehk_Free((char *)item,1);
841}
842#endif
843
844/*
845* return number of decrypted bytes
846*/
847#ifndef OPENSSL_NO_RSA
848static int surewarehk_rsa_priv_dec(int flen,const unsigned char *from,unsigned char *to,
849 RSA *rsa,int padding)
850{
851 int ret=0,tlen;
852 char *buf=NULL,*hptr=NULL;
853 char msg[64]="ENGINE_rsa_priv_dec";
854 if (!p_surewarehk_Rsa_Priv_Dec)
855 {
856 SUREWAREerr(SUREWARE_F_SUREWAREHK_RSA_PRIV_DEC,ENGINE_R_NOT_INITIALISED);
857 }
858 /* extract ref to private key */
859 else if (!(hptr=RSA_get_ex_data(rsa, rsaHndidx)))
860 {
861 SUREWAREerr(SUREWARE_F_SUREWAREHK_RSA_PRIV_DEC,SUREWARE_R_MISSING_KEY_COMPONENTS);
862 goto err;
863 }
864 /* analyse what padding we can do into the hardware */
865 if (padding==RSA_PKCS1_PADDING)
866 {
867 /* do it one shot */
868 ret=p_surewarehk_Rsa_Priv_Dec(msg,flen,(unsigned char *)from,&tlen,to,hptr,SUREWARE_PKCS1_PAD);
869 surewarehk_error_handling(msg,SUREWARE_F_SUREWAREHK_RSA_PRIV_DEC,ret);
870 if (ret!=1)
871 goto err;
872 ret=tlen;
873 }
874 else /* do with no padding into hardware */
875 {
876 ret=p_surewarehk_Rsa_Priv_Dec(msg,flen,(unsigned char *)from,&tlen,to,hptr,SUREWARE_NO_PAD);
877 surewarehk_error_handling(msg,SUREWARE_F_SUREWAREHK_RSA_PRIV_DEC,ret);
878 if (ret!=1)
879 goto err;
880 /* intermediate buffer for padding */
881 if ((buf=OPENSSL_malloc(tlen)) == NULL)
882 {
883 RSAerr(SUREWARE_F_SUREWAREHK_RSA_PRIV_DEC,ERR_R_MALLOC_FAILURE);
884 goto err;
885 }
886 memcpy(buf,to,tlen);/* transfert to into buf */
887 switch (padding) /* check padding in software */
888 {
889#ifndef OPENSSL_NO_SHA
890 case RSA_PKCS1_OAEP_PADDING:
891 ret=RSA_padding_check_PKCS1_OAEP(to,tlen,(unsigned char *)buf,tlen,tlen,NULL,0);
892 break;
893#endif
894 case RSA_SSLV23_PADDING:
895 ret=RSA_padding_check_SSLv23(to,tlen,(unsigned char *)buf,flen,tlen);
896 break;
897 case RSA_NO_PADDING:
898 ret=RSA_padding_check_none(to,tlen,(unsigned char *)buf,flen,tlen);
899 break;
900 default:
901 RSAerr(SUREWARE_F_SUREWAREHK_RSA_PRIV_DEC,RSA_R_UNKNOWN_PADDING_TYPE);
902 goto err;
903 }
904 if (ret < 0)
905 RSAerr(SUREWARE_F_SUREWAREHK_RSA_PRIV_DEC,RSA_R_PADDING_CHECK_FAILED);
906 }
907err:
908 if (buf)
909 {
910 OPENSSL_cleanse(buf,tlen);
911 OPENSSL_free(buf);
912 }
913 return ret;
914}
915
916/*
917* Does what OpenSSL rsa_priv_enc does.
918*/
919static int surewarehk_rsa_sign(int flen,const unsigned char *from,unsigned char *to,
920 RSA *rsa,int padding)
921{
922 int ret=0,tlen;
923 char *hptr=NULL;
924 char msg[64]="ENGINE_rsa_sign";
925 if (!p_surewarehk_Rsa_Sign)
926 {
927 SUREWAREerr(SUREWARE_F_SUREWAREHK_RSA_PRIV_ENC,ENGINE_R_NOT_INITIALISED);
928 }
929 /* extract ref to private key */
930 else if (!(hptr=RSA_get_ex_data(rsa, rsaHndidx)))
931 {
932 SUREWAREerr(SUREWARE_F_SUREWAREHK_RSA_PRIV_ENC,SUREWARE_R_MISSING_KEY_COMPONENTS);
933 }
934 else
935 {
936 switch (padding)
937 {
938 case RSA_PKCS1_PADDING: /* do it in one shot */
939 ret=p_surewarehk_Rsa_Sign(msg,flen,(unsigned char *)from,&tlen,to,hptr,SUREWARE_PKCS1_PAD);
940 surewarehk_error_handling(msg,SUREWARE_F_SUREWAREHK_RSA_PRIV_ENC,ret);
941 break;
942 case RSA_NO_PADDING:
943 default:
944 RSAerr(SUREWARE_F_SUREWAREHK_RSA_PRIV_ENC,RSA_R_UNKNOWN_PADDING_TYPE);
945 }
946 }
947 return ret==1 ? tlen : ret;
948}
949
950#endif
951
952#ifndef OPENSSL_NO_DSA
953/* DSA sign and verify */
954static DSA_SIG * surewarehk_dsa_do_sign(const unsigned char *from, int flen, DSA *dsa)
955{
956 int ret=0;
957 char *hptr=NULL;
958 DSA_SIG *psign=NULL;
959 char msg[64]="ENGINE_dsa_do_sign";
960 if (!p_surewarehk_Dsa_Sign)
961 {
962 SUREWAREerr(SUREWARE_F_SUREWAREHK_DSA_DO_SIGN,ENGINE_R_NOT_INITIALISED);
963 }
964 /* extract ref to private key */
965 else if (!(hptr=DSA_get_ex_data(dsa, dsaHndidx)))
966 {
967 SUREWAREerr(SUREWARE_F_SUREWAREHK_DSA_DO_SIGN,SUREWARE_R_MISSING_KEY_COMPONENTS);
968 }
969 else
970 {
971 if((psign = DSA_SIG_new()) == NULL)
972 {
973 SUREWAREerr(SUREWARE_F_SUREWAREHK_DSA_DO_SIGN,ERR_R_MALLOC_FAILURE);
974 goto err;
975 }
976 psign->r=BN_new();
977 psign->s=BN_new();
978 bn_expand2(psign->r, 20/sizeof(BN_ULONG));
979 bn_expand2(psign->s, 20/sizeof(BN_ULONG));
980 if (!psign->r || psign->r->dmax!=20/sizeof(BN_ULONG) ||
981 !psign->s || psign->s->dmax!=20/sizeof(BN_ULONG))
982 goto err;
983 ret=p_surewarehk_Dsa_Sign(msg,flen,from,
984 (unsigned long *)psign->r->d,
985 (unsigned long *)psign->s->d,
986 hptr);
987 surewarehk_error_handling(msg,SUREWARE_F_SUREWAREHK_DSA_DO_SIGN,ret);
988 }
989 psign->r->top=20/sizeof(BN_ULONG);
990 bn_fix_top(psign->r);
991 psign->s->top=20/sizeof(BN_ULONG);
992 bn_fix_top(psign->s);
993
994err:
995 if (psign)
996 {
997 DSA_SIG_free(psign);
998 psign=NULL;
999 }
1000 return psign;
1001}
1002#endif
1003
1004static int surewarehk_modexp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
1005 const BIGNUM *m, BN_CTX *ctx)
1006{
1007 int ret=0;
1008 char msg[64]="ENGINE_modexp";
1009 if (!p_surewarehk_Mod_Exp)
1010 {
1011 SUREWAREerr(SUREWARE_F_SUREWAREHK_MOD_EXP,ENGINE_R_NOT_INITIALISED);
1012 }
1013 else
1014 {
1015 bn_expand2(r,m->top);
1016 if (r && r->dmax==m->top)
1017 {
1018 /* do it*/
1019 ret=p_surewarehk_Mod_Exp(msg,
1020 m->top*sizeof(BN_ULONG),
1021 (unsigned long *)m->d,
1022 p->top*sizeof(BN_ULONG),
1023 (unsigned long *)p->d,
1024 a->top*sizeof(BN_ULONG),
1025 (unsigned long *)a->d,
1026 (unsigned long *)r->d);
1027 surewarehk_error_handling(msg,SUREWARE_F_SUREWAREHK_MOD_EXP,ret);
1028 if (ret==1)
1029 {
1030 /* normalise result */
1031 r->top=m->top;
1032 bn_fix_top(r);
1033 }
1034 }
1035 }
1036 return ret;
1037}
1038#endif /* !OPENSSL_NO_HW_SureWare */
1039#endif /* !OPENSSL_NO_HW */
diff --git a/src/lib/libcrypto/engine/hw_sureware_err.c b/src/lib/libcrypto/engine/hw_sureware_err.c
new file mode 100644
index 0000000000..69955dadbb
--- /dev/null
+++ b/src/lib/libcrypto/engine/hw_sureware_err.c
@@ -0,0 +1,150 @@
1/* hw_sureware_err.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/* 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 "hw_sureware_err.h"
64
65/* BEGIN ERROR CODES */
66#ifndef OPENSSL_NO_ERR
67static ERR_STRING_DATA SUREWARE_str_functs[]=
68 {
69{ERR_PACK(0,SUREWARE_F_SUREWAREHK_CTRL,0), "SUREWAREHK_CTRL"},
70{ERR_PACK(0,SUREWARE_F_SUREWAREHK_DSA_DO_SIGN,0), "SUREWAREHK_DSA_DO_SIGN"},
71{ERR_PACK(0,SUREWARE_F_SUREWAREHK_EX_FREE,0), "SUREWAREHK_EX_FREE"},
72{ERR_PACK(0,SUREWARE_F_SUREWAREHK_FINISH,0), "SUREWAREHK_FINISH"},
73{ERR_PACK(0,SUREWARE_F_SUREWAREHK_INIT,0), "SUREWAREHK_INIT"},
74{ERR_PACK(0,SUREWARE_F_SUREWAREHK_LOAD_PRIVATE_KEY,0), "SUREWAREHK_LOAD_PRIVATE_KEY"},
75{ERR_PACK(0,SUREWARE_F_SUREWAREHK_LOAD_PUBLIC_KEY,0), "SUREWAREHK_LOAD_PUBLIC_KEY"},
76{ERR_PACK(0,SUREWARE_F_SUREWAREHK_MOD_EXP,0), "SUREWAREHK_MOD_EXP"},
77{ERR_PACK(0,SUREWARE_F_SUREWAREHK_RAND_BYTES,0), "SUREWAREHK_RAND_BYTES"},
78{ERR_PACK(0,SUREWARE_F_SUREWAREHK_RAND_SEED,0), "SUREWAREHK_RAND_SEED"},
79{ERR_PACK(0,SUREWARE_F_SUREWAREHK_RSA_PRIV_DEC,0), "SUREWAREHK_RSA_PRIV_DEC"},
80{ERR_PACK(0,SUREWARE_F_SUREWAREHK_RSA_PRIV_ENC,0), "SUREWAREHK_RSA_PRIV_ENC"},
81{0,NULL}
82 };
83
84static ERR_STRING_DATA SUREWARE_str_reasons[]=
85 {
86{SUREWARE_R_BIO_WAS_FREED ,"bio was freed"},
87{SUREWARE_R_MISSING_KEY_COMPONENTS ,"missing key components"},
88{SUREWARE_R_REQUEST_FAILED ,"request failed"},
89{SUREWARE_R_REQUEST_FALLBACK ,"request fallback"},
90{SUREWARE_R_SIZE_TOO_LARGE_OR_TOO_SMALL ,"size too large or too small"},
91{SUREWARE_R_UNIT_FAILURE ,"unit failure"},
92{0,NULL}
93 };
94
95#endif
96
97#ifdef SUREWARE_LIB_NAME
98static ERR_STRING_DATA SUREWARE_lib_name[]=
99 {
100{0 ,SUREWARE_LIB_NAME},
101{0,NULL}
102 };
103#endif
104
105
106static int SUREWARE_lib_error_code=0;
107static int SUREWARE_error_init=1;
108
109static void ERR_load_SUREWARE_strings(void)
110 {
111 if (SUREWARE_lib_error_code == 0)
112 SUREWARE_lib_error_code=ERR_get_next_error_library();
113
114 if (SUREWARE_error_init)
115 {
116 SUREWARE_error_init=0;
117#ifndef OPENSSL_NO_ERR
118 ERR_load_strings(SUREWARE_lib_error_code,SUREWARE_str_functs);
119 ERR_load_strings(SUREWARE_lib_error_code,SUREWARE_str_reasons);
120#endif
121
122#ifdef SUREWARE_LIB_NAME
123 SUREWARE_lib_name->error = ERR_PACK(SUREWARE_lib_error_code,0,0);
124 ERR_load_strings(0,SUREWARE_lib_name);
125#endif
126 }
127 }
128
129static void ERR_unload_SUREWARE_strings(void)
130 {
131 if (SUREWARE_error_init == 0)
132 {
133#ifndef OPENSSL_NO_ERR
134 ERR_unload_strings(SUREWARE_lib_error_code,SUREWARE_str_functs);
135 ERR_unload_strings(SUREWARE_lib_error_code,SUREWARE_str_reasons);
136#endif
137
138#ifdef SUREWARE_LIB_NAME
139 ERR_unload_strings(0,SUREWARE_lib_name);
140#endif
141 SUREWARE_error_init=1;
142 }
143 }
144
145static void ERR_SUREWARE_error(int function, int reason, char *file, int line)
146 {
147 if (SUREWARE_lib_error_code == 0)
148 SUREWARE_lib_error_code=ERR_get_next_error_library();
149 ERR_PUT_error(SUREWARE_lib_error_code,function,reason,file,line);
150 }
diff --git a/src/lib/libcrypto/engine/hw_sureware_err.h b/src/lib/libcrypto/engine/hw_sureware_err.h
new file mode 100644
index 0000000000..bc52af5e05
--- /dev/null
+++ b/src/lib/libcrypto/engine/hw_sureware_err.h
@@ -0,0 +1,94 @@
1/* ====================================================================
2 * Copyright (c) 2001 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_SUREWARE_ERR_H
56#define HEADER_SUREWARE_ERR_H
57
58/* BEGIN ERROR CODES */
59/* The following lines are auto generated by the script mkerr.pl. Any changes
60 * made after this point may be overwritten when the script is next run.
61 */
62static void ERR_load_SUREWARE_strings(void);
63static void ERR_unload_SUREWARE_strings(void);
64static void ERR_SUREWARE_error(int function, int reason, char *file, int line);
65#define SUREWAREerr(f,r) ERR_SUREWARE_error((f),(r),__FILE__,__LINE__)
66
67/* Error codes for the SUREWARE functions. */
68
69/* Function codes. */
70#define SUREWARE_F_SUREWAREHK_CTRL 100
71#define SUREWARE_F_SUREWAREHK_DSA_DO_SIGN 101
72#define SUREWARE_F_SUREWAREHK_EX_FREE 102
73#define SUREWARE_F_SUREWAREHK_FINISH 103
74#define SUREWARE_F_SUREWAREHK_INIT 104
75#define SUREWARE_F_SUREWAREHK_LOAD_PRIVATE_KEY 105
76#define SUREWARE_F_SUREWAREHK_LOAD_PUBLIC_KEY 106
77#define SUREWARE_F_SUREWAREHK_MOD_EXP 107
78#define SUREWARE_F_SUREWAREHK_RAND_BYTES 108
79#define SUREWARE_F_SUREWAREHK_RAND_SEED 109
80#define SUREWARE_F_SUREWAREHK_RSA_PRIV_DEC 110
81#define SUREWARE_F_SUREWAREHK_RSA_PRIV_ENC 111
82
83/* Reason codes. */
84#define SUREWARE_R_BIO_WAS_FREED 100
85#define SUREWARE_R_MISSING_KEY_COMPONENTS 105
86#define SUREWARE_R_REQUEST_FAILED 101
87#define SUREWARE_R_REQUEST_FALLBACK 102
88#define SUREWARE_R_SIZE_TOO_LARGE_OR_TOO_SMALL 103
89#define SUREWARE_R_UNIT_FAILURE 104
90
91#ifdef __cplusplus
92}
93#endif
94#endif
diff --git a/src/lib/libcrypto/engine/hw_ubsec.c b/src/lib/libcrypto/engine/hw_ubsec.c
new file mode 100644
index 0000000000..5234a08a07
--- /dev/null
+++ b/src/lib/libcrypto/engine/hw_ubsec.c
@@ -0,0 +1,1060 @@
1/* crypto/engine/hw_ubsec.c */
2/* Written by Geoff Thorpe (geoff@geoffthorpe.net) for the OpenSSL
3 * project 2000.
4 *
5 * Cloned shamelessly by Joe Tardo.
6 */
7/* ====================================================================
8 * Copyright (c) 1999-2001 The OpenSSL Project. All rights reserved.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 *
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions and the following disclaimer.
16 *
17 * 2. Redistributions in binary form must reproduce the above copyright
18 * notice, this list of conditions and the following disclaimer in
19 * the documentation and/or other materials provided with the
20 * distribution.
21 *
22 * 3. All advertising materials mentioning features or use of this
23 * software must display the following acknowledgment:
24 * "This product includes software developed by the OpenSSL Project
25 * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
26 *
27 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
28 * endorse or promote products derived from this software without
29 * prior written permission. For written permission, please contact
30 * licensing@OpenSSL.org.
31 *
32 * 5. Products derived from this software may not be called "OpenSSL"
33 * nor may "OpenSSL" appear in their names without prior written
34 * permission of the OpenSSL Project.
35 *
36 * 6. Redistributions of any form whatsoever must retain the following
37 * acknowledgment:
38 * "This product includes software developed by the OpenSSL Project
39 * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
42 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
44 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
45 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
46 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
47 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
48 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
49 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
50 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
51 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
52 * OF THE POSSIBILITY OF SUCH DAMAGE.
53 * ====================================================================
54 *
55 * This product includes cryptographic software written by Eric Young
56 * (eay@cryptsoft.com). This product includes software written by Tim
57 * Hudson (tjh@cryptsoft.com).
58 *
59 */
60
61#include <stdio.h>
62#include <openssl/crypto.h>
63#include "cryptlib.h"
64#include <openssl/dso.h>
65#include <openssl/engine.h>
66
67#ifndef OPENSSL_NO_HW
68#ifndef OPENSSL_NO_HW_UBSEC
69
70#ifdef FLAT_INC
71#include "hw_ubsec.h"
72#else
73#include "vendor_defns/hw_ubsec.h"
74#endif
75
76#define UBSEC_LIB_NAME "ubsec engine"
77#include "hw_ubsec_err.c"
78
79#define FAIL_TO_SOFTWARE -15
80
81static int ubsec_destroy(ENGINE *e);
82static int ubsec_init(ENGINE *e);
83static int ubsec_finish(ENGINE *e);
84static int ubsec_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f)());
85static int ubsec_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
86 const BIGNUM *m, BN_CTX *ctx);
87static int ubsec_mod_exp_crt(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
88 const BIGNUM *q, const BIGNUM *dp,
89 const BIGNUM *dq, const BIGNUM *qinv, BN_CTX *ctx);
90#ifndef OPENSSL_NO_RSA
91static int ubsec_rsa_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa);
92#endif
93static int ubsec_mod_exp_mont(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
94 const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx);
95#ifndef OPENSSL_NO_DSA
96#ifdef NOT_USED
97static int ubsec_dsa_mod_exp(DSA *dsa, BIGNUM *rr, BIGNUM *a1,
98 BIGNUM *p1, BIGNUM *a2, BIGNUM *p2, BIGNUM *m,
99 BN_CTX *ctx, BN_MONT_CTX *in_mont);
100static int ubsec_mod_exp_dsa(DSA *dsa, BIGNUM *r, BIGNUM *a,
101 const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx,
102 BN_MONT_CTX *m_ctx);
103#endif
104static DSA_SIG *ubsec_dsa_do_sign(const unsigned char *dgst, int dlen, DSA *dsa);
105static int ubsec_dsa_verify(const unsigned char *dgst, int dgst_len,
106 DSA_SIG *sig, DSA *dsa);
107#endif
108#ifndef OPENSSL_NO_DH
109static int ubsec_mod_exp_dh(const DH *dh, BIGNUM *r, const BIGNUM *a,
110 const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx,
111 BN_MONT_CTX *m_ctx);
112static int ubsec_dh_compute_key(unsigned char *key,const BIGNUM *pub_key,DH *dh);
113static int ubsec_dh_generate_key(DH *dh);
114#endif
115
116#ifdef NOT_USED
117static int ubsec_rand_bytes(unsigned char *buf, int num);
118static int ubsec_rand_status(void);
119#endif
120
121#define UBSEC_CMD_SO_PATH ENGINE_CMD_BASE
122static const ENGINE_CMD_DEFN ubsec_cmd_defns[] = {
123 {UBSEC_CMD_SO_PATH,
124 "SO_PATH",
125 "Specifies the path to the 'ubsec' shared library",
126 ENGINE_CMD_FLAG_STRING},
127 {0, NULL, NULL, 0}
128 };
129
130#ifndef OPENSSL_NO_RSA
131/* Our internal RSA_METHOD that we provide pointers to */
132static RSA_METHOD ubsec_rsa =
133 {
134 "UBSEC RSA method",
135 NULL,
136 NULL,
137 NULL,
138 NULL,
139 ubsec_rsa_mod_exp,
140 ubsec_mod_exp_mont,
141 NULL,
142 NULL,
143 0,
144 NULL,
145 NULL,
146 NULL
147 };
148#endif
149
150#ifndef OPENSSL_NO_DSA
151/* Our internal DSA_METHOD that we provide pointers to */
152static DSA_METHOD ubsec_dsa =
153 {
154 "UBSEC DSA method",
155 ubsec_dsa_do_sign, /* dsa_do_sign */
156 NULL, /* dsa_sign_setup */
157 ubsec_dsa_verify, /* dsa_do_verify */
158 NULL, /* ubsec_dsa_mod_exp */ /* dsa_mod_exp */
159 NULL, /* ubsec_mod_exp_dsa */ /* bn_mod_exp */
160 NULL, /* init */
161 NULL, /* finish */
162 0, /* flags */
163 NULL /* app_data */
164 };
165#endif
166
167#ifndef OPENSSL_NO_DH
168/* Our internal DH_METHOD that we provide pointers to */
169static DH_METHOD ubsec_dh =
170 {
171 "UBSEC DH method",
172 ubsec_dh_generate_key,
173 ubsec_dh_compute_key,
174 ubsec_mod_exp_dh,
175 NULL,
176 NULL,
177 0,
178 NULL
179 };
180#endif
181
182/* Constants used when creating the ENGINE */
183static const char *engine_ubsec_id = "ubsec";
184static const char *engine_ubsec_name = "UBSEC hardware engine support";
185
186/* This internal function is used by ENGINE_ubsec() and possibly by the
187 * "dynamic" ENGINE support too */
188static int bind_helper(ENGINE *e)
189 {
190#ifndef OPENSSL_NO_RSA
191 const RSA_METHOD *meth1;
192#endif
193#ifndef OPENSSL_NO_DH
194#ifndef HAVE_UBSEC_DH
195 const DH_METHOD *meth3;
196#endif /* HAVE_UBSEC_DH */
197#endif
198 if(!ENGINE_set_id(e, engine_ubsec_id) ||
199 !ENGINE_set_name(e, engine_ubsec_name) ||
200#ifndef OPENSSL_NO_RSA
201 !ENGINE_set_RSA(e, &ubsec_rsa) ||
202#endif
203#ifndef OPENSSL_NO_DSA
204 !ENGINE_set_DSA(e, &ubsec_dsa) ||
205#endif
206#ifndef OPENSSL_NO_DH
207 !ENGINE_set_DH(e, &ubsec_dh) ||
208#endif
209 !ENGINE_set_destroy_function(e, ubsec_destroy) ||
210 !ENGINE_set_init_function(e, ubsec_init) ||
211 !ENGINE_set_finish_function(e, ubsec_finish) ||
212 !ENGINE_set_ctrl_function(e, ubsec_ctrl) ||
213 !ENGINE_set_cmd_defns(e, ubsec_cmd_defns))
214 return 0;
215
216#ifndef OPENSSL_NO_RSA
217 /* We know that the "PKCS1_SSLeay()" functions hook properly
218 * to the Broadcom-specific mod_exp and mod_exp_crt so we use
219 * those functions. NB: We don't use ENGINE_openssl() or
220 * anything "more generic" because something like the RSAref
221 * code may not hook properly, and if you own one of these
222 * cards then you have the right to do RSA operations on it
223 * anyway! */
224 meth1 = RSA_PKCS1_SSLeay();
225 ubsec_rsa.rsa_pub_enc = meth1->rsa_pub_enc;
226 ubsec_rsa.rsa_pub_dec = meth1->rsa_pub_dec;
227 ubsec_rsa.rsa_priv_enc = meth1->rsa_priv_enc;
228 ubsec_rsa.rsa_priv_dec = meth1->rsa_priv_dec;
229#endif
230
231#ifndef OPENSSL_NO_DH
232#ifndef HAVE_UBSEC_DH
233 /* Much the same for Diffie-Hellman */
234 meth3 = DH_OpenSSL();
235 ubsec_dh.generate_key = meth3->generate_key;
236 ubsec_dh.compute_key = meth3->compute_key;
237#endif /* HAVE_UBSEC_DH */
238#endif
239
240 /* Ensure the ubsec error handling is set up */
241 ERR_load_UBSEC_strings();
242 return 1;
243 }
244
245#ifndef ENGINE_DYNAMIC_SUPPORT
246static ENGINE *engine_ubsec(void)
247 {
248 ENGINE *ret = ENGINE_new();
249 if(!ret)
250 return NULL;
251 if(!bind_helper(ret))
252 {
253 ENGINE_free(ret);
254 return NULL;
255 }
256 return ret;
257 }
258
259void ENGINE_load_ubsec(void)
260 {
261 /* Copied from eng_[openssl|dyn].c */
262 ENGINE *toadd = engine_ubsec();
263 if(!toadd) return;
264 ENGINE_add(toadd);
265 ENGINE_free(toadd);
266 ERR_clear_error();
267 }
268#endif
269
270/* This is a process-global DSO handle used for loading and unloading
271 * the UBSEC library. NB: This is only set (or unset) during an
272 * init() or finish() call (reference counts permitting) and they're
273 * operating with global locks, so this should be thread-safe
274 * implicitly. */
275
276static DSO *ubsec_dso = NULL;
277
278/* These are the function pointers that are (un)set when the library has
279 * successfully (un)loaded. */
280
281static t_UBSEC_ubsec_bytes_to_bits *p_UBSEC_ubsec_bytes_to_bits = NULL;
282static t_UBSEC_ubsec_bits_to_bytes *p_UBSEC_ubsec_bits_to_bytes = NULL;
283static t_UBSEC_ubsec_open *p_UBSEC_ubsec_open = NULL;
284static t_UBSEC_ubsec_close *p_UBSEC_ubsec_close = NULL;
285#ifndef OPENSSL_NO_DH
286static t_UBSEC_diffie_hellman_generate_ioctl
287 *p_UBSEC_diffie_hellman_generate_ioctl = NULL;
288static t_UBSEC_diffie_hellman_agree_ioctl *p_UBSEC_diffie_hellman_agree_ioctl = NULL;
289#endif
290/* #ifndef OPENSSL_NO_RSA */
291static t_UBSEC_rsa_mod_exp_ioctl *p_UBSEC_rsa_mod_exp_ioctl = NULL;
292static t_UBSEC_rsa_mod_exp_crt_ioctl *p_UBSEC_rsa_mod_exp_crt_ioctl = NULL;
293/* #endif */
294#ifndef OPENSSL_NO_DSA
295static t_UBSEC_dsa_sign_ioctl *p_UBSEC_dsa_sign_ioctl = NULL;
296static t_UBSEC_dsa_verify_ioctl *p_UBSEC_dsa_verify_ioctl = NULL;
297#endif
298static t_UBSEC_math_accelerate_ioctl *p_UBSEC_math_accelerate_ioctl = NULL;
299static t_UBSEC_rng_ioctl *p_UBSEC_rng_ioctl = NULL;
300static t_UBSEC_max_key_len_ioctl *p_UBSEC_max_key_len_ioctl = NULL;
301
302static int max_key_len = 1024; /* ??? */
303
304/*
305 * These are the static string constants for the DSO file name and the function
306 * symbol names to bind to.
307 */
308
309static const char *UBSEC_LIBNAME = NULL;
310static const char *get_UBSEC_LIBNAME(void)
311 {
312 if(UBSEC_LIBNAME)
313 return UBSEC_LIBNAME;
314 return "ubsec";
315 }
316static void free_UBSEC_LIBNAME(void)
317 {
318 if(UBSEC_LIBNAME)
319 OPENSSL_free((void*)UBSEC_LIBNAME);
320 UBSEC_LIBNAME = NULL;
321 }
322static long set_UBSEC_LIBNAME(const char *name)
323 {
324 free_UBSEC_LIBNAME();
325 return (((UBSEC_LIBNAME = BUF_strdup(name)) != NULL) ? 1 : 0);
326 }
327static const char *UBSEC_F1 = "ubsec_bytes_to_bits";
328static const char *UBSEC_F2 = "ubsec_bits_to_bytes";
329static const char *UBSEC_F3 = "ubsec_open";
330static const char *UBSEC_F4 = "ubsec_close";
331#ifndef OPENSSL_NO_DH
332static const char *UBSEC_F5 = "diffie_hellman_generate_ioctl";
333static const char *UBSEC_F6 = "diffie_hellman_agree_ioctl";
334#endif
335/* #ifndef OPENSSL_NO_RSA */
336static const char *UBSEC_F7 = "rsa_mod_exp_ioctl";
337static const char *UBSEC_F8 = "rsa_mod_exp_crt_ioctl";
338/* #endif */
339#ifndef OPENSSL_NO_DSA
340static const char *UBSEC_F9 = "dsa_sign_ioctl";
341static const char *UBSEC_F10 = "dsa_verify_ioctl";
342#endif
343static const char *UBSEC_F11 = "math_accelerate_ioctl";
344static const char *UBSEC_F12 = "rng_ioctl";
345static const char *UBSEC_F13 = "ubsec_max_key_len_ioctl";
346
347/* Destructor (complements the "ENGINE_ubsec()" constructor) */
348static int ubsec_destroy(ENGINE *e)
349 {
350 free_UBSEC_LIBNAME();
351 ERR_unload_UBSEC_strings();
352 return 1;
353 }
354
355/* (de)initialisation functions. */
356static int ubsec_init(ENGINE *e)
357 {
358 t_UBSEC_ubsec_bytes_to_bits *p1;
359 t_UBSEC_ubsec_bits_to_bytes *p2;
360 t_UBSEC_ubsec_open *p3;
361 t_UBSEC_ubsec_close *p4;
362#ifndef OPENSSL_NO_DH
363 t_UBSEC_diffie_hellman_generate_ioctl *p5;
364 t_UBSEC_diffie_hellman_agree_ioctl *p6;
365#endif
366/* #ifndef OPENSSL_NO_RSA */
367 t_UBSEC_rsa_mod_exp_ioctl *p7;
368 t_UBSEC_rsa_mod_exp_crt_ioctl *p8;
369/* #endif */
370#ifndef OPENSSL_NO_DSA
371 t_UBSEC_dsa_sign_ioctl *p9;
372 t_UBSEC_dsa_verify_ioctl *p10;
373#endif
374 t_UBSEC_math_accelerate_ioctl *p11;
375 t_UBSEC_rng_ioctl *p12;
376 t_UBSEC_max_key_len_ioctl *p13;
377 int fd = 0;
378
379 if(ubsec_dso != NULL)
380 {
381 UBSECerr(UBSEC_F_UBSEC_INIT, UBSEC_R_ALREADY_LOADED);
382 goto err;
383 }
384 /*
385 * Attempt to load libubsec.so/ubsec.dll/whatever.
386 */
387 ubsec_dso = DSO_load(NULL, get_UBSEC_LIBNAME(), NULL, 0);
388 if(ubsec_dso == NULL)
389 {
390 UBSECerr(UBSEC_F_UBSEC_INIT, UBSEC_R_DSO_FAILURE);
391 goto err;
392 }
393
394 if (
395 !(p1 = (t_UBSEC_ubsec_bytes_to_bits *) DSO_bind_func(ubsec_dso, UBSEC_F1)) ||
396 !(p2 = (t_UBSEC_ubsec_bits_to_bytes *) DSO_bind_func(ubsec_dso, UBSEC_F2)) ||
397 !(p3 = (t_UBSEC_ubsec_open *) DSO_bind_func(ubsec_dso, UBSEC_F3)) ||
398 !(p4 = (t_UBSEC_ubsec_close *) DSO_bind_func(ubsec_dso, UBSEC_F4)) ||
399#ifndef OPENSSL_NO_DH
400 !(p5 = (t_UBSEC_diffie_hellman_generate_ioctl *)
401 DSO_bind_func(ubsec_dso, UBSEC_F5)) ||
402 !(p6 = (t_UBSEC_diffie_hellman_agree_ioctl *)
403 DSO_bind_func(ubsec_dso, UBSEC_F6)) ||
404#endif
405/* #ifndef OPENSSL_NO_RSA */
406 !(p7 = (t_UBSEC_rsa_mod_exp_ioctl *) DSO_bind_func(ubsec_dso, UBSEC_F7)) ||
407 !(p8 = (t_UBSEC_rsa_mod_exp_crt_ioctl *) DSO_bind_func(ubsec_dso, UBSEC_F8)) ||
408/* #endif */
409#ifndef OPENSSL_NO_DSA
410 !(p9 = (t_UBSEC_dsa_sign_ioctl *) DSO_bind_func(ubsec_dso, UBSEC_F9)) ||
411 !(p10 = (t_UBSEC_dsa_verify_ioctl *) DSO_bind_func(ubsec_dso, UBSEC_F10)) ||
412#endif
413 !(p11 = (t_UBSEC_math_accelerate_ioctl *)
414 DSO_bind_func(ubsec_dso, UBSEC_F11)) ||
415 !(p12 = (t_UBSEC_rng_ioctl *) DSO_bind_func(ubsec_dso, UBSEC_F12)) ||
416 !(p13 = (t_UBSEC_max_key_len_ioctl *) DSO_bind_func(ubsec_dso, UBSEC_F13)))
417 {
418 UBSECerr(UBSEC_F_UBSEC_INIT, UBSEC_R_DSO_FAILURE);
419 goto err;
420 }
421
422 /* Copy the pointers */
423 p_UBSEC_ubsec_bytes_to_bits = p1;
424 p_UBSEC_ubsec_bits_to_bytes = p2;
425 p_UBSEC_ubsec_open = p3;
426 p_UBSEC_ubsec_close = p4;
427#ifndef OPENSSL_NO_DH
428 p_UBSEC_diffie_hellman_generate_ioctl = p5;
429 p_UBSEC_diffie_hellman_agree_ioctl = p6;
430#endif
431#ifndef OPENSSL_NO_RSA
432 p_UBSEC_rsa_mod_exp_ioctl = p7;
433 p_UBSEC_rsa_mod_exp_crt_ioctl = p8;
434#endif
435#ifndef OPENSSL_NO_DSA
436 p_UBSEC_dsa_sign_ioctl = p9;
437 p_UBSEC_dsa_verify_ioctl = p10;
438#endif
439 p_UBSEC_math_accelerate_ioctl = p11;
440 p_UBSEC_rng_ioctl = p12;
441 p_UBSEC_max_key_len_ioctl = p13;
442
443 /* Perform an open to see if there's actually any unit running. */
444 if (((fd = p_UBSEC_ubsec_open(UBSEC_KEY_DEVICE_NAME)) > 0) && (p_UBSEC_max_key_len_ioctl(fd, &max_key_len) == 0))
445 {
446 p_UBSEC_ubsec_close(fd);
447 return 1;
448 }
449 else
450 {
451 UBSECerr(UBSEC_F_UBSEC_INIT, UBSEC_R_UNIT_FAILURE);
452 }
453
454err:
455 if(ubsec_dso)
456 DSO_free(ubsec_dso);
457 p_UBSEC_ubsec_bytes_to_bits = NULL;
458 p_UBSEC_ubsec_bits_to_bytes = NULL;
459 p_UBSEC_ubsec_open = NULL;
460 p_UBSEC_ubsec_close = NULL;
461#ifndef OPENSSL_NO_DH
462 p_UBSEC_diffie_hellman_generate_ioctl = NULL;
463 p_UBSEC_diffie_hellman_agree_ioctl = NULL;
464#endif
465#ifndef OPENSSL_NO_RSA
466 p_UBSEC_rsa_mod_exp_ioctl = NULL;
467 p_UBSEC_rsa_mod_exp_crt_ioctl = NULL;
468#endif
469#ifndef OPENSSL_NO_DSA
470 p_UBSEC_dsa_sign_ioctl = NULL;
471 p_UBSEC_dsa_verify_ioctl = NULL;
472#endif
473 p_UBSEC_math_accelerate_ioctl = NULL;
474 p_UBSEC_rng_ioctl = NULL;
475 p_UBSEC_max_key_len_ioctl = NULL;
476
477 return 0;
478 }
479
480static int ubsec_finish(ENGINE *e)
481 {
482 free_UBSEC_LIBNAME();
483 if(ubsec_dso == NULL)
484 {
485 UBSECerr(UBSEC_F_UBSEC_FINISH, UBSEC_R_NOT_LOADED);
486 return 0;
487 }
488 if(!DSO_free(ubsec_dso))
489 {
490 UBSECerr(UBSEC_F_UBSEC_FINISH, UBSEC_R_DSO_FAILURE);
491 return 0;
492 }
493 ubsec_dso = NULL;
494 p_UBSEC_ubsec_bytes_to_bits = NULL;
495 p_UBSEC_ubsec_bits_to_bytes = NULL;
496 p_UBSEC_ubsec_open = NULL;
497 p_UBSEC_ubsec_close = NULL;
498#ifndef OPENSSL_NO_DH
499 p_UBSEC_diffie_hellman_generate_ioctl = NULL;
500 p_UBSEC_diffie_hellman_agree_ioctl = NULL;
501#endif
502#ifndef OPENSSL_NO_RSA
503 p_UBSEC_rsa_mod_exp_ioctl = NULL;
504 p_UBSEC_rsa_mod_exp_crt_ioctl = NULL;
505#endif
506#ifndef OPENSSL_NO_DSA
507 p_UBSEC_dsa_sign_ioctl = NULL;
508 p_UBSEC_dsa_verify_ioctl = NULL;
509#endif
510 p_UBSEC_math_accelerate_ioctl = NULL;
511 p_UBSEC_rng_ioctl = NULL;
512 p_UBSEC_max_key_len_ioctl = NULL;
513 return 1;
514 }
515
516static int ubsec_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f)())
517 {
518 int initialised = ((ubsec_dso == NULL) ? 0 : 1);
519 switch(cmd)
520 {
521 case UBSEC_CMD_SO_PATH:
522 if(p == NULL)
523 {
524 UBSECerr(UBSEC_F_UBSEC_CTRL,ERR_R_PASSED_NULL_PARAMETER);
525 return 0;
526 }
527 if(initialised)
528 {
529 UBSECerr(UBSEC_F_UBSEC_CTRL,UBSEC_R_ALREADY_LOADED);
530 return 0;
531 }
532 return set_UBSEC_LIBNAME((const char *)p);
533 default:
534 break;
535 }
536 UBSECerr(UBSEC_F_UBSEC_CTRL,UBSEC_R_CTRL_COMMAND_NOT_IMPLEMENTED);
537 return 0;
538 }
539
540static int ubsec_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
541 const BIGNUM *m, BN_CTX *ctx)
542 {
543 int y_len = 0;
544 int fd;
545
546 if(ubsec_dso == NULL)
547 {
548 UBSECerr(UBSEC_F_UBSEC_MOD_EXP, UBSEC_R_NOT_LOADED);
549 return 0;
550 }
551
552 /* Check if hardware can't handle this argument. */
553 y_len = BN_num_bits(m);
554 if (y_len > max_key_len) {
555 UBSECerr(UBSEC_F_UBSEC_MOD_EXP, UBSEC_R_SIZE_TOO_LARGE_OR_TOO_SMALL);
556 return BN_mod_exp(r, a, p, m, ctx);
557 }
558
559 if(!bn_wexpand(r, m->top))
560 {
561 UBSECerr(UBSEC_F_UBSEC_MOD_EXP, UBSEC_R_BN_EXPAND_FAIL);
562 return 0;
563 }
564
565 if ((fd = p_UBSEC_ubsec_open(UBSEC_KEY_DEVICE_NAME)) <= 0) {
566 fd = 0;
567 UBSECerr(UBSEC_F_UBSEC_INIT, UBSEC_R_UNIT_FAILURE);
568 return BN_mod_exp(r, a, p, m, ctx);
569 }
570
571 if (p_UBSEC_rsa_mod_exp_ioctl(fd, (unsigned char *)a->d, BN_num_bits(a),
572 (unsigned char *)m->d, BN_num_bits(m), (unsigned char *)p->d,
573 BN_num_bits(p), (unsigned char *)r->d, &y_len) != 0)
574 {
575 UBSECerr(UBSEC_F_UBSEC_MOD_EXP, UBSEC_R_REQUEST_FAILED);
576 p_UBSEC_ubsec_close(fd);
577
578 return BN_mod_exp(r, a, p, m, ctx);
579 }
580
581 p_UBSEC_ubsec_close(fd);
582
583 r->top = (BN_num_bits(m)+BN_BITS2-1)/BN_BITS2;
584 return 1;
585 }
586
587#ifndef OPENSSL_NO_RSA
588static int ubsec_rsa_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa)
589 {
590 BN_CTX *ctx;
591 int to_return = 0;
592
593 if((ctx = BN_CTX_new()) == NULL)
594 goto err;
595
596 if(!rsa->p || !rsa->q || !rsa->dmp1 || !rsa->dmq1 || !rsa->iqmp)
597 {
598 UBSECerr(UBSEC_F_UBSEC_RSA_MOD_EXP, UBSEC_R_MISSING_KEY_COMPONENTS);
599 goto err;
600 }
601
602 to_return = ubsec_mod_exp_crt(r0, I, rsa->p, rsa->q, rsa->dmp1,
603 rsa->dmq1, rsa->iqmp, ctx);
604 if (to_return == FAIL_TO_SOFTWARE)
605 {
606 /*
607 * Do in software as hardware failed.
608 */
609 const RSA_METHOD *meth = RSA_PKCS1_SSLeay();
610 to_return = (*meth->rsa_mod_exp)(r0, I, rsa);
611 }
612err:
613 if(ctx)
614 BN_CTX_free(ctx);
615 return to_return;
616 }
617#endif
618
619static int ubsec_mod_exp_crt(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
620 const BIGNUM *q, const BIGNUM *dp,
621 const BIGNUM *dq, const BIGNUM *qinv, BN_CTX *ctx)
622 {
623 int y_len,
624 m_len,
625 fd;
626
627 m_len = BN_num_bytes(p) + BN_num_bytes(q) + 1;
628 y_len = BN_num_bits(p) + BN_num_bits(q);
629
630 /* Check if hardware can't handle this argument. */
631 if (y_len > max_key_len) {
632 UBSECerr(UBSEC_F_UBSEC_MOD_EXP, UBSEC_R_SIZE_TOO_LARGE_OR_TOO_SMALL);
633 return FAIL_TO_SOFTWARE;
634 }
635
636 if (!bn_wexpand(r, p->top + q->top + 1)) {
637 UBSECerr(UBSEC_F_UBSEC_RSA_MOD_EXP_CRT, UBSEC_R_BN_EXPAND_FAIL);
638 return 0;
639 }
640
641 if ((fd = p_UBSEC_ubsec_open(UBSEC_KEY_DEVICE_NAME)) <= 0) {
642 fd = 0;
643 UBSECerr(UBSEC_F_UBSEC_INIT, UBSEC_R_UNIT_FAILURE);
644 return FAIL_TO_SOFTWARE;
645 }
646
647 if (p_UBSEC_rsa_mod_exp_crt_ioctl(fd,
648 (unsigned char *)a->d, BN_num_bits(a),
649 (unsigned char *)qinv->d, BN_num_bits(qinv),
650 (unsigned char *)dp->d, BN_num_bits(dp),
651 (unsigned char *)p->d, BN_num_bits(p),
652 (unsigned char *)dq->d, BN_num_bits(dq),
653 (unsigned char *)q->d, BN_num_bits(q),
654 (unsigned char *)r->d, &y_len) != 0) {
655 UBSECerr(UBSEC_F_UBSEC_MOD_EXP, UBSEC_R_REQUEST_FAILED);
656 p_UBSEC_ubsec_close(fd);
657 return FAIL_TO_SOFTWARE;
658 }
659
660 p_UBSEC_ubsec_close(fd);
661
662 r->top = (BN_num_bits(p) + BN_num_bits(q) + BN_BITS2 - 1)/BN_BITS2;
663 return 1;
664}
665
666#ifndef OPENSSL_NO_DSA
667#ifdef NOT_USED
668static int ubsec_dsa_mod_exp(DSA *dsa, BIGNUM *rr, BIGNUM *a1,
669 BIGNUM *p1, BIGNUM *a2, BIGNUM *p2, BIGNUM *m,
670 BN_CTX *ctx, BN_MONT_CTX *in_mont)
671 {
672 BIGNUM t;
673 int to_return = 0;
674
675 BN_init(&t);
676 /* let rr = a1 ^ p1 mod m */
677 if (!ubsec_mod_exp(rr,a1,p1,m,ctx)) goto end;
678 /* let t = a2 ^ p2 mod m */
679 if (!ubsec_mod_exp(&t,a2,p2,m,ctx)) goto end;
680 /* let rr = rr * t mod m */
681 if (!BN_mod_mul(rr,rr,&t,m,ctx)) goto end;
682 to_return = 1;
683end:
684 BN_free(&t);
685 return to_return;
686 }
687
688static int ubsec_mod_exp_dsa(DSA *dsa, BIGNUM *r, BIGNUM *a,
689 const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx,
690 BN_MONT_CTX *m_ctx)
691 {
692 return ubsec_mod_exp(r, a, p, m, ctx);
693 }
694#endif
695#endif
696
697/*
698 * This function is aliased to mod_exp (with the mont stuff dropped).
699 */
700static int ubsec_mod_exp_mont(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
701 const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx)
702 {
703 int ret = 0;
704
705#ifndef OPENSSL_NO_RSA
706 /* Do in software if the key is too large for the hardware. */
707 if (BN_num_bits(m) > max_key_len)
708 {
709 const RSA_METHOD *meth = RSA_PKCS1_SSLeay();
710 ret = (*meth->bn_mod_exp)(r, a, p, m, ctx, m_ctx);
711 }
712 else
713#endif
714 {
715 ret = ubsec_mod_exp(r, a, p, m, ctx);
716 }
717
718 return ret;
719 }
720
721#ifndef OPENSSL_NO_DH
722/* This function is aliased to mod_exp (with the dh and mont dropped). */
723static int ubsec_mod_exp_dh(const DH *dh, BIGNUM *r, const BIGNUM *a,
724 const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx,
725 BN_MONT_CTX *m_ctx)
726 {
727 return ubsec_mod_exp(r, a, p, m, ctx);
728 }
729#endif
730
731#ifndef OPENSSL_NO_DSA
732static DSA_SIG *ubsec_dsa_do_sign(const unsigned char *dgst, int dlen, DSA *dsa)
733 {
734 DSA_SIG *to_return = NULL;
735 int s_len = 160, r_len = 160, d_len, fd;
736 BIGNUM m, *r=NULL, *s=NULL;
737
738 BN_init(&m);
739
740 s = BN_new();
741 r = BN_new();
742 if ((s == NULL) || (r==NULL))
743 goto err;
744
745 d_len = p_UBSEC_ubsec_bytes_to_bits((unsigned char *)dgst, dlen);
746
747 if(!bn_wexpand(r, (160+BN_BITS2-1)/BN_BITS2) ||
748 (!bn_wexpand(s, (160+BN_BITS2-1)/BN_BITS2))) {
749 UBSECerr(UBSEC_F_UBSEC_DSA_SIGN, UBSEC_R_BN_EXPAND_FAIL);
750 goto err;
751 }
752
753 if (BN_bin2bn(dgst,dlen,&m) == NULL) {
754 UBSECerr(UBSEC_F_UBSEC_DSA_SIGN, UBSEC_R_BN_EXPAND_FAIL);
755 goto err;
756 }
757
758 if ((fd = p_UBSEC_ubsec_open(UBSEC_KEY_DEVICE_NAME)) <= 0) {
759 const DSA_METHOD *meth;
760 fd = 0;
761 UBSECerr(UBSEC_F_UBSEC_INIT, UBSEC_R_UNIT_FAILURE);
762 meth = DSA_OpenSSL();
763 to_return = meth->dsa_do_sign(dgst, dlen, dsa);
764 goto err;
765 }
766
767 if (p_UBSEC_dsa_sign_ioctl(fd, 0, /* compute hash before signing */
768 (unsigned char *)dgst, d_len,
769 NULL, 0, /* compute random value */
770 (unsigned char *)dsa->p->d, BN_num_bits(dsa->p),
771 (unsigned char *)dsa->q->d, BN_num_bits(dsa->q),
772 (unsigned char *)dsa->g->d, BN_num_bits(dsa->g),
773 (unsigned char *)dsa->priv_key->d, BN_num_bits(dsa->priv_key),
774 (unsigned char *)r->d, &r_len,
775 (unsigned char *)s->d, &s_len ) != 0) {
776 const DSA_METHOD *meth;
777
778 UBSECerr(UBSEC_F_UBSEC_DSA_SIGN, UBSEC_R_REQUEST_FAILED);
779 p_UBSEC_ubsec_close(fd);
780 meth = DSA_OpenSSL();
781 to_return = meth->dsa_do_sign(dgst, dlen, dsa);
782
783 goto err;
784 }
785
786 p_UBSEC_ubsec_close(fd);
787
788 r->top = (160+BN_BITS2-1)/BN_BITS2;
789 s->top = (160+BN_BITS2-1)/BN_BITS2;
790
791 to_return = DSA_SIG_new();
792 if(to_return == NULL) {
793 UBSECerr(UBSEC_F_UBSEC_DSA_SIGN, UBSEC_R_BN_EXPAND_FAIL);
794 goto err;
795 }
796
797 to_return->r = r;
798 to_return->s = s;
799
800err:
801 if (!to_return) {
802 if (r) BN_free(r);
803 if (s) BN_free(s);
804 }
805 BN_clear_free(&m);
806 return to_return;
807}
808
809static int ubsec_dsa_verify(const unsigned char *dgst, int dgst_len,
810 DSA_SIG *sig, DSA *dsa)
811 {
812 int v_len, d_len;
813 int to_return = 0;
814 int fd;
815 BIGNUM v;
816
817 BN_init(&v);
818
819 if(!bn_wexpand(&v, dsa->p->top)) {
820 UBSECerr(UBSEC_F_UBSEC_DSA_VERIFY ,UBSEC_R_BN_EXPAND_FAIL);
821 goto err;
822 }
823
824 v_len = BN_num_bits(dsa->p);
825
826 d_len = p_UBSEC_ubsec_bytes_to_bits((unsigned char *)dgst, dgst_len);
827
828 if ((fd = p_UBSEC_ubsec_open(UBSEC_KEY_DEVICE_NAME)) <= 0) {
829 const DSA_METHOD *meth;
830 fd = 0;
831 UBSECerr(UBSEC_F_UBSEC_INIT, UBSEC_R_UNIT_FAILURE);
832 meth = DSA_OpenSSL();
833 to_return = meth->dsa_do_verify(dgst, dgst_len, sig, dsa);
834 goto err;
835 }
836
837 if (p_UBSEC_dsa_verify_ioctl(fd, 0, /* compute hash before signing */
838 (unsigned char *)dgst, d_len,
839 (unsigned char *)dsa->p->d, BN_num_bits(dsa->p),
840 (unsigned char *)dsa->q->d, BN_num_bits(dsa->q),
841 (unsigned char *)dsa->g->d, BN_num_bits(dsa->g),
842 (unsigned char *)dsa->pub_key->d, BN_num_bits(dsa->pub_key),
843 (unsigned char *)sig->r->d, BN_num_bits(sig->r),
844 (unsigned char *)sig->s->d, BN_num_bits(sig->s),
845 (unsigned char *)v.d, &v_len) != 0) {
846 const DSA_METHOD *meth;
847 UBSECerr(UBSEC_F_UBSEC_DSA_VERIFY , UBSEC_R_REQUEST_FAILED);
848 p_UBSEC_ubsec_close(fd);
849
850 meth = DSA_OpenSSL();
851 to_return = meth->dsa_do_verify(dgst, dgst_len, sig, dsa);
852
853 goto err;
854 }
855
856 p_UBSEC_ubsec_close(fd);
857
858 to_return = 1;
859err:
860 BN_clear_free(&v);
861 return to_return;
862 }
863#endif
864
865#ifndef OPENSSL_NO_DH
866static int ubsec_dh_compute_key (unsigned char *key,const BIGNUM *pub_key,DH *dh)
867 {
868 int ret = -1,
869 k_len,
870 fd;
871
872 k_len = BN_num_bits(dh->p);
873
874 if ((fd = p_UBSEC_ubsec_open(UBSEC_KEY_DEVICE_NAME)) <= 0)
875 {
876 const DH_METHOD *meth;
877 ENGINEerr(UBSEC_F_UBSEC_INIT, UBSEC_R_UNIT_FAILURE);
878 meth = DH_OpenSSL();
879 ret = meth->compute_key(key, pub_key, dh);
880 goto err;
881 }
882
883 if (p_UBSEC_diffie_hellman_agree_ioctl(fd,
884 (unsigned char *)dh->priv_key->d, BN_num_bits(dh->priv_key),
885 (unsigned char *)pub_key->d, BN_num_bits(pub_key),
886 (unsigned char *)dh->p->d, BN_num_bits(dh->p),
887 key, &k_len) != 0)
888 {
889 /* Hardware's a no go, failover to software */
890 const DH_METHOD *meth;
891 ENGINEerr(UBSEC_F_UBSEC_DH_COMPUTE_KEY, UBSEC_R_REQUEST_FAILED);
892 p_UBSEC_ubsec_close(fd);
893
894 meth = DH_OpenSSL();
895 ret = meth->compute_key(key, pub_key, dh);
896
897 goto err;
898 }
899
900 p_UBSEC_ubsec_close(fd);
901
902 ret = p_UBSEC_ubsec_bits_to_bytes(k_len);
903err:
904 return ret;
905 }
906
907static int ubsec_dh_generate_key (DH *dh)
908 {
909 int ret = 0,
910 random_bits = 0,
911 pub_key_len = 0,
912 priv_key_len = 0,
913 fd;
914 BIGNUM *pub_key = NULL;
915 BIGNUM *priv_key = NULL;
916
917 /*
918 * How many bits should Random x be? dh_key.c
919 * sets the range from 0 to num_bits(modulus) ???
920 */
921
922 if (dh->priv_key == NULL)
923 {
924 priv_key = BN_new();
925 if (priv_key == NULL) goto err;
926 priv_key_len = BN_num_bits(dh->p);
927 bn_wexpand(priv_key, dh->p->top);
928 do
929 if (!BN_rand_range(priv_key, dh->p)) goto err;
930 while (BN_is_zero(priv_key));
931 random_bits = BN_num_bits(priv_key);
932 }
933 else
934 {
935 priv_key = dh->priv_key;
936 }
937
938 if (dh->pub_key == NULL)
939 {
940 pub_key = BN_new();
941 pub_key_len = BN_num_bits(dh->p);
942 bn_wexpand(pub_key, dh->p->top);
943 if(pub_key == NULL) goto err;
944 }
945 else
946 {
947 pub_key = dh->pub_key;
948 }
949
950 if ((fd = p_UBSEC_ubsec_open(UBSEC_KEY_DEVICE_NAME)) <= 0)
951 {
952 const DH_METHOD *meth;
953 ENGINEerr(UBSEC_F_UBSEC_INIT, UBSEC_R_UNIT_FAILURE);
954 meth = DH_OpenSSL();
955 ret = meth->generate_key(dh);
956 goto err;
957 }
958
959 if (p_UBSEC_diffie_hellman_generate_ioctl(fd,
960 (unsigned char *)priv_key->d, &priv_key_len,
961 (unsigned char *)pub_key->d, &pub_key_len,
962 (unsigned char *)dh->g->d, BN_num_bits(dh->g),
963 (unsigned char *)dh->p->d, BN_num_bits(dh->p),
964 0, 0, random_bits) != 0)
965 {
966 /* Hardware's a no go, failover to software */
967 const DH_METHOD *meth;
968
969 ENGINEerr(UBSEC_F_UBSEC_DH_COMPUTE_KEY, UBSEC_R_REQUEST_FAILED);
970 p_UBSEC_ubsec_close(fd);
971
972 meth = DH_OpenSSL();
973 ret = meth->generate_key(dh);
974
975 goto err;
976 }
977
978 p_UBSEC_ubsec_close(fd);
979
980 dh->pub_key = pub_key;
981 dh->pub_key->top = (pub_key_len + BN_BITS2-1) / BN_BITS2;
982 dh->priv_key = priv_key;
983 dh->priv_key->top = (priv_key_len + BN_BITS2-1) / BN_BITS2;
984
985 ret = 1;
986err:
987 return ret;
988 }
989#endif
990
991#ifdef NOT_USED
992static int ubsec_rand_bytes(unsigned char * buf,
993 int num)
994 {
995 int ret = 0,
996 fd;
997
998 if ((fd = p_UBSEC_ubsec_open(UBSEC_KEY_DEVICE_NAME)) <= 0)
999 {
1000 const RAND_METHOD *meth;
1001 ENGINEerr(UBSEC_F_UBSEC_INIT, UBSEC_R_UNIT_FAILURE);
1002 num = p_UBSEC_ubsec_bits_to_bytes(num);
1003 meth = RAND_SSLeay();
1004 meth->seed(buf, num);
1005 ret = meth->bytes(buf, num);
1006 goto err;
1007 }
1008
1009 num *= 8; /* bytes to bits */
1010
1011 if (p_UBSEC_rng_ioctl(fd,
1012 UBSEC_RNG_DIRECT,
1013 buf,
1014 &num) != 0)
1015 {
1016 /* Hardware's a no go, failover to software */
1017 const RAND_METHOD *meth;
1018
1019 ENGINEerr(UBSEC_F_UBSEC_RNG_BYTES, UBSEC_R_REQUEST_FAILED);
1020 p_UBSEC_ubsec_close(fd);
1021
1022 num = p_UBSEC_ubsec_bits_to_bytes(num);
1023 meth = RAND_SSLeay();
1024 meth->seed(buf, num);
1025 ret = meth->bytes(buf, num);
1026
1027 goto err;
1028 }
1029
1030 p_UBSEC_ubsec_close(fd);
1031
1032 ret = 1;
1033err:
1034 return(ret);
1035 }
1036
1037
1038static int ubsec_rand_status(void)
1039 {
1040 return 0;
1041 }
1042#endif
1043
1044/* This stuff is needed if this ENGINE is being compiled into a self-contained
1045 * shared-library. */
1046#ifdef ENGINE_DYNAMIC_SUPPORT
1047static int bind_fn(ENGINE *e, const char *id)
1048 {
1049 if(id && (strcmp(id, engine_ubsec_id) != 0))
1050 return 0;
1051 if(!bind_helper(e))
1052 return 0;
1053 return 1;
1054 }
1055IMPLEMENT_DYNAMIC_CHECK_FN()
1056IMPLEMENT_DYNAMIC_BIND_FN(bind_fn)
1057#endif /* ENGINE_DYNAMIC_SUPPORT */
1058
1059#endif /* !OPENSSL_NO_HW_UBSEC */
1060#endif /* !OPENSSL_NO_HW */
diff --git a/src/lib/libcrypto/engine/hw_ubsec_err.c b/src/lib/libcrypto/engine/hw_ubsec_err.c
new file mode 100644
index 0000000000..d707331fc2
--- /dev/null
+++ b/src/lib/libcrypto/engine/hw_ubsec_err.c
@@ -0,0 +1,151 @@
1/* hw_ubsec_err.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/* 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 "hw_ubsec_err.h"
64
65/* BEGIN ERROR CODES */
66#ifndef OPENSSL_NO_ERR
67static ERR_STRING_DATA UBSEC_str_functs[]=
68 {
69{ERR_PACK(0,UBSEC_F_UBSEC_CTRL,0), "UBSEC_CTRL"},
70{ERR_PACK(0,UBSEC_F_UBSEC_DH_COMPUTE_KEY,0), "UBSEC_DH_COMPUTE_KEY"},
71{ERR_PACK(0,UBSEC_F_UBSEC_DSA_SIGN,0), "UBSEC_DSA_SIGN"},
72{ERR_PACK(0,UBSEC_F_UBSEC_DSA_VERIFY,0), "UBSEC_DSA_VERIFY"},
73{ERR_PACK(0,UBSEC_F_UBSEC_FINISH,0), "UBSEC_FINISH"},
74{ERR_PACK(0,UBSEC_F_UBSEC_INIT,0), "UBSEC_INIT"},
75{ERR_PACK(0,UBSEC_F_UBSEC_MOD_EXP,0), "UBSEC_MOD_EXP"},
76{ERR_PACK(0,UBSEC_F_UBSEC_RNG_BYTES,0), "UBSEC_RNG_BYTES"},
77{ERR_PACK(0,UBSEC_F_UBSEC_RSA_MOD_EXP,0), "UBSEC_RSA_MOD_EXP"},
78{ERR_PACK(0,UBSEC_F_UBSEC_RSA_MOD_EXP_CRT,0), "UBSEC_RSA_MOD_EXP_CRT"},
79{0,NULL}
80 };
81
82static ERR_STRING_DATA UBSEC_str_reasons[]=
83 {
84{UBSEC_R_ALREADY_LOADED ,"already loaded"},
85{UBSEC_R_BN_EXPAND_FAIL ,"bn expand fail"},
86{UBSEC_R_CTRL_COMMAND_NOT_IMPLEMENTED ,"ctrl command not implemented"},
87{UBSEC_R_DSO_FAILURE ,"dso failure"},
88{UBSEC_R_MISSING_KEY_COMPONENTS ,"missing key components"},
89{UBSEC_R_NOT_LOADED ,"not loaded"},
90{UBSEC_R_REQUEST_FAILED ,"request failed"},
91{UBSEC_R_SIZE_TOO_LARGE_OR_TOO_SMALL ,"size too large or too small"},
92{UBSEC_R_UNIT_FAILURE ,"unit failure"},
93{0,NULL}
94 };
95
96#endif
97
98#ifdef UBSEC_LIB_NAME
99static ERR_STRING_DATA UBSEC_lib_name[]=
100 {
101{0 ,UBSEC_LIB_NAME},
102{0,NULL}
103 };
104#endif
105
106
107static int UBSEC_lib_error_code=0;
108static int UBSEC_error_init=1;
109
110static void ERR_load_UBSEC_strings(void)
111 {
112 if (UBSEC_lib_error_code == 0)
113 UBSEC_lib_error_code=ERR_get_next_error_library();
114
115 if (UBSEC_error_init)
116 {
117 UBSEC_error_init=0;
118#ifndef OPENSSL_NO_ERR
119 ERR_load_strings(UBSEC_lib_error_code,UBSEC_str_functs);
120 ERR_load_strings(UBSEC_lib_error_code,UBSEC_str_reasons);
121#endif
122
123#ifdef UBSEC_LIB_NAME
124 UBSEC_lib_name->error = ERR_PACK(UBSEC_lib_error_code,0,0);
125 ERR_load_strings(0,UBSEC_lib_name);
126#endif
127 }
128 }
129
130static void ERR_unload_UBSEC_strings(void)
131 {
132 if (UBSEC_error_init == 0)
133 {
134#ifndef OPENSSL_NO_ERR
135 ERR_unload_strings(UBSEC_lib_error_code,UBSEC_str_functs);
136 ERR_unload_strings(UBSEC_lib_error_code,UBSEC_str_reasons);
137#endif
138
139#ifdef UBSEC_LIB_NAME
140 ERR_unload_strings(0,UBSEC_lib_name);
141#endif
142 UBSEC_error_init=1;
143 }
144 }
145
146static void ERR_UBSEC_error(int function, int reason, char *file, int line)
147 {
148 if (UBSEC_lib_error_code == 0)
149 UBSEC_lib_error_code=ERR_get_next_error_library();
150 ERR_PUT_error(UBSEC_lib_error_code,function,reason,file,line);
151 }
diff --git a/src/lib/libcrypto/engine/hw_ubsec_err.h b/src/lib/libcrypto/engine/hw_ubsec_err.h
new file mode 100644
index 0000000000..023d3be771
--- /dev/null
+++ b/src/lib/libcrypto/engine/hw_ubsec_err.h
@@ -0,0 +1,95 @@
1/* ====================================================================
2 * Copyright (c) 2001 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_UBSEC_ERR_H
56#define HEADER_UBSEC_ERR_H
57
58/* BEGIN ERROR CODES */
59/* The following lines are auto generated by the script mkerr.pl. Any changes
60 * made after this point may be overwritten when the script is next run.
61 */
62static void ERR_load_UBSEC_strings(void);
63static void ERR_unload_UBSEC_strings(void);
64static void ERR_UBSEC_error(int function, int reason, char *file, int line);
65#define UBSECerr(f,r) ERR_UBSEC_error((f),(r),__FILE__,__LINE__)
66
67/* Error codes for the UBSEC functions. */
68
69/* Function codes. */
70#define UBSEC_F_UBSEC_CTRL 100
71#define UBSEC_F_UBSEC_DH_COMPUTE_KEY 101
72#define UBSEC_F_UBSEC_DSA_SIGN 102
73#define UBSEC_F_UBSEC_DSA_VERIFY 103
74#define UBSEC_F_UBSEC_FINISH 104
75#define UBSEC_F_UBSEC_INIT 105
76#define UBSEC_F_UBSEC_MOD_EXP 106
77#define UBSEC_F_UBSEC_RNG_BYTES 107
78#define UBSEC_F_UBSEC_RSA_MOD_EXP 108
79#define UBSEC_F_UBSEC_RSA_MOD_EXP_CRT 109
80
81/* Reason codes. */
82#define UBSEC_R_ALREADY_LOADED 100
83#define UBSEC_R_BN_EXPAND_FAIL 101
84#define UBSEC_R_CTRL_COMMAND_NOT_IMPLEMENTED 102
85#define UBSEC_R_DSO_FAILURE 103
86#define UBSEC_R_MISSING_KEY_COMPONENTS 104
87#define UBSEC_R_NOT_LOADED 105
88#define UBSEC_R_REQUEST_FAILED 106
89#define UBSEC_R_SIZE_TOO_LARGE_OR_TOO_SMALL 107
90#define UBSEC_R_UNIT_FAILURE 108
91
92#ifdef __cplusplus
93}
94#endif
95#endif
diff --git a/src/lib/libcrypto/engine/tb_dsa.c b/src/lib/libcrypto/engine/tb_dsa.c
index 7efe181927..80170591f2 100644
--- a/src/lib/libcrypto/engine/tb_dsa.c
+++ b/src/lib/libcrypto/engine/tb_dsa.c
@@ -94,7 +94,7 @@ int ENGINE_set_default_DSA(ENGINE *e)
94 { 94 {
95 if(e->dsa_meth) 95 if(e->dsa_meth)
96 return engine_table_register(&dsa_table, 96 return engine_table_register(&dsa_table,
97 engine_unregister_all_DSA, e, &dummy_nid, 1, 1); 97 engine_unregister_all_DSA, e, &dummy_nid, 1, 0);
98 return 1; 98 return 1;
99 } 99 }
100 100
diff --git a/src/lib/libcrypto/engine/vendor_defns/aep.h b/src/lib/libcrypto/engine/vendor_defns/aep.h
new file mode 100644
index 0000000000..2b2792d2d6
--- /dev/null
+++ b/src/lib/libcrypto/engine/vendor_defns/aep.h
@@ -0,0 +1,178 @@
1/* This header declares the necessary definitions for using the exponentiation
2 * acceleration capabilities, and rnd number generation of the AEP card.
3 *
4 */
5
6/*
7 *
8 * Some AEP defines
9 *
10 */
11
12/*Successful return value*/
13#define AEP_R_OK 0x00000000
14
15/*Miscelleanous unsuccessful return value*/
16#define AEP_R_GENERAL_ERROR 0x10000001
17
18/*Insufficient host memory*/
19#define AEP_R_HOST_MEMORY 0x10000002
20
21#define AEP_R_FUNCTION_FAILED 0x10000006
22
23/*Invalid arguments in function call*/
24#define AEP_R_ARGUMENTS_BAD 0x10020000
25
26#define AEP_R_NO_TARGET_RESOURCES 0x10030000
27
28/*Error occuring on socket operation*/
29#define AEP_R_SOCKERROR 0x10000010
30
31/*Socket has been closed from the other end*/
32#define AEP_R_SOCKEOF 0x10000011
33
34/*Invalid handles*/
35#define AEP_R_CONNECTION_HANDLE_INVALID 0x100000B3
36
37#define AEP_R_TRANSACTION_HANDLE_INVALID 0x10040000
38
39/*Transaction has not yet returned from accelerator*/
40#define AEP_R_TRANSACTION_NOT_READY 0x00010000
41
42/*There is already a thread waiting on this transaction*/
43#define AEP_R_TRANSACTION_CLAIMED 0x10050000
44
45/*The transaction timed out*/
46#define AEP_R_TIMED_OUT 0x10060000
47
48#define AEP_R_FXN_NOT_IMPLEMENTED 0x10070000
49
50#define AEP_R_TARGET_ERROR 0x10080000
51
52/*Error in the AEP daemon process*/
53#define AEP_R_DAEMON_ERROR 0x10090000
54
55/*Invalid ctx id*/
56#define AEP_R_INVALID_CTX_ID 0x10009000
57
58#define AEP_R_NO_KEY_MANAGER 0x1000a000
59
60/*Error obtaining a mutex*/
61#define AEP_R_MUTEX_BAD 0x000001A0
62
63/*Fxn call before AEP_Initialise ot after AEP_Finialise*/
64#define AEP_R_AEPAPI_NOT_INITIALIZED 0x10000190
65
66/*AEP_Initialise has already been called*/
67#define AEP_R_AEPAPI_ALREADY_INITIALIZED 0x10000191
68
69/*Maximum number of connections to daemon reached*/
70#define AEP_R_NO_MORE_CONNECTION_HNDLS 0x10000200
71
72/*
73 *
74 * Some AEP Type definitions
75 *
76 */
77
78/* an unsigned 8-bit value */
79typedef unsigned char AEP_U8;
80
81/* an unsigned 8-bit character */
82typedef char AEP_CHAR;
83
84/* a BYTE-sized Boolean flag */
85typedef AEP_U8 AEP_BBOOL;
86
87/*Unsigned value, at least 16 bits long*/
88typedef unsigned short AEP_U16;
89
90/* an unsigned value, at least 32 bits long */
91#ifdef SIXTY_FOUR_BIT_LONG
92typedef unsigned int AEP_U32;
93#else
94typedef unsigned long AEP_U32;
95#endif
96
97#ifdef SIXTY_FOUR_BIT_LONG
98typedef unsigned long AEP_U64;
99#else
100typedef struct { unsigned long l1, l2; } AEP_U64;
101#endif
102
103/* at least 32 bits; each bit is a Boolean flag */
104typedef AEP_U32 AEP_FLAGS;
105
106typedef AEP_U8 *AEP_U8_PTR;
107typedef AEP_CHAR *AEP_CHAR_PTR;
108typedef AEP_U32 *AEP_U32_PTR;
109typedef AEP_U64 *AEP_U64_PTR;
110typedef void *AEP_VOID_PTR;
111
112/* Pointer to a AEP_VOID_PTR-- i.e., pointer to pointer to void */
113typedef AEP_VOID_PTR *AEP_VOID_PTR_PTR;
114
115/*Used to identify an AEP connection handle*/
116typedef AEP_U32 AEP_CONNECTION_HNDL;
117
118/*Pointer to an AEP connection handle*/
119typedef AEP_CONNECTION_HNDL *AEP_CONNECTION_HNDL_PTR;
120
121/*Used by an application (in conjunction with the apps process id) to
122identify an individual transaction*/
123typedef AEP_U32 AEP_TRANSACTION_ID;
124
125/*Pointer to an applications transaction identifier*/
126typedef AEP_TRANSACTION_ID *AEP_TRANSACTION_ID_PTR;
127
128/*Return value type*/
129typedef AEP_U32 AEP_RV;
130
131#define MAX_PROCESS_CONNECTIONS 256
132
133#define RAND_BLK_SIZE 1024
134
135typedef enum{
136 NotConnected= 0,
137 Connected= 1,
138 InUse= 2
139} AEP_CONNECTION_STATE;
140
141
142typedef struct AEP_CONNECTION_ENTRY{
143 AEP_CONNECTION_STATE conn_state;
144 AEP_CONNECTION_HNDL conn_hndl;
145} AEP_CONNECTION_ENTRY;
146
147
148typedef AEP_RV t_AEP_OpenConnection(AEP_CONNECTION_HNDL_PTR phConnection);
149typedef AEP_RV t_AEP_CloseConnection(AEP_CONNECTION_HNDL hConnection);
150
151typedef AEP_RV t_AEP_ModExp(AEP_CONNECTION_HNDL hConnection,
152 AEP_VOID_PTR pA, AEP_VOID_PTR pP,
153 AEP_VOID_PTR pN,
154 AEP_VOID_PTR pResult,
155 AEP_TRANSACTION_ID* pidTransID);
156
157typedef AEP_RV t_AEP_ModExpCrt(AEP_CONNECTION_HNDL hConnection,
158 AEP_VOID_PTR pA, AEP_VOID_PTR pP,
159 AEP_VOID_PTR pQ,
160 AEP_VOID_PTR pDmp1, AEP_VOID_PTR pDmq1,
161 AEP_VOID_PTR pIqmp,
162 AEP_VOID_PTR pResult,
163 AEP_TRANSACTION_ID* pidTransID);
164
165#ifdef AEPRAND
166typedef AEP_RV t_AEP_GenRandom(AEP_CONNECTION_HNDL hConnection,
167 AEP_U32 Len,
168 AEP_U32 Type,
169 AEP_VOID_PTR pResult,
170 AEP_TRANSACTION_ID* pidTransID);
171#endif
172
173typedef AEP_RV t_AEP_Initialize(AEP_VOID_PTR pInitArgs);
174typedef AEP_RV t_AEP_Finalize();
175typedef AEP_RV t_AEP_SetBNCallBacks(AEP_RV (*GetBigNumSizeFunc)(),
176 AEP_RV (*MakeAEPBigNumFunc)(),
177 AEP_RV (*ConverAEPBigNumFunc)());
178
diff --git a/src/lib/libcrypto/engine/vendor_defns/atalla.h b/src/lib/libcrypto/engine/vendor_defns/atalla.h
new file mode 100644
index 0000000000..149970d441
--- /dev/null
+++ b/src/lib/libcrypto/engine/vendor_defns/atalla.h
@@ -0,0 +1,48 @@
1/* This header declares the necessary definitions for using the exponentiation
2 * acceleration capabilities of Atalla cards. The only cryptographic operation
3 * is performed by "ASI_RSAPrivateKeyOpFn" and this takes a structure that
4 * defines an "RSA private key". However, it is really only performing a
5 * regular mod_exp using the supplied modulus and exponent - no CRT form is
6 * being used. Hence, it is a generic mod_exp function in disguise, and we use
7 * it as such.
8 *
9 * Thanks to the people at Atalla for letting me know these definitions are
10 * fine and that they can be reproduced here.
11 *
12 * Geoff.
13 */
14
15typedef struct ItemStr
16 {
17 unsigned char *data;
18 int len;
19 } Item;
20
21typedef struct RSAPrivateKeyStr
22 {
23 void *reserved;
24 Item version;
25 Item modulus;
26 Item publicExponent;
27 Item privateExponent;
28 Item prime[2];
29 Item exponent[2];
30 Item coefficient;
31 } RSAPrivateKey;
32
33/* Predeclare the function pointer types that we dynamically load from the DSO.
34 * These use the same names and form that Ben's original support code had (in
35 * crypto/bn/bn_exp.c) unless of course I've inadvertently changed the style
36 * somewhere along the way!
37 */
38
39typedef int tfnASI_GetPerformanceStatistics(int reset_flag,
40 unsigned int *ret_buf);
41
42typedef int tfnASI_GetHardwareConfig(long card_num, unsigned int *ret_buf);
43
44typedef int tfnASI_RSAPrivateKeyOpFn(RSAPrivateKey * rsaKey,
45 unsigned char *output,
46 unsigned char *input,
47 unsigned int modulus_len);
48
diff --git a/src/lib/libcrypto/engine/vendor_defns/cswift.h b/src/lib/libcrypto/engine/vendor_defns/cswift.h
new file mode 100644
index 0000000000..60079326bb
--- /dev/null
+++ b/src/lib/libcrypto/engine/vendor_defns/cswift.h
@@ -0,0 +1,234 @@
1/* Attribution notice: Rainbow have generously allowed me to reproduce
2 * the necessary definitions here from their API. This means the support
3 * can build independently of whether application builders have the
4 * API or hardware. This will allow developers to easily produce software
5 * that has latent hardware support for any users that have accelertors
6 * installed, without the developers themselves needing anything extra.
7 *
8 * I have only clipped the parts from the CryptoSwift header files that
9 * are (or seem) relevant to the CryptoSwift support code. This is
10 * simply to keep the file sizes reasonable.
11 * [Geoff]
12 */
13
14
15/* NB: These type widths do *not* seem right in general, in particular
16 * they're not terribly friendly to 64-bit architectures (unsigned long)
17 * will be 64-bit on IA-64 for a start. I'm leaving these alone as they
18 * agree with Rainbow's API and this will only be called into question
19 * on platforms with Rainbow support anyway! ;-) */
20
21#ifdef __cplusplus
22extern "C" {
23#endif /* __cplusplus */
24
25typedef long SW_STATUS; /* status */
26typedef unsigned char SW_BYTE; /* 8 bit byte */
27typedef unsigned short SW_U16; /* 16 bit number */
28#if defined(_IRIX)
29#include <sgidefs.h>
30typedef __uint32_t SW_U32;
31#else
32typedef unsigned long SW_U32; /* 32 bit integer */
33#endif
34
35#if defined(OPENSSL_SYS_WIN32)
36 typedef struct _SW_U64 {
37 SW_U32 low32;
38 SW_U32 high32;
39 } SW_U64; /* 64 bit integer */
40#elif defined(OPENSSL_SYS_MACINTOSH_CLASSIC)
41 typedef longlong SW_U64
42#else /* Unix variants */
43 typedef struct _SW_U64 {
44 SW_U32 low32;
45 SW_U32 high32;
46 } SW_U64; /* 64 bit integer */
47#endif
48
49/* status codes */
50#define SW_OK (0L)
51#define SW_ERR_BASE (-10000L)
52#define SW_ERR_NO_CARD (SW_ERR_BASE-1) /* The Card is not present */
53#define SW_ERR_CARD_NOT_READY (SW_ERR_BASE-2) /* The card has not powered */
54 /* up yet */
55#define SW_ERR_TIME_OUT (SW_ERR_BASE-3) /* Execution of a command */
56 /* time out */
57#define SW_ERR_NO_EXECUTE (SW_ERR_BASE-4) /* The Card failed to */
58 /* execute the command */
59#define SW_ERR_INPUT_NULL_PTR (SW_ERR_BASE-5) /* a required pointer is */
60 /* NULL */
61#define SW_ERR_INPUT_SIZE (SW_ERR_BASE-6) /* size is invalid, too */
62 /* small, too large. */
63#define SW_ERR_INVALID_HANDLE (SW_ERR_BASE-7) /* Invalid SW_ACC_CONTEXT */
64 /* handle */
65#define SW_ERR_PENDING (SW_ERR_BASE-8) /* A request is already out- */
66 /* standing at this */
67 /* context handle */
68#define SW_ERR_AVAILABLE (SW_ERR_BASE-9) /* A result is available. */
69#define SW_ERR_NO_PENDING (SW_ERR_BASE-10)/* No request is pending. */
70#define SW_ERR_NO_MEMORY (SW_ERR_BASE-11)/* Not enough memory */
71#define SW_ERR_BAD_ALGORITHM (SW_ERR_BASE-12)/* Invalid algorithm type */
72 /* in SW_PARAM structure */
73#define SW_ERR_MISSING_KEY (SW_ERR_BASE-13)/* No key is associated with */
74 /* context. */
75 /* swAttachKeyParam() is */
76 /* not called. */
77#define SW_ERR_KEY_CMD_MISMATCH \
78 (SW_ERR_BASE-14)/* Cannot perform requested */
79 /* SW_COMMAND_CODE since */
80 /* key attached via */
81 /* swAttachKeyParam() */
82 /* cannot be used for this*/
83 /* SW_COMMAND_CODE. */
84#define SW_ERR_NOT_IMPLEMENTED \
85 (SW_ERR_BASE-15)/* Not implemented */
86#define SW_ERR_BAD_COMMAND (SW_ERR_BASE-16)/* Bad command code */
87#define SW_ERR_BAD_ITEM_SIZE (SW_ERR_BASE-17)/* too small or too large in */
88 /* the "initems" or */
89 /* "outitems". */
90#define SW_ERR_BAD_ACCNUM (SW_ERR_BASE-18)/* Bad accelerator number */
91#define SW_ERR_SELFTEST_FAIL (SW_ERR_BASE-19)/* At least one of the self */
92 /* test fail, look at the */
93 /* selfTestBitmap in */
94 /* SW_ACCELERATOR_INFO for*/
95 /* details. */
96#define SW_ERR_MISALIGN (SW_ERR_BASE-20)/* Certain alogrithms require*/
97 /* key materials aligned */
98 /* in certain order, e.g. */
99 /* 128 bit for CRT */
100#define SW_ERR_OUTPUT_NULL_PTR \
101 (SW_ERR_BASE-21)/* a required pointer is */
102 /* NULL */
103#define SW_ERR_OUTPUT_SIZE \
104 (SW_ERR_BASE-22)/* size is invalid, too */
105 /* small, too large. */
106#define SW_ERR_FIRMWARE_CHECKSUM \
107 (SW_ERR_BASE-23)/* firmware checksum mismatch*/
108 /* download failed. */
109#define SW_ERR_UNKNOWN_FIRMWARE \
110 (SW_ERR_BASE-24)/* unknown firmware error */
111#define SW_ERR_INTERRUPT (SW_ERR_BASE-25)/* request is abort when */
112 /* it's waiting to be */
113 /* completed. */
114#define SW_ERR_NVWRITE_FAIL (SW_ERR_BASE-26)/* error in writing to Non- */
115 /* volatile memory */
116#define SW_ERR_NVWRITE_RANGE (SW_ERR_BASE-27)/* out of range error in */
117 /* writing to NV memory */
118#define SW_ERR_RNG_ERROR (SW_ERR_BASE-28)/* Random Number Generation */
119 /* failure */
120#define SW_ERR_DSS_FAILURE (SW_ERR_BASE-29)/* DSS Sign or Verify failure*/
121#define SW_ERR_MODEXP_FAILURE (SW_ERR_BASE-30)/* Failure in various math */
122 /* calculations */
123#define SW_ERR_ONBOARD_MEMORY (SW_ERR_BASE-31)/* Error in accessing on - */
124 /* board memory */
125#define SW_ERR_FIRMWARE_VERSION \
126 (SW_ERR_BASE-32)/* Wrong version in firmware */
127 /* update */
128#define SW_ERR_ZERO_WORKING_ACCELERATOR \
129 (SW_ERR_BASE-44)/* All accelerators are bad */
130
131
132 /* algorithm type */
133#define SW_ALG_CRT 1
134#define SW_ALG_EXP 2
135#define SW_ALG_DSA 3
136#define SW_ALG_NVDATA 4
137
138 /* command code */
139#define SW_CMD_MODEXP_CRT 1 /* perform Modular Exponentiation using */
140 /* Chinese Remainder Theorem (CRT) */
141#define SW_CMD_MODEXP 2 /* perform Modular Exponentiation */
142#define SW_CMD_DSS_SIGN 3 /* perform DSS sign */
143#define SW_CMD_DSS_VERIFY 4 /* perform DSS verify */
144#define SW_CMD_RAND 5 /* perform random number generation */
145#define SW_CMD_NVREAD 6 /* perform read to nonvolatile RAM */
146#define SW_CMD_NVWRITE 7 /* perform write to nonvolatile RAM */
147
148typedef SW_U32 SW_ALGTYPE; /* alogrithm type */
149typedef SW_U32 SW_STATE; /* state */
150typedef SW_U32 SW_COMMAND_CODE; /* command code */
151typedef SW_U32 SW_COMMAND_BITMAP[4]; /* bitmap */
152
153typedef struct _SW_LARGENUMBER {
154 SW_U32 nbytes; /* number of bytes in the buffer "value" */
155 SW_BYTE* value; /* the large integer as a string of */
156 /* bytes in network (big endian) order */
157} SW_LARGENUMBER;
158
159#if defined(OPENSSL_SYS_WIN32)
160 #include <windows.h>
161 typedef HANDLE SW_OSHANDLE; /* handle to kernel object */
162 #define SW_OS_INVALID_HANDLE INVALID_HANDLE_VALUE
163 #define SW_CALLCONV _stdcall
164#elif defined(OPENSSL_SYS_MACINTOSH_CLASSIC)
165 /* async callback mechanisms */
166 /* swiftCallbackLevel */
167 #define SW_MAC_CALLBACK_LEVEL_NO 0
168 #define SW_MAC_CALLBACK_LEVEL_HARDWARE 1 /* from the hardware ISR */
169 #define SW_MAC_CALLBACK_LEVEL_SECONDARY 2 /* as secondary ISR */
170 typedef int SW_MAC_CALLBACK_LEVEL;
171 typedef int SW_OSHANDLE;
172 #define SW_OS_INVALID_HANDLE (-1)
173 #define SW_CALLCONV
174#else /* Unix variants */
175 typedef int SW_OSHANDLE; /* handle to driver */
176 #define SW_OS_INVALID_HANDLE (-1)
177 #define SW_CALLCONV
178#endif
179
180typedef struct _SW_CRT {
181 SW_LARGENUMBER p; /* prime number p */
182 SW_LARGENUMBER q; /* prime number q */
183 SW_LARGENUMBER dmp1; /* exponent1 */
184 SW_LARGENUMBER dmq1; /* exponent2 */
185 SW_LARGENUMBER iqmp; /* CRT coefficient */
186} SW_CRT;
187
188typedef struct _SW_EXP {
189 SW_LARGENUMBER modulus; /* modulus */
190 SW_LARGENUMBER exponent;/* exponent */
191} SW_EXP;
192
193typedef struct _SW_DSA {
194 SW_LARGENUMBER p; /* */
195 SW_LARGENUMBER q; /* */
196 SW_LARGENUMBER g; /* */
197 SW_LARGENUMBER key; /* private/public key */
198} SW_DSA;
199
200typedef struct _SW_NVDATA {
201 SW_U32 accnum; /* accelerator board number */
202 SW_U32 offset; /* offset in byte */
203} SW_NVDATA;
204
205typedef struct _SW_PARAM {
206 SW_ALGTYPE type; /* type of the alogrithm */
207 union {
208 SW_CRT crt;
209 SW_EXP exp;
210 SW_DSA dsa;
211 SW_NVDATA nvdata;
212 } up;
213} SW_PARAM;
214
215typedef SW_U32 SW_CONTEXT_HANDLE; /* opaque context handle */
216
217
218/* Now the OpenSSL bits, these function types are the for the function
219 * pointers that will bound into the Rainbow shared libraries. */
220typedef SW_STATUS SW_CALLCONV t_swAcquireAccContext(SW_CONTEXT_HANDLE *hac);
221typedef SW_STATUS SW_CALLCONV t_swAttachKeyParam(SW_CONTEXT_HANDLE hac,
222 SW_PARAM *key_params);
223typedef SW_STATUS SW_CALLCONV t_swSimpleRequest(SW_CONTEXT_HANDLE hac,
224 SW_COMMAND_CODE cmd,
225 SW_LARGENUMBER pin[],
226 SW_U32 pin_count,
227 SW_LARGENUMBER pout[],
228 SW_U32 pout_count);
229typedef SW_STATUS SW_CALLCONV t_swReleaseAccContext(SW_CONTEXT_HANDLE hac);
230
231#ifdef __cplusplus
232}
233#endif /* __cplusplus */
234
diff --git a/src/lib/libcrypto/engine/vendor_defns/hw_4758_cca.h b/src/lib/libcrypto/engine/vendor_defns/hw_4758_cca.h
new file mode 100644
index 0000000000..296636e81a
--- /dev/null
+++ b/src/lib/libcrypto/engine/vendor_defns/hw_4758_cca.h
@@ -0,0 +1,149 @@
1/**********************************************************************/
2/* */
3/* Prototypes of the CCA verbs used by the 4758 CCA openssl driver */
4/* */
5/* Maurice Gittens <maurice@gittens.nl> */
6/* */
7/**********************************************************************/
8
9#ifndef __HW_4758_CCA__
10#define __HW_4758_CCA__
11
12/*
13 * Only WIN32 support for now
14 */
15#if defined(WIN32)
16
17 #define CCA_LIB_NAME "CSUNSAPI"
18
19 #define CSNDPKX "CSNDPKX_32"
20 #define CSNDKRR "CSNDKRR_32"
21 #define CSNDPKE "CSNDPKE_32"
22 #define CSNDPKD "CSNDPKD_32"
23 #define CSNDDSV "CSNDDSV_32"
24 #define CSNDDSG "CSNDDSG_32"
25 #define CSNBRNG "CSNBRNG_32"
26
27 #define SECURITYAPI __stdcall
28#else
29 /* Fixme!!
30 Find out the values of these constants for other platforms.
31 */
32 #define CCA_LIB_NAME "CSUNSAPI"
33
34 #define CSNDPKX "CSNDPKX"
35 #define CSNDKRR "CSNDKRR"
36 #define CSNDPKE "CSNDPKE"
37 #define CSNDPKD "CSNDPKD"
38 #define CSNDDSV "CSNDDSV"
39 #define CSNDDSG "CSNDDSG"
40 #define CSNBRNG "CSNBRNG"
41
42 #define SECURITYAPI
43#endif
44
45/*
46 * security API prototypes
47 */
48
49/* PKA Key Record Read */
50typedef void (SECURITYAPI *F_KEYRECORDREAD)
51 (long * return_code,
52 long * reason_code,
53 long * exit_data_length,
54 unsigned char * exit_data,
55 long * rule_array_count,
56 unsigned char * rule_array,
57 unsigned char * key_label,
58 long * key_token_length,
59 unsigned char * key_token);
60
61/* Random Number Generate */
62typedef void (SECURITYAPI *F_RANDOMNUMBERGENERATE)
63 (long * return_code,
64 long * reason_code,
65 long * exit_data_length,
66 unsigned char * exit_data,
67 unsigned char * form,
68 unsigned char * random_number);
69
70/* Digital Signature Generate */
71typedef void (SECURITYAPI *F_DIGITALSIGNATUREGENERATE)
72 (long * return_code,
73 long * reason_code,
74 long * exit_data_length,
75 unsigned char * exit_data,
76 long * rule_array_count,
77 unsigned char * rule_array,
78 long * PKA_private_key_id_length,
79 unsigned char * PKA_private_key_id,
80 long * hash_length,
81 unsigned char * hash,
82 long * signature_field_length,
83 long * signature_bit_length,
84 unsigned char * signature_field);
85
86/* Digital Signature Verify */
87typedef void (SECURITYAPI *F_DIGITALSIGNATUREVERIFY)(
88 long * return_code,
89 long * reason_code,
90 long * exit_data_length,
91 unsigned char * exit_data,
92 long * rule_array_count,
93 unsigned char * rule_array,
94 long * PKA_public_key_id_length,
95 unsigned char * PKA_public_key_id,
96 long * hash_length,
97 unsigned char * hash,
98 long * signature_field_length,
99 unsigned char * signature_field);
100
101/* PKA Public Key Extract */
102typedef void (SECURITYAPI *F_PUBLICKEYEXTRACT)(
103 long * return_code,
104 long * reason_code,
105 long * exit_data_length,
106 unsigned char * exit_data,
107 long * rule_array_count,
108 unsigned char * rule_array,
109 long * source_key_identifier_length,
110 unsigned char * source_key_identifier,
111 long * target_key_token_length,
112 unsigned char * target_key_token);
113
114/* PKA Encrypt */
115typedef void (SECURITYAPI *F_PKAENCRYPT)
116 (long * return_code,
117 long * reason_code,
118 long * exit_data_length,
119 unsigned char * exit_data,
120 long * rule_array_count,
121 unsigned char * rule_array,
122 long * key_value_length,
123 unsigned char * key_value,
124 long * data_struct_length,
125 unsigned char * data_struct,
126 long * RSA_public_key_length,
127 unsigned char * RSA_public_key,
128 long * RSA_encipher_length,
129 unsigned char * RSA_encipher );
130
131/* PKA Decrypt */
132typedef void (SECURITYAPI *F_PKADECRYPT)
133 (long * return_code,
134 long * reason_code,
135 long * exit_data_length,
136 unsigned char * exit_data,
137 long * rule_array_count,
138 unsigned char * rule_array,
139 long * enciphered_key_length,
140 unsigned char * enciphered_key,
141 long * data_struct_length,
142 unsigned char * data_struct,
143 long * RSA_private_key_length,
144 unsigned char * RSA_private_key,
145 long * key_value_length,
146 unsigned char * key_value );
147
148
149#endif
diff --git a/src/lib/libcrypto/engine/vendor_defns/hw_ubsec.h b/src/lib/libcrypto/engine/vendor_defns/hw_ubsec.h
new file mode 100644
index 0000000000..b6619d40f2
--- /dev/null
+++ b/src/lib/libcrypto/engine/vendor_defns/hw_ubsec.h
@@ -0,0 +1,100 @@
1/******************************************************************************
2 *
3 * Copyright 2000
4 * Broadcom Corporation
5 * 16215 Alton Parkway
6 * PO Box 57013
7 * Irvine CA 92619-7013
8 *
9 *****************************************************************************/
10/*
11 * Broadcom Corporation uBSec SDK
12 */
13/*
14 * Character device header file.
15 */
16/*
17 * Revision History:
18 *
19 * October 2000 JTT Created.
20 */
21
22#define MAX_PUBLIC_KEY_BITS (1024)
23#define MAX_PUBLIC_KEY_BYTES (1024/8)
24#define SHA_BIT_SIZE (160)
25#define MAX_CRYPTO_KEY_LENGTH 24
26#define MAX_MAC_KEY_LENGTH 64
27#define UBSEC_CRYPTO_DEVICE_NAME ((unsigned char *)"/dev/ubscrypt")
28#define UBSEC_KEY_DEVICE_NAME ((unsigned char *)"/dev/ubskey")
29
30/* Math command types. */
31#define UBSEC_MATH_MODADD 0x0001
32#define UBSEC_MATH_MODSUB 0x0002
33#define UBSEC_MATH_MODMUL 0x0004
34#define UBSEC_MATH_MODEXP 0x0008
35#define UBSEC_MATH_MODREM 0x0010
36#define UBSEC_MATH_MODINV 0x0020
37
38typedef long ubsec_MathCommand_t;
39typedef long ubsec_RNGCommand_t;
40
41typedef struct ubsec_crypto_context_s {
42 unsigned int flags;
43 unsigned char crypto[MAX_CRYPTO_KEY_LENGTH];
44 unsigned char auth[MAX_MAC_KEY_LENGTH];
45} ubsec_crypto_context_t, *ubsec_crypto_context_p;
46
47/*
48 * Predeclare the function pointer types that we dynamically load from the DSO.
49 */
50
51typedef int t_UBSEC_ubsec_bytes_to_bits(unsigned char *n, int bytes);
52
53typedef int t_UBSEC_ubsec_bits_to_bytes(int bits);
54
55typedef int t_UBSEC_ubsec_open(unsigned char *device);
56
57typedef int t_UBSEC_ubsec_close(int fd);
58
59typedef int t_UBSEC_diffie_hellman_generate_ioctl (int fd,
60 unsigned char *x, int *x_len, unsigned char *y, int *y_len,
61 unsigned char *g, int g_len, unsigned char *m, int m_len,
62 unsigned char *userX, int userX_len, int random_bits);
63
64typedef int t_UBSEC_diffie_hellman_agree_ioctl (int fd,
65 unsigned char *x, int x_len, unsigned char *y, int y_len,
66 unsigned char *m, int m_len, unsigned char *k, int *k_len);
67
68typedef int t_UBSEC_rsa_mod_exp_ioctl (int fd,
69 unsigned char *x, int x_len, unsigned char *m, int m_len,
70 unsigned char *e, int e_len, unsigned char *y, int *y_len);
71
72typedef int t_UBSEC_rsa_mod_exp_crt_ioctl (int fd,
73 unsigned char *x, int x_len, unsigned char *qinv, int qinv_len,
74 unsigned char *edq, int edq_len, unsigned char *q, int q_len,
75 unsigned char *edp, int edp_len, unsigned char *p, int p_len,
76 unsigned char *y, int *y_len);
77
78typedef int t_UBSEC_dsa_sign_ioctl (int fd,
79 int hash, unsigned char *data, int data_len,
80 unsigned char *rndom, int random_len,
81 unsigned char *p, int p_len, unsigned char *q, int q_len,
82 unsigned char *g, int g_len, unsigned char *key, int key_len,
83 unsigned char *r, int *r_len, unsigned char *s, int *s_len);
84
85typedef int t_UBSEC_dsa_verify_ioctl (int fd,
86 int hash, unsigned char *data, int data_len,
87 unsigned char *p, int p_len, unsigned char *q, int q_len,
88 unsigned char *g, int g_len, unsigned char *key, int key_len,
89 unsigned char *r, int r_len, unsigned char *s, int s_len,
90 unsigned char *v, int *v_len);
91
92typedef int t_UBSEC_math_accelerate_ioctl(int fd, ubsec_MathCommand_t command,
93 unsigned char *ModN, int *ModN_len, unsigned char *ExpE, int *ExpE_len,
94 unsigned char *ParamA, int *ParamA_len, unsigned char *ParamB, int *ParamB_len,
95 unsigned char *Result, int *Result_len);
96
97typedef int t_UBSEC_rng_ioctl(int fd, ubsec_RNGCommand_t command,
98 unsigned char *Result, int *Result_len);
99
100typedef int t_UBSEC_max_key_len_ioctl(int fd, int *max_key_len);
diff --git a/src/lib/libcrypto/engine/vendor_defns/hwcryptohook.h b/src/lib/libcrypto/engine/vendor_defns/hwcryptohook.h
new file mode 100644
index 0000000000..aaa4d4575e
--- /dev/null
+++ b/src/lib/libcrypto/engine/vendor_defns/hwcryptohook.h
@@ -0,0 +1,486 @@
1/*
2 * ModExp / RSA (with/without KM) plugin API
3 *
4 * The application will load a dynamic library which
5 * exports entrypoint(s) defined in this file.
6 *
7 * This set of entrypoints provides only a multithreaded,
8 * synchronous-within-each-thread, facility.
9 *
10 *
11 * This file is Copyright 1998-2000 nCipher Corporation Limited.
12 *
13 * Redistribution and use in source and binary forms, with opr without
14 * modification, are permitted provided that the following conditions
15 * are met:
16 *
17 * 1. Redistributions of source code must retain the copyright notice,
18 * this list of conditions, and the following disclaimer.
19 *
20 * 2. Redistributions in binary form must reproduce the above
21 * copyright notice, this list of conditions, and the following
22 * disclaimer, in the documentation and/or other materials provided
23 * with the distribution
24 *
25 * IN NO EVENT SHALL NCIPHER CORPORATION LIMITED (`NCIPHER') AND/OR
26 * ANY OTHER AUTHORS OR DISTRIBUTORS OF THIS FILE BE LIABLE for any
27 * damages arising directly or indirectly from this file, its use or
28 * this licence. Without prejudice to the generality of the
29 * foregoing: all liability shall be excluded for direct, indirect,
30 * special, incidental, consequential or other damages or any loss of
31 * profits, business, revenue goodwill or anticipated savings;
32 * liability shall be excluded even if nCipher or anyone else has been
33 * advised of the possibility of damage. In any event, if the
34 * exclusion of liability is not effective, the liability of nCipher
35 * or any author or distributor shall be limited to the lesser of the
36 * price paid and 1,000 pounds sterling. This licence only fails to
37 * exclude or limit liability for death or personal injury arising out
38 * of negligence, and only to the extent that such an exclusion or
39 * limitation is not effective.
40 *
41 * NCIPHER AND THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ALL
42 * AND ANY WARRANTIES (WHETHER EXPRESS OR IMPLIED), including, but not
43 * limited to, any implied warranties of merchantability, fitness for
44 * a particular purpose, satisfactory quality, and/or non-infringement
45 * of any third party rights.
46 *
47 * US Government use: This software and documentation is Commercial
48 * Computer Software and Computer Software Documentation, as defined in
49 * sub-paragraphs (a)(1) and (a)(5) of DFAR 252.227-7014, "Rights in
50 * Noncommercial Computer Software and Noncommercial Computer Software
51 * Documentation." Use, duplication or disclosure by the Government is
52 * subject to the terms and conditions specified here.
53 *
54 * By using or distributing this file you will be accepting these
55 * terms and conditions, including the limitation of liability and
56 * lack of warranty. If you do not wish to accept these terms and
57 * conditions, DO NOT USE THE FILE.
58 *
59 *
60 * The actual dynamically loadable plugin, and the library files for
61 * static linking, which are also provided in some distributions, are
62 * not covered by the licence described above. You should have
63 * received a separate licence with terms and conditions for these
64 * library files; if you received the library files without a licence,
65 * please contact nCipher.
66 *
67 *
68 * $Id: hwcryptohook.h,v 1.1.1.1 2003/05/11 21:35:16 markus Exp $
69 */
70
71#ifndef HWCRYPTOHOOK_H
72#define HWCRYPTOHOOK_H
73
74#include <sys/types.h>
75#include <stdio.h>
76
77#ifndef HWCRYPTOHOOK_DECLARE_APPTYPES
78#define HWCRYPTOHOOK_DECLARE_APPTYPES 1
79#endif
80
81#define HWCRYPTOHOOK_ERROR_FAILED -1
82#define HWCRYPTOHOOK_ERROR_FALLBACK -2
83#define HWCRYPTOHOOK_ERROR_MPISIZE -3
84
85#if HWCRYPTOHOOK_DECLARE_APPTYPES
86
87/* These structs are defined by the application and opaque to the
88 * crypto plugin. The application may define these as it sees fit.
89 * Default declarations are provided here, but the application may
90 * #define HWCRYPTOHOOK_DECLARE_APPTYPES 0
91 * to prevent these declarations, and instead provide its own
92 * declarations of these types. (Pointers to them must still be
93 * ordinary pointers to structs or unions, or the resulting combined
94 * program will have a type inconsistency.)
95 */
96typedef struct HWCryptoHook_MutexValue HWCryptoHook_Mutex;
97typedef struct HWCryptoHook_CondVarValue HWCryptoHook_CondVar;
98typedef struct HWCryptoHook_PassphraseContextValue HWCryptoHook_PassphraseContext;
99typedef struct HWCryptoHook_CallerContextValue HWCryptoHook_CallerContext;
100
101#endif /* HWCRYPTOHOOK_DECLARE_APPTYPES */
102
103/* These next two structs are opaque to the application. The crypto
104 * plugin will return pointers to them; the caller simply manipulates
105 * the pointers.
106 */
107typedef struct HWCryptoHook_Context *HWCryptoHook_ContextHandle;
108typedef struct HWCryptoHook_RSAKey *HWCryptoHook_RSAKeyHandle;
109
110typedef struct {
111 char *buf;
112 size_t size;
113} HWCryptoHook_ErrMsgBuf;
114/* Used for error reporting. When a HWCryptoHook function fails it
115 * will return a sentinel value (0 for pointer-valued functions, or a
116 * negative number, usually HWCRYPTOHOOK_ERROR_FAILED, for
117 * integer-valued ones). It will, if an ErrMsgBuf is passed, also put
118 * an error message there.
119 *
120 * size is the size of the buffer, and will not be modified. If you
121 * pass 0 for size you must pass 0 for buf, and nothing will be
122 * recorded (just as if you passed 0 for the struct pointer).
123 * Messages written to the buffer will always be null-terminated, even
124 * when truncated to fit within size bytes.
125 *
126 * The contents of the buffer are not defined if there is no error.
127 */
128
129typedef struct HWCryptoHook_MPIStruct {
130 unsigned char *buf;
131 size_t size;
132} HWCryptoHook_MPI;
133/* When one of these is returned, a pointer is passed to the function.
134 * At call, size is the space available. Afterwards it is updated to
135 * be set to the actual length (which may be more than the space available,
136 * if there was not enough room and the result was truncated).
137 * buf (the pointer) is not updated.
138 *
139 * size is in bytes and may be zero at call or return, but must be a
140 * multiple of the limb size. Zero limbs at the MS end are not
141 * permitted.
142 */
143
144#define HWCryptoHook_InitFlags_FallbackModExp 0x0002UL
145#define HWCryptoHook_InitFlags_FallbackRSAImmed 0x0004UL
146/* Enable requesting fallback to software in case of problems with the
147 * hardware support. This indicates to the crypto provider that the
148 * application is prepared to fall back to software operation if the
149 * ModExp* or RSAImmed* functions return HWCRYPTOHOOK_ERROR_FALLBACK.
150 * Without this flag those calls will never return
151 * HWCRYPTOHOOK_ERROR_FALLBACK. The flag will also cause the crypto
152 * provider to avoid repeatedly attempting to contact dead hardware
153 * within a short interval, if appropriate.
154 */
155
156#define HWCryptoHook_InitFlags_SimpleForkCheck 0x0010UL
157/* Without _SimpleForkCheck the library is allowed to assume that the
158 * application will not fork and call the library in the child(ren).
159 *
160 * When it is specified, this is allowed. However, after a fork
161 * neither parent nor child may unload any loaded keys or call
162 * _Finish. Instead, they should call exit (or die with a signal)
163 * without calling _Finish. After all the children have died the
164 * parent may unload keys or call _Finish.
165 *
166 * This flag only has any effect on UN*X platforms.
167 */
168
169typedef struct {
170 unsigned long flags;
171 void *logstream; /* usually a FILE*. See below. */
172
173 size_t limbsize; /* bignum format - size of radix type, must be power of 2 */
174 int mslimbfirst; /* 0 or 1 */
175 int msbytefirst; /* 0 or 1; -1 = native */
176
177 /* All the callback functions should return 0 on success, or a
178 * nonzero integer (whose value will be visible in the error message
179 * put in the buffer passed to the call).
180 *
181 * If a callback is not available pass a null function pointer.
182 *
183 * The callbacks may not call down again into the crypto plugin.
184 */
185
186 /* For thread-safety. Set everything to 0 if you promise only to be
187 * singlethreaded. maxsimultaneous is the number of calls to
188 * ModExp[Crt]/RSAImmed{Priv,Pub}/RSA. If you don't know what to
189 * put there then say 0 and the hook library will use a default.
190 *
191 * maxmutexes is a small limit on the number of simultaneous mutexes
192 * which will be requested by the library. If there is no small
193 * limit, set it to 0. If the crypto plugin cannot create the
194 * advertised number of mutexes the calls to its functions may fail.
195 * If a low number of mutexes is advertised the plugin will try to
196 * do the best it can. Making larger numbers of mutexes available
197 * may improve performance and parallelism by reducing contention
198 * over critical sections. Unavailability of any mutexes, implying
199 * single-threaded operation, should be indicated by the setting
200 * mutex_init et al to 0.
201 */
202 int maxmutexes;
203 int maxsimultaneous;
204 size_t mutexsize;
205 int (*mutex_init)(HWCryptoHook_Mutex*, HWCryptoHook_CallerContext *cactx);
206 int (*mutex_acquire)(HWCryptoHook_Mutex*);
207 void (*mutex_release)(HWCryptoHook_Mutex*);
208 void (*mutex_destroy)(HWCryptoHook_Mutex*);
209
210 /* For greater efficiency, can use condition vars internally for
211 * synchronisation. In this case maxsimultaneous is ignored, but
212 * the other mutex stuff must be available. In singlethreaded
213 * programs, set everything to 0.
214 */
215 size_t condvarsize;
216 int (*condvar_init)(HWCryptoHook_CondVar*, HWCryptoHook_CallerContext *cactx);
217 int (*condvar_wait)(HWCryptoHook_CondVar*, HWCryptoHook_Mutex*);
218 void (*condvar_signal)(HWCryptoHook_CondVar*);
219 void (*condvar_broadcast)(HWCryptoHook_CondVar*);
220 void (*condvar_destroy)(HWCryptoHook_CondVar*);
221
222 /* The semantics of acquiring and releasing mutexes and broadcasting
223 * and waiting on condition variables are expected to be those from
224 * POSIX threads (pthreads). The mutexes may be (in pthread-speak)
225 * fast mutexes, recursive mutexes, or nonrecursive ones.
226 *
227 * The _release/_signal/_broadcast and _destroy functions must
228 * always succeed when given a valid argument; if they are given an
229 * invalid argument then the program (crypto plugin + application)
230 * has an internal error, and they should abort the program.
231 */
232
233 int (*getpassphrase)(const char *prompt_info,
234 int *len_io, char *buf,
235 HWCryptoHook_PassphraseContext *ppctx,
236 HWCryptoHook_CallerContext *cactx);
237 /* Passphrases and the prompt_info, if they contain high-bit-set
238 * characters, are UTF-8. The prompt_info may be a null pointer if
239 * no prompt information is available (it should not be an empty
240 * string). It will not contain text like `enter passphrase';
241 * instead it might say something like `Operator Card for John
242 * Smith' or `SmartCard in nFast Module #1, Slot #1'.
243 *
244 * buf points to a buffer in which to return the passphrase; on
245 * entry *len_io is the length of the buffer. It should be updated
246 * by the callback. The returned passphrase should not be
247 * null-terminated by the callback.
248 */
249
250 int (*getphystoken)(const char *prompt_info,
251 const char *wrong_info,
252 HWCryptoHook_PassphraseContext *ppctx,
253 HWCryptoHook_CallerContext *cactx);
254 /* Requests that the human user physically insert a different
255 * smartcard, DataKey, etc. The plugin should check whether the
256 * currently inserted token(s) are appropriate, and if they are it
257 * should not make this call.
258 *
259 * prompt_info is as before. wrong_info is a description of the
260 * currently inserted token(s) so that the user is told what
261 * something is. wrong_info, like prompt_info, may be null, but
262 * should not be an empty string. Its contents should be
263 * syntactically similar to that of prompt_info.
264 */
265
266 /* Note that a single LoadKey operation might cause several calls to
267 * getpassphrase and/or requestphystoken. If requestphystoken is
268 * not provided (ie, a null pointer is passed) then the plugin may
269 * not support loading keys for which authorisation by several cards
270 * is required. If getpassphrase is not provided then cards with
271 * passphrases may not be supported.
272 *
273 * getpassphrase and getphystoken do not need to check that the
274 * passphrase has been entered correctly or the correct token
275 * inserted; the crypto plugin will do that. If this is not the
276 * case then the crypto plugin is responsible for calling these
277 * routines again as appropriate until the correct token(s) and
278 * passphrase(s) are supplied as required, or until any retry limits
279 * implemented by the crypto plugin are reached.
280 *
281 * In either case, the application must allow the user to say `no'
282 * or `cancel' to indicate that they do not know the passphrase or
283 * have the appropriate token; this should cause the callback to
284 * return nonzero indicating error.
285 */
286
287 void (*logmessage)(void *logstream, const char *message);
288 /* A log message will be generated at least every time something goes
289 * wrong and an ErrMsgBuf is filled in (or would be if one was
290 * provided). Other diagnostic information may be written there too,
291 * including more detailed reasons for errors which are reported in an
292 * ErrMsgBuf.
293 *
294 * When a log message is generated, this callback is called. It
295 * should write a message to the relevant logging arrangements.
296 *
297 * The message string passed will be null-terminated and may be of arbitrary
298 * length. It will not be prefixed by the time and date, nor by the
299 * name of the library that is generating it - if this is required,
300 * the logmessage callback must do it. The message will not have a
301 * trailing newline (though it may contain internal newlines).
302 *
303 * If a null pointer is passed for logmessage a default function is
304 * used. The default function treats logstream as a FILE* which has
305 * been converted to a void*. If logstream is 0 it does nothing.
306 * Otherwise it prepends the date and time and library name and
307 * writes the message to logstream. Each line will be prefixed by a
308 * descriptive string containing the date, time and identity of the
309 * crypto plugin. Errors on the logstream are not reported
310 * anywhere, and the default function doesn't flush the stream, so
311 * the application must set the buffering how it wants it.
312 *
313 * The crypto plugin may also provide a facility to have copies of
314 * log messages sent elsewhere, and or for adjusting the verbosity
315 * of the log messages; any such facilities will be configured by
316 * external means.
317 */
318
319} HWCryptoHook_InitInfo;
320
321typedef
322HWCryptoHook_ContextHandle HWCryptoHook_Init_t(const HWCryptoHook_InitInfo *initinfo,
323 size_t initinfosize,
324 const HWCryptoHook_ErrMsgBuf *errors,
325 HWCryptoHook_CallerContext *cactx);
326extern HWCryptoHook_Init_t HWCryptoHook_Init;
327
328/* Caller should set initinfosize to the size of the HWCryptoHook struct,
329 * so it can be extended later.
330 *
331 * On success, a message for display or logging by the server,
332 * including the name and version number of the plugin, will be filled
333 * in into *errors; on failure *errors is used for error handling, as
334 * usual.
335 */
336
337/* All these functions return 0 on success, HWCRYPTOHOOK_ERROR_FAILED
338 * on most failures. HWCRYPTOHOOK_ERROR_MPISIZE means at least one of
339 * the output MPI buffer(s) was too small; the sizes of all have been
340 * set to the desired size (and for those where the buffer was large
341 * enough, the value may have been copied in), and no error message
342 * has been recorded.
343 *
344 * You may pass 0 for the errors struct. In any case, unless you set
345 * _NoStderr at init time then messages may be reported to stderr.
346 */
347
348/* The RSAImmed* functions (and key managed RSA) only work with
349 * modules which have an RSA patent licence - currently that means KM
350 * units; the ModExp* ones work with all modules, so you need a patent
351 * licence in the software in the US. They are otherwise identical.
352 */
353
354typedef
355void HWCryptoHook_Finish_t(HWCryptoHook_ContextHandle hwctx);
356extern HWCryptoHook_Finish_t HWCryptoHook_Finish;
357/* You must not have any calls going or keys loaded when you call this. */
358
359typedef
360int HWCryptoHook_RandomBytes_t(HWCryptoHook_ContextHandle hwctx,
361 unsigned char *buf, size_t len,
362 const HWCryptoHook_ErrMsgBuf *errors);
363extern HWCryptoHook_RandomBytes_t HWCryptoHook_RandomBytes;
364
365typedef
366int HWCryptoHook_ModExp_t(HWCryptoHook_ContextHandle hwctx,
367 HWCryptoHook_MPI a,
368 HWCryptoHook_MPI p,
369 HWCryptoHook_MPI n,
370 HWCryptoHook_MPI *r,
371 const HWCryptoHook_ErrMsgBuf *errors);
372extern HWCryptoHook_ModExp_t HWCryptoHook_ModExp;
373
374typedef
375int HWCryptoHook_RSAImmedPub_t(HWCryptoHook_ContextHandle hwctx,
376 HWCryptoHook_MPI m,
377 HWCryptoHook_MPI e,
378 HWCryptoHook_MPI n,
379 HWCryptoHook_MPI *r,
380 const HWCryptoHook_ErrMsgBuf *errors);
381extern HWCryptoHook_RSAImmedPub_t HWCryptoHook_RSAImmedPub;
382
383typedef
384int HWCryptoHook_ModExpCRT_t(HWCryptoHook_ContextHandle hwctx,
385 HWCryptoHook_MPI a,
386 HWCryptoHook_MPI p,
387 HWCryptoHook_MPI q,
388 HWCryptoHook_MPI dmp1,
389 HWCryptoHook_MPI dmq1,
390 HWCryptoHook_MPI iqmp,
391 HWCryptoHook_MPI *r,
392 const HWCryptoHook_ErrMsgBuf *errors);
393extern HWCryptoHook_ModExpCRT_t HWCryptoHook_ModExpCRT;
394
395typedef
396int HWCryptoHook_RSAImmedPriv_t(HWCryptoHook_ContextHandle hwctx,
397 HWCryptoHook_MPI m,
398 HWCryptoHook_MPI p,
399 HWCryptoHook_MPI q,
400 HWCryptoHook_MPI dmp1,
401 HWCryptoHook_MPI dmq1,
402 HWCryptoHook_MPI iqmp,
403 HWCryptoHook_MPI *r,
404 const HWCryptoHook_ErrMsgBuf *errors);
405extern HWCryptoHook_RSAImmedPriv_t HWCryptoHook_RSAImmedPriv;
406
407/* The RSAImmed* and ModExp* functions may return E_FAILED or
408 * E_FALLBACK for failure.
409 *
410 * E_FAILED means the failure is permanent and definite and there
411 * should be no attempt to fall back to software. (Eg, for some
412 * applications, which support only the acceleration-only
413 * functions, the `key material' may actually be an encoded key
414 * identifier, and doing the operation in software would give wrong
415 * answers.)
416 *
417 * E_FALLBACK means that doing the computation in software would seem
418 * reasonable. If an application pays attention to this and is
419 * able to fall back, it should also set the Fallback init flags.
420 */
421
422typedef
423int HWCryptoHook_RSALoadKey_t(HWCryptoHook_ContextHandle hwctx,
424 const char *key_ident,
425 HWCryptoHook_RSAKeyHandle *keyhandle_r,
426 const HWCryptoHook_ErrMsgBuf *errors,
427 HWCryptoHook_PassphraseContext *ppctx);
428extern HWCryptoHook_RSALoadKey_t HWCryptoHook_RSALoadKey;
429/* The key_ident is a null-terminated string configured by the
430 * user via the application's usual configuration mechanisms.
431 * It is provided to the user by the crypto provider's key management
432 * system. The user must be able to enter at least any string of between
433 * 1 and 1023 characters inclusive, consisting of printable 7-bit
434 * ASCII characters. The provider should avoid using
435 * any characters except alphanumerics and the punctuation
436 * characters _ - + . / @ ~ (the user is expected to be able
437 * to enter these without quoting). The string may be case-sensitive.
438 * The application may allow the user to enter other NULL-terminated strings,
439 * and the provider must cope (returning an error if the string is not
440 * valid).
441 *
442 * If the key does not exist, no error is recorded and 0 is returned;
443 * keyhandle_r will be set to 0 instead of to a key handle.
444 */
445
446typedef
447int HWCryptoHook_RSAGetPublicKey_t(HWCryptoHook_RSAKeyHandle k,
448 HWCryptoHook_MPI *n,
449 HWCryptoHook_MPI *e,
450 const HWCryptoHook_ErrMsgBuf *errors);
451extern HWCryptoHook_RSAGetPublicKey_t HWCryptoHook_RSAGetPublicKey;
452/* The crypto plugin will not store certificates.
453 *
454 * Although this function for acquiring the public key value is
455 * provided, it is not the purpose of this API to deal fully with the
456 * handling of the public key.
457 *
458 * It is expected that the crypto supplier's key generation program
459 * will provide general facilities for producing X.509
460 * self-certificates and certificate requests in PEM format. These
461 * will be given to the user so that they can configure them in the
462 * application, send them to CAs, or whatever.
463 *
464 * In case this kind of certificate handling is not appropriate, the
465 * crypto supplier's key generation program should be able to be
466 * configured not to generate such a self-certificate or certificate
467 * request. Then the application will need to do all of this, and
468 * will need to store and handle the public key and certificates
469 * itself.
470 */
471
472typedef
473int HWCryptoHook_RSAUnloadKey_t(HWCryptoHook_RSAKeyHandle k,
474 const HWCryptoHook_ErrMsgBuf *errors);
475extern HWCryptoHook_RSAUnloadKey_t HWCryptoHook_RSAUnloadKey;
476/* Might fail due to locking problems, or other serious internal problems. */
477
478typedef
479int HWCryptoHook_RSA_t(HWCryptoHook_MPI m,
480 HWCryptoHook_RSAKeyHandle k,
481 HWCryptoHook_MPI *r,
482 const HWCryptoHook_ErrMsgBuf *errors);
483extern HWCryptoHook_RSA_t HWCryptoHook_RSA;
484/* RSA private key operation (sign or decrypt) - raw, unpadded. */
485
486#endif /*HWCRYPTOHOOK_H*/
diff --git a/src/lib/libcrypto/engine/vendor_defns/sureware.h b/src/lib/libcrypto/engine/vendor_defns/sureware.h
new file mode 100644
index 0000000000..4bc22027f9
--- /dev/null
+++ b/src/lib/libcrypto/engine/vendor_defns/sureware.h
@@ -0,0 +1,239 @@
1/*
2* Written by Corinne Dive-Reclus(cdive@baltimore.com)
3*
4* Copyright@2001 Baltimore Technologies Ltd.
5* *
6* THIS FILE IS PROVIDED BY BALTIMORE TECHNOLOGIES ``AS IS'' AND *
7* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE *
8* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE *
9* ARE DISCLAIMED. IN NO EVENT SHALL BALTIMORE TECHNOLOGIES BE LIABLE *
10* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL *
11* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS *
12* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) *
13* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT *
14* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY *
15* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF *
16* SUCH DAMAGE. *
17*
18*
19*/
20#ifdef WIN32
21#define SW_EXPORT __declspec ( dllexport )
22#else
23#define SW_EXPORT
24#endif
25
26/*
27* List of exposed SureWare errors
28*/
29#define SUREWAREHOOK_ERROR_FAILED -1
30#define SUREWAREHOOK_ERROR_FALLBACK -2
31#define SUREWAREHOOK_ERROR_UNIT_FAILURE -3
32#define SUREWAREHOOK_ERROR_DATA_SIZE -4
33#define SUREWAREHOOK_ERROR_INVALID_PAD -5
34/*
35* -----------------WARNING-----------------------------------
36* In all the following functions:
37* msg is a string with at least 24 bytes free.
38* A 24 bytes string will be concatenated to the existing content of msg.
39*/
40/*
41* SureWare Initialisation function
42* in param threadsafe, if !=0, thread safe enabled
43* return SureWareHOOK_ERROR_UNIT_FAILURE if failure, 1 if success
44*/
45typedef int SureWareHook_Init_t(char*const msg,int threadsafe);
46extern SW_EXPORT SureWareHook_Init_t SureWareHook_Init;
47/*
48* SureWare Finish function
49*/
50typedef void SureWareHook_Finish_t();
51extern SW_EXPORT SureWareHook_Finish_t SureWareHook_Finish;
52/*
53* PRE_CONDITION:
54* DO NOT CALL ANY OF THE FOLLOWING FUNCTIONS IN CASE OF INIT FAILURE
55*/
56/*
57* SureWare RAND Bytes function
58* In case of failure, the content of buf is unpredictable.
59* return 1 if success
60* SureWareHOOK_ERROR_FALLBACK if function not available in hardware
61* SureWareHOOK_ERROR_FAILED if error while processing
62* SureWareHOOK_ERROR_UNIT_FAILURE if hardware failure
63* SUREWAREHOOK_ERROR_DATA_SIZE wrong size for buf
64*
65* in/out param buf : a num bytes long buffer where random bytes will be put
66* in param num : the number of bytes into buf
67*/
68typedef int SureWareHook_Rand_Bytes_t(char*const msg,unsigned char *buf, int num);
69extern SW_EXPORT SureWareHook_Rand_Bytes_t SureWareHook_Rand_Bytes;
70
71/*
72* SureWare RAND Seed function
73* Adds some seed to the Hardware Random Number Generator
74* return 1 if success
75* SureWareHOOK_ERROR_FALLBACK if function not available in hardware
76* SureWareHOOK_ERROR_FAILED if error while processing
77* SureWareHOOK_ERROR_UNIT_FAILURE if hardware failure
78* SUREWAREHOOK_ERROR_DATA_SIZE wrong size for buf
79*
80* in param buf : the seed to add into the HRNG
81* in param num : the number of bytes into buf
82*/
83typedef int SureWareHook_Rand_Seed_t(char*const msg,const void *buf, int num);
84extern SW_EXPORT SureWareHook_Rand_Seed_t SureWareHook_Rand_Seed;
85
86/*
87* SureWare Load Private Key function
88* return 1 if success
89* SureWareHOOK_ERROR_FAILED if error while processing
90* No hardware is contact for this function.
91*
92* in param key_id :the name of the private protected key file without the extension
93 ".sws"
94* out param hptr : a pointer to a buffer allocated by SureWare_Hook
95* out param num: the effective key length in bytes
96* out param keytype: 1 if RSA 2 if DSA
97*/
98typedef int SureWareHook_Load_Privkey_t(char*const msg,const char *key_id,char **hptr,unsigned long *num,char *keytype);
99extern SW_EXPORT SureWareHook_Load_Privkey_t SureWareHook_Load_Privkey;
100
101/*
102* SureWare Info Public Key function
103* return 1 if success
104* SureWareHOOK_ERROR_FAILED if error while processing
105* No hardware is contact for this function.
106*
107* in param key_id :the name of the private protected key file without the extension
108 ".swp"
109* out param hptr : a pointer to a buffer allocated by SureWare_Hook
110* out param num: the effective key length in bytes
111* out param keytype: 1 if RSA 2 if DSA
112*/
113typedef int SureWareHook_Info_Pubkey_t(char*const msg,const char *key_id,unsigned long *num,
114 char *keytype);
115extern SW_EXPORT SureWareHook_Info_Pubkey_t SureWareHook_Info_Pubkey;
116
117/*
118* SureWare Load Public Key function
119* return 1 if success
120* SureWareHOOK_ERROR_FAILED if error while processing
121* No hardware is contact for this function.
122*
123* in param key_id :the name of the public protected key file without the extension
124 ".swp"
125* in param num : the bytes size of n and e
126* out param n: where to write modulus in bn format
127* out param e: where to write exponent in bn format
128*/
129typedef int SureWareHook_Load_Rsa_Pubkey_t(char*const msg,const char *key_id,unsigned long num,
130 unsigned long *n, unsigned long *e);
131extern SW_EXPORT SureWareHook_Load_Rsa_Pubkey_t SureWareHook_Load_Rsa_Pubkey;
132
133/*
134* SureWare Load DSA Public Key function
135* return 1 if success
136* SureWareHOOK_ERROR_FAILED if error while processing
137* No hardware is contact for this function.
138*
139* in param key_id :the name of the public protected key file without the extension
140 ".swp"
141* in param num : the bytes size of n and e
142* out param pub: where to write pub key in bn format
143* out param p: where to write prime in bn format
144* out param q: where to write sunprime (length 20 bytes) in bn format
145* out param g: where to write base in bn format
146*/
147typedef int SureWareHook_Load_Dsa_Pubkey_t(char*const msg,const char *key_id,unsigned long num,
148 unsigned long *pub, unsigned long *p,unsigned long*q,
149 unsigned long *g);
150extern SW_EXPORT SureWareHook_Load_Dsa_Pubkey_t SureWareHook_Load_Dsa_Pubkey;
151
152/*
153* SureWare Free function
154* Destroy the key into the hardware if destroy==1
155*/
156typedef void SureWareHook_Free_t(char *p,int destroy);
157extern SW_EXPORT SureWareHook_Free_t SureWareHook_Free;
158
159#define SUREWARE_PKCS1_PAD 1
160#define SUREWARE_ISO9796_PAD 2
161#define SUREWARE_NO_PAD 0
162/*
163* SureWare RSA Private Decryption
164* return 1 if success
165* SureWareHOOK_ERROR_FAILED if error while processing
166* SureWareHOOK_ERROR_UNIT_FAILURE if hardware failure
167* SUREWAREHOOK_ERROR_DATA_SIZE wrong size for buf
168*
169* in param flen : byte size of from and to
170* in param from : encrypted data buffer, should be a not-null valid pointer
171* out param tlen: byte size of decrypted data, if error, unexpected value
172* out param to : decrypted data buffer, should be a not-null valid pointer
173* in param prsa: a protected key pointer, should be a not-null valid pointer
174* int padding: padding id as follow
175* SUREWARE_PKCS1_PAD
176* SUREWARE_NO_PAD
177*
178*/
179typedef int SureWareHook_Rsa_Priv_Dec_t(char*const msg,int flen,unsigned char *from,
180 int *tlen,unsigned char *to,
181 char *prsa,int padding);
182extern SW_EXPORT SureWareHook_Rsa_Priv_Dec_t SureWareHook_Rsa_Priv_Dec;
183/*
184* SureWare RSA Signature
185* return 1 if success
186* SureWareHOOK_ERROR_FAILED if error while processing
187* SureWareHOOK_ERROR_UNIT_FAILURE if hardware failure
188* SUREWAREHOOK_ERROR_DATA_SIZE wrong size for buf
189*
190* in param flen : byte size of from and to
191* in param from : encrypted data buffer, should be a not-null valid pointer
192* out param tlen: byte size of decrypted data, if error, unexpected value
193* out param to : decrypted data buffer, should be a not-null valid pointer
194* in param prsa: a protected key pointer, should be a not-null valid pointer
195* int padding: padding id as follow
196* SUREWARE_PKCS1_PAD
197* SUREWARE_ISO9796_PAD
198*
199*/
200typedef int SureWareHook_Rsa_Sign_t(char*const msg,int flen,unsigned char *from,
201 int *tlen,unsigned char *to,
202 char *prsa,int padding);
203extern SW_EXPORT SureWareHook_Rsa_Sign_t SureWareHook_Rsa_Sign;
204/*
205* SureWare DSA Signature
206* return 1 if success
207* SureWareHOOK_ERROR_FAILED if error while processing
208* SureWareHOOK_ERROR_UNIT_FAILURE if hardware failure
209* SUREWAREHOOK_ERROR_DATA_SIZE wrong size for buf
210*
211* in param flen : byte size of from and to
212* in param from : encrypted data buffer, should be a not-null valid pointer
213* out param to : decrypted data buffer, should be a 40bytes valid pointer
214* in param pdsa: a protected key pointer, should be a not-null valid pointer
215*
216*/
217typedef int SureWareHook_Dsa_Sign_t(char*const msg,int flen,const unsigned char *from,
218 unsigned long *r,unsigned long *s,char *pdsa);
219extern SW_EXPORT SureWareHook_Dsa_Sign_t SureWareHook_Dsa_Sign;
220
221
222/*
223* SureWare Mod Exp
224* return 1 if success
225* SureWareHOOK_ERROR_FAILED if error while processing
226* SureWareHOOK_ERROR_UNIT_FAILURE if hardware failure
227* SUREWAREHOOK_ERROR_DATA_SIZE wrong size for buf
228*
229* mod and res are mlen bytes long.
230* exp is elen bytes long
231* data is dlen bytes long
232* mlen,elen and dlen are all multiple of sizeof(unsigned long)
233*/
234typedef int SureWareHook_Mod_Exp_t(char*const msg,int mlen,const unsigned long *mod,
235 int elen,const unsigned long *exponent,
236 int dlen,unsigned long *data,
237 unsigned long *res);
238extern SW_EXPORT SureWareHook_Mod_Exp_t SureWareHook_Mod_Exp;
239
diff --git a/src/lib/libcrypto/err/Makefile b/src/lib/libcrypto/err/Makefile
new file mode 100644
index 0000000000..4adec55302
--- /dev/null
+++ b/src/lib/libcrypto/err/Makefile
@@ -0,0 +1,118 @@
1#
2# OpenSSL/crypto/err/Makefile
3#
4
5DIR= err
6TOP= ../..
7CC= cc
8INCLUDES= -I.. -I$(TOP) -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
18CFLAGS= $(INCLUDES) $(CFLAG)
19
20GENERAL=Makefile
21TEST=
22APPS=
23
24LIB=$(TOP)/libcrypto.a
25LIBSRC=err.c err_all.c err_prn.c
26LIBOBJ=err.o err_all.o err_prn.o
27
28SRC= $(LIBSRC)
29
30EXHEADER= err.h
31HEADER= $(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
45files:
46 $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
47
48links:
49 @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
50 @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
51 @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
52
53install:
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 $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(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
80err.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/buffer.h
81err.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
82err.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
83err.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
84err.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
85err.o: ../../include/openssl/symhacks.h ../cryptlib.h err.c
86err_all.o: ../../include/openssl/aes.h ../../include/openssl/asn1.h
87err_all.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
88err_all.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
89err_all.o: ../../include/openssl/cast.h ../../include/openssl/conf.h
90err_all.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
91err_all.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
92err_all.o: ../../include/openssl/dsa.h ../../include/openssl/dso.h
93err_all.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
94err_all.o: ../../include/openssl/engine.h ../../include/openssl/err.h
95err_all.o: ../../include/openssl/evp.h ../../include/openssl/fips.h
96err_all.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
97err_all.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
98err_all.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
99err_all.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
100err_all.o: ../../include/openssl/ocsp.h ../../include/openssl/opensslconf.h
101err_all.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
102err_all.o: ../../include/openssl/pem2.h ../../include/openssl/pkcs12.h
103err_all.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h
104err_all.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
105err_all.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
106err_all.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
107err_all.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
108err_all.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
109err_all.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h
110err_all.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
111err_all.o: err_all.c
112err_prn.o: ../../e_os.h ../../include/openssl/bio.h
113err_prn.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
114err_prn.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
115err_prn.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
116err_prn.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
117err_prn.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
118err_prn.o: ../cryptlib.h err_prn.c
diff --git a/src/lib/libcrypto/err/Makefile.ssl b/src/lib/libcrypto/err/Makefile.ssl
new file mode 100644
index 0000000000..b253061d07
--- /dev/null
+++ b/src/lib/libcrypto/err/Makefile.ssl
@@ -0,0 +1,119 @@
1#
2# SSLeay/crypto/err/Makefile
3#
4
5DIR= err
6TOP= ../..
7CC= cc
8INCLUDES= -I.. -I$(TOP) -I../../include
9CFLAG=-g
10INSTALL_PREFIX=
11OPENSSLDIR= /usr/local/ssl
12INSTALLTOP=/usr/local/ssl
13MAKE= make -f Makefile.ssl
14MAKEDEPPROG= makedepend
15MAKEDEPEND= $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG)
16MAKEFILE= Makefile.ssl
17AR= ar r
18
19CFLAGS= $(INCLUDES) $(CFLAG)
20
21GENERAL=Makefile
22TEST=
23APPS=
24
25LIB=$(TOP)/libcrypto.a
26LIBSRC=err.c err_all.c err_prn.c
27LIBOBJ=err.o err_all.o err_prn.o
28
29SRC= $(LIBSRC)
30
31EXHEADER= err.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.ssl >> $(TOP)/MINFO
48
49links:
50 @sh $(TOP)/util/point.sh Makefile.ssl Makefile
51 @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
52 @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
53 @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
54
55install:
56 @for i in $(EXHEADER) ; \
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 $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
72
73dclean:
74 $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
75 mv -f Makefile.new $(MAKEFILE)
76
77clean:
78 rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
79
80# DO NOT DELETE THIS LINE -- make depend depends on it.
81
82err.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/buffer.h
83err.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
84err.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
85err.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
86err.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
87err.o: ../../include/openssl/symhacks.h ../cryptlib.h err.c
88err_all.o: ../../include/openssl/aes.h ../../include/openssl/asn1.h
89err_all.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
90err_all.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
91err_all.o: ../../include/openssl/cast.h ../../include/openssl/conf.h
92err_all.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
93err_all.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
94err_all.o: ../../include/openssl/dsa.h ../../include/openssl/dso.h
95err_all.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
96err_all.o: ../../include/openssl/engine.h ../../include/openssl/err.h
97err_all.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
98err_all.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
99err_all.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
100err_all.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
101err_all.o: ../../include/openssl/objects.h ../../include/openssl/ocsp.h
102err_all.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
103err_all.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pem2.h
104err_all.o: ../../include/openssl/pkcs12.h ../../include/openssl/pkcs7.h
105err_all.o: ../../include/openssl/rand.h ../../include/openssl/rc2.h
106err_all.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
107err_all.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
108err_all.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
109err_all.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
110err_all.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
111err_all.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
112err_all.o: ../../include/openssl/x509v3.h err_all.c
113err_prn.o: ../../e_os.h ../../include/openssl/bio.h
114err_prn.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
115err_prn.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
116err_prn.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
117err_prn.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
118err_prn.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
119err_prn.o: ../cryptlib.h err_prn.c
diff --git a/src/lib/libcrypto/err/err.c b/src/lib/libcrypto/err/err.c
index 53687d79ab..c78790a54c 100644
--- a/src/lib/libcrypto/err/err.c
+++ b/src/lib/libcrypto/err/err.c
@@ -621,8 +621,7 @@ static void err_load_strings(int lib, ERR_STRING_DATA *str)
621 { 621 {
622 while (str->error) 622 while (str->error)
623 { 623 {
624 if (lib) 624 str->error|=ERR_PACK(lib,0,0);
625 str->error|=ERR_PACK(lib,0,0);
626 ERRFN(err_set_item)(str); 625 ERRFN(err_set_item)(str);
627 str++; 626 str++;
628 } 627 }
@@ -638,8 +637,7 @@ void ERR_unload_strings(int lib, ERR_STRING_DATA *str)
638 { 637 {
639 while (str->error) 638 while (str->error)
640 { 639 {
641 if (lib) 640 str->error|=ERR_PACK(lib,0,0);
642 str->error|=ERR_PACK(lib,0,0);
643 ERRFN(err_del_item)(str); 641 ERRFN(err_del_item)(str);
644 str++; 642 str++;
645 } 643 }
diff --git a/src/lib/libcrypto/err/openssl.ec b/src/lib/libcrypto/err/openssl.ec
index f8cd6937e7..447a7f87ed 100644
--- a/src/lib/libcrypto/err/openssl.ec
+++ b/src/lib/libcrypto/err/openssl.ec
@@ -27,7 +27,7 @@ L DSO crypto/dso/dso.h crypto/dso/dso_err.c
27L ENGINE crypto/engine/engine.h crypto/engine/eng_err.c 27L ENGINE crypto/engine/engine.h crypto/engine/eng_err.c
28L OCSP crypto/ocsp/ocsp.h crypto/ocsp/ocsp_err.c 28L OCSP crypto/ocsp/ocsp.h crypto/ocsp/ocsp_err.c
29L UI crypto/ui/ui.h crypto/ui/ui_err.c 29L UI crypto/ui/ui.h crypto/ui/ui_err.c
30L FIPS fips-1.0/fips.h fips-1.0/fips_err.h 30L FIPS fips/fips.h fips/fips_err.h
31 31
32# additional header files to be scanned for function names 32# additional header files to be scanned for function names
33L NONE crypto/x509/x509_vfy.h NONE 33L NONE crypto/x509/x509_vfy.h NONE
diff --git a/src/lib/libcrypto/evp/Makefile b/src/lib/libcrypto/evp/Makefile
new file mode 100644
index 0000000000..d1c2a272bb
--- /dev/null
+++ b/src/lib/libcrypto/evp/Makefile
@@ -0,0 +1,1076 @@
1#
2# OpenSSL/crypto/evp/Makefile
3#
4
5DIR= evp
6TOP= ../..
7CC= cc
8INCLUDES= -I.. -I$(TOP) -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
18CFLAGS= $(INCLUDES) $(CFLAG)
19
20GENERAL=Makefile
21TEST=evp_test.c
22TESTDATA=evptests.txt
23APPS=
24
25LIB=$(TOP)/libcrypto.a
26LIBSRC= encode.c digest.c evp_enc.c evp_key.c evp_acnf.c \
27 e_des.c e_bf.c e_idea.c e_des3.c \
28 e_rc4.c e_aes.c names.c \
29 e_xcbc_d.c e_rc2.c e_cast.c e_rc5.c \
30 m_null.c m_md2.c m_md4.c m_md5.c m_sha.c m_sha1.c \
31 m_dss.c m_dss1.c m_mdc2.c m_ripemd.c \
32 p_open.c p_seal.c p_sign.c p_verify.c p_lib.c p_enc.c p_dec.c \
33 bio_md.c bio_b64.c bio_enc.c evp_err.c e_null.c \
34 c_all.c c_allc.c c_alld.c evp_lib.c bio_ok.c \
35 evp_pkey.c evp_pbe.c p5_crpt.c p5_crpt2.c \
36 e_old.c
37
38LIBOBJ= encode.o digest.o evp_enc.o evp_key.o evp_acnf.o \
39 e_des.o e_bf.o e_idea.o e_des3.o \
40 e_rc4.o e_aes.o names.o \
41 e_xcbc_d.o e_rc2.o e_cast.o e_rc5.o \
42 m_null.o m_md2.o m_md4.o m_md5.o m_sha.o m_sha1.o \
43 m_dss.o m_dss1.o m_mdc2.o m_ripemd.o \
44 p_open.o p_seal.o p_sign.o p_verify.o p_lib.o p_enc.o p_dec.o \
45 bio_md.o bio_b64.o bio_enc.o evp_err.o e_null.o \
46 c_all.o c_allc.o c_alld.o evp_lib.o bio_ok.o \
47 evp_pkey.o evp_pbe.o p5_crpt.o p5_crpt2.o \
48 e_old.o
49
50SRC= $(LIBSRC)
51
52EXHEADER= evp.h
53HEADER= $(EXHEADER)
54
55ALL= $(GENERAL) $(SRC) $(HEADER)
56
57top:
58 (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all)
59
60all: lib
61
62lib: $(LIBOBJ)
63 $(AR) $(LIB) $(LIBOBJ)
64 $(RANLIB) $(LIB) || echo Never mind.
65 @touch lib
66
67files:
68 $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
69
70links:
71 @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
72 @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
73 cp $(TESTDATA) ../../test
74 @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
75
76install:
77 @headerlist="$(EXHEADER)"; for i in $$headerlist ; \
78 do \
79 (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
80 chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
81 done;
82
83tags:
84 ctags $(SRC)
85
86tests:
87
88lint:
89 lint -DLINT $(INCLUDES) $(SRC)>fluff
90
91depend:
92 $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(LIBSRC)
93
94dclean:
95 $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
96 mv -f Makefile.new $(MAKEFILE)
97
98clean:
99 rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
100
101# DO NOT DELETE THIS LINE -- make depend depends on it.
102
103bio_b64.o: ../../e_os.h ../../include/openssl/aes.h
104bio_b64.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
105bio_b64.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
106bio_b64.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
107bio_b64.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
108bio_b64.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
109bio_b64.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
110bio_b64.o: ../../include/openssl/err.h ../../include/openssl/evp.h
111bio_b64.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
112bio_b64.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
113bio_b64.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
114bio_b64.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
115bio_b64.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
116bio_b64.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rc2.h
117bio_b64.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
118bio_b64.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
119bio_b64.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
120bio_b64.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
121bio_b64.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
122bio_b64.o: ../cryptlib.h bio_b64.c
123bio_enc.o: ../../e_os.h ../../include/openssl/aes.h
124bio_enc.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
125bio_enc.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
126bio_enc.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
127bio_enc.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
128bio_enc.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
129bio_enc.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
130bio_enc.o: ../../include/openssl/err.h ../../include/openssl/evp.h
131bio_enc.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
132bio_enc.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
133bio_enc.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
134bio_enc.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
135bio_enc.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
136bio_enc.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rc2.h
137bio_enc.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
138bio_enc.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
139bio_enc.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
140bio_enc.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
141bio_enc.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
142bio_enc.o: ../cryptlib.h bio_enc.c
143bio_md.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
144bio_md.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
145bio_md.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
146bio_md.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
147bio_md.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
148bio_md.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
149bio_md.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
150bio_md.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
151bio_md.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
152bio_md.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
153bio_md.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
154bio_md.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
155bio_md.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
156bio_md.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
157bio_md.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
158bio_md.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
159bio_md.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
160bio_md.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
161bio_md.o: ../../include/openssl/ui_compat.h ../cryptlib.h bio_md.c
162bio_ok.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
163bio_ok.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
164bio_ok.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
165bio_ok.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
166bio_ok.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
167bio_ok.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
168bio_ok.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
169bio_ok.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
170bio_ok.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
171bio_ok.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
172bio_ok.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
173bio_ok.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
174bio_ok.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
175bio_ok.o: ../../include/openssl/rand.h ../../include/openssl/rc2.h
176bio_ok.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
177bio_ok.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
178bio_ok.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
179bio_ok.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
180bio_ok.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
181bio_ok.o: ../cryptlib.h bio_ok.c
182c_all.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
183c_all.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
184c_all.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
185c_all.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
186c_all.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
187c_all.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
188c_all.o: ../../include/openssl/e_os2.h ../../include/openssl/engine.h
189c_all.o: ../../include/openssl/err.h ../../include/openssl/evp.h
190c_all.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
191c_all.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
192c_all.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
193c_all.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
194c_all.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
195c_all.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rand.h
196c_all.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
197c_all.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
198c_all.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
199c_all.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
200c_all.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
201c_all.o: ../../include/openssl/ui_compat.h ../cryptlib.h c_all.c
202c_allc.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
203c_allc.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
204c_allc.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
205c_allc.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
206c_allc.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
207c_allc.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
208c_allc.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
209c_allc.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
210c_allc.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
211c_allc.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
212c_allc.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
213c_allc.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
214c_allc.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
215c_allc.o: ../../include/openssl/pkcs12.h ../../include/openssl/pkcs7.h
216c_allc.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
217c_allc.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
218c_allc.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
219c_allc.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
220c_allc.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
221c_allc.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h
222c_allc.o: ../../include/openssl/x509_vfy.h ../cryptlib.h c_allc.c
223c_alld.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
224c_alld.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
225c_alld.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
226c_alld.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
227c_alld.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
228c_alld.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
229c_alld.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
230c_alld.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
231c_alld.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
232c_alld.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
233c_alld.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
234c_alld.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
235c_alld.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
236c_alld.o: ../../include/openssl/pkcs12.h ../../include/openssl/pkcs7.h
237c_alld.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
238c_alld.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
239c_alld.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
240c_alld.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
241c_alld.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
242c_alld.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h
243c_alld.o: ../../include/openssl/x509_vfy.h ../cryptlib.h c_alld.c
244digest.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
245digest.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
246digest.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
247digest.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
248digest.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
249digest.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
250digest.o: ../../include/openssl/e_os2.h ../../include/openssl/engine.h
251digest.o: ../../include/openssl/err.h ../../include/openssl/evp.h
252digest.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
253digest.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
254digest.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
255digest.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
256digest.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
257digest.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rand.h
258digest.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
259digest.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
260digest.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
261digest.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
262digest.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
263digest.o: ../../include/openssl/ui_compat.h ../cryptlib.h digest.c
264e_aes.o: ../../include/openssl/aes.h ../../include/openssl/asn1.h
265e_aes.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
266e_aes.o: ../../include/openssl/bn.h ../../include/openssl/cast.h
267e_aes.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
268e_aes.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
269e_aes.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
270e_aes.o: ../../include/openssl/err.h ../../include/openssl/evp.h
271e_aes.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
272e_aes.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
273e_aes.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
274e_aes.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
275e_aes.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
276e_aes.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rc2.h
277e_aes.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
278e_aes.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
279e_aes.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
280e_aes.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
281e_aes.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h e_aes.c
282e_aes.o: evp_locl.h
283e_bf.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
284e_bf.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
285e_bf.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
286e_bf.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
287e_bf.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
288e_bf.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
289e_bf.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
290e_bf.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
291e_bf.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
292e_bf.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
293e_bf.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
294e_bf.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
295e_bf.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
296e_bf.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
297e_bf.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
298e_bf.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
299e_bf.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
300e_bf.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
301e_bf.o: ../../include/openssl/ui_compat.h ../cryptlib.h e_bf.c evp_locl.h
302e_cast.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
303e_cast.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
304e_cast.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
305e_cast.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
306e_cast.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
307e_cast.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
308e_cast.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
309e_cast.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
310e_cast.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
311e_cast.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
312e_cast.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
313e_cast.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
314e_cast.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
315e_cast.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
316e_cast.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
317e_cast.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
318e_cast.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
319e_cast.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
320e_cast.o: ../../include/openssl/ui_compat.h ../cryptlib.h e_cast.c evp_locl.h
321e_des.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
322e_des.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
323e_des.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
324e_des.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
325e_des.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
326e_des.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
327e_des.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
328e_des.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
329e_des.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
330e_des.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
331e_des.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
332e_des.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
333e_des.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
334e_des.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
335e_des.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
336e_des.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
337e_des.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
338e_des.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
339e_des.o: ../../include/openssl/ui_compat.h ../cryptlib.h e_des.c evp_locl.h
340e_des3.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
341e_des3.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
342e_des3.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
343e_des3.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
344e_des3.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
345e_des3.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
346e_des3.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
347e_des3.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
348e_des3.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
349e_des3.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
350e_des3.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
351e_des3.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
352e_des3.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
353e_des3.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
354e_des3.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
355e_des3.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
356e_des3.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
357e_des3.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
358e_des3.o: ../../include/openssl/ui_compat.h ../cryptlib.h e_des3.c evp_locl.h
359e_idea.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
360e_idea.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
361e_idea.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
362e_idea.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
363e_idea.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
364e_idea.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
365e_idea.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
366e_idea.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
367e_idea.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
368e_idea.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
369e_idea.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
370e_idea.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
371e_idea.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
372e_idea.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
373e_idea.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
374e_idea.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
375e_idea.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
376e_idea.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
377e_idea.o: ../../include/openssl/ui_compat.h ../cryptlib.h e_idea.c evp_locl.h
378e_null.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
379e_null.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
380e_null.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
381e_null.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
382e_null.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
383e_null.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
384e_null.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
385e_null.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
386e_null.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
387e_null.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
388e_null.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
389e_null.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
390e_null.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
391e_null.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
392e_null.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
393e_null.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
394e_null.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
395e_null.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
396e_null.o: ../../include/openssl/ui_compat.h ../cryptlib.h e_null.c
397e_old.o: ../../include/openssl/aes.h ../../include/openssl/asn1.h
398e_old.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
399e_old.o: ../../include/openssl/bn.h ../../include/openssl/cast.h
400e_old.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
401e_old.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
402e_old.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
403e_old.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
404e_old.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
405e_old.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
406e_old.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
407e_old.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
408e_old.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rc2.h
409e_old.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
410e_old.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
411e_old.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
412e_old.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
413e_old.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h e_old.c
414e_rc2.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
415e_rc2.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
416e_rc2.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
417e_rc2.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
418e_rc2.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
419e_rc2.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
420e_rc2.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
421e_rc2.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
422e_rc2.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
423e_rc2.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
424e_rc2.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
425e_rc2.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
426e_rc2.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
427e_rc2.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
428e_rc2.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
429e_rc2.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
430e_rc2.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
431e_rc2.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
432e_rc2.o: ../../include/openssl/ui_compat.h ../cryptlib.h e_rc2.c evp_locl.h
433e_rc4.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
434e_rc4.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
435e_rc4.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
436e_rc4.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
437e_rc4.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
438e_rc4.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
439e_rc4.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
440e_rc4.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
441e_rc4.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
442e_rc4.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
443e_rc4.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
444e_rc4.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
445e_rc4.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
446e_rc4.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
447e_rc4.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
448e_rc4.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
449e_rc4.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
450e_rc4.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
451e_rc4.o: ../../include/openssl/ui_compat.h ../cryptlib.h e_rc4.c evp_locl.h
452e_rc5.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
453e_rc5.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
454e_rc5.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
455e_rc5.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
456e_rc5.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
457e_rc5.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
458e_rc5.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
459e_rc5.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
460e_rc5.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
461e_rc5.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
462e_rc5.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
463e_rc5.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
464e_rc5.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
465e_rc5.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
466e_rc5.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
467e_rc5.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
468e_rc5.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
469e_rc5.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
470e_rc5.o: ../../include/openssl/ui_compat.h ../cryptlib.h e_rc5.c evp_locl.h
471e_xcbc_d.o: ../../e_os.h ../../include/openssl/aes.h
472e_xcbc_d.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
473e_xcbc_d.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
474e_xcbc_d.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
475e_xcbc_d.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
476e_xcbc_d.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
477e_xcbc_d.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
478e_xcbc_d.o: ../../include/openssl/err.h ../../include/openssl/evp.h
479e_xcbc_d.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
480e_xcbc_d.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
481e_xcbc_d.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
482e_xcbc_d.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
483e_xcbc_d.o: ../../include/openssl/opensslconf.h
484e_xcbc_d.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
485e_xcbc_d.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
486e_xcbc_d.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
487e_xcbc_d.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
488e_xcbc_d.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
489e_xcbc_d.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
490e_xcbc_d.o: ../../include/openssl/ui_compat.h ../cryptlib.h e_xcbc_d.c
491encode.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
492encode.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
493encode.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
494encode.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
495encode.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
496encode.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
497encode.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
498encode.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
499encode.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
500encode.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
501encode.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
502encode.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
503encode.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
504encode.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
505encode.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
506encode.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
507encode.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
508encode.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
509encode.o: ../../include/openssl/ui_compat.h ../cryptlib.h encode.c
510evp_acnf.o: ../../e_os.h ../../include/openssl/aes.h
511evp_acnf.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
512evp_acnf.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
513evp_acnf.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
514evp_acnf.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
515evp_acnf.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
516evp_acnf.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
517evp_acnf.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
518evp_acnf.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
519evp_acnf.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
520evp_acnf.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
521evp_acnf.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
522evp_acnf.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
523evp_acnf.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
524evp_acnf.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
525evp_acnf.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
526evp_acnf.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
527evp_acnf.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
528evp_acnf.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
529evp_acnf.o: ../../include/openssl/ui_compat.h ../cryptlib.h evp_acnf.c
530evp_enc.o: ../../e_os.h ../../include/openssl/aes.h
531evp_enc.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
532evp_enc.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
533evp_enc.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
534evp_enc.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
535evp_enc.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
536evp_enc.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
537evp_enc.o: ../../include/openssl/engine.h ../../include/openssl/err.h
538evp_enc.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
539evp_enc.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
540evp_enc.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
541evp_enc.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
542evp_enc.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
543evp_enc.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
544evp_enc.o: ../../include/openssl/rand.h ../../include/openssl/rc2.h
545evp_enc.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
546evp_enc.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
547evp_enc.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
548evp_enc.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
549evp_enc.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
550evp_enc.o: ../cryptlib.h evp_enc.c evp_locl.h
551evp_err.o: ../../include/openssl/aes.h ../../include/openssl/asn1.h
552evp_err.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
553evp_err.o: ../../include/openssl/bn.h ../../include/openssl/cast.h
554evp_err.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
555evp_err.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
556evp_err.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
557evp_err.o: ../../include/openssl/err.h ../../include/openssl/evp.h
558evp_err.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
559evp_err.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
560evp_err.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
561evp_err.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
562evp_err.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
563evp_err.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rc2.h
564evp_err.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
565evp_err.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
566evp_err.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
567evp_err.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
568evp_err.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
569evp_err.o: evp_err.c
570evp_key.o: ../../e_os.h ../../include/openssl/aes.h
571evp_key.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
572evp_key.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
573evp_key.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
574evp_key.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
575evp_key.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
576evp_key.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
577evp_key.o: ../../include/openssl/err.h ../../include/openssl/evp.h
578evp_key.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
579evp_key.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
580evp_key.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
581evp_key.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
582evp_key.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
583evp_key.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
584evp_key.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
585evp_key.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
586evp_key.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
587evp_key.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
588evp_key.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
589evp_key.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h
590evp_key.o: ../../include/openssl/x509_vfy.h ../cryptlib.h evp_key.c
591evp_lib.o: ../../e_os.h ../../include/openssl/aes.h
592evp_lib.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
593evp_lib.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
594evp_lib.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
595evp_lib.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
596evp_lib.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
597evp_lib.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
598evp_lib.o: ../../include/openssl/err.h ../../include/openssl/evp.h
599evp_lib.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
600evp_lib.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
601evp_lib.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
602evp_lib.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
603evp_lib.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
604evp_lib.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rc2.h
605evp_lib.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
606evp_lib.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
607evp_lib.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
608evp_lib.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
609evp_lib.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
610evp_lib.o: ../cryptlib.h evp_lib.c
611evp_pbe.o: ../../e_os.h ../../include/openssl/aes.h
612evp_pbe.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
613evp_pbe.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
614evp_pbe.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
615evp_pbe.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
616evp_pbe.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
617evp_pbe.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
618evp_pbe.o: ../../include/openssl/err.h ../../include/openssl/evp.h
619evp_pbe.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
620evp_pbe.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
621evp_pbe.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
622evp_pbe.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
623evp_pbe.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
624evp_pbe.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
625evp_pbe.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
626evp_pbe.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
627evp_pbe.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
628evp_pbe.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
629evp_pbe.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
630evp_pbe.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h
631evp_pbe.o: ../../include/openssl/x509_vfy.h ../cryptlib.h evp_pbe.c
632evp_pkey.o: ../../e_os.h ../../include/openssl/aes.h
633evp_pkey.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
634evp_pkey.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
635evp_pkey.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
636evp_pkey.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
637evp_pkey.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
638evp_pkey.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
639evp_pkey.o: ../../include/openssl/err.h ../../include/openssl/evp.h
640evp_pkey.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
641evp_pkey.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
642evp_pkey.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
643evp_pkey.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
644evp_pkey.o: ../../include/openssl/opensslconf.h
645evp_pkey.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
646evp_pkey.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h
647evp_pkey.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
648evp_pkey.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
649evp_pkey.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
650evp_pkey.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
651evp_pkey.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
652evp_pkey.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h
653evp_pkey.o: ../../include/openssl/x509_vfy.h ../cryptlib.h evp_pkey.c
654m_dss.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
655m_dss.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
656m_dss.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
657m_dss.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
658m_dss.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
659m_dss.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
660m_dss.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
661m_dss.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
662m_dss.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
663m_dss.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
664m_dss.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
665m_dss.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
666m_dss.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
667m_dss.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
668m_dss.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
669m_dss.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
670m_dss.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
671m_dss.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
672m_dss.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
673m_dss.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
674m_dss.o: ../cryptlib.h m_dss.c
675m_dss1.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
676m_dss1.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
677m_dss1.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
678m_dss1.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
679m_dss1.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
680m_dss1.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
681m_dss1.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
682m_dss1.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
683m_dss1.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
684m_dss1.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
685m_dss1.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
686m_dss1.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
687m_dss1.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
688m_dss1.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
689m_dss1.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
690m_dss1.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
691m_dss1.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
692m_dss1.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
693m_dss1.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
694m_dss1.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
695m_dss1.o: ../cryptlib.h m_dss1.c
696m_md2.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
697m_md2.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
698m_md2.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
699m_md2.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
700m_md2.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
701m_md2.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
702m_md2.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
703m_md2.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
704m_md2.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
705m_md2.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
706m_md2.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
707m_md2.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
708m_md2.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
709m_md2.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
710m_md2.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
711m_md2.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
712m_md2.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
713m_md2.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
714m_md2.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
715m_md2.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
716m_md2.o: ../cryptlib.h evp_locl.h m_md2.c
717m_md4.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
718m_md4.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
719m_md4.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
720m_md4.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
721m_md4.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
722m_md4.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
723m_md4.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
724m_md4.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
725m_md4.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
726m_md4.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
727m_md4.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
728m_md4.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
729m_md4.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
730m_md4.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
731m_md4.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
732m_md4.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
733m_md4.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
734m_md4.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
735m_md4.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
736m_md4.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
737m_md4.o: ../cryptlib.h evp_locl.h m_md4.c
738m_md5.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
739m_md5.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
740m_md5.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
741m_md5.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
742m_md5.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
743m_md5.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
744m_md5.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
745m_md5.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
746m_md5.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
747m_md5.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
748m_md5.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
749m_md5.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
750m_md5.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
751m_md5.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
752m_md5.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
753m_md5.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
754m_md5.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
755m_md5.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
756m_md5.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
757m_md5.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
758m_md5.o: ../cryptlib.h evp_locl.h m_md5.c
759m_mdc2.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
760m_mdc2.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
761m_mdc2.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
762m_mdc2.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
763m_mdc2.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
764m_mdc2.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
765m_mdc2.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
766m_mdc2.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
767m_mdc2.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
768m_mdc2.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
769m_mdc2.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
770m_mdc2.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
771m_mdc2.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
772m_mdc2.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
773m_mdc2.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
774m_mdc2.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
775m_mdc2.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
776m_mdc2.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
777m_mdc2.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
778m_mdc2.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
779m_mdc2.o: ../cryptlib.h evp_locl.h m_mdc2.c
780m_null.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
781m_null.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
782m_null.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
783m_null.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
784m_null.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
785m_null.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
786m_null.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
787m_null.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
788m_null.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
789m_null.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
790m_null.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
791m_null.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
792m_null.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
793m_null.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
794m_null.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
795m_null.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
796m_null.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
797m_null.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
798m_null.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
799m_null.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
800m_null.o: ../cryptlib.h m_null.c
801m_ripemd.o: ../../e_os.h ../../include/openssl/aes.h
802m_ripemd.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
803m_ripemd.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
804m_ripemd.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
805m_ripemd.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
806m_ripemd.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
807m_ripemd.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
808m_ripemd.o: ../../include/openssl/err.h ../../include/openssl/evp.h
809m_ripemd.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
810m_ripemd.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
811m_ripemd.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
812m_ripemd.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
813m_ripemd.o: ../../include/openssl/opensslconf.h
814m_ripemd.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
815m_ripemd.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
816m_ripemd.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
817m_ripemd.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
818m_ripemd.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
819m_ripemd.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
820m_ripemd.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
821m_ripemd.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
822m_ripemd.o: ../cryptlib.h m_ripemd.c
823m_sha.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
824m_sha.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
825m_sha.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
826m_sha.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
827m_sha.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
828m_sha.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
829m_sha.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
830m_sha.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
831m_sha.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
832m_sha.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
833m_sha.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
834m_sha.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
835m_sha.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
836m_sha.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
837m_sha.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
838m_sha.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
839m_sha.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
840m_sha.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
841m_sha.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
842m_sha.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
843m_sha.o: ../cryptlib.h evp_locl.h m_sha.c
844m_sha1.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
845m_sha1.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
846m_sha1.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
847m_sha1.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
848m_sha1.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
849m_sha1.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
850m_sha1.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
851m_sha1.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
852m_sha1.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
853m_sha1.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
854m_sha1.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
855m_sha1.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
856m_sha1.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
857m_sha1.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
858m_sha1.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
859m_sha1.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
860m_sha1.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
861m_sha1.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
862m_sha1.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
863m_sha1.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
864m_sha1.o: ../cryptlib.h m_sha1.c
865names.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
866names.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
867names.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
868names.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
869names.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
870names.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
871names.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
872names.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
873names.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
874names.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
875names.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
876names.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
877names.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
878names.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
879names.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
880names.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
881names.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
882names.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
883names.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
884names.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
885names.o: ../cryptlib.h names.c
886p5_crpt.o: ../../e_os.h ../../include/openssl/aes.h
887p5_crpt.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
888p5_crpt.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
889p5_crpt.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
890p5_crpt.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
891p5_crpt.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
892p5_crpt.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
893p5_crpt.o: ../../include/openssl/err.h ../../include/openssl/evp.h
894p5_crpt.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
895p5_crpt.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
896p5_crpt.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
897p5_crpt.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
898p5_crpt.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
899p5_crpt.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
900p5_crpt.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
901p5_crpt.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
902p5_crpt.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
903p5_crpt.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
904p5_crpt.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
905p5_crpt.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h
906p5_crpt.o: ../../include/openssl/x509_vfy.h ../cryptlib.h p5_crpt.c
907p5_crpt2.o: ../../e_os.h ../../include/openssl/aes.h
908p5_crpt2.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
909p5_crpt2.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
910p5_crpt2.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
911p5_crpt2.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
912p5_crpt2.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
913p5_crpt2.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
914p5_crpt2.o: ../../include/openssl/err.h ../../include/openssl/evp.h
915p5_crpt2.o: ../../include/openssl/hmac.h ../../include/openssl/idea.h
916p5_crpt2.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
917p5_crpt2.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
918p5_crpt2.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
919p5_crpt2.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
920p5_crpt2.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
921p5_crpt2.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
922p5_crpt2.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
923p5_crpt2.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
924p5_crpt2.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
925p5_crpt2.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
926p5_crpt2.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
927p5_crpt2.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
928p5_crpt2.o: ../cryptlib.h p5_crpt2.c
929p_dec.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
930p_dec.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
931p_dec.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
932p_dec.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
933p_dec.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
934p_dec.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
935p_dec.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
936p_dec.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
937p_dec.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
938p_dec.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
939p_dec.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
940p_dec.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
941p_dec.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
942p_dec.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h
943p_dec.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
944p_dec.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
945p_dec.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
946p_dec.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
947p_dec.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
948p_dec.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h
949p_dec.o: ../../include/openssl/x509_vfy.h ../cryptlib.h p_dec.c
950p_enc.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
951p_enc.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
952p_enc.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
953p_enc.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
954p_enc.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
955p_enc.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
956p_enc.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
957p_enc.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
958p_enc.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
959p_enc.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
960p_enc.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
961p_enc.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
962p_enc.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
963p_enc.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h
964p_enc.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
965p_enc.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
966p_enc.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
967p_enc.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
968p_enc.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
969p_enc.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h
970p_enc.o: ../../include/openssl/x509_vfy.h ../cryptlib.h p_enc.c
971p_lib.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
972p_lib.o: ../../include/openssl/asn1_mac.h ../../include/openssl/bio.h
973p_lib.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
974p_lib.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
975p_lib.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
976p_lib.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
977p_lib.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
978p_lib.o: ../../include/openssl/err.h ../../include/openssl/evp.h
979p_lib.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
980p_lib.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
981p_lib.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
982p_lib.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
983p_lib.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
984p_lib.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
985p_lib.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
986p_lib.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
987p_lib.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
988p_lib.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
989p_lib.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
990p_lib.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h
991p_lib.o: ../../include/openssl/x509_vfy.h ../cryptlib.h p_lib.c
992p_open.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
993p_open.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
994p_open.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
995p_open.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
996p_open.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
997p_open.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
998p_open.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
999p_open.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
1000p_open.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
1001p_open.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
1002p_open.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
1003p_open.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
1004p_open.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
1005p_open.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
1006p_open.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
1007p_open.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
1008p_open.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
1009p_open.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
1010p_open.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
1011p_open.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
1012p_open.o: ../cryptlib.h p_open.c
1013p_seal.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
1014p_seal.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
1015p_seal.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
1016p_seal.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
1017p_seal.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
1018p_seal.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
1019p_seal.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
1020p_seal.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
1021p_seal.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
1022p_seal.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
1023p_seal.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
1024p_seal.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
1025p_seal.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
1026p_seal.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h
1027p_seal.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
1028p_seal.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
1029p_seal.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
1030p_seal.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
1031p_seal.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
1032p_seal.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h
1033p_seal.o: ../../include/openssl/x509_vfy.h ../cryptlib.h p_seal.c
1034p_sign.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
1035p_sign.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
1036p_sign.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
1037p_sign.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
1038p_sign.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
1039p_sign.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
1040p_sign.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
1041p_sign.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
1042p_sign.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
1043p_sign.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
1044p_sign.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
1045p_sign.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
1046p_sign.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
1047p_sign.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
1048p_sign.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
1049p_sign.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
1050p_sign.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
1051p_sign.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
1052p_sign.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
1053p_sign.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
1054p_sign.o: ../cryptlib.h p_sign.c
1055p_verify.o: ../../e_os.h ../../include/openssl/aes.h
1056p_verify.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
1057p_verify.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
1058p_verify.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
1059p_verify.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
1060p_verify.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
1061p_verify.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
1062p_verify.o: ../../include/openssl/err.h ../../include/openssl/evp.h
1063p_verify.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
1064p_verify.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
1065p_verify.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
1066p_verify.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
1067p_verify.o: ../../include/openssl/opensslconf.h
1068p_verify.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
1069p_verify.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
1070p_verify.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
1071p_verify.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
1072p_verify.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
1073p_verify.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
1074p_verify.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
1075p_verify.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
1076p_verify.o: ../cryptlib.h p_verify.c
diff --git a/src/lib/libcrypto/evp/Makefile.ssl b/src/lib/libcrypto/evp/Makefile.ssl
new file mode 100644
index 0000000000..f33aebd33a
--- /dev/null
+++ b/src/lib/libcrypto/evp/Makefile.ssl
@@ -0,0 +1,1059 @@
1#
2# SSLeay/crypto/evp/Makefile
3#
4
5DIR= evp
6TOP= ../..
7CC= cc
8INCLUDES= -I.. -I$(TOP) -I../../include
9CFLAG=-g
10INSTALL_PREFIX=
11OPENSSLDIR= /usr/local/ssl
12INSTALLTOP=/usr/local/ssl
13MAKE= make -f Makefile.ssl
14MAKEDEPPROG= makedepend
15MAKEDEPEND= $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG)
16MAKEFILE= Makefile.ssl
17AR= ar r
18
19CFLAGS= $(INCLUDES) $(CFLAG)
20
21GENERAL=Makefile
22TEST=evp_test.c
23TESTDATA=evptests.txt
24APPS=
25
26LIB=$(TOP)/libcrypto.a
27LIBSRC= encode.c digest.c evp_enc.c evp_key.c evp_acnf.c \
28 e_des.c e_bf.c e_idea.c e_des3.c \
29 e_rc4.c e_aes.c names.c \
30 e_xcbc_d.c e_rc2.c e_cast.c e_rc5.c \
31 m_null.c m_md2.c m_md4.c m_md5.c m_sha.c m_sha1.c \
32 m_dss.c m_dss1.c m_mdc2.c m_ripemd.c \
33 p_open.c p_seal.c p_sign.c p_verify.c p_lib.c p_enc.c p_dec.c \
34 bio_md.c bio_b64.c bio_enc.c evp_err.c e_null.c \
35 c_all.c c_allc.c c_alld.c evp_lib.c bio_ok.c \
36 evp_pkey.c evp_pbe.c p5_crpt.c p5_crpt2.c
37
38LIBOBJ= encode.o digest.o evp_enc.o evp_key.o evp_acnf.o \
39 e_des.o e_bf.o e_idea.o e_des3.o \
40 e_rc4.o e_aes.o names.o \
41 e_xcbc_d.o e_rc2.o e_cast.o e_rc5.o \
42 m_null.o m_md2.o m_md4.o m_md5.o m_sha.o m_sha1.o \
43 m_dss.o m_dss1.o m_mdc2.o m_ripemd.o \
44 p_open.o p_seal.o p_sign.o p_verify.o p_lib.o p_enc.o p_dec.o \
45 bio_md.o bio_b64.o bio_enc.o evp_err.o e_null.o \
46 c_all.o c_allc.o c_alld.o evp_lib.o bio_ok.o \
47 evp_pkey.o evp_pbe.o p5_crpt.o p5_crpt2.o
48
49SRC= $(LIBSRC)
50
51EXHEADER= evp.h
52HEADER= $(EXHEADER)
53
54ALL= $(GENERAL) $(SRC) $(HEADER)
55
56top:
57 (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all)
58
59all: lib
60
61lib: $(LIBOBJ)
62 $(AR) $(LIB) $(LIBOBJ)
63 $(RANLIB) $(LIB) || echo Never mind.
64 @touch lib
65
66files:
67 $(PERL) $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO
68
69links:
70 @sh $(TOP)/util/point.sh Makefile.ssl Makefile
71 @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
72 @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
73 cp $(TESTDATA) ../../test
74 @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
75
76install:
77 @for i in $(EXHEADER) ; \
78 do \
79 (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
80 chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
81 done;
82
83tags:
84 ctags $(SRC)
85
86tests:
87
88lint:
89 lint -DLINT $(INCLUDES) $(SRC)>fluff
90
91depend:
92 $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(LIBSRC)
93
94dclean:
95 $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
96 mv -f Makefile.new $(MAKEFILE)
97
98clean:
99 rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
100
101# DO NOT DELETE THIS LINE -- make depend depends on it.
102
103bio_b64.o: ../../e_os.h ../../include/openssl/aes.h
104bio_b64.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
105bio_b64.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
106bio_b64.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
107bio_b64.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
108bio_b64.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
109bio_b64.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
110bio_b64.o: ../../include/openssl/err.h ../../include/openssl/evp.h
111bio_b64.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
112bio_b64.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
113bio_b64.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
114bio_b64.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
115bio_b64.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
116bio_b64.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rc2.h
117bio_b64.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
118bio_b64.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
119bio_b64.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
120bio_b64.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
121bio_b64.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
122bio_b64.o: ../cryptlib.h bio_b64.c
123bio_enc.o: ../../e_os.h ../../include/openssl/aes.h
124bio_enc.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
125bio_enc.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
126bio_enc.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
127bio_enc.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
128bio_enc.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
129bio_enc.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
130bio_enc.o: ../../include/openssl/err.h ../../include/openssl/evp.h
131bio_enc.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
132bio_enc.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
133bio_enc.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
134bio_enc.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
135bio_enc.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
136bio_enc.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rc2.h
137bio_enc.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
138bio_enc.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
139bio_enc.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
140bio_enc.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
141bio_enc.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
142bio_enc.o: ../cryptlib.h bio_enc.c
143bio_md.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
144bio_md.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
145bio_md.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
146bio_md.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
147bio_md.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
148bio_md.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
149bio_md.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
150bio_md.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
151bio_md.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
152bio_md.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
153bio_md.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
154bio_md.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
155bio_md.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
156bio_md.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
157bio_md.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
158bio_md.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
159bio_md.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
160bio_md.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
161bio_md.o: ../../include/openssl/ui_compat.h ../cryptlib.h bio_md.c
162bio_ok.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
163bio_ok.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
164bio_ok.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
165bio_ok.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
166bio_ok.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
167bio_ok.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
168bio_ok.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
169bio_ok.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
170bio_ok.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
171bio_ok.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
172bio_ok.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
173bio_ok.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
174bio_ok.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
175bio_ok.o: ../../include/openssl/rand.h ../../include/openssl/rc2.h
176bio_ok.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
177bio_ok.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
178bio_ok.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
179bio_ok.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
180bio_ok.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
181bio_ok.o: ../cryptlib.h bio_ok.c
182c_all.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
183c_all.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
184c_all.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
185c_all.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
186c_all.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
187c_all.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
188c_all.o: ../../include/openssl/e_os2.h ../../include/openssl/engine.h
189c_all.o: ../../include/openssl/err.h ../../include/openssl/evp.h
190c_all.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
191c_all.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
192c_all.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
193c_all.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
194c_all.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
195c_all.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rand.h
196c_all.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
197c_all.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
198c_all.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
199c_all.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
200c_all.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
201c_all.o: ../../include/openssl/ui_compat.h ../cryptlib.h c_all.c
202c_allc.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
203c_allc.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
204c_allc.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
205c_allc.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
206c_allc.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
207c_allc.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
208c_allc.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
209c_allc.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
210c_allc.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
211c_allc.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
212c_allc.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
213c_allc.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
214c_allc.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
215c_allc.o: ../../include/openssl/pkcs12.h ../../include/openssl/pkcs7.h
216c_allc.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
217c_allc.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
218c_allc.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
219c_allc.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
220c_allc.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
221c_allc.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h
222c_allc.o: ../../include/openssl/x509_vfy.h ../cryptlib.h c_allc.c
223c_alld.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
224c_alld.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
225c_alld.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
226c_alld.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
227c_alld.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
228c_alld.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
229c_alld.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
230c_alld.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
231c_alld.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
232c_alld.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
233c_alld.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
234c_alld.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
235c_alld.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
236c_alld.o: ../../include/openssl/pkcs12.h ../../include/openssl/pkcs7.h
237c_alld.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
238c_alld.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
239c_alld.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
240c_alld.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
241c_alld.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
242c_alld.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h
243c_alld.o: ../../include/openssl/x509_vfy.h ../cryptlib.h c_alld.c
244digest.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
245digest.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
246digest.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
247digest.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
248digest.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
249digest.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
250digest.o: ../../include/openssl/e_os2.h ../../include/openssl/engine.h
251digest.o: ../../include/openssl/err.h ../../include/openssl/evp.h
252digest.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
253digest.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
254digest.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
255digest.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
256digest.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
257digest.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rand.h
258digest.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
259digest.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
260digest.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
261digest.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
262digest.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
263digest.o: ../../include/openssl/ui_compat.h ../cryptlib.h digest.c
264e_aes.o: ../../include/openssl/aes.h ../../include/openssl/asn1.h
265e_aes.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
266e_aes.o: ../../include/openssl/bn.h ../../include/openssl/cast.h
267e_aes.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
268e_aes.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
269e_aes.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
270e_aes.o: ../../include/openssl/err.h ../../include/openssl/evp.h
271e_aes.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
272e_aes.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
273e_aes.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
274e_aes.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
275e_aes.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
276e_aes.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rc2.h
277e_aes.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
278e_aes.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
279e_aes.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
280e_aes.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
281e_aes.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h e_aes.c
282e_aes.o: evp_locl.h
283e_bf.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
284e_bf.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
285e_bf.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
286e_bf.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
287e_bf.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
288e_bf.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
289e_bf.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
290e_bf.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
291e_bf.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
292e_bf.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
293e_bf.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
294e_bf.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
295e_bf.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
296e_bf.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
297e_bf.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
298e_bf.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
299e_bf.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
300e_bf.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
301e_bf.o: ../../include/openssl/ui_compat.h ../cryptlib.h e_bf.c evp_locl.h
302e_cast.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
303e_cast.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
304e_cast.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
305e_cast.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
306e_cast.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
307e_cast.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
308e_cast.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
309e_cast.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
310e_cast.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
311e_cast.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
312e_cast.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
313e_cast.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
314e_cast.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
315e_cast.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
316e_cast.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
317e_cast.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
318e_cast.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
319e_cast.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
320e_cast.o: ../../include/openssl/ui_compat.h ../cryptlib.h e_cast.c evp_locl.h
321e_des.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
322e_des.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
323e_des.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
324e_des.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
325e_des.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
326e_des.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
327e_des.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
328e_des.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
329e_des.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
330e_des.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
331e_des.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
332e_des.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
333e_des.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
334e_des.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
335e_des.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
336e_des.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
337e_des.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
338e_des.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
339e_des.o: ../../include/openssl/ui_compat.h ../cryptlib.h e_des.c evp_locl.h
340e_des3.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
341e_des3.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
342e_des3.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
343e_des3.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
344e_des3.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
345e_des3.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
346e_des3.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
347e_des3.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
348e_des3.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
349e_des3.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
350e_des3.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
351e_des3.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
352e_des3.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
353e_des3.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
354e_des3.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
355e_des3.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
356e_des3.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
357e_des3.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
358e_des3.o: ../../include/openssl/ui_compat.h ../cryptlib.h e_des3.c evp_locl.h
359e_idea.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
360e_idea.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
361e_idea.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
362e_idea.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
363e_idea.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
364e_idea.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
365e_idea.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
366e_idea.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
367e_idea.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
368e_idea.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
369e_idea.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
370e_idea.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
371e_idea.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
372e_idea.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
373e_idea.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
374e_idea.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
375e_idea.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
376e_idea.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
377e_idea.o: ../../include/openssl/ui_compat.h ../cryptlib.h e_idea.c evp_locl.h
378e_null.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
379e_null.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
380e_null.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
381e_null.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
382e_null.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
383e_null.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
384e_null.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
385e_null.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
386e_null.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
387e_null.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
388e_null.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
389e_null.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
390e_null.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
391e_null.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
392e_null.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
393e_null.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
394e_null.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
395e_null.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
396e_null.o: ../../include/openssl/ui_compat.h ../cryptlib.h e_null.c
397e_rc2.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
398e_rc2.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
399e_rc2.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
400e_rc2.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
401e_rc2.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
402e_rc2.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
403e_rc2.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
404e_rc2.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
405e_rc2.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
406e_rc2.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
407e_rc2.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
408e_rc2.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
409e_rc2.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
410e_rc2.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
411e_rc2.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
412e_rc2.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
413e_rc2.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
414e_rc2.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
415e_rc2.o: ../../include/openssl/ui_compat.h ../cryptlib.h e_rc2.c evp_locl.h
416e_rc4.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
417e_rc4.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
418e_rc4.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
419e_rc4.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
420e_rc4.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
421e_rc4.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
422e_rc4.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
423e_rc4.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
424e_rc4.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
425e_rc4.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
426e_rc4.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
427e_rc4.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
428e_rc4.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
429e_rc4.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
430e_rc4.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
431e_rc4.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
432e_rc4.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
433e_rc4.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
434e_rc4.o: ../../include/openssl/ui_compat.h ../cryptlib.h e_rc4.c
435e_rc5.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
436e_rc5.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
437e_rc5.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
438e_rc5.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
439e_rc5.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
440e_rc5.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
441e_rc5.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
442e_rc5.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
443e_rc5.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
444e_rc5.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
445e_rc5.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
446e_rc5.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
447e_rc5.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
448e_rc5.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
449e_rc5.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
450e_rc5.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
451e_rc5.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
452e_rc5.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
453e_rc5.o: ../../include/openssl/ui_compat.h ../cryptlib.h e_rc5.c evp_locl.h
454e_xcbc_d.o: ../../e_os.h ../../include/openssl/aes.h
455e_xcbc_d.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
456e_xcbc_d.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
457e_xcbc_d.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
458e_xcbc_d.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
459e_xcbc_d.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
460e_xcbc_d.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
461e_xcbc_d.o: ../../include/openssl/err.h ../../include/openssl/evp.h
462e_xcbc_d.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
463e_xcbc_d.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
464e_xcbc_d.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
465e_xcbc_d.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
466e_xcbc_d.o: ../../include/openssl/opensslconf.h
467e_xcbc_d.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
468e_xcbc_d.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
469e_xcbc_d.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
470e_xcbc_d.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
471e_xcbc_d.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
472e_xcbc_d.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
473e_xcbc_d.o: ../../include/openssl/ui_compat.h ../cryptlib.h e_xcbc_d.c
474encode.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
475encode.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
476encode.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
477encode.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
478encode.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
479encode.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
480encode.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
481encode.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
482encode.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
483encode.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
484encode.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
485encode.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
486encode.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
487encode.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
488encode.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
489encode.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
490encode.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
491encode.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
492encode.o: ../../include/openssl/ui_compat.h ../cryptlib.h encode.c
493evp_acnf.o: ../../e_os.h ../../include/openssl/aes.h
494evp_acnf.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
495evp_acnf.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
496evp_acnf.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
497evp_acnf.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
498evp_acnf.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
499evp_acnf.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
500evp_acnf.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
501evp_acnf.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
502evp_acnf.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
503evp_acnf.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
504evp_acnf.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
505evp_acnf.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
506evp_acnf.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
507evp_acnf.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
508evp_acnf.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
509evp_acnf.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
510evp_acnf.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
511evp_acnf.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
512evp_acnf.o: ../../include/openssl/ui_compat.h ../cryptlib.h evp_acnf.c
513evp_enc.o: ../../e_os.h ../../include/openssl/aes.h
514evp_enc.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
515evp_enc.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
516evp_enc.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
517evp_enc.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
518evp_enc.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
519evp_enc.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
520evp_enc.o: ../../include/openssl/engine.h ../../include/openssl/err.h
521evp_enc.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
522evp_enc.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
523evp_enc.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
524evp_enc.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
525evp_enc.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
526evp_enc.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
527evp_enc.o: ../../include/openssl/rand.h ../../include/openssl/rc2.h
528evp_enc.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
529evp_enc.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
530evp_enc.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
531evp_enc.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
532evp_enc.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
533evp_enc.o: ../cryptlib.h evp_enc.c evp_locl.h
534evp_err.o: ../../include/openssl/aes.h ../../include/openssl/asn1.h
535evp_err.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
536evp_err.o: ../../include/openssl/bn.h ../../include/openssl/cast.h
537evp_err.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
538evp_err.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
539evp_err.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
540evp_err.o: ../../include/openssl/err.h ../../include/openssl/evp.h
541evp_err.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
542evp_err.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
543evp_err.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
544evp_err.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
545evp_err.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
546evp_err.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rc2.h
547evp_err.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
548evp_err.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
549evp_err.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
550evp_err.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
551evp_err.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
552evp_err.o: evp_err.c
553evp_key.o: ../../e_os.h ../../include/openssl/aes.h
554evp_key.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
555evp_key.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
556evp_key.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
557evp_key.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
558evp_key.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
559evp_key.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
560evp_key.o: ../../include/openssl/err.h ../../include/openssl/evp.h
561evp_key.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
562evp_key.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
563evp_key.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
564evp_key.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
565evp_key.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
566evp_key.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
567evp_key.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
568evp_key.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
569evp_key.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
570evp_key.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
571evp_key.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
572evp_key.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h
573evp_key.o: ../../include/openssl/x509_vfy.h ../cryptlib.h evp_key.c
574evp_lib.o: ../../e_os.h ../../include/openssl/aes.h
575evp_lib.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
576evp_lib.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
577evp_lib.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
578evp_lib.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
579evp_lib.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
580evp_lib.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
581evp_lib.o: ../../include/openssl/err.h ../../include/openssl/evp.h
582evp_lib.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
583evp_lib.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
584evp_lib.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
585evp_lib.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
586evp_lib.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
587evp_lib.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rc2.h
588evp_lib.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
589evp_lib.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
590evp_lib.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
591evp_lib.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
592evp_lib.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
593evp_lib.o: ../cryptlib.h evp_lib.c
594evp_pbe.o: ../../e_os.h ../../include/openssl/aes.h
595evp_pbe.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
596evp_pbe.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
597evp_pbe.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
598evp_pbe.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
599evp_pbe.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
600evp_pbe.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
601evp_pbe.o: ../../include/openssl/err.h ../../include/openssl/evp.h
602evp_pbe.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
603evp_pbe.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
604evp_pbe.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
605evp_pbe.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
606evp_pbe.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
607evp_pbe.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
608evp_pbe.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
609evp_pbe.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
610evp_pbe.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
611evp_pbe.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
612evp_pbe.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
613evp_pbe.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h
614evp_pbe.o: ../../include/openssl/x509_vfy.h ../cryptlib.h evp_pbe.c
615evp_pkey.o: ../../e_os.h ../../include/openssl/aes.h
616evp_pkey.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
617evp_pkey.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
618evp_pkey.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
619evp_pkey.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
620evp_pkey.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
621evp_pkey.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
622evp_pkey.o: ../../include/openssl/err.h ../../include/openssl/evp.h
623evp_pkey.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
624evp_pkey.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
625evp_pkey.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
626evp_pkey.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
627evp_pkey.o: ../../include/openssl/opensslconf.h
628evp_pkey.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
629evp_pkey.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h
630evp_pkey.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
631evp_pkey.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
632evp_pkey.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
633evp_pkey.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
634evp_pkey.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
635evp_pkey.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h
636evp_pkey.o: ../../include/openssl/x509_vfy.h ../cryptlib.h evp_pkey.c
637m_dss.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
638m_dss.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
639m_dss.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
640m_dss.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
641m_dss.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
642m_dss.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
643m_dss.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
644m_dss.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
645m_dss.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
646m_dss.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
647m_dss.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
648m_dss.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
649m_dss.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
650m_dss.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
651m_dss.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
652m_dss.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
653m_dss.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
654m_dss.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
655m_dss.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
656m_dss.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
657m_dss.o: ../cryptlib.h m_dss.c
658m_dss1.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
659m_dss1.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
660m_dss1.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
661m_dss1.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
662m_dss1.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
663m_dss1.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
664m_dss1.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
665m_dss1.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
666m_dss1.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
667m_dss1.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
668m_dss1.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
669m_dss1.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
670m_dss1.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
671m_dss1.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
672m_dss1.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
673m_dss1.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
674m_dss1.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
675m_dss1.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
676m_dss1.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
677m_dss1.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
678m_dss1.o: ../cryptlib.h m_dss1.c
679m_md2.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
680m_md2.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
681m_md2.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
682m_md2.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
683m_md2.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
684m_md2.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
685m_md2.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
686m_md2.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
687m_md2.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
688m_md2.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
689m_md2.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
690m_md2.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
691m_md2.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
692m_md2.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
693m_md2.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
694m_md2.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
695m_md2.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
696m_md2.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
697m_md2.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
698m_md2.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
699m_md2.o: ../cryptlib.h m_md2.c
700m_md4.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
701m_md4.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
702m_md4.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
703m_md4.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
704m_md4.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
705m_md4.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
706m_md4.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
707m_md4.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
708m_md4.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
709m_md4.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
710m_md4.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
711m_md4.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
712m_md4.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
713m_md4.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
714m_md4.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
715m_md4.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
716m_md4.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
717m_md4.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
718m_md4.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
719m_md4.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
720m_md4.o: ../cryptlib.h m_md4.c
721m_md5.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
722m_md5.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
723m_md5.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
724m_md5.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
725m_md5.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
726m_md5.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
727m_md5.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
728m_md5.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
729m_md5.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
730m_md5.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
731m_md5.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
732m_md5.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
733m_md5.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
734m_md5.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
735m_md5.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
736m_md5.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
737m_md5.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
738m_md5.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
739m_md5.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
740m_md5.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
741m_md5.o: ../cryptlib.h m_md5.c
742m_mdc2.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
743m_mdc2.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
744m_mdc2.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
745m_mdc2.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
746m_mdc2.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
747m_mdc2.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
748m_mdc2.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
749m_mdc2.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
750m_mdc2.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
751m_mdc2.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
752m_mdc2.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
753m_mdc2.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
754m_mdc2.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
755m_mdc2.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
756m_mdc2.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
757m_mdc2.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
758m_mdc2.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
759m_mdc2.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
760m_mdc2.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
761m_mdc2.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
762m_mdc2.o: ../cryptlib.h m_mdc2.c
763m_null.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
764m_null.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
765m_null.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
766m_null.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
767m_null.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
768m_null.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
769m_null.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
770m_null.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
771m_null.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
772m_null.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
773m_null.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
774m_null.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
775m_null.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
776m_null.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
777m_null.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
778m_null.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
779m_null.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
780m_null.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
781m_null.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
782m_null.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
783m_null.o: ../cryptlib.h m_null.c
784m_ripemd.o: ../../e_os.h ../../include/openssl/aes.h
785m_ripemd.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
786m_ripemd.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
787m_ripemd.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
788m_ripemd.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
789m_ripemd.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
790m_ripemd.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
791m_ripemd.o: ../../include/openssl/err.h ../../include/openssl/evp.h
792m_ripemd.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
793m_ripemd.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
794m_ripemd.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
795m_ripemd.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
796m_ripemd.o: ../../include/openssl/opensslconf.h
797m_ripemd.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
798m_ripemd.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
799m_ripemd.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
800m_ripemd.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
801m_ripemd.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
802m_ripemd.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
803m_ripemd.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
804m_ripemd.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
805m_ripemd.o: ../cryptlib.h m_ripemd.c
806m_sha.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
807m_sha.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
808m_sha.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
809m_sha.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
810m_sha.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
811m_sha.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
812m_sha.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
813m_sha.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
814m_sha.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
815m_sha.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
816m_sha.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
817m_sha.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
818m_sha.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
819m_sha.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
820m_sha.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
821m_sha.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
822m_sha.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
823m_sha.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
824m_sha.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
825m_sha.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
826m_sha.o: ../cryptlib.h m_sha.c
827m_sha1.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
828m_sha1.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
829m_sha1.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
830m_sha1.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
831m_sha1.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
832m_sha1.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
833m_sha1.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
834m_sha1.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
835m_sha1.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
836m_sha1.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
837m_sha1.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
838m_sha1.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
839m_sha1.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
840m_sha1.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
841m_sha1.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
842m_sha1.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
843m_sha1.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
844m_sha1.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
845m_sha1.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
846m_sha1.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
847m_sha1.o: ../cryptlib.h m_sha1.c
848names.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
849names.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
850names.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
851names.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
852names.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
853names.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
854names.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
855names.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
856names.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
857names.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
858names.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
859names.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
860names.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
861names.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
862names.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
863names.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
864names.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
865names.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
866names.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
867names.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
868names.o: ../cryptlib.h names.c
869p5_crpt.o: ../../e_os.h ../../include/openssl/aes.h
870p5_crpt.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
871p5_crpt.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
872p5_crpt.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
873p5_crpt.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
874p5_crpt.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
875p5_crpt.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
876p5_crpt.o: ../../include/openssl/err.h ../../include/openssl/evp.h
877p5_crpt.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
878p5_crpt.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
879p5_crpt.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
880p5_crpt.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
881p5_crpt.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
882p5_crpt.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
883p5_crpt.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
884p5_crpt.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
885p5_crpt.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
886p5_crpt.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
887p5_crpt.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
888p5_crpt.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h
889p5_crpt.o: ../../include/openssl/x509_vfy.h ../cryptlib.h p5_crpt.c
890p5_crpt2.o: ../../e_os.h ../../include/openssl/aes.h
891p5_crpt2.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
892p5_crpt2.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
893p5_crpt2.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
894p5_crpt2.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
895p5_crpt2.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
896p5_crpt2.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
897p5_crpt2.o: ../../include/openssl/err.h ../../include/openssl/evp.h
898p5_crpt2.o: ../../include/openssl/hmac.h ../../include/openssl/idea.h
899p5_crpt2.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
900p5_crpt2.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
901p5_crpt2.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
902p5_crpt2.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
903p5_crpt2.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
904p5_crpt2.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
905p5_crpt2.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
906p5_crpt2.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
907p5_crpt2.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
908p5_crpt2.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
909p5_crpt2.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
910p5_crpt2.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
911p5_crpt2.o: ../cryptlib.h p5_crpt2.c
912p_dec.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
913p_dec.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
914p_dec.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
915p_dec.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
916p_dec.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
917p_dec.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
918p_dec.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
919p_dec.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
920p_dec.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
921p_dec.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
922p_dec.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
923p_dec.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
924p_dec.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
925p_dec.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h
926p_dec.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
927p_dec.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
928p_dec.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
929p_dec.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
930p_dec.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
931p_dec.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h
932p_dec.o: ../../include/openssl/x509_vfy.h ../cryptlib.h p_dec.c
933p_enc.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
934p_enc.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
935p_enc.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
936p_enc.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
937p_enc.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
938p_enc.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
939p_enc.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
940p_enc.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
941p_enc.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
942p_enc.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
943p_enc.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
944p_enc.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
945p_enc.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
946p_enc.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h
947p_enc.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
948p_enc.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
949p_enc.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
950p_enc.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
951p_enc.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
952p_enc.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h
953p_enc.o: ../../include/openssl/x509_vfy.h ../cryptlib.h p_enc.c
954p_lib.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
955p_lib.o: ../../include/openssl/asn1_mac.h ../../include/openssl/bio.h
956p_lib.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
957p_lib.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
958p_lib.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
959p_lib.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
960p_lib.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
961p_lib.o: ../../include/openssl/err.h ../../include/openssl/evp.h
962p_lib.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
963p_lib.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
964p_lib.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
965p_lib.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
966p_lib.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
967p_lib.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
968p_lib.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
969p_lib.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
970p_lib.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
971p_lib.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
972p_lib.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
973p_lib.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h
974p_lib.o: ../../include/openssl/x509_vfy.h ../cryptlib.h p_lib.c
975p_open.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
976p_open.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
977p_open.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
978p_open.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
979p_open.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
980p_open.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
981p_open.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
982p_open.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
983p_open.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
984p_open.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
985p_open.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
986p_open.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
987p_open.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
988p_open.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
989p_open.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
990p_open.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
991p_open.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
992p_open.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
993p_open.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
994p_open.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
995p_open.o: ../cryptlib.h p_open.c
996p_seal.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
997p_seal.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
998p_seal.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
999p_seal.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
1000p_seal.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
1001p_seal.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
1002p_seal.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
1003p_seal.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
1004p_seal.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
1005p_seal.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
1006p_seal.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
1007p_seal.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
1008p_seal.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
1009p_seal.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h
1010p_seal.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
1011p_seal.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
1012p_seal.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
1013p_seal.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
1014p_seal.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
1015p_seal.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h
1016p_seal.o: ../../include/openssl/x509_vfy.h ../cryptlib.h p_seal.c
1017p_sign.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
1018p_sign.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
1019p_sign.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
1020p_sign.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
1021p_sign.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
1022p_sign.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
1023p_sign.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
1024p_sign.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
1025p_sign.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
1026p_sign.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
1027p_sign.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
1028p_sign.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
1029p_sign.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
1030p_sign.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
1031p_sign.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
1032p_sign.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
1033p_sign.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
1034p_sign.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
1035p_sign.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
1036p_sign.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
1037p_sign.o: ../cryptlib.h p_sign.c
1038p_verify.o: ../../e_os.h ../../include/openssl/aes.h
1039p_verify.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
1040p_verify.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
1041p_verify.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
1042p_verify.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
1043p_verify.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
1044p_verify.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
1045p_verify.o: ../../include/openssl/err.h ../../include/openssl/evp.h
1046p_verify.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
1047p_verify.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
1048p_verify.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
1049p_verify.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
1050p_verify.o: ../../include/openssl/opensslconf.h
1051p_verify.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
1052p_verify.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
1053p_verify.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
1054p_verify.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
1055p_verify.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
1056p_verify.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
1057p_verify.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
1058p_verify.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
1059p_verify.o: ../cryptlib.h p_verify.c
diff --git a/src/lib/libcrypto/evp/bio_enc.c b/src/lib/libcrypto/evp/bio_enc.c
index b8cda1a9f0..ab81851503 100644
--- a/src/lib/libcrypto/evp/bio_enc.c
+++ b/src/lib/libcrypto/evp/bio_enc.c
@@ -71,7 +71,7 @@ static int enc_new(BIO *h);
71static int enc_free(BIO *data); 71static int enc_free(BIO *data);
72static long enc_callback_ctrl(BIO *h, int cmd, bio_info_cb *fps); 72static long enc_callback_ctrl(BIO *h, int cmd, bio_info_cb *fps);
73#define ENC_BLOCK_SIZE (1024*4) 73#define ENC_BLOCK_SIZE (1024*4)
74#define BUF_OFFSET (EVP_MAX_BLOCK_LENGTH*2) 74#define BUF_OFFSET EVP_MAX_BLOCK_LENGTH
75 75
76typedef struct enc_struct 76typedef struct enc_struct
77 { 77 {
diff --git a/src/lib/libcrypto/evp/bio_ok.c b/src/lib/libcrypto/evp/bio_ok.c
new file mode 100644
index 0000000000..4e3f10141b
--- /dev/null
+++ b/src/lib/libcrypto/evp/bio_ok.c
@@ -0,0 +1,575 @@
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 "cryptlib.h"
123#include <openssl/buffer.h>
124#include <openssl/bio.h>
125#include <openssl/evp.h>
126#include <openssl/rand.h>
127
128static int ok_write(BIO *h, const char *buf, int num);
129static int ok_read(BIO *h, char *buf, int size);
130static long ok_ctrl(BIO *h, int cmd, long arg1, void *arg2);
131static int ok_new(BIO *h);
132static int ok_free(BIO *data);
133static long ok_callback_ctrl(BIO *h, int cmd, bio_info_cb *fp);
134
135static void sig_out(BIO* b);
136static void sig_in(BIO* b);
137static void block_out(BIO* b);
138static void block_in(BIO* b);
139#define OK_BLOCK_SIZE (1024*4)
140#define OK_BLOCK_BLOCK 4
141#define IOBS (OK_BLOCK_SIZE+ OK_BLOCK_BLOCK+ 3*EVP_MAX_MD_SIZE)
142#define WELLKNOWN "The quick brown fox jumped over the lazy dog's back."
143
144#ifndef L_ENDIAN
145#define swapem(x) \
146 ((unsigned long int)((((unsigned long int)(x) & 0x000000ffU) << 24) | \
147 (((unsigned long int)(x) & 0x0000ff00U) << 8) | \
148 (((unsigned long int)(x) & 0x00ff0000U) >> 8) | \
149 (((unsigned long int)(x) & 0xff000000U) >> 24)))
150#else
151#define swapem(x) (x)
152#endif
153
154typedef struct ok_struct
155 {
156 int buf_len;
157 int buf_off;
158 int buf_len_save;
159 int buf_off_save;
160 int cont; /* <= 0 when finished */
161 int finished;
162 EVP_MD_CTX md;
163 int blockout; /* output block is ready */
164 int sigio; /* must process signature */
165 unsigned char buf[IOBS];
166 } BIO_OK_CTX;
167
168static BIO_METHOD methods_ok=
169 {
170 BIO_TYPE_CIPHER,"reliable",
171 ok_write,
172 ok_read,
173 NULL, /* ok_puts, */
174 NULL, /* ok_gets, */
175 ok_ctrl,
176 ok_new,
177 ok_free,
178 ok_callback_ctrl,
179 };
180
181BIO_METHOD *BIO_f_reliable(void)
182 {
183 return(&methods_ok);
184 }
185
186static int ok_new(BIO *bi)
187 {
188 BIO_OK_CTX *ctx;
189
190 ctx=(BIO_OK_CTX *)OPENSSL_malloc(sizeof(BIO_OK_CTX));
191 if (ctx == NULL) return(0);
192
193 ctx->buf_len=0;
194 ctx->buf_off=0;
195 ctx->buf_len_save=0;
196 ctx->buf_off_save=0;
197 ctx->cont=1;
198 ctx->finished=0;
199 ctx->blockout= 0;
200 ctx->sigio=1;
201
202 EVP_MD_CTX_init(&ctx->md);
203
204 bi->init=0;
205 bi->ptr=(char *)ctx;
206 bi->flags=0;
207 return(1);
208 }
209
210static int ok_free(BIO *a)
211 {
212 if (a == NULL) return(0);
213 EVP_MD_CTX_cleanup(&((BIO_OK_CTX *)a->ptr)->md);
214 OPENSSL_cleanse(a->ptr,sizeof(BIO_OK_CTX));
215 OPENSSL_free(a->ptr);
216 a->ptr=NULL;
217 a->init=0;
218 a->flags=0;
219 return(1);
220 }
221
222static int ok_read(BIO *b, char *out, int outl)
223 {
224 int ret=0,i,n;
225 BIO_OK_CTX *ctx;
226
227 if (out == NULL) return(0);
228 ctx=(BIO_OK_CTX *)b->ptr;
229
230 if ((ctx == NULL) || (b->next_bio == NULL) || (b->init == 0)) return(0);
231
232 while(outl > 0)
233 {
234
235 /* copy clean bytes to output buffer */
236 if (ctx->blockout)
237 {
238 i=ctx->buf_len-ctx->buf_off;
239 if (i > outl) i=outl;
240 memcpy(out,&(ctx->buf[ctx->buf_off]),i);
241 ret+=i;
242 out+=i;
243 outl-=i;
244 ctx->buf_off+=i;
245
246 /* all clean bytes are out */
247 if (ctx->buf_len == ctx->buf_off)
248 {
249 ctx->buf_off=0;
250
251 /* copy start of the next block into proper place */
252 if(ctx->buf_len_save- ctx->buf_off_save > 0)
253 {
254 ctx->buf_len= ctx->buf_len_save- ctx->buf_off_save;
255 memmove(ctx->buf, &(ctx->buf[ctx->buf_off_save]),
256 ctx->buf_len);
257 }
258 else
259 {
260 ctx->buf_len=0;
261 }
262 ctx->blockout= 0;
263 }
264 }
265
266 /* output buffer full -- cancel */
267 if (outl == 0) break;
268
269 /* no clean bytes in buffer -- fill it */
270 n=IOBS- ctx->buf_len;
271 i=BIO_read(b->next_bio,&(ctx->buf[ctx->buf_len]),n);
272
273 if (i <= 0) break; /* nothing new */
274
275 ctx->buf_len+= i;
276
277 /* no signature yet -- check if we got one */
278 if (ctx->sigio == 1) sig_in(b);
279
280 /* signature ok -- check if we got block */
281 if (ctx->sigio == 0) block_in(b);
282
283 /* invalid block -- cancel */
284 if (ctx->cont <= 0) break;
285
286 }
287
288 BIO_clear_retry_flags(b);
289 BIO_copy_next_retry(b);
290 return(ret);
291 }
292
293static int ok_write(BIO *b, const char *in, int inl)
294 {
295 int ret=0,n,i;
296 BIO_OK_CTX *ctx;
297
298 ctx=(BIO_OK_CTX *)b->ptr;
299 ret=inl;
300
301 if ((ctx == NULL) || (b->next_bio == NULL) || (b->init == 0)) return(0);
302
303 if(ctx->sigio) sig_out(b);
304
305 do{
306 BIO_clear_retry_flags(b);
307 n=ctx->buf_len-ctx->buf_off;
308 while (ctx->blockout && n > 0)
309 {
310 i=BIO_write(b->next_bio,&(ctx->buf[ctx->buf_off]),n);
311 if (i <= 0)
312 {
313 BIO_copy_next_retry(b);
314 if(!BIO_should_retry(b))
315 ctx->cont= 0;
316 return(i);
317 }
318 ctx->buf_off+=i;
319 n-=i;
320 }
321
322 /* at this point all pending data has been written */
323 ctx->blockout= 0;
324 if (ctx->buf_len == ctx->buf_off)
325 {
326 ctx->buf_len=OK_BLOCK_BLOCK;
327 ctx->buf_off=0;
328 }
329
330 if ((in == NULL) || (inl <= 0)) return(0);
331
332 n= (inl+ ctx->buf_len > OK_BLOCK_SIZE+ OK_BLOCK_BLOCK) ?
333 OK_BLOCK_SIZE+ OK_BLOCK_BLOCK- ctx->buf_len : inl;
334
335 memcpy((unsigned char *)(&(ctx->buf[ctx->buf_len])),(unsigned char *)in,n);
336 ctx->buf_len+= n;
337 inl-=n;
338 in+=n;
339
340 if(ctx->buf_len >= OK_BLOCK_SIZE+ OK_BLOCK_BLOCK)
341 {
342 block_out(b);
343 }
344 }while(inl > 0);
345
346 BIO_clear_retry_flags(b);
347 BIO_copy_next_retry(b);
348 return(ret);
349 }
350
351static long ok_ctrl(BIO *b, int cmd, long num, void *ptr)
352 {
353 BIO_OK_CTX *ctx;
354 EVP_MD *md;
355 const EVP_MD **ppmd;
356 long ret=1;
357 int i;
358
359 ctx=b->ptr;
360
361 switch (cmd)
362 {
363 case BIO_CTRL_RESET:
364 ctx->buf_len=0;
365 ctx->buf_off=0;
366 ctx->buf_len_save=0;
367 ctx->buf_off_save=0;
368 ctx->cont=1;
369 ctx->finished=0;
370 ctx->blockout= 0;
371 ctx->sigio=1;
372 ret=BIO_ctrl(b->next_bio,cmd,num,ptr);
373 break;
374 case BIO_CTRL_EOF: /* More to read */
375 if (ctx->cont <= 0)
376 ret=1;
377 else
378 ret=BIO_ctrl(b->next_bio,cmd,num,ptr);
379 break;
380 case BIO_CTRL_PENDING: /* More to read in buffer */
381 case BIO_CTRL_WPENDING: /* More to read in buffer */
382 ret=ctx->blockout ? ctx->buf_len-ctx->buf_off : 0;
383 if (ret <= 0)
384 ret=BIO_ctrl(b->next_bio,cmd,num,ptr);
385 break;
386 case BIO_CTRL_FLUSH:
387 /* do a final write */
388 if(ctx->blockout == 0)
389 block_out(b);
390
391 while (ctx->blockout)
392 {
393 i=ok_write(b,NULL,0);
394 if (i < 0)
395 {
396 ret=i;
397 break;
398 }
399 }
400
401 ctx->finished=1;
402 ctx->buf_off=ctx->buf_len=0;
403 ctx->cont=(int)ret;
404
405 /* Finally flush the underlying BIO */
406 ret=BIO_ctrl(b->next_bio,cmd,num,ptr);
407 break;
408 case BIO_C_DO_STATE_MACHINE:
409 BIO_clear_retry_flags(b);
410 ret=BIO_ctrl(b->next_bio,cmd,num,ptr);
411 BIO_copy_next_retry(b);
412 break;
413 case BIO_CTRL_INFO:
414 ret=(long)ctx->cont;
415 break;
416 case BIO_C_SET_MD:
417 md=ptr;
418 EVP_DigestInit_ex(&ctx->md, md, NULL);
419 b->init=1;
420 break;
421 case BIO_C_GET_MD:
422 if (b->init)
423 {
424 ppmd=ptr;
425 *ppmd=ctx->md.digest;
426 }
427 else
428 ret=0;
429 break;
430 default:
431 ret=BIO_ctrl(b->next_bio,cmd,num,ptr);
432 break;
433 }
434 return(ret);
435 }
436
437static long ok_callback_ctrl(BIO *b, int cmd, bio_info_cb *fp)
438 {
439 long ret=1;
440
441 if (b->next_bio == NULL) return(0);
442 switch (cmd)
443 {
444 default:
445 ret=BIO_callback_ctrl(b->next_bio,cmd,fp);
446 break;
447 }
448 return(ret);
449 }
450
451static void longswap(void *_ptr, int len)
452{
453#ifndef L_ENDIAN
454 int i;
455 char *ptr=_ptr;
456
457 for(i= 0;i < len;i+= 4){
458 *((unsigned long *)&(ptr[i]))= swapem(*((unsigned long *)&(ptr[i])));
459 }
460#endif
461}
462
463static void sig_out(BIO* b)
464 {
465 BIO_OK_CTX *ctx;
466 EVP_MD_CTX *md;
467
468 ctx=b->ptr;
469 md=&ctx->md;
470
471 if(ctx->buf_len+ 2* md->digest->md_size > OK_BLOCK_SIZE) return;
472
473 EVP_DigestInit_ex(md, md->digest, NULL);
474 /* FIXME: there's absolutely no guarantee this makes any sense at all,
475 * particularly now EVP_MD_CTX has been restructured.
476 */
477 RAND_pseudo_bytes(md->md_data, md->digest->md_size);
478 memcpy(&(ctx->buf[ctx->buf_len]), md->md_data, md->digest->md_size);
479 longswap(&(ctx->buf[ctx->buf_len]), md->digest->md_size);
480 ctx->buf_len+= md->digest->md_size;
481
482 EVP_DigestUpdate(md, WELLKNOWN, strlen(WELLKNOWN));
483 EVP_DigestFinal_ex(md, &(ctx->buf[ctx->buf_len]), NULL);
484 ctx->buf_len+= md->digest->md_size;
485 ctx->blockout= 1;
486 ctx->sigio= 0;
487 }
488
489static void sig_in(BIO* b)
490 {
491 BIO_OK_CTX *ctx;
492 EVP_MD_CTX *md;
493 unsigned char tmp[EVP_MAX_MD_SIZE];
494 int ret= 0;
495
496 ctx=b->ptr;
497 md=&ctx->md;
498
499 if(ctx->buf_len- ctx->buf_off < 2* md->digest->md_size) return;
500
501 EVP_DigestInit_ex(md, md->digest, NULL);
502 memcpy(md->md_data, &(ctx->buf[ctx->buf_off]), md->digest->md_size);
503 longswap(md->md_data, md->digest->md_size);
504 ctx->buf_off+= md->digest->md_size;
505
506 EVP_DigestUpdate(md, WELLKNOWN, strlen(WELLKNOWN));
507 EVP_DigestFinal_ex(md, tmp, NULL);
508 ret= memcmp(&(ctx->buf[ctx->buf_off]), tmp, md->digest->md_size) == 0;
509 ctx->buf_off+= md->digest->md_size;
510 if(ret == 1)
511 {
512 ctx->sigio= 0;
513 if(ctx->buf_len != ctx->buf_off)
514 {
515 memmove(ctx->buf, &(ctx->buf[ctx->buf_off]), ctx->buf_len- ctx->buf_off);
516 }
517 ctx->buf_len-= ctx->buf_off;
518 ctx->buf_off= 0;
519 }
520 else
521 {
522 ctx->cont= 0;
523 }
524 }
525
526static void block_out(BIO* b)
527 {
528 BIO_OK_CTX *ctx;
529 EVP_MD_CTX *md;
530 unsigned long tl;
531
532 ctx=b->ptr;
533 md=&ctx->md;
534
535 tl= ctx->buf_len- OK_BLOCK_BLOCK;
536 tl= swapem(tl);
537 memcpy(ctx->buf, &tl, OK_BLOCK_BLOCK);
538 tl= swapem(tl);
539 EVP_DigestUpdate(md, (unsigned char*) &(ctx->buf[OK_BLOCK_BLOCK]), tl);
540 EVP_DigestFinal_ex(md, &(ctx->buf[ctx->buf_len]), NULL);
541 ctx->buf_len+= md->digest->md_size;
542 ctx->blockout= 1;
543 }
544
545static void block_in(BIO* b)
546 {
547 BIO_OK_CTX *ctx;
548 EVP_MD_CTX *md;
549 long tl= 0;
550 unsigned char tmp[EVP_MAX_MD_SIZE];
551
552 ctx=b->ptr;
553 md=&ctx->md;
554
555 memcpy(&tl, ctx->buf, OK_BLOCK_BLOCK);
556 tl= swapem(tl);
557 if (ctx->buf_len < tl+ OK_BLOCK_BLOCK+ md->digest->md_size) return;
558
559 EVP_DigestUpdate(md, (unsigned char*) &(ctx->buf[OK_BLOCK_BLOCK]), tl);
560 EVP_DigestFinal_ex(md, tmp, NULL);
561 if(memcmp(&(ctx->buf[tl+ OK_BLOCK_BLOCK]), tmp, md->digest->md_size) == 0)
562 {
563 /* there might be parts from next block lurking around ! */
564 ctx->buf_off_save= tl+ OK_BLOCK_BLOCK+ md->digest->md_size;
565 ctx->buf_len_save= ctx->buf_len;
566 ctx->buf_off= OK_BLOCK_BLOCK;
567 ctx->buf_len= tl+ OK_BLOCK_BLOCK;
568 ctx->blockout= 1;
569 }
570 else
571 {
572 ctx->cont= 0;
573 }
574 }
575
diff --git a/src/lib/libcrypto/evp/c_allc.c b/src/lib/libcrypto/evp/c_allc.c
new file mode 100644
index 0000000000..fc96812365
--- /dev/null
+++ b/src/lib/libcrypto/evp/c_allc.c
@@ -0,0 +1,188 @@
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
75 EVP_add_cipher(EVP_des_ofb());
76 EVP_add_cipher(EVP_des_ede_ofb());
77 EVP_add_cipher(EVP_des_ede3_ofb());
78
79 EVP_add_cipher(EVP_desx_cbc());
80 EVP_add_cipher_alias(SN_desx_cbc,"DESX");
81 EVP_add_cipher_alias(SN_desx_cbc,"desx");
82
83 EVP_add_cipher(EVP_des_cbc());
84 EVP_add_cipher_alias(SN_des_cbc,"DES");
85 EVP_add_cipher_alias(SN_des_cbc,"des");
86 EVP_add_cipher(EVP_des_ede_cbc());
87 EVP_add_cipher(EVP_des_ede3_cbc());
88 EVP_add_cipher_alias(SN_des_ede3_cbc,"DES3");
89 EVP_add_cipher_alias(SN_des_ede3_cbc,"des3");
90
91 EVP_add_cipher(EVP_des_ecb());
92 EVP_add_cipher(EVP_des_ede());
93 EVP_add_cipher(EVP_des_ede3());
94#endif
95
96#ifndef OPENSSL_NO_RC4
97 EVP_add_cipher(EVP_rc4());
98 EVP_add_cipher(EVP_rc4_40());
99#endif
100
101#ifndef OPENSSL_NO_IDEA
102 EVP_add_cipher(EVP_idea_ecb());
103 EVP_add_cipher(EVP_idea_cfb());
104 EVP_add_cipher(EVP_idea_ofb());
105 EVP_add_cipher(EVP_idea_cbc());
106 EVP_add_cipher_alias(SN_idea_cbc,"IDEA");
107 EVP_add_cipher_alias(SN_idea_cbc,"idea");
108#endif
109
110#ifndef OPENSSL_NO_RC2
111 EVP_add_cipher(EVP_rc2_ecb());
112 EVP_add_cipher(EVP_rc2_cfb());
113 EVP_add_cipher(EVP_rc2_ofb());
114 EVP_add_cipher(EVP_rc2_cbc());
115 EVP_add_cipher(EVP_rc2_40_cbc());
116 EVP_add_cipher(EVP_rc2_64_cbc());
117 EVP_add_cipher_alias(SN_rc2_cbc,"RC2");
118 EVP_add_cipher_alias(SN_rc2_cbc,"rc2");
119#endif
120
121#ifndef OPENSSL_NO_BF
122 EVP_add_cipher(EVP_bf_ecb());
123 EVP_add_cipher(EVP_bf_cfb());
124 EVP_add_cipher(EVP_bf_ofb());
125 EVP_add_cipher(EVP_bf_cbc());
126 EVP_add_cipher_alias(SN_bf_cbc,"BF");
127 EVP_add_cipher_alias(SN_bf_cbc,"bf");
128 EVP_add_cipher_alias(SN_bf_cbc,"blowfish");
129#endif
130
131#ifndef OPENSSL_NO_CAST
132 EVP_add_cipher(EVP_cast5_ecb());
133 EVP_add_cipher(EVP_cast5_cfb());
134 EVP_add_cipher(EVP_cast5_ofb());
135 EVP_add_cipher(EVP_cast5_cbc());
136 EVP_add_cipher_alias(SN_cast5_cbc,"CAST");
137 EVP_add_cipher_alias(SN_cast5_cbc,"cast");
138 EVP_add_cipher_alias(SN_cast5_cbc,"CAST-cbc");
139 EVP_add_cipher_alias(SN_cast5_cbc,"cast-cbc");
140#endif
141
142#ifndef OPENSSL_NO_RC5
143 EVP_add_cipher(EVP_rc5_32_12_16_ecb());
144 EVP_add_cipher(EVP_rc5_32_12_16_cfb());
145 EVP_add_cipher(EVP_rc5_32_12_16_ofb());
146 EVP_add_cipher(EVP_rc5_32_12_16_cbc());
147 EVP_add_cipher_alias(SN_rc5_cbc,"rc5");
148 EVP_add_cipher_alias(SN_rc5_cbc,"RC5");
149#endif
150
151#ifndef OPENSSL_NO_AES
152 EVP_add_cipher(EVP_aes_128_ecb());
153 EVP_add_cipher(EVP_aes_128_cbc());
154 EVP_add_cipher(EVP_aes_128_cfb());
155 EVP_add_cipher(EVP_aes_128_cfb1());
156 EVP_add_cipher(EVP_aes_128_cfb8());
157 EVP_add_cipher(EVP_aes_128_ofb());
158#if 0
159 EVP_add_cipher(EVP_aes_128_ctr());
160#endif
161 EVP_add_cipher_alias(SN_aes_128_cbc,"AES128");
162 EVP_add_cipher_alias(SN_aes_128_cbc,"aes128");
163 EVP_add_cipher(EVP_aes_192_ecb());
164 EVP_add_cipher(EVP_aes_192_cbc());
165 EVP_add_cipher(EVP_aes_192_cfb());
166 EVP_add_cipher(EVP_aes_192_cfb1());
167 EVP_add_cipher(EVP_aes_192_cfb8());
168 EVP_add_cipher(EVP_aes_192_ofb());
169#if 0
170 EVP_add_cipher(EVP_aes_192_ctr());
171#endif
172 EVP_add_cipher_alias(SN_aes_192_cbc,"AES192");
173 EVP_add_cipher_alias(SN_aes_192_cbc,"aes192");
174 EVP_add_cipher(EVP_aes_256_ecb());
175 EVP_add_cipher(EVP_aes_256_cbc());
176 EVP_add_cipher(EVP_aes_256_cfb());
177 EVP_add_cipher(EVP_aes_256_cfb1());
178 EVP_add_cipher(EVP_aes_256_cfb8());
179 EVP_add_cipher(EVP_aes_256_ofb());
180#if 0
181 EVP_add_cipher(EVP_aes_256_ctr());
182#endif
183 EVP_add_cipher_alias(SN_aes_256_cbc,"AES256");
184 EVP_add_cipher_alias(SN_aes_256_cbc,"aes256");
185#endif
186 PKCS12_PBE_add();
187 PKCS5_PBE_add();
188 }
diff --git a/src/lib/libcrypto/evp/c_alld.c b/src/lib/libcrypto/evp/c_alld.c
new file mode 100644
index 0000000000..aae7bf7482
--- /dev/null
+++ b/src/lib/libcrypto/evp/c_alld.c
@@ -0,0 +1,103 @@
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_MD2
68 EVP_add_digest(EVP_md2());
69#endif
70#ifndef OPENSSL_NO_MD4
71 EVP_add_digest(EVP_md4());
72#endif
73#ifndef OPENSSL_NO_MD5
74 EVP_add_digest(EVP_md5());
75 EVP_add_digest_alias(SN_md5,"ssl2-md5");
76 EVP_add_digest_alias(SN_md5,"ssl3-md5");
77#endif
78#if !defined(OPENSSL_NO_SHA) && !defined(OPENSSL_NO_SHA0)
79 EVP_add_digest(EVP_sha());
80#ifndef OPENSSL_NO_DSA
81 EVP_add_digest(EVP_dss());
82#endif
83#endif
84#ifndef OPENSSL_NO_SHA
85 EVP_add_digest(EVP_sha1());
86 EVP_add_digest_alias(SN_sha1,"ssl3-sha1");
87 EVP_add_digest_alias(SN_sha1WithRSAEncryption,SN_sha1WithRSA);
88#ifndef OPENSSL_NO_DSA
89 EVP_add_digest(EVP_dss1());
90 EVP_add_digest_alias(SN_dsaWithSHA1,SN_dsaWithSHA1_2);
91 EVP_add_digest_alias(SN_dsaWithSHA1,"DSS1");
92 EVP_add_digest_alias(SN_dsaWithSHA1,"dss1");
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 }
diff --git a/src/lib/libcrypto/evp/e_acss.c b/src/lib/libcrypto/evp/e_acss.c
new file mode 100644
index 0000000000..a16b85c627
--- /dev/null
+++ b/src/lib/libcrypto/evp/e_acss.c
@@ -0,0 +1,85 @@
1/* $Id: e_acss.c,v 1.2 2004/02/13 10:05:44 hshoexer Exp $ */
2/*
3 * Copyright (c) 2004 The OpenBSD project
4 *
5 * Permission to use, copy, modify, and distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
8 *
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 */
17
18#ifndef OPENSSL_NO_ACSS
19
20#include "cryptlib.h"
21#include <openssl/evp.h>
22#include <openssl/objects.h>
23#include "evp_locl.h"
24#include <openssl/acss.h>
25
26typedef struct {
27 ACSS_KEY ks;
28} EVP_ACSS_KEY;
29
30#define data(ctx) EVP_C_DATA(EVP_ACSS_KEY,ctx)
31
32static int acss_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
33 const unsigned char *iv, int enc);
34static int acss_ciph(EVP_CIPHER_CTX *ctx, unsigned char *out,
35 const unsigned char *in, unsigned int inl);
36static int acss_ctrl(EVP_CIPHER_CTX *ctx, int type, int arg, void *ptr);
37static const EVP_CIPHER acss_cipher = {
38 NID_undef,
39 1,5,0,
40 0,
41 acss_init_key,
42 acss_ciph,
43 NULL,
44 sizeof(EVP_ACSS_KEY),
45 NULL,
46 NULL,
47 acss_ctrl,
48 NULL
49};
50
51const
52EVP_CIPHER *EVP_acss(void)
53{
54 return(&acss_cipher);
55}
56
57static int
58acss_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
59 const unsigned char *iv, int enc)
60{
61 acss_setkey(&data(ctx)->ks,key,enc,ACSS_MODE1);
62 return 1;
63}
64
65static int
66acss_ciph(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in,
67 unsigned int inl)
68{
69 acss(&data(ctx)->ks,inl,in,out);
70 return 1;
71}
72
73static int
74acss_ctrl(EVP_CIPHER_CTX *ctx, int type, int arg, void *ptr)
75{
76 switch(type) {
77 case EVP_CTRL_SET_ACSS_MODE:
78 data(ctx)->ks.mode = arg;
79 return 1;
80
81 default:
82 return -1;
83 }
84}
85#endif
diff --git a/src/lib/libcrypto/evp/e_aes.c b/src/lib/libcrypto/evp/e_aes.c
index 7b67984fa1..f35036c9d7 100644
--- a/src/lib/libcrypto/evp/e_aes.c
+++ b/src/lib/libcrypto/evp/e_aes.c
@@ -86,9 +86,9 @@ IMPLEMENT_BLOCK_CIPHER(aes_256, ks, AES, EVP_AES_KEY,
86 86
87#define IMPLEMENT_AES_CFBR(ksize,cbits,flags) IMPLEMENT_CFBR(aes,AES,EVP_AES_KEY,ks,ksize,cbits,16,flags) 87#define IMPLEMENT_AES_CFBR(ksize,cbits,flags) IMPLEMENT_CFBR(aes,AES,EVP_AES_KEY,ks,ksize,cbits,16,flags)
88 88
89IMPLEMENT_AES_CFBR(128,1,EVP_CIPH_FLAG_FIPS) 89IMPLEMENT_AES_CFBR(128,1,0)
90IMPLEMENT_AES_CFBR(192,1,EVP_CIPH_FLAG_FIPS) 90IMPLEMENT_AES_CFBR(192,1,0)
91IMPLEMENT_AES_CFBR(256,1,EVP_CIPH_FLAG_FIPS) 91IMPLEMENT_AES_CFBR(256,1,0)
92 92
93IMPLEMENT_AES_CFBR(128,8,EVP_CIPH_FLAG_FIPS) 93IMPLEMENT_AES_CFBR(128,8,EVP_CIPH_FLAG_FIPS)
94IMPLEMENT_AES_CFBR(192,8,EVP_CIPH_FLAG_FIPS) 94IMPLEMENT_AES_CFBR(192,8,EVP_CIPH_FLAG_FIPS)
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..3c7713b181
--- /dev/null
+++ b/src/lib/libcrypto/evp/e_rc5.c
@@ -0,0 +1,125 @@
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#ifndef OPENSSL_NO_RC5
60
61#include <stdio.h>
62#include "cryptlib.h"
63#include <openssl/evp.h>
64#include <openssl/objects.h>
65#include "evp_locl.h"
66#include <openssl/rc5.h>
67
68static int r_32_12_16_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
69 const unsigned char *iv,int enc);
70static int rc5_ctrl(EVP_CIPHER_CTX *c, int type, int arg, void *ptr);
71
72typedef struct
73 {
74 int rounds; /* number of rounds */
75 RC5_32_KEY ks; /* key schedule */
76 } EVP_RC5_KEY;
77
78#define data(ctx) EVP_C_DATA(EVP_RC5_KEY,ctx)
79
80IMPLEMENT_BLOCK_CIPHER(rc5_32_12_16, ks, RC5_32, EVP_RC5_KEY, NID_rc5,
81 8, RC5_32_KEY_LENGTH, 8, 64,
82 EVP_CIPH_VARIABLE_LENGTH | EVP_CIPH_CTRL_INIT,
83 r_32_12_16_init_key, NULL,
84 NULL, NULL, rc5_ctrl)
85
86static int rc5_ctrl(EVP_CIPHER_CTX *c, int type, int arg, void *ptr)
87 {
88 switch(type)
89 {
90 case EVP_CTRL_INIT:
91 data(c)->rounds = RC5_12_ROUNDS;
92 return 1;
93
94 case EVP_CTRL_GET_RC5_ROUNDS:
95 *(int *)ptr = data(c)->rounds;
96 return 1;
97
98 case EVP_CTRL_SET_RC5_ROUNDS:
99 switch(arg)
100 {
101 case RC5_8_ROUNDS:
102 case RC5_12_ROUNDS:
103 case RC5_16_ROUNDS:
104 data(c)->rounds = arg;
105 return 1;
106
107 default:
108 EVPerr(EVP_F_RC5_CTRL, EVP_R_UNSUPORTED_NUMBER_OF_ROUNDS);
109 return 0;
110 }
111
112 default:
113 return -1;
114 }
115 }
116
117static int r_32_12_16_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
118 const unsigned char *iv, int enc)
119 {
120 RC5_32_set_key(&data(ctx)->ks,EVP_CIPHER_CTX_key_length(ctx),
121 key,data(ctx)->rounds);
122 return 1;
123 }
124
125#endif
diff --git a/src/lib/libcrypto/evp/encode.c b/src/lib/libcrypto/evp/encode.c
index 33e540087d..08209357ce 100644
--- a/src/lib/libcrypto/evp/encode.c
+++ b/src/lib/libcrypto/evp/encode.c
@@ -313,7 +313,7 @@ int EVP_DecodeUpdate(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl,
313 /* There will never be more than two '=' */ 313 /* There will never be more than two '=' */
314 } 314 }
315 315
316 if ((v == B64_EOF && (n&3) == 0) || (n >= 64)) 316 if ((v == B64_EOF) || (n >= 64))
317 { 317 {
318 /* This is needed to work correctly on 64 byte input 318 /* This is needed to work correctly on 64 byte input
319 * lines. We process the line and then need to 319 * lines. We process the line and then need to
diff --git a/src/lib/libcrypto/evp/evp.h b/src/lib/libcrypto/evp/evp.h
index 56eec23fef..09e597f631 100644
--- a/src/lib/libcrypto/evp/evp.h
+++ b/src/lib/libcrypto/evp/evp.h
@@ -74,52 +74,6 @@
74#ifndef OPENSSL_NO_BIO 74#ifndef OPENSSL_NO_BIO
75#include <openssl/bio.h> 75#include <openssl/bio.h>
76#endif 76#endif
77#ifndef OPENSSL_NO_MD2
78#include <openssl/md2.h>
79#endif
80#ifndef OPENSSL_NO_MD4
81#include <openssl/md4.h>
82#endif
83#ifndef OPENSSL_NO_MD5
84#include <openssl/md5.h>
85#endif
86#ifndef OPENSSL_NO_SHA
87#ifndef OPENSSL_FIPS
88#include <openssl/sha.h>
89#else
90#include <openssl/fips_sha.h>
91#endif
92#endif
93#ifndef OPENSSL_NO_RIPEMD
94#include <openssl/ripemd.h>
95#endif
96#ifndef OPENSSL_NO_DES
97#include <openssl/des.h>
98#endif
99#ifndef OPENSSL_NO_RC4
100#include <openssl/rc4.h>
101#endif
102#ifndef OPENSSL_NO_RC2
103#include <openssl/rc2.h>
104#endif
105#ifndef OPENSSL_NO_RC5
106#include <openssl/rc5.h>
107#endif
108#ifndef OPENSSL_NO_BF
109#include <openssl/blowfish.h>
110#endif
111#ifndef OPENSSL_NO_CAST
112#include <openssl/cast.h>
113#endif
114#ifndef OPENSSL_NO_IDEA
115#include <openssl/idea.h>
116#endif
117#ifndef OPENSSL_NO_MDC2
118#include <openssl/mdc2.h>
119#endif
120#ifndef OPENSSL_NO_AES
121#include <openssl/aes.h>
122#endif
123 77
124#ifdef OPENSSL_FIPS 78#ifdef OPENSSL_FIPS
125#include <openssl/fips.h> 79#include <openssl/fips.h>
@@ -132,11 +86,7 @@
132#define EVP_CAST5_KEY_SIZE 16 86#define EVP_CAST5_KEY_SIZE 16
133#define EVP_RC5_32_12_16_KEY_SIZE 16 87#define EVP_RC5_32_12_16_KEY_SIZE 16
134*/ 88*/
135#ifdef OPENSSL_FIPS 89#define EVP_MAX_MD_SIZE 64 /* to fit SHA512 */
136#define EVP_MAX_MD_SIZE 64 /* longest known SHA512 */
137#else
138#define EVP_MAX_MD_SIZE (16+20) /* The SSLv3 md5+sha1 type */
139#endif
140#define EVP_MAX_KEY_LENGTH 32 90#define EVP_MAX_KEY_LENGTH 32
141#define EVP_MAX_IV_LENGTH 16 91#define EVP_MAX_IV_LENGTH 16
142#define EVP_MAX_BLOCK_LENGTH 32 92#define EVP_MAX_BLOCK_LENGTH 32
@@ -145,18 +95,6 @@
145/* Default PKCS#5 iteration count */ 95/* Default PKCS#5 iteration count */
146#define PKCS5_DEFAULT_ITER 2048 96#define PKCS5_DEFAULT_ITER 2048
147 97
148#ifndef OPENSSL_NO_RSA
149#include <openssl/rsa.h>
150#endif
151
152#ifndef OPENSSL_NO_DSA
153#include <openssl/dsa.h>
154#endif
155
156#ifndef OPENSSL_NO_DH
157#include <openssl/dh.h>
158#endif
159
160#include <openssl/objects.h> 98#include <openssl/objects.h>
161 99
162#define EVP_PK_RSA 0x0001 100#define EVP_PK_RSA 0x0001
@@ -402,6 +340,7 @@ struct evp_cipher_st
402#define EVP_CTRL_SET_RC2_KEY_BITS 0x3 340#define EVP_CTRL_SET_RC2_KEY_BITS 0x3
403#define EVP_CTRL_GET_RC5_ROUNDS 0x4 341#define EVP_CTRL_GET_RC5_ROUNDS 0x4
404#define EVP_CTRL_SET_RC5_ROUNDS 0x5 342#define EVP_CTRL_SET_RC5_ROUNDS 0x5
343#define EVP_CTRL_SET_ACSS_MODE 0x6
405 344
406typedef struct evp_cipher_info_st 345typedef struct evp_cipher_info_st
407 { 346 {
@@ -650,16 +589,6 @@ const EVP_MD *EVP_sha(void);
650const EVP_MD *EVP_sha1(void); 589const EVP_MD *EVP_sha1(void);
651const EVP_MD *EVP_dss(void); 590const EVP_MD *EVP_dss(void);
652const EVP_MD *EVP_dss1(void); 591const EVP_MD *EVP_dss1(void);
653#ifdef OPENSSL_FIPS
654#ifndef OPENSSL_NO_SHA256
655const EVP_MD *EVP_sha224(void);
656const EVP_MD *EVP_sha256(void);
657#endif
658#ifndef OPENSSL_NO_SHA512
659const EVP_MD *EVP_sha384(void);
660const EVP_MD *EVP_sha512(void);
661#endif
662#endif
663#endif 592#endif
664#ifndef OPENSSL_NO_MDC2 593#ifndef OPENSSL_NO_MDC2
665const EVP_MD *EVP_mdc2(void); 594const EVP_MD *EVP_mdc2(void);
@@ -778,6 +707,9 @@ const EVP_CIPHER *EVP_aes_256_ofb(void);
778const EVP_CIPHER *EVP_aes_256_ctr(void); 707const EVP_CIPHER *EVP_aes_256_ctr(void);
779#endif 708#endif
780#endif 709#endif
710#ifndef OPENSSL_NO_ACSS
711const EVP_CIPHER *EVP_acss(void);
712#endif
781 713
782void OPENSSL_add_all_algorithms_noconf(void); 714void OPENSSL_add_all_algorithms_noconf(void);
783void OPENSSL_add_all_algorithms_conf(void); 715void OPENSSL_add_all_algorithms_conf(void);
diff --git a/src/lib/libcrypto/evp/evp_acnf.c b/src/lib/libcrypto/evp/evp_acnf.c
new file mode 100644
index 0000000000..ff3e311cc5
--- /dev/null
+++ b/src/lib/libcrypto/evp/evp_acnf.c
@@ -0,0 +1,73 @@
1/* evp_acnf.c */
2/* Written by Stephen Henson (shenson@bigfoot.com) 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 77eee070d3..40135d0729 100644
--- a/src/lib/libcrypto/evp/evp_err.c
+++ b/src/lib/libcrypto/evp/evp_err.c
@@ -64,92 +64,88 @@
64 64
65/* BEGIN ERROR CODES */ 65/* BEGIN ERROR CODES */
66#ifndef OPENSSL_NO_ERR 66#ifndef OPENSSL_NO_ERR
67
68#define ERR_FUNC(func) ERR_PACK(ERR_LIB_EVP,func,0)
69#define ERR_REASON(reason) ERR_PACK(ERR_LIB_EVP,0,reason)
70
71static ERR_STRING_DATA EVP_str_functs[]= 67static ERR_STRING_DATA EVP_str_functs[]=
72 { 68 {
73{ERR_FUNC(EVP_F_AES_INIT_KEY), "AES_INIT_KEY"}, 69{ERR_PACK(0,EVP_F_AES_INIT_KEY,0), "AES_INIT_KEY"},
74{ERR_FUNC(EVP_F_D2I_PKEY), "D2I_PKEY"}, 70{ERR_PACK(0,EVP_F_D2I_PKEY,0), "D2I_PKEY"},
75{ERR_FUNC(EVP_F_EVP_ADD_CIPHER), "EVP_add_cipher"}, 71{ERR_PACK(0,EVP_F_EVP_ADD_CIPHER,0), "EVP_add_cipher"},
76{ERR_FUNC(EVP_F_EVP_ADD_DIGEST), "EVP_add_digest"}, 72{ERR_PACK(0,EVP_F_EVP_ADD_DIGEST,0), "EVP_add_digest"},
77{ERR_FUNC(EVP_F_EVP_CIPHERINIT), "EVP_CipherInit"}, 73{ERR_PACK(0,EVP_F_EVP_CIPHERINIT,0), "EVP_CipherInit"},
78{ERR_FUNC(EVP_F_EVP_CIPHER_CTX_CTRL), "EVP_CIPHER_CTX_ctrl"}, 74{ERR_PACK(0,EVP_F_EVP_CIPHER_CTX_CTRL,0), "EVP_CIPHER_CTX_ctrl"},
79{ERR_FUNC(EVP_F_EVP_CIPHER_CTX_SET_KEY_LENGTH), "EVP_CIPHER_CTX_set_key_length"}, 75{ERR_PACK(0,EVP_F_EVP_CIPHER_CTX_SET_KEY_LENGTH,0), "EVP_CIPHER_CTX_set_key_length"},
80{ERR_FUNC(EVP_F_EVP_DECRYPTFINAL), "EVP_DecryptFinal"}, 76{ERR_PACK(0,EVP_F_EVP_DECRYPTFINAL,0), "EVP_DecryptFinal"},
81{ERR_FUNC(EVP_F_EVP_DIGESTINIT), "EVP_DigestInit"}, 77{ERR_PACK(0,EVP_F_EVP_DIGESTINIT,0), "EVP_DigestInit"},
82{ERR_FUNC(EVP_F_EVP_ENCRYPTFINAL), "EVP_EncryptFinal"}, 78{ERR_PACK(0,EVP_F_EVP_ENCRYPTFINAL,0), "EVP_EncryptFinal"},
83{ERR_FUNC(EVP_F_EVP_GET_CIPHERBYNAME), "EVP_get_cipherbyname"}, 79{ERR_PACK(0,EVP_F_EVP_GET_CIPHERBYNAME,0), "EVP_get_cipherbyname"},
84{ERR_FUNC(EVP_F_EVP_GET_DIGESTBYNAME), "EVP_get_digestbyname"}, 80{ERR_PACK(0,EVP_F_EVP_GET_DIGESTBYNAME,0), "EVP_get_digestbyname"},
85{ERR_FUNC(EVP_F_EVP_MD_CTX_COPY), "EVP_MD_CTX_copy"}, 81{ERR_PACK(0,EVP_F_EVP_MD_CTX_COPY,0), "EVP_MD_CTX_copy"},
86{ERR_FUNC(EVP_F_EVP_OPENINIT), "EVP_OpenInit"}, 82{ERR_PACK(0,EVP_F_EVP_OPENINIT,0), "EVP_OpenInit"},
87{ERR_FUNC(EVP_F_EVP_PBE_ALG_ADD), "EVP_PBE_alg_add"}, 83{ERR_PACK(0,EVP_F_EVP_PBE_ALG_ADD,0), "EVP_PBE_alg_add"},
88{ERR_FUNC(EVP_F_EVP_PBE_CIPHERINIT), "EVP_PBE_CipherInit"}, 84{ERR_PACK(0,EVP_F_EVP_PBE_CIPHERINIT,0), "EVP_PBE_CipherInit"},
89{ERR_FUNC(EVP_F_EVP_PKCS82PKEY), "EVP_PKCS82PKEY"}, 85{ERR_PACK(0,EVP_F_EVP_PKCS82PKEY,0), "EVP_PKCS82PKEY"},
90{ERR_FUNC(EVP_F_EVP_PKCS8_SET_BROKEN), "EVP_PKCS8_SET_BROKEN"}, 86{ERR_PACK(0,EVP_F_EVP_PKCS8_SET_BROKEN,0), "EVP_PKCS8_SET_BROKEN"},
91{ERR_FUNC(EVP_F_EVP_PKEY2PKCS8), "EVP_PKEY2PKCS8"}, 87{ERR_PACK(0,EVP_F_EVP_PKEY2PKCS8,0), "EVP_PKEY2PKCS8"},
92{ERR_FUNC(EVP_F_EVP_PKEY_COPY_PARAMETERS), "EVP_PKEY_copy_parameters"}, 88{ERR_PACK(0,EVP_F_EVP_PKEY_COPY_PARAMETERS,0), "EVP_PKEY_copy_parameters"},
93{ERR_FUNC(EVP_F_EVP_PKEY_DECRYPT), "EVP_PKEY_decrypt"}, 89{ERR_PACK(0,EVP_F_EVP_PKEY_DECRYPT,0), "EVP_PKEY_decrypt"},
94{ERR_FUNC(EVP_F_EVP_PKEY_ENCRYPT), "EVP_PKEY_encrypt"}, 90{ERR_PACK(0,EVP_F_EVP_PKEY_ENCRYPT,0), "EVP_PKEY_encrypt"},
95{ERR_FUNC(EVP_F_EVP_PKEY_GET1_DH), "EVP_PKEY_get1_DH"}, 91{ERR_PACK(0,EVP_F_EVP_PKEY_GET1_DH,0), "EVP_PKEY_get1_DH"},
96{ERR_FUNC(EVP_F_EVP_PKEY_GET1_DSA), "EVP_PKEY_get1_DSA"}, 92{ERR_PACK(0,EVP_F_EVP_PKEY_GET1_DSA,0), "EVP_PKEY_get1_DSA"},
97{ERR_FUNC(EVP_F_EVP_PKEY_GET1_RSA), "EVP_PKEY_get1_RSA"}, 93{ERR_PACK(0,EVP_F_EVP_PKEY_GET1_RSA,0), "EVP_PKEY_get1_RSA"},
98{ERR_FUNC(EVP_F_EVP_PKEY_NEW), "EVP_PKEY_new"}, 94{ERR_PACK(0,EVP_F_EVP_PKEY_NEW,0), "EVP_PKEY_new"},
99{ERR_FUNC(EVP_F_EVP_RIJNDAEL), "EVP_RIJNDAEL"}, 95{ERR_PACK(0,EVP_F_EVP_RIJNDAEL,0), "EVP_RIJNDAEL"},
100{ERR_FUNC(EVP_F_EVP_SIGNFINAL), "EVP_SignFinal"}, 96{ERR_PACK(0,EVP_F_EVP_SIGNFINAL,0), "EVP_SignFinal"},
101{ERR_FUNC(EVP_F_EVP_VERIFYFINAL), "EVP_VerifyFinal"}, 97{ERR_PACK(0,EVP_F_EVP_VERIFYFINAL,0), "EVP_VerifyFinal"},
102{ERR_FUNC(EVP_F_PKCS5_PBE_KEYIVGEN), "PKCS5_PBE_keyivgen"}, 98{ERR_PACK(0,EVP_F_PKCS5_PBE_KEYIVGEN,0), "PKCS5_PBE_keyivgen"},
103{ERR_FUNC(EVP_F_PKCS5_V2_PBE_KEYIVGEN), "PKCS5_v2_PBE_keyivgen"}, 99{ERR_PACK(0,EVP_F_PKCS5_V2_PBE_KEYIVGEN,0), "PKCS5_v2_PBE_keyivgen"},
104{ERR_FUNC(EVP_F_RC2_MAGIC_TO_METH), "RC2_MAGIC_TO_METH"}, 100{ERR_PACK(0,EVP_F_RC2_MAGIC_TO_METH,0), "RC2_MAGIC_TO_METH"},
105{ERR_FUNC(EVP_F_RC5_CTRL), "RC5_CTRL"}, 101{ERR_PACK(0,EVP_F_RC5_CTRL,0), "RC5_CTRL"},
106{0,NULL} 102{0,NULL}
107 }; 103 };
108 104
109static ERR_STRING_DATA EVP_str_reasons[]= 105static ERR_STRING_DATA EVP_str_reasons[]=
110 { 106 {
111{ERR_REASON(EVP_R_AES_KEY_SETUP_FAILED) ,"aes key setup failed"}, 107{EVP_R_AES_KEY_SETUP_FAILED ,"aes key setup failed"},
112{ERR_REASON(EVP_R_BAD_BLOCK_LENGTH) ,"bad block length"}, 108{EVP_R_BAD_BLOCK_LENGTH ,"bad block length"},
113{ERR_REASON(EVP_R_BAD_DECRYPT) ,"bad decrypt"}, 109{EVP_R_BAD_DECRYPT ,"bad decrypt"},
114{ERR_REASON(EVP_R_BAD_KEY_LENGTH) ,"bad key length"}, 110{EVP_R_BAD_KEY_LENGTH ,"bad key length"},
115{ERR_REASON(EVP_R_BN_DECODE_ERROR) ,"bn decode error"}, 111{EVP_R_BN_DECODE_ERROR ,"bn decode error"},
116{ERR_REASON(EVP_R_BN_PUBKEY_ERROR) ,"bn pubkey error"}, 112{EVP_R_BN_PUBKEY_ERROR ,"bn pubkey error"},
117{ERR_REASON(EVP_R_CIPHER_PARAMETER_ERROR),"cipher parameter error"}, 113{EVP_R_CIPHER_PARAMETER_ERROR ,"cipher parameter error"},
118{ERR_REASON(EVP_R_CTRL_NOT_IMPLEMENTED) ,"ctrl not implemented"}, 114{EVP_R_CTRL_NOT_IMPLEMENTED ,"ctrl not implemented"},
119{ERR_REASON(EVP_R_CTRL_OPERATION_NOT_IMPLEMENTED),"ctrl operation not implemented"}, 115{EVP_R_CTRL_OPERATION_NOT_IMPLEMENTED ,"ctrl operation not implemented"},
120{ERR_REASON(EVP_R_DATA_NOT_MULTIPLE_OF_BLOCK_LENGTH),"data not multiple of block length"}, 116{EVP_R_DATA_NOT_MULTIPLE_OF_BLOCK_LENGTH ,"data not multiple of block length"},
121{ERR_REASON(EVP_R_DECODE_ERROR) ,"decode error"}, 117{EVP_R_DECODE_ERROR ,"decode error"},
122{ERR_REASON(EVP_R_DIFFERENT_KEY_TYPES) ,"different key types"}, 118{EVP_R_DIFFERENT_KEY_TYPES ,"different key types"},
123{ERR_REASON(EVP_R_DISABLED_FOR_FIPS) ,"disabled for fips"}, 119{EVP_R_DISABLED_FOR_FIPS ,"disabled for fips"},
124{ERR_REASON(EVP_R_ENCODE_ERROR) ,"encode error"}, 120{EVP_R_ENCODE_ERROR ,"encode error"},
125{ERR_REASON(EVP_R_EVP_PBE_CIPHERINIT_ERROR),"evp pbe cipherinit error"}, 121{EVP_R_EVP_PBE_CIPHERINIT_ERROR ,"evp pbe cipherinit error"},
126{ERR_REASON(EVP_R_EXPECTING_AN_RSA_KEY) ,"expecting an rsa key"}, 122{EVP_R_EXPECTING_AN_RSA_KEY ,"expecting an rsa key"},
127{ERR_REASON(EVP_R_EXPECTING_A_DH_KEY) ,"expecting a dh key"}, 123{EVP_R_EXPECTING_A_DH_KEY ,"expecting a dh key"},
128{ERR_REASON(EVP_R_EXPECTING_A_DSA_KEY) ,"expecting a dsa key"}, 124{EVP_R_EXPECTING_A_DSA_KEY ,"expecting a dsa key"},
129{ERR_REASON(EVP_R_INITIALIZATION_ERROR) ,"initialization error"}, 125{EVP_R_INITIALIZATION_ERROR ,"initialization error"},
130{ERR_REASON(EVP_R_INPUT_NOT_INITIALIZED) ,"input not initialized"}, 126{EVP_R_INPUT_NOT_INITIALIZED ,"input not initialized"},
131{ERR_REASON(EVP_R_INVALID_KEY_LENGTH) ,"invalid key length"}, 127{EVP_R_INVALID_KEY_LENGTH ,"invalid key length"},
132{ERR_REASON(EVP_R_IV_TOO_LARGE) ,"iv too large"}, 128{EVP_R_IV_TOO_LARGE ,"iv too large"},
133{ERR_REASON(EVP_R_KEYGEN_FAILURE) ,"keygen failure"}, 129{EVP_R_KEYGEN_FAILURE ,"keygen failure"},
134{ERR_REASON(EVP_R_MISSING_PARAMETERS) ,"missing parameters"}, 130{EVP_R_MISSING_PARAMETERS ,"missing parameters"},
135{ERR_REASON(EVP_R_NO_CIPHER_SET) ,"no cipher set"}, 131{EVP_R_NO_CIPHER_SET ,"no cipher set"},
136{ERR_REASON(EVP_R_NO_DIGEST_SET) ,"no digest set"}, 132{EVP_R_NO_DIGEST_SET ,"no digest set"},
137{ERR_REASON(EVP_R_NO_DSA_PARAMETERS) ,"no dsa parameters"}, 133{EVP_R_NO_DSA_PARAMETERS ,"no dsa parameters"},
138{ERR_REASON(EVP_R_NO_SIGN_FUNCTION_CONFIGURED),"no sign function configured"}, 134{EVP_R_NO_SIGN_FUNCTION_CONFIGURED ,"no sign function configured"},
139{ERR_REASON(EVP_R_NO_VERIFY_FUNCTION_CONFIGURED),"no verify function configured"}, 135{EVP_R_NO_VERIFY_FUNCTION_CONFIGURED ,"no verify function configured"},
140{ERR_REASON(EVP_R_PKCS8_UNKNOWN_BROKEN_TYPE),"pkcs8 unknown broken type"}, 136{EVP_R_PKCS8_UNKNOWN_BROKEN_TYPE ,"pkcs8 unknown broken type"},
141{ERR_REASON(EVP_R_PUBLIC_KEY_NOT_RSA) ,"public key not rsa"}, 137{EVP_R_PUBLIC_KEY_NOT_RSA ,"public key not rsa"},
142{ERR_REASON(EVP_R_UNKNOWN_PBE_ALGORITHM) ,"unknown pbe algorithm"}, 138{EVP_R_UNKNOWN_PBE_ALGORITHM ,"unknown pbe algorithm"},
143{ERR_REASON(EVP_R_UNSUPORTED_NUMBER_OF_ROUNDS),"unsuported number of rounds"}, 139{EVP_R_UNSUPORTED_NUMBER_OF_ROUNDS ,"unsuported number of rounds"},
144{ERR_REASON(EVP_R_UNSUPPORTED_CIPHER) ,"unsupported cipher"}, 140{EVP_R_UNSUPPORTED_CIPHER ,"unsupported cipher"},
145{ERR_REASON(EVP_R_UNSUPPORTED_KEYLENGTH) ,"unsupported keylength"}, 141{EVP_R_UNSUPPORTED_KEYLENGTH ,"unsupported keylength"},
146{ERR_REASON(EVP_R_UNSUPPORTED_KEY_DERIVATION_FUNCTION),"unsupported key derivation function"}, 142{EVP_R_UNSUPPORTED_KEY_DERIVATION_FUNCTION,"unsupported key derivation function"},
147{ERR_REASON(EVP_R_UNSUPPORTED_KEY_SIZE) ,"unsupported key size"}, 143{EVP_R_UNSUPPORTED_KEY_SIZE ,"unsupported key size"},
148{ERR_REASON(EVP_R_UNSUPPORTED_PRF) ,"unsupported prf"}, 144{EVP_R_UNSUPPORTED_PRF ,"unsupported prf"},
149{ERR_REASON(EVP_R_UNSUPPORTED_PRIVATE_KEY_ALGORITHM),"unsupported private key algorithm"}, 145{EVP_R_UNSUPPORTED_PRIVATE_KEY_ALGORITHM ,"unsupported private key algorithm"},
150{ERR_REASON(EVP_R_UNSUPPORTED_SALT_TYPE) ,"unsupported salt type"}, 146{EVP_R_UNSUPPORTED_SALT_TYPE ,"unsupported salt type"},
151{ERR_REASON(EVP_R_WRONG_FINAL_BLOCK_LENGTH),"wrong final block length"}, 147{EVP_R_WRONG_FINAL_BLOCK_LENGTH ,"wrong final block length"},
152{ERR_REASON(EVP_R_WRONG_PUBLIC_KEY_TYPE) ,"wrong public key type"}, 148{EVP_R_WRONG_PUBLIC_KEY_TYPE ,"wrong public key type"},
153{0,NULL} 149{0,NULL}
154 }; 150 };
155 151
@@ -163,8 +159,8 @@ void ERR_load_EVP_strings(void)
163 { 159 {
164 init=0; 160 init=0;
165#ifndef OPENSSL_NO_ERR 161#ifndef OPENSSL_NO_ERR
166 ERR_load_strings(0,EVP_str_functs); 162 ERR_load_strings(ERR_LIB_EVP,EVP_str_functs);
167 ERR_load_strings(0,EVP_str_reasons); 163 ERR_load_strings(ERR_LIB_EVP,EVP_str_reasons);
168#endif 164#endif
169 165
170 } 166 }
diff --git a/src/lib/libcrypto/evp/evp_key.c b/src/lib/libcrypto/evp/evp_key.c
index f8650d5df6..5f387a94d3 100644
--- a/src/lib/libcrypto/evp/evp_key.c
+++ b/src/lib/libcrypto/evp/evp_key.c
@@ -126,8 +126,7 @@ int EVP_BytesToKey(const EVP_CIPHER *type, const EVP_MD *md,
126 EVP_MD_CTX_init(&c); 126 EVP_MD_CTX_init(&c);
127 for (;;) 127 for (;;)
128 { 128 {
129 if (!EVP_DigestInit_ex(&c,md, NULL)) 129 EVP_DigestInit_ex(&c,md, NULL);
130 return 0;
131 if (addmd++) 130 if (addmd++)
132 EVP_DigestUpdate(&c,&(md_buf[0]),mds); 131 EVP_DigestUpdate(&c,&(md_buf[0]),mds);
133 EVP_DigestUpdate(&c,data,datal); 132 EVP_DigestUpdate(&c,data,datal);
diff --git a/src/lib/libcrypto/evp/evp_test.c b/src/lib/libcrypto/evp/evp_test.c
new file mode 100644
index 0000000000..a624cfd248
--- /dev/null
+++ b/src/lib/libcrypto/evp/evp_test.c
@@ -0,0 +1,422 @@
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/evp.h>
56#ifndef OPENSSL_NO_ENGINE
57#include <openssl/engine.h>
58#endif
59#include <openssl/err.h>
60#include <openssl/conf.h>
61
62static void hexdump(FILE *f,const char *title,const unsigned char *s,int l)
63 {
64 int n=0;
65
66 fprintf(f,"%s",title);
67 for( ; n < l ; ++n)
68 {
69 if((n%16) == 0)
70 fprintf(f,"\n%04x",n);
71 fprintf(f," %02x",s[n]);
72 }
73 fprintf(f,"\n");
74 }
75
76static int convert(unsigned char *s)
77 {
78 unsigned char *d;
79
80 for(d=s ; *s ; s+=2,++d)
81 {
82 unsigned int n;
83
84 if(!s[1])
85 {
86 fprintf(stderr,"Odd number of hex digits!");
87 EXIT(4);
88 }
89 sscanf((char *)s,"%2x",&n);
90 *d=(unsigned char)n;
91 }
92 return s-d;
93 }
94
95static char *sstrsep(char **string, const char *delim)
96 {
97 char isdelim[256];
98 char *token = *string;
99
100 if (**string == 0)
101 return NULL;
102
103 memset(isdelim, 0, 256);
104 isdelim[0] = 1;
105
106 while (*delim)
107 {
108 isdelim[(unsigned char)(*delim)] = 1;
109 delim++;
110 }
111
112 while (!isdelim[(unsigned char)(**string)])
113 {
114 (*string)++;
115 }
116
117 if (**string)
118 {
119 **string = 0;
120 (*string)++;
121 }
122
123 return token;
124 }
125
126static unsigned char *ustrsep(char **p,const char *sep)
127 { return (unsigned char *)sstrsep(p,sep); }
128
129static int test1_exit(int ec)
130 {
131 EXIT(ec);
132 return(0); /* To keep some compilers quiet */
133 }
134
135static void test1(const EVP_CIPHER *c,const unsigned char *key,int kn,
136 const unsigned char *iv,int in,
137 const unsigned char *plaintext,int pn,
138 const unsigned char *ciphertext,int cn,
139 int encdec,int multiplier)
140 {
141 EVP_CIPHER_CTX ctx;
142 unsigned char out[4096];
143 int outl,outl2;
144
145 printf("Testing cipher %s%s\n",EVP_CIPHER_name(c),
146 (encdec == 1 ? "(encrypt)" : (encdec == 0 ? "(decrypt)" : "(encrypt/decrypt)")));
147 hexdump(stdout,"Key",key,kn);
148 if(in)
149 hexdump(stdout,"IV",iv,in);
150 hexdump(stdout,"Plaintext",plaintext,pn);
151 hexdump(stdout,"Ciphertext",ciphertext,cn);
152
153 if(kn != c->key_len)
154 {
155 fprintf(stderr,"Key length doesn't match, got %d expected %d\n",kn,
156 c->key_len);
157 test1_exit(5);
158 }
159 EVP_CIPHER_CTX_init(&ctx);
160 if (encdec != 0)
161 {
162 if(!EVP_EncryptInit_ex(&ctx,c,NULL,key,iv))
163 {
164 fprintf(stderr,"EncryptInit failed\n");
165 ERR_print_errors_fp(stderr);
166 test1_exit(10);
167 }
168 EVP_CIPHER_CTX_set_padding(&ctx,0);
169
170 if(!EVP_EncryptUpdate(&ctx,out,&outl,plaintext,pn*multiplier))
171 {
172 fprintf(stderr,"Encrypt failed\n");
173 ERR_print_errors_fp(stderr);
174 test1_exit(6);
175 }
176 if(!EVP_EncryptFinal_ex(&ctx,out+outl,&outl2))
177 {
178 fprintf(stderr,"EncryptFinal failed\n");
179 ERR_print_errors_fp(stderr);
180 test1_exit(7);
181 }
182
183 if(outl+outl2 != cn*multiplier)
184 {
185 fprintf(stderr,"Ciphertext length mismatch got %d expected %d\n",
186 outl+outl2,cn);
187 test1_exit(8);
188 }
189
190 if(memcmp(out,ciphertext,cn))
191 {
192 fprintf(stderr,"Ciphertext mismatch\n");
193 hexdump(stderr,"Got",out,cn);
194 hexdump(stderr,"Expected",ciphertext,cn);
195 test1_exit(9);
196 }
197 }
198
199 if (encdec <= 0)
200 {
201 if(!EVP_DecryptInit_ex(&ctx,c,NULL,key,iv))
202 {
203 fprintf(stderr,"DecryptInit failed\n");
204 ERR_print_errors_fp(stderr);
205 test1_exit(11);
206 }
207 EVP_CIPHER_CTX_set_padding(&ctx,0);
208
209 if(!EVP_DecryptUpdate(&ctx,out,&outl,ciphertext,cn*multiplier))
210 {
211 fprintf(stderr,"Decrypt failed\n");
212 ERR_print_errors_fp(stderr);
213 test1_exit(6);
214 }
215 if(!EVP_DecryptFinal_ex(&ctx,out+outl,&outl2))
216 {
217 fprintf(stderr,"DecryptFinal failed\n");
218 ERR_print_errors_fp(stderr);
219 test1_exit(7);
220 }
221
222 if(outl+outl2 != cn*multiplier)
223 {
224 fprintf(stderr,"Plaintext length mismatch got %d expected %d\n",
225 outl+outl2,cn);
226 test1_exit(8);
227 }
228
229 if(memcmp(out,plaintext,cn))
230 {
231 fprintf(stderr,"Plaintext mismatch\n");
232 hexdump(stderr,"Got",out,cn);
233 hexdump(stderr,"Expected",plaintext,cn);
234 test1_exit(9);
235 }
236 }
237
238 EVP_CIPHER_CTX_cleanup(&ctx);
239
240 printf("\n");
241 }
242
243static int test_cipher(const char *cipher,const unsigned char *key,int kn,
244 const unsigned char *iv,int in,
245 const unsigned char *plaintext,int pn,
246 const unsigned char *ciphertext,int cn,
247 int encdec,int multiplier)
248 {
249 const EVP_CIPHER *c;
250
251 c=EVP_get_cipherbyname(cipher);
252 if(!c)
253 return 0;
254
255 test1(c,key,kn,iv,in,plaintext,pn,ciphertext,cn,encdec,multiplier);
256
257 return 1;
258 }
259
260static int test_digest(const char *digest,
261 const unsigned char *plaintext,int pn,
262 const unsigned char *ciphertext, unsigned int cn)
263 {
264 const EVP_MD *d;
265 EVP_MD_CTX ctx;
266 unsigned char md[EVP_MAX_MD_SIZE];
267 unsigned int mdn;
268
269 d=EVP_get_digestbyname(digest);
270 if(!d)
271 return 0;
272
273 printf("Testing digest %s\n",EVP_MD_name(d));
274 hexdump(stdout,"Plaintext",plaintext,pn);
275 hexdump(stdout,"Digest",ciphertext,cn);
276
277 EVP_MD_CTX_init(&ctx);
278 if(!EVP_DigestInit_ex(&ctx,d, NULL))
279 {
280 fprintf(stderr,"DigestInit failed\n");
281 ERR_print_errors_fp(stderr);
282 EXIT(100);
283 }
284 if(!EVP_DigestUpdate(&ctx,plaintext,pn))
285 {
286 fprintf(stderr,"DigestUpdate failed\n");
287 ERR_print_errors_fp(stderr);
288 EXIT(101);
289 }
290 if(!EVP_DigestFinal_ex(&ctx,md,&mdn))
291 {
292 fprintf(stderr,"DigestFinal failed\n");
293 ERR_print_errors_fp(stderr);
294 EXIT(101);
295 }
296 EVP_MD_CTX_cleanup(&ctx);
297
298 if(mdn != cn)
299 {
300 fprintf(stderr,"Digest length mismatch, got %d expected %d\n",mdn,cn);
301 EXIT(102);
302 }
303
304 if(memcmp(md,ciphertext,cn))
305 {
306 fprintf(stderr,"Digest mismatch\n");
307 hexdump(stderr,"Got",md,cn);
308 hexdump(stderr,"Expected",ciphertext,cn);
309 EXIT(103);
310 }
311
312 printf("\n");
313
314 EVP_MD_CTX_cleanup(&ctx);
315
316 return 1;
317 }
318
319int main(int argc,char **argv)
320 {
321 const char *szTestFile;
322 FILE *f;
323
324 if(argc != 2)
325 {
326 fprintf(stderr,"%s <test file>\n",argv[0]);
327 EXIT(1);
328 }
329 CRYPTO_malloc_debug_init();
330 CRYPTO_set_mem_debug_options(V_CRYPTO_MDEBUG_ALL);
331 CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON);
332
333 szTestFile=argv[1];
334
335 f=fopen(szTestFile,"r");
336 if(!f)
337 {
338 perror(szTestFile);
339 EXIT(2);
340 }
341
342 /* Load up the software EVP_CIPHER and EVP_MD definitions */
343 OpenSSL_add_all_ciphers();
344 OpenSSL_add_all_digests();
345#ifndef OPENSSL_NO_ENGINE
346 /* Load all compiled-in ENGINEs */
347 ENGINE_load_builtin_engines();
348#endif
349#if 0
350 OPENSSL_config();
351#endif
352#ifndef OPENSSL_NO_ENGINE
353 /* Register all available ENGINE implementations of ciphers and digests.
354 * This could perhaps be changed to "ENGINE_register_all_complete()"? */
355 ENGINE_register_all_ciphers();
356 ENGINE_register_all_digests();
357 /* If we add command-line options, this statement should be switchable.
358 * It'll prevent ENGINEs being ENGINE_init()ialised for cipher/digest use if
359 * they weren't already initialised. */
360 /* ENGINE_set_cipher_flags(ENGINE_CIPHER_FLAG_NOINIT); */
361#endif
362
363 for( ; ; )
364 {
365 char line[4096];
366 char *p;
367 char *cipher;
368 unsigned char *iv,*key,*plaintext,*ciphertext;
369 int encdec;
370 int kn,in,pn,cn;
371 int multiplier=1;
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(strchr(cipher,'*'))
397 {
398 p=cipher;
399 sstrsep(&p,"*");
400 multiplier=atoi(sstrsep(&p,"*"));
401 }
402
403 if(!test_cipher(cipher,key,kn,iv,in,plaintext,pn,ciphertext,cn,encdec,
404 multiplier)
405 && !test_digest(cipher,plaintext,pn,ciphertext,cn))
406 {
407 fprintf(stderr,"Can't find %s\n",cipher);
408 EXIT(3);
409 }
410 }
411
412#ifndef OPENSSL_NO_ENGINE
413 ENGINE_cleanup();
414#endif
415 EVP_cleanup();
416 CRYPTO_cleanup_all_ex_data();
417 ERR_remove_state(0);
418 ERR_free_strings();
419 CRYPTO_mem_leaks_fp(stderr);
420
421 return 0;
422 }
diff --git a/src/lib/libcrypto/evp/evptests.txt b/src/lib/libcrypto/evp/evptests.txt
new file mode 100644
index 0000000000..dfe91a5bc0
--- /dev/null
+++ b/src/lib/libcrypto/evp/evptests.txt
@@ -0,0 +1,288 @@
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
96# CFB1-AES128.Encrypt
97
98AES-128-CFB1:2b7e151628aed2a6abf7158809cf4f3c:000102030405060708090a0b0c0d0e0f:00:00:1
99AES-128-CFB1:2b7e151628aed2a6abf7158809cf4f3c:00020406080a0c0e10121416181a1c1e:80:80:1
100AES-128-CFB1:2b7e151628aed2a6abf7158809cf4f3c:0004080c1014181c2024282c3034383d:80:80:1
101AES-128-CFB1:2b7e151628aed2a6abf7158809cf4f3c:0008101820283038404850586068707b:00:00:1
102AES-128-CFB1:2b7e151628aed2a6abf7158809cf4f3c:00102030405060708090a0b0c0d0e0f6:80:80:1
103AES-128-CFB1:2b7e151628aed2a6abf7158809cf4f3c:0020406080a0c0e10121416181a1c1ed:00:00:1
104AES-128-CFB1:2b7e151628aed2a6abf7158809cf4f3c:004080c1014181c2024282c3034383da:80:00:1
105AES-128-CFB1:2b7e151628aed2a6abf7158809cf4f3c:008101820283038404850586068707b4:80:00:1
106AES-128-CFB1:2b7e151628aed2a6abf7158809cf4f3c:0102030405060708090a0b0c0d0e0f68:80:80:1
107AES-128-CFB1:2b7e151628aed2a6abf7158809cf4f3c:020406080a0c0e10121416181a1c1ed1:80:00:1
108AES-128-CFB1:2b7e151628aed2a6abf7158809cf4f3c:04080c1014181c2024282c3034383da2:00:80:1
109AES-128-CFB1:2b7e151628aed2a6abf7158809cf4f3c:08101820283038404850586068707b45:00:80:1
110AES-128-CFB1:2b7e151628aed2a6abf7158809cf4f3c:102030405060708090a0b0c0d0e0f68b:00:00:1
111AES-128-CFB1:2b7e151628aed2a6abf7158809cf4f3c:20406080a0c0e10121416181a1c1ed16:00:00:1
112AES-128-CFB1:2b7e151628aed2a6abf7158809cf4f3c:4080c1014181c2024282c3034383da2c:00:80:1
113AES-128-CFB1:2b7e151628aed2a6abf7158809cf4f3c:8101820283038404850586068707b459:80:80:1
114# all of the above packed into one...
115# in: 0110 1011 1100 0001 = 6bc1
116# out: 0110 1000 1011 0011 = 68b3
117AES-128-CFB1*8:2b7e151628aed2a6abf7158809cf4f3c:000102030405060708090a0b0c0d0e0f:6bc1:68b3:1
118
119# CFB1-AES128.Decrypt
120AES-128-CFB1:2b7e151628aed2a6abf7158809cf4f3c:000102030405060708090a0b0c0d0e0f:00:00:0
121AES-128-CFB1:2b7e151628aed2a6abf7158809cf4f3c:00020406080a0c0e10121416181a1c1e:80:80:0
122AES-128-CFB1:2b7e151628aed2a6abf7158809cf4f3c:0004080c1014181c2024282c3034383d:80:80:0
123AES-128-CFB1:2b7e151628aed2a6abf7158809cf4f3c:0008101820283038404850586068707b:00:00:0
124AES-128-CFB1:2b7e151628aed2a6abf7158809cf4f3c:00102030405060708090a0b0c0d0e0f6:80:80:0
125AES-128-CFB1:2b7e151628aed2a6abf7158809cf4f3c:0020406080a0c0e10121416181a1c1ed:00:00:0
126AES-128-CFB1:2b7e151628aed2a6abf7158809cf4f3c:004080c1014181c2024282c3034383da:80:00:0
127AES-128-CFB1:2b7e151628aed2a6abf7158809cf4f3c:008101820283038404850586068707b4:80:00:0
128AES-128-CFB1:2b7e151628aed2a6abf7158809cf4f3c:0102030405060708090a0b0c0d0e0f68:80:80:0
129AES-128-CFB1:2b7e151628aed2a6abf7158809cf4f3c:020406080a0c0e10121416181a1c1ed1:80:00:0
130AES-128-CFB1:2b7e151628aed2a6abf7158809cf4f3c:04080c1014181c2024282c3034383da2:00:80:0
131AES-128-CFB1:2b7e151628aed2a6abf7158809cf4f3c:08101820283038404850586068707b45:00:80:0
132AES-128-CFB1:2b7e151628aed2a6abf7158809cf4f3c:102030405060708090a0b0c0d0e0f68b:00:00:0
133AES-128-CFB1:2b7e151628aed2a6abf7158809cf4f3c:20406080a0c0e10121416181a1c1ed16:00:00:0
134AES-128-CFB1:2b7e151628aed2a6abf7158809cf4f3c:4080c1014181c2024282c3034383da2c:00:80:0
135AES-128-CFB1:2b7e151628aed2a6abf7158809cf4f3c:8101820283038404850586068707b459:80:80:0
136# all of the above packed into one...
137# in: 0110 1000 1011 0011 = 68b3
138# out: 0110 1011 1100 0001 = 6bc1
139AES-128-CFB1*8:2b7e151628aed2a6abf7158809cf4f3c:000102030405060708090a0b0c0d0e0f:6bc1:68b3:0
140
141# TODO: CFB1-AES192 and 256
142
143# CFB8-AES128.Encrypt
144
145AES-128-CFB8:2b7e151628aed2a6abf7158809cf4f3c:000102030405060708090a0b0c0d0e0f:6b:3b:1
146AES-128-CFB8:2b7e151628aed2a6abf7158809cf4f3c:0102030405060708090a0b0c0d0e0f3b:c1:79:1
147AES-128-CFB8:2b7e151628aed2a6abf7158809cf4f3c:02030405060708090a0b0c0d0e0f3b79:be:42:1
148AES-128-CFB8:2b7e151628aed2a6abf7158809cf4f3c:030405060708090a0b0c0d0e0f3b7942:e2:4c:1
149AES-128-CFB8:2b7e151628aed2a6abf7158809cf4f3c:0405060708090a0b0c0d0e0f3b79424c:2e:9c:1
150AES-128-CFB8:2b7e151628aed2a6abf7158809cf4f3c:05060708090a0b0c0d0e0f3b79424c9c:40:0d:1
151AES-128-CFB8:2b7e151628aed2a6abf7158809cf4f3c:060708090a0b0c0d0e0f3b79424c9c0d:9f:d4:1
152AES-128-CFB8:2b7e151628aed2a6abf7158809cf4f3c:0708090a0b0c0d0e0f3b79424c9c0dd4:96:36:1
153AES-128-CFB8:2b7e151628aed2a6abf7158809cf4f3c:08090a0b0c0d0e0f3b79424c9c0dd436:e9:ba:1
154AES-128-CFB8:2b7e151628aed2a6abf7158809cf4f3c:090a0b0c0d0e0f3b79424c9c0dd436ba:3d:ce:1
155AES-128-CFB8:2b7e151628aed2a6abf7158809cf4f3c:0a0b0c0d0e0f3b79424c9c0dd436bace:7e:9e:1
156AES-128-CFB8:2b7e151628aed2a6abf7158809cf4f3c:0b0c0d0e0f3b79424c9c0dd436bace9e:11:0e:1
157AES-128-CFB8:2b7e151628aed2a6abf7158809cf4f3c:0c0d0e0f3b79424c9c0dd436bace9e0e:73:d4:1
158AES-128-CFB8:2b7e151628aed2a6abf7158809cf4f3c:0d0e0f3b79424c9c0dd436bace9e0ed4:93:58:1
159AES-128-CFB8:2b7e151628aed2a6abf7158809cf4f3c:0e0f3b79424c9c0dd436bace9e0ed458:17:6a:1
160AES-128-CFB8:2b7e151628aed2a6abf7158809cf4f3c:0f3b79424c9c0dd436bace9e0ed4586a:2a:4f:1
161AES-128-CFB8:2b7e151628aed2a6abf7158809cf4f3c:3b79424c9c0dd436bace9e0ed4586a4f:ae:32:1
162AES-128-CFB8:2b7e151628aed2a6abf7158809cf4f3c:79424c9c0dd436bace9e0ed4586a4f32:2d:b9:1
163# all of the above packed into one
164AES-128-CFB8:2b7e151628aed2a6abf7158809cf4f3c:000102030405060708090a0b0c0d0e0f:6bc1bee22e409f96e93d7e117393172aae2d:3b79424c9c0dd436bace9e0ed4586a4f32b9:1
165
166# CFB8-AES128.Decrypt
167
168AES-128-CFB8:2b7e151628aed2a6abf7158809cf4f3c:000102030405060708090a0b0c0d0e0f:6b:3b:0
169AES-128-CFB8:2b7e151628aed2a6abf7158809cf4f3c:0102030405060708090a0b0c0d0e0f3b:c1:79:0
170AES-128-CFB8:2b7e151628aed2a6abf7158809cf4f3c:02030405060708090a0b0c0d0e0f3b79:be:42:0
171AES-128-CFB8:2b7e151628aed2a6abf7158809cf4f3c:030405060708090a0b0c0d0e0f3b7942:e2:4c:0
172AES-128-CFB8:2b7e151628aed2a6abf7158809cf4f3c:0405060708090a0b0c0d0e0f3b79424c:2e:9c:0
173AES-128-CFB8:2b7e151628aed2a6abf7158809cf4f3c:05060708090a0b0c0d0e0f3b79424c9c:40:0d:0
174AES-128-CFB8:2b7e151628aed2a6abf7158809cf4f3c:060708090a0b0c0d0e0f3b79424c9c0d:9f:d4:0
175AES-128-CFB8:2b7e151628aed2a6abf7158809cf4f3c:0708090a0b0c0d0e0f3b79424c9c0dd4:96:36:0
176AES-128-CFB8:2b7e151628aed2a6abf7158809cf4f3c:08090a0b0c0d0e0f3b79424c9c0dd436:e9:ba:0
177AES-128-CFB8:2b7e151628aed2a6abf7158809cf4f3c:090a0b0c0d0e0f3b79424c9c0dd436ba:3d:ce:0
178AES-128-CFB8:2b7e151628aed2a6abf7158809cf4f3c:0a0b0c0d0e0f3b79424c9c0dd436bace:7e:9e:0
179AES-128-CFB8:2b7e151628aed2a6abf7158809cf4f3c:0b0c0d0e0f3b79424c9c0dd436bace9e:11:0e:0
180AES-128-CFB8:2b7e151628aed2a6abf7158809cf4f3c:0c0d0e0f3b79424c9c0dd436bace9e0e:73:d4:0
181AES-128-CFB8:2b7e151628aed2a6abf7158809cf4f3c:0d0e0f3b79424c9c0dd436bace9e0ed4:93:58:0
182AES-128-CFB8:2b7e151628aed2a6abf7158809cf4f3c:0e0f3b79424c9c0dd436bace9e0ed458:17:6a:0
183AES-128-CFB8:2b7e151628aed2a6abf7158809cf4f3c:0f3b79424c9c0dd436bace9e0ed4586a:2a:4f:0
184AES-128-CFB8:2b7e151628aed2a6abf7158809cf4f3c:3b79424c9c0dd436bace9e0ed4586a4f:ae:32:0
185AES-128-CFB8:2b7e151628aed2a6abf7158809cf4f3c:79424c9c0dd436bace9e0ed4586a4f32:2d:b9:0
186# all of the above packed into one
187AES-128-CFB8:2b7e151628aed2a6abf7158809cf4f3c:000102030405060708090a0b0c0d0e0f:6bc1bee22e409f96e93d7e117393172aae2d:3b79424c9c0dd436bace9e0ed4586a4f32b9:0
188
189# TODO: 192 and 256 bit keys
190
191# For all CFB128 encrypts and decrypts, the transformed sequence is
192# AES-bits-CFB:key:IV/ciphertext':plaintext:ciphertext:encdec
193# CFB128-AES128.Encrypt
194AES-128-CFB:2B7E151628AED2A6ABF7158809CF4F3C:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:3B3FD92EB72DAD20333449F8E83CFB4A:1
195AES-128-CFB:2B7E151628AED2A6ABF7158809CF4F3C:3B3FD92EB72DAD20333449F8E83CFB4A:AE2D8A571E03AC9C9EB76FAC45AF8E51:C8A64537A0B3A93FCDE3CDAD9F1CE58B:1
196AES-128-CFB:2B7E151628AED2A6ABF7158809CF4F3C:C8A64537A0B3A93FCDE3CDAD9F1CE58B:30C81C46A35CE411E5FBC1191A0A52EF:26751F67A3CBB140B1808CF187A4F4DF:1
197AES-128-CFB:2B7E151628AED2A6ABF7158809CF4F3C:26751F67A3CBB140B1808CF187A4F4DF:F69F2445DF4F9B17AD2B417BE66C3710:C04B05357C5D1C0EEAC4C66F9FF7F2E6:1
198# CFB128-AES128.Decrypt
199AES-128-CFB:2B7E151628AED2A6ABF7158809CF4F3C:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:3B3FD92EB72DAD20333449F8E83CFB4A:0
200AES-128-CFB:2B7E151628AED2A6ABF7158809CF4F3C:3B3FD92EB72DAD20333449F8E83CFB4A:AE2D8A571E03AC9C9EB76FAC45AF8E51:C8A64537A0B3A93FCDE3CDAD9F1CE58B:0
201AES-128-CFB:2B7E151628AED2A6ABF7158809CF4F3C:C8A64537A0B3A93FCDE3CDAD9F1CE58B:30C81C46A35CE411E5FBC1191A0A52EF:26751F67A3CBB140B1808CF187A4F4DF:0
202AES-128-CFB:2B7E151628AED2A6ABF7158809CF4F3C:26751F67A3CBB140B1808CF187A4F4DF:F69F2445DF4F9B17AD2B417BE66C3710:C04B05357C5D1C0EEAC4C66F9FF7F2E6:0
203# CFB128-AES192.Encrypt
204AES-192-CFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:CDC80D6FDDF18CAB34C25909C99A4174:1
205AES-192-CFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:CDC80D6FDDF18CAB34C25909C99A4174:AE2D8A571E03AC9C9EB76FAC45AF8E51:67CE7F7F81173621961A2B70171D3D7A:1
206AES-192-CFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:67CE7F7F81173621961A2B70171D3D7A:30C81C46A35CE411E5FBC1191A0A52EF:2E1E8A1DD59B88B1C8E60FED1EFAC4C9:1
207AES-192-CFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:2E1E8A1DD59B88B1C8E60FED1EFAC4C9:F69F2445DF4F9B17AD2B417BE66C3710:C05F9F9CA9834FA042AE8FBA584B09FF:1
208# CFB128-AES192.Decrypt
209AES-192-CFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:CDC80D6FDDF18CAB34C25909C99A4174:0
210AES-192-CFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:CDC80D6FDDF18CAB34C25909C99A4174:AE2D8A571E03AC9C9EB76FAC45AF8E51:67CE7F7F81173621961A2B70171D3D7A:0
211AES-192-CFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:67CE7F7F81173621961A2B70171D3D7A:30C81C46A35CE411E5FBC1191A0A52EF:2E1E8A1DD59B88B1C8E60FED1EFAC4C9:0
212AES-192-CFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:2E1E8A1DD59B88B1C8E60FED1EFAC4C9:F69F2445DF4F9B17AD2B417BE66C3710:C05F9F9CA9834FA042AE8FBA584B09FF:0
213# CFB128-AES256.Encrypt
214AES-256-CFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:DC7E84BFDA79164B7ECD8486985D3860:1
215AES-256-CFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:DC7E84BFDA79164B7ECD8486985D3860:AE2D8A571E03AC9C9EB76FAC45AF8E51:39FFED143B28B1C832113C6331E5407B:1
216AES-256-CFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:39FFED143B28B1C832113C6331E5407B:30C81C46A35CE411E5FBC1191A0A52EF:DF10132415E54B92A13ED0A8267AE2F9:1
217AES-256-CFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:DF10132415E54B92A13ED0A8267AE2F9:F69F2445DF4F9B17AD2B417BE66C3710:75A385741AB9CEF82031623D55B1E471:1
218# CFB128-AES256.Decrypt
219AES-256-CFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:DC7E84BFDA79164B7ECD8486985D3860:0
220AES-256-CFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:DC7E84BFDA79164B7ECD8486985D3860:AE2D8A571E03AC9C9EB76FAC45AF8E51:39FFED143B28B1C832113C6331E5407B:0
221AES-256-CFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:39FFED143B28B1C832113C6331E5407B:30C81C46A35CE411E5FBC1191A0A52EF:DF10132415E54B92A13ED0A8267AE2F9:0
222AES-256-CFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:DF10132415E54B92A13ED0A8267AE2F9:F69F2445DF4F9B17AD2B417BE66C3710:75A385741AB9CEF82031623D55B1E471:0
223# For all OFB encrypts and decrypts, the transformed sequence is
224# AES-bits-CFB:key:IV/output':plaintext:ciphertext:encdec
225# OFB-AES128.Encrypt
226AES-128-OFB:2B7E151628AED2A6ABF7158809CF4F3C:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:3B3FD92EB72DAD20333449F8E83CFB4A:1
227AES-128-OFB:2B7E151628AED2A6ABF7158809CF4F3C:50FE67CC996D32B6DA0937E99BAFEC60:AE2D8A571E03AC9C9EB76FAC45AF8E51:7789508D16918F03F53C52DAC54ED825:1
228AES-128-OFB:2B7E151628AED2A6ABF7158809CF4F3C:D9A4DADA0892239F6B8B3D7680E15674:30C81C46A35CE411E5FBC1191A0A52EF:9740051E9C5FECF64344F7A82260EDCC:1
229AES-128-OFB:2B7E151628AED2A6ABF7158809CF4F3C:A78819583F0308E7A6BF36B1386ABF23:F69F2445DF4F9B17AD2B417BE66C3710:304C6528F659C77866A510D9C1D6AE5E:1
230# OFB-AES128.Decrypt
231AES-128-OFB:2B7E151628AED2A6ABF7158809CF4F3C:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:3B3FD92EB72DAD20333449F8E83CFB4A:0
232AES-128-OFB:2B7E151628AED2A6ABF7158809CF4F3C:50FE67CC996D32B6DA0937E99BAFEC60:AE2D8A571E03AC9C9EB76FAC45AF8E51:7789508D16918F03F53C52DAC54ED825:0
233AES-128-OFB:2B7E151628AED2A6ABF7158809CF4F3C:D9A4DADA0892239F6B8B3D7680E15674:30C81C46A35CE411E5FBC1191A0A52EF:9740051E9C5FECF64344F7A82260EDCC:0
234AES-128-OFB:2B7E151628AED2A6ABF7158809CF4F3C:A78819583F0308E7A6BF36B1386ABF23:F69F2445DF4F9B17AD2B417BE66C3710:304C6528F659C77866A510D9C1D6AE5E:0
235# OFB-AES192.Encrypt
236AES-192-OFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:CDC80D6FDDF18CAB34C25909C99A4174:1
237AES-192-OFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:A609B38DF3B1133DDDFF2718BA09565E:AE2D8A571E03AC9C9EB76FAC45AF8E51:FCC28B8D4C63837C09E81700C1100401:1
238AES-192-OFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:52EF01DA52602FE0975F78AC84BF8A50:30C81C46A35CE411E5FBC1191A0A52EF:8D9A9AEAC0F6596F559C6D4DAF59A5F2:1
239AES-192-OFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:BD5286AC63AABD7EB067AC54B553F71D:F69F2445DF4F9B17AD2B417BE66C3710:6D9F200857CA6C3E9CAC524BD9ACC92A:1
240# OFB-AES192.Decrypt
241AES-192-OFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:CDC80D6FDDF18CAB34C25909C99A4174:0
242AES-192-OFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:A609B38DF3B1133DDDFF2718BA09565E:AE2D8A571E03AC9C9EB76FAC45AF8E51:FCC28B8D4C63837C09E81700C1100401:0
243AES-192-OFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:52EF01DA52602FE0975F78AC84BF8A50:30C81C46A35CE411E5FBC1191A0A52EF:8D9A9AEAC0F6596F559C6D4DAF59A5F2:0
244AES-192-OFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:BD5286AC63AABD7EB067AC54B553F71D:F69F2445DF4F9B17AD2B417BE66C3710:6D9F200857CA6C3E9CAC524BD9ACC92A:0
245# OFB-AES256.Encrypt
246AES-256-OFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:DC7E84BFDA79164B7ECD8486985D3860:1
247AES-256-OFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:B7BF3A5DF43989DD97F0FA97EBCE2F4A:AE2D8A571E03AC9C9EB76FAC45AF8E51:4FEBDC6740D20B3AC88F6AD82A4FB08D:1
248AES-256-OFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:E1C656305ED1A7A6563805746FE03EDC:30C81C46A35CE411E5FBC1191A0A52EF:71AB47A086E86EEDF39D1C5BBA97C408:1
249AES-256-OFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:41635BE625B48AFC1666DD42A09D96E7:F69F2445DF4F9B17AD2B417BE66C3710:0126141D67F37BE8538F5A8BE740E484:1
250# OFB-AES256.Decrypt
251AES-256-OFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:DC7E84BFDA79164B7ECD8486985D3860:0
252AES-256-OFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:B7BF3A5DF43989DD97F0FA97EBCE2F4A:AE2D8A571E03AC9C9EB76FAC45AF8E51:4FEBDC6740D20B3AC88F6AD82A4FB08D:0
253AES-256-OFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:E1C656305ED1A7A6563805746FE03EDC:30C81C46A35CE411E5FBC1191A0A52EF:71AB47A086E86EEDF39D1C5BBA97C408:0
254AES-256-OFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:41635BE625B48AFC1666DD42A09D96E7:F69F2445DF4F9B17AD2B417BE66C3710:0126141D67F37BE8538F5A8BE740E484:0
255
256# DES ECB tests (from destest)
257
258DES-ECB:0000000000000000::0000000000000000:8CA64DE9C1B123A7
259DES-ECB:FFFFFFFFFFFFFFFF::FFFFFFFFFFFFFFFF:7359B2163E4EDC58
260DES-ECB:3000000000000000::1000000000000001:958E6E627A05557B
261DES-ECB:1111111111111111::1111111111111111:F40379AB9E0EC533
262DES-ECB:0123456789ABCDEF::1111111111111111:17668DFC7292532D
263DES-ECB:1111111111111111::0123456789ABCDEF:8A5AE1F81AB8F2DD
264DES-ECB:FEDCBA9876543210::0123456789ABCDEF:ED39D950FA74BCC4
265
266# DESX-CBC tests (from destest)
267DESX-CBC:0123456789abcdeff1e0d3c2b5a49786fedcba9876543210:fedcba9876543210:37363534333231204E6F77206973207468652074696D6520666F722000000000:846B2914851E9A2954732F8AA0A611C115CDC2D7951B1053A63C5E03B21AA3C4
268
269# DES EDE3 CBC tests (from destest)
270DES-EDE3-CBC:0123456789abcdeff1e0d3c2b5a49786fedcba9876543210:fedcba9876543210:37363534333231204E6F77206973207468652074696D6520666F722000000000:3FE301C962AC01D02213763C1CBD4CDC799657C064ECF5D41C673812CFDE9675
271
272# DES CFB1 from FIPS 81
273# plaintext: 0100 1110 0110 1111 0111 0111 = 4e6f77
274# ciphertext: 1100 1101 0001 1110 1100 1001 = cd1ec9
275
276DES-CFB1*8:0123456789abcdef:1234567890abcdef:4e6f77:cd1ec9
277
278# DES CFB8 from FIPS 81
279
280DES-CFB8:0123456789abcdef:1234567890abcdef:4e6f7720697320746865:f31fda07011462ee187f
281
282# RC4 tests (from rc4test)
283RC4:0123456789abcdef0123456789abcdef::0123456789abcdef:75b7878099e0c596
284RC4:0123456789abcdef0123456789abcdef::0000000000000000:7494c2e7104b0879
285RC4:00000000000000000000000000000000::0000000000000000:de188941a3375d3a
286RC4:ef012345ef012345ef012345ef012345::0000000000000000000000000000000000000000:d6a141a7ec3c38dfbd615a1162e1c7ba36b67858
287RC4:0123456789abcdef0123456789abcdef::123456789ABCDEF0123456789ABCDEF0123456789ABCDEF012345678:66a0949f8af7d6891f7f832ba833c00c892ebe30143ce28740011ecf
288RC4:ef012345ef012345ef012345ef012345::00000000000000000000:d6a141a7ec3c38dfbd61
diff --git a/src/lib/libcrypto/evp/m_dss1.c b/src/lib/libcrypto/evp/m_dss1.c
index 23b90d0538..f5668ebda0 100644
--- a/src/lib/libcrypto/evp/m_dss1.c
+++ b/src/lib/libcrypto/evp/m_dss1.c
@@ -67,14 +67,7 @@ static int init(EVP_MD_CTX *ctx)
67 { return SHA1_Init(ctx->md_data); } 67 { return SHA1_Init(ctx->md_data); }
68 68
69static int update(EVP_MD_CTX *ctx,const void *data,unsigned long count) 69static int update(EVP_MD_CTX *ctx,const void *data,unsigned long count)
70#ifndef OPENSSL_FIPS
71 { return SHA1_Update(ctx->md_data,data,count); } 70 { return SHA1_Update(ctx->md_data,data,count); }
72#else
73 {
74 OPENSSL_assert(sizeof(count)<=sizeof(size_t));
75 return SHA1_Update(ctx->md_data,data,count);
76 }
77#endif
78 71
79static int final(EVP_MD_CTX *ctx,unsigned char *md) 72static int final(EVP_MD_CTX *ctx,unsigned char *md)
80 { return SHA1_Final(md,ctx->md_data); } 73 { return SHA1_Final(md,ctx->md_data); }
@@ -84,7 +77,7 @@ static const EVP_MD dss1_md=
84 NID_dsa, 77 NID_dsa,
85 NID_dsaWithSHA1, 78 NID_dsaWithSHA1,
86 SHA_DIGEST_LENGTH, 79 SHA_DIGEST_LENGTH,
87 EVP_MD_FLAG_FIPS, 80 0,
88 init, 81 init,
89 update, 82 update,
90 final, 83 final,
diff --git a/src/lib/libcrypto/evp/m_md2.c b/src/lib/libcrypto/evp/m_md2.c
new file mode 100644
index 0000000000..0df48e5199
--- /dev/null
+++ b/src/lib/libcrypto/evp/m_md2.c
@@ -0,0 +1,97 @@
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#ifndef OPENSSL_NO_MD2
60#include <stdio.h>
61#include "cryptlib.h"
62#include <openssl/evp.h>
63#include "evp_locl.h"
64#include <openssl/objects.h>
65#include <openssl/x509.h>
66#include <openssl/md2.h>
67
68static int init(EVP_MD_CTX *ctx)
69 { return MD2_Init(ctx->md_data); }
70
71static int update(EVP_MD_CTX *ctx,const void *data,unsigned long count)
72 { return MD2_Update(ctx->md_data,data,count); }
73
74static int final(EVP_MD_CTX *ctx,unsigned char *md)
75 { return MD2_Final(md,ctx->md_data); }
76
77static const EVP_MD md2_md=
78 {
79 NID_md2,
80 NID_md2WithRSAEncryption,
81 MD2_DIGEST_LENGTH,
82 0,
83 init,
84 update,
85 final,
86 NULL,
87 NULL,
88 EVP_PKEY_RSA_method,
89 MD2_BLOCK,
90 sizeof(EVP_MD *)+sizeof(MD2_CTX),
91 };
92
93const EVP_MD *EVP_md2(void)
94 {
95 return(&md2_md);
96 }
97#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..62de1336b8
--- /dev/null
+++ b/src/lib/libcrypto/evp/m_mdc2.c
@@ -0,0 +1,97 @@
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#ifndef OPENSSL_NO_MDC2
60#include <stdio.h>
61#include "cryptlib.h"
62#include <openssl/evp.h>
63#include "evp_locl.h"
64#include <openssl/objects.h>
65#include <openssl/x509.h>
66#include <openssl/mdc2.h>
67
68static int init(EVP_MD_CTX *ctx)
69 { return MDC2_Init(ctx->md_data); }
70
71static int update(EVP_MD_CTX *ctx,const void *data,unsigned long count)
72 { return MDC2_Update(ctx->md_data,data,count); }
73
74static int final(EVP_MD_CTX *ctx,unsigned char *md)
75 { return MDC2_Final(md,ctx->md_data); }
76
77static const EVP_MD mdc2_md=
78 {
79 NID_mdc2,
80 NID_mdc2WithRSA,
81 MDC2_DIGEST_LENGTH,
82 0,
83 init,
84 update,
85 final,
86 NULL,
87 NULL,
88 EVP_PKEY_RSA_ASN1_OCTET_STRING_method,
89 MDC2_BLOCK,
90 sizeof(EVP_MD *)+sizeof(MDC2_CTX),
91 };
92
93const EVP_MD *EVP_mdc2(void)
94 {
95 return(&mdc2_md);
96 }
97#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..d1785e5f74
--- /dev/null
+++ b/src/lib/libcrypto/evp/m_sha.c
@@ -0,0 +1,96 @@
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#if !defined(OPENSSL_NO_SHA) && !defined(OPENSSL_NO_SHA0)
60#include <stdio.h>
61#include "cryptlib.h"
62#include <openssl/evp.h>
63#include "evp_locl.h"
64#include <openssl/objects.h>
65#include <openssl/x509.h>
66
67static int init(EVP_MD_CTX *ctx)
68 { return SHA_Init(ctx->md_data); }
69
70static int update(EVP_MD_CTX *ctx,const void *data,unsigned long count)
71 { return SHA_Update(ctx->md_data,data,count); }
72
73static int final(EVP_MD_CTX *ctx,unsigned char *md)
74 { return SHA_Final(md,ctx->md_data); }
75
76static const EVP_MD sha_md=
77 {
78 NID_sha,
79 NID_shaWithRSAEncryption,
80 SHA_DIGEST_LENGTH,
81 0,
82 init,
83 update,
84 final,
85 NULL,
86 NULL,
87 EVP_PKEY_RSA_method,
88 SHA_CBLOCK,
89 sizeof(EVP_MD *)+sizeof(SHA_CTX),
90 };
91
92const EVP_MD *EVP_sha(void)
93 {
94 return(&sha_md);
95 }
96#endif
diff --git a/src/lib/libcrypto/evp/m_sha1.c b/src/lib/libcrypto/evp/m_sha1.c
index 60da93873c..fe4402389a 100644
--- a/src/lib/libcrypto/evp/m_sha1.c
+++ b/src/lib/libcrypto/evp/m_sha1.c
@@ -67,14 +67,7 @@ static int init(EVP_MD_CTX *ctx)
67 { return SHA1_Init(ctx->md_data); } 67 { return SHA1_Init(ctx->md_data); }
68 68
69static int update(EVP_MD_CTX *ctx,const void *data,unsigned long count) 69static int update(EVP_MD_CTX *ctx,const void *data,unsigned long count)
70#ifndef OPENSSL_FIPS
71 { return SHA1_Update(ctx->md_data,data,count); } 70 { return SHA1_Update(ctx->md_data,data,count); }
72#else
73 {
74 OPENSSL_assert(sizeof(count)<=sizeof(size_t));
75 return SHA1_Update(ctx->md_data,data,count);
76 }
77#endif
78 71
79static int final(EVP_MD_CTX *ctx,unsigned char *md) 72static int final(EVP_MD_CTX *ctx,unsigned char *md)
80 { return SHA1_Final(md,ctx->md_data); } 73 { return SHA1_Final(md,ctx->md_data); }
@@ -100,115 +93,3 @@ const EVP_MD *EVP_sha1(void)
100 return(&sha1_md); 93 return(&sha1_md);
101 } 94 }
102#endif 95#endif
103
104#ifdef OPENSSL_FIPS
105#ifndef OPENSSL_NO_SHA256
106static int init224(EVP_MD_CTX *ctx)
107 { return SHA224_Init(ctx->md_data); }
108static int init256(EVP_MD_CTX *ctx)
109 { return SHA256_Init(ctx->md_data); }
110/*
111 * Even though there're separate SHA224_[Update|Final], we call
112 * SHA256 functions even in SHA224 context. This is what happens
113 * there anyway, so we can spare few CPU cycles:-)
114 */
115static int update256(EVP_MD_CTX *ctx,const void *data,unsigned long count)
116 {
117 OPENSSL_assert(sizeof(count)<=sizeof(size_t));
118 return SHA256_Update(ctx->md_data,data,count);
119 }
120static int final256(EVP_MD_CTX *ctx,unsigned char *md)
121 { return SHA256_Final(md,ctx->md_data); }
122
123static const EVP_MD sha224_md=
124 {
125 NID_sha224,
126 NID_sha224WithRSAEncryption,
127 SHA224_DIGEST_LENGTH,
128 EVP_MD_FLAG_FIPS,
129 init224,
130 update256,
131 final256,
132 NULL,
133 NULL,
134 EVP_PKEY_RSA_method,
135 SHA256_CBLOCK,
136 sizeof(EVP_MD *)+sizeof(SHA256_CTX),
137 };
138
139const EVP_MD *EVP_sha224(void)
140 { return(&sha224_md); }
141
142static const EVP_MD sha256_md=
143 {
144 NID_sha256,
145 NID_sha256WithRSAEncryption,
146 SHA256_DIGEST_LENGTH,
147 EVP_MD_FLAG_FIPS,
148 init256,
149 update256,
150 final256,
151 NULL,
152 NULL,
153 EVP_PKEY_RSA_method,
154 SHA256_CBLOCK,
155 sizeof(EVP_MD *)+sizeof(SHA256_CTX),
156 };
157
158const EVP_MD *EVP_sha256(void)
159 { return(&sha256_md); }
160#endif /* ifndef OPENSSL_NO_SHA256 */
161
162#ifndef OPENSSL_NO_SHA512
163static int init384(EVP_MD_CTX *ctx)
164 { return SHA384_Init(ctx->md_data); }
165static int init512(EVP_MD_CTX *ctx)
166 { return SHA512_Init(ctx->md_data); }
167/* See comment in SHA224/256 section */
168static int update512(EVP_MD_CTX *ctx,const void *data,unsigned long count)
169 {
170 OPENSSL_assert(sizeof(count)<=sizeof(size_t));
171 return SHA512_Update(ctx->md_data,data,count);
172 }
173static int final512(EVP_MD_CTX *ctx,unsigned char *md)
174 { return SHA512_Final(md,ctx->md_data); }
175
176static const EVP_MD sha384_md=
177 {
178 NID_sha384,
179 NID_sha384WithRSAEncryption,
180 SHA384_DIGEST_LENGTH,
181 EVP_MD_FLAG_FIPS,
182 init384,
183 update512,
184 final512,
185 NULL,
186 NULL,
187 EVP_PKEY_RSA_method,
188 SHA512_CBLOCK,
189 sizeof(EVP_MD *)+sizeof(SHA512_CTX),
190 };
191
192const EVP_MD *EVP_sha384(void)
193 { return(&sha384_md); }
194
195static const EVP_MD sha512_md=
196 {
197 NID_sha512,
198 NID_sha512WithRSAEncryption,
199 SHA512_DIGEST_LENGTH,
200 EVP_MD_FLAG_FIPS,
201 init512,
202 update512,
203 final512,
204 NULL,
205 NULL,
206 EVP_PKEY_RSA_method,
207 SHA512_CBLOCK,
208 sizeof(EVP_MD *)+sizeof(SHA512_CTX),
209 };
210
211const EVP_MD *EVP_sha512(void)
212 { return(&sha512_md); }
213#endif /* ifndef OPENSSL_NO_SHA512 */
214#endif /* ifdef OPENSSL_FIPS */
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 1d5fabc4b2..1f94e1ef88 100644
--- a/src/lib/libcrypto/evp/p5_crpt2.c
+++ b/src/lib/libcrypto/evp/p5_crpt2.c
@@ -194,16 +194,11 @@ int PKCS5_v2_PBE_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, int passlen,
194 194
195 /* Now decode key derivation function */ 195 /* Now decode key derivation function */
196 196
197 if(!pbe2->keyfunc->parameter ||
198 (pbe2->keyfunc->parameter->type != V_ASN1_SEQUENCE))
199 {
200 EVPerr(EVP_F_PKCS5_V2_PBE_KEYIVGEN,EVP_R_DECODE_ERROR);
201 goto err;
202 }
203
204 pbuf = pbe2->keyfunc->parameter->value.sequence->data; 197 pbuf = pbe2->keyfunc->parameter->value.sequence->data;
205 plen = pbe2->keyfunc->parameter->value.sequence->length; 198 plen = pbe2->keyfunc->parameter->value.sequence->length;
206 if(!(kdf = d2i_PBKDF2PARAM(NULL, &pbuf, plen)) ) { 199 if(!pbe2->keyfunc->parameter ||
200 (pbe2->keyfunc->parameter->type != V_ASN1_SEQUENCE) ||
201 !(kdf = d2i_PBKDF2PARAM(NULL, &pbuf, plen)) ) {
207 EVPerr(EVP_F_PKCS5_V2_PBE_KEYIVGEN,EVP_R_DECODE_ERROR); 202 EVPerr(EVP_F_PKCS5_V2_PBE_KEYIVGEN,EVP_R_DECODE_ERROR);
208 goto err; 203 goto err;
209 } 204 }
diff --git a/src/lib/libcrypto/hmac/Makefile b/src/lib/libcrypto/hmac/Makefile
new file mode 100644
index 0000000000..3d53d8240f
--- /dev/null
+++ b/src/lib/libcrypto/hmac/Makefile
@@ -0,0 +1,99 @@
1#
2# OpenSSL/crypto/md/Makefile
3#
4
5DIR= hmac
6TOP= ../..
7CC= cc
8INCLUDES=
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
18CFLAGS= $(INCLUDES) $(CFLAG)
19
20GENERAL=Makefile
21TEST=hmactest.c
22APPS=
23
24LIB=$(TOP)/libcrypto.a
25LIBSRC=hmac.c
26LIBOBJ=hmac.o
27
28SRC= $(LIBSRC)
29
30EXHEADER= hmac.h
31HEADER= $(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
45files:
46 $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
47
48links:
49 @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
50 @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
51 @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
52
53install:
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 $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(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
80hmac.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
81hmac.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
82hmac.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
83hmac.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
84hmac.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
85hmac.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
86hmac.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
87hmac.o: ../../include/openssl/evp.h ../../include/openssl/hmac.h
88hmac.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
89hmac.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
90hmac.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
91hmac.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
92hmac.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
93hmac.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rc2.h
94hmac.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
95hmac.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
96hmac.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
97hmac.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
98hmac.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
99hmac.o: ../cryptlib.h hmac.c
diff --git a/src/lib/libcrypto/hmac/Makefile.ssl b/src/lib/libcrypto/hmac/Makefile.ssl
new file mode 100644
index 0000000000..f1c07322c4
--- /dev/null
+++ b/src/lib/libcrypto/hmac/Makefile.ssl
@@ -0,0 +1,101 @@
1#
2# SSLeay/crypto/md/Makefile
3#
4
5DIR= hmac
6TOP= ../..
7CC= cc
8INCLUDES=
9CFLAG=-g
10INSTALL_PREFIX=
11OPENSSLDIR= /usr/local/ssl
12INSTALLTOP=/usr/local/ssl
13MAKE= make -f Makefile.ssl
14MAKEDEPPROG= makedepend
15MAKEDEPEND= $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG)
16MAKEFILE= Makefile.ssl
17AR= ar r
18
19CFLAGS= $(INCLUDES) $(CFLAG)
20
21GENERAL=Makefile
22TEST=hmactest.c
23APPS=
24
25LIB=$(TOP)/libcrypto.a
26LIBSRC=hmac.c
27LIBOBJ=hmac.o
28
29SRC= $(LIBSRC)
30
31EXHEADER= hmac.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.ssl >> $(TOP)/MINFO
48
49links:
50 @sh $(TOP)/util/point.sh Makefile.ssl Makefile
51 @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
52 @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
53 @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
54
55install:
56 @for i in $(EXHEADER) ; \
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 $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
72
73dclean:
74 $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
75 mv -f Makefile.new $(MAKEFILE)
76
77clean:
78 rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
79
80# DO NOT DELETE THIS LINE -- make depend depends on it.
81
82hmac.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
83hmac.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
84hmac.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
85hmac.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
86hmac.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
87hmac.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
88hmac.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
89hmac.o: ../../include/openssl/evp.h ../../include/openssl/hmac.h
90hmac.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
91hmac.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
92hmac.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
93hmac.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
94hmac.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
95hmac.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rc2.h
96hmac.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
97hmac.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
98hmac.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
99hmac.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
100hmac.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
101hmac.o: ../cryptlib.h hmac.c
diff --git a/src/lib/libcrypto/hmac/hmac.c b/src/lib/libcrypto/hmac/hmac.c
index 6c110bd52b..06ee80761f 100644
--- a/src/lib/libcrypto/hmac/hmac.c
+++ b/src/lib/libcrypto/hmac/hmac.c
@@ -61,8 +61,6 @@
61#include <openssl/hmac.h> 61#include <openssl/hmac.h>
62#include "cryptlib.h" 62#include "cryptlib.h"
63 63
64#ifndef OPENSSL_FIPS
65
66void HMAC_Init_ex(HMAC_CTX *ctx, const void *key, int len, 64void HMAC_Init_ex(HMAC_CTX *ctx, const void *key, int len,
67 const EVP_MD *md, ENGINE *impl) 65 const EVP_MD *md, ENGINE *impl)
68 { 66 {
@@ -79,6 +77,15 @@ void HMAC_Init_ex(HMAC_CTX *ctx, const void *key, int len,
79 77
80 if (key != NULL) 78 if (key != NULL)
81 { 79 {
80#ifdef OPENSSL_FIPS
81 if (FIPS_mode() && !(md->flags & EVP_MD_FLAG_FIPS)
82 && (!(ctx->md_ctx.flags & EVP_MD_CTX_FLAG_NON_FIPS_ALLOW)
83 || !(ctx->i_ctx.flags & EVP_MD_CTX_FLAG_NON_FIPS_ALLOW)
84 || !(ctx->o_ctx.flags & EVP_MD_CTX_FLAG_NON_FIPS_ALLOW)))
85 OpenSSLDie(__FILE__,__LINE__,
86 "HMAC: digest not allowed in FIPS mode");
87#endif
88
82 reset=1; 89 reset=1;
83 j=EVP_MD_block_size(md); 90 j=EVP_MD_block_size(md);
84 OPENSSL_assert(j <= sizeof ctx->key); 91 OPENSSL_assert(j <= sizeof ctx->key);
@@ -180,4 +187,3 @@ void HMAC_CTX_set_flags(HMAC_CTX *ctx, unsigned long flags)
180 EVP_MD_CTX_set_flags(&ctx->md_ctx, flags); 187 EVP_MD_CTX_set_flags(&ctx->md_ctx, flags);
181 } 188 }
182 189
183#endif
diff --git a/src/lib/libcrypto/hmac/hmac.h b/src/lib/libcrypto/hmac/hmac.h
index c6489c04c8..294ab3b36a 100644
--- a/src/lib/libcrypto/hmac/hmac.h
+++ b/src/lib/libcrypto/hmac/hmac.h
@@ -64,11 +64,7 @@
64 64
65#include <openssl/evp.h> 65#include <openssl/evp.h>
66 66
67#ifdef OPENSSL_FIPS
68#define HMAC_MAX_MD_CBLOCK 128
69#else
70#define HMAC_MAX_MD_CBLOCK 64 67#define HMAC_MAX_MD_CBLOCK 64
71#endif
72 68
73#ifdef __cplusplus 69#ifdef __cplusplus
74extern "C" { 70extern "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..6b8e530d9d
--- /dev/null
+++ b/src/lib/libcrypto/idea/Makefile
@@ -0,0 +1,92 @@
1#
2# OpenSSL/crypto/idea/Makefile
3#
4
5DIR= idea
6TOP= ../..
7CC= cc
8INCLUDES=
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
18CFLAGS= $(INCLUDES) $(CFLAG)
19
20GENERAL=Makefile
21TEST=ideatest.c
22APPS=
23
24LIB=$(TOP)/libcrypto.a
25LIBSRC=i_cbc.c i_cfb64.c i_ofb64.c i_ecb.c i_skey.c
26LIBOBJ=i_cbc.o i_cfb64.o i_ofb64.o i_ecb.o i_skey.o
27
28SRC= $(LIBSRC)
29
30EXHEADER= idea.h
31HEADER= idea_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
45files:
46 $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
47
48links:
49 @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
50 @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
51 @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
52
53install:
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 $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(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
80i_cbc.o: ../../include/openssl/idea.h ../../include/openssl/opensslconf.h
81i_cbc.o: i_cbc.c idea_lcl.h
82i_cfb64.o: ../../include/openssl/idea.h ../../include/openssl/opensslconf.h
83i_cfb64.o: i_cfb64.c idea_lcl.h
84i_ecb.o: ../../include/openssl/idea.h ../../include/openssl/opensslconf.h
85i_ecb.o: ../../include/openssl/opensslv.h i_ecb.c idea_lcl.h
86i_ofb64.o: ../../include/openssl/idea.h ../../include/openssl/opensslconf.h
87i_ofb64.o: i_ofb64.c idea_lcl.h
88i_skey.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
89i_skey.o: ../../include/openssl/fips.h ../../include/openssl/idea.h
90i_skey.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
91i_skey.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
92i_skey.o: ../../include/openssl/symhacks.h i_skey.c idea_lcl.h
diff --git a/src/lib/libcrypto/idea/Makefile.ssl b/src/lib/libcrypto/idea/Makefile.ssl
new file mode 100644
index 0000000000..fa016ea399
--- /dev/null
+++ b/src/lib/libcrypto/idea/Makefile.ssl
@@ -0,0 +1,91 @@
1#
2# SSLeay/crypto/idea/Makefile
3#
4
5DIR= idea
6TOP= ../..
7CC= cc
8INCLUDES=
9CFLAG=-g
10INSTALL_PREFIX=
11OPENSSLDIR= /usr/local/ssl
12INSTALLTOP=/usr/local/ssl
13MAKE= make -f Makefile.ssl
14MAKEDEPPROG= makedepend
15MAKEDEPEND= $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG)
16MAKEFILE= Makefile.ssl
17AR= ar r
18
19CFLAGS= $(INCLUDES) $(CFLAG)
20
21GENERAL=Makefile
22TEST=ideatest.c
23APPS=
24
25LIB=$(TOP)/libcrypto.a
26LIBSRC=i_cbc.c i_cfb64.c i_ofb64.c i_ecb.c i_skey.c
27LIBOBJ=i_cbc.o i_cfb64.o i_ofb64.o i_ecb.o i_skey.o
28
29SRC= $(LIBSRC)
30
31EXHEADER= idea.h
32HEADER= idea_lcl.h $(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.ssl >> $(TOP)/MINFO
48
49links:
50 @sh $(TOP)/util/point.sh Makefile.ssl Makefile
51 @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
52 @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
53 @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
54
55install:
56 @for i in $(EXHEADER) ; \
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 $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
72
73dclean:
74 $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
75 mv -f Makefile.new $(MAKEFILE)
76
77clean:
78 rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
79
80# DO NOT DELETE THIS LINE -- make depend depends on it.
81
82i_cbc.o: ../../include/openssl/idea.h ../../include/openssl/opensslconf.h
83i_cbc.o: i_cbc.c idea_lcl.h
84i_cfb64.o: ../../include/openssl/idea.h ../../include/openssl/opensslconf.h
85i_cfb64.o: i_cfb64.c idea_lcl.h
86i_ecb.o: ../../include/openssl/idea.h ../../include/openssl/opensslconf.h
87i_ecb.o: ../../include/openssl/opensslv.h i_ecb.c idea_lcl.h
88i_ofb64.o: ../../include/openssl/idea.h ../../include/openssl/opensslconf.h
89i_ofb64.o: i_ofb64.c idea_lcl.h
90i_skey.o: ../../include/openssl/idea.h ../../include/openssl/opensslconf.h
91i_skey.o: i_skey.c idea_lcl.h
diff --git a/src/lib/libcrypto/idea/ideatest.c b/src/lib/libcrypto/idea/ideatest.c
new file mode 100644
index 0000000000..98f805d72a
--- /dev/null
+++ b/src/lib/libcrypto/idea/ideatest.c
@@ -0,0 +1,232 @@
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 EXIT(err);
173 return(err);
174 }
175
176static int cfb64_test(unsigned char *cfb_cipher)
177 {
178 IDEA_KEY_SCHEDULE eks,dks;
179 int err=0,i,n;
180
181 idea_set_encrypt_key(cfb_key,&eks);
182 idea_set_decrypt_key(&eks,&dks);
183 memcpy(cfb_tmp,cfb_iv,8);
184 n=0;
185 idea_cfb64_encrypt(plain,cfb_buf1,(long)12,&eks,
186 cfb_tmp,&n,IDEA_ENCRYPT);
187 idea_cfb64_encrypt(&(plain[12]),&(cfb_buf1[12]),
188 (long)CFB_TEST_SIZE-12,&eks,
189 cfb_tmp,&n,IDEA_ENCRYPT);
190 if (memcmp(cfb_cipher,cfb_buf1,CFB_TEST_SIZE) != 0)
191 {
192 err=1;
193 printf("idea_cfb64_encrypt encrypt error\n");
194 for (i=0; i<CFB_TEST_SIZE; i+=8)
195 printf("%s\n",pt(&(cfb_buf1[i])));
196 }
197 memcpy(cfb_tmp,cfb_iv,8);
198 n=0;
199 idea_cfb64_encrypt(cfb_buf1,cfb_buf2,(long)17,&eks,
200 cfb_tmp,&n,IDEA_DECRYPT);
201 idea_cfb64_encrypt(&(cfb_buf1[17]),&(cfb_buf2[17]),
202 (long)CFB_TEST_SIZE-17,&dks,
203 cfb_tmp,&n,IDEA_DECRYPT);
204 if (memcmp(plain,cfb_buf2,CFB_TEST_SIZE) != 0)
205 {
206 err=1;
207 printf("idea_cfb_encrypt decrypt error\n");
208 for (i=0; i<24; i+=8)
209 printf("%s\n",pt(&(cfb_buf2[i])));
210 }
211 return(err);
212 }
213
214static char *pt(unsigned char *p)
215 {
216 static char bufs[10][20];
217 static int bnum=0;
218 char *ret;
219 int i;
220 static char *f="0123456789ABCDEF";
221
222 ret= &(bufs[bnum++][0]);
223 bnum%=10;
224 for (i=0; i<8; i++)
225 {
226 ret[i*2]=f[(p[i]>>4)&0xf];
227 ret[i*2+1]=f[p[i]&0xf];
228 }
229 ret[16]='\0';
230 return(ret);
231 }
232#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.com b/src/lib/libcrypto/install.com
new file mode 100644
index 0000000000..b3d155e964
--- /dev/null
+++ b/src/lib/libcrypto/install.com
@@ -0,0 +1,138 @@
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$! P1 root of the directory tree
7$!
8$ IF P1 .EQS. ""
9$ THEN
10$ WRITE SYS$OUTPUT "First argument missing."
11$ WRITE SYS$OUTPUT "Should be the directory where you want things installed."
12$ EXIT
13$ ENDIF
14$
15$ ROOT = F$PARSE(P1,"[]A.;0",,,"SYNTAX_ONLY,NO_CONCEAL") - "A.;0"
16$ ROOT_DEV = F$PARSE(ROOT,,,"DEVICE","SYNTAX_ONLY")
17$ ROOT_DIR = F$PARSE(ROOT,,,"DIRECTORY","SYNTAX_ONLY") -
18 - "[000000." - "][" - "[" - "]"
19$ ROOT = ROOT_DEV + "[" + ROOT_DIR
20$
21$ DEFINE/NOLOG WRK_SSLROOT 'ROOT'.] /TRANS=CONC
22$ DEFINE/NOLOG WRK_SSLVLIB WRK_SSLROOT:[VAX_LIB]
23$ DEFINE/NOLOG WRK_SSLALIB WRK_SSLROOT:[ALPHA_LIB]
24$ DEFINE/NOLOG WRK_SSLINCLUDE WRK_SSLROOT:[INCLUDE]
25$
26$ IF F$PARSE("WRK_SSLROOT:[000000]") .EQS. "" THEN -
27 CREATE/DIR/LOG WRK_SSLROOT:[000000]
28$ IF F$PARSE("WRK_SSLVLIB:") .EQS. "" THEN -
29 CREATE/DIR/LOG WRK_SSLVLIB:
30$ IF F$PARSE("WRK_SSLALIB:") .EQS. "" THEN -
31 CREATE/DIR/LOG WRK_SSLALIB:
32$ IF F$PARSE("WRK_SSLINCLUDE:") .EQS. "" THEN -
33 CREATE/DIR/LOG WRK_SSLINCLUDE:
34$
35$ SDIRS := ,MD2,MD4,MD5,SHA,MDC2,HMAC,RIPEMD,-
36 DES,RC2,RC4,RC5,IDEA,BF,CAST,-
37 BN,EC,RSA,DSA,DH,DSO,ENGINE,AES,-
38 BUFFER,BIO,STACK,LHASH,RAND,ERR,OBJECTS,-
39 EVP,ASN1,PEM,X509,X509V3,CONF,TXT_DB,PKCS7,PKCS12,COMP,OCSP,-
40 UI,KRB5
41$ EXHEADER_ := crypto.h,tmdiff.h,opensslv.h,opensslconf.h,ebcdic.h,-
42 symhacks.h,ossl_typ.h
43$ EXHEADER_MD2 := md2.h
44$ EXHEADER_MD4 := md4.h
45$ EXHEADER_MD5 := md5.h
46$ EXHEADER_SHA := sha.h
47$ EXHEADER_MDC2 := mdc2.h
48$ EXHEADER_HMAC := hmac.h
49$ EXHEADER_RIPEMD := ripemd.h
50$ EXHEADER_DES := des.h,des_old.h
51$ EXHEADER_RC2 := rc2.h
52$ EXHEADER_RC4 := rc4.h
53$ EXHEADER_RC5 := rc5.h
54$ EXHEADER_IDEA := idea.h
55$ EXHEADER_BF := blowfish.h
56$ EXHEADER_CAST := cast.h
57$ EXHEADER_BN := bn.h
58$ EXHEADER_EC := ec.h
59$ EXHEADER_RSA := rsa.h
60$ EXHEADER_DSA := dsa.h
61$ EXHEADER_DH := dh.h
62$ EXHEADER_DSO := dso.h
63$ EXHEADER_ENGINE := engine.h
64$ EXHEADER_AES := aes.h
65$ EXHEADER_BUFFER := buffer.h
66$ EXHEADER_BIO := bio.h
67$ EXHEADER_STACK := stack.h,safestack.h
68$ EXHEADER_LHASH := lhash.h
69$ EXHEADER_RAND := rand.h
70$ EXHEADER_ERR := err.h
71$ EXHEADER_OBJECTS := objects.h,obj_mac.h
72$ EXHEADER_EVP := evp.h
73$ EXHEADER_ASN1 := asn1.h,asn1_mac.h,asn1t.h
74$ EXHEADER_PEM := pem.h,pem2.h
75$ EXHEADER_X509 := x509.h,x509_vfy.h
76$ EXHEADER_X509V3 := x509v3.h
77$ EXHEADER_CONF := conf.h,conf_api.h
78$ EXHEADER_TXT_DB := txt_db.h
79$ EXHEADER_PKCS7 := pkcs7.h
80$ EXHEADER_PKCS12 := pkcs12.h
81$ EXHEADER_COMP := comp.h
82$ EXHEADER_OCSP := ocsp.h
83$ EXHEADER_UI := ui.h,ui_compat.h
84$ EXHEADER_KRB5 := krb5_asn.h
85$ LIBS := LIBCRYPTO
86$
87$ VEXE_DIR := [-.VAX.EXE.CRYPTO]
88$ AEXE_DIR := [-.AXP.EXE.CRYPTO]
89$
90$ I = 0
91$ LOOP_SDIRS:
92$ D = F$EDIT(F$ELEMENT(I, ",", SDIRS),"TRIM")
93$ I = I + 1
94$ IF D .EQS. "," THEN GOTO LOOP_SDIRS_END
95$ tmp = EXHEADER_'D'
96$ IF D .EQS. ""
97$ THEN
98$ COPY 'tmp' WRK_SSLINCLUDE: /LOG
99$ ELSE
100$ COPY [.'D']'tmp' WRK_SSLINCLUDE: /LOG
101$ ENDIF
102$ SET FILE/PROT=WORLD:RE WRK_SSLINCLUDE:'tmp'
103$ GOTO LOOP_SDIRS
104$ LOOP_SDIRS_END:
105$
106$ I = 0
107$ LOOP_LIB:
108$ E = F$EDIT(F$ELEMENT(I, ",", LIBS),"TRIM")
109$ I = I + 1
110$ IF E .EQS. "," THEN GOTO LOOP_LIB_END
111$ SET NOON
112$ IF F$SEARCH(VEXE_DIR+E+".OLB") .NES. ""
113$ THEN
114$ COPY 'VEXE_DIR''E'.OLB WRK_SSLVLIB:'E'.OLB/log
115$ SET FILE/PROT=W:RE WRK_SSLVLIB:'E'.OLB
116$ ENDIF
117$ ! Preparing for the time when we have shareable images
118$ IF F$SEARCH(VEXE_DIR+E+".EXE") .NES. ""
119$ THEN
120$ COPY 'VEXE_DIR''E'.EXE WRK_SSLVLIB:'E'.EXE/log
121$ SET FILE/PROT=W:RE WRK_SSLVLIB:'E'.EXE
122$ ENDIF
123$ IF F$SEARCH(AEXE_DIR+E+".OLB") .NES. ""
124$ THEN
125$ COPY 'AEXE_DIR''E'.OLB WRK_SSLALIB:'E'.OLB/log
126$ SET FILE/PROT=W:RE WRK_SSLALIB:'E'.OLB
127$ ENDIF
128$ ! Preparing for the time when we have shareable images
129$ IF F$SEARCH(AEXE_DIR+E+".EXE") .NES. ""
130$ THEN
131$ COPY 'AEXE_DIR''E'.EXE WRK_SSLALIB:'E'.EXE/log
132$ SET FILE/PROT=W:RE WRK_SSLALIB:'E'.EXE
133$ ENDIF
134$ SET ON
135$ GOTO LOOP_LIB
136$ LOOP_LIB_END:
137$
138$ EXIT
diff --git a/src/lib/libcrypto/krb5/Makefile b/src/lib/libcrypto/krb5/Makefile
new file mode 100644
index 0000000000..25cc695e8d
--- /dev/null
+++ b/src/lib/libcrypto/krb5/Makefile
@@ -0,0 +1,88 @@
1#
2# OpenSSL/krb5/Makefile
3#
4
5DIR= krb5
6TOP= ../..
7CC= cc
8INCLUDES= -I.. -I$(TOP) -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
18CFLAGS= $(INCLUDES) $(CFLAG)
19
20GENERAL=Makefile README
21TEST=
22APPS=
23
24LIB=$(TOP)/libcrypto.a
25LIBSRC= krb5_asn.c
26
27LIBOBJ= krb5_asn.o
28
29SRC= $(LIBSRC)
30
31EXHEADER= krb5_asn.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 @headerlist="$(EXHEADER)"; for i in $$headerlist ; \
56 do \
57 (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
58 chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
59 done;
60
61tags:
62 ctags $(SRC)
63
64tests:
65
66lint:
67 lint -DLINT $(INCLUDES) $(SRC)>fluff
68
69depend:
70 $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(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 *.obj lib tags core .pure .nfs* *.old *.bak fluff
78
79# DO NOT DELETE THIS LINE -- make depend depends on it.
80
81krb5_asn.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h
82krb5_asn.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
83krb5_asn.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
84krb5_asn.o: ../../include/openssl/krb5_asn.h
85krb5_asn.o: ../../include/openssl/opensslconf.h
86krb5_asn.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
87krb5_asn.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
88krb5_asn.o: ../../include/openssl/symhacks.h krb5_asn.c
diff --git a/src/lib/libcrypto/krb5/Makefile.ssl b/src/lib/libcrypto/krb5/Makefile.ssl
new file mode 100644
index 0000000000..d9224c0f09
--- /dev/null
+++ b/src/lib/libcrypto/krb5/Makefile.ssl
@@ -0,0 +1,90 @@
1#
2# OpenSSL/krb5/Makefile.ssl
3#
4
5DIR= krb5
6TOP= ../..
7CC= cc
8INCLUDES= -I.. -I$(TOP) -I../../include
9CFLAG=-g
10INSTALL_PREFIX=
11OPENSSLDIR= /usr/local/ssl
12INSTALLTOP=/usr/local/ssl
13MAKE= make -f Makefile.ssl
14MAKEDEPPROG= makedepend
15MAKEDEPEND= $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG)
16MAKEFILE= Makefile.ssl
17AR= ar r
18
19CFLAGS= $(INCLUDES) $(CFLAG)
20
21GENERAL=Makefile README
22TEST=
23APPS=
24
25LIB=$(TOP)/libcrypto.a
26LIBSRC= krb5_asn.c
27
28LIBOBJ= krb5_asn.o
29
30SRC= $(LIBSRC)
31
32EXHEADER= krb5_asn.h
33HEADER= $(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
47files:
48 $(PERL) $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO
49
50links:
51 @sh $(TOP)/util/point.sh Makefile.ssl Makefile ;
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 @for i in $(EXHEADER) ; \
58 do \
59 (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
60 chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
61 done;
62
63tags:
64 ctags $(SRC)
65
66tests:
67
68lint:
69 lint -DLINT $(INCLUDES) $(SRC)>fluff
70
71depend:
72 $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(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
83krb5_asn.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h
84krb5_asn.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
85krb5_asn.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
86krb5_asn.o: ../../include/openssl/krb5_asn.h
87krb5_asn.o: ../../include/openssl/opensslconf.h
88krb5_asn.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
89krb5_asn.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
90krb5_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..cdb0e77fad
--- /dev/null
+++ b/src/lib/libcrypto/lhash/Makefile
@@ -0,0 +1,91 @@
1#
2# OpenSSL/crypto/lhash/Makefile
3#
4
5DIR= lhash
6TOP= ../..
7CC= cc
8INCLUDES=
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
18CFLAGS= $(INCLUDES) $(CFLAG)
19
20GENERAL=Makefile
21TEST=
22APPS=
23
24LIB=$(TOP)/libcrypto.a
25LIBSRC=lhash.c lh_stats.c
26LIBOBJ=lhash.o lh_stats.o
27
28SRC= $(LIBSRC)
29
30EXHEADER= lhash.h
31HEADER= $(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
45files:
46 $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
47
48links:
49 @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
50 @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
51 @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
52
53install:
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 $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(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
80lh_stats.o: ../../e_os.h ../../include/openssl/bio.h
81lh_stats.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
82lh_stats.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
83lh_stats.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
84lh_stats.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
85lh_stats.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
86lh_stats.o: ../cryptlib.h lh_stats.c
87lhash.o: ../../include/openssl/bio.h ../../include/openssl/crypto.h
88lhash.o: ../../include/openssl/e_os2.h ../../include/openssl/lhash.h
89lhash.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
90lhash.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
91lhash.o: ../../include/openssl/symhacks.h lhash.c
diff --git a/src/lib/libcrypto/lhash/Makefile.ssl b/src/lib/libcrypto/lhash/Makefile.ssl
new file mode 100644
index 0000000000..60e7ee3393
--- /dev/null
+++ b/src/lib/libcrypto/lhash/Makefile.ssl
@@ -0,0 +1,93 @@
1#
2# SSLeay/crypto/lhash/Makefile
3#
4
5DIR= lhash
6TOP= ../..
7CC= cc
8INCLUDES=
9CFLAG=-g
10INSTALL_PREFIX=
11OPENSSLDIR= /usr/local/ssl
12INSTALLTOP=/usr/local/ssl
13MAKE= make -f Makefile.ssl
14MAKEDEPPROG= makedepend
15MAKEDEPEND= $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG)
16MAKEFILE= Makefile.ssl
17AR= ar r
18
19CFLAGS= $(INCLUDES) $(CFLAG)
20
21GENERAL=Makefile
22TEST=
23APPS=
24
25LIB=$(TOP)/libcrypto.a
26LIBSRC=lhash.c lh_stats.c
27LIBOBJ=lhash.o lh_stats.o
28
29SRC= $(LIBSRC)
30
31EXHEADER= lhash.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.ssl >> $(TOP)/MINFO
48
49links:
50 @sh $(TOP)/util/point.sh Makefile.ssl Makefile
51 @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
52 @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
53 @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
54
55install:
56 @for i in $(EXHEADER) ; \
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 $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
72
73dclean:
74 $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
75 mv -f Makefile.new $(MAKEFILE)
76
77clean:
78 rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
79
80# DO NOT DELETE THIS LINE -- make depend depends on it.
81
82lh_stats.o: ../../e_os.h ../../include/openssl/bio.h
83lh_stats.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
84lh_stats.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
85lh_stats.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
86lh_stats.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
87lh_stats.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
88lh_stats.o: ../cryptlib.h lh_stats.c
89lhash.o: ../../include/openssl/bio.h ../../include/openssl/crypto.h
90lhash.o: ../../include/openssl/e_os2.h ../../include/openssl/lhash.h
91lhash.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
92lhash.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
93lhash.o: ../../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/md2/Makefile b/src/lib/libcrypto/md2/Makefile
new file mode 100644
index 0000000000..9d0351bb2f
--- /dev/null
+++ b/src/lib/libcrypto/md2/Makefile
@@ -0,0 +1,93 @@
1#
2# OpenSSL/crypto/md/Makefile
3#
4
5DIR= md2
6TOP= ../..
7CC= cc
8INCLUDES=
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
18CFLAGS= $(INCLUDES) $(CFLAG)
19
20GENERAL=Makefile
21TEST=md2test.c
22APPS=
23
24LIB=$(TOP)/libcrypto.a
25LIBSRC=md2_dgst.c md2_one.c
26LIBOBJ=md2_dgst.o md2_one.o
27
28SRC= $(LIBSRC)
29
30EXHEADER= md2.h
31HEADER= $(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
45files:
46 $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
47
48links:
49 @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
50 @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
51 @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
52
53install:
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 $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(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
80md2_dgst.o: ../../include/openssl/bio.h ../../include/openssl/crypto.h
81md2_dgst.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
82md2_dgst.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
83md2_dgst.o: ../../include/openssl/md2.h ../../include/openssl/opensslconf.h
84md2_dgst.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
85md2_dgst.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
86md2_dgst.o: md2_dgst.c
87md2_one.o: ../../e_os.h ../../include/openssl/bio.h
88md2_one.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
89md2_one.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
90md2_one.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
91md2_one.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
92md2_one.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
93md2_one.o: ../../include/openssl/symhacks.h ../cryptlib.h md2_one.c
diff --git a/src/lib/libcrypto/md2/Makefile.ssl b/src/lib/libcrypto/md2/Makefile.ssl
new file mode 100644
index 0000000000..3206924c90
--- /dev/null
+++ b/src/lib/libcrypto/md2/Makefile.ssl
@@ -0,0 +1,93 @@
1#
2# SSLeay/crypto/md/Makefile
3#
4
5DIR= md2
6TOP= ../..
7CC= cc
8INCLUDES=
9CFLAG=-g
10INSTALL_PREFIX=
11OPENSSLDIR= /usr/local/ssl
12INSTALLTOP=/usr/local/ssl
13MAKE= make -f Makefile.ssl
14MAKEDEPPROG= makedepend
15MAKEDEPEND= $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG)
16MAKEFILE= Makefile.ssl
17AR= ar r
18
19CFLAGS= $(INCLUDES) $(CFLAG)
20
21GENERAL=Makefile
22TEST=md2test.c
23APPS=
24
25LIB=$(TOP)/libcrypto.a
26LIBSRC=md2_dgst.c md2_one.c
27LIBOBJ=md2_dgst.o md2_one.o
28
29SRC= $(LIBSRC)
30
31EXHEADER= md2.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.ssl >> $(TOP)/MINFO
48
49links:
50 @sh $(TOP)/util/point.sh Makefile.ssl Makefile
51 @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
52 @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
53 @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
54
55install:
56 @for i in $(EXHEADER) ; \
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 $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
72
73dclean:
74 $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
75 mv -f Makefile.new $(MAKEFILE)
76
77clean:
78 rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
79
80# DO NOT DELETE THIS LINE -- make depend depends on it.
81
82md2_dgst.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
83md2_dgst.o: ../../include/openssl/md2.h ../../include/openssl/opensslconf.h
84md2_dgst.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
85md2_dgst.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
86md2_dgst.o: md2_dgst.c
87md2_one.o: ../../e_os.h ../../include/openssl/bio.h
88md2_one.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
89md2_one.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
90md2_one.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
91md2_one.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
92md2_one.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
93md2_one.o: ../../include/openssl/symhacks.h ../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..d0ef9da08e
--- /dev/null
+++ b/src/lib/libcrypto/md2/md2.h
@@ -0,0 +1,94 @@
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#ifdef OPENSSL_NO_MD2
63#error MD2 is disabled.
64#endif
65
66#define MD2_DIGEST_LENGTH 16
67#define MD2_BLOCK 16
68#include <openssl/opensslconf.h> /* MD2_INT */
69
70#ifdef __cplusplus
71extern "C" {
72#endif
73
74typedef struct MD2state_st
75 {
76 int num;
77 unsigned char data[MD2_BLOCK];
78 MD2_INT cksm[MD2_BLOCK];
79 MD2_INT state[MD2_BLOCK];
80 } MD2_CTX;
81
82const char *MD2_options(void);
83#ifdef OPENSSL_FIPS
84int private_MD2_Init(MD2_CTX *c);
85#endif
86int MD2_Init(MD2_CTX *c);
87int MD2_Update(MD2_CTX *c, const unsigned char *data, unsigned long len);
88int MD2_Final(unsigned char *md, MD2_CTX *c);
89unsigned char *MD2(const unsigned char *d, unsigned long n,unsigned char *md);
90#ifdef __cplusplus
91}
92#endif
93
94#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..8124acd687
--- /dev/null
+++ b/src/lib/libcrypto/md2/md2_dgst.c
@@ -0,0 +1,229 @@
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#include <openssl/fips.h>
66#include <openssl/err.h>
67
68const char *MD2_version="MD2" OPENSSL_VERSION_PTEXT;
69
70/* Implemented from RFC1319 The MD2 Message-Digest Algorithm
71 */
72
73#define UCHAR unsigned char
74
75static void md2_block(MD2_CTX *c, const unsigned char *d);
76/* The magic S table - I have converted it to hex since it is
77 * basically just a random byte string. */
78static MD2_INT S[256]={
79 0x29, 0x2E, 0x43, 0xC9, 0xA2, 0xD8, 0x7C, 0x01,
80 0x3D, 0x36, 0x54, 0xA1, 0xEC, 0xF0, 0x06, 0x13,
81 0x62, 0xA7, 0x05, 0xF3, 0xC0, 0xC7, 0x73, 0x8C,
82 0x98, 0x93, 0x2B, 0xD9, 0xBC, 0x4C, 0x82, 0xCA,
83 0x1E, 0x9B, 0x57, 0x3C, 0xFD, 0xD4, 0xE0, 0x16,
84 0x67, 0x42, 0x6F, 0x18, 0x8A, 0x17, 0xE5, 0x12,
85 0xBE, 0x4E, 0xC4, 0xD6, 0xDA, 0x9E, 0xDE, 0x49,
86 0xA0, 0xFB, 0xF5, 0x8E, 0xBB, 0x2F, 0xEE, 0x7A,
87 0xA9, 0x68, 0x79, 0x91, 0x15, 0xB2, 0x07, 0x3F,
88 0x94, 0xC2, 0x10, 0x89, 0x0B, 0x22, 0x5F, 0x21,
89 0x80, 0x7F, 0x5D, 0x9A, 0x5A, 0x90, 0x32, 0x27,
90 0x35, 0x3E, 0xCC, 0xE7, 0xBF, 0xF7, 0x97, 0x03,
91 0xFF, 0x19, 0x30, 0xB3, 0x48, 0xA5, 0xB5, 0xD1,
92 0xD7, 0x5E, 0x92, 0x2A, 0xAC, 0x56, 0xAA, 0xC6,
93 0x4F, 0xB8, 0x38, 0xD2, 0x96, 0xA4, 0x7D, 0xB6,
94 0x76, 0xFC, 0x6B, 0xE2, 0x9C, 0x74, 0x04, 0xF1,
95 0x45, 0x9D, 0x70, 0x59, 0x64, 0x71, 0x87, 0x20,
96 0x86, 0x5B, 0xCF, 0x65, 0xE6, 0x2D, 0xA8, 0x02,
97 0x1B, 0x60, 0x25, 0xAD, 0xAE, 0xB0, 0xB9, 0xF6,
98 0x1C, 0x46, 0x61, 0x69, 0x34, 0x40, 0x7E, 0x0F,
99 0x55, 0x47, 0xA3, 0x23, 0xDD, 0x51, 0xAF, 0x3A,
100 0xC3, 0x5C, 0xF9, 0xCE, 0xBA, 0xC5, 0xEA, 0x26,
101 0x2C, 0x53, 0x0D, 0x6E, 0x85, 0x28, 0x84, 0x09,
102 0xD3, 0xDF, 0xCD, 0xF4, 0x41, 0x81, 0x4D, 0x52,
103 0x6A, 0xDC, 0x37, 0xC8, 0x6C, 0xC1, 0xAB, 0xFA,
104 0x24, 0xE1, 0x7B, 0x08, 0x0C, 0xBD, 0xB1, 0x4A,
105 0x78, 0x88, 0x95, 0x8B, 0xE3, 0x63, 0xE8, 0x6D,
106 0xE9, 0xCB, 0xD5, 0xFE, 0x3B, 0x00, 0x1D, 0x39,
107 0xF2, 0xEF, 0xB7, 0x0E, 0x66, 0x58, 0xD0, 0xE4,
108 0xA6, 0x77, 0x72, 0xF8, 0xEB, 0x75, 0x4B, 0x0A,
109 0x31, 0x44, 0x50, 0xB4, 0x8F, 0xED, 0x1F, 0x1A,
110 0xDB, 0x99, 0x8D, 0x33, 0x9F, 0x11, 0x83, 0x14,
111 };
112
113const char *MD2_options(void)
114 {
115 if (sizeof(MD2_INT) == 1)
116 return("md2(char)");
117 else
118 return("md2(int)");
119 }
120
121FIPS_NON_FIPS_MD_Init(MD2)
122 {
123 c->num=0;
124 memset(c->state,0,sizeof c->state);
125 memset(c->cksm,0,sizeof c->cksm);
126 memset(c->data,0,sizeof c->data);
127 return 1;
128 }
129
130int MD2_Update(MD2_CTX *c, const unsigned char *data, unsigned long len)
131 {
132 register UCHAR *p;
133
134 if (len == 0) return 1;
135
136 p=c->data;
137 if (c->num != 0)
138 {
139 if ((c->num+len) >= MD2_BLOCK)
140 {
141 memcpy(&(p[c->num]),data,MD2_BLOCK-c->num);
142 md2_block(c,c->data);
143 data+=(MD2_BLOCK - c->num);
144 len-=(MD2_BLOCK - c->num);
145 c->num=0;
146 /* drop through and do the rest */
147 }
148 else
149 {
150 memcpy(&(p[c->num]),data,(int)len);
151 /* data+=len; */
152 c->num+=(int)len;
153 return 1;
154 }
155 }
156 /* we now can process the input data in blocks of MD2_BLOCK
157 * chars and save the leftovers to c->data. */
158 while (len >= MD2_BLOCK)
159 {
160 md2_block(c,data);
161 data+=MD2_BLOCK;
162 len-=MD2_BLOCK;
163 }
164 memcpy(p,data,(int)len);
165 c->num=(int)len;
166 return 1;
167 }
168
169static void md2_block(MD2_CTX *c, const unsigned char *d)
170 {
171 register MD2_INT t,*sp1,*sp2;
172 register int i,j;
173 MD2_INT state[48];
174
175 sp1=c->state;
176 sp2=c->cksm;
177 j=sp2[MD2_BLOCK-1];
178 for (i=0; i<16; i++)
179 {
180 state[i]=sp1[i];
181 state[i+16]=t=d[i];
182 state[i+32]=(t^sp1[i]);
183 j=sp2[i]^=S[t^j];
184 }
185 t=0;
186 for (i=0; i<18; i++)
187 {
188 for (j=0; j<48; j+=8)
189 {
190 t= state[j+ 0]^=S[t];
191 t= state[j+ 1]^=S[t];
192 t= state[j+ 2]^=S[t];
193 t= state[j+ 3]^=S[t];
194 t= state[j+ 4]^=S[t];
195 t= state[j+ 5]^=S[t];
196 t= state[j+ 6]^=S[t];
197 t= state[j+ 7]^=S[t];
198 }
199 t=(t+i)&0xff;
200 }
201 memcpy(sp1,state,16*sizeof(MD2_INT));
202 OPENSSL_cleanse(state,48*sizeof(MD2_INT));
203 }
204
205int MD2_Final(unsigned char *md, MD2_CTX *c)
206 {
207 int i,v;
208 register UCHAR *cp;
209 register MD2_INT *p1,*p2;
210
211 cp=c->data;
212 p1=c->state;
213 p2=c->cksm;
214 v=MD2_BLOCK-c->num;
215 for (i=c->num; i<MD2_BLOCK; i++)
216 cp[i]=(UCHAR)v;
217
218 md2_block(c,cp);
219
220 for (i=0; i<MD2_BLOCK; i++)
221 cp[i]=(UCHAR)p2[i];
222 md2_block(c,cp);
223
224 for (i=0; i<16; i++)
225 md[i]=(UCHAR)(p1[i]&0xff);
226 memset((char *)&c,0,sizeof(c));
227 return 1;
228 }
229
diff --git a/src/lib/libcrypto/md2/md2_one.c b/src/lib/libcrypto/md2/md2_one.c
new file mode 100644
index 0000000000..835160ef56
--- /dev/null
+++ b/src/lib/libcrypto/md2/md2_one.c
@@ -0,0 +1,93 @@
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, unsigned long 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 MD2_Init(&c);
73#ifndef CHARSET_EBCDIC
74 MD2_Update(&c,d,n);
75#else
76 {
77 char temp[1024];
78 unsigned long chunk;
79
80 while (n > 0)
81 {
82 chunk = (n > sizeof(temp)) ? sizeof(temp) : n;
83 ebcdic2ascii(temp, d, chunk);
84 MD2_Update(&c,temp,chunk);
85 n -= chunk;
86 d += chunk;
87 }
88 }
89#endif
90 MD2_Final(md,&c);
91 OPENSSL_cleanse(&c,sizeof(c)); /* Security consideration */
92 return(md);
93 }
diff --git a/src/lib/libcrypto/md2/md2test.c b/src/lib/libcrypto/md2/md2test.c
new file mode 100644
index 0000000000..9c1e28b6ce
--- /dev/null
+++ b/src/lib/libcrypto/md2/md2test.c
@@ -0,0 +1,139 @@
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,(unsigned long)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 EXIT(err);
128 }
129
130static char *pt(unsigned char *md)
131 {
132 int i;
133 static char buf[80];
134
135 for (i=0; i<MD2_DIGEST_LENGTH; i++)
136 sprintf(&(buf[i*2]),"%02x",md[i]);
137 return(buf);
138 }
139#endif
diff --git a/src/lib/libcrypto/md4/Makefile b/src/lib/libcrypto/md4/Makefile
new file mode 100644
index 0000000000..eeb457f20f
--- /dev/null
+++ b/src/lib/libcrypto/md4/Makefile
@@ -0,0 +1,92 @@
1#
2# OpenSSL/crypto/md4/Makefile
3#
4
5DIR= md4
6TOP= ../..
7CC= cc
8CPP= $(CC) -E
9INCLUDES=
10CFLAG=-g
11INSTALL_PREFIX=
12OPENSSLDIR= /usr/local/ssl
13INSTALLTOP=/usr/local/ssl
14MAKEDEPPROG= makedepend
15MAKEDEPEND= $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG)
16MAKEFILE= Makefile
17AR= ar r
18
19CFLAGS= $(INCLUDES) $(CFLAG)
20
21GENERAL=Makefile
22TEST=md4test.c
23APPS=md4.c
24
25LIB=$(TOP)/libcrypto.a
26LIBSRC=md4_dgst.c md4_one.c
27LIBOBJ=md4_dgst.o md4_one.o
28
29SRC= $(LIBSRC)
30
31EXHEADER= md4.h
32HEADER= md4_locl.h $(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 @headerlist="$(EXHEADER)"; for i in $$headerlist ; \
56 do \
57 (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
58 chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
59 done;
60
61tags:
62 ctags $(SRC)
63
64tests:
65
66lint:
67 lint -DLINT $(INCLUDES) $(SRC)>fluff
68
69depend:
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 asm/mx86unix.cpp *.o asm/*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
78
79# DO NOT DELETE THIS LINE -- make depend depends on it.
80
81md4_dgst.o: ../../include/openssl/bio.h ../../include/openssl/crypto.h
82md4_dgst.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
83md4_dgst.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
84md4_dgst.o: ../../include/openssl/md4.h ../../include/openssl/opensslconf.h
85md4_dgst.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
86md4_dgst.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
87md4_dgst.o: ../md32_common.h md4_dgst.c md4_locl.h
88md4_one.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
89md4_one.o: ../../include/openssl/md4.h ../../include/openssl/opensslconf.h
90md4_one.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
91md4_one.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
92md4_one.o: md4_one.c
diff --git a/src/lib/libcrypto/md4/Makefile.ssl b/src/lib/libcrypto/md4/Makefile.ssl
new file mode 100644
index 0000000000..7d2e8d8d3b
--- /dev/null
+++ b/src/lib/libcrypto/md4/Makefile.ssl
@@ -0,0 +1,91 @@
1#
2# SSLeay/crypto/md4/Makefile
3#
4
5DIR= md4
6TOP= ../..
7CC= cc
8CPP= $(CC) -E
9INCLUDES=
10CFLAG=-g
11INSTALL_PREFIX=
12OPENSSLDIR= /usr/local/ssl
13INSTALLTOP=/usr/local/ssl
14MAKE= make -f Makefile.ssl
15MAKEDEPPROG= makedepend
16MAKEDEPEND= $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG)
17MAKEFILE= Makefile.ssl
18AR= ar r
19
20CFLAGS= $(INCLUDES) $(CFLAG)
21
22GENERAL=Makefile
23TEST=md4test.c
24APPS=md4.c
25
26LIB=$(TOP)/libcrypto.a
27LIBSRC=md4_dgst.c md4_one.c
28LIBOBJ=md4_dgst.o md4_one.o
29
30SRC= $(LIBSRC)
31
32EXHEADER= md4.h
33HEADER= md4_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
47files:
48 $(PERL) $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO
49
50links:
51 @sh $(TOP)/util/point.sh Makefile.ssl Makefile
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 @for i in $(EXHEADER) ; \
58 do \
59 (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
60 chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
61 done;
62
63tags:
64 ctags $(SRC)
65
66tests:
67
68lint:
69 lint -DLINT $(INCLUDES) $(SRC)>fluff
70
71depend:
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 asm/mx86unix.cpp *.o asm/*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
80
81# DO NOT DELETE THIS LINE -- make depend depends on it.
82
83md4_dgst.o: ../../include/openssl/e_os2.h ../../include/openssl/md4.h
84md4_dgst.o: ../../include/openssl/opensslconf.h
85md4_dgst.o: ../../include/openssl/opensslv.h ../md32_common.h md4_dgst.c
86md4_dgst.o: md4_locl.h
87md4_one.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
88md4_one.o: ../../include/openssl/md4.h ../../include/openssl/opensslconf.h
89md4_one.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
90md4_one.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
91md4_one.o: 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_one.c b/src/lib/libcrypto/md4/md4_one.c
index 50f79352f6..00565507e4 100644
--- a/src/lib/libcrypto/md4/md4_one.c
+++ b/src/lib/libcrypto/md4/md4_one.c
@@ -71,8 +71,7 @@ unsigned char *MD4(const unsigned char *d, unsigned long n, unsigned char *md)
71 static unsigned char m[MD4_DIGEST_LENGTH]; 71 static unsigned char m[MD4_DIGEST_LENGTH];
72 72
73 if (md == NULL) md=m; 73 if (md == NULL) md=m;
74 if (!MD4_Init(&c)) 74 MD4_Init(&c);
75 return NULL;
76#ifndef CHARSET_EBCDIC 75#ifndef CHARSET_EBCDIC
77 MD4_Update(&c,d,n); 76 MD4_Update(&c,d,n);
78#else 77#else
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..21a77d96f7
--- /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 unsigned char **P,**R;
101 char *p;
102 unsigned char md[MD4_DIGEST_LENGTH];
103
104 P=(unsigned char **)test;
105 R=(unsigned char **)ret;
106 i=1;
107 while (*P != NULL)
108 {
109 EVP_Digest(&(P[0][0]),(unsigned long)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..1ed018526f
--- /dev/null
+++ b/src/lib/libcrypto/md5/Makefile
@@ -0,0 +1,128 @@
1#
2# OpenSSL/crypto/md5/Makefile
3#
4
5DIR= md5
6TOP= ../..
7CC= cc
8CPP= $(CC) -E
9INCLUDES=-I.. -I$(TOP) -I../../include
10CFLAG=-g
11INSTALL_PREFIX=
12OPENSSLDIR= /usr/local/ssl
13INSTALLTOP=/usr/local/ssl
14MAKEDEPPROG= makedepend
15MAKEDEPEND= $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG)
16MAKEFILE= Makefile
17AR= ar r
18
19MD5_ASM_OBJ=
20
21CFLAGS= $(INCLUDES) $(CFLAG)
22ASFLAGS= $(INCLUDES) $(ASFLAG)
23
24GENERAL=Makefile
25TEST=md5test.c
26APPS=
27
28LIB=$(TOP)/libcrypto.a
29LIBSRC=md5_dgst.c md5_one.c
30LIBOBJ=md5_dgst.o md5_one.o $(MD5_ASM_OBJ)
31
32SRC= $(LIBSRC)
33
34EXHEADER= md5.h
35HEADER= md5_locl.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
49# elf
50asm/mx86-elf.s: asm/md5-586.pl ../perlasm/x86asm.pl
51 (cd asm; $(PERL) md5-586.pl elf $(CFLAGS) > mx86-elf.s)
52
53# a.out
54asm/mx86-out.o: asm/mx86unix.cpp
55 $(CPP) -DOUT asm/mx86unix.cpp | as -o asm/mx86-out.o
56
57# bsdi
58asm/mx86bsdi.o: asm/mx86unix.cpp
59 $(CPP) -DBSDI asm/mx86unix.cpp | sed 's/ :/:/' | as -o asm/mx86bsdi.o
60
61asm/mx86unix.cpp: asm/md5-586.pl ../perlasm/x86asm.pl
62 (cd asm; $(PERL) md5-586.pl cpp >mx86unix.cpp)
63
64asm/md5-sparcv8plus.o: asm/md5-sparcv9.S
65 $(CC) $(ASFLAGS) -DMD5_BLOCK_DATA_ORDER -c \
66 -o asm/md5-sparcv8plus.o asm/md5-sparcv9.S
67
68# Old GNU assembler doesn't understand V9 instructions, so we
69# hire /usr/ccs/bin/as to do the job. Note that option is called
70# *-gcc27, but even gcc 2>=8 users may experience similar problem
71# if they didn't bother to upgrade GNU assembler. Such users should
72# not choose this option, but be adviced to *remove* GNU assembler
73# or upgrade it.
74asm/md5-sparcv8plus-gcc27.o: asm/md5-sparcv9.S
75 $(CC) $(ASFLAGS) -DMD5_BLOCK_DATA_ORDER -E asm/md5-sparcv9.S | \
76 /usr/ccs/bin/as -xarch=v8plus - -o asm/md5-sparcv8plus-gcc27.o
77
78asm/md5-sparcv9.o: asm/md5-sparcv9.S
79 $(CC) $(ASFLAGS) -DMD5_BLOCK_DATA_ORDER -c \
80 -o asm/md5-sparcv9.o asm/md5-sparcv9.S
81
82files:
83 $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
84
85links:
86 @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
87 @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
88 @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
89
90install:
91 @headerlist="$(EXHEADER)"; for i in $$headerlist ; \
92 do \
93 (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
94 chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
95 done;
96
97tags:
98 ctags $(SRC)
99
100tests:
101
102lint:
103 lint -DLINT $(INCLUDES) $(SRC)>fluff
104
105depend:
106 $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
107
108dclean:
109 $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
110 mv -f Makefile.new $(MAKEFILE)
111
112clean:
113 rm -f asm/mx86unix.cpp asm/*-elf.* *.o asm/*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
114
115# DO NOT DELETE THIS LINE -- make depend depends on it.
116
117md5_dgst.o: ../../include/openssl/bio.h ../../include/openssl/crypto.h
118md5_dgst.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
119md5_dgst.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
120md5_dgst.o: ../../include/openssl/md5.h ../../include/openssl/opensslconf.h
121md5_dgst.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
122md5_dgst.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
123md5_dgst.o: ../md32_common.h md5_dgst.c md5_locl.h
124md5_one.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
125md5_one.o: ../../include/openssl/md5.h ../../include/openssl/opensslconf.h
126md5_one.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
127md5_one.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
128md5_one.o: md5_one.c
diff --git a/src/lib/libcrypto/md5/Makefile.ssl b/src/lib/libcrypto/md5/Makefile.ssl
new file mode 100644
index 0000000000..2361775a2d
--- /dev/null
+++ b/src/lib/libcrypto/md5/Makefile.ssl
@@ -0,0 +1,127 @@
1#
2# SSLeay/crypto/md5/Makefile
3#
4
5DIR= md5
6TOP= ../..
7CC= cc
8CPP= $(CC) -E
9INCLUDES=-I.. -I$(TOP) -I../../include
10CFLAG=-g
11INSTALL_PREFIX=
12OPENSSLDIR= /usr/local/ssl
13INSTALLTOP=/usr/local/ssl
14MAKE= make -f Makefile.ssl
15MAKEDEPPROG= makedepend
16MAKEDEPEND= $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG)
17MAKEFILE= Makefile.ssl
18AR= ar r
19
20MD5_ASM_OBJ=
21
22CFLAGS= $(INCLUDES) $(CFLAG)
23ASFLAGS= $(INCLUDES) $(ASFLAG)
24
25GENERAL=Makefile
26TEST=md5test.c
27APPS=
28
29LIB=$(TOP)/libcrypto.a
30LIBSRC=md5_dgst.c md5_one.c
31LIBOBJ=md5_dgst.o md5_one.o $(MD5_ASM_OBJ)
32
33SRC= $(LIBSRC)
34
35EXHEADER= md5.h
36HEADER= md5_locl.h $(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
50# elf
51asm/mx86-elf.s: asm/md5-586.pl ../perlasm/x86asm.pl
52 (cd asm; $(PERL) md5-586.pl elf $(CFLAGS) > mx86-elf.s)
53
54# a.out
55asm/mx86-out.o: asm/mx86unix.cpp
56 $(CPP) -DOUT asm/mx86unix.cpp | as -o asm/mx86-out.o
57
58# bsdi
59asm/mx86bsdi.o: asm/mx86unix.cpp
60 $(CPP) -DBSDI asm/mx86unix.cpp | sed 's/ :/:/' | as -o asm/mx86bsdi.o
61
62asm/mx86unix.cpp: asm/md5-586.pl ../perlasm/x86asm.pl
63 (cd asm; $(PERL) md5-586.pl cpp >mx86unix.cpp)
64
65asm/md5-sparcv8plus.o: asm/md5-sparcv9.S
66 $(CC) $(ASFLAGS) -DMD5_BLOCK_DATA_ORDER -c \
67 -o asm/md5-sparcv8plus.o asm/md5-sparcv9.S
68
69# Old GNU assembler doesn't understand V9 instructions, so we
70# hire /usr/ccs/bin/as to do the job. Note that option is called
71# *-gcc27, but even gcc 2>=8 users may experience similar problem
72# if they didn't bother to upgrade GNU assembler. Such users should
73# not choose this option, but be adviced to *remove* GNU assembler
74# or upgrade it.
75asm/md5-sparcv8plus-gcc27.o: asm/md5-sparcv9.S
76 $(CC) $(ASFLAGS) -DMD5_BLOCK_DATA_ORDER -E asm/md5-sparcv9.S | \
77 /usr/ccs/bin/as -xarch=v8plus - -o asm/md5-sparcv8plus-gcc27.o
78
79asm/md5-sparcv9.o: asm/md5-sparcv9.S
80 $(CC) $(ASFLAGS) -DMD5_BLOCK_DATA_ORDER -c \
81 -o asm/md5-sparcv9.o asm/md5-sparcv9.S
82
83files:
84 $(PERL) $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO
85
86links:
87 @sh $(TOP)/util/point.sh Makefile.ssl Makefile
88 @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
89 @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
90 @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
91
92install:
93 @for i in $(EXHEADER) ; \
94 do \
95 (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
96 chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
97 done;
98
99tags:
100 ctags $(SRC)
101
102tests:
103
104lint:
105 lint -DLINT $(INCLUDES) $(SRC)>fluff
106
107depend:
108 $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
109
110dclean:
111 $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
112 mv -f Makefile.new $(MAKEFILE)
113
114clean:
115 rm -f asm/mx86unix.cpp asm/*-elf.* *.o asm/*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
116
117# DO NOT DELETE THIS LINE -- make depend depends on it.
118
119md5_dgst.o: ../../include/openssl/e_os2.h ../../include/openssl/md5.h
120md5_dgst.o: ../../include/openssl/opensslconf.h
121md5_dgst.o: ../../include/openssl/opensslv.h ../md32_common.h md5_dgst.c
122md5_dgst.o: md5_locl.h
123md5_one.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
124md5_one.o: ../../include/openssl/md5.h ../../include/openssl/opensslconf.h
125md5_one.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
126md5_one.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
127md5_one.o: md5_one.c
diff --git a/src/lib/libcrypto/md5/asm/md5-sparcv9.S b/src/lib/libcrypto/md5/asm/md5-sparcv9.S
new file mode 100644
index 0000000000..db45aa4c97
--- /dev/null
+++ b/src/lib/libcrypto/md5/asm/md5-sparcv9.S
@@ -0,0 +1,1031 @@
1.ident "md5-sparcv9.S, Version 1.0"
2.ident "SPARC V9 ISA artwork by Andy Polyakov <appro@fy.chalmers.se>"
3.file "md5-sparcv9.S"
4
5/*
6 * ====================================================================
7 * Copyright (c) 1999 Andy Polyakov <appro@fy.chalmers.se>.
8 *
9 * Rights for redistribution and usage in source and binary forms are
10 * granted as long as above copyright notices are retained. Warranty
11 * of any kind is (of course:-) disclaimed.
12 * ====================================================================
13 */
14
15/*
16 * This is my modest contribution to OpenSSL project (see
17 * http://www.openssl.org/ for more information about it) and is an
18 * assembler implementation of MD5 block hash function. I've hand-coded
19 * this for the sole reason to reach UltraSPARC-specific "load in
20 * little-endian byte order" instruction. This gives up to 15%
21 * performance improvement for cases when input message is aligned at
22 * 32 bits boundary. The module was tested under both 32 *and* 64 bit
23 * kernels. For updates see http://fy.chalmers.se/~appro/hpe/.
24 *
25 * To compile with SC4.x/SC5.x:
26 *
27 * cc -xarch=v[9|8plus] -DOPENSSL_SYSNAME_ULTRASPARC -DMD5_BLOCK_DATA_ORDER \
28 * -c md5-sparcv9.S
29 *
30 * and with gcc:
31 *
32 * gcc -mcpu=ultrasparc -DOPENSSL_SYSNAME_ULTRASPARC -DMD5_BLOCK_DATA_ORDER \
33 * -c md5-sparcv9.S
34 *
35 * or if above fails (it does if you have gas):
36 *
37 * gcc -E -DOPENSSL_SYSNAMEULTRASPARC -DMD5_BLOCK_DATA_ORDER md5_block.sparc.S | \
38 * as -xarch=v8plus /dev/fd/0 -o md5-sparcv9.o
39 */
40
41#include <openssl/e_os2.h>
42
43#define A %o0
44#define B %o1
45#define C %o2
46#define D %o3
47#define T1 %o4
48#define T2 %o5
49
50#define R0 %l0
51#define R1 %l1
52#define R2 %l2
53#define R3 %l3
54#define R4 %l4
55#define R5 %l5
56#define R6 %l6
57#define R7 %l7
58#define R8 %i3
59#define R9 %i4
60#define R10 %i5
61#define R11 %g1
62#define R12 %g2
63#define R13 %g3
64#define RX %g4
65
66#define Aptr %i0+0
67#define Bptr %i0+4
68#define Cptr %i0+8
69#define Dptr %i0+12
70
71#define Aval R5 /* those not used at the end of the last round */
72#define Bval R6
73#define Cval R7
74#define Dval R8
75
76#if defined(MD5_BLOCK_DATA_ORDER)
77# if defined(OPENSSL_SYSNAME_ULTRASPARC)
78# define LOAD lda
79# define X(i) [%i1+i*4]%asi
80# define md5_block md5_block_asm_data_order_aligned
81# define ASI_PRIMARY_LITTLE 0x88
82# else
83# error "MD5_BLOCK_DATA_ORDER is supported only on UltraSPARC!"
84# endif
85#else
86# define LOAD ld
87# define X(i) [%i1+i*4]
88# define md5_block md5_block_asm_host_order
89#endif
90
91.section ".text",#alloc,#execinstr
92
93#if defined(__SUNPRO_C) && defined(__sparcv9)
94 /* They've said -xarch=v9 at command line */
95 .register %g2,#scratch
96 .register %g3,#scratch
97# define FRAME -192
98#elif defined(__GNUC__) && defined(__arch64__)
99 /* They've said -m64 at command line */
100 .register %g2,#scratch
101 .register %g3,#scratch
102# define FRAME -192
103#else
104# define FRAME -96
105#endif
106
107.align 32
108
109.global md5_block
110md5_block:
111 save %sp,FRAME,%sp
112
113 ld [Dptr],D
114 ld [Cptr],C
115 ld [Bptr],B
116 ld [Aptr],A
117#ifdef ASI_PRIMARY_LITTLE
118 rd %asi,%o7 ! How dare I? Well, I just do:-)
119 wr %g0,ASI_PRIMARY_LITTLE,%asi
120#endif
121 LOAD X(0),R0
122
123.Lmd5_block_loop:
124
125!!!!!!!!Round 0
126
127 xor C,D,T1
128 sethi %hi(0xd76aa478),T2
129 and T1,B,T1
130 or T2,%lo(0xd76aa478),T2 !=
131 xor T1,D,T1
132 add T1,R0,T1
133 LOAD X(1),R1
134 add T1,T2,T1 !=
135 add A,T1,A
136 sll A,7,T2
137 srl A,32-7,A
138 or A,T2,A !=
139 xor B,C,T1
140 add A,B,A
141
142 sethi %hi(0xe8c7b756),T2
143 and T1,A,T1 !=
144 or T2,%lo(0xe8c7b756),T2
145 xor T1,C,T1
146 LOAD X(2),R2
147 add T1,R1,T1 !=
148 add T1,T2,T1
149 add D,T1,D
150 sll D,12,T2
151 srl D,32-12,D !=
152 or D,T2,D
153 xor A,B,T1
154 add D,A,D
155
156 sethi %hi(0x242070db),T2 !=
157 and T1,D,T1
158 or T2,%lo(0x242070db),T2
159 xor T1,B,T1
160 add T1,R2,T1 !=
161 LOAD X(3),R3
162 add T1,T2,T1
163 add C,T1,C
164 sll C,17,T2 !=
165 srl C,32-17,C
166 or C,T2,C
167 xor D,A,T1
168 add C,D,C !=
169
170 sethi %hi(0xc1bdceee),T2
171 and T1,C,T1
172 or T2,%lo(0xc1bdceee),T2
173 xor T1,A,T1 !=
174 add T1,R3,T1
175 LOAD X(4),R4
176 add T1,T2,T1
177 add B,T1,B !=
178 sll B,22,T2
179 srl B,32-22,B
180 or B,T2,B
181 xor C,D,T1 !=
182 add B,C,B
183
184 sethi %hi(0xf57c0faf),T2
185 and T1,B,T1
186 or T2,%lo(0xf57c0faf),T2 !=
187 xor T1,D,T1
188 add T1,R4,T1
189 LOAD X(5),R5
190 add T1,T2,T1 !=
191 add A,T1,A
192 sll A,7,T2
193 srl A,32-7,A
194 or A,T2,A !=
195 xor B,C,T1
196 add A,B,A
197
198 sethi %hi(0x4787c62a),T2
199 and T1,A,T1 !=
200 or T2,%lo(0x4787c62a),T2
201 xor T1,C,T1
202 LOAD X(6),R6
203 add T1,R5,T1 !=
204 add T1,T2,T1
205 add D,T1,D
206 sll D,12,T2
207 srl D,32-12,D !=
208 or D,T2,D
209 xor A,B,T1
210 add D,A,D
211
212 sethi %hi(0xa8304613),T2 !=
213 and T1,D,T1
214 or T2,%lo(0xa8304613),T2
215 xor T1,B,T1
216 add T1,R6,T1 !=
217 LOAD X(7),R7
218 add T1,T2,T1
219 add C,T1,C
220 sll C,17,T2 !=
221 srl C,32-17,C
222 or C,T2,C
223 xor D,A,T1
224 add C,D,C !=
225
226 sethi %hi(0xfd469501),T2
227 and T1,C,T1
228 or T2,%lo(0xfd469501),T2
229 xor T1,A,T1 !=
230 add T1,R7,T1
231 LOAD X(8),R8
232 add T1,T2,T1
233 add B,T1,B !=
234 sll B,22,T2
235 srl B,32-22,B
236 or B,T2,B
237 xor C,D,T1 !=
238 add B,C,B
239
240 sethi %hi(0x698098d8),T2
241 and T1,B,T1
242 or T2,%lo(0x698098d8),T2 !=
243 xor T1,D,T1
244 add T1,R8,T1
245 LOAD X(9),R9
246 add T1,T2,T1 !=
247 add A,T1,A
248 sll A,7,T2
249 srl A,32-7,A
250 or A,T2,A !=
251 xor B,C,T1
252 add A,B,A
253
254 sethi %hi(0x8b44f7af),T2
255 and T1,A,T1 !=
256 or T2,%lo(0x8b44f7af),T2
257 xor T1,C,T1
258 LOAD X(10),R10
259 add T1,R9,T1 !=
260 add T1,T2,T1
261 add D,T1,D
262 sll D,12,T2
263 srl D,32-12,D !=
264 or D,T2,D
265 xor A,B,T1
266 add D,A,D
267
268 sethi %hi(0xffff5bb1),T2 !=
269 and T1,D,T1
270 or T2,%lo(0xffff5bb1),T2
271 xor T1,B,T1
272 add T1,R10,T1 !=
273 LOAD X(11),R11
274 add T1,T2,T1
275 add C,T1,C
276 sll C,17,T2 !=
277 srl C,32-17,C
278 or C,T2,C
279 xor D,A,T1
280 add C,D,C !=
281
282 sethi %hi(0x895cd7be),T2
283 and T1,C,T1
284 or T2,%lo(0x895cd7be),T2
285 xor T1,A,T1 !=
286 add T1,R11,T1
287 LOAD X(12),R12
288 add T1,T2,T1
289 add B,T1,B !=
290 sll B,22,T2
291 srl B,32-22,B
292 or B,T2,B
293 xor C,D,T1 !=
294 add B,C,B
295
296 sethi %hi(0x6b901122),T2
297 and T1,B,T1
298 or T2,%lo(0x6b901122),T2 !=
299 xor T1,D,T1
300 add T1,R12,T1
301 LOAD X(13),R13
302 add T1,T2,T1 !=
303 add A,T1,A
304 sll A,7,T2
305 srl A,32-7,A
306 or A,T2,A !=
307 xor B,C,T1
308 add A,B,A
309
310 sethi %hi(0xfd987193),T2
311 and T1,A,T1 !=
312 or T2,%lo(0xfd987193),T2
313 xor T1,C,T1
314 LOAD X(14),RX
315 add T1,R13,T1 !=
316 add T1,T2,T1
317 add D,T1,D
318 sll D,12,T2
319 srl D,32-12,D !=
320 or D,T2,D
321 xor A,B,T1
322 add D,A,D
323
324 sethi %hi(0xa679438e),T2 !=
325 and T1,D,T1
326 or T2,%lo(0xa679438e),T2
327 xor T1,B,T1
328 add T1,RX,T1 !=
329 LOAD X(15),RX
330 add T1,T2,T1
331 add C,T1,C
332 sll C,17,T2 !=
333 srl C,32-17,C
334 or C,T2,C
335 xor D,A,T1
336 add C,D,C !=
337
338 sethi %hi(0x49b40821),T2
339 and T1,C,T1
340 or T2,%lo(0x49b40821),T2
341 xor T1,A,T1 !=
342 add T1,RX,T1
343 !pre-LOADed X(1),R1
344 add T1,T2,T1
345 add B,T1,B
346 sll B,22,T2 !=
347 srl B,32-22,B
348 or B,T2,B
349 add B,C,B
350
351!!!!!!!!Round 1
352
353 xor B,C,T1 !=
354 sethi %hi(0xf61e2562),T2
355 and T1,D,T1
356 or T2,%lo(0xf61e2562),T2
357 xor T1,C,T1 !=
358 add T1,R1,T1
359 !pre-LOADed X(6),R6
360 add T1,T2,T1
361 add A,T1,A
362 sll A,5,T2 !=
363 srl A,32-5,A
364 or A,T2,A
365 add A,B,A
366
367 xor A,B,T1 !=
368 sethi %hi(0xc040b340),T2
369 and T1,C,T1
370 or T2,%lo(0xc040b340),T2
371 xor T1,B,T1 !=
372 add T1,R6,T1
373 !pre-LOADed X(11),R11
374 add T1,T2,T1
375 add D,T1,D
376 sll D,9,T2 !=
377 srl D,32-9,D
378 or D,T2,D
379 add D,A,D
380
381 xor D,A,T1 !=
382 sethi %hi(0x265e5a51),T2
383 and T1,B,T1
384 or T2,%lo(0x265e5a51),T2
385 xor T1,A,T1 !=
386 add T1,R11,T1
387 !pre-LOADed X(0),R0
388 add T1,T2,T1
389 add C,T1,C
390 sll C,14,T2 !=
391 srl C,32-14,C
392 or C,T2,C
393 add C,D,C
394
395 xor C,D,T1 !=
396 sethi %hi(0xe9b6c7aa),T2
397 and T1,A,T1
398 or T2,%lo(0xe9b6c7aa),T2
399 xor T1,D,T1 !=
400 add T1,R0,T1
401 !pre-LOADed X(5),R5
402 add T1,T2,T1
403 add B,T1,B
404 sll B,20,T2 !=
405 srl B,32-20,B
406 or B,T2,B
407 add B,C,B
408
409 xor B,C,T1 !=
410 sethi %hi(0xd62f105d),T2
411 and T1,D,T1
412 or T2,%lo(0xd62f105d),T2
413 xor T1,C,T1 !=
414 add T1,R5,T1
415 !pre-LOADed X(10),R10
416 add T1,T2,T1
417 add A,T1,A
418 sll A,5,T2 !=
419 srl A,32-5,A
420 or A,T2,A
421 add A,B,A
422
423 xor A,B,T1 !=
424 sethi %hi(0x02441453),T2
425 and T1,C,T1
426 or T2,%lo(0x02441453),T2
427 xor T1,B,T1 !=
428 add T1,R10,T1
429 LOAD X(15),RX
430 add T1,T2,T1
431 add D,T1,D !=
432 sll D,9,T2
433 srl D,32-9,D
434 or D,T2,D
435 add D,A,D !=
436
437 xor D,A,T1
438 sethi %hi(0xd8a1e681),T2
439 and T1,B,T1
440 or T2,%lo(0xd8a1e681),T2 !=
441 xor T1,A,T1
442 add T1,RX,T1
443 !pre-LOADed X(4),R4
444 add T1,T2,T1
445 add C,T1,C !=
446 sll C,14,T2
447 srl C,32-14,C
448 or C,T2,C
449 add C,D,C !=
450
451 xor C,D,T1
452 sethi %hi(0xe7d3fbc8),T2
453 and T1,A,T1
454 or T2,%lo(0xe7d3fbc8),T2 !=
455 xor T1,D,T1
456 add T1,R4,T1
457 !pre-LOADed X(9),R9
458 add T1,T2,T1
459 add B,T1,B !=
460 sll B,20,T2
461 srl B,32-20,B
462 or B,T2,B
463 add B,C,B !=
464
465 xor B,C,T1
466 sethi %hi(0x21e1cde6),T2
467 and T1,D,T1
468 or T2,%lo(0x21e1cde6),T2 !=
469 xor T1,C,T1
470 add T1,R9,T1
471 LOAD X(14),RX
472 add T1,T2,T1 !=
473 add A,T1,A
474 sll A,5,T2
475 srl A,32-5,A
476 or A,T2,A !=
477 add A,B,A
478
479 xor A,B,T1
480 sethi %hi(0xc33707d6),T2
481 and T1,C,T1 !=
482 or T2,%lo(0xc33707d6),T2
483 xor T1,B,T1
484 add T1,RX,T1
485 !pre-LOADed X(3),R3
486 add T1,T2,T1 !=
487 add D,T1,D
488 sll D,9,T2
489 srl D,32-9,D
490 or D,T2,D !=
491 add D,A,D
492
493 xor D,A,T1
494 sethi %hi(0xf4d50d87),T2
495 and T1,B,T1 !=
496 or T2,%lo(0xf4d50d87),T2
497 xor T1,A,T1
498 add T1,R3,T1
499 !pre-LOADed X(8),R8
500 add T1,T2,T1 !=
501 add C,T1,C
502 sll C,14,T2
503 srl C,32-14,C
504 or C,T2,C !=
505 add C,D,C
506
507 xor C,D,T1
508 sethi %hi(0x455a14ed),T2
509 and T1,A,T1 !=
510 or T2,%lo(0x455a14ed),T2
511 xor T1,D,T1
512 add T1,R8,T1
513 !pre-LOADed X(13),R13
514 add T1,T2,T1 !=
515 add B,T1,B
516 sll B,20,T2
517 srl B,32-20,B
518 or B,T2,B !=
519 add B,C,B
520
521 xor B,C,T1
522 sethi %hi(0xa9e3e905),T2
523 and T1,D,T1 !=
524 or T2,%lo(0xa9e3e905),T2
525 xor T1,C,T1
526 add T1,R13,T1
527 !pre-LOADed X(2),R2
528 add T1,T2,T1 !=
529 add A,T1,A
530 sll A,5,T2
531 srl A,32-5,A
532 or A,T2,A !=
533 add A,B,A
534
535 xor A,B,T1
536 sethi %hi(0xfcefa3f8),T2
537 and T1,C,T1 !=
538 or T2,%lo(0xfcefa3f8),T2
539 xor T1,B,T1
540 add T1,R2,T1
541 !pre-LOADed X(7),R7
542 add T1,T2,T1 !=
543 add D,T1,D
544 sll D,9,T2
545 srl D,32-9,D
546 or D,T2,D !=
547 add D,A,D
548
549 xor D,A,T1
550 sethi %hi(0x676f02d9),T2
551 and T1,B,T1 !=
552 or T2,%lo(0x676f02d9),T2
553 xor T1,A,T1
554 add T1,R7,T1
555 !pre-LOADed X(12),R12
556 add T1,T2,T1 !=
557 add C,T1,C
558 sll C,14,T2
559 srl C,32-14,C
560 or C,T2,C !=
561 add C,D,C
562
563 xor C,D,T1
564 sethi %hi(0x8d2a4c8a),T2
565 and T1,A,T1 !=
566 or T2,%lo(0x8d2a4c8a),T2
567 xor T1,D,T1
568 add T1,R12,T1
569 !pre-LOADed X(5),R5
570 add T1,T2,T1 !=
571 add B,T1,B
572 sll B,20,T2
573 srl B,32-20,B
574 or B,T2,B !=
575 add B,C,B
576
577!!!!!!!!Round 2
578
579 xor B,C,T1
580 sethi %hi(0xfffa3942),T2
581 xor T1,D,T1 !=
582 or T2,%lo(0xfffa3942),T2
583 add T1,R5,T1
584 !pre-LOADed X(8),R8
585 add T1,T2,T1
586 add A,T1,A !=
587 sll A,4,T2
588 srl A,32-4,A
589 or A,T2,A
590 add A,B,A !=
591
592 xor A,B,T1
593 sethi %hi(0x8771f681),T2
594 xor T1,C,T1
595 or T2,%lo(0x8771f681),T2 !=
596 add T1,R8,T1
597 !pre-LOADed X(11),R11
598 add T1,T2,T1
599 add D,T1,D
600 sll D,11,T2 !=
601 srl D,32-11,D
602 or D,T2,D
603 add D,A,D
604
605 xor D,A,T1 !=
606 sethi %hi(0x6d9d6122),T2
607 xor T1,B,T1
608 or T2,%lo(0x6d9d6122),T2
609 add T1,R11,T1 !=
610 LOAD X(14),RX
611 add T1,T2,T1
612 add C,T1,C
613 sll C,16,T2 !=
614 srl C,32-16,C
615 or C,T2,C
616 add C,D,C
617
618 xor C,D,T1 !=
619 sethi %hi(0xfde5380c),T2
620 xor T1,A,T1
621 or T2,%lo(0xfde5380c),T2
622 add T1,RX,T1 !=
623 !pre-LOADed X(1),R1
624 add T1,T2,T1
625 add B,T1,B
626 sll B,23,T2
627 srl B,32-23,B !=
628 or B,T2,B
629 add B,C,B
630
631 xor B,C,T1
632 sethi %hi(0xa4beea44),T2 !=
633 xor T1,D,T1
634 or T2,%lo(0xa4beea44),T2
635 add T1,R1,T1
636 !pre-LOADed X(4),R4
637 add T1,T2,T1 !=
638 add A,T1,A
639 sll A,4,T2
640 srl A,32-4,A
641 or A,T2,A !=
642 add A,B,A
643
644 xor A,B,T1
645 sethi %hi(0x4bdecfa9),T2
646 xor T1,C,T1 !=
647 or T2,%lo(0x4bdecfa9),T2
648 add T1,R4,T1
649 !pre-LOADed X(7),R7
650 add T1,T2,T1
651 add D,T1,D !=
652 sll D,11,T2
653 srl D,32-11,D
654 or D,T2,D
655 add D,A,D !=
656
657 xor D,A,T1
658 sethi %hi(0xf6bb4b60),T2
659 xor T1,B,T1
660 or T2,%lo(0xf6bb4b60),T2 !=
661 add T1,R7,T1
662 !pre-LOADed X(10),R10
663 add T1,T2,T1
664 add C,T1,C
665 sll C,16,T2 !=
666 srl C,32-16,C
667 or C,T2,C
668 add C,D,C
669
670 xor C,D,T1 !=
671 sethi %hi(0xbebfbc70),T2
672 xor T1,A,T1
673 or T2,%lo(0xbebfbc70),T2
674 add T1,R10,T1 !=
675 !pre-LOADed X(13),R13
676 add T1,T2,T1
677 add B,T1,B
678 sll B,23,T2
679 srl B,32-23,B !=
680 or B,T2,B
681 add B,C,B
682
683 xor B,C,T1
684 sethi %hi(0x289b7ec6),T2 !=
685 xor T1,D,T1
686 or T2,%lo(0x289b7ec6),T2
687 add T1,R13,T1
688 !pre-LOADed X(0),R0
689 add T1,T2,T1 !=
690 add A,T1,A
691 sll A,4,T2
692 srl A,32-4,A
693 or A,T2,A !=
694 add A,B,A
695
696 xor A,B,T1
697 sethi %hi(0xeaa127fa),T2
698 xor T1,C,T1 !=
699 or T2,%lo(0xeaa127fa),T2
700 add T1,R0,T1
701 !pre-LOADed X(3),R3
702 add T1,T2,T1
703 add D,T1,D !=
704 sll D,11,T2
705 srl D,32-11,D
706 or D,T2,D
707 add D,A,D !=
708
709 xor D,A,T1
710 sethi %hi(0xd4ef3085),T2
711 xor T1,B,T1
712 or T2,%lo(0xd4ef3085),T2 !=
713 add T1,R3,T1
714 !pre-LOADed X(6),R6
715 add T1,T2,T1
716 add C,T1,C
717 sll C,16,T2 !=
718 srl C,32-16,C
719 or C,T2,C
720 add C,D,C
721
722 xor C,D,T1 !=
723 sethi %hi(0x04881d05),T2
724 xor T1,A,T1
725 or T2,%lo(0x04881d05),T2
726 add T1,R6,T1 !=
727 !pre-LOADed X(9),R9
728 add T1,T2,T1
729 add B,T1,B
730 sll B,23,T2
731 srl B,32-23,B !=
732 or B,T2,B
733 add B,C,B
734
735 xor B,C,T1
736 sethi %hi(0xd9d4d039),T2 !=
737 xor T1,D,T1
738 or T2,%lo(0xd9d4d039),T2
739 add T1,R9,T1
740 !pre-LOADed X(12),R12
741 add T1,T2,T1 !=
742 add A,T1,A
743 sll A,4,T2
744 srl A,32-4,A
745 or A,T2,A !=
746 add A,B,A
747
748 xor A,B,T1
749 sethi %hi(0xe6db99e5),T2
750 xor T1,C,T1 !=
751 or T2,%lo(0xe6db99e5),T2
752 add T1,R12,T1
753 LOAD X(15),RX
754 add T1,T2,T1 !=
755 add D,T1,D
756 sll D,11,T2
757 srl D,32-11,D
758 or D,T2,D !=
759 add D,A,D
760
761 xor D,A,T1
762 sethi %hi(0x1fa27cf8),T2
763 xor T1,B,T1 !=
764 or T2,%lo(0x1fa27cf8),T2
765 add T1,RX,T1
766 !pre-LOADed X(2),R2
767 add T1,T2,T1
768 add C,T1,C !=
769 sll C,16,T2
770 srl C,32-16,C
771 or C,T2,C
772 add C,D,C !=
773
774 xor C,D,T1
775 sethi %hi(0xc4ac5665),T2
776 xor T1,A,T1
777 or T2,%lo(0xc4ac5665),T2 !=
778 add T1,R2,T1
779 !pre-LOADed X(0),R0
780 add T1,T2,T1
781 add B,T1,B
782 sll B,23,T2 !=
783 srl B,32-23,B
784 or B,T2,B
785 add B,C,B
786
787!!!!!!!!Round 3
788
789 orn B,D,T1 !=
790 sethi %hi(0xf4292244),T2
791 xor T1,C,T1
792 or T2,%lo(0xf4292244),T2
793 add T1,R0,T1 !=
794 !pre-LOADed X(7),R7
795 add T1,T2,T1
796 add A,T1,A
797 sll A,6,T2
798 srl A,32-6,A !=
799 or A,T2,A
800 add A,B,A
801
802 orn A,C,T1
803 sethi %hi(0x432aff97),T2 !=
804 xor T1,B,T1
805 or T2,%lo(0x432aff97),T2
806 LOAD X(14),RX
807 add T1,R7,T1 !=
808 add T1,T2,T1
809 add D,T1,D
810 sll D,10,T2
811 srl D,32-10,D !=
812 or D,T2,D
813 add D,A,D
814
815 orn D,B,T1
816 sethi %hi(0xab9423a7),T2 !=
817 xor T1,A,T1
818 or T2,%lo(0xab9423a7),T2
819 add T1,RX,T1
820 !pre-LOADed X(5),R5
821 add T1,T2,T1 !=
822 add C,T1,C
823 sll C,15,T2
824 srl C,32-15,C
825 or C,T2,C !=
826 add C,D,C
827
828 orn C,A,T1
829 sethi %hi(0xfc93a039),T2
830 xor T1,D,T1 !=
831 or T2,%lo(0xfc93a039),T2
832 add T1,R5,T1
833 !pre-LOADed X(12),R12
834 add T1,T2,T1
835 add B,T1,B !=
836 sll B,21,T2
837 srl B,32-21,B
838 or B,T2,B
839 add B,C,B !=
840
841 orn B,D,T1
842 sethi %hi(0x655b59c3),T2
843 xor T1,C,T1
844 or T2,%lo(0x655b59c3),T2 !=
845 add T1,R12,T1
846 !pre-LOADed X(3),R3
847 add T1,T2,T1
848 add A,T1,A
849 sll A,6,T2 !=
850 srl A,32-6,A
851 or A,T2,A
852 add A,B,A
853
854 orn A,C,T1 !=
855 sethi %hi(0x8f0ccc92),T2
856 xor T1,B,T1
857 or T2,%lo(0x8f0ccc92),T2
858 add T1,R3,T1 !=
859 !pre-LOADed X(10),R10
860 add T1,T2,T1
861 add D,T1,D
862 sll D,10,T2
863 srl D,32-10,D !=
864 or D,T2,D
865 add D,A,D
866
867 orn D,B,T1
868 sethi %hi(0xffeff47d),T2 !=
869 xor T1,A,T1
870 or T2,%lo(0xffeff47d),T2
871 add T1,R10,T1
872 !pre-LOADed X(1),R1
873 add T1,T2,T1 !=
874 add C,T1,C
875 sll C,15,T2
876 srl C,32-15,C
877 or C,T2,C !=
878 add C,D,C
879
880 orn C,A,T1
881 sethi %hi(0x85845dd1),T2
882 xor T1,D,T1 !=
883 or T2,%lo(0x85845dd1),T2
884 add T1,R1,T1
885 !pre-LOADed X(8),R8
886 add T1,T2,T1
887 add B,T1,B !=
888 sll B,21,T2
889 srl B,32-21,B
890 or B,T2,B
891 add B,C,B !=
892
893 orn B,D,T1
894 sethi %hi(0x6fa87e4f),T2
895 xor T1,C,T1
896 or T2,%lo(0x6fa87e4f),T2 !=
897 add T1,R8,T1
898 LOAD X(15),RX
899 add T1,T2,T1
900 add A,T1,A !=
901 sll A,6,T2
902 srl A,32-6,A
903 or A,T2,A
904 add A,B,A !=
905
906 orn A,C,T1
907 sethi %hi(0xfe2ce6e0),T2
908 xor T1,B,T1
909 or T2,%lo(0xfe2ce6e0),T2 !=
910 add T1,RX,T1
911 !pre-LOADed X(6),R6
912 add T1,T2,T1
913 add D,T1,D
914 sll D,10,T2 !=
915 srl D,32-10,D
916 or D,T2,D
917 add D,A,D
918
919 orn D,B,T1 !=
920 sethi %hi(0xa3014314),T2
921 xor T1,A,T1
922 or T2,%lo(0xa3014314),T2
923 add T1,R6,T1 !=
924 !pre-LOADed X(13),R13
925 add T1,T2,T1
926 add C,T1,C
927 sll C,15,T2
928 srl C,32-15,C !=
929 or C,T2,C
930 add C,D,C
931
932 orn C,A,T1
933 sethi %hi(0x4e0811a1),T2 !=
934 xor T1,D,T1
935 or T2,%lo(0x4e0811a1),T2
936 !pre-LOADed X(4),R4
937 ld [Aptr],Aval
938 add T1,R13,T1 !=
939 add T1,T2,T1
940 add B,T1,B
941 sll B,21,T2
942 srl B,32-21,B !=
943 or B,T2,B
944 add B,C,B
945
946 orn B,D,T1
947 sethi %hi(0xf7537e82),T2 !=
948 xor T1,C,T1
949 or T2,%lo(0xf7537e82),T2
950 !pre-LOADed X(11),R11
951 ld [Dptr],Dval
952 add T1,R4,T1 !=
953 add T1,T2,T1
954 add A,T1,A
955 sll A,6,T2
956 srl A,32-6,A !=
957 or A,T2,A
958 add A,B,A
959
960 orn A,C,T1
961 sethi %hi(0xbd3af235),T2 !=
962 xor T1,B,T1
963 or T2,%lo(0xbd3af235),T2
964 !pre-LOADed X(2),R2
965 ld [Cptr],Cval
966 add T1,R11,T1 !=
967 add T1,T2,T1
968 add D,T1,D
969 sll D,10,T2
970 srl D,32-10,D !=
971 or D,T2,D
972 add D,A,D
973
974 orn D,B,T1
975 sethi %hi(0x2ad7d2bb),T2 !=
976 xor T1,A,T1
977 or T2,%lo(0x2ad7d2bb),T2
978 !pre-LOADed X(9),R9
979 ld [Bptr],Bval
980 add T1,R2,T1 !=
981 add Aval,A,Aval
982 add T1,T2,T1
983 st Aval,[Aptr]
984 add C,T1,C !=
985 sll C,15,T2
986 add Dval,D,Dval
987 srl C,32-15,C
988 or C,T2,C !=
989 st Dval,[Dptr]
990 add C,D,C
991
992 orn C,A,T1
993 sethi %hi(0xeb86d391),T2 !=
994 xor T1,D,T1
995 or T2,%lo(0xeb86d391),T2
996 add T1,R9,T1
997 !pre-LOADed X(0),R0
998 mov Aval,A !=
999 add T1,T2,T1
1000 mov Dval,D
1001 add B,T1,B
1002 sll B,21,T2 !=
1003 add Cval,C,Cval
1004 srl B,32-21,B
1005 st Cval,[Cptr]
1006 or B,T2,B !=
1007 add B,C,B
1008
1009 deccc %i2
1010 mov Cval,C
1011 add B,Bval,B !=
1012 inc 64,%i1
1013 nop
1014 st B,[Bptr]
1015 nop !=
1016
1017#ifdef OPENSSL_SYSNAME_ULTRASPARC
1018 bg,a,pt %icc,.Lmd5_block_loop
1019#else
1020 bg,a .Lmd5_block_loop
1021#endif
1022 LOAD X(0),R0
1023
1024#ifdef ASI_PRIMARY_LITTLE
1025 wr %g0,%o7,%asi
1026#endif
1027 ret
1028 restore %g0,0,%o0
1029
1030.type md5_block,#function
1031.size md5_block,(.-md5_block)
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_one.c b/src/lib/libcrypto/md5/md5_one.c
index 44c6c455d1..c5dd2d81db 100644
--- a/src/lib/libcrypto/md5/md5_one.c
+++ b/src/lib/libcrypto/md5/md5_one.c
@@ -71,8 +71,7 @@ unsigned char *MD5(const unsigned char *d, unsigned long n, unsigned char *md)
71 static unsigned char m[MD5_DIGEST_LENGTH]; 71 static unsigned char m[MD5_DIGEST_LENGTH];
72 72
73 if (md == NULL) md=m; 73 if (md == NULL) md=m;
74 if (!MD5_Init(&c)) 74 MD5_Init(&c);
75 return NULL;
76#ifndef CHARSET_EBCDIC 75#ifndef CHARSET_EBCDIC
77 MD5_Update(&c,d,n); 76 MD5_Update(&c,d,n);
78#else 77#else
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..bfd62629ed
--- /dev/null
+++ b/src/lib/libcrypto/md5/md5test.c
@@ -0,0 +1,136 @@
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 unsigned char **P,**R;
101 char *p;
102 unsigned char md[MD5_DIGEST_LENGTH];
103
104 P=(unsigned char **)test;
105 R=(unsigned char **)ret;
106 i=1;
107 while (*P != NULL)
108 {
109 EVP_Digest(&(P[0][0]),(unsigned long)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 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<MD5_DIGEST_LENGTH; i++)
133 sprintf(&(buf[i*2]),"%02x",md[i]);
134 return(buf);
135 }
136#endif
diff --git a/src/lib/libcrypto/mdc2/Makefile b/src/lib/libcrypto/mdc2/Makefile
new file mode 100644
index 0000000000..38c785bf95
--- /dev/null
+++ b/src/lib/libcrypto/mdc2/Makefile
@@ -0,0 +1,98 @@
1#
2# SSLeay/crypto/mdc2/Makefile
3#
4
5DIR= mdc2
6TOP= ../..
7CC= cc
8INCLUDES=
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
18CFLAGS= $(INCLUDES) $(CFLAG)
19
20GENERAL=Makefile
21TEST= mdc2test.c
22APPS=
23
24LIB=$(TOP)/libcrypto.a
25LIBSRC=mdc2dgst.c mdc2_one.c
26LIBOBJ=mdc2dgst.o mdc2_one.o
27
28SRC= $(LIBSRC)
29
30EXHEADER= mdc2.h
31HEADER= $(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
45files:
46 $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
47
48links:
49 @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
50 @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
51 @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
52
53install:
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 $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(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
80mdc2_one.o: ../../e_os.h ../../include/openssl/bio.h
81mdc2_one.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
82mdc2_one.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
83mdc2_one.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
84mdc2_one.o: ../../include/openssl/lhash.h ../../include/openssl/mdc2.h
85mdc2_one.o: ../../include/openssl/opensslconf.h
86mdc2_one.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
87mdc2_one.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
88mdc2_one.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
89mdc2_one.o: ../cryptlib.h mdc2_one.c
90mdc2dgst.o: ../../include/openssl/bio.h ../../include/openssl/crypto.h
91mdc2dgst.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
92mdc2dgst.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
93mdc2dgst.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
94mdc2dgst.o: ../../include/openssl/mdc2.h ../../include/openssl/opensslconf.h
95mdc2dgst.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
96mdc2dgst.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
97mdc2dgst.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
98mdc2dgst.o: mdc2dgst.c
diff --git a/src/lib/libcrypto/mdc2/Makefile.ssl b/src/lib/libcrypto/mdc2/Makefile.ssl
new file mode 100644
index 0000000000..33f366fb08
--- /dev/null
+++ b/src/lib/libcrypto/mdc2/Makefile.ssl
@@ -0,0 +1,98 @@
1#
2# SSLeay/crypto/mdc2/Makefile
3#
4
5DIR= mdc2
6TOP= ../..
7CC= cc
8INCLUDES=
9CFLAG=-g
10INSTALL_PREFIX=
11OPENSSLDIR= /usr/local/ssl
12INSTALLTOP=/usr/local/ssl
13MAKE= make -f Makefile.ssl
14MAKEDEPPROG= makedepend
15MAKEDEPEND= $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG)
16MAKEFILE= Makefile.ssl
17AR= ar r
18
19CFLAGS= $(INCLUDES) $(CFLAG)
20
21GENERAL=Makefile
22TEST= mdc2test.c
23APPS=
24
25LIB=$(TOP)/libcrypto.a
26LIBSRC=mdc2dgst.c mdc2_one.c
27LIBOBJ=mdc2dgst.o mdc2_one.o
28
29SRC= $(LIBSRC)
30
31EXHEADER= mdc2.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.ssl >> $(TOP)/MINFO
48
49links:
50 @sh $(TOP)/util/point.sh Makefile.ssl Makefile
51 @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
52 @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
53 @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
54
55install:
56 @for i in $(EXHEADER) ; \
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 $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
72
73dclean:
74 $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
75 mv -f Makefile.new $(MAKEFILE)
76
77clean:
78 rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
79
80# DO NOT DELETE THIS LINE -- make depend depends on it.
81
82mdc2_one.o: ../../e_os.h ../../include/openssl/bio.h
83mdc2_one.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
84mdc2_one.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
85mdc2_one.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
86mdc2_one.o: ../../include/openssl/lhash.h ../../include/openssl/mdc2.h
87mdc2_one.o: ../../include/openssl/opensslconf.h
88mdc2_one.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
89mdc2_one.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
90mdc2_one.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
91mdc2_one.o: ../cryptlib.h mdc2_one.c
92mdc2dgst.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
93mdc2dgst.o: ../../include/openssl/des_old.h ../../include/openssl/e_os2.h
94mdc2dgst.o: ../../include/openssl/mdc2.h ../../include/openssl/opensslconf.h
95mdc2dgst.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
96mdc2dgst.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
97mdc2dgst.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
98mdc2dgst.o: mdc2dgst.c
diff --git a/src/lib/libcrypto/mdc2/mdc2.h b/src/lib/libcrypto/mdc2/mdc2.h
new file mode 100644
index 0000000000..4cba101f37
--- /dev/null
+++ b/src/lib/libcrypto/mdc2/mdc2.h
@@ -0,0 +1,97 @@
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 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#ifdef OPENSSL_FIPS
84int private_MDC2_Init(MDC2_CTX *c);
85#endif
86int MDC2_Init(MDC2_CTX *c);
87int MDC2_Update(MDC2_CTX *c, const unsigned char *data, unsigned long len);
88int MDC2_Final(unsigned char *md, MDC2_CTX *c);
89unsigned char *MDC2(const unsigned char *d, unsigned long n,
90 unsigned char *md);
91
92#ifdef __cplusplus
93}
94#endif
95
96#endif
97
diff --git a/src/lib/libcrypto/mdc2/mdc2test.c b/src/lib/libcrypto/mdc2/mdc2test.c
new file mode 100644
index 0000000000..c9abe99d92
--- /dev/null
+++ b/src/lib/libcrypto/mdc2/mdc2test.c
@@ -0,0 +1,146 @@
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 EXIT(ret);
144 return(ret);
145 }
146#endif
diff --git a/src/lib/libcrypto/mem.c b/src/lib/libcrypto/mem.c
new file mode 100644
index 0000000000..dd86733b77
--- /dev/null
+++ b/src/lib/libcrypto/mem.c
@@ -0,0 +1,401 @@
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 if (!allow_customize)
129 return 0;
130 if ((m == 0) || (r == 0) || (f == 0))
131 return 0;
132 malloc_func=m; malloc_ex_func=default_malloc_ex;
133 realloc_func=r; realloc_ex_func=default_realloc_ex;
134 free_func=f;
135 malloc_locked_func=m; malloc_locked_ex_func=default_malloc_locked_ex;
136 free_locked_func=f;
137 return 1;
138 }
139
140int CRYPTO_set_mem_ex_functions(
141 void *(*m)(size_t,const char *,int),
142 void *(*r)(void *, size_t,const char *,int),
143 void (*f)(void *))
144 {
145 if (!allow_customize)
146 return 0;
147 if ((m == 0) || (r == 0) || (f == 0))
148 return 0;
149 malloc_func=0; malloc_ex_func=m;
150 realloc_func=0; realloc_ex_func=r;
151 free_func=f;
152 malloc_locked_func=0; malloc_locked_ex_func=m;
153 free_locked_func=f;
154 return 1;
155 }
156
157int CRYPTO_set_locked_mem_functions(void *(*m)(size_t), void (*f)(void *))
158 {
159 if (!allow_customize)
160 return 0;
161 if ((m == NULL) || (f == NULL))
162 return 0;
163 malloc_locked_func=m; malloc_locked_ex_func=default_malloc_locked_ex;
164 free_locked_func=f;
165 return 1;
166 }
167
168int CRYPTO_set_locked_mem_ex_functions(
169 void *(*m)(size_t,const char *,int),
170 void (*f)(void *))
171 {
172 if (!allow_customize)
173 return 0;
174 if ((m == NULL) || (f == NULL))
175 return 0;
176 malloc_locked_func=0; malloc_locked_ex_func=m;
177 free_func=f;
178 return 1;
179 }
180
181int CRYPTO_set_mem_debug_functions(void (*m)(void *,int,const char *,int,int),
182 void (*r)(void *,void *,int,const char *,int,int),
183 void (*f)(void *,int),
184 void (*so)(long),
185 long (*go)(void))
186 {
187 if (!allow_customize_debug)
188 return 0;
189 malloc_debug_func=m;
190 realloc_debug_func=r;
191 free_debug_func=f;
192 set_debug_options_func=so;
193 get_debug_options_func=go;
194 return 1;
195 }
196
197
198void CRYPTO_get_mem_functions(void *(**m)(size_t), void *(**r)(void *, size_t),
199 void (**f)(void *))
200 {
201 if (m != NULL) *m = (malloc_ex_func == default_malloc_ex) ?
202 malloc_func : 0;
203 if (r != NULL) *r = (realloc_ex_func == default_realloc_ex) ?
204 realloc_func : 0;
205 if (f != NULL) *f=free_func;
206 }
207
208void CRYPTO_get_mem_ex_functions(
209 void *(**m)(size_t,const char *,int),
210 void *(**r)(void *, size_t,const char *,int),
211 void (**f)(void *))
212 {
213 if (m != NULL) *m = (malloc_ex_func != default_malloc_ex) ?
214 malloc_ex_func : 0;
215 if (r != NULL) *r = (realloc_ex_func != default_realloc_ex) ?
216 realloc_ex_func : 0;
217 if (f != NULL) *f=free_func;
218 }
219
220void CRYPTO_get_locked_mem_functions(void *(**m)(size_t), void (**f)(void *))
221 {
222 if (m != NULL) *m = (malloc_locked_ex_func == default_malloc_locked_ex) ?
223 malloc_locked_func : 0;
224 if (f != NULL) *f=free_locked_func;
225 }
226
227void CRYPTO_get_locked_mem_ex_functions(
228 void *(**m)(size_t,const char *,int),
229 void (**f)(void *))
230 {
231 if (m != NULL) *m = (malloc_locked_ex_func != default_malloc_locked_ex) ?
232 malloc_locked_ex_func : 0;
233 if (f != NULL) *f=free_locked_func;
234 }
235
236void CRYPTO_get_mem_debug_functions(void (**m)(void *,int,const char *,int,int),
237 void (**r)(void *,void *,int,const char *,int,int),
238 void (**f)(void *,int),
239 void (**so)(long),
240 long (**go)(void))
241 {
242 if (m != NULL) *m=malloc_debug_func;
243 if (r != NULL) *r=realloc_debug_func;
244 if (f != NULL) *f=free_debug_func;
245 if (so != NULL) *so=set_debug_options_func;
246 if (go != NULL) *go=get_debug_options_func;
247 }
248
249
250void *CRYPTO_malloc_locked(int num, const char *file, int line)
251 {
252 void *ret = NULL;
253 extern unsigned char cleanse_ctr;
254
255 if (num <= 0) return NULL;
256
257 allow_customize = 0;
258 if (malloc_debug_func != NULL)
259 {
260 allow_customize_debug = 0;
261 malloc_debug_func(NULL, num, file, line, 0);
262 }
263 ret = malloc_locked_ex_func(num,file,line);
264#ifdef LEVITTE_DEBUG_MEM
265 fprintf(stderr, "LEVITTE_DEBUG_MEM: > 0x%p (%d)\n", ret, num);
266#endif
267 if (malloc_debug_func != NULL)
268 malloc_debug_func(ret, num, file, line, 1);
269
270 /* Create a dependency on the value of 'cleanse_ctr' so our memory
271 * sanitisation function can't be optimised out. NB: We only do
272 * this for >2Kb so the overhead doesn't bother us. */
273 if(ret && (num > 2048))
274 ((unsigned char *)ret)[0] = cleanse_ctr;
275
276 return ret;
277 }
278
279void CRYPTO_free_locked(void *str)
280 {
281 if (free_debug_func != NULL)
282 free_debug_func(str, 0);
283#ifdef LEVITTE_DEBUG_MEM
284 fprintf(stderr, "LEVITTE_DEBUG_MEM: < 0x%p\n", str);
285#endif
286 free_locked_func(str);
287 if (free_debug_func != NULL)
288 free_debug_func(NULL, 1);
289 }
290
291void *CRYPTO_malloc(int num, const char *file, int line)
292 {
293 void *ret = NULL;
294 extern unsigned char cleanse_ctr;
295
296 if (num <= 0) return NULL;
297
298 allow_customize = 0;
299 if (malloc_debug_func != NULL)
300 {
301 allow_customize_debug = 0;
302 malloc_debug_func(NULL, num, file, line, 0);
303 }
304 ret = malloc_ex_func(num,file,line);
305#ifdef LEVITTE_DEBUG_MEM
306 fprintf(stderr, "LEVITTE_DEBUG_MEM: > 0x%p (%d)\n", ret, num);
307#endif
308 if (malloc_debug_func != NULL)
309 malloc_debug_func(ret, num, file, line, 1);
310
311 /* Create a dependency on the value of 'cleanse_ctr' so our memory
312 * sanitisation function can't be optimised out. NB: We only do
313 * this for >2Kb so the overhead doesn't bother us. */
314 if(ret && (num > 2048))
315 ((unsigned char *)ret)[0] = cleanse_ctr;
316
317 return ret;
318 }
319
320void *CRYPTO_realloc(void *str, int num, const char *file, int line)
321 {
322 void *ret = NULL;
323
324 if (str == NULL)
325 return CRYPTO_malloc(num, file, line);
326
327 if (num <= 0) return NULL;
328
329 if (realloc_debug_func != NULL)
330 realloc_debug_func(str, NULL, num, file, line, 0);
331 ret = realloc_ex_func(str,num,file,line);
332#ifdef LEVITTE_DEBUG_MEM
333 fprintf(stderr, "LEVITTE_DEBUG_MEM: | 0x%p -> 0x%p (%d)\n", str, ret, num);
334#endif
335 if (realloc_debug_func != NULL)
336 realloc_debug_func(str, ret, num, file, line, 1);
337
338 return ret;
339 }
340
341void *CRYPTO_realloc_clean(void *str, int old_len, int num, const char *file,
342 int line)
343 {
344 void *ret = NULL;
345
346 if (str == NULL)
347 return CRYPTO_malloc(num, file, line);
348
349 if (num <= 0) return NULL;
350
351 if (realloc_debug_func != NULL)
352 realloc_debug_func(str, NULL, num, file, line, 0);
353 ret=malloc_ex_func(num,file,line);
354 if(ret)
355 {
356 memcpy(ret,str,old_len);
357 OPENSSL_cleanse(str,old_len);
358 free_func(str);
359 }
360#ifdef LEVITTE_DEBUG_MEM
361 fprintf(stderr,
362 "LEVITTE_DEBUG_MEM: | 0x%p -> 0x%p (%d)\n",
363 str, ret, num);
364#endif
365 if (realloc_debug_func != NULL)
366 realloc_debug_func(str, ret, num, file, line, 1);
367
368 return ret;
369 }
370
371void CRYPTO_free(void *str)
372 {
373 if (free_debug_func != NULL)
374 free_debug_func(str, 0);
375#ifdef LEVITTE_DEBUG_MEM
376 fprintf(stderr, "LEVITTE_DEBUG_MEM: < 0x%p\n", str);
377#endif
378 free_func(str);
379 if (free_debug_func != NULL)
380 free_debug_func(NULL, 1);
381 }
382
383void *CRYPTO_remalloc(void *a, int num, const char *file, int line)
384 {
385 if (a != NULL) OPENSSL_free(a);
386 a=(char *)OPENSSL_malloc(num);
387 return(a);
388 }
389
390void CRYPTO_set_mem_debug_options(long bits)
391 {
392 if (set_debug_options_func != NULL)
393 set_debug_options_func(bits);
394 }
395
396long CRYPTO_get_mem_debug_options(void)
397 {
398 if (get_debug_options_func != NULL)
399 return get_debug_options_func();
400 return 0;
401 }
diff --git a/src/lib/libcrypto/o_str.h b/src/lib/libcrypto/o_str.h
new file mode 100644
index 0000000000..4a70a9e00b
--- /dev/null
+++ b/src/lib/libcrypto/o_str.h
@@ -0,0 +1,67 @@
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);
66
67#endif
diff --git a/src/lib/libcrypto/objects/Makefile b/src/lib/libcrypto/objects/Makefile
new file mode 100644
index 0000000000..23b2a69e6d
--- /dev/null
+++ b/src/lib/libcrypto/objects/Makefile
@@ -0,0 +1,122 @@
1#
2# OpenSSL/crypto/objects/Makefile
3#
4
5DIR= objects
6TOP= ../..
7CC= cc
8INCLUDES= -I.. -I$(TOP) -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
17PERL= perl
18
19CFLAGS= $(INCLUDES) $(CFLAG)
20
21GENERAL=Makefile README
22TEST=
23APPS=
24
25LIB=$(TOP)/libcrypto.a
26LIBSRC= o_names.c obj_dat.c obj_lib.c obj_err.c
27LIBOBJ= o_names.o obj_dat.o obj_lib.o obj_err.o
28
29SRC= $(LIBSRC)
30
31EXHEADER= objects.h obj_mac.h
32HEADER= $(EXHEADER) obj_dat.h
33
34ALL= $(GENERAL) $(SRC) $(HEADER)
35
36top:
37 (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all)
38
39all: obj_dat.h lib
40
41lib: $(LIBOBJ)
42 $(AR) $(LIB) $(LIBOBJ)
43 $(RANLIB) $(LIB) || echo Never mind.
44 @touch lib
45
46obj_dat.h: obj_dat.pl obj_mac.h
47 $(PERL) obj_dat.pl obj_mac.h obj_dat.h
48
49# objects.pl both reads and writes obj_mac.num
50obj_mac.h: objects.pl objects.txt obj_mac.num
51 $(PERL) objects.pl objects.txt obj_mac.num obj_mac.h
52 @sleep 1; touch obj_mac.h; sleep 1
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 @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 $(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
89o_names.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
90o_names.o: ../../include/openssl/bn.h ../../include/openssl/crypto.h
91o_names.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
92o_names.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
93o_names.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
94o_names.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
95o_names.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
96o_names.o: ../../include/openssl/symhacks.h o_names.c
97obj_dat.o: ../../e_os.h ../../include/openssl/asn1.h
98obj_dat.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
99obj_dat.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
100obj_dat.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
101obj_dat.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
102obj_dat.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
103obj_dat.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
104obj_dat.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
105obj_dat.o: ../../include/openssl/symhacks.h ../cryptlib.h obj_dat.c obj_dat.h
106obj_err.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
107obj_err.o: ../../include/openssl/bn.h ../../include/openssl/crypto.h
108obj_err.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
109obj_err.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
110obj_err.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
111obj_err.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
112obj_err.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
113obj_err.o: ../../include/openssl/symhacks.h obj_err.c
114obj_lib.o: ../../e_os.h ../../include/openssl/asn1.h
115obj_lib.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
116obj_lib.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
117obj_lib.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
118obj_lib.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
119obj_lib.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
120obj_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
121obj_lib.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
122obj_lib.o: ../../include/openssl/symhacks.h ../cryptlib.h obj_lib.c
diff --git a/src/lib/libcrypto/objects/Makefile.ssl b/src/lib/libcrypto/objects/Makefile.ssl
new file mode 100644
index 0000000000..3e7a194cf9
--- /dev/null
+++ b/src/lib/libcrypto/objects/Makefile.ssl
@@ -0,0 +1,123 @@
1#
2# SSLeay/crypto/objects/Makefile
3#
4
5DIR= objects
6TOP= ../..
7CC= cc
8INCLUDES= -I.. -I$(TOP) -I../../include
9CFLAG=-g
10INSTALL_PREFIX=
11OPENSSLDIR= /usr/local/ssl
12INSTALLTOP=/usr/local/ssl
13MAKE= make -f Makefile.ssl
14MAKEDEPPROG= makedepend
15MAKEDEPEND= $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG)
16MAKEFILE= Makefile.ssl
17AR= ar r
18PERL= perl
19
20CFLAGS= $(INCLUDES) $(CFLAG)
21
22GENERAL=Makefile README
23TEST=
24APPS=
25
26LIB=$(TOP)/libcrypto.a
27LIBSRC= o_names.c obj_dat.c obj_lib.c obj_err.c
28LIBOBJ= o_names.o obj_dat.o obj_lib.o obj_err.o
29
30SRC= $(LIBSRC)
31
32EXHEADER= objects.h obj_mac.h
33HEADER= $(EXHEADER) obj_dat.h
34
35ALL= $(GENERAL) $(SRC) $(HEADER)
36
37top:
38 (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all)
39
40all: obj_dat.h lib
41
42lib: $(LIBOBJ)
43 $(AR) $(LIB) $(LIBOBJ)
44 $(RANLIB) $(LIB) || echo Never mind.
45 @touch lib
46
47obj_dat.h: obj_dat.pl obj_mac.h
48 $(PERL) obj_dat.pl obj_mac.h obj_dat.h
49
50# objects.pl both reads and writes obj_mac.num
51obj_mac.h: objects.pl objects.txt obj_mac.num
52 $(PERL) objects.pl objects.txt obj_mac.num obj_mac.h
53
54files:
55 $(PERL) $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO
56
57links:
58 @sh $(TOP)/util/point.sh Makefile.ssl Makefile
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 @for i in $(EXHEADER) ; \
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
73tests:
74
75lint:
76 lint -DLINT $(INCLUDES) $(SRC)>fluff
77
78depend:
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/bn.h ../../include/openssl/crypto.h
92o_names.o: ../../include/openssl/e_os2.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/bn.h ../../include/openssl/crypto.h
109obj_err.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
110obj_err.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
111obj_err.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
112obj_err.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
113obj_err.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
114obj_err.o: ../../include/openssl/symhacks.h obj_err.c
115obj_lib.o: ../../e_os.h ../../include/openssl/asn1.h
116obj_lib.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
117obj_lib.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
118obj_lib.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
119obj_lib.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
120obj_lib.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
121obj_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
122obj_lib.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
123obj_lib.o: ../../include/openssl/symhacks.h ../cryptlib.h obj_lib.c
diff --git a/src/lib/libcrypto/objects/obj_err.c b/src/lib/libcrypto/objects/obj_err.c
index 0682979b38..2b5f43e3cc 100644
--- a/src/lib/libcrypto/objects/obj_err.c
+++ b/src/lib/libcrypto/objects/obj_err.c
@@ -1,6 +1,6 @@
1/* crypto/objects/obj_err.c */ 1/* crypto/objects/obj_err.c */
2/* ==================================================================== 2/* ====================================================================
3 * Copyright (c) 1999-2005 The OpenSSL Project. All rights reserved. 3 * Copyright (c) 1999-2004 The OpenSSL Project. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
@@ -64,26 +64,22 @@
64 64
65/* BEGIN ERROR CODES */ 65/* BEGIN ERROR CODES */
66#ifndef OPENSSL_NO_ERR 66#ifndef OPENSSL_NO_ERR
67
68#define ERR_FUNC(func) ERR_PACK(ERR_LIB_OBJ,func,0)
69#define ERR_REASON(reason) ERR_PACK(ERR_LIB_OBJ,0,reason)
70
71static ERR_STRING_DATA OBJ_str_functs[]= 67static ERR_STRING_DATA OBJ_str_functs[]=
72 { 68 {
73{ERR_FUNC(OBJ_F_OBJ_ADD_OBJECT), "OBJ_add_object"}, 69{ERR_PACK(0,OBJ_F_OBJ_ADD_OBJECT,0), "OBJ_add_object"},
74{ERR_FUNC(OBJ_F_OBJ_CREATE), "OBJ_create"}, 70{ERR_PACK(0,OBJ_F_OBJ_CREATE,0), "OBJ_create"},
75{ERR_FUNC(OBJ_F_OBJ_DUP), "OBJ_dup"}, 71{ERR_PACK(0,OBJ_F_OBJ_DUP,0), "OBJ_dup"},
76{ERR_FUNC(OBJ_F_OBJ_NAME_NEW_INDEX), "OBJ_NAME_new_index"}, 72{ERR_PACK(0,OBJ_F_OBJ_NAME_NEW_INDEX,0), "OBJ_NAME_new_index"},
77{ERR_FUNC(OBJ_F_OBJ_NID2LN), "OBJ_nid2ln"}, 73{ERR_PACK(0,OBJ_F_OBJ_NID2LN,0), "OBJ_nid2ln"},
78{ERR_FUNC(OBJ_F_OBJ_NID2OBJ), "OBJ_nid2obj"}, 74{ERR_PACK(0,OBJ_F_OBJ_NID2OBJ,0), "OBJ_nid2obj"},
79{ERR_FUNC(OBJ_F_OBJ_NID2SN), "OBJ_nid2sn"}, 75{ERR_PACK(0,OBJ_F_OBJ_NID2SN,0), "OBJ_nid2sn"},
80{0,NULL} 76{0,NULL}
81 }; 77 };
82 78
83static ERR_STRING_DATA OBJ_str_reasons[]= 79static ERR_STRING_DATA OBJ_str_reasons[]=
84 { 80 {
85{ERR_REASON(OBJ_R_MALLOC_FAILURE) ,"malloc failure"}, 81{OBJ_R_MALLOC_FAILURE ,"malloc failure"},
86{ERR_REASON(OBJ_R_UNKNOWN_NID) ,"unknown nid"}, 82{OBJ_R_UNKNOWN_NID ,"unknown nid"},
87{0,NULL} 83{0,NULL}
88 }; 84 };
89 85
@@ -97,8 +93,8 @@ void ERR_load_OBJ_strings(void)
97 { 93 {
98 init=0; 94 init=0;
99#ifndef OPENSSL_NO_ERR 95#ifndef OPENSSL_NO_ERR
100 ERR_load_strings(0,OBJ_str_functs); 96 ERR_load_strings(ERR_LIB_OBJ,OBJ_str_functs);
101 ERR_load_strings(0,OBJ_str_reasons); 97 ERR_load_strings(ERR_LIB_OBJ,OBJ_str_reasons);
102#endif 98#endif
103 99
104 } 100 }
diff --git a/src/lib/libcrypto/objects/obj_mac.num b/src/lib/libcrypto/objects/obj_mac.num
index 84555d936e..0e64a929ba 100644
--- a/src/lib/libcrypto/objects/obj_mac.num
+++ b/src/lib/libcrypto/objects/obj_mac.num
@@ -287,9 +287,9 @@ qcStatements 286
287ac_auditEntity 287 287ac_auditEntity 287
288ac_targeting 288 288ac_targeting 288
289aaControls 289 289aaControls 289
290sbgp_ipAddrBlock 290 290sbqp_ipAddrBlock 290
291sbgp_autonomousSysNum 291 291sbqp_autonomousSysNum 291
292sbgp_routerIdentifier 292 292sbqp_routerIdentifier 292
293textNotice 293 293textNotice 293
294ipsecEndSystem 294 294ipsecEndSystem 294
295ipsecTunnel 295 295ipsecTunnel 295
@@ -663,13 +663,5 @@ id_ppl 662
663proxyCertInfo 663 663proxyCertInfo 663
664id_ppl_anyLanguage 664 664id_ppl_anyLanguage 664
665id_ppl_inheritAll 665 665id_ppl_inheritAll 665
666name_constraints 666 666id_ppl_independent 666
667Independent 667 667Independent 667
668sha256WithRSAEncryption 668
669sha384WithRSAEncryption 669
670sha512WithRSAEncryption 670
671sha224WithRSAEncryption 671
672sha256 672
673sha384 673
674sha512 674
675sha224 675
diff --git a/src/lib/libcrypto/objects/objects.pl b/src/lib/libcrypto/objects/objects.pl
index 76c06cc8f9..76bb8da677 100644
--- a/src/lib/libcrypto/objects/objects.pl
+++ b/src/lib/libcrypto/objects/objects.pl
@@ -107,12 +107,13 @@ while (<IN>)
107 } 107 }
108close IN; 108close IN;
109 109
110open (NUMOUT,">$ARGV[1]") || die "Can't open output file $ARGV[1]"; 110#XXX don't modify input files
111foreach (sort { $a <=> $b } keys %nidn) 111#open (NUMOUT,">$ARGV[1]") || die "Can't open output file $ARGV[1]";
112 { 112#foreach (sort { $a <=> $b } keys %nidn)
113 print NUMOUT $nidn{$_},"\t\t",$_,"\n"; 113# {
114 } 114# print NUMOUT $nidn{$_},"\t\t",$_,"\n";
115close NUMOUT; 115# }
116#close NUMOUT;
116 117
117open (OUT,">$ARGV[2]") || die "Can't open output file $ARGV[2]"; 118open (OUT,">$ARGV[2]") || die "Can't open output file $ARGV[2]";
118print OUT <<'EOF'; 119print OUT <<'EOF';
diff --git a/src/lib/libcrypto/objects/objects.txt b/src/lib/libcrypto/objects/objects.txt
index 2635c4e667..50e9031e61 100644
--- a/src/lib/libcrypto/objects/objects.txt
+++ b/src/lib/libcrypto/objects/objects.txt
@@ -63,11 +63,6 @@ pkcs1 2 : RSA-MD2 : md2WithRSAEncryption
63pkcs1 3 : RSA-MD4 : md4WithRSAEncryption 63pkcs1 3 : RSA-MD4 : md4WithRSAEncryption
64pkcs1 4 : RSA-MD5 : md5WithRSAEncryption 64pkcs1 4 : RSA-MD5 : md5WithRSAEncryption
65pkcs1 5 : RSA-SHA1 : sha1WithRSAEncryption 65pkcs1 5 : RSA-SHA1 : sha1WithRSAEncryption
66# According to PKCS #1 version 2.1
67pkcs1 11 : RSA-SHA256 : sha256WithRSAEncryption
68pkcs1 12 : RSA-SHA384 : sha384WithRSAEncryption
69pkcs1 13 : RSA-SHA512 : sha512WithRSAEncryption
70pkcs1 14 : RSA-SHA224 : sha224WithRSAEncryption
71 66
72pkcs 3 : pkcs3 67pkcs 3 : pkcs3
73pkcs3 1 : : dhKeyAgreement 68pkcs3 1 : : dhKeyAgreement
@@ -346,9 +341,9 @@ id-pe 3 : qcStatements
346id-pe 4 : ac-auditEntity 341id-pe 4 : ac-auditEntity
347id-pe 5 : ac-targeting 342id-pe 5 : ac-targeting
348id-pe 6 : aaControls 343id-pe 6 : aaControls
349id-pe 7 : sbgp-ipAddrBlock 344id-pe 7 : sbqp-ipAddrBlock
350id-pe 8 : sbgp-autonomousSysNum 345id-pe 8 : sbqp-autonomousSysNum
351id-pe 9 : sbgp-routerIdentifier 346id-pe 9 : sbqp-routerIdentifier
352id-pe 10 : ac-proxying 347id-pe 10 : ac-proxying
353!Cname sinfo-access 348!Cname sinfo-access
354id-pe 11 : subjectInfoAccess : Subject Information Access 349id-pe 11 : subjectInfoAccess : Subject Information Access
@@ -589,8 +584,6 @@ id-ce 21 : CRLReason : X509v3 CRL Reason Code
589id-ce 24 : invalidityDate : Invalidity Date 584id-ce 24 : invalidityDate : Invalidity Date
590!Cname delta-crl 585!Cname delta-crl
591id-ce 27 : deltaCRL : X509v3 Delta CRL Indicator 586id-ce 27 : deltaCRL : X509v3 Delta CRL Indicator
592!Cname name-constraints
593id-ce 30 : nameConstraints : X509v3 Name Constraints
594!Cname crl-distribution-points 587!Cname crl-distribution-points
595id-ce 31 : crlDistributionPoints : X509v3 CRL Distribution Points 588id-ce 31 : crlDistributionPoints : X509v3 CRL Distribution Points
596!Cname certificate-policies 589!Cname certificate-policies
@@ -710,13 +703,6 @@ aes 44 : AES-256-CFB : aes-256-cfb
710 : DES-EDE3-CFB1 : des-ede3-cfb1 703 : DES-EDE3-CFB1 : des-ede3-cfb1
711 : DES-EDE3-CFB8 : des-ede3-cfb8 704 : DES-EDE3-CFB8 : des-ede3-cfb8
712 705
713# OIDs for SHA224, SHA256, SHA385 and SHA512, according to x9.84.
714!Alias nist_hashalgs nistAlgorithms 2
715nist_hashalgs 1 : SHA256 : sha256
716nist_hashalgs 2 : SHA384 : sha384
717nist_hashalgs 3 : SHA512 : sha512
718nist_hashalgs 4 : SHA224 : sha224
719
720# Hold instruction CRL entry extension 706# Hold instruction CRL entry extension
721!Cname hold-instruction-code 707!Cname hold-instruction-code
722id-ce 23 : holdInstructionCode : Hold Instruction Code 708id-ce 23 : holdInstructionCode : Hold Instruction Code
diff --git a/src/lib/libcrypto/ocsp/Makefile b/src/lib/libcrypto/ocsp/Makefile
new file mode 100644
index 0000000000..59f7098d9e
--- /dev/null
+++ b/src/lib/libcrypto/ocsp/Makefile
@@ -0,0 +1,291 @@
1#
2# OpenSSL/ocsp/Makefile
3#
4
5DIR= ocsp
6TOP= ../..
7CC= cc
8INCLUDES= -I.. -I$(TOP) -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
18CFLAGS= $(INCLUDES) $(CFLAG)
19
20GENERAL=Makefile README
21TEST=
22APPS=
23
24LIB=$(TOP)/libcrypto.a
25LIBSRC= ocsp_asn.c ocsp_ext.c ocsp_ht.c ocsp_lib.c ocsp_cl.c \
26 ocsp_srv.c ocsp_prn.c ocsp_vfy.c ocsp_err.c
27
28LIBOBJ= ocsp_asn.o ocsp_ext.o ocsp_ht.o ocsp_lib.o ocsp_cl.o \
29 ocsp_srv.o ocsp_prn.o ocsp_vfy.o ocsp_err.o
30
31SRC= $(LIBSRC)
32
33EXHEADER= ocsp.h
34HEADER= $(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
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 @headerlist="$(EXHEADER)"; for i in $$headerlist ; \
58 do \
59 (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
60 chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
61 done;
62
63tags:
64 ctags $(SRC)
65
66tests:
67
68lint:
69 lint -DLINT $(INCLUDES) $(SRC)>fluff
70
71depend:
72 $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(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
83ocsp_asn.o: ../../include/openssl/aes.h ../../include/openssl/asn1.h
84ocsp_asn.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
85ocsp_asn.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
86ocsp_asn.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
87ocsp_asn.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
88ocsp_asn.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
89ocsp_asn.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
90ocsp_asn.o: ../../include/openssl/e_os2.h ../../include/openssl/evp.h
91ocsp_asn.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
92ocsp_asn.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
93ocsp_asn.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
94ocsp_asn.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
95ocsp_asn.o: ../../include/openssl/ocsp.h ../../include/openssl/opensslconf.h
96ocsp_asn.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
97ocsp_asn.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
98ocsp_asn.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
99ocsp_asn.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
100ocsp_asn.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
101ocsp_asn.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
102ocsp_asn.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
103ocsp_asn.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
104ocsp_asn.o: ../../include/openssl/x509v3.h ocsp_asn.c
105ocsp_cl.o: ../../e_os.h ../../include/openssl/aes.h
106ocsp_cl.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
107ocsp_cl.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
108ocsp_cl.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
109ocsp_cl.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
110ocsp_cl.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
111ocsp_cl.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
112ocsp_cl.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
113ocsp_cl.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
114ocsp_cl.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
115ocsp_cl.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
116ocsp_cl.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
117ocsp_cl.o: ../../include/openssl/objects.h ../../include/openssl/ocsp.h
118ocsp_cl.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
119ocsp_cl.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pem.h
120ocsp_cl.o: ../../include/openssl/pem2.h ../../include/openssl/pkcs7.h
121ocsp_cl.o: ../../include/openssl/rand.h ../../include/openssl/rc2.h
122ocsp_cl.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
123ocsp_cl.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
124ocsp_cl.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
125ocsp_cl.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
126ocsp_cl.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
127ocsp_cl.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
128ocsp_cl.o: ../../include/openssl/x509v3.h ../cryptlib.h ocsp_cl.c
129ocsp_err.o: ../../include/openssl/aes.h ../../include/openssl/asn1.h
130ocsp_err.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
131ocsp_err.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
132ocsp_err.o: ../../include/openssl/cast.h ../../include/openssl/conf.h
133ocsp_err.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
134ocsp_err.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
135ocsp_err.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
136ocsp_err.o: ../../include/openssl/err.h ../../include/openssl/evp.h
137ocsp_err.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
138ocsp_err.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
139ocsp_err.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
140ocsp_err.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
141ocsp_err.o: ../../include/openssl/ocsp.h ../../include/openssl/opensslconf.h
142ocsp_err.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
143ocsp_err.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
144ocsp_err.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
145ocsp_err.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
146ocsp_err.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
147ocsp_err.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
148ocsp_err.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
149ocsp_err.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
150ocsp_err.o: ../../include/openssl/x509v3.h ocsp_err.c
151ocsp_ext.o: ../../e_os.h ../../include/openssl/aes.h
152ocsp_ext.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
153ocsp_ext.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
154ocsp_ext.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
155ocsp_ext.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
156ocsp_ext.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
157ocsp_ext.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
158ocsp_ext.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
159ocsp_ext.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
160ocsp_ext.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
161ocsp_ext.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
162ocsp_ext.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
163ocsp_ext.o: ../../include/openssl/objects.h ../../include/openssl/ocsp.h
164ocsp_ext.o: ../../include/openssl/opensslconf.h
165ocsp_ext.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
166ocsp_ext.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h
167ocsp_ext.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
168ocsp_ext.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
169ocsp_ext.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
170ocsp_ext.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
171ocsp_ext.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
172ocsp_ext.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h
173ocsp_ext.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
174ocsp_ext.o: ../cryptlib.h ocsp_ext.c
175ocsp_ht.o: ../../include/openssl/aes.h ../../include/openssl/asn1.h
176ocsp_ht.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
177ocsp_ht.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
178ocsp_ht.o: ../../include/openssl/cast.h ../../include/openssl/conf.h
179ocsp_ht.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
180ocsp_ht.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
181ocsp_ht.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
182ocsp_ht.o: ../../include/openssl/err.h ../../include/openssl/evp.h
183ocsp_ht.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
184ocsp_ht.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
185ocsp_ht.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
186ocsp_ht.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
187ocsp_ht.o: ../../include/openssl/ocsp.h ../../include/openssl/opensslconf.h
188ocsp_ht.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
189ocsp_ht.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
190ocsp_ht.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
191ocsp_ht.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
192ocsp_ht.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
193ocsp_ht.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
194ocsp_ht.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
195ocsp_ht.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
196ocsp_ht.o: ../../include/openssl/x509v3.h ocsp_ht.c
197ocsp_lib.o: ../../e_os.h ../../include/openssl/aes.h
198ocsp_lib.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
199ocsp_lib.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
200ocsp_lib.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
201ocsp_lib.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
202ocsp_lib.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
203ocsp_lib.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
204ocsp_lib.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
205ocsp_lib.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
206ocsp_lib.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
207ocsp_lib.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
208ocsp_lib.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
209ocsp_lib.o: ../../include/openssl/objects.h ../../include/openssl/ocsp.h
210ocsp_lib.o: ../../include/openssl/opensslconf.h
211ocsp_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
212ocsp_lib.o: ../../include/openssl/pem.h ../../include/openssl/pem2.h
213ocsp_lib.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h
214ocsp_lib.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
215ocsp_lib.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
216ocsp_lib.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
217ocsp_lib.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
218ocsp_lib.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
219ocsp_lib.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h
220ocsp_lib.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
221ocsp_lib.o: ../cryptlib.h ocsp_lib.c
222ocsp_prn.o: ../../include/openssl/aes.h ../../include/openssl/asn1.h
223ocsp_prn.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
224ocsp_prn.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
225ocsp_prn.o: ../../include/openssl/cast.h ../../include/openssl/conf.h
226ocsp_prn.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
227ocsp_prn.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
228ocsp_prn.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
229ocsp_prn.o: ../../include/openssl/err.h ../../include/openssl/evp.h
230ocsp_prn.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
231ocsp_prn.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
232ocsp_prn.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
233ocsp_prn.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
234ocsp_prn.o: ../../include/openssl/ocsp.h ../../include/openssl/opensslconf.h
235ocsp_prn.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
236ocsp_prn.o: ../../include/openssl/pem.h ../../include/openssl/pem2.h
237ocsp_prn.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
238ocsp_prn.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
239ocsp_prn.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
240ocsp_prn.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
241ocsp_prn.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
242ocsp_prn.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
243ocsp_prn.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
244ocsp_prn.o: ../../include/openssl/x509v3.h ocsp_prn.c
245ocsp_srv.o: ../../e_os.h ../../include/openssl/aes.h
246ocsp_srv.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
247ocsp_srv.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
248ocsp_srv.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
249ocsp_srv.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
250ocsp_srv.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
251ocsp_srv.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
252ocsp_srv.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
253ocsp_srv.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
254ocsp_srv.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
255ocsp_srv.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
256ocsp_srv.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
257ocsp_srv.o: ../../include/openssl/objects.h ../../include/openssl/ocsp.h
258ocsp_srv.o: ../../include/openssl/opensslconf.h
259ocsp_srv.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
260ocsp_srv.o: ../../include/openssl/pem.h ../../include/openssl/pem2.h
261ocsp_srv.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h
262ocsp_srv.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
263ocsp_srv.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
264ocsp_srv.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
265ocsp_srv.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
266ocsp_srv.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
267ocsp_srv.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h
268ocsp_srv.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
269ocsp_srv.o: ../cryptlib.h ocsp_srv.c
270ocsp_vfy.o: ../../include/openssl/aes.h ../../include/openssl/asn1.h
271ocsp_vfy.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
272ocsp_vfy.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
273ocsp_vfy.o: ../../include/openssl/cast.h ../../include/openssl/conf.h
274ocsp_vfy.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
275ocsp_vfy.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
276ocsp_vfy.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
277ocsp_vfy.o: ../../include/openssl/err.h ../../include/openssl/evp.h
278ocsp_vfy.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
279ocsp_vfy.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
280ocsp_vfy.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
281ocsp_vfy.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
282ocsp_vfy.o: ../../include/openssl/ocsp.h ../../include/openssl/opensslconf.h
283ocsp_vfy.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
284ocsp_vfy.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
285ocsp_vfy.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
286ocsp_vfy.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
287ocsp_vfy.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
288ocsp_vfy.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
289ocsp_vfy.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
290ocsp_vfy.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
291ocsp_vfy.o: ../../include/openssl/x509v3.h ocsp_vfy.c
diff --git a/src/lib/libcrypto/ocsp/Makefile.ssl b/src/lib/libcrypto/ocsp/Makefile.ssl
new file mode 100644
index 0000000000..02477be538
--- /dev/null
+++ b/src/lib/libcrypto/ocsp/Makefile.ssl
@@ -0,0 +1,293 @@
1#
2# OpenSSL/ocsp/Makefile.ssl
3#
4
5DIR= ocsp
6TOP= ../..
7CC= cc
8INCLUDES= -I.. -I$(TOP) -I../../include
9CFLAG=-g
10INSTALL_PREFIX=
11OPENSSLDIR= /usr/local/ssl
12INSTALLTOP=/usr/local/ssl
13MAKE= make -f Makefile.ssl
14MAKEDEPPROG= makedepend
15MAKEDEPEND= $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG)
16MAKEFILE= Makefile.ssl
17AR= ar r
18
19CFLAGS= $(INCLUDES) $(CFLAG)
20
21GENERAL=Makefile README
22TEST=
23APPS=
24
25LIB=$(TOP)/libcrypto.a
26LIBSRC= ocsp_asn.c ocsp_ext.c ocsp_ht.c ocsp_lib.c ocsp_cl.c \
27 ocsp_srv.c ocsp_prn.c ocsp_vfy.c ocsp_err.c
28
29LIBOBJ= ocsp_asn.o ocsp_ext.o ocsp_ht.o ocsp_lib.o ocsp_cl.o \
30 ocsp_srv.o ocsp_prn.o ocsp_vfy.o ocsp_err.o
31
32SRC= $(LIBSRC)
33
34EXHEADER= ocsp.h
35HEADER= $(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.ssl >> $(TOP)/MINFO
51
52links:
53 @sh $(TOP)/util/point.sh Makefile.ssl Makefile ;
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 @for i in $(EXHEADER) ; \
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 $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(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 *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
82
83# DO NOT DELETE THIS LINE -- make depend depends on it.
84
85ocsp_asn.o: ../../include/openssl/aes.h ../../include/openssl/asn1.h
86ocsp_asn.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
87ocsp_asn.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
88ocsp_asn.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
89ocsp_asn.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
90ocsp_asn.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
91ocsp_asn.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
92ocsp_asn.o: ../../include/openssl/e_os2.h ../../include/openssl/evp.h
93ocsp_asn.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
94ocsp_asn.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
95ocsp_asn.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
96ocsp_asn.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
97ocsp_asn.o: ../../include/openssl/ocsp.h ../../include/openssl/opensslconf.h
98ocsp_asn.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
99ocsp_asn.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
100ocsp_asn.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
101ocsp_asn.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
102ocsp_asn.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
103ocsp_asn.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
104ocsp_asn.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
105ocsp_asn.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
106ocsp_asn.o: ../../include/openssl/x509v3.h ocsp_asn.c
107ocsp_cl.o: ../../e_os.h ../../include/openssl/aes.h
108ocsp_cl.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
109ocsp_cl.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
110ocsp_cl.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
111ocsp_cl.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
112ocsp_cl.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
113ocsp_cl.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
114ocsp_cl.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
115ocsp_cl.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
116ocsp_cl.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
117ocsp_cl.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
118ocsp_cl.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
119ocsp_cl.o: ../../include/openssl/objects.h ../../include/openssl/ocsp.h
120ocsp_cl.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
121ocsp_cl.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pem.h
122ocsp_cl.o: ../../include/openssl/pem2.h ../../include/openssl/pkcs7.h
123ocsp_cl.o: ../../include/openssl/rand.h ../../include/openssl/rc2.h
124ocsp_cl.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
125ocsp_cl.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
126ocsp_cl.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
127ocsp_cl.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
128ocsp_cl.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
129ocsp_cl.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
130ocsp_cl.o: ../../include/openssl/x509v3.h ../cryptlib.h ocsp_cl.c
131ocsp_err.o: ../../include/openssl/aes.h ../../include/openssl/asn1.h
132ocsp_err.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
133ocsp_err.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
134ocsp_err.o: ../../include/openssl/cast.h ../../include/openssl/conf.h
135ocsp_err.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
136ocsp_err.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
137ocsp_err.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
138ocsp_err.o: ../../include/openssl/err.h ../../include/openssl/evp.h
139ocsp_err.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
140ocsp_err.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
141ocsp_err.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
142ocsp_err.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
143ocsp_err.o: ../../include/openssl/ocsp.h ../../include/openssl/opensslconf.h
144ocsp_err.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
145ocsp_err.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
146ocsp_err.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
147ocsp_err.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
148ocsp_err.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
149ocsp_err.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
150ocsp_err.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
151ocsp_err.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
152ocsp_err.o: ../../include/openssl/x509v3.h ocsp_err.c
153ocsp_ext.o: ../../e_os.h ../../include/openssl/aes.h
154ocsp_ext.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
155ocsp_ext.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
156ocsp_ext.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
157ocsp_ext.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
158ocsp_ext.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
159ocsp_ext.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
160ocsp_ext.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
161ocsp_ext.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
162ocsp_ext.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
163ocsp_ext.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
164ocsp_ext.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
165ocsp_ext.o: ../../include/openssl/objects.h ../../include/openssl/ocsp.h
166ocsp_ext.o: ../../include/openssl/opensslconf.h
167ocsp_ext.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
168ocsp_ext.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h
169ocsp_ext.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
170ocsp_ext.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
171ocsp_ext.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
172ocsp_ext.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
173ocsp_ext.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
174ocsp_ext.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h
175ocsp_ext.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
176ocsp_ext.o: ../cryptlib.h ocsp_ext.c
177ocsp_ht.o: ../../include/openssl/aes.h ../../include/openssl/asn1.h
178ocsp_ht.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
179ocsp_ht.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
180ocsp_ht.o: ../../include/openssl/cast.h ../../include/openssl/conf.h
181ocsp_ht.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
182ocsp_ht.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
183ocsp_ht.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
184ocsp_ht.o: ../../include/openssl/err.h ../../include/openssl/evp.h
185ocsp_ht.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
186ocsp_ht.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
187ocsp_ht.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
188ocsp_ht.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
189ocsp_ht.o: ../../include/openssl/ocsp.h ../../include/openssl/opensslconf.h
190ocsp_ht.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
191ocsp_ht.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
192ocsp_ht.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
193ocsp_ht.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
194ocsp_ht.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
195ocsp_ht.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
196ocsp_ht.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
197ocsp_ht.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
198ocsp_ht.o: ../../include/openssl/x509v3.h ocsp_ht.c
199ocsp_lib.o: ../../e_os.h ../../include/openssl/aes.h
200ocsp_lib.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
201ocsp_lib.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
202ocsp_lib.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
203ocsp_lib.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
204ocsp_lib.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
205ocsp_lib.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
206ocsp_lib.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
207ocsp_lib.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
208ocsp_lib.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
209ocsp_lib.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
210ocsp_lib.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
211ocsp_lib.o: ../../include/openssl/objects.h ../../include/openssl/ocsp.h
212ocsp_lib.o: ../../include/openssl/opensslconf.h
213ocsp_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
214ocsp_lib.o: ../../include/openssl/pem.h ../../include/openssl/pem2.h
215ocsp_lib.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h
216ocsp_lib.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
217ocsp_lib.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
218ocsp_lib.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
219ocsp_lib.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
220ocsp_lib.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
221ocsp_lib.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h
222ocsp_lib.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
223ocsp_lib.o: ../cryptlib.h ocsp_lib.c
224ocsp_prn.o: ../../include/openssl/aes.h ../../include/openssl/asn1.h
225ocsp_prn.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
226ocsp_prn.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
227ocsp_prn.o: ../../include/openssl/cast.h ../../include/openssl/conf.h
228ocsp_prn.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
229ocsp_prn.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
230ocsp_prn.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
231ocsp_prn.o: ../../include/openssl/err.h ../../include/openssl/evp.h
232ocsp_prn.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
233ocsp_prn.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
234ocsp_prn.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
235ocsp_prn.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
236ocsp_prn.o: ../../include/openssl/ocsp.h ../../include/openssl/opensslconf.h
237ocsp_prn.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
238ocsp_prn.o: ../../include/openssl/pem.h ../../include/openssl/pem2.h
239ocsp_prn.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
240ocsp_prn.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
241ocsp_prn.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
242ocsp_prn.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
243ocsp_prn.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
244ocsp_prn.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
245ocsp_prn.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
246ocsp_prn.o: ../../include/openssl/x509v3.h ocsp_prn.c
247ocsp_srv.o: ../../e_os.h ../../include/openssl/aes.h
248ocsp_srv.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
249ocsp_srv.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
250ocsp_srv.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
251ocsp_srv.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
252ocsp_srv.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
253ocsp_srv.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
254ocsp_srv.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
255ocsp_srv.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
256ocsp_srv.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
257ocsp_srv.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
258ocsp_srv.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
259ocsp_srv.o: ../../include/openssl/objects.h ../../include/openssl/ocsp.h
260ocsp_srv.o: ../../include/openssl/opensslconf.h
261ocsp_srv.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
262ocsp_srv.o: ../../include/openssl/pem.h ../../include/openssl/pem2.h
263ocsp_srv.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h
264ocsp_srv.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
265ocsp_srv.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
266ocsp_srv.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
267ocsp_srv.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
268ocsp_srv.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
269ocsp_srv.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h
270ocsp_srv.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
271ocsp_srv.o: ../cryptlib.h ocsp_srv.c
272ocsp_vfy.o: ../../include/openssl/aes.h ../../include/openssl/asn1.h
273ocsp_vfy.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
274ocsp_vfy.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
275ocsp_vfy.o: ../../include/openssl/cast.h ../../include/openssl/conf.h
276ocsp_vfy.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
277ocsp_vfy.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
278ocsp_vfy.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
279ocsp_vfy.o: ../../include/openssl/err.h ../../include/openssl/evp.h
280ocsp_vfy.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
281ocsp_vfy.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
282ocsp_vfy.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
283ocsp_vfy.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
284ocsp_vfy.o: ../../include/openssl/ocsp.h ../../include/openssl/opensslconf.h
285ocsp_vfy.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
286ocsp_vfy.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
287ocsp_vfy.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
288ocsp_vfy.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
289ocsp_vfy.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
290ocsp_vfy.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
291ocsp_vfy.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
292ocsp_vfy.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
293ocsp_vfy.o: ../../include/openssl/x509v3.h ocsp_vfy.c
diff --git a/src/lib/libcrypto/ocsp/ocsp_err.c b/src/lib/libcrypto/ocsp/ocsp_err.c
index 65e6093fbc..4c4d8306f8 100644
--- a/src/lib/libcrypto/ocsp/ocsp_err.c
+++ b/src/lib/libcrypto/ocsp/ocsp_err.c
@@ -1,6 +1,6 @@
1/* crypto/ocsp/ocsp_err.c */ 1/* crypto/ocsp/ocsp_err.c */
2/* ==================================================================== 2/* ====================================================================
3 * Copyright (c) 1999-2005 The OpenSSL Project. All rights reserved. 3 * Copyright (c) 1999 The OpenSSL Project. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
@@ -64,64 +64,60 @@
64 64
65/* BEGIN ERROR CODES */ 65/* BEGIN ERROR CODES */
66#ifndef OPENSSL_NO_ERR 66#ifndef OPENSSL_NO_ERR
67
68#define ERR_FUNC(func) ERR_PACK(ERR_LIB_OCSP,func,0)
69#define ERR_REASON(reason) ERR_PACK(ERR_LIB_OCSP,0,reason)
70
71static ERR_STRING_DATA OCSP_str_functs[]= 67static ERR_STRING_DATA OCSP_str_functs[]=
72 { 68 {
73{ERR_FUNC(OCSP_F_ASN1_STRING_ENCODE), "ASN1_STRING_encode"}, 69{ERR_PACK(0,OCSP_F_ASN1_STRING_ENCODE,0), "ASN1_STRING_encode"},
74{ERR_FUNC(OCSP_F_CERT_ID_NEW), "CERT_ID_NEW"}, 70{ERR_PACK(0,OCSP_F_CERT_ID_NEW,0), "CERT_ID_NEW"},
75{ERR_FUNC(OCSP_F_D2I_OCSP_NONCE), "D2I_OCSP_NONCE"}, 71{ERR_PACK(0,OCSP_F_D2I_OCSP_NONCE,0), "D2I_OCSP_NONCE"},
76{ERR_FUNC(OCSP_F_OCSP_BASIC_ADD1_STATUS), "OCSP_basic_add1_status"}, 72{ERR_PACK(0,OCSP_F_OCSP_BASIC_ADD1_STATUS,0), "OCSP_basic_add1_status"},
77{ERR_FUNC(OCSP_F_OCSP_BASIC_SIGN), "OCSP_basic_sign"}, 73{ERR_PACK(0,OCSP_F_OCSP_BASIC_SIGN,0), "OCSP_basic_sign"},
78{ERR_FUNC(OCSP_F_OCSP_BASIC_VERIFY), "OCSP_basic_verify"}, 74{ERR_PACK(0,OCSP_F_OCSP_BASIC_VERIFY,0), "OCSP_basic_verify"},
79{ERR_FUNC(OCSP_F_OCSP_CHECK_DELEGATED), "OCSP_CHECK_DELEGATED"}, 75{ERR_PACK(0,OCSP_F_OCSP_CHECK_DELEGATED,0), "OCSP_CHECK_DELEGATED"},
80{ERR_FUNC(OCSP_F_OCSP_CHECK_IDS), "OCSP_CHECK_IDS"}, 76{ERR_PACK(0,OCSP_F_OCSP_CHECK_IDS,0), "OCSP_CHECK_IDS"},
81{ERR_FUNC(OCSP_F_OCSP_CHECK_ISSUER), "OCSP_CHECK_ISSUER"}, 77{ERR_PACK(0,OCSP_F_OCSP_CHECK_ISSUER,0), "OCSP_CHECK_ISSUER"},
82{ERR_FUNC(OCSP_F_OCSP_CHECK_VALIDITY), "OCSP_check_validity"}, 78{ERR_PACK(0,OCSP_F_OCSP_CHECK_VALIDITY,0), "OCSP_check_validity"},
83{ERR_FUNC(OCSP_F_OCSP_MATCH_ISSUERID), "OCSP_MATCH_ISSUERID"}, 79{ERR_PACK(0,OCSP_F_OCSP_MATCH_ISSUERID,0), "OCSP_MATCH_ISSUERID"},
84{ERR_FUNC(OCSP_F_OCSP_PARSE_URL), "OCSP_parse_url"}, 80{ERR_PACK(0,OCSP_F_OCSP_PARSE_URL,0), "OCSP_parse_url"},
85{ERR_FUNC(OCSP_F_OCSP_REQUEST_SIGN), "OCSP_request_sign"}, 81{ERR_PACK(0,OCSP_F_OCSP_REQUEST_SIGN,0), "OCSP_request_sign"},
86{ERR_FUNC(OCSP_F_OCSP_REQUEST_VERIFY), "OCSP_request_verify"}, 82{ERR_PACK(0,OCSP_F_OCSP_REQUEST_VERIFY,0), "OCSP_request_verify"},
87{ERR_FUNC(OCSP_F_OCSP_RESPONSE_GET1_BASIC), "OCSP_response_get1_basic"}, 83{ERR_PACK(0,OCSP_F_OCSP_RESPONSE_GET1_BASIC,0), "OCSP_response_get1_basic"},
88{ERR_FUNC(OCSP_F_OCSP_SENDREQ_BIO), "OCSP_sendreq_bio"}, 84{ERR_PACK(0,OCSP_F_OCSP_SENDREQ_BIO,0), "OCSP_sendreq_bio"},
89{ERR_FUNC(OCSP_F_REQUEST_VERIFY), "REQUEST_VERIFY"}, 85{ERR_PACK(0,OCSP_F_REQUEST_VERIFY,0), "REQUEST_VERIFY"},
90{0,NULL} 86{0,NULL}
91 }; 87 };
92 88
93static ERR_STRING_DATA OCSP_str_reasons[]= 89static ERR_STRING_DATA OCSP_str_reasons[]=
94 { 90 {
95{ERR_REASON(OCSP_R_BAD_DATA) ,"bad data"}, 91{OCSP_R_BAD_DATA ,"bad data"},
96{ERR_REASON(OCSP_R_CERTIFICATE_VERIFY_ERROR),"certificate verify error"}, 92{OCSP_R_CERTIFICATE_VERIFY_ERROR ,"certificate verify error"},
97{ERR_REASON(OCSP_R_DIGEST_ERR) ,"digest err"}, 93{OCSP_R_DIGEST_ERR ,"digest err"},
98{ERR_REASON(OCSP_R_ERROR_IN_NEXTUPDATE_FIELD),"error in nextupdate field"}, 94{OCSP_R_ERROR_IN_NEXTUPDATE_FIELD ,"error in nextupdate field"},
99{ERR_REASON(OCSP_R_ERROR_IN_THISUPDATE_FIELD),"error in thisupdate field"}, 95{OCSP_R_ERROR_IN_THISUPDATE_FIELD ,"error in thisupdate field"},
100{ERR_REASON(OCSP_R_ERROR_PARSING_URL) ,"error parsing url"}, 96{OCSP_R_ERROR_PARSING_URL ,"error parsing url"},
101{ERR_REASON(OCSP_R_MISSING_OCSPSIGNING_USAGE),"missing ocspsigning usage"}, 97{OCSP_R_MISSING_OCSPSIGNING_USAGE ,"missing ocspsigning usage"},
102{ERR_REASON(OCSP_R_NEXTUPDATE_BEFORE_THISUPDATE),"nextupdate before thisupdate"}, 98{OCSP_R_NEXTUPDATE_BEFORE_THISUPDATE ,"nextupdate before thisupdate"},
103{ERR_REASON(OCSP_R_NOT_BASIC_RESPONSE) ,"not basic response"}, 99{OCSP_R_NOT_BASIC_RESPONSE ,"not basic response"},
104{ERR_REASON(OCSP_R_NO_CERTIFICATES_IN_CHAIN),"no certificates in chain"}, 100{OCSP_R_NO_CERTIFICATES_IN_CHAIN ,"no certificates in chain"},
105{ERR_REASON(OCSP_R_NO_CONTENT) ,"no content"}, 101{OCSP_R_NO_CONTENT ,"no content"},
106{ERR_REASON(OCSP_R_NO_PUBLIC_KEY) ,"no public key"}, 102{OCSP_R_NO_PUBLIC_KEY ,"no public key"},
107{ERR_REASON(OCSP_R_NO_RESPONSE_DATA) ,"no response data"}, 103{OCSP_R_NO_RESPONSE_DATA ,"no response data"},
108{ERR_REASON(OCSP_R_NO_REVOKED_TIME) ,"no revoked time"}, 104{OCSP_R_NO_REVOKED_TIME ,"no revoked time"},
109{ERR_REASON(OCSP_R_PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE),"private key does not match certificate"}, 105{OCSP_R_PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE,"private key does not match certificate"},
110{ERR_REASON(OCSP_R_REQUEST_NOT_SIGNED) ,"request not signed"}, 106{OCSP_R_REQUEST_NOT_SIGNED ,"request not signed"},
111{ERR_REASON(OCSP_R_RESPONSE_CONTAINS_NO_REVOCATION_DATA),"response contains no revocation data"}, 107{OCSP_R_RESPONSE_CONTAINS_NO_REVOCATION_DATA,"response contains no revocation data"},
112{ERR_REASON(OCSP_R_ROOT_CA_NOT_TRUSTED) ,"root ca not trusted"}, 108{OCSP_R_ROOT_CA_NOT_TRUSTED ,"root ca not trusted"},
113{ERR_REASON(OCSP_R_SERVER_READ_ERROR) ,"server read error"}, 109{OCSP_R_SERVER_READ_ERROR ,"server read error"},
114{ERR_REASON(OCSP_R_SERVER_RESPONSE_ERROR),"server response error"}, 110{OCSP_R_SERVER_RESPONSE_ERROR ,"server response error"},
115{ERR_REASON(OCSP_R_SERVER_RESPONSE_PARSE_ERROR),"server response parse error"}, 111{OCSP_R_SERVER_RESPONSE_PARSE_ERROR ,"server response parse error"},
116{ERR_REASON(OCSP_R_SERVER_WRITE_ERROR) ,"server write error"}, 112{OCSP_R_SERVER_WRITE_ERROR ,"server write error"},
117{ERR_REASON(OCSP_R_SIGNATURE_FAILURE) ,"signature failure"}, 113{OCSP_R_SIGNATURE_FAILURE ,"signature failure"},
118{ERR_REASON(OCSP_R_SIGNER_CERTIFICATE_NOT_FOUND),"signer certificate not found"}, 114{OCSP_R_SIGNER_CERTIFICATE_NOT_FOUND ,"signer certificate not found"},
119{ERR_REASON(OCSP_R_STATUS_EXPIRED) ,"status expired"}, 115{OCSP_R_STATUS_EXPIRED ,"status expired"},
120{ERR_REASON(OCSP_R_STATUS_NOT_YET_VALID) ,"status not yet valid"}, 116{OCSP_R_STATUS_NOT_YET_VALID ,"status not yet valid"},
121{ERR_REASON(OCSP_R_STATUS_TOO_OLD) ,"status too old"}, 117{OCSP_R_STATUS_TOO_OLD ,"status too old"},
122{ERR_REASON(OCSP_R_UNKNOWN_MESSAGE_DIGEST),"unknown message digest"}, 118{OCSP_R_UNKNOWN_MESSAGE_DIGEST ,"unknown message digest"},
123{ERR_REASON(OCSP_R_UNKNOWN_NID) ,"unknown nid"}, 119{OCSP_R_UNKNOWN_NID ,"unknown nid"},
124{ERR_REASON(OCSP_R_UNSUPPORTED_REQUESTORNAME_TYPE),"unsupported requestorname type"}, 120{OCSP_R_UNSUPPORTED_REQUESTORNAME_TYPE ,"unsupported requestorname type"},
125{0,NULL} 121{0,NULL}
126 }; 122 };
127 123
@@ -135,8 +131,8 @@ void ERR_load_OCSP_strings(void)
135 { 131 {
136 init=0; 132 init=0;
137#ifndef OPENSSL_NO_ERR 133#ifndef OPENSSL_NO_ERR
138 ERR_load_strings(0,OCSP_str_functs); 134 ERR_load_strings(ERR_LIB_OCSP,OCSP_str_functs);
139 ERR_load_strings(0,OCSP_str_reasons); 135 ERR_load_strings(ERR_LIB_OCSP,OCSP_str_reasons);
140#endif 136#endif
141 137
142 } 138 }
diff --git a/src/lib/libcrypto/opensslconf.h.in b/src/lib/libcrypto/opensslconf.h.in
new file mode 100644
index 0000000000..685e83b7a3
--- /dev/null
+++ b/src/lib/libcrypto/opensslconf.h.in
@@ -0,0 +1,158 @@
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 OPENSSLDIR "/usr/local/ssl"
9#endif
10#endif
11
12#undef OPENSSL_UNISTD
13#define OPENSSL_UNISTD <unistd.h>
14
15#undef OPENSSL_EXPORT_VAR_AS_FUNCTION
16
17#if defined(HEADER_IDEA_H) && !defined(IDEA_INT)
18#define IDEA_INT unsigned int
19#endif
20
21#if defined(HEADER_MD2_H) && !defined(MD2_INT)
22#define MD2_INT unsigned int
23#endif
24
25#if defined(HEADER_RC2_H) && !defined(RC2_INT)
26/* I need to put in a mod for the alpha - eay */
27#define RC2_INT unsigned int
28#endif
29
30#if defined(HEADER_RC4_H)
31#if !defined(RC4_INT)
32/* using int types make the structure larger but make the code faster
33 * on most boxes I have tested - up to %20 faster. */
34/*
35 * I don't know what does "most" mean, but declaring "int" is a must on:
36 * - Intel P6 because partial register stalls are very expensive;
37 * - elder Alpha because it lacks byte load/store instructions;
38 */
39#define RC4_INT unsigned int
40#endif
41#if !defined(RC4_CHUNK)
42/*
43 * This enables code handling data aligned at natural CPU word
44 * boundary. See crypto/rc4/rc4_enc.c for further details.
45 */
46#undef RC4_CHUNK
47#endif
48#endif
49
50#if (defined(HEADER_NEW_DES_H) || defined(HEADER_DES_H)) && !defined(DES_LONG)
51/* If this is set to 'unsigned int' on a DEC Alpha, this gives about a
52 * %20 speed up (longs are 8 bytes, int's are 4). */
53#ifndef DES_LONG
54#define DES_LONG unsigned long
55#endif
56#endif
57
58#if defined(HEADER_BN_H) && !defined(CONFIG_HEADER_BN_H)
59#define CONFIG_HEADER_BN_H
60#undef BN_LLONG
61
62/* Should we define BN_DIV2W here? */
63
64/* Only one for the following should be defined */
65/* The prime number generation stuff may not work when
66 * EIGHT_BIT but I don't care since I've only used this mode
67 * for debuging the bignum libraries */
68#undef SIXTY_FOUR_BIT_LONG
69#undef SIXTY_FOUR_BIT
70#define THIRTY_TWO_BIT
71#undef SIXTEEN_BIT
72#undef EIGHT_BIT
73#endif
74
75#if defined(HEADER_RC4_LOCL_H) && !defined(CONFIG_HEADER_RC4_LOCL_H)
76#define CONFIG_HEADER_RC4_LOCL_H
77/* if this is defined data[i] is used instead of *data, this is a %20
78 * speedup on x86 */
79#undef RC4_INDEX
80#endif
81
82#if defined(HEADER_BF_LOCL_H) && !defined(CONFIG_HEADER_BF_LOCL_H)
83#define CONFIG_HEADER_BF_LOCL_H
84#undef BF_PTR
85#endif /* HEADER_BF_LOCL_H */
86
87#if defined(HEADER_DES_LOCL_H) && !defined(CONFIG_HEADER_DES_LOCL_H)
88#define CONFIG_HEADER_DES_LOCL_H
89#ifndef DES_DEFAULT_OPTIONS
90/* the following is tweaked from a config script, that is why it is a
91 * protected undef/define */
92#ifndef DES_PTR
93#undef DES_PTR
94#endif
95
96/* This helps C compiler generate the correct code for multiple functional
97 * units. It reduces register dependancies at the expense of 2 more
98 * registers */
99#ifndef DES_RISC1
100#undef DES_RISC1
101#endif
102
103#ifndef DES_RISC2
104#undef DES_RISC2
105#endif
106
107#if defined(DES_RISC1) && defined(DES_RISC2)
108YOU SHOULD NOT HAVE BOTH DES_RISC1 AND DES_RISC2 DEFINED!!!!!
109#endif
110
111/* Unroll the inner loop, this sometimes helps, sometimes hinders.
112 * Very mucy CPU dependant */
113#ifndef DES_UNROLL
114#undef DES_UNROLL
115#endif
116
117/* These default values were supplied by
118 * Peter Gutman <pgut001@cs.auckland.ac.nz>
119 * They are only used if nothing else has been defined */
120#if !defined(DES_PTR) && !defined(DES_RISC1) && !defined(DES_RISC2) && !defined(DES_UNROLL)
121/* Special defines which change the way the code is built depending on the
122 CPU and OS. For SGI machines you can use _MIPS_SZLONG (32 or 64) to find
123 even newer MIPS CPU's, but at the moment one size fits all for
124 optimization options. Older Sparc's work better with only UNROLL, but
125 there's no way to tell at compile time what it is you're running on */
126
127#if defined( sun ) /* Newer Sparc's */
128# define DES_PTR
129# define DES_RISC1
130# define DES_UNROLL
131#elif defined( __ultrix ) /* Older MIPS */
132# define DES_PTR
133# define DES_RISC2
134# define DES_UNROLL
135#elif defined( __osf1__ ) /* Alpha */
136# define DES_PTR
137# define DES_RISC2
138#elif defined ( _AIX ) /* RS6000 */
139 /* Unknown */
140#elif defined( __hpux ) /* HP-PA */
141 /* Unknown */
142#elif defined( __aux ) /* 68K */
143 /* Unknown */
144#elif defined( __dgux ) /* 88K (but P6 in latest boxes) */
145# define DES_UNROLL
146#elif defined( __sgi ) /* Newer MIPS */
147# define DES_PTR
148# define DES_RISC2
149# define DES_UNROLL
150#elif defined(i386) || defined(__i386__) /* x86 boxes, should be gcc */
151# define DES_PTR
152# define DES_RISC1
153# define DES_UNROLL
154#endif /* Systems-specific speed defines */
155#endif
156
157#endif /* DES_DEFAULT_OPTIONS */
158#endif /* HEADER_DES_LOCL_H */
diff --git a/src/lib/libcrypto/opensslv.h b/src/lib/libcrypto/opensslv.h
index e50c1baf00..5d5f688edd 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 0x009070afL 28#define OPENSSL_VERSION_NUMBER 0x0090707fL
29#ifdef OPENSSL_FIPS 29#ifdef OPENSSL_FIPS
30#define OPENSSL_VERSION_TEXT "OpenSSL 0.9.7j-fips 04 May 2006" 30#define OPENSSL_VERSION_TEXT "OpenSSL 0.9.7g-fips 11 Apr 2005"
31#else 31#else
32#define OPENSSL_VERSION_TEXT "OpenSSL 0.9.7j 04 May 2006" 32#define OPENSSL_VERSION_TEXT "OpenSSL 0.9.7g 11 Apr 2005"
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..fbc2b5d056
--- /dev/null
+++ b/src/lib/libcrypto/pem/Makefile
@@ -0,0 +1,335 @@
1#
2# OpenSSL/crypto/pem/Makefile
3#
4
5DIR= pem
6TOP= ../..
7CC= cc
8INCLUDES= -I.. -I$(TOP) -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
18CFLAGS= $(INCLUDES) $(CFLAG)
19
20GENERAL=Makefile
21TEST=
22APPS=
23
24LIB=$(TOP)/libcrypto.a
25LIBSRC= pem_sign.c pem_seal.c pem_info.c pem_lib.c pem_all.c pem_err.c \
26 pem_x509.c pem_xaux.c pem_oth.c pem_pk8.c pem_pkey.c
27
28LIBOBJ= pem_sign.o pem_seal.o pem_info.o pem_lib.o pem_all.o pem_err.o \
29 pem_x509.o pem_xaux.o pem_oth.o pem_pk8.o pem_pkey.o
30
31SRC= $(LIBSRC)
32
33EXHEADER= pem.h pem2.h
34HEADER= $(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
48files:
49 $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
50
51links: $(EXHEADER)
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 @headerlist="$(EXHEADER)"; for i in $$headerlist ; \
58 do \
59 (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
60 chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
61 done;
62
63tags:
64 ctags $(SRC)
65
66tests:
67
68lint:
69 lint -DLINT $(INCLUDES) $(SRC)>fluff
70
71depend:
72 $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(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
83pem_all.o: ../../e_os.h ../../include/openssl/aes.h
84pem_all.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
85pem_all.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
86pem_all.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
87pem_all.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
88pem_all.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
89pem_all.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
90pem_all.o: ../../include/openssl/err.h ../../include/openssl/evp.h
91pem_all.o: ../../include/openssl/fips.h ../../include/openssl/idea.h
92pem_all.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
93pem_all.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
94pem_all.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
95pem_all.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
96pem_all.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
97pem_all.o: ../../include/openssl/pem.h ../../include/openssl/pem2.h
98pem_all.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
99pem_all.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
100pem_all.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
101pem_all.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
102pem_all.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
103pem_all.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
104pem_all.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
105pem_all.o: ../cryptlib.h pem_all.c
106pem_err.o: ../../include/openssl/aes.h ../../include/openssl/asn1.h
107pem_err.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
108pem_err.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
109pem_err.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
110pem_err.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
111pem_err.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
112pem_err.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
113pem_err.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
114pem_err.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
115pem_err.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
116pem_err.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
117pem_err.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
118pem_err.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
119pem_err.o: ../../include/openssl/pem.h ../../include/openssl/pem2.h
120pem_err.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
121pem_err.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
122pem_err.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
123pem_err.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
124pem_err.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
125pem_err.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
126pem_err.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
127pem_err.o: pem_err.c
128pem_info.o: ../../e_os.h ../../include/openssl/aes.h
129pem_info.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
130pem_info.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
131pem_info.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
132pem_info.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
133pem_info.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
134pem_info.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
135pem_info.o: ../../include/openssl/err.h ../../include/openssl/evp.h
136pem_info.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
137pem_info.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
138pem_info.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
139pem_info.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
140pem_info.o: ../../include/openssl/opensslconf.h
141pem_info.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
142pem_info.o: ../../include/openssl/pem.h ../../include/openssl/pem2.h
143pem_info.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
144pem_info.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
145pem_info.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
146pem_info.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
147pem_info.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
148pem_info.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
149pem_info.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
150pem_info.o: ../cryptlib.h pem_info.c
151pem_lib.o: ../../e_os.h ../../include/openssl/aes.h
152pem_lib.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
153pem_lib.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
154pem_lib.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
155pem_lib.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
156pem_lib.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
157pem_lib.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
158pem_lib.o: ../../include/openssl/err.h ../../include/openssl/evp.h
159pem_lib.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
160pem_lib.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
161pem_lib.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
162pem_lib.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
163pem_lib.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
164pem_lib.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pem.h
165pem_lib.o: ../../include/openssl/pem2.h ../../include/openssl/pkcs12.h
166pem_lib.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h
167pem_lib.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
168pem_lib.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
169pem_lib.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
170pem_lib.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
171pem_lib.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
172pem_lib.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h
173pem_lib.o: ../../include/openssl/x509_vfy.h ../cryptlib.h pem_lib.c
174pem_oth.o: ../../e_os.h ../../include/openssl/aes.h
175pem_oth.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
176pem_oth.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
177pem_oth.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
178pem_oth.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
179pem_oth.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
180pem_oth.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
181pem_oth.o: ../../include/openssl/err.h ../../include/openssl/evp.h
182pem_oth.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
183pem_oth.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
184pem_oth.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
185pem_oth.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
186pem_oth.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
187pem_oth.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pem.h
188pem_oth.o: ../../include/openssl/pem2.h ../../include/openssl/pkcs7.h
189pem_oth.o: ../../include/openssl/rand.h ../../include/openssl/rc2.h
190pem_oth.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
191pem_oth.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
192pem_oth.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
193pem_oth.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
194pem_oth.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
195pem_oth.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
196pem_oth.o: ../cryptlib.h pem_oth.c
197pem_pk8.o: ../../e_os.h ../../include/openssl/aes.h
198pem_pk8.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
199pem_pk8.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
200pem_pk8.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
201pem_pk8.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
202pem_pk8.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
203pem_pk8.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
204pem_pk8.o: ../../include/openssl/err.h ../../include/openssl/evp.h
205pem_pk8.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
206pem_pk8.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
207pem_pk8.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
208pem_pk8.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
209pem_pk8.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
210pem_pk8.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pem.h
211pem_pk8.o: ../../include/openssl/pem2.h ../../include/openssl/pkcs12.h
212pem_pk8.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h
213pem_pk8.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
214pem_pk8.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
215pem_pk8.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
216pem_pk8.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
217pem_pk8.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
218pem_pk8.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h
219pem_pk8.o: ../../include/openssl/x509_vfy.h ../cryptlib.h pem_pk8.c
220pem_pkey.o: ../../e_os.h ../../include/openssl/aes.h
221pem_pkey.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
222pem_pkey.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
223pem_pkey.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
224pem_pkey.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
225pem_pkey.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
226pem_pkey.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
227pem_pkey.o: ../../include/openssl/err.h ../../include/openssl/evp.h
228pem_pkey.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
229pem_pkey.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
230pem_pkey.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
231pem_pkey.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
232pem_pkey.o: ../../include/openssl/opensslconf.h
233pem_pkey.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
234pem_pkey.o: ../../include/openssl/pem.h ../../include/openssl/pem2.h
235pem_pkey.o: ../../include/openssl/pkcs12.h ../../include/openssl/pkcs7.h
236pem_pkey.o: ../../include/openssl/rand.h ../../include/openssl/rc2.h
237pem_pkey.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
238pem_pkey.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
239pem_pkey.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
240pem_pkey.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
241pem_pkey.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
242pem_pkey.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
243pem_pkey.o: ../cryptlib.h pem_pkey.c
244pem_seal.o: ../../e_os.h ../../include/openssl/aes.h
245pem_seal.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
246pem_seal.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
247pem_seal.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
248pem_seal.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
249pem_seal.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
250pem_seal.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
251pem_seal.o: ../../include/openssl/err.h ../../include/openssl/evp.h
252pem_seal.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
253pem_seal.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
254pem_seal.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
255pem_seal.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
256pem_seal.o: ../../include/openssl/opensslconf.h
257pem_seal.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
258pem_seal.o: ../../include/openssl/pem.h ../../include/openssl/pem2.h
259pem_seal.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h
260pem_seal.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
261pem_seal.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
262pem_seal.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
263pem_seal.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
264pem_seal.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
265pem_seal.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h
266pem_seal.o: ../../include/openssl/x509_vfy.h ../cryptlib.h pem_seal.c
267pem_sign.o: ../../e_os.h ../../include/openssl/aes.h
268pem_sign.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
269pem_sign.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
270pem_sign.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
271pem_sign.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
272pem_sign.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
273pem_sign.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
274pem_sign.o: ../../include/openssl/err.h ../../include/openssl/evp.h
275pem_sign.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
276pem_sign.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
277pem_sign.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
278pem_sign.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
279pem_sign.o: ../../include/openssl/opensslconf.h
280pem_sign.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
281pem_sign.o: ../../include/openssl/pem.h ../../include/openssl/pem2.h
282pem_sign.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h
283pem_sign.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
284pem_sign.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
285pem_sign.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
286pem_sign.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
287pem_sign.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
288pem_sign.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h
289pem_sign.o: ../../include/openssl/x509_vfy.h ../cryptlib.h pem_sign.c
290pem_x509.o: ../../e_os.h ../../include/openssl/aes.h
291pem_x509.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
292pem_x509.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
293pem_x509.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
294pem_x509.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
295pem_x509.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
296pem_x509.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
297pem_x509.o: ../../include/openssl/err.h ../../include/openssl/evp.h
298pem_x509.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
299pem_x509.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
300pem_x509.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
301pem_x509.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
302pem_x509.o: ../../include/openssl/opensslconf.h
303pem_x509.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
304pem_x509.o: ../../include/openssl/pem.h ../../include/openssl/pem2.h
305pem_x509.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
306pem_x509.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
307pem_x509.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
308pem_x509.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
309pem_x509.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
310pem_x509.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
311pem_x509.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
312pem_x509.o: ../cryptlib.h pem_x509.c
313pem_xaux.o: ../../e_os.h ../../include/openssl/aes.h
314pem_xaux.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
315pem_xaux.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
316pem_xaux.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
317pem_xaux.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
318pem_xaux.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
319pem_xaux.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
320pem_xaux.o: ../../include/openssl/err.h ../../include/openssl/evp.h
321pem_xaux.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
322pem_xaux.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
323pem_xaux.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
324pem_xaux.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
325pem_xaux.o: ../../include/openssl/opensslconf.h
326pem_xaux.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
327pem_xaux.o: ../../include/openssl/pem.h ../../include/openssl/pem2.h
328pem_xaux.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
329pem_xaux.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
330pem_xaux.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
331pem_xaux.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
332pem_xaux.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
333pem_xaux.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
334pem_xaux.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
335pem_xaux.o: ../cryptlib.h pem_xaux.c
diff --git a/src/lib/libcrypto/pem/Makefile.ssl b/src/lib/libcrypto/pem/Makefile.ssl
new file mode 100644
index 0000000000..d3043eb401
--- /dev/null
+++ b/src/lib/libcrypto/pem/Makefile.ssl
@@ -0,0 +1,336 @@
1#
2# SSLeay/crypto/pem/Makefile
3#
4
5DIR= pem
6TOP= ../..
7CC= cc
8INCLUDES= -I.. -I$(TOP) -I../../include
9CFLAG=-g
10INSTALL_PREFIX=
11OPENSSLDIR= /usr/local/ssl
12INSTALLTOP=/usr/local/ssl
13MAKE= make -f Makefile.ssl
14MAKEDEPPROG= makedepend
15MAKEDEPEND= $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG)
16MAKEFILE= Makefile.ssl
17AR= ar r
18
19CFLAGS= $(INCLUDES) $(CFLAG)
20
21GENERAL=Makefile
22TEST=
23APPS=
24
25LIB=$(TOP)/libcrypto.a
26LIBSRC= pem_sign.c pem_seal.c pem_info.c pem_lib.c pem_all.c pem_err.c \
27 pem_x509.c pem_xaux.c pem_oth.c pem_pk8.c pem_pkey.c
28
29LIBOBJ= pem_sign.o pem_seal.o pem_info.o pem_lib.o pem_all.o pem_err.o \
30 pem_x509.o pem_xaux.o pem_oth.o pem_pk8.o pem_pkey.o
31
32SRC= $(LIBSRC)
33
34EXHEADER= pem.h pem2.h
35HEADER= $(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.ssl >> $(TOP)/MINFO
51
52links: $(EXHEADER)
53 @sh $(TOP)/util/point.sh Makefile.ssl Makefile
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 @for i in $(EXHEADER) ; \
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 $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(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 *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
82
83# DO NOT DELETE THIS LINE -- make depend depends on it.
84
85pem_all.o: ../../e_os.h ../../include/openssl/aes.h
86pem_all.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
87pem_all.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
88pem_all.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
89pem_all.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
90pem_all.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
91pem_all.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
92pem_all.o: ../../include/openssl/err.h ../../include/openssl/evp.h
93pem_all.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
94pem_all.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
95pem_all.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
96pem_all.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
97pem_all.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
98pem_all.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pem.h
99pem_all.o: ../../include/openssl/pem2.h ../../include/openssl/pkcs7.h
100pem_all.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
101pem_all.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
102pem_all.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
103pem_all.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
104pem_all.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
105pem_all.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h
106pem_all.o: ../../include/openssl/x509_vfy.h ../cryptlib.h pem_all.c
107pem_err.o: ../../include/openssl/aes.h ../../include/openssl/asn1.h
108pem_err.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
109pem_err.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
110pem_err.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
111pem_err.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
112pem_err.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
113pem_err.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
114pem_err.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
115pem_err.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
116pem_err.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
117pem_err.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
118pem_err.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
119pem_err.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
120pem_err.o: ../../include/openssl/pem.h ../../include/openssl/pem2.h
121pem_err.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
122pem_err.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
123pem_err.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
124pem_err.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
125pem_err.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
126pem_err.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
127pem_err.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
128pem_err.o: pem_err.c
129pem_info.o: ../../e_os.h ../../include/openssl/aes.h
130pem_info.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
131pem_info.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
132pem_info.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
133pem_info.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
134pem_info.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
135pem_info.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
136pem_info.o: ../../include/openssl/err.h ../../include/openssl/evp.h
137pem_info.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
138pem_info.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
139pem_info.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
140pem_info.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
141pem_info.o: ../../include/openssl/opensslconf.h
142pem_info.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
143pem_info.o: ../../include/openssl/pem.h ../../include/openssl/pem2.h
144pem_info.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
145pem_info.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
146pem_info.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
147pem_info.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
148pem_info.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
149pem_info.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
150pem_info.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
151pem_info.o: ../cryptlib.h pem_info.c
152pem_lib.o: ../../e_os.h ../../include/openssl/aes.h
153pem_lib.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
154pem_lib.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
155pem_lib.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
156pem_lib.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
157pem_lib.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
158pem_lib.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
159pem_lib.o: ../../include/openssl/err.h ../../include/openssl/evp.h
160pem_lib.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
161pem_lib.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
162pem_lib.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
163pem_lib.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
164pem_lib.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
165pem_lib.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pem.h
166pem_lib.o: ../../include/openssl/pem2.h ../../include/openssl/pkcs12.h
167pem_lib.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h
168pem_lib.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
169pem_lib.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
170pem_lib.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
171pem_lib.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
172pem_lib.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
173pem_lib.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h
174pem_lib.o: ../../include/openssl/x509_vfy.h ../cryptlib.h pem_lib.c
175pem_oth.o: ../../e_os.h ../../include/openssl/aes.h
176pem_oth.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
177pem_oth.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
178pem_oth.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
179pem_oth.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
180pem_oth.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
181pem_oth.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
182pem_oth.o: ../../include/openssl/err.h ../../include/openssl/evp.h
183pem_oth.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
184pem_oth.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
185pem_oth.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
186pem_oth.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
187pem_oth.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
188pem_oth.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pem.h
189pem_oth.o: ../../include/openssl/pem2.h ../../include/openssl/pkcs7.h
190pem_oth.o: ../../include/openssl/rand.h ../../include/openssl/rc2.h
191pem_oth.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
192pem_oth.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
193pem_oth.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
194pem_oth.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
195pem_oth.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
196pem_oth.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
197pem_oth.o: ../cryptlib.h pem_oth.c
198pem_pk8.o: ../../e_os.h ../../include/openssl/aes.h
199pem_pk8.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
200pem_pk8.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
201pem_pk8.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
202pem_pk8.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
203pem_pk8.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
204pem_pk8.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
205pem_pk8.o: ../../include/openssl/err.h ../../include/openssl/evp.h
206pem_pk8.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
207pem_pk8.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
208pem_pk8.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
209pem_pk8.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
210pem_pk8.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
211pem_pk8.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pem.h
212pem_pk8.o: ../../include/openssl/pem2.h ../../include/openssl/pkcs12.h
213pem_pk8.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h
214pem_pk8.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
215pem_pk8.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
216pem_pk8.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
217pem_pk8.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
218pem_pk8.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
219pem_pk8.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h
220pem_pk8.o: ../../include/openssl/x509_vfy.h ../cryptlib.h pem_pk8.c
221pem_pkey.o: ../../e_os.h ../../include/openssl/aes.h
222pem_pkey.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
223pem_pkey.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
224pem_pkey.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
225pem_pkey.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
226pem_pkey.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
227pem_pkey.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
228pem_pkey.o: ../../include/openssl/err.h ../../include/openssl/evp.h
229pem_pkey.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
230pem_pkey.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
231pem_pkey.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
232pem_pkey.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
233pem_pkey.o: ../../include/openssl/opensslconf.h
234pem_pkey.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
235pem_pkey.o: ../../include/openssl/pem.h ../../include/openssl/pem2.h
236pem_pkey.o: ../../include/openssl/pkcs12.h ../../include/openssl/pkcs7.h
237pem_pkey.o: ../../include/openssl/rand.h ../../include/openssl/rc2.h
238pem_pkey.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
239pem_pkey.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
240pem_pkey.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
241pem_pkey.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
242pem_pkey.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
243pem_pkey.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
244pem_pkey.o: ../cryptlib.h pem_pkey.c
245pem_seal.o: ../../e_os.h ../../include/openssl/aes.h
246pem_seal.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
247pem_seal.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
248pem_seal.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
249pem_seal.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
250pem_seal.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
251pem_seal.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
252pem_seal.o: ../../include/openssl/err.h ../../include/openssl/evp.h
253pem_seal.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
254pem_seal.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
255pem_seal.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
256pem_seal.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
257pem_seal.o: ../../include/openssl/opensslconf.h
258pem_seal.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
259pem_seal.o: ../../include/openssl/pem.h ../../include/openssl/pem2.h
260pem_seal.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h
261pem_seal.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
262pem_seal.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
263pem_seal.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
264pem_seal.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
265pem_seal.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
266pem_seal.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h
267pem_seal.o: ../../include/openssl/x509_vfy.h ../cryptlib.h pem_seal.c
268pem_sign.o: ../../e_os.h ../../include/openssl/aes.h
269pem_sign.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
270pem_sign.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
271pem_sign.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
272pem_sign.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
273pem_sign.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
274pem_sign.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
275pem_sign.o: ../../include/openssl/err.h ../../include/openssl/evp.h
276pem_sign.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
277pem_sign.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
278pem_sign.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
279pem_sign.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
280pem_sign.o: ../../include/openssl/opensslconf.h
281pem_sign.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
282pem_sign.o: ../../include/openssl/pem.h ../../include/openssl/pem2.h
283pem_sign.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h
284pem_sign.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
285pem_sign.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
286pem_sign.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
287pem_sign.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
288pem_sign.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
289pem_sign.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h
290pem_sign.o: ../../include/openssl/x509_vfy.h ../cryptlib.h pem_sign.c
291pem_x509.o: ../../e_os.h ../../include/openssl/aes.h
292pem_x509.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
293pem_x509.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
294pem_x509.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
295pem_x509.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
296pem_x509.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
297pem_x509.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
298pem_x509.o: ../../include/openssl/err.h ../../include/openssl/evp.h
299pem_x509.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
300pem_x509.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
301pem_x509.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
302pem_x509.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
303pem_x509.o: ../../include/openssl/opensslconf.h
304pem_x509.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
305pem_x509.o: ../../include/openssl/pem.h ../../include/openssl/pem2.h
306pem_x509.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
307pem_x509.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
308pem_x509.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
309pem_x509.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
310pem_x509.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
311pem_x509.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
312pem_x509.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
313pem_x509.o: ../cryptlib.h pem_x509.c
314pem_xaux.o: ../../e_os.h ../../include/openssl/aes.h
315pem_xaux.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
316pem_xaux.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
317pem_xaux.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
318pem_xaux.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
319pem_xaux.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
320pem_xaux.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
321pem_xaux.o: ../../include/openssl/err.h ../../include/openssl/evp.h
322pem_xaux.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
323pem_xaux.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
324pem_xaux.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
325pem_xaux.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
326pem_xaux.o: ../../include/openssl/opensslconf.h
327pem_xaux.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
328pem_xaux.o: ../../include/openssl/pem.h ../../include/openssl/pem2.h
329pem_xaux.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
330pem_xaux.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
331pem_xaux.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
332pem_xaux.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
333pem_xaux.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
334pem_xaux.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
335pem_xaux.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
336pem_xaux.o: ../cryptlib.h pem_xaux.c
diff --git a/src/lib/libcrypto/pem/pem_err.c b/src/lib/libcrypto/pem/pem_err.c
index 8527028ebc..3b39b84d66 100644
--- a/src/lib/libcrypto/pem/pem_err.c
+++ b/src/lib/libcrypto/pem/pem_err.c
@@ -1,6 +1,6 @@
1/* crypto/pem/pem_err.c */ 1/* crypto/pem/pem_err.c */
2/* ==================================================================== 2/* ====================================================================
3 * Copyright (c) 1999-2005 The OpenSSL Project. All rights reserved. 3 * Copyright (c) 1999 The OpenSSL Project. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
@@ -64,56 +64,52 @@
64 64
65/* BEGIN ERROR CODES */ 65/* BEGIN ERROR CODES */
66#ifndef OPENSSL_NO_ERR 66#ifndef OPENSSL_NO_ERR
67
68#define ERR_FUNC(func) ERR_PACK(ERR_LIB_PEM,func,0)
69#define ERR_REASON(reason) ERR_PACK(ERR_LIB_PEM,0,reason)
70
71static ERR_STRING_DATA PEM_str_functs[]= 67static ERR_STRING_DATA PEM_str_functs[]=
72 { 68 {
73{ERR_FUNC(PEM_F_D2I_PKCS8PRIVATEKEY_BIO), "d2i_PKCS8PrivateKey_bio"}, 69{ERR_PACK(0,PEM_F_D2I_PKCS8PRIVATEKEY_BIO,0), "d2i_PKCS8PrivateKey_bio"},
74{ERR_FUNC(PEM_F_D2I_PKCS8PRIVATEKEY_FP), "d2i_PKCS8PrivateKey_fp"}, 70{ERR_PACK(0,PEM_F_D2I_PKCS8PRIVATEKEY_FP,0), "d2i_PKCS8PrivateKey_fp"},
75{ERR_FUNC(PEM_F_DEF_CALLBACK), "DEF_CALLBACK"}, 71{ERR_PACK(0,PEM_F_DEF_CALLBACK,0), "DEF_CALLBACK"},
76{ERR_FUNC(PEM_F_LOAD_IV), "LOAD_IV"}, 72{ERR_PACK(0,PEM_F_LOAD_IV,0), "LOAD_IV"},
77{ERR_FUNC(PEM_F_PEM_ASN1_READ), "PEM_ASN1_read"}, 73{ERR_PACK(0,PEM_F_PEM_ASN1_READ,0), "PEM_ASN1_read"},
78{ERR_FUNC(PEM_F_PEM_ASN1_READ_BIO), "PEM_ASN1_read_bio"}, 74{ERR_PACK(0,PEM_F_PEM_ASN1_READ_BIO,0), "PEM_ASN1_read_bio"},
79{ERR_FUNC(PEM_F_PEM_ASN1_WRITE), "PEM_ASN1_write"}, 75{ERR_PACK(0,PEM_F_PEM_ASN1_WRITE,0), "PEM_ASN1_write"},
80{ERR_FUNC(PEM_F_PEM_ASN1_WRITE_BIO), "PEM_ASN1_write_bio"}, 76{ERR_PACK(0,PEM_F_PEM_ASN1_WRITE_BIO,0), "PEM_ASN1_write_bio"},
81{ERR_FUNC(PEM_F_PEM_DO_HEADER), "PEM_do_header"}, 77{ERR_PACK(0,PEM_F_PEM_DO_HEADER,0), "PEM_do_header"},
82{ERR_FUNC(PEM_F_PEM_F_DO_PK8KEY_FP), "PEM_F_DO_PK8KEY_FP"}, 78{ERR_PACK(0,PEM_F_PEM_F_DO_PK8KEY_FP,0), "PEM_F_DO_PK8KEY_FP"},
83{ERR_FUNC(PEM_F_PEM_F_PEM_WRITE_PKCS8PRIVATEKEY), "PEM_F_PEM_WRITE_PKCS8PRIVATEKEY"}, 79{ERR_PACK(0,PEM_F_PEM_F_PEM_WRITE_PKCS8PRIVATEKEY,0), "PEM_F_PEM_WRITE_PKCS8PRIVATEKEY"},
84{ERR_FUNC(PEM_F_PEM_GET_EVP_CIPHER_INFO), "PEM_get_EVP_CIPHER_INFO"}, 80{ERR_PACK(0,PEM_F_PEM_GET_EVP_CIPHER_INFO,0), "PEM_get_EVP_CIPHER_INFO"},
85{ERR_FUNC(PEM_F_PEM_READ), "PEM_read"}, 81{ERR_PACK(0,PEM_F_PEM_READ,0), "PEM_read"},
86{ERR_FUNC(PEM_F_PEM_READ_BIO), "PEM_read_bio"}, 82{ERR_PACK(0,PEM_F_PEM_READ_BIO,0), "PEM_read_bio"},
87{ERR_FUNC(PEM_F_PEM_SEALFINAL), "PEM_SealFinal"}, 83{ERR_PACK(0,PEM_F_PEM_SEALFINAL,0), "PEM_SealFinal"},
88{ERR_FUNC(PEM_F_PEM_SEALINIT), "PEM_SealInit"}, 84{ERR_PACK(0,PEM_F_PEM_SEALINIT,0), "PEM_SealInit"},
89{ERR_FUNC(PEM_F_PEM_SIGNFINAL), "PEM_SignFinal"}, 85{ERR_PACK(0,PEM_F_PEM_SIGNFINAL,0), "PEM_SignFinal"},
90{ERR_FUNC(PEM_F_PEM_WRITE), "PEM_write"}, 86{ERR_PACK(0,PEM_F_PEM_WRITE,0), "PEM_write"},
91{ERR_FUNC(PEM_F_PEM_WRITE_BIO), "PEM_write_bio"}, 87{ERR_PACK(0,PEM_F_PEM_WRITE_BIO,0), "PEM_write_bio"},
92{ERR_FUNC(PEM_F_PEM_WRITE_BIO_PKCS8PRIVATEKEY), "PEM_write_bio_PKCS8PrivateKey"}, 88{ERR_PACK(0,PEM_F_PEM_WRITE_BIO_PKCS8PRIVATEKEY,0), "PEM_write_bio_PKCS8PrivateKey"},
93{ERR_FUNC(PEM_F_PEM_X509_INFO_READ), "PEM_X509_INFO_read"}, 89{ERR_PACK(0,PEM_F_PEM_X509_INFO_READ,0), "PEM_X509_INFO_read"},
94{ERR_FUNC(PEM_F_PEM_X509_INFO_READ_BIO), "PEM_X509_INFO_read_bio"}, 90{ERR_PACK(0,PEM_F_PEM_X509_INFO_READ_BIO,0), "PEM_X509_INFO_read_bio"},
95{ERR_FUNC(PEM_F_PEM_X509_INFO_WRITE_BIO), "PEM_X509_INFO_write_bio"}, 91{ERR_PACK(0,PEM_F_PEM_X509_INFO_WRITE_BIO,0), "PEM_X509_INFO_write_bio"},
96{0,NULL} 92{0,NULL}
97 }; 93 };
98 94
99static ERR_STRING_DATA PEM_str_reasons[]= 95static ERR_STRING_DATA PEM_str_reasons[]=
100 { 96 {
101{ERR_REASON(PEM_R_BAD_BASE64_DECODE) ,"bad base64 decode"}, 97{PEM_R_BAD_BASE64_DECODE ,"bad base64 decode"},
102{ERR_REASON(PEM_R_BAD_DECRYPT) ,"bad decrypt"}, 98{PEM_R_BAD_DECRYPT ,"bad decrypt"},
103{ERR_REASON(PEM_R_BAD_END_LINE) ,"bad end line"}, 99{PEM_R_BAD_END_LINE ,"bad end line"},
104{ERR_REASON(PEM_R_BAD_IV_CHARS) ,"bad iv chars"}, 100{PEM_R_BAD_IV_CHARS ,"bad iv chars"},
105{ERR_REASON(PEM_R_BAD_PASSWORD_READ) ,"bad password read"}, 101{PEM_R_BAD_PASSWORD_READ ,"bad password read"},
106{ERR_REASON(PEM_R_ERROR_CONVERTING_PRIVATE_KEY),"error converting private key"}, 102{PEM_R_ERROR_CONVERTING_PRIVATE_KEY ,"error converting private key"},
107{ERR_REASON(PEM_R_NOT_DEK_INFO) ,"not dek info"}, 103{PEM_R_NOT_DEK_INFO ,"not dek info"},
108{ERR_REASON(PEM_R_NOT_ENCRYPTED) ,"not encrypted"}, 104{PEM_R_NOT_ENCRYPTED ,"not encrypted"},
109{ERR_REASON(PEM_R_NOT_PROC_TYPE) ,"not proc type"}, 105{PEM_R_NOT_PROC_TYPE ,"not proc type"},
110{ERR_REASON(PEM_R_NO_START_LINE) ,"no start line"}, 106{PEM_R_NO_START_LINE ,"no start line"},
111{ERR_REASON(PEM_R_PROBLEMS_GETTING_PASSWORD),"problems getting password"}, 107{PEM_R_PROBLEMS_GETTING_PASSWORD ,"problems getting password"},
112{ERR_REASON(PEM_R_PUBLIC_KEY_NO_RSA) ,"public key no rsa"}, 108{PEM_R_PUBLIC_KEY_NO_RSA ,"public key no rsa"},
113{ERR_REASON(PEM_R_READ_KEY) ,"read key"}, 109{PEM_R_READ_KEY ,"read key"},
114{ERR_REASON(PEM_R_SHORT_HEADER) ,"short header"}, 110{PEM_R_SHORT_HEADER ,"short header"},
115{ERR_REASON(PEM_R_UNSUPPORTED_CIPHER) ,"unsupported cipher"}, 111{PEM_R_UNSUPPORTED_CIPHER ,"unsupported cipher"},
116{ERR_REASON(PEM_R_UNSUPPORTED_ENCRYPTION),"unsupported encryption"}, 112{PEM_R_UNSUPPORTED_ENCRYPTION ,"unsupported encryption"},
117{0,NULL} 113{0,NULL}
118 }; 114 };
119 115
@@ -127,8 +123,8 @@ void ERR_load_PEM_strings(void)
127 { 123 {
128 init=0; 124 init=0;
129#ifndef OPENSSL_NO_ERR 125#ifndef OPENSSL_NO_ERR
130 ERR_load_strings(0,PEM_str_functs); 126 ERR_load_strings(ERR_LIB_PEM,PEM_str_functs);
131 ERR_load_strings(0,PEM_str_reasons); 127 ERR_load_strings(ERR_LIB_PEM,PEM_str_reasons);
132#endif 128#endif
133 129
134 } 130 }
diff --git a/src/lib/libcrypto/perlasm/alpha.pl b/src/lib/libcrypto/perlasm/alpha.pl
new file mode 100644
index 0000000000..3dac571743
--- /dev/null
+++ b/src/lib/libcrypto/perlasm/alpha.pl
@@ -0,0 +1,434 @@
1#!/usr/local/bin/perl
2
3package alpha;
4use Carp qw(croak cluck);
5
6$label="100";
7
8$n_debug=0;
9$smear_regs=1;
10$reg_alloc=1;
11
12$align="3";
13$com_start="#";
14
15sub main'asm_init_output { @out=(); }
16sub main'asm_get_output { return(@out); }
17sub main'get_labels { return(@labels); }
18sub main'external_label { push(@labels,@_); }
19
20# General registers
21
22%regs=( 'r0', '$0',
23 'r1', '$1',
24 'r2', '$2',
25 'r3', '$3',
26 'r4', '$4',
27 'r5', '$5',
28 'r6', '$6',
29 'r7', '$7',
30 'r8', '$8',
31 'r9', '$22',
32 'r10', '$23',
33 'r11', '$24',
34 'r12', '$25',
35 'r13', '$27',
36 'r14', '$28',
37 'r15', '$21', # argc == 5
38 'r16', '$20', # argc == 4
39 'r17', '$19', # argc == 3
40 'r18', '$18', # argc == 2
41 'r19', '$17', # argc == 1
42 'r20', '$16', # argc == 0
43 'r21', '$9', # save 0
44 'r22', '$10', # save 1
45 'r23', '$11', # save 2
46 'r24', '$12', # save 3
47 'r25', '$13', # save 4
48 'r26', '$14', # save 5
49
50 'a0', '$16',
51 'a1', '$17',
52 'a2', '$18',
53 'a3', '$19',
54 'a4', '$20',
55 'a5', '$21',
56
57 's0', '$9',
58 's1', '$10',
59 's2', '$11',
60 's3', '$12',
61 's4', '$13',
62 's5', '$14',
63 'zero', '$31',
64 'sp', '$30',
65 );
66
67$main'reg_s0="r21";
68$main'reg_s1="r22";
69$main'reg_s2="r23";
70$main'reg_s3="r24";
71$main'reg_s4="r25";
72$main'reg_s5="r26";
73
74@reg=( '$0', '$1' ,'$2' ,'$3' ,'$4' ,'$5' ,'$6' ,'$7' ,'$8',
75 '$22','$23','$24','$25','$20','$21','$27','$28');
76
77
78sub main'sub { &out3("subq",@_); }
79sub main'add { &out3("addq",@_); }
80sub main'mov { &out3("bis",$_[0],$_[0],$_[1]); }
81sub main'or { &out3("bis",@_); }
82sub main'bis { &out3("bis",@_); }
83sub main'br { &out1("br",@_); }
84sub main'ld { &out2("ldq",@_); }
85sub main'st { &out2("stq",@_); }
86sub main'cmpult { &out3("cmpult",@_); }
87sub main'cmplt { &out3("cmplt",@_); }
88sub main'bgt { &out2("bgt",@_); }
89sub main'ble { &out2("ble",@_); }
90sub main'blt { &out2("blt",@_); }
91sub main'mul { &out3("mulq",@_); }
92sub main'muh { &out3("umulh",@_); }
93
94$main'QWS=8;
95
96sub main'asm_add
97 {
98 push(@out,@_);
99 }
100
101sub main'asm_finish
102 {
103 &main'file_end();
104 print &main'asm_get_output();
105 }
106
107sub main'asm_init
108 {
109 ($type,$fn)=@_;
110 $filename=$fn;
111
112 &main'asm_init_output();
113 &main'comment("Don't even think of reading this code");
114 &main'comment("It was automatically generated by $filename");
115 &main'comment("Which is a perl program used to generate the alpha assember.");
116 &main'comment("eric <eay\@cryptsoft.com>");
117 &main'comment("");
118
119 $filename =~ s/\.pl$//;
120 &main'file($filename);
121 }
122
123sub conv
124 {
125 local($r)=@_;
126 local($v);
127
128 return($regs{$r}) if defined($regs{$r});
129 return($r);
130 }
131
132sub main'QWPw
133 {
134 local($off,$reg)=@_;
135
136 return(&main'QWP($off*8,$reg));
137 }
138
139sub main'QWP
140 {
141 local($off,$reg)=@_;
142
143 $ret="$off(".&conv($reg).")";
144 return($ret);
145 }
146
147sub out3
148 {
149 local($name,$p1,$p2,$p3)=@_;
150
151 $p1=&conv($p1);
152 $p2=&conv($p2);
153 $p3=&conv($p3);
154 push(@out,"\t$name\t");
155 $l=length($p1)+1;
156 push(@out,$p1.",");
157 $ll=3-($l+9)/8;
158 $tmp1=sprintf("\t" x $ll);
159 push(@out,$tmp1);
160
161 $l=length($p2)+1;
162 push(@out,$p2.",");
163 $ll=3-($l+9)/8;
164 $tmp1=sprintf("\t" x $ll);
165 push(@out,$tmp1);
166
167 push(@out,&conv($p3)."\n");
168 }
169
170sub out2
171 {
172 local($name,$p1,$p2,$p3)=@_;
173
174 $p1=&conv($p1);
175 $p2=&conv($p2);
176 push(@out,"\t$name\t");
177 $l=length($p1)+1;
178 push(@out,$p1.",");
179 $ll=3-($l+9)/8;
180 $tmp1=sprintf("\t" x $ll);
181 push(@out,$tmp1);
182
183 push(@out,&conv($p2)."\n");
184 }
185
186sub out1
187 {
188 local($name,$p1)=@_;
189
190 $p1=&conv($p1);
191 push(@out,"\t$name\t".$p1."\n");
192 }
193
194sub out0
195 {
196 push(@out,"\t$_[0]\n");
197 }
198
199sub main'file
200 {
201 local($file)=@_;
202
203 local($tmp)=<<"EOF";
204 # DEC Alpha assember
205 # Generated from perl scripts contains in SSLeay
206 .file 1 "$file.s"
207 .set noat
208EOF
209 push(@out,$tmp);
210 }
211
212sub main'function_begin
213 {
214 local($func)=@_;
215
216print STDERR "$func\n";
217 local($tmp)=<<"EOF";
218 .text
219 .align $align
220 .globl $func
221 .ent $func
222${func}:
223${func}..ng:
224 .frame \$30,0,\$26,0
225 .prologue 0
226EOF
227 push(@out,$tmp);
228 $stack=0;
229 }
230
231sub main'function_end
232 {
233 local($func)=@_;
234
235 local($tmp)=<<"EOF";
236 ret \$31,(\$26),1
237 .end $func
238EOF
239 push(@out,$tmp);
240 $stack=0;
241 %label=();
242 }
243
244sub main'function_end_A
245 {
246 local($func)=@_;
247
248 local($tmp)=<<"EOF";
249 ret \$31,(\$26),1
250EOF
251 push(@out,$tmp);
252 }
253
254sub main'function_end_B
255 {
256 local($func)=@_;
257
258 $func=$under.$func;
259
260 push(@out,"\t.end $func\n");
261 $stack=0;
262 %label=();
263 }
264
265sub main'wparam
266 {
267 local($num)=@_;
268
269 if ($num < 6)
270 {
271 $num=20-$num;
272 return("r$num");
273 }
274 else
275 { return(&main'QWP($stack+$num*8,"sp")); }
276 }
277
278sub main'stack_push
279 {
280 local($num)=@_;
281 $stack+=$num*8;
282 &main'sub("sp",$num*8,"sp");
283 }
284
285sub main'stack_pop
286 {
287 local($num)=@_;
288 $stack-=$num*8;
289 &main'add("sp",$num*8,"sp");
290 }
291
292sub main'swtmp
293 {
294 return(&main'QWP(($_[0])*8,"sp"));
295 }
296
297# Should use swtmp, which is above sp. Linix can trash the stack above esp
298#sub main'wtmp
299# {
300# local($num)=@_;
301#
302# return(&main'QWP(-($num+1)*4,"esp","",0));
303# }
304
305sub main'comment
306 {
307 foreach (@_)
308 {
309 if (/^\s*$/)
310 { push(@out,"\n"); }
311 else
312 { push(@out,"\t$com_start $_ $com_end\n"); }
313 }
314 }
315
316sub main'label
317 {
318 if (!defined($label{$_[0]}))
319 {
320 $label{$_[0]}=$label;
321 $label++;
322 }
323 return('$'.$label{$_[0]});
324 }
325
326sub main'set_label
327 {
328 if (!defined($label{$_[0]}))
329 {
330 $label{$_[0]}=$label;
331 $label++;
332 }
333# push(@out,".align $align\n") if ($_[1] != 0);
334 push(@out,'$'."$label{$_[0]}:\n");
335 }
336
337sub main'file_end
338 {
339 }
340
341sub main'data_word
342 {
343 push(@out,"\t.long $_[0]\n");
344 }
345
346@pool_free=();
347@pool_taken=();
348$curr_num=0;
349$max=0;
350
351sub main'init_pool
352 {
353 local($args)=@_;
354 local($i);
355
356 @pool_free=();
357 for ($i=(14+(6-$args)); $i >= 0; $i--)
358 {
359 push(@pool_free,"r$i");
360 }
361 print STDERR "START :register pool:@pool_free\n";
362 $curr_num=$max=0;
363 }
364
365sub main'fin_pool
366 {
367 printf STDERR "END %2d:register pool:@pool_free\n",$max;
368 }
369
370sub main'GR
371 {
372 local($r)=@_;
373 local($i,@n,$_);
374
375 foreach (@pool_free)
376 {
377 if ($r ne $_)
378 { push(@n,$_); }
379 else
380 {
381 $curr_num++;
382 $max=$curr_num if ($curr_num > $max);
383 }
384 }
385 @pool_free=@n;
386print STDERR "GR:@pool_free\n" if $reg_alloc;
387 return(@_);
388 }
389
390sub main'NR
391 {
392 local($num)=@_;
393 local(@ret);
394
395 $num=1 if $num == 0;
396 ($#pool_free >= ($num-1)) || croak "out of registers: want $num, have @pool_free";
397 while ($num > 0)
398 {
399 push(@ret,pop @pool_free);
400 $curr_num++;
401 $max=$curr_num if ($curr_num > $max);
402 $num--
403 }
404 print STDERR "nr @ret\n" if $n_debug;
405print STDERR "NR:@pool_free\n" if $reg_alloc;
406 return(@ret);
407
408 }
409
410sub main'FR
411 {
412 local(@r)=@_;
413 local(@a,$v,$w);
414
415 print STDERR "fr @r\n" if $n_debug;
416# cluck "fr @r";
417 for $w (@pool_free)
418 {
419 foreach $v (@r)
420 {
421 croak "double register free of $v (@pool_free)" if $w eq $v;
422 }
423 }
424 foreach $v (@r)
425 {
426 croak "bad argument to FR" if ($v !~ /^r\d+$/);
427 if ($smear_regs)
428 { unshift(@pool_free,$v); }
429 else { push(@pool_free,$v); }
430 $curr_num--;
431 }
432print STDERR "FR:@pool_free\n" if $reg_alloc;
433 }
4341;
diff --git a/src/lib/libcrypto/perlasm/x86asm.pl b/src/lib/libcrypto/perlasm/x86asm.pl
index ea54a1edc5..60233f80e8 100644
--- a/src/lib/libcrypto/perlasm/x86asm.pl
+++ b/src/lib/libcrypto/perlasm/x86asm.pl
@@ -18,9 +18,13 @@ sub main'asm_init
18 ($type,$fn,$i386)=@_; 18 ($type,$fn,$i386)=@_;
19 $filename=$fn; 19 $filename=$fn;
20 20
21 $elf=$cpp=$sol=$aout=$win32=$gaswin=0; 21 $elf=$cpp=$sol=$aout=$win32=$gaswin=$openbsd=0;
22 if ( ($type eq "elf")) 22 if ( ($type eq "elf"))
23 { $elf=1; require "x86unix.pl"; } 23 { $elf=1; require "x86unix.pl"; }
24 elsif ( ($type eq "openbsd-elf"))
25 { $openbsd=$elf=1; require "x86unix.pl"; }
26 elsif ( ($type eq "openbsd-a.out"))
27 { $openbsd=1; require "x86unix.pl"; }
24 elsif ( ($type eq "a.out")) 28 elsif ( ($type eq "a.out"))
25 { $aout=1; require "x86unix.pl"; } 29 { $aout=1; require "x86unix.pl"; }
26 elsif ( ($type eq "gaswin")) 30 elsif ( ($type eq "gaswin"))
@@ -43,6 +47,8 @@ Pick one target type from
43 cpp - format so x86unix.cpp can be used 47 cpp - format so x86unix.cpp can be used
44 win32 - Windows 95/Windows NT 48 win32 - Windows 95/Windows NT
45 win32n - Windows 95/Windows NT NASM format 49 win32n - Windows 95/Windows NT NASM format
50 openbsd-elf - OpenBSD elf
51 openbsd-a.out - OpenBSD a.out
46EOF 52EOF
47 exit(1); 53 exit(1);
48 } 54 }
@@ -90,7 +96,7 @@ $tmp
90#ifdef OUT 96#ifdef OUT
91#define OK 1 97#define OK 1
92#define ALIGN 4 98#define ALIGN 4
93#if defined(__CYGWIN__) || defined(__DJGPP__) || defined(__MINGW32__) 99#if defined(__CYGWIN__) || defined(__DJGPP__)
94#undef SIZE 100#undef SIZE
95#undef TYPE 101#undef TYPE
96#define SIZE(a,b) 102#define SIZE(a,b)
diff --git a/src/lib/libcrypto/perlasm/x86ms.pl b/src/lib/libcrypto/perlasm/x86ms.pl
new file mode 100644
index 0000000000..b6bd744057
--- /dev/null
+++ b/src/lib/libcrypto/perlasm/x86ms.pl
@@ -0,0 +1,380 @@
1#!/usr/local/bin/perl
2
3package x86ms;
4
5$label="L000";
6
7%lb=( 'eax', 'al',
8 'ebx', 'bl',
9 'ecx', 'cl',
10 'edx', 'dl',
11 'ax', 'al',
12 'bx', 'bl',
13 'cx', 'cl',
14 'dx', 'dl',
15 );
16
17%hb=( 'eax', 'ah',
18 'ebx', 'bh',
19 'ecx', 'ch',
20 'edx', 'dh',
21 'ax', 'ah',
22 'bx', 'bh',
23 'cx', 'ch',
24 'dx', 'dh',
25 );
26
27sub main'asm_init_output { @out=(); }
28sub main'asm_get_output { return(@out); }
29sub main'get_labels { return(@labels); }
30sub main'external_label { push(@labels,@_); }
31
32sub main'LB
33 {
34 (defined($lb{$_[0]})) || die "$_[0] does not have a 'low byte'\n";
35 return($lb{$_[0]});
36 }
37
38sub main'HB
39 {
40 (defined($hb{$_[0]})) || die "$_[0] does not have a 'high byte'\n";
41 return($hb{$_[0]});
42 }
43
44sub main'BP
45 {
46 &get_mem("BYTE",@_);
47 }
48
49sub main'DWP
50 {
51 &get_mem("DWORD",@_);
52 }
53
54sub main'BC
55 {
56 return @_;
57 }
58
59sub main'DWC
60 {
61 return @_;
62 }
63
64sub main'stack_push
65 {
66 local($num)=@_;
67 $stack+=$num*4;
68 &main'sub("esp",$num*4);
69 }
70
71sub main'stack_pop
72 {
73 local($num)=@_;
74 $stack-=$num*4;
75 &main'add("esp",$num*4);
76 }
77
78sub get_mem
79 {
80 local($size,$addr,$reg1,$reg2,$idx)=@_;
81 local($t,$post);
82 local($ret)="$size PTR ";
83
84 $addr =~ s/^\s+//;
85 if ($addr =~ /^(.+)\+(.+)$/)
86 {
87 $reg2=&conv($1);
88 $addr="_$2";
89 }
90 elsif ($addr =~ /^[_a-zA-Z]/)
91 {
92 $addr="_$addr";
93 }
94
95 if ($addr =~ /^.+\-.+$/) { $addr="($addr)"; }
96
97 $reg1="$regs{$reg1}" if defined($regs{$reg1});
98 $reg2="$regs{$reg2}" if defined($regs{$reg2});
99 if (($addr ne "") && ($addr ne 0))
100 {
101 if ($addr !~ /^-/)
102 { $ret.=$addr; }
103 else { $post=$addr; }
104 }
105 if ($reg2 ne "")
106 {
107 $t="";
108 $t="*$idx" if ($idx != 0);
109 $reg1="+".$reg1 if ("$reg1$post" ne "");
110 $ret.="[$reg2$t$reg1$post]";
111 }
112 else
113 {
114 $ret.="[$reg1$post]"
115 }
116 $ret =~ s/\[\]//; # in case $addr was the only argument
117 return($ret);
118 }
119
120sub main'mov { &out2("mov",@_); }
121sub main'movb { &out2("mov",@_); }
122sub main'and { &out2("and",@_); }
123sub main'or { &out2("or",@_); }
124sub main'shl { &out2("shl",@_); }
125sub main'shr { &out2("shr",@_); }
126sub main'xor { &out2("xor",@_); }
127sub main'xorb { &out2("xor",@_); }
128sub main'add { &out2("add",@_); }
129sub main'adc { &out2("adc",@_); }
130sub main'sub { &out2("sub",@_); }
131sub main'rotl { &out2("rol",@_); }
132sub main'rotr { &out2("ror",@_); }
133sub main'exch { &out2("xchg",@_); }
134sub main'cmp { &out2("cmp",@_); }
135sub main'lea { &out2("lea",@_); }
136sub main'mul { &out1("mul",@_); }
137sub main'div { &out1("div",@_); }
138sub main'dec { &out1("dec",@_); }
139sub main'inc { &out1("inc",@_); }
140sub main'jmp { &out1("jmp",@_); }
141sub main'jmp_ptr { &out1p("jmp",@_); }
142sub main'je { &out1("je",@_); }
143sub main'jle { &out1("jle",@_); }
144sub main'jz { &out1("jz",@_); }
145sub main'jge { &out1("jge",@_); }
146sub main'jl { &out1("jl",@_); }
147sub main'ja { &out1("ja",@_); }
148sub main'jae { &out1("jae",@_); }
149sub main'jb { &out1("jb",@_); }
150sub main'jbe { &out1("jbe",@_); }
151sub main'jc { &out1("jc",@_); }
152sub main'jnc { &out1("jnc",@_); }
153sub main'jnz { &out1("jnz",@_); }
154sub main'jne { &out1("jne",@_); }
155sub main'jno { &out1("jno",@_); }
156sub main'push { &out1("push",@_); $stack+=4; }
157sub main'pop { &out1("pop",@_); $stack-=4; }
158sub main'bswap { &out1("bswap",@_); &using486(); }
159sub main'not { &out1("not",@_); }
160sub main'call { &out1("call",($_[0]=~/^\$L/?'':'_').$_[0]); }
161sub main'ret { &out0("ret"); }
162sub main'nop { &out0("nop"); }
163sub main'movz { &out2("movzx",@_); }
164
165sub out2
166 {
167 local($name,$p1,$p2)=@_;
168 local($l,$t);
169
170 push(@out,"\t$name\t");
171 $t=&conv($p1).",";
172 $l=length($t);
173 push(@out,$t);
174 $l=4-($l+9)/8;
175 push(@out,"\t" x $l);
176 push(@out,&conv($p2));
177 push(@out,"\n");
178 }
179
180sub out0
181 {
182 local($name)=@_;
183
184 push(@out,"\t$name\n");
185 }
186
187sub out1
188 {
189 local($name,$p1)=@_;
190 local($l,$t);
191
192 push(@out,"\t$name\t".&conv($p1)."\n");
193 }
194
195sub conv
196 {
197 local($p)=@_;
198
199 $p =~ s/0x([0-9A-Fa-f]+)/0$1h/;
200 return $p;
201 }
202
203sub using486
204 {
205 return if $using486;
206 $using486++;
207 grep(s/\.386/\.486/,@out);
208 }
209
210sub main'file
211 {
212 local($file)=@_;
213
214 local($tmp)=<<"EOF";
215 TITLE $file.asm
216 .386
217.model FLAT
218EOF
219 push(@out,$tmp);
220 }
221
222sub main'function_begin
223 {
224 local($func,$extra)=@_;
225
226 push(@labels,$func);
227
228 local($tmp)=<<"EOF";
229_TEXT SEGMENT
230PUBLIC _$func
231$extra
232_$func PROC NEAR
233 push ebp
234 push ebx
235 push esi
236 push edi
237EOF
238 push(@out,$tmp);
239 $stack=20;
240 }
241
242sub main'function_begin_B
243 {
244 local($func,$extra)=@_;
245
246 local($tmp)=<<"EOF";
247_TEXT SEGMENT
248PUBLIC _$func
249$extra
250_$func PROC NEAR
251EOF
252 push(@out,$tmp);
253 $stack=4;
254 }
255
256sub main'function_end
257 {
258 local($func)=@_;
259
260 local($tmp)=<<"EOF";
261 pop edi
262 pop esi
263 pop ebx
264 pop ebp
265 ret
266_$func ENDP
267_TEXT ENDS
268EOF
269 push(@out,$tmp);
270 $stack=0;
271 %label=();
272 }
273
274sub main'function_end_B
275 {
276 local($func)=@_;
277
278 local($tmp)=<<"EOF";
279_$func ENDP
280_TEXT ENDS
281EOF
282 push(@out,$tmp);
283 $stack=0;
284 %label=();
285 }
286
287sub main'function_end_A
288 {
289 local($func)=@_;
290
291 local($tmp)=<<"EOF";
292 pop edi
293 pop esi
294 pop ebx
295 pop ebp
296 ret
297EOF
298 push(@out,$tmp);
299 }
300
301sub main'file_end
302 {
303 push(@out,"END\n");
304 }
305
306sub main'wparam
307 {
308 local($num)=@_;
309
310 return(&main'DWP($stack+$num*4,"esp","",0));
311 }
312
313sub main'swtmp
314 {
315 return(&main'DWP($_[0]*4,"esp","",0));
316 }
317
318# Should use swtmp, which is above esp. Linix can trash the stack above esp
319#sub main'wtmp
320# {
321# local($num)=@_;
322#
323# return(&main'DWP(-(($num+1)*4),"esp","",0));
324# }
325
326sub main'comment
327 {
328 foreach (@_)
329 {
330 push(@out,"\t; $_\n");
331 }
332 }
333
334sub main'label
335 {
336 if (!defined($label{$_[0]}))
337 {
338 $label{$_[0]}="\$${label}${_[0]}";
339 $label++;
340 }
341 return($label{$_[0]});
342 }
343
344sub main'set_label
345 {
346 if (!defined($label{$_[0]}))
347 {
348 $label{$_[0]}="\$${label}${_[0]}";
349 $label++;
350 }
351 if((defined $_[2]) && ($_[2] == 1))
352 {
353 push(@out,"$label{$_[0]}::\n");
354 }
355 else
356 {
357 push(@out,"$label{$_[0]}:\n");
358 }
359 }
360
361sub main'data_word
362 {
363 push(@out,"\tDD\t$_[0]\n");
364 }
365
366sub out1p
367 {
368 local($name,$p1)=@_;
369 local($l,$t);
370
371 push(@out,"\t$name\t ".&conv($p1)."\n");
372 }
373
374sub main'picmeup
375 {
376 local($dst,$sym)=@_;
377 &main'lea($dst,&main'DWP($sym));
378 }
379
380sub main'blindpop { &out1("pop",@_); }
diff --git a/src/lib/libcrypto/perlasm/x86nasm.pl b/src/lib/libcrypto/perlasm/x86nasm.pl
new file mode 100644
index 0000000000..5009acb4b3
--- /dev/null
+++ b/src/lib/libcrypto/perlasm/x86nasm.pl
@@ -0,0 +1,362 @@
1#!/usr/local/bin/perl
2
3package x86nasm;
4
5$label="L000";
6
7%lb=( 'eax', 'al',
8 'ebx', 'bl',
9 'ecx', 'cl',
10 'edx', 'dl',
11 'ax', 'al',
12 'bx', 'bl',
13 'cx', 'cl',
14 'dx', 'dl',
15 );
16
17%hb=( 'eax', 'ah',
18 'ebx', 'bh',
19 'ecx', 'ch',
20 'edx', 'dh',
21 'ax', 'ah',
22 'bx', 'bh',
23 'cx', 'ch',
24 'dx', 'dh',
25 );
26
27sub main'asm_init_output { @out=(); }
28sub main'asm_get_output { return(@out); }
29sub main'get_labels { return(@labels); }
30
31sub main'external_label
32{
33 push(@labels,@_);
34 foreach (@_) {
35 push(@out, "extern\t_$_\n");
36 }
37}
38
39sub main'LB
40 {
41 (defined($lb{$_[0]})) || die "$_[0] does not have a 'low byte'\n";
42 return($lb{$_[0]});
43 }
44
45sub main'HB
46 {
47 (defined($hb{$_[0]})) || die "$_[0] does not have a 'high byte'\n";
48 return($hb{$_[0]});
49 }
50
51sub main'BP
52 {
53 &get_mem("BYTE",@_);
54 }
55
56sub main'DWP
57 {
58 &get_mem("DWORD",@_);
59 }
60
61sub main'BC
62 {
63 return "BYTE @_";
64 }
65
66sub main'DWC
67 {
68 return "DWORD @_";
69 }
70
71sub main'stack_push
72 {
73 my($num)=@_;
74 $stack+=$num*4;
75 &main'sub("esp",$num*4);
76 }
77
78sub main'stack_pop
79 {
80 my($num)=@_;
81 $stack-=$num*4;
82 &main'add("esp",$num*4);
83 }
84
85sub get_mem
86 {
87 my($size,$addr,$reg1,$reg2,$idx)=@_;
88 my($t,$post);
89 my($ret)="$size [";
90 $addr =~ s/^\s+//;
91 if ($addr =~ /^(.+)\+(.+)$/)
92 {
93 $reg2=&conv($1);
94 $addr="_$2";
95 }
96 elsif ($addr =~ /^[_a-zA-Z]/)
97 {
98 $addr="_$addr";
99 }
100
101 if ($addr =~ /^.+\-.+$/) { $addr="($addr)"; }
102
103 $reg1="$regs{$reg1}" if defined($regs{$reg1});
104 $reg2="$regs{$reg2}" if defined($regs{$reg2});
105 if (($addr ne "") && ($addr ne 0))
106 {
107 if ($addr !~ /^-/)
108 { $ret.="${addr}+"; }
109 else { $post=$addr; }
110 }
111 if ($reg2 ne "")
112 {
113 $t="";
114 $t="*$idx" if ($idx != 0);
115 $reg1="+".$reg1 if ("$reg1$post" ne "");
116 $ret.="$reg2$t$reg1$post]";
117 }
118 else
119 {
120 $ret.="$reg1$post]"
121 }
122 $ret =~ s/\+\]/]/; # in case $addr was the only argument
123 return($ret);
124 }
125
126sub main'mov { &out2("mov",@_); }
127sub main'movb { &out2("mov",@_); }
128sub main'and { &out2("and",@_); }
129sub main'or { &out2("or",@_); }
130sub main'shl { &out2("shl",@_); }
131sub main'shr { &out2("shr",@_); }
132sub main'xor { &out2("xor",@_); }
133sub main'xorb { &out2("xor",@_); }
134sub main'add { &out2("add",@_); }
135sub main'adc { &out2("adc",@_); }
136sub main'sub { &out2("sub",@_); }
137sub main'rotl { &out2("rol",@_); }
138sub main'rotr { &out2("ror",@_); }
139sub main'exch { &out2("xchg",@_); }
140sub main'cmp { &out2("cmp",@_); }
141sub main'lea { &out2("lea",@_); }
142sub main'mul { &out1("mul",@_); }
143sub main'div { &out1("div",@_); }
144sub main'dec { &out1("dec",@_); }
145sub main'inc { &out1("inc",@_); }
146sub main'jmp { &out1("jmp",@_); }
147sub main'jmp_ptr { &out1p("jmp",@_); }
148
149# This is a bit of a kludge: declare all branches as NEAR.
150sub main'je { &out1("je NEAR",@_); }
151sub main'jle { &out1("jle NEAR",@_); }
152sub main'jz { &out1("jz NEAR",@_); }
153sub main'jge { &out1("jge NEAR",@_); }
154sub main'jl { &out1("jl NEAR",@_); }
155sub main'ja { &out1("ja NEAR",@_); }
156sub main'jae { &out1("jae NEAR",@_); }
157sub main'jb { &out1("jb NEAR",@_); }
158sub main'jbe { &out1("jbe NEAR",@_); }
159sub main'jc { &out1("jc NEAR",@_); }
160sub main'jnc { &out1("jnc NEAR",@_); }
161sub main'jnz { &out1("jnz NEAR",@_); }
162sub main'jne { &out1("jne NEAR",@_); }
163sub main'jno { &out1("jno NEAR",@_); }
164
165sub main'push { &out1("push",@_); $stack+=4; }
166sub main'pop { &out1("pop",@_); $stack-=4; }
167sub main'bswap { &out1("bswap",@_); &using486(); }
168sub main'not { &out1("not",@_); }
169sub main'call { &out1("call",($_[0]=~/^\$L/?'':'_').$_[0]); }
170sub main'ret { &out0("ret"); }
171sub main'nop { &out0("nop"); }
172sub main'movz { &out2("movzx",@_); }
173
174sub out2
175 {
176 my($name,$p1,$p2)=@_;
177 my($l,$t);
178
179 push(@out,"\t$name\t");
180 if ($name eq "lea")
181 {
182 $p1 =~ s/^[^\[]*\[/\[/;
183 $p2 =~ s/^[^\[]*\[/\[/;
184 }
185 $t=&conv($p1).",";
186 $l=length($t);
187 push(@out,$t);
188 $l=4-($l+9)/8;
189 push(@out,"\t" x $l);
190 push(@out,&conv($p2));
191 push(@out,"\n");
192 }
193
194sub out0
195 {
196 my($name)=@_;
197
198 push(@out,"\t$name\n");
199 }
200
201sub out1
202 {
203 my($name,$p1)=@_;
204 my($l,$t);
205 push(@out,"\t$name\t".&conv($p1)."\n");
206 }
207
208sub conv
209 {
210 my($p)=@_;
211 $p =~ s/0x([0-9A-Fa-f]+)/0$1h/;
212 return $p;
213 }
214
215sub using486
216 {
217 return if $using486;
218 $using486++;
219 grep(s/\.386/\.486/,@out);
220 }
221
222sub main'file
223 {
224 push(@out, "segment .text use32\n");
225 }
226
227sub main'function_begin
228 {
229 my($func,$extra)=@_;
230
231 push(@labels,$func);
232 my($tmp)=<<"EOF";
233global _$func
234_$func:
235 push ebp
236 push ebx
237 push esi
238 push edi
239EOF
240 push(@out,$tmp);
241 $stack=20;
242 }
243
244sub main'function_begin_B
245 {
246 my($func,$extra)=@_;
247 my($tmp)=<<"EOF";
248global _$func
249_$func:
250EOF
251 push(@out,$tmp);
252 $stack=4;
253 }
254
255sub main'function_end
256 {
257 my($func)=@_;
258
259 my($tmp)=<<"EOF";
260 pop edi
261 pop esi
262 pop ebx
263 pop ebp
264 ret
265EOF
266 push(@out,$tmp);
267 $stack=0;
268 %label=();
269 }
270
271sub main'function_end_B
272 {
273 $stack=0;
274 %label=();
275 }
276
277sub main'function_end_A
278 {
279 my($func)=@_;
280
281 my($tmp)=<<"EOF";
282 pop edi
283 pop esi
284 pop ebx
285 pop ebp
286 ret
287EOF
288 push(@out,$tmp);
289 }
290
291sub main'file_end
292 {
293 }
294
295sub main'wparam
296 {
297 my($num)=@_;
298
299 return(&main'DWP($stack+$num*4,"esp","",0));
300 }
301
302sub main'swtmp
303 {
304 return(&main'DWP($_[0]*4,"esp","",0));
305 }
306
307# Should use swtmp, which is above esp. Linix can trash the stack above esp
308#sub main'wtmp
309# {
310# my($num)=@_;
311#
312# return(&main'DWP(-(($num+1)*4),"esp","",0));
313# }
314
315sub main'comment
316 {
317 foreach (@_)
318 {
319 push(@out,"\t; $_\n");
320 }
321 }
322
323sub main'label
324 {
325 if (!defined($label{$_[0]}))
326 {
327 $label{$_[0]}="\$${label}${_[0]}";
328 $label++;
329 }
330 return($label{$_[0]});
331 }
332
333sub main'set_label
334 {
335 if (!defined($label{$_[0]}))
336 {
337 $label{$_[0]}="\$${label}${_[0]}";
338 $label++;
339 }
340 push(@out,"$label{$_[0]}:\n");
341 }
342
343sub main'data_word
344 {
345 push(@out,"\tDD\t$_[0]\n");
346 }
347
348sub out1p
349 {
350 my($name,$p1)=@_;
351 my($l,$t);
352
353 push(@out,"\t$name\t ".&conv($p1)."\n");
354 }
355
356sub main'picmeup
357 {
358 local($dst,$sym)=@_;
359 &main'lea($dst,&main'DWP($sym));
360 }
361
362sub main'blindpop { &out1("pop",@_); }
diff --git a/src/lib/libcrypto/perlasm/x86unix.pl b/src/lib/libcrypto/perlasm/x86unix.pl
new file mode 100644
index 0000000000..b61425e951
--- /dev/null
+++ b/src/lib/libcrypto/perlasm/x86unix.pl
@@ -0,0 +1,628 @@
1#!/usr/local/bin/perl
2
3package x86unix;
4
5$label="L000";
6$const="";
7$constl=0;
8
9$align=($main'aout)?"4":"16";
10$under=($main'aout)?"_":"";
11$com_start=($main'sol)?"/":"#";
12
13sub main'asm_init_output { @out=(); }
14sub main'asm_get_output { return(@out); }
15sub main'get_labels { return(@labels); }
16sub main'external_label { push(@labels,@_); }
17
18if ($main'openbsd)
19 {
20 $com_start='/*';
21 $com_end='*/';
22 }
23
24if ($main'cpp)
25 {
26 $align="ALIGN";
27 $under="";
28 $com_start='/*';
29 $com_end='*/';
30 }
31
32%lb=( 'eax', '%al',
33 'ebx', '%bl',
34 'ecx', '%cl',
35 'edx', '%dl',
36 'ax', '%al',
37 'bx', '%bl',
38 'cx', '%cl',
39 'dx', '%dl',
40 );
41
42%hb=( 'eax', '%ah',
43 'ebx', '%bh',
44 'ecx', '%ch',
45 'edx', '%dh',
46 'ax', '%ah',
47 'bx', '%bh',
48 'cx', '%ch',
49 'dx', '%dh',
50 );
51
52%regs=( 'eax', '%eax',
53 'ebx', '%ebx',
54 'ecx', '%ecx',
55 'edx', '%edx',
56 'esi', '%esi',
57 'edi', '%edi',
58 'ebp', '%ebp',
59 'esp', '%esp',
60 );
61
62%reg_val=(
63 'eax', 0x00,
64 'ebx', 0x03,
65 'ecx', 0x01,
66 'edx', 0x02,
67 'esi', 0x06,
68 'edi', 0x07,
69 'ebp', 0x05,
70 'esp', 0x04,
71 );
72
73sub main'LB
74 {
75 (defined($lb{$_[0]})) || die "$_[0] does not have a 'low byte'\n";
76 return($lb{$_[0]});
77 }
78
79sub main'HB
80 {
81 (defined($hb{$_[0]})) || die "$_[0] does not have a 'high byte'\n";
82 return($hb{$_[0]});
83 }
84
85sub main'DWP
86 {
87 local($addr,$reg1,$reg2,$idx)=@_;
88
89 $ret="";
90 $addr =~ s/(^|[+ \t])([A-Za-z_]+[A-Za-z0-9_]+)($|[+ \t])/$1$under$2$3/;
91 $reg1="$regs{$reg1}" if defined($regs{$reg1});
92 $reg2="$regs{$reg2}" if defined($regs{$reg2});
93 $ret.=$addr if ($addr ne "") && ($addr ne 0);
94 if ($reg2 ne "")
95 {
96 if($idx ne "" && $idx != 0)
97 { $ret.="($reg1,$reg2,$idx)"; }
98 else
99 { $ret.="($reg1,$reg2)"; }
100 }
101 elsif ($reg1 ne "")
102 { $ret.="($reg1)" }
103 return($ret);
104 }
105
106sub main'BP
107 {
108 return(&main'DWP(@_));
109 }
110
111sub main'BC
112 {
113 return @_;
114 }
115
116sub main'DWC
117 {
118 return @_;
119 }
120
121#sub main'BP
122# {
123# local($addr,$reg1,$reg2,$idx)=@_;
124#
125# $ret="";
126#
127# $addr =~ s/(^|[+ \t])([A-Za-z_]+)($|[+ \t])/$1$under$2$3/;
128# $reg1="$regs{$reg1}" if defined($regs{$reg1});
129# $reg2="$regs{$reg2}" if defined($regs{$reg2});
130# $ret.=$addr if ($addr ne "") && ($addr ne 0);
131# if ($reg2 ne "")
132# { $ret.="($reg1,$reg2,$idx)"; }
133# else
134# { $ret.="($reg1)" }
135# return($ret);
136# }
137
138sub main'mov { &out2("movl",@_); }
139sub main'movb { &out2("movb",@_); }
140sub main'and { &out2("andl",@_); }
141sub main'or { &out2("orl",@_); }
142sub main'shl { &out2("sall",@_); }
143sub main'shr { &out2("shrl",@_); }
144sub main'xor { &out2("xorl",@_); }
145sub main'xorb { &out2("xorb",@_); }
146sub main'add { &out2($_[0]=~/%[a-d][lh]/?"addb":"addl",@_); }
147sub main'adc { &out2("adcl",@_); }
148sub main'sub { &out2("subl",@_); }
149sub main'rotl { &out2("roll",@_); }
150sub main'rotr { &out2("rorl",@_); }
151sub main'exch { &out2($_[0]=~/%[a-d][lh]/?"xchgb":"xchgl",@_); }
152sub main'cmp { &out2("cmpl",@_); }
153sub main'lea { &out2("leal",@_); }
154sub main'mul { &out1("mull",@_); }
155sub main'div { &out1("divl",@_); }
156sub main'jmp { &out1("jmp",@_); }
157sub main'jmp_ptr { &out1p("jmp",@_); }
158sub main'je { &out1("je",@_); }
159sub main'jle { &out1("jle",@_); }
160sub main'jne { &out1("jne",@_); }
161sub main'jnz { &out1("jnz",@_); }
162sub main'jz { &out1("jz",@_); }
163sub main'jge { &out1("jge",@_); }
164sub main'jl { &out1("jl",@_); }
165sub main'ja { &out1("ja",@_); }
166sub main'jae { &out1("jae",@_); }
167sub main'jb { &out1("jb",@_); }
168sub main'jbe { &out1("jbe",@_); }
169sub main'jc { &out1("jc",@_); }
170sub main'jnc { &out1("jnc",@_); }
171sub main'jno { &out1("jno",@_); }
172sub main'dec { &out1("decl",@_); }
173sub main'inc { &out1($_[0]=~/%[a-d][hl]/?"incb":"incl",@_); }
174sub main'push { &out1("pushl",@_); $stack+=4; }
175sub main'pop { &out1("popl",@_); $stack-=4; }
176sub main'pushf { &out0("pushf"); $stack+=4; }
177sub main'popf { &out0("popf"); $stack-=4; }
178sub main'not { &out1("notl",@_); }
179sub main'call { &out1("call",($_[0]=~/^\.L/?'':$under).$_[0]); }
180sub main'ret { &out0("ret"); }
181sub main'nop { &out0("nop"); }
182sub main'test { &out2("testl",@_); }
183sub main'movz { &out2("movzbl",@_); }
184sub main'neg { &out1("negl",@_); }
185
186# The bswapl instruction is new for the 486. Emulate if i386.
187sub main'bswap
188 {
189 if ($main'i386)
190 {
191 &main'comment("bswapl @_");
192 &main'exch(main'HB(@_),main'LB(@_));
193 &main'rotr(@_,16);
194 &main'exch(main'HB(@_),main'LB(@_));
195 }
196 else
197 {
198 &out1("bswapl",@_);
199 }
200 }
201
202sub out2
203 {
204 local($name,$p1,$p2)=@_;
205 local($l,$ll,$t);
206 local(%special)=( "roll",0xD1C0,"rorl",0xD1C8,
207 "rcll",0xD1D0,"rcrl",0xD1D8,
208 "shll",0xD1E0,"shrl",0xD1E8,
209 "sarl",0xD1F8);
210
211 if ((defined($special{$name})) && defined($regs{$p1}) && ($p2 == 1))
212 {
213 $op=$special{$name}|$reg_val{$p1};
214 $tmp1=sprintf(".byte %d\n",($op>>8)&0xff);
215 $tmp2=sprintf(".byte %d\t",$op &0xff);
216 push(@out,$tmp1);
217 push(@out,$tmp2);
218
219 $p2=&conv($p2);
220 $p1=&conv($p1);
221 &main'comment("$name $p2 $p1");
222 return;
223 }
224
225 push(@out,"\t$name\t");
226 $t=&conv($p2).",";
227 $l=length($t);
228 push(@out,$t);
229 $ll=4-($l+9)/8;
230 $tmp1=sprintf("\t" x $ll);
231 push(@out,$tmp1);
232 push(@out,&conv($p1)."\n");
233 }
234
235sub out1
236 {
237 local($name,$p1)=@_;
238 local($l,$t);
239 local(%special)=("bswapl",0x0FC8);
240
241 if ((defined($special{$name})) && defined($regs{$p1}))
242 {
243 $op=$special{$name}|$reg_val{$p1};
244 $tmp1=sprintf(".byte %d\n",($op>>8)&0xff);
245 $tmp2=sprintf(".byte %d\t",$op &0xff);
246 push(@out,$tmp1);
247 push(@out,$tmp2);
248
249 $p2=&conv($p2);
250 $p1=&conv($p1);
251 &main'comment("$name $p2 $p1");
252 return;
253 }
254
255 push(@out,"\t$name\t".&conv($p1)."\n");
256 }
257
258sub out1p
259 {
260 local($name,$p1)=@_;
261 local($l,$t);
262
263 push(@out,"\t$name\t*".&conv($p1)."\n");
264 }
265
266sub out0
267 {
268 push(@out,"\t$_[0]\n");
269 }
270
271sub conv
272 {
273 local($p)=@_;
274
275# $p =~ s/0x([0-9A-Fa-f]+)/0$1h/;
276
277 $p=$regs{$p} if (defined($regs{$p}));
278
279 $p =~ s/^(-{0,1}[0-9A-Fa-f]+)$/\$$1/;
280 $p =~ s/^(0x[0-9A-Fa-f]+)$/\$$1/;
281 return $p;
282 }
283
284sub main'file
285 {
286 local($file)=@_;
287
288 if ($main'openbsd)
289 { push(@out,"#include <machine/asm.h>\n"); return; }
290
291 local($tmp)=<<"EOF";
292 .file "$file.s"
293 .version "01.01"
294gcc2_compiled.:
295EOF
296 push(@out,$tmp);
297 }
298
299sub main'function_begin
300 {
301 local($func)=@_;
302
303 &main'external_label($func);
304 $func=$under.$func;
305
306 if ($main'openbsd)
307 { push (@out, "\nENTRY($func)\n"); goto skip; }
308
309 local($tmp)=<<"EOF";
310.text
311 .align $align
312.globl $func
313EOF
314 push(@out,$tmp);
315 if ($main'cpp)
316 { $tmp=push(@out,"\tTYPE($func,\@function)\n"); }
317 elsif ($main'gaswin)
318 { $tmp=push(@out,"\t.def\t$func;\t.scl\t2;\t.type\t32;\t.endef\n"); }
319 else { $tmp=push(@out,"\t.type\t$func,\@function\n"); }
320 push(@out,"$func:\n");
321skip:
322 $tmp=<<"EOF";
323 pushl %ebp
324 pushl %ebx
325 pushl %esi
326 pushl %edi
327
328EOF
329 push(@out,$tmp);
330 $stack=20;
331 }
332
333sub main'function_begin_B
334 {
335 local($func,$extra)=@_;
336
337 &main'external_label($func);
338 $func=$under.$func;
339
340 if ($main'openbsd)
341 { push(@out, "\nENTRY($func)\n"); goto skip; }
342
343 local($tmp)=<<"EOF";
344.text
345 .align $align
346.globl $func
347EOF
348 push(@out,$tmp);
349 if ($main'cpp)
350 { push(@out,"\tTYPE($func,\@function)\n"); }
351 elsif ($main'gaswin)
352 { $tmp=push(@out,"\t.def\t$func;\t.scl\t2;\t.type\t32;\t.endef\n"); }
353 else { push(@out,"\t.type $func,\@function\n"); }
354 push(@out,"$func:\n");
355skip:
356 $stack=4;
357 }
358
359sub main'function_end
360 {
361 local($func)=@_;
362
363 $func=$under.$func;
364
365 local($tmp)=<<"EOF";
366 popl %edi
367 popl %esi
368 popl %ebx
369 popl %ebp
370 ret
371.L_${func}_end:
372EOF
373 push(@out,$tmp);
374
375 if ($main'cpp)
376 { push(@out,"\tSIZE($func,.L_${func}_end-$func)\n"); }
377 elsif ($main'gaswin)
378 { $tmp=push(@out,"\t.align 4\n"); }
379 else { push(@out,"\t.size\t$func,.L_${func}_end-$func\n"); }
380 push(@out,".ident \"$func\"\n");
381 $stack=0;
382 %label=();
383 }
384
385sub main'function_end_A
386 {
387 local($func)=@_;
388
389 local($tmp)=<<"EOF";
390 popl %edi
391 popl %esi
392 popl %ebx
393 popl %ebp
394 ret
395EOF
396 push(@out,$tmp);
397 }
398
399sub main'function_end_B
400 {
401 local($func)=@_;
402
403 $func=$under.$func;
404
405 push(@out,".L_${func}_end:\n");
406 if ($main'cpp)
407 { push(@out,"\tSIZE($func,.L_${func}_end-$func)\n"); }
408 elsif ($main'gaswin)
409 { push(@out,"\t.align 4\n"); }
410 else { push(@out,"\t.size\t$func,.L_${func}_end-$func\n"); }
411 push(@out,".ident \"desasm.pl\"\n");
412 $stack=0;
413 %label=();
414 }
415
416sub main'wparam
417 {
418 local($num)=@_;
419
420 return(&main'DWP($stack+$num*4,"esp","",0));
421 }
422
423sub main'stack_push
424 {
425 local($num)=@_;
426 $stack+=$num*4;
427 &main'sub("esp",$num*4);
428 }
429
430sub main'stack_pop
431 {
432 local($num)=@_;
433 $stack-=$num*4;
434 &main'add("esp",$num*4);
435 }
436
437sub main'swtmp
438 {
439 return(&main'DWP($_[0]*4,"esp","",0));
440 }
441
442# Should use swtmp, which is above esp. Linix can trash the stack above esp
443#sub main'wtmp
444# {
445# local($num)=@_;
446#
447# return(&main'DWP(-($num+1)*4,"esp","",0));
448# }
449
450sub main'comment
451 {
452 if (!$main'openbsd && $main'elf)
453 # GNU and SVR4 as'es use different comment delimiters,
454 { # so we just skip comments...
455 push(@out,"\n");
456 return;
457 }
458 foreach (@_)
459 {
460 if (/^\s*$/)
461 { push(@out,"\n"); }
462 else
463 { push(@out,"\t$com_start $_ $com_end\n"); }
464 }
465 }
466
467sub main'public_label
468 {
469 $label{$_[0]}="${under}${_[0]}" if (!defined($label{$_[0]}));
470 push(@out,".globl\t$label{$_[0]}\n");
471 }
472
473sub main'label
474 {
475 if (!defined($label{$_[0]}))
476 {
477 $label{$_[0]}=".${label}${_[0]}";
478 $label++;
479 }
480 return($label{$_[0]});
481 }
482
483sub main'set_label
484 {
485 if (!defined($label{$_[0]}))
486 {
487 $label{$_[0]}=".${label}${_[0]}";
488 $label++;
489 }
490 if ($main'openbsd)
491 { push(@out,"_ALIGN_TEXT\n") if ($_[1] != 0); }
492 else
493 { push(@out,".align $align\n") if ($_[1] != 0); }
494 push(@out,"$label{$_[0]}:\n");
495 }
496
497sub main'file_end
498 {
499 if ($const ne "")
500 {
501 push(@out,".section .rodata\n");
502 push(@out,$const);
503 $const="";
504 }
505 }
506
507sub main'data_word
508 {
509 push(@out,"\t.long\t".join(',',@_)."\n");
510 }
511
512# debug output functions: puts, putx, printf
513
514sub main'puts
515 {
516 &pushvars();
517 &main'push('$Lstring' . ++$constl);
518 &main'call('puts');
519 $stack-=4;
520 &main'add("esp",4);
521 &popvars();
522
523 $const .= "Lstring$constl:\n\t.string \"@_[0]\"\n";
524 }
525
526sub main'putx
527 {
528 &pushvars();
529 &main'push($_[0]);
530 &main'push('$Lstring' . ++$constl);
531 &main'call('printf');
532 &main'add("esp",8);
533 $stack-=8;
534 &popvars();
535
536 $const .= "Lstring$constl:\n\t.string \"\%X\"\n";
537 }
538
539sub main'printf
540 {
541 $ostack = $stack;
542 &pushvars();
543 for ($i = @_ - 1; $i >= 0; $i--)
544 {
545 if ($i == 0) # change this to support %s format strings
546 {
547 &main'push('$Lstring' . ++$constl);
548 $const .= "Lstring$constl:\n\t.string \"@_[$i]\"\n";
549 }
550 else
551 {
552 if ($_[$i] =~ /([0-9]*)\(%esp\)/)
553 {
554 &main'push(($1 + $stack - $ostack) . '(%esp)');
555 }
556 else
557 {
558 &main'push($_[$i]);
559 }
560 }
561 }
562 &main'call('printf');
563 $stack-=4*@_;
564 &main'add("esp",4*@_);
565 &popvars();
566 }
567
568sub pushvars
569 {
570 &main'pushf();
571 &main'push("edx");
572 &main'push("ecx");
573 &main'push("eax");
574 }
575
576sub popvars
577 {
578 &main'pop("eax");
579 &main'pop("ecx");
580 &main'pop("edx");
581 &main'popf();
582 }
583
584sub main'picmeup
585 {
586 local($dst,$sym)=@_;
587 if ($main'cpp)
588 {
589 local($tmp)=<<___;
590#if (defined(ELF) || defined(SOL)) && defined(PIC)
591 .align 8
592 call 1f
5931: popl $regs{$dst}
594 addl \$_GLOBAL_OFFSET_TABLE_+[.-1b],$regs{$dst}
595 movl $sym\@GOT($regs{$dst}),$regs{$dst}
596#else
597 leal $sym,$regs{$dst}
598#endif
599___
600 push(@out,$tmp);
601 }
602 elsif ($main'openbsd)
603 {
604 push(@out, "#ifdef PIC\n");
605 push(@out, "\tPIC_PROLOGUE\n");
606 &main'mov($dst,"PIC_GOT($sym)");
607 push(@out, "\tPIC_EPILOGUE\n");
608 push(@out, "#else\n");
609 &main'lea($dst,&main'DWP($sym));
610 push(@out, "#endif\n");
611 }
612 elsif ($main'pic && ($main'elf || $main'aout))
613 {
614 push(@out,"\t.align\t8\n");
615 &main'call(&main'label("PIC_me_up"));
616 &main'set_label("PIC_me_up");
617 &main'blindpop($dst);
618 &main'add($dst,"\$$under"."_GLOBAL_OFFSET_TABLE_+[.-".
619 &main'label("PIC_me_up") . "]");
620 &main'mov($dst,&main'DWP($sym."\@GOT",$dst));
621 }
622 else
623 {
624 &main'lea($dst,&main'DWP($sym));
625 }
626 }
627
628sub main'blindpop { &out1("popl",@_); }
diff --git a/src/lib/libcrypto/pkcs12/Makefile b/src/lib/libcrypto/pkcs12/Makefile
new file mode 100644
index 0000000000..bef4f27912
--- /dev/null
+++ b/src/lib/libcrypto/pkcs12/Makefile
@@ -0,0 +1,415 @@
1#
2# OpenSSL/crypto/pkcs12/Makefile
3#
4
5DIR= pkcs12
6TOP= ../..
7CC= cc
8INCLUDES= -I.. -I$(TOP) -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
18CFLAGS= $(INCLUDES) $(CFLAG)
19
20GENERAL=Makefile
21TEST=
22APPS=
23
24LIB=$(TOP)/libcrypto.a
25LIBSRC= p12_add.c p12_asn.c p12_attr.c p12_crpt.c p12_crt.c p12_decr.c \
26 p12_init.c p12_key.c p12_kiss.c p12_mutl.c\
27 p12_utl.c p12_npas.c pk12err.c p12_p8d.c p12_p8e.c
28LIBOBJ= p12_add.o p12_asn.o p12_attr.o p12_crpt.o p12_crt.o p12_decr.o \
29 p12_init.o p12_key.o p12_kiss.o p12_mutl.o\
30 p12_utl.o p12_npas.o pk12err.o p12_p8d.o p12_p8e.o
31
32SRC= $(LIBSRC)
33
34EXHEADER= pkcs12.h
35HEADER= $(EXHEADER)
36
37ALL= $(GENERAL) $(SRC) $(HEADER)
38
39top:
40 (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all)
41
42test:
43
44all: lib
45
46lib: $(LIBOBJ)
47 $(AR) $(LIB) $(LIBOBJ)
48 $(RANLIB) $(LIB) || echo Never mind.
49 @touch lib
50
51files:
52 $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
53
54links:
55 @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
56 @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
57 @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
58
59install:
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 $(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 *.obj lib tags core .pure .nfs* *.old *.bak fluff
83
84# DO NOT DELETE THIS LINE -- make depend depends on it.
85
86p12_add.o: ../../e_os.h ../../include/openssl/aes.h
87p12_add.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
88p12_add.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
89p12_add.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
90p12_add.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
91p12_add.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
92p12_add.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
93p12_add.o: ../../include/openssl/err.h ../../include/openssl/evp.h
94p12_add.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
95p12_add.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
96p12_add.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
97p12_add.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
98p12_add.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
99p12_add.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs12.h
100p12_add.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
101p12_add.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
102p12_add.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
103p12_add.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
104p12_add.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
105p12_add.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
106p12_add.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
107p12_add.o: ../cryptlib.h p12_add.c
108p12_asn.o: ../../e_os.h ../../include/openssl/aes.h
109p12_asn.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h
110p12_asn.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
111p12_asn.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
112p12_asn.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
113p12_asn.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
114p12_asn.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
115p12_asn.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
116p12_asn.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
117p12_asn.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
118p12_asn.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
119p12_asn.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
120p12_asn.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
121p12_asn.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
122p12_asn.o: ../../include/openssl/pkcs12.h ../../include/openssl/pkcs7.h
123p12_asn.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
124p12_asn.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
125p12_asn.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
126p12_asn.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
127p12_asn.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
128p12_asn.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h
129p12_asn.o: ../../include/openssl/x509_vfy.h ../cryptlib.h p12_asn.c
130p12_attr.o: ../../e_os.h ../../include/openssl/aes.h
131p12_attr.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
132p12_attr.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
133p12_attr.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
134p12_attr.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
135p12_attr.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
136p12_attr.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
137p12_attr.o: ../../include/openssl/err.h ../../include/openssl/evp.h
138p12_attr.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
139p12_attr.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
140p12_attr.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
141p12_attr.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
142p12_attr.o: ../../include/openssl/opensslconf.h
143p12_attr.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
144p12_attr.o: ../../include/openssl/pkcs12.h ../../include/openssl/pkcs7.h
145p12_attr.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
146p12_attr.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
147p12_attr.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
148p12_attr.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
149p12_attr.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
150p12_attr.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h
151p12_attr.o: ../../include/openssl/x509_vfy.h ../cryptlib.h p12_attr.c
152p12_crpt.o: ../../e_os.h ../../include/openssl/aes.h
153p12_crpt.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
154p12_crpt.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
155p12_crpt.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
156p12_crpt.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
157p12_crpt.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
158p12_crpt.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
159p12_crpt.o: ../../include/openssl/err.h ../../include/openssl/evp.h
160p12_crpt.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
161p12_crpt.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
162p12_crpt.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
163p12_crpt.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
164p12_crpt.o: ../../include/openssl/opensslconf.h
165p12_crpt.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
166p12_crpt.o: ../../include/openssl/pkcs12.h ../../include/openssl/pkcs7.h
167p12_crpt.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
168p12_crpt.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
169p12_crpt.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
170p12_crpt.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
171p12_crpt.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
172p12_crpt.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h
173p12_crpt.o: ../../include/openssl/x509_vfy.h ../cryptlib.h p12_crpt.c
174p12_crt.o: ../../e_os.h ../../include/openssl/aes.h
175p12_crt.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
176p12_crt.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
177p12_crt.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
178p12_crt.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
179p12_crt.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
180p12_crt.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
181p12_crt.o: ../../include/openssl/err.h ../../include/openssl/evp.h
182p12_crt.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
183p12_crt.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
184p12_crt.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
185p12_crt.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
186p12_crt.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
187p12_crt.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs12.h
188p12_crt.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
189p12_crt.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
190p12_crt.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
191p12_crt.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
192p12_crt.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
193p12_crt.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
194p12_crt.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
195p12_crt.o: ../cryptlib.h p12_crt.c
196p12_decr.o: ../../e_os.h ../../include/openssl/aes.h
197p12_decr.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
198p12_decr.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
199p12_decr.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
200p12_decr.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
201p12_decr.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
202p12_decr.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
203p12_decr.o: ../../include/openssl/err.h ../../include/openssl/evp.h
204p12_decr.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
205p12_decr.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
206p12_decr.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
207p12_decr.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
208p12_decr.o: ../../include/openssl/opensslconf.h
209p12_decr.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
210p12_decr.o: ../../include/openssl/pkcs12.h ../../include/openssl/pkcs7.h
211p12_decr.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
212p12_decr.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
213p12_decr.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
214p12_decr.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
215p12_decr.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
216p12_decr.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h
217p12_decr.o: ../../include/openssl/x509_vfy.h ../cryptlib.h p12_decr.c
218p12_init.o: ../../e_os.h ../../include/openssl/aes.h
219p12_init.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
220p12_init.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
221p12_init.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
222p12_init.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
223p12_init.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
224p12_init.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
225p12_init.o: ../../include/openssl/err.h ../../include/openssl/evp.h
226p12_init.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
227p12_init.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
228p12_init.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
229p12_init.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
230p12_init.o: ../../include/openssl/opensslconf.h
231p12_init.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
232p12_init.o: ../../include/openssl/pkcs12.h ../../include/openssl/pkcs7.h
233p12_init.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
234p12_init.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
235p12_init.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
236p12_init.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
237p12_init.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
238p12_init.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h
239p12_init.o: ../../include/openssl/x509_vfy.h ../cryptlib.h p12_init.c
240p12_key.o: ../../e_os.h ../../include/openssl/aes.h
241p12_key.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
242p12_key.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
243p12_key.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
244p12_key.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
245p12_key.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
246p12_key.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
247p12_key.o: ../../include/openssl/err.h ../../include/openssl/evp.h
248p12_key.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
249p12_key.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
250p12_key.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
251p12_key.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
252p12_key.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
253p12_key.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs12.h
254p12_key.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
255p12_key.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
256p12_key.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
257p12_key.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
258p12_key.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
259p12_key.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
260p12_key.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
261p12_key.o: ../cryptlib.h p12_key.c
262p12_kiss.o: ../../e_os.h ../../include/openssl/aes.h
263p12_kiss.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
264p12_kiss.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
265p12_kiss.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
266p12_kiss.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
267p12_kiss.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
268p12_kiss.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
269p12_kiss.o: ../../include/openssl/err.h ../../include/openssl/evp.h
270p12_kiss.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
271p12_kiss.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
272p12_kiss.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
273p12_kiss.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
274p12_kiss.o: ../../include/openssl/opensslconf.h
275p12_kiss.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
276p12_kiss.o: ../../include/openssl/pkcs12.h ../../include/openssl/pkcs7.h
277p12_kiss.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
278p12_kiss.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
279p12_kiss.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
280p12_kiss.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
281p12_kiss.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
282p12_kiss.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h
283p12_kiss.o: ../../include/openssl/x509_vfy.h ../cryptlib.h p12_kiss.c
284p12_mutl.o: ../../e_os.h ../../include/openssl/aes.h
285p12_mutl.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
286p12_mutl.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
287p12_mutl.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
288p12_mutl.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
289p12_mutl.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
290p12_mutl.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
291p12_mutl.o: ../../include/openssl/err.h ../../include/openssl/evp.h
292p12_mutl.o: ../../include/openssl/hmac.h ../../include/openssl/idea.h
293p12_mutl.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
294p12_mutl.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
295p12_mutl.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
296p12_mutl.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
297p12_mutl.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
298p12_mutl.o: ../../include/openssl/pkcs12.h ../../include/openssl/pkcs7.h
299p12_mutl.o: ../../include/openssl/rand.h ../../include/openssl/rc2.h
300p12_mutl.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
301p12_mutl.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
302p12_mutl.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
303p12_mutl.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
304p12_mutl.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
305p12_mutl.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
306p12_mutl.o: ../cryptlib.h p12_mutl.c
307p12_npas.o: ../../include/openssl/aes.h ../../include/openssl/asn1.h
308p12_npas.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
309p12_npas.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
310p12_npas.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
311p12_npas.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
312p12_npas.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
313p12_npas.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
314p12_npas.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
315p12_npas.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
316p12_npas.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
317p12_npas.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
318p12_npas.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
319p12_npas.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
320p12_npas.o: ../../include/openssl/pem.h ../../include/openssl/pem2.h
321p12_npas.o: ../../include/openssl/pkcs12.h ../../include/openssl/pkcs7.h
322p12_npas.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
323p12_npas.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
324p12_npas.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
325p12_npas.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
326p12_npas.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
327p12_npas.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h
328p12_npas.o: ../../include/openssl/x509_vfy.h p12_npas.c
329p12_p8d.o: ../../e_os.h ../../include/openssl/aes.h
330p12_p8d.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
331p12_p8d.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
332p12_p8d.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
333p12_p8d.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
334p12_p8d.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
335p12_p8d.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
336p12_p8d.o: ../../include/openssl/err.h ../../include/openssl/evp.h
337p12_p8d.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
338p12_p8d.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
339p12_p8d.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
340p12_p8d.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
341p12_p8d.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
342p12_p8d.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs12.h
343p12_p8d.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
344p12_p8d.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
345p12_p8d.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
346p12_p8d.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
347p12_p8d.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
348p12_p8d.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
349p12_p8d.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
350p12_p8d.o: ../cryptlib.h p12_p8d.c
351p12_p8e.o: ../../e_os.h ../../include/openssl/aes.h
352p12_p8e.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
353p12_p8e.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
354p12_p8e.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
355p12_p8e.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
356p12_p8e.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
357p12_p8e.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
358p12_p8e.o: ../../include/openssl/err.h ../../include/openssl/evp.h
359p12_p8e.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
360p12_p8e.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
361p12_p8e.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
362p12_p8e.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
363p12_p8e.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
364p12_p8e.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs12.h
365p12_p8e.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
366p12_p8e.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
367p12_p8e.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
368p12_p8e.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
369p12_p8e.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
370p12_p8e.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
371p12_p8e.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
372p12_p8e.o: ../cryptlib.h p12_p8e.c
373p12_utl.o: ../../e_os.h ../../include/openssl/aes.h
374p12_utl.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
375p12_utl.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
376p12_utl.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
377p12_utl.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
378p12_utl.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
379p12_utl.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
380p12_utl.o: ../../include/openssl/err.h ../../include/openssl/evp.h
381p12_utl.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
382p12_utl.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
383p12_utl.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
384p12_utl.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
385p12_utl.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
386p12_utl.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs12.h
387p12_utl.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
388p12_utl.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
389p12_utl.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
390p12_utl.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
391p12_utl.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
392p12_utl.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
393p12_utl.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
394p12_utl.o: ../cryptlib.h p12_utl.c
395pk12err.o: ../../include/openssl/aes.h ../../include/openssl/asn1.h
396pk12err.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
397pk12err.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
398pk12err.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
399pk12err.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
400pk12err.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
401pk12err.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
402pk12err.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
403pk12err.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
404pk12err.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
405pk12err.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
406pk12err.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
407pk12err.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
408pk12err.o: ../../include/openssl/pkcs12.h ../../include/openssl/pkcs7.h
409pk12err.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
410pk12err.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
411pk12err.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
412pk12err.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
413pk12err.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
414pk12err.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h
415pk12err.o: ../../include/openssl/x509_vfy.h pk12err.c
diff --git a/src/lib/libcrypto/pkcs12/Makefile.ssl b/src/lib/libcrypto/pkcs12/Makefile.ssl
new file mode 100644
index 0000000000..a6e47b4085
--- /dev/null
+++ b/src/lib/libcrypto/pkcs12/Makefile.ssl
@@ -0,0 +1,417 @@
1#
2# SSLeay/crypto/pkcs12/Makefile
3#
4
5DIR= pkcs12
6TOP= ../..
7CC= cc
8INCLUDES= -I.. -I$(TOP) -I../../include
9CFLAG=-g
10INSTALL_PREFIX=
11OPENSSLDIR= /usr/local/ssl
12INSTALLTOP=/usr/local/ssl
13MAKE= make -f Makefile.ssl
14MAKEDEPPROG= makedepend
15MAKEDEPEND= $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG)
16MAKEFILE= Makefile.ssl
17AR= ar r
18
19CFLAGS= $(INCLUDES) $(CFLAG)
20
21GENERAL=Makefile
22TEST=
23APPS=
24
25LIB=$(TOP)/libcrypto.a
26LIBSRC= p12_add.c p12_asn.c p12_attr.c p12_crpt.c p12_crt.c p12_decr.c \
27 p12_init.c p12_key.c p12_kiss.c p12_mutl.c\
28 p12_utl.c p12_npas.c pk12err.c p12_p8d.c p12_p8e.c
29LIBOBJ= p12_add.o p12_asn.o p12_attr.o p12_crpt.o p12_crt.o p12_decr.o \
30 p12_init.o p12_key.o p12_kiss.o p12_mutl.o\
31 p12_utl.o p12_npas.o pk12err.o p12_p8d.o p12_p8e.o
32
33SRC= $(LIBSRC)
34
35EXHEADER= pkcs12.h
36HEADER= $(EXHEADER)
37
38ALL= $(GENERAL) $(SRC) $(HEADER)
39
40top:
41 (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all)
42
43test:
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.ssl >> $(TOP)/MINFO
54
55links:
56 @sh $(TOP)/util/point.sh Makefile.ssl Makefile
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 @for i in $(EXHEADER) ; \
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 $(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 *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
85
86# DO NOT DELETE THIS LINE -- make depend depends on it.
87
88p12_add.o: ../../e_os.h ../../include/openssl/aes.h
89p12_add.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
90p12_add.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
91p12_add.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
92p12_add.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
93p12_add.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
94p12_add.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
95p12_add.o: ../../include/openssl/err.h ../../include/openssl/evp.h
96p12_add.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
97p12_add.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
98p12_add.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
99p12_add.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
100p12_add.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
101p12_add.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs12.h
102p12_add.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
103p12_add.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
104p12_add.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
105p12_add.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
106p12_add.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
107p12_add.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
108p12_add.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
109p12_add.o: ../cryptlib.h p12_add.c
110p12_asn.o: ../../e_os.h ../../include/openssl/aes.h
111p12_asn.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h
112p12_asn.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
113p12_asn.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
114p12_asn.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
115p12_asn.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
116p12_asn.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
117p12_asn.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
118p12_asn.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
119p12_asn.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
120p12_asn.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
121p12_asn.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
122p12_asn.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
123p12_asn.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
124p12_asn.o: ../../include/openssl/pkcs12.h ../../include/openssl/pkcs7.h
125p12_asn.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
126p12_asn.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
127p12_asn.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
128p12_asn.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
129p12_asn.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
130p12_asn.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h
131p12_asn.o: ../../include/openssl/x509_vfy.h ../cryptlib.h p12_asn.c
132p12_attr.o: ../../e_os.h ../../include/openssl/aes.h
133p12_attr.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
134p12_attr.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
135p12_attr.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
136p12_attr.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
137p12_attr.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
138p12_attr.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
139p12_attr.o: ../../include/openssl/err.h ../../include/openssl/evp.h
140p12_attr.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
141p12_attr.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
142p12_attr.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
143p12_attr.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
144p12_attr.o: ../../include/openssl/opensslconf.h
145p12_attr.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
146p12_attr.o: ../../include/openssl/pkcs12.h ../../include/openssl/pkcs7.h
147p12_attr.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
148p12_attr.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
149p12_attr.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
150p12_attr.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
151p12_attr.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
152p12_attr.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h
153p12_attr.o: ../../include/openssl/x509_vfy.h ../cryptlib.h p12_attr.c
154p12_crpt.o: ../../e_os.h ../../include/openssl/aes.h
155p12_crpt.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
156p12_crpt.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
157p12_crpt.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
158p12_crpt.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
159p12_crpt.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
160p12_crpt.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
161p12_crpt.o: ../../include/openssl/err.h ../../include/openssl/evp.h
162p12_crpt.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
163p12_crpt.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
164p12_crpt.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
165p12_crpt.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
166p12_crpt.o: ../../include/openssl/opensslconf.h
167p12_crpt.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
168p12_crpt.o: ../../include/openssl/pkcs12.h ../../include/openssl/pkcs7.h
169p12_crpt.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
170p12_crpt.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
171p12_crpt.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
172p12_crpt.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
173p12_crpt.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
174p12_crpt.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h
175p12_crpt.o: ../../include/openssl/x509_vfy.h ../cryptlib.h p12_crpt.c
176p12_crt.o: ../../e_os.h ../../include/openssl/aes.h
177p12_crt.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
178p12_crt.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
179p12_crt.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
180p12_crt.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
181p12_crt.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
182p12_crt.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
183p12_crt.o: ../../include/openssl/err.h ../../include/openssl/evp.h
184p12_crt.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
185p12_crt.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
186p12_crt.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
187p12_crt.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
188p12_crt.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
189p12_crt.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs12.h
190p12_crt.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
191p12_crt.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
192p12_crt.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
193p12_crt.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
194p12_crt.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
195p12_crt.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
196p12_crt.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
197p12_crt.o: ../cryptlib.h p12_crt.c
198p12_decr.o: ../../e_os.h ../../include/openssl/aes.h
199p12_decr.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
200p12_decr.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
201p12_decr.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
202p12_decr.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
203p12_decr.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
204p12_decr.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
205p12_decr.o: ../../include/openssl/err.h ../../include/openssl/evp.h
206p12_decr.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
207p12_decr.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
208p12_decr.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
209p12_decr.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
210p12_decr.o: ../../include/openssl/opensslconf.h
211p12_decr.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
212p12_decr.o: ../../include/openssl/pkcs12.h ../../include/openssl/pkcs7.h
213p12_decr.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
214p12_decr.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
215p12_decr.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
216p12_decr.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
217p12_decr.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
218p12_decr.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h
219p12_decr.o: ../../include/openssl/x509_vfy.h ../cryptlib.h p12_decr.c
220p12_init.o: ../../e_os.h ../../include/openssl/aes.h
221p12_init.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
222p12_init.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
223p12_init.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
224p12_init.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
225p12_init.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
226p12_init.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
227p12_init.o: ../../include/openssl/err.h ../../include/openssl/evp.h
228p12_init.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
229p12_init.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
230p12_init.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
231p12_init.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
232p12_init.o: ../../include/openssl/opensslconf.h
233p12_init.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
234p12_init.o: ../../include/openssl/pkcs12.h ../../include/openssl/pkcs7.h
235p12_init.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
236p12_init.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
237p12_init.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
238p12_init.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
239p12_init.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
240p12_init.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h
241p12_init.o: ../../include/openssl/x509_vfy.h ../cryptlib.h p12_init.c
242p12_key.o: ../../e_os.h ../../include/openssl/aes.h
243p12_key.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
244p12_key.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
245p12_key.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
246p12_key.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
247p12_key.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
248p12_key.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
249p12_key.o: ../../include/openssl/err.h ../../include/openssl/evp.h
250p12_key.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
251p12_key.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
252p12_key.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
253p12_key.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
254p12_key.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
255p12_key.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs12.h
256p12_key.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
257p12_key.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
258p12_key.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
259p12_key.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
260p12_key.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
261p12_key.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
262p12_key.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
263p12_key.o: ../cryptlib.h p12_key.c
264p12_kiss.o: ../../e_os.h ../../include/openssl/aes.h
265p12_kiss.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
266p12_kiss.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
267p12_kiss.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
268p12_kiss.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
269p12_kiss.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
270p12_kiss.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
271p12_kiss.o: ../../include/openssl/err.h ../../include/openssl/evp.h
272p12_kiss.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
273p12_kiss.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
274p12_kiss.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
275p12_kiss.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
276p12_kiss.o: ../../include/openssl/opensslconf.h
277p12_kiss.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
278p12_kiss.o: ../../include/openssl/pkcs12.h ../../include/openssl/pkcs7.h
279p12_kiss.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
280p12_kiss.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
281p12_kiss.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
282p12_kiss.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
283p12_kiss.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
284p12_kiss.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h
285p12_kiss.o: ../../include/openssl/x509_vfy.h ../cryptlib.h p12_kiss.c
286p12_mutl.o: ../../e_os.h ../../include/openssl/aes.h
287p12_mutl.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
288p12_mutl.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
289p12_mutl.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
290p12_mutl.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
291p12_mutl.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
292p12_mutl.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
293p12_mutl.o: ../../include/openssl/err.h ../../include/openssl/evp.h
294p12_mutl.o: ../../include/openssl/hmac.h ../../include/openssl/idea.h
295p12_mutl.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
296p12_mutl.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
297p12_mutl.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
298p12_mutl.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
299p12_mutl.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
300p12_mutl.o: ../../include/openssl/pkcs12.h ../../include/openssl/pkcs7.h
301p12_mutl.o: ../../include/openssl/rand.h ../../include/openssl/rc2.h
302p12_mutl.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
303p12_mutl.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
304p12_mutl.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
305p12_mutl.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
306p12_mutl.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
307p12_mutl.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
308p12_mutl.o: ../cryptlib.h p12_mutl.c
309p12_npas.o: ../../include/openssl/aes.h ../../include/openssl/asn1.h
310p12_npas.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
311p12_npas.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
312p12_npas.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
313p12_npas.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
314p12_npas.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
315p12_npas.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
316p12_npas.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
317p12_npas.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
318p12_npas.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
319p12_npas.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
320p12_npas.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
321p12_npas.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
322p12_npas.o: ../../include/openssl/pem.h ../../include/openssl/pem2.h
323p12_npas.o: ../../include/openssl/pkcs12.h ../../include/openssl/pkcs7.h
324p12_npas.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
325p12_npas.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
326p12_npas.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
327p12_npas.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
328p12_npas.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
329p12_npas.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h
330p12_npas.o: ../../include/openssl/x509_vfy.h p12_npas.c
331p12_p8d.o: ../../e_os.h ../../include/openssl/aes.h
332p12_p8d.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
333p12_p8d.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
334p12_p8d.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
335p12_p8d.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
336p12_p8d.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
337p12_p8d.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
338p12_p8d.o: ../../include/openssl/err.h ../../include/openssl/evp.h
339p12_p8d.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
340p12_p8d.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
341p12_p8d.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
342p12_p8d.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
343p12_p8d.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
344p12_p8d.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs12.h
345p12_p8d.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
346p12_p8d.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
347p12_p8d.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
348p12_p8d.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
349p12_p8d.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
350p12_p8d.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
351p12_p8d.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
352p12_p8d.o: ../cryptlib.h p12_p8d.c
353p12_p8e.o: ../../e_os.h ../../include/openssl/aes.h
354p12_p8e.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
355p12_p8e.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
356p12_p8e.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
357p12_p8e.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
358p12_p8e.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
359p12_p8e.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
360p12_p8e.o: ../../include/openssl/err.h ../../include/openssl/evp.h
361p12_p8e.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
362p12_p8e.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
363p12_p8e.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
364p12_p8e.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
365p12_p8e.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
366p12_p8e.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs12.h
367p12_p8e.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
368p12_p8e.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
369p12_p8e.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
370p12_p8e.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
371p12_p8e.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
372p12_p8e.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
373p12_p8e.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
374p12_p8e.o: ../cryptlib.h p12_p8e.c
375p12_utl.o: ../../e_os.h ../../include/openssl/aes.h
376p12_utl.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
377p12_utl.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
378p12_utl.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
379p12_utl.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
380p12_utl.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
381p12_utl.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
382p12_utl.o: ../../include/openssl/err.h ../../include/openssl/evp.h
383p12_utl.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
384p12_utl.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
385p12_utl.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
386p12_utl.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
387p12_utl.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
388p12_utl.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs12.h
389p12_utl.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
390p12_utl.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
391p12_utl.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
392p12_utl.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
393p12_utl.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
394p12_utl.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
395p12_utl.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
396p12_utl.o: ../cryptlib.h p12_utl.c
397pk12err.o: ../../include/openssl/aes.h ../../include/openssl/asn1.h
398pk12err.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
399pk12err.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
400pk12err.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
401pk12err.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
402pk12err.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
403pk12err.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
404pk12err.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
405pk12err.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
406pk12err.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
407pk12err.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
408pk12err.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
409pk12err.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
410pk12err.o: ../../include/openssl/pkcs12.h ../../include/openssl/pkcs7.h
411pk12err.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
412pk12err.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
413pk12err.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
414pk12err.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
415pk12err.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
416pk12err.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h
417pk12err.o: ../../include/openssl/x509_vfy.h pk12err.c
diff --git a/src/lib/libcrypto/pkcs12/p12_add.c b/src/lib/libcrypto/pkcs12/p12_add.c
index 27015dd8c3..1909f28506 100644
--- a/src/lib/libcrypto/pkcs12/p12_add.c
+++ b/src/lib/libcrypto/pkcs12/p12_add.c
@@ -148,11 +148,7 @@ PKCS7 *PKCS12_pack_p7data(STACK_OF(PKCS12_SAFEBAG) *sk)
148/* Unpack SAFEBAGS from PKCS#7 data ContentInfo */ 148/* Unpack SAFEBAGS from PKCS#7 data ContentInfo */
149STACK_OF(PKCS12_SAFEBAG) *PKCS12_unpack_p7data(PKCS7 *p7) 149STACK_OF(PKCS12_SAFEBAG) *PKCS12_unpack_p7data(PKCS7 *p7)
150{ 150{
151 if(!PKCS7_type_is_data(p7)) 151 if(!PKCS7_type_is_data(p7)) return NULL;
152 {
153 PKCS12err(PKCS12_F_PKCS12_UNPACK_P7DATA,PKCS12_R_CONTENT_TYPE_NOT_DATA);
154 return NULL;
155 }
156 return ASN1_item_unpack(p7->d.data, ASN1_ITEM_rptr(PKCS12_SAFEBAGS)); 152 return ASN1_item_unpack(p7->d.data, ASN1_ITEM_rptr(PKCS12_SAFEBAGS));
157} 153}
158 154
@@ -215,10 +211,5 @@ int PKCS12_pack_authsafes(PKCS12 *p12, STACK_OF(PKCS7) *safes)
215 211
216STACK_OF(PKCS7) *PKCS12_unpack_authsafes(PKCS12 *p12) 212STACK_OF(PKCS7) *PKCS12_unpack_authsafes(PKCS12 *p12)
217{ 213{
218 if (!PKCS7_type_is_data(p12->authsafes))
219 {
220 PKCS12err(PKCS12_F_PKCS12_UNPACK_AUTHSAFES,PKCS12_R_CONTENT_TYPE_NOT_DATA);
221 return NULL;
222 }
223 return ASN1_item_unpack(p12->authsafes->d.data, ASN1_ITEM_rptr(PKCS12_AUTHSAFES)); 214 return ASN1_item_unpack(p12->authsafes->d.data, ASN1_ITEM_rptr(PKCS12_AUTHSAFES));
224} 215}
diff --git a/src/lib/libcrypto/pkcs12/p12_crt.c b/src/lib/libcrypto/pkcs12/p12_crt.c
index 40340a7bef..4c36c643ce 100644
--- a/src/lib/libcrypto/pkcs12/p12_crt.c
+++ b/src/lib/libcrypto/pkcs12/p12_crt.c
@@ -76,15 +76,7 @@ PKCS12 *PKCS12_create(char *pass, char *name, EVP_PKEY *pkey, X509 *cert,
76 unsigned int keyidlen; 76 unsigned int keyidlen;
77 77
78 /* Set defaults */ 78 /* Set defaults */
79 if(!nid_cert) 79 if(!nid_cert) nid_cert = NID_pbe_WithSHA1And40BitRC2_CBC;
80 {
81#ifdef OPENSSL_FIPS
82 if (FIPS_mode())
83 nid_cert = NID_pbe_WithSHA1And3_Key_TripleDES_CBC;
84 else
85#endif
86 nid_cert = NID_pbe_WithSHA1And40BitRC2_CBC;
87 }
88 if(!nid_key) nid_key = NID_pbe_WithSHA1And3_Key_TripleDES_CBC; 80 if(!nid_key) nid_key = NID_pbe_WithSHA1And3_Key_TripleDES_CBC;
89 if(!iter) iter = PKCS12_DEFAULT_ITER; 81 if(!iter) iter = PKCS12_DEFAULT_ITER;
90 if(!mac_iter) mac_iter = 1; 82 if(!mac_iter) mac_iter = 1;
diff --git a/src/lib/libcrypto/pkcs12/p12_mutl.c b/src/lib/libcrypto/pkcs12/p12_mutl.c
index 140d21155e..4886b9b289 100644
--- a/src/lib/libcrypto/pkcs12/p12_mutl.c
+++ b/src/lib/libcrypto/pkcs12/p12_mutl.c
@@ -72,12 +72,6 @@ int PKCS12_gen_mac (PKCS12 *p12, const char *pass, int passlen,
72 unsigned char key[PKCS12_MAC_KEY_LENGTH], *salt; 72 unsigned char key[PKCS12_MAC_KEY_LENGTH], *salt;
73 int saltlen, iter; 73 int saltlen, iter;
74 74
75 if (!PKCS7_type_is_data(p12->authsafes))
76 {
77 PKCS12err(PKCS12_F_PKCS12_GEN_MAC,PKCS12_R_CONTENT_TYPE_NOT_DATA);
78 return 0;
79 }
80
81 salt = p12->mac->salt->data; 75 salt = p12->mac->salt->data;
82 saltlen = p12->mac->salt->length; 76 saltlen = p12->mac->salt->length;
83 if (!p12->mac->iter) iter = 1; 77 if (!p12->mac->iter) iter = 1;
diff --git a/src/lib/libcrypto/pkcs12/pk12err.c b/src/lib/libcrypto/pkcs12/pk12err.c
index a33b37b1c7..10ab80502c 100644
--- a/src/lib/libcrypto/pkcs12/pk12err.c
+++ b/src/lib/libcrypto/pkcs12/pk12err.c
@@ -1,6 +1,6 @@
1/* crypto/pkcs12/pk12err.c */ 1/* crypto/pkcs12/pk12err.c */
2/* ==================================================================== 2/* ====================================================================
3 * Copyright (c) 1999-2005 The OpenSSL Project. All rights reserved. 3 * Copyright (c) 1999 The OpenSSL Project. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
@@ -64,67 +64,60 @@
64 64
65/* BEGIN ERROR CODES */ 65/* BEGIN ERROR CODES */
66#ifndef OPENSSL_NO_ERR 66#ifndef OPENSSL_NO_ERR
67
68#define ERR_FUNC(func) ERR_PACK(ERR_LIB_PKCS12,func,0)
69#define ERR_REASON(reason) ERR_PACK(ERR_LIB_PKCS12,0,reason)
70
71static ERR_STRING_DATA PKCS12_str_functs[]= 67static ERR_STRING_DATA PKCS12_str_functs[]=
72 { 68 {
73{ERR_FUNC(PKCS12_F_PARSE_BAGS), "PARSE_BAGS"}, 69{ERR_PACK(0,PKCS12_F_PARSE_BAGS,0), "PARSE_BAGS"},
74{ERR_FUNC(PKCS12_F_PKCS12_ADD_FRIENDLYNAME), "PKCS12_ADD_FRIENDLYNAME"}, 70{ERR_PACK(0,PKCS12_F_PKCS12_ADD_FRIENDLYNAME,0), "PKCS12_ADD_FRIENDLYNAME"},
75{ERR_FUNC(PKCS12_F_PKCS12_ADD_FRIENDLYNAME_ASC), "PKCS12_add_friendlyname_asc"}, 71{ERR_PACK(0,PKCS12_F_PKCS12_ADD_FRIENDLYNAME_ASC,0), "PKCS12_add_friendlyname_asc"},
76{ERR_FUNC(PKCS12_F_PKCS12_ADD_FRIENDLYNAME_UNI), "PKCS12_add_friendlyname_uni"}, 72{ERR_PACK(0,PKCS12_F_PKCS12_ADD_FRIENDLYNAME_UNI,0), "PKCS12_add_friendlyname_uni"},
77{ERR_FUNC(PKCS12_F_PKCS12_ADD_LOCALKEYID), "PKCS12_add_localkeyid"}, 73{ERR_PACK(0,PKCS12_F_PKCS12_ADD_LOCALKEYID,0), "PKCS12_add_localkeyid"},
78{ERR_FUNC(PKCS12_F_PKCS12_CREATE), "PKCS12_create"}, 74{ERR_PACK(0,PKCS12_F_PKCS12_CREATE,0), "PKCS12_create"},
79{ERR_FUNC(PKCS12_F_PKCS12_DECRYPT_D2I), "PKCS12_DECRYPT_D2I"}, 75{ERR_PACK(0,PKCS12_F_PKCS12_DECRYPT_D2I,0), "PKCS12_decrypt_d2i"},
80{ERR_FUNC(PKCS12_F_PKCS12_GEN_MAC), "PKCS12_gen_mac"}, 76{ERR_PACK(0,PKCS12_F_PKCS12_GEN_MAC,0), "PKCS12_gen_mac"},
81{ERR_FUNC(PKCS12_F_PKCS12_I2D_ENCRYPT), "PKCS12_I2D_ENCRYPT"}, 77{ERR_PACK(0,PKCS12_F_PKCS12_I2D_ENCRYPT,0), "PKCS12_i2d_encrypt"},
82{ERR_FUNC(PKCS12_F_PKCS12_INIT), "PKCS12_init"}, 78{ERR_PACK(0,PKCS12_F_PKCS12_INIT,0), "PKCS12_init"},
83{ERR_FUNC(PKCS12_F_PKCS12_KEY_GEN_ASC), "PKCS12_key_gen_asc"}, 79{ERR_PACK(0,PKCS12_F_PKCS12_KEY_GEN_ASC,0), "PKCS12_key_gen_asc"},
84{ERR_FUNC(PKCS12_F_PKCS12_KEY_GEN_UNI), "PKCS12_key_gen_uni"}, 80{ERR_PACK(0,PKCS12_F_PKCS12_KEY_GEN_UNI,0), "PKCS12_key_gen_uni"},
85{ERR_FUNC(PKCS12_F_PKCS12_MAKE_KEYBAG), "PKCS12_MAKE_KEYBAG"}, 81{ERR_PACK(0,PKCS12_F_PKCS12_MAKE_KEYBAG,0), "PKCS12_MAKE_KEYBAG"},
86{ERR_FUNC(PKCS12_F_PKCS12_MAKE_SHKEYBAG), "PKCS12_MAKE_SHKEYBAG"}, 82{ERR_PACK(0,PKCS12_F_PKCS12_MAKE_SHKEYBAG,0), "PKCS12_MAKE_SHKEYBAG"},
87{ERR_FUNC(PKCS12_F_PKCS12_NEWPASS), "PKCS12_newpass"}, 83{ERR_PACK(0,PKCS12_F_PKCS12_NEWPASS,0), "PKCS12_newpass"},
88{ERR_FUNC(PKCS12_F_PKCS12_PACK_P7DATA), "PKCS12_pack_p7data"}, 84{ERR_PACK(0,PKCS12_F_PKCS12_PACK_P7DATA,0), "PKCS12_pack_p7data"},
89{ERR_FUNC(PKCS12_F_PKCS12_PACK_P7ENCDATA), "PKCS12_pack_p7encdata"}, 85{ERR_PACK(0,PKCS12_F_PKCS12_PACK_P7ENCDATA,0), "PKCS12_pack_p7encdata"},
90{ERR_FUNC(PKCS12_F_PKCS12_PACK_SAFEBAG), "PKCS12_PACK_SAFEBAG"}, 86{ERR_PACK(0,PKCS12_F_PKCS12_PACK_SAFEBAG,0), "PKCS12_pack_safebag"},
91{ERR_FUNC(PKCS12_F_PKCS12_PARSE), "PKCS12_parse"}, 87{ERR_PACK(0,PKCS12_F_PKCS12_PARSE,0), "PKCS12_parse"},
92{ERR_FUNC(PKCS12_F_PKCS12_PBE_CRYPT), "PKCS12_pbe_crypt"}, 88{ERR_PACK(0,PKCS12_F_PKCS12_PBE_CRYPT,0), "PKCS12_pbe_crypt"},
93{ERR_FUNC(PKCS12_F_PKCS12_PBE_KEYIVGEN), "PKCS12_PBE_keyivgen"}, 89{ERR_PACK(0,PKCS12_F_PKCS12_PBE_KEYIVGEN,0), "PKCS12_PBE_keyivgen"},
94{ERR_FUNC(PKCS12_F_PKCS12_SETUP_MAC), "PKCS12_setup_mac"}, 90{ERR_PACK(0,PKCS12_F_PKCS12_SETUP_MAC,0), "PKCS12_setup_mac"},
95{ERR_FUNC(PKCS12_F_PKCS12_SET_MAC), "PKCS12_set_mac"}, 91{ERR_PACK(0,PKCS12_F_PKCS12_SET_MAC,0), "PKCS12_set_mac"},
96{ERR_FUNC(PKCS12_F_PKCS12_UNPACK_AUTHSAFES), "PKCS12_unpack_authsafes"}, 92{ERR_PACK(0,PKCS12_F_PKCS8_ADD_KEYUSAGE,0), "PKCS8_add_keyusage"},
97{ERR_FUNC(PKCS12_F_PKCS12_UNPACK_P7DATA), "PKCS12_unpack_p7data"}, 93{ERR_PACK(0,PKCS12_F_PKCS8_ENCRYPT,0), "PKCS8_encrypt"},
98{ERR_FUNC(PKCS12_F_PKCS8_ADD_KEYUSAGE), "PKCS8_add_keyusage"}, 94{ERR_PACK(0,PKCS12_F_VERIFY_MAC,0), "VERIFY_MAC"},
99{ERR_FUNC(PKCS12_F_PKCS8_ENCRYPT), "PKCS8_encrypt"},
100{ERR_FUNC(PKCS12_F_VERIFY_MAC), "VERIFY_MAC"},
101{0,NULL} 95{0,NULL}
102 }; 96 };
103 97
104static ERR_STRING_DATA PKCS12_str_reasons[]= 98static ERR_STRING_DATA PKCS12_str_reasons[]=
105 { 99 {
106{ERR_REASON(PKCS12_R_CANT_PACK_STRUCTURE),"cant pack structure"}, 100{PKCS12_R_CANT_PACK_STRUCTURE ,"cant pack structure"},
107{ERR_REASON(PKCS12_R_CONTENT_TYPE_NOT_DATA),"content type not data"}, 101{PKCS12_R_DECODE_ERROR ,"decode error"},
108{ERR_REASON(PKCS12_R_DECODE_ERROR) ,"decode error"}, 102{PKCS12_R_ENCODE_ERROR ,"encode error"},
109{ERR_REASON(PKCS12_R_ENCODE_ERROR) ,"encode error"}, 103{PKCS12_R_ENCRYPT_ERROR ,"encrypt error"},
110{ERR_REASON(PKCS12_R_ENCRYPT_ERROR) ,"encrypt error"}, 104{PKCS12_R_ERROR_SETTING_ENCRYPTED_DATA_TYPE,"error setting encrypted data type"},
111{ERR_REASON(PKCS12_R_ERROR_SETTING_ENCRYPTED_DATA_TYPE),"error setting encrypted data type"}, 105{PKCS12_R_INVALID_NULL_ARGUMENT ,"invalid null argument"},
112{ERR_REASON(PKCS12_R_INVALID_NULL_ARGUMENT),"invalid null argument"}, 106{PKCS12_R_INVALID_NULL_PKCS12_POINTER ,"invalid null pkcs12 pointer"},
113{ERR_REASON(PKCS12_R_INVALID_NULL_PKCS12_POINTER),"invalid null pkcs12 pointer"}, 107{PKCS12_R_IV_GEN_ERROR ,"iv gen error"},
114{ERR_REASON(PKCS12_R_IV_GEN_ERROR) ,"iv gen error"}, 108{PKCS12_R_KEY_GEN_ERROR ,"key gen error"},
115{ERR_REASON(PKCS12_R_KEY_GEN_ERROR) ,"key gen error"}, 109{PKCS12_R_MAC_ABSENT ,"mac absent"},
116{ERR_REASON(PKCS12_R_MAC_ABSENT) ,"mac absent"}, 110{PKCS12_R_MAC_GENERATION_ERROR ,"mac generation error"},
117{ERR_REASON(PKCS12_R_MAC_GENERATION_ERROR),"mac generation error"}, 111{PKCS12_R_MAC_SETUP_ERROR ,"mac setup error"},
118{ERR_REASON(PKCS12_R_MAC_SETUP_ERROR) ,"mac setup error"}, 112{PKCS12_R_MAC_STRING_SET_ERROR ,"mac string set error"},
119{ERR_REASON(PKCS12_R_MAC_STRING_SET_ERROR),"mac string set error"}, 113{PKCS12_R_MAC_VERIFY_ERROR ,"mac verify error"},
120{ERR_REASON(PKCS12_R_MAC_VERIFY_ERROR) ,"mac verify error"}, 114{PKCS12_R_MAC_VERIFY_FAILURE ,"mac verify failure"},
121{ERR_REASON(PKCS12_R_MAC_VERIFY_FAILURE) ,"mac verify failure"}, 115{PKCS12_R_PARSE_ERROR ,"parse error"},
122{ERR_REASON(PKCS12_R_PARSE_ERROR) ,"parse error"}, 116{PKCS12_R_PKCS12_ALGOR_CIPHERINIT_ERROR ,"pkcs12 algor cipherinit error"},
123{ERR_REASON(PKCS12_R_PKCS12_ALGOR_CIPHERINIT_ERROR),"pkcs12 algor cipherinit error"}, 117{PKCS12_R_PKCS12_CIPHERFINAL_ERROR ,"pkcs12 cipherfinal error"},
124{ERR_REASON(PKCS12_R_PKCS12_CIPHERFINAL_ERROR),"pkcs12 cipherfinal error"}, 118{PKCS12_R_PKCS12_PBE_CRYPT_ERROR ,"pkcs12 pbe crypt error"},
125{ERR_REASON(PKCS12_R_PKCS12_PBE_CRYPT_ERROR),"pkcs12 pbe crypt error"}, 119{PKCS12_R_UNKNOWN_DIGEST_ALGORITHM ,"unknown digest algorithm"},
126{ERR_REASON(PKCS12_R_UNKNOWN_DIGEST_ALGORITHM),"unknown digest algorithm"}, 120{PKCS12_R_UNSUPPORTED_PKCS12_MODE ,"unsupported pkcs12 mode"},
127{ERR_REASON(PKCS12_R_UNSUPPORTED_PKCS12_MODE),"unsupported pkcs12 mode"},
128{0,NULL} 121{0,NULL}
129 }; 122 };
130 123
@@ -138,8 +131,8 @@ void ERR_load_PKCS12_strings(void)
138 { 131 {
139 init=0; 132 init=0;
140#ifndef OPENSSL_NO_ERR 133#ifndef OPENSSL_NO_ERR
141 ERR_load_strings(0,PKCS12_str_functs); 134 ERR_load_strings(ERR_LIB_PKCS12,PKCS12_str_functs);
142 ERR_load_strings(0,PKCS12_str_reasons); 135 ERR_load_strings(ERR_LIB_PKCS12,PKCS12_str_reasons);
143#endif 136#endif
144 137
145 } 138 }
diff --git a/src/lib/libcrypto/pkcs12/pkcs12.h b/src/lib/libcrypto/pkcs12/pkcs12.h
index fb8af82d4f..dd338f266c 100644
--- a/src/lib/libcrypto/pkcs12/pkcs12.h
+++ b/src/lib/libcrypto/pkcs12/pkcs12.h
@@ -287,15 +287,12 @@ void ERR_load_PKCS12_strings(void);
287#define PKCS12_F_PKCS12_PBE_KEYIVGEN 120 287#define PKCS12_F_PKCS12_PBE_KEYIVGEN 120
288#define PKCS12_F_PKCS12_SETUP_MAC 122 288#define PKCS12_F_PKCS12_SETUP_MAC 122
289#define PKCS12_F_PKCS12_SET_MAC 123 289#define PKCS12_F_PKCS12_SET_MAC 123
290#define PKCS12_F_PKCS12_UNPACK_AUTHSAFES 129
291#define PKCS12_F_PKCS12_UNPACK_P7DATA 130
292#define PKCS12_F_PKCS8_ADD_KEYUSAGE 124 290#define PKCS12_F_PKCS8_ADD_KEYUSAGE 124
293#define PKCS12_F_PKCS8_ENCRYPT 125 291#define PKCS12_F_PKCS8_ENCRYPT 125
294#define PKCS12_F_VERIFY_MAC 126 292#define PKCS12_F_VERIFY_MAC 126
295 293
296/* Reason codes. */ 294/* Reason codes. */
297#define PKCS12_R_CANT_PACK_STRUCTURE 100 295#define PKCS12_R_CANT_PACK_STRUCTURE 100
298#define PKCS12_R_CONTENT_TYPE_NOT_DATA 121
299#define PKCS12_R_DECODE_ERROR 101 296#define PKCS12_R_DECODE_ERROR 101
300#define PKCS12_R_ENCODE_ERROR 102 297#define PKCS12_R_ENCODE_ERROR 102
301#define PKCS12_R_ENCRYPT_ERROR 103 298#define PKCS12_R_ENCRYPT_ERROR 103
diff --git a/src/lib/libcrypto/pkcs7/Makefile b/src/lib/libcrypto/pkcs7/Makefile
new file mode 100644
index 0000000000..a213ae2227
--- /dev/null
+++ b/src/lib/libcrypto/pkcs7/Makefile
@@ -0,0 +1,241 @@
1#
2# OpenSSL/crypto/pkcs7/Makefile
3#
4
5DIR= pkcs7
6TOP= ../..
7CC= cc
8INCLUDES= -I.. -I$(TOP) -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 README
24TEST=
25APPS=
26
27LIB=$(TOP)/libcrypto.a
28LIBSRC= pk7_asn1.c pk7_lib.c pkcs7err.c pk7_doit.c pk7_smime.c pk7_attr.c \
29 pk7_mime.c
30LIBOBJ= pk7_asn1.o pk7_lib.o pkcs7err.o pk7_doit.o pk7_smime.o pk7_attr.o \
31 pk7_mime.o
32
33SRC= $(LIBSRC)
34
35EXHEADER= pkcs7.h
36HEADER= $(EXHEADER)
37
38ALL= $(GENERAL) $(SRC) $(HEADER)
39
40top:
41 (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all)
42
43test:
44
45all: lib
46
47testapps: enc dec sign verify
48
49enc: enc.o lib
50 $(CC) $(CFLAGS) -o enc enc.o $(PEX_LIBS) $(LIB) $(EX_LIBS)
51
52dec: dec.o lib
53 $(CC) $(CFLAGS) -o dec dec.o $(PEX_LIBS) $(LIB) $(EX_LIBS)
54
55sign: sign.o lib
56 $(CC) $(CFLAGS) -o sign sign.o $(PEX_LIBS) $(LIB) $(EX_LIBS)
57
58verify: verify.o example.o lib
59 $(CC) $(CFLAGS) -o verify verify.o $(PEX_LIBS) example.o $(LIB) $(EX_LIBS)
60
61lib: $(LIBOBJ)
62 $(AR) $(LIB) $(LIBOBJ)
63 $(RANLIB) $(LIB) || echo Never mind.
64 @touch lib
65
66files:
67 $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
68
69links:
70 @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
71 @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
72 @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
73
74install:
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 $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
91
92dclean:
93 $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
94 mv -f Makefile.new $(MAKEFILE)
95
96clean:
97 rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff enc dec sign verify
98
99# DO NOT DELETE THIS LINE -- make depend depends on it.
100
101pk7_asn1.o: ../../e_os.h ../../include/openssl/aes.h
102pk7_asn1.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h
103pk7_asn1.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
104pk7_asn1.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
105pk7_asn1.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
106pk7_asn1.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
107pk7_asn1.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
108pk7_asn1.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
109pk7_asn1.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
110pk7_asn1.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
111pk7_asn1.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
112pk7_asn1.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
113pk7_asn1.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
114pk7_asn1.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
115pk7_asn1.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
116pk7_asn1.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
117pk7_asn1.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
118pk7_asn1.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
119pk7_asn1.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
120pk7_asn1.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
121pk7_asn1.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
122pk7_asn1.o: ../cryptlib.h pk7_asn1.c
123pk7_attr.o: ../../include/openssl/aes.h ../../include/openssl/asn1.h
124pk7_attr.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
125pk7_attr.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
126pk7_attr.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
127pk7_attr.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
128pk7_attr.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
129pk7_attr.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
130pk7_attr.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
131pk7_attr.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
132pk7_attr.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
133pk7_attr.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
134pk7_attr.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
135pk7_attr.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
136pk7_attr.o: ../../include/openssl/pem.h ../../include/openssl/pem2.h
137pk7_attr.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
138pk7_attr.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
139pk7_attr.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
140pk7_attr.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
141pk7_attr.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
142pk7_attr.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
143pk7_attr.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
144pk7_attr.o: pk7_attr.c
145pk7_doit.o: ../../e_os.h ../../include/openssl/aes.h
146pk7_doit.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
147pk7_doit.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
148pk7_doit.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
149pk7_doit.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
150pk7_doit.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
151pk7_doit.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
152pk7_doit.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
153pk7_doit.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
154pk7_doit.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
155pk7_doit.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
156pk7_doit.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
157pk7_doit.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
158pk7_doit.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
159pk7_doit.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h
160pk7_doit.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
161pk7_doit.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
162pk7_doit.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
163pk7_doit.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
164pk7_doit.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
165pk7_doit.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h
166pk7_doit.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
167pk7_doit.o: ../cryptlib.h pk7_doit.c
168pk7_lib.o: ../../e_os.h ../../include/openssl/aes.h
169pk7_lib.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
170pk7_lib.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
171pk7_lib.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
172pk7_lib.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
173pk7_lib.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
174pk7_lib.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
175pk7_lib.o: ../../include/openssl/err.h ../../include/openssl/evp.h
176pk7_lib.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
177pk7_lib.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
178pk7_lib.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
179pk7_lib.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
180pk7_lib.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
181pk7_lib.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
182pk7_lib.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
183pk7_lib.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
184pk7_lib.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
185pk7_lib.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
186pk7_lib.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
187pk7_lib.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h
188pk7_lib.o: ../../include/openssl/x509_vfy.h ../cryptlib.h pk7_lib.c
189pk7_mime.o: ../../e_os.h ../../include/openssl/aes.h
190pk7_mime.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
191pk7_mime.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
192pk7_mime.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
193pk7_mime.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
194pk7_mime.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
195pk7_mime.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
196pk7_mime.o: ../../include/openssl/err.h ../../include/openssl/evp.h
197pk7_mime.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
198pk7_mime.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
199pk7_mime.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
200pk7_mime.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
201pk7_mime.o: ../../include/openssl/opensslconf.h
202pk7_mime.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
203pk7_mime.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h
204pk7_mime.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
205pk7_mime.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
206pk7_mime.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
207pk7_mime.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
208pk7_mime.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
209pk7_mime.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h
210pk7_mime.o: ../../include/openssl/x509_vfy.h ../cryptlib.h pk7_mime.c
211pk7_smime.o: ../../e_os.h ../../include/openssl/aes.h
212pk7_smime.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
213pk7_smime.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
214pk7_smime.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
215pk7_smime.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
216pk7_smime.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
217pk7_smime.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
218pk7_smime.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
219pk7_smime.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
220pk7_smime.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
221pk7_smime.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
222pk7_smime.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
223pk7_smime.o: ../../include/openssl/objects.h
224pk7_smime.o: ../../include/openssl/opensslconf.h
225pk7_smime.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
226pk7_smime.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
227pk7_smime.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
228pk7_smime.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
229pk7_smime.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
230pk7_smime.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
231pk7_smime.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
232pk7_smime.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
233pk7_smime.o: ../../include/openssl/x509v3.h ../cryptlib.h pk7_smime.c
234pkcs7err.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
235pkcs7err.o: ../../include/openssl/bn.h ../../include/openssl/crypto.h
236pkcs7err.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
237pkcs7err.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
238pkcs7err.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
239pkcs7err.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
240pkcs7err.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
241pkcs7err.o: pkcs7err.c
diff --git a/src/lib/libcrypto/pkcs7/Makefile.ssl b/src/lib/libcrypto/pkcs7/Makefile.ssl
new file mode 100644
index 0000000000..c3bfc7d560
--- /dev/null
+++ b/src/lib/libcrypto/pkcs7/Makefile.ssl
@@ -0,0 +1,243 @@
1#
2# SSLeay/crypto/pkcs7/Makefile
3#
4
5DIR= pkcs7
6TOP= ../..
7CC= cc
8INCLUDES= -I.. -I$(TOP) -I../../include
9CFLAG=-g
10INSTALL_PREFIX=
11OPENSSLDIR= /usr/local/ssl
12INSTALLTOP=/usr/local/ssl
13MAKE= make -f Makefile.ssl
14MAKEDEPPROG= makedepend
15MAKEDEPEND= $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG)
16MAKEFILE= Makefile.ssl
17AR= ar r
18
19PEX_LIBS=
20EX_LIBS=
21
22CFLAGS= $(INCLUDES) $(CFLAG)
23
24GENERAL=Makefile README
25TEST=
26APPS=
27
28LIB=$(TOP)/libcrypto.a
29LIBSRC= pk7_asn1.c pk7_lib.c pkcs7err.c pk7_doit.c pk7_smime.c pk7_attr.c \
30 pk7_mime.c
31LIBOBJ= pk7_asn1.o pk7_lib.o pkcs7err.o pk7_doit.o pk7_smime.o pk7_attr.o \
32 pk7_mime.o
33
34SRC= $(LIBSRC)
35
36EXHEADER= pkcs7.h
37HEADER= $(EXHEADER)
38
39ALL= $(GENERAL) $(SRC) $(HEADER)
40
41top:
42 (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all)
43
44test:
45
46all: lib
47
48testapps: enc dec sign verify
49
50enc: enc.o lib
51 $(CC) $(CFLAGS) -o enc enc.o $(PEX_LIBS) $(LIB) $(EX_LIBS)
52
53dec: dec.o lib
54 $(CC) $(CFLAGS) -o dec dec.o $(PEX_LIBS) $(LIB) $(EX_LIBS)
55
56sign: sign.o lib
57 $(CC) $(CFLAGS) -o sign sign.o $(PEX_LIBS) $(LIB) $(EX_LIBS)
58
59verify: verify.o example.o lib
60 $(CC) $(CFLAGS) -o verify verify.o $(PEX_LIBS) example.o $(LIB) $(EX_LIBS)
61
62lib: $(LIBOBJ)
63 $(AR) $(LIB) $(LIBOBJ)
64 $(RANLIB) $(LIB) || echo Never mind.
65 @touch lib
66
67files:
68 $(PERL) $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO
69
70links:
71 @sh $(TOP)/util/point.sh Makefile.ssl Makefile
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 @for i in $(EXHEADER) ; \
78 do \
79 (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
80 chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
81 done;
82
83tags:
84 ctags $(SRC)
85
86tests:
87
88lint:
89 lint -DLINT $(INCLUDES) $(SRC)>fluff
90
91depend:
92 $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
93
94dclean:
95 $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
96 mv -f Makefile.new $(MAKEFILE)
97
98clean:
99 rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff enc dec sign verify
100
101# DO NOT DELETE THIS LINE -- make depend depends on it.
102
103pk7_asn1.o: ../../e_os.h ../../include/openssl/aes.h
104pk7_asn1.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h
105pk7_asn1.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
106pk7_asn1.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
107pk7_asn1.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
108pk7_asn1.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
109pk7_asn1.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
110pk7_asn1.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
111pk7_asn1.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
112pk7_asn1.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
113pk7_asn1.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
114pk7_asn1.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
115pk7_asn1.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
116pk7_asn1.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
117pk7_asn1.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
118pk7_asn1.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
119pk7_asn1.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
120pk7_asn1.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
121pk7_asn1.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
122pk7_asn1.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
123pk7_asn1.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
124pk7_asn1.o: ../cryptlib.h pk7_asn1.c
125pk7_attr.o: ../../include/openssl/aes.h ../../include/openssl/asn1.h
126pk7_attr.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
127pk7_attr.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
128pk7_attr.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
129pk7_attr.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
130pk7_attr.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
131pk7_attr.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
132pk7_attr.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
133pk7_attr.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
134pk7_attr.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
135pk7_attr.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
136pk7_attr.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
137pk7_attr.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
138pk7_attr.o: ../../include/openssl/pem.h ../../include/openssl/pem2.h
139pk7_attr.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
140pk7_attr.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
141pk7_attr.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
142pk7_attr.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
143pk7_attr.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
144pk7_attr.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
145pk7_attr.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
146pk7_attr.o: pk7_attr.c
147pk7_doit.o: ../../e_os.h ../../include/openssl/aes.h
148pk7_doit.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
149pk7_doit.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
150pk7_doit.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
151pk7_doit.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
152pk7_doit.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
153pk7_doit.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
154pk7_doit.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
155pk7_doit.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
156pk7_doit.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
157pk7_doit.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
158pk7_doit.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
159pk7_doit.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
160pk7_doit.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
161pk7_doit.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h
162pk7_doit.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
163pk7_doit.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
164pk7_doit.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
165pk7_doit.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
166pk7_doit.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
167pk7_doit.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h
168pk7_doit.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
169pk7_doit.o: ../cryptlib.h pk7_doit.c
170pk7_lib.o: ../../e_os.h ../../include/openssl/aes.h
171pk7_lib.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
172pk7_lib.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
173pk7_lib.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
174pk7_lib.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
175pk7_lib.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
176pk7_lib.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
177pk7_lib.o: ../../include/openssl/err.h ../../include/openssl/evp.h
178pk7_lib.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
179pk7_lib.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
180pk7_lib.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
181pk7_lib.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
182pk7_lib.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
183pk7_lib.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
184pk7_lib.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
185pk7_lib.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
186pk7_lib.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
187pk7_lib.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
188pk7_lib.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
189pk7_lib.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h
190pk7_lib.o: ../../include/openssl/x509_vfy.h ../cryptlib.h pk7_lib.c
191pk7_mime.o: ../../e_os.h ../../include/openssl/aes.h
192pk7_mime.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
193pk7_mime.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
194pk7_mime.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
195pk7_mime.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
196pk7_mime.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
197pk7_mime.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
198pk7_mime.o: ../../include/openssl/err.h ../../include/openssl/evp.h
199pk7_mime.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
200pk7_mime.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
201pk7_mime.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
202pk7_mime.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
203pk7_mime.o: ../../include/openssl/opensslconf.h
204pk7_mime.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
205pk7_mime.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h
206pk7_mime.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
207pk7_mime.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
208pk7_mime.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
209pk7_mime.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
210pk7_mime.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
211pk7_mime.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h
212pk7_mime.o: ../../include/openssl/x509_vfy.h ../cryptlib.h pk7_mime.c
213pk7_smime.o: ../../e_os.h ../../include/openssl/aes.h
214pk7_smime.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
215pk7_smime.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
216pk7_smime.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
217pk7_smime.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
218pk7_smime.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
219pk7_smime.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
220pk7_smime.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
221pk7_smime.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
222pk7_smime.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
223pk7_smime.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
224pk7_smime.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
225pk7_smime.o: ../../include/openssl/objects.h
226pk7_smime.o: ../../include/openssl/opensslconf.h
227pk7_smime.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
228pk7_smime.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
229pk7_smime.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
230pk7_smime.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
231pk7_smime.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
232pk7_smime.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
233pk7_smime.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
234pk7_smime.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
235pk7_smime.o: ../../include/openssl/x509v3.h ../cryptlib.h pk7_smime.c
236pkcs7err.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
237pkcs7err.o: ../../include/openssl/bn.h ../../include/openssl/crypto.h
238pkcs7err.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
239pkcs7err.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
240pkcs7err.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
241pkcs7err.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
242pkcs7err.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
243pkcs7err.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..895a91177b
--- /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_get_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..c993947cc3
--- /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_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_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_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_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/pk7_mime.c b/src/lib/libcrypto/pkcs7/pk7_mime.c
index 927b88c3e7..5d2a97839d 100644
--- a/src/lib/libcrypto/pkcs7/pk7_mime.c
+++ b/src/lib/libcrypto/pkcs7/pk7_mime.c
@@ -3,7 +3,7 @@
3 * project 1999. 3 * project 1999.
4 */ 4 */
5/* ==================================================================== 5/* ====================================================================
6 * Copyright (c) 1999-2005 The OpenSSL Project. All rights reserved. 6 * Copyright (c) 1999-2003 The OpenSSL Project. All rights reserved.
7 * 7 *
8 * Redistribution and use in source and binary forms, with or without 8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions 9 * modification, are permitted provided that the following conditions
@@ -152,12 +152,11 @@ int SMIME_write_PKCS7(BIO *bio, PKCS7 *p7, BIO *data, int flags)
152{ 152{
153 char bound[33], c; 153 char bound[33], c;
154 int i; 154 int i;
155 char *mime_prefix, *mime_eol, *msg_type=NULL; 155 char *mime_prefix, *mime_eol;
156 if (flags & PKCS7_NOOLDMIMETYPE) 156 if (flags & PKCS7_NOOLDMIMETYPE)
157 mime_prefix = "application/pkcs7-"; 157 mime_prefix = "application/pkcs7-";
158 else 158 else
159 mime_prefix = "application/x-pkcs7-"; 159 mime_prefix = "application/x-pkcs7-";
160
161 if (flags & PKCS7_CRLFEOL) 160 if (flags & PKCS7_CRLFEOL)
162 mime_eol = "\r\n"; 161 mime_eol = "\r\n";
163 else 162 else
@@ -199,30 +198,11 @@ int SMIME_write_PKCS7(BIO *bio, PKCS7 *p7, BIO *data, int flags)
199 mime_eol, mime_eol); 198 mime_eol, mime_eol);
200 return 1; 199 return 1;
201 } 200 }
202
203 /* Determine smime-type header */
204
205 if (PKCS7_type_is_enveloped(p7))
206 msg_type = "enveloped-data";
207 else if (PKCS7_type_is_signed(p7))
208 {
209 /* If we have any signers it is signed-data othewise
210 * certs-only.
211 */
212 STACK_OF(PKCS7_SIGNER_INFO) *sinfos;
213 sinfos = PKCS7_get_signer_info(p7);
214 if (sk_PKCS7_SIGNER_INFO_num(sinfos) > 0)
215 msg_type = "signed-data";
216 else
217 msg_type = "certs-only";
218 }
219 /* MIME headers */ 201 /* MIME headers */
220 BIO_printf(bio, "MIME-Version: 1.0%s", mime_eol); 202 BIO_printf(bio, "MIME-Version: 1.0%s", mime_eol);
221 BIO_printf(bio, "Content-Disposition: attachment;"); 203 BIO_printf(bio, "Content-Disposition: attachment;");
222 BIO_printf(bio, " filename=\"smime.p7m\"%s", mime_eol); 204 BIO_printf(bio, " filename=\"smime.p7m\"%s", mime_eol);
223 BIO_printf(bio, "Content-Type: %smime;", mime_prefix); 205 BIO_printf(bio, "Content-Type: %smime;", mime_prefix);
224 if (msg_type)
225 BIO_printf(bio, " smime-type=%s;", msg_type);
226 BIO_printf(bio, " name=\"smime.p7m\"%s", mime_eol); 206 BIO_printf(bio, " name=\"smime.p7m\"%s", mime_eol);
227 BIO_printf(bio, "Content-Transfer-Encoding: base64%s%s", 207 BIO_printf(bio, "Content-Transfer-Encoding: base64%s%s",
228 mime_eol, mime_eol); 208 mime_eol, mime_eol);
diff --git a/src/lib/libcrypto/pkcs7/pk7_smime.c b/src/lib/libcrypto/pkcs7/pk7_smime.c
index 99a0d63f38..a852b49235 100644
--- a/src/lib/libcrypto/pkcs7/pk7_smime.c
+++ b/src/lib/libcrypto/pkcs7/pk7_smime.c
@@ -296,9 +296,11 @@ int PKCS7_verify(PKCS7 *p7, STACK_OF(X509) *certs, X509_STORE *store,
296 296
297 if (tmpin == indata) 297 if (tmpin == indata)
298 { 298 {
299 if (indata) BIO_pop(p7bio); 299 if(indata) BIO_pop(p7bio);
300 BIO_free_all(p7bio);
300 } 301 }
301 BIO_free_all(p7bio); 302 else
303 BIO_free_all(tmpin);
302 304
303 sk_X509_free(signers); 305 sk_X509_free(signers);
304 306
diff --git a/src/lib/libcrypto/pkcs7/pkcs7err.c b/src/lib/libcrypto/pkcs7/pkcs7err.c
index 19894c80a4..5e51527a40 100644
--- a/src/lib/libcrypto/pkcs7/pkcs7err.c
+++ b/src/lib/libcrypto/pkcs7/pkcs7err.c
@@ -1,6 +1,6 @@
1/* crypto/pkcs7/pkcs7err.c */ 1/* crypto/pkcs7/pkcs7err.c */
2/* ==================================================================== 2/* ====================================================================
3 * Copyright (c) 1999-2005 The OpenSSL Project. All rights reserved. 3 * Copyright (c) 1999 The OpenSSL Project. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
@@ -64,85 +64,81 @@
64 64
65/* BEGIN ERROR CODES */ 65/* BEGIN ERROR CODES */
66#ifndef OPENSSL_NO_ERR 66#ifndef OPENSSL_NO_ERR
67
68#define ERR_FUNC(func) ERR_PACK(ERR_LIB_PKCS7,func,0)
69#define ERR_REASON(reason) ERR_PACK(ERR_LIB_PKCS7,0,reason)
70
71static ERR_STRING_DATA PKCS7_str_functs[]= 67static ERR_STRING_DATA PKCS7_str_functs[]=
72 { 68 {
73{ERR_FUNC(PKCS7_F_B64_READ_PKCS7), "B64_READ_PKCS7"}, 69{ERR_PACK(0,PKCS7_F_B64_READ_PKCS7,0), "B64_READ_PKCS7"},
74{ERR_FUNC(PKCS7_F_B64_WRITE_PKCS7), "B64_WRITE_PKCS7"}, 70{ERR_PACK(0,PKCS7_F_B64_WRITE_PKCS7,0), "B64_WRITE_PKCS7"},
75{ERR_FUNC(PKCS7_F_PKCS7_ADD_ATTRIB_SMIMECAP), "PKCS7_add_attrib_smimecap"}, 71{ERR_PACK(0,PKCS7_F_PKCS7_ADD_ATTRIB_SMIMECAP,0), "PKCS7_add_attrib_smimecap"},
76{ERR_FUNC(PKCS7_F_PKCS7_ADD_CERTIFICATE), "PKCS7_add_certificate"}, 72{ERR_PACK(0,PKCS7_F_PKCS7_ADD_CERTIFICATE,0), "PKCS7_add_certificate"},
77{ERR_FUNC(PKCS7_F_PKCS7_ADD_CRL), "PKCS7_add_crl"}, 73{ERR_PACK(0,PKCS7_F_PKCS7_ADD_CRL,0), "PKCS7_add_crl"},
78{ERR_FUNC(PKCS7_F_PKCS7_ADD_RECIPIENT_INFO), "PKCS7_add_recipient_info"}, 74{ERR_PACK(0,PKCS7_F_PKCS7_ADD_RECIPIENT_INFO,0), "PKCS7_add_recipient_info"},
79{ERR_FUNC(PKCS7_F_PKCS7_ADD_SIGNER), "PKCS7_add_signer"}, 75{ERR_PACK(0,PKCS7_F_PKCS7_ADD_SIGNER,0), "PKCS7_add_signer"},
80{ERR_FUNC(PKCS7_F_PKCS7_CTRL), "PKCS7_ctrl"}, 76{ERR_PACK(0,PKCS7_F_PKCS7_CTRL,0), "PKCS7_ctrl"},
81{ERR_FUNC(PKCS7_F_PKCS7_DATADECODE), "PKCS7_dataDecode"}, 77{ERR_PACK(0,PKCS7_F_PKCS7_DATADECODE,0), "PKCS7_dataDecode"},
82{ERR_FUNC(PKCS7_F_PKCS7_DATAINIT), "PKCS7_dataInit"}, 78{ERR_PACK(0,PKCS7_F_PKCS7_DATAINIT,0), "PKCS7_dataInit"},
83{ERR_FUNC(PKCS7_F_PKCS7_DATASIGN), "PKCS7_DATASIGN"}, 79{ERR_PACK(0,PKCS7_F_PKCS7_DATASIGN,0), "PKCS7_DATASIGN"},
84{ERR_FUNC(PKCS7_F_PKCS7_DATAVERIFY), "PKCS7_dataVerify"}, 80{ERR_PACK(0,PKCS7_F_PKCS7_DATAVERIFY,0), "PKCS7_dataVerify"},
85{ERR_FUNC(PKCS7_F_PKCS7_DECRYPT), "PKCS7_decrypt"}, 81{ERR_PACK(0,PKCS7_F_PKCS7_DECRYPT,0), "PKCS7_decrypt"},
86{ERR_FUNC(PKCS7_F_PKCS7_ENCRYPT), "PKCS7_encrypt"}, 82{ERR_PACK(0,PKCS7_F_PKCS7_ENCRYPT,0), "PKCS7_encrypt"},
87{ERR_FUNC(PKCS7_F_PKCS7_GET0_SIGNERS), "PKCS7_get0_signers"}, 83{ERR_PACK(0,PKCS7_F_PKCS7_GET0_SIGNERS,0), "PKCS7_get0_signers"},
88{ERR_FUNC(PKCS7_F_PKCS7_SET_CIPHER), "PKCS7_set_cipher"}, 84{ERR_PACK(0,PKCS7_F_PKCS7_SET_CIPHER,0), "PKCS7_set_cipher"},
89{ERR_FUNC(PKCS7_F_PKCS7_SET_CONTENT), "PKCS7_set_content"}, 85{ERR_PACK(0,PKCS7_F_PKCS7_SET_CONTENT,0), "PKCS7_set_content"},
90{ERR_FUNC(PKCS7_F_PKCS7_SET_TYPE), "PKCS7_set_type"}, 86{ERR_PACK(0,PKCS7_F_PKCS7_SET_TYPE,0), "PKCS7_set_type"},
91{ERR_FUNC(PKCS7_F_PKCS7_SIGN), "PKCS7_sign"}, 87{ERR_PACK(0,PKCS7_F_PKCS7_SIGN,0), "PKCS7_sign"},
92{ERR_FUNC(PKCS7_F_PKCS7_SIGNATUREVERIFY), "PKCS7_signatureVerify"}, 88{ERR_PACK(0,PKCS7_F_PKCS7_SIGNATUREVERIFY,0), "PKCS7_signatureVerify"},
93{ERR_FUNC(PKCS7_F_PKCS7_SIMPLE_SMIMECAP), "PKCS7_simple_smimecap"}, 89{ERR_PACK(0,PKCS7_F_PKCS7_SIMPLE_SMIMECAP,0), "PKCS7_simple_smimecap"},
94{ERR_FUNC(PKCS7_F_PKCS7_VERIFY), "PKCS7_verify"}, 90{ERR_PACK(0,PKCS7_F_PKCS7_VERIFY,0), "PKCS7_verify"},
95{ERR_FUNC(PKCS7_F_SMIME_READ_PKCS7), "SMIME_read_PKCS7"}, 91{ERR_PACK(0,PKCS7_F_SMIME_READ_PKCS7,0), "SMIME_read_PKCS7"},
96{ERR_FUNC(PKCS7_F_SMIME_TEXT), "SMIME_text"}, 92{ERR_PACK(0,PKCS7_F_SMIME_TEXT,0), "SMIME_text"},
97{0,NULL} 93{0,NULL}
98 }; 94 };
99 95
100static ERR_STRING_DATA PKCS7_str_reasons[]= 96static ERR_STRING_DATA PKCS7_str_reasons[]=
101 { 97 {
102{ERR_REASON(PKCS7_R_CERTIFICATE_VERIFY_ERROR),"certificate verify error"}, 98{PKCS7_R_CERTIFICATE_VERIFY_ERROR ,"certificate verify error"},
103{ERR_REASON(PKCS7_R_CIPHER_HAS_NO_OBJECT_IDENTIFIER),"cipher has no object identifier"}, 99{PKCS7_R_CIPHER_HAS_NO_OBJECT_IDENTIFIER ,"cipher has no object identifier"},
104{ERR_REASON(PKCS7_R_CIPHER_NOT_INITIALIZED),"cipher not initialized"}, 100{PKCS7_R_CIPHER_NOT_INITIALIZED ,"cipher not initialized"},
105{ERR_REASON(PKCS7_R_CONTENT_AND_DATA_PRESENT),"content and data present"}, 101{PKCS7_R_CONTENT_AND_DATA_PRESENT ,"content and data present"},
106{ERR_REASON(PKCS7_R_DECODE_ERROR) ,"decode error"}, 102{PKCS7_R_DECODE_ERROR ,"decode error"},
107{ERR_REASON(PKCS7_R_DECRYPTED_KEY_IS_WRONG_LENGTH),"decrypted key is wrong length"}, 103{PKCS7_R_DECRYPTED_KEY_IS_WRONG_LENGTH ,"decrypted key is wrong length"},
108{ERR_REASON(PKCS7_R_DECRYPT_ERROR) ,"decrypt error"}, 104{PKCS7_R_DECRYPT_ERROR ,"decrypt error"},
109{ERR_REASON(PKCS7_R_DIGEST_FAILURE) ,"digest failure"}, 105{PKCS7_R_DIGEST_FAILURE ,"digest failure"},
110{ERR_REASON(PKCS7_R_ERROR_ADDING_RECIPIENT),"error adding recipient"}, 106{PKCS7_R_ERROR_ADDING_RECIPIENT ,"error adding recipient"},
111{ERR_REASON(PKCS7_R_ERROR_SETTING_CIPHER),"error setting cipher"}, 107{PKCS7_R_ERROR_SETTING_CIPHER ,"error setting cipher"},
112{ERR_REASON(PKCS7_R_INVALID_MIME_TYPE) ,"invalid mime type"}, 108{PKCS7_R_INVALID_MIME_TYPE ,"invalid mime type"},
113{ERR_REASON(PKCS7_R_INVALID_NULL_POINTER),"invalid null pointer"}, 109{PKCS7_R_INVALID_NULL_POINTER ,"invalid null pointer"},
114{ERR_REASON(PKCS7_R_MIME_NO_CONTENT_TYPE),"mime no content type"}, 110{PKCS7_R_MIME_NO_CONTENT_TYPE ,"mime no content type"},
115{ERR_REASON(PKCS7_R_MIME_PARSE_ERROR) ,"mime parse error"}, 111{PKCS7_R_MIME_PARSE_ERROR ,"mime parse error"},
116{ERR_REASON(PKCS7_R_MIME_SIG_PARSE_ERROR),"mime sig parse error"}, 112{PKCS7_R_MIME_SIG_PARSE_ERROR ,"mime sig parse error"},
117{ERR_REASON(PKCS7_R_MISSING_CERIPEND_INFO),"missing ceripend info"}, 113{PKCS7_R_MISSING_CERIPEND_INFO ,"missing ceripend info"},
118{ERR_REASON(PKCS7_R_NO_CONTENT) ,"no content"}, 114{PKCS7_R_NO_CONTENT ,"no content"},
119{ERR_REASON(PKCS7_R_NO_CONTENT_TYPE) ,"no content type"}, 115{PKCS7_R_NO_CONTENT_TYPE ,"no content type"},
120{ERR_REASON(PKCS7_R_NO_MULTIPART_BODY_FAILURE),"no multipart body failure"}, 116{PKCS7_R_NO_MULTIPART_BODY_FAILURE ,"no multipart body failure"},
121{ERR_REASON(PKCS7_R_NO_MULTIPART_BOUNDARY),"no multipart boundary"}, 117{PKCS7_R_NO_MULTIPART_BOUNDARY ,"no multipart boundary"},
122{ERR_REASON(PKCS7_R_NO_RECIPIENT_MATCHES_CERTIFICATE),"no recipient matches certificate"}, 118{PKCS7_R_NO_RECIPIENT_MATCHES_CERTIFICATE,"no recipient matches certificate"},
123{ERR_REASON(PKCS7_R_NO_SIGNATURES_ON_DATA),"no signatures on data"}, 119{PKCS7_R_NO_SIGNATURES_ON_DATA ,"no signatures on data"},
124{ERR_REASON(PKCS7_R_NO_SIGNERS) ,"no signers"}, 120{PKCS7_R_NO_SIGNERS ,"no signers"},
125{ERR_REASON(PKCS7_R_NO_SIG_CONTENT_TYPE) ,"no sig content type"}, 121{PKCS7_R_NO_SIG_CONTENT_TYPE ,"no sig content type"},
126{ERR_REASON(PKCS7_R_OPERATION_NOT_SUPPORTED_ON_THIS_TYPE),"operation not supported on this type"}, 122{PKCS7_R_OPERATION_NOT_SUPPORTED_ON_THIS_TYPE,"operation not supported on this type"},
127{ERR_REASON(PKCS7_R_PKCS7_ADD_SIGNATURE_ERROR),"pkcs7 add signature error"}, 123{PKCS7_R_PKCS7_ADD_SIGNATURE_ERROR ,"pkcs7 add signature error"},
128{ERR_REASON(PKCS7_R_PKCS7_DATAFINAL_ERROR),"pkcs7 datafinal error"}, 124{PKCS7_R_PKCS7_DATAFINAL_ERROR ,"pkcs7 datafinal error"},
129{ERR_REASON(PKCS7_R_PKCS7_DATASIGN) ,"pkcs7 datasign"}, 125{PKCS7_R_PKCS7_DATASIGN ,"pkcs7 datasign"},
130{ERR_REASON(PKCS7_R_PKCS7_PARSE_ERROR) ,"pkcs7 parse error"}, 126{PKCS7_R_PKCS7_PARSE_ERROR ,"pkcs7 parse error"},
131{ERR_REASON(PKCS7_R_PKCS7_SIG_PARSE_ERROR),"pkcs7 sig parse error"}, 127{PKCS7_R_PKCS7_SIG_PARSE_ERROR ,"pkcs7 sig parse error"},
132{ERR_REASON(PKCS7_R_PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE),"private key does not match certificate"}, 128{PKCS7_R_PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE,"private key does not match certificate"},
133{ERR_REASON(PKCS7_R_SIGNATURE_FAILURE) ,"signature failure"}, 129{PKCS7_R_SIGNATURE_FAILURE ,"signature failure"},
134{ERR_REASON(PKCS7_R_SIGNER_CERTIFICATE_NOT_FOUND),"signer certificate not found"}, 130{PKCS7_R_SIGNER_CERTIFICATE_NOT_FOUND ,"signer certificate not found"},
135{ERR_REASON(PKCS7_R_SIG_INVALID_MIME_TYPE),"sig invalid mime type"}, 131{PKCS7_R_SIG_INVALID_MIME_TYPE ,"sig invalid mime type"},
136{ERR_REASON(PKCS7_R_SMIME_TEXT_ERROR) ,"smime text error"}, 132{PKCS7_R_SMIME_TEXT_ERROR ,"smime text error"},
137{ERR_REASON(PKCS7_R_UNABLE_TO_FIND_CERTIFICATE),"unable to find certificate"}, 133{PKCS7_R_UNABLE_TO_FIND_CERTIFICATE ,"unable to find certificate"},
138{ERR_REASON(PKCS7_R_UNABLE_TO_FIND_MEM_BIO),"unable to find mem bio"}, 134{PKCS7_R_UNABLE_TO_FIND_MEM_BIO ,"unable to find mem bio"},
139{ERR_REASON(PKCS7_R_UNABLE_TO_FIND_MESSAGE_DIGEST),"unable to find message digest"}, 135{PKCS7_R_UNABLE_TO_FIND_MESSAGE_DIGEST ,"unable to find message digest"},
140{ERR_REASON(PKCS7_R_UNKNOWN_DIGEST_TYPE) ,"unknown digest type"}, 136{PKCS7_R_UNKNOWN_DIGEST_TYPE ,"unknown digest type"},
141{ERR_REASON(PKCS7_R_UNKNOWN_OPERATION) ,"unknown operation"}, 137{PKCS7_R_UNKNOWN_OPERATION ,"unknown operation"},
142{ERR_REASON(PKCS7_R_UNSUPPORTED_CIPHER_TYPE),"unsupported cipher type"}, 138{PKCS7_R_UNSUPPORTED_CIPHER_TYPE ,"unsupported cipher type"},
143{ERR_REASON(PKCS7_R_UNSUPPORTED_CONTENT_TYPE),"unsupported content type"}, 139{PKCS7_R_UNSUPPORTED_CONTENT_TYPE ,"unsupported content type"},
144{ERR_REASON(PKCS7_R_WRONG_CONTENT_TYPE) ,"wrong content type"}, 140{PKCS7_R_WRONG_CONTENT_TYPE ,"wrong content type"},
145{ERR_REASON(PKCS7_R_WRONG_PKCS7_TYPE) ,"wrong pkcs7 type"}, 141{PKCS7_R_WRONG_PKCS7_TYPE ,"wrong pkcs7 type"},
146{0,NULL} 142{0,NULL}
147 }; 143 };
148 144
@@ -156,8 +152,8 @@ void ERR_load_PKCS7_strings(void)
156 { 152 {
157 init=0; 153 init=0;
158#ifndef OPENSSL_NO_ERR 154#ifndef OPENSSL_NO_ERR
159 ERR_load_strings(0,PKCS7_str_functs); 155 ERR_load_strings(ERR_LIB_PKCS7,PKCS7_str_functs);
160 ERR_load_strings(0,PKCS7_str_reasons); 156 ERR_load_strings(ERR_LIB_PKCS7,PKCS7_str_reasons);
161#endif 157#endif
162 158
163 } 159 }
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/rand/Makefile b/src/lib/libcrypto/rand/Makefile
new file mode 100644
index 0000000000..b1d1a75f98
--- /dev/null
+++ b/src/lib/libcrypto/rand/Makefile
@@ -0,0 +1,196 @@
1#
2# OpenSSL/crypto/rand/Makefile
3#
4
5DIR= rand
6TOP= ../..
7CC= cc
8INCLUDES=
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
18CFLAGS= $(INCLUDES) $(CFLAG)
19
20GENERAL=Makefile
21TEST= randtest.c
22APPS=
23
24LIB=$(TOP)/libcrypto.a
25LIBSRC=md_rand.c randfile.c rand_lib.c rand_err.c rand_egd.c \
26 rand_win.c rand_unix.c rand_os2.c
27LIBOBJ=md_rand.o randfile.o rand_lib.o rand_err.o rand_egd.o \
28 rand_win.o rand_unix.o rand_os2.o
29
30SRC= $(LIBSRC)
31
32EXHEADER= rand.h
33HEADER= $(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
47files:
48 $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
49
50links:
51 @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
52 @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
53 @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
54
55install:
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 $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
72
73dclean:
74 $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
75 mv -f Makefile.new $(MAKEFILE)
76
77clean:
78 rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
79
80# DO NOT DELETE THIS LINE -- make depend depends on it.
81
82md_rand.o: ../../e_os.h ../../include/openssl/aes.h
83md_rand.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
84md_rand.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
85md_rand.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
86md_rand.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
87md_rand.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
88md_rand.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
89md_rand.o: ../../include/openssl/evp.h ../../include/openssl/fips.h
90md_rand.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
91md_rand.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
92md_rand.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
93md_rand.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
94md_rand.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
95md_rand.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rand.h
96md_rand.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
97md_rand.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
98md_rand.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
99md_rand.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
100md_rand.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
101md_rand.o: ../../include/openssl/ui_compat.h md_rand.c rand_lcl.h
102rand_egd.o: ../../include/openssl/buffer.h ../../include/openssl/e_os2.h
103rand_egd.o: ../../include/openssl/opensslconf.h
104rand_egd.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rand.h
105rand_egd.o: rand_egd.c
106rand_err.o: ../../include/openssl/bio.h ../../include/openssl/crypto.h
107rand_err.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
108rand_err.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
109rand_err.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
110rand_err.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h
111rand_err.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
112rand_err.o: rand_err.c
113rand_lib.o: ../../e_os.h ../../include/openssl/asn1.h
114rand_lib.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
115rand_lib.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
116rand_lib.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
117rand_lib.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
118rand_lib.o: ../../include/openssl/e_os2.h ../../include/openssl/engine.h
119rand_lib.o: ../../include/openssl/err.h ../../include/openssl/fips.h
120rand_lib.o: ../../include/openssl/fips_rand.h ../../include/openssl/lhash.h
121rand_lib.o: ../../include/openssl/opensslconf.h
122rand_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
123rand_lib.o: ../../include/openssl/rand.h ../../include/openssl/rsa.h
124rand_lib.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
125rand_lib.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
126rand_lib.o: ../../include/openssl/ui_compat.h ../cryptlib.h rand_lib.c
127rand_os2.o: ../../e_os.h ../../include/openssl/aes.h
128rand_os2.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
129rand_os2.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
130rand_os2.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
131rand_os2.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
132rand_os2.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
133rand_os2.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
134rand_os2.o: ../../include/openssl/err.h ../../include/openssl/evp.h
135rand_os2.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
136rand_os2.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
137rand_os2.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
138rand_os2.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
139rand_os2.o: ../../include/openssl/opensslconf.h
140rand_os2.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
141rand_os2.o: ../../include/openssl/rand.h ../../include/openssl/rc2.h
142rand_os2.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
143rand_os2.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
144rand_os2.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
145rand_os2.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
146rand_os2.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
147rand_os2.o: ../cryptlib.h rand_lcl.h rand_os2.c
148rand_unix.o: ../../e_os.h ../../include/openssl/aes.h
149rand_unix.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
150rand_unix.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
151rand_unix.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
152rand_unix.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
153rand_unix.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
154rand_unix.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
155rand_unix.o: ../../include/openssl/err.h ../../include/openssl/evp.h
156rand_unix.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
157rand_unix.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
158rand_unix.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
159rand_unix.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
160rand_unix.o: ../../include/openssl/opensslconf.h
161rand_unix.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
162rand_unix.o: ../../include/openssl/rand.h ../../include/openssl/rc2.h
163rand_unix.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
164rand_unix.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
165rand_unix.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
166rand_unix.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
167rand_unix.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
168rand_unix.o: ../cryptlib.h rand_lcl.h rand_unix.c
169rand_win.o: ../../e_os.h ../../include/openssl/aes.h
170rand_win.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
171rand_win.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
172rand_win.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
173rand_win.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
174rand_win.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
175rand_win.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
176rand_win.o: ../../include/openssl/err.h ../../include/openssl/evp.h
177rand_win.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
178rand_win.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
179rand_win.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
180rand_win.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
181rand_win.o: ../../include/openssl/opensslconf.h
182rand_win.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
183rand_win.o: ../../include/openssl/rand.h ../../include/openssl/rc2.h
184rand_win.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
185rand_win.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
186rand_win.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
187rand_win.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
188rand_win.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
189rand_win.o: ../cryptlib.h rand_lcl.h rand_win.c
190randfile.o: ../../e_os.h ../../include/openssl/buffer.h
191randfile.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
192randfile.o: ../../include/openssl/opensslconf.h
193randfile.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
194randfile.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h
195randfile.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
196randfile.o: randfile.c
diff --git a/src/lib/libcrypto/rand/Makefile.ssl b/src/lib/libcrypto/rand/Makefile.ssl
new file mode 100644
index 0000000000..e5cbe5319c
--- /dev/null
+++ b/src/lib/libcrypto/rand/Makefile.ssl
@@ -0,0 +1,196 @@
1#
2# SSLeay/crypto/rand/Makefile
3#
4
5DIR= rand
6TOP= ../..
7CC= cc
8INCLUDES=
9CFLAG=-g
10INSTALL_PREFIX=
11OPENSSLDIR= /usr/local/ssl
12INSTALLTOP=/usr/local/ssl
13MAKE= make -f Makefile.ssl
14MAKEDEPPROG= makedepend
15MAKEDEPEND= $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG)
16MAKEFILE= Makefile.ssl
17AR= ar r
18
19CFLAGS= $(INCLUDES) $(CFLAG)
20
21GENERAL=Makefile
22TEST= randtest.c
23APPS=
24
25LIB=$(TOP)/libcrypto.a
26LIBSRC=md_rand.c randfile.c rand_lib.c rand_err.c rand_egd.c \
27 rand_win.c rand_unix.c rand_os2.c
28LIBOBJ=md_rand.o randfile.o rand_lib.o rand_err.o rand_egd.o \
29 rand_win.o rand_unix.o rand_os2.o
30
31SRC= $(LIBSRC)
32
33EXHEADER= rand.h
34HEADER= $(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
48files:
49 $(PERL) $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO
50
51links:
52 @sh $(TOP)/util/point.sh Makefile.ssl Makefile
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 @for i in $(EXHEADER) ; \
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 $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
74
75dclean:
76 $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
77 mv -f Makefile.new $(MAKEFILE)
78
79clean:
80 rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
81
82# DO NOT DELETE THIS LINE -- make depend depends on it.
83
84md_rand.o: ../../e_os.h ../../include/openssl/aes.h
85md_rand.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
86md_rand.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
87md_rand.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
88md_rand.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
89md_rand.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
90md_rand.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
91md_rand.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
92md_rand.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
93md_rand.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
94md_rand.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
95md_rand.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
96md_rand.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
97md_rand.o: ../../include/openssl/rand.h ../../include/openssl/rc2.h
98md_rand.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
99md_rand.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
100md_rand.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
101md_rand.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
102md_rand.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
103md_rand.o: md_rand.c rand_lcl.h
104rand_egd.o: ../../include/openssl/buffer.h ../../include/openssl/e_os2.h
105rand_egd.o: ../../include/openssl/opensslconf.h
106rand_egd.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rand.h
107rand_egd.o: rand_egd.c
108rand_err.o: ../../include/openssl/bio.h ../../include/openssl/crypto.h
109rand_err.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
110rand_err.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
111rand_err.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
112rand_err.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h
113rand_err.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
114rand_err.o: rand_err.c
115rand_lib.o: ../../e_os.h ../../include/openssl/asn1.h
116rand_lib.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
117rand_lib.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
118rand_lib.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
119rand_lib.o: ../../include/openssl/e_os2.h ../../include/openssl/engine.h
120rand_lib.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
121rand_lib.o: ../../include/openssl/opensslconf.h
122rand_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
123rand_lib.o: ../../include/openssl/rand.h ../../include/openssl/rsa.h
124rand_lib.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
125rand_lib.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
126rand_lib.o: ../cryptlib.h rand_lib.c
127rand_os2.o: ../../e_os.h ../../include/openssl/aes.h
128rand_os2.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
129rand_os2.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
130rand_os2.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
131rand_os2.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
132rand_os2.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
133rand_os2.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
134rand_os2.o: ../../include/openssl/err.h ../../include/openssl/evp.h
135rand_os2.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
136rand_os2.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
137rand_os2.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
138rand_os2.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
139rand_os2.o: ../../include/openssl/opensslconf.h
140rand_os2.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
141rand_os2.o: ../../include/openssl/rand.h ../../include/openssl/rc2.h
142rand_os2.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
143rand_os2.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
144rand_os2.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
145rand_os2.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
146rand_os2.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
147rand_os2.o: ../cryptlib.h rand_lcl.h rand_os2.c
148rand_unix.o: ../../e_os.h ../../include/openssl/aes.h
149rand_unix.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
150rand_unix.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
151rand_unix.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
152rand_unix.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
153rand_unix.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
154rand_unix.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
155rand_unix.o: ../../include/openssl/err.h ../../include/openssl/evp.h
156rand_unix.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
157rand_unix.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
158rand_unix.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
159rand_unix.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
160rand_unix.o: ../../include/openssl/opensslconf.h
161rand_unix.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
162rand_unix.o: ../../include/openssl/rand.h ../../include/openssl/rc2.h
163rand_unix.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
164rand_unix.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
165rand_unix.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
166rand_unix.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
167rand_unix.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
168rand_unix.o: ../cryptlib.h rand_lcl.h rand_unix.c
169rand_win.o: ../../e_os.h ../../include/openssl/aes.h
170rand_win.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
171rand_win.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
172rand_win.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
173rand_win.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
174rand_win.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
175rand_win.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
176rand_win.o: ../../include/openssl/err.h ../../include/openssl/evp.h
177rand_win.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
178rand_win.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
179rand_win.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
180rand_win.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
181rand_win.o: ../../include/openssl/opensslconf.h
182rand_win.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
183rand_win.o: ../../include/openssl/rand.h ../../include/openssl/rc2.h
184rand_win.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
185rand_win.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
186rand_win.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
187rand_win.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
188rand_win.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
189rand_win.o: ../cryptlib.h rand_lcl.h rand_win.c
190randfile.o: ../../e_os.h ../../include/openssl/buffer.h
191randfile.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
192randfile.o: ../../include/openssl/opensslconf.h
193randfile.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
194randfile.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h
195randfile.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
196randfile.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..c84968df88
--- /dev/null
+++ b/src/lib/libcrypto/rand/md_rand.c
@@ -0,0 +1,581 @@
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#ifdef MD_RAND_DEBUG
113# ifndef NDEBUG
114# define NDEBUG
115# endif
116#endif
117
118#include <assert.h>
119#include <stdio.h>
120#include <string.h>
121
122#include "e_os.h"
123
124#include <openssl/rand.h>
125#include "rand_lcl.h"
126
127#include <openssl/crypto.h>
128#include <openssl/err.h>
129#include <openssl/fips.h>
130
131#ifdef BN_DEBUG
132# define PREDICT
133#endif
134
135/* #define PREDICT 1 */
136
137#define STATE_SIZE 1023
138static int state_num=0,state_index=0;
139static unsigned char state[STATE_SIZE+MD_DIGEST_LENGTH];
140static unsigned char md[MD_DIGEST_LENGTH];
141static long md_count[2]={0,0};
142static double entropy=0;
143static int initialized=0;
144
145static unsigned int crypto_lock_rand = 0; /* may be set only when a thread
146 * holds CRYPTO_LOCK_RAND
147 * (to prevent double locking) */
148/* access to lockin_thread is synchronized by CRYPTO_LOCK_RAND2 */
149static unsigned long locking_thread = 0; /* valid iff crypto_lock_rand is set */
150
151
152#ifdef PREDICT
153int rand_predictable=0;
154#endif
155
156const char *RAND_version="RAND" OPENSSL_VERSION_PTEXT;
157
158static void ssleay_rand_cleanup(void);
159static void ssleay_rand_seed(const void *buf, int num);
160static void ssleay_rand_add(const void *buf, int num, double add_entropy);
161static int ssleay_rand_bytes(unsigned char *buf, int num);
162static int ssleay_rand_pseudo_bytes(unsigned char *buf, int num);
163static int ssleay_rand_status(void);
164
165RAND_METHOD rand_ssleay_meth={
166 ssleay_rand_seed,
167 ssleay_rand_bytes,
168 ssleay_rand_cleanup,
169 ssleay_rand_add,
170 ssleay_rand_pseudo_bytes,
171 ssleay_rand_status
172 };
173
174RAND_METHOD *RAND_SSLeay(void)
175 {
176 return(&rand_ssleay_meth);
177 }
178
179static void ssleay_rand_cleanup(void)
180 {
181 OPENSSL_cleanse(state,sizeof(state));
182 state_num=0;
183 state_index=0;
184 OPENSSL_cleanse(md,MD_DIGEST_LENGTH);
185 md_count[0]=0;
186 md_count[1]=0;
187 entropy=0;
188 initialized=0;
189 }
190
191static void ssleay_rand_add(const void *buf, int num, double add)
192 {
193 int i,j,k,st_idx;
194 long md_c[2];
195 unsigned char local_md[MD_DIGEST_LENGTH];
196 EVP_MD_CTX m;
197 int do_not_lock;
198
199 /*
200 * (Based on the rand(3) manpage)
201 *
202 * The input is chopped up into units of 20 bytes (or less for
203 * the last block). Each of these blocks is run through the hash
204 * function as follows: The data passed to the hash function
205 * is the current 'md', the same number of bytes from the 'state'
206 * (the location determined by in incremented looping index) as
207 * the current 'block', the new key data 'block', and 'count'
208 * (which is incremented after each use).
209 * The result of this is kept in 'md' and also xored into the
210 * 'state' at the same locations that were used as input into the
211 * hash function.
212 */
213
214 /* check if we already have the lock */
215 if (crypto_lock_rand)
216 {
217 CRYPTO_r_lock(CRYPTO_LOCK_RAND2);
218 do_not_lock = (locking_thread == CRYPTO_thread_id());
219 CRYPTO_r_unlock(CRYPTO_LOCK_RAND2);
220 }
221 else
222 do_not_lock = 0;
223
224 if (!do_not_lock) CRYPTO_w_lock(CRYPTO_LOCK_RAND);
225 st_idx=state_index;
226
227 /* use our own copies of the counters so that even
228 * if a concurrent thread seeds with exactly the
229 * same data and uses the same subarray there's _some_
230 * difference */
231 md_c[0] = md_count[0];
232 md_c[1] = md_count[1];
233
234 memcpy(local_md, md, sizeof md);
235
236 /* state_index <= state_num <= STATE_SIZE */
237 state_index += num;
238 if (state_index >= STATE_SIZE)
239 {
240 state_index%=STATE_SIZE;
241 state_num=STATE_SIZE;
242 }
243 else if (state_num < STATE_SIZE)
244 {
245 if (state_index > state_num)
246 state_num=state_index;
247 }
248 /* state_index <= state_num <= STATE_SIZE */
249
250 /* state[st_idx], ..., state[(st_idx + num - 1) % STATE_SIZE]
251 * are what we will use now, but other threads may use them
252 * as well */
253
254 md_count[1] += (num / MD_DIGEST_LENGTH) + (num % MD_DIGEST_LENGTH > 0);
255
256 if (!do_not_lock) CRYPTO_w_unlock(CRYPTO_LOCK_RAND);
257
258 EVP_MD_CTX_init(&m);
259 for (i=0; i<num; i+=MD_DIGEST_LENGTH)
260 {
261 j=(num-i);
262 j=(j > MD_DIGEST_LENGTH)?MD_DIGEST_LENGTH:j;
263
264 MD_Init(&m);
265 MD_Update(&m,local_md,MD_DIGEST_LENGTH);
266 k=(st_idx+j)-STATE_SIZE;
267 if (k > 0)
268 {
269 MD_Update(&m,&(state[st_idx]),j-k);
270 MD_Update(&m,&(state[0]),k);
271 }
272 else
273 MD_Update(&m,&(state[st_idx]),j);
274
275 MD_Update(&m,buf,j);
276 MD_Update(&m,(unsigned char *)&(md_c[0]),sizeof(md_c));
277 MD_Final(&m,local_md);
278 md_c[1]++;
279
280 buf=(const char *)buf + j;
281
282 for (k=0; k<j; k++)
283 {
284 /* Parallel threads may interfere with this,
285 * but always each byte of the new state is
286 * the XOR of some previous value of its
287 * and local_md (itermediate values may be lost).
288 * Alway using locking could hurt performance more
289 * than necessary given that conflicts occur only
290 * when the total seeding is longer than the random
291 * state. */
292 state[st_idx++]^=local_md[k];
293 if (st_idx >= STATE_SIZE)
294 st_idx=0;
295 }
296 }
297 EVP_MD_CTX_cleanup(&m);
298
299 if (!do_not_lock) CRYPTO_w_lock(CRYPTO_LOCK_RAND);
300 /* Don't just copy back local_md into md -- this could mean that
301 * other thread's seeding remains without effect (except for
302 * the incremented counter). By XORing it we keep at least as
303 * much entropy as fits into md. */
304 for (k = 0; k < sizeof md; k++)
305 {
306 md[k] ^= local_md[k];
307 }
308 if (entropy < ENTROPY_NEEDED) /* stop counting when we have enough */
309 entropy += add;
310 if (!do_not_lock) CRYPTO_w_unlock(CRYPTO_LOCK_RAND);
311
312#if !defined(OPENSSL_THREADS) && !defined(OPENSSL_SYS_WIN32)
313 assert(md_c[1] == md_count[1]);
314#endif
315 }
316
317static void ssleay_rand_seed(const void *buf, int num)
318 {
319 ssleay_rand_add(buf, num, num);
320 }
321
322static int ssleay_rand_bytes(unsigned char *buf, int num)
323 {
324 static volatile int stirred_pool = 0;
325 int i,j,k,st_num,st_idx;
326 int num_ceil;
327 int ok;
328 long md_c[2];
329 unsigned char local_md[MD_DIGEST_LENGTH];
330 EVP_MD_CTX m;
331#ifndef GETPID_IS_MEANINGLESS
332 pid_t curr_pid = getpid();
333#endif
334 int do_stir_pool = 0;
335
336#ifdef OPENSSL_FIPS
337 if(FIPS_mode())
338 {
339 FIPSerr(FIPS_F_SSLEAY_RAND_BYTES,FIPS_R_NON_FIPS_METHOD);
340 return 0;
341 }
342#endif
343
344#ifdef PREDICT
345 if (rand_predictable)
346 {
347 static unsigned char val=0;
348
349 for (i=0; i<num; i++)
350 buf[i]=val++;
351 return(1);
352 }
353#endif
354
355 if (num <= 0)
356 return 1;
357
358 EVP_MD_CTX_init(&m);
359 /* round upwards to multiple of MD_DIGEST_LENGTH/2 */
360 num_ceil = (1 + (num-1)/(MD_DIGEST_LENGTH/2)) * (MD_DIGEST_LENGTH/2);
361
362 /*
363 * (Based on the rand(3) manpage:)
364 *
365 * For each group of 10 bytes (or less), we do the following:
366 *
367 * Input into the hash function the local 'md' (which is initialized from
368 * the global 'md' before any bytes are generated), the bytes that are to
369 * be overwritten by the random bytes, and bytes from the 'state'
370 * (incrementing looping index). From this digest output (which is kept
371 * in 'md'), the top (up to) 10 bytes are returned to the caller and the
372 * bottom 10 bytes are xored into the 'state'.
373 *
374 * Finally, after we have finished 'num' random bytes for the
375 * caller, 'count' (which is incremented) and the local and global 'md'
376 * are fed into the hash function and the results are kept in the
377 * global 'md'.
378 */
379
380 CRYPTO_w_lock(CRYPTO_LOCK_RAND);
381
382 /* prevent ssleay_rand_bytes() from trying to obtain the lock again */
383 CRYPTO_w_lock(CRYPTO_LOCK_RAND2);
384 locking_thread = CRYPTO_thread_id();
385 CRYPTO_w_unlock(CRYPTO_LOCK_RAND2);
386 crypto_lock_rand = 1;
387
388 if (!initialized)
389 {
390 RAND_poll();
391 initialized = 1;
392 }
393
394 if (!stirred_pool)
395 do_stir_pool = 1;
396
397 ok = (entropy >= ENTROPY_NEEDED);
398 if (!ok)
399 {
400 /* If the PRNG state is not yet unpredictable, then seeing
401 * the PRNG output may help attackers to determine the new
402 * state; thus we have to decrease the entropy estimate.
403 * Once we've had enough initial seeding we don't bother to
404 * adjust the entropy count, though, because we're not ambitious
405 * to provide *information-theoretic* randomness.
406 *
407 * NOTE: This approach fails if the program forks before
408 * we have enough entropy. Entropy should be collected
409 * in a separate input pool and be transferred to the
410 * output pool only when the entropy limit has been reached.
411 */
412 entropy -= num;
413 if (entropy < 0)
414 entropy = 0;
415 }
416
417 if (do_stir_pool)
418 {
419 /* In the output function only half of 'md' remains secret,
420 * so we better make sure that the required entropy gets
421 * 'evenly distributed' through 'state', our randomness pool.
422 * The input function (ssleay_rand_add) chains all of 'md',
423 * which makes it more suitable for this purpose.
424 */
425
426 int n = STATE_SIZE; /* so that the complete pool gets accessed */
427 while (n > 0)
428 {
429#if MD_DIGEST_LENGTH > 20
430# error "Please adjust DUMMY_SEED."
431#endif
432#define DUMMY_SEED "...................." /* at least MD_DIGEST_LENGTH */
433 /* Note that the seed does not matter, it's just that
434 * ssleay_rand_add expects to have something to hash. */
435 ssleay_rand_add(DUMMY_SEED, MD_DIGEST_LENGTH, 0.0);
436 n -= MD_DIGEST_LENGTH;
437 }
438 if (ok)
439 stirred_pool = 1;
440 }
441
442 st_idx=state_index;
443 st_num=state_num;
444 md_c[0] = md_count[0];
445 md_c[1] = md_count[1];
446 memcpy(local_md, md, sizeof md);
447
448 state_index+=num_ceil;
449 if (state_index > state_num)
450 state_index %= state_num;
451
452 /* state[st_idx], ..., state[(st_idx + num_ceil - 1) % st_num]
453 * are now ours (but other threads may use them too) */
454
455 md_count[0] += 1;
456
457 /* before unlocking, we must clear 'crypto_lock_rand' */
458 crypto_lock_rand = 0;
459 CRYPTO_w_unlock(CRYPTO_LOCK_RAND);
460
461 while (num > 0)
462 {
463 /* num_ceil -= MD_DIGEST_LENGTH/2 */
464 j=(num >= MD_DIGEST_LENGTH/2)?MD_DIGEST_LENGTH/2:num;
465 num-=j;
466 MD_Init(&m);
467#ifndef GETPID_IS_MEANINGLESS
468 if (curr_pid) /* just in the first iteration to save time */
469 {
470 MD_Update(&m,(unsigned char*)&curr_pid,sizeof curr_pid);
471 curr_pid = 0;
472 }
473#endif
474 MD_Update(&m,local_md,MD_DIGEST_LENGTH);
475 MD_Update(&m,(unsigned char *)&(md_c[0]),sizeof(md_c));
476#ifndef PURIFY
477 MD_Update(&m,buf,j); /* purify complains */
478#endif
479 k=(st_idx+MD_DIGEST_LENGTH/2)-st_num;
480 if (k > 0)
481 {
482 MD_Update(&m,&(state[st_idx]),MD_DIGEST_LENGTH/2-k);
483 MD_Update(&m,&(state[0]),k);
484 }
485 else
486 MD_Update(&m,&(state[st_idx]),MD_DIGEST_LENGTH/2);
487 MD_Final(&m,local_md);
488
489 for (i=0; i<MD_DIGEST_LENGTH/2; i++)
490 {
491 state[st_idx++]^=local_md[i]; /* may compete with other threads */
492 if (st_idx >= st_num)
493 st_idx=0;
494 if (i < j)
495 *(buf++)=local_md[i+MD_DIGEST_LENGTH/2];
496 }
497 }
498
499 MD_Init(&m);
500 MD_Update(&m,(unsigned char *)&(md_c[0]),sizeof(md_c));
501 MD_Update(&m,local_md,MD_DIGEST_LENGTH);
502 CRYPTO_w_lock(CRYPTO_LOCK_RAND);
503 MD_Update(&m,md,MD_DIGEST_LENGTH);
504 MD_Final(&m,md);
505 CRYPTO_w_unlock(CRYPTO_LOCK_RAND);
506
507 EVP_MD_CTX_cleanup(&m);
508 if (ok)
509 return(1);
510 else
511 {
512 RANDerr(RAND_F_SSLEAY_RAND_BYTES,RAND_R_PRNG_NOT_SEEDED);
513 ERR_add_error_data(1, "You need to read the OpenSSL FAQ, "
514 "http://www.openssl.org/support/faq.html");
515 return(0);
516 }
517 }
518
519/* pseudo-random bytes that are guaranteed to be unique but not
520 unpredictable */
521static int ssleay_rand_pseudo_bytes(unsigned char *buf, int num)
522 {
523 int ret;
524 unsigned long err;
525
526 ret = RAND_bytes(buf, num);
527 if (ret == 0)
528 {
529 err = ERR_peek_error();
530 if (ERR_GET_LIB(err) == ERR_LIB_RAND &&
531 ERR_GET_REASON(err) == RAND_R_PRNG_NOT_SEEDED)
532 (void)ERR_get_error();
533 }
534 return (ret);
535 }
536
537static int ssleay_rand_status(void)
538 {
539 int ret;
540 int do_not_lock;
541
542 /* check if we already have the lock
543 * (could happen if a RAND_poll() implementation calls RAND_status()) */
544 if (crypto_lock_rand)
545 {
546 CRYPTO_r_lock(CRYPTO_LOCK_RAND2);
547 do_not_lock = (locking_thread == CRYPTO_thread_id());
548 CRYPTO_r_unlock(CRYPTO_LOCK_RAND2);
549 }
550 else
551 do_not_lock = 0;
552
553 if (!do_not_lock)
554 {
555 CRYPTO_w_lock(CRYPTO_LOCK_RAND);
556
557 /* prevent ssleay_rand_bytes() from trying to obtain the lock again */
558 CRYPTO_w_lock(CRYPTO_LOCK_RAND2);
559 locking_thread = CRYPTO_thread_id();
560 CRYPTO_w_unlock(CRYPTO_LOCK_RAND2);
561 crypto_lock_rand = 1;
562 }
563
564 if (!initialized)
565 {
566 RAND_poll();
567 initialized = 1;
568 }
569
570 ret = entropy >= ENTROPY_NEEDED;
571
572 if (!do_not_lock)
573 {
574 /* before unlocking, we must clear 'crypto_lock_rand' */
575 crypto_lock_rand = 0;
576
577 CRYPTO_w_unlock(CRYPTO_LOCK_RAND);
578 }
579
580 return ret;
581 }
diff --git a/src/lib/libcrypto/rand/rand_egd.c b/src/lib/libcrypto/rand/rand_egd.c
new file mode 100644
index 0000000000..cd666abfcb
--- /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_VOS)
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 97f96e1aee..95574659ac 100644
--- a/src/lib/libcrypto/rand/rand_err.c
+++ b/src/lib/libcrypto/rand/rand_err.c
@@ -1,6 +1,6 @@
1/* crypto/rand/rand_err.c */ 1/* crypto/rand/rand_err.c */
2/* ==================================================================== 2/* ====================================================================
3 * Copyright (c) 1999-2005 The OpenSSL Project. All rights reserved. 3 * Copyright (c) 1999-2003 The OpenSSL Project. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
@@ -64,26 +64,22 @@
64 64
65/* BEGIN ERROR CODES */ 65/* BEGIN ERROR CODES */
66#ifndef OPENSSL_NO_ERR 66#ifndef OPENSSL_NO_ERR
67
68#define ERR_FUNC(func) ERR_PACK(ERR_LIB_RAND,func,0)
69#define ERR_REASON(reason) ERR_PACK(ERR_LIB_RAND,0,reason)
70
71static ERR_STRING_DATA RAND_str_functs[]= 67static ERR_STRING_DATA RAND_str_functs[]=
72 { 68 {
73{ERR_FUNC(RAND_F_FIPS_RAND_BYTES), "FIPS_RAND_BYTES"}, 69{ERR_PACK(0,RAND_F_FIPS_RAND_BYTES,0), "FIPS_RAND_BYTES"},
74{ERR_FUNC(RAND_F_RAND_GET_RAND_METHOD), "RAND_get_rand_method"}, 70{ERR_PACK(0,RAND_F_RAND_GET_RAND_METHOD,0), "RAND_get_rand_method"},
75{ERR_FUNC(RAND_F_SSLEAY_RAND_BYTES), "SSLEAY_RAND_BYTES"}, 71{ERR_PACK(0,RAND_F_SSLEAY_RAND_BYTES,0), "SSLEAY_RAND_BYTES"},
76{0,NULL} 72{0,NULL}
77 }; 73 };
78 74
79static ERR_STRING_DATA RAND_str_reasons[]= 75static ERR_STRING_DATA RAND_str_reasons[]=
80 { 76 {
81{ERR_REASON(RAND_R_NON_FIPS_METHOD) ,"non fips method"}, 77{RAND_R_NON_FIPS_METHOD ,"non fips method"},
82{ERR_REASON(RAND_R_PRNG_ASKING_FOR_TOO_MUCH),"prng asking for too much"}, 78{RAND_R_PRNG_ASKING_FOR_TOO_MUCH ,"prng asking for too much"},
83{ERR_REASON(RAND_R_PRNG_NOT_REKEYED) ,"prng not rekeyed"}, 79{RAND_R_PRNG_NOT_REKEYED ,"prng not rekeyed"},
84{ERR_REASON(RAND_R_PRNG_NOT_RESEEDED) ,"prng not reseeded"}, 80{RAND_R_PRNG_NOT_RESEEDED ,"prng not reseeded"},
85{ERR_REASON(RAND_R_PRNG_NOT_SEEDED) ,"PRNG not seeded"}, 81{RAND_R_PRNG_NOT_SEEDED ,"PRNG not seeded"},
86{ERR_REASON(RAND_R_PRNG_STUCK) ,"prng stuck"}, 82{RAND_R_PRNG_STUCK ,"prng stuck"},
87{0,NULL} 83{0,NULL}
88 }; 84 };
89 85
@@ -97,8 +93,8 @@ void ERR_load_RAND_strings(void)
97 { 93 {
98 init=0; 94 init=0;
99#ifndef OPENSSL_NO_ERR 95#ifndef OPENSSL_NO_ERR
100 ERR_load_strings(0,RAND_str_functs); 96 ERR_load_strings(ERR_LIB_RAND,RAND_str_functs);
101 ERR_load_strings(0,RAND_str_reasons); 97 ERR_load_strings(ERR_LIB_RAND,RAND_str_reasons);
102#endif 98#endif
103 99
104 } 100 }
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 a21bde79de..88f1b56d91 100644
--- a/src/lib/libcrypto/rand/rand_lib.c
+++ b/src/lib/libcrypto/rand/rand_lib.c
@@ -87,6 +87,16 @@ int RAND_set_rand_method(const RAND_METHOD *meth)
87 87
88const RAND_METHOD *RAND_get_rand_method(void) 88const RAND_METHOD *RAND_get_rand_method(void)
89 { 89 {
90#ifdef OPENSSL_FIPS
91 if(FIPS_mode()
92 && default_RAND_meth != FIPS_rand_check())
93 {
94 RANDerr(RAND_F_RAND_GET_RAND_METHOD,RAND_R_NON_FIPS_METHOD);
95 return 0;
96 }
97#endif
98
99
90 if (!default_RAND_meth) 100 if (!default_RAND_meth)
91 { 101 {
92#ifndef OPENSSL_NO_ENGINE 102#ifndef OPENSSL_NO_ENGINE
@@ -104,22 +114,8 @@ const RAND_METHOD *RAND_get_rand_method(void)
104 funct_ref = e; 114 funct_ref = e;
105 else 115 else
106#endif 116#endif
107#ifdef OPENSSL_FIPS 117 default_RAND_meth = RAND_SSLeay();
108 if(FIPS_mode())
109 default_RAND_meth=FIPS_rand_method();
110 else
111#endif
112 default_RAND_meth = RAND_SSLeay();
113 } 118 }
114
115#ifdef OPENSSL_FIPS
116 if(FIPS_mode()
117 && default_RAND_meth != FIPS_rand_check())
118 {
119 RANDerr(RAND_F_RAND_GET_RAND_METHOD,RAND_R_NON_FIPS_METHOD);
120 return 0;
121 }
122#endif
123 return default_RAND_meth; 119 return default_RAND_meth;
124 } 120 }
125 121
diff --git a/src/lib/libcrypto/rand/rand_os2.c b/src/lib/libcrypto/rand/rand_os2.c
new file mode 100644
index 0000000000..c3e36d4e5e
--- /dev/null
+++ b/src/lib/libcrypto/rand/rand_os2.c
@@ -0,0 +1,147 @@
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
81APIRET APIENTRY(*DosPerfSysCall) (ULONG ulCommand, ULONG ulParm1, ULONG ulParm2, ULONG ulParm3) = NULL;
82APIRET APIENTRY(*DosQuerySysState) (ULONG func, ULONG arg1, ULONG pid, ULONG _res_, PVOID buf, ULONG bufsz) = NULL;
83HMODULE hDoscalls = 0;
84
85int RAND_poll(void)
86{
87 char failed_module[20];
88 QWORD qwTime;
89 ULONG SysVars[QSV_FOREGROUND_PROCESS];
90
91 if (hDoscalls == 0) {
92 ULONG rc = DosLoadModule(failed_module, sizeof(failed_module), "DOSCALLS", &hDoscalls);
93
94 if (rc == 0) {
95 rc = DosQueryProcAddr(hDoscalls, 976, NULL, (PFN *)&DosPerfSysCall);
96
97 if (rc)
98 DosPerfSysCall = NULL;
99
100 rc = DosQueryProcAddr(hDoscalls, 368, NULL, (PFN *)&DosQuerySysState);
101
102 if (rc)
103 DosQuerySysState = NULL;
104 }
105 }
106
107 /* Sample the hi-res timer, runs at around 1.1 MHz */
108 DosTmrQueryTime(&qwTime);
109 RAND_add(&qwTime, sizeof(qwTime), 2);
110
111 /* Sample a bunch of system variables, includes various process & memory statistics */
112 DosQuerySysInfo(1, QSV_FOREGROUND_PROCESS, SysVars, sizeof(SysVars));
113 RAND_add(SysVars, sizeof(SysVars), 4);
114
115 /* If available, sample CPU registers that count at CPU MHz
116 * Only fairly new CPUs (PPro & K6 onwards) & OS/2 versions support this
117 */
118 if (DosPerfSysCall) {
119 CPUUTIL util;
120
121 if (DosPerfSysCall(CMD_KI_RDCNT, (ULONG)&util, 0, 0) == 0) {
122 RAND_add(&util, sizeof(util), 10);
123 }
124 else {
125 DosPerfSysCall = NULL;
126 }
127 }
128
129 /* DosQuerySysState() gives us a huge quantity of process, thread, memory & handle stats */
130 if (DosQuerySysState) {
131 char *buffer = OPENSSL_malloc(256 * 1024);
132
133 if (DosQuerySysState(0x1F, 0, 0, 0, buffer, 256 * 1024) == 0) {
134 /* First 4 bytes in buffer is a pointer to the thread count
135 * there should be at least 1 byte of entropy per thread
136 */
137 RAND_add(buffer, 256 * 1024, **(ULONG **)buffer);
138 }
139
140 OPENSSL_free(buffer);
141 return 1;
142 }
143
144 return 0;
145}
146
147#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..9376554fae
--- /dev/null
+++ b/src/lib/libcrypto/rand/rand_unix.c
@@ -0,0 +1,281 @@
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-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#define USE_SOCKETS
113#include "e_os.h"
114#include "cryptlib.h"
115#include <openssl/rand.h>
116#include "rand_lcl.h"
117
118#if !(defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_WIN32) || defined(OPENSSL_SYS_VMS) || defined(OPENSSL_SYS_OS2) || defined(OPENSSL_SYS_VXWORKS))
119
120#include <sys/types.h>
121#include <sys/time.h>
122#include <sys/times.h>
123#include <sys/stat.h>
124#include <fcntl.h>
125#include <unistd.h>
126#include <time.h>
127
128#ifdef __OpenBSD__
129int RAND_poll(void)
130{
131 u_int32_t rnd = 0, i;
132 unsigned char buf[ENTROPY_NEEDED];
133
134 for (i = 0; i < sizeof(buf); i++) {
135 if (i % 4 == 0)
136 rnd = arc4random();
137 buf[i] = rnd;
138 rnd >>= 8;
139 }
140 RAND_add(buf, sizeof(buf), ENTROPY_NEEDED);
141 memset(buf, 0, sizeof(buf));
142
143 return 1;
144}
145#else
146int RAND_poll(void)
147{
148 unsigned long l;
149 pid_t curr_pid = getpid();
150#if defined(DEVRANDOM) || defined(DEVRANDOM_EGD)
151 unsigned char tmpbuf[ENTROPY_NEEDED];
152 int n = 0;
153#endif
154#ifdef DEVRANDOM
155 static const char *randomfiles[] = { DEVRANDOM };
156 struct stat randomstats[sizeof(randomfiles)/sizeof(randomfiles[0])];
157 int fd,i;
158#endif
159#ifdef DEVRANDOM_EGD
160 static const char *egdsockets[] = { DEVRANDOM_EGD, NULL };
161 const char **egdsocket = NULL;
162#endif
163
164#ifdef DEVRANDOM
165 memset(randomstats,0,sizeof(randomstats));
166 /* Use a random entropy pool device. Linux, FreeBSD and OpenBSD
167 * have this. Use /dev/urandom if you can as /dev/random may block
168 * if it runs out of random entries. */
169
170 for (i=0; i<sizeof(randomfiles)/sizeof(randomfiles[0]) && n < ENTROPY_NEEDED; i++)
171 {
172 if ((fd = open(randomfiles[i], O_RDONLY
173#ifdef O_NONBLOCK
174 |O_NONBLOCK
175#endif
176#ifdef O_BINARY
177 |O_BINARY
178#endif
179#ifdef O_NOCTTY /* If it happens to be a TTY (god forbid), do not make it
180 our controlling tty */
181 |O_NOCTTY
182#endif
183 )) >= 0)
184 {
185 struct timeval t = { 0, 10*1000 }; /* Spend 10ms on
186 each file. */
187 int r,j;
188 fd_set fset;
189 struct stat *st=&randomstats[i];
190
191 /* Avoid using same input... Used to be O_NOFOLLOW
192 * above, but it's not universally appropriate... */
193 if (fstat(fd,st) != 0) { close(fd); continue; }
194 for (j=0;j<i;j++)
195 {
196 if (randomstats[j].st_ino==st->st_ino &&
197 randomstats[j].st_dev==st->st_dev)
198 break;
199 }
200 if (j<i) { close(fd); continue; }
201
202 do
203 {
204 FD_ZERO(&fset);
205 FD_SET(fd, &fset);
206 r = -1;
207
208 if (select(fd+1,&fset,NULL,NULL,&t) < 0)
209 t.tv_usec=0;
210 else if (FD_ISSET(fd, &fset))
211 {
212 r=read(fd,(unsigned char *)tmpbuf+n,
213 ENTROPY_NEEDED-n);
214 if (r > 0)
215 n += r;
216 }
217
218 /* Some Unixen will update t, some
219 won't. For those who won't, give
220 up here, otherwise, we will do
221 this once again for the remaining
222 time. */
223 if (t.tv_usec == 10*1000)
224 t.tv_usec=0;
225 }
226 while ((r > 0 || (errno == EINTR || errno == EAGAIN))
227 && t.tv_usec != 0 && n < ENTROPY_NEEDED);
228
229 close(fd);
230 }
231 }
232#endif
233
234#ifdef DEVRANDOM_EGD
235 /* Use an EGD socket to read entropy from an EGD or PRNGD entropy
236 * collecting daemon. */
237
238 for (egdsocket = egdsockets; *egdsocket && n < ENTROPY_NEEDED; egdsocket++)
239 {
240 int r;
241
242 r = RAND_query_egd_bytes(*egdsocket, (unsigned char *)tmpbuf+n,
243 ENTROPY_NEEDED-n);
244 if (r > 0)
245 n += r;
246 }
247#endif
248
249#if defined(DEVRANDOM) || defined(DEVRANDOM_EGD)
250 if (n > 0)
251 {
252 RAND_add(tmpbuf,sizeof tmpbuf,n);
253 OPENSSL_cleanse(tmpbuf,n);
254 }
255#endif
256
257 /* put in some default random data, we need more than just this */
258 l=curr_pid;
259 RAND_add(&l,sizeof(l),0);
260 l=getuid();
261 RAND_add(&l,sizeof(l),0);
262
263 l=time(NULL);
264 RAND_add(&l,sizeof(l),0);
265
266#if defined(DEVRANDOM) || defined(DEVRANDOM_EGD)
267 return 1;
268#else
269 return 0;
270#endif
271}
272
273#endif
274#endif
275
276#if defined(OPENSSL_SYS_VXWORKS)
277int RAND_poll(void)
278{
279 return 0;
280}
281#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..1267a3acae
--- /dev/null
+++ b/src/lib/libcrypto/rand/rand_vms.c
@@ -0,0 +1,136 @@
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
72static struct items_data_st
73 {
74 short length, code; /* length is amount of bytes */
75 } items_data[] =
76 { { 4, JPI$_BUFIO },
77 { 4, JPI$_CPUTIM },
78 { 4, JPI$_DIRIO },
79 { 8, JPI$_LOGINTIM },
80 { 4, JPI$_PAGEFLTS },
81 { 4, JPI$_PID },
82 { 4, JPI$_WSSIZE },
83 { 0, 0 }
84 };
85
86int RAND_poll(void)
87 {
88 long pid, iosb[2];
89 int status = 0;
90 struct
91 {
92 short length, code;
93 long *buffer;
94 int *retlen;
95 } item[32], *pitem;
96 unsigned char data_buffer[256];
97 short total_length = 0;
98 struct items_data_st *pitems_data;
99
100 pitems_data = items_data;
101 pitem = item;
102
103 /* Setup */
104 while (pitems_data->length
105 && (total_length + pitems_data->length <= 256))
106 {
107 pitem->length = pitems_data->length;
108 pitem->code = pitems_data->code;
109 pitem->buffer = (long *)&data_buffer[total_length];
110 pitem->retlen = 0;
111 total_length += pitems_data->length;
112 pitems_data++;
113 pitem++;
114 }
115 pitem->length = pitem->code = 0;
116
117 /*
118 * Scan through all the processes in the system and add entropy with
119 * results from the processes that were possible to look at.
120 * However, view the information as only half trustable.
121 */
122 pid = -1; /* search context */
123 while ((status = sys$getjpiw(0, &pid, 0, item, iosb, 0, 0))
124 != SS$_NOMOREPROC)
125 {
126 if (status == SS$_NORMAL)
127 {
128 RAND_add(data_buffer, total_length, total_length/2);
129 }
130 }
131 sys$gettim(iosb);
132 RAND_add((unsigned char *)iosb, sizeof(iosb), sizeof(iosb)/2);
133 return 1;
134}
135
136#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..30c69161ef
--- /dev/null
+++ b/src/lib/libcrypto/rand/rand_win.c
@@ -0,0 +1,747 @@
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/* Intel hardware RNG CSP -- available from
125 * http://developer.intel.com/design/security/rng/redist_license.htm
126 */
127#define PROV_INTEL_SEC 22
128#define INTEL_DEF_PROV L"Intel Hardware Cryptographic Service Provider"
129
130static void readtimer(void);
131static void readscreen(void);
132
133/* It appears like CURSORINFO, PCURSORINFO and LPCURSORINFO are only defined
134 when WINVER is 0x0500 and up, which currently only happens on Win2000.
135 Unfortunately, those are typedefs, so they're a little bit difficult to
136 detect properly. On the other hand, the macro CURSOR_SHOWING is defined
137 within the same conditional, so it can be use to detect the absence of said
138 typedefs. */
139
140#ifndef CURSOR_SHOWING
141/*
142 * Information about the global cursor.
143 */
144typedef struct tagCURSORINFO
145{
146 DWORD cbSize;
147 DWORD flags;
148 HCURSOR hCursor;
149 POINT ptScreenPos;
150} CURSORINFO, *PCURSORINFO, *LPCURSORINFO;
151
152#define CURSOR_SHOWING 0x00000001
153#endif /* CURSOR_SHOWING */
154
155typedef BOOL (WINAPI *CRYPTACQUIRECONTEXTW)(HCRYPTPROV *, LPCWSTR, LPCWSTR,
156 DWORD, DWORD);
157typedef BOOL (WINAPI *CRYPTGENRANDOM)(HCRYPTPROV, DWORD, BYTE *);
158typedef BOOL (WINAPI *CRYPTRELEASECONTEXT)(HCRYPTPROV, DWORD);
159
160typedef HWND (WINAPI *GETFOREGROUNDWINDOW)(VOID);
161typedef BOOL (WINAPI *GETCURSORINFO)(PCURSORINFO);
162typedef DWORD (WINAPI *GETQUEUESTATUS)(UINT);
163
164typedef HANDLE (WINAPI *CREATETOOLHELP32SNAPSHOT)(DWORD, DWORD);
165typedef BOOL (WINAPI *CLOSETOOLHELP32SNAPSHOT)(HANDLE);
166typedef BOOL (WINAPI *HEAP32FIRST)(LPHEAPENTRY32, DWORD, DWORD);
167typedef BOOL (WINAPI *HEAP32NEXT)(LPHEAPENTRY32);
168typedef BOOL (WINAPI *HEAP32LIST)(HANDLE, LPHEAPLIST32);
169typedef BOOL (WINAPI *PROCESS32)(HANDLE, LPPROCESSENTRY32);
170typedef BOOL (WINAPI *THREAD32)(HANDLE, LPTHREADENTRY32);
171typedef BOOL (WINAPI *MODULE32)(HANDLE, LPMODULEENTRY32);
172
173#include <lmcons.h>
174#ifndef OPENSSL_SYS_WINCE
175#include <lmstats.h>
176#endif
177#if 1 /* The NET API is Unicode only. It requires the use of the UNICODE
178 * macro. When UNICODE is defined LPTSTR becomes LPWSTR. LMSTR was
179 * was added to the Platform SDK to allow the NET API to be used in
180 * non-Unicode applications provided that Unicode strings were still
181 * used for input. LMSTR is defined as LPWSTR.
182 */
183typedef NET_API_STATUS (NET_API_FUNCTION * NETSTATGET)
184 (LPWSTR, LPWSTR, DWORD, DWORD, LPBYTE*);
185typedef NET_API_STATUS (NET_API_FUNCTION * NETFREE)(LPBYTE);
186#endif /* 1 */
187
188int RAND_poll(void)
189{
190 MEMORYSTATUS m;
191 HCRYPTPROV hProvider = 0;
192 BYTE buf[64];
193 DWORD w;
194 HWND h;
195
196 HMODULE advapi, kernel, user, netapi;
197 CRYPTACQUIRECONTEXTW acquire = 0;
198 CRYPTGENRANDOM gen = 0;
199 CRYPTRELEASECONTEXT release = 0;
200#if 1 /* There was previously a problem with NETSTATGET. Currently, this
201 * section is still experimental, but if all goes well, this conditional
202 * will be removed
203 */
204 NETSTATGET netstatget = 0;
205 NETFREE netfree = 0;
206#endif /* 1 */
207
208 /* Determine the OS version we are on so we can turn off things
209 * that do not work properly.
210 */
211 OSVERSIONINFO osverinfo ;
212 osverinfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO) ;
213 GetVersionEx( &osverinfo ) ;
214
215#if defined(OPENSSL_SYS_WINCE) && WCEPLATFORM!=MS_HPC_PRO
216#ifndef CryptAcquireContext
217#define CryptAcquireContext CryptAcquireContextW
218#endif
219 /* poll the CryptoAPI PRNG */
220 /* The CryptoAPI returns sizeof(buf) bytes of randomness */
221 if (CryptAcquireContext(&hProvider, 0, 0, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT))
222 {
223 if (CryptGenRandom(hProvider, sizeof(buf), buf))
224 RAND_add(buf, sizeof(buf), sizeof(buf));
225 CryptReleaseContext(hProvider, 0);
226 }
227#endif
228
229#ifndef OPENSSL_SYS_WINCE
230 /*
231 * None of below libraries are present on Windows CE, which is
232 * why we #ifndef the whole section. This also excuses us from
233 * handling the GetProcAddress issue. The trouble is that in
234 * real Win32 API GetProcAddress is available in ANSI flavor
235 * only. In WinCE on the other hand GetProcAddress is a macro
236 * most commonly defined as GetProcAddressW, which accepts
237 * Unicode argument. If we were to call GetProcAddress under
238 * WinCE, I'd recommend to either redefine GetProcAddress as
239 * GetProcAddressA (there seem to be one in common CE spec) or
240 * implement own shim routine, which would accept ANSI argument
241 * and expand it to Unicode.
242 */
243
244 /* load functions dynamically - not available on all systems */
245 advapi = LoadLibrary(TEXT("ADVAPI32.DLL"));
246 kernel = LoadLibrary(TEXT("KERNEL32.DLL"));
247 user = LoadLibrary(TEXT("USER32.DLL"));
248 netapi = LoadLibrary(TEXT("NETAPI32.DLL"));
249
250#if 1 /* There was previously a problem with NETSTATGET. Currently, this
251 * section is still experimental, but if all goes well, this conditional
252 * will be removed
253 */
254 if (netapi)
255 {
256 netstatget = (NETSTATGET) GetProcAddress(netapi,"NetStatisticsGet");
257 netfree = (NETFREE) GetProcAddress(netapi,"NetApiBufferFree");
258 }
259
260 if (netstatget && netfree)
261 {
262 LPBYTE outbuf;
263 /* NetStatisticsGet() is a Unicode only function
264 * STAT_WORKSTATION_0 contains 45 fields and STAT_SERVER_0
265 * contains 17 fields. We treat each field as a source of
266 * one byte of entropy.
267 */
268
269 if (netstatget(NULL, L"LanmanWorkstation", 0, 0, &outbuf) == 0)
270 {
271 RAND_add(outbuf, sizeof(STAT_WORKSTATION_0), 45);
272 netfree(outbuf);
273 }
274 if (netstatget(NULL, L"LanmanServer", 0, 0, &outbuf) == 0)
275 {
276 RAND_add(outbuf, sizeof(STAT_SERVER_0), 17);
277 netfree(outbuf);
278 }
279 }
280
281 if (netapi)
282 FreeLibrary(netapi);
283#endif /* 1 */
284
285 /* It appears like this can cause an exception deep within ADVAPI32.DLL
286 * at random times on Windows 2000. Reported by Jeffrey Altman.
287 * Only use it on NT.
288 */
289 /* Wolfgang Marczy <WMarczy@topcall.co.at> reports that
290 * the RegQueryValueEx call below can hang on NT4.0 (SP6).
291 * So we don't use this at all for now. */
292#if 0
293 if ( osverinfo.dwPlatformId == VER_PLATFORM_WIN32_NT &&
294 osverinfo.dwMajorVersion < 5)
295 {
296 /* Read Performance Statistics from NT/2000 registry
297 * The size of the performance data can vary from call
298 * to call so we must guess the size of the buffer to use
299 * and increase its size if we get an ERROR_MORE_DATA
300 * return instead of ERROR_SUCCESS.
301 */
302 LONG rc=ERROR_MORE_DATA;
303 char * buf=NULL;
304 DWORD bufsz=0;
305 DWORD length;
306
307 while (rc == ERROR_MORE_DATA)
308 {
309 buf = realloc(buf,bufsz+8192);
310 if (!buf)
311 break;
312 bufsz += 8192;
313
314 length = bufsz;
315 rc = RegQueryValueEx(HKEY_PERFORMANCE_DATA, TEXT("Global"),
316 NULL, NULL, buf, &length);
317 }
318 if (rc == ERROR_SUCCESS)
319 {
320 /* For entropy count assume only least significant
321 * byte of each DWORD is random.
322 */
323 RAND_add(&length, sizeof(length), 0);
324 RAND_add(buf, length, length / 4.0);
325
326 /* Close the Registry Key to allow Windows to cleanup/close
327 * the open handle
328 * Note: The 'HKEY_PERFORMANCE_DATA' key is implicitly opened
329 * when the RegQueryValueEx above is done. However, if
330 * it is not explicitly closed, it can cause disk
331 * partition manipulation problems.
332 */
333 RegCloseKey(HKEY_PERFORMANCE_DATA);
334 }
335 if (buf)
336 free(buf);
337 }
338#endif
339
340 if (advapi)
341 {
342 /*
343 * If it's available, then it's available in both ANSI
344 * and UNICODE flavors even in Win9x, documentation says.
345 * We favor Unicode...
346 */
347 acquire = (CRYPTACQUIRECONTEXTW) GetProcAddress(advapi,
348 "CryptAcquireContextW");
349 gen = (CRYPTGENRANDOM) GetProcAddress(advapi,
350 "CryptGenRandom");
351 release = (CRYPTRELEASECONTEXT) GetProcAddress(advapi,
352 "CryptReleaseContext");
353 }
354
355 if (acquire && gen && release)
356 {
357 /* poll the CryptoAPI PRNG */
358 /* The CryptoAPI returns sizeof(buf) bytes of randomness */
359 if (acquire(&hProvider, 0, 0, PROV_RSA_FULL,
360 CRYPT_VERIFYCONTEXT))
361 {
362 if (gen(hProvider, sizeof(buf), buf) != 0)
363 {
364 RAND_add(buf, sizeof(buf), 0);
365#if 0
366 printf("randomness from PROV_RSA_FULL\n");
367#endif
368 }
369 release(hProvider, 0);
370 }
371
372 /* poll the Pentium PRG with CryptoAPI */
373 if (acquire(&hProvider, 0, INTEL_DEF_PROV, PROV_INTEL_SEC, 0))
374 {
375 if (gen(hProvider, sizeof(buf), buf) != 0)
376 {
377 RAND_add(buf, sizeof(buf), sizeof(buf));
378#if 0
379 printf("randomness from PROV_INTEL_SEC\n");
380#endif
381 }
382 release(hProvider, 0);
383 }
384 }
385
386 if (advapi)
387 FreeLibrary(advapi);
388
389 if (user)
390 {
391 GETCURSORINFO cursor;
392 GETFOREGROUNDWINDOW win;
393 GETQUEUESTATUS queue;
394
395 win = (GETFOREGROUNDWINDOW) GetProcAddress(user, "GetForegroundWindow");
396 cursor = (GETCURSORINFO) GetProcAddress(user, "GetCursorInfo");
397 queue = (GETQUEUESTATUS) GetProcAddress(user, "GetQueueStatus");
398
399 if (win)
400 {
401 /* window handle */
402 h = win();
403 RAND_add(&h, sizeof(h), 0);
404 }
405 if (cursor)
406 {
407 /* unfortunately, its not safe to call GetCursorInfo()
408 * on NT4 even though it exists in SP3 (or SP6) and
409 * higher.
410 */
411 if ( osverinfo.dwPlatformId == VER_PLATFORM_WIN32_NT &&
412 osverinfo.dwMajorVersion < 5)
413 cursor = 0;
414 }
415 if (cursor)
416 {
417 /* cursor position */
418 /* assume 2 bytes of entropy */
419 CURSORINFO ci;
420 ci.cbSize = sizeof(CURSORINFO);
421 if (cursor(&ci))
422 RAND_add(&ci, ci.cbSize, 2);
423 }
424
425 if (queue)
426 {
427 /* message queue status */
428 /* assume 1 byte of entropy */
429 w = queue(QS_ALLEVENTS);
430 RAND_add(&w, sizeof(w), 1);
431 }
432
433 FreeLibrary(user);
434 }
435
436 /* Toolhelp32 snapshot: enumerate processes, threads, modules and heap
437 * http://msdn.microsoft.com/library/psdk/winbase/toolhelp_5pfd.htm
438 * (Win 9x and 2000 only, not available on NT)
439 *
440 * This seeding method was proposed in Peter Gutmann, Software
441 * Generation of Practically Strong Random Numbers,
442 * http://www.usenix.org/publications/library/proceedings/sec98/gutmann.html
443 * revised version at http://www.cryptoengines.com/~peter/06_random.pdf
444 * (The assignment of entropy estimates below is arbitrary, but based
445 * on Peter's analysis the full poll appears to be safe. Additional
446 * interactive seeding is encouraged.)
447 */
448
449 if (kernel)
450 {
451 CREATETOOLHELP32SNAPSHOT snap;
452 CLOSETOOLHELP32SNAPSHOT close_snap;
453 HANDLE handle;
454
455 HEAP32FIRST heap_first;
456 HEAP32NEXT heap_next;
457 HEAP32LIST heaplist_first, heaplist_next;
458 PROCESS32 process_first, process_next;
459 THREAD32 thread_first, thread_next;
460 MODULE32 module_first, module_next;
461
462 HEAPLIST32 hlist;
463 HEAPENTRY32 hentry;
464 PROCESSENTRY32 p;
465 THREADENTRY32 t;
466 MODULEENTRY32 m;
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 hlist.dwSize = sizeof(HEAPLIST32);
498 if (heaplist_first(handle, &hlist))
499 do
500 {
501 RAND_add(&hlist, hlist.dwSize, 3);
502 hentry.dwSize = sizeof(HEAPENTRY32);
503 if (heap_first(&hentry,
504 hlist.th32ProcessID,
505 hlist.th32HeapID))
506 {
507 int entrycnt = 80;
508 do
509 RAND_add(&hentry,
510 hentry.dwSize, 5);
511 while (heap_next(&hentry)
512 && --entrycnt > 0);
513 }
514 } while (heaplist_next(handle,
515 &hlist));
516
517 /* process walking */
518 /* PROCESSENTRY32 contains 9 fields that will change
519 * with each entry. Consider each field a source of
520 * 1 byte of entropy.
521 */
522 p.dwSize = sizeof(PROCESSENTRY32);
523 if (process_first(handle, &p))
524 do
525 RAND_add(&p, p.dwSize, 9);
526 while (process_next(handle, &p));
527
528 /* thread walking */
529 /* THREADENTRY32 contains 6 fields that will change
530 * with each entry. Consider each field a source of
531 * 1 byte of entropy.
532 */
533 t.dwSize = sizeof(THREADENTRY32);
534 if (thread_first(handle, &t))
535 do
536 RAND_add(&t, t.dwSize, 6);
537 while (thread_next(handle, &t));
538
539 /* module walking */
540 /* MODULEENTRY32 contains 9 fields that will change
541 * with each entry. Consider each field a source of
542 * 1 byte of entropy.
543 */
544 m.dwSize = sizeof(MODULEENTRY32);
545 if (module_first(handle, &m))
546 do
547 RAND_add(&m, m.dwSize, 9);
548 while (module_next(handle, &m));
549 if (close_snap)
550 close_snap(handle);
551 else
552 CloseHandle(handle);
553 }
554
555 FreeLibrary(kernel);
556 }
557#endif /* !OPENSSL_SYS_WINCE */
558
559 /* timer data */
560 readtimer();
561
562 /* memory usage statistics */
563 GlobalMemoryStatus(&m);
564 RAND_add(&m, sizeof(m), 1);
565
566 /* process ID */
567 w = GetCurrentProcessId();
568 RAND_add(&w, sizeof(w), 1);
569
570#if 0
571 printf("Exiting RAND_poll\n");
572#endif
573
574 return(1);
575}
576
577int RAND_event(UINT iMsg, WPARAM wParam, LPARAM lParam)
578 {
579 double add_entropy=0;
580
581 switch (iMsg)
582 {
583 case WM_KEYDOWN:
584 {
585 static WPARAM key;
586 if (key != wParam)
587 add_entropy = 0.05;
588 key = wParam;
589 }
590 break;
591 case WM_MOUSEMOVE:
592 {
593 static int lastx,lasty,lastdx,lastdy;
594 int x,y,dx,dy;
595
596 x=LOWORD(lParam);
597 y=HIWORD(lParam);
598 dx=lastx-x;
599 dy=lasty-y;
600 if (dx != 0 && dy != 0 && dx-lastdx != 0 && dy-lastdy != 0)
601 add_entropy=.2;
602 lastx=x, lasty=y;
603 lastdx=dx, lastdy=dy;
604 }
605 break;
606 }
607
608 readtimer();
609 RAND_add(&iMsg, sizeof(iMsg), add_entropy);
610 RAND_add(&wParam, sizeof(wParam), 0);
611 RAND_add(&lParam, sizeof(lParam), 0);
612
613 return (RAND_status());
614 }
615
616
617void RAND_screen(void) /* function available for backward compatibility */
618{
619 RAND_poll();
620 readscreen();
621}
622
623
624/* feed timing information to the PRNG */
625static void readtimer(void)
626{
627 DWORD w;
628 LARGE_INTEGER l;
629 static int have_perfc = 1;
630#if defined(_MSC_VER) && defined(_M_X86)
631 static int have_tsc = 1;
632 DWORD cyclecount;
633
634 if (have_tsc) {
635 __try {
636 __asm {
637 _emit 0x0f
638 _emit 0x31
639 mov cyclecount, eax
640 }
641 RAND_add(&cyclecount, sizeof(cyclecount), 1);
642 } __except(EXCEPTION_EXECUTE_HANDLER) {
643 have_tsc = 0;
644 }
645 }
646#else
647# define have_tsc 0
648#endif
649
650 if (have_perfc) {
651 if (QueryPerformanceCounter(&l) == 0)
652 have_perfc = 0;
653 else
654 RAND_add(&l, sizeof(l), 0);
655 }
656
657 if (!have_tsc && !have_perfc) {
658 w = GetTickCount();
659 RAND_add(&w, sizeof(w), 0);
660 }
661}
662
663/* feed screen contents to PRNG */
664/*****************************************************************************
665 *
666 * Created 960901 by Gertjan van Oosten, gertjan@West.NL, West Consulting B.V.
667 *
668 * Code adapted from
669 * <URL:http://support.microsoft.com/default.aspx?scid=kb;[LN];97193>;
670 * the original copyright message is:
671 *
672 * (C) Copyright Microsoft Corp. 1993. All rights reserved.
673 *
674 * You have a royalty-free right to use, modify, reproduce and
675 * distribute the Sample Files (and/or any modified version) in
676 * any way you find useful, provided that you agree that
677 * Microsoft has no warranty obligations or liability for any
678 * Sample Application Files which are modified.
679 */
680
681static void readscreen(void)
682{
683#if !defined(OPENSSL_SYS_WINCE) && !defined(OPENSSL_SYS_WIN32_CYGWIN)
684 HDC hScrDC; /* screen DC */
685 HDC hMemDC; /* memory DC */
686 HBITMAP hBitmap; /* handle for our bitmap */
687 HBITMAP hOldBitmap; /* handle for previous bitmap */
688 BITMAP bm; /* bitmap properties */
689 unsigned int size; /* size of bitmap */
690 char *bmbits; /* contents of bitmap */
691 int w; /* screen width */
692 int h; /* screen height */
693 int y; /* y-coordinate of screen lines to grab */
694 int n = 16; /* number of screen lines to grab at a time */
695
696 /* Create a screen DC and a memory DC compatible to screen DC */
697 hScrDC = CreateDC(TEXT("DISPLAY"), NULL, NULL, NULL);
698 hMemDC = CreateCompatibleDC(hScrDC);
699
700 /* Get screen resolution */
701 w = GetDeviceCaps(hScrDC, HORZRES);
702 h = GetDeviceCaps(hScrDC, VERTRES);
703
704 /* Create a bitmap compatible with the screen DC */
705 hBitmap = CreateCompatibleBitmap(hScrDC, w, n);
706
707 /* Select new bitmap into memory DC */
708 hOldBitmap = SelectObject(hMemDC, hBitmap);
709
710 /* Get bitmap properties */
711 GetObject(hBitmap, sizeof(BITMAP), (LPSTR)&bm);
712 size = (unsigned int)bm.bmWidthBytes * bm.bmHeight * bm.bmPlanes;
713
714 bmbits = OPENSSL_malloc(size);
715 if (bmbits) {
716 /* Now go through the whole screen, repeatedly grabbing n lines */
717 for (y = 0; y < h-n; y += n)
718 {
719 unsigned char md[MD_DIGEST_LENGTH];
720
721 /* Bitblt screen DC to memory DC */
722 BitBlt(hMemDC, 0, 0, w, n, hScrDC, 0, y, SRCCOPY);
723
724 /* Copy bitmap bits from memory DC to bmbits */
725 GetBitmapBits(hBitmap, size, bmbits);
726
727 /* Get the hash of the bitmap */
728 MD(bmbits,size,md);
729
730 /* Seed the random generator with the hash value */
731 RAND_add(md, MD_DIGEST_LENGTH, 0);
732 }
733
734 OPENSSL_free(bmbits);
735 }
736
737 /* Select old bitmap back into memory DC */
738 hBitmap = SelectObject(hMemDC, hOldBitmap);
739
740 /* Clean up */
741 DeleteObject(hBitmap);
742 DeleteDC(hMemDC);
743 DeleteDC(hScrDC);
744#endif /* !OPENSSL_SYS_WINCE */
745}
746
747#endif
diff --git a/src/lib/libcrypto/rand/randfile.c b/src/lib/libcrypto/rand/randfile.c
index 7183fa32e4..9bd89ba495 100644
--- a/src/lib/libcrypto/rand/randfile.c
+++ b/src/lib/libcrypto/rand/randfile.c
@@ -57,7 +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#define _XOPEN_SOURCE 500 60#define _XOPEN_SOURCE 1
61 61
62#include <errno.h> 62#include <errno.h>
63#include <stdio.h> 63#include <stdio.h>
@@ -233,7 +233,7 @@ const char *RAND_file_name(char *buf, size_t size)
233 struct stat sb; 233 struct stat sb;
234#endif 234#endif
235 235
236 if (OPENSSL_issetugid() == 0) 236 if (issetugid() == 0)
237 s=getenv("RANDFILE"); 237 s=getenv("RANDFILE");
238 if (s != NULL && *s && strlen(s) + 1 < size) 238 if (s != NULL && *s && strlen(s) + 1 < size)
239 { 239 {
@@ -242,7 +242,7 @@ const char *RAND_file_name(char *buf, size_t size)
242 } 242 }
243 else 243 else
244 { 244 {
245 if (OPENSSL_issetugid() == 0) 245 if (issetugid() == 0)
246 s=getenv("HOME"); 246 s=getenv("HOME");
247#ifdef DEFAULT_HOME 247#ifdef DEFAULT_HOME
248 if (s == NULL) 248 if (s == NULL)
diff --git a/src/lib/libcrypto/rand/randtest.c b/src/lib/libcrypto/rand/randtest.c
new file mode 100644
index 0000000000..701932e6ee
--- /dev/null
+++ b/src/lib/libcrypto/rand/randtest.c
@@ -0,0 +1,216 @@
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()
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 EXIT(err);
215 return(err);
216 }
diff --git a/src/lib/libcrypto/rc2/Makefile b/src/lib/libcrypto/rc2/Makefile
new file mode 100644
index 0000000000..34080ab741
--- /dev/null
+++ b/src/lib/libcrypto/rc2/Makefile
@@ -0,0 +1,92 @@
1#
2# OpenSSL/crypto/rc2/Makefile
3#
4
5DIR= rc2
6TOP= ../..
7CC= cc
8INCLUDES=
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
18CFLAGS= $(INCLUDES) $(CFLAG)
19
20GENERAL=Makefile
21TEST=rc2test.c
22APPS=
23
24LIB=$(TOP)/libcrypto.a
25LIBSRC=rc2_ecb.c rc2_skey.c rc2_cbc.c rc2cfb64.c rc2ofb64.c
26LIBOBJ=rc2_ecb.o rc2_skey.o rc2_cbc.o rc2cfb64.o rc2ofb64.o
27
28SRC= $(LIBSRC)
29
30EXHEADER= rc2.h
31HEADER= rc2_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
45files:
46 $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
47
48links:
49 @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
50 @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
51 @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
52
53install:
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 $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(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
80rc2_cbc.o: ../../include/openssl/opensslconf.h ../../include/openssl/rc2.h
81rc2_cbc.o: rc2_cbc.c rc2_locl.h
82rc2_ecb.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
83rc2_ecb.o: ../../include/openssl/rc2.h rc2_ecb.c rc2_locl.h
84rc2_skey.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
85rc2_skey.o: ../../include/openssl/fips.h ../../include/openssl/opensslconf.h
86rc2_skey.o: ../../include/openssl/opensslv.h ../../include/openssl/rc2.h
87rc2_skey.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
88rc2_skey.o: ../../include/openssl/symhacks.h rc2_locl.h rc2_skey.c
89rc2cfb64.o: ../../include/openssl/opensslconf.h ../../include/openssl/rc2.h
90rc2cfb64.o: rc2_locl.h rc2cfb64.c
91rc2ofb64.o: ../../include/openssl/opensslconf.h ../../include/openssl/rc2.h
92rc2ofb64.o: rc2_locl.h rc2ofb64.c
diff --git a/src/lib/libcrypto/rc2/Makefile.ssl b/src/lib/libcrypto/rc2/Makefile.ssl
new file mode 100644
index 0000000000..98d5960d5d
--- /dev/null
+++ b/src/lib/libcrypto/rc2/Makefile.ssl
@@ -0,0 +1,91 @@
1#
2# SSLeay/crypto/rc2/Makefile
3#
4
5DIR= rc2
6TOP= ../..
7CC= cc
8INCLUDES=
9CFLAG=-g
10INSTALL_PREFIX=
11OPENSSLDIR= /usr/local/ssl
12INSTALLTOP=/usr/local/ssl
13MAKE= make -f Makefile.ssl
14MAKEDEPPROG= makedepend
15MAKEDEPEND= $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG)
16MAKEFILE= Makefile.ssl
17AR= ar r
18
19CFLAGS= $(INCLUDES) $(CFLAG)
20
21GENERAL=Makefile
22TEST=rc2test.c
23APPS=
24
25LIB=$(TOP)/libcrypto.a
26LIBSRC=rc2_ecb.c rc2_skey.c rc2_cbc.c rc2cfb64.c rc2ofb64.c
27LIBOBJ=rc2_ecb.o rc2_skey.o rc2_cbc.o rc2cfb64.o rc2ofb64.o
28
29SRC= $(LIBSRC)
30
31EXHEADER= rc2.h
32HEADER= rc2_locl.h $(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.ssl >> $(TOP)/MINFO
48
49links:
50 @sh $(TOP)/util/point.sh Makefile.ssl Makefile
51 @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
52 @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
53 @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
54
55install:
56 @for i in $(EXHEADER) ; \
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 $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
72
73dclean:
74 $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
75 mv -f Makefile.new $(MAKEFILE)
76
77clean:
78 rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
79
80# DO NOT DELETE THIS LINE -- make depend depends on it.
81
82rc2_cbc.o: ../../include/openssl/opensslconf.h ../../include/openssl/rc2.h
83rc2_cbc.o: rc2_cbc.c rc2_locl.h
84rc2_ecb.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
85rc2_ecb.o: ../../include/openssl/rc2.h rc2_ecb.c rc2_locl.h
86rc2_skey.o: ../../include/openssl/opensslconf.h ../../include/openssl/rc2.h
87rc2_skey.o: rc2_locl.h rc2_skey.c
88rc2cfb64.o: ../../include/openssl/opensslconf.h ../../include/openssl/rc2.h
89rc2cfb64.o: rc2_locl.h rc2cfb64.c
90rc2ofb64.o: ../../include/openssl/opensslconf.h ../../include/openssl/rc2.h
91rc2ofb64.o: rc2_locl.h rc2ofb64.c
diff --git a/src/lib/libcrypto/rc2/rc2_skey.c b/src/lib/libcrypto/rc2/rc2_skey.c
index 9652865188..22f372f85c 100644
--- a/src/lib/libcrypto/rc2/rc2_skey.c
+++ b/src/lib/libcrypto/rc2/rc2_skey.c
@@ -58,7 +58,6 @@
58 58
59#include <openssl/rc2.h> 59#include <openssl/rc2.h>
60#include <openssl/crypto.h> 60#include <openssl/crypto.h>
61#include <openssl/fips.h>
62#include "rc2_locl.h" 61#include "rc2_locl.h"
63 62
64static unsigned char key_table[256]={ 63static unsigned char key_table[256]={
diff --git a/src/lib/libcrypto/rc2/rc2speed.c b/src/lib/libcrypto/rc2/rc2speed.c
new file mode 100644
index 0000000000..47d34b444e
--- /dev/null
+++ b/src/lib/libcrypto/rc2/rc2speed.c
@@ -0,0 +1,274 @@
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#include <signal.h>
73#ifndef _IRIX
74#include <time.h>
75#endif
76#ifdef TIMES
77#include <sys/types.h>
78#include <sys/times.h>
79#endif
80
81/* Depending on the VMS version, the tms structure is perhaps defined.
82 The __TMS macro will show if it was. If it wasn't defined, we should
83 undefine TIMES, since that tells the rest of the program how things
84 should be handled. -- Richard Levitte */
85#if defined(OPENSSL_SYS_VMS_DECC) && !defined(__TMS)
86#undef TIMES
87#endif
88
89#ifndef TIMES
90#include <sys/timeb.h>
91#endif
92
93#if defined(sun) || defined(__ultrix)
94#define _POSIX_SOURCE
95#include <limits.h>
96#include <sys/param.h>
97#endif
98
99#include <openssl/rc2.h>
100
101/* The following if from times(3) man page. It may need to be changed */
102#ifndef HZ
103#ifndef CLK_TCK
104#define HZ 100.0
105#endif
106#else /* CLK_TCK */
107#define HZ ((double)CLK_TCK)
108#endif
109
110#define BUFSIZE ((long)1024)
111long run=0;
112
113double Time_F(int s);
114#ifdef SIGALRM
115#if defined(__STDC__) || defined(sgi) || defined(_AIX)
116#define SIGRETTYPE void
117#else
118#define SIGRETTYPE int
119#endif
120
121SIGRETTYPE sig_done(int sig);
122SIGRETTYPE sig_done(int sig)
123 {
124 signal(SIGALRM,sig_done);
125 run=0;
126#ifdef LINT
127 sig=sig;
128#endif
129 }
130#endif
131
132#define START 0
133#define STOP 1
134
135double Time_F(int s)
136 {
137 double ret;
138#ifdef TIMES
139 static struct tms tstart,tend;
140
141 if (s == START)
142 {
143 times(&tstart);
144 return(0);
145 }
146 else
147 {
148 times(&tend);
149 ret=((double)(tend.tms_utime-tstart.tms_utime))/HZ;
150 return((ret == 0.0)?1e-6:ret);
151 }
152#else /* !times() */
153 static struct timeb tstart,tend;
154 long i;
155
156 if (s == START)
157 {
158 ftime(&tstart);
159 return(0);
160 }
161 else
162 {
163 ftime(&tend);
164 i=(long)tend.millitm-(long)tstart.millitm;
165 ret=((double)(tend.time-tstart.time))+((double)i)/1e3;
166 return((ret == 0.0)?1e-6:ret);
167 }
168#endif
169 }
170
171int main(int argc, char **argv)
172 {
173 long count;
174 static unsigned char buf[BUFSIZE];
175 static unsigned char key[] ={
176 0x12,0x34,0x56,0x78,0x9a,0xbc,0xde,0xf0,
177 0xfe,0xdc,0xba,0x98,0x76,0x54,0x32,0x10,
178 };
179 RC2_KEY sch;
180 double a,b,c,d;
181#ifndef SIGALRM
182 long ca,cb,cc;
183#endif
184
185#ifndef TIMES
186 printf("To get the most accurate results, try to run this\n");
187 printf("program when this computer is idle.\n");
188#endif
189
190#ifndef SIGALRM
191 printf("First we calculate the approximate speed ...\n");
192 RC2_set_key(&sch,16,key,128);
193 count=10;
194 do {
195 long i;
196 unsigned long data[2];
197
198 count*=2;
199 Time_F(START);
200 for (i=count; i; i--)
201 RC2_encrypt(data,&sch);
202 d=Time_F(STOP);
203 } while (d < 3.0);
204 ca=count/512;
205 cb=count;
206 cc=count*8/BUFSIZE+1;
207 printf("Doing RC2_set_key %ld times\n",ca);
208#define COND(d) (count != (d))
209#define COUNT(d) (d)
210#else
211#define COND(c) (run)
212#define COUNT(d) (count)
213 signal(SIGALRM,sig_done);
214 printf("Doing RC2_set_key for 10 seconds\n");
215 alarm(10);
216#endif
217
218 Time_F(START);
219 for (count=0,run=1; COND(ca); count+=4)
220 {
221 RC2_set_key(&sch,16,key,128);
222 RC2_set_key(&sch,16,key,128);
223 RC2_set_key(&sch,16,key,128);
224 RC2_set_key(&sch,16,key,128);
225 }
226 d=Time_F(STOP);
227 printf("%ld RC2_set_key's in %.2f seconds\n",count,d);
228 a=((double)COUNT(ca))/d;
229
230#ifdef SIGALRM
231 printf("Doing RC2_encrypt's for 10 seconds\n");
232 alarm(10);
233#else
234 printf("Doing RC2_encrypt %ld times\n",cb);
235#endif
236 Time_F(START);
237 for (count=0,run=1; COND(cb); count+=4)
238 {
239 unsigned long data[2];
240
241 RC2_encrypt(data,&sch);
242 RC2_encrypt(data,&sch);
243 RC2_encrypt(data,&sch);
244 RC2_encrypt(data,&sch);
245 }
246 d=Time_F(STOP);
247 printf("%ld RC2_encrypt's in %.2f second\n",count,d);
248 b=((double)COUNT(cb)*8)/d;
249
250#ifdef SIGALRM
251 printf("Doing RC2_cbc_encrypt on %ld byte blocks for 10 seconds\n",
252 BUFSIZE);
253 alarm(10);
254#else
255 printf("Doing RC2_cbc_encrypt %ld times on %ld byte blocks\n",cc,
256 BUFSIZE);
257#endif
258 Time_F(START);
259 for (count=0,run=1; COND(cc); count++)
260 RC2_cbc_encrypt(buf,buf,BUFSIZE,&sch,
261 &(key[0]),RC2_ENCRYPT);
262 d=Time_F(STOP);
263 printf("%ld RC2_cbc_encrypt's of %ld byte blocks in %.2f second\n",
264 count,BUFSIZE,d);
265 c=((double)COUNT(cc)*BUFSIZE)/d;
266
267 printf("RC2 set_key per sec = %12.2f (%9.3fuS)\n",a,1.0e6/a);
268 printf("RC2 raw ecb bytes per sec = %12.2f (%9.3fuS)\n",b,8.0e6/b);
269 printf("RC2 cbc bytes per sec = %12.2f (%9.3fuS)\n",c,8.0e6/c);
270 exit(0);
271#if defined(LINT) || defined(OPENSSL_SYS_MSDOS)
272 return(0);
273#endif
274 }
diff --git a/src/lib/libcrypto/rc2/rc2test.c b/src/lib/libcrypto/rc2/rc2test.c
new file mode 100644
index 0000000000..b67bafb49f
--- /dev/null
+++ b/src/lib/libcrypto/rc2/rc2test.c
@@ -0,0 +1,271 @@
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 EXIT(err);
209 return(err);
210 }
211
212#ifdef undef
213static int cfb64_test(unsigned char *cfb_cipher)
214 {
215 IDEA_KEY_SCHEDULE eks,dks;
216 int err=0,i,n;
217
218 idea_set_encrypt_key(cfb_key,&eks);
219 idea_set_decrypt_key(&eks,&dks);
220 memcpy(cfb_tmp,cfb_iv,8);
221 n=0;
222 idea_cfb64_encrypt(plain,cfb_buf1,(long)12,&eks,
223 cfb_tmp,&n,IDEA_ENCRYPT);
224 idea_cfb64_encrypt(&(plain[12]),&(cfb_buf1[12]),
225 (long)CFB_TEST_SIZE-12,&eks,
226 cfb_tmp,&n,IDEA_ENCRYPT);
227 if (memcmp(cfb_cipher,cfb_buf1,CFB_TEST_SIZE) != 0)
228 {
229 err=1;
230 printf("idea_cfb64_encrypt encrypt error\n");
231 for (i=0; i<CFB_TEST_SIZE; i+=8)
232 printf("%s\n",pt(&(cfb_buf1[i])));
233 }
234 memcpy(cfb_tmp,cfb_iv,8);
235 n=0;
236 idea_cfb64_encrypt(cfb_buf1,cfb_buf2,(long)17,&eks,
237 cfb_tmp,&n,IDEA_DECRYPT);
238 idea_cfb64_encrypt(&(cfb_buf1[17]),&(cfb_buf2[17]),
239 (long)CFB_TEST_SIZE-17,&dks,
240 cfb_tmp,&n,IDEA_DECRYPT);
241 if (memcmp(plain,cfb_buf2,CFB_TEST_SIZE) != 0)
242 {
243 err=1;
244 printf("idea_cfb_encrypt decrypt error\n");
245 for (i=0; i<24; i+=8)
246 printf("%s\n",pt(&(cfb_buf2[i])));
247 }
248 return(err);
249 }
250
251static char *pt(unsigned char *p)
252 {
253 static char bufs[10][20];
254 static int bnum=0;
255 char *ret;
256 int i;
257 static char *f="0123456789ABCDEF";
258
259 ret= &(bufs[bnum++][0]);
260 bnum%=10;
261 for (i=0; i<8; i++)
262 {
263 ret[i*2]=f[(p[i]>>4)&0xf];
264 ret[i*2+1]=f[p[i]&0xf];
265 }
266 ret[16]='\0';
267 return(ret);
268 }
269
270#endif
271#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..20d078ec87
--- /dev/null
+++ b/src/lib/libcrypto/rc4/Makefile
@@ -0,0 +1,128 @@
1#
2# OpenSSL/crypto/rc4/Makefile
3#
4
5DIR= rc4
6TOP= ../..
7CC= cc
8CPP= $(CC) -E
9INCLUDES=
10CFLAG=-g
11INSTALL_PREFIX=
12OPENSSLDIR= /usr/local/ssl
13INSTALLTOP=/usr/local/ssl
14MAKEDEPPROG= makedepend
15MAKEDEPEND= $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG)
16MAKEFILE= Makefile
17AR= ar r
18
19RC4_ENC=rc4_enc.o
20# or use
21#RC4_ENC=asm/rx86-elf.o
22#RC4_ENC=asm/rx86-out.o
23#RC4_ENC=asm/rx86-sol.o
24#RC4_ENC=asm/rx86bdsi.o
25
26CFLAGS= $(INCLUDES) $(CFLAG)
27ASFLAGS= $(INCLUDES) $(ASFLAG)
28
29GENERAL=Makefile
30TEST=rc4test.c
31APPS=
32
33LIB=$(TOP)/libcrypto.a
34LIBSRC=rc4_skey.c rc4_enc.c
35LIBOBJ=rc4_skey.o $(RC4_ENC)
36
37SRC= $(LIBSRC)
38
39EXHEADER= rc4.h
40HEADER= $(EXHEADER) rc4_locl.h
41
42ALL= $(GENERAL) $(SRC) $(HEADER)
43
44top:
45 (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all)
46
47all: lib
48
49lib: $(LIBOBJ)
50 $(AR) $(LIB) $(LIBOBJ)
51 $(RANLIB) $(LIB) || echo Never mind.
52 @touch lib
53
54# elf
55asm/rx86-elf.s: asm/rc4-586.pl ../perlasm/x86asm.pl
56 (cd asm; $(PERL) rc4-586.pl elf $(CFLAGS) > rx86-elf.s)
57
58# a.out
59asm/rx86-out.o: asm/rx86unix.cpp
60 $(CPP) -DOUT asm/rx86unix.cpp | as -o asm/rx86-out.o
61
62# bsdi
63asm/rx86bsdi.o: asm/rx86unix.cpp
64 $(CPP) -DBSDI asm/rx86unix.cpp | sed 's/ :/:/' | as -o asm/rx86bsdi.o
65
66asm/rx86unix.cpp: asm/rc4-586.pl ../perlasm/x86asm.pl
67 (cd asm; $(PERL) rc4-586.pl cpp >rx86unix.cpp)
68
69asm/rc4-x86_64.s: asm/rc4-x86_64.pl; $(PERL) asm/rc4-x86_64.pl $@
70
71asm/rc4-ia64.s: asm/rc4-ia64.S
72 @case `awk '/^#define RC4_INT/{print$$NF}' $(TOP)/include/openssl/opensslconf.h` in \
73 int) set -x; $(CC) $(CFLAGS) -DSZ=4 -E asm/rc4-ia64.S > $@ ;; \
74 char) set -x; $(CC) $(CFLAGS) -DSZ=1 -E asm/rc4-ia64.S > $@ ;; \
75 *) exit 1 ;; \
76 esac
77
78files:
79 $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
80
81links:
82 @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
83 @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
84 @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
85
86install:
87 @headerlist="$(EXHEADER)"; for i in $$headerlist ; \
88 do \
89 (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
90 chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
91 done;
92
93tags:
94 ctags $(SRC)
95
96tests:
97
98lint:
99 lint -DLINT $(INCLUDES) $(SRC)>fluff
100
101depend:
102 $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
103
104dclean:
105 $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
106 mv -f Makefile.new $(MAKEFILE)
107
108clean:
109 rm -f asm/rx86unix.cpp asm/*-elf.* *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff asm/*.o
110
111# DO NOT DELETE THIS LINE -- make depend depends on it.
112
113rc4_enc.o: ../../e_os.h ../../include/openssl/bio.h
114rc4_enc.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
115rc4_enc.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
116rc4_enc.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
117rc4_enc.o: ../../include/openssl/opensslv.h ../../include/openssl/rc4.h
118rc4_enc.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
119rc4_enc.o: ../../include/openssl/symhacks.h ../cryptlib.h rc4_enc.c rc4_locl.h
120rc4_skey.o: ../../e_os.h ../../include/openssl/bio.h
121rc4_skey.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
122rc4_skey.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
123rc4_skey.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
124rc4_skey.o: ../../include/openssl/opensslconf.h
125rc4_skey.o: ../../include/openssl/opensslv.h ../../include/openssl/rc4.h
126rc4_skey.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
127rc4_skey.o: ../../include/openssl/symhacks.h ../cryptlib.h rc4_locl.h
128rc4_skey.o: rc4_skey.c
diff --git a/src/lib/libcrypto/rc4/Makefile.ssl b/src/lib/libcrypto/rc4/Makefile.ssl
new file mode 100644
index 0000000000..3e602662be
--- /dev/null
+++ b/src/lib/libcrypto/rc4/Makefile.ssl
@@ -0,0 +1,110 @@
1#
2# SSLeay/crypto/rc4/Makefile
3#
4
5DIR= rc4
6TOP= ../..
7CC= cc
8CPP= $(CC) -E
9INCLUDES=
10CFLAG=-g
11INSTALL_PREFIX=
12OPENSSLDIR= /usr/local/ssl
13INSTALLTOP=/usr/local/ssl
14MAKE= make -f Makefile.ssl
15MAKEDEPPROG= makedepend
16MAKEDEPEND= $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG)
17MAKEFILE= Makefile.ssl
18AR= ar r
19
20RC4_ENC=rc4_enc.o
21# or use
22#RC4_ENC=asm/rx86-elf.o
23#RC4_ENC=asm/rx86-out.o
24#RC4_ENC=asm/rx86-sol.o
25#RC4_ENC=asm/rx86bdsi.o
26
27CFLAGS= $(INCLUDES) $(CFLAG)
28ASFLAGS= $(INCLUDES) $(ASFLAG)
29
30GENERAL=Makefile
31TEST=rc4test.c
32APPS=
33
34LIB=$(TOP)/libcrypto.a
35LIBSRC=rc4_skey.c rc4_enc.c
36LIBOBJ=rc4_skey.o $(RC4_ENC)
37
38SRC= $(LIBSRC)
39
40EXHEADER= rc4.h
41HEADER= $(EXHEADER) rc4_locl.h
42
43ALL= $(GENERAL) $(SRC) $(HEADER)
44
45top:
46 (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all)
47
48all: lib
49
50lib: $(LIBOBJ)
51 $(AR) $(LIB) $(LIBOBJ)
52 $(RANLIB) $(LIB) || echo Never mind.
53 @touch lib
54
55# elf
56asm/rx86-elf.s: asm/rc4-586.pl ../perlasm/x86asm.pl
57 (cd asm; $(PERL) rc4-586.pl elf $(CFLAGS) > rx86-elf.s)
58
59# a.out
60asm/rx86-out.o: asm/rx86unix.cpp
61 $(CPP) -DOUT asm/rx86unix.cpp | as -o asm/rx86-out.o
62
63# bsdi
64asm/rx86bsdi.o: asm/rx86unix.cpp
65 $(CPP) -DBSDI asm/rx86unix.cpp | sed 's/ :/:/' | as -o asm/rx86bsdi.o
66
67asm/rx86unix.cpp: asm/rc4-586.pl ../perlasm/x86asm.pl
68 (cd asm; $(PERL) rc4-586.pl cpp >rx86unix.cpp)
69
70files:
71 $(PERL) $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO
72
73links:
74 @sh $(TOP)/util/point.sh Makefile.ssl Makefile
75 @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
76 @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
77 @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
78
79install:
80 @for i in $(EXHEADER) ; \
81 do \
82 (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
83 chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
84 done;
85
86tags:
87 ctags $(SRC)
88
89tests:
90
91lint:
92 lint -DLINT $(INCLUDES) $(SRC)>fluff
93
94depend:
95 $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
96
97dclean:
98 $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
99 mv -f Makefile.new $(MAKEFILE)
100
101clean:
102 rm -f asm/rx86unix.cpp asm/*-elf.* *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff asm/*.o
103
104# DO NOT DELETE THIS LINE -- make depend depends on it.
105
106rc4_enc.o: ../../include/openssl/opensslconf.h ../../include/openssl/rc4.h
107rc4_enc.o: rc4_enc.c rc4_locl.h
108rc4_skey.o: ../../include/openssl/opensslconf.h
109rc4_skey.o: ../../include/openssl/opensslv.h ../../include/openssl/rc4.h
110rc4_skey.o: rc4_locl.h rc4_skey.c
diff --git a/src/lib/libcrypto/rc4/asm/rc4-amd64.pl b/src/lib/libcrypto/rc4/asm/rc4-amd64.pl
new file mode 100755
index 0000000000..9e0da8af99
--- /dev/null
+++ b/src/lib/libcrypto/rc4/asm/rc4-amd64.pl
@@ -0,0 +1,227 @@
1#!/usr/bin/env perl
2#
3# ====================================================================
4# Written by Andy Polyakov <appro@fy.chalmers.se> for the OpenSSL
5# project. Rights for redistribution and usage in source and binary
6# forms are granted according to the OpenSSL license.
7# ====================================================================
8#
9# 2.22x RC4 tune-up:-) It should be noted though that my hand [as in
10# "hand-coded assembler"] doesn't stand for the whole improvement
11# coefficient. It turned out that eliminating RC4_CHAR from config
12# line results in ~40% improvement (yes, even for C implementation).
13# Presumably it has everything to do with AMD cache architecture and
14# RAW or whatever penalties. Once again! The module *requires* config
15# line *without* RC4_CHAR! As for coding "secret," I bet on partial
16# register arithmetics. For example instead of 'inc %r8; and $255,%r8'
17# I simply 'inc %r8b'. Even though optimization manual discourages
18# to operate on partial registers, it turned out to be the best bet.
19# At least for AMD... How IA32E would perform remains to be seen...
20
21# As was shown by Marc Bevand reordering of couple of load operations
22# results in even higher performance gain of 3.3x:-) At least on
23# Opteron... For reference, 1x in this case is RC4_CHAR C-code
24# compiled with gcc 3.3.2, which performs at ~54MBps per 1GHz clock.
25# Latter means that if you want to *estimate* what to expect from
26# *your* CPU, then multiply 54 by 3.3 and clock frequency in GHz.
27
28# Intel P4 EM64T core was found to run the AMD64 code really slow...
29# The only way to achieve comparable performance on P4 is to keep
30# RC4_CHAR. Kind of ironic, huh? As it's apparently impossible to
31# compose blended code, which would perform even within 30% marginal
32# on either AMD and Intel platforms, I implement both cases. See
33# rc4_skey.c for further details... This applies to 0.9.8 and later.
34# In 0.9.7 context RC4_CHAR codepath is never engaged and ~70 bytes
35# of code remain redundant.
36
37$output=shift;
38
39$win64a=1 if ($output =~ /win64a.[s|asm]/);
40
41open STDOUT,">$output" || die "can't open $output: $!";
42
43if (defined($win64a)) {
44 $dat="%rcx"; # arg1
45 $len="%rdx"; # arg2
46 $inp="%rsi"; # r8, arg3 moves here
47 $out="%rdi"; # r9, arg4 moves here
48} else {
49 $dat="%rdi"; # arg1
50 $len="%rsi"; # arg2
51 $inp="%rdx"; # arg3
52 $out="%rcx"; # arg4
53}
54
55$XX="%r10";
56$TX="%r8";
57$YY="%r11";
58$TY="%r9";
59
60sub PTR() {
61 my $ret=shift;
62 if (defined($win64a)) {
63 $ret =~ s/\[([\S]+)\+([\S]+)\]/[$2+$1]/g; # [%rN+%rM*4]->[%rM*4+%rN]
64 $ret =~ s/:([^\[]+)\[([^\]]+)\]/:[$2+$1]/g; # :off[ea]->:[ea+off]
65 } else {
66 $ret =~ s/[\+\*]/,/g; # [%rN+%rM*4]->[%rN,%rM,4]
67 $ret =~ s/\[([^\]]+)\]/($1)/g; # [%rN]->(%rN)
68 }
69 $ret;
70}
71
72$code=<<___ if (!defined($win64a));
73.text
74
75.globl RC4
76.type RC4,\@function
77.align 16
78RC4: or $len,$len
79 jne .Lentry
80 repret
81.Lentry:
82___
83$code=<<___ if (defined($win64a));
84_TEXT SEGMENT
85PUBLIC RC4
86ALIGN 16
87RC4 PROC
88 or $len,$len
89 jne .Lentry
90 repret
91.Lentry:
92 push %rdi
93 push %rsi
94 sub \$40,%rsp
95 mov %r8,$inp
96 mov %r9,$out
97___
98$code.=<<___;
99 add \$8,$dat
100 movl `&PTR("DWORD:-8[$dat]")`,$XX#d
101 movl `&PTR("DWORD:-4[$dat]")`,$YY#d
102 cmpl \$-1,`&PTR("DWORD:256[$dat]")`
103 je .LRC4_CHAR
104 test \$-8,$len
105 jz .Lloop1
106.align 16
107.Lloop8:
108 inc $XX#b
109 movl `&PTR("DWORD:[$dat+$XX*4]")`,$TX#d
110 add $TX#b,$YY#b
111 movl `&PTR("DWORD:[$dat+$YY*4]")`,$TY#d
112 movl $TX#d,`&PTR("DWORD:[$dat+$YY*4]")`
113 movl $TY#d,`&PTR("DWORD:[$dat+$XX*4]")`
114 add $TX#b,$TY#b
115 inc $XX#b
116 movl `&PTR("DWORD:[$dat+$XX*4]")`,$TX#d
117 movb `&PTR("BYTE:[$dat+$TY*4]")`,%al
118___
119for ($i=1;$i<=6;$i++) {
120$code.=<<___;
121 add $TX#b,$YY#b
122 ror \$8,%rax
123 movl `&PTR("DWORD:[$dat+$YY*4]")`,$TY#d
124 movl $TX#d,`&PTR("DWORD:[$dat+$YY*4]")`
125 movl $TY#d,`&PTR("DWORD:[$dat+$XX*4]")`
126 add $TX#b,$TY#b
127 inc $XX#b
128 movl `&PTR("DWORD:[$dat+$XX*4]")`,$TX#d
129 movb `&PTR("BYTE:[$dat+$TY*4]")`,%al
130___
131}
132$code.=<<___;
133 add $TX#b,$YY#b
134 ror \$8,%rax
135 movl `&PTR("DWORD:[$dat+$YY*4]")`,$TY#d
136 movl $TX#d,`&PTR("DWORD:[$dat+$YY*4]")`
137 movl $TY#d,`&PTR("DWORD:[$dat+$XX*4]")`
138 sub \$8,$len
139 add $TY#b,$TX#b
140 movb `&PTR("BYTE:[$dat+$TX*4]")`,%al
141 ror \$8,%rax
142 add \$8,$inp
143 add \$8,$out
144
145 xor `&PTR("QWORD:-8[$inp]")`,%rax
146 mov %rax,`&PTR("QWORD:-8[$out]")`
147
148 test \$-8,$len
149 jnz .Lloop8
150 cmp \$0,$len
151 jne .Lloop1
152.Lexit:
153 movl $XX#d,`&PTR("DWORD:-8[$dat]")`
154 movl $YY#d,`&PTR("DWORD:-4[$dat]")`
155___
156$code.=<<___ if (defined($win64a));
157 add \$40,%rsp
158 pop %rsi
159 pop %rdi
160___
161$code.=<<___;
162 repret
163.align 16
164.Lloop1:
165 movzb `&PTR("BYTE:[$inp]")`,%eax
166 inc $XX#b
167 movl `&PTR("DWORD:[$dat+$XX*4]")`,$TX#d
168 add $TX#b,$YY#b
169 movl `&PTR("DWORD:[$dat+$YY*4]")`,$TY#d
170 movl $TX#d,`&PTR("DWORD:[$dat+$YY*4]")`
171 movl $TY#d,`&PTR("DWORD:[$dat+$XX*4]")`
172 add $TY#b,$TX#b
173 movl `&PTR("DWORD:[$dat+$TX*4]")`,$TY#d
174 xor $TY,%rax
175 inc $inp
176 movb %al,`&PTR("BYTE:[$out]")`
177 inc $out
178 dec $len
179 jnz .Lloop1
180 jmp .Lexit
181
182.align 16
183.LRC4_CHAR:
184 inc $XX#b
185 movzb `&PTR("BYTE:[$dat+$XX]")`,$TX#d
186 add $TX#b,$YY#b
187 movzb `&PTR("BYTE:[$dat+$YY]")`,$TY#d
188 movb $TX#b,`&PTR("BYTE:[$dat+$YY]")`
189 movb $TY#b,`&PTR("BYTE:[$dat+$XX]")`
190 add $TX#b,$TY#b
191 movzb `&PTR("BYTE:[$dat+$TY]")`,$TY#d
192 xorb `&PTR("BYTE:[$inp]")`,$TY#b
193 movb $TY#b,`&PTR("BYTE:[$out]")`
194 inc $inp
195 inc $out
196 dec $len
197 jnz .LRC4_CHAR
198 jmp .Lexit
199___
200$code.=<<___ if (defined($win64a));
201RC4 ENDP
202_TEXT ENDS
203END
204___
205$code.=<<___ if (!defined($win64a));
206.size RC4,.-RC4
207___
208
209$code =~ s/#([bwd])/$1/gm;
210$code =~ s/\`([^\`]*)\`/eval $1/gem;
211
212if (defined($win64a)) {
213 $code =~ s/\.align/ALIGN/gm;
214 $code =~ s/[\$%]//gm;
215 $code =~ s/\.L/\$L/gm;
216 $code =~ s/([\w]+)([\s]+)([\S]+),([\S]+)/$1$2$4,$3/gm;
217 $code =~ s/([QD]*WORD|BYTE):/$1 PTR/gm;
218 $code =~ s/mov[bwlq]/mov/gm;
219 $code =~ s/movzb/movzx/gm;
220 $code =~ s/repret/DB\t0F3h,0C3h/gm;
221 $code =~ s/cmpl/cmp/gm;
222 $code =~ s/xorb/xor/gm;
223} else {
224 $code =~ s/([QD]*WORD|BYTE)://gm;
225 $code =~ s/repret/.byte\t0xF3,0xC3/gm;
226}
227print $code;
diff --git a/src/lib/libcrypto/rc4/asm/rc4-ia64.S b/src/lib/libcrypto/rc4/asm/rc4-ia64.S
new file mode 100644
index 0000000000..a322d0c718
--- /dev/null
+++ b/src/lib/libcrypto/rc4/asm/rc4-ia64.S
@@ -0,0 +1,160 @@
1// ====================================================================
2// Written by Andy Polyakov <appro@fy.chalmers.se> for the OpenSSL
3// project.
4//
5// Rights for redistribution and usage in source and binary forms are
6// granted according to the OpenSSL license. Warranty of any kind is
7// disclaimed.
8// ====================================================================
9
10.ident "rc4-ia64.S, Version 2.0"
11.ident "IA-64 ISA artwork by Andy Polyakov <appro@fy.chalmers.se>"
12
13// What's wrong with compiler generated code? Because of the nature of
14// C language, compiler doesn't [dare to] reorder load and stores. But
15// being memory-bound, RC4 should benefit from reorder [on in-order-
16// execution core such as IA-64]. But what can we reorder? At the very
17// least we can safely reorder references to key schedule in respect
18// to input and output streams. Secondly, from the first [close] glance
19// it appeared that it's possible to pull up some references to
20// elements of the key schedule itself. Original rationale ["prior
21// loads are not safe only for "degenerated" key schedule, when some
22// elements equal to the same value"] was kind of sloppy. I should have
23// formulated as it really was: if we assume that pulling up reference
24// to key[x+1] is not safe, then it would mean that key schedule would
25// "degenerate," which is never the case. The problem is that this
26// holds true in respect to references to key[x], but not to key[y].
27// Legitimate "collisions" do occur within every 256^2 bytes window.
28// Fortunately there're enough free instruction slots to keep prior
29// reference to key[x+1], detect "collision" and compensate for it.
30// All this without sacrificing a single clock cycle:-) Throughput is
31// ~210MBps on 900MHz CPU, which is is >3x faster than gcc generated
32// code and +30% - if compared to HP-UX C. Unrolling loop below should
33// give >30% on top of that...
34
35.text
36.explicit
37
38#if defined(_HPUX_SOURCE) && !defined(_LP64)
39# define ADDP addp4
40#else
41# define ADDP add
42#endif
43
44#ifndef SZ
45#define SZ 4 // this is set to sizeof(RC4_INT)
46#endif
47// SZ==4 seems to be optimal. At least SZ==8 is not any faster, not for
48// assembler implementation, while SZ==1 code is ~30% slower.
49#if SZ==1 // RC4_INT is unsigned char
50# define LDKEY ld1
51# define STKEY st1
52# define OFF 0
53#elif SZ==4 // RC4_INT is unsigned int
54# define LDKEY ld4
55# define STKEY st4
56# define OFF 2
57#elif SZ==8 // RC4_INT is unsigned long
58# define LDKEY ld8
59# define STKEY st8
60# define OFF 3
61#endif
62
63out=r8; // [expanded] output pointer
64inp=r9; // [expanded] output pointer
65prsave=r10;
66key=r28; // [expanded] pointer to RC4_KEY
67ksch=r29; // (key->data+255)[&~(sizeof(key->data)-1)]
68xx=r30;
69yy=r31;
70
71// void RC4(RC4_KEY *key,size_t len,const void *inp,void *out);
72.global RC4#
73.proc RC4#
74.align 32
75.skip 16
76RC4:
77 .prologue
78 .fframe 0
79 .save ar.pfs,r2
80 .save ar.lc,r3
81 .save pr,prsave
82{ .mii; alloc r2=ar.pfs,4,12,0,16
83 mov prsave=pr
84 ADDP key=0,in0 };;
85{ .mib; cmp.eq p6,p0=0,in1 // len==0?
86 mov r3=ar.lc
87(p6) br.ret.spnt.many b0 };; // emergency exit
88
89 .body
90 .rotr dat[4],key_x[4],tx[2],rnd[2],key_y[2],ty[1];
91
92{ .mib; LDKEY xx=[key],SZ // load key->x
93 add in1=-1,in1 // adjust len for loop counter
94 nop.b 0 }
95{ .mib; ADDP inp=0,in2
96 ADDP out=0,in3
97 brp.loop.imp .Ltop,.Lexit-16 };;
98{ .mmi; LDKEY yy=[key] // load key->y
99 add ksch=SZ,key
100 mov ar.lc=in1 }
101{ .mmi; mov key_y[1]=r0 // guarantee inequality
102 // in first iteration
103 add xx=1,xx
104 mov pr.rot=1<<16 };;
105{ .mii; nop.m 0
106 dep key_x[1]=xx,r0,OFF,8
107 mov ar.ec=3 };; // note that epilogue counter
108 // is off by 1. I compensate
109 // for this at exit...
110.Ltop:
111// The loop is scheduled for 4*(n+2) spin-rate on Itanium 2, which
112// theoretically gives asymptotic performance of clock frequency
113// divided by 4 bytes per seconds, or 400MBps on 1.6GHz CPU. This is
114// for sizeof(RC4_INT)==4. For smaller RC4_INT STKEY inadvertently
115// splits the last bundle and you end up with 5*n spin-rate:-(
116// Originally the loop was scheduled for 3*n and relied on key
117// schedule to be aligned at 256*sizeof(RC4_INT) boundary. But
118// *(out++)=dat, which maps to st1, had same effect [inadvertent
119// bundle split] and holded the loop back. Rescheduling for 4*n
120// made it possible to eliminate dependence on specific alignment
121// and allow OpenSSH keep "abusing" our API. Reaching for 3*n would
122// require unrolling, sticking to variable shift instruction for
123// collecting output [to avoid starvation for integer shifter] and
124// copying of key schedule to controlled place in stack [so that
125// deposit instruction can serve as substitute for whole
126// key->data+((x&255)<<log2(sizeof(key->data[0])))]...
127{ .mmi; (p19) st1 [out]=dat[3],1 // *(out++)=dat
128 (p16) add xx=1,xx // x++
129 (p18) dep rnd[1]=rnd[1],r0,OFF,8 } // ((tx+ty)&255)<<OFF
130{ .mmi; (p16) add key_x[1]=ksch,key_x[1] // &key[xx&255]
131 (p17) add key_y[1]=ksch,key_y[1] };; // &key[yy&255]
132{ .mmi; (p16) LDKEY tx[0]=[key_x[1]] // tx=key[xx]
133 (p17) LDKEY ty[0]=[key_y[1]] // ty=key[yy]
134 (p16) dep key_x[0]=xx,r0,OFF,8 } // (xx&255)<<OFF
135{ .mmi; (p18) add rnd[1]=ksch,rnd[1] // &key[(tx+ty)&255]
136 (p16) cmp.ne.unc p20,p21=key_x[1],key_y[1] };;
137{ .mmi; (p18) LDKEY rnd[1]=[rnd[1]] // rnd=key[(tx+ty)&255]
138 (p16) ld1 dat[0]=[inp],1 } // dat=*(inp++)
139.pred.rel "mutex",p20,p21
140{ .mmi; (p21) add yy=yy,tx[1] // (p16)
141 (p20) add yy=yy,tx[0] // (p16) y+=tx
142 (p21) mov tx[0]=tx[1] };; // (p16)
143{ .mmi; (p17) STKEY [key_y[1]]=tx[1] // key[yy]=tx
144 (p17) STKEY [key_x[2]]=ty[0] // key[xx]=ty
145 (p16) dep key_y[0]=yy,r0,OFF,8 } // &key[yy&255]
146{ .mmb; (p17) add rnd[0]=tx[1],ty[0] // tx+=ty
147 (p18) xor dat[2]=dat[2],rnd[1] // dat^=rnd
148 br.ctop.sptk .Ltop };;
149.Lexit:
150{ .mib; STKEY [key]=yy,-SZ // save key->y
151 mov pr=prsave,0x1ffff
152 nop.b 0 }
153{ .mib; st1 [out]=dat[3],1 // compensate for truncated
154 // epilogue counter
155 add xx=-1,xx
156 nop.b 0 };;
157{ .mib; STKEY [key]=xx // save key->x
158 mov ar.lc=r3
159 br.ret.sptk.many b0 };;
160.endp RC4#
diff --git a/src/lib/libcrypto/rc4/rc4.c b/src/lib/libcrypto/rc4/rc4.c
new file mode 100644
index 0000000000..b39c070292
--- /dev/null
+++ b/src/lib/libcrypto/rc4/rc4.c
@@ -0,0 +1,192 @@
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
64char *usage[]={
65"usage: rc4 args\n",
66"\n",
67" -in arg - input file - default stdin\n",
68" -out arg - output file - default stdout\n",
69" -key key - password\n",
70NULL
71};
72
73int main(int argc, char *argv[])
74 {
75 FILE *in=NULL,*out=NULL;
76 char *infile=NULL,*outfile=NULL,*keystr=NULL;
77 RC4_KEY key;
78 char buf[BUFSIZ];
79 int badops=0,i;
80 char **pp;
81 unsigned char md[MD5_DIGEST_LENGTH];
82
83 argc--;
84 argv++;
85 while (argc >= 1)
86 {
87 if (strcmp(*argv,"-in") == 0)
88 {
89 if (--argc < 1) goto bad;
90 infile= *(++argv);
91 }
92 else if (strcmp(*argv,"-out") == 0)
93 {
94 if (--argc < 1) goto bad;
95 outfile= *(++argv);
96 }
97 else if (strcmp(*argv,"-key") == 0)
98 {
99 if (--argc < 1) goto bad;
100 keystr= *(++argv);
101 }
102 else
103 {
104 fprintf(stderr,"unknown option %s\n",*argv);
105 badops=1;
106 break;
107 }
108 argc--;
109 argv++;
110 }
111
112 if (badops)
113 {
114bad:
115 for (pp=usage; (*pp != NULL); pp++)
116 fprintf(stderr,"%s",*pp);
117 exit(1);
118 }
119
120 if (infile == NULL)
121 in=stdin;
122 else
123 {
124 in=fopen(infile,"r");
125 if (in == NULL)
126 {
127 perror("open");
128 exit(1);
129 }
130
131 }
132 if (outfile == NULL)
133 out=stdout;
134 else
135 {
136 out=fopen(outfile,"w");
137 if (out == NULL)
138 {
139 perror("open");
140 exit(1);
141 }
142 }
143
144#ifdef OPENSSL_SYS_MSDOS
145 /* This should set the file to binary mode. */
146 {
147#include <fcntl.h>
148 setmode(fileno(in),O_BINARY);
149 setmode(fileno(out),O_BINARY);
150 }
151#endif
152
153 if (keystr == NULL)
154 { /* get key */
155 i=EVP_read_pw_string(buf,BUFSIZ,"Enter RC4 password:",0);
156 if (i != 0)
157 {
158 OPENSSL_cleanse(buf,BUFSIZ);
159 fprintf(stderr,"bad password read\n");
160 exit(1);
161 }
162 keystr=buf;
163 }
164
165 EVP_Digest((unsigned char *)keystr,(unsigned long)strlen(keystr),md,NULL,EVP_md5());
166 OPENSSL_cleanse(keystr,strlen(keystr));
167 RC4_set_key(&key,MD5_DIGEST_LENGTH,md);
168
169 for(;;)
170 {
171 i=fread(buf,1,BUFSIZ,in);
172 if (i == 0) break;
173 if (i < 0)
174 {
175 perror("read");
176 exit(1);
177 }
178 RC4(&key,(unsigned int)i,(unsigned char *)buf,
179 (unsigned char *)buf);
180 i=fwrite(buf,(unsigned int)i,1,out);
181 if (i != 1)
182 {
183 perror("write");
184 exit(1);
185 }
186 }
187 fclose(out);
188 fclose(in);
189 exit(0);
190 return(1);
191 }
192
diff --git a/src/lib/libcrypto/rc4/rc4.h b/src/lib/libcrypto/rc4/rc4.h
index ae0cea75b8..dd90d9fde0 100644
--- a/src/lib/libcrypto/rc4/rc4.h
+++ b/src/lib/libcrypto/rc4/rc4.h
@@ -73,6 +73,10 @@ typedef struct rc4_key_st
73 { 73 {
74 RC4_INT x,y; 74 RC4_INT x,y;
75 RC4_INT data[256]; 75 RC4_INT data[256];
76#if defined(__ia64) || defined(__ia64__) || defined(_M_IA64)
77 /* see crypto/rc4/asm/rc4-ia64.S for further details... */
78 RC4_INT pad[512-256-2];
79#endif
76 } RC4_KEY; 80 } RC4_KEY;
77 81
78 82
diff --git a/src/lib/libcrypto/rc4/rc4_enc.c b/src/lib/libcrypto/rc4/rc4_enc.c
index d5f18a3a70..81a97ea3b7 100644
--- a/src/lib/libcrypto/rc4/rc4_enc.c
+++ b/src/lib/libcrypto/rc4/rc4_enc.c
@@ -77,6 +77,10 @@ void RC4(RC4_KEY *key, unsigned long len, const unsigned char *indata,
77 x=key->x; 77 x=key->x;
78 y=key->y; 78 y=key->y;
79 d=key->data; 79 d=key->data;
80#if defined(__ia64) || defined(__ia64__) || defined(_M_IA64)
81 /* see crypto/rc4/asm/rc4-ia64.S for further details... */
82 d=(RC4_INT *)(((size_t)(d+255))&~(sizeof(key->data)-1));
83#endif
80 84
81#if defined(RC4_CHUNK) 85#if defined(RC4_CHUNK)
82 /* 86 /*
diff --git a/src/lib/libcrypto/rc4/rc4_skey.c b/src/lib/libcrypto/rc4/rc4_skey.c
index 60510624fd..07234f061a 100644
--- a/src/lib/libcrypto/rc4/rc4_skey.c
+++ b/src/lib/libcrypto/rc4/rc4_skey.c
@@ -58,7 +58,6 @@
58 58
59#include <openssl/rc4.h> 59#include <openssl/rc4.h>
60#include <openssl/crypto.h> 60#include <openssl/crypto.h>
61#include <openssl/fips.h>
62#include "rc4_locl.h" 61#include "rc4_locl.h"
63#include <openssl/opensslv.h> 62#include <openssl/opensslv.h>
64 63
@@ -95,6 +94,10 @@ FIPS_NON_FIPS_VCIPHER_Init(RC4)
95 unsigned int i; 94 unsigned int i;
96 95
97 d= &(key->data[0]); 96 d= &(key->data[0]);
97#if defined(__ia64) || defined(__ia64__) || defined(_M_IA64)
98 /* see crypto/rc4/asm/rc4-ia64.S for further details... */
99 d=(RC4_INT *)(((size_t)(d+255))&~(sizeof(key->data)-1));
100#endif
98 101
99 for (i=0; i<256; i++) 102 for (i=0; i<256; i++)
100 d[i]=i; 103 d[i]=i;
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..ced98c52df
--- /dev/null
+++ b/src/lib/libcrypto/rc4/rc4speed.c
@@ -0,0 +1,250 @@
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#include <signal.h>
73#ifndef _IRIX
74#include <time.h>
75#endif
76#ifdef TIMES
77#include <sys/types.h>
78#include <sys/times.h>
79#endif
80
81/* Depending on the VMS version, the tms structure is perhaps defined.
82 The __TMS macro will show if it was. If it wasn't defined, we should
83 undefine TIMES, since that tells the rest of the program how things
84 should be handled. -- Richard Levitte */
85#if defined(OPENSSL_SYS_VMS_DECC) && !defined(__TMS)
86#undef TIMES
87#endif
88
89#ifndef TIMES
90#include <sys/timeb.h>
91#endif
92
93#if defined(sun) || defined(__ultrix)
94#define _POSIX_SOURCE
95#include <limits.h>
96#include <sys/param.h>
97#endif
98
99#include <openssl/rc4.h>
100
101/* The following if from times(3) man page. It may need to be changed */
102#ifndef HZ
103#ifndef CLK_TCK
104#define HZ 100.0
105#else /* CLK_TCK */
106#define HZ ((double)CLK_TCK)
107#endif
108#endif
109
110#define BUFSIZE ((long)1024)
111long run=0;
112
113double Time_F(int s);
114#ifdef SIGALRM
115#if defined(__STDC__) || defined(sgi) || defined(_AIX)
116#define SIGRETTYPE void
117#else
118#define SIGRETTYPE int
119#endif
120
121SIGRETTYPE sig_done(int sig);
122SIGRETTYPE sig_done(int sig)
123 {
124 signal(SIGALRM,sig_done);
125 run=0;
126#ifdef LINT
127 sig=sig;
128#endif
129 }
130#endif
131
132#define START 0
133#define STOP 1
134
135double Time_F(int s)
136 {
137 double ret;
138#ifdef TIMES
139 static struct tms tstart,tend;
140
141 if (s == START)
142 {
143 times(&tstart);
144 return(0);
145 }
146 else
147 {
148 times(&tend);
149 ret=((double)(tend.tms_utime-tstart.tms_utime))/HZ;
150 return((ret == 0.0)?1e-6:ret);
151 }
152#else /* !times() */
153 static struct timeb tstart,tend;
154 long i;
155
156 if (s == START)
157 {
158 ftime(&tstart);
159 return(0);
160 }
161 else
162 {
163 ftime(&tend);
164 i=(long)tend.millitm-(long)tstart.millitm;
165 ret=((double)(tend.time-tstart.time))+((double)i)/1e3;
166 return((ret == 0.0)?1e-6:ret);
167 }
168#endif
169 }
170
171int main(int argc, char **argv)
172 {
173 long count;
174 static unsigned char buf[BUFSIZE];
175 static unsigned char key[] ={
176 0x12,0x34,0x56,0x78,0x9a,0xbc,0xde,0xf0,
177 0xfe,0xdc,0xba,0x98,0x76,0x54,0x32,0x10,
178 };
179 RC4_KEY sch;
180 double a,b,c,d;
181#ifndef SIGALRM
182 long ca,cb,cc;
183#endif
184
185#ifndef TIMES
186 printf("To get the most accurate results, try to run this\n");
187 printf("program when this computer is idle.\n");
188#endif
189
190#ifndef SIGALRM
191 printf("First we calculate the approximate speed ...\n");
192 RC4_set_key(&sch,16,key);
193 count=10;
194 do {
195 long i;
196 unsigned long data[2];
197
198 count*=2;
199 Time_F(START);
200 for (i=count; i; i--)
201 RC4(&sch,8,buf,buf);
202 d=Time_F(STOP);
203 } while (d < 3.0);
204 ca=count/512;
205 cc=count*8/BUFSIZE+1;
206 printf("Doing RC4_set_key %ld times\n",ca);
207#define COND(d) (count != (d))
208#define COUNT(d) (d)
209#else
210#define COND(c) (run)
211#define COUNT(d) (count)
212 signal(SIGALRM,sig_done);
213 printf("Doing RC4_set_key for 10 seconds\n");
214 alarm(10);
215#endif
216
217 Time_F(START);
218 for (count=0,run=1; COND(ca); count+=4)
219 {
220 RC4_set_key(&sch,16,key);
221 RC4_set_key(&sch,16,key);
222 RC4_set_key(&sch,16,key);
223 RC4_set_key(&sch,16,key);
224 }
225 d=Time_F(STOP);
226 printf("%ld RC4_set_key's in %.2f seconds\n",count,d);
227 a=((double)COUNT(ca))/d;
228
229#ifdef SIGALRM
230 printf("Doing RC4 on %ld byte blocks for 10 seconds\n",BUFSIZE);
231 alarm(10);
232#else
233 printf("Doing RC4 %ld times on %ld byte blocks\n",cc,BUFSIZE);
234#endif
235 Time_F(START);
236 for (count=0,run=1; COND(cc); count++)
237 RC4(&sch,BUFSIZE,buf,buf);
238 d=Time_F(STOP);
239 printf("%ld RC4's of %ld byte blocks in %.2f second\n",
240 count,BUFSIZE,d);
241 c=((double)COUNT(cc)*BUFSIZE)/d;
242
243 printf("RC4 set_key per sec = %12.2f (%9.3fuS)\n",a,1.0e6/a);
244 printf("RC4 bytes per sec = %12.2f (%9.3fuS)\n",c,8.0e6/c);
245 exit(0);
246#if defined(LINT) || defined(OPENSSL_SYS_MSDOS)
247 return(0);
248#endif
249 }
250
diff --git a/src/lib/libcrypto/rc4/rc4test.c b/src/lib/libcrypto/rc4/rc4test.c
new file mode 100644
index 0000000000..b9d8f20975
--- /dev/null
+++ b/src/lib/libcrypto/rc4/rc4test.c
@@ -0,0 +1,203 @@
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
74static unsigned char keys[7][30]={
75 {8,0x01,0x23,0x45,0x67,0x89,0xab,0xcd,0xef},
76 {8,0x01,0x23,0x45,0x67,0x89,0xab,0xcd,0xef},
77 {8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
78 {4,0xef,0x01,0x23,0x45},
79 {8,0x01,0x23,0x45,0x67,0x89,0xab,0xcd,0xef},
80 {4,0xef,0x01,0x23,0x45},
81 };
82
83static unsigned char data_len[7]={8,8,8,20,28,10};
84static unsigned char data[7][30]={
85 {0x01,0x23,0x45,0x67,0x89,0xab,0xcd,0xef,0xff},
86 {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff},
87 {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff},
88 {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
89 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
90 0x00,0x00,0x00,0x00,0xff},
91 {0x12,0x34,0x56,0x78,0x9A,0xBC,0xDE,0xF0,
92 0x12,0x34,0x56,0x78,0x9A,0xBC,0xDE,0xF0,
93 0x12,0x34,0x56,0x78,0x9A,0xBC,0xDE,0xF0,
94 0x12,0x34,0x56,0x78,0xff},
95 {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff},
96 {0},
97 };
98
99static unsigned char output[7][30]={
100 {0x75,0xb7,0x87,0x80,0x99,0xe0,0xc5,0x96,0x00},
101 {0x74,0x94,0xc2,0xe7,0x10,0x4b,0x08,0x79,0x00},
102 {0xde,0x18,0x89,0x41,0xa3,0x37,0x5d,0x3a,0x00},
103 {0xd6,0xa1,0x41,0xa7,0xec,0x3c,0x38,0xdf,
104 0xbd,0x61,0x5a,0x11,0x62,0xe1,0xc7,0xba,
105 0x36,0xb6,0x78,0x58,0x00},
106 {0x66,0xa0,0x94,0x9f,0x8a,0xf7,0xd6,0x89,
107 0x1f,0x7f,0x83,0x2b,0xa8,0x33,0xc0,0x0c,
108 0x89,0x2e,0xbe,0x30,0x14,0x3c,0xe2,0x87,
109 0x40,0x01,0x1e,0xcf,0x00},
110 {0xd6,0xa1,0x41,0xa7,0xec,0x3c,0x38,0xdf,0xbd,0x61,0x00},
111 {0},
112 };
113
114int main(int argc, char *argv[])
115 {
116 int i,err=0;
117 int j;
118 unsigned char *p;
119 RC4_KEY key;
120 unsigned char buf[512],obuf[512];
121
122 for (i=0; i<512; i++) buf[i]=0x01;
123
124 for (i=0; i<6; i++)
125 {
126 RC4_set_key(&key,keys[i][0],&(keys[i][1]));
127 memset(obuf,0x00,sizeof(obuf));
128 RC4(&key,data_len[i],&(data[i][0]),obuf);
129 if (memcmp(obuf,output[i],data_len[i]+1) != 0)
130 {
131 printf("error calculating RC4\n");
132 printf("output:");
133 for (j=0; j<data_len[i]+1; j++)
134 printf(" %02x",obuf[j]);
135 printf("\n");
136 printf("expect:");
137 p= &(output[i][0]);
138 for (j=0; j<data_len[i]+1; j++)
139 printf(" %02x",*(p++));
140 printf("\n");
141 err++;
142 }
143 else
144 printf("test %d ok\n",i);
145 }
146 printf("test end processing ");
147 for (i=0; i<data_len[3]; i++)
148 {
149 RC4_set_key(&key,keys[3][0],&(keys[3][1]));
150 memset(obuf,0x00,sizeof(obuf));
151 RC4(&key,i,&(data[3][0]),obuf);
152 if ((memcmp(obuf,output[3],i) != 0) || (obuf[i] != 0))
153 {
154 printf("error in RC4 length processing\n");
155 printf("output:");
156 for (j=0; j<i+1; j++)
157 printf(" %02x",obuf[j]);
158 printf("\n");
159 printf("expect:");
160 p= &(output[3][0]);
161 for (j=0; j<i; j++)
162 printf(" %02x",*(p++));
163 printf(" 00\n");
164 err++;
165 }
166 else
167 {
168 printf(".");
169 fflush(stdout);
170 }
171 }
172 printf("done\n");
173 printf("test multi-call ");
174 for (i=0; i<data_len[3]; i++)
175 {
176 RC4_set_key(&key,keys[3][0],&(keys[3][1]));
177 memset(obuf,0x00,sizeof(obuf));
178 RC4(&key,i,&(data[3][0]),obuf);
179 RC4(&key,data_len[3]-i,&(data[3][i]),&(obuf[i]));
180 if (memcmp(obuf,output[3],data_len[3]+1) != 0)
181 {
182 printf("error in RC4 multi-call processing\n");
183 printf("output:");
184 for (j=0; j<data_len[3]+1; j++)
185 printf(" %02x",obuf[j]);
186 printf("\n");
187 printf("expect:");
188 p= &(output[3][0]);
189 for (j=0; j<data_len[3]+1; j++)
190 printf(" %02x",*(p++));
191 err++;
192 }
193 else
194 {
195 printf(".");
196 fflush(stdout);
197 }
198 }
199 printf("done\n");
200 EXIT(err);
201 return(0);
202 }
203#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..16e6a60017
--- /dev/null
+++ b/src/lib/libcrypto/rc5/Makefile
@@ -0,0 +1,110 @@
1#
2# OpenSSL/crypto/rc5/Makefile
3#
4
5DIR= rc5
6TOP= ../..
7CC= cc
8CPP= $(CC) -E
9INCLUDES=
10CFLAG=-g
11INSTALL_PREFIX=
12OPENSSLDIR= /usr/local/ssl
13INSTALLTOP=/usr/local/ssl
14MAKEDEPPROG= makedepend
15MAKEDEPEND= $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG)
16MAKEFILE= Makefile
17AR= ar r
18
19RC5_ENC= rc5_enc.o
20# or use
21#DES_ENC= r586-elf.o
22
23CFLAGS= $(INCLUDES) $(CFLAG)
24ASFLAGS= $(INCLUDES) $(ASFLAG)
25
26GENERAL=Makefile
27TEST=rc5test.c
28APPS=
29
30LIB=$(TOP)/libcrypto.a
31LIBSRC=rc5_skey.c rc5_ecb.c rc5_enc.c rc5cfb64.c rc5ofb64.c
32LIBOBJ=rc5_skey.o rc5_ecb.o $(RC5_ENC) rc5cfb64.o rc5ofb64.o
33
34SRC= $(LIBSRC)
35
36EXHEADER= rc5.h
37HEADER= rc5_locl.h $(EXHEADER)
38
39ALL= $(GENERAL) $(SRC) $(HEADER)
40
41top:
42 (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all)
43
44all: lib
45
46lib: $(LIBOBJ)
47 $(AR) $(LIB) $(LIBOBJ)
48 $(RANLIB) $(LIB) || echo Never mind.
49 @touch lib
50
51# elf
52asm/r586-elf.s: asm/rc5-586.pl ../perlasm/x86asm.pl ../perlasm/cbc.pl
53 (cd asm; $(PERL) rc5-586.pl elf $(CFLAGS) > r586-elf.s)
54
55# a.out
56asm/r586-out.o: asm/r586unix.cpp
57 $(CPP) -DOUT asm/r586unix.cpp | as -o asm/r586-out.o
58
59# bsdi
60asm/r586bsdi.o: asm/r586unix.cpp
61 $(CPP) -DBSDI asm/r586unix.cpp | sed 's/ :/:/' | as -o asm/r586bsdi.o
62
63asm/r586unix.cpp: asm/rc5-586.pl ../perlasm/x86asm.pl ../perlasm/cbc.pl
64 (cd asm; $(PERL) rc5-586.pl cpp >r586unix.cpp)
65
66files:
67 $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
68
69links:
70 @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
71 @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
72 @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
73
74install:
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 $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
91
92dclean:
93 $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
94 mv -f Makefile.new $(MAKEFILE)
95
96clean:
97 rm -f asm/r586unix.cpp asm/*-elf.* *.o asm/*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
98
99# DO NOT DELETE THIS LINE -- make depend depends on it.
100
101rc5_ecb.o: ../../include/openssl/opensslv.h ../../include/openssl/rc5.h
102rc5_ecb.o: rc5_ecb.c rc5_locl.h
103rc5_enc.o: ../../include/openssl/rc5.h rc5_enc.c rc5_locl.h
104rc5_skey.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
105rc5_skey.o: ../../include/openssl/fips.h ../../include/openssl/opensslconf.h
106rc5_skey.o: ../../include/openssl/opensslv.h ../../include/openssl/rc5.h
107rc5_skey.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
108rc5_skey.o: ../../include/openssl/symhacks.h rc5_locl.h rc5_skey.c
109rc5cfb64.o: ../../include/openssl/rc5.h rc5_locl.h rc5cfb64.c
110rc5ofb64.o: ../../include/openssl/rc5.h rc5_locl.h rc5ofb64.c
diff --git a/src/lib/libcrypto/rc5/Makefile.ssl b/src/lib/libcrypto/rc5/Makefile.ssl
new file mode 100644
index 0000000000..3f9632f8f7
--- /dev/null
+++ b/src/lib/libcrypto/rc5/Makefile.ssl
@@ -0,0 +1,108 @@
1#
2# SSLeay/crypto/rc5/Makefile
3#
4
5DIR= rc5
6TOP= ../..
7CC= cc
8CPP= $(CC) -E
9INCLUDES=
10CFLAG=-g
11INSTALL_PREFIX=
12OPENSSLDIR= /usr/local/ssl
13INSTALLTOP=/usr/local/ssl
14MAKE= make -f Makefile.ssl
15MAKEDEPPROG= makedepend
16MAKEDEPEND= $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG)
17MAKEFILE= Makefile.ssl
18AR= ar r
19
20RC5_ENC= rc5_enc.o
21# or use
22#DES_ENC= r586-elf.o
23
24CFLAGS= $(INCLUDES) $(CFLAG)
25ASFLAGS= $(INCLUDES) $(ASFLAG)
26
27GENERAL=Makefile
28TEST=rc5test.c
29APPS=
30
31LIB=$(TOP)/libcrypto.a
32LIBSRC=rc5_skey.c rc5_ecb.c rc5_enc.c rc5cfb64.c rc5ofb64.c
33LIBOBJ=rc5_skey.o rc5_ecb.o $(RC5_ENC) rc5cfb64.o rc5ofb64.o
34
35SRC= $(LIBSRC)
36
37EXHEADER= rc5.h
38HEADER= rc5_locl.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
52# elf
53asm/r586-elf.s: asm/rc5-586.pl ../perlasm/x86asm.pl ../perlasm/cbc.pl
54 (cd asm; $(PERL) rc5-586.pl elf $(CFLAGS) > r586-elf.s)
55
56# a.out
57asm/r586-out.o: asm/r586unix.cpp
58 $(CPP) -DOUT asm/r586unix.cpp | as -o asm/r586-out.o
59
60# bsdi
61asm/r586bsdi.o: asm/r586unix.cpp
62 $(CPP) -DBSDI asm/r586unix.cpp | sed 's/ :/:/' | as -o asm/r586bsdi.o
63
64asm/r586unix.cpp: asm/rc5-586.pl ../perlasm/x86asm.pl ../perlasm/cbc.pl
65 (cd asm; $(PERL) rc5-586.pl cpp >r586unix.cpp)
66
67files:
68 $(PERL) $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO
69
70links:
71 @sh $(TOP)/util/point.sh Makefile.ssl Makefile
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 @for i in $(EXHEADER) ; \
78 do \
79 (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
80 chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
81 done;
82
83tags:
84 ctags $(SRC)
85
86tests:
87
88lint:
89 lint -DLINT $(INCLUDES) $(SRC)>fluff
90
91depend:
92 $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
93
94dclean:
95 $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
96 mv -f Makefile.new $(MAKEFILE)
97
98clean:
99 rm -f asm/r586unix.cpp asm/*-elf.* *.o asm/*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
100
101# DO NOT DELETE THIS LINE -- make depend depends on it.
102
103rc5_ecb.o: ../../include/openssl/opensslv.h ../../include/openssl/rc5.h
104rc5_ecb.o: rc5_ecb.c rc5_locl.h
105rc5_enc.o: ../../include/openssl/rc5.h rc5_enc.c rc5_locl.h
106rc5_skey.o: ../../include/openssl/rc5.h rc5_locl.h rc5_skey.c
107rc5cfb64.o: ../../include/openssl/rc5.h rc5_locl.h rc5cfb64.c
108rc5ofb64.o: ../../include/openssl/rc5.h 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..aa3f26920b
--- /dev/null
+++ b/src/lib/libcrypto/rc5/rc5.h
@@ -0,0 +1,119 @@
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#ifdef __cplusplus
63extern "C" {
64#endif
65
66#ifdef OPENSSL_NO_RC5
67#error RC5 is disabled.
68#endif
69
70#define RC5_ENCRYPT 1
71#define RC5_DECRYPT 0
72
73/* 32 bit. For Alpha, things may get weird */
74#define RC5_32_INT unsigned long
75
76#define RC5_32_BLOCK 8
77#define RC5_32_KEY_LENGTH 16 /* This is a default, max is 255 */
78
79/* This are the only values supported. Tweak the code if you want more
80 * The most supported modes will be
81 * RC5-32/12/16
82 * RC5-32/16/8
83 */
84#define RC5_8_ROUNDS 8
85#define RC5_12_ROUNDS 12
86#define RC5_16_ROUNDS 16
87
88typedef struct rc5_key_st
89 {
90 /* Number of rounds */
91 int rounds;
92 RC5_32_INT data[2*(RC5_16_ROUNDS+1)];
93 } RC5_32_KEY;
94
95#ifdef OPENSSL_FIPS
96void private_RC5_32_set_key(RC5_32_KEY *key, int len, const unsigned char *data,
97 int rounds);
98#endif
99void RC5_32_set_key(RC5_32_KEY *key, int len, const unsigned char *data,
100 int rounds);
101void RC5_32_ecb_encrypt(const unsigned char *in,unsigned char *out,RC5_32_KEY *key,
102 int enc);
103void RC5_32_encrypt(unsigned long *data,RC5_32_KEY *key);
104void RC5_32_decrypt(unsigned long *data,RC5_32_KEY *key);
105void RC5_32_cbc_encrypt(const unsigned char *in, unsigned char *out,
106 long length, RC5_32_KEY *ks, unsigned char *iv,
107 int enc);
108void RC5_32_cfb64_encrypt(const unsigned char *in, unsigned char *out,
109 long length, RC5_32_KEY *schedule,
110 unsigned char *ivec, int *num, int enc);
111void RC5_32_ofb64_encrypt(const unsigned char *in, unsigned char *out,
112 long length, RC5_32_KEY *schedule,
113 unsigned char *ivec, int *num);
114
115#ifdef __cplusplus
116}
117#endif
118
119#endif
diff --git a/src/lib/libcrypto/rc5/rc5_locl.h b/src/lib/libcrypto/rc5/rc5_locl.h
new file mode 100644
index 0000000000..f4ebc23004
--- /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)
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"(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"(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/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/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..20c8b4d8db
--- /dev/null
+++ b/src/lib/libcrypto/ripemd/Makefile
@@ -0,0 +1,111 @@
1#
2# OpenSSL/crypto/ripemd/Makefile
3#
4
5DIR= ripemd
6TOP= ../..
7CC= cc
8CPP= $(CC) -E
9INCLUDES=
10CFLAG=-g
11INSTALL_PREFIX=
12OPENSSLDIR= /usr/local/ssl
13INSTALLTOP=/usr/local/ssl
14MAKEDEPPROG= makedepend
15MAKEDEPEND= $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG)
16MAKEFILE= Makefile
17AR= ar r
18
19RIP_ASM_OBJ=
20
21CFLAGS= $(INCLUDES) $(CFLAG)
22ASFLAGS= $(INCLUDES) $(ASFLAG)
23
24GENERAL=Makefile
25TEST=rmdtest.c
26APPS=
27
28LIB=$(TOP)/libcrypto.a
29LIBSRC=rmd_dgst.c rmd_one.c
30LIBOBJ=rmd_dgst.o rmd_one.o $(RMD160_ASM_OBJ)
31
32SRC= $(LIBSRC)
33
34EXHEADER= ripemd.h
35HEADER= rmd_locl.h rmdconst.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
49# elf
50asm/rm86-elf.s: asm/rmd-586.pl ../perlasm/x86asm.pl
51 (cd asm; $(PERL) rmd-586.pl elf $(CFLAGS) > rm86-elf.s)
52
53# a.out
54asm/rm86-out.o: asm/rm86unix.cpp
55 $(CPP) -DOUT asm/rm86unix.cpp | as -o asm/rm86-out.o
56
57# bsdi
58asm/rm86bsdi.o: asm/rm86unix.cpp
59 $(CPP) -DBSDI asm/rm86unix.cpp | sed 's/ :/:/' | as -o asm/rm86bsdi.o
60
61asm/rm86unix.cpp: asm/rmd-586.pl ../perlasm/x86asm.pl
62 (cd asm; $(PERL) rmd-586.pl cpp >rm86unix.cpp)
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 @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
71
72install:
73 @headerlist="$(EXHEADER)"; for i in $$headerlist ; \
74 do \
75 (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
76 chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
77 done;
78
79tags:
80 ctags $(SRC)
81
82tests:
83
84lint:
85 lint -DLINT $(INCLUDES) $(SRC)>fluff
86
87depend:
88 $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
89
90dclean:
91 $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
92 mv -f Makefile.new $(MAKEFILE)
93
94clean:
95 rm -f asm/rm86unix.cpp asm/*-elf.* *.o asm/*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
96
97# DO NOT DELETE THIS LINE -- make depend depends on it.
98
99rmd_dgst.o: ../../include/openssl/bio.h ../../include/openssl/crypto.h
100rmd_dgst.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
101rmd_dgst.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
102rmd_dgst.o: ../../include/openssl/opensslconf.h
103rmd_dgst.o: ../../include/openssl/opensslv.h ../../include/openssl/ripemd.h
104rmd_dgst.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
105rmd_dgst.o: ../../include/openssl/symhacks.h ../md32_common.h rmd_dgst.c
106rmd_dgst.o: rmd_locl.h rmdconst.h
107rmd_one.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
108rmd_one.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
109rmd_one.o: ../../include/openssl/ripemd.h ../../include/openssl/safestack.h
110rmd_one.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
111rmd_one.o: rmd_one.c
diff --git a/src/lib/libcrypto/ripemd/Makefile.ssl b/src/lib/libcrypto/ripemd/Makefile.ssl
new file mode 100644
index 0000000000..f22ac790ae
--- /dev/null
+++ b/src/lib/libcrypto/ripemd/Makefile.ssl
@@ -0,0 +1,108 @@
1#
2# SSLeay/crypto/ripemd/Makefile
3#
4
5DIR= ripemd
6TOP= ../..
7CC= cc
8CPP= $(CC) -E
9INCLUDES=
10CFLAG=-g
11INSTALL_PREFIX=
12OPENSSLDIR= /usr/local/ssl
13INSTALLTOP=/usr/local/ssl
14MAKE= make -f Makefile.ssl
15MAKEDEPPROG= makedepend
16MAKEDEPEND= $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG)
17MAKEFILE= Makefile.ssl
18AR= ar r
19
20RIP_ASM_OBJ=
21
22CFLAGS= $(INCLUDES) $(CFLAG)
23ASFLAGS= $(INCLUDES) $(ASFLAG)
24
25GENERAL=Makefile
26TEST=rmdtest.c
27APPS=
28
29LIB=$(TOP)/libcrypto.a
30LIBSRC=rmd_dgst.c rmd_one.c
31LIBOBJ=rmd_dgst.o rmd_one.o $(RMD160_ASM_OBJ)
32
33SRC= $(LIBSRC)
34
35EXHEADER= ripemd.h
36HEADER= rmd_locl.h rmdconst.h $(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
50# elf
51asm/rm86-elf.s: asm/rmd-586.pl ../perlasm/x86asm.pl
52 (cd asm; $(PERL) rmd-586.pl elf $(CFLAGS) > rm86-elf.s)
53
54# a.out
55asm/rm86-out.o: asm/rm86unix.cpp
56 $(CPP) -DOUT asm/rm86unix.cpp | as -o asm/rm86-out.o
57
58# bsdi
59asm/rm86bsdi.o: asm/rm86unix.cpp
60 $(CPP) -DBSDI asm/rm86unix.cpp | sed 's/ :/:/' | as -o asm/rm86bsdi.o
61
62asm/rm86unix.cpp: asm/rmd-586.pl ../perlasm/x86asm.pl
63 (cd asm; $(PERL) rmd-586.pl cpp >rm86unix.cpp)
64
65files:
66 $(PERL) $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO
67
68links:
69 @sh $(TOP)/util/point.sh Makefile.ssl Makefile
70 @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
71 @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
72 @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
73
74install:
75 @for i in $(EXHEADER) ; \
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 $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
91
92dclean:
93 $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
94 mv -f Makefile.new $(MAKEFILE)
95
96clean:
97 rm -f asm/rm86unix.cpp asm/*-elf.* *.o asm/*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
98
99# DO NOT DELETE THIS LINE -- make depend depends on it.
100
101rmd_dgst.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslconf.h
102rmd_dgst.o: ../../include/openssl/opensslv.h ../../include/openssl/ripemd.h
103rmd_dgst.o: ../md32_common.h rmd_dgst.c rmd_locl.h rmdconst.h
104rmd_one.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
105rmd_one.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
106rmd_one.o: ../../include/openssl/ripemd.h ../../include/openssl/safestack.h
107rmd_one.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
108rmd_one.o: rmd_one.c
diff --git a/src/lib/libcrypto/ripemd/README b/src/lib/libcrypto/ripemd/README
index 7097707264..f1ffc8b134 100644
--- a/src/lib/libcrypto/ripemd/README
+++ b/src/lib/libcrypto/ripemd/README
@@ -4,7 +4,7 @@ http://www.esat.kuleuven.ac.be/~bosselae/ripemd160.html
4This is my implementation of RIPEMD-160. The pentium assember is a little 4This is my implementation of RIPEMD-160. The pentium assember is a little
5off the pace since I only get 1050 cycles, while the best is 1013. 5off the pace since I only get 1050 cycles, while the best is 1013.
6I have a few ideas for how to get another 20 or so cycles, but at 6I have a few ideas for how to get another 20 or so cycles, but at
7this point I will not bother right now. I belive the trick will be 7this point I will not bother right now. I believe the trick will be
8to remove my 'copy X array onto stack' until inside the RIP1() finctions the 8to remove my 'copy X array onto stack' until inside the RIP1() finctions the
9first time round. To do this I need another register and will only have one 9first time round. To do this I need another register and will only have one
10temporary one. A bit tricky.... I can also cleanup the saving of the 5 words 10temporary one. A bit tricky.... I can also cleanup the saving of the 5 words
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 5dff6bafa1..58ff010d11 100644
--- a/src/lib/libcrypto/ripemd/rmd_dgst.c
+++ b/src/lib/libcrypto/ripemd/rmd_dgst.c
@@ -91,7 +91,7 @@ FIPS_NON_FIPS_MD_Init(RIPEMD160)
91void ripemd160_block_host_order (RIPEMD160_CTX *ctx, const void *p, int num) 91void ripemd160_block_host_order (RIPEMD160_CTX *ctx, const void *p, int num)
92 { 92 {
93 const RIPEMD160_LONG *XX=p; 93 const RIPEMD160_LONG *XX=p;
94 register unsigned MD32_REG_T A,B,C,D,E; 94 register volatile unsigned MD32_REG_T A,B,C,D,E;
95 register unsigned MD32_REG_T a,b,c,d,e; 95 register unsigned MD32_REG_T a,b,c,d,e;
96 96
97 for (;num--;XX+=HASH_LBLOCK) 97 for (;num--;XX+=HASH_LBLOCK)
@@ -291,7 +291,7 @@ void ripemd160_block_host_order (RIPEMD160_CTX *ctx, const void *p, int num)
291void ripemd160_block_data_order (RIPEMD160_CTX *ctx, const void *p, int num) 291void ripemd160_block_data_order (RIPEMD160_CTX *ctx, const void *p, int num)
292 { 292 {
293 const unsigned char *data=p; 293 const unsigned char *data=p;
294 register unsigned MD32_REG_T A,B,C,D,E; 294 register volatile unsigned MD32_REG_T A,B,C,D,E;
295 unsigned MD32_REG_T a,b,c,d,e,l; 295 unsigned MD32_REG_T a,b,c,d,e,l;
296#ifndef MD32_XARRAY 296#ifndef MD32_XARRAY
297 /* See comment in crypto/sha/sha_locl.h for details. */ 297 /* See comment in crypto/sha/sha_locl.h for details. */
diff --git a/src/lib/libcrypto/ripemd/rmd_one.c b/src/lib/libcrypto/ripemd/rmd_one.c
index b88446b267..f8b580c33a 100644
--- a/src/lib/libcrypto/ripemd/rmd_one.c
+++ b/src/lib/libcrypto/ripemd/rmd_one.c
@@ -68,8 +68,7 @@ unsigned char *RIPEMD160(const unsigned char *d, unsigned long n,
68 static unsigned char m[RIPEMD160_DIGEST_LENGTH]; 68 static unsigned char m[RIPEMD160_DIGEST_LENGTH];
69 69
70 if (md == NULL) md=m; 70 if (md == NULL) md=m;
71 if (!RIPEMD160_Init(&c)) 71 RIPEMD160_Init(&c);
72 return NULL;
73 RIPEMD160_Update(&c,d,n); 72 RIPEMD160_Update(&c,d,n);
74 RIPEMD160_Final(md,&c); 73 RIPEMD160_Final(md,&c);
75 OPENSSL_cleanse(&c,sizeof(c)); /* security consideration */ 74 OPENSSL_cleanse(&c,sizeof(c)); /* security consideration */
diff --git a/src/lib/libcrypto/ripemd/rmdtest.c b/src/lib/libcrypto/ripemd/rmdtest.c
new file mode 100644
index 0000000000..d4c709e646
--- /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 unsigned char **P,**R;
107 char *p;
108 unsigned char md[RIPEMD160_DIGEST_LENGTH];
109
110 P=(unsigned char **)test;
111 R=(unsigned char **)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]),(unsigned long)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..8851825250
--- /dev/null
+++ b/src/lib/libcrypto/rsa/Makefile
@@ -0,0 +1,269 @@
1#
2# OpenSSL/crypto/rsa/Makefile
3#
4
5DIR= rsa
6TOP= ../..
7CC= cc
8INCLUDES= -I.. -I$(TOP) -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
18CFLAGS= $(INCLUDES) $(CFLAG)
19
20GENERAL=Makefile
21TEST=rsa_test.c
22APPS=
23
24LIB=$(TOP)/libcrypto.a
25LIBSRC= rsa_eay.c rsa_gen.c rsa_lib.c rsa_sign.c rsa_saos.c rsa_err.c \
26 rsa_pk1.c rsa_ssl.c rsa_none.c rsa_oaep.c rsa_chk.c rsa_null.c \
27 rsa_pss.c rsa_x931.c rsa_asn1.c
28LIBOBJ= rsa_eay.o rsa_gen.o rsa_lib.o rsa_sign.o rsa_saos.o rsa_err.o \
29 rsa_pk1.o rsa_ssl.o rsa_none.o rsa_oaep.o rsa_chk.o rsa_null.o \
30 rsa_pss.o rsa_x931.o rsa_asn1.o
31
32SRC= $(LIBSRC)
33
34EXHEADER= rsa.h
35HEADER= $(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 @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 $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
74
75dclean:
76 $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
77 mv -f Makefile.new $(MAKEFILE)
78
79clean:
80 rm -f *.o */*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
81
82# DO NOT DELETE THIS LINE -- make depend depends on it.
83
84rsa_asn1.o: ../../e_os.h ../../include/openssl/asn1.h
85rsa_asn1.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
86rsa_asn1.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
87rsa_asn1.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
88rsa_asn1.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
89rsa_asn1.o: ../../include/openssl/opensslconf.h
90rsa_asn1.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
91rsa_asn1.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
92rsa_asn1.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
93rsa_asn1.o: ../cryptlib.h rsa_asn1.c
94rsa_chk.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
95rsa_chk.o: ../../include/openssl/bn.h ../../include/openssl/crypto.h
96rsa_chk.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
97rsa_chk.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
98rsa_chk.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
99rsa_chk.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
100rsa_chk.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
101rsa_chk.o: rsa_chk.c
102rsa_eay.o: ../../e_os.h ../../include/openssl/asn1.h
103rsa_eay.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
104rsa_eay.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
105rsa_eay.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
106rsa_eay.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
107rsa_eay.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
108rsa_eay.o: ../../include/openssl/rand.h ../../include/openssl/rsa.h
109rsa_eay.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
110rsa_eay.o: ../../include/openssl/symhacks.h ../cryptlib.h rsa_eay.c
111rsa_err.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
112rsa_err.o: ../../include/openssl/bn.h ../../include/openssl/crypto.h
113rsa_err.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
114rsa_err.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
115rsa_err.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
116rsa_err.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
117rsa_err.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
118rsa_err.o: rsa_err.c
119rsa_gen.o: ../../e_os.h ../../include/openssl/asn1.h
120rsa_gen.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
121rsa_gen.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
122rsa_gen.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
123rsa_gen.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
124rsa_gen.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
125rsa_gen.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
126rsa_gen.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
127rsa_gen.o: ../cryptlib.h rsa_gen.c
128rsa_lib.o: ../../e_os.h ../../include/openssl/asn1.h
129rsa_lib.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
130rsa_lib.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
131rsa_lib.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
132rsa_lib.o: ../../include/openssl/e_os2.h ../../include/openssl/engine.h
133rsa_lib.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
134rsa_lib.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
135rsa_lib.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rand.h
136rsa_lib.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
137rsa_lib.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
138rsa_lib.o: ../../include/openssl/ui.h ../cryptlib.h rsa_lib.c
139rsa_none.o: ../../e_os.h ../../include/openssl/asn1.h
140rsa_none.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
141rsa_none.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
142rsa_none.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
143rsa_none.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
144rsa_none.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
145rsa_none.o: ../../include/openssl/rand.h ../../include/openssl/rsa.h
146rsa_none.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
147rsa_none.o: ../../include/openssl/symhacks.h ../cryptlib.h rsa_none.c
148rsa_null.o: ../../e_os.h ../../include/openssl/asn1.h
149rsa_null.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
150rsa_null.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
151rsa_null.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
152rsa_null.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
153rsa_null.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
154rsa_null.o: ../../include/openssl/rand.h ../../include/openssl/rsa.h
155rsa_null.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
156rsa_null.o: ../../include/openssl/symhacks.h ../cryptlib.h rsa_null.c
157rsa_oaep.o: ../../e_os.h ../../include/openssl/aes.h
158rsa_oaep.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
159rsa_oaep.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
160rsa_oaep.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
161rsa_oaep.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
162rsa_oaep.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
163rsa_oaep.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
164rsa_oaep.o: ../../include/openssl/err.h ../../include/openssl/evp.h
165rsa_oaep.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
166rsa_oaep.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
167rsa_oaep.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
168rsa_oaep.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
169rsa_oaep.o: ../../include/openssl/opensslconf.h
170rsa_oaep.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
171rsa_oaep.o: ../../include/openssl/rand.h ../../include/openssl/rc2.h
172rsa_oaep.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
173rsa_oaep.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
174rsa_oaep.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
175rsa_oaep.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
176rsa_oaep.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
177rsa_oaep.o: ../cryptlib.h rsa_oaep.c
178rsa_pk1.o: ../../e_os.h ../../include/openssl/asn1.h
179rsa_pk1.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
180rsa_pk1.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
181rsa_pk1.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
182rsa_pk1.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
183rsa_pk1.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
184rsa_pk1.o: ../../include/openssl/rand.h ../../include/openssl/rsa.h
185rsa_pk1.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
186rsa_pk1.o: ../../include/openssl/symhacks.h ../cryptlib.h rsa_pk1.c
187rsa_pss.o: ../../e_os.h ../../include/openssl/aes.h
188rsa_pss.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
189rsa_pss.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
190rsa_pss.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
191rsa_pss.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
192rsa_pss.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
193rsa_pss.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
194rsa_pss.o: ../../include/openssl/err.h ../../include/openssl/evp.h
195rsa_pss.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
196rsa_pss.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
197rsa_pss.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
198rsa_pss.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
199rsa_pss.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
200rsa_pss.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rand.h
201rsa_pss.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
202rsa_pss.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
203rsa_pss.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
204rsa_pss.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
205rsa_pss.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
206rsa_pss.o: ../../include/openssl/ui_compat.h ../cryptlib.h rsa_pss.c
207rsa_saos.o: ../../e_os.h ../../include/openssl/aes.h
208rsa_saos.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
209rsa_saos.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
210rsa_saos.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
211rsa_saos.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
212rsa_saos.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
213rsa_saos.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
214rsa_saos.o: ../../include/openssl/err.h ../../include/openssl/evp.h
215rsa_saos.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
216rsa_saos.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
217rsa_saos.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
218rsa_saos.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
219rsa_saos.o: ../../include/openssl/opensslconf.h
220rsa_saos.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
221rsa_saos.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
222rsa_saos.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
223rsa_saos.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
224rsa_saos.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
225rsa_saos.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
226rsa_saos.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
227rsa_saos.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
228rsa_saos.o: ../cryptlib.h rsa_saos.c
229rsa_sign.o: ../../e_os.h ../../include/openssl/aes.h
230rsa_sign.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
231rsa_sign.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
232rsa_sign.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
233rsa_sign.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
234rsa_sign.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
235rsa_sign.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
236rsa_sign.o: ../../include/openssl/err.h ../../include/openssl/evp.h
237rsa_sign.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
238rsa_sign.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
239rsa_sign.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
240rsa_sign.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
241rsa_sign.o: ../../include/openssl/opensslconf.h
242rsa_sign.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
243rsa_sign.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
244rsa_sign.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
245rsa_sign.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
246rsa_sign.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
247rsa_sign.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
248rsa_sign.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
249rsa_sign.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
250rsa_sign.o: ../cryptlib.h rsa_sign.c
251rsa_ssl.o: ../../e_os.h ../../include/openssl/asn1.h
252rsa_ssl.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
253rsa_ssl.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
254rsa_ssl.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
255rsa_ssl.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
256rsa_ssl.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
257rsa_ssl.o: ../../include/openssl/rand.h ../../include/openssl/rsa.h
258rsa_ssl.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
259rsa_ssl.o: ../../include/openssl/symhacks.h ../cryptlib.h rsa_ssl.c
260rsa_x931.o: ../../e_os.h ../../include/openssl/asn1.h
261rsa_x931.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
262rsa_x931.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
263rsa_x931.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
264rsa_x931.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
265rsa_x931.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
266rsa_x931.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
267rsa_x931.o: ../../include/openssl/rand.h ../../include/openssl/rsa.h
268rsa_x931.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
269rsa_x931.o: ../../include/openssl/symhacks.h ../cryptlib.h rsa_x931.c
diff --git a/src/lib/libcrypto/rsa/Makefile.ssl b/src/lib/libcrypto/rsa/Makefile.ssl
new file mode 100644
index 0000000000..8089344a04
--- /dev/null
+++ b/src/lib/libcrypto/rsa/Makefile.ssl
@@ -0,0 +1,241 @@
1#
2# SSLeay/crypto/rsa/Makefile
3#
4
5DIR= rsa
6TOP= ../..
7CC= cc
8INCLUDES= -I.. -I$(TOP) -I../../include
9CFLAG=-g
10INSTALL_PREFIX=
11OPENSSLDIR= /usr/local/ssl
12INSTALLTOP=/usr/local/ssl
13MAKE= make -f Makefile.ssl
14MAKEDEPPROG= makedepend
15MAKEDEPEND= $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG)
16MAKEFILE= Makefile.ssl
17AR= ar r
18
19CFLAGS= $(INCLUDES) $(CFLAG)
20
21GENERAL=Makefile
22TEST=rsa_test.c
23APPS=
24
25LIB=$(TOP)/libcrypto.a
26LIBSRC= rsa_eay.c rsa_gen.c rsa_lib.c rsa_sign.c rsa_saos.c rsa_err.c \
27 rsa_pk1.c rsa_ssl.c rsa_none.c rsa_oaep.c rsa_chk.c rsa_null.c \
28 rsa_asn1.c
29LIBOBJ= rsa_eay.o rsa_gen.o rsa_lib.o rsa_sign.o rsa_saos.o rsa_err.o \
30 rsa_pk1.o rsa_ssl.o rsa_none.o rsa_oaep.o rsa_chk.o rsa_null.o \
31 rsa_asn1.o
32
33SRC= $(LIBSRC)
34
35EXHEADER= rsa.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.ssl >> $(TOP)/MINFO
52
53links:
54 @sh $(TOP)/util/point.sh Makefile.ssl Makefile
55 @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
56 @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
57 @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
58
59install:
60 @for i in $(EXHEADER) ; \
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 $(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
86rsa_asn1.o: ../../e_os.h ../../include/openssl/asn1.h
87rsa_asn1.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
88rsa_asn1.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
89rsa_asn1.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
90rsa_asn1.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
91rsa_asn1.o: ../../include/openssl/opensslconf.h
92rsa_asn1.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
93rsa_asn1.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
94rsa_asn1.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
95rsa_asn1.o: ../cryptlib.h rsa_asn1.c
96rsa_chk.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
97rsa_chk.o: ../../include/openssl/bn.h ../../include/openssl/crypto.h
98rsa_chk.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
99rsa_chk.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
100rsa_chk.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
101rsa_chk.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
102rsa_chk.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
103rsa_chk.o: rsa_chk.c
104rsa_eay.o: ../../e_os.h ../../include/openssl/asn1.h
105rsa_eay.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
106rsa_eay.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
107rsa_eay.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
108rsa_eay.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
109rsa_eay.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
110rsa_eay.o: ../../include/openssl/rand.h ../../include/openssl/rsa.h
111rsa_eay.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
112rsa_eay.o: ../../include/openssl/symhacks.h ../cryptlib.h rsa_eay.c
113rsa_err.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
114rsa_err.o: ../../include/openssl/bn.h ../../include/openssl/crypto.h
115rsa_err.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
116rsa_err.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
117rsa_err.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
118rsa_err.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
119rsa_err.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
120rsa_err.o: rsa_err.c
121rsa_gen.o: ../../e_os.h ../../include/openssl/asn1.h
122rsa_gen.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
123rsa_gen.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
124rsa_gen.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
125rsa_gen.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
126rsa_gen.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
127rsa_gen.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
128rsa_gen.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
129rsa_gen.o: ../cryptlib.h rsa_gen.c
130rsa_lib.o: ../../e_os.h ../../include/openssl/asn1.h
131rsa_lib.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
132rsa_lib.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
133rsa_lib.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
134rsa_lib.o: ../../include/openssl/e_os2.h ../../include/openssl/engine.h
135rsa_lib.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
136rsa_lib.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
137rsa_lib.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rand.h
138rsa_lib.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
139rsa_lib.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
140rsa_lib.o: ../../include/openssl/ui.h ../cryptlib.h rsa_lib.c
141rsa_none.o: ../../e_os.h ../../include/openssl/asn1.h
142rsa_none.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
143rsa_none.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
144rsa_none.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
145rsa_none.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
146rsa_none.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
147rsa_none.o: ../../include/openssl/rand.h ../../include/openssl/rsa.h
148rsa_none.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
149rsa_none.o: ../../include/openssl/symhacks.h ../cryptlib.h rsa_none.c
150rsa_null.o: ../../e_os.h ../../include/openssl/asn1.h
151rsa_null.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
152rsa_null.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
153rsa_null.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
154rsa_null.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
155rsa_null.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
156rsa_null.o: ../../include/openssl/rand.h ../../include/openssl/rsa.h
157rsa_null.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
158rsa_null.o: ../../include/openssl/symhacks.h ../cryptlib.h rsa_null.c
159rsa_oaep.o: ../../e_os.h ../../include/openssl/aes.h
160rsa_oaep.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
161rsa_oaep.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
162rsa_oaep.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
163rsa_oaep.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
164rsa_oaep.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
165rsa_oaep.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
166rsa_oaep.o: ../../include/openssl/err.h ../../include/openssl/evp.h
167rsa_oaep.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
168rsa_oaep.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
169rsa_oaep.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
170rsa_oaep.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
171rsa_oaep.o: ../../include/openssl/opensslconf.h
172rsa_oaep.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
173rsa_oaep.o: ../../include/openssl/rand.h ../../include/openssl/rc2.h
174rsa_oaep.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
175rsa_oaep.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
176rsa_oaep.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
177rsa_oaep.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
178rsa_oaep.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
179rsa_oaep.o: ../cryptlib.h rsa_oaep.c
180rsa_pk1.o: ../../e_os.h ../../include/openssl/asn1.h
181rsa_pk1.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
182rsa_pk1.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
183rsa_pk1.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
184rsa_pk1.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
185rsa_pk1.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
186rsa_pk1.o: ../../include/openssl/rand.h ../../include/openssl/rsa.h
187rsa_pk1.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
188rsa_pk1.o: ../../include/openssl/symhacks.h ../cryptlib.h rsa_pk1.c
189rsa_saos.o: ../../e_os.h ../../include/openssl/aes.h
190rsa_saos.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
191rsa_saos.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
192rsa_saos.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
193rsa_saos.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
194rsa_saos.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
195rsa_saos.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
196rsa_saos.o: ../../include/openssl/err.h ../../include/openssl/evp.h
197rsa_saos.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
198rsa_saos.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
199rsa_saos.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
200rsa_saos.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
201rsa_saos.o: ../../include/openssl/opensslconf.h
202rsa_saos.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
203rsa_saos.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
204rsa_saos.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
205rsa_saos.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
206rsa_saos.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
207rsa_saos.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
208rsa_saos.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
209rsa_saos.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
210rsa_saos.o: ../cryptlib.h rsa_saos.c
211rsa_sign.o: ../../e_os.h ../../include/openssl/aes.h
212rsa_sign.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
213rsa_sign.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
214rsa_sign.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
215rsa_sign.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
216rsa_sign.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
217rsa_sign.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
218rsa_sign.o: ../../include/openssl/err.h ../../include/openssl/evp.h
219rsa_sign.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
220rsa_sign.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
221rsa_sign.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
222rsa_sign.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
223rsa_sign.o: ../../include/openssl/opensslconf.h
224rsa_sign.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
225rsa_sign.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
226rsa_sign.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
227rsa_sign.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
228rsa_sign.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
229rsa_sign.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
230rsa_sign.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
231rsa_sign.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
232rsa_sign.o: ../cryptlib.h rsa_sign.c
233rsa_ssl.o: ../../e_os.h ../../include/openssl/asn1.h
234rsa_ssl.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
235rsa_ssl.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
236rsa_ssl.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
237rsa_ssl.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
238rsa_ssl.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
239rsa_ssl.o: ../../include/openssl/rand.h ../../include/openssl/rsa.h
240rsa_ssl.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
241rsa_ssl.o: ../../include/openssl/symhacks.h ../cryptlib.h rsa_ssl.c
diff --git a/src/lib/libcrypto/rsa/rsa.h b/src/lib/libcrypto/rsa/rsa.h
index 0b639cd37f..fc3bb5f86d 100644
--- a/src/lib/libcrypto/rsa/rsa.h
+++ b/src/lib/libcrypto/rsa/rsa.h
@@ -157,41 +157,33 @@ struct rsa_st
157#define RSA_3 0x3L 157#define RSA_3 0x3L
158#define RSA_F4 0x10001L 158#define RSA_F4 0x10001L
159 159
160#define RSA_METHOD_FLAG_NO_CHECK 0x0001 /* don't check pub/private match */ 160#define RSA_METHOD_FLAG_NO_CHECK 0x01 /* don't check pub/private match */
161 161
162#define RSA_FLAG_CACHE_PUBLIC 0x0002 162#define RSA_FLAG_CACHE_PUBLIC 0x02
163#define RSA_FLAG_CACHE_PRIVATE 0x0004 163#define RSA_FLAG_CACHE_PRIVATE 0x04
164#define RSA_FLAG_BLINDING 0x0008 164#define RSA_FLAG_BLINDING 0x08
165#define RSA_FLAG_THREAD_SAFE 0x0010 165#define RSA_FLAG_THREAD_SAFE 0x10
166/* This flag means the private key operations will be handled by rsa_mod_exp 166/* This flag means the private key operations will be handled by rsa_mod_exp
167 * and that they do not depend on the private key components being present: 167 * and that they do not depend on the private key components being present:
168 * for example a key stored in external hardware. Without this flag bn_mod_exp 168 * for example a key stored in external hardware. Without this flag bn_mod_exp
169 * gets called when private key components are absent. 169 * gets called when private key components are absent.
170 */ 170 */
171#define RSA_FLAG_EXT_PKEY 0x0020 171#define RSA_FLAG_EXT_PKEY 0x20
172 172
173/* This flag in the RSA_METHOD enables the new rsa_sign, rsa_verify functions. 173/* This flag in the RSA_METHOD enables the new rsa_sign, rsa_verify functions.
174 */ 174 */
175#define RSA_FLAG_SIGN_VER 0x0040 175#define RSA_FLAG_SIGN_VER 0x40
176 176
177#define RSA_FLAG_NO_BLINDING 0x0080 /* new with 0.9.6j and 0.9.7b; the built-in 177#define RSA_FLAG_NO_BLINDING 0x80 /* new with 0.9.6j and 0.9.7b; the built-in
178 * RSA implementation now uses blinding by 178 * RSA implementation now uses blinding by
179 * default (ignoring RSA_FLAG_BLINDING), 179 * default (ignoring RSA_FLAG_BLINDING),
180 * but other engines might not need it 180 * but other engines might not need it
181 */ 181 */
182#define RSA_FLAG_NO_EXP_CONSTTIME 0x0100 /* new with 0.9.7h; the built-in RSA
183 * implementation now uses constant time
184 * modular exponentiation for secret exponents
185 * by default. This flag causes the
186 * faster variable sliding window method to
187 * be used for all exponents.
188 */
189 182
190#define RSA_PKCS1_PADDING 1 183#define RSA_PKCS1_PADDING 1
191#define RSA_SSLV23_PADDING 2 184#define RSA_SSLV23_PADDING 2
192#define RSA_NO_PADDING 3 185#define RSA_NO_PADDING 3
193#define RSA_PKCS1_OAEP_PADDING 4 186#define RSA_PKCS1_OAEP_PADDING 4
194#define RSA_X931_PADDING 5
195 187
196#define RSA_PKCS1_PADDING_SIZE 11 188#define RSA_PKCS1_PADDING_SIZE 11
197 189
@@ -204,15 +196,6 @@ int RSA_size(const RSA *);
204RSA * RSA_generate_key(int bits, unsigned long e,void 196RSA * RSA_generate_key(int bits, unsigned long e,void
205 (*callback)(int,int,void *),void *cb_arg); 197 (*callback)(int,int,void *),void *cb_arg);
206int RSA_check_key(const RSA *); 198int RSA_check_key(const RSA *);
207#ifdef OPENSSL_FIPS
208int RSA_X931_derive(RSA *rsa, BIGNUM *p1, BIGNUM *p2, BIGNUM *q1, BIGNUM *q2,
209 void (*cb)(int, int, void *), void *cb_arg,
210 const BIGNUM *Xp1, const BIGNUM *Xp2, const BIGNUM *Xp,
211 const BIGNUM *Xq1, const BIGNUM *Xq2, const BIGNUM *Xq,
212 const BIGNUM *e);
213RSA *RSA_X931_generate_key(int bits, const BIGNUM *e,
214 void (*cb)(int,int,void *), void *cb_arg);
215#endif
216 /* next 4 return -1 on error */ 199 /* next 4 return -1 on error */
217int RSA_public_encrypt(int flen, const unsigned char *from, 200int RSA_public_encrypt(int flen, const unsigned char *from,
218 unsigned char *to, RSA *rsa,int padding); 201 unsigned char *to, RSA *rsa,int padding);
@@ -285,8 +268,6 @@ int RSA_padding_add_PKCS1_type_2(unsigned char *to,int tlen,
285 const unsigned char *f,int fl); 268 const unsigned char *f,int fl);
286int RSA_padding_check_PKCS1_type_2(unsigned char *to,int tlen, 269int RSA_padding_check_PKCS1_type_2(unsigned char *to,int tlen,
287 const unsigned char *f,int fl,int rsa_len); 270 const unsigned char *f,int fl,int rsa_len);
288int PKCS1_MGF1(unsigned char *mask, long len,
289 const unsigned char *seed, long seedlen, const EVP_MD *dgst);
290int RSA_padding_add_PKCS1_OAEP(unsigned char *to,int tlen, 271int RSA_padding_add_PKCS1_OAEP(unsigned char *to,int tlen,
291 const unsigned char *f,int fl, 272 const unsigned char *f,int fl,
292 const unsigned char *p,int pl); 273 const unsigned char *p,int pl);
@@ -301,17 +282,6 @@ int RSA_padding_add_none(unsigned char *to,int tlen,
301 const unsigned char *f,int fl); 282 const unsigned char *f,int fl);
302int RSA_padding_check_none(unsigned char *to,int tlen, 283int RSA_padding_check_none(unsigned char *to,int tlen,
303 const unsigned char *f,int fl,int rsa_len); 284 const unsigned char *f,int fl,int rsa_len);
304int RSA_padding_add_X931(unsigned char *to,int tlen,
305 const unsigned char *f,int fl);
306int RSA_padding_check_X931(unsigned char *to,int tlen,
307 const unsigned char *f,int fl,int rsa_len);
308int RSA_X931_hash_id(int nid);
309
310int RSA_verify_PKCS1_PSS(RSA *rsa, const unsigned char *mHash,
311 const EVP_MD *Hash, const unsigned char *EM, int sLen);
312int RSA_padding_add_PKCS1_PSS(RSA *rsa, unsigned char *EM,
313 const unsigned char *mHash,
314 const EVP_MD *Hash, int sLen);
315 285
316int RSA_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, 286int RSA_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,
317 CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func); 287 CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);
@@ -341,24 +311,20 @@ void ERR_load_RSA_strings(void);
341#define RSA_F_RSA_NULL 124 311#define RSA_F_RSA_NULL 124
342#define RSA_F_RSA_PADDING_ADD_NONE 107 312#define RSA_F_RSA_PADDING_ADD_NONE 107
343#define RSA_F_RSA_PADDING_ADD_PKCS1_OAEP 121 313#define RSA_F_RSA_PADDING_ADD_PKCS1_OAEP 121
344#define RSA_F_RSA_PADDING_ADD_PKCS1_PSS 125
345#define RSA_F_RSA_PADDING_ADD_PKCS1_TYPE_1 108 314#define RSA_F_RSA_PADDING_ADD_PKCS1_TYPE_1 108
346#define RSA_F_RSA_PADDING_ADD_PKCS1_TYPE_2 109 315#define RSA_F_RSA_PADDING_ADD_PKCS1_TYPE_2 109
347#define RSA_F_RSA_PADDING_ADD_SSLV23 110 316#define RSA_F_RSA_PADDING_ADD_SSLV23 110
348#define RSA_F_RSA_PADDING_ADD_X931 127
349#define RSA_F_RSA_PADDING_CHECK_NONE 111 317#define RSA_F_RSA_PADDING_CHECK_NONE 111
350#define RSA_F_RSA_PADDING_CHECK_PKCS1_OAEP 122 318#define RSA_F_RSA_PADDING_CHECK_PKCS1_OAEP 122
351#define RSA_F_RSA_PADDING_CHECK_PKCS1_TYPE_1 112 319#define RSA_F_RSA_PADDING_CHECK_PKCS1_TYPE_1 112
352#define RSA_F_RSA_PADDING_CHECK_PKCS1_TYPE_2 113 320#define RSA_F_RSA_PADDING_CHECK_PKCS1_TYPE_2 113
353#define RSA_F_RSA_PADDING_CHECK_SSLV23 114 321#define RSA_F_RSA_PADDING_CHECK_SSLV23 114
354#define RSA_F_RSA_PADDING_CHECK_X931 128
355#define RSA_F_RSA_PRINT 115 322#define RSA_F_RSA_PRINT 115
356#define RSA_F_RSA_PRINT_FP 116 323#define RSA_F_RSA_PRINT_FP 116
357#define RSA_F_RSA_SIGN 117 324#define RSA_F_RSA_SIGN 117
358#define RSA_F_RSA_SIGN_ASN1_OCTET_STRING 118 325#define RSA_F_RSA_SIGN_ASN1_OCTET_STRING 118
359#define RSA_F_RSA_VERIFY 119 326#define RSA_F_RSA_VERIFY 119
360#define RSA_F_RSA_VERIFY_ASN1_OCTET_STRING 120 327#define RSA_F_RSA_VERIFY_ASN1_OCTET_STRING 120
361#define RSA_F_RSA_VERIFY_PKCS1_PSS 126
362 328
363/* Reason codes. */ 329/* Reason codes. */
364#define RSA_R_ALGORITHM_MISMATCH 100 330#define RSA_R_ALGORITHM_MISMATCH 100
@@ -378,14 +344,9 @@ void ERR_load_RSA_strings(void);
378#define RSA_R_DMP1_NOT_CONGRUENT_TO_D 124 344#define RSA_R_DMP1_NOT_CONGRUENT_TO_D 124
379#define RSA_R_DMQ1_NOT_CONGRUENT_TO_D 125 345#define RSA_R_DMQ1_NOT_CONGRUENT_TO_D 125
380#define RSA_R_D_E_NOT_CONGRUENT_TO_1 123 346#define RSA_R_D_E_NOT_CONGRUENT_TO_1 123
381#define RSA_R_FIRST_OCTET_INVALID 133
382#define RSA_R_INVALID_HEADER 137
383#define RSA_R_INVALID_MESSAGE_LENGTH 131 347#define RSA_R_INVALID_MESSAGE_LENGTH 131
384#define RSA_R_INVALID_PADDING 138
385#define RSA_R_INVALID_TRAILER 139
386#define RSA_R_IQMP_NOT_INVERSE_OF_Q 126 348#define RSA_R_IQMP_NOT_INVERSE_OF_Q 126
387#define RSA_R_KEY_SIZE_TOO_SMALL 120 349#define RSA_R_KEY_SIZE_TOO_SMALL 120
388#define RSA_R_LAST_OCTET_INVALID 134
389#define RSA_R_NULL_BEFORE_BLOCK_MISSING 113 350#define RSA_R_NULL_BEFORE_BLOCK_MISSING 113
390#define RSA_R_N_DOES_NOT_EQUAL_P_Q 127 351#define RSA_R_N_DOES_NOT_EQUAL_P_Q 127
391#define RSA_R_OAEP_DECODING_ERROR 121 352#define RSA_R_OAEP_DECODING_ERROR 121
@@ -393,8 +354,6 @@ void ERR_load_RSA_strings(void);
393#define RSA_R_P_NOT_PRIME 128 354#define RSA_R_P_NOT_PRIME 128
394#define RSA_R_Q_NOT_PRIME 129 355#define RSA_R_Q_NOT_PRIME 129
395#define RSA_R_RSA_OPERATIONS_NOT_SUPPORTED 130 356#define RSA_R_RSA_OPERATIONS_NOT_SUPPORTED 130
396#define RSA_R_SLEN_CHECK_FAILED 136
397#define RSA_R_SLEN_RECOVERY_FAILED 135
398#define RSA_R_SSLV3_ROLLBACK_ATTACK 115 357#define RSA_R_SSLV3_ROLLBACK_ATTACK 115
399#define RSA_R_THE_ASN1_OBJECT_IDENTIFIER_IS_NOT_KNOWN_FOR_THIS_MD 116 358#define RSA_R_THE_ASN1_OBJECT_IDENTIFIER_IS_NOT_KNOWN_FOR_THIS_MD 116
400#define RSA_R_UNKNOWN_ALGORITHM_TYPE 117 359#define RSA_R_UNKNOWN_ALGORITHM_TYPE 117
diff --git a/src/lib/libcrypto/rsa/rsa_eay.c b/src/lib/libcrypto/rsa/rsa_eay.c
index be4ac96ce3..d4caab3f95 100644
--- a/src/lib/libcrypto/rsa/rsa_eay.c
+++ b/src/lib/libcrypto/rsa/rsa_eay.c
@@ -55,59 +55,6 @@
55 * copied and put under another distribution licence 55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.] 56 * [including the GNU Public Licence.]
57 */ 57 */
58/* ====================================================================
59 * Copyright (c) 1998-2005 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 58
112#include <stdio.h> 59#include <stdio.h>
113#include "cryptlib.h" 60#include "cryptlib.h"
@@ -198,13 +145,30 @@ static int RSA_eay_public_encrypt(int flen, const unsigned char *from,
198 goto err; 145 goto err;
199 } 146 }
200 147
201 if (rsa->flags & RSA_FLAG_CACHE_PUBLIC) 148 if ((rsa->_method_mod_n == NULL) && (rsa->flags & RSA_FLAG_CACHE_PUBLIC))
202 { 149 {
203 if (!BN_MONT_CTX_set_locked(&rsa->_method_mod_n, 150 BN_MONT_CTX* bn_mont_ctx;
204 CRYPTO_LOCK_RSA, rsa->n, ctx)) 151 if ((bn_mont_ctx=BN_MONT_CTX_new()) == NULL)
152 goto err;
153 if (!BN_MONT_CTX_set(bn_mont_ctx,rsa->n,ctx))
154 {
155 BN_MONT_CTX_free(bn_mont_ctx);
205 goto err; 156 goto err;
157 }
158 if (rsa->_method_mod_n == NULL) /* other thread may have finished first */
159 {
160 CRYPTO_w_lock(CRYPTO_LOCK_RSA);
161 if (rsa->_method_mod_n == NULL)
162 {
163 rsa->_method_mod_n = bn_mont_ctx;
164 bn_mont_ctx = NULL;
165 }
166 CRYPTO_w_unlock(CRYPTO_LOCK_RSA);
167 }
168 if (bn_mont_ctx)
169 BN_MONT_CTX_free(bn_mont_ctx);
206 } 170 }
207 171
208 if (!rsa->meth->bn_mod_exp(&ret,&f,rsa->e,rsa->n,ctx, 172 if (!rsa->meth->bn_mod_exp(&ret,&f,rsa->e,rsa->n,ctx,
209 rsa->_method_mod_n)) goto err; 173 rsa->_method_mod_n)) goto err;
210 174
@@ -285,7 +249,7 @@ err:
285static int RSA_eay_private_encrypt(int flen, const unsigned char *from, 249static int RSA_eay_private_encrypt(int flen, const unsigned char *from,
286 unsigned char *to, RSA *rsa, int padding) 250 unsigned char *to, RSA *rsa, int padding)
287 { 251 {
288 BIGNUM f,ret, *res; 252 BIGNUM f,ret;
289 int i,j,k,num=0,r= -1; 253 int i,j,k,num=0,r= -1;
290 unsigned char *buf=NULL; 254 unsigned char *buf=NULL;
291 BN_CTX *ctx=NULL; 255 BN_CTX *ctx=NULL;
@@ -367,43 +331,19 @@ static int RSA_eay_private_encrypt(int flen, const unsigned char *from,
367 (rsa->dmp1 != NULL) && 331 (rsa->dmp1 != NULL) &&
368 (rsa->dmq1 != NULL) && 332 (rsa->dmq1 != NULL) &&
369 (rsa->iqmp != NULL)) ) 333 (rsa->iqmp != NULL)) )
370 { 334 { if (!rsa->meth->rsa_mod_exp(&ret,&f,rsa)) goto err; }
371 if (!rsa->meth->rsa_mod_exp(&ret,&f,rsa)) goto err;
372 }
373 else 335 else
374 { 336 {
375 BIGNUM local_d; 337 if (!rsa->meth->bn_mod_exp(&ret,&f,rsa->d,rsa->n,ctx,NULL)) goto err;
376 BIGNUM *d = NULL;
377
378 if (!(rsa->flags & RSA_FLAG_NO_EXP_CONSTTIME))
379 {
380 BN_init(&local_d);
381 d = &local_d;
382 BN_with_flags(d, rsa->d, BN_FLG_EXP_CONSTTIME);
383 }
384 else
385 d = rsa->d;
386 if (!rsa->meth->bn_mod_exp(&ret,&f,d,rsa->n,ctx,NULL)) goto err;
387 } 338 }
388 339
389 if (blinding) 340 if (blinding)
390 if (!BN_BLINDING_invert(&ret, blinding, ctx)) goto err; 341 if (!BN_BLINDING_invert(&ret, blinding, ctx)) goto err;
391 342
392 if (padding == RSA_X931_PADDING)
393 {
394 BN_sub(&f, rsa->n, &ret);
395 if (BN_cmp(&ret, &f))
396 res = &f;
397 else
398 res = &ret;
399 }
400 else
401 res = &ret;
402
403 /* put in leading 0 bytes if the number is less than the 343 /* put in leading 0 bytes if the number is less than the
404 * length of the modulus */ 344 * length of the modulus */
405 j=BN_num_bytes(res); 345 j=BN_num_bytes(&ret);
406 i=BN_bn2bin(res,&(to[num-j])); 346 i=BN_bn2bin(&ret,&(to[num-j]));
407 for (k=0; k<(num-i); k++) 347 for (k=0; k<(num-i); k++)
408 to[k]=0; 348 to[k]=0;
409 349
@@ -504,22 +444,10 @@ static int RSA_eay_private_decrypt(int flen, const unsigned char *from,
504 (rsa->dmp1 != NULL) && 444 (rsa->dmp1 != NULL) &&
505 (rsa->dmq1 != NULL) && 445 (rsa->dmq1 != NULL) &&
506 (rsa->iqmp != NULL)) ) 446 (rsa->iqmp != NULL)) )
507 { 447 { if (!rsa->meth->rsa_mod_exp(&ret,&f,rsa)) goto err; }
508 if (!rsa->meth->rsa_mod_exp(&ret,&f,rsa)) goto err;
509 }
510 else 448 else
511 { 449 {
512 BIGNUM local_d; 450 if (!rsa->meth->bn_mod_exp(&ret,&f,rsa->d,rsa->n,ctx,NULL))
513 BIGNUM *d = NULL;
514
515 if (!(rsa->flags & RSA_FLAG_NO_EXP_CONSTTIME))
516 {
517 d = &local_d;
518 BN_with_flags(d, rsa->d, BN_FLG_EXP_CONSTTIME);
519 }
520 else
521 d = rsa->d;
522 if (!rsa->meth->bn_mod_exp(&ret,&f,d,rsa->n,ctx,NULL))
523 goto err; 451 goto err;
524 } 452 }
525 453
@@ -606,20 +534,33 @@ static int RSA_eay_public_decrypt(int flen, const unsigned char *from,
606 } 534 }
607 535
608 /* do the decrypt */ 536 /* do the decrypt */
609 537 if ((rsa->_method_mod_n == NULL) && (rsa->flags & RSA_FLAG_CACHE_PUBLIC))
610 if (rsa->flags & RSA_FLAG_CACHE_PUBLIC)
611 { 538 {
612 if (!BN_MONT_CTX_set_locked(&rsa->_method_mod_n, 539 BN_MONT_CTX* bn_mont_ctx;
613 CRYPTO_LOCK_RSA, rsa->n, ctx)) 540 if ((bn_mont_ctx=BN_MONT_CTX_new()) == NULL)
541 goto err;
542 if (!BN_MONT_CTX_set(bn_mont_ctx,rsa->n,ctx))
543 {
544 BN_MONT_CTX_free(bn_mont_ctx);
614 goto err; 545 goto err;
546 }
547 if (rsa->_method_mod_n == NULL) /* other thread may have finished first */
548 {
549 CRYPTO_w_lock(CRYPTO_LOCK_RSA);
550 if (rsa->_method_mod_n == NULL)
551 {
552 rsa->_method_mod_n = bn_mont_ctx;
553 bn_mont_ctx = NULL;
554 }
555 CRYPTO_w_unlock(CRYPTO_LOCK_RSA);
556 }
557 if (bn_mont_ctx)
558 BN_MONT_CTX_free(bn_mont_ctx);
615 } 559 }
616 560
617 if (!rsa->meth->bn_mod_exp(&ret,&f,rsa->e,rsa->n,ctx, 561 if (!rsa->meth->bn_mod_exp(&ret,&f,rsa->e,rsa->n,ctx,
618 rsa->_method_mod_n)) goto err; 562 rsa->_method_mod_n)) goto err;
619 563
620 if ((padding == RSA_X931_PADDING) && ((ret.d[0] & 0xf) != 12))
621 BN_sub(&ret, rsa->n, &ret);
622
623 p=buf; 564 p=buf;
624 i=BN_bn2bin(&ret,p); 565 i=BN_bn2bin(&ret,p);
625 566
@@ -653,8 +594,6 @@ err:
653static int RSA_eay_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa) 594static int RSA_eay_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa)
654 { 595 {
655 BIGNUM r1,m1,vrfy; 596 BIGNUM r1,m1,vrfy;
656 BIGNUM local_dmp1, local_dmq1;
657 BIGNUM *dmp1, *dmq1;
658 int ret=0; 597 int ret=0;
659 BN_CTX *ctx; 598 BN_CTX *ctx;
660 599
@@ -665,34 +604,61 @@ static int RSA_eay_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa)
665 604
666 if (rsa->flags & RSA_FLAG_CACHE_PRIVATE) 605 if (rsa->flags & RSA_FLAG_CACHE_PRIVATE)
667 { 606 {
668 if (!BN_MONT_CTX_set_locked(&rsa->_method_mod_p, 607 if (rsa->_method_mod_p == NULL)
669 CRYPTO_LOCK_RSA, rsa->p, ctx)) 608 {
670 goto err; 609 BN_MONT_CTX* bn_mont_ctx;
671 if (!BN_MONT_CTX_set_locked(&rsa->_method_mod_q, 610 if ((bn_mont_ctx=BN_MONT_CTX_new()) == NULL)
672 CRYPTO_LOCK_RSA, rsa->q, ctx)) 611 goto err;
673 goto err; 612 if (!BN_MONT_CTX_set(bn_mont_ctx,rsa->p,ctx))
674 } 613 {
614 BN_MONT_CTX_free(bn_mont_ctx);
615 goto err;
616 }
617 if (rsa->_method_mod_p == NULL) /* other thread may have finished first */
618 {
619 CRYPTO_w_lock(CRYPTO_LOCK_RSA);
620 if (rsa->_method_mod_p == NULL)
621 {
622 rsa->_method_mod_p = bn_mont_ctx;
623 bn_mont_ctx = NULL;
624 }
625 CRYPTO_w_unlock(CRYPTO_LOCK_RSA);
626 }
627 if (bn_mont_ctx)
628 BN_MONT_CTX_free(bn_mont_ctx);
629 }
675 630
676 if (!BN_mod(&r1,I,rsa->q,ctx)) goto err; 631 if (rsa->_method_mod_q == NULL)
677 if (!(rsa->flags & RSA_FLAG_NO_EXP_CONSTTIME)) 632 {
678 { 633 BN_MONT_CTX* bn_mont_ctx;
679 dmq1 = &local_dmq1; 634 if ((bn_mont_ctx=BN_MONT_CTX_new()) == NULL)
680 BN_with_flags(dmq1, rsa->dmq1, BN_FLG_EXP_CONSTTIME); 635 goto err;
636 if (!BN_MONT_CTX_set(bn_mont_ctx,rsa->q,ctx))
637 {
638 BN_MONT_CTX_free(bn_mont_ctx);
639 goto err;
640 }
641 if (rsa->_method_mod_q == NULL) /* other thread may have finished first */
642 {
643 CRYPTO_w_lock(CRYPTO_LOCK_RSA);
644 if (rsa->_method_mod_q == NULL)
645 {
646 rsa->_method_mod_q = bn_mont_ctx;
647 bn_mont_ctx = NULL;
648 }
649 CRYPTO_w_unlock(CRYPTO_LOCK_RSA);
650 }
651 if (bn_mont_ctx)
652 BN_MONT_CTX_free(bn_mont_ctx);
653 }
681 } 654 }
682 else 655
683 dmq1 = rsa->dmq1; 656 if (!BN_mod(&r1,I,rsa->q,ctx)) goto err;
684 if (!rsa->meth->bn_mod_exp(&m1,&r1,dmq1,rsa->q,ctx, 657 if (!rsa->meth->bn_mod_exp(&m1,&r1,rsa->dmq1,rsa->q,ctx,
685 rsa->_method_mod_q)) goto err; 658 rsa->_method_mod_q)) goto err;
686 659
687 if (!BN_mod(&r1,I,rsa->p,ctx)) goto err; 660 if (!BN_mod(&r1,I,rsa->p,ctx)) goto err;
688 if (!(rsa->flags & RSA_FLAG_NO_EXP_CONSTTIME)) 661 if (!rsa->meth->bn_mod_exp(r0,&r1,rsa->dmp1,rsa->p,ctx,
689 {
690 dmp1 = &local_dmp1;
691 BN_with_flags(dmp1, rsa->dmp1, BN_FLG_EXP_CONSTTIME);
692 }
693 else
694 dmp1 = rsa->dmp1;
695 if (!rsa->meth->bn_mod_exp(r0,&r1,dmp1,rsa->p,ctx,
696 rsa->_method_mod_p)) goto err; 662 rsa->_method_mod_p)) goto err;
697 663
698 if (!BN_sub(r0,r0,&m1)) goto err; 664 if (!BN_sub(r0,r0,&m1)) goto err;
@@ -727,23 +693,10 @@ static int RSA_eay_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa)
727 if (vrfy.neg) 693 if (vrfy.neg)
728 if (!BN_add(&vrfy, &vrfy, rsa->n)) goto err; 694 if (!BN_add(&vrfy, &vrfy, rsa->n)) goto err;
729 if (!BN_is_zero(&vrfy)) 695 if (!BN_is_zero(&vrfy))
730 {
731 /* 'I' and 'vrfy' aren't congruent mod n. Don't leak 696 /* 'I' and 'vrfy' aren't congruent mod n. Don't leak
732 * miscalculated CRT output, just do a raw (slower) 697 * miscalculated CRT output, just do a raw (slower)
733 * mod_exp and return that instead. */ 698 * mod_exp and return that instead. */
734 699 if (!rsa->meth->bn_mod_exp(r0,I,rsa->d,rsa->n,ctx,NULL)) goto err;
735 BIGNUM local_d;
736 BIGNUM *d = NULL;
737
738 if (!(rsa->flags & RSA_FLAG_NO_EXP_CONSTTIME))
739 {
740 d = &local_d;
741 BN_with_flags(d, rsa->d, BN_FLG_EXP_CONSTTIME);
742 }
743 else
744 d = rsa->d;
745 if (!rsa->meth->bn_mod_exp(r0,I,d,rsa->n,ctx,NULL)) goto err;
746 }
747 } 700 }
748 ret=1; 701 ret=1;
749err: 702err:
diff --git a/src/lib/libcrypto/rsa/rsa_err.c b/src/lib/libcrypto/rsa/rsa_err.c
index 2ec4b30ff7..a7766c3b76 100644
--- a/src/lib/libcrypto/rsa/rsa_err.c
+++ b/src/lib/libcrypto/rsa/rsa_err.c
@@ -1,6 +1,6 @@
1/* crypto/rsa/rsa_err.c */ 1/* crypto/rsa/rsa_err.c */
2/* ==================================================================== 2/* ====================================================================
3 * Copyright (c) 1999-2005 The OpenSSL Project. All rights reserved. 3 * Copyright (c) 1999 The OpenSSL Project. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
@@ -64,85 +64,70 @@
64 64
65/* BEGIN ERROR CODES */ 65/* BEGIN ERROR CODES */
66#ifndef OPENSSL_NO_ERR 66#ifndef OPENSSL_NO_ERR
67
68#define ERR_FUNC(func) ERR_PACK(ERR_LIB_RSA,func,0)
69#define ERR_REASON(reason) ERR_PACK(ERR_LIB_RSA,0,reason)
70
71static ERR_STRING_DATA RSA_str_functs[]= 67static ERR_STRING_DATA RSA_str_functs[]=
72 { 68 {
73{ERR_FUNC(RSA_F_MEMORY_LOCK), "MEMORY_LOCK"}, 69{ERR_PACK(0,RSA_F_MEMORY_LOCK,0), "MEMORY_LOCK"},
74{ERR_FUNC(RSA_F_RSA_CHECK_KEY), "RSA_check_key"}, 70{ERR_PACK(0,RSA_F_RSA_CHECK_KEY,0), "RSA_check_key"},
75{ERR_FUNC(RSA_F_RSA_EAY_PRIVATE_DECRYPT), "RSA_EAY_PRIVATE_DECRYPT"}, 71{ERR_PACK(0,RSA_F_RSA_EAY_PRIVATE_DECRYPT,0), "RSA_EAY_PRIVATE_DECRYPT"},
76{ERR_FUNC(RSA_F_RSA_EAY_PRIVATE_ENCRYPT), "RSA_EAY_PRIVATE_ENCRYPT"}, 72{ERR_PACK(0,RSA_F_RSA_EAY_PRIVATE_ENCRYPT,0), "RSA_EAY_PRIVATE_ENCRYPT"},
77{ERR_FUNC(RSA_F_RSA_EAY_PUBLIC_DECRYPT), "RSA_EAY_PUBLIC_DECRYPT"}, 73{ERR_PACK(0,RSA_F_RSA_EAY_PUBLIC_DECRYPT,0), "RSA_EAY_PUBLIC_DECRYPT"},
78{ERR_FUNC(RSA_F_RSA_EAY_PUBLIC_ENCRYPT), "RSA_EAY_PUBLIC_ENCRYPT"}, 74{ERR_PACK(0,RSA_F_RSA_EAY_PUBLIC_ENCRYPT,0), "RSA_EAY_PUBLIC_ENCRYPT"},
79{ERR_FUNC(RSA_F_RSA_GENERATE_KEY), "RSA_generate_key"}, 75{ERR_PACK(0,RSA_F_RSA_GENERATE_KEY,0), "RSA_generate_key"},
80{ERR_FUNC(RSA_F_RSA_NEW_METHOD), "RSA_new_method"}, 76{ERR_PACK(0,RSA_F_RSA_NEW_METHOD,0), "RSA_new_method"},
81{ERR_FUNC(RSA_F_RSA_NULL), "RSA_NULL"}, 77{ERR_PACK(0,RSA_F_RSA_NULL,0), "RSA_NULL"},
82{ERR_FUNC(RSA_F_RSA_PADDING_ADD_NONE), "RSA_padding_add_none"}, 78{ERR_PACK(0,RSA_F_RSA_PADDING_ADD_NONE,0), "RSA_padding_add_none"},
83{ERR_FUNC(RSA_F_RSA_PADDING_ADD_PKCS1_OAEP), "RSA_padding_add_PKCS1_OAEP"}, 79{ERR_PACK(0,RSA_F_RSA_PADDING_ADD_PKCS1_OAEP,0), "RSA_padding_add_PKCS1_OAEP"},
84{ERR_FUNC(RSA_F_RSA_PADDING_ADD_PKCS1_PSS), "RSA_padding_add_PKCS1_PSS"}, 80{ERR_PACK(0,RSA_F_RSA_PADDING_ADD_PKCS1_TYPE_1,0), "RSA_padding_add_PKCS1_type_1"},
85{ERR_FUNC(RSA_F_RSA_PADDING_ADD_PKCS1_TYPE_1), "RSA_padding_add_PKCS1_type_1"}, 81{ERR_PACK(0,RSA_F_RSA_PADDING_ADD_PKCS1_TYPE_2,0), "RSA_padding_add_PKCS1_type_2"},
86{ERR_FUNC(RSA_F_RSA_PADDING_ADD_PKCS1_TYPE_2), "RSA_padding_add_PKCS1_type_2"}, 82{ERR_PACK(0,RSA_F_RSA_PADDING_ADD_SSLV23,0), "RSA_padding_add_SSLv23"},
87{ERR_FUNC(RSA_F_RSA_PADDING_ADD_SSLV23), "RSA_padding_add_SSLv23"}, 83{ERR_PACK(0,RSA_F_RSA_PADDING_CHECK_NONE,0), "RSA_padding_check_none"},
88{ERR_FUNC(RSA_F_RSA_PADDING_ADD_X931), "RSA_padding_add_X931"}, 84{ERR_PACK(0,RSA_F_RSA_PADDING_CHECK_PKCS1_OAEP,0), "RSA_padding_check_PKCS1_OAEP"},
89{ERR_FUNC(RSA_F_RSA_PADDING_CHECK_NONE), "RSA_padding_check_none"}, 85{ERR_PACK(0,RSA_F_RSA_PADDING_CHECK_PKCS1_TYPE_1,0), "RSA_padding_check_PKCS1_type_1"},
90{ERR_FUNC(RSA_F_RSA_PADDING_CHECK_PKCS1_OAEP), "RSA_padding_check_PKCS1_OAEP"}, 86{ERR_PACK(0,RSA_F_RSA_PADDING_CHECK_PKCS1_TYPE_2,0), "RSA_padding_check_PKCS1_type_2"},
91{ERR_FUNC(RSA_F_RSA_PADDING_CHECK_PKCS1_TYPE_1), "RSA_padding_check_PKCS1_type_1"}, 87{ERR_PACK(0,RSA_F_RSA_PADDING_CHECK_SSLV23,0), "RSA_padding_check_SSLv23"},
92{ERR_FUNC(RSA_F_RSA_PADDING_CHECK_PKCS1_TYPE_2), "RSA_padding_check_PKCS1_type_2"}, 88{ERR_PACK(0,RSA_F_RSA_PRINT,0), "RSA_print"},
93{ERR_FUNC(RSA_F_RSA_PADDING_CHECK_SSLV23), "RSA_padding_check_SSLv23"}, 89{ERR_PACK(0,RSA_F_RSA_PRINT_FP,0), "RSA_print_fp"},
94{ERR_FUNC(RSA_F_RSA_PADDING_CHECK_X931), "RSA_padding_check_X931"}, 90{ERR_PACK(0,RSA_F_RSA_SIGN,0), "RSA_sign"},
95{ERR_FUNC(RSA_F_RSA_PRINT), "RSA_print"}, 91{ERR_PACK(0,RSA_F_RSA_SIGN_ASN1_OCTET_STRING,0), "RSA_sign_ASN1_OCTET_STRING"},
96{ERR_FUNC(RSA_F_RSA_PRINT_FP), "RSA_print_fp"}, 92{ERR_PACK(0,RSA_F_RSA_VERIFY,0), "RSA_verify"},
97{ERR_FUNC(RSA_F_RSA_SIGN), "RSA_sign"}, 93{ERR_PACK(0,RSA_F_RSA_VERIFY_ASN1_OCTET_STRING,0), "RSA_verify_ASN1_OCTET_STRING"},
98{ERR_FUNC(RSA_F_RSA_SIGN_ASN1_OCTET_STRING), "RSA_sign_ASN1_OCTET_STRING"},
99{ERR_FUNC(RSA_F_RSA_VERIFY), "RSA_verify"},
100{ERR_FUNC(RSA_F_RSA_VERIFY_ASN1_OCTET_STRING), "RSA_verify_ASN1_OCTET_STRING"},
101{ERR_FUNC(RSA_F_RSA_VERIFY_PKCS1_PSS), "RSA_verify_PKCS1_PSS"},
102{0,NULL} 94{0,NULL}
103 }; 95 };
104 96
105static ERR_STRING_DATA RSA_str_reasons[]= 97static ERR_STRING_DATA RSA_str_reasons[]=
106 { 98 {
107{ERR_REASON(RSA_R_ALGORITHM_MISMATCH) ,"algorithm mismatch"}, 99{RSA_R_ALGORITHM_MISMATCH ,"algorithm mismatch"},
108{ERR_REASON(RSA_R_BAD_E_VALUE) ,"bad e value"}, 100{RSA_R_BAD_E_VALUE ,"bad e value"},
109{ERR_REASON(RSA_R_BAD_FIXED_HEADER_DECRYPT),"bad fixed header decrypt"}, 101{RSA_R_BAD_FIXED_HEADER_DECRYPT ,"bad fixed header decrypt"},
110{ERR_REASON(RSA_R_BAD_PAD_BYTE_COUNT) ,"bad pad byte count"}, 102{RSA_R_BAD_PAD_BYTE_COUNT ,"bad pad byte count"},
111{ERR_REASON(RSA_R_BAD_SIGNATURE) ,"bad signature"}, 103{RSA_R_BAD_SIGNATURE ,"bad signature"},
112{ERR_REASON(RSA_R_BLOCK_TYPE_IS_NOT_01) ,"block type is not 01"}, 104{RSA_R_BLOCK_TYPE_IS_NOT_01 ,"block type is not 01"},
113{ERR_REASON(RSA_R_BLOCK_TYPE_IS_NOT_02) ,"block type is not 02"}, 105{RSA_R_BLOCK_TYPE_IS_NOT_02 ,"block type is not 02"},
114{ERR_REASON(RSA_R_DATA_GREATER_THAN_MOD_LEN),"data greater than mod len"}, 106{RSA_R_DATA_GREATER_THAN_MOD_LEN ,"data greater than mod len"},
115{ERR_REASON(RSA_R_DATA_TOO_LARGE) ,"data too large"}, 107{RSA_R_DATA_TOO_LARGE ,"data too large"},
116{ERR_REASON(RSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE),"data too large for key size"}, 108{RSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE ,"data too large for key size"},
117{ERR_REASON(RSA_R_DATA_TOO_LARGE_FOR_MODULUS),"data too large for modulus"}, 109{RSA_R_DATA_TOO_LARGE_FOR_MODULUS ,"data too large for modulus"},
118{ERR_REASON(RSA_R_DATA_TOO_SMALL) ,"data too small"}, 110{RSA_R_DATA_TOO_SMALL ,"data too small"},
119{ERR_REASON(RSA_R_DATA_TOO_SMALL_FOR_KEY_SIZE),"data too small for key size"}, 111{RSA_R_DATA_TOO_SMALL_FOR_KEY_SIZE ,"data too small for key size"},
120{ERR_REASON(RSA_R_DIGEST_TOO_BIG_FOR_RSA_KEY),"digest too big for rsa key"}, 112{RSA_R_DIGEST_TOO_BIG_FOR_RSA_KEY ,"digest too big for rsa key"},
121{ERR_REASON(RSA_R_DMP1_NOT_CONGRUENT_TO_D),"dmp1 not congruent to d"}, 113{RSA_R_DMP1_NOT_CONGRUENT_TO_D ,"dmp1 not congruent to d"},
122{ERR_REASON(RSA_R_DMQ1_NOT_CONGRUENT_TO_D),"dmq1 not congruent to d"}, 114{RSA_R_DMQ1_NOT_CONGRUENT_TO_D ,"dmq1 not congruent to d"},
123{ERR_REASON(RSA_R_D_E_NOT_CONGRUENT_TO_1),"d e not congruent to 1"}, 115{RSA_R_D_E_NOT_CONGRUENT_TO_1 ,"d e not congruent to 1"},
124{ERR_REASON(RSA_R_FIRST_OCTET_INVALID) ,"first octet invalid"}, 116{RSA_R_INVALID_MESSAGE_LENGTH ,"invalid message length"},
125{ERR_REASON(RSA_R_INVALID_HEADER) ,"invalid header"}, 117{RSA_R_IQMP_NOT_INVERSE_OF_Q ,"iqmp not inverse of q"},
126{ERR_REASON(RSA_R_INVALID_MESSAGE_LENGTH),"invalid message length"}, 118{RSA_R_KEY_SIZE_TOO_SMALL ,"key size too small"},
127{ERR_REASON(RSA_R_INVALID_PADDING) ,"invalid padding"}, 119{RSA_R_NULL_BEFORE_BLOCK_MISSING ,"null before block missing"},
128{ERR_REASON(RSA_R_INVALID_TRAILER) ,"invalid trailer"}, 120{RSA_R_N_DOES_NOT_EQUAL_P_Q ,"n does not equal p q"},
129{ERR_REASON(RSA_R_IQMP_NOT_INVERSE_OF_Q) ,"iqmp not inverse of q"}, 121{RSA_R_OAEP_DECODING_ERROR ,"oaep decoding error"},
130{ERR_REASON(RSA_R_KEY_SIZE_TOO_SMALL) ,"key size too small"}, 122{RSA_R_PADDING_CHECK_FAILED ,"padding check failed"},
131{ERR_REASON(RSA_R_LAST_OCTET_INVALID) ,"last octet invalid"}, 123{RSA_R_P_NOT_PRIME ,"p not prime"},
132{ERR_REASON(RSA_R_NULL_BEFORE_BLOCK_MISSING),"null before block missing"}, 124{RSA_R_Q_NOT_PRIME ,"q not prime"},
133{ERR_REASON(RSA_R_N_DOES_NOT_EQUAL_P_Q) ,"n does not equal p q"}, 125{RSA_R_RSA_OPERATIONS_NOT_SUPPORTED ,"rsa operations not supported"},
134{ERR_REASON(RSA_R_OAEP_DECODING_ERROR) ,"oaep decoding error"}, 126{RSA_R_SSLV3_ROLLBACK_ATTACK ,"sslv3 rollback attack"},
135{ERR_REASON(RSA_R_SLEN_RECOVERY_FAILED) ,"salt length recovery failed"}, 127{RSA_R_THE_ASN1_OBJECT_IDENTIFIER_IS_NOT_KNOWN_FOR_THIS_MD,"the asn1 object identifier is not known for this md"},
136{ERR_REASON(RSA_R_PADDING_CHECK_FAILED) ,"padding check failed"}, 128{RSA_R_UNKNOWN_ALGORITHM_TYPE ,"unknown algorithm type"},
137{ERR_REASON(RSA_R_P_NOT_PRIME) ,"p not prime"}, 129{RSA_R_UNKNOWN_PADDING_TYPE ,"unknown padding type"},
138{ERR_REASON(RSA_R_Q_NOT_PRIME) ,"q not prime"}, 130{RSA_R_WRONG_SIGNATURE_LENGTH ,"wrong signature length"},
139{ERR_REASON(RSA_R_RSA_OPERATIONS_NOT_SUPPORTED),"rsa operations not supported"},
140{ERR_REASON(RSA_R_SSLV3_ROLLBACK_ATTACK) ,"sslv3 rollback attack"},
141{ERR_REASON(RSA_R_THE_ASN1_OBJECT_IDENTIFIER_IS_NOT_KNOWN_FOR_THIS_MD),"the asn1 object identifier is not known for this md"},
142{ERR_REASON(RSA_R_UNKNOWN_ALGORITHM_TYPE),"unknown algorithm type"},
143{ERR_REASON(RSA_R_UNKNOWN_PADDING_TYPE) ,"unknown padding type"},
144{ERR_REASON(RSA_R_WRONG_SIGNATURE_LENGTH),"wrong signature length"},
145{ERR_REASON(RSA_R_SLEN_CHECK_FAILED) ,"salt length check failed"},
146{0,NULL} 131{0,NULL}
147 }; 132 };
148 133
@@ -156,8 +141,8 @@ void ERR_load_RSA_strings(void)
156 { 141 {
157 init=0; 142 init=0;
158#ifndef OPENSSL_NO_ERR 143#ifndef OPENSSL_NO_ERR
159 ERR_load_strings(0,RSA_str_functs); 144 ERR_load_strings(ERR_LIB_RSA,RSA_str_functs);
160 ERR_load_strings(0,RSA_str_reasons); 145 ERR_load_strings(ERR_LIB_RSA,RSA_str_reasons);
161#endif 146#endif
162 147
163 } 148 }
diff --git a/src/lib/libcrypto/rsa/rsa_gen.c b/src/lib/libcrypto/rsa/rsa_gen.c
index dd1422cc98..adb5e34da5 100644
--- a/src/lib/libcrypto/rsa/rsa_gen.c
+++ b/src/lib/libcrypto/rsa/rsa_gen.c
@@ -184,8 +184,7 @@ err:
184 RSAerr(RSA_F_RSA_GENERATE_KEY,ERR_LIB_BN); 184 RSAerr(RSA_F_RSA_GENERATE_KEY,ERR_LIB_BN);
185 ok=0; 185 ok=0;
186 } 186 }
187 if (ctx != NULL) 187 BN_CTX_end(ctx);
188 BN_CTX_end(ctx);
189 BN_CTX_free(ctx); 188 BN_CTX_free(ctx);
190 BN_CTX_free(ctx2); 189 BN_CTX_free(ctx2);
191 190
diff --git a/src/lib/libcrypto/rsa/rsa_null.c b/src/lib/libcrypto/rsa/rsa_null.c
new file mode 100644
index 0000000000..64057fbdcf
--- /dev/null
+++ b/src/lib/libcrypto/rsa/rsa_null.c
@@ -0,0 +1,150 @@
1/* rsa_null.c */
2/* Written by Dr Stephen N Henson (shenson@bigfoot.com) 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 };
98
99const RSA_METHOD *RSA_null_method(void)
100 {
101 return(&rsa_null_meth);
102 }
103
104static int RSA_null_public_encrypt(int flen, const unsigned char *from,
105 unsigned char *to, RSA *rsa, int padding)
106 {
107 RSAerr(RSA_F_RSA_NULL, RSA_R_RSA_OPERATIONS_NOT_SUPPORTED);
108 return -1;
109 }
110
111static int RSA_null_private_encrypt(int flen, const unsigned char *from,
112 unsigned char *to, RSA *rsa, int padding)
113 {
114 RSAerr(RSA_F_RSA_NULL, RSA_R_RSA_OPERATIONS_NOT_SUPPORTED);
115 return -1;
116 }
117
118static int RSA_null_private_decrypt(int flen, const unsigned char *from,
119 unsigned char *to, RSA *rsa, int padding)
120 {
121 RSAerr(RSA_F_RSA_NULL, RSA_R_RSA_OPERATIONS_NOT_SUPPORTED);
122 return -1;
123 }
124
125static int RSA_null_public_decrypt(int flen, const unsigned char *from,
126 unsigned char *to, RSA *rsa, int padding)
127 {
128 RSAerr(RSA_F_RSA_NULL, RSA_R_RSA_OPERATIONS_NOT_SUPPORTED);
129 return -1;
130 }
131
132#if 0 /* not currently used */
133static int RSA_null_mod_exp(BIGNUM *r0, BIGNUM *I, RSA *rsa)
134 {
135 RSAerr(RSA_F_RSA_NULL, RSA_R_RSA_OPERATIONS_NOT_SUPPORTED);
136 return -1;
137 }
138#endif
139
140static int RSA_null_init(RSA *rsa)
141 {
142 return(1);
143 }
144
145static int RSA_null_finish(RSA *rsa)
146 {
147 return(1);
148 }
149
150
diff --git a/src/lib/libcrypto/rsa/rsa_oaep.c b/src/lib/libcrypto/rsa/rsa_oaep.c
index d43ecaca63..e3f7c608ec 100644
--- a/src/lib/libcrypto/rsa/rsa_oaep.c
+++ b/src/lib/libcrypto/rsa/rsa_oaep.c
@@ -28,6 +28,9 @@
28#include <openssl/rand.h> 28#include <openssl/rand.h>
29#include <openssl/sha.h> 29#include <openssl/sha.h>
30 30
31int MGF1(unsigned char *mask, long len,
32 const unsigned char *seed, long seedlen);
33
31int RSA_padding_add_PKCS1_OAEP(unsigned char *to, int tlen, 34int RSA_padding_add_PKCS1_OAEP(unsigned char *to, int tlen,
32 const unsigned char *from, int flen, 35 const unsigned char *from, int flen,
33 const unsigned char *param, int plen) 36 const unsigned char *param, int plen)
@@ -73,13 +76,11 @@ int RSA_padding_add_PKCS1_OAEP(unsigned char *to, int tlen,
73 20); 76 20);
74#endif 77#endif
75 78
76 PKCS1_MGF1(dbmask, emlen - SHA_DIGEST_LENGTH, seed, SHA_DIGEST_LENGTH, 79 MGF1(dbmask, emlen - SHA_DIGEST_LENGTH, seed, SHA_DIGEST_LENGTH);
77 EVP_sha1());
78 for (i = 0; i < emlen - SHA_DIGEST_LENGTH; i++) 80 for (i = 0; i < emlen - SHA_DIGEST_LENGTH; i++)
79 db[i] ^= dbmask[i]; 81 db[i] ^= dbmask[i];
80 82
81 PKCS1_MGF1(seedmask, SHA_DIGEST_LENGTH, db, emlen - SHA_DIGEST_LENGTH, 83 MGF1(seedmask, SHA_DIGEST_LENGTH, db, emlen - SHA_DIGEST_LENGTH);
82 EVP_sha1());
83 for (i = 0; i < SHA_DIGEST_LENGTH; i++) 84 for (i = 0; i < SHA_DIGEST_LENGTH; i++)
84 seed[i] ^= seedmask[i]; 85 seed[i] ^= seedmask[i];
85 86
@@ -125,11 +126,11 @@ int RSA_padding_check_PKCS1_OAEP(unsigned char *to, int tlen,
125 return -1; 126 return -1;
126 } 127 }
127 128
128 PKCS1_MGF1(seed, SHA_DIGEST_LENGTH, maskeddb, dblen, EVP_sha1()); 129 MGF1(seed, SHA_DIGEST_LENGTH, maskeddb, dblen);
129 for (i = lzero; i < SHA_DIGEST_LENGTH; i++) 130 for (i = lzero; i < SHA_DIGEST_LENGTH; i++)
130 seed[i] ^= from[i - lzero]; 131 seed[i] ^= from[i - lzero];
131 132
132 PKCS1_MGF1(db, dblen, seed, SHA_DIGEST_LENGTH, EVP_sha1()); 133 MGF1(db, dblen, seed, SHA_DIGEST_LENGTH);
133 for (i = 0; i < dblen; i++) 134 for (i = 0; i < dblen; i++)
134 db[i] ^= maskeddb[i]; 135 db[i] ^= maskeddb[i];
135 136
@@ -169,30 +170,28 @@ decoding_err:
169 return -1; 170 return -1;
170 } 171 }
171 172
172int PKCS1_MGF1(unsigned char *mask, long len, 173int MGF1(unsigned char *mask, long len,
173 const unsigned char *seed, long seedlen, const EVP_MD *dgst) 174 const unsigned char *seed, long seedlen)
174 { 175 {
175 long i, outlen = 0; 176 long i, outlen = 0;
176 unsigned char cnt[4]; 177 unsigned char cnt[4];
177 EVP_MD_CTX c; 178 EVP_MD_CTX c;
178 unsigned char md[EVP_MAX_MD_SIZE]; 179 unsigned char md[SHA_DIGEST_LENGTH];
179 int mdlen;
180 180
181 EVP_MD_CTX_init(&c); 181 EVP_MD_CTX_init(&c);
182 mdlen = EVP_MD_size(dgst);
183 for (i = 0; outlen < len; i++) 182 for (i = 0; outlen < len; i++)
184 { 183 {
185 cnt[0] = (unsigned char)((i >> 24) & 255); 184 cnt[0] = (unsigned char)((i >> 24) & 255);
186 cnt[1] = (unsigned char)((i >> 16) & 255); 185 cnt[1] = (unsigned char)((i >> 16) & 255);
187 cnt[2] = (unsigned char)((i >> 8)) & 255; 186 cnt[2] = (unsigned char)((i >> 8)) & 255;
188 cnt[3] = (unsigned char)(i & 255); 187 cnt[3] = (unsigned char)(i & 255);
189 EVP_DigestInit_ex(&c,dgst, NULL); 188 EVP_DigestInit_ex(&c,EVP_sha1(), NULL);
190 EVP_DigestUpdate(&c, seed, seedlen); 189 EVP_DigestUpdate(&c, seed, seedlen);
191 EVP_DigestUpdate(&c, cnt, 4); 190 EVP_DigestUpdate(&c, cnt, 4);
192 if (outlen + mdlen <= len) 191 if (outlen + SHA_DIGEST_LENGTH <= len)
193 { 192 {
194 EVP_DigestFinal_ex(&c, mask + outlen, NULL); 193 EVP_DigestFinal_ex(&c, mask + outlen, NULL);
195 outlen += mdlen; 194 outlen += SHA_DIGEST_LENGTH;
196 } 195 }
197 else 196 else
198 { 197 {
@@ -204,9 +203,4 @@ int PKCS1_MGF1(unsigned char *mask, long len,
204 EVP_MD_CTX_cleanup(&c); 203 EVP_MD_CTX_cleanup(&c);
205 return 0; 204 return 0;
206 } 205 }
207
208int MGF1(unsigned char *mask, long len, const unsigned char *seed, long seedlen)
209 {
210 return PKCS1_MGF1(mask, len, seed, seedlen, EVP_sha1());
211 }
212#endif 206#endif
diff --git a/src/lib/libcrypto/rsa/rsa_test.c b/src/lib/libcrypto/rsa/rsa_test.c
new file mode 100644
index 0000000000..924e9ad1f6
--- /dev/null
+++ b/src/lib/libcrypto/rsa/rsa_test.c
@@ -0,0 +1,317 @@
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#ifdef OPENSSL_NO_RSA
12int main(int argc, char *argv[])
13{
14 printf("No RSA support\n");
15 return(0);
16}
17#else
18#include <openssl/rsa.h>
19
20#define SetKey \
21 key->n = BN_bin2bn(n, sizeof(n)-1, key->n); \
22 key->e = BN_bin2bn(e, sizeof(e)-1, key->e); \
23 key->d = BN_bin2bn(d, sizeof(d)-1, key->d); \
24 key->p = BN_bin2bn(p, sizeof(p)-1, key->p); \
25 key->q = BN_bin2bn(q, sizeof(q)-1, key->q); \
26 key->dmp1 = BN_bin2bn(dmp1, sizeof(dmp1)-1, key->dmp1); \
27 key->dmq1 = BN_bin2bn(dmq1, sizeof(dmq1)-1, key->dmq1); \
28 key->iqmp = BN_bin2bn(iqmp, sizeof(iqmp)-1, key->iqmp); \
29 memcpy(c, ctext_ex, sizeof(ctext_ex) - 1); \
30 return (sizeof(ctext_ex) - 1);
31
32static int key1(RSA *key, unsigned char *c)
33 {
34 static unsigned char n[] =
35"\x00\xAA\x36\xAB\xCE\x88\xAC\xFD\xFF\x55\x52\x3C\x7F\xC4\x52\x3F"
36"\x90\xEF\xA0\x0D\xF3\x77\x4A\x25\x9F\x2E\x62\xB4\xC5\xD9\x9C\xB5"
37"\xAD\xB3\x00\xA0\x28\x5E\x53\x01\x93\x0E\x0C\x70\xFB\x68\x76\x93"
38"\x9C\xE6\x16\xCE\x62\x4A\x11\xE0\x08\x6D\x34\x1E\xBC\xAC\xA0\xA1"
39"\xF5";
40
41 static unsigned char e[] = "\x11";
42
43 static unsigned char d[] =
44"\x0A\x03\x37\x48\x62\x64\x87\x69\x5F\x5F\x30\xBC\x38\xB9\x8B\x44"
45"\xC2\xCD\x2D\xFF\x43\x40\x98\xCD\x20\xD8\xA1\x38\xD0\x90\xBF\x64"
46"\x79\x7C\x3F\xA7\xA2\xCD\xCB\x3C\xD1\xE0\xBD\xBA\x26\x54\xB4\xF9"
47"\xDF\x8E\x8A\xE5\x9D\x73\x3D\x9F\x33\xB3\x01\x62\x4A\xFD\x1D\x51";
48
49 static unsigned char p[] =
50"\x00\xD8\x40\xB4\x16\x66\xB4\x2E\x92\xEA\x0D\xA3\xB4\x32\x04\xB5"
51"\xCF\xCE\x33\x52\x52\x4D\x04\x16\xA5\xA4\x41\xE7\x00\xAF\x46\x12"
52"\x0D";
53
54 static unsigned char q[] =
55"\x00\xC9\x7F\xB1\xF0\x27\xF4\x53\xF6\x34\x12\x33\xEA\xAA\xD1\xD9"
56"\x35\x3F\x6C\x42\xD0\x88\x66\xB1\xD0\x5A\x0F\x20\x35\x02\x8B\x9D"
57"\x89";
58
59 static unsigned char dmp1[] =
60"\x59\x0B\x95\x72\xA2\xC2\xA9\xC4\x06\x05\x9D\xC2\xAB\x2F\x1D\xAF"
61"\xEB\x7E\x8B\x4F\x10\xA7\x54\x9E\x8E\xED\xF5\xB4\xFC\xE0\x9E\x05";
62
63 static unsigned char dmq1[] =
64"\x00\x8E\x3C\x05\x21\xFE\x15\xE0\xEA\x06\xA3\x6F\xF0\xF1\x0C\x99"
65"\x52\xC3\x5B\x7A\x75\x14\xFD\x32\x38\xB8\x0A\xAD\x52\x98\x62\x8D"
66"\x51";
67
68 static unsigned char iqmp[] =
69"\x36\x3F\xF7\x18\x9D\xA8\xE9\x0B\x1D\x34\x1F\x71\xD0\x9B\x76\xA8"
70"\xA9\x43\xE1\x1D\x10\xB2\x4D\x24\x9F\x2D\xEA\xFE\xF8\x0C\x18\x26";
71
72 static unsigned char ctext_ex[] =
73"\x1b\x8f\x05\xf9\xca\x1a\x79\x52\x6e\x53\xf3\xcc\x51\x4f\xdb\x89"
74"\x2b\xfb\x91\x93\x23\x1e\x78\xb9\x92\xe6\x8d\x50\xa4\x80\xcb\x52"
75"\x33\x89\x5c\x74\x95\x8d\x5d\x02\xab\x8c\x0f\xd0\x40\xeb\x58\x44"
76"\xb0\x05\xc3\x9e\xd8\x27\x4a\x9d\xbf\xa8\x06\x71\x40\x94\x39\xd2";
77
78 SetKey;
79 }
80
81static int key2(RSA *key, unsigned char *c)
82 {
83 static unsigned char n[] =
84"\x00\xA3\x07\x9A\x90\xDF\x0D\xFD\x72\xAC\x09\x0C\xCC\x2A\x78\xB8"
85"\x74\x13\x13\x3E\x40\x75\x9C\x98\xFA\xF8\x20\x4F\x35\x8A\x0B\x26"
86"\x3C\x67\x70\xE7\x83\xA9\x3B\x69\x71\xB7\x37\x79\xD2\x71\x7B\xE8"
87"\x34\x77\xCF";
88
89 static unsigned char e[] = "\x3";
90
91 static unsigned char d[] =
92"\x6C\xAF\xBC\x60\x94\xB3\xFE\x4C\x72\xB0\xB3\x32\xC6\xFB\x25\xA2"
93"\xB7\x62\x29\x80\x4E\x68\x65\xFC\xA4\x5A\x74\xDF\x0F\x8F\xB8\x41"
94"\x3B\x52\xC0\xD0\xE5\x3D\x9B\x59\x0F\xF1\x9B\xE7\x9F\x49\xDD\x21"
95"\xE5\xEB";
96
97 static unsigned char p[] =
98"\x00\xCF\x20\x35\x02\x8B\x9D\x86\x98\x40\xB4\x16\x66\xB4\x2E\x92"
99"\xEA\x0D\xA3\xB4\x32\x04\xB5\xCF\xCE\x91";
100
101 static unsigned char q[] =
102"\x00\xC9\x7F\xB1\xF0\x27\xF4\x53\xF6\x34\x12\x33\xEA\xAA\xD1\xD9"
103"\x35\x3F\x6C\x42\xD0\x88\x66\xB1\xD0\x5F";
104
105 static unsigned char dmp1[] =
106"\x00\x8A\x15\x78\xAC\x5D\x13\xAF\x10\x2B\x22\xB9\x99\xCD\x74\x61"
107"\xF1\x5E\x6D\x22\xCC\x03\x23\xDF\xDF\x0B";
108
109 static unsigned char dmq1[] =
110"\x00\x86\x55\x21\x4A\xC5\x4D\x8D\x4E\xCD\x61\x77\xF1\xC7\x36\x90"
111"\xCE\x2A\x48\x2C\x8B\x05\x99\xCB\xE0\x3F";
112
113 static unsigned char iqmp[] =
114"\x00\x83\xEF\xEF\xB8\xA9\xA4\x0D\x1D\xB6\xED\x98\xAD\x84\xED\x13"
115"\x35\xDC\xC1\x08\xF3\x22\xD0\x57\xCF\x8D";
116
117 static unsigned char ctext_ex[] =
118"\x14\xbd\xdd\x28\xc9\x83\x35\x19\x23\x80\xe8\xe5\x49\xb1\x58\x2a"
119"\x8b\x40\xb4\x48\x6d\x03\xa6\xa5\x31\x1f\x1f\xd5\xf0\xa1\x80\xe4"
120"\x17\x53\x03\x29\xa9\x34\x90\x74\xb1\x52\x13\x54\x29\x08\x24\x52"
121"\x62\x51";
122
123 SetKey;
124 }
125
126static int key3(RSA *key, unsigned char *c)
127 {
128 static unsigned char n[] =
129"\x00\xBB\xF8\x2F\x09\x06\x82\xCE\x9C\x23\x38\xAC\x2B\x9D\xA8\x71"
130"\xF7\x36\x8D\x07\xEE\xD4\x10\x43\xA4\x40\xD6\xB6\xF0\x74\x54\xF5"
131"\x1F\xB8\xDF\xBA\xAF\x03\x5C\x02\xAB\x61\xEA\x48\xCE\xEB\x6F\xCD"
132"\x48\x76\xED\x52\x0D\x60\xE1\xEC\x46\x19\x71\x9D\x8A\x5B\x8B\x80"
133"\x7F\xAF\xB8\xE0\xA3\xDF\xC7\x37\x72\x3E\xE6\xB4\xB7\xD9\x3A\x25"
134"\x84\xEE\x6A\x64\x9D\x06\x09\x53\x74\x88\x34\xB2\x45\x45\x98\x39"
135"\x4E\xE0\xAA\xB1\x2D\x7B\x61\xA5\x1F\x52\x7A\x9A\x41\xF6\xC1\x68"
136"\x7F\xE2\x53\x72\x98\xCA\x2A\x8F\x59\x46\xF8\xE5\xFD\x09\x1D\xBD"
137"\xCB";
138
139 static unsigned char e[] = "\x11";
140
141 static unsigned char d[] =
142"\x00\xA5\xDA\xFC\x53\x41\xFA\xF2\x89\xC4\xB9\x88\xDB\x30\xC1\xCD"
143"\xF8\x3F\x31\x25\x1E\x06\x68\xB4\x27\x84\x81\x38\x01\x57\x96\x41"
144"\xB2\x94\x10\xB3\xC7\x99\x8D\x6B\xC4\x65\x74\x5E\x5C\x39\x26\x69"
145"\xD6\x87\x0D\xA2\xC0\x82\xA9\x39\xE3\x7F\xDC\xB8\x2E\xC9\x3E\xDA"
146"\xC9\x7F\xF3\xAD\x59\x50\xAC\xCF\xBC\x11\x1C\x76\xF1\xA9\x52\x94"
147"\x44\xE5\x6A\xAF\x68\xC5\x6C\x09\x2C\xD3\x8D\xC3\xBE\xF5\xD2\x0A"
148"\x93\x99\x26\xED\x4F\x74\xA1\x3E\xDD\xFB\xE1\xA1\xCE\xCC\x48\x94"
149"\xAF\x94\x28\xC2\xB7\xB8\x88\x3F\xE4\x46\x3A\x4B\xC8\x5B\x1C\xB3"
150"\xC1";
151
152 static unsigned char p[] =
153"\x00\xEE\xCF\xAE\x81\xB1\xB9\xB3\xC9\x08\x81\x0B\x10\xA1\xB5\x60"
154"\x01\x99\xEB\x9F\x44\xAE\xF4\xFD\xA4\x93\xB8\x1A\x9E\x3D\x84\xF6"
155"\x32\x12\x4E\xF0\x23\x6E\x5D\x1E\x3B\x7E\x28\xFA\xE7\xAA\x04\x0A"
156"\x2D\x5B\x25\x21\x76\x45\x9D\x1F\x39\x75\x41\xBA\x2A\x58\xFB\x65"
157"\x99";
158
159 static unsigned char q[] =
160"\x00\xC9\x7F\xB1\xF0\x27\xF4\x53\xF6\x34\x12\x33\xEA\xAA\xD1\xD9"
161"\x35\x3F\x6C\x42\xD0\x88\x66\xB1\xD0\x5A\x0F\x20\x35\x02\x8B\x9D"
162"\x86\x98\x40\xB4\x16\x66\xB4\x2E\x92\xEA\x0D\xA3\xB4\x32\x04\xB5"
163"\xCF\xCE\x33\x52\x52\x4D\x04\x16\xA5\xA4\x41\xE7\x00\xAF\x46\x15"
164"\x03";
165
166 static unsigned char dmp1[] =
167"\x54\x49\x4C\xA6\x3E\xBA\x03\x37\xE4\xE2\x40\x23\xFC\xD6\x9A\x5A"
168"\xEB\x07\xDD\xDC\x01\x83\xA4\xD0\xAC\x9B\x54\xB0\x51\xF2\xB1\x3E"
169"\xD9\x49\x09\x75\xEA\xB7\x74\x14\xFF\x59\xC1\xF7\x69\x2E\x9A\x2E"
170"\x20\x2B\x38\xFC\x91\x0A\x47\x41\x74\xAD\xC9\x3C\x1F\x67\xC9\x81";
171
172 static unsigned char dmq1[] =
173"\x47\x1E\x02\x90\xFF\x0A\xF0\x75\x03\x51\xB7\xF8\x78\x86\x4C\xA9"
174"\x61\xAD\xBD\x3A\x8A\x7E\x99\x1C\x5C\x05\x56\xA9\x4C\x31\x46\xA7"
175"\xF9\x80\x3F\x8F\x6F\x8A\xE3\x42\xE9\x31\xFD\x8A\xE4\x7A\x22\x0D"
176"\x1B\x99\xA4\x95\x84\x98\x07\xFE\x39\xF9\x24\x5A\x98\x36\xDA\x3D";
177
178 static unsigned char iqmp[] =
179"\x00\xB0\x6C\x4F\xDA\xBB\x63\x01\x19\x8D\x26\x5B\xDB\xAE\x94\x23"
180"\xB3\x80\xF2\x71\xF7\x34\x53\x88\x50\x93\x07\x7F\xCD\x39\xE2\x11"
181"\x9F\xC9\x86\x32\x15\x4F\x58\x83\xB1\x67\xA9\x67\xBF\x40\x2B\x4E"
182"\x9E\x2E\x0F\x96\x56\xE6\x98\xEA\x36\x66\xED\xFB\x25\x79\x80\x39"
183"\xF7";
184
185 static unsigned char ctext_ex[] =
186"\xb8\x24\x6b\x56\xa6\xed\x58\x81\xae\xb5\x85\xd9\xa2\x5b\x2a\xd7"
187"\x90\xc4\x17\xe0\x80\x68\x1b\xf1\xac\x2b\xc3\xde\xb6\x9d\x8b\xce"
188"\xf0\xc4\x36\x6f\xec\x40\x0a\xf0\x52\xa7\x2e\x9b\x0e\xff\xb5\xb3"
189"\xf2\xf1\x92\xdb\xea\xca\x03\xc1\x27\x40\x05\x71\x13\xbf\x1f\x06"
190"\x69\xac\x22\xe9\xf3\xa7\x85\x2e\x3c\x15\xd9\x13\xca\xb0\xb8\x86"
191"\x3a\x95\xc9\x92\x94\xce\x86\x74\x21\x49\x54\x61\x03\x46\xf4\xd4"
192"\x74\xb2\x6f\x7c\x48\xb4\x2e\xe6\x8e\x1f\x57\x2a\x1f\xc4\x02\x6a"
193"\xc4\x56\xb4\xf5\x9f\x7b\x62\x1e\xa1\xb9\xd8\x8f\x64\x20\x2f\xb1";
194
195 SetKey;
196 }
197
198static int pad_unknown(void)
199{
200 unsigned long l;
201 while ((l = ERR_get_error()) != 0)
202 if (ERR_GET_REASON(l) == RSA_R_UNKNOWN_PADDING_TYPE)
203 return(1);
204 return(0);
205}
206
207static const char rnd_seed[] = "string to make the random number generator think it has entropy";
208
209int main(int argc, char *argv[])
210 {
211 int err=0;
212 int v;
213 RSA *key;
214 unsigned char ptext[256];
215 unsigned char ctext[256];
216 static unsigned char ptext_ex[] = "\x54\x85\x9b\x34\x2c\x49\xea\x2a";
217 unsigned char ctext_ex[256];
218 int plen;
219 int clen = 0;
220 int num;
221
222 CRYPTO_malloc_debug_init();
223 CRYPTO_dbg_set_options(V_CRYPTO_MDEBUG_ALL);
224 CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON);
225
226 RAND_seed(rnd_seed, sizeof rnd_seed); /* or OAEP may fail */
227
228 plen = sizeof(ptext_ex) - 1;
229
230 for (v = 0; v < 3; v++)
231 {
232 key = RSA_new();
233 switch (v) {
234 case 0:
235 clen = key1(key, ctext_ex);
236 break;
237 case 1:
238 clen = key2(key, ctext_ex);
239 break;
240 case 2:
241 clen = key3(key, ctext_ex);
242 break;
243 }
244
245 num = RSA_public_encrypt(plen, ptext_ex, ctext, key,
246 RSA_PKCS1_PADDING);
247 if (num != clen)
248 {
249 printf("PKCS#1 v1.5 encryption failed!\n");
250 err=1;
251 goto oaep;
252 }
253
254 num = RSA_private_decrypt(num, ctext, ptext, key,
255 RSA_PKCS1_PADDING);
256 if (num != plen || memcmp(ptext, ptext_ex, num) != 0)
257 {
258 printf("PKCS#1 v1.5 decryption failed!\n");
259 err=1;
260 }
261 else
262 printf("PKCS #1 v1.5 encryption/decryption ok\n");
263
264 oaep:
265 ERR_clear_error();
266 num = RSA_public_encrypt(plen, ptext_ex, ctext, key,
267 RSA_PKCS1_OAEP_PADDING);
268 if (num == -1 && pad_unknown())
269 {
270 printf("No OAEP support\n");
271 goto next;
272 }
273 if (num != clen)
274 {
275 printf("OAEP encryption failed!\n");
276 err=1;
277 goto next;
278 }
279
280 num = RSA_private_decrypt(num, ctext, ptext, key,
281 RSA_PKCS1_OAEP_PADDING);
282 if (num != plen || memcmp(ptext, ptext_ex, num) != 0)
283 {
284 printf("OAEP decryption (encrypted data) failed!\n");
285 err=1;
286 }
287 else if (memcmp(ctext, ctext_ex, num) == 0)
288 {
289 printf("OAEP test vector %d passed!\n", v);
290 goto next;
291 }
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 next:
307 RSA_free(key);
308 }
309
310 CRYPTO_cleanup_all_ex_data();
311 ERR_remove_state(0);
312
313 CRYPTO_mem_leaks_fp(stderr);
314
315 return err;
316 }
317#endif
diff --git a/src/lib/libcrypto/sha/Makefile b/src/lib/libcrypto/sha/Makefile
new file mode 100644
index 0000000000..46103bbc83
--- /dev/null
+++ b/src/lib/libcrypto/sha/Makefile
@@ -0,0 +1,127 @@
1#
2# OpenSSL/crypto/sha/Makefile
3#
4
5DIR= sha
6TOP= ../..
7CC= cc
8CPP= $(CC) -E
9INCLUDES=
10CFLAG=-g
11INSTALL_PREFIX=
12OPENSSLDIR= /usr/local/ssl
13INSTALLTOP=/usr/local/ssl
14MAKEDEPPROG= makedepend
15MAKEDEPEND= $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG)
16MAKEFILE= Makefile
17AR= ar r
18
19SHA1_ASM_OBJ=
20
21CFLAGS= $(INCLUDES) $(CFLAG)
22ASFLAGS= $(INCLUDES) $(ASFLAG)
23
24GENERAL=Makefile
25TEST=shatest.c sha1test.c
26APPS=
27
28LIB=$(TOP)/libcrypto.a
29LIBSRC=sha_dgst.c sha1dgst.c sha_one.c sha1_one.c
30LIBOBJ=sha_dgst.o sha1dgst.o sha_one.o sha1_one.o $(SHA1_ASM_OBJ)
31
32SRC= $(LIBSRC)
33
34EXHEADER= sha.h
35HEADER= sha_locl.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
49# elf
50asm/sx86-elf.s: asm/sha1-586.pl ../perlasm/x86asm.pl
51 (cd asm; $(PERL) sha1-586.pl elf $(CFLAGS) $(PROCESSOR) > sx86-elf.s)
52
53# a.out
54asm/sx86-out.o: asm/sx86unix.cpp
55 $(CPP) -DOUT asm/sx86unix.cpp | as -o asm/sx86-out.o
56
57# bsdi
58asm/sx86bsdi.o: asm/sx86unix.cpp
59 $(CPP) -DBSDI asm/sx86unix.cpp | sed 's/ :/:/' | as -o asm/sx86bsdi.o
60
61asm/sx86unix.cpp: asm/sha1-586.pl ../perlasm/x86asm.pl
62 (cd asm; $(PERL) sha1-586.pl cpp $(PROCESSOR) >sx86unix.cpp)
63
64asm/sha1-ia64.s: asm/sha1-ia64.pl
65 (cd asm; $(PERL) sha1-ia64.pl $(CFLAGS) ) > $@
66
67files:
68 $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
69
70links:
71 @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
72 @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
73 @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
74
75install:
76 @headerlist="$(EXHEADER)"; for i in $$headerlist ; \
77 do \
78 (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
79 chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
80 done;
81
82tags:
83 ctags $(SRC)
84
85tests:
86
87lint:
88 lint -DLINT $(INCLUDES) $(SRC)>fluff
89
90depend:
91 $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(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 asm/sx86unix.cpp asm/*-elf.* *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff asm/*.o
99
100# DO NOT DELETE THIS LINE -- make depend depends on it.
101
102sha1_one.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
103sha1_one.o: ../../include/openssl/opensslconf.h
104sha1_one.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
105sha1_one.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
106sha1_one.o: ../../include/openssl/symhacks.h sha1_one.c
107sha1dgst.o: ../../include/openssl/bio.h ../../include/openssl/crypto.h
108sha1dgst.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
109sha1dgst.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
110sha1dgst.o: ../../include/openssl/opensslconf.h
111sha1dgst.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
112sha1dgst.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
113sha1dgst.o: ../../include/openssl/symhacks.h ../md32_common.h sha1dgst.c
114sha1dgst.o: sha_locl.h
115sha_dgst.o: ../../include/openssl/bio.h ../../include/openssl/crypto.h
116sha_dgst.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
117sha_dgst.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
118sha_dgst.o: ../../include/openssl/opensslconf.h
119sha_dgst.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
120sha_dgst.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
121sha_dgst.o: ../../include/openssl/symhacks.h ../md32_common.h sha_dgst.c
122sha_dgst.o: sha_locl.h
123sha_one.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
124sha_one.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
125sha_one.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
126sha_one.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
127sha_one.o: sha_one.c
diff --git a/src/lib/libcrypto/sha/Makefile.ssl b/src/lib/libcrypto/sha/Makefile.ssl
new file mode 100644
index 0000000000..4ba201c787
--- /dev/null
+++ b/src/lib/libcrypto/sha/Makefile.ssl
@@ -0,0 +1,116 @@
1#
2# SSLeay/crypto/sha/Makefile
3#
4
5DIR= sha
6TOP= ../..
7CC= cc
8CPP= $(CC) -E
9INCLUDES=
10CFLAG=-g
11INSTALL_PREFIX=
12OPENSSLDIR= /usr/local/ssl
13INSTALLTOP=/usr/local/ssl
14MAKE= make -f Makefile.ssl
15MAKEDEPPROG= makedepend
16MAKEDEPEND= $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG)
17MAKEFILE= Makefile.ssl
18AR= ar r
19
20SHA1_ASM_OBJ=
21
22CFLAGS= $(INCLUDES) $(CFLAG)
23ASFLAGS= $(INCLUDES) $(ASFLAG)
24
25GENERAL=Makefile
26TEST=shatest.c sha1test.c
27APPS=
28
29LIB=$(TOP)/libcrypto.a
30LIBSRC=sha_dgst.c sha1dgst.c sha_one.c sha1_one.c
31LIBOBJ=sha_dgst.o sha1dgst.o sha_one.o sha1_one.o $(SHA1_ASM_OBJ)
32
33SRC= $(LIBSRC)
34
35EXHEADER= sha.h
36HEADER= sha_locl.h $(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
50# elf
51asm/sx86-elf.s: asm/sha1-586.pl ../perlasm/x86asm.pl
52 (cd asm; $(PERL) sha1-586.pl elf $(CFLAGS) $(PROCESSOR) > sx86-elf.s)
53
54# a.out
55asm/sx86-out.o: asm/sx86unix.cpp
56 $(CPP) -DOUT asm/sx86unix.cpp | as -o asm/sx86-out.o
57
58# bsdi
59asm/sx86bsdi.o: asm/sx86unix.cpp
60 $(CPP) -DBSDI asm/sx86unix.cpp | sed 's/ :/:/' | as -o asm/sx86bsdi.o
61
62asm/sx86unix.cpp: asm/sha1-586.pl ../perlasm/x86asm.pl
63 (cd asm; $(PERL) sha1-586.pl cpp $(PROCESSOR) >sx86unix.cpp)
64
65files:
66 $(PERL) $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO
67
68links:
69 @sh $(TOP)/util/point.sh Makefile.ssl Makefile
70 @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
71 @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
72 @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
73
74install:
75 @for i in $(EXHEADER) ; \
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 $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
91
92dclean:
93 $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
94 mv -f Makefile.new $(MAKEFILE)
95
96clean:
97 rm -f asm/sx86unix.cpp asm/*-elf.* *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff asm/*.o
98
99# DO NOT DELETE THIS LINE -- make depend depends on it.
100
101sha1_one.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
102sha1_one.o: ../../include/openssl/opensslconf.h
103sha1_one.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
104sha1_one.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
105sha1_one.o: ../../include/openssl/symhacks.h sha1_one.c
106sha1dgst.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslconf.h
107sha1dgst.o: ../../include/openssl/opensslv.h ../../include/openssl/sha.h
108sha1dgst.o: ../md32_common.h sha1dgst.c sha_locl.h
109sha_dgst.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslconf.h
110sha_dgst.o: ../../include/openssl/opensslv.h ../../include/openssl/sha.h
111sha_dgst.o: ../md32_common.h sha_dgst.c sha_locl.h
112sha_one.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
113sha_one.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
114sha_one.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
115sha_one.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
116sha_one.o: 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 f4694b701b..20e660c71d 100644
--- a/src/lib/libcrypto/sha/sha1_one.c
+++ b/src/lib/libcrypto/sha/sha1_one.c
@@ -61,15 +61,14 @@
61#include <openssl/sha.h> 61#include <openssl/sha.h>
62#include <openssl/crypto.h> 62#include <openssl/crypto.h>
63 63
64#if !defined(OPENSSL_NO_SHA1) && !defined(OPENSSL_FIPS) 64#ifndef OPENSSL_NO_SHA1
65unsigned char *SHA1(const unsigned char *d, unsigned long n, unsigned char *md) 65unsigned char *SHA1(const unsigned char *d, unsigned long n, unsigned char *md)
66 { 66 {
67 SHA_CTX c; 67 SHA_CTX c;
68 static unsigned char m[SHA_DIGEST_LENGTH]; 68 static unsigned char m[SHA_DIGEST_LENGTH];
69 69
70 if (md == NULL) md=m; 70 if (md == NULL) md=m;
71 if (!SHA1_Init(&c)) 71 SHA1_Init(&c);
72 return NULL;
73 SHA1_Update(&c,d,n); 72 SHA1_Update(&c,d,n);
74 SHA1_Final(md,&c); 73 SHA1_Final(md,&c);
75 OPENSSL_cleanse(&c,sizeof(c)); 74 OPENSSL_cleanse(&c,sizeof(c));
diff --git a/src/lib/libcrypto/sha/sha1s.cpp b/src/lib/libcrypto/sha/sha1s.cpp
new file mode 100644
index 0000000000..af23d1e0f2
--- /dev/null
+++ b/src/lib/libcrypto/sha/sha1s.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/sha.h>
36
37#define sha1_block_x86 sha1_block_asm_data_order
38extern "C" {
39void sha1_block_x86(SHA_CTX *ctx, unsigned char *buffer,int num);
40}
41
42void main(int argc,char *argv[])
43 {
44 unsigned char buffer[64*256];
45 SHA_CTX ctx;
46 unsigned long s1,s2,e1,e2;
47 unsigned char k[16];
48 unsigned long data[2];
49 unsigned char iv[8];
50 int i,num=0,numm;
51 int j=0;
52
53 if (argc >= 2)
54 num=atoi(argv[1]);
55
56 if (num == 0) num=16;
57 if (num > 250) num=16;
58 numm=num+2;
59#if 0
60 num*=64;
61 numm*=64;
62#endif
63
64 for (j=0; j<6; j++)
65 {
66 for (i=0; i<10; i++) /**/
67 {
68 sha1_block_x86(&ctx,buffer,numm);
69 GetTSC(s1);
70 sha1_block_x86(&ctx,buffer,numm);
71 GetTSC(e1);
72 GetTSC(s2);
73 sha1_block_x86(&ctx,buffer,num);
74 GetTSC(e2);
75 sha1_block_x86(&ctx,buffer,num);
76 }
77
78 printf("sha1 (%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/sha/sha1test.c b/src/lib/libcrypto/sha/sha1test.c
new file mode 100644
index 0000000000..4f2e4ada2d
--- /dev/null
+++ b/src/lib/libcrypto/sha/sha1test.c
@@ -0,0 +1,174 @@
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 unsigned 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=(unsigned char **)test;
122 R=(unsigned char **)ret;
123 i=1;
124 while (*P != NULL)
125 {
126 EVP_Digest(*P,(unsigned long)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 EXIT(err);
161 EVP_MD_CTX_cleanup(&c);
162 return(0);
163 }
164
165static char *pt(unsigned char *md)
166 {
167 int i;
168 static char buf[80];
169
170 for (i=0; i<SHA_DIGEST_LENGTH; i++)
171 sprintf(&(buf[i*2]),"%02x",md[i]);
172 return(buf);
173 }
174#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..5a4b3ab204
--- /dev/null
+++ b/src/lib/libcrypto/sha/sha_dgst.c
@@ -0,0 +1,73 @@
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#if !defined(OPENSSL_NO_SHA0) && !defined(OPENSSL_NO_SHA)
60
61#undef SHA_1
62#define SHA_0
63
64#include <openssl/opensslv.h>
65
66const char *SHA_version="SHA" OPENSSL_VERSION_PTEXT;
67
68/* The implementation is in ../md32_common.h */
69
70#include "sha_locl.h"
71
72#endif
73
diff --git a/src/lib/libcrypto/sha/sha_one.c b/src/lib/libcrypto/sha/sha_one.c
new file mode 100644
index 0000000000..e61c63f3e9
--- /dev/null
+++ b/src/lib/libcrypto/sha/sha_one.c
@@ -0,0 +1,77 @@
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, unsigned long 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 SHA_Init(&c);
72 SHA_Update(&c,d,n);
73 SHA_Final(md,&c);
74 OPENSSL_cleanse(&c,sizeof(c));
75 return(md);
76 }
77#endif
diff --git a/src/lib/libcrypto/sha/shatest.c b/src/lib/libcrypto/sha/shatest.c
new file mode 100644
index 0000000000..ff702aa53e
--- /dev/null
+++ b/src/lib/libcrypto/sha/shatest.c
@@ -0,0 +1,174 @@
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 unsigned 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=(unsigned char **)test;
122 R=(unsigned char **)ret;
123 i=1;
124 while (*P != NULL)
125 {
126 EVP_Digest(*P,(unsigned long)strlen((char *)*P),md,NULL,EVP_sha(), NULL);
127 p=pt(md);
128 if (strcmp(p,(char *)*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 EVP_MD_CTX_cleanup(&c);
161 EXIT(err);
162 return(0);
163 }
164
165static char *pt(unsigned char *md)
166 {
167 int i;
168 static char buf[80];
169
170 for (i=0; i<SHA_DIGEST_LENGTH; i++)
171 sprintf(&(buf[i*2]),"%02x",md[i]);
172 return(buf);
173 }
174#endif
diff --git a/src/lib/libcrypto/stack/Makefile b/src/lib/libcrypto/stack/Makefile
new file mode 100644
index 0000000000..711b16832a
--- /dev/null
+++ b/src/lib/libcrypto/stack/Makefile
@@ -0,0 +1,86 @@
1#
2# OpenSSL/crypto/stack/Makefile
3#
4
5DIR= stack
6TOP= ../..
7CC= cc
8INCLUDES=
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
18CFLAGS= $(INCLUDES) $(CFLAG)
19
20GENERAL=Makefile
21TEST=
22APPS=
23
24LIB=$(TOP)/libcrypto.a
25LIBSRC=stack.c
26LIBOBJ=stack.o
27
28SRC= $(LIBSRC)
29
30EXHEADER= stack.h safestack.h
31HEADER= $(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
45files:
46 $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
47
48links:
49 @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
50 @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
51 @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
52
53install:
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 $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(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
80stack.o: ../../e_os.h ../../include/openssl/bio.h
81stack.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
82stack.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
83stack.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
84stack.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
85stack.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
86stack.o: ../cryptlib.h stack.c
diff --git a/src/lib/libcrypto/stack/Makefile.ssl b/src/lib/libcrypto/stack/Makefile.ssl
new file mode 100644
index 0000000000..7120fb804a
--- /dev/null
+++ b/src/lib/libcrypto/stack/Makefile.ssl
@@ -0,0 +1,88 @@
1#
2# SSLeay/crypto/stack/Makefile
3#
4
5DIR= stack
6TOP= ../..
7CC= cc
8INCLUDES=
9CFLAG=-g
10INSTALL_PREFIX=
11OPENSSLDIR= /usr/local/ssl
12INSTALLTOP=/usr/local/ssl
13MAKE= make -f Makefile.ssl
14MAKEDEPPROG= makedepend
15MAKEDEPEND= $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG)
16MAKEFILE= Makefile.ssl
17AR= ar r
18
19CFLAGS= $(INCLUDES) $(CFLAG)
20
21GENERAL=Makefile
22TEST=
23APPS=
24
25LIB=$(TOP)/libcrypto.a
26LIBSRC=stack.c
27LIBOBJ=stack.o
28
29SRC= $(LIBSRC)
30
31EXHEADER= stack.h safestack.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.ssl >> $(TOP)/MINFO
48
49links:
50 @sh $(TOP)/util/point.sh Makefile.ssl Makefile
51 @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
52 @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
53 @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
54
55install:
56 @for i in $(EXHEADER) ; \
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 $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
72
73dclean:
74 $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
75 mv -f Makefile.new $(MAKEFILE)
76
77clean:
78 rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
79
80# DO NOT DELETE THIS LINE -- make depend depends on it.
81
82stack.o: ../../e_os.h ../../include/openssl/bio.h
83stack.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
84stack.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
85stack.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
86stack.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
87stack.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
88stack.o: ../cryptlib.h stack.c
diff --git a/src/lib/libcrypto/stack/safestack.h b/src/lib/libcrypto/stack/safestack.h
index 6010b7f122..bd1121c279 100644
--- a/src/lib/libcrypto/stack/safestack.h
+++ b/src/lib/libcrypto/stack/safestack.h
@@ -55,9 +55,6 @@
55#ifndef HEADER_SAFESTACK_H 55#ifndef HEADER_SAFESTACK_H
56#define HEADER_SAFESTACK_H 56#define HEADER_SAFESTACK_H
57 57
58typedef void (*openssl_fptr)(void);
59#define openssl_fcast(f) ((openssl_fptr)f)
60
61#include <openssl/stack.h> 58#include <openssl/stack.h>
62 59
63#ifdef DEBUG_SAFESTACK 60#ifdef DEBUG_SAFESTACK
@@ -76,74 +73,74 @@ STACK_OF(type) \
76/* SKM_sk_... stack macros are internal to safestack.h: 73/* SKM_sk_... stack macros are internal to safestack.h:
77 * never use them directly, use sk_<type>_... instead */ 74 * never use them directly, use sk_<type>_... instead */
78#define SKM_sk_new(type, cmp) \ 75#define SKM_sk_new(type, cmp) \
79 ((STACK_OF(type) * (*)(int (*)(const type * const *, const type * const *)))openssl_fcast(sk_new))(cmp) 76 ((STACK_OF(type) * (*)(int (*)(const type * const *, const type * const *)))sk_new)(cmp)
80#define SKM_sk_new_null(type) \ 77#define SKM_sk_new_null(type) \
81 ((STACK_OF(type) * (*)(void))openssl_fcast(sk_new_null))() 78 ((STACK_OF(type) * (*)(void))sk_new_null)()
82#define SKM_sk_free(type, st) \ 79#define SKM_sk_free(type, st) \
83 ((void (*)(STACK_OF(type) *))openssl_fcast(sk_free))(st) 80 ((void (*)(STACK_OF(type) *))sk_free)(st)
84#define SKM_sk_num(type, st) \ 81#define SKM_sk_num(type, st) \
85 ((int (*)(const STACK_OF(type) *))openssl_fcast(sk_num))(st) 82 ((int (*)(const STACK_OF(type) *))sk_num)(st)
86#define SKM_sk_value(type, st,i) \ 83#define SKM_sk_value(type, st,i) \
87 ((type * (*)(const STACK_OF(type) *, int))openssl_fcast(sk_value))(st, i) 84 ((type * (*)(const STACK_OF(type) *, int))sk_value)(st, i)
88#define SKM_sk_set(type, st,i,val) \ 85#define SKM_sk_set(type, st,i,val) \
89 ((type * (*)(STACK_OF(type) *, int, type *))openssl_fcast(sk_set))(st, i, val) 86 ((type * (*)(STACK_OF(type) *, int, type *))sk_set)(st, i, val)
90#define SKM_sk_zero(type, st) \ 87#define SKM_sk_zero(type, st) \
91 ((void (*)(STACK_OF(type) *))openssl_fcast(sk_zero))(st) 88 ((void (*)(STACK_OF(type) *))sk_zero)(st)
92#define SKM_sk_push(type, st,val) \ 89#define SKM_sk_push(type, st,val) \
93 ((int (*)(STACK_OF(type) *, type *))openssl_fcast(sk_push))(st, val) 90 ((int (*)(STACK_OF(type) *, type *))sk_push)(st, val)
94#define SKM_sk_unshift(type, st,val) \ 91#define SKM_sk_unshift(type, st,val) \
95 ((int (*)(STACK_OF(type) *, type *))openssl_fcast(sk_unshift))(st, val) 92 ((int (*)(STACK_OF(type) *, type *))sk_unshift)(st, val)
96#define SKM_sk_find(type, st,val) \ 93#define SKM_sk_find(type, st,val) \
97 ((int (*)(STACK_OF(type) *, type *))openssl_fcast(sk_find))(st, val) 94 ((int (*)(STACK_OF(type) *, type *))sk_find)(st, val)
98#define SKM_sk_delete(type, st,i) \ 95#define SKM_sk_delete(type, st,i) \
99 ((type * (*)(STACK_OF(type) *, int))openssl_fcast(sk_delete))(st, i) 96 ((type * (*)(STACK_OF(type) *, int))sk_delete)(st, i)
100#define SKM_sk_delete_ptr(type, st,ptr) \ 97#define SKM_sk_delete_ptr(type, st,ptr) \
101 ((type * (*)(STACK_OF(type) *, type *))openssl_fcast(sk_delete_ptr))(st, ptr) 98 ((type * (*)(STACK_OF(type) *, type *))sk_delete_ptr)(st, ptr)
102#define SKM_sk_insert(type, st,val,i) \ 99#define SKM_sk_insert(type, st,val,i) \
103 ((int (*)(STACK_OF(type) *, type *, int))openssl_fcast(sk_insert))(st, val, i) 100 ((int (*)(STACK_OF(type) *, type *, int))sk_insert)(st, val, i)
104#define SKM_sk_set_cmp_func(type, st,cmp) \ 101#define SKM_sk_set_cmp_func(type, st,cmp) \
105 ((int (*(*)(STACK_OF(type) *, int (*)(const type * const *, const type * const *))) \ 102 ((int (*(*)(STACK_OF(type) *, int (*)(const type * const *, const type * const *))) \
106 (const type * const *, const type * const *))openssl_fcast(sk_set_cmp_func))\ 103 (const type * const *, const type * const *))sk_set_cmp_func)\
107 (st, cmp) 104 (st, cmp)
108#define SKM_sk_dup(type, st) \ 105#define SKM_sk_dup(type, st) \
109 ((STACK_OF(type) *(*)(STACK_OF(type) *))openssl_fcast(sk_dup))(st) 106 ((STACK_OF(type) *(*)(STACK_OF(type) *))sk_dup)(st)
110#define SKM_sk_pop_free(type, st,free_func) \ 107#define SKM_sk_pop_free(type, st,free_func) \
111 ((void (*)(STACK_OF(type) *, void (*)(type *)))openssl_fcast(sk_pop_free))\ 108 ((void (*)(STACK_OF(type) *, void (*)(type *)))sk_pop_free)\
112 (st, free_func) 109 (st, free_func)
113#define SKM_sk_shift(type, st) \ 110#define SKM_sk_shift(type, st) \
114 ((type * (*)(STACK_OF(type) *))openssl_fcast(sk_shift))(st) 111 ((type * (*)(STACK_OF(type) *))sk_shift)(st)
115#define SKM_sk_pop(type, st) \ 112#define SKM_sk_pop(type, st) \
116 ((type * (*)(STACK_OF(type) *))openssl_fcast(sk_pop))(st) 113 ((type * (*)(STACK_OF(type) *))sk_pop)(st)
117#define SKM_sk_sort(type, st) \ 114#define SKM_sk_sort(type, st) \
118 ((void (*)(STACK_OF(type) *))openssl_fcast(sk_sort))(st) 115 ((void (*)(STACK_OF(type) *))sk_sort)(st)
119#define SKM_sk_is_sorted(type, st) \ 116#define SKM_sk_is_sorted(type, st) \
120 ((int (*)(const STACK_OF(type) *))openssl_fcast(sk_is_sorted))(st) 117 ((int (*)(const STACK_OF(type) *))sk_is_sorted)(st)
121 118
122#define SKM_ASN1_SET_OF_d2i(type, st, pp, length, d2i_func, free_func, ex_tag, ex_class) \ 119#define SKM_ASN1_SET_OF_d2i(type, st, pp, length, d2i_func, free_func, ex_tag, ex_class) \
123 ((STACK_OF(type) * (*) (STACK_OF(type) **,unsigned char **, long , \ 120 ((STACK_OF(type) * (*) (STACK_OF(type) **,unsigned char **, long , \
124 type *(*)(type **, unsigned char **,long), \ 121 type *(*)(type **, unsigned char **,long), \
125 void (*)(type *), int ,int )) openssl_fcast(d2i_ASN1_SET)) \ 122 void (*)(type *), int ,int )) d2i_ASN1_SET) \
126 (st,pp,length, d2i_func, free_func, ex_tag,ex_class) 123 (st,pp,length, d2i_func, free_func, ex_tag,ex_class)
127#define SKM_ASN1_SET_OF_i2d(type, st, pp, i2d_func, ex_tag, ex_class, is_set) \ 124#define SKM_ASN1_SET_OF_i2d(type, st, pp, i2d_func, ex_tag, ex_class, is_set) \
128 ((int (*)(STACK_OF(type) *,unsigned char **, \ 125 ((int (*)(STACK_OF(type) *,unsigned char **, \
129 int (*)(type *,unsigned char **), int , int , int)) openssl_fcast(i2d_ASN1_SET)) \ 126 int (*)(type *,unsigned char **), int , int , int)) i2d_ASN1_SET) \
130 (st,pp,i2d_func,ex_tag,ex_class,is_set) 127 (st,pp,i2d_func,ex_tag,ex_class,is_set)
131 128
132#define SKM_ASN1_seq_pack(type, st, i2d_func, buf, len) \ 129#define SKM_ASN1_seq_pack(type, st, i2d_func, buf, len) \
133 ((unsigned char *(*)(STACK_OF(type) *, \ 130 ((unsigned char *(*)(STACK_OF(type) *, \
134 int (*)(type *,unsigned char **), unsigned char **,int *)) openssl_fcast(ASN1_seq_pack)) \ 131 int (*)(type *,unsigned char **), unsigned char **,int *)) ASN1_seq_pack) \
135 (st, i2d_func, buf, len) 132 (st, i2d_func, buf, len)
136#define SKM_ASN1_seq_unpack(type, buf, len, d2i_func, free_func) \ 133#define SKM_ASN1_seq_unpack(type, buf, len, d2i_func, free_func) \
137 ((STACK_OF(type) * (*)(unsigned char *,int, \ 134 ((STACK_OF(type) * (*)(unsigned char *,int, \
138 type *(*)(type **,unsigned char **, long), \ 135 type *(*)(type **,unsigned char **, long), \
139 void (*)(type *)))openssl_fcast(ASN1_seq_unpack)) \ 136 void (*)(type *)))ASN1_seq_unpack) \
140 (buf,len,d2i_func, free_func) 137 (buf,len,d2i_func, free_func)
141 138
142#define SKM_PKCS12_decrypt_d2i(type, algor, d2i_func, free_func, pass, passlen, oct, seq) \ 139#define SKM_PKCS12_decrypt_d2i(type, algor, d2i_func, free_func, pass, passlen, oct, seq) \
143 ((STACK_OF(type) * (*)(X509_ALGOR *, \ 140 ((STACK_OF(type) * (*)(X509_ALGOR *, \
144 type *(*)(type **, unsigned char **, long), void (*)(type *), \ 141 type *(*)(type **, unsigned char **, long), void (*)(type *), \
145 const char *, int, \ 142 const char *, int, \
146 ASN1_STRING *, int))openssl_fcast(PKCS12_decrypt_d2i)) \ 143 ASN1_STRING *, int))PKCS12_decrypt_d2i) \
147 (algor,d2i_func,free_func,pass,passlen,oct,seq) 144 (algor,d2i_func,free_func,pass,passlen,oct,seq)
148 145
149#else 146#else
diff --git a/src/lib/libcrypto/symhacks.h b/src/lib/libcrypto/symhacks.h
new file mode 100644
index 0000000000..774162fec9
--- /dev/null
+++ b/src/lib/libcrypto/symhacks.h
@@ -0,0 +1,275 @@
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#ifdef OPENSSL_SYS_VMS
64
65/* Hack a long name in crypto/ex_data.c */
66#undef CRYPTO_get_ex_data_implementation
67#define CRYPTO_get_ex_data_implementation CRYPTO_get_ex_data_impl
68#undef CRYPTO_set_ex_data_implementation
69#define CRYPTO_set_ex_data_implementation CRYPTO_set_ex_data_impl
70
71/* Hack a long name in crypto/asn1/a_mbstr.c */
72#undef ASN1_STRING_set_default_mask_asc
73#define ASN1_STRING_set_default_mask_asc ASN1_STRING_set_def_mask_asc
74
75#if 0 /* No longer needed, since safestack macro magic does the job */
76/* Hack the names created with DECLARE_ASN1_SET_OF(PKCS7_SIGNER_INFO) */
77#undef i2d_ASN1_SET_OF_PKCS7_SIGNER_INFO
78#define i2d_ASN1_SET_OF_PKCS7_SIGNER_INFO i2d_ASN1_SET_OF_PKCS7_SIGINF
79#undef d2i_ASN1_SET_OF_PKCS7_SIGNER_INFO
80#define d2i_ASN1_SET_OF_PKCS7_SIGNER_INFO d2i_ASN1_SET_OF_PKCS7_SIGINF
81#endif
82
83#if 0 /* No longer needed, since safestack macro magic does the job */
84/* Hack the names created with DECLARE_ASN1_SET_OF(PKCS7_RECIP_INFO) */
85#undef i2d_ASN1_SET_OF_PKCS7_RECIP_INFO
86#define i2d_ASN1_SET_OF_PKCS7_RECIP_INFO i2d_ASN1_SET_OF_PKCS7_RECINF
87#undef d2i_ASN1_SET_OF_PKCS7_RECIP_INFO
88#define d2i_ASN1_SET_OF_PKCS7_RECIP_INFO d2i_ASN1_SET_OF_PKCS7_RECINF
89#endif
90
91#if 0 /* No longer needed, since safestack macro magic does the job */
92/* Hack the names created with DECLARE_ASN1_SET_OF(ACCESS_DESCRIPTION) */
93#undef i2d_ASN1_SET_OF_ACCESS_DESCRIPTION
94#define i2d_ASN1_SET_OF_ACCESS_DESCRIPTION i2d_ASN1_SET_OF_ACC_DESC
95#undef d2i_ASN1_SET_OF_ACCESS_DESCRIPTION
96#define d2i_ASN1_SET_OF_ACCESS_DESCRIPTION d2i_ASN1_SET_OF_ACC_DESC
97#endif
98
99/* Hack the names created with DECLARE_PEM_rw(NETSCAPE_CERT_SEQUENCE) */
100#undef PEM_read_NETSCAPE_CERT_SEQUENCE
101#define PEM_read_NETSCAPE_CERT_SEQUENCE PEM_read_NS_CERT_SEQ
102#undef PEM_write_NETSCAPE_CERT_SEQUENCE
103#define PEM_write_NETSCAPE_CERT_SEQUENCE PEM_write_NS_CERT_SEQ
104#undef PEM_read_bio_NETSCAPE_CERT_SEQUENCE
105#define PEM_read_bio_NETSCAPE_CERT_SEQUENCE PEM_read_bio_NS_CERT_SEQ
106#undef PEM_write_bio_NETSCAPE_CERT_SEQUENCE
107#define PEM_write_bio_NETSCAPE_CERT_SEQUENCE PEM_write_bio_NS_CERT_SEQ
108#undef PEM_write_cb_bio_NETSCAPE_CERT_SEQUENCE
109#define PEM_write_cb_bio_NETSCAPE_CERT_SEQUENCE PEM_write_cb_bio_NS_CERT_SEQ
110
111/* Hack the names created with DECLARE_PEM_rw(PKCS8_PRIV_KEY_INFO) */
112#undef PEM_read_PKCS8_PRIV_KEY_INFO
113#define PEM_read_PKCS8_PRIV_KEY_INFO PEM_read_P8_PRIV_KEY_INFO
114#undef PEM_write_PKCS8_PRIV_KEY_INFO
115#define PEM_write_PKCS8_PRIV_KEY_INFO PEM_write_P8_PRIV_KEY_INFO
116#undef PEM_read_bio_PKCS8_PRIV_KEY_INFO
117#define PEM_read_bio_PKCS8_PRIV_KEY_INFO PEM_read_bio_P8_PRIV_KEY_INFO
118#undef PEM_write_bio_PKCS8_PRIV_KEY_INFO
119#define PEM_write_bio_PKCS8_PRIV_KEY_INFO PEM_write_bio_P8_PRIV_KEY_INFO
120#undef PEM_write_cb_bio_PKCS8_PRIV_KEY_INFO
121#define PEM_write_cb_bio_PKCS8_PRIV_KEY_INFO PEM_wrt_cb_bio_P8_PRIV_KEY_INFO
122
123/* Hack other PEM names */
124#undef PEM_write_bio_PKCS8PrivateKey_nid
125#define PEM_write_bio_PKCS8PrivateKey_nid PEM_write_bio_PKCS8PrivKey_nid
126
127/* Hack some long X509 names */
128#undef X509_REVOKED_get_ext_by_critical
129#define X509_REVOKED_get_ext_by_critical X509_REVOKED_get_ext_by_critic
130
131/* Hack some long CRYPTO names */
132#undef CRYPTO_set_dynlock_destroy_callback
133#define CRYPTO_set_dynlock_destroy_callback CRYPTO_set_dynlock_destroy_cb
134#undef CRYPTO_set_dynlock_create_callback
135#define CRYPTO_set_dynlock_create_callback CRYPTO_set_dynlock_create_cb
136#undef CRYPTO_set_dynlock_lock_callback
137#define CRYPTO_set_dynlock_lock_callback CRYPTO_set_dynlock_lock_cb
138#undef CRYPTO_get_dynlock_lock_callback
139#define CRYPTO_get_dynlock_lock_callback CRYPTO_get_dynlock_lock_cb
140#undef CRYPTO_get_dynlock_destroy_callback
141#define CRYPTO_get_dynlock_destroy_callback CRYPTO_get_dynlock_destroy_cb
142#undef CRYPTO_get_dynlock_create_callback
143#define CRYPTO_get_dynlock_create_callback CRYPTO_get_dynlock_create_cb
144#undef CRYPTO_set_locked_mem_ex_functions
145#define CRYPTO_set_locked_mem_ex_functions CRYPTO_set_locked_mem_ex_funcs
146#undef CRYPTO_get_locked_mem_ex_functions
147#define CRYPTO_get_locked_mem_ex_functions CRYPTO_get_locked_mem_ex_funcs
148
149/* Hack some long SSL names */
150#undef SSL_CTX_set_default_verify_paths
151#define SSL_CTX_set_default_verify_paths SSL_CTX_set_def_verify_paths
152#undef SSL_get_ex_data_X509_STORE_CTX_idx
153#define SSL_get_ex_data_X509_STORE_CTX_idx SSL_get_ex_d_X509_STORE_CTX_idx
154#undef SSL_add_file_cert_subjects_to_stack
155#define SSL_add_file_cert_subjects_to_stack SSL_add_file_cert_subjs_to_stk
156#if 0 /* This function is not defined i VMS. */
157#undef SSL_add_dir_cert_subjects_to_stack
158#define SSL_add_dir_cert_subjects_to_stack SSL_add_dir_cert_subjs_to_stk
159#endif
160#undef SSL_CTX_use_certificate_chain_file
161#define SSL_CTX_use_certificate_chain_file SSL_CTX_use_cert_chain_file
162#undef SSL_CTX_set_cert_verify_callback
163#define SSL_CTX_set_cert_verify_callback SSL_CTX_set_cert_verify_cb
164#undef SSL_CTX_set_default_passwd_cb_userdata
165#define SSL_CTX_set_default_passwd_cb_userdata SSL_CTX_set_def_passwd_cb_ud
166
167/* Hack some long ENGINE names */
168#undef ENGINE_get_default_BN_mod_exp_crt
169#define ENGINE_get_default_BN_mod_exp_crt ENGINE_get_def_BN_mod_exp_crt
170#undef ENGINE_set_default_BN_mod_exp_crt
171#define ENGINE_set_default_BN_mod_exp_crt ENGINE_set_def_BN_mod_exp_crt
172#undef ENGINE_set_load_privkey_function
173#define ENGINE_set_load_privkey_function ENGINE_set_load_privkey_fn
174#undef ENGINE_get_load_privkey_function
175#define ENGINE_get_load_privkey_function ENGINE_get_load_privkey_fn
176
177/* Hack some long OCSP names */
178#undef OCSP_REQUEST_get_ext_by_critical
179#define OCSP_REQUEST_get_ext_by_critical OCSP_REQUEST_get_ext_by_crit
180#undef OCSP_BASICRESP_get_ext_by_critical
181#define OCSP_BASICRESP_get_ext_by_critical OCSP_BASICRESP_get_ext_by_crit
182#undef OCSP_SINGLERESP_get_ext_by_critical
183#define OCSP_SINGLERESP_get_ext_by_critical OCSP_SINGLERESP_get_ext_by_crit
184
185/* Hack some long DES names */
186#undef _ossl_old_des_ede3_cfb64_encrypt
187#define _ossl_old_des_ede3_cfb64_encrypt _ossl_odes_ede3_cfb64_encrypt
188#undef _ossl_old_des_ede3_ofb64_encrypt
189#define _ossl_old_des_ede3_ofb64_encrypt _ossl_odes_ede3_ofb64_encrypt
190
191/* Hack some long EVP names */
192#undef OPENSSL_add_all_algorithms_noconf
193#define OPENSSL_add_all_algorithms_noconf OPENSSL_add_all_algo_noconf
194#undef OPENSSL_add_all_algorithms_conf
195#define OPENSSL_add_all_algorithms_conf OPENSSL_add_all_algo_conf
196
197/* Hack some long EC names */
198#undef EC_POINT_set_Jprojective_coordinates_GFp
199#define EC_POINT_set_Jprojective_coordinates_GFp \
200 EC_POINT_set_Jproj_coords_GFp
201#undef EC_POINT_get_Jprojective_coordinates_GFp
202#define EC_POINT_get_Jprojective_coordinates_GFp \
203 EC_POINT_get_Jproj_coords_GFp
204#undef EC_POINT_set_affine_coordinates_GFp
205#define EC_POINT_set_affine_coordinates_GFp EC_POINT_set_affine_coords_GFp
206#undef EC_POINT_get_affine_coordinates_GFp
207#define EC_POINT_get_affine_coordinates_GFp EC_POINT_get_affine_coords_GFp
208#undef EC_POINT_set_compressed_coordinates_GFp
209#define EC_POINT_set_compressed_coordinates_GFp EC_POINT_set_compr_coords_GFp
210#undef ec_GFp_simple_group_set_curve_GFp
211#define ec_GFp_simple_group_set_curve_GFp ec_GFp_simple_grp_set_curve_GFp
212#undef ec_GFp_simple_group_get_curve_GFp
213#define ec_GFp_simple_group_get_curve_GFp ec_GFp_simple_grp_get_curve_GFp
214#undef ec_GFp_simple_group_clear_finish
215#define ec_GFp_simple_group_clear_finish ec_GFp_simple_grp_clear_finish
216#undef ec_GFp_simple_group_set_generator
217#define ec_GFp_simple_group_set_generator ec_GFp_simple_grp_set_generator
218#undef ec_GFp_simple_group_get0_generator
219#define ec_GFp_simple_group_get0_generator ec_GFp_simple_grp_gt0_generator
220#undef ec_GFp_simple_group_get_cofactor
221#define ec_GFp_simple_group_get_cofactor ec_GFp_simple_grp_get_cofactor
222#undef ec_GFp_simple_point_clear_finish
223#define ec_GFp_simple_point_clear_finish ec_GFp_simple_pt_clear_finish
224#undef ec_GFp_simple_point_set_to_infinity
225#define ec_GFp_simple_point_set_to_infinity ec_GFp_simple_pt_set_to_inf
226#undef ec_GFp_simple_points_make_affine
227#define ec_GFp_simple_points_make_affine ec_GFp_simple_pts_make_affine
228#undef ec_GFp_simple_group_get_curve_GFp
229#define ec_GFp_simple_group_get_curve_GFp ec_GFp_simple_grp_get_curve_GFp
230#undef ec_GFp_simple_set_Jprojective_coordinates_GFp
231#define ec_GFp_simple_set_Jprojective_coordinates_GFp \
232 ec_GFp_smp_set_Jproj_coords_GFp
233#undef ec_GFp_simple_get_Jprojective_coordinates_GFp
234#define ec_GFp_simple_get_Jprojective_coordinates_GFp \
235 ec_GFp_smp_get_Jproj_coords_GFp
236#undef ec_GFp_simple_point_set_affine_coordinates_GFp
237#define ec_GFp_simple_point_set_affine_coordinates_GFp \
238 ec_GFp_smp_pt_set_af_coords_GFp
239#undef ec_GFp_simple_point_get_affine_coordinates_GFp
240#define ec_GFp_simple_point_get_affine_coordinates_GFp \
241 ec_GFp_smp_pt_get_af_coords_GFp
242#undef ec_GFp_simple_set_compressed_coordinates_GFp
243#define ec_GFp_simple_set_compressed_coordinates_GFp \
244 ec_GFp_smp_set_compr_coords_GFp
245
246#endif /* defined OPENSSL_SYS_VMS */
247
248
249/* Case insensiteve linking causes problems.... */
250#if defined(OPENSSL_SYS_WIN16) || defined(OPENSSL_SYS_VMS) || defined(OPENSSL_SYS_OS2)
251#undef ERR_load_CRYPTO_strings
252#define ERR_load_CRYPTO_strings ERR_load_CRYPTOlib_strings
253#undef OCSP_crlID_new
254#define OCSP_crlID_new OCSP_crlID2_new
255
256/* These functions do not seem to exist! However, I'm paranoid...
257 Original command in x509v3.h:
258 These functions are being redefined in another directory,
259 and clash when the linker is case-insensitive, so let's
260 hide them a little, by giving them an extra 'o' at the
261 beginning of the name... */
262#undef X509v3_cleanup_extensions
263#define X509v3_cleanup_extensions oX509v3_cleanup_extensions
264#undef X509v3_add_extension
265#define X509v3_add_extension oX509v3_add_extension
266#undef X509v3_add_netscape_extensions
267#define X509v3_add_netscape_extensions oX509v3_add_netscape_extensions
268#undef X509v3_add_standard_extensions
269#define X509v3_add_standard_extensions oX509v3_add_standard_extensions
270
271
272#endif
273
274
275#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..7588966cb2
--- /dev/null
+++ b/src/lib/libcrypto/threads/mttest.c
@@ -0,0 +1,1096 @@
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#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#include <openssl/rand.h>
88
89#define TEST_SERVER_CERT "../../apps/server.pem"
90#define TEST_CLIENT_CERT "../../apps/client.pem"
91
92#define MAX_THREAD_NUMBER 100
93
94int MS_CALLBACK verify_callback(int ok, X509_STORE_CTX *xs);
95void thread_setup(void);
96void thread_cleanup(void);
97void do_threads(SSL_CTX *s_ctx,SSL_CTX *c_ctx);
98
99void irix_locking_callback(int mode,int type,char *file,int line);
100void solaris_locking_callback(int mode,int type,char *file,int line);
101void win32_locking_callback(int mode,int type,char *file,int line);
102void pthreads_locking_callback(int mode,int type,char *file,int line);
103
104unsigned long irix_thread_id(void );
105unsigned long solaris_thread_id(void );
106unsigned long pthreads_thread_id(void );
107
108BIO *bio_err=NULL;
109BIO *bio_stdout=NULL;
110
111static char *cipher=NULL;
112int verbose=0;
113#ifdef FIONBIO
114static int s_nbio=0;
115#endif
116
117int thread_number=10;
118int number_of_loops=10;
119int reconnect=0;
120int cache_stats=0;
121
122static const char rnd_seed[] = "string to make the random number generator think it has entropy";
123
124int doit(char *ctx[4]);
125static void print_stats(FILE *fp, SSL_CTX *ctx)
126{
127 fprintf(fp,"%4ld items in the session cache\n",
128 SSL_CTX_sess_number(ctx));
129 fprintf(fp,"%4d client connects (SSL_connect())\n",
130 SSL_CTX_sess_connect(ctx));
131 fprintf(fp,"%4d client connects that finished\n",
132 SSL_CTX_sess_connect_good(ctx));
133 fprintf(fp,"%4d server connects (SSL_accept())\n",
134 SSL_CTX_sess_accept(ctx));
135 fprintf(fp,"%4d server connects that finished\n",
136 SSL_CTX_sess_accept_good(ctx));
137 fprintf(fp,"%4d session cache hits\n",SSL_CTX_sess_hits(ctx));
138 fprintf(fp,"%4d session cache misses\n",SSL_CTX_sess_misses(ctx));
139 fprintf(fp,"%4d session cache timeouts\n",SSL_CTX_sess_timeouts(ctx));
140 }
141
142static void sv_usage(void)
143 {
144 fprintf(stderr,"usage: ssltest [args ...]\n");
145 fprintf(stderr,"\n");
146 fprintf(stderr," -server_auth - check server certificate\n");
147 fprintf(stderr," -client_auth - do client authentication\n");
148 fprintf(stderr," -v - more output\n");
149 fprintf(stderr," -CApath arg - PEM format directory of CA's\n");
150 fprintf(stderr," -CAfile arg - PEM format file of CA's\n");
151 fprintf(stderr," -threads arg - number of threads\n");
152 fprintf(stderr," -loops arg - number of 'connections', per thread\n");
153 fprintf(stderr," -reconnect - reuse session-id's\n");
154 fprintf(stderr," -stats - server session-id cache stats\n");
155 fprintf(stderr," -cert arg - server certificate/key\n");
156 fprintf(stderr," -ccert arg - client certificate/key\n");
157 fprintf(stderr," -ssl3 - just SSLv3n\n");
158 }
159
160int main(int argc, char *argv[])
161 {
162 char *CApath=NULL,*CAfile=NULL;
163 int badop=0;
164 int ret=1;
165 int client_auth=0;
166 int server_auth=0;
167 SSL_CTX *s_ctx=NULL;
168 SSL_CTX *c_ctx=NULL;
169 char *scert=TEST_SERVER_CERT;
170 char *ccert=TEST_CLIENT_CERT;
171 SSL_METHOD *ssl_method=SSLv23_method();
172
173 RAND_seed(rnd_seed, sizeof rnd_seed);
174
175 if (bio_err == NULL)
176 bio_err=BIO_new_fp(stderr,BIO_NOCLOSE);
177 if (bio_stdout == NULL)
178 bio_stdout=BIO_new_fp(stdout,BIO_NOCLOSE);
179 argc--;
180 argv++;
181
182 while (argc >= 1)
183 {
184 if (strcmp(*argv,"-server_auth") == 0)
185 server_auth=1;
186 else if (strcmp(*argv,"-client_auth") == 0)
187 client_auth=1;
188 else if (strcmp(*argv,"-reconnect") == 0)
189 reconnect=1;
190 else if (strcmp(*argv,"-stats") == 0)
191 cache_stats=1;
192 else if (strcmp(*argv,"-ssl3") == 0)
193 ssl_method=SSLv3_method();
194 else if (strcmp(*argv,"-ssl2") == 0)
195 ssl_method=SSLv2_method();
196 else if (strcmp(*argv,"-CApath") == 0)
197 {
198 if (--argc < 1) goto bad;
199 CApath= *(++argv);
200 }
201 else if (strcmp(*argv,"-CAfile") == 0)
202 {
203 if (--argc < 1) goto bad;
204 CAfile= *(++argv);
205 }
206 else if (strcmp(*argv,"-cert") == 0)
207 {
208 if (--argc < 1) goto bad;
209 scert= *(++argv);
210 }
211 else if (strcmp(*argv,"-ccert") == 0)
212 {
213 if (--argc < 1) goto bad;
214 ccert= *(++argv);
215 }
216 else if (strcmp(*argv,"-threads") == 0)
217 {
218 if (--argc < 1) goto bad;
219 thread_number= atoi(*(++argv));
220 if (thread_number == 0) thread_number=1;
221 if (thread_number > MAX_THREAD_NUMBER)
222 thread_number=MAX_THREAD_NUMBER;
223 }
224 else if (strcmp(*argv,"-loops") == 0)
225 {
226 if (--argc < 1) goto bad;
227 number_of_loops= atoi(*(++argv));
228 if (number_of_loops == 0) number_of_loops=1;
229 }
230 else
231 {
232 fprintf(stderr,"unknown option %s\n",*argv);
233 badop=1;
234 break;
235 }
236 argc--;
237 argv++;
238 }
239 if (badop)
240 {
241bad:
242 sv_usage();
243 goto end;
244 }
245
246 if (cipher == NULL && OPENSSL_issetugid() == 0)
247 cipher=getenv("SSL_CIPHER");
248
249 SSL_load_error_strings();
250 OpenSSL_add_ssl_algorithms();
251
252 c_ctx=SSL_CTX_new(ssl_method);
253 s_ctx=SSL_CTX_new(ssl_method);
254 if ((c_ctx == NULL) || (s_ctx == NULL))
255 {
256 ERR_print_errors(bio_err);
257 goto end;
258 }
259
260 SSL_CTX_set_session_cache_mode(s_ctx,
261 SSL_SESS_CACHE_NO_AUTO_CLEAR|SSL_SESS_CACHE_SERVER);
262 SSL_CTX_set_session_cache_mode(c_ctx,
263 SSL_SESS_CACHE_NO_AUTO_CLEAR|SSL_SESS_CACHE_SERVER);
264
265 if (!SSL_CTX_use_certificate_file(s_ctx,scert,SSL_FILETYPE_PEM))
266 {
267 ERR_print_errors(bio_err);
268 }
269 else if (!SSL_CTX_use_RSAPrivateKey_file(s_ctx,scert,SSL_FILETYPE_PEM))
270 {
271 ERR_print_errors(bio_err);
272 goto end;
273 }
274
275 if (client_auth)
276 {
277 SSL_CTX_use_certificate_file(c_ctx,ccert,
278 SSL_FILETYPE_PEM);
279 SSL_CTX_use_RSAPrivateKey_file(c_ctx,ccert,
280 SSL_FILETYPE_PEM);
281 }
282
283 if ( (!SSL_CTX_load_verify_locations(s_ctx,CAfile,CApath)) ||
284 (!SSL_CTX_set_default_verify_paths(s_ctx)) ||
285 (!SSL_CTX_load_verify_locations(c_ctx,CAfile,CApath)) ||
286 (!SSL_CTX_set_default_verify_paths(c_ctx)))
287 {
288 fprintf(stderr,"SSL_load_verify_locations\n");
289 ERR_print_errors(bio_err);
290 goto end;
291 }
292
293 if (client_auth)
294 {
295 fprintf(stderr,"client authentication\n");
296 SSL_CTX_set_verify(s_ctx,
297 SSL_VERIFY_PEER|SSL_VERIFY_FAIL_IF_NO_PEER_CERT,
298 verify_callback);
299 }
300 if (server_auth)
301 {
302 fprintf(stderr,"server authentication\n");
303 SSL_CTX_set_verify(c_ctx,SSL_VERIFY_PEER,
304 verify_callback);
305 }
306
307 thread_setup();
308 do_threads(s_ctx,c_ctx);
309 thread_cleanup();
310end:
311
312 if (c_ctx != NULL)
313 {
314 fprintf(stderr,"Client SSL_CTX stats then free it\n");
315 print_stats(stderr,c_ctx);
316 SSL_CTX_free(c_ctx);
317 }
318 if (s_ctx != NULL)
319 {
320 fprintf(stderr,"Server SSL_CTX stats then free it\n");
321 print_stats(stderr,s_ctx);
322 if (cache_stats)
323 {
324 fprintf(stderr,"-----\n");
325 lh_stats(SSL_CTX_sessions(s_ctx),stderr);
326 fprintf(stderr,"-----\n");
327 /* lh_node_stats(SSL_CTX_sessions(s_ctx),stderr);
328 fprintf(stderr,"-----\n"); */
329 lh_node_usage_stats(SSL_CTX_sessions(s_ctx),stderr);
330 fprintf(stderr,"-----\n");
331 }
332 SSL_CTX_free(s_ctx);
333 fprintf(stderr,"done free\n");
334 }
335 exit(ret);
336 return(0);
337 }
338
339#define W_READ 1
340#define W_WRITE 2
341#define C_DONE 1
342#define S_DONE 2
343
344int ndoit(SSL_CTX *ssl_ctx[2])
345 {
346 int i;
347 int ret;
348 char *ctx[4];
349
350 ctx[0]=(char *)ssl_ctx[0];
351 ctx[1]=(char *)ssl_ctx[1];
352
353 if (reconnect)
354 {
355 ctx[2]=(char *)SSL_new(ssl_ctx[0]);
356 ctx[3]=(char *)SSL_new(ssl_ctx[1]);
357 }
358 else
359 {
360 ctx[2]=NULL;
361 ctx[3]=NULL;
362 }
363
364 fprintf(stdout,"started thread %lu\n",CRYPTO_thread_id());
365 for (i=0; i<number_of_loops; i++)
366 {
367/* fprintf(stderr,"%4d %2d ctx->ref (%3d,%3d)\n",
368 CRYPTO_thread_id(),i,
369 ssl_ctx[0]->references,
370 ssl_ctx[1]->references); */
371 /* pthread_delay_np(&tm);*/
372
373 ret=doit(ctx);
374 if (ret != 0)
375 {
376 fprintf(stdout,"error[%d] %lu - %d\n",
377 i,CRYPTO_thread_id(),ret);
378 return(ret);
379 }
380 }
381 fprintf(stdout,"DONE %lu\n",CRYPTO_thread_id());
382 if (reconnect)
383 {
384 SSL_free((SSL *)ctx[2]);
385 SSL_free((SSL *)ctx[3]);
386 }
387 return(0);
388 }
389
390int doit(char *ctx[4])
391 {
392 SSL_CTX *s_ctx,*c_ctx;
393 static char cbuf[200],sbuf[200];
394 SSL *c_ssl=NULL;
395 SSL *s_ssl=NULL;
396 BIO *c_to_s=NULL;
397 BIO *s_to_c=NULL;
398 BIO *c_bio=NULL;
399 BIO *s_bio=NULL;
400 int c_r,c_w,s_r,s_w;
401 int c_want,s_want;
402 int i;
403 int done=0;
404 int c_write,s_write;
405 int do_server=0,do_client=0;
406
407 s_ctx=(SSL_CTX *)ctx[0];
408 c_ctx=(SSL_CTX *)ctx[1];
409
410 if (ctx[2] != NULL)
411 s_ssl=(SSL *)ctx[2];
412 else
413 s_ssl=SSL_new(s_ctx);
414
415 if (ctx[3] != NULL)
416 c_ssl=(SSL *)ctx[3];
417 else
418 c_ssl=SSL_new(c_ctx);
419
420 if ((s_ssl == NULL) || (c_ssl == NULL)) goto err;
421
422 c_to_s=BIO_new(BIO_s_mem());
423 s_to_c=BIO_new(BIO_s_mem());
424 if ((s_to_c == NULL) || (c_to_s == NULL)) goto err;
425
426 c_bio=BIO_new(BIO_f_ssl());
427 s_bio=BIO_new(BIO_f_ssl());
428 if ((c_bio == NULL) || (s_bio == NULL)) goto err;
429
430 SSL_set_connect_state(c_ssl);
431 SSL_set_bio(c_ssl,s_to_c,c_to_s);
432 BIO_set_ssl(c_bio,c_ssl,(ctx[2] == NULL)?BIO_CLOSE:BIO_NOCLOSE);
433
434 SSL_set_accept_state(s_ssl);
435 SSL_set_bio(s_ssl,c_to_s,s_to_c);
436 BIO_set_ssl(s_bio,s_ssl,(ctx[3] == NULL)?BIO_CLOSE:BIO_NOCLOSE);
437
438 c_r=0; s_r=1;
439 c_w=1; s_w=0;
440 c_want=W_WRITE;
441 s_want=0;
442 c_write=1,s_write=0;
443
444 /* We can always do writes */
445 for (;;)
446 {
447 do_server=0;
448 do_client=0;
449
450 i=(int)BIO_pending(s_bio);
451 if ((i && s_r) || s_w) do_server=1;
452
453 i=(int)BIO_pending(c_bio);
454 if ((i && c_r) || c_w) do_client=1;
455
456 if (do_server && verbose)
457 {
458 if (SSL_in_init(s_ssl))
459 printf("server waiting in SSL_accept - %s\n",
460 SSL_state_string_long(s_ssl));
461 else if (s_write)
462 printf("server:SSL_write()\n");
463 else
464 printf("server:SSL_read()\n");
465 }
466
467 if (do_client && verbose)
468 {
469 if (SSL_in_init(c_ssl))
470 printf("client waiting in SSL_connect - %s\n",
471 SSL_state_string_long(c_ssl));
472 else if (c_write)
473 printf("client:SSL_write()\n");
474 else
475 printf("client:SSL_read()\n");
476 }
477
478 if (!do_client && !do_server)
479 {
480 fprintf(stdout,"ERROR IN STARTUP\n");
481 break;
482 }
483 if (do_client && !(done & C_DONE))
484 {
485 if (c_write)
486 {
487 i=BIO_write(c_bio,"hello from client\n",18);
488 if (i < 0)
489 {
490 c_r=0;
491 c_w=0;
492 if (BIO_should_retry(c_bio))
493 {
494 if (BIO_should_read(c_bio))
495 c_r=1;
496 if (BIO_should_write(c_bio))
497 c_w=1;
498 }
499 else
500 {
501 fprintf(stderr,"ERROR in CLIENT\n");
502 ERR_print_errors_fp(stderr);
503 return(1);
504 }
505 }
506 else if (i == 0)
507 {
508 fprintf(stderr,"SSL CLIENT STARTUP FAILED\n");
509 return(1);
510 }
511 else
512 {
513 /* ok */
514 c_write=0;
515 }
516 }
517 else
518 {
519 i=BIO_read(c_bio,cbuf,100);
520 if (i < 0)
521 {
522 c_r=0;
523 c_w=0;
524 if (BIO_should_retry(c_bio))
525 {
526 if (BIO_should_read(c_bio))
527 c_r=1;
528 if (BIO_should_write(c_bio))
529 c_w=1;
530 }
531 else
532 {
533 fprintf(stderr,"ERROR in CLIENT\n");
534 ERR_print_errors_fp(stderr);
535 return(1);
536 }
537 }
538 else if (i == 0)
539 {
540 fprintf(stderr,"SSL CLIENT STARTUP FAILED\n");
541 return(1);
542 }
543 else
544 {
545 done|=C_DONE;
546#ifdef undef
547 fprintf(stdout,"CLIENT:from server:");
548 fwrite(cbuf,1,i,stdout);
549 fflush(stdout);
550#endif
551 }
552 }
553 }
554
555 if (do_server && !(done & S_DONE))
556 {
557 if (!s_write)
558 {
559 i=BIO_read(s_bio,sbuf,100);
560 if (i < 0)
561 {
562 s_r=0;
563 s_w=0;
564 if (BIO_should_retry(s_bio))
565 {
566 if (BIO_should_read(s_bio))
567 s_r=1;
568 if (BIO_should_write(s_bio))
569 s_w=1;
570 }
571 else
572 {
573 fprintf(stderr,"ERROR in SERVER\n");
574 ERR_print_errors_fp(stderr);
575 return(1);
576 }
577 }
578 else if (i == 0)
579 {
580 fprintf(stderr,"SSL SERVER STARTUP FAILED\n");
581 return(1);
582 }
583 else
584 {
585 s_write=1;
586 s_w=1;
587#ifdef undef
588 fprintf(stdout,"SERVER:from client:");
589 fwrite(sbuf,1,i,stdout);
590 fflush(stdout);
591#endif
592 }
593 }
594 else
595 {
596 i=BIO_write(s_bio,"hello from server\n",18);
597 if (i < 0)
598 {
599 s_r=0;
600 s_w=0;
601 if (BIO_should_retry(s_bio))
602 {
603 if (BIO_should_read(s_bio))
604 s_r=1;
605 if (BIO_should_write(s_bio))
606 s_w=1;
607 }
608 else
609 {
610 fprintf(stderr,"ERROR in SERVER\n");
611 ERR_print_errors_fp(stderr);
612 return(1);
613 }
614 }
615 else if (i == 0)
616 {
617 fprintf(stderr,"SSL SERVER STARTUP FAILED\n");
618 return(1);
619 }
620 else
621 {
622 s_write=0;
623 s_r=1;
624 done|=S_DONE;
625 }
626 }
627 }
628
629 if ((done & S_DONE) && (done & C_DONE)) break;
630 }
631
632 SSL_set_shutdown(c_ssl,SSL_SENT_SHUTDOWN|SSL_RECEIVED_SHUTDOWN);
633 SSL_set_shutdown(s_ssl,SSL_SENT_SHUTDOWN|SSL_RECEIVED_SHUTDOWN);
634
635#ifdef undef
636 fprintf(stdout,"DONE\n");
637#endif
638err:
639 /* We have to set the BIO's to NULL otherwise they will be
640 * free()ed twice. Once when th s_ssl is SSL_free()ed and
641 * again when c_ssl is SSL_free()ed.
642 * This is a hack required because s_ssl and c_ssl are sharing the same
643 * BIO structure and SSL_set_bio() and SSL_free() automatically
644 * BIO_free non NULL entries.
645 * You should not normally do this or be required to do this */
646
647 if (s_ssl != NULL)
648 {
649 s_ssl->rbio=NULL;
650 s_ssl->wbio=NULL;
651 }
652 if (c_ssl != NULL)
653 {
654 c_ssl->rbio=NULL;
655 c_ssl->wbio=NULL;
656 }
657
658 /* The SSL's are optionally freed in the following calls */
659 if (c_to_s != NULL) BIO_free(c_to_s);
660 if (s_to_c != NULL) BIO_free(s_to_c);
661
662 if (c_bio != NULL) BIO_free(c_bio);
663 if (s_bio != NULL) BIO_free(s_bio);
664 return(0);
665 }
666
667int MS_CALLBACK verify_callback(int ok, X509_STORE_CTX *ctx)
668 {
669 char *s, buf[256];
670
671 if (verbose)
672 {
673 s=X509_NAME_oneline(X509_get_subject_name(ctx->current_cert),
674 buf,256);
675 if (s != NULL)
676 {
677 if (ok)
678 fprintf(stderr,"depth=%d %s\n",
679 ctx->error_depth,buf);
680 else
681 fprintf(stderr,"depth=%d error=%d %s\n",
682 ctx->error_depth,ctx->error,buf);
683 }
684 }
685 return(ok);
686 }
687
688#define THREAD_STACK_SIZE (16*1024)
689
690#ifdef OPENSSL_SYS_WIN32
691
692static HANDLE *lock_cs;
693
694void thread_setup(void)
695 {
696 int i;
697
698 lock_cs=OPENSSL_malloc(CRYPTO_num_locks() * sizeof(HANDLE));
699 for (i=0; i<CRYPTO_num_locks(); i++)
700 {
701 lock_cs[i]=CreateMutex(NULL,FALSE,NULL);
702 }
703
704 CRYPTO_set_locking_callback((void (*)(int,int,char *,int))win32_locking_callback);
705 /* id callback defined */
706 }
707
708void thread_cleanup(void)
709 {
710 int i;
711
712 CRYPTO_set_locking_callback(NULL);
713 for (i=0; i<CRYPTO_num_locks(); i++)
714 CloseHandle(lock_cs[i]);
715 OPENSSL_free(lock_cs);
716 }
717
718void win32_locking_callback(int mode, int type, char *file, int line)
719 {
720 if (mode & CRYPTO_LOCK)
721 {
722 WaitForSingleObject(lock_cs[type],INFINITE);
723 }
724 else
725 {
726 ReleaseMutex(lock_cs[type]);
727 }
728 }
729
730void do_threads(SSL_CTX *s_ctx, SSL_CTX *c_ctx)
731 {
732 double ret;
733 SSL_CTX *ssl_ctx[2];
734 DWORD thread_id[MAX_THREAD_NUMBER];
735 HANDLE thread_handle[MAX_THREAD_NUMBER];
736 int i;
737 SYSTEMTIME start,end;
738
739 ssl_ctx[0]=s_ctx;
740 ssl_ctx[1]=c_ctx;
741
742 GetSystemTime(&start);
743 for (i=0; i<thread_number; i++)
744 {
745 thread_handle[i]=CreateThread(NULL,
746 THREAD_STACK_SIZE,
747 (LPTHREAD_START_ROUTINE)ndoit,
748 (void *)ssl_ctx,
749 0L,
750 &(thread_id[i]));
751 }
752
753 printf("reaping\n");
754 for (i=0; i<thread_number; i+=50)
755 {
756 int j;
757
758 j=(thread_number < (i+50))?(thread_number-i):50;
759
760 if (WaitForMultipleObjects(j,
761 (CONST HANDLE *)&(thread_handle[i]),TRUE,INFINITE)
762 == WAIT_FAILED)
763 {
764 fprintf(stderr,"WaitForMultipleObjects failed:%d\n",GetLastError());
765 exit(1);
766 }
767 }
768 GetSystemTime(&end);
769
770 if (start.wDayOfWeek > end.wDayOfWeek) end.wDayOfWeek+=7;
771 ret=(end.wDayOfWeek-start.wDayOfWeek)*24;
772
773 ret=(ret+end.wHour-start.wHour)*60;
774 ret=(ret+end.wMinute-start.wMinute)*60;
775 ret=(ret+end.wSecond-start.wSecond);
776 ret+=(end.wMilliseconds-start.wMilliseconds)/1000.0;
777
778 printf("win32 threads done - %.3f seconds\n",ret);
779 }
780
781#endif /* OPENSSL_SYS_WIN32 */
782
783#ifdef SOLARIS
784
785static mutex_t *lock_cs;
786/*static rwlock_t *lock_cs; */
787static long *lock_count;
788
789void thread_setup(void)
790 {
791 int i;
792
793 lock_cs=OPENSSL_malloc(CRYPTO_num_locks() * sizeof(mutex_t));
794 lock_count=OPENSSL_malloc(CRYPTO_num_locks() * sizeof(long));
795 for (i=0; i<CRYPTO_num_locks(); i++)
796 {
797 lock_count[i]=0;
798 /* rwlock_init(&(lock_cs[i]),USYNC_THREAD,NULL); */
799 mutex_init(&(lock_cs[i]),USYNC_THREAD,NULL);
800 }
801
802 CRYPTO_set_id_callback((unsigned long (*)())solaris_thread_id);
803 CRYPTO_set_locking_callback((void (*)())solaris_locking_callback);
804 }
805
806void thread_cleanup(void)
807 {
808 int i;
809
810 CRYPTO_set_locking_callback(NULL);
811
812 fprintf(stderr,"cleanup\n");
813
814 for (i=0; i<CRYPTO_num_locks(); i++)
815 {
816 /* rwlock_destroy(&(lock_cs[i])); */
817 mutex_destroy(&(lock_cs[i]));
818 fprintf(stderr,"%8ld:%s\n",lock_count[i],CRYPTO_get_lock_name(i));
819 }
820 OPENSSL_free(lock_cs);
821 OPENSSL_free(lock_count);
822
823 fprintf(stderr,"done cleanup\n");
824
825 }
826
827void solaris_locking_callback(int mode, int type, char *file, int line)
828 {
829#ifdef undef
830 fprintf(stderr,"thread=%4d mode=%s lock=%s %s:%d\n",
831 CRYPTO_thread_id(),
832 (mode&CRYPTO_LOCK)?"l":"u",
833 (type&CRYPTO_READ)?"r":"w",file,line);
834#endif
835
836 /*
837 if (CRYPTO_LOCK_SSL_CERT == type)
838 fprintf(stderr,"(t,m,f,l) %ld %d %s %d\n",
839 CRYPTO_thread_id(),
840 mode,file,line);
841 */
842 if (mode & CRYPTO_LOCK)
843 {
844 /* if (mode & CRYPTO_READ)
845 rw_rdlock(&(lock_cs[type]));
846 else
847 rw_wrlock(&(lock_cs[type])); */
848
849 mutex_lock(&(lock_cs[type]));
850 lock_count[type]++;
851 }
852 else
853 {
854/* rw_unlock(&(lock_cs[type])); */
855 mutex_unlock(&(lock_cs[type]));
856 }
857 }
858
859void do_threads(SSL_CTX *s_ctx, SSL_CTX *c_ctx)
860 {
861 SSL_CTX *ssl_ctx[2];
862 thread_t thread_ctx[MAX_THREAD_NUMBER];
863 int i;
864
865 ssl_ctx[0]=s_ctx;
866 ssl_ctx[1]=c_ctx;
867
868 thr_setconcurrency(thread_number);
869 for (i=0; i<thread_number; i++)
870 {
871 thr_create(NULL, THREAD_STACK_SIZE,
872 (void *(*)())ndoit,
873 (void *)ssl_ctx,
874 0L,
875 &(thread_ctx[i]));
876 }
877
878 printf("reaping\n");
879 for (i=0; i<thread_number; i++)
880 {
881 thr_join(thread_ctx[i],NULL,NULL);
882 }
883
884 printf("solaris threads done (%d,%d)\n",
885 s_ctx->references,c_ctx->references);
886 }
887
888unsigned long solaris_thread_id(void)
889 {
890 unsigned long ret;
891
892 ret=(unsigned long)thr_self();
893 return(ret);
894 }
895#endif /* SOLARIS */
896
897#ifdef IRIX
898
899
900static usptr_t *arena;
901static usema_t **lock_cs;
902
903void thread_setup(void)
904 {
905 int i;
906 char filename[20];
907
908 strcpy(filename,"/tmp/mttest.XXXXXX");
909 mktemp(filename);
910
911 usconfig(CONF_STHREADIOOFF);
912 usconfig(CONF_STHREADMALLOCOFF);
913 usconfig(CONF_INITUSERS,100);
914 usconfig(CONF_LOCKTYPE,US_DEBUGPLUS);
915 arena=usinit(filename);
916 unlink(filename);
917
918 lock_cs=OPENSSL_malloc(CRYPTO_num_locks() * sizeof(usema_t *));
919 for (i=0; i<CRYPTO_num_locks(); i++)
920 {
921 lock_cs[i]=usnewsema(arena,1);
922 }
923
924 CRYPTO_set_id_callback((unsigned long (*)())irix_thread_id);
925 CRYPTO_set_locking_callback((void (*)())irix_locking_callback);
926 }
927
928void thread_cleanup(void)
929 {
930 int i;
931
932 CRYPTO_set_locking_callback(NULL);
933 for (i=0; i<CRYPTO_num_locks(); i++)
934 {
935 char buf[10];
936
937 sprintf(buf,"%2d:",i);
938 usdumpsema(lock_cs[i],stdout,buf);
939 usfreesema(lock_cs[i],arena);
940 }
941 OPENSSL_free(lock_cs);
942 }
943
944void irix_locking_callback(int mode, int type, char *file, int line)
945 {
946 if (mode & CRYPTO_LOCK)
947 {
948 printf("lock %d\n",type);
949 uspsema(lock_cs[type]);
950 }
951 else
952 {
953 printf("unlock %d\n",type);
954 usvsema(lock_cs[type]);
955 }
956 }
957
958void do_threads(SSL_CTX *s_ctx, SSL_CTX *c_ctx)
959 {
960 SSL_CTX *ssl_ctx[2];
961 int thread_ctx[MAX_THREAD_NUMBER];
962 int i;
963
964 ssl_ctx[0]=s_ctx;
965 ssl_ctx[1]=c_ctx;
966
967 for (i=0; i<thread_number; i++)
968 {
969 thread_ctx[i]=sproc((void (*)())ndoit,
970 PR_SADDR|PR_SFDS,(void *)ssl_ctx);
971 }
972
973 printf("reaping\n");
974 for (i=0; i<thread_number; i++)
975 {
976 wait(NULL);
977 }
978
979 printf("irix threads done (%d,%d)\n",
980 s_ctx->references,c_ctx->references);
981 }
982
983unsigned long irix_thread_id(void)
984 {
985 unsigned long ret;
986
987 ret=(unsigned long)getpid();
988 return(ret);
989 }
990#endif /* IRIX */
991
992#ifdef PTHREADS
993
994static pthread_mutex_t *lock_cs;
995static long *lock_count;
996
997void thread_setup(void)
998 {
999 int i;
1000
1001 lock_cs=OPENSSL_malloc(CRYPTO_num_locks() * sizeof(pthread_mutex_t));
1002 lock_count=OPENSSL_malloc(CRYPTO_num_locks() * sizeof(long));
1003 for (i=0; i<CRYPTO_num_locks(); i++)
1004 {
1005 lock_count[i]=0;
1006 pthread_mutex_init(&(lock_cs[i]),NULL);
1007 }
1008
1009 CRYPTO_set_id_callback((unsigned long (*)())pthreads_thread_id);
1010 CRYPTO_set_locking_callback((void (*)())pthreads_locking_callback);
1011 }
1012
1013void thread_cleanup(void)
1014 {
1015 int i;
1016
1017 CRYPTO_set_locking_callback(NULL);
1018 fprintf(stderr,"cleanup\n");
1019 for (i=0; i<CRYPTO_num_locks(); i++)
1020 {
1021 pthread_mutex_destroy(&(lock_cs[i]));
1022 fprintf(stderr,"%8ld:%s\n",lock_count[i],
1023 CRYPTO_get_lock_name(i));
1024 }
1025 OPENSSL_free(lock_cs);
1026 OPENSSL_free(lock_count);
1027
1028 fprintf(stderr,"done cleanup\n");
1029 }
1030
1031void pthreads_locking_callback(int mode, int type, char *file,
1032 int line)
1033 {
1034#ifdef undef
1035 fprintf(stderr,"thread=%4d mode=%s lock=%s %s:%d\n",
1036 CRYPTO_thread_id(),
1037 (mode&CRYPTO_LOCK)?"l":"u",
1038 (type&CRYPTO_READ)?"r":"w",file,line);
1039#endif
1040/*
1041 if (CRYPTO_LOCK_SSL_CERT == type)
1042 fprintf(stderr,"(t,m,f,l) %ld %d %s %d\n",
1043 CRYPTO_thread_id(),
1044 mode,file,line);
1045*/
1046 if (mode & CRYPTO_LOCK)
1047 {
1048 pthread_mutex_lock(&(lock_cs[type]));
1049 lock_count[type]++;
1050 }
1051 else
1052 {
1053 pthread_mutex_unlock(&(lock_cs[type]));
1054 }
1055 }
1056
1057void do_threads(SSL_CTX *s_ctx, SSL_CTX *c_ctx)
1058 {
1059 SSL_CTX *ssl_ctx[2];
1060 pthread_t thread_ctx[MAX_THREAD_NUMBER];
1061 int i;
1062
1063 ssl_ctx[0]=s_ctx;
1064 ssl_ctx[1]=c_ctx;
1065
1066 /*
1067 thr_setconcurrency(thread_number);
1068 */
1069 for (i=0; i<thread_number; i++)
1070 {
1071 pthread_create(&(thread_ctx[i]), NULL,
1072 (void *(*)())ndoit, (void *)ssl_ctx);
1073 }
1074
1075 printf("reaping\n");
1076 for (i=0; i<thread_number; i++)
1077 {
1078 pthread_join(thread_ctx[i],NULL);
1079 }
1080
1081 printf("pthreads threads done (%d,%d)\n",
1082 s_ctx->references,c_ctx->references);
1083 }
1084
1085unsigned long pthreads_thread_id(void)
1086 {
1087 unsigned long ret;
1088
1089 ret=(unsigned long)pthread_self();
1090 return(ret);
1091 }
1092
1093#endif /* PTHREADS */
1094
1095
1096
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..63f5b8cc2e
--- /dev/null
+++ b/src/lib/libcrypto/threads/pthreads-vms.com
@@ -0,0 +1,9 @@
1$! To compile mttest on VMS.
2$!
3$! WARNING: only tested with DEC C so far.
4$
5$ arch := vax
6$ if f$getsyi("CPU") .ge. 128 then arch := axp
7$ define/user openssl [--.include.openssl]
8$ cc/def=PTHREADS mttest.c
9$ 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..a6a79b9f45
--- /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 <openssl/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/tmdiff.c b/src/lib/libcrypto/tmdiff.c
new file mode 100644
index 0000000000..307523ebba
--- /dev/null
+++ b/src/lib/libcrypto/tmdiff.c
@@ -0,0 +1,249 @@
1/* crypto/tmdiff.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 "cryptlib.h"
61#include <openssl/tmdiff.h>
62#if !defined(OPENSSL_SYS_MSDOS)
63#include OPENSSL_UNISTD
64#endif
65
66#ifdef TIMEB
67#undef OPENSSL_SYS_WIN32
68#undef TIMES
69#endif
70
71#if !defined(OPENSSL_SYS_MSDOS) && !defined(OPENSSL_SYS_WIN32) && !(defined(OPENSSL_SYS_VMS) || defined(__DECC)) && !defined(OPENSSL_SYS_MACOSX_RHAPSODY) && !defined(OPENSSL_SYS_VXWORKS)
72# define TIMES
73#endif
74
75#ifndef _IRIX
76# include <time.h>
77#endif
78#ifdef TIMES
79# include <sys/types.h>
80# include <sys/times.h>
81#endif
82
83/* Depending on the VMS version, the tms structure is perhaps defined.
84 The __TMS macro will show if it was. If it wasn't defined, we should
85 undefine TIMES, since that tells the rest of the program how things
86 should be handled. -- Richard Levitte */
87#if defined(OPENSSL_SYS_VMS_DECC) && !defined(__TMS)
88#undef TIMES
89#endif
90
91#if defined(sun) || defined(__ultrix)
92#define _POSIX_SOURCE
93#include <limits.h>
94#include <sys/param.h>
95#endif
96
97#if !defined(TIMES) && !defined(OPENSSL_SYS_VXWORKS)
98#include <sys/timeb.h>
99#endif
100
101#ifdef OPENSSL_SYS_WIN32
102#include <windows.h>
103#endif
104
105/* The following if from times(3) man page. It may need to be changed */
106#ifndef HZ
107# if defined(_SC_CLK_TCK) \
108 && (!defined(OPENSSL_SYS_VMS) || __CTRL_VER >= 70000000)
109# define HZ ((double)sysconf(_SC_CLK_TCK))
110# else
111# ifndef CLK_TCK
112# ifndef _BSD_CLK_TCK_ /* FreeBSD hack */
113# define HZ 100.0
114# else /* _BSD_CLK_TCK_ */
115# define HZ ((double)_BSD_CLK_TCK_)
116# endif
117# else /* CLK_TCK */
118# define HZ ((double)CLK_TCK)
119# endif
120# endif
121#endif
122
123typedef struct ms_tm
124 {
125#ifdef TIMES
126 struct tms ms_tms;
127#else
128# ifdef OPENSSL_SYS_WIN32
129 HANDLE thread_id;
130 FILETIME ms_win32;
131# else
132# ifdef OPENSSL_SYS_VXWORKS
133 unsigned long ticks;
134# else
135 struct timeb ms_timeb;
136# endif
137# endif
138#endif
139 } MS_TM;
140
141char *ms_time_new(void)
142 {
143 MS_TM *ret;
144
145 ret=(MS_TM *)OPENSSL_malloc(sizeof(MS_TM));
146 if (ret == NULL)
147 return(NULL);
148 memset(ret,0,sizeof(MS_TM));
149#ifdef OPENSSL_SYS_WIN32
150 ret->thread_id=GetCurrentThread();
151#endif
152 return((char *)ret);
153 }
154
155void ms_time_free(char *a)
156 {
157 if (a != NULL)
158 OPENSSL_free(a);
159 }
160
161void ms_time_get(char *a)
162 {
163 MS_TM *tm=(MS_TM *)a;
164#ifdef OPENSSL_SYS_WIN32
165 FILETIME tmpa,tmpb,tmpc;
166#endif
167
168#ifdef TIMES
169 times(&tm->ms_tms);
170#else
171# ifdef OPENSSL_SYS_WIN32
172 GetThreadTimes(tm->thread_id,&tmpa,&tmpb,&tmpc,&(tm->ms_win32));
173# else
174# ifdef OPENSSL_SYS_VXWORKS
175 tm->ticks = tickGet();
176# else
177 ftime(&tm->ms_timeb);
178# endif
179# endif
180#endif
181 }
182
183double ms_time_diff(char *ap, char *bp)
184 {
185 MS_TM *a=(MS_TM *)ap;
186 MS_TM *b=(MS_TM *)bp;
187 double ret;
188
189#ifdef TIMES
190 ret=(b->ms_tms.tms_utime-a->ms_tms.tms_utime)/HZ;
191#else
192# ifdef OPENSSL_SYS_WIN32
193 {
194#ifdef __GNUC__
195 signed long long la,lb;
196#else
197 signed _int64 la,lb;
198#endif
199 la=a->ms_win32.dwHighDateTime;
200 lb=b->ms_win32.dwHighDateTime;
201 la<<=32;
202 lb<<=32;
203 la+=a->ms_win32.dwLowDateTime;
204 lb+=b->ms_win32.dwLowDateTime;
205 ret=((double)(lb-la))/1e7;
206 }
207# else
208# ifdef OPENSSL_SYS_VXWORKS
209 ret = (double)(b->ticks - a->ticks) / (double)sysClkRateGet();
210# else
211 ret= (double)(b->ms_timeb.time-a->ms_timeb.time)+
212 (((double)b->ms_timeb.millitm)-
213 ((double)a->ms_timeb.millitm))/1000.0;
214# endif
215# endif
216#endif
217 return((ret < 0.0000001)?0.0000001:ret);
218 }
219
220int ms_time_cmp(char *ap, char *bp)
221 {
222 MS_TM *a=(MS_TM *)ap,*b=(MS_TM *)bp;
223 double d;
224 int ret;
225
226#ifdef TIMES
227 d=(b->ms_tms.tms_utime-a->ms_tms.tms_utime)/HZ;
228#else
229# ifdef OPENSSL_SYS_WIN32
230 d =(b->ms_win32.dwHighDateTime&0x000fffff)*10+b->ms_win32.dwLowDateTime/1e7;
231 d-=(a->ms_win32.dwHighDateTime&0x000fffff)*10+a->ms_win32.dwLowDateTime/1e7;
232# else
233# ifdef OPENSSL_SYS_VXWORKS
234 d = (b->ticks - a->ticks);
235# else
236 d= (double)(b->ms_timeb.time-a->ms_timeb.time)+
237 (((double)b->ms_timeb.millitm)-(double)a->ms_timeb.millitm)/1000.0;
238# endif
239# endif
240#endif
241 if (d == 0.0)
242 ret=0;
243 else if (d < 0)
244 ret= -1;
245 else
246 ret=1;
247 return(ret);
248 }
249
diff --git a/src/lib/libcrypto/tmdiff.h b/src/lib/libcrypto/tmdiff.h
new file mode 100644
index 0000000000..41a8a1e0e0
--- /dev/null
+++ b/src/lib/libcrypto/tmdiff.h
@@ -0,0 +1,81 @@
1/* crypto/tmdiff.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/* Header for dynamic hash table routines
60 * Author - Eric Young
61 */
62
63#ifndef HEADER_TMDIFF_H
64#define HEADER_TMDIFF_H
65
66#ifdef __cplusplus
67extern "C" {
68#endif
69
70char *ms_time_new(void );
71void ms_time_free(char *a);
72void ms_time_get(char *a);
73double ms_time_diff(char *start,char *end);
74int ms_time_cmp(char *ap,char *bp);
75
76#ifdef __cplusplus
77}
78#endif
79
80#endif
81
diff --git a/src/lib/libcrypto/txt_db/Makefile b/src/lib/libcrypto/txt_db/Makefile
new file mode 100644
index 0000000000..3cb550a795
--- /dev/null
+++ b/src/lib/libcrypto/txt_db/Makefile
@@ -0,0 +1,86 @@
1#
2# OpenSSL/crypto/txt_db/Makefile
3#
4
5DIR= txt_db
6TOP= ../..
7CC= cc
8INCLUDES=
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
18CFLAGS= $(INCLUDES) $(CFLAG)
19
20GENERAL=Makefile
21TEST=
22APPS=
23
24LIB=$(TOP)/libcrypto.a
25LIBSRC=txt_db.c
26LIBOBJ=txt_db.o
27
28SRC= $(LIBSRC)
29
30EXHEADER= txt_db.h
31HEADER= $(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
45files:
46 $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
47
48links:
49 @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
50 @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
51 @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
52
53install:
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 $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(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
80txt_db.o: ../../e_os.h ../../include/openssl/bio.h
81txt_db.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
82txt_db.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
83txt_db.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
84txt_db.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
85txt_db.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
86txt_db.o: ../../include/openssl/txt_db.h ../cryptlib.h txt_db.c
diff --git a/src/lib/libcrypto/txt_db/Makefile.ssl b/src/lib/libcrypto/txt_db/Makefile.ssl
new file mode 100644
index 0000000000..6221dfae4d
--- /dev/null
+++ b/src/lib/libcrypto/txt_db/Makefile.ssl
@@ -0,0 +1,88 @@
1#
2# SSLeay/crypto/txt_db/Makefile
3#
4
5DIR= txt_db
6TOP= ../..
7CC= cc
8INCLUDES=
9CFLAG=-g
10INSTALL_PREFIX=
11OPENSSLDIR= /usr/local/ssl
12INSTALLTOP=/usr/local/ssl
13MAKE= make -f Makefile.ssl
14MAKEDEPPROG= makedepend
15MAKEDEPEND= $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG)
16MAKEFILE= Makefile.ssl
17AR= ar r
18
19CFLAGS= $(INCLUDES) $(CFLAG)
20
21GENERAL=Makefile
22TEST=
23APPS=
24
25LIB=$(TOP)/libcrypto.a
26LIBSRC=txt_db.c
27LIBOBJ=txt_db.o
28
29SRC= $(LIBSRC)
30
31EXHEADER= txt_db.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.ssl >> $(TOP)/MINFO
48
49links:
50 @sh $(TOP)/util/point.sh Makefile.ssl Makefile
51 @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
52 @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
53 @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
54
55install:
56 @for i in $(EXHEADER) ; \
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 $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
72
73dclean:
74 $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
75 mv -f Makefile.new $(MAKEFILE)
76
77clean:
78 rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
79
80# DO NOT DELETE THIS LINE -- make depend depends on it.
81
82txt_db.o: ../../e_os.h ../../include/openssl/bio.h
83txt_db.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
84txt_db.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
85txt_db.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
86txt_db.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
87txt_db.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
88txt_db.o: ../../include/openssl/txt_db.h ../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..fcb2a66a39
--- /dev/null
+++ b/src/lib/libcrypto/ui/Makefile
@@ -0,0 +1,115 @@
1#
2# OpenSSL/crypto/ui/Makefile
3#
4
5DIR= ui
6TOP= ../..
7CC= cc
8INCLUDES= -I.. -I$(TOP) -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
18CFLAGS= $(INCLUDES) $(CFLAG)
19
20GENERAL=Makefile
21#TEST= uitest.c
22TEST=
23APPS=
24
25COMPATSRC= ui_compat.c
26COMPATOBJ= ui_compat.o
27
28LIB=$(TOP)/libcrypto.a
29LIBSRC= ui_err.c ui_lib.c ui_openssl.c ui_util.c $(COMPATSRC)
30LIBOBJ= ui_err.o ui_lib.o ui_openssl.o ui_util.o $(COMPATOBJ)
31
32SRC= $(LIBSRC)
33
34EXHEADER= ui.h ui_compat.h
35HEADER= $(EXHEADER) ui_locl.h
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 @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 $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
74
75dclean:
76 $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
77 mv -f Makefile.new $(MAKEFILE)
78
79clean:
80 rm -f *.o */*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
81
82# DO NOT DELETE THIS LINE -- make depend depends on it.
83
84ui_compat.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
85ui_compat.o: ../../include/openssl/opensslconf.h
86ui_compat.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
87ui_compat.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
88ui_compat.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
89ui_compat.o: ui_compat.c
90ui_err.o: ../../include/openssl/bio.h ../../include/openssl/crypto.h
91ui_err.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
92ui_err.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
93ui_err.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
94ui_err.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
95ui_err.o: ../../include/openssl/ui.h ui_err.c
96ui_lib.o: ../../e_os.h ../../include/openssl/bio.h
97ui_lib.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
98ui_lib.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
99ui_lib.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
100ui_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
101ui_lib.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
102ui_lib.o: ../../include/openssl/ui.h ../cryptlib.h ui_lib.c ui_locl.h
103ui_openssl.o: ../../e_os.h ../../include/openssl/bio.h
104ui_openssl.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
105ui_openssl.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
106ui_openssl.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
107ui_openssl.o: ../../include/openssl/opensslv.h
108ui_openssl.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
109ui_openssl.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
110ui_openssl.o: ../cryptlib.h ui_locl.h ui_openssl.c
111ui_util.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
112ui_util.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
113ui_util.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
114ui_util.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
115ui_util.o: ui_util.c
diff --git a/src/lib/libcrypto/ui/Makefile.ssl b/src/lib/libcrypto/ui/Makefile.ssl
new file mode 100644
index 0000000000..ba46951d1c
--- /dev/null
+++ b/src/lib/libcrypto/ui/Makefile.ssl
@@ -0,0 +1,117 @@
1#
2# OpenSSL/crypto/ui/Makefile
3#
4
5DIR= ui
6TOP= ../..
7CC= cc
8INCLUDES= -I.. -I$(TOP) -I../../include
9CFLAG=-g
10INSTALL_PREFIX=
11OPENSSLDIR= /usr/local/ssl
12INSTALLTOP=/usr/local/ssl
13MAKE= make -f Makefile.ssl
14MAKEDEPPROG= makedepend
15MAKEDEPEND= $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG)
16MAKEFILE= Makefile.ssl
17AR= ar r
18
19CFLAGS= $(INCLUDES) $(CFLAG)
20
21GENERAL=Makefile
22#TEST= uitest.c
23TEST=
24APPS=
25
26COMPATSRC= ui_compat.c
27COMPATOBJ= ui_compat.o
28
29LIB=$(TOP)/libcrypto.a
30LIBSRC= ui_err.c ui_lib.c ui_openssl.c ui_util.c $(COMPATSRC)
31LIBOBJ= ui_err.o ui_lib.o ui_openssl.o ui_util.o $(COMPATOBJ)
32
33SRC= $(LIBSRC)
34
35EXHEADER= ui.h ui_compat.h
36HEADER= $(EXHEADER) ui_locl.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.ssl >> $(TOP)/MINFO
52
53links:
54 @sh $(TOP)/util/point.sh Makefile.ssl Makefile
55 @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
56 @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
57 @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
58
59install:
60 @for i in $(EXHEADER) ; \
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 $(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
86ui_compat.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
87ui_compat.o: ../../include/openssl/opensslconf.h
88ui_compat.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
89ui_compat.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
90ui_compat.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
91ui_compat.o: ui_compat.c
92ui_err.o: ../../include/openssl/bio.h ../../include/openssl/crypto.h
93ui_err.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
94ui_err.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
95ui_err.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
96ui_err.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
97ui_err.o: ../../include/openssl/ui.h ui_err.c
98ui_lib.o: ../../e_os.h ../../include/openssl/bio.h
99ui_lib.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
100ui_lib.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
101ui_lib.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
102ui_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
103ui_lib.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
104ui_lib.o: ../../include/openssl/ui.h ../cryptlib.h ui_lib.c ui_locl.h
105ui_openssl.o: ../../e_os.h ../../include/openssl/bio.h
106ui_openssl.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
107ui_openssl.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
108ui_openssl.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
109ui_openssl.o: ../../include/openssl/opensslv.h
110ui_openssl.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
111ui_openssl.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
112ui_openssl.o: ../cryptlib.h ui_locl.h ui_openssl.c
113ui_util.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
114ui_util.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
115ui_util.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
116ui_util.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
117ui_util.o: 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_err.c b/src/lib/libcrypto/ui/ui_err.c
index d983cdd66f..39a62ae737 100644
--- a/src/lib/libcrypto/ui/ui_err.c
+++ b/src/lib/libcrypto/ui/ui_err.c
@@ -1,6 +1,6 @@
1/* crypto/ui/ui_err.c */ 1/* crypto/ui/ui_err.c */
2/* ==================================================================== 2/* ====================================================================
3 * Copyright (c) 1999-2005 The OpenSSL Project. All rights reserved. 3 * Copyright (c) 1999 The OpenSSL Project. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
@@ -64,36 +64,32 @@
64 64
65/* BEGIN ERROR CODES */ 65/* BEGIN ERROR CODES */
66#ifndef OPENSSL_NO_ERR 66#ifndef OPENSSL_NO_ERR
67
68#define ERR_FUNC(func) ERR_PACK(ERR_LIB_UI,func,0)
69#define ERR_REASON(reason) ERR_PACK(ERR_LIB_UI,0,reason)
70
71static ERR_STRING_DATA UI_str_functs[]= 67static ERR_STRING_DATA UI_str_functs[]=
72 { 68 {
73{ERR_FUNC(UI_F_GENERAL_ALLOCATE_BOOLEAN), "GENERAL_ALLOCATE_BOOLEAN"}, 69{ERR_PACK(0,UI_F_GENERAL_ALLOCATE_BOOLEAN,0), "GENERAL_ALLOCATE_BOOLEAN"},
74{ERR_FUNC(UI_F_GENERAL_ALLOCATE_PROMPT), "GENERAL_ALLOCATE_PROMPT"}, 70{ERR_PACK(0,UI_F_GENERAL_ALLOCATE_PROMPT,0), "GENERAL_ALLOCATE_PROMPT"},
75{ERR_FUNC(UI_F_GENERAL_ALLOCATE_STRING), "GENERAL_ALLOCATE_STRING"}, 71{ERR_PACK(0,UI_F_GENERAL_ALLOCATE_STRING,0), "GENERAL_ALLOCATE_STRING"},
76{ERR_FUNC(UI_F_UI_CTRL), "UI_ctrl"}, 72{ERR_PACK(0,UI_F_UI_CTRL,0), "UI_ctrl"},
77{ERR_FUNC(UI_F_UI_DUP_ERROR_STRING), "UI_dup_error_string"}, 73{ERR_PACK(0,UI_F_UI_DUP_ERROR_STRING,0), "UI_dup_error_string"},
78{ERR_FUNC(UI_F_UI_DUP_INFO_STRING), "UI_dup_info_string"}, 74{ERR_PACK(0,UI_F_UI_DUP_INFO_STRING,0), "UI_dup_info_string"},
79{ERR_FUNC(UI_F_UI_DUP_INPUT_BOOLEAN), "UI_dup_input_boolean"}, 75{ERR_PACK(0,UI_F_UI_DUP_INPUT_BOOLEAN,0), "UI_dup_input_boolean"},
80{ERR_FUNC(UI_F_UI_DUP_INPUT_STRING), "UI_dup_input_string"}, 76{ERR_PACK(0,UI_F_UI_DUP_INPUT_STRING,0), "UI_dup_input_string"},
81{ERR_FUNC(UI_F_UI_DUP_VERIFY_STRING), "UI_dup_verify_string"}, 77{ERR_PACK(0,UI_F_UI_DUP_VERIFY_STRING,0), "UI_dup_verify_string"},
82{ERR_FUNC(UI_F_UI_GET0_RESULT), "UI_get0_result"}, 78{ERR_PACK(0,UI_F_UI_GET0_RESULT,0), "UI_get0_result"},
83{ERR_FUNC(UI_F_UI_NEW_METHOD), "UI_new_method"}, 79{ERR_PACK(0,UI_F_UI_NEW_METHOD,0), "UI_new_method"},
84{ERR_FUNC(UI_F_UI_SET_RESULT), "UI_set_result"}, 80{ERR_PACK(0,UI_F_UI_SET_RESULT,0), "UI_set_result"},
85{0,NULL} 81{0,NULL}
86 }; 82 };
87 83
88static ERR_STRING_DATA UI_str_reasons[]= 84static ERR_STRING_DATA UI_str_reasons[]=
89 { 85 {
90{ERR_REASON(UI_R_COMMON_OK_AND_CANCEL_CHARACTERS),"common ok and cancel characters"}, 86{UI_R_COMMON_OK_AND_CANCEL_CHARACTERS ,"common ok and cancel characters"},
91{ERR_REASON(UI_R_INDEX_TOO_LARGE) ,"index too large"}, 87{UI_R_INDEX_TOO_LARGE ,"index too large"},
92{ERR_REASON(UI_R_INDEX_TOO_SMALL) ,"index too small"}, 88{UI_R_INDEX_TOO_SMALL ,"index too small"},
93{ERR_REASON(UI_R_NO_RESULT_BUFFER) ,"no result buffer"}, 89{UI_R_NO_RESULT_BUFFER ,"no result buffer"},
94{ERR_REASON(UI_R_RESULT_TOO_LARGE) ,"result too large"}, 90{UI_R_RESULT_TOO_LARGE ,"result too large"},
95{ERR_REASON(UI_R_RESULT_TOO_SMALL) ,"result too small"}, 91{UI_R_RESULT_TOO_SMALL ,"result too small"},
96{ERR_REASON(UI_R_UNKNOWN_CONTROL_COMMAND),"unknown control command"}, 92{UI_R_UNKNOWN_CONTROL_COMMAND ,"unknown control command"},
97{0,NULL} 93{0,NULL}
98 }; 94 };
99 95
@@ -107,8 +103,8 @@ void ERR_load_UI_strings(void)
107 { 103 {
108 init=0; 104 init=0;
109#ifndef OPENSSL_NO_ERR 105#ifndef OPENSSL_NO_ERR
110 ERR_load_strings(0,UI_str_functs); 106 ERR_load_strings(ERR_LIB_UI,UI_str_functs);
111 ERR_load_strings(0,UI_str_reasons); 107 ERR_load_strings(ERR_LIB_UI,UI_str_reasons);
112#endif 108#endif
113 109
114 } 110 }
diff --git a/src/lib/libcrypto/uid.c b/src/lib/libcrypto/uid.c
new file mode 100644
index 0000000000..73205a4baa
--- /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)
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/checkhash.pl b/src/lib/libcrypto/util/checkhash.pl
new file mode 100644
index 0000000000..c61fa72178
--- /dev/null
+++ b/src/lib/libcrypto/util/checkhash.pl
@@ -0,0 +1,222 @@
1#!/usr/bin/env perl -w
2
3my $package = caller;
4
5if (!(defined $package))
6 {
7 my $retval = check_hashes(@ARGV);
8 exit $retval;
9 }
10
111;
12
13sub check_hashes
14 {
15
16 my @args = @_;
17
18 my $change_dir = "";
19 my $check_program = "sha/fips_standalone_sha1";
20
21 my $verbose = 0;
22 my $badfiles = 0;
23 my $rebuild = 0;
24 my $force_rewrite = 0;
25 my $hash_file = "fipshashes.c";
26 my $recurse = 0;
27
28 my @fingerprint_files;
29
30 while (@args)
31 {
32 my $arg = $args[0];
33 if ($arg eq "-chdir")
34 {
35 shift @args;
36 $change_dir = shift @args;
37 }
38 elsif ($arg eq "-rebuild")
39 {
40 shift @args;
41 $rebuild = 1;
42 }
43 elsif ($arg eq "-verbose")
44 {
45 shift @args;
46 $verbose = 1;
47 }
48 elsif ($arg eq "-force-rewrite")
49 {
50 shift @args;
51 $force_rewrite = 1;
52 }
53 elsif ($arg eq "-hash_file")
54 {
55 shift @args;
56 $hash_file = shift @args;
57 }
58 elsif ($arg eq "-recurse")
59 {
60 shift @args;
61 $recurse = 1;
62 }
63 elsif ($arg eq "-program_path")
64 {
65 shift @args;
66 $check_program = shift @args;
67 }
68 else
69 {
70 print STDERR "Unknown Option $arg";
71 return 1;
72 }
73
74 }
75
76 chdir $change_dir if $change_dir ne "";
77
78 if ($recurse)
79 {
80 @fingerprint_files = ("fingerprint.sha1",
81 <*/fingerprint.sha1>);
82 }
83 else
84 {
85 push @fingerprint_files, $hash_file;
86 }
87
88 foreach $fp (@fingerprint_files)
89 {
90 if (!open(IN, "$fp"))
91 {
92 print STDERR "Can't open file $fp";
93 return 1;
94 }
95 print STDERR "Opening Fingerprint file $fp\n" if $verbose;
96 my $dir = $fp;
97 $dir =~ s/[^\/]*$//;
98 while (<IN>)
99 {
100 chomp;
101 if (!(($file, $hash) = /^\"HMAC-SHA1\((.*)\)\s*=\s*(\w*)\",$/))
102 {
103 /^\"/ || next;
104 print STDERR "FATAL: Invalid syntax in file $fp\n";
105 print STDERR "Line:\n$_\n";
106 fatal_error();
107 return 1;
108 }
109 if (!$rebuild && length($hash) != 40)
110 {
111 print STDERR "FATAL: Invalid hash length in $fp for file $file\n";
112 fatal_error();
113 return 1;
114 }
115 push @hashed_files, "$dir$file";
116 if (exists $hashes{"$dir$file"})
117 {
118 print STDERR "FATAL: Duplicate Hash file $dir$file\n";
119 fatal_error();
120 return 1;
121 }
122 if (! -r "$dir$file")
123 {
124 print STDERR "FATAL: Can't access $dir$file\n";
125 fatal_error();
126 return 1;
127 }
128 $hashes{"$dir$file"} = $hash;
129 }
130 close IN;
131 }
132
133 @checked_hashes = `$check_program @hashed_files`;
134
135 if ($? != 0)
136 {
137 print STDERR "Error running hash program $check_program\n";
138 fatal_error();
139 return 1;
140 }
141
142 if (@checked_hashes != @hashed_files)
143 {
144 print STDERR "FATAL: hash count incorrect\n";
145 fatal_error();
146 return 1;
147 }
148
149 foreach (@checked_hashes)
150 {
151 chomp;
152 if (!(($file, $hash) = /^HMAC-SHA1\((.*)\)\s*=\s*(\w*)$/))
153 {
154 print STDERR "FATAL: Invalid syntax in file $fp\n";
155 print STDERR "Line:\n$_\n";
156 fatal_error();
157 return 1;
158 }
159 if (length($hash) != 40)
160 {
161 print STDERR "FATAL: Invalid hash length for file $file\n";
162 fatal_error();
163 return 1;
164 }
165 if ($hash ne $hashes{$file})
166 {
167 if ($rebuild)
168 {
169 print STDERR "Updating hash on file $file\n";
170 $hashes{$file} = $hash;
171 }
172 else
173 {
174 print STDERR "Hash check failed for file $file\n";
175 }
176 $badfiles++;
177 }
178 elsif ($verbose)
179 { print "Hash Check OK for $file\n";}
180 }
181
182
183 if ($badfiles && !$rebuild)
184 {
185 print STDERR "FATAL: hash mismatch on $badfiles files\n";
186 fatal_error();
187 return 1;
188 }
189
190 if ($badfiles || $force_rewrite)
191 {
192 print "Updating Hash file $hash_file\n";
193 if (!open(OUT, ">$hash_file"))
194 {
195 print STDERR "Error rewriting $hash_file";
196 return 1;
197 }
198 print OUT "const char * const FIPS_source_hashes[] = {\n";
199 foreach (@hashed_files)
200 {
201 print OUT "\"HMAC-SHA1($_)= $hashes{$_}\",\n";
202 }
203 print OUT "};\n";
204 close OUT;
205 }
206
207 if (!$badfiles)
208 {
209 print "FIPS hash check successful\n";
210 }
211
212 return 0;
213
214 }
215
216
217sub fatal_error
218 {
219 print STDERR "*** Your source code does not match the FIPS validated source ***\n";
220 }
221
222
diff --git a/src/lib/libcrypto/util/ck_errf.pl b/src/lib/libcrypto/util/ck_errf.pl
new file mode 100644
index 0000000000..7a24d6c5a2
--- /dev/null
+++ b/src/lib/libcrypto/util/ck_errf.pl
@@ -0,0 +1,45 @@
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
10foreach $file (@ARGV)
11 {
12 open(IN,"<$file") || die "unable to open $file\n";
13 $func="";
14 while (<IN>)
15 {
16 if (/^[a-zA-Z].+[\s*]([A-Za-z_0-9]+)\(.*\)/)
17 {
18 $func=$1;
19 $func =~ tr/A-Z/a-z/;
20 }
21 if (/([A-Z0-9]+)err\(([^,]+)/)
22 {
23 next if ($func eq "");
24 $errlib=$1;
25 $n=$2;
26 if ($n !~ /([^_]+)_F_(.+)$/)
27 {
28 # print "check -$file:$.:$func:$n\n";
29 next;
30 }
31 $lib=$1;
32 $n=$2;
33
34 if ($lib ne $errlib)
35 { print "$file:$.:$func:$n\n"; next; }
36
37 $n =~ tr/A-Z/a-z/;
38 if (($n ne $func) && ($errlib ne "SYS"))
39 { print "$file:$.:$func:$n\n"; next; }
40 # print "$func:$1\n";
41 }
42 }
43 close(IN);
44 }
45
diff --git a/src/lib/libcrypto/util/clean-depend.pl b/src/lib/libcrypto/util/clean-depend.pl
new file mode 100644
index 0000000000..6c485d1e2f
--- /dev/null
+++ b/src/lib/libcrypto/util/clean-depend.pl
@@ -0,0 +1,54 @@
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 foreach $dep (sort @{$files{$file}}) {
41 $dep=~s/^\.\///;
42 next if $prevdep eq $dep; # to exterminate duplicates...
43 $prevdep = $dep;
44 $len=0 if $len+length($dep)+1 >= 80;
45 if($len == 0) {
46 print "\n$file:";
47 $len=length($file)+1;
48 }
49 print " $dep";
50 $len+=length($dep)+1;
51 }
52}
53
54print "\n";
diff --git a/src/lib/libcrypto/util/cygwin.sh b/src/lib/libcrypto/util/cygwin.sh
new file mode 100644
index 0000000000..7f791d47f4
--- /dev/null
+++ b/src/lib/libcrypto/util/cygwin.sh
@@ -0,0 +1,127 @@
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 no-idea no-rc5 no-mdc2"
11INSTALL_PREFIX=/tmp/install
12
13VERSION=
14SUBVERSION=$1
15
16function cleanup()
17{
18 rm -rf ${INSTALL_PREFIX}/etc
19 rm -rf ${INSTALL_PREFIX}/usr
20}
21
22function get_openssl_version()
23{
24 eval `grep '^VERSION=' Makefile`
25 if [ -z "${VERSION}" ]
26 then
27 echo "Error: Couldn't retrieve OpenSSL version from Makefile."
28 echo " Check value of variable VERSION in Makefile."
29 exit 1
30 fi
31}
32
33function base_install()
34{
35 mkdir -p ${INSTALL_PREFIX}
36 cleanup
37 make install INSTALL_PREFIX="${INSTALL_PREFIX}"
38}
39
40function doc_install()
41{
42 DOC_DIR=${INSTALL_PREFIX}/usr/share/doc/openssl
43
44 mkdir -p ${DOC_DIR}
45 cp CHANGES CHANGES.SSLeay INSTALL LICENSE NEWS README ${DOC_DIR}
46
47 create_cygwin_readme
48}
49
50function create_cygwin_readme()
51{
52 README_DIR=${INSTALL_PREFIX}/usr/share/doc/Cygwin
53 README_FILE=${README_DIR}/openssl-${VERSION}.README
54
55 mkdir -p ${README_DIR}
56 cat > ${README_FILE} <<- EOF
57 The Cygwin version has been built using the following configure:
58
59 ./config ${CONFIG_OPTIONS}
60
61 The IDEA, RC5 and MDC2 algorithms are disabled due to patent and/or
62 licensing issues.
63 EOF
64}
65
66function create_profile_files()
67{
68 PROFILE_DIR=${INSTALL_PREFIX}/etc/profile.d
69
70 mkdir -p $PROFILE_DIR
71 cat > ${PROFILE_DIR}/openssl.sh <<- "EOF"
72 export MANPATH="${MANPATH}:/usr/ssl/man"
73 EOF
74 cat > ${PROFILE_DIR}/openssl.csh <<- "EOF"
75 if ( $?MANPATH ) then
76 setenv MANPATH "${MANPATH}:/usr/ssl/man"
77 else
78 setenv MANPATH ":/usr/ssl/man"
79 endif
80 EOF
81}
82
83if [ -z "${SUBVERSION}" ]
84then
85 echo "Usage: $0 subversion"
86 exit 1
87fi
88
89if [ ! -f config ]
90then
91 echo "You must start this script in the OpenSSL toplevel source dir."
92 exit 1
93fi
94
95./config ${CONFIG_OPTIONS}
96
97get_openssl_version
98
99make depend || exit 1
100
101make || exit 1
102
103base_install
104
105doc_install
106
107create_cygwin_readme
108
109create_profile_files
110
111cd ${INSTALL_PREFIX}
112strip usr/bin/*.exe usr/bin/*.dll
113
114# Runtime package
115find etc usr/bin usr/share/doc usr/ssl/certs usr/ssl/man/man[157] \
116 usr/ssl/misc usr/ssl/openssl.cnf usr/ssl/private -empty -o \! -type d |
117tar cjfT openssl-${VERSION}-${SUBVERSION}.tar.bz2 -
118# Development package
119find usr/include usr/lib usr/ssl/man/man3 -empty -o \! -type d |
120tar cjfT openssl-devel-${VERSION}-${SUBVERSION}.tar.bz2 -
121
122ls -l openssl-${VERSION}-${SUBVERSION}.tar.bz2
123ls -l openssl-devel-${VERSION}-${SUBVERSION}.tar.bz2
124
125cleanup
126
127exit 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/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..5610521f0b
--- /dev/null
+++ b/src/lib/libcrypto/util/domd
@@ -0,0 +1,34 @@
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 [ "$MAKEDEPEND" = "gcc" ]; 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 gcc -D OPENSSL_DOING_MAKEDEPEND -M $args >> Makefile.tmp
26 ${PERL} $TOP/util/clean-depend.pl < Makefile.tmp > Makefile.new
27 rm -f Makefile.tmp
28else
29 ${MAKEDEPEND} -D OPENSSL_DOING_MAKEDEPEND -f Makefile $@
30 ${PERL} $TOP/util/clean-depend.pl < Makefile > Makefile.new
31fi
32mv Makefile.new Makefile
33# unfake the presence of Kerberos
34rm $TOP/krb5.h
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/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/fipslink.pl b/src/lib/libcrypto/util/fipslink.pl
new file mode 100644
index 0000000000..a893833c5c
--- /dev/null
+++ b/src/lib/libcrypto/util/fipslink.pl
@@ -0,0 +1,78 @@
1#!/usr/bin/perl
2
3sub check_env
4 {
5 my @ret;
6 foreach (@_)
7 {
8 die "Environment variable $_ not defined!\n" unless exists $ENV{$_};
9 push @ret, $ENV{$_};
10 }
11 return @ret;
12 }
13
14
15my ($fips_cc,$fips_cc_args, $fips_link,$fips_target, $fips_libdir, $sha1_exe)
16 = check_env("FIPS_CC", "FIPS_CC_ARGS", "FIPS_LINK", "FIPS_TARGET",
17 "FIPSLIB_D", "FIPS_SHA1_EXE");
18
19
20
21if (exists $ENV{"PREMAIN_DSO_EXE"})
22 {
23 $fips_premain_dso = $ENV{"PREMAIN_DSO_EXE"};
24 }
25 else
26 {
27 $fips_premain_dso = "";
28 }
29
30check_hash($sha1_exe, "fips_premain.c");
31check_hash($sha1_exe, "fipscanister.o");
32
33
34print "Integrity check OK\n";
35
36print "$fips_cc $fips_cc_args $fips_libdir/fips_premain.c\n";
37system "$fips_cc $fips_cc_args $fips_libdir/fips_premain.c";
38die "First stage Compile failure" if $? != 0;
39
40print "$fips_link @ARGV\n";
41system "$fips_link @ARGV";
42die "First stage Link failure" if $? != 0;
43
44
45print "$fips_premain_dso $fips_target\n";
46$fips_hash=`$fips_premain_dso $fips_target`;
47chomp $fips_hash;
48die "Get hash failure" if $? != 0;
49
50
51print "$fips_cc -DHMAC_SHA1_SIG=\\\"$fips_hash\\\" $fips_cc_args $fips_libdir/fips_premain.c\n";
52system "$fips_cc -DHMAC_SHA1_SIG=\\\"$fips_hash\\\" $fips_cc_args $fips_libdir/fips_premain.c";
53die "Second stage Compile failure" if $? != 0;
54
55
56print "$fips_link @ARGV\n";
57system "$fips_link @ARGV";
58die "Second stage Link failure" if $? != 0;
59
60sub check_hash
61 {
62 my ($sha1_exe, $filename) = @_;
63 my ($hashfile, $hashval);
64
65 open(IN, "${fips_libdir}/${filename}.sha1") || die "Cannot open file hash file ${fips_libdir}/${filename}.sha1";
66 $hashfile = <IN>;
67 close IN;
68 $hashval = `$sha1_exe ${fips_libdir}/$filename`;
69 chomp $hashfile;
70 chomp $hashval;
71 $hashfile =~ s/^.*=\s+//;
72 $hashval =~ s/^.*=\s+//;
73 die "Invalid hash syntax in file" if (length($hashfile) != 40);
74 die "Invalid hash received for file" if (length($hashval) != 40);
75 die "***HASH VALUE MISMATCH FOR FILE $filename ***" if ($hashval ne $hashfile);
76 }
77
78
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..56fb7446e0
--- /dev/null
+++ b/src/lib/libcrypto/util/libeay.num
@@ -0,0 +1,2869 @@
1SSLeay 1 EXIST::FUNCTION:
2SSLeay_version 2 EXIST::FUNCTION:
3ASN1_BIT_STRING_asn1_meth 3 EXIST::FUNCTION:
4ASN1_HEADER_free 4 EXIST::FUNCTION:
5ASN1_HEADER_new 5 EXIST::FUNCTION:
6ASN1_IA5STRING_asn1_meth 6 EXIST::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:!WIN16:FUNCTION:FP_API
79BIO_new_fp 83 EXIST:!WIN16: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:!WIN16: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:
127BN_get_word 133 EXIST::FUNCTION:
128BN_is_bit_set 134 EXIST::FUNCTION:
129BN_is_prime 135 EXIST::FUNCTION:
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:
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:
189CRYPTO_set_locking_callback 197 EXIST::FUNCTION:
190CRYPTO_set_mem_functions 198 EXIST::FUNCTION:
191CRYPTO_thread_id 199 EXIST::FUNCTION:
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: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: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:
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 EXIST::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:!WIN16:FUNCTION:
360PEM_ASN1_read_bio 368 EXIST::FUNCTION:BIO
361PEM_ASN1_write 369 EXIST:!WIN16: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:!WIN16: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:!WIN16: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:!WIN16: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 EXIST::FUNCTION:RSA
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: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 EXIST::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 EXIST::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: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 EXIST::FUNCTION:DES
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 EXIST::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: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 EXIST:WIN16:FUNCTION:FP_API
954BIO_new_fp_internal 971 EXIST:WIN16:FUNCTION:FP_API
955BIO_s_file_internal 972 EXIST:WIN16:FUNCTION:FP_API
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,!WIN16:FUNCTION:
988ERR_load_CRYPTOlib_strings 1009 EXIST:OS2,VMS,WIN16: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:BIO
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:
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 EXIST::FUNCTION:
1121ms_time_new 1149 EXIST::FUNCTION:
1122ms_time_free 1150 EXIST::FUNCTION:
1123ms_time_cmp 1151 EXIST::FUNCTION:
1124ms_time_get 1152 EXIST::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:
1225BN_get_params 1249 EXIST::FUNCTION:
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:
1258asc2uni 1282 EXIST::FUNCTION:
1259uni2asc 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:
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:RSA
1818d2i_RSA_NET_2 2407 NOEXIST::FUNCTION:
1819d2i_RSA_NET 2408 EXIST::FUNCTION: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
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 EXIST::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 EXIST::FUNCTION:DES
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:
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
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
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
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
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,!WIN16:FUNCTION:
2736OCSP_crlID2_new 3181 EXIST:OS2,VMS,WIN16: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
2766ENGINE_load_sureware 3211 EXIST::FUNCTION: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
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 EXIST:OPENSSL_FIPS:FUNCTION:
2808FIPS_selftest_des 3250 EXIST:OPENSSL_FIPS:FUNCTION:
2809EVP_aes_128_cfb1 3251 EXIST::FUNCTION:AES
2810EVP_aes_192_cfb8 3252 EXIST::FUNCTION:AES
2811FIPS_mode_set 3253 EXIST:OPENSSL_FIPS:FUNCTION:
2812FIPS_selftest_dsa 3254 EXIST:OPENSSL_FIPS:FUNCTION:
2813EVP_aes_256_cfb8 3255 EXIST::FUNCTION:AES
2814FIPS_allow_md5 3256 EXIST:OPENSSL_FIPS:FUNCTION:
2815DES_ede3_cfb_encrypt 3257 EXIST::FUNCTION:DES
2816EVP_des_ede3_cfb8 3258 EXIST::FUNCTION:DES
2817FIPS_rand_seeded 3259 EXIST:OPENSSL_FIPS:FUNCTION:
2818AES_cfbr_encrypt_block 3260 EXIST::FUNCTION:AES
2819AES_cfb8_encrypt 3261 EXIST::FUNCTION:AES
2820FIPS_rand_seed 3262 EXIST:OPENSSL_FIPS:FUNCTION:
2821FIPS_corrupt_des 3263 EXIST:OPENSSL_FIPS:FUNCTION:
2822EVP_aes_192_cfb1 3264 EXIST::FUNCTION:AES
2823FIPS_selftest_aes 3265 EXIST:OPENSSL_FIPS:FUNCTION:
2824FIPS_set_prng_key 3266 EXIST:OPENSSL_FIPS:FUNCTION:
2825EVP_des_cfb8 3267 EXIST::FUNCTION:DES
2826FIPS_corrupt_dsa 3268 EXIST:OPENSSL_FIPS:FUNCTION:
2827FIPS_test_mode 3269 EXIST:OPENSSL_FIPS:FUNCTION:
2828FIPS_rand_method 3270 EXIST:OPENSSL_FIPS:FUNCTION:
2829EVP_aes_256_cfb1 3271 EXIST::FUNCTION:AES
2830ERR_load_FIPS_strings 3272 EXIST:OPENSSL_FIPS:FUNCTION:
2831FIPS_corrupt_aes 3273 EXIST:OPENSSL_FIPS:FUNCTION:
2832FIPS_selftest_sha1 3274 EXIST:OPENSSL_FIPS:FUNCTION:
2833FIPS_selftest_rsa 3275 EXIST:OPENSSL_FIPS:FUNCTION:
2834FIPS_corrupt_sha1 3276 EXIST:OPENSSL_FIPS:FUNCTION:
2835EVP_des_cfb1 3277 EXIST::FUNCTION:DES
2836FIPS_dsa_check 3278 EXIST:OPENSSL_FIPS:FUNCTION:
2837AES_cfb1_encrypt 3279 EXIST::FUNCTION:AES
2838EVP_des_ede3_cfb1 3280 EXIST::FUNCTION:DES
2839FIPS_rand_check 3281 EXIST:OPENSSL_FIPS:FUNCTION:
2840FIPS_md5_allowed 3282 EXIST:OPENSSL_FIPS:FUNCTION:
2841FIPS_mode 3283 EXIST:OPENSSL_FIPS:FUNCTION:
2842FIPS_selftest_failed 3284 EXIST:OPENSSL_FIPS: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 EXIST:OPENSSL_FIPS:FUNCTION:RC5
2851private_MD5_Init 3293 EXIST:OPENSSL_FIPS:FUNCTION:MD5
2852private_RC4_set_key 3294 EXIST:OPENSSL_FIPS: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:
diff --git a/src/lib/libcrypto/util/mk1mf.pl b/src/lib/libcrypto/util/mk1mf.pl
new file mode 100644
index 0000000000..957264c6b5
--- /dev/null
+++ b/src/lib/libcrypto/util/mk1mf.pl
@@ -0,0 +1,944 @@
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$OPTIONS="";
10$ssl_version="";
11$banner="\t\@echo Building OpenSSL";
12
13open(IN,"<Makefile") || die "unable to open Makefile!\n";
14while(<IN>) {
15 $ssl_version=$1 if (/^VERSION=(.*)$/);
16 $OPTIONS=$1 if (/^OPTIONS=(.*)$/);
17 $INSTALLTOP=$1 if (/^INSTALLTOP=(.*$)/);
18}
19close(IN);
20
21die "Makefile is not the toplevel Makefile!\n" if $ssl_version eq "";
22
23$infile="MINFO";
24
25%ops=(
26 "VC-WIN32", "Microsoft Visual C++ [4-6] - Windows NT or 9X",
27 "VC-CE", "Microsoft eMbedded Visual C++ 3.0 - Windows CE ONLY",
28 "VC-NT", "Microsoft Visual C++ [4-6] - Windows NT ONLY",
29 "VC-W31-16", "Microsoft Visual C++ 1.52 - Windows 3.1 - 286",
30 "VC-WIN16", "Alias for VC-W31-32",
31 "VC-W31-32", "Microsoft Visual C++ 1.52 - Windows 3.1 - 386+",
32 "VC-MSDOS","Microsoft Visual C++ 1.52 - MSDOS",
33 "Mingw32", "GNU C++ - Windows NT or 9x",
34 "Mingw32-files", "Create files with DOS copy ...",
35 "BC-NT", "Borland C++ 4.5 - Windows NT",
36 "BC-W31", "Borland C++ 4.5 - Windows 3.1 - PROBABLY NOT WORKING",
37 "BC-MSDOS","Borland C++ 4.5 - MSDOS",
38 "linux-elf","Linux elf",
39 "ultrix-mips","DEC mips ultrix",
40 "FreeBSD","FreeBSD distribution",
41 "OS2-EMX", "EMX GCC OS/2",
42 "default","cc under unix",
43 );
44
45$platform="";
46foreach (@ARGV)
47 {
48 if (!&read_options && !defined($ops{$_}))
49 {
50 print STDERR "unknown option - $_\n";
51 print STDERR "usage: perl mk1mf.pl [options] [system]\n";
52 print STDERR "\nwhere [system] can be one of the following\n";
53 foreach $i (sort keys %ops)
54 { printf STDERR "\t%-10s\t%s\n",$i,$ops{$i}; }
55 print STDERR <<"EOF";
56and [options] can be one of
57 no-md2 no-md4 no-md5 no-sha no-mdc2 - Skip this digest
58 no-ripemd
59 no-rc2 no-rc4 no-rc5 no-idea no-des - Skip this symetric cipher
60 no-bf no-cast no-aes
61 no-rsa no-dsa no-dh - Skip this public key cipher
62 no-ssl2 no-ssl3 - Skip this version of SSL
63 just-ssl - remove all non-ssl keys/digest
64 no-asm - No x86 asm
65 no-krb5 - No KRB5
66 no-ec - No EC
67 no-engine - No engine
68 no-hw - No hw
69 nasm - Use NASM for x86 asm
70 gaswin - Use GNU as with Mingw32
71 no-socks - No socket code
72 no-err - No error strings
73 dll/shlib - Build shared libraries (MS)
74 debug - Debug build
75 profile - Profiling build
76 gcc - Use Gcc (unix)
77
78Values that can be set
79TMP=tmpdir OUT=outdir SRC=srcdir BIN=binpath INC=header-outdir CC=C-compiler
80
81-L<ex_lib_path> -l<ex_lib> - extra library flags (unix)
82-<ex_cc_flags> - extra 'cc' flags,
83 added (MS), or replace (unix)
84EOF
85 exit(1);
86 }
87 $platform=$_;
88 }
89foreach (grep(!/^$/, split(/ /, $OPTIONS)))
90 {
91 print STDERR "unknown option - $_\n" if !&read_options;
92 }
93
94$no_mdc2=1 if ($no_des);
95
96$no_ssl3=1 if ($no_md5 || $no_sha);
97$no_ssl3=1 if ($no_rsa && $no_dh);
98
99$no_ssl2=1 if ($no_md5);
100$no_ssl2=1 if ($no_rsa);
101
102$out_def="out";
103$inc_def="outinc";
104$tmp_def="tmp";
105
106$mkdir="-mkdir";
107
108($ssl,$crypto)=("ssl","crypto");
109$ranlib="echo ranlib";
110
111$cc=(defined($VARS{'CC'}))?$VARS{'CC'}:'cc';
112$src_dir=(defined($VARS{'SRC'}))?$VARS{'SRC'}:'.';
113$bin_dir=(defined($VARS{'BIN'}))?$VARS{'BIN'}:'';
114
115# $bin_dir.=$o causes a core dump on my sparc :-(
116
117$NT=0;
118
119push(@INC,"util/pl","pl");
120if ($platform eq "VC-MSDOS")
121 {
122 $asmbits=16;
123 $msdos=1;
124 require 'VC-16.pl';
125 }
126elsif ($platform eq "VC-W31-16")
127 {
128 $asmbits=16;
129 $msdos=1; $win16=1;
130 require 'VC-16.pl';
131 }
132elsif (($platform eq "VC-W31-32") || ($platform eq "VC-WIN16"))
133 {
134 $asmbits=32;
135 $msdos=1; $win16=1;
136 require 'VC-16.pl';
137 }
138elsif (($platform eq "VC-WIN32") || ($platform eq "VC-NT"))
139 {
140 $NT = 1 if $platform eq "VC-NT";
141 require 'VC-32.pl';
142 }
143elsif ($platform eq "VC-CE")
144 {
145 require 'VC-CE.pl';
146 }
147elsif ($platform eq "Mingw32")
148 {
149 require 'Mingw32.pl';
150 }
151elsif ($platform eq "Mingw32-files")
152 {
153 require 'Mingw32f.pl';
154 }
155elsif ($platform eq "BC-NT")
156 {
157 $bc=1;
158 require 'BC-32.pl';
159 }
160elsif ($platform eq "BC-W31")
161 {
162 $bc=1;
163 $msdos=1; $w16=1;
164 require 'BC-16.pl';
165 }
166elsif ($platform eq "BC-Q16")
167 {
168 $msdos=1; $w16=1; $shlib=0; $qw=1;
169 require 'BC-16.pl';
170 }
171elsif ($platform eq "BC-MSDOS")
172 {
173 $asmbits=16;
174 $msdos=1;
175 require 'BC-16.pl';
176 }
177elsif ($platform eq "FreeBSD")
178 {
179 require 'unix.pl';
180 $cflags='-DTERMIO -D_ANSI_SOURCE -O2 -fomit-frame-pointer';
181 }
182elsif ($platform eq "linux-elf")
183 {
184 require "unix.pl";
185 require "linux.pl";
186 $unix=1;
187 }
188elsif ($platform eq "ultrix-mips")
189 {
190 require "unix.pl";
191 require "ultrix.pl";
192 $unix=1;
193 }
194elsif ($platform eq "OS2-EMX")
195 {
196 $wc=1;
197 require 'OS2-EMX.pl';
198 }
199else
200 {
201 require "unix.pl";
202
203 $unix=1;
204 $cflags.=' -DTERMIO';
205 }
206
207$out_dir=(defined($VARS{'OUT'}))?$VARS{'OUT'}:$out_def.($debug?".dbg":"");
208$tmp_dir=(defined($VARS{'TMP'}))?$VARS{'TMP'}:$tmp_def.($debug?".dbg":"");
209$inc_dir=(defined($VARS{'INC'}))?$VARS{'INC'}:$inc_def;
210
211$bin_dir=$bin_dir.$o unless ((substr($bin_dir,-1,1) eq $o) || ($bin_dir eq ''));
212
213$cflags.=" -DOPENSSL_NO_IDEA" if $no_idea;
214$cflags.=" -DOPENSSL_NO_AES" if $no_aes;
215$cflags.=" -DOPENSSL_NO_RC2" if $no_rc2;
216$cflags.=" -DOPENSSL_NO_RC4" if $no_rc4;
217$cflags.=" -DOPENSSL_NO_RC5" if $no_rc5;
218$cflags.=" -DOPENSSL_NO_MD2" if $no_md2;
219$cflags.=" -DOPENSSL_NO_MD4" if $no_md4;
220$cflags.=" -DOPENSSL_NO_MD5" if $no_md5;
221$cflags.=" -DOPENSSL_NO_SHA" if $no_sha;
222$cflags.=" -DOPENSSL_NO_SHA1" if $no_sha1;
223$cflags.=" -DOPENSSL_NO_RIPEMD" if $no_ripemd;
224$cflags.=" -DOPENSSL_NO_MDC2" if $no_mdc2;
225$cflags.=" -DOPENSSL_NO_BF" if $no_bf;
226$cflags.=" -DOPENSSL_NO_CAST" if $no_cast;
227$cflags.=" -DOPENSSL_NO_DES" if $no_des;
228$cflags.=" -DOPENSSL_NO_RSA" if $no_rsa;
229$cflags.=" -DOPENSSL_NO_DSA" if $no_dsa;
230$cflags.=" -DOPENSSL_NO_DH" if $no_dh;
231$cflags.=" -DOPENSSL_NO_SOCK" if $no_sock;
232$cflags.=" -DOPENSSL_NO_SSL2" if $no_ssl2;
233$cflags.=" -DOPENSSL_NO_SSL3" if $no_ssl3;
234$cflags.=" -DOPENSSL_NO_ERR" if $no_err;
235$cflags.=" -DOPENSSL_NO_KRB5" if $no_krb5;
236$cflags.=" -DOPENSSL_NO_EC" if $no_ec;
237$cflags.=" -DOPENSSL_NO_ENGINE" if $no_engine;
238$cflags.=" -DOPENSSL_NO_HW" if $no_hw;
239$cflags.=" -DOPENSSL_FIPS" if $fips;
240#$cflags.=" -DRSAref" if $rsaref ne "";
241
242## if ($unix)
243## { $cflags="$c_flags" if ($c_flags ne ""); }
244##else
245 { $cflags="$c_flags$cflags" if ($c_flags ne ""); }
246
247$ex_libs="$l_flags$ex_libs" if ($l_flags ne "");
248
249%shlib_ex_cflags=("SSL" => " -DOPENSSL_BUILD_SHLIBSSL",
250 "CRYPTO" => " -DOPENSSL_BUILD_SHLIBCRYPTO");
251
252if ($msdos)
253 {
254 $banner ="\t\@echo Make sure you have run 'perl Configure $platform' in the\n";
255 $banner.="\t\@echo top level directory, if you don't have perl, you will\n";
256 $banner.="\t\@echo need to probably edit crypto/bn/bn.h, check the\n";
257 $banner.="\t\@echo documentation for details.\n";
258 }
259
260# have to do this to allow $(CC) under unix
261$link="$bin_dir$link" if ($link !~ /^\$/);
262
263$INSTALLTOP =~ s|/|$o|g;
264
265$defs= <<"EOF";
266# This makefile has been automatically generated from the OpenSSL distribution.
267# This single makefile will build the complete OpenSSL distribution and
268# by default leave the 'intertesting' output files in .${o}out and the stuff
269# that needs deleting in .${o}tmp.
270# The file was generated by running 'make makefile.one', which
271# does a 'make files', which writes all the environment variables from all
272# the makefiles to the file call MINFO. This file is used by
273# util${o}mk1mf.pl to generate makefile.one.
274# The 'makefile per directory' system suites me when developing this
275# library and also so I can 'distribute' indervidual library sections.
276# The one monster makefile better suits building in non-unix
277# environments.
278
279EOF
280
281$defs .= $preamble if defined $preamble;
282
283if ($platform eq "VC-CE")
284 {
285 $defs.= <<"EOF";
286!INCLUDE <\$(WCECOMPAT)/wcedefs.mak>
287
288EOF
289 }
290
291$defs.= <<"EOF";
292INSTALLTOP=$INSTALLTOP
293
294# Set your compiler options
295PLATFORM=$platform
296CC=$bin_dir${cc}
297CFLAG=$cflags
298APP_CFLAG=$app_cflag
299LIB_CFLAG=$lib_cflag
300SHLIB_CFLAG=$shl_cflag
301APP_EX_OBJ=$app_ex_obj
302SHLIB_EX_OBJ=$shlib_ex_obj
303# add extra libraries to this define, for solaris -lsocket -lnsl would
304# be added
305EX_LIBS=$ex_libs
306
307# The OpenSSL directory
308SRC_D=$src_dir
309
310LINK=$link
311LFLAGS=$lflags
312
313BN_ASM_OBJ=$bn_asm_obj
314BN_ASM_SRC=$bn_asm_src
315BNCO_ASM_OBJ=$bnco_asm_obj
316BNCO_ASM_SRC=$bnco_asm_src
317DES_ENC_OBJ=$des_enc_obj
318DES_ENC_SRC=$des_enc_src
319BF_ENC_OBJ=$bf_enc_obj
320BF_ENC_SRC=$bf_enc_src
321CAST_ENC_OBJ=$cast_enc_obj
322CAST_ENC_SRC=$cast_enc_src
323RC4_ENC_OBJ=$rc4_enc_obj
324RC4_ENC_SRC=$rc4_enc_src
325RC5_ENC_OBJ=$rc5_enc_obj
326RC5_ENC_SRC=$rc5_enc_src
327MD5_ASM_OBJ=$md5_asm_obj
328MD5_ASM_SRC=$md5_asm_src
329SHA1_ASM_OBJ=$sha1_asm_obj
330SHA1_ASM_SRC=$sha1_asm_src
331RMD160_ASM_OBJ=$rmd160_asm_obj
332RMD160_ASM_SRC=$rmd160_asm_src
333
334# The output directory for everything intersting
335OUT_D=$out_dir
336# The output directory for all the temporary muck
337TMP_D=$tmp_dir
338# The output directory for the header files
339INC_D=$inc_dir
340INCO_D=$inc_dir${o}openssl
341
342CP=$cp
343RM=$rm
344RANLIB=$ranlib
345MKDIR=$mkdir
346MKLIB=$bin_dir$mklib
347MLFLAGS=$mlflags
348ASM=$bin_dir$asm
349
350######################################################
351# You should not need to touch anything below this point
352######################################################
353
354E_EXE=openssl
355SSL=$ssl
356CRYPTO=$crypto
357
358# BIN_D - Binary output directory
359# TEST_D - Binary test file output directory
360# LIB_D - library output directory
361# Note: if you change these point to different directories then uncomment out
362# the lines around the 'NB' comment below.
363#
364BIN_D=\$(OUT_D)
365TEST_D=\$(OUT_D)
366LIB_D=\$(OUT_D)
367
368# INCL_D - local library directory
369# OBJ_D - temp object file directory
370OBJ_D=\$(TMP_D)
371INCL_D=\$(TMP_D)
372
373O_SSL= \$(LIB_D)$o$plib\$(SSL)$shlibp
374O_CRYPTO= \$(LIB_D)$o$plib\$(CRYPTO)$shlibp
375SO_SSL= $plib\$(SSL)$so_shlibp
376SO_CRYPTO= $plib\$(CRYPTO)$so_shlibp
377L_SSL= \$(LIB_D)$o$plib\$(SSL)$libp
378L_CRYPTO= \$(LIB_D)$o$plib\$(CRYPTO)$libp
379
380L_LIBS= \$(L_SSL) \$(L_CRYPTO)
381
382######################################################
383# Don't touch anything below this point
384######################################################
385
386INC=-I\$(INC_D) -I\$(INCL_D)
387APP_CFLAGS=\$(INC) \$(CFLAG) \$(APP_CFLAG)
388LIB_CFLAGS=\$(INC) \$(CFLAG) \$(LIB_CFLAG)
389SHLIB_CFLAGS=\$(INC) \$(CFLAG) \$(LIB_CFLAG) \$(SHLIB_CFLAG)
390LIBS_DEP=\$(O_CRYPTO) \$(O_SSL)
391
392#############################################
393EOF
394
395$rules=<<"EOF";
396all: banner \$(TMP_D) \$(BIN_D) \$(TEST_D) \$(LIB_D) \$(INCO_D) headers lib exe
397
398banner:
399$banner
400
401\$(TMP_D):
402 \$(MKDIR) \$(TMP_D)
403# NB: uncomment out these lines if BIN_D, TEST_D and LIB_D are different
404#\$(BIN_D):
405# \$(MKDIR) \$(BIN_D)
406#
407#\$(TEST_D):
408# \$(MKDIR) \$(TEST_D)
409
410\$(LIB_D):
411 \$(MKDIR) \$(LIB_D)
412
413\$(INCO_D): \$(INC_D)
414 \$(MKDIR) \$(INCO_D)
415
416\$(INC_D):
417 \$(MKDIR) \$(INC_D)
418
419headers: \$(HEADER) \$(EXHEADER)
420 @
421
422lib: \$(LIBS_DEP)
423
424exe: \$(T_EXE) \$(BIN_D)$o\$(E_EXE)$exep
425
426install:
427 \$(MKDIR) \$(INSTALLTOP)
428 \$(MKDIR) \$(INSTALLTOP)${o}bin
429 \$(MKDIR) \$(INSTALLTOP)${o}include
430 \$(MKDIR) \$(INSTALLTOP)${o}include${o}openssl
431 \$(MKDIR) \$(INSTALLTOP)${o}lib
432 \$(CP) \$(INCO_D)${o}*.\[ch\] \$(INSTALLTOP)${o}include${o}openssl
433 \$(CP) \$(BIN_D)$o\$(E_EXE)$exep \$(INSTALLTOP)${o}bin
434 \$(CP) \$(O_SSL) \$(INSTALLTOP)${o}lib
435 \$(CP) \$(O_CRYPTO) \$(INSTALLTOP)${o}lib
436
437clean:
438 \$(RM) \$(TMP_D)$o*.*
439
440vclean:
441 \$(RM) \$(TMP_D)$o*.*
442 \$(RM) \$(OUT_D)$o*.*
443
444EOF
445
446my $platform_cpp_symbol = "MK1MF_PLATFORM_$platform";
447$platform_cpp_symbol =~ s/-/_/g;
448if (open(IN,"crypto/buildinf.h"))
449 {
450 # Remove entry for this platform in existing file buildinf.h.
451
452 my $old_buildinf_h = "";
453 while (<IN>)
454 {
455 if (/^\#ifdef $platform_cpp_symbol$/)
456 {
457 while (<IN>) { last if (/^\#endif/); }
458 }
459 else
460 {
461 $old_buildinf_h .= $_;
462 }
463 }
464 close(IN);
465
466 open(OUT,">crypto/buildinf.h") || die "Can't open buildinf.h";
467 print OUT $old_buildinf_h;
468 close(OUT);
469 }
470
471open (OUT,">>crypto/buildinf.h") || die "Can't open buildinf.h";
472printf OUT <<EOF;
473#ifdef $platform_cpp_symbol
474 /* auto-generated/updated by util/mk1mf.pl for crypto/cversion.c */
475 #define CFLAGS "$cc $cflags"
476 #define PLATFORM "$platform"
477EOF
478printf OUT " #define DATE \"%s\"\n", scalar gmtime();
479printf OUT "#endif\n";
480close(OUT);
481
482#############################################
483# We parse in input file and 'store' info for later printing.
484open(IN,"<$infile") || die "unable to open $infile:$!\n";
485$_=<IN>;
486for (;;)
487 {
488 chop;
489
490 ($key,$val)=/^([^=]+)=(.*)/;
491 if ($key eq "RELATIVE_DIRECTORY")
492 {
493 if ($lib ne "")
494 {
495 $uc=$lib;
496 $uc =~ s/^lib(.*)\.a/$1/;
497 $uc =~ tr/a-z/A-Z/;
498 $lib_nam{$uc}=$uc;
499 $lib_obj{$uc}.=$libobj." ";
500 }
501 last if ($val eq "FINISHED");
502 $lib="";
503 $libobj="";
504 $dir=$val;
505 }
506
507 if ($key eq "TEST")
508 { $test.=&var_add($dir,$val); }
509
510 if (($key eq "PROGS") || ($key eq "E_OBJ"))
511 { $e_exe.=&var_add($dir,$val); }
512
513 if ($key eq "LIB")
514 {
515 $lib=$val;
516 $lib =~ s/^.*\/([^\/]+)$/$1/;
517 }
518
519 if ($key eq "EXHEADER")
520 { $exheader.=&var_add($dir,$val); }
521
522 if ($key eq "HEADER")
523 { $header.=&var_add($dir,$val); }
524
525 if ($key eq "LIBOBJ")
526 { $libobj=&var_add($dir,$val); }
527
528 if (!($_=<IN>))
529 { $_="RELATIVE_DIRECTORY=FINISHED\n"; }
530 }
531close(IN);
532
533# Strip of trailing ' '
534foreach (keys %lib_obj) { $lib_obj{$_}=&clean_up_ws($lib_obj{$_}); }
535$test=&clean_up_ws($test);
536$e_exe=&clean_up_ws($e_exe);
537$exheader=&clean_up_ws($exheader);
538$header=&clean_up_ws($header);
539
540# First we strip the exheaders from the headers list
541foreach (split(/\s+/,$exheader)){ $h{$_}=1; }
542foreach (split(/\s+/,$header)) { $h.=$_." " unless $h{$_}; }
543chop($h); $header=$h;
544
545$defs.=&do_defs("HEADER",$header,"\$(INCL_D)",".h");
546$rules.=&do_copy_rule("\$(INCL_D)",$header,".h");
547
548$defs.=&do_defs("EXHEADER",$exheader,"\$(INCO_D)",".h");
549$rules.=&do_copy_rule("\$(INCO_D)",$exheader,".h");
550
551$defs.=&do_defs("T_OBJ",$test,"\$(OBJ_D)",$obj);
552$rules.=&do_compile_rule("\$(OBJ_D)",$test,"\$(APP_CFLAGS)");
553
554$defs.=&do_defs("E_OBJ",$e_exe,"\$(OBJ_D)",$obj);
555$rules.=&do_compile_rule("\$(OBJ_D)",$e_exe,'-DMONOLITH $(APP_CFLAGS)');
556
557foreach (values %lib_nam)
558 {
559 $lib_obj=$lib_obj{$_};
560 local($slib)=$shlib;
561
562 if (($_ eq "SSL") && $no_ssl2 && $no_ssl3)
563 {
564 $rules.="\$(O_SSL):\n\n";
565 next;
566 }
567
568 if (($bn_asm_obj ne "") && ($_ eq "CRYPTO"))
569 {
570 $lib_obj =~ s/\s\S*\/bn_asm\S*/ \$(BN_ASM_OBJ)/;
571 $rules.=&do_asm_rule($bn_asm_obj,$bn_asm_src);
572 }
573 if (($bnco_asm_obj ne "") && ($_ eq "CRYPTO"))
574 {
575 $lib_obj .= "\$(BNCO_ASM_OBJ)";
576 $rules.=&do_asm_rule($bnco_asm_obj,$bnco_asm_src);
577 }
578 if (($des_enc_obj ne "") && ($_ eq "CRYPTO"))
579 {
580 $lib_obj =~ s/\s\S*des_enc\S*/ \$(DES_ENC_OBJ)/;
581 $lib_obj =~ s/\s\S*\/fcrypt_b\S*\s*/ /;
582 $rules.=&do_asm_rule($des_enc_obj,$des_enc_src);
583 }
584 if (($bf_enc_obj ne "") && ($_ eq "CRYPTO"))
585 {
586 $lib_obj =~ s/\s\S*\/bf_enc\S*/ \$(BF_ENC_OBJ)/;
587 $rules.=&do_asm_rule($bf_enc_obj,$bf_enc_src);
588 }
589 if (($cast_enc_obj ne "") && ($_ eq "CRYPTO"))
590 {
591 $lib_obj =~ s/(\s\S*\/c_enc\S*)/ \$(CAST_ENC_OBJ)/;
592 $rules.=&do_asm_rule($cast_enc_obj,$cast_enc_src);
593 }
594 if (($rc4_enc_obj ne "") && ($_ eq "CRYPTO"))
595 {
596 $lib_obj =~ s/\s\S*\/rc4_enc\S*/ \$(RC4_ENC_OBJ)/;
597 $rules.=&do_asm_rule($rc4_enc_obj,$rc4_enc_src);
598 }
599 if (($rc5_enc_obj ne "") && ($_ eq "CRYPTO"))
600 {
601 $lib_obj =~ s/\s\S*\/rc5_enc\S*/ \$(RC5_ENC_OBJ)/;
602 $rules.=&do_asm_rule($rc5_enc_obj,$rc5_enc_src);
603 }
604 if (($md5_asm_obj ne "") && ($_ eq "CRYPTO"))
605 {
606 $lib_obj =~ s/\s(\S*\/md5_dgst\S*)/ $1 \$(MD5_ASM_OBJ)/;
607 $rules.=&do_asm_rule($md5_asm_obj,$md5_asm_src);
608 }
609 if (($sha1_asm_obj ne "") && ($_ eq "CRYPTO"))
610 {
611 $lib_obj =~ s/\s(\S*\/sha1dgst\S*)/ $1 \$(SHA1_ASM_OBJ)/;
612 $rules.=&do_asm_rule($sha1_asm_obj,$sha1_asm_src);
613 }
614 if (($rmd160_asm_obj ne "") && ($_ eq "CRYPTO"))
615 {
616 $lib_obj =~ s/\s(\S*\/rmd_dgst\S*)/ $1 \$(RMD160_ASM_OBJ)/;
617 $rules.=&do_asm_rule($rmd160_asm_obj,$rmd160_asm_src);
618 }
619 $defs.=&do_defs(${_}."OBJ",$lib_obj,"\$(OBJ_D)",$obj);
620 $lib=($slib)?" \$(SHLIB_CFLAGS)".$shlib_ex_cflags{$_}:" \$(LIB_CFLAGS)";
621 $rules.=&do_compile_rule("\$(OBJ_D)",$lib_obj{$_},$lib);
622 }
623
624$defs.=&do_defs("T_EXE",$test,"\$(TEST_D)",$exep);
625foreach (split(/\s+/,$test))
626 {
627 $t=&bname($_);
628 $tt="\$(OBJ_D)${o}$t${obj}";
629 $rules.=&do_link_rule("\$(TEST_D)$o$t$exep",$tt,"\$(LIBS_DEP)","\$(L_LIBS) \$(EX_LIBS)");
630 }
631
632$rules.= &do_lib_rule("\$(SSLOBJ)","\$(O_SSL)",$ssl,$shlib,"\$(SO_SSL)");
633$rules.= &do_lib_rule("\$(CRYPTOOBJ)","\$(O_CRYPTO)",$crypto,$shlib,"\$(SO_CRYPTO)");
634
635if ($fips)
636 {
637 $rules.=&do_link_rule("\$(BIN_D)$o\$(E_EXE)$exep","\$(E_OBJ)","\$(LIBS_DEP)","\$(L_LIBS) \$(EX_LIBS)","\$(BIN_D)$o.sha1","\$(BIN_D)$o\$(E_EXE)$exep");
638 }
639else
640 {
641 $rules.=&do_link_rule("\$(BIN_D)$o\$(E_EXE)$exep","\$(E_OBJ)","\$(LIBS_DEP)","\$(L_LIBS) \$(EX_LIBS)");
642 }
643print $defs;
644
645if ($platform eq "linux-elf") {
646 print <<"EOF";
647# Generate perlasm output files
648%.cpp:
649 (cd \$(\@D)/..; PERL=perl make -f Makefile asm/\$(\@F))
650EOF
651}
652print "###################################################################\n";
653print $rules;
654
655###############################################
656# strip off any trailing .[och] and append the relative directory
657# also remembering to do nothing if we are in one of the dropped
658# directories
659sub var_add
660 {
661 local($dir,$val)=@_;
662 local(@a,$_,$ret);
663
664 return("") if $no_engine && $dir =~ /\/engine/;
665 return("") if $no_hw && $dir =~ /\/hw/;
666 return("") if $no_idea && $dir =~ /\/idea/;
667 return("") if $no_aes && $dir =~ /\/aes/;
668 return("") if $no_rc2 && $dir =~ /\/rc2/;
669 return("") if $no_rc4 && $dir =~ /\/rc4/;
670 return("") if $no_rc5 && $dir =~ /\/rc5/;
671 return("") if $no_rsa && $dir =~ /\/rsa/;
672 return("") if $no_rsa && $dir =~ /^rsaref/;
673 return("") if $no_dsa && $dir =~ /\/dsa/;
674 return("") if $no_dh && $dir =~ /\/dh/;
675 return("") if $no_ec && $dir =~ /\/ec/;
676 if ($no_des && $dir =~ /\/des/)
677 {
678 if ($val =~ /read_pwd/)
679 { return("$dir/read_pwd "); }
680 else
681 { return(""); }
682 }
683 return("") if $no_mdc2 && $dir =~ /\/mdc2/;
684 return("") if $no_sock && $dir =~ /\/proxy/;
685 return("") if $no_bf && $dir =~ /\/bf/;
686 return("") if $no_cast && $dir =~ /\/cast/;
687
688 $val =~ s/^\s*(.*)\s*$/$1/;
689 @a=split(/\s+/,$val);
690 grep(s/\.[och]$//,@a);
691
692 @a=grep(!/^e_.*_3d$/,@a) if $no_des;
693 @a=grep(!/^e_.*_d$/,@a) if $no_des;
694 @a=grep(!/^e_.*_ae$/,@a) if $no_idea;
695 @a=grep(!/^e_.*_i$/,@a) if $no_aes;
696 @a=grep(!/^e_.*_r2$/,@a) if $no_rc2;
697 @a=grep(!/^e_.*_r5$/,@a) if $no_rc5;
698 @a=grep(!/^e_.*_bf$/,@a) if $no_bf;
699 @a=grep(!/^e_.*_c$/,@a) if $no_cast;
700 @a=grep(!/^e_rc4$/,@a) if $no_rc4;
701
702 @a=grep(!/(^s2_)|(^s23_)/,@a) if $no_ssl2;
703 @a=grep(!/(^s3_)|(^s23_)/,@a) if $no_ssl3;
704
705 @a=grep(!/(_sock$)|(_acpt$)|(_conn$)|(^pxy_)/,@a) if $no_sock;
706
707 @a=grep(!/(^md2)|(_md2$)/,@a) if $no_md2;
708 @a=grep(!/(^md4)|(_md4$)/,@a) if $no_md4;
709 @a=grep(!/(^md5)|(_md5$)/,@a) if $no_md5;
710 @a=grep(!/(rmd)|(ripemd)/,@a) if $no_ripemd;
711
712 @a=grep(!/(^d2i_r_)|(^i2d_r_)/,@a) if $no_rsa;
713 @a=grep(!/(^p_open$)|(^p_seal$)/,@a) if $no_rsa;
714 @a=grep(!/(^pem_seal$)/,@a) if $no_rsa;
715
716 @a=grep(!/(m_dss$)|(m_dss1$)/,@a) if $no_dsa;
717 @a=grep(!/(^d2i_s_)|(^i2d_s_)|(_dsap$)/,@a) if $no_dsa;
718
719 @a=grep(!/^n_pkey$/,@a) if $no_rsa || $no_rc4;
720
721 @a=grep(!/_dhp$/,@a) if $no_dh;
722
723 @a=grep(!/(^sha[^1])|(_sha$)|(m_dss$)/,@a) if $no_sha;
724 @a=grep(!/(^sha1)|(_sha1$)|(m_dss1$)/,@a) if $no_sha1;
725 @a=grep(!/_mdc2$/,@a) if $no_mdc2;
726
727 @a=grep(!/^engine$/,@a) if $no_engine;
728 @a=grep(!/^hw$/,@a) if $no_hw;
729 @a=grep(!/(^rsa$)|(^genrsa$)/,@a) if $no_rsa;
730 @a=grep(!/(^dsa$)|(^gendsa$)|(^dsaparam$)/,@a) if $no_dsa;
731 @a=grep(!/^gendsa$/,@a) if $no_sha1;
732 @a=grep(!/(^dh$)|(^gendh$)/,@a) if $no_dh;
733
734 @a=grep(!/(^dh)|(_sha1$)|(m_dss1$)/,@a) if $no_sha1;
735
736 grep($_="$dir/$_",@a);
737 @a=grep(!/(^|\/)s_/,@a) if $no_sock;
738 @a=grep(!/(^|\/)bio_sock/,@a) if $no_sock;
739 $ret=join(' ',@a)." ";
740 return($ret);
741 }
742
743# change things so that each 'token' is only separated by one space
744sub clean_up_ws
745 {
746 local($w)=@_;
747
748 $w =~ s/^\s*(.*)\s*$/$1/;
749 $w =~ s/\s+/ /g;
750 return($w);
751 }
752
753sub do_defs
754 {
755 local($var,$files,$location,$postfix)=@_;
756 local($_,$ret,$pf);
757 local(*OUT,$tmp,$t);
758
759 $files =~ s/\//$o/g if $o ne '/';
760 $ret="$var=";
761 $n=1;
762 $Vars{$var}.="";
763 foreach (split(/ /,$files))
764 {
765 $orig=$_;
766 $_=&bname($_) unless /^\$/;
767 if ($n++ == 2)
768 {
769 $n=0;
770 $ret.="\\\n\t";
771 }
772 if (($_ =~ /bss_file/) && ($postfix eq ".h"))
773 { $pf=".c"; }
774 else { $pf=$postfix; }
775 if ($_ =~ /BN_ASM/) { $t="$_ "; }
776 elsif ($_ =~ /BNCO_ASM/){ $t="$_ "; }
777 elsif ($_ =~ /DES_ENC/) { $t="$_ "; }
778 elsif ($_ =~ /BF_ENC/) { $t="$_ "; }
779 elsif ($_ =~ /CAST_ENC/){ $t="$_ "; }
780 elsif ($_ =~ /RC4_ENC/) { $t="$_ "; }
781 elsif ($_ =~ /RC5_ENC/) { $t="$_ "; }
782 elsif ($_ =~ /MD5_ASM/) { $t="$_ "; }
783 elsif ($_ =~ /SHA1_ASM/){ $t="$_ "; }
784 elsif ($_ =~ /RMD160_ASM/){ $t="$_ "; }
785 else { $t="$location${o}$_$pf "; }
786
787 $Vars{$var}.="$t ";
788 $ret.=$t;
789 }
790 chop($ret);
791 $ret.="\n\n";
792 return($ret);
793 }
794
795# return the name with the leading path removed
796sub bname
797 {
798 local($ret)=@_;
799 $ret =~ s/^.*[\\\/]([^\\\/]+)$/$1/;
800 return($ret);
801 }
802
803
804##############################################################
805# do a rule for each file that says 'compile' to new direcory
806# compile the files in '$files' into $to
807sub do_compile_rule
808 {
809 local($to,$files,$ex)=@_;
810 local($ret,$_,$n);
811
812 $files =~ s/\//$o/g if $o ne '/';
813 foreach (split(/\s+/,$files))
814 {
815 $n=&bname($_);
816 $ret.=&cc_compile_target("$to${o}$n$obj","${_}.c",$ex)
817 }
818 return($ret);
819 }
820
821##############################################################
822# do a rule for each file that says 'compile' to new direcory
823sub cc_compile_target
824 {
825 local($target,$source,$ex_flags)=@_;
826 local($ret);
827
828 $ex_flags.=" -DMK1MF_BUILD -D$platform_cpp_symbol" if ($source =~ /cversion/);
829 $target =~ s/\//$o/g if $o ne "/";
830 $source =~ s/\//$o/g if $o ne "/";
831 $ret ="$target: \$(SRC_D)$o$source\n\t";
832 $ret.="\$(CC) ${ofile}$target $ex_flags -c \$(SRC_D)$o$source\n\n";
833 return($ret);
834 }
835
836##############################################################
837sub do_asm_rule
838 {
839 local($target,$src)=@_;
840 local($ret,@s,@t,$i);
841
842 $target =~ s/\//$o/g if $o ne "/";
843 $src =~ s/\//$o/g if $o ne "/";
844
845 @s=split(/\s+/,$src);
846 @t=split(/\s+/,$target);
847
848 for ($i=0; $i<=$#s; $i++)
849 {
850 $ret.="$t[$i]: $s[$i]\n";
851 $ret.="\t\$(ASM) $afile$t[$i] \$(SRC_D)$o$s[$i]\n\n";
852 }
853 return($ret);
854 }
855
856sub do_shlib_rule
857 {
858 local($n,$def)=@_;
859 local($ret,$nn);
860 local($t);
861
862 ($nn=$n) =~ tr/a-z/A-Z/;
863 $ret.="$n.dll: \$(${nn}OBJ)\n";
864 if ($vc && $w32)
865 {
866 $ret.="\t\$(MKSHLIB) $efile$n.dll $def @<<\n \$(${nn}OBJ_F)\n<<\n";
867 }
868 $ret.="\n";
869 return($ret);
870 }
871
872# do a rule for each file that says 'copy' to new direcory on change
873sub do_copy_rule
874 {
875 local($to,$files,$p)=@_;
876 local($ret,$_,$n,$pp);
877
878 $files =~ s/\//$o/g if $o ne '/';
879 foreach (split(/\s+/,$files))
880 {
881 $n=&bname($_);
882 if ($n =~ /bss_file/)
883 { $pp=".c"; }
884 else { $pp=$p; }
885 $ret.="$to${o}$n$pp: \$(SRC_D)$o$_$pp\n\t\$(CP) \$(SRC_D)$o$_$pp $to${o}$n$pp\n\n";
886 }
887 return($ret);
888 }
889
890sub read_options
891 {
892 if (/^no-rc2$/) { $no_rc2=1; }
893 elsif (/^no-rc4$/) { $no_rc4=1; }
894 elsif (/^no-rc5$/) { $no_rc5=1; }
895 elsif (/^no-idea$/) { $no_idea=1; }
896 elsif (/^no-aes$/) { $no_aes=1; }
897 elsif (/^no-des$/) { $no_des=1; }
898 elsif (/^no-bf$/) { $no_bf=1; }
899 elsif (/^no-cast$/) { $no_cast=1; }
900 elsif (/^no-md2$/) { $no_md2=1; }
901 elsif (/^no-md4$/) { $no_md4=1; }
902 elsif (/^no-md5$/) { $no_md5=1; }
903 elsif (/^no-sha$/) { $no_sha=1; }
904 elsif (/^no-sha1$/) { $no_sha1=1; }
905 elsif (/^no-ripemd$/) { $no_ripemd=1; }
906 elsif (/^no-mdc2$/) { $no_mdc2=1; }
907 elsif (/^no-patents$/) { $no_rc2=$no_rc4=$no_rc5=$no_idea=$no_rsa=1; }
908 elsif (/^no-rsa$/) { $no_rsa=1; }
909 elsif (/^no-dsa$/) { $no_dsa=1; }
910 elsif (/^no-dh$/) { $no_dh=1; }
911 elsif (/^no-hmac$/) { $no_hmac=1; }
912 elsif (/^no-aes$/) { $no_aes=1; }
913 elsif (/^no-asm$/) { $no_asm=1; }
914 elsif (/^nasm$/) { $nasm=1; }
915 elsif (/^gaswin$/) { $gaswin=1; }
916 elsif (/^no-ssl2$/) { $no_ssl2=1; }
917 elsif (/^no-ssl3$/) { $no_ssl3=1; }
918 elsif (/^no-err$/) { $no_err=1; }
919 elsif (/^no-sock$/) { $no_sock=1; }
920 elsif (/^no-krb5$/) { $no_krb5=1; }
921 elsif (/^no-ec$/) { $no_ec=1; }
922 elsif (/^no-engine$/) { $no_engine=1; }
923 elsif (/^no-hw$/) { $no_hw=1; }
924
925 elsif (/^just-ssl$/) { $no_rc2=$no_idea=$no_des=$no_bf=$no_cast=1;
926 $no_md2=$no_sha=$no_mdc2=$no_dsa=$no_dh=1;
927 $no_ssl2=$no_err=$no_ripemd=$no_rc5=1;
928 $no_aes=1; }
929
930 elsif (/^rsaref$/) { }
931 elsif (/^fips$/) { $fips=1; }
932 elsif (/^gcc$/) { $gcc=1; }
933 elsif (/^debug$/) { $debug=1; }
934 elsif (/^profile$/) { $profile=1; }
935 elsif (/^shlib$/) { $shlib=1; }
936 elsif (/^dll$/) { $shlib=1; }
937 elsif (/^shared$/) { } # We just need to ignore it for now...
938 elsif (/^([^=]*)=(.*)$/){ $VARS{$1}=$2; }
939 elsif (/^-[lL].*$/) { $l_flags.="$_ "; }
940 elsif ((!/^-help/) && (!/^-h/) && (!/^-\?/) && /^-.*$/)
941 { $c_flags.="$_ "; }
942 else { return(0); }
943 return(1);
944 }
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..9918c3d549
--- /dev/null
+++ b/src/lib/libcrypto/util/mkdef.pl
@@ -0,0 +1,1404 @@
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 $VMSAlpha=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", "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 "RIPEMD",
87 "MDC2", "RSA", "DSA", "DH", "EC", "HMAC", "AES",
88 # Envelope "algorithms"
89 "EVP", "X509", "ASN1_TYPEDEFS",
90 # Helper "algorithms"
91 "BIO", "COMP", "BUFFER", "LHASH", "STACK", "ERR",
92 "LOCKING",
93 # External "algorithms"
94 "FP_API", "STDIO", "SOCK", "KRB5", "ENGINE", "HW" );
95
96my $options="";
97open(IN,"<Makefile") || die "unable to open Makefile!\n";
98while(<IN>) {
99 $options=$1 if (/^OPTIONS=(.*)$/);
100}
101close(IN);
102
103# The following ciphers may be excluded (by Configure). This means functions
104# defined with ifndef(NO_XXX) are not included in the .def file, and everything
105# in directory xxx is ignored.
106my $no_rc2; my $no_rc4; my $no_rc5; my $no_idea; my $no_des; my $no_bf;
107my $no_cast;
108my $no_md2; my $no_md4; my $no_md5; my $no_sha; my $no_ripemd; my $no_mdc2;
109my $no_rsa; my $no_dsa; my $no_dh; my $no_hmac=0; my $no_aes; my $no_krb5;
110my $no_ec; my $no_engine; my $no_hw;
111my $no_fp_api;
112my $fips;
113
114foreach (@ARGV, split(/ /, $options))
115 {
116 $debug=1 if $_ eq "debug";
117 $W32=1 if $_ eq "32";
118 $W16=1 if $_ eq "16";
119 if($_ eq "NT") {
120 $W32 = 1;
121 $NT = 1;
122 }
123 if ($_ eq "VMS-VAX") {
124 $VMS=1;
125 $VMSVAX=1;
126 }
127 if ($_ eq "VMS-Alpha") {
128 $VMS=1;
129 $VMSAlpha=1;
130 }
131 $VMS=1 if $_ eq "VMS";
132 $OS2=1 if $_ eq "OS2";
133 $fips=1 if $_ eq "fips";
134
135 $do_ssl=1 if $_ eq "ssleay";
136 if ($_ eq "ssl") {
137 $do_ssl=1;
138 $libname=$_
139 }
140 $do_crypto=1 if $_ eq "libeay";
141 if ($_ eq "crypto") {
142 $do_crypto=1;
143 $libname=$_;
144 }
145 $do_update=1 if $_ eq "update";
146 $do_rewrite=1 if $_ eq "rewrite";
147 $do_ctest=1 if $_ eq "ctest";
148 $do_ctestall=1 if $_ eq "ctestall";
149 $do_checkexist=1 if $_ eq "exist";
150 #$safe_stack_def=1 if $_ eq "-DDEBUG_SAFESTACK";
151
152 if (/^no-rc2$/) { $no_rc2=1; }
153 elsif (/^no-rc4$/) { $no_rc4=1; }
154 elsif (/^no-rc5$/) { $no_rc5=1; }
155 elsif (/^no-idea$/) { $no_idea=1; }
156 elsif (/^no-des$/) { $no_des=1; $no_mdc2=1; }
157 elsif (/^no-bf$/) { $no_bf=1; }
158 elsif (/^no-cast$/) { $no_cast=1; }
159 elsif (/^no-md2$/) { $no_md2=1; }
160 elsif (/^no-md4$/) { $no_md4=1; }
161 elsif (/^no-md5$/) { $no_md5=1; }
162 elsif (/^no-sha$/) { $no_sha=1; }
163 elsif (/^no-ripemd$/) { $no_ripemd=1; }
164 elsif (/^no-mdc2$/) { $no_mdc2=1; }
165 elsif (/^no-rsa$/) { $no_rsa=1; }
166 elsif (/^no-dsa$/) { $no_dsa=1; }
167 elsif (/^no-dh$/) { $no_dh=1; }
168 elsif (/^no-ec$/) { $no_ec=1; }
169 elsif (/^no-hmac$/) { $no_hmac=1; }
170 elsif (/^no-aes$/) { $no_aes=1; }
171 elsif (/^no-evp$/) { $no_evp=1; }
172 elsif (/^no-lhash$/) { $no_lhash=1; }
173 elsif (/^no-stack$/) { $no_stack=1; }
174 elsif (/^no-err$/) { $no_err=1; }
175 elsif (/^no-buffer$/) { $no_buffer=1; }
176 elsif (/^no-bio$/) { $no_bio=1; }
177 #elsif (/^no-locking$/) { $no_locking=1; }
178 elsif (/^no-comp$/) { $no_comp=1; }
179 elsif (/^no-dso$/) { $no_dso=1; }
180 elsif (/^no-krb5$/) { $no_krb5=1; }
181 elsif (/^no-engine$/) { $no_engine=1; }
182 elsif (/^no-hw$/) { $no_hw=1; }
183 }
184
185
186if (!$libname) {
187 if ($do_ssl) {
188 $libname="SSLEAY";
189 }
190 if ($do_crypto) {
191 $libname="LIBEAY";
192 }
193}
194
195# If no platform is given, assume WIN32
196if ($W32 + $W16 + $VMS + $OS2 == 0) {
197 $W32 = 1;
198}
199
200# Add extra knowledge
201if ($W16) {
202 $no_fp_api=1;
203}
204
205if (!$do_ssl && !$do_crypto)
206 {
207 print STDERR "usage: $0 ( ssl | crypto ) [ 16 | 32 | NT | OS2 ]\n";
208 exit(1);
209 }
210
211%ssl_list=&load_numbers($ssl_num);
212$max_ssl = $max_num;
213%crypto_list=&load_numbers($crypto_num);
214$max_crypto = $max_num;
215
216my $ssl="ssl/ssl.h";
217$ssl.=" ssl/kssl.h";
218
219my $crypto ="crypto/crypto.h";
220$crypto.=" crypto/des/des.h crypto/des/des_old.h" ; # unless $no_des;
221$crypto.=" crypto/idea/idea.h" ; # unless $no_idea;
222$crypto.=" crypto/rc4/rc4.h" ; # unless $no_rc4;
223$crypto.=" crypto/rc5/rc5.h" ; # unless $no_rc5;
224$crypto.=" crypto/rc2/rc2.h" ; # unless $no_rc2;
225$crypto.=" crypto/bf/blowfish.h" ; # unless $no_bf;
226$crypto.=" crypto/cast/cast.h" ; # unless $no_cast;
227$crypto.=" crypto/md2/md2.h" ; # unless $no_md2;
228$crypto.=" crypto/md4/md4.h" ; # unless $no_md4;
229$crypto.=" crypto/md5/md5.h" ; # unless $no_md5;
230$crypto.=" crypto/mdc2/mdc2.h" ; # unless $no_mdc2;
231$crypto.=" crypto/sha/sha.h" ; # unless $no_sha;
232$crypto.=" crypto/ripemd/ripemd.h" ; # unless $no_ripemd;
233$crypto.=" crypto/aes/aes.h" ; # unless $no_aes;
234
235$crypto.=" crypto/bn/bn.h";
236$crypto.=" crypto/rsa/rsa.h" ; # unless $no_rsa;
237$crypto.=" crypto/dsa/dsa.h" ; # unless $no_dsa;
238$crypto.=" crypto/dh/dh.h" ; # unless $no_dh;
239$crypto.=" crypto/ec/ec.h" ; # unless $no_ec;
240$crypto.=" crypto/hmac/hmac.h" ; # unless $no_hmac;
241
242$crypto.=" crypto/engine/engine.h"; # unless $no_engine;
243$crypto.=" crypto/stack/stack.h" ; # unless $no_stack;
244$crypto.=" crypto/buffer/buffer.h" ; # unless $no_buffer;
245$crypto.=" crypto/bio/bio.h" ; # unless $no_bio;
246$crypto.=" crypto/dso/dso.h" ; # unless $no_dso;
247$crypto.=" crypto/lhash/lhash.h" ; # unless $no_lhash;
248$crypto.=" crypto/conf/conf.h";
249$crypto.=" crypto/txt_db/txt_db.h";
250
251$crypto.=" crypto/evp/evp.h" ; # unless $no_evp;
252$crypto.=" crypto/objects/objects.h";
253$crypto.=" crypto/pem/pem.h";
254#$crypto.=" crypto/meth/meth.h";
255$crypto.=" crypto/asn1/asn1.h";
256$crypto.=" crypto/asn1/asn1t.h";
257$crypto.=" crypto/asn1/asn1_mac.h";
258$crypto.=" crypto/err/err.h" ; # unless $no_err;
259$crypto.=" crypto/pkcs7/pkcs7.h";
260$crypto.=" crypto/pkcs12/pkcs12.h";
261$crypto.=" crypto/x509/x509.h";
262$crypto.=" crypto/x509/x509_vfy.h";
263$crypto.=" crypto/x509v3/x509v3.h";
264$crypto.=" crypto/rand/rand.h";
265$crypto.=" crypto/comp/comp.h" ; # unless $no_comp;
266$crypto.=" crypto/ocsp/ocsp.h";
267$crypto.=" crypto/ui/ui.h crypto/ui/ui_compat.h";
268$crypto.=" crypto/krb5/krb5_asn.h";
269$crypto.=" crypto/tmdiff.h";
270$crypto.=" fips/fips.h fips/rand/fips_rand.h";
271
272my $symhacks="crypto/symhacks.h";
273
274my @ssl_symbols = &do_defs("SSLEAY", $ssl, $symhacks);
275my @crypto_symbols = &do_defs("LIBEAY", $crypto, $symhacks);
276
277if ($do_update) {
278
279if ($do_ssl == 1) {
280
281 &maybe_add_info("SSLEAY",*ssl_list,@ssl_symbols);
282 if ($do_rewrite == 1) {
283 open(OUT, ">$ssl_num");
284 &rewrite_numbers(*OUT,"SSLEAY",*ssl_list,@ssl_symbols);
285 } else {
286 open(OUT, ">>$ssl_num");
287 }
288 &update_numbers(*OUT,"SSLEAY",*ssl_list,$max_ssl,@ssl_symbols);
289 close OUT;
290}
291
292if($do_crypto == 1) {
293
294 &maybe_add_info("LIBEAY",*crypto_list,@crypto_symbols);
295 if ($do_rewrite == 1) {
296 open(OUT, ">$crypto_num");
297 &rewrite_numbers(*OUT,"LIBEAY",*crypto_list,@crypto_symbols);
298 } else {
299 open(OUT, ">>$crypto_num");
300 }
301 &update_numbers(*OUT,"LIBEAY",*crypto_list,$max_crypto,@crypto_symbols);
302 close OUT;
303}
304
305} elsif ($do_checkexist) {
306 &check_existing(*ssl_list, @ssl_symbols)
307 if $do_ssl == 1;
308 &check_existing(*crypto_list, @crypto_symbols)
309 if $do_crypto == 1;
310} elsif ($do_ctest || $do_ctestall) {
311
312 print <<"EOF";
313
314/* Test file to check all DEF file symbols are present by trying
315 * to link to all of them. This is *not* intended to be run!
316 */
317
318int main()
319{
320EOF
321 &print_test_file(*STDOUT,"SSLEAY",*ssl_list,$do_ctestall,@ssl_symbols)
322 if $do_ssl == 1;
323
324 &print_test_file(*STDOUT,"LIBEAY",*crypto_list,$do_ctestall,@crypto_symbols)
325 if $do_crypto == 1;
326
327 print "}\n";
328
329} else {
330
331 &print_def_file(*STDOUT,$libname,*ssl_list,@ssl_symbols)
332 if $do_ssl == 1;
333
334 &print_def_file(*STDOUT,$libname,*crypto_list,@crypto_symbols)
335 if $do_crypto == 1;
336
337}
338
339
340sub do_defs
341{
342 my($name,$files,$symhacksfile)=@_;
343 my $file;
344 my @ret;
345 my %syms;
346 my %platform; # For anything undefined, we assume ""
347 my %kind; # For anything undefined, we assume "FUNCTION"
348 my %algorithm; # For anything undefined, we assume ""
349 my %variant;
350 my %variant_cnt; # To be able to allocate "name{n}" if "name"
351 # is the same name as the original.
352 my $cpp;
353 my %unknown_algorithms = ();
354
355 foreach $file (split(/\s+/,$symhacksfile." ".$files))
356 {
357 print STDERR "DEBUG: starting on $file:\n" if $debug;
358 open(IN,"<$file") || die "unable to open $file:$!\n";
359 my $line = "", my $def= "";
360 my %tag = (
361 (map { $_ => 0 } @known_platforms),
362 (map { "OPENSSL_SYS_".$_ => 0 } @known_ossl_platforms),
363 (map { "OPENSSL_NO_".$_ => 0 } @known_algorithms),
364 NOPROTO => 0,
365 PERL5 => 0,
366 _WINDLL => 0,
367 CONST_STRICT => 0,
368 TRUE => 1,
369 );
370 my $symhacking = $file eq $symhacksfile;
371 my @current_platforms = ();
372 my @current_algorithms = ();
373
374 # params: symbol, alias, platforms, kind
375 # The reason to put this subroutine in a variable is that
376 # it will otherwise create it's own, unshared, version of
377 # %tag and %variant...
378 my $make_variant = sub
379 {
380 my ($s, $a, $p, $k) = @_;
381 my ($a1, $a2);
382
383 print STDERR "DEBUG: make_variant: Entered with ",$s,", ",$a,", ",(defined($p)?$p:""),", ",(defined($k)?$k:""),"\n" if $debug;
384 if (defined($p))
385 {
386 $a1 = join(",",$p,
387 grep(!/^$/,
388 map { $tag{$_} == 1 ? $_ : "" }
389 @known_platforms));
390 }
391 else
392 {
393 $a1 = join(",",
394 grep(!/^$/,
395 map { $tag{$_} == 1 ? $_ : "" }
396 @known_platforms));
397 }
398 $a2 = join(",",
399 grep(!/^$/,
400 map { $tag{"OPENSSL_SYS_".$_} == 1 ? $_ : "" }
401 @known_ossl_platforms));
402 print STDERR "DEBUG: make_variant: a1 = $a1; a2 = $a2\n" if $debug;
403 if ($a1 eq "") { $a1 = $a2; }
404 elsif ($a1 ne "" && $a2 ne "") { $a1 .= ",".$a2; }
405 if ($a eq $s)
406 {
407 if (!defined($variant_cnt{$s}))
408 {
409 $variant_cnt{$s} = 0;
410 }
411 $variant_cnt{$s}++;
412 $a .= "{$variant_cnt{$s}}";
413 }
414 my $toadd = $a.":".$a1.(defined($k)?":".$k:"");
415 my $togrep = $s.'(\{[0-9]+\})?:'.$a1.(defined($k)?":".$k:"");
416 if (!grep(/^$togrep$/,
417 split(/;/, defined($variant{$s})?$variant{$s}:""))) {
418 if (defined($variant{$s})) { $variant{$s} .= ";"; }
419 $variant{$s} .= $toadd;
420 }
421 print STDERR "DEBUG: make_variant: Exit with variant of ",$s," = ",$variant{$s},"\n" if $debug;
422 };
423
424 print STDERR "DEBUG: parsing ----------\n" if $debug;
425 while(<IN>) {
426 last if (/\/\* Error codes for the \w+ functions\. \*\//);
427 if ($line ne '') {
428 $_ = $line . $_;
429 $line = '';
430 }
431
432 if (/\\$/) {
433 chomp; # remove eol
434 chop; # remove ending backslash
435 $line = $_;
436 next;
437 }
438
439 $cpp = 1 if /^\#.*ifdef.*cplusplus/;
440 if ($cpp) {
441 $cpp = 0 if /^\#.*endif/;
442 next;
443 }
444
445 s/\/\*.*?\*\///gs; # ignore comments
446 if (/\/\*/) { # if we have part
447 $line = $_; # of a comment,
448 next; # continue reading
449 }
450 s/{[^{}]*}//gs; # ignore {} blocks
451 print STDERR "DEBUG: \$def=\"$def\"\n" if $debug && $def ne "";
452 print STDERR "DEBUG: \$_=\"$_\"\n" if $debug;
453 if (/^\#\s*ifndef\s+(.*)/) {
454 push(@tag,"-");
455 push(@tag,$1);
456 $tag{$1}=-1;
457 print STDERR "DEBUG: $file: found tag $1 = -1\n" if $debug;
458 } elsif (/^\#\s*if\s+!defined\(([^\)]+)\)/) {
459 push(@tag,"-");
460 if (/^\#\s*if\s+(!defined\(([^\)]+)\)(\s+\&\&\s+!defined\(([^\)]+)\))*)$/) {
461 my $tmp_1 = $1;
462 my $tmp_;
463 foreach $tmp_ (split '\&\&',$tmp_1) {
464 $tmp_ =~ /!defined\(([^\)]+)\)/;
465 print STDERR "DEBUG: $file: found tag $1 = -1\n" if $debug;
466 push(@tag,$1);
467 $tag{$1}=-1;
468 }
469 } else {
470 print STDERR "Warning: $file: complicated expression: $_" if $debug; # because it is O...
471 print STDERR "DEBUG: $file: found tag $1 = -1\n" if $debug;
472 push(@tag,$1);
473 $tag{$1}=-1;
474 }
475 } elsif (/^\#\s*ifdef\s+(\S*)/) {
476 push(@tag,"-");
477 push(@tag,$1);
478 $tag{$1}=1;
479 print STDERR "DEBUG: $file: found tag $1 = 1\n" if $debug;
480 } elsif (/^\#\s*if\s+defined\(([^\)]+)\)/) {
481 push(@tag,"-");
482 if (/^\#\s*if\s+(defined\(([^\)]+)\)(\s+\|\|\s+defined\(([^\)]+)\))*)$/) {
483 my $tmp_1 = $1;
484 my $tmp_;
485 foreach $tmp_ (split '\|\|',$tmp_1) {
486 $tmp_ =~ /defined\(([^\)]+)\)/;
487 print STDERR "DEBUG: $file: found tag $1 = 1\n" if $debug;
488 push(@tag,$1);
489 $tag{$1}=1;
490 }
491 } else {
492 print STDERR "Warning: $file: complicated expression: $_\n" if $debug; # because it is O...
493 print STDERR "DEBUG: $file: found tag $1 = 1\n" if $debug;
494 push(@tag,$1);
495 $tag{$1}=1;
496 }
497 } elsif (/^\#\s*error\s+(\w+) is disabled\./) {
498 my $tag_i = $#tag;
499 while($tag[$tag_i] ne "-") {
500 if ($tag[$tag_i] eq "OPENSSL_NO_".$1) {
501 $tag{$tag[$tag_i]}=2;
502 print STDERR "DEBUG: $file: chaged tag $1 = 2\n" if $debug;
503 }
504 $tag_i--;
505 }
506 } elsif (/^\#\s*endif/) {
507 my $tag_i = $#tag;
508 while($tag[$tag_i] ne "-") {
509 my $t=$tag[$tag_i];
510 print STDERR "DEBUG: \$t=\"$t\"\n" if $debug;
511 if ($tag{$t}==2) {
512 $tag{$t}=-1;
513 } else {
514 $tag{$t}=0;
515 }
516 print STDERR "DEBUG: $file: changed tag ",$t," = ",$tag{$t},"\n" if $debug;
517 pop(@tag);
518 if ($t =~ /^OPENSSL_NO_([A-Z0-9_]+)$/) {
519 $t=$1;
520 } else {
521 $t="";
522 }
523 if ($t ne ""
524 && !grep(/^$t$/, @known_algorithms)) {
525 $unknown_algorithms{$t} = 1;
526 #print STDERR "DEBUG: Added as unknown algorithm: $t\n" if $debug;
527 }
528 $tag_i--;
529 }
530 pop(@tag);
531 } elsif (/^\#\s*else/) {
532 my $tag_i = $#tag;
533 while($tag[$tag_i] ne "-") {
534 my $t=$tag[$tag_i];
535 $tag{$t}= -$tag{$t};
536 print STDERR "DEBUG: $file: changed tag ",$t," = ",$tag{$t},"\n" if $debug;
537 $tag_i--;
538 }
539 } elsif (/^\#\s*if\s+1/) {
540 push(@tag,"-");
541 # Dummy tag
542 push(@tag,"TRUE");
543 $tag{"TRUE"}=1;
544 print STDERR "DEBUG: $file: found 1\n" if $debug;
545 } elsif (/^\#\s*if\s+0/) {
546 push(@tag,"-");
547 # Dummy tag
548 push(@tag,"TRUE");
549 $tag{"TRUE"}=-1;
550 print STDERR "DEBUG: $file: found 0\n" if $debug;
551 } elsif (/^\#\s*define\s+(\w+)\s+(\w+)/
552 && $symhacking && $tag{'TRUE'} != -1) {
553 # This is for aliasing. When we find an alias,
554 # we have to invert
555 &$make_variant($1,$2);
556 print STDERR "DEBUG: $file: defined $1 = $2\n" if $debug;
557 }
558 if (/^\#/) {
559 @current_platforms =
560 grep(!/^$/,
561 map { $tag{$_} == 1 ? $_ :
562 $tag{$_} == -1 ? "!".$_ : "" }
563 @known_platforms);
564 push @current_platforms
565 , grep(!/^$/,
566 map { $tag{"OPENSSL_SYS_".$_} == 1 ? $_ :
567 $tag{"OPENSSL_SYS_".$_} == -1 ? "!".$_ : "" }
568 @known_ossl_platforms);
569 @current_algorithms =
570 grep(!/^$/,
571 map { $tag{"OPENSSL_NO_".$_} == -1 ? $_ : "" }
572 @known_algorithms);
573 $def .=
574 "#INFO:"
575 .join(',',@current_platforms).":"
576 .join(',',@current_algorithms).";";
577 next;
578 }
579 if ($tag{'TRUE'} != -1) {
580 if (/^\s*DECLARE_STACK_OF\s*\(\s*(\w*)\s*\)/) {
581 next;
582 } elsif (/^\s*DECLARE_ASN1_ENCODE_FUNCTIONS\s*\(\s*(\w*)\s*,\s*(\w*)\s*,\s*(\w*)\s*\)/) {
583 $def .= "int d2i_$3(void);";
584 $def .= "int i2d_$3(void);";
585 # Variant for platforms that do not
586 # have to access globale variables
587 # in shared libraries through functions
588 $def .=
589 "#INFO:"
590 .join(',',"!EXPORT_VAR_AS_FUNCTION",@current_platforms).":"
591 .join(',',@current_algorithms).";";
592 $def .= "OPENSSL_EXTERN int $2_it;";
593 $def .=
594 "#INFO:"
595 .join(',',@current_platforms).":"
596 .join(',',@current_algorithms).";";
597 # Variant for platforms that have to
598 # access globale variables in shared
599 # libraries through functions
600 &$make_variant("$2_it","$2_it",
601 "EXPORT_VAR_AS_FUNCTION",
602 "FUNCTION");
603 next;
604 } elsif (/^\s*DECLARE_ASN1_FUNCTIONS_fname\s*\(\s*(\w*)\s*,\s*(\w*)\s*,\s*(\w*)\s*\)/) {
605 $def .= "int d2i_$3(void);";
606 $def .= "int i2d_$3(void);";
607 $def .= "int $3_free(void);";
608 $def .= "int $3_new(void);";
609 # Variant for platforms that do not
610 # have to access globale variables
611 # in shared libraries through functions
612 $def .=
613 "#INFO:"
614 .join(',',"!EXPORT_VAR_AS_FUNCTION",@current_platforms).":"
615 .join(',',@current_algorithms).";";
616 $def .= "OPENSSL_EXTERN int $2_it;";
617 $def .=
618 "#INFO:"
619 .join(',',@current_platforms).":"
620 .join(',',@current_algorithms).";";
621 # Variant for platforms that have to
622 # access globale variables in shared
623 # libraries through functions
624 &$make_variant("$2_it","$2_it",
625 "EXPORT_VAR_AS_FUNCTION",
626 "FUNCTION");
627 next;
628 } elsif (/^\s*DECLARE_ASN1_FUNCTIONS\s*\(\s*(\w*)\s*\)/ ||
629 /^\s*DECLARE_ASN1_FUNCTIONS_const\s*\(\s*(\w*)\s*\)/) {
630 $def .= "int d2i_$1(void);";
631 $def .= "int i2d_$1(void);";
632 $def .= "int $1_free(void);";
633 $def .= "int $1_new(void);";
634 # Variant for platforms that do not
635 # have to access globale variables
636 # in shared libraries through functions
637 $def .=
638 "#INFO:"
639 .join(',',"!EXPORT_VAR_AS_FUNCTION",@current_platforms).":"
640 .join(',',@current_algorithms).";";
641 $def .= "OPENSSL_EXTERN int $1_it;";
642 $def .=
643 "#INFO:"
644 .join(',',@current_platforms).":"
645 .join(',',@current_algorithms).";";
646 # Variant for platforms that have to
647 # access globale variables in shared
648 # libraries through functions
649 &$make_variant("$1_it","$1_it",
650 "EXPORT_VAR_AS_FUNCTION",
651 "FUNCTION");
652 next;
653 } elsif (/^\s*DECLARE_ASN1_ENCODE_FUNCTIONS_const\s*\(\s*(\w*)\s*,\s*(\w*)\s*\)/) {
654 $def .= "int d2i_$2(void);";
655 $def .= "int i2d_$2(void);";
656 # Variant for platforms that do not
657 # have to access globale variables
658 # in shared libraries through functions
659 $def .=
660 "#INFO:"
661 .join(',',"!EXPORT_VAR_AS_FUNCTION",@current_platforms).":"
662 .join(',',@current_algorithms).";";
663 $def .= "OPENSSL_EXTERN int $2_it;";
664 $def .=
665 "#INFO:"
666 .join(',',@current_platforms).":"
667 .join(',',@current_algorithms).";";
668 # Variant for platforms that have to
669 # access globale variables in shared
670 # libraries through functions
671 &$make_variant("$2_it","$2_it",
672 "EXPORT_VAR_AS_FUNCTION",
673 "FUNCTION");
674 next;
675 } elsif (/^\s*DECLARE_ASN1_FUNCTIONS_name\s*\(\s*(\w*)\s*,\s*(\w*)\s*\)/) {
676 $def .= "int d2i_$2(void);";
677 $def .= "int i2d_$2(void);";
678 $def .= "int $2_free(void);";
679 $def .= "int $2_new(void);";
680 # Variant for platforms that do not
681 # have to access globale variables
682 # in shared libraries through functions
683 $def .=
684 "#INFO:"
685 .join(',',"!EXPORT_VAR_AS_FUNCTION",@current_platforms).":"
686 .join(',',@current_algorithms).";";
687 $def .= "OPENSSL_EXTERN int $2_it;";
688 $def .=
689 "#INFO:"
690 .join(',',@current_platforms).":"
691 .join(',',@current_algorithms).";";
692 # Variant for platforms that have to
693 # access globale variables in shared
694 # libraries through functions
695 &$make_variant("$2_it","$2_it",
696 "EXPORT_VAR_AS_FUNCTION",
697 "FUNCTION");
698 next;
699 } elsif (/^\s*DECLARE_ASN1_ITEM\s*\(\s*(\w*)\s*\)/) {
700 # Variant for platforms that do not
701 # have to access globale variables
702 # in shared libraries through functions
703 $def .=
704 "#INFO:"
705 .join(',',"!EXPORT_VAR_AS_FUNCTION",@current_platforms).":"
706 .join(',',@current_algorithms).";";
707 $def .= "OPENSSL_EXTERN int $1_it;";
708 $def .=
709 "#INFO:"
710 .join(',',@current_platforms).":"
711 .join(',',@current_algorithms).";";
712 # Variant for platforms that have to
713 # access globale variables in shared
714 # libraries through functions
715 &$make_variant("$1_it","$1_it",
716 "EXPORT_VAR_AS_FUNCTION",
717 "FUNCTION");
718 next;
719 } elsif (/^\s*DECLARE_ASN1_SET_OF\s*\(\s*(\w*)\s*\)/) {
720 next;
721 } elsif (/^\s*DECLARE_PKCS12_STACK_OF\s*\(\s*(\w*)\s*\)/) {
722 next;
723 } elsif (/^DECLARE_PEM_rw\s*\(\s*(\w*)\s*,/ ||
724 /^DECLARE_PEM_rw_cb\s*\(\s*(\w*)\s*,/ ) {
725 # Things not in Win16
726 $def .=
727 "#INFO:"
728 .join(',',"!WIN16",@current_platforms).":"
729 .join(',',@current_algorithms).";";
730 $def .= "int PEM_read_$1(void);";
731 $def .= "int PEM_write_$1(void);";
732 $def .=
733 "#INFO:"
734 .join(',',@current_platforms).":"
735 .join(',',@current_algorithms).";";
736 # Things that are everywhere
737 $def .= "int PEM_read_bio_$1(void);";
738 $def .= "int PEM_write_bio_$1(void);";
739 next;
740 } elsif (/^DECLARE_PEM_write\s*\(\s*(\w*)\s*,/ ||
741 /^DECLARE_PEM_write_cb\s*\(\s*(\w*)\s*,/ ) {
742 # Things not in Win16
743 $def .=
744 "#INFO:"
745 .join(',',"!WIN16",@current_platforms).":"
746 .join(',',@current_algorithms).";";
747 $def .= "int PEM_write_$1(void);";
748 $def .=
749 "#INFO:"
750 .join(',',@current_platforms).":"
751 .join(',',@current_algorithms).";";
752 # Things that are everywhere
753 $def .= "int PEM_write_bio_$1(void);";
754 next;
755 } elsif (/^DECLARE_PEM_read\s*\(\s*(\w*)\s*,/ ||
756 /^DECLARE_PEM_read_cb\s*\(\s*(\w*)\s*,/ ) {
757 # Things not in Win16
758 $def .=
759 "#INFO:"
760 .join(',',"!WIN16",@current_platforms).":"
761 .join(',',@current_algorithms).";";
762 $def .= "int PEM_read_$1(void);";
763 $def .=
764 "#INFO:"
765 .join(',',@current_platforms).":"
766 .join(',',@current_algorithms).";";
767 # Things that are everywhere
768 $def .= "int PEM_read_bio_$1(void);";
769 next;
770 } elsif (/^OPENSSL_DECLARE_GLOBAL\s*\(\s*(\w*)\s*,\s*(\w*)\s*\)/) {
771 # Variant for platforms that do not
772 # have to access globale variables
773 # in shared libraries through functions
774 $def .=
775 "#INFO:"
776 .join(',',"!EXPORT_VAR_AS_FUNCTION",@current_platforms).":"
777 .join(',',@current_algorithms).";";
778 $def .= "OPENSSL_EXTERN int _shadow_$2;";
779 $def .=
780 "#INFO:"
781 .join(',',@current_platforms).":"
782 .join(',',@current_algorithms).";";
783 # Variant for platforms that have to
784 # access globale variables in shared
785 # libraries through functions
786 &$make_variant("_shadow_$2","_shadow_$2",
787 "EXPORT_VAR_AS_FUNCTION",
788 "FUNCTION");
789 } elsif ($tag{'CONST_STRICT'} != 1) {
790 if (/\{|\/\*|\([^\)]*$/) {
791 $line = $_;
792 } else {
793 $def .= $_;
794 }
795 }
796 }
797 }
798 close(IN);
799
800 my $algs = '';
801 my $plays;
802
803 print STDERR "DEBUG: postprocessing ----------\n" if $debug;
804 foreach (split /;/, $def) {
805 my $s; my $k = "FUNCTION"; my $p; my $a;
806 s/^[\n\s]*//g;
807 s/[\n\s]*$//g;
808 next if(/\#undef/);
809 next if(/typedef\W/);
810 next if(/\#define/);
811
812 print STDERR "DEBUG: \$_ = \"$_\"\n" if $debug;
813 if (/^\#INFO:([^:]*):(.*)$/) {
814 $plats = $1;
815 $algs = $2;
816 print STDERR "DEBUG: found info on platforms ($plats) and algorithms ($algs)\n" if $debug;
817 next;
818 } elsif (/^\s*OPENSSL_EXTERN\s.*?(\w+(\{[0-9]+\})?)(\[[0-9]*\])*\s*$/) {
819 $s = $1;
820 $k = "VARIABLE";
821 print STDERR "DEBUG: found external variable $s\n" if $debug;
822 } elsif (/\(\*(\w*(\{[0-9]+\})?)\([^\)]+/) {
823 $s = $1;
824 print STDERR "DEBUG: found ANSI C function $s\n" if $debug;
825 } elsif (/\w+\W+(\w+)\W*\(\s*\)(\s*__attribute__\(.*\)\s*)?$/s) {
826 # K&R C
827 print STDERR "DEBUG: found K&R C function $s\n" if $debug;
828 next;
829 } elsif (/\w+\W+\w+(\{[0-9]+\})?\W*\(.*\)(\s*__attribute__\(.*\)\s*)?$/s) {
830 while (not /\(\)(\s*__attribute__\(.*\)\s*)?$/s) {
831 s/[^\(\)]*\)(\s*__attribute__\(.*\)\s*)?$/\)/s;
832 s/\([^\(\)]*\)\)(\s*__attribute__\(.*\)\s*)?$/\)/s;
833 }
834 s/\(void\)//;
835 /(\w+(\{[0-9]+\})?)\W*\(\)/s;
836 $s = $1;
837 print STDERR "DEBUG: found function $s\n" if $debug;
838 } elsif (/\(/ and not (/=/)) {
839 print STDERR "File $file: cannot parse: $_;\n";
840 next;
841 } else {
842 next;
843 }
844
845 $syms{$s} = 1;
846 $kind{$s} = $k;
847
848 $p = $plats;
849 $a = $algs;
850 $a .= ",BF" if($s =~ /EVP_bf/);
851 $a .= ",CAST" if($s =~ /EVP_cast/);
852 $a .= ",DES" if($s =~ /EVP_des/);
853 $a .= ",DSA" if($s =~ /EVP_dss/);
854 $a .= ",IDEA" if($s =~ /EVP_idea/);
855 $a .= ",MD2" if($s =~ /EVP_md2/);
856 $a .= ",MD4" if($s =~ /EVP_md4/);
857 $a .= ",MD5" if($s =~ /EVP_md5/);
858 $a .= ",RC2" if($s =~ /EVP_rc2/);
859 $a .= ",RC4" if($s =~ /EVP_rc4/);
860 $a .= ",RC5" if($s =~ /EVP_rc5/);
861 $a .= ",RIPEMD" if($s =~ /EVP_ripemd/);
862 $a .= ",SHA" if($s =~ /EVP_sha/);
863 $a .= ",RSA" if($s =~ /EVP_(Open|Seal)(Final|Init)/);
864 $a .= ",RSA" if($s =~ /PEM_Seal(Final|Init|Update)/);
865 $a .= ",RSA" if($s =~ /RSAPrivateKey/);
866 $a .= ",RSA" if($s =~ /SSLv23?_((client|server)_)?method/);
867
868 $platform{$s} =
869 &reduce_platforms((defined($platform{$s})?$platform{$s}.',':"").$p);
870 $algorithm{$s} = '' if !defined $algorithm{$s};
871 $algorithm{$s} .= ','.$a;
872
873 if (defined($variant{$s})) {
874 foreach $v (split /;/,$variant{$s}) {
875 (my $r, my $p, my $k) = split(/:/,$v);
876 my $ip = join ',',map({ /^!(.*)$/ ? $1 : "!".$_ } split /,/, $p);
877 $syms{$r} = 1;
878 if (!defined($k)) { $k = $kind{$s}; }
879 $kind{$r} = $k."(".$s.")";
880 $algorithm{$r} = $algorithm{$s};
881 $platform{$r} = &reduce_platforms($platform{$s}.",".$p.",".$p);
882 $platform{$s} = &reduce_platforms($platform{$s}.','.$ip.','.$ip);
883 print STDERR "DEBUG: \$variant{\"$s\"} = ",$v,"; \$r = $r; \$p = ",$platform{$r},"; \$a = ",$algorithm{$r},"; \$kind = ",$kind{$r},"\n" if $debug;
884 }
885 }
886 print STDERR "DEBUG: \$s = $s; \$p = ",$platform{$s},"; \$a = ",$algorithm{$s},"; \$kind = ",$kind{$s},"\n" if $debug;
887 }
888 }
889
890 # Prune the returned symbols
891
892 delete $syms{"bn_dump1"};
893 $platform{"BIO_s_log"} .= ",!WIN32,!WIN16,!macintosh";
894
895 $platform{"PEM_read_NS_CERT_SEQ"} = "VMS";
896 $platform{"PEM_write_NS_CERT_SEQ"} = "VMS";
897 $platform{"PEM_read_P8_PRIV_KEY_INFO"} = "VMS";
898 $platform{"PEM_write_P8_PRIV_KEY_INFO"} = "VMS";
899
900 # Info we know about
901
902 push @ret, map { $_."\\".&info_string($_,"EXIST",
903 $platform{$_},
904 $kind{$_},
905 $algorithm{$_}) } keys %syms;
906
907 if (keys %unknown_algorithms) {
908 print STDERR "WARNING: mkdef.pl doesn't know the following algorithms:\n";
909 print STDERR "\t",join("\n\t",keys %unknown_algorithms),"\n";
910 }
911 return(@ret);
912}
913
914# Param: string of comma-separated platform-specs.
915sub reduce_platforms
916{
917 my ($platforms) = @_;
918 my $pl = defined($platforms) ? $platforms : "";
919 my %p = map { $_ => 0 } split /,/, $pl;
920 my $ret;
921
922 print STDERR "DEBUG: Entered reduce_platforms with \"$platforms\"\n"
923 if $debug;
924 # We do this, because if there's code like the following, it really
925 # means the function exists in all cases and should therefore be
926 # everywhere. By increasing and decreasing, we may attain 0:
927 #
928 # ifndef WIN16
929 # int foo();
930 # else
931 # int _fat foo();
932 # endif
933 foreach $platform (split /,/, $pl) {
934 if ($platform =~ /^!(.*)$/) {
935 $p{$1}--;
936 } else {
937 $p{$platform}++;
938 }
939 }
940 foreach $platform (keys %p) {
941 if ($p{$platform} == 0) { delete $p{$platform}; }
942 }
943
944 delete $p{""};
945
946 $ret = join(',',sort(map { $p{$_} < 0 ? "!".$_ : $_ } keys %p));
947 print STDERR "DEBUG: Exiting reduce_platforms with \"$ret\"\n"
948 if $debug;
949 return $ret;
950}
951
952sub info_string {
953 (my $symbol, my $exist, my $platforms, my $kind, my $algorithms) = @_;
954
955 my %a = defined($algorithms) ?
956 map { $_ => 1 } split /,/, $algorithms : ();
957 my $k = defined($kind) ? $kind : "FUNCTION";
958 my $ret;
959 my $p = &reduce_platforms($platforms);
960
961 delete $a{""};
962
963 $ret = $exist;
964 $ret .= ":".$p;
965 $ret .= ":".$k;
966 $ret .= ":".join(',',sort keys %a);
967 return $ret;
968}
969
970sub maybe_add_info {
971 (my $name, *nums, my @symbols) = @_;
972 my $sym;
973 my $new_info = 0;
974 my %syms=();
975
976 print STDERR "Updating $name info\n";
977 foreach $sym (@symbols) {
978 (my $s, my $i) = split /\\/, $sym;
979 if (defined($nums{$s})) {
980 $i =~ s/^(.*?:.*?:\w+)(\(\w+\))?/$1/;
981 (my $n, my $dummy) = split /\\/, $nums{$s};
982 if (!defined($dummy) || $i ne $dummy) {
983 $nums{$s} = $n."\\".$i;
984 $new_info++;
985 print STDERR "DEBUG: maybe_add_info for $s: \"$dummy\" => \"$i\"\n" if $debug;
986 }
987 }
988 $syms{$s} = 1;
989 }
990
991 my @s=sort { &parse_number($nums{$a},"n") <=> &parse_number($nums{$b},"n") } keys %nums;
992 foreach $sym (@s) {
993 (my $n, my $i) = split /\\/, $nums{$sym};
994 if (!defined($syms{$sym}) && $i !~ /^NOEXIST:/) {
995 $new_info++;
996 print STDERR "DEBUG: maybe_add_info for $sym: -> undefined\n" if $debug;
997 }
998 }
999 if ($new_info) {
1000 print STDERR "$new_info old symbols got an info update\n";
1001 if (!$do_rewrite) {
1002 print STDERR "You should do a rewrite to fix this.\n";
1003 }
1004 } else {
1005 print STDERR "No old symbols needed info update\n";
1006 }
1007}
1008
1009# Param: string of comma-separated keywords, each possibly prefixed with a "!"
1010sub is_valid
1011{
1012 my ($keywords_txt,$platforms) = @_;
1013 my (@keywords) = split /,/,$keywords_txt;
1014 my ($falsesum, $truesum) = (0, !grep(/^[^!]/,@keywords));
1015
1016 # Param: one keyword
1017 sub recognise
1018 {
1019 my ($keyword,$platforms) = @_;
1020
1021 if ($platforms) {
1022 # platforms
1023 if ($keyword eq "VMS" && $VMS) { return 1; }
1024 if ($keyword eq "WIN32" && $W32) { return 1; }
1025 if ($keyword eq "WIN16" && $W16) { return 1; }
1026 if ($keyword eq "WINNT" && $NT) { return 1; }
1027 if ($keyword eq "OS2" && $OS2) { return 1; }
1028 # Special platforms:
1029 # EXPORT_VAR_AS_FUNCTION means that global variables
1030 # will be represented as functions. This currently
1031 # only happens on VMS-VAX.
1032 if ($keyword eq "EXPORT_VAR_AS_FUNCTION" && ($VMSVAX || $W32 || $W16)) {
1033 return 1;
1034 }
1035 if ($keyword eq "OPENSSL_FIPS" && $fips) {
1036 return 1;
1037 }
1038 return 0;
1039 } else {
1040 # algorithms
1041 if ($keyword eq "RC2" && $no_rc2) { return 0; }
1042 if ($keyword eq "RC4" && $no_rc4) { return 0; }
1043 if ($keyword eq "RC5" && $no_rc5) { return 0; }
1044 if ($keyword eq "IDEA" && $no_idea) { return 0; }
1045 if ($keyword eq "DES" && $no_des) { return 0; }
1046 if ($keyword eq "BF" && $no_bf) { return 0; }
1047 if ($keyword eq "CAST" && $no_cast) { return 0; }
1048 if ($keyword eq "MD2" && $no_md2) { return 0; }
1049 if ($keyword eq "MD4" && $no_md4) { return 0; }
1050 if ($keyword eq "MD5" && $no_md5) { return 0; }
1051 if ($keyword eq "SHA" && $no_sha) { return 0; }
1052 if ($keyword eq "RIPEMD" && $no_ripemd) { return 0; }
1053 if ($keyword eq "MDC2" && $no_mdc2) { return 0; }
1054 if ($keyword eq "RSA" && $no_rsa) { return 0; }
1055 if ($keyword eq "DSA" && $no_dsa) { return 0; }
1056 if ($keyword eq "DH" && $no_dh) { return 0; }
1057 if ($keyword eq "EC" && $no_ec) { return 0; }
1058 if ($keyword eq "HMAC" && $no_hmac) { return 0; }
1059 if ($keyword eq "AES" && $no_aes) { return 0; }
1060 if ($keyword eq "EVP" && $no_evp) { return 0; }
1061 if ($keyword eq "LHASH" && $no_lhash) { return 0; }
1062 if ($keyword eq "STACK" && $no_stack) { return 0; }
1063 if ($keyword eq "ERR" && $no_err) { return 0; }
1064 if ($keyword eq "BUFFER" && $no_buffer) { return 0; }
1065 if ($keyword eq "BIO" && $no_bio) { return 0; }
1066 if ($keyword eq "COMP" && $no_comp) { return 0; }
1067 if ($keyword eq "DSO" && $no_dso) { return 0; }
1068 if ($keyword eq "KRB5" && $no_krb5) { return 0; }
1069 if ($keyword eq "ENGINE" && $no_engine) { return 0; }
1070 if ($keyword eq "HW" && $no_hw) { return 0; }
1071 if ($keyword eq "FP_API" && $no_fp_api) { return 0; }
1072
1073 # Nothing recognise as true
1074 return 1;
1075 }
1076 }
1077
1078 foreach $k (@keywords) {
1079 if ($k =~ /^!(.*)$/) {
1080 $falsesum += &recognise($1,$platforms);
1081 } else {
1082 $truesum += &recognise($k,$platforms);
1083 }
1084 }
1085 print STDERR "DEBUG: [",$#keywords,",",$#keywords < 0,"] is_valid($keywords_txt) => (\!$falsesum) && $truesum = ",(!$falsesum) && $truesum,"\n" if $debug;
1086 return (!$falsesum) && $truesum;
1087}
1088
1089sub print_test_file
1090{
1091 (*OUT,my $name,*nums,my $testall,my @symbols)=@_;
1092 my $n = 1; my @e; my @r;
1093 my $sym; my $prev = ""; my $prefSSLeay;
1094
1095 (@e)=grep(/^SSLeay(\{[0-9]+\})?\\.*?:.*?:.*/,@symbols);
1096 (@r)=grep(/^\w+(\{[0-9]+\})?\\.*?:.*?:.*/ && !/^SSLeay(\{[0-9]+\})?\\.*?:.*?:.*/,@symbols);
1097 @symbols=((sort @e),(sort @r));
1098
1099 foreach $sym (@symbols) {
1100 (my $s, my $i) = $sym =~ /^(.*?)\\(.*)$/;
1101 my $v = 0;
1102 $v = 1 if $i=~ /^.*?:.*?:VARIABLE/;
1103 my $p = ($i =~ /^[^:]*:([^:]*):/,$1);
1104 my $a = ($i =~ /^[^:]*:[^:]*:[^:]*:([^:]*)/,$1);
1105 if (!defined($nums{$s})) {
1106 print STDERR "Warning: $s does not have a number assigned\n"
1107 if(!$do_update);
1108 } elsif (is_valid($p,1) && is_valid($a,0)) {
1109 my $s2 = ($s =~ /^(.*?)(\{[0-9]+\})?$/, $1);
1110 if ($prev eq $s2) {
1111 print OUT "\t/* The following has already appeared previously */\n";
1112 print STDERR "Warning: Symbol '",$s2,"' redefined. old=",($nums{$prev} =~ /^(.*?)\\/,$1),", new=",($nums{$s2} =~ /^(.*?)\\/,$1),"\n";
1113 }
1114 $prev = $s2; # To warn about duplicates...
1115
1116 ($nn,$ni)=($nums{$s2} =~ /^(.*?)\\(.*)$/);
1117 if ($v) {
1118 print OUT "\textern int $s2; /* type unknown */ /* $nn $ni */\n";
1119 } else {
1120 print OUT "\textern int $s2(); /* type unknown */ /* $nn $ni */\n";
1121 }
1122 }
1123 }
1124}
1125
1126sub get_version {
1127 local *MF;
1128 my $v = '?';
1129 open MF, 'Makefile' or return $v;
1130 while (<MF>) {
1131 $v = $1, last if /^VERSION=(.*?)\s*$/;
1132 }
1133 close MF;
1134 return $v;
1135}
1136
1137sub print_def_file
1138{
1139 (*OUT,my $name,*nums,my @symbols)=@_;
1140 my $n = 1; my @e; my @r; my @v; my $prev="";
1141 my $liboptions="";
1142 my $libname = $name;
1143 my $http_vendor = 'www.openssl.org/';
1144 my $version = get_version();
1145 my $what = "OpenSSL: implementation of Secure Socket Layer";
1146 my $description = "$what $version, $name - http://$http_vendor";
1147
1148 if ($W32)
1149 { $libname.="32"; }
1150 elsif ($W16)
1151 { $libname.="16"; }
1152 elsif ($OS2)
1153 { # DLL names should not clash on the whole system.
1154 # However, they should not have any particular relationship
1155 # to the name of the static library. Chose descriptive names
1156 # (must be at most 8 chars).
1157 my %translate = (ssl => 'open_ssl', crypto => 'cryptssl');
1158 $libname = $translate{$name} || $name;
1159 $liboptions = <<EOO;
1160INITINSTANCE
1161DATA MULTIPLE NONSHARED
1162EOO
1163 # Vendor field can't contain colon, drat; so we omit http://
1164 $description = "\@#$http_vendor:$version#\@$what; DLL for library $name. Build for EMX -Zmtd";
1165 }
1166
1167 print OUT <<"EOF";
1168;
1169; Definition file for the DLL version of the $name library from OpenSSL
1170;
1171
1172LIBRARY $libname $liboptions
1173
1174DESCRIPTION '$description'
1175
1176EOF
1177
1178 if ($W16) {
1179 print <<"EOF";
1180CODE PRELOAD MOVEABLE
1181DATA PRELOAD MOVEABLE SINGLE
1182
1183EXETYPE WINDOWS
1184
1185HEAPSIZE 4096
1186STACKSIZE 8192
1187
1188EOF
1189 }
1190
1191 print "EXPORTS\n";
1192
1193 (@e)=grep(/^SSLeay(\{[0-9]+\})?\\.*?:.*?:FUNCTION/,@symbols);
1194 (@r)=grep(/^\w+(\{[0-9]+\})?\\.*?:.*?:FUNCTION/ && !/^SSLeay(\{[0-9]+\})?\\.*?:.*?:FUNCTION/,@symbols);
1195 (@v)=grep(/^\w+(\{[0-9]+\})?\\.*?:.*?:VARIABLE/,@symbols);
1196 @symbols=((sort @e),(sort @r), (sort @v));
1197
1198
1199 foreach $sym (@symbols) {
1200 (my $s, my $i) = $sym =~ /^(.*?)\\(.*)$/;
1201 my $v = 0;
1202 $v = 1 if $i =~ /^.*?:.*?:VARIABLE/;
1203 if (!defined($nums{$s})) {
1204 printf STDERR "Warning: $s does not have a number assigned\n"
1205 if(!$do_update);
1206 } else {
1207 (my $n, my $dummy) = split /\\/, $nums{$s};
1208 my %pf = ();
1209 my $p = ($i =~ /^[^:]*:([^:]*):/,$1);
1210 my $a = ($i =~ /^[^:]*:[^:]*:[^:]*:([^:]*)/,$1);
1211 if (is_valid($p,1) && is_valid($a,0)) {
1212 my $s2 = ($s =~ /^(.*?)(\{[0-9]+\})?$/, $1);
1213 if ($prev eq $s2) {
1214 print STDERR "Warning: Symbol '",$s2,"' redefined. old=",($nums{$prev} =~ /^(.*?)\\/,$1),", new=",($nums{$s2} =~ /^(.*?)\\/,$1),"\n";
1215 }
1216 $prev = $s2; # To warn about duplicates...
1217 if($v && !$OS2) {
1218 printf OUT " %s%-39s @%-8d DATA\n",($W32)?"":"_",$s2,$n;
1219 } else {
1220 printf OUT " %s%-39s @%d\n",($W32||$OS2)?"":"_",$s2,$n;
1221 }
1222 }
1223 }
1224 }
1225 printf OUT "\n";
1226}
1227
1228sub load_numbers
1229{
1230 my($name)=@_;
1231 my(@a,%ret);
1232
1233 $max_num = 0;
1234 $num_noinfo = 0;
1235 $prev = "";
1236 $prev_cnt = 0;
1237
1238 open(IN,"<$name") || die "unable to open $name:$!\n";
1239 while (<IN>) {
1240 chop;
1241 s/#.*$//;
1242 next if /^\s*$/;
1243 @a=split;
1244 if (defined $ret{$a[0]}) {
1245 # This is actually perfectly OK
1246 #print STDERR "Warning: Symbol '",$a[0],"' redefined. old=",$ret{$a[0]},", new=",$a[1],"\n";
1247 }
1248 if ($max_num > $a[1]) {
1249 print STDERR "Warning: Number decreased from ",$max_num," to ",$a[1],"\n";
1250 }
1251 elsif ($max_num == $a[1]) {
1252 # This is actually perfectly OK
1253 #print STDERR "Warning: Symbol ",$a[0]," has same number as previous ",$prev,": ",$a[1],"\n";
1254 if ($a[0] eq $prev) {
1255 $prev_cnt++;
1256 $a[0] .= "{$prev_cnt}";
1257 }
1258 }
1259 else {
1260 $prev_cnt = 0;
1261 }
1262 if ($#a < 2) {
1263 # Existence will be proven later, in do_defs
1264 $ret{$a[0]}=$a[1];
1265 $num_noinfo++;
1266 } else {
1267 $ret{$a[0]}=$a[1]."\\".$a[2]; # \\ is a special marker
1268 }
1269 $max_num = $a[1] if $a[1] > $max_num;
1270 $prev=$a[0];
1271 }
1272 if ($num_noinfo) {
1273 print STDERR "Warning: $num_noinfo symbols were without info.";
1274 if ($do_rewrite) {
1275 printf STDERR " The rewrite will fix this.\n";
1276 } else {
1277 printf STDERR " You should do a rewrite to fix this.\n";
1278 }
1279 }
1280 close(IN);
1281 return(%ret);
1282}
1283
1284sub parse_number
1285{
1286 (my $str, my $what) = @_;
1287 (my $n, my $i) = split(/\\/,$str);
1288 if ($what eq "n") {
1289 return $n;
1290 } else {
1291 return $i;
1292 }
1293}
1294
1295sub rewrite_numbers
1296{
1297 (*OUT,$name,*nums,@symbols)=@_;
1298 my $thing;
1299
1300 print STDERR "Rewriting $name\n";
1301
1302 my @r = grep(/^\w+(\{[0-9]+\})?\\.*?:.*?:\w+\(\w+\)/,@symbols);
1303 my $r; my %r; my %rsyms;
1304 foreach $r (@r) {
1305 (my $s, my $i) = split /\\/, $r;
1306 my $a = $1 if $i =~ /^.*?:.*?:\w+\((\w+)\)/;
1307 $i =~ s/^(.*?:.*?:\w+)\(\w+\)/$1/;
1308 $r{$a} = $s."\\".$i;
1309 $rsyms{$s} = 1;
1310 }
1311
1312 my %syms = ();
1313 foreach $_ (@symbols) {
1314 (my $n, my $i) = split /\\/;
1315 $syms{$n} = 1;
1316 }
1317
1318 my @s=sort {
1319 &parse_number($nums{$a},"n") <=> &parse_number($nums{$b},"n")
1320 || $a cmp $b
1321 } keys %nums;
1322 foreach $sym (@s) {
1323 (my $n, my $i) = split /\\/, $nums{$sym};
1324 next if defined($i) && $i =~ /^.*?:.*?:\w+\(\w+\)/;
1325 next if defined($rsyms{$sym});
1326 print STDERR "DEBUG: rewrite_numbers for sym = ",$sym,": i = ",$i,", n = ",$n,", rsym{sym} = ",$rsyms{$sym},"syms{sym} = ",$syms{$sym},"\n" if $debug;
1327 $i="NOEXIST::FUNCTION:"
1328 if !defined($i) || $i eq "" || !defined($syms{$sym});
1329 my $s2 = $sym;
1330 $s2 =~ s/\{[0-9]+\}$//;
1331 printf OUT "%s%-39s %d\t%s\n","",$s2,$n,$i;
1332 if (exists $r{$sym}) {
1333 (my $s, $i) = split /\\/,$r{$sym};
1334 my $s2 = $s;
1335 $s2 =~ s/\{[0-9]+\}$//;
1336 printf OUT "%s%-39s %d\t%s\n","",$s2,$n,$i;
1337 }
1338 }
1339}
1340
1341sub update_numbers
1342{
1343 (*OUT,$name,*nums,my $start_num, my @symbols)=@_;
1344 my $new_syms = 0;
1345
1346 print STDERR "Updating $name numbers\n";
1347
1348 my @r = grep(/^\w+(\{[0-9]+\})?\\.*?:.*?:\w+\(\w+\)/,@symbols);
1349 my $r; my %r; my %rsyms;
1350 foreach $r (@r) {
1351 (my $s, my $i) = split /\\/, $r;
1352 my $a = $1 if $i =~ /^.*?:.*?:\w+\((\w+)\)/;
1353 $i =~ s/^(.*?:.*?:\w+)\(\w+\)/$1/;
1354 $r{$a} = $s."\\".$i;
1355 $rsyms{$s} = 1;
1356 }
1357
1358 foreach $sym (@symbols) {
1359 (my $s, my $i) = $sym =~ /^(.*?)\\(.*)$/;
1360 next if $i =~ /^.*?:.*?:\w+\(\w+\)/;
1361 next if defined($rsyms{$sym});
1362 die "ERROR: Symbol $sym had no info attached to it."
1363 if $i eq "";
1364 if (!exists $nums{$s}) {
1365 $new_syms++;
1366 my $s2 = $s;
1367 $s2 =~ s/\{[0-9]+\}$//;
1368 printf OUT "%s%-39s %d\t%s\n","",$s2, ++$start_num,$i;
1369 if (exists $r{$s}) {
1370 ($s, $i) = split /\\/,$r{$s};
1371 $s =~ s/\{[0-9]+\}$//;
1372 printf OUT "%s%-39s %d\t%s\n","",$s, $start_num,$i;
1373 }
1374 }
1375 }
1376 if($new_syms) {
1377 print STDERR "$new_syms New symbols added\n";
1378 } else {
1379 print STDERR "No New symbols Added\n";
1380 }
1381}
1382
1383sub check_existing
1384{
1385 (*nums, my @symbols)=@_;
1386 my %existing; my @remaining;
1387 @remaining=();
1388 foreach $sym (@symbols) {
1389 (my $s, my $i) = $sym =~ /^(.*?)\\(.*)$/;
1390 $existing{$s}=1;
1391 }
1392 foreach $sym (keys %nums) {
1393 if (!exists $existing{$sym}) {
1394 push @remaining, $sym;
1395 }
1396 }
1397 if(@remaining) {
1398 print STDERR "The following symbols do not seem to exist:\n";
1399 foreach $sym (@remaining) {
1400 print STDERR "\t",$sym,"\n";
1401 }
1402 }
1403}
1404
diff --git a/src/lib/libcrypto/util/mkdir-p.pl b/src/lib/libcrypto/util/mkdir-p.pl
new file mode 100644
index 0000000000..6c69c2daa4
--- /dev/null
+++ b/src/lib/libcrypto/util/mkdir-p.pl
@@ -0,0 +1,33 @@
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 &do_mkdir_p($arg);
12}
13
14
15sub do_mkdir_p {
16 local($dir) = @_;
17
18 $dir =~ s|/*\Z(?!\n)||s;
19
20 if (-d $dir) {
21 return;
22 }
23
24 if ($dir =~ m|[^/]/|s) {
25 local($parent) = $dir;
26 $parent =~ s|[^/]*\Z(?!\n)||s;
27
28 do_mkdir_p($parent);
29 }
30
31 mkdir($dir, 0777) || die "Cannot create directory $dir: $!\n";
32 print "created directory `$dir'\n";
33}
diff --git a/src/lib/libcrypto/util/mkerr.pl b/src/lib/libcrypto/util/mkerr.pl
index 9678514604..60e534807e 100644
--- a/src/lib/libcrypto/util/mkerr.pl
+++ b/src/lib/libcrypto/util/mkerr.pl
@@ -9,9 +9,6 @@ my $reindex = 0;
9my $dowrite = 0; 9my $dowrite = 0;
10my $staticloader = ""; 10my $staticloader = "";
11 11
12my $pack_errcode;
13my $load_errcode;
14
15while (@ARGV) { 12while (@ARGV) {
16 my $arg = $ARGV[0]; 13 my $arg = $ARGV[0];
17 if($arg eq "-conf") { 14 if($arg eq "-conf") {
@@ -44,8 +41,8 @@ while (@ARGV) {
44} 41}
45 42
46if($recurse) { 43if($recurse) {
47 @source = (<crypto/*.c>, <crypto/*/*.c>, <ssl/*.c>, <fips-1.0/*.c>, 44 @source = (<crypto/*.c>, <crypto/*/*.c>, <ssl/*.c>, <fips/*.c>,
48 <fips-1.0/*/*.c>); 45 <fips/*/*.c>);
49} else { 46} else {
50 @source = @ARGV; 47 @source = @ARGV;
51} 48}
@@ -402,20 +399,6 @@ EOF
402 $hincf = "\"$hfile\""; 399 $hincf = "\"$hfile\"";
403 } 400 }
404 401
405 # If static we know the error code at compile time so use it
406 # in error definitions.
407
408 if ($static)
409 {
410 $pack_errcode = "ERR_LIB_${lib}";
411 $load_errcode = "0";
412 }
413 else
414 {
415 $pack_errcode = "0";
416 $load_errcode = "ERR_LIB_${lib}";
417 }
418
419 402
420 open (OUT,">$cfile") || die "Can't open $cfile for writing"; 403 open (OUT,">$cfile") || die "Can't open $cfile for writing";
421 404
@@ -486,10 +469,6 @@ EOF
486 469
487/* BEGIN ERROR CODES */ 470/* BEGIN ERROR CODES */
488#ifndef OPENSSL_NO_ERR 471#ifndef OPENSSL_NO_ERR
489
490#define ERR_FUNC(func) ERR_PACK($pack_errcode,func,0)
491#define ERR_REASON(reason) ERR_PACK($pack_errcode,0,reason)
492
493static ERR_STRING_DATA ${lib}_str_functs[]= 472static ERR_STRING_DATA ${lib}_str_functs[]=
494 { 473 {
495EOF 474EOF
@@ -501,8 +480,7 @@ EOF
501 if(exists $ftrans{$fn}) { 480 if(exists $ftrans{$fn}) {
502 $fn = $ftrans{$fn}; 481 $fn = $ftrans{$fn};
503 } 482 }
504# print OUT "{ERR_PACK($pack_errcode,$i,0),\t\"$fn\"},\n"; 483 print OUT "{ERR_PACK(0,$i,0),\t\"$fn\"},\n";
505 print OUT "{ERR_FUNC($i),\t\"$fn\"},\n";
506 } 484 }
507 print OUT <<"EOF"; 485 print OUT <<"EOF";
508{0,NULL} 486{0,NULL}
@@ -514,7 +492,6 @@ EOF
514 # Add each reason code. 492 # Add each reason code.
515 foreach $i (@reasons) { 493 foreach $i (@reasons) {
516 my $rn; 494 my $rn;
517 my $rstr = "ERR_REASON($i)";
518 my $nspc = 0; 495 my $nspc = 0;
519 if (exists $err_reason_strings{$i}) { 496 if (exists $err_reason_strings{$i}) {
520 $rn = $err_reason_strings{$i}; 497 $rn = $err_reason_strings{$i};
@@ -523,9 +500,9 @@ EOF
523 $rn = $1; 500 $rn = $1;
524 $rn =~ tr/_[A-Z]/ [a-z]/; 501 $rn =~ tr/_[A-Z]/ [a-z]/;
525 } 502 }
526 $nspc = 40 - length($rstr) unless length($rstr) > 40; 503 $nspc = 40 - length($i) unless length($i) > 40;
527 $nspc = " " x $nspc; 504 $nspc = " " x $nspc;
528 print OUT "{${rstr}${nspc},\"$rn\"},\n"; 505 print OUT "{${i}${nspc},\"$rn\"},\n";
529 } 506 }
530if($static) { 507if($static) {
531 print OUT <<"EOF"; 508 print OUT <<"EOF";
@@ -542,8 +519,8 @@ ${staticloader}void ERR_load_${lib}_strings(void)
542 { 519 {
543 init=0; 520 init=0;
544#ifndef OPENSSL_NO_ERR 521#ifndef OPENSSL_NO_ERR
545 ERR_load_strings($load_errcode,${lib}_str_functs); 522 ERR_load_strings(ERR_LIB_${lib},${lib}_str_functs);
546 ERR_load_strings($load_errcode,${lib}_str_reasons); 523 ERR_load_strings(ERR_LIB_${lib},${lib}_str_reasons);
547#endif 524#endif
548 525
549 } 526 }
diff --git a/src/lib/libcrypto/util/mkfiles.pl b/src/lib/libcrypto/util/mkfiles.pl
new file mode 100644
index 0000000000..928a274303
--- /dev/null
+++ b/src/lib/libcrypto/util/mkfiles.pl
@@ -0,0 +1,125 @@
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/ripemd",
19"crypto/des",
20"crypto/rc2",
21"crypto/rc4",
22"crypto/rc5",
23"crypto/idea",
24"crypto/bf",
25"crypto/cast",
26"crypto/aes",
27"crypto/bn",
28"crypto/rsa",
29"crypto/dsa",
30"crypto/dso",
31"crypto/dh",
32"crypto/ec",
33"crypto/buffer",
34"crypto/bio",
35"crypto/stack",
36"crypto/lhash",
37"crypto/rand",
38"crypto/err",
39"crypto/objects",
40"crypto/evp",
41"crypto/asn1",
42"crypto/pem",
43"crypto/x509",
44"crypto/x509v3",
45"crypto/conf",
46"crypto/txt_db",
47"crypto/pkcs7",
48"crypto/pkcs12",
49"crypto/comp",
50"crypto/engine",
51"crypto/ocsp",
52"crypto/ui",
53"crypto/krb5",
54"fips",
55"fips/aes",
56"fips/des",
57"fips/dsa",
58"fips/dh",
59"fips/rand",
60"fips/rsa",
61"fips/sha1",
62"ssl",
63"apps",
64"test",
65"tools"
66);
67
68foreach (@dirs) {
69 &files_dir ($_, "Makefile");
70}
71
72exit(0);
73
74sub files_dir
75{
76my ($dir, $makefile) = @_;
77
78my %sym;
79
80open (IN, "$dir/$makefile") || die "Can't open $dir/$makefile";
81
82my $s="";
83
84while (<IN>)
85 {
86 chop;
87 s/#.*//;
88 if (/^(\S+)\s*=\s*(.*)$/)
89 {
90 $o="";
91 ($s,$b)=($1,$2);
92 for (;;)
93 {
94 if ($b =~ /\\$/)
95 {
96 chop($b);
97 $o.=$b." ";
98 $b=<IN>;
99 chop($b);
100 }
101 else
102 {
103 $o.=$b." ";
104 last;
105 }
106 }
107 $o =~ s/^\s+//;
108 $o =~ s/\s+$//;
109 $o =~ s/\s+/ /g;
110
111 $o =~ s/\$[({]([^)}]+)[)}]/$sym{$1}/g;
112 $sym{$s}=$o;
113 }
114 }
115
116print "RELATIVE_DIRECTORY=$dir\n";
117
118foreach (sort keys %sym)
119 {
120 print "$_=$sym{$_}\n";
121 }
122print "RELATIVE_DIRECTORY=\n";
123
124close (IN);
125}
diff --git a/src/lib/libcrypto/util/mklink.pl b/src/lib/libcrypto/util/mklink.pl
new file mode 100644
index 0000000000..c8653cecc3
--- /dev/null
+++ b/src/lib/libcrypto/util/mklink.pl
@@ -0,0 +1,70 @@
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
18my $from = shift;
19my @files = @ARGV;
20
21my @from_path = split(/[\\\/]/, $from);
22my $pwd = `pwd`;
23chop($pwd);
24my @pwd_path = split(/[\\\/]/, $pwd);
25
26my @to_path = ();
27
28my $dirname;
29foreach $dirname (@from_path) {
30
31 # In this loop, @to_path always is a relative path from
32 # @pwd_path (interpreted is an absolute path) to the original pwd.
33
34 # At the end, @from_path (as a relative path from the original pwd)
35 # designates the same directory as the absolute path @pwd_path,
36 # which means that @to_path then is a path from there to the original pwd.
37
38 next if ($dirname eq "" || $dirname eq ".");
39
40 if ($dirname eq "..") {
41 @to_path = (pop(@pwd_path), @to_path);
42 } else {
43 @to_path = ("..", @to_path);
44 push(@pwd_path, $dirname);
45 }
46}
47
48my $to = join('/', @to_path);
49
50my $file;
51$symlink_exists=eval {symlink("",""); 1};
52foreach $file (@files) {
53 my $err = "";
54 if ($symlink_exists) {
55 unlink "$from/$file";
56 symlink("$to/$file", "$from/$file") or $err = " [$!]";
57 } else {
58 unlink "$from/$file";
59 open (OLD, "<$file") or die "Can't open $file: $!";
60 open (NEW, ">$from/$file") or die "Can't open $from/$file: $!";
61 binmode(OLD);
62 binmode(NEW);
63 while (<OLD>) {
64 print NEW $_;
65 }
66 close (OLD) or die "Can't close $file: $!";
67 close (NEW) or die "Can't close $from/$file: $!";
68 }
69 print $file . " => $from/$file$err\n";
70}
diff --git a/src/lib/libcrypto/util/opensslwrap.sh b/src/lib/libcrypto/util/opensslwrap.sh
new file mode 100755
index 0000000000..91d29e2b87
--- /dev/null
+++ b/src/lib/libcrypto/util/opensslwrap.sh
@@ -0,0 +1,22 @@
1#!/bin/sh
2
3HERE="`echo $0 | sed -e 's|[^/]*$||'`"
4OPENSSL="${HERE}../apps/openssl"
5
6if [ -x "${OPENSSL}.exe" ]; then
7 # The original reason for this script existence is to work around
8 # certain caveats in run-time linker behaviour. On Windows platforms
9 # adjusting $PATH used to be sufficient, but with introduction of
10 # SafeDllSearchMode in XP/2003 the only way to get it right in
11 # *all* possible situations is to copy newly built .DLLs to apps/
12 # and test/, which is now done elsewhere... The $PATH is adjusted
13 # for backward compatibility (and nostagical reasons:-).
14 if [ "$OSTYPE" != msdosdjgpp ]; then
15 PATH="${HERE}..:$PATH"; export PATH
16 fi
17 exec "${OPENSSL}.exe" "$@"
18elif [ -x "${OPENSSL}" -a -x "${HERE}shlib_wrap.sh" ]; then
19 exec "${HERE}shlib_wrap.sh" "${OPENSSL}" "$@"
20else
21 exec "${OPENSSL}" "$@" # hope for the best...
22fi
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-16.pl b/src/lib/libcrypto/util/pl/BC-16.pl
new file mode 100644
index 0000000000..8030653daa
--- /dev/null
+++ b/src/lib/libcrypto/util/pl/BC-16.pl
@@ -0,0 +1,151 @@
1#!/usr/local/bin/perl
2# VCw16lib.pl - the file for Visual C++ 1.52b for windows, static libraries
3#
4
5$o='\\';
6$cp='copy';
7$rm='del';
8
9# C compiler stuff
10$cc='bcc';
11
12if ($debug)
13 { $op="-v "; }
14else { $op="-O "; }
15
16$cflags="-d -ml $op -DL_ENDIAN";
17# I add the stack opt
18$base_lflags="/c /C";
19$lflags="$base_lflags";
20
21if ($win16)
22 {
23 $shlib=1;
24 $cflags.=" -DOPENSSL_SYSNAME_WIN16";
25 $app_cflag="-W";
26 $lib_cflag="-WD";
27 $lflags.="/Twe";
28 }
29else
30 {
31 $cflags.=" -DOENSSL_SYSNAME_MSDOS";
32 $lflags.=" /Tde";
33 }
34
35if ($shlib)
36 {
37 $mlflags=" /Twd $base_lflags"; # stack if defined in .def file
38 $libs="libw ldllcew";
39 $no_asm=1;
40 }
41else
42 { $mlflags=''; }
43
44$obj='.obj';
45$ofile="-o";
46
47# EXE linking stuff
48$link="tlink";
49$efile="";
50$exep='.exe';
51$ex_libs="CL";
52$ex_libs.=$no_sock?"":" winsock.lib";
53
54$app_ex_obj="C0L.obj ";
55$shlib_ex_obj="" if ($shlib);
56
57# static library stuff
58$mklib='tlib';
59$ranlib='echo no ranlib';
60$plib="";
61$libp=".lib";
62$shlibp=($shlib)?".dll":".lib";
63$lfile='';
64
65$asm='bcc -c -B -Tml';
66$afile='/o';
67if ($no_asm || $fips)
68 {
69 $bn_asm_obj='';
70 $bn_asm_src='';
71 }
72elsif ($asmbits == 32)
73 {
74 $bn_asm_obj='crypto\bn\asm\x86w32.obj';
75 $bn_asm_src='crypto\bn\asm\x86w32.asm';
76 }
77else
78 {
79 $bn_asm_obj='crypto\bn\asm\x86w16.obj';
80 $bn_asm_src='crypto\bn\asm\x86w16.asm';
81 }
82
83sub do_lib_rule
84 {
85 local($target,$name,$shlib)=@_;
86 local($ret,$Name);
87
88 $taget =~ s/\//$o/g if $o ne '/';
89 ($Name=$name) =~ tr/a-z/A-Z/;
90
91 $ret.="$target: \$(${Name}OBJ)\n";
92 $ret.="\t\$(RM) \$(O_$Name)\n";
93
94 # Due to a pathetic line length limit, I unwrap the args.
95 local($lib_names)="";
96 local($dll_names)="";
97 foreach $_ (sort split(/\s+/,$Vars{"${Name}OBJ"}))
98 {
99 $lib_names.=" +$_ &\n";
100 $dll_names.=" $_\n";
101 }
102
103 if (!$shlib)
104 {
105 $ret.="\t\$(MKLIB) $target & <<|\n$lib_names\n,\n|\n";
106 }
107 else
108 {
109 local($ex)=($Name eq "SSL")?' $(L_CRYPTO) winsock':"";
110 $ret.="\t\$(LINK) \$(MLFLAGS) @&&|\n";
111 $ret.=$dll_names;
112 $ret.="\n $target\n\n $ex $libs\nms$o${name}16.def;\n|\n";
113 ($out_lib=$target) =~ s/O_/L_/;
114 $ret.="\timplib /nowep $out_lib $target\n\n";
115 }
116 $ret.="\n";
117 return($ret);
118 }
119
120sub do_link_rule
121 {
122 local($target,$files,$dep_libs,$libs,$sha1file,$openssl)=@_;
123 local($ret,$f,$_,@f);
124
125 $file =~ s/\//$o/g if $o ne '/';
126 $n=&bname($target);
127 $ret.="$target: $files $dep_libs\n";
128 $ret.=" \$(LINK) @&&|";
129
130 # Due to a pathetic line length limit, I have to unwrap the args.
131 $ret.=" \$(LFLAGS) ";
132 if ($files =~ /\(([^)]*)\)$/)
133 {
134 $ret.=" \$(APP_EX_OBJ)";
135 foreach $_ (sort split(/\s+/,$Vars{$1}))
136 { $ret.="\n $r $_ +"; }
137 chop($ret);
138 $ret.="\n";
139 }
140 else
141 { $ret.="\n $r \$(APP_EX_OBJ) $files\n"; }
142 $ret.=" $target\n\n $libs\n\n|\n";
143 if (defined $sha1file)
144 {
145 $ret.=" $openssl sha1 -hmac etaonrishdlcupfm -binary $target > $sha1file";
146 }
147 $ret.="\n";
148 return($ret);
149 }
150
1511;
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..897ae9d824
--- /dev/null
+++ b/src/lib/libcrypto/util/pl/BC-32.pl
@@ -0,0 +1,140 @@
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-aus -w-par -w-inl -c -tWC -tWM -DOPENSSL_SYSNAME_WIN32 -DL_ENDIAN -DDSO_WIN32 -D_stricmp=stricmp ";
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';
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 && !$fips)
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.="\t\$(RM) \$(O_$Name)\n";
110 $ret.="\techo LIB $<\n";
111 $ret.="\t&\$(MKLIB) $lfile$target -+\$**\n";
112 }
113 else
114 {
115 local($ex)=($target =~ /O_SSL/)?' $(L_CRYPTO)':'';
116 $ex.=' wsock32.lib gdi32.lib';
117 $ret.="\t\$(LINK) \$(MLFLAGS) $efile$target /def:ms/${Name}.def @<<\n \$(SHLIB_EX_OBJ) $objs $ex\n<<\n";
118 }
119 $ret.="\n";
120 return($ret);
121 }
122
123sub do_link_rule
124 {
125 local($target,$files,$dep_libs,$libs,$sha1file,$openssl)=@_;
126 local($ret,$_);
127
128 $file =~ s/\//$o/g if $o ne '/';
129 $n=&bname($targer);
130 $ret.="$target: $files $dep_libs\n";
131 $ret.="\t\$(LINK) \$(LFLAGS) $files \$(APP_EX_OBJ), $target,, $libs\n";
132 if (defined $sha1file)
133 {
134 $ret.="\t$openssl sha1 -hmac etaonrishdlcupfm -binary $target > $sha1file";
135 }
136 $ret.="\n";
137 return($ret);
138 }
139
1401;
diff --git a/src/lib/libcrypto/util/pl/Mingw32.pl b/src/lib/libcrypto/util/pl/Mingw32.pl
new file mode 100644
index 0000000000..b9bb24d21d
--- /dev/null
+++ b/src/lib/libcrypto/util/pl/Mingw32.pl
@@ -0,0 +1,109 @@
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 and !$fips)
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";
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="-lwsock32 -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,$sha1file,$openssl)=@_;
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";
102 if (defined $sha1file)
103 {
104 $ret.="\t$openssl sha1 -hmac etaonrishdlcupfm -binary $target > $sha1file";
105 }
106 $ret.="\n";
107 return($ret);
108 }
1091;
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..75d72ebbcb
--- /dev/null
+++ b/src/lib/libcrypto/util/pl/OS2-EMX.pl
@@ -0,0 +1,124 @@
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 && !$fips)
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 }
72
73if ($shlib)
74 {
75 $mlflags.=" $lflags -Zdll";
76 $lib_cflag=" -D_DLL";
77 $out_def="out_dll";
78 $tmp_def="tmp_dll";
79 }
80
81sub do_lib_rule
82 {
83 local($obj,$target,$name,$shlib)=@_;
84 local($ret,$_,$Name);
85
86 $target =~ s/\//$o/g if $o ne '/';
87 $target="$target";
88 ($Name=$name) =~ tr/a-z/A-Z/;
89
90 $ret.="$target: \$(${Name}OBJ)\n";
91 if (!$shlib)
92 {
93 $ret.="\t\$(RM) $target\n";
94 $ret.="\t\$(MKLIB) $target \$(${Name}OBJ)\n";
95 $ret.="\t\$(RANLIB) $target\n\n";
96 }
97 else
98 {
99 local($ex)=($target =~ /O_SSL/)?' $(L_CRYPTO)':'';
100 $ex.=' -lsocket';
101 $ret.="\t\$(LINK) \$(SHLIB_CFLAGS) \$(MLFLAGS) $efile$target \$(SHLIB_EX_OBJ) \$(${Name}OBJ) $ex os2/${Name}.def\n";
102 $ret.="\temximp -o $out_def/$name.a os2/${Name}.def\n";
103 $ret.="\temximp -o $out_def/$name.lib os2/${Name}.def\n\n";
104 }
105 }
106
107sub do_link_rule
108 {
109 local($target,$files,$dep_libs,$libs,$sha1file,$openssl)=@_;
110 local($ret,$_);
111
112 $file =~ s/\//$o/g if $o ne '/';
113 $n=&bname($target);
114 $ret.="$target: $files $dep_libs\n";
115 $ret.="\t\$(LINK) ${efile}$target \$(CFLAG) \$(LFLAGS) $files $libs\n";
116 if (defined $sha1file)
117 {
118 $ret.="\t$openssl sha1 -hmac etaonrishdlcupfm -binary $target > $sha1file";
119 }
120 $ret.="\n";
121 return($ret);
122 }
123
1241;
diff --git a/src/lib/libcrypto/util/pl/VC-16.pl b/src/lib/libcrypto/util/pl/VC-16.pl
new file mode 100644
index 0000000000..564ba3fd08
--- /dev/null
+++ b/src/lib/libcrypto/util/pl/VC-16.pl
@@ -0,0 +1,177 @@
1#!/usr/local/bin/perl
2# VCw16lib.pl - the file for Visual C++ 1.52b for windows, static libraries
3#
4
5$ssl= "ssleay16";
6$crypto="libeay16";
7
8$o='\\';
9$cp='copy';
10$rm='del';
11
12# C compiler stuff
13$cc='cl';
14
15$out_def="out16";
16$tmp_def="tmp16";
17$inc_def="inc16";
18
19if ($debug)
20 {
21 $op="/Od /Zi /Zd";
22 $base_lflags="/CO";
23 }
24else {
25 $op="/G2 /f- /Ocgnotb2";
26 }
27$base_lflags.=" /FARCALL /NOLOGO /NOD /SEG:1024 /ONERROR:NOEXE /NOE /PACKC:60000";
28if ($win16) { $base_lflags.=" /PACKD:60000"; }
29
30$cflags="/ALw /Gx- /Gt256 /Gf $op /W3 /WX -DL_ENDIAN /nologo";
31# I add the stack opt
32$lflags="$base_lflags /STACK:20000";
33
34if ($win16)
35 {
36 $cflags.=" -DOPENSSL_SYSNAME_WIN16";
37 $app_cflag="/Gw /FPi87";
38 $lib_cflag="/Gw";
39 $lib_cflag.=" -D_WINDLL -D_DLL" if $shlib;
40 $lib_cflag.=" -DWIN16TTY" if !$shlib;
41 $lflags.=" /ALIGN:256";
42 $ex_libs.="oldnames llibcewq libw";
43 }
44else
45 {
46 $no_sock=1;
47 $cflags.=" -DMSDOS";
48 $lflags.=" /EXEPACK";
49 $ex_libs.="oldnames.lib llibce.lib";
50 }
51
52if ($shlib)
53 {
54 $mlflags="$base_lflags";
55 $libs="oldnames ldllcew libw";
56 $shlib_ex_obj="";
57# $no_asm=1;
58 $out_def="out16dll";
59 $tmp_def="tmp16dll";
60 }
61else
62 { $mlflags=''; }
63
64$app_ex_obj="";
65
66$obj='.obj';
67$ofile="/Fo";
68
69# EXE linking stuff
70$link="link";
71$efile="";
72$exep='.exe';
73$ex_libs.=$no_sock?"":" winsock";
74
75# static library stuff
76$mklib='lib /PAGESIZE:1024';
77$ranlib='';
78$plib="";
79$libp=".lib";
80$shlibp=($shlib)?".dll":".lib";
81$lfile='';
82
83$asm='ml /Cp /c /Cx';
84$afile='/Fo';
85
86$bn_asm_obj='';
87$bn_asm_src='';
88$des_enc_obj='';
89$des_enc_src='';
90$bf_enc_obj='';
91$bf_enc_src='';
92
93if (!$no_asm && !$fips)
94 {
95 if ($asmbits == 32)
96 {
97 $bn_asm_obj='crypto\bn\asm\x86w32.obj';
98 $bn_asm_src='crypto\bn\asm\x86w32.asm';
99 }
100 else
101 {
102 $bn_asm_obj='crypto\bn\asm\x86w16.obj';
103 $bn_asm_src='crypto\bn\asm\x86w16.asm';
104 }
105 }
106
107sub do_lib_rule
108 {
109 local($objs,$target,$name,$shlib)=@_;
110 local($ret,$Name);
111
112 $taget =~ s/\//$o/g if $o ne '/';
113 ($Name=$name) =~ tr/a-z/A-Z/;
114
115# $target="\$(LIB_D)$o$target";
116 $ret.="$target: $objs\n";
117# $ret.="\t\$(RM) \$(O_$Name)\n";
118
119 # Due to a pathetic line length limit, I unwrap the args.
120 local($lib_names)="";
121 local($dll_names)=" \$(SHLIB_EX_OBJ) +\n";
122 ($obj)= ($objs =~ /\((.*)\)/);
123 foreach $_ (sort split(/\s+/,$Vars{$obj}))
124 {
125 $lib_names.="+$_ &\n";
126 $dll_names.=" $_ +\n";
127 }
128
129 if (!$shlib)
130 {
131 $ret.="\tdel $target\n";
132 $ret.="\t\$(MKLIB) @<<\n$target\ny\n$lib_names\n\n<<\n";
133 }
134 else
135 {
136 local($ex)=($target =~ /O_SSL/)?'$(L_CRYPTO)':"";
137 $ex.=' winsock';
138 $ret.="\t\$(LINK) \$(MLFLAGS) @<<\n";
139 $ret.=$dll_names;
140 $ret.="\n $target\n\n $ex $libs\nms$o${name}.def;\n<<\n";
141 ($out_lib=$target) =~ s/O_/L_/;
142 $ret.="\timplib /noignorecase /nowep $out_lib $target\n";
143 }
144 $ret.="\n";
145 return($ret);
146 }
147
148sub do_link_rule
149 {
150 local($target,$files,$dep_libs,$libs,$sha1file,$openssl)=@_;
151 local($ret,$f,$_,@f);
152
153 $file =~ s/\//$o/g if $o ne '/';
154 $n=&bname($targer);
155 $ret.="$target: $files $dep_libs\n";
156 $ret.=" \$(LINK) \$(LFLAGS) @<<\n";
157
158 # Due to a pathetic line length limit, I have to unwrap the args.
159 if ($files =~ /\(([^)]*)\)$/)
160 {
161 @a=('$(APP_EX_OBJ)');
162 push(@a,sort split(/\s+/,$Vars{$1}));
163 for $_ (@a)
164 { $ret.=" $_ +\n"; }
165 }
166 else
167 { $ret.=" \$(APP_EX_OBJ) $files"; }
168 $ret.="\n $target\n\n $libs\n\n<<\n";
169 if (defined $sha1file)
170 {
171 $ret.=" $openssl sha1 -hmac etaonrishdlcupfm -binary $target > $sha1file";
172 }
173 $ret.="\n";
174 return($ret);
175 }
176
1771;
diff --git a/src/lib/libcrypto/util/pl/VC-32-GMAKE.pl b/src/lib/libcrypto/util/pl/VC-32-GMAKE.pl
new file mode 100644
index 0000000000..b5bbcac6c2
--- /dev/null
+++ b/src/lib/libcrypto/util/pl/VC-32-GMAKE.pl
@@ -0,0 +1,222 @@
1#!/usr/local/bin/perl
2# VCw32lib.pl - the file for Visual C++ 4.[01] for windows NT, static libraries
3#
4
5
6if ($fips && !$shlib)
7 {
8 $crypto="libeayfips32";
9 $crypto_compat = "libeaycompat32.lib";
10 }
11else
12 {
13 $crypto="libeay32";
14 }
15$ssl= "ssleay32";
16
17$o='/';
18#$cp='copy nul+'; # Timestamps get stuffed otherwise
19#$rm='del';
20
21$cp='cp';
22$rm='rm';
23
24$zlib_lib="zlib1.lib";
25
26# C compiler stuff
27$cc='cl';
28$cflags=' -MD -W3 -WX -Ox -O2 -Ob2 -Gs0 -GF -Gy -nologo -DOPENSSL_SYSNAME_WIN32 -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -DDSO_WIN32';
29$cflags.=' -D_CRT_SECURE_NO_DEPRECATE'; # shut up VC8
30$cflags.=' -D_CRT_NONSTDC_NO_DEPRECATE'; # shut up VC8
31$lflags="-nologo -subsystem:console -machine:I386 -opt:ref";
32$mlflags='';
33
34$out_def="gmout32";
35$tmp_def="gmtmp32";
36$inc_def="gminc32";
37
38if ($debug)
39 {
40 $cflags=" -MDd -W3 -WX -Zi -Yd -Od -nologo -DOPENSSL_SYSNAME_WIN32 -D_DEBUG -DL_ENDIAN -DWIN32_LEAN_AND_MEAN -DDEBUG -DDSO_WIN32";
41 $lflags.=" -debug";
42 $mlflags.=' -debug';
43 }
44$cflags .= " -DOPENSSL_SYSNAME_WINNT" if $NT == 1;
45
46$obj='.obj';
47$ofile="-Fo";
48
49# EXE linking stuff
50$link="link";
51$efile="-out:";
52$exep='.exe';
53if ($no_sock)
54 { $ex_libs=""; }
55else { $ex_libs="wsock32.lib user32.lib gdi32.lib"; }
56
57# static library stuff
58$mklib='lib';
59$ranlib='';
60$plib="";
61$libp=".lib";
62$shlibp=($shlib)?".dll":".lib";
63$lfile='-out:';
64
65$shlib_ex_obj="";
66$app_ex_obj="setargv.obj";
67if ($nasm) {
68 $asm='nasmw -f win32';
69 $afile='-o ';
70} else {
71 $asm='ml -Cp -coff -c -Cx';
72 $asm.=" -Zi" if $debug;
73 $afile='-Fo';
74}
75
76$bn_asm_obj='';
77$bn_asm_src='';
78$des_enc_obj='';
79$des_enc_src='';
80$bf_enc_obj='';
81$bf_enc_src='';
82
83if (!$no_asm && !$fips)
84 {
85 $bn_asm_obj='crypto/bn/asm/bn_win32.obj';
86 $bn_asm_src='crypto/bn/asm/bn_win32.asm';
87 $des_enc_obj='crypto/des/asm/d_win32.obj crypto/des/asm/y_win32.obj';
88 $des_enc_src='crypto/des/asm/d_win32.asm crypto/des/asm/y_win32.asm';
89 $bf_enc_obj='crypto/bf/asm/b_win32.obj';
90 $bf_enc_src='crypto/bf/asm/b_win32.asm';
91 $cast_enc_obj='crypto/cast/asm/c_win32.obj';
92 $cast_enc_src='crypto/cast/asm/c_win32.asm';
93 $rc4_enc_obj='crypto/rc4/asm/r4_win32.obj';
94 $rc4_enc_src='crypto/rc4/asm/r4_win32.asm';
95 $rc5_enc_obj='crypto/rc5/asm/r5_win32.obj';
96 $rc5_enc_src='crypto/rc5/asm/r5_win32.asm';
97 $md5_asm_obj='crypto/md5/asm/m5_win32.obj';
98 $md5_asm_src='crypto/md5/asm/m5_win32.asm';
99 $sha1_asm_obj='crypto/sha/asm/s1_win32.obj';
100 $sha1_asm_src='crypto/sha/asm/s1_win32.asm';
101 $rmd160_asm_obj='crypto/ripemd/asm/rm_win32.obj';
102 $rmd160_asm_src='crypto/ripemd/asm/rm_win32.asm';
103 $cflags.=" -DBN_ASM -DMD5_ASM -DSHA1_ASM -DRMD160_ASM";
104 }
105
106if ($shlib)
107 {
108 $mlflags.=" $lflags -dll";
109# $cflags =~ s| -MD| -MT|;
110 $lib_cflag=" -D_WINDLL";
111 $out_def="gmout32dll";
112 $tmp_def="gmtmp32dll";
113 }
114
115$cflags.=" -Fd$out_def";
116
117sub do_lib_rule
118 {
119 local($objs,$target,$name,$shlib,$ign,$base_addr, $fips_get_sig, $fips_premain_src)=@_;
120 local($ret,$Name);
121
122 $taget =~ s/\//$o/g if $o ne '/';
123 ($Name=$name) =~ tr/a-z/A-Z/;
124 my $base_arg;
125 if ($base_addr ne "")
126 {
127 $base_arg= " -base:$base_addr";
128 }
129 else
130 {
131 $base_arg = "";
132 }
133
134
135# $target="\$(LIB_D)$o$target";
136 if (!$shlib)
137 {
138# $ret.="\t\$(RM) \$(O_$Name)\n";
139 $ret.="$target: $objs\n";
140 $ex =' advapi32.lib';
141 $ret.="\t\$(MKLIB) $lfile$target $objs $ex\n\n";
142 }
143 else
144 {
145 local($ex)=($target =~ /O_SSL/)?' $(L_CRYPTO)':'';
146 $ex.=' wsock32.lib gdi32.lib advapi32.lib user32.lib';
147 $ex.=" $zlib_lib" if $zlib_opt == 1 && $target =~ /O_CRYPTO/;
148 if (defined $fips_get_sig)
149 {
150 $ret.="$target: \$(O_FIPSCANISTER) $objs $fips_get_sig\n";
151 $ret.="\tFIPS_LINK=\$(LINK) ";
152 $ret.="FIPS_CC=\$(CC) ";
153 $ret.="FIPS_CC_ARGS=\"-Fo\$(OBJ_D)${o}fips_premain.obj \$(SHLIB_CFLAGS) -c\" ";
154 $ret.="FIPS_PREMAIN_DSO=$fips_get_sig ";
155 $ret.="FIPS_TARGET=$target ";
156 $ret.="FIPS_LIBDIR=\$(FIPSLIB_D) ";
157 $ret.="\$(FIPSLINK) \$(MLFLAGS) $base_arg $efile$target ";
158 $ret.="-def:ms/${Name}.def \$(SHLIB_EX_OBJ) $objs ";
159 $ret.="\$(OBJ_D)${o}fips_premain.obj $ex\n\n";
160 }
161 else
162 {
163 $ret.="$target: $objs\n";
164 $ret.="\t\$(LINK) \$(MLFLAGS) $base_arg $efile$target /def:ms/${Name}.def \$(SHLIB_EX_OBJ) $objs $ex\n\n";
165 }
166 }
167 $ret.="\n";
168 return($ret);
169 }
170
171sub do_link_rule
172 {
173 local($target,$files,$dep_libs,$libs,$standalone)=@_;
174 local($ret,$_);
175 $file =~ s/\//$o/g if $o ne '/';
176 $n=&bname($targer);
177 if ($standalone)
178 {
179 $ret.="$target: $files $dep_libs\n";
180 $ret.="\t\$(LINK) \$(LFLAGS) $efile$target ";
181 $ret.="$files $libs\n\n";
182 }
183 elsif ($fips && !$shlib)
184 {
185 $ret.="$target: \$(O_FIPSCANISTER) $files $dep_libs\n";
186 $ret.="\tFIPS_LINK=\$(LINK) ";
187 $ret.="FIPS_CC=\$(CC) ";
188 $ret.="FIPS_CC_ARGS=\"-Fo\$(OBJ_D)${o}fips_premain.obj \$(SHLIB_CFLAGS) -c\" ";
189 $ret.="FIPS_PREMAIN_DSO= ";
190 $ret.="FIPS_TARGET=$target ";
191 $ret.="FIPS_LIBDIR=\$(FIPSLIB_D) ";
192 $ret.=" \$(FIPSLINK) \$(LFLAGS) $efile$target ";
193 $ret.="\$(APP_EX_OBJ) $files \$(OBJ_D)${o}fips_premain.obj $libs\n\n";
194 }
195 else
196 {
197 $ret.="$target: $files $dep_libs\n";
198 $ret.="\t\$(LINK) \$(LFLAGS) $efile$target ";
199 $ret.="\$(APP_EX_OBJ) $files $libs\n\n";
200 }
201 $ret.="\n";
202 return($ret);
203 }
204
205sub do_rlink_rule
206 {
207 local($target,$files,$check_hash, $deps)=@_;
208 local($ret,$_);
209
210 $file =~ s/\//$o/g if $o ne '/';
211 $n=&bname($targer);
212 $ret.="$target: $check_hash $files $deps\n";
213 $ret.="\t\$(PERL) util${o}checkhash.pl -chdir fips-1.0 -program_path ..$o$check_hash\n";
214 $ret.="\t\$(MKCANISTER) $target $files\n";
215 $ret.="\t$check_hash $target > $target.sha1\n";
216 $ret.="\t\$(CP) fips-1.0${o}fips_premain.c \$(FIPSLIB_D)\n";
217 $ret.="\t$check_hash \$(FIPSLIB_D)${o}fips_premain.c > \$(FIPSLIB_D)${o}fips_premain.c.sha1\n\n";
218 return($ret);
219 }
220
221
2221;
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..cf689b9feb
--- /dev/null
+++ b/src/lib/libcrypto/util/pl/VC-32.pl
@@ -0,0 +1,145 @@
1#!/usr/local/bin/perl
2# VCw32lib.pl - the file for Visual C++ 4.[01] for windows NT, static libraries
3#
4
5$ssl= "ssleay32";
6$crypto="libeay32";
7
8$o='\\';
9$cp='copy nul+'; # Timestamps get stuffed otherwise
10$rm='del';
11
12# C compiler stuff
13$cc='cl';
14$cflags=' /MD /W3 /WX /G5 /Ox /O2 /Ob2 /Gs0 /GF /Gy /nologo -DOPENSSL_SYSNAME_WIN32 -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -DDSO_WIN32';
15$lflags="/nologo /subsystem:console /machine:I386 /opt:ref";
16$mlflags='';
17
18$out_def="out32";
19$tmp_def="tmp32";
20$inc_def="inc32";
21
22if ($debug)
23 {
24 $cflags=" /MDd /W3 /WX /Zi /Yd /Od /nologo -DOPENSSL_SYSNAME_WIN32 -D_DEBUG -DL_ENDIAN -DWIN32_LEAN_AND_MEAN -DDEBUG -DDSO_WIN32";
25 $lflags.=" /debug";
26 $mlflags.=' /debug';
27 }
28$cflags .= " -DOPENSSL_SYSNAME_WINNT" if $NT == 1;
29
30$obj='.obj';
31$ofile="/Fo";
32
33# EXE linking stuff
34$link="link";
35$efile="/out:";
36$exep='.exe';
37if ($no_sock)
38 { $ex_libs=""; }
39else { $ex_libs="wsock32.lib user32.lib gdi32.lib"; }
40
41# static library stuff
42$mklib='lib';
43$ranlib='';
44$plib="";
45$libp=".lib";
46$shlibp=($shlib)?".dll":".lib";
47$lfile='/out:';
48
49$shlib_ex_obj="";
50$app_ex_obj="setargv.obj";
51if ($nasm) {
52 $asm='nasmw -f win32';
53 $afile='-o ';
54} else {
55 $asm='ml /Cp /coff /c /Cx';
56 $asm.=" /Zi" if $debug;
57 $afile='/Fo';
58}
59
60$bn_asm_obj='';
61$bn_asm_src='';
62$des_enc_obj='';
63$des_enc_src='';
64$bf_enc_obj='';
65$bf_enc_src='';
66
67if (!$no_asm && !$fips)
68 {
69 $bn_asm_obj='crypto\bn\asm\bn_win32.obj';
70 $bn_asm_src='crypto\bn\asm\bn_win32.asm';
71 $des_enc_obj='crypto\des\asm\d_win32.obj crypto\des\asm\y_win32.obj';
72 $des_enc_src='crypto\des\asm\d_win32.asm crypto\des\asm\y_win32.asm';
73 $bf_enc_obj='crypto\bf\asm\b_win32.obj';
74 $bf_enc_src='crypto\bf\asm\b_win32.asm';
75 $cast_enc_obj='crypto\cast\asm\c_win32.obj';
76 $cast_enc_src='crypto\cast\asm\c_win32.asm';
77 $rc4_enc_obj='crypto\rc4\asm\r4_win32.obj';
78 $rc4_enc_src='crypto\rc4\asm\r4_win32.asm';
79 $rc5_enc_obj='crypto\rc5\asm\r5_win32.obj';
80 $rc5_enc_src='crypto\rc5\asm\r5_win32.asm';
81 $md5_asm_obj='crypto\md5\asm\m5_win32.obj';
82 $md5_asm_src='crypto\md5\asm\m5_win32.asm';
83 $sha1_asm_obj='crypto\sha\asm\s1_win32.obj';
84 $sha1_asm_src='crypto\sha\asm\s1_win32.asm';
85 $rmd160_asm_obj='crypto\ripemd\asm\rm_win32.obj';
86 $rmd160_asm_src='crypto\ripemd\asm\rm_win32.asm';
87 $cflags.=" -DBN_ASM -DMD5_ASM -DSHA1_ASM -DRMD160_ASM";
88 }
89
90if ($shlib)
91 {
92 $mlflags.=" $lflags /dll";
93# $cflags =~ s| /MD| /MT|;
94 $lib_cflag=" -D_WINDLL";
95 $out_def="out32dll";
96 $tmp_def="tmp32dll";
97 }
98
99$cflags.=" /Fd$out_def";
100
101sub do_lib_rule
102 {
103 local($objs,$target,$name,$shlib)=@_;
104 local($ret,$Name);
105
106 $taget =~ s/\//$o/g if $o ne '/';
107 ($Name=$name) =~ tr/a-z/A-Z/;
108
109# $target="\$(LIB_D)$o$target";
110 $ret.="$target: $objs\n";
111 if (!$shlib)
112 {
113# $ret.="\t\$(RM) \$(O_$Name)\n";
114 $ex =' advapi32.lib';
115 $ret.="\t\$(MKLIB) $lfile$target @<<\n $objs $ex\n<<\n";
116 }
117 else
118 {
119 local($ex)=($target =~ /O_SSL/)?' $(L_CRYPTO)':'';
120 $ex.=' wsock32.lib gdi32.lib advapi32.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,$sha1file,$openssl)=@_;
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.=" \$(LINK) \$(LFLAGS) $efile$target @<<\n";
136 $ret.=" \$(APP_EX_OBJ) $files $libs\n<<\n";
137 if (defined $sha1file)
138 {
139 $ret.=" $openssl sha1 -hmac etaonrishdlcupfm -binary $target > $sha1file";
140 }
141 $ret.="\n";
142 return($ret);
143 }
144
1451;
diff --git a/src/lib/libcrypto/util/pl/VC-CE.pl b/src/lib/libcrypto/util/pl/VC-CE.pl
new file mode 100644
index 0000000000..2fd0c4dd32
--- /dev/null
+++ b/src/lib/libcrypto/util/pl/VC-CE.pl
@@ -0,0 +1,116 @@
1#!/usr/local/bin/perl
2# VC-CE.pl - the file for eMbedded Visual C++ 3.0 for windows CE, static libraries
3#
4
5$ssl= "ssleay32";
6$crypto="libeay32";
7$RSAref="RSAref32";
8
9$o='\\';
10$cp='copy nul+'; # Timestamps get stuffed otherwise
11$rm='del';
12
13# C compiler stuff
14$cc='$(CC)';
15$cflags=' /W3 /WX /Ox /O2 /Ob2 /Gs0 /GF /Gy /nologo $(WCETARGETDEFS) -DUNICODE -D_UNICODE -DWIN32 -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -DDSO_WIN32 -DNO_CHMOD -I$(WCECOMPAT)/include';
16$lflags='/nologo /subsystem:windowsce,$(WCELDVERSION) /machine:$(WCELDMACHINE) /opt:ref';
17$mlflags='';
18
19$out_def='out32_$(TARGETCPU)';
20$tmp_def='tmp32_$(TARGETCPU)';
21$inc_def="inc32";
22
23if ($debug)
24 {
25 $cflags=" /MDd /W3 /WX /Zi /Yd /Od /nologo -DWIN32 -D_DEBUG -DL_ENDIAN -DWIN32_LEAN_AND_MEAN -DDEBUG -DDSO_WIN32";
26 $lflags.=" /debug";
27 $mlflags.=' /debug';
28 }
29
30$obj='.obj';
31$ofile="/Fo";
32
33# EXE linking stuff
34$link="link";
35$efile="/out:";
36$exep='.exe';
37if ($no_sock)
38 { $ex_libs=""; }
39else { $ex_libs='winsock.lib $(WCECOMPAT)/lib/wcecompatex.lib $(WCELDFLAGS)'; }
40
41# static library stuff
42$mklib='lib';
43$ranlib='';
44$plib="";
45$libp=".lib";
46$shlibp=($shlib)?".dll":".lib";
47$lfile='/out:';
48
49$shlib_ex_obj="";
50$app_ex_obj="";
51$app_ex_obj="";
52
53$bn_asm_obj='';
54$bn_asm_src='';
55$des_enc_obj='';
56$des_enc_src='';
57$bf_enc_obj='';
58$bf_enc_src='';
59
60if ($shlib)
61 {
62 $mlflags.=" $lflags /dll";
63# $cflags =~ s| /MD| /MT|;
64 $lib_cflag=" -D_WINDLL -D_DLL";
65 $out_def='out32dll_$(TARGETCPU)';
66 $tmp_def='tmp32dll_$(TARGETCPU)';
67 }
68
69$cflags.=" /Fd$out_def";
70
71sub do_lib_rule
72 {
73 local($objs,$target,$name,$shlib)=@_;
74 local($ret,$Name);
75
76 $taget =~ s/\//$o/g if $o ne '/';
77 ($Name=$name) =~ tr/a-z/A-Z/;
78
79# $target="\$(LIB_D)$o$target";
80 $ret.="$target: $objs\n";
81 if (!$shlib)
82 {
83# $ret.="\t\$(RM) \$(O_$Name)\n";
84 $ex =' ';
85 $ret.="\t\$(MKLIB) $lfile$target @<<\n $objs $ex\n<<\n";
86 }
87 else
88 {
89 local($ex)=($target =~ /O_SSL/)?' $(L_CRYPTO)':'';
90# $ex.=' winsock.lib coredll.lib $(WCECOMPAT)/lib/wcecompatex.lib';
91 $ex.=' winsock.lib $(WCECOMPAT)/lib/wcecompatex.lib';
92 $ret.="\t\$(LINK) \$(MLFLAGS) $efile$target /def:ms/${Name}.def @<<\n \$(SHLIB_EX_OBJ) $objs $ex\n<<\n";
93 }
94 $ret.="\n";
95 return($ret);
96 }
97
98sub do_link_rule
99 {
100 local($target,$files,$dep_libs,$libs,$sha1file,$openssl)=@_;
101 local($ret,$_);
102
103 $file =~ s/\//$o/g if $o ne '/';
104 $n=&bname($targer);
105 $ret.="$target: $files $dep_libs\n";
106 $ret.=" \$(LINK) \$(LFLAGS) $efile$target @<<\n";
107 $ret.=" \$(APP_EX_OBJ) $files $libs\n<<\n";
108 if (defined $sha1file)
109 {
110 $ret.=" $openssl sha1 -hmac etaonrishdlcupfm -binary $target > $sha1file";
111 }
112 $ret.="\n";
113 return($ret);
114 }
115
1161;
diff --git a/src/lib/libcrypto/util/pl/linux.pl b/src/lib/libcrypto/util/pl/linux.pl
new file mode 100644
index 0000000000..df05c40526
--- /dev/null
+++ b/src/lib/libcrypto/util/pl/linux.pl
@@ -0,0 +1,109 @@
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";
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,$sha1file,$openssl)=@_;
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";
82 if (defined $sha1file)
83 {
84 $ret.="\t$openssl sha1 -hmac etaonrishdlcupfm -binary $target > $sha1file";
85 }
86 $ret.="\n";
87 return($ret);
88 }
89
90sub do_asm_rule
91 {
92 local($target,$src)=@_;
93 local($ret,@s,@t,$i);
94
95 $target =~ s/\//$o/g if $o ne "/";
96 $src =~ s/\//$o/g if $o ne "/";
97
98 @s=split(/\s+/,$src);
99 @t=split(/\s+/,$target);
100
101 for ($i=0; $i<=$#s; $i++)
102 {
103 $ret.="$t[$i]: $s[$i]\n";
104 $ret.="\tgcc -E -DELF \$(SRC_D)$o$s[$i]|\$(AS) $afile$t[$i]\n\n";
105 }
106 return($ret);
107 }
108
1091;
diff --git a/src/lib/libcrypto/util/pl/ultrix.pl b/src/lib/libcrypto/util/pl/ultrix.pl
new file mode 100644
index 0000000000..447b854708
--- /dev/null
+++ b/src/lib/libcrypto/util/pl/ultrix.pl
@@ -0,0 +1,43 @@
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 && !$fips)
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,$sha1file,$openssl)=@_;
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";
35 if (defined $sha1file)
36 {
37 $ret.="\t$openssl sha1 -hmac etaonrishdlcupfm -binary $target > $sha1file";
38 }
39 $ret.="\n";
40 return($ret);
41 }
42
431;
diff --git a/src/lib/libcrypto/util/pl/unix.pl b/src/lib/libcrypto/util/pl/unix.pl
new file mode 100644
index 0000000000..bbd1798a2e
--- /dev/null
+++ b/src/lib/libcrypto/util/pl/unix.pl
@@ -0,0 +1,101 @@
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,$sha1file,$openssl)=@_;
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";
80 if (defined $sha1file)
81 {
82 $ret.="\t$openssl sha1 -hmac etaonrishdlcupfm -binary $target > $sha1file";
83 }
84 $ret.="\n";
85 return($ret);
86 }
87
88sub which
89 {
90 my ($name)=@_;
91 my $path;
92 foreach $path (split /:/, $ENV{PATH})
93 {
94 if (-x "$path/$name")
95 {
96 return "$path/$name";
97 }
98 }
99 }
100
1011;
diff --git a/src/lib/libcrypto/util/pod2man.pl b/src/lib/libcrypto/util/pod2man.pl
new file mode 100644
index 0000000000..657e4e264e
--- /dev/null
+++ b/src/lib/libcrypto/util/pod2man.pl
@@ -0,0 +1,1183 @@
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 die "$0: Invalid man page - 1st pod line is not NAME in $ARGV[0]\n" unless $lax;
429 }
430 die "$0: Invalid man page - no documentation in $ARGV[0]\n" unless $lax;
431 }
432 close F;
433}
434
435print <<"END";
436.rn '' }`
437''' \$RCSfile\$\$Revision\$\$Date\$
438'''
439''' \$Log\$
440'''
441.de Sh
442.br
443.if t .Sp
444.ne 5
445.PP
446\\fB\\\\\$1\\fR
447.PP
448..
449.de Sp
450.if t .sp .5v
451.if n .sp
452..
453.de Ip
454.br
455.ie \\\\n(.\$>=3 .ne \\\\\$3
456.el .ne 3
457.IP "\\\\\$1" \\\\\$2
458..
459.de Vb
460.ft $CFont
461.nf
462.ne \\\\\$1
463..
464.de Ve
465.ft R
466
467.fi
468..
469'''
470'''
471''' Set up \\*(-- to give an unbreakable dash;
472''' string Tr holds user defined translation string.
473''' Bell System Logo is used as a dummy character.
474'''
475.tr \\(*W-|\\(bv\\*(Tr
476.ie n \\{\\
477.ds -- \\(*W-
478.ds PI pi
479.if (\\n(.H=4u)&(1m=24u) .ds -- \\(*W\\h'-12u'\\(*W\\h'-12u'-\\" diablo 10 pitch
480.if (\\n(.H=4u)&(1m=20u) .ds -- \\(*W\\h'-12u'\\(*W\\h'-8u'-\\" diablo 12 pitch
481.ds L" ""
482.ds R" ""
483''' \\*(M", \\*(S", \\*(N" and \\*(T" are the equivalent of
484''' \\*(L" and \\*(R", except that they are used on ".xx" lines,
485''' such as .IP and .SH, which do another additional levels of
486''' double-quote interpretation
487.ds M" """
488.ds S" """
489.ds N" """""
490.ds T" """""
491.ds L' '
492.ds R' '
493.ds M' '
494.ds S' '
495.ds N' '
496.ds T' '
497'br\\}
498.el\\{\\
499.ds -- \\(em\\|
500.tr \\*(Tr
501.ds L" ``
502.ds R" ''
503.ds M" ``
504.ds S" ''
505.ds N" ``
506.ds T" ''
507.ds L' `
508.ds R' '
509.ds M' `
510.ds S' '
511.ds N' `
512.ds T' '
513.ds PI \\(*p
514'br\\}
515END
516
517print <<'END';
518.\" If the F register is turned on, we'll generate
519.\" index entries out stderr for the following things:
520.\" TH Title
521.\" SH Header
522.\" Sh Subsection
523.\" Ip Item
524.\" X<> Xref (embedded
525.\" Of course, you have to process the output yourself
526.\" in some meaninful fashion.
527.if \nF \{
528.de IX
529.tm Index:\\$1\t\\n%\t"\\$2"
530..
531.nr % 0
532.rr F
533.\}
534END
535
536print <<"END";
537.TH $name $section "$RP" "$date" "$center"
538.UC
539END
540
541push(@Indices, qq{.IX Title "$name $section"});
542
543while (($name, $desc) = each %namedesc) {
544 for ($name, $desc) { s/^\s+//; s/\s+$//; }
545 push(@Indices, qq(.IX Name "$name - $desc"\n));
546}
547
548print <<'END';
549.if n .hy 0
550.if n .na
551.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
552.de CQ \" put $1 in typewriter font
553END
554print ".ft $CFont\n";
555print <<'END';
556'if n "\c
557'if t \\&\\$1\c
558'if n \\&\\$1\c
559'if n \&"
560\\&\\$2 \\$3 \\$4 \\$5 \\$6 \\$7
561'.ft R
562..
563.\" @(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2
564. \" AM - accent mark definitions
565.bd B 3
566. \" fudge factors for nroff and troff
567.if n \{\
568. ds #H 0
569. ds #V .8m
570. ds #F .3m
571. ds #[ \f1
572. ds #] \fP
573.\}
574.if t \{\
575. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
576. ds #V .6m
577. ds #F 0
578. ds #[ \&
579. ds #] \&
580.\}
581. \" simple accents for nroff and troff
582.if n \{\
583. ds ' \&
584. ds ` \&
585. ds ^ \&
586. ds , \&
587. ds ~ ~
588. ds ? ?
589. ds ! !
590. ds /
591. ds q
592.\}
593.if t \{\
594. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
595. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
596. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
597. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
598. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
599. ds ? \s-2c\h'-\w'c'u*7/10'\u\h'\*(#H'\zi\d\s+2\h'\w'c'u*8/10'
600. ds ! \s-2\(or\s+2\h'-\w'\(or'u'\v'-.8m'.\v'.8m'
601. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
602. 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'
603.\}
604. \" troff and (daisy-wheel) nroff accents
605.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
606.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
607.ds v \\k:\h'-(\\n(.wu*9/10-\*(#H)'\v'-\*(#V'\*(#[\s-4v\s0\v'\*(#V'\h'|\\n:u'\*(#]
608.ds _ \\k:\h'-(\\n(.wu*9/10-\*(#H+(\*(#F*2/3))'\v'-.4m'\z\(hy\v'.4m'\h'|\\n:u'
609.ds . \\k:\h'-(\\n(.wu*8/10)'\v'\*(#V*4/10'\z.\v'-\*(#V*4/10'\h'|\\n:u'
610.ds 3 \*(#[\v'.2m'\s-2\&3\s0\v'-.2m'\*(#]
611.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
612.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
613.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
614.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
615.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
616.ds ae a\h'-(\w'a'u*4/10)'e
617.ds Ae A\h'-(\w'A'u*4/10)'E
618.ds oe o\h'-(\w'o'u*4/10)'e
619.ds Oe O\h'-(\w'O'u*4/10)'E
620. \" corrections for vroff
621.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
622.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
623. \" for low resolution devices (crt and lpr)
624.if \n(.H>23 .if \n(.V>19 \
625\{\
626. ds : e
627. ds 8 ss
628. ds v \h'-1'\o'\(aa\(ga'
629. ds _ \h'-1'^
630. ds . \h'-1'.
631. ds 3 3
632. ds o a
633. ds d- d\h'-1'\(ga
634. ds D- D\h'-1'\(hy
635. ds th \o'bp'
636. ds Th \o'LP'
637. ds ae ae
638. ds Ae AE
639. ds oe oe
640. ds Oe OE
641.\}
642.rm #[ #] #H #V #F C
643END
644
645$indent = 0;
646
647$begun = "";
648
649# Unrolling [^A-Z>]|[A-Z](?!<) gives: // MRE pp 165.
650my $nonest = '(?:[^A-Z>]*(?:[A-Z](?!<)[^A-Z>]*)*)';
651
652while (<>) {
653 if ($cutting) {
654 next unless /^=/;
655 $cutting = 0;
656 }
657 if ($begun) {
658 if (/^=end\s+$begun/) {
659 $begun = "";
660 }
661 elsif ($begun =~ /^(roff|man)$/) {
662 print STDOUT $_;
663 }
664 next;
665 }
666 chomp;
667
668 # Translate verbatim paragraph
669
670 if (/^\s/) {
671 @lines = split(/\n/);
672 for (@lines) {
673 1 while s
674 {^( [^\t]* ) \t ( \t* ) }
675 { $1 . ' ' x (8 - (length($1)%8) + 8 * (length($2))) }ex;
676 s/\\/\\e/g;
677 s/\A/\\&/s;
678 }
679 $lines = @lines;
680 makespace() unless $verbatim++;
681 print ".Vb $lines\n";
682 print join("\n", @lines), "\n";
683 print ".Ve\n";
684 $needspace = 0;
685 next;
686 }
687
688 $verbatim = 0;
689
690 if (/^=for\s+(\S+)\s*/s) {
691 if ($1 eq "man" or $1 eq "roff") {
692 print STDOUT $',"\n\n";
693 } else {
694 # ignore unknown for
695 }
696 next;
697 }
698 elsif (/^=begin\s+(\S+)\s*/s) {
699 $begun = $1;
700 if ($1 eq "man" or $1 eq "roff") {
701 print STDOUT $'."\n\n";
702 }
703 next;
704 }
705
706 # check for things that'll hosed our noremap scheme; affects $_
707 init_noremap();
708
709 if (!/^=item/) {
710
711 # trofficate backslashes; must do it before what happens below
712 s/\\/noremap('\\e')/ge;
713
714 # protect leading periods and quotes against *roff
715 # mistaking them for directives
716 s/^(?:[A-Z]<)?[.']/\\&$&/gm;
717
718 # first hide the escapes in case we need to
719 # intuit something and get it wrong due to fmting
720
721 1 while s/([A-Z]<$nonest>)/noremap($1)/ge;
722
723 # func() is a reference to a perl function
724 s{
725 \b
726 (
727 [:\w]+ \(\)
728 )
729 } {I<$1>}gx;
730
731 # func(n) is a reference to a perl function or a man page
732 s{
733 ([:\w]+)
734 (
735 \( [^\051]+ \)
736 )
737 } {I<$1>\\|$2}gx;
738
739 # convert simple variable references
740 s/(\s+)([\$\@%][\w:]+)(?!\()/${1}C<$2>/g;
741
742 if (m{ (
743 [\-\w]+
744 \(
745 [^\051]*?
746 [\@\$,]
747 [^\051]*?
748 \)
749 )
750 }x && $` !~ /([LCI]<[^<>]*|-)$/ && !/^=\w/)
751 {
752 warn "$0: bad option in paragraph $. of $ARGV: ``$1'' should be [LCI]<$1>\n";
753 $oops++;
754 }
755
756 while (/(-[a-zA-Z])\b/g && $` !~ /[\w\-]$/) {
757 warn "$0: bad option in paragraph $. of $ARGV: ``$1'' should be [CB]<$1>\n";
758 $oops++;
759 }
760
761 # put it back so we get the <> processed again;
762 clear_noremap(0); # 0 means leave the E's
763
764 } else {
765 # trofficate backslashes
766 s/\\/noremap('\\e')/ge;
767
768 }
769
770 # need to hide E<> first; they're processed in clear_noremap
771 s/(E<[^<>]+>)/noremap($1)/ge;
772
773
774 $maxnest = 10;
775 while ($maxnest-- && /[A-Z]</) {
776
777 # can't do C font here
778 s/([BI])<($nonest)>/font($1) . $2 . font('R')/eg;
779
780 # files and filelike refs in italics
781 s/F<($nonest)>/I<$1>/g;
782
783 # no break -- usually we want C<> for this
784 s/S<($nonest)>/nobreak($1)/eg;
785
786 # LREF: a la HREF L<show this text|man/section>
787 s:L<([^|>]+)\|[^>]+>:$1:g;
788
789 # LREF: a manpage(3f)
790 s:L<([a-zA-Z][^\s\/]+)(\([^\)]+\))?>:the I<$1>$2 manpage:g;
791
792 # LREF: an =item on another manpage
793 s{
794 L<
795 ([^/]+)
796 /
797 (
798 [:\w]+
799 (\(\))?
800 )
801 >
802 } {the C<$2> entry in the I<$1> manpage}gx;
803
804 # LREF: an =item on this manpage
805 s{
806 ((?:
807 L<
808 /
809 (
810 [:\w]+
811 (\(\))?
812 )
813 >
814 (,?\s+(and\s+)?)?
815 )+)
816 } { internal_lrefs($1) }gex;
817
818 # LREF: a =head2 (head1?), maybe on a manpage, maybe right here
819 # the "func" can disambiguate
820 s{
821 L<
822 (?:
823 ([a-zA-Z]\S+?) /
824 )?
825 "?(.*?)"?
826 >
827 }{
828 do {
829 $1 # if no $1, assume it means on this page.
830 ? "the section on I<$2> in the I<$1> manpage"
831 : "the section on I<$2>"
832 }
833 }gesx; # s in case it goes over multiple lines, so . matches \n
834
835 s/Z<>/\\&/g;
836
837 # comes last because not subject to reprocessing
838 s/C<($nonest)>/noremap("${CFont_embed}${1}\\fR")/eg;
839 }
840
841 if (s/^=//) {
842 $needspace = 0; # Assume this.
843
844 s/\n/ /g;
845
846 ($Cmd, $_) = split(' ', $_, 2);
847
848 $dotlevel = 1;
849 if ($Cmd eq 'head1') {
850 $dotlevel = 1;
851 }
852 elsif ($Cmd eq 'head2') {
853 $dotlevel = 1;
854 }
855 elsif ($Cmd eq 'item') {
856 $dotlevel = 2;
857 }
858
859 if (defined $_) {
860 &escapes($dotlevel);
861 s/"/""/g;
862 }
863
864 clear_noremap(1);
865
866 if ($Cmd eq 'cut') {
867 $cutting = 1;
868 }
869 elsif ($Cmd eq 'head1') {
870 s/\s+$//;
871 delete $wanna_see{$_} if exists $wanna_see{$_};
872 print qq{.SH "$_"\n};
873 push(@Indices, qq{.IX Header "$_"\n});
874 }
875 elsif ($Cmd eq 'head2') {
876 print qq{.Sh "$_"\n};
877 push(@Indices, qq{.IX Subsection "$_"\n});
878 }
879 elsif ($Cmd eq 'over') {
880 push(@indent,$indent);
881 $indent += ($_ + 0) || 5;
882 }
883 elsif ($Cmd eq 'back') {
884 $indent = pop(@indent);
885 warn "$0: Unmatched =back in paragraph $. of $ARGV\n" unless defined $indent;
886 $needspace = 1;
887 }
888 elsif ($Cmd eq 'item') {
889 s/^\*( |$)/\\(bu$1/g;
890 # if you know how to get ":s please do
891 s/\\\*\(L"([^"]+?)\\\*\(R"/'$1'/g;
892 s/\\\*\(L"([^"]+?)""/'$1'/g;
893 s/[^"]""([^"]+?)""[^"]/'$1'/g;
894 # here do something about the $" in perlvar?
895 print STDOUT qq{.Ip "$_" $indent\n};
896 push(@Indices, qq{.IX Item "$_"\n});
897 }
898 elsif ($Cmd eq 'pod') {
899 # this is just a comment
900 }
901 else {
902 warn "$0: Unrecognized pod directive in paragraph $. of $ARGV: $Cmd\n";
903 }
904 }
905 else {
906 if ($needspace) {
907 &makespace;
908 }
909 &escapes(0);
910 clear_noremap(1);
911 print $_, "\n";
912 $needspace = 1;
913 }
914}
915
916print <<"END";
917
918.rn }` ''
919END
920
921if (%wanna_see && !$lax) {
922 @missing = keys %wanna_see;
923 warn "$0: $Filename is missing required section"
924 . (@missing > 1 && "s")
925 . ": @missing\n";
926 $oops++;
927}
928
929foreach (@Indices) { print "$_\n"; }
930
931exit;
932#exit ($oops != 0);
933
934#########################################################################
935
936sub nobreak {
937 my $string = shift;
938 $string =~ s/ /\\ /g;
939 $string;
940}
941
942sub escapes {
943 my $indot = shift;
944
945 s/X<(.*?)>/mkindex($1)/ge;
946
947 # translate the minus in foo-bar into foo\-bar for roff
948 s/([^0-9a-z-])-([^-])/$1\\-$2/g;
949
950 # make -- into the string version \*(-- (defined above)
951 s/\b--\b/\\*(--/g;
952 s/"--([^"])/"\\*(--$1/g; # should be a better way
953 s/([^"])--"/$1\\*(--"/g;
954
955 # fix up quotes; this is somewhat tricky
956 my $dotmacroL = 'L';
957 my $dotmacroR = 'R';
958 if ( $indot == 1 ) {
959 $dotmacroL = 'M';
960 $dotmacroR = 'S';
961 }
962 elsif ( $indot >= 2 ) {
963 $dotmacroL = 'N';
964 $dotmacroR = 'T';
965 }
966 if (!/""/) {
967 s/(^|\s)(['"])/noremap("$1\\*($dotmacroL$2")/ge;
968 s/(['"])($|[\-\s,;\\!?.])/noremap("\\*($dotmacroR$1$2")/ge;
969 }
970
971 #s/(?!")(?:.)--(?!")(?:.)/\\*(--/g;
972 #s/(?:(?!")(?:.)--(?:"))|(?:(?:")--(?!")(?:.))/\\*(--/g;
973
974
975 # make sure that func() keeps a bit a space tween the parens
976 ### s/\b\(\)/\\|()/g;
977 ### s/\b\(\)/(\\|)/g;
978
979 # make C++ into \*C+, which is a squinched version (defined above)
980 s/\bC\+\+/\\*(C+/g;
981
982 # make double underbars have a little tiny space between them
983 s/__/_\\|_/g;
984
985 # PI goes to \*(PI (defined above)
986 s/\bPI\b/noremap('\\*(PI')/ge;
987
988 # make all caps a teeny bit smaller, but don't muck with embedded code literals
989 my $hidCFont = font('C');
990 if ($Cmd !~ /^head1/) { # SH already makes smaller
991 # /g isn't enough; 1 while or we'll be off
992
993# 1 while s{
994# (?!$hidCFont)(..|^.|^)
995# \b
996# (
997# [A-Z][\/A-Z+:\-\d_$.]+
998# )
999# (s?)
1000# \b
1001# } {$1\\s-1$2\\s0}gmox;
1002
1003 1 while s{
1004 (?!$hidCFont)(..|^.|^)
1005 (
1006 \b[A-Z]{2,}[\/A-Z+:\-\d_\$]*\b
1007 )
1008 } {
1009 $1 . noremap( '\\s-1' . $2 . '\\s0' )
1010 }egmox;
1011
1012 }
1013}
1014
1015# make troff just be normal, but make small nroff get quoted
1016# decided to just put the quotes in the text; sigh;
1017sub ccvt {
1018 local($_,$prev) = @_;
1019 noremap(qq{.CQ "$_" \n\\&});
1020}
1021
1022sub makespace {
1023 if ($indent) {
1024 print ".Sp\n";
1025 }
1026 else {
1027 print ".PP\n";
1028 }
1029}
1030
1031sub mkindex {
1032 my ($entry) = @_;
1033 my @entries = split m:\s*/\s*:, $entry;
1034 push @Indices, ".IX Xref " . join ' ', map {qq("$_")} @entries;
1035 return '';
1036}
1037
1038sub font {
1039 local($font) = shift;
1040 return '\\f' . noremap($font);
1041}
1042
1043sub noremap {
1044 local($thing_to_hide) = shift;
1045 $thing_to_hide =~ tr/\000-\177/\200-\377/;
1046 return $thing_to_hide;
1047}
1048
1049sub init_noremap {
1050 # escape high bit characters in input stream
1051 s/([\200-\377])/"E<".ord($1).">"/ge;
1052}
1053
1054sub clear_noremap {
1055 my $ready_to_print = $_[0];
1056
1057 tr/\200-\377/\000-\177/;
1058
1059 # trofficate backslashes
1060 # s/(?!\\e)(?:..|^.|^)\\/\\e/g;
1061
1062 # now for the E<>s, which have been hidden until now
1063 # otherwise the interative \w<> processing would have
1064 # been hosed by the E<gt>
1065 s {
1066 E<
1067 (
1068 ( \d + )
1069 | ( [A-Za-z]+ )
1070 )
1071 >
1072 } {
1073 do {
1074 defined $2
1075 ? chr($2)
1076 :
1077 exists $HTML_Escapes{$3}
1078 ? do { $HTML_Escapes{$3} }
1079 : do {
1080 warn "$0: Unknown escape in paragraph $. of $ARGV: ``$&''\n";
1081 "E<$1>";
1082 }
1083 }
1084 }egx if $ready_to_print;
1085}
1086
1087sub internal_lrefs {
1088 local($_) = shift;
1089 local $trailing_and = s/and\s+$// ? "and " : "";
1090
1091 s{L</([^>]+)>}{$1}g;
1092 my(@items) = split( /(?:,?\s+(?:and\s+)?)/ );
1093 my $retstr = "the ";
1094 my $i;
1095 for ($i = 0; $i <= $#items; $i++) {
1096 $retstr .= "C<$items[$i]>";
1097 $retstr .= ", " if @items > 2 && $i != $#items;
1098 $retstr .= " and " if $i+2 == @items;
1099 }
1100
1101 $retstr .= " entr" . ( @items > 1 ? "ies" : "y" )
1102 . " elsewhere in this document";
1103 # terminal space to avoid words running together (pattern used
1104 # strips terminal spaces)
1105 $retstr .= " " if length $trailing_and;
1106 $retstr .= $trailing_and;
1107
1108 return $retstr;
1109
1110}
1111
1112BEGIN {
1113%HTML_Escapes = (
1114 'amp' => '&', # ampersand
1115 'lt' => '<', # left chevron, less-than
1116 'gt' => '>', # right chevron, greater-than
1117 'quot' => '"', # double quote
1118
1119 "Aacute" => "A\\*'", # capital A, acute accent
1120 "aacute" => "a\\*'", # small a, acute accent
1121 "Acirc" => "A\\*^", # capital A, circumflex accent
1122 "acirc" => "a\\*^", # small a, circumflex accent
1123 "AElig" => '\*(AE', # capital AE diphthong (ligature)
1124 "aelig" => '\*(ae', # small ae diphthong (ligature)
1125 "Agrave" => "A\\*`", # capital A, grave accent
1126 "agrave" => "A\\*`", # small a, grave accent
1127 "Aring" => 'A\\*o', # capital A, ring
1128 "aring" => 'a\\*o', # small a, ring
1129 "Atilde" => 'A\\*~', # capital A, tilde
1130 "atilde" => 'a\\*~', # small a, tilde
1131 "Auml" => 'A\\*:', # capital A, dieresis or umlaut mark
1132 "auml" => 'a\\*:', # small a, dieresis or umlaut mark
1133 "Ccedil" => 'C\\*,', # capital C, cedilla
1134 "ccedil" => 'c\\*,', # small c, cedilla
1135 "Eacute" => "E\\*'", # capital E, acute accent
1136 "eacute" => "e\\*'", # small e, acute accent
1137 "Ecirc" => "E\\*^", # capital E, circumflex accent
1138 "ecirc" => "e\\*^", # small e, circumflex accent
1139 "Egrave" => "E\\*`", # capital E, grave accent
1140 "egrave" => "e\\*`", # small e, grave accent
1141 "ETH" => '\\*(D-', # capital Eth, Icelandic
1142 "eth" => '\\*(d-', # small eth, Icelandic
1143 "Euml" => "E\\*:", # capital E, dieresis or umlaut mark
1144 "euml" => "e\\*:", # small e, dieresis or umlaut mark
1145 "Iacute" => "I\\*'", # capital I, acute accent
1146 "iacute" => "i\\*'", # small i, acute accent
1147 "Icirc" => "I\\*^", # capital I, circumflex accent
1148 "icirc" => "i\\*^", # small i, circumflex accent
1149 "Igrave" => "I\\*`", # capital I, grave accent
1150 "igrave" => "i\\*`", # small i, grave accent
1151 "Iuml" => "I\\*:", # capital I, dieresis or umlaut mark
1152 "iuml" => "i\\*:", # small i, dieresis or umlaut mark
1153 "Ntilde" => 'N\*~', # capital N, tilde
1154 "ntilde" => 'n\*~', # small n, tilde
1155 "Oacute" => "O\\*'", # capital O, acute accent
1156 "oacute" => "o\\*'", # small o, acute accent
1157 "Ocirc" => "O\\*^", # capital O, circumflex accent
1158 "ocirc" => "o\\*^", # small o, circumflex accent
1159 "Ograve" => "O\\*`", # capital O, grave accent
1160 "ograve" => "o\\*`", # small o, grave accent
1161 "Oslash" => "O\\*/", # capital O, slash
1162 "oslash" => "o\\*/", # small o, slash
1163 "Otilde" => "O\\*~", # capital O, tilde
1164 "otilde" => "o\\*~", # small o, tilde
1165 "Ouml" => "O\\*:", # capital O, dieresis or umlaut mark
1166 "ouml" => "o\\*:", # small o, dieresis or umlaut mark
1167 "szlig" => '\*8', # small sharp s, German (sz ligature)
1168 "THORN" => '\\*(Th', # capital THORN, Icelandic
1169 "thorn" => '\\*(th',, # small thorn, Icelandic
1170 "Uacute" => "U\\*'", # capital U, acute accent
1171 "uacute" => "u\\*'", # small u, acute accent
1172 "Ucirc" => "U\\*^", # capital U, circumflex accent
1173 "ucirc" => "u\\*^", # small u, circumflex accent
1174 "Ugrave" => "U\\*`", # capital U, grave accent
1175 "ugrave" => "u\\*`", # small u, grave accent
1176 "Uuml" => "U\\*:", # capital U, dieresis or umlaut mark
1177 "uuml" => "u\\*:", # small u, dieresis or umlaut mark
1178 "Yacute" => "Y\\*'", # capital Y, acute accent
1179 "yacute" => "y\\*'", # small y, acute accent
1180 "yuml" => "y\\*:", # small y, dieresis or umlaut mark
1181);
1182}
1183
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..4790e08f8a
--- /dev/null
+++ b/src/lib/libcrypto/util/point.sh
@@ -0,0 +1,10 @@
1#!/bin/sh
2
3rm -f "$2"
4if test "$OSTYPE" = msdosdjgpp; 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..e9d5aa8938
--- /dev/null
+++ b/src/lib/libcrypto/util/selftest.pl
@@ -0,0 +1,195 @@
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 =~ "usage";
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 <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 <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$_=$options;
134s/no-asm//;
135s/no-shared//;
136s/no-krb5//;
137if (/no-/)
138{
139 print OUT "Test skipped.\n";
140 goto err;
141}
142
143print "Running make test...\n";
144if (system("make test 2>&1 | tee maketest.log") > 255)
145 {
146 print OUT "make test failed!\n";
147} else {
148 $ok=1;
149}
150
151if ($ok and open(IN,"<maketest.log")) {
152 while (<IN>) {
153 $ok=2 if /^platform: $platform/;
154 }
155 close(IN);
156}
157
158if ($ok != 2) {
159 print OUT "Failure!\n";
160 if (open(IN,"<make.log")) {
161 print OUT $sep;
162 while (<IN>) {
163 print OUT;
164 }
165 close(IN);
166 print OUT $sep;
167 } else {
168 print OUT "make.log not found!\n";
169 }
170 if (open(IN,"<maketest.log")) {
171 while (<IN>) {
172 print OUT;
173 }
174 close(IN);
175 print OUT $sep;
176 } else {
177 print OUT "maketest.log not found!\n";
178 }
179} else {
180 print OUT "Test passed.\n";
181}
182err:
183close(OUT);
184
185print "\n";
186open(IN,"<$report") or die;
187while (<IN>) {
188 if (/$sep/) {
189 print "[...]\n";
190 last;
191 }
192 print;
193}
194print "\nTest report in file $report\n";
195
diff --git a/src/lib/libcrypto/util/shlib_wrap.sh b/src/lib/libcrypto/util/shlib_wrap.sh
new file mode 100755
index 0000000000..dc5f5b1ce4
--- /dev/null
+++ b/src/lib/libcrypto/util/shlib_wrap.sh
@@ -0,0 +1,70 @@
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*)
26 [ -n "$LD_LIBRARY_PATH_64" ] && rld_var=LD_LIBRARY_PATH_64
27 ;;
28 *ELF\ N32*MIPS*)
29 [ -n "$LD_LIBRARYN32_PATH" ] && rld_var=LD_LIBRARYN32_PATH
30 _RLDN32_LIST="$LIBCRYPTOSO:$LIBSSLSO:DEFAULT"; export _RLDN32_LIST
31 ;;
32 *ELF\ 64*MIPS*)
33 [ -n "$LD_LIBRARY64_PATH" ] && rld_var=LD_LIBRARY64_PATH
34 _RLD64_LIST="$LIBCRYPTOSO:$LIBSSLSO:DEFAULT"; export _RLD64_LIST
35 ;;
36 esac
37 eval $rld_var=\"${THERE}:'$'$rld_var\"; export $rld_var
38 unset rld_var
39 ;;
40*) LD_LIBRARY_PATH="${THERE}:$LD_LIBRARY_PATH" # Linux, ELF HP-UX
41 DYLD_LIBRARY_PATH="${THERE}:$DYLD_LIBRARY_PATH" # MacOS X
42 SHLIB_PATH="${THERE}:$SHLIB_PATH" # legacy HP-UX
43 LIBPATH="${THERE}:$LIBPATH" # AIX, OS/2
44 export LD_LIBRARY_PATH DYLD_LIBRARY_PATH SHLIB_PATH LIBPATH
45 # Even though $PATH is adjusted [for Windows sake], it doesn't
46 # necessarily does the trick. Trouble is that with introduction
47 # of SafeDllSearchMode in XP/2003 it's more appropriate to copy
48 # .DLLs in vicinity of executable, which is done elsewhere...
49 if [ "$OSTYPE" != msdosdjgpp ]; then
50 PATH="${THERE}:$PATH"; export PATH
51 fi
52 ;;
53esac
54
55if [ -f "$LIBCRYPTOSO" ]; then
56 # Following three lines are major excuse for isolating them into
57 # this wrapper script. Original reason for setting LD_PRELOAD
58 # was to make it possible to pass 'make test' when user linked
59 # with -rpath pointing to previous version installation. Wrapping
60 # it into a script makes it possible to do so on multi-ABI
61 # platforms.
62 case "$SYSNAME" in
63 *BSD) LD_PRELOAD="$LIBCRYPTOSO:$LIBSSLSO" ;; # *BSD
64 *) LD_PRELOAD="$LIBCRYPTOSO $LIBSSLSO" ;; # SunOS, Linux, ELF HP-UX
65 esac
66 _RLD_LIST="$LIBCRYPTOSO:$LIBSSLSO:DEFAULT" # Tru64, o32 IRIX
67 export LD_PRELOAD _RLD_LIST
68fi
69
70exec "$@"
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..46e38a131f
--- /dev/null
+++ b/src/lib/libcrypto/util/ssleay.num
@@ -0,0 +1,217 @@
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
102SSLv2_method 114 EXIST::FUNCTION:RSA
103SSLv2_server_method 115 EXIST::FUNCTION:RSA
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 EXIST::FUNCTION:
121SSL_SESSION_hash 133 EXIST::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 NOEXIST::FUNCTION:
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:
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/x509/Makefile b/src/lib/libcrypto/x509/Makefile
new file mode 100644
index 0000000000..ee3f8a4a23
--- /dev/null
+++ b/src/lib/libcrypto/x509/Makefile
@@ -0,0 +1,592 @@
1#
2# OpenSSL/crypto/x509/Makefile
3#
4
5DIR= x509
6TOP= ../..
7CC= cc
8INCLUDES= -I.. -I$(TOP) -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
18CFLAGS= $(INCLUDES) $(CFLAG)
19
20GENERAL=Makefile README
21TEST=
22APPS=
23
24LIB=$(TOP)/libcrypto.a
25LIBSRC= x509_def.c x509_d2.c x509_r2x.c x509_cmp.c \
26 x509_obj.c x509_req.c x509spki.c x509_vfy.c \
27 x509_set.c x509cset.c x509rset.c x509_err.c \
28 x509name.c x509_v3.c x509_ext.c x509_att.c \
29 x509type.c x509_lu.c x_all.c x509_txt.c \
30 x509_trs.c by_file.c by_dir.c
31LIBOBJ= x509_def.o x509_d2.o x509_r2x.o x509_cmp.o \
32 x509_obj.o x509_req.o x509spki.o x509_vfy.o \
33 x509_set.o x509cset.o x509rset.o x509_err.o \
34 x509name.o x509_v3.o x509_ext.o x509_att.o \
35 x509type.o x509_lu.o x_all.o x509_txt.o \
36 x509_trs.o by_file.o by_dir.o
37
38SRC= $(LIBSRC)
39
40EXHEADER= x509.h x509_vfy.h
41HEADER= $(EXHEADER)
42
43ALL= $(GENERAL) $(SRC) $(HEADER)
44
45top:
46 (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all)
47
48all: lib
49
50lib: $(LIBOBJ)
51 $(AR) $(LIB) $(LIBOBJ)
52 $(RANLIB) $(LIB) || echo Never mind.
53 @touch lib
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 @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
73tests:
74
75lint:
76 lint -DLINT $(INCLUDES) $(SRC)>fluff
77
78depend:
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
90by_dir.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
91by_dir.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
92by_dir.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
93by_dir.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
94by_dir.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
95by_dir.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
96by_dir.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
97by_dir.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
98by_dir.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
99by_dir.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
100by_dir.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
101by_dir.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
102by_dir.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
103by_dir.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
104by_dir.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
105by_dir.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
106by_dir.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
107by_dir.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
108by_dir.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
109by_dir.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
110by_dir.o: ../cryptlib.h by_dir.c
111by_file.o: ../../e_os.h ../../include/openssl/aes.h
112by_file.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
113by_file.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
114by_file.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
115by_file.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
116by_file.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
117by_file.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
118by_file.o: ../../include/openssl/err.h ../../include/openssl/evp.h
119by_file.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
120by_file.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
121by_file.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
122by_file.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
123by_file.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
124by_file.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pem.h
125by_file.o: ../../include/openssl/pem2.h ../../include/openssl/pkcs7.h
126by_file.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
127by_file.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
128by_file.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
129by_file.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
130by_file.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
131by_file.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h
132by_file.o: ../../include/openssl/x509_vfy.h ../cryptlib.h by_file.c
133x509_att.o: ../../e_os.h ../../include/openssl/aes.h
134x509_att.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
135x509_att.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
136x509_att.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
137x509_att.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
138x509_att.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
139x509_att.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
140x509_att.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
141x509_att.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
142x509_att.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
143x509_att.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
144x509_att.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
145x509_att.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
146x509_att.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
147x509_att.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
148x509_att.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
149x509_att.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
150x509_att.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
151x509_att.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
152x509_att.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
153x509_att.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
154x509_att.o: ../../include/openssl/x509v3.h ../cryptlib.h x509_att.c
155x509_cmp.o: ../../e_os.h ../../include/openssl/aes.h
156x509_cmp.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
157x509_cmp.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
158x509_cmp.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
159x509_cmp.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
160x509_cmp.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
161x509_cmp.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
162x509_cmp.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
163x509_cmp.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
164x509_cmp.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
165x509_cmp.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
166x509_cmp.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
167x509_cmp.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
168x509_cmp.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
169x509_cmp.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
170x509_cmp.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
171x509_cmp.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
172x509_cmp.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
173x509_cmp.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
174x509_cmp.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
175x509_cmp.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
176x509_cmp.o: ../../include/openssl/x509v3.h ../cryptlib.h x509_cmp.c
177x509_d2.o: ../../e_os.h ../../include/openssl/aes.h
178x509_d2.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
179x509_d2.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
180x509_d2.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
181x509_d2.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
182x509_d2.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
183x509_d2.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
184x509_d2.o: ../../include/openssl/err.h ../../include/openssl/evp.h
185x509_d2.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
186x509_d2.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
187x509_d2.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
188x509_d2.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
189x509_d2.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
190x509_d2.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
191x509_d2.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
192x509_d2.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
193x509_d2.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
194x509_d2.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
195x509_d2.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
196x509_d2.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h
197x509_d2.o: ../../include/openssl/x509_vfy.h ../cryptlib.h x509_d2.c
198x509_def.o: ../../e_os.h ../../include/openssl/aes.h
199x509_def.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
200x509_def.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
201x509_def.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
202x509_def.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
203x509_def.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
204x509_def.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
205x509_def.o: ../../include/openssl/err.h ../../include/openssl/evp.h
206x509_def.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
207x509_def.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
208x509_def.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
209x509_def.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
210x509_def.o: ../../include/openssl/opensslconf.h
211x509_def.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
212x509_def.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
213x509_def.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
214x509_def.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
215x509_def.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
216x509_def.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
217x509_def.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
218x509_def.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
219x509_def.o: ../cryptlib.h x509_def.c
220x509_err.o: ../../include/openssl/aes.h ../../include/openssl/asn1.h
221x509_err.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
222x509_err.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
223x509_err.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
224x509_err.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
225x509_err.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
226x509_err.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
227x509_err.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
228x509_err.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
229x509_err.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
230x509_err.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
231x509_err.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
232x509_err.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
233x509_err.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
234x509_err.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
235x509_err.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
236x509_err.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
237x509_err.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
238x509_err.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
239x509_err.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
240x509_err.o: x509_err.c
241x509_ext.o: ../../e_os.h ../../include/openssl/aes.h
242x509_ext.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
243x509_ext.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
244x509_ext.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
245x509_ext.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
246x509_ext.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
247x509_ext.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
248x509_ext.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
249x509_ext.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
250x509_ext.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
251x509_ext.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
252x509_ext.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
253x509_ext.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
254x509_ext.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
255x509_ext.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
256x509_ext.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
257x509_ext.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
258x509_ext.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
259x509_ext.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
260x509_ext.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
261x509_ext.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
262x509_ext.o: ../../include/openssl/x509v3.h ../cryptlib.h x509_ext.c
263x509_lu.o: ../../e_os.h ../../include/openssl/aes.h
264x509_lu.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
265x509_lu.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
266x509_lu.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
267x509_lu.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
268x509_lu.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
269x509_lu.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
270x509_lu.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
271x509_lu.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
272x509_lu.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
273x509_lu.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
274x509_lu.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
275x509_lu.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
276x509_lu.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
277x509_lu.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
278x509_lu.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
279x509_lu.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
280x509_lu.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
281x509_lu.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
282x509_lu.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
283x509_lu.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
284x509_lu.o: ../../include/openssl/x509v3.h ../cryptlib.h x509_lu.c
285x509_obj.o: ../../e_os.h ../../include/openssl/aes.h
286x509_obj.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
287x509_obj.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
288x509_obj.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
289x509_obj.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
290x509_obj.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
291x509_obj.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
292x509_obj.o: ../../include/openssl/err.h ../../include/openssl/evp.h
293x509_obj.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
294x509_obj.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
295x509_obj.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
296x509_obj.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
297x509_obj.o: ../../include/openssl/opensslconf.h
298x509_obj.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
299x509_obj.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
300x509_obj.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
301x509_obj.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
302x509_obj.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
303x509_obj.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
304x509_obj.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
305x509_obj.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
306x509_obj.o: ../cryptlib.h x509_obj.c
307x509_r2x.o: ../../e_os.h ../../include/openssl/aes.h
308x509_r2x.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
309x509_r2x.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
310x509_r2x.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
311x509_r2x.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
312x509_r2x.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
313x509_r2x.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
314x509_r2x.o: ../../include/openssl/err.h ../../include/openssl/evp.h
315x509_r2x.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
316x509_r2x.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
317x509_r2x.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
318x509_r2x.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
319x509_r2x.o: ../../include/openssl/opensslconf.h
320x509_r2x.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
321x509_r2x.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
322x509_r2x.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
323x509_r2x.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
324x509_r2x.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
325x509_r2x.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
326x509_r2x.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
327x509_r2x.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
328x509_r2x.o: ../cryptlib.h x509_r2x.c
329x509_req.o: ../../e_os.h ../../include/openssl/aes.h
330x509_req.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
331x509_req.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
332x509_req.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
333x509_req.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
334x509_req.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
335x509_req.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
336x509_req.o: ../../include/openssl/err.h ../../include/openssl/evp.h
337x509_req.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
338x509_req.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
339x509_req.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
340x509_req.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
341x509_req.o: ../../include/openssl/opensslconf.h
342x509_req.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
343x509_req.o: ../../include/openssl/pem.h ../../include/openssl/pem2.h
344x509_req.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
345x509_req.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
346x509_req.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
347x509_req.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
348x509_req.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
349x509_req.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
350x509_req.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
351x509_req.o: ../cryptlib.h x509_req.c
352x509_set.o: ../../e_os.h ../../include/openssl/aes.h
353x509_set.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
354x509_set.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
355x509_set.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
356x509_set.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
357x509_set.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
358x509_set.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
359x509_set.o: ../../include/openssl/err.h ../../include/openssl/evp.h
360x509_set.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
361x509_set.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
362x509_set.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
363x509_set.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
364x509_set.o: ../../include/openssl/opensslconf.h
365x509_set.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
366x509_set.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
367x509_set.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
368x509_set.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
369x509_set.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
370x509_set.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
371x509_set.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
372x509_set.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
373x509_set.o: ../cryptlib.h x509_set.c
374x509_trs.o: ../../e_os.h ../../include/openssl/aes.h
375x509_trs.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
376x509_trs.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
377x509_trs.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
378x509_trs.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
379x509_trs.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
380x509_trs.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
381x509_trs.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
382x509_trs.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
383x509_trs.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
384x509_trs.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
385x509_trs.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
386x509_trs.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
387x509_trs.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
388x509_trs.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
389x509_trs.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
390x509_trs.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
391x509_trs.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
392x509_trs.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
393x509_trs.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
394x509_trs.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
395x509_trs.o: ../../include/openssl/x509v3.h ../cryptlib.h x509_trs.c
396x509_txt.o: ../../e_os.h ../../include/openssl/aes.h
397x509_txt.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
398x509_txt.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
399x509_txt.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
400x509_txt.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
401x509_txt.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
402x509_txt.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
403x509_txt.o: ../../include/openssl/err.h ../../include/openssl/evp.h
404x509_txt.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
405x509_txt.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
406x509_txt.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
407x509_txt.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
408x509_txt.o: ../../include/openssl/opensslconf.h
409x509_txt.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
410x509_txt.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
411x509_txt.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
412x509_txt.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
413x509_txt.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
414x509_txt.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
415x509_txt.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
416x509_txt.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
417x509_txt.o: ../cryptlib.h x509_txt.c
418x509_v3.o: ../../e_os.h ../../include/openssl/aes.h
419x509_v3.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
420x509_v3.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
421x509_v3.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
422x509_v3.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
423x509_v3.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
424x509_v3.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
425x509_v3.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
426x509_v3.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
427x509_v3.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
428x509_v3.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
429x509_v3.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
430x509_v3.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
431x509_v3.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
432x509_v3.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
433x509_v3.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
434x509_v3.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
435x509_v3.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
436x509_v3.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
437x509_v3.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
438x509_v3.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
439x509_v3.o: ../../include/openssl/x509v3.h ../cryptlib.h x509_v3.c
440x509_vfy.o: ../../e_os.h ../../include/openssl/aes.h
441x509_vfy.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
442x509_vfy.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
443x509_vfy.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
444x509_vfy.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
445x509_vfy.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
446x509_vfy.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
447x509_vfy.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
448x509_vfy.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
449x509_vfy.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
450x509_vfy.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
451x509_vfy.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
452x509_vfy.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
453x509_vfy.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
454x509_vfy.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
455x509_vfy.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
456x509_vfy.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
457x509_vfy.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
458x509_vfy.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
459x509_vfy.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
460x509_vfy.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
461x509_vfy.o: ../../include/openssl/x509v3.h ../cryptlib.h x509_vfy.c
462x509cset.o: ../../e_os.h ../../include/openssl/aes.h
463x509cset.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
464x509cset.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
465x509cset.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
466x509cset.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
467x509cset.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
468x509cset.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
469x509cset.o: ../../include/openssl/err.h ../../include/openssl/evp.h
470x509cset.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
471x509cset.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
472x509cset.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
473x509cset.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
474x509cset.o: ../../include/openssl/opensslconf.h
475x509cset.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
476x509cset.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
477x509cset.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
478x509cset.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
479x509cset.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
480x509cset.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
481x509cset.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
482x509cset.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
483x509cset.o: ../cryptlib.h x509cset.c
484x509name.o: ../../e_os.h ../../include/openssl/aes.h
485x509name.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
486x509name.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
487x509name.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
488x509name.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
489x509name.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
490x509name.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
491x509name.o: ../../include/openssl/err.h ../../include/openssl/evp.h
492x509name.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
493x509name.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
494x509name.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
495x509name.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
496x509name.o: ../../include/openssl/opensslconf.h
497x509name.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
498x509name.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
499x509name.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
500x509name.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
501x509name.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
502x509name.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
503x509name.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
504x509name.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
505x509name.o: ../cryptlib.h x509name.c
506x509rset.o: ../../e_os.h ../../include/openssl/aes.h
507x509rset.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
508x509rset.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
509x509rset.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
510x509rset.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
511x509rset.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
512x509rset.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
513x509rset.o: ../../include/openssl/err.h ../../include/openssl/evp.h
514x509rset.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
515x509rset.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
516x509rset.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
517x509rset.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
518x509rset.o: ../../include/openssl/opensslconf.h
519x509rset.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
520x509rset.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
521x509rset.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
522x509rset.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
523x509rset.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
524x509rset.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
525x509rset.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
526x509rset.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
527x509rset.o: ../cryptlib.h x509rset.c
528x509spki.o: ../../e_os.h ../../include/openssl/aes.h
529x509spki.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
530x509spki.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
531x509spki.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
532x509spki.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
533x509spki.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
534x509spki.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
535x509spki.o: ../../include/openssl/err.h ../../include/openssl/evp.h
536x509spki.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
537x509spki.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
538x509spki.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
539x509spki.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
540x509spki.o: ../../include/openssl/opensslconf.h
541x509spki.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
542x509spki.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
543x509spki.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
544x509spki.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
545x509spki.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
546x509spki.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
547x509spki.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
548x509spki.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
549x509spki.o: ../cryptlib.h x509spki.c
550x509type.o: ../../e_os.h ../../include/openssl/aes.h
551x509type.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
552x509type.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
553x509type.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
554x509type.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
555x509type.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
556x509type.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
557x509type.o: ../../include/openssl/err.h ../../include/openssl/evp.h
558x509type.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
559x509type.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
560x509type.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
561x509type.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
562x509type.o: ../../include/openssl/opensslconf.h
563x509type.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
564x509type.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
565x509type.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
566x509type.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
567x509type.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
568x509type.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
569x509type.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
570x509type.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
571x509type.o: ../cryptlib.h x509type.c
572x_all.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
573x_all.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
574x_all.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
575x_all.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
576x_all.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
577x_all.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
578x_all.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
579x_all.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
580x_all.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
581x_all.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
582x_all.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
583x_all.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
584x_all.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
585x_all.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
586x_all.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
587x_all.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
588x_all.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
589x_all.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
590x_all.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
591x_all.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
592x_all.o: ../cryptlib.h x_all.c
diff --git a/src/lib/libcrypto/x509/Makefile.ssl b/src/lib/libcrypto/x509/Makefile.ssl
new file mode 100644
index 0000000000..3a3452536c
--- /dev/null
+++ b/src/lib/libcrypto/x509/Makefile.ssl
@@ -0,0 +1,594 @@
1#
2# SSLeay/crypto/x509/Makefile
3#
4
5DIR= x509
6TOP= ../..
7CC= cc
8INCLUDES= -I.. -I$(TOP) -I../../include
9CFLAG=-g
10INSTALL_PREFIX=
11OPENSSLDIR= /usr/local/ssl
12INSTALLTOP=/usr/local/ssl
13MAKE= make -f Makefile.ssl
14MAKEDEPPROG= makedepend
15MAKEDEPEND= $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG)
16MAKEFILE= Makefile.ssl
17AR= ar r
18
19CFLAGS= $(INCLUDES) $(CFLAG)
20
21GENERAL=Makefile README
22TEST=
23APPS=
24
25LIB=$(TOP)/libcrypto.a
26LIBSRC= x509_def.c x509_d2.c x509_r2x.c x509_cmp.c \
27 x509_obj.c x509_req.c x509spki.c x509_vfy.c \
28 x509_set.c x509cset.c x509rset.c x509_err.c \
29 x509name.c x509_v3.c x509_ext.c x509_att.c \
30 x509type.c x509_lu.c x_all.c x509_txt.c \
31 x509_trs.c by_file.c by_dir.c
32LIBOBJ= x509_def.o x509_d2.o x509_r2x.o x509_cmp.o \
33 x509_obj.o x509_req.o x509spki.o x509_vfy.o \
34 x509_set.o x509cset.o x509rset.o x509_err.o \
35 x509name.o x509_v3.o x509_ext.o x509_att.o \
36 x509type.o x509_lu.o x_all.o x509_txt.o \
37 x509_trs.o by_file.o by_dir.o
38
39SRC= $(LIBSRC)
40
41EXHEADER= x509.h x509_vfy.h
42HEADER= $(EXHEADER)
43
44ALL= $(GENERAL) $(SRC) $(HEADER)
45
46top:
47 (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all)
48
49all: lib
50
51lib: $(LIBOBJ)
52 $(AR) $(LIB) $(LIBOBJ)
53 $(RANLIB) $(LIB) || echo Never mind.
54 @touch lib
55
56files:
57 $(PERL) $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO
58
59links:
60 @sh $(TOP)/util/point.sh Makefile.ssl Makefile
61 @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
62 @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
63 @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
64
65install:
66 @for i in $(EXHEADER) ; \
67 do \
68 (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
69 chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
70 done;
71
72tags:
73 ctags $(SRC)
74
75tests:
76
77lint:
78 lint -DLINT $(INCLUDES) $(SRC)>fluff
79
80depend:
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 *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
89
90# DO NOT DELETE THIS LINE -- make depend depends on it.
91
92by_dir.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
93by_dir.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
94by_dir.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
95by_dir.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
96by_dir.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
97by_dir.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
98by_dir.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
99by_dir.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
100by_dir.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
101by_dir.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
102by_dir.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
103by_dir.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
104by_dir.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
105by_dir.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
106by_dir.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
107by_dir.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
108by_dir.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
109by_dir.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
110by_dir.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
111by_dir.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
112by_dir.o: ../cryptlib.h by_dir.c
113by_file.o: ../../e_os.h ../../include/openssl/aes.h
114by_file.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
115by_file.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
116by_file.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
117by_file.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
118by_file.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
119by_file.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
120by_file.o: ../../include/openssl/err.h ../../include/openssl/evp.h
121by_file.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
122by_file.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
123by_file.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
124by_file.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
125by_file.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
126by_file.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pem.h
127by_file.o: ../../include/openssl/pem2.h ../../include/openssl/pkcs7.h
128by_file.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
129by_file.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
130by_file.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
131by_file.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
132by_file.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
133by_file.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h
134by_file.o: ../../include/openssl/x509_vfy.h ../cryptlib.h by_file.c
135x509_att.o: ../../e_os.h ../../include/openssl/aes.h
136x509_att.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
137x509_att.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
138x509_att.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
139x509_att.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
140x509_att.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
141x509_att.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
142x509_att.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
143x509_att.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
144x509_att.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
145x509_att.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
146x509_att.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
147x509_att.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
148x509_att.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
149x509_att.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
150x509_att.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
151x509_att.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
152x509_att.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
153x509_att.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
154x509_att.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
155x509_att.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
156x509_att.o: ../../include/openssl/x509v3.h ../cryptlib.h x509_att.c
157x509_cmp.o: ../../e_os.h ../../include/openssl/aes.h
158x509_cmp.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
159x509_cmp.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
160x509_cmp.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
161x509_cmp.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
162x509_cmp.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
163x509_cmp.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
164x509_cmp.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
165x509_cmp.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
166x509_cmp.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
167x509_cmp.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
168x509_cmp.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
169x509_cmp.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
170x509_cmp.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
171x509_cmp.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
172x509_cmp.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
173x509_cmp.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
174x509_cmp.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
175x509_cmp.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
176x509_cmp.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
177x509_cmp.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
178x509_cmp.o: ../../include/openssl/x509v3.h ../cryptlib.h x509_cmp.c
179x509_d2.o: ../../e_os.h ../../include/openssl/aes.h
180x509_d2.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
181x509_d2.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
182x509_d2.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
183x509_d2.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
184x509_d2.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
185x509_d2.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
186x509_d2.o: ../../include/openssl/err.h ../../include/openssl/evp.h
187x509_d2.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
188x509_d2.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
189x509_d2.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
190x509_d2.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
191x509_d2.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
192x509_d2.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
193x509_d2.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
194x509_d2.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
195x509_d2.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
196x509_d2.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
197x509_d2.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
198x509_d2.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h
199x509_d2.o: ../../include/openssl/x509_vfy.h ../cryptlib.h x509_d2.c
200x509_def.o: ../../e_os.h ../../include/openssl/aes.h
201x509_def.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
202x509_def.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
203x509_def.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
204x509_def.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
205x509_def.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
206x509_def.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
207x509_def.o: ../../include/openssl/err.h ../../include/openssl/evp.h
208x509_def.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
209x509_def.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
210x509_def.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
211x509_def.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
212x509_def.o: ../../include/openssl/opensslconf.h
213x509_def.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
214x509_def.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
215x509_def.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
216x509_def.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
217x509_def.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
218x509_def.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
219x509_def.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
220x509_def.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
221x509_def.o: ../cryptlib.h x509_def.c
222x509_err.o: ../../include/openssl/aes.h ../../include/openssl/asn1.h
223x509_err.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
224x509_err.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
225x509_err.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
226x509_err.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
227x509_err.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
228x509_err.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
229x509_err.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
230x509_err.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
231x509_err.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
232x509_err.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
233x509_err.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
234x509_err.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
235x509_err.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
236x509_err.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
237x509_err.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
238x509_err.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
239x509_err.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
240x509_err.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
241x509_err.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
242x509_err.o: x509_err.c
243x509_ext.o: ../../e_os.h ../../include/openssl/aes.h
244x509_ext.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
245x509_ext.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
246x509_ext.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
247x509_ext.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
248x509_ext.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
249x509_ext.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
250x509_ext.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
251x509_ext.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
252x509_ext.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
253x509_ext.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
254x509_ext.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
255x509_ext.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
256x509_ext.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
257x509_ext.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
258x509_ext.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
259x509_ext.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
260x509_ext.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
261x509_ext.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
262x509_ext.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
263x509_ext.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
264x509_ext.o: ../../include/openssl/x509v3.h ../cryptlib.h x509_ext.c
265x509_lu.o: ../../e_os.h ../../include/openssl/aes.h
266x509_lu.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
267x509_lu.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
268x509_lu.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
269x509_lu.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
270x509_lu.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
271x509_lu.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
272x509_lu.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
273x509_lu.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
274x509_lu.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
275x509_lu.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
276x509_lu.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
277x509_lu.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
278x509_lu.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
279x509_lu.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
280x509_lu.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
281x509_lu.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
282x509_lu.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
283x509_lu.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
284x509_lu.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
285x509_lu.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
286x509_lu.o: ../../include/openssl/x509v3.h ../cryptlib.h x509_lu.c
287x509_obj.o: ../../e_os.h ../../include/openssl/aes.h
288x509_obj.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
289x509_obj.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
290x509_obj.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
291x509_obj.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
292x509_obj.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
293x509_obj.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
294x509_obj.o: ../../include/openssl/err.h ../../include/openssl/evp.h
295x509_obj.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
296x509_obj.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
297x509_obj.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
298x509_obj.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
299x509_obj.o: ../../include/openssl/opensslconf.h
300x509_obj.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
301x509_obj.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
302x509_obj.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
303x509_obj.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
304x509_obj.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
305x509_obj.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
306x509_obj.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
307x509_obj.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
308x509_obj.o: ../cryptlib.h x509_obj.c
309x509_r2x.o: ../../e_os.h ../../include/openssl/aes.h
310x509_r2x.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
311x509_r2x.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
312x509_r2x.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
313x509_r2x.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
314x509_r2x.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
315x509_r2x.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
316x509_r2x.o: ../../include/openssl/err.h ../../include/openssl/evp.h
317x509_r2x.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
318x509_r2x.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
319x509_r2x.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
320x509_r2x.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
321x509_r2x.o: ../../include/openssl/opensslconf.h
322x509_r2x.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
323x509_r2x.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
324x509_r2x.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
325x509_r2x.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
326x509_r2x.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
327x509_r2x.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
328x509_r2x.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
329x509_r2x.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
330x509_r2x.o: ../cryptlib.h x509_r2x.c
331x509_req.o: ../../e_os.h ../../include/openssl/aes.h
332x509_req.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
333x509_req.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
334x509_req.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
335x509_req.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
336x509_req.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
337x509_req.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
338x509_req.o: ../../include/openssl/err.h ../../include/openssl/evp.h
339x509_req.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
340x509_req.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
341x509_req.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
342x509_req.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
343x509_req.o: ../../include/openssl/opensslconf.h
344x509_req.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
345x509_req.o: ../../include/openssl/pem.h ../../include/openssl/pem2.h
346x509_req.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
347x509_req.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
348x509_req.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
349x509_req.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
350x509_req.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
351x509_req.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
352x509_req.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
353x509_req.o: ../cryptlib.h x509_req.c
354x509_set.o: ../../e_os.h ../../include/openssl/aes.h
355x509_set.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
356x509_set.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
357x509_set.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
358x509_set.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
359x509_set.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
360x509_set.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
361x509_set.o: ../../include/openssl/err.h ../../include/openssl/evp.h
362x509_set.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
363x509_set.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
364x509_set.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
365x509_set.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
366x509_set.o: ../../include/openssl/opensslconf.h
367x509_set.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
368x509_set.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
369x509_set.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
370x509_set.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
371x509_set.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
372x509_set.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
373x509_set.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
374x509_set.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
375x509_set.o: ../cryptlib.h x509_set.c
376x509_trs.o: ../../e_os.h ../../include/openssl/aes.h
377x509_trs.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
378x509_trs.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
379x509_trs.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
380x509_trs.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
381x509_trs.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
382x509_trs.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
383x509_trs.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
384x509_trs.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
385x509_trs.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
386x509_trs.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
387x509_trs.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
388x509_trs.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
389x509_trs.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
390x509_trs.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
391x509_trs.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
392x509_trs.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
393x509_trs.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
394x509_trs.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
395x509_trs.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
396x509_trs.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
397x509_trs.o: ../../include/openssl/x509v3.h ../cryptlib.h x509_trs.c
398x509_txt.o: ../../e_os.h ../../include/openssl/aes.h
399x509_txt.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
400x509_txt.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
401x509_txt.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
402x509_txt.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
403x509_txt.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
404x509_txt.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
405x509_txt.o: ../../include/openssl/err.h ../../include/openssl/evp.h
406x509_txt.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
407x509_txt.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
408x509_txt.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
409x509_txt.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
410x509_txt.o: ../../include/openssl/opensslconf.h
411x509_txt.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
412x509_txt.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
413x509_txt.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
414x509_txt.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
415x509_txt.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
416x509_txt.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
417x509_txt.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
418x509_txt.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
419x509_txt.o: ../cryptlib.h x509_txt.c
420x509_v3.o: ../../e_os.h ../../include/openssl/aes.h
421x509_v3.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
422x509_v3.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
423x509_v3.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
424x509_v3.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
425x509_v3.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
426x509_v3.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
427x509_v3.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
428x509_v3.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
429x509_v3.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
430x509_v3.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
431x509_v3.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
432x509_v3.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
433x509_v3.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
434x509_v3.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
435x509_v3.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
436x509_v3.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
437x509_v3.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
438x509_v3.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
439x509_v3.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
440x509_v3.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
441x509_v3.o: ../../include/openssl/x509v3.h ../cryptlib.h x509_v3.c
442x509_vfy.o: ../../e_os.h ../../include/openssl/aes.h
443x509_vfy.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
444x509_vfy.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
445x509_vfy.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
446x509_vfy.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
447x509_vfy.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
448x509_vfy.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
449x509_vfy.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
450x509_vfy.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
451x509_vfy.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
452x509_vfy.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
453x509_vfy.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
454x509_vfy.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
455x509_vfy.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
456x509_vfy.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
457x509_vfy.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
458x509_vfy.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
459x509_vfy.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
460x509_vfy.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
461x509_vfy.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
462x509_vfy.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
463x509_vfy.o: ../../include/openssl/x509v3.h ../cryptlib.h x509_vfy.c
464x509cset.o: ../../e_os.h ../../include/openssl/aes.h
465x509cset.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
466x509cset.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
467x509cset.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
468x509cset.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
469x509cset.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
470x509cset.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
471x509cset.o: ../../include/openssl/err.h ../../include/openssl/evp.h
472x509cset.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
473x509cset.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
474x509cset.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
475x509cset.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
476x509cset.o: ../../include/openssl/opensslconf.h
477x509cset.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
478x509cset.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
479x509cset.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
480x509cset.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
481x509cset.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
482x509cset.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
483x509cset.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
484x509cset.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
485x509cset.o: ../cryptlib.h x509cset.c
486x509name.o: ../../e_os.h ../../include/openssl/aes.h
487x509name.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
488x509name.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
489x509name.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
490x509name.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
491x509name.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
492x509name.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
493x509name.o: ../../include/openssl/err.h ../../include/openssl/evp.h
494x509name.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
495x509name.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
496x509name.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
497x509name.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
498x509name.o: ../../include/openssl/opensslconf.h
499x509name.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
500x509name.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
501x509name.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
502x509name.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
503x509name.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
504x509name.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
505x509name.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
506x509name.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
507x509name.o: ../cryptlib.h x509name.c
508x509rset.o: ../../e_os.h ../../include/openssl/aes.h
509x509rset.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
510x509rset.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
511x509rset.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
512x509rset.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
513x509rset.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
514x509rset.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
515x509rset.o: ../../include/openssl/err.h ../../include/openssl/evp.h
516x509rset.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
517x509rset.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
518x509rset.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
519x509rset.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
520x509rset.o: ../../include/openssl/opensslconf.h
521x509rset.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
522x509rset.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
523x509rset.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
524x509rset.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
525x509rset.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
526x509rset.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
527x509rset.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
528x509rset.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
529x509rset.o: ../cryptlib.h x509rset.c
530x509spki.o: ../../e_os.h ../../include/openssl/aes.h
531x509spki.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
532x509spki.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
533x509spki.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
534x509spki.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
535x509spki.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
536x509spki.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
537x509spki.o: ../../include/openssl/err.h ../../include/openssl/evp.h
538x509spki.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
539x509spki.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
540x509spki.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
541x509spki.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
542x509spki.o: ../../include/openssl/opensslconf.h
543x509spki.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
544x509spki.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
545x509spki.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
546x509spki.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
547x509spki.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
548x509spki.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
549x509spki.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
550x509spki.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
551x509spki.o: ../cryptlib.h x509spki.c
552x509type.o: ../../e_os.h ../../include/openssl/aes.h
553x509type.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
554x509type.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
555x509type.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
556x509type.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
557x509type.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
558x509type.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
559x509type.o: ../../include/openssl/err.h ../../include/openssl/evp.h
560x509type.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
561x509type.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
562x509type.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
563x509type.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
564x509type.o: ../../include/openssl/opensslconf.h
565x509type.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
566x509type.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
567x509type.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
568x509type.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
569x509type.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
570x509type.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
571x509type.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
572x509type.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
573x509type.o: ../cryptlib.h x509type.c
574x_all.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
575x_all.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
576x_all.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
577x_all.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
578x_all.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
579x_all.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
580x_all.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
581x_all.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
582x_all.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
583x_all.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
584x_all.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
585x_all.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
586x_all.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
587x_all.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
588x_all.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
589x_all.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
590x_all.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
591x_all.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
592x_all.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
593x_all.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
594x_all.o: ../cryptlib.h x_all.c
diff --git a/src/lib/libcrypto/x509/by_dir.c b/src/lib/libcrypto/x509/by_dir.c
index ea689aed1a..6207340472 100644
--- a/src/lib/libcrypto/x509/by_dir.c
+++ b/src/lib/libcrypto/x509/by_dir.c
@@ -114,7 +114,7 @@ static int dir_ctrl(X509_LOOKUP *ctx, int cmd, const char *argp, long argl,
114 { 114 {
115 int ret=0; 115 int ret=0;
116 BY_DIR *ld; 116 BY_DIR *ld;
117 char *dir = NULL; 117 char *dir;
118 118
119 ld=(BY_DIR *)ctx->method_data; 119 ld=(BY_DIR *)ctx->method_data;
120 120
@@ -123,16 +123,17 @@ static int dir_ctrl(X509_LOOKUP *ctx, int cmd, const char *argp, long argl,
123 case X509_L_ADD_DIR: 123 case X509_L_ADD_DIR:
124 if (argl == X509_FILETYPE_DEFAULT) 124 if (argl == X509_FILETYPE_DEFAULT)
125 { 125 {
126 dir=(char *)Getenv(X509_get_default_cert_dir_env()); 126 ret=add_cert_dir(ld,X509_get_default_cert_dir(),
127 if (dir) 127 X509_FILETYPE_PEM);
128 ret=add_cert_dir(ld,dir,X509_FILETYPE_PEM);
129 else
130 ret=add_cert_dir(ld,X509_get_default_cert_dir(),
131 X509_FILETYPE_PEM);
132 if (!ret) 128 if (!ret)
133 { 129 {
134 X509err(X509_F_DIR_CTRL,X509_R_LOADING_CERT_DIR); 130 X509err(X509_F_DIR_CTRL,X509_R_LOADING_CERT_DIR);
135 } 131 }
132 else
133 {
134 dir=(char *)Getenv(X509_get_default_cert_dir_env());
135 ret=add_cert_dir(ld,dir,X509_FILETYPE_PEM);
136 }
136 } 137 }
137 else 138 else
138 ret=add_cert_dir(ld,argp,(int)argl); 139 ret=add_cert_dir(ld,argp,(int)argl);
diff --git a/src/lib/libcrypto/x509/x509_err.c b/src/lib/libcrypto/x509/x509_err.c
index d44d046027..5bbf4acf76 100644
--- a/src/lib/libcrypto/x509/x509_err.c
+++ b/src/lib/libcrypto/x509/x509_err.c
@@ -1,6 +1,6 @@
1/* crypto/x509/x509_err.c */ 1/* crypto/x509/x509_err.c */
2/* ==================================================================== 2/* ====================================================================
3 * Copyright (c) 1999-2005 The OpenSSL Project. All rights reserved. 3 * Copyright (c) 1999 The OpenSSL Project. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
@@ -64,81 +64,77 @@
64 64
65/* BEGIN ERROR CODES */ 65/* BEGIN ERROR CODES */
66#ifndef OPENSSL_NO_ERR 66#ifndef OPENSSL_NO_ERR
67
68#define ERR_FUNC(func) ERR_PACK(ERR_LIB_X509,func,0)
69#define ERR_REASON(reason) ERR_PACK(ERR_LIB_X509,0,reason)
70
71static ERR_STRING_DATA X509_str_functs[]= 67static ERR_STRING_DATA X509_str_functs[]=
72 { 68 {
73{ERR_FUNC(X509_F_ADD_CERT_DIR), "ADD_CERT_DIR"}, 69{ERR_PACK(0,X509_F_ADD_CERT_DIR,0), "ADD_CERT_DIR"},
74{ERR_FUNC(X509_F_BY_FILE_CTRL), "BY_FILE_CTRL"}, 70{ERR_PACK(0,X509_F_BY_FILE_CTRL,0), "BY_FILE_CTRL"},
75{ERR_FUNC(X509_F_DIR_CTRL), "DIR_CTRL"}, 71{ERR_PACK(0,X509_F_DIR_CTRL,0), "DIR_CTRL"},
76{ERR_FUNC(X509_F_GET_CERT_BY_SUBJECT), "GET_CERT_BY_SUBJECT"}, 72{ERR_PACK(0,X509_F_GET_CERT_BY_SUBJECT,0), "GET_CERT_BY_SUBJECT"},
77{ERR_FUNC(X509_F_NETSCAPE_SPKI_B64_DECODE), "NETSCAPE_SPKI_b64_decode"}, 73{ERR_PACK(0,X509_F_NETSCAPE_SPKI_B64_DECODE,0), "NETSCAPE_SPKI_b64_decode"},
78{ERR_FUNC(X509_F_NETSCAPE_SPKI_B64_ENCODE), "NETSCAPE_SPKI_b64_encode"}, 74{ERR_PACK(0,X509_F_NETSCAPE_SPKI_B64_ENCODE,0), "NETSCAPE_SPKI_b64_encode"},
79{ERR_FUNC(X509_F_X509V3_ADD_EXT), "X509v3_add_ext"}, 75{ERR_PACK(0,X509_F_X509V3_ADD_EXT,0), "X509v3_add_ext"},
80{ERR_FUNC(X509_F_X509_ADD_ATTR), "X509_ADD_ATTR"}, 76{ERR_PACK(0,X509_F_X509_ADD_ATTR,0), "X509_ADD_ATTR"},
81{ERR_FUNC(X509_F_X509_ATTRIBUTE_CREATE_BY_NID), "X509_ATTRIBUTE_create_by_NID"}, 77{ERR_PACK(0,X509_F_X509_ATTRIBUTE_CREATE_BY_NID,0), "X509_ATTRIBUTE_create_by_NID"},
82{ERR_FUNC(X509_F_X509_ATTRIBUTE_CREATE_BY_OBJ), "X509_ATTRIBUTE_create_by_OBJ"}, 78{ERR_PACK(0,X509_F_X509_ATTRIBUTE_CREATE_BY_OBJ,0), "X509_ATTRIBUTE_create_by_OBJ"},
83{ERR_FUNC(X509_F_X509_ATTRIBUTE_CREATE_BY_TXT), "X509_ATTRIBUTE_create_by_txt"}, 79{ERR_PACK(0,X509_F_X509_ATTRIBUTE_CREATE_BY_TXT,0), "X509_ATTRIBUTE_create_by_txt"},
84{ERR_FUNC(X509_F_X509_ATTRIBUTE_GET0_DATA), "X509_ATTRIBUTE_get0_data"}, 80{ERR_PACK(0,X509_F_X509_ATTRIBUTE_GET0_DATA,0), "X509_ATTRIBUTE_get0_data"},
85{ERR_FUNC(X509_F_X509_ATTRIBUTE_SET1_DATA), "X509_ATTRIBUTE_set1_data"}, 81{ERR_PACK(0,X509_F_X509_ATTRIBUTE_SET1_DATA,0), "X509_ATTRIBUTE_set1_data"},
86{ERR_FUNC(X509_F_X509_CHECK_PRIVATE_KEY), "X509_check_private_key"}, 82{ERR_PACK(0,X509_F_X509_CHECK_PRIVATE_KEY,0), "X509_check_private_key"},
87{ERR_FUNC(X509_F_X509_EXTENSION_CREATE_BY_NID), "X509_EXTENSION_create_by_NID"}, 83{ERR_PACK(0,X509_F_X509_EXTENSION_CREATE_BY_NID,0), "X509_EXTENSION_create_by_NID"},
88{ERR_FUNC(X509_F_X509_EXTENSION_CREATE_BY_OBJ), "X509_EXTENSION_create_by_OBJ"}, 84{ERR_PACK(0,X509_F_X509_EXTENSION_CREATE_BY_OBJ,0), "X509_EXTENSION_create_by_OBJ"},
89{ERR_FUNC(X509_F_X509_GET_PUBKEY_PARAMETERS), "X509_get_pubkey_parameters"}, 85{ERR_PACK(0,X509_F_X509_GET_PUBKEY_PARAMETERS,0), "X509_get_pubkey_parameters"},
90{ERR_FUNC(X509_F_X509_LOAD_CERT_CRL_FILE), "X509_load_cert_crl_file"}, 86{ERR_PACK(0,X509_F_X509_LOAD_CERT_CRL_FILE,0), "X509_load_cert_crl_file"},
91{ERR_FUNC(X509_F_X509_LOAD_CERT_FILE), "X509_load_cert_file"}, 87{ERR_PACK(0,X509_F_X509_LOAD_CERT_FILE,0), "X509_load_cert_file"},
92{ERR_FUNC(X509_F_X509_LOAD_CRL_FILE), "X509_load_crl_file"}, 88{ERR_PACK(0,X509_F_X509_LOAD_CRL_FILE,0), "X509_load_crl_file"},
93{ERR_FUNC(X509_F_X509_NAME_ADD_ENTRY), "X509_NAME_add_entry"}, 89{ERR_PACK(0,X509_F_X509_NAME_ADD_ENTRY,0), "X509_NAME_add_entry"},
94{ERR_FUNC(X509_F_X509_NAME_ENTRY_CREATE_BY_NID), "X509_NAME_ENTRY_create_by_NID"}, 90{ERR_PACK(0,X509_F_X509_NAME_ENTRY_CREATE_BY_NID,0), "X509_NAME_ENTRY_create_by_NID"},
95{ERR_FUNC(X509_F_X509_NAME_ENTRY_CREATE_BY_TXT), "X509_NAME_ENTRY_create_by_txt"}, 91{ERR_PACK(0,X509_F_X509_NAME_ENTRY_CREATE_BY_TXT,0), "X509_NAME_ENTRY_create_by_txt"},
96{ERR_FUNC(X509_F_X509_NAME_ENTRY_SET_OBJECT), "X509_NAME_ENTRY_set_object"}, 92{ERR_PACK(0,X509_F_X509_NAME_ENTRY_SET_OBJECT,0), "X509_NAME_ENTRY_set_object"},
97{ERR_FUNC(X509_F_X509_NAME_ONELINE), "X509_NAME_oneline"}, 93{ERR_PACK(0,X509_F_X509_NAME_ONELINE,0), "X509_NAME_oneline"},
98{ERR_FUNC(X509_F_X509_NAME_PRINT), "X509_NAME_print"}, 94{ERR_PACK(0,X509_F_X509_NAME_PRINT,0), "X509_NAME_print"},
99{ERR_FUNC(X509_F_X509_PRINT_FP), "X509_print_fp"}, 95{ERR_PACK(0,X509_F_X509_PRINT_FP,0), "X509_print_fp"},
100{ERR_FUNC(X509_F_X509_PUBKEY_GET), "X509_PUBKEY_get"}, 96{ERR_PACK(0,X509_F_X509_PUBKEY_GET,0), "X509_PUBKEY_get"},
101{ERR_FUNC(X509_F_X509_PUBKEY_SET), "X509_PUBKEY_set"}, 97{ERR_PACK(0,X509_F_X509_PUBKEY_SET,0), "X509_PUBKEY_set"},
102{ERR_FUNC(X509_F_X509_REQ_PRINT), "X509_REQ_print"}, 98{ERR_PACK(0,X509_F_X509_REQ_PRINT,0), "X509_REQ_print"},
103{ERR_FUNC(X509_F_X509_REQ_PRINT_FP), "X509_REQ_print_fp"}, 99{ERR_PACK(0,X509_F_X509_REQ_PRINT_FP,0), "X509_REQ_print_fp"},
104{ERR_FUNC(X509_F_X509_REQ_TO_X509), "X509_REQ_to_X509"}, 100{ERR_PACK(0,X509_F_X509_REQ_TO_X509,0), "X509_REQ_to_X509"},
105{ERR_FUNC(X509_F_X509_STORE_ADD_CERT), "X509_STORE_add_cert"}, 101{ERR_PACK(0,X509_F_X509_STORE_ADD_CERT,0), "X509_STORE_add_cert"},
106{ERR_FUNC(X509_F_X509_STORE_ADD_CRL), "X509_STORE_add_crl"}, 102{ERR_PACK(0,X509_F_X509_STORE_ADD_CRL,0), "X509_STORE_add_crl"},
107{ERR_FUNC(X509_F_X509_STORE_CTX_INIT), "X509_STORE_CTX_init"}, 103{ERR_PACK(0,X509_F_X509_STORE_CTX_INIT,0), "X509_STORE_CTX_init"},
108{ERR_FUNC(X509_F_X509_STORE_CTX_NEW), "X509_STORE_CTX_new"}, 104{ERR_PACK(0,X509_F_X509_STORE_CTX_NEW,0), "X509_STORE_CTX_new"},
109{ERR_FUNC(X509_F_X509_STORE_CTX_PURPOSE_INHERIT), "X509_STORE_CTX_purpose_inherit"}, 105{ERR_PACK(0,X509_F_X509_STORE_CTX_PURPOSE_INHERIT,0), "X509_STORE_CTX_purpose_inherit"},
110{ERR_FUNC(X509_F_X509_TO_X509_REQ), "X509_to_X509_REQ"}, 106{ERR_PACK(0,X509_F_X509_TO_X509_REQ,0), "X509_to_X509_REQ"},
111{ERR_FUNC(X509_F_X509_TRUST_ADD), "X509_TRUST_add"}, 107{ERR_PACK(0,X509_F_X509_TRUST_ADD,0), "X509_TRUST_add"},
112{ERR_FUNC(X509_F_X509_TRUST_SET), "X509_TRUST_set"}, 108{ERR_PACK(0,X509_F_X509_TRUST_SET,0), "X509_TRUST_set"},
113{ERR_FUNC(X509_F_X509_VERIFY_CERT), "X509_verify_cert"}, 109{ERR_PACK(0,X509_F_X509_VERIFY_CERT,0), "X509_verify_cert"},
114{0,NULL} 110{0,NULL}
115 }; 111 };
116 112
117static ERR_STRING_DATA X509_str_reasons[]= 113static ERR_STRING_DATA X509_str_reasons[]=
118 { 114 {
119{ERR_REASON(X509_R_BAD_X509_FILETYPE) ,"bad x509 filetype"}, 115{X509_R_BAD_X509_FILETYPE ,"bad x509 filetype"},
120{ERR_REASON(X509_R_BASE64_DECODE_ERROR) ,"base64 decode error"}, 116{X509_R_BASE64_DECODE_ERROR ,"base64 decode error"},
121{ERR_REASON(X509_R_CANT_CHECK_DH_KEY) ,"cant check dh key"}, 117{X509_R_CANT_CHECK_DH_KEY ,"cant check dh key"},
122{ERR_REASON(X509_R_CERT_ALREADY_IN_HASH_TABLE),"cert already in hash table"}, 118{X509_R_CERT_ALREADY_IN_HASH_TABLE ,"cert already in hash table"},
123{ERR_REASON(X509_R_ERR_ASN1_LIB) ,"err asn1 lib"}, 119{X509_R_ERR_ASN1_LIB ,"err asn1 lib"},
124{ERR_REASON(X509_R_INVALID_DIRECTORY) ,"invalid directory"}, 120{X509_R_INVALID_DIRECTORY ,"invalid directory"},
125{ERR_REASON(X509_R_INVALID_FIELD_NAME) ,"invalid field name"}, 121{X509_R_INVALID_FIELD_NAME ,"invalid field name"},
126{ERR_REASON(X509_R_INVALID_TRUST) ,"invalid trust"}, 122{X509_R_INVALID_TRUST ,"invalid trust"},
127{ERR_REASON(X509_R_KEY_TYPE_MISMATCH) ,"key type mismatch"}, 123{X509_R_KEY_TYPE_MISMATCH ,"key type mismatch"},
128{ERR_REASON(X509_R_KEY_VALUES_MISMATCH) ,"key values mismatch"}, 124{X509_R_KEY_VALUES_MISMATCH ,"key values mismatch"},
129{ERR_REASON(X509_R_LOADING_CERT_DIR) ,"loading cert dir"}, 125{X509_R_LOADING_CERT_DIR ,"loading cert dir"},
130{ERR_REASON(X509_R_LOADING_DEFAULTS) ,"loading defaults"}, 126{X509_R_LOADING_DEFAULTS ,"loading defaults"},
131{ERR_REASON(X509_R_NO_CERT_SET_FOR_US_TO_VERIFY),"no cert set for us to verify"}, 127{X509_R_NO_CERT_SET_FOR_US_TO_VERIFY ,"no cert set for us to verify"},
132{ERR_REASON(X509_R_SHOULD_RETRY) ,"should retry"}, 128{X509_R_SHOULD_RETRY ,"should retry"},
133{ERR_REASON(X509_R_UNABLE_TO_FIND_PARAMETERS_IN_CHAIN),"unable to find parameters in chain"}, 129{X509_R_UNABLE_TO_FIND_PARAMETERS_IN_CHAIN,"unable to find parameters in chain"},
134{ERR_REASON(X509_R_UNABLE_TO_GET_CERTS_PUBLIC_KEY),"unable to get certs public key"}, 130{X509_R_UNABLE_TO_GET_CERTS_PUBLIC_KEY ,"unable to get certs public key"},
135{ERR_REASON(X509_R_UNKNOWN_KEY_TYPE) ,"unknown key type"}, 131{X509_R_UNKNOWN_KEY_TYPE ,"unknown key type"},
136{ERR_REASON(X509_R_UNKNOWN_NID) ,"unknown nid"}, 132{X509_R_UNKNOWN_NID ,"unknown nid"},
137{ERR_REASON(X509_R_UNKNOWN_PURPOSE_ID) ,"unknown purpose id"}, 133{X509_R_UNKNOWN_PURPOSE_ID ,"unknown purpose id"},
138{ERR_REASON(X509_R_UNKNOWN_TRUST_ID) ,"unknown trust id"}, 134{X509_R_UNKNOWN_TRUST_ID ,"unknown trust id"},
139{ERR_REASON(X509_R_UNSUPPORTED_ALGORITHM),"unsupported algorithm"}, 135{X509_R_UNSUPPORTED_ALGORITHM ,"unsupported algorithm"},
140{ERR_REASON(X509_R_WRONG_LOOKUP_TYPE) ,"wrong lookup type"}, 136{X509_R_WRONG_LOOKUP_TYPE ,"wrong lookup type"},
141{ERR_REASON(X509_R_WRONG_TYPE) ,"wrong type"}, 137{X509_R_WRONG_TYPE ,"wrong type"},
142{0,NULL} 138{0,NULL}
143 }; 139 };
144 140
@@ -152,8 +148,8 @@ void ERR_load_X509_strings(void)
152 { 148 {
153 init=0; 149 init=0;
154#ifndef OPENSSL_NO_ERR 150#ifndef OPENSSL_NO_ERR
155 ERR_load_strings(0,X509_str_functs); 151 ERR_load_strings(ERR_LIB_X509,X509_str_functs);
156 ERR_load_strings(0,X509_str_reasons); 152 ERR_load_strings(ERR_LIB_X509,X509_str_reasons);
157#endif 153#endif
158 154
159 } 155 }
diff --git a/src/lib/libcrypto/x509/x509_vfy.c b/src/lib/libcrypto/x509/x509_vfy.c
index 383e082aba..e43c861ee7 100644
--- a/src/lib/libcrypto/x509/x509_vfy.c
+++ b/src/lib/libcrypto/x509/x509_vfy.c
@@ -944,7 +944,7 @@ int X509_cmp_time(ASN1_TIME *ctm, time_t *cmp_time)
944 offset=0; 944 offset=0;
945 else 945 else
946 { 946 {
947 if ((*str != '+') && (*str != '-')) 947 if ((*str != '+') && (str[5] != '-'))
948 return 0; 948 return 0;
949 offset=((str[1]-'0')*10+(str[2]-'0'))*60; 949 offset=((str[1]-'0')*10+(str[2]-'0'))*60;
950 offset+=(str[3]-'0')*10+(str[4]-'0'); 950 offset+=(str[3]-'0')*10+(str[4]-'0');
diff --git a/src/lib/libcrypto/x509v3/Makefile b/src/lib/libcrypto/x509v3/Makefile
new file mode 100644
index 0000000000..49423f39f7
--- /dev/null
+++ b/src/lib/libcrypto/x509v3/Makefile
@@ -0,0 +1,645 @@
1#
2# OpenSSL/crypto/x509v3/Makefile
3#
4
5DIR= x509v3
6TOP= ../..
7CC= cc
8INCLUDES= -I.. -I$(TOP) -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
18CFLAGS= $(INCLUDES) $(CFLAG)
19
20GENERAL=Makefile README
21TEST=
22APPS=
23
24LIB=$(TOP)/libcrypto.a
25LIBSRC= v3_bcons.c v3_bitst.c v3_conf.c v3_extku.c v3_ia5.c v3_lib.c \
26v3_prn.c v3_utl.c v3err.c v3_genn.c v3_alt.c v3_skey.c v3_akey.c v3_pku.c \
27v3_int.c v3_enum.c v3_sxnet.c v3_cpols.c v3_crld.c v3_purp.c v3_info.c \
28v3_ocsp.c v3_akeya.c v3_pcia.c v3_pci.c
29LIBOBJ= v3_bcons.o v3_bitst.o v3_conf.o v3_extku.o v3_ia5.o v3_lib.o \
30v3_prn.o v3_utl.o v3err.o v3_genn.o v3_alt.o v3_skey.o v3_akey.o v3_pku.o \
31v3_int.o v3_enum.o v3_sxnet.o v3_cpols.o v3_crld.o v3_purp.o v3_info.o \
32v3_ocsp.o v3_akeya.o v3_pcia.o v3_pci.o
33
34SRC= $(LIBSRC)
35
36EXHEADER= x509v3.h
37HEADER= $(EXHEADER)
38
39ALL= $(GENERAL) $(SRC) $(HEADER)
40
41top:
42 (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all)
43
44all: lib
45
46lib: $(LIBOBJ)
47 $(AR) $(LIB) $(LIBOBJ)
48 $(RANLIB) $(LIB) || echo Never mind.
49 @touch lib
50
51files:
52 $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
53
54links:
55 @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
56 @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
57 @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
58
59install:
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 $(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 *.obj lib tags core .pure .nfs* *.old *.bak fluff
83
84# DO NOT DELETE THIS LINE -- make depend depends on it.
85
86v3_akey.o: ../../e_os.h ../../include/openssl/aes.h
87v3_akey.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h
88v3_akey.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
89v3_akey.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
90v3_akey.o: ../../include/openssl/cast.h ../../include/openssl/conf.h
91v3_akey.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
92v3_akey.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
93v3_akey.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
94v3_akey.o: ../../include/openssl/err.h ../../include/openssl/evp.h
95v3_akey.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
96v3_akey.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
97v3_akey.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
98v3_akey.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
99v3_akey.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
100v3_akey.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
101v3_akey.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
102v3_akey.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
103v3_akey.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
104v3_akey.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
105v3_akey.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
106v3_akey.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h
107v3_akey.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
108v3_akey.o: ../cryptlib.h v3_akey.c
109v3_akeya.o: ../../e_os.h ../../include/openssl/aes.h
110v3_akeya.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h
111v3_akeya.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
112v3_akeya.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
113v3_akeya.o: ../../include/openssl/cast.h ../../include/openssl/conf.h
114v3_akeya.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
115v3_akeya.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
116v3_akeya.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
117v3_akeya.o: ../../include/openssl/err.h ../../include/openssl/evp.h
118v3_akeya.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
119v3_akeya.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
120v3_akeya.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
121v3_akeya.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
122v3_akeya.o: ../../include/openssl/opensslconf.h
123v3_akeya.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
124v3_akeya.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
125v3_akeya.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
126v3_akeya.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
127v3_akeya.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
128v3_akeya.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
129v3_akeya.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
130v3_akeya.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
131v3_akeya.o: ../../include/openssl/x509v3.h ../cryptlib.h v3_akeya.c
132v3_alt.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
133v3_alt.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
134v3_alt.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
135v3_alt.o: ../../include/openssl/cast.h ../../include/openssl/conf.h
136v3_alt.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
137v3_alt.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
138v3_alt.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
139v3_alt.o: ../../include/openssl/err.h ../../include/openssl/evp.h
140v3_alt.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
141v3_alt.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
142v3_alt.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
143v3_alt.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
144v3_alt.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
145v3_alt.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
146v3_alt.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
147v3_alt.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
148v3_alt.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
149v3_alt.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
150v3_alt.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
151v3_alt.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h
152v3_alt.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
153v3_alt.o: ../cryptlib.h v3_alt.c
154v3_bcons.o: ../../e_os.h ../../include/openssl/aes.h
155v3_bcons.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h
156v3_bcons.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
157v3_bcons.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
158v3_bcons.o: ../../include/openssl/cast.h ../../include/openssl/conf.h
159v3_bcons.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
160v3_bcons.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
161v3_bcons.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
162v3_bcons.o: ../../include/openssl/err.h ../../include/openssl/evp.h
163v3_bcons.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
164v3_bcons.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
165v3_bcons.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
166v3_bcons.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
167v3_bcons.o: ../../include/openssl/opensslconf.h
168v3_bcons.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
169v3_bcons.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
170v3_bcons.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
171v3_bcons.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
172v3_bcons.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
173v3_bcons.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
174v3_bcons.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
175v3_bcons.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
176v3_bcons.o: ../../include/openssl/x509v3.h ../cryptlib.h v3_bcons.c
177v3_bitst.o: ../../e_os.h ../../include/openssl/aes.h
178v3_bitst.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
179v3_bitst.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
180v3_bitst.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
181v3_bitst.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
182v3_bitst.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
183v3_bitst.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
184v3_bitst.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
185v3_bitst.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
186v3_bitst.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
187v3_bitst.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
188v3_bitst.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
189v3_bitst.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
190v3_bitst.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
191v3_bitst.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
192v3_bitst.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
193v3_bitst.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
194v3_bitst.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
195v3_bitst.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
196v3_bitst.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
197v3_bitst.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
198v3_bitst.o: ../../include/openssl/x509v3.h ../cryptlib.h v3_bitst.c
199v3_conf.o: ../../e_os.h ../../include/openssl/aes.h
200v3_conf.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
201v3_conf.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
202v3_conf.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
203v3_conf.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
204v3_conf.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
205v3_conf.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
206v3_conf.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
207v3_conf.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
208v3_conf.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
209v3_conf.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
210v3_conf.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
211v3_conf.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
212v3_conf.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
213v3_conf.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
214v3_conf.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
215v3_conf.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
216v3_conf.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
217v3_conf.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
218v3_conf.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
219v3_conf.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
220v3_conf.o: ../../include/openssl/x509v3.h ../cryptlib.h v3_conf.c
221v3_cpols.o: ../../e_os.h ../../include/openssl/aes.h
222v3_cpols.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h
223v3_cpols.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
224v3_cpols.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
225v3_cpols.o: ../../include/openssl/cast.h ../../include/openssl/conf.h
226v3_cpols.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
227v3_cpols.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
228v3_cpols.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
229v3_cpols.o: ../../include/openssl/err.h ../../include/openssl/evp.h
230v3_cpols.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
231v3_cpols.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
232v3_cpols.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
233v3_cpols.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
234v3_cpols.o: ../../include/openssl/opensslconf.h
235v3_cpols.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
236v3_cpols.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
237v3_cpols.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
238v3_cpols.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
239v3_cpols.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
240v3_cpols.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
241v3_cpols.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
242v3_cpols.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
243v3_cpols.o: ../../include/openssl/x509v3.h ../cryptlib.h v3_cpols.c
244v3_crld.o: ../../e_os.h ../../include/openssl/aes.h
245v3_crld.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h
246v3_crld.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
247v3_crld.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
248v3_crld.o: ../../include/openssl/cast.h ../../include/openssl/conf.h
249v3_crld.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
250v3_crld.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
251v3_crld.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
252v3_crld.o: ../../include/openssl/err.h ../../include/openssl/evp.h
253v3_crld.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
254v3_crld.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
255v3_crld.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
256v3_crld.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
257v3_crld.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
258v3_crld.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
259v3_crld.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
260v3_crld.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
261v3_crld.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
262v3_crld.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
263v3_crld.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
264v3_crld.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h
265v3_crld.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
266v3_crld.o: ../cryptlib.h v3_crld.c
267v3_enum.o: ../../e_os.h ../../include/openssl/aes.h
268v3_enum.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
269v3_enum.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
270v3_enum.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
271v3_enum.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
272v3_enum.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
273v3_enum.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
274v3_enum.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
275v3_enum.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
276v3_enum.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
277v3_enum.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
278v3_enum.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
279v3_enum.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
280v3_enum.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
281v3_enum.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
282v3_enum.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
283v3_enum.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
284v3_enum.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
285v3_enum.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
286v3_enum.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
287v3_enum.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
288v3_enum.o: ../../include/openssl/x509v3.h ../cryptlib.h v3_enum.c
289v3_extku.o: ../../e_os.h ../../include/openssl/aes.h
290v3_extku.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h
291v3_extku.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
292v3_extku.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
293v3_extku.o: ../../include/openssl/cast.h ../../include/openssl/conf.h
294v3_extku.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
295v3_extku.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
296v3_extku.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
297v3_extku.o: ../../include/openssl/err.h ../../include/openssl/evp.h
298v3_extku.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
299v3_extku.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
300v3_extku.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
301v3_extku.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
302v3_extku.o: ../../include/openssl/opensslconf.h
303v3_extku.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
304v3_extku.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
305v3_extku.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
306v3_extku.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
307v3_extku.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
308v3_extku.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
309v3_extku.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
310v3_extku.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
311v3_extku.o: ../../include/openssl/x509v3.h ../cryptlib.h v3_extku.c
312v3_genn.o: ../../e_os.h ../../include/openssl/aes.h
313v3_genn.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h
314v3_genn.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
315v3_genn.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
316v3_genn.o: ../../include/openssl/cast.h ../../include/openssl/conf.h
317v3_genn.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
318v3_genn.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
319v3_genn.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
320v3_genn.o: ../../include/openssl/err.h ../../include/openssl/evp.h
321v3_genn.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
322v3_genn.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
323v3_genn.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
324v3_genn.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
325v3_genn.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
326v3_genn.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
327v3_genn.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
328v3_genn.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
329v3_genn.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
330v3_genn.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
331v3_genn.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
332v3_genn.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h
333v3_genn.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
334v3_genn.o: ../cryptlib.h v3_genn.c
335v3_ia5.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
336v3_ia5.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
337v3_ia5.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
338v3_ia5.o: ../../include/openssl/cast.h ../../include/openssl/conf.h
339v3_ia5.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
340v3_ia5.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
341v3_ia5.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
342v3_ia5.o: ../../include/openssl/err.h ../../include/openssl/evp.h
343v3_ia5.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
344v3_ia5.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
345v3_ia5.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
346v3_ia5.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
347v3_ia5.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
348v3_ia5.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
349v3_ia5.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
350v3_ia5.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
351v3_ia5.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
352v3_ia5.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
353v3_ia5.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
354v3_ia5.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h
355v3_ia5.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
356v3_ia5.o: ../cryptlib.h v3_ia5.c
357v3_info.o: ../../e_os.h ../../include/openssl/aes.h
358v3_info.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h
359v3_info.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
360v3_info.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
361v3_info.o: ../../include/openssl/cast.h ../../include/openssl/conf.h
362v3_info.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
363v3_info.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
364v3_info.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
365v3_info.o: ../../include/openssl/err.h ../../include/openssl/evp.h
366v3_info.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
367v3_info.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
368v3_info.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
369v3_info.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
370v3_info.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
371v3_info.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
372v3_info.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
373v3_info.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
374v3_info.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
375v3_info.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
376v3_info.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
377v3_info.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h
378v3_info.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
379v3_info.o: ../cryptlib.h v3_info.c
380v3_int.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
381v3_int.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
382v3_int.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
383v3_int.o: ../../include/openssl/cast.h ../../include/openssl/conf.h
384v3_int.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
385v3_int.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
386v3_int.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
387v3_int.o: ../../include/openssl/err.h ../../include/openssl/evp.h
388v3_int.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
389v3_int.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
390v3_int.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
391v3_int.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
392v3_int.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
393v3_int.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
394v3_int.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
395v3_int.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
396v3_int.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
397v3_int.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
398v3_int.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
399v3_int.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h
400v3_int.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
401v3_int.o: ../cryptlib.h v3_int.c
402v3_lib.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
403v3_lib.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
404v3_lib.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
405v3_lib.o: ../../include/openssl/cast.h ../../include/openssl/conf.h
406v3_lib.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
407v3_lib.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
408v3_lib.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
409v3_lib.o: ../../include/openssl/err.h ../../include/openssl/evp.h
410v3_lib.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
411v3_lib.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
412v3_lib.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
413v3_lib.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
414v3_lib.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
415v3_lib.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
416v3_lib.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
417v3_lib.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
418v3_lib.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
419v3_lib.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
420v3_lib.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
421v3_lib.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h
422v3_lib.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
423v3_lib.o: ../cryptlib.h ext_dat.h v3_lib.c
424v3_ocsp.o: ../../e_os.h ../../include/openssl/aes.h
425v3_ocsp.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
426v3_ocsp.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
427v3_ocsp.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
428v3_ocsp.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
429v3_ocsp.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
430v3_ocsp.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
431v3_ocsp.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
432v3_ocsp.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
433v3_ocsp.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
434v3_ocsp.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
435v3_ocsp.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
436v3_ocsp.o: ../../include/openssl/objects.h ../../include/openssl/ocsp.h
437v3_ocsp.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
438v3_ocsp.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
439v3_ocsp.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
440v3_ocsp.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
441v3_ocsp.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
442v3_ocsp.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
443v3_ocsp.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
444v3_ocsp.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h
445v3_ocsp.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
446v3_ocsp.o: ../cryptlib.h v3_ocsp.c
447v3_pci.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
448v3_pci.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
449v3_pci.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
450v3_pci.o: ../../include/openssl/cast.h ../../include/openssl/conf.h
451v3_pci.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
452v3_pci.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
453v3_pci.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
454v3_pci.o: ../../include/openssl/err.h ../../include/openssl/evp.h
455v3_pci.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
456v3_pci.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
457v3_pci.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
458v3_pci.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
459v3_pci.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
460v3_pci.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
461v3_pci.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
462v3_pci.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
463v3_pci.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
464v3_pci.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
465v3_pci.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
466v3_pci.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h
467v3_pci.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
468v3_pci.o: ../cryptlib.h v3_pci.c
469v3_pcia.o: ../../include/openssl/aes.h ../../include/openssl/asn1.h
470v3_pcia.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
471v3_pcia.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
472v3_pcia.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
473v3_pcia.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
474v3_pcia.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
475v3_pcia.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
476v3_pcia.o: ../../include/openssl/e_os2.h ../../include/openssl/evp.h
477v3_pcia.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
478v3_pcia.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
479v3_pcia.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
480v3_pcia.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
481v3_pcia.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
482v3_pcia.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
483v3_pcia.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
484v3_pcia.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
485v3_pcia.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
486v3_pcia.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
487v3_pcia.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
488v3_pcia.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h
489v3_pcia.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
490v3_pcia.o: v3_pcia.c
491v3_pku.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
492v3_pku.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
493v3_pku.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
494v3_pku.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
495v3_pku.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
496v3_pku.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
497v3_pku.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
498v3_pku.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
499v3_pku.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
500v3_pku.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
501v3_pku.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
502v3_pku.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
503v3_pku.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
504v3_pku.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
505v3_pku.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
506v3_pku.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
507v3_pku.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
508v3_pku.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
509v3_pku.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
510v3_pku.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
511v3_pku.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
512v3_pku.o: ../../include/openssl/x509v3.h ../cryptlib.h v3_pku.c
513v3_prn.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
514v3_prn.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
515v3_prn.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
516v3_prn.o: ../../include/openssl/cast.h ../../include/openssl/conf.h
517v3_prn.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
518v3_prn.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
519v3_prn.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
520v3_prn.o: ../../include/openssl/err.h ../../include/openssl/evp.h
521v3_prn.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
522v3_prn.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
523v3_prn.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
524v3_prn.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
525v3_prn.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
526v3_prn.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
527v3_prn.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
528v3_prn.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
529v3_prn.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
530v3_prn.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
531v3_prn.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
532v3_prn.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h
533v3_prn.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
534v3_prn.o: ../cryptlib.h v3_prn.c
535v3_purp.o: ../../e_os.h ../../include/openssl/aes.h
536v3_purp.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
537v3_purp.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
538v3_purp.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
539v3_purp.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
540v3_purp.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
541v3_purp.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
542v3_purp.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
543v3_purp.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
544v3_purp.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
545v3_purp.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
546v3_purp.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
547v3_purp.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
548v3_purp.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
549v3_purp.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
550v3_purp.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
551v3_purp.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
552v3_purp.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
553v3_purp.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
554v3_purp.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
555v3_purp.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
556v3_purp.o: ../../include/openssl/x509v3.h ../cryptlib.h v3_purp.c
557v3_skey.o: ../../e_os.h ../../include/openssl/aes.h
558v3_skey.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
559v3_skey.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
560v3_skey.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
561v3_skey.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
562v3_skey.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
563v3_skey.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
564v3_skey.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
565v3_skey.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
566v3_skey.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
567v3_skey.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
568v3_skey.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
569v3_skey.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
570v3_skey.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
571v3_skey.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
572v3_skey.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
573v3_skey.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
574v3_skey.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
575v3_skey.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
576v3_skey.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
577v3_skey.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
578v3_skey.o: ../../include/openssl/x509v3.h ../cryptlib.h v3_skey.c
579v3_sxnet.o: ../../e_os.h ../../include/openssl/aes.h
580v3_sxnet.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h
581v3_sxnet.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
582v3_sxnet.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
583v3_sxnet.o: ../../include/openssl/cast.h ../../include/openssl/conf.h
584v3_sxnet.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
585v3_sxnet.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
586v3_sxnet.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
587v3_sxnet.o: ../../include/openssl/err.h ../../include/openssl/evp.h
588v3_sxnet.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
589v3_sxnet.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
590v3_sxnet.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
591v3_sxnet.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
592v3_sxnet.o: ../../include/openssl/opensslconf.h
593v3_sxnet.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
594v3_sxnet.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
595v3_sxnet.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
596v3_sxnet.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
597v3_sxnet.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
598v3_sxnet.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
599v3_sxnet.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
600v3_sxnet.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
601v3_sxnet.o: ../../include/openssl/x509v3.h ../cryptlib.h v3_sxnet.c
602v3_utl.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
603v3_utl.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
604v3_utl.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
605v3_utl.o: ../../include/openssl/cast.h ../../include/openssl/conf.h
606v3_utl.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
607v3_utl.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
608v3_utl.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
609v3_utl.o: ../../include/openssl/err.h ../../include/openssl/evp.h
610v3_utl.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
611v3_utl.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
612v3_utl.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
613v3_utl.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
614v3_utl.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
615v3_utl.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
616v3_utl.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
617v3_utl.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
618v3_utl.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
619v3_utl.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
620v3_utl.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
621v3_utl.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h
622v3_utl.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
623v3_utl.o: ../cryptlib.h v3_utl.c
624v3err.o: ../../include/openssl/aes.h ../../include/openssl/asn1.h
625v3err.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
626v3err.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
627v3err.o: ../../include/openssl/cast.h ../../include/openssl/conf.h
628v3err.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
629v3err.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
630v3err.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
631v3err.o: ../../include/openssl/err.h ../../include/openssl/evp.h
632v3err.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
633v3err.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
634v3err.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
635v3err.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
636v3err.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
637v3err.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
638v3err.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
639v3err.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
640v3err.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
641v3err.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
642v3err.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
643v3err.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h
644v3err.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
645v3err.o: v3err.c
diff --git a/src/lib/libcrypto/x509v3/Makefile.ssl b/src/lib/libcrypto/x509v3/Makefile.ssl
new file mode 100644
index 0000000000..66df90c346
--- /dev/null
+++ b/src/lib/libcrypto/x509v3/Makefile.ssl
@@ -0,0 +1,603 @@
1#
2# SSLeay/crypto/x509v3/Makefile
3#
4
5DIR= x509v3
6TOP= ../..
7CC= cc
8INCLUDES= -I.. -I$(TOP) -I../../include
9CFLAG=-g
10INSTALL_PREFIX=
11OPENSSLDIR= /usr/local/ssl
12INSTALLTOP=/usr/local/ssl
13MAKE= make -f Makefile.ssl
14MAKEDEPPROG= makedepend
15MAKEDEPEND= $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG)
16MAKEFILE= Makefile.ssl
17AR= ar r
18
19CFLAGS= $(INCLUDES) $(CFLAG)
20
21GENERAL=Makefile README
22TEST=
23APPS=
24
25LIB=$(TOP)/libcrypto.a
26LIBSRC= v3_bcons.c v3_bitst.c v3_conf.c v3_extku.c v3_ia5.c v3_lib.c \
27v3_prn.c v3_utl.c v3err.c v3_genn.c v3_alt.c v3_skey.c v3_akey.c v3_pku.c \
28v3_int.c v3_enum.c v3_sxnet.c v3_cpols.c v3_crld.c v3_purp.c v3_info.c \
29v3_ocsp.c v3_akeya.c
30LIBOBJ= v3_bcons.o v3_bitst.o v3_conf.o v3_extku.o v3_ia5.o v3_lib.o \
31v3_prn.o v3_utl.o v3err.o v3_genn.o v3_alt.o v3_skey.o v3_akey.o v3_pku.o \
32v3_int.o v3_enum.o v3_sxnet.o v3_cpols.o v3_crld.o v3_purp.o v3_info.o \
33v3_ocsp.o v3_akeya.o
34
35SRC= $(LIBSRC)
36
37EXHEADER= x509v3.h
38HEADER= $(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.ssl >> $(TOP)/MINFO
54
55links:
56 @sh $(TOP)/util/point.sh Makefile.ssl Makefile
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 @for i in $(EXHEADER) ; \
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 $(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 *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
85
86# DO NOT DELETE THIS LINE -- make depend depends on it.
87
88v3_akey.o: ../../e_os.h ../../include/openssl/aes.h
89v3_akey.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h
90v3_akey.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
91v3_akey.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
92v3_akey.o: ../../include/openssl/cast.h ../../include/openssl/conf.h
93v3_akey.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
94v3_akey.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
95v3_akey.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
96v3_akey.o: ../../include/openssl/err.h ../../include/openssl/evp.h
97v3_akey.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
98v3_akey.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
99v3_akey.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
100v3_akey.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
101v3_akey.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
102v3_akey.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
103v3_akey.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
104v3_akey.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
105v3_akey.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
106v3_akey.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
107v3_akey.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
108v3_akey.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h
109v3_akey.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
110v3_akey.o: ../cryptlib.h v3_akey.c
111v3_akeya.o: ../../e_os.h ../../include/openssl/aes.h
112v3_akeya.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h
113v3_akeya.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
114v3_akeya.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
115v3_akeya.o: ../../include/openssl/cast.h ../../include/openssl/conf.h
116v3_akeya.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
117v3_akeya.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
118v3_akeya.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
119v3_akeya.o: ../../include/openssl/err.h ../../include/openssl/evp.h
120v3_akeya.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
121v3_akeya.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
122v3_akeya.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
123v3_akeya.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
124v3_akeya.o: ../../include/openssl/opensslconf.h
125v3_akeya.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
126v3_akeya.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
127v3_akeya.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
128v3_akeya.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
129v3_akeya.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
130v3_akeya.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
131v3_akeya.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
132v3_akeya.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
133v3_akeya.o: ../../include/openssl/x509v3.h ../cryptlib.h v3_akeya.c
134v3_alt.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
135v3_alt.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
136v3_alt.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
137v3_alt.o: ../../include/openssl/cast.h ../../include/openssl/conf.h
138v3_alt.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
139v3_alt.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
140v3_alt.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
141v3_alt.o: ../../include/openssl/err.h ../../include/openssl/evp.h
142v3_alt.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
143v3_alt.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
144v3_alt.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
145v3_alt.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
146v3_alt.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
147v3_alt.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
148v3_alt.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
149v3_alt.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
150v3_alt.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
151v3_alt.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
152v3_alt.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
153v3_alt.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h
154v3_alt.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
155v3_alt.o: ../cryptlib.h v3_alt.c
156v3_bcons.o: ../../e_os.h ../../include/openssl/aes.h
157v3_bcons.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h
158v3_bcons.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
159v3_bcons.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
160v3_bcons.o: ../../include/openssl/cast.h ../../include/openssl/conf.h
161v3_bcons.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
162v3_bcons.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
163v3_bcons.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
164v3_bcons.o: ../../include/openssl/err.h ../../include/openssl/evp.h
165v3_bcons.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
166v3_bcons.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
167v3_bcons.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
168v3_bcons.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
169v3_bcons.o: ../../include/openssl/opensslconf.h
170v3_bcons.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
171v3_bcons.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
172v3_bcons.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
173v3_bcons.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
174v3_bcons.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
175v3_bcons.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
176v3_bcons.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
177v3_bcons.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
178v3_bcons.o: ../../include/openssl/x509v3.h ../cryptlib.h v3_bcons.c
179v3_bitst.o: ../../e_os.h ../../include/openssl/aes.h
180v3_bitst.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
181v3_bitst.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
182v3_bitst.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
183v3_bitst.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
184v3_bitst.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
185v3_bitst.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
186v3_bitst.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
187v3_bitst.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
188v3_bitst.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
189v3_bitst.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
190v3_bitst.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
191v3_bitst.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
192v3_bitst.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
193v3_bitst.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
194v3_bitst.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
195v3_bitst.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
196v3_bitst.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
197v3_bitst.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
198v3_bitst.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
199v3_bitst.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
200v3_bitst.o: ../../include/openssl/x509v3.h ../cryptlib.h v3_bitst.c
201v3_conf.o: ../../e_os.h ../../include/openssl/aes.h
202v3_conf.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
203v3_conf.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
204v3_conf.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
205v3_conf.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
206v3_conf.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
207v3_conf.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
208v3_conf.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
209v3_conf.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
210v3_conf.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
211v3_conf.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
212v3_conf.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
213v3_conf.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
214v3_conf.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
215v3_conf.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
216v3_conf.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
217v3_conf.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
218v3_conf.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
219v3_conf.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
220v3_conf.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
221v3_conf.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
222v3_conf.o: ../../include/openssl/x509v3.h ../cryptlib.h v3_conf.c
223v3_cpols.o: ../../e_os.h ../../include/openssl/aes.h
224v3_cpols.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h
225v3_cpols.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
226v3_cpols.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
227v3_cpols.o: ../../include/openssl/cast.h ../../include/openssl/conf.h
228v3_cpols.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
229v3_cpols.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
230v3_cpols.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
231v3_cpols.o: ../../include/openssl/err.h ../../include/openssl/evp.h
232v3_cpols.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
233v3_cpols.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
234v3_cpols.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
235v3_cpols.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
236v3_cpols.o: ../../include/openssl/opensslconf.h
237v3_cpols.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
238v3_cpols.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
239v3_cpols.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
240v3_cpols.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
241v3_cpols.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
242v3_cpols.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
243v3_cpols.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
244v3_cpols.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
245v3_cpols.o: ../../include/openssl/x509v3.h ../cryptlib.h v3_cpols.c
246v3_crld.o: ../../e_os.h ../../include/openssl/aes.h
247v3_crld.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h
248v3_crld.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
249v3_crld.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
250v3_crld.o: ../../include/openssl/cast.h ../../include/openssl/conf.h
251v3_crld.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
252v3_crld.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
253v3_crld.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
254v3_crld.o: ../../include/openssl/err.h ../../include/openssl/evp.h
255v3_crld.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
256v3_crld.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
257v3_crld.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
258v3_crld.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
259v3_crld.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
260v3_crld.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
261v3_crld.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
262v3_crld.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
263v3_crld.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
264v3_crld.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
265v3_crld.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
266v3_crld.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h
267v3_crld.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
268v3_crld.o: ../cryptlib.h v3_crld.c
269v3_enum.o: ../../e_os.h ../../include/openssl/aes.h
270v3_enum.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
271v3_enum.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
272v3_enum.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
273v3_enum.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
274v3_enum.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
275v3_enum.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
276v3_enum.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
277v3_enum.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
278v3_enum.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
279v3_enum.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
280v3_enum.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
281v3_enum.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
282v3_enum.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
283v3_enum.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
284v3_enum.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
285v3_enum.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
286v3_enum.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
287v3_enum.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
288v3_enum.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
289v3_enum.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
290v3_enum.o: ../../include/openssl/x509v3.h ../cryptlib.h v3_enum.c
291v3_extku.o: ../../e_os.h ../../include/openssl/aes.h
292v3_extku.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h
293v3_extku.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
294v3_extku.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
295v3_extku.o: ../../include/openssl/cast.h ../../include/openssl/conf.h
296v3_extku.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
297v3_extku.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
298v3_extku.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
299v3_extku.o: ../../include/openssl/err.h ../../include/openssl/evp.h
300v3_extku.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
301v3_extku.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
302v3_extku.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
303v3_extku.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
304v3_extku.o: ../../include/openssl/opensslconf.h
305v3_extku.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
306v3_extku.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
307v3_extku.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
308v3_extku.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
309v3_extku.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
310v3_extku.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
311v3_extku.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
312v3_extku.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
313v3_extku.o: ../../include/openssl/x509v3.h ../cryptlib.h v3_extku.c
314v3_genn.o: ../../e_os.h ../../include/openssl/aes.h
315v3_genn.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h
316v3_genn.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
317v3_genn.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
318v3_genn.o: ../../include/openssl/cast.h ../../include/openssl/conf.h
319v3_genn.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
320v3_genn.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
321v3_genn.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
322v3_genn.o: ../../include/openssl/err.h ../../include/openssl/evp.h
323v3_genn.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
324v3_genn.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
325v3_genn.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
326v3_genn.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
327v3_genn.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
328v3_genn.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
329v3_genn.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
330v3_genn.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
331v3_genn.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
332v3_genn.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
333v3_genn.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
334v3_genn.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h
335v3_genn.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
336v3_genn.o: ../cryptlib.h v3_genn.c
337v3_ia5.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
338v3_ia5.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
339v3_ia5.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
340v3_ia5.o: ../../include/openssl/cast.h ../../include/openssl/conf.h
341v3_ia5.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
342v3_ia5.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
343v3_ia5.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
344v3_ia5.o: ../../include/openssl/err.h ../../include/openssl/evp.h
345v3_ia5.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
346v3_ia5.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
347v3_ia5.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
348v3_ia5.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
349v3_ia5.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
350v3_ia5.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
351v3_ia5.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
352v3_ia5.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
353v3_ia5.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
354v3_ia5.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
355v3_ia5.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
356v3_ia5.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h
357v3_ia5.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
358v3_ia5.o: ../cryptlib.h v3_ia5.c
359v3_info.o: ../../e_os.h ../../include/openssl/aes.h
360v3_info.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h
361v3_info.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
362v3_info.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
363v3_info.o: ../../include/openssl/cast.h ../../include/openssl/conf.h
364v3_info.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
365v3_info.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
366v3_info.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
367v3_info.o: ../../include/openssl/err.h ../../include/openssl/evp.h
368v3_info.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
369v3_info.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
370v3_info.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
371v3_info.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
372v3_info.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
373v3_info.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
374v3_info.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
375v3_info.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
376v3_info.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
377v3_info.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
378v3_info.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
379v3_info.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h
380v3_info.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
381v3_info.o: ../cryptlib.h v3_info.c
382v3_int.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
383v3_int.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
384v3_int.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
385v3_int.o: ../../include/openssl/cast.h ../../include/openssl/conf.h
386v3_int.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
387v3_int.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
388v3_int.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
389v3_int.o: ../../include/openssl/err.h ../../include/openssl/evp.h
390v3_int.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
391v3_int.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
392v3_int.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
393v3_int.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
394v3_int.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
395v3_int.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
396v3_int.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
397v3_int.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
398v3_int.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
399v3_int.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
400v3_int.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
401v3_int.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h
402v3_int.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
403v3_int.o: ../cryptlib.h v3_int.c
404v3_lib.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
405v3_lib.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
406v3_lib.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
407v3_lib.o: ../../include/openssl/cast.h ../../include/openssl/conf.h
408v3_lib.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
409v3_lib.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
410v3_lib.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
411v3_lib.o: ../../include/openssl/err.h ../../include/openssl/evp.h
412v3_lib.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
413v3_lib.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
414v3_lib.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
415v3_lib.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
416v3_lib.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
417v3_lib.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
418v3_lib.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
419v3_lib.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
420v3_lib.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
421v3_lib.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
422v3_lib.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
423v3_lib.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h
424v3_lib.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
425v3_lib.o: ../cryptlib.h ext_dat.h v3_lib.c
426v3_ocsp.o: ../../e_os.h ../../include/openssl/aes.h
427v3_ocsp.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
428v3_ocsp.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
429v3_ocsp.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
430v3_ocsp.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
431v3_ocsp.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
432v3_ocsp.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
433v3_ocsp.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
434v3_ocsp.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
435v3_ocsp.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
436v3_ocsp.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
437v3_ocsp.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
438v3_ocsp.o: ../../include/openssl/objects.h ../../include/openssl/ocsp.h
439v3_ocsp.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
440v3_ocsp.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
441v3_ocsp.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
442v3_ocsp.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
443v3_ocsp.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
444v3_ocsp.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
445v3_ocsp.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
446v3_ocsp.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h
447v3_ocsp.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
448v3_ocsp.o: ../cryptlib.h v3_ocsp.c
449v3_pku.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
450v3_pku.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h
451v3_pku.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
452v3_pku.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
453v3_pku.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
454v3_pku.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
455v3_pku.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
456v3_pku.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
457v3_pku.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
458v3_pku.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
459v3_pku.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
460v3_pku.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
461v3_pku.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
462v3_pku.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
463v3_pku.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
464v3_pku.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
465v3_pku.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
466v3_pku.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
467v3_pku.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
468v3_pku.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
469v3_pku.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
470v3_pku.o: ../../include/openssl/x509v3.h ../cryptlib.h v3_pku.c
471v3_prn.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
472v3_prn.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
473v3_prn.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
474v3_prn.o: ../../include/openssl/cast.h ../../include/openssl/conf.h
475v3_prn.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
476v3_prn.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
477v3_prn.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
478v3_prn.o: ../../include/openssl/err.h ../../include/openssl/evp.h
479v3_prn.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
480v3_prn.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
481v3_prn.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
482v3_prn.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
483v3_prn.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
484v3_prn.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
485v3_prn.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
486v3_prn.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
487v3_prn.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
488v3_prn.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
489v3_prn.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
490v3_prn.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h
491v3_prn.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
492v3_prn.o: ../cryptlib.h v3_prn.c
493v3_purp.o: ../../e_os.h ../../include/openssl/aes.h
494v3_purp.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
495v3_purp.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
496v3_purp.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
497v3_purp.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
498v3_purp.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
499v3_purp.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
500v3_purp.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
501v3_purp.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
502v3_purp.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
503v3_purp.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
504v3_purp.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
505v3_purp.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
506v3_purp.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
507v3_purp.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
508v3_purp.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
509v3_purp.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
510v3_purp.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
511v3_purp.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
512v3_purp.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
513v3_purp.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
514v3_purp.o: ../../include/openssl/x509v3.h ../cryptlib.h v3_purp.c
515v3_skey.o: ../../e_os.h ../../include/openssl/aes.h
516v3_skey.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
517v3_skey.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
518v3_skey.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
519v3_skey.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
520v3_skey.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
521v3_skey.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
522v3_skey.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
523v3_skey.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
524v3_skey.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
525v3_skey.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
526v3_skey.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
527v3_skey.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
528v3_skey.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
529v3_skey.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
530v3_skey.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
531v3_skey.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
532v3_skey.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
533v3_skey.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
534v3_skey.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
535v3_skey.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
536v3_skey.o: ../../include/openssl/x509v3.h ../cryptlib.h v3_skey.c
537v3_sxnet.o: ../../e_os.h ../../include/openssl/aes.h
538v3_sxnet.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h
539v3_sxnet.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
540v3_sxnet.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
541v3_sxnet.o: ../../include/openssl/cast.h ../../include/openssl/conf.h
542v3_sxnet.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
543v3_sxnet.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
544v3_sxnet.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
545v3_sxnet.o: ../../include/openssl/err.h ../../include/openssl/evp.h
546v3_sxnet.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
547v3_sxnet.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
548v3_sxnet.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
549v3_sxnet.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
550v3_sxnet.o: ../../include/openssl/opensslconf.h
551v3_sxnet.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
552v3_sxnet.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
553v3_sxnet.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
554v3_sxnet.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
555v3_sxnet.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
556v3_sxnet.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
557v3_sxnet.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
558v3_sxnet.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
559v3_sxnet.o: ../../include/openssl/x509v3.h ../cryptlib.h v3_sxnet.c
560v3_utl.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/asn1.h
561v3_utl.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
562v3_utl.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
563v3_utl.o: ../../include/openssl/cast.h ../../include/openssl/conf.h
564v3_utl.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
565v3_utl.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
566v3_utl.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
567v3_utl.o: ../../include/openssl/err.h ../../include/openssl/evp.h
568v3_utl.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
569v3_utl.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
570v3_utl.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
571v3_utl.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
572v3_utl.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
573v3_utl.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
574v3_utl.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
575v3_utl.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
576v3_utl.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
577v3_utl.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
578v3_utl.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
579v3_utl.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h
580v3_utl.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
581v3_utl.o: ../cryptlib.h v3_utl.c
582v3err.o: ../../include/openssl/aes.h ../../include/openssl/asn1.h
583v3err.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
584v3err.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
585v3err.o: ../../include/openssl/cast.h ../../include/openssl/conf.h
586v3err.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
587v3err.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
588v3err.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
589v3err.o: ../../include/openssl/err.h ../../include/openssl/evp.h
590v3err.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
591v3err.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
592v3err.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
593v3err.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
594v3err.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
595v3err.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h
596v3err.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
597v3err.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
598v3err.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
599v3err.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
600v3err.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
601v3err.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h
602v3err.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
603v3err.o: v3err.c
diff --git a/src/lib/libcrypto/x509v3/tabtest.c b/src/lib/libcrypto/x509v3/tabtest.c
new file mode 100644
index 0000000000..dad0d38dd5
--- /dev/null
+++ b/src/lib/libcrypto/x509v3/tabtest.c
@@ -0,0 +1,88 @@
1/* tabtest.c */
2/* Written by Dr Stephen N Henson (shenson@bigfoot.com) 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_cpols.c b/src/lib/libcrypto/x509v3/v3_cpols.c
index 867525f336..0d554f3a2c 100644
--- a/src/lib/libcrypto/x509v3/v3_cpols.c
+++ b/src/lib/libcrypto/x509v3/v3_cpols.c
@@ -137,15 +137,7 @@ static STACK_OF(POLICYINFO) *r2i_certpol(X509V3_EXT_METHOD *method,
137 CONF_VALUE *cnf; 137 CONF_VALUE *cnf;
138 int i, ia5org; 138 int i, ia5org;
139 pols = sk_POLICYINFO_new_null(); 139 pols = sk_POLICYINFO_new_null();
140 if (pols == NULL) {
141 X509V3err(X509V3_F_R2I_CERTPOL, ERR_R_MALLOC_FAILURE);
142 return NULL;
143 }
144 vals = X509V3_parse_list(value); 140 vals = X509V3_parse_list(value);
145 if (vals == NULL) {
146 X509V3err(X509V3_F_R2I_CERTPOL, ERR_R_X509V3_LIB);
147 goto err;
148 }
149 ia5org = 0; 141 ia5org = 0;
150 for(i = 0; i < sk_CONF_VALUE_num(vals); i++) { 142 for(i = 0; i < sk_CONF_VALUE_num(vals); i++) {
151 cnf = sk_CONF_VALUE_value(vals, i); 143 cnf = sk_CONF_VALUE_value(vals, i);
@@ -184,7 +176,6 @@ static STACK_OF(POLICYINFO) *r2i_certpol(X509V3_EXT_METHOD *method,
184 sk_CONF_VALUE_pop_free(vals, X509V3_conf_free); 176 sk_CONF_VALUE_pop_free(vals, X509V3_conf_free);
185 return pols; 177 return pols;
186 err: 178 err:
187 sk_CONF_VALUE_pop_free(vals, X509V3_conf_free);
188 sk_POLICYINFO_pop_free(pols, POLICYINFO_free); 179 sk_POLICYINFO_pop_free(pols, POLICYINFO_free);
189 return NULL; 180 return NULL;
190} 181}
diff --git a/src/lib/libcrypto/x509v3/v3_utl.c b/src/lib/libcrypto/x509v3/v3_utl.c
index 34ac2998de..466c91d0e8 100644
--- a/src/lib/libcrypto/x509v3/v3_utl.c
+++ b/src/lib/libcrypto/x509v3/v3_utl.c
@@ -78,7 +78,7 @@ int X509V3_add_value(const char *name, const char *value,
78 CONF_VALUE *vtmp = NULL; 78 CONF_VALUE *vtmp = NULL;
79 char *tname = NULL, *tvalue = NULL; 79 char *tname = NULL, *tvalue = NULL;
80 if(name && !(tname = BUF_strdup(name))) goto err; 80 if(name && !(tname = BUF_strdup(name))) goto err;
81 if(value && !(tvalue = BUF_strdup(value))) goto err;; 81 if(value && !(tvalue = BUF_strdup(value))) goto err;
82 if(!(vtmp = (CONF_VALUE *)OPENSSL_malloc(sizeof(CONF_VALUE)))) goto err; 82 if(!(vtmp = (CONF_VALUE *)OPENSSL_malloc(sizeof(CONF_VALUE)))) goto err;
83 if(!*extlist && !(*extlist = sk_CONF_VALUE_new_null())) goto err; 83 if(!*extlist && !(*extlist = sk_CONF_VALUE_new_null())) goto err;
84 vtmp->section = NULL; 84 vtmp->section = NULL;
diff --git a/src/lib/libcrypto/x509v3/v3conf.c b/src/lib/libcrypto/x509v3/v3conf.c
new file mode 100644
index 0000000000..00cf5b4a5b
--- /dev/null
+++ b/src/lib/libcrypto/x509v3/v3conf.c
@@ -0,0 +1,127 @@
1/* v3conf.c */
2/* Written by Dr Stephen N Henson (shenson@bigfoot.com) 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/v3err.c b/src/lib/libcrypto/x509v3/v3err.c
index e1edaf5248..2df0c3ef01 100644
--- a/src/lib/libcrypto/x509v3/v3err.c
+++ b/src/lib/libcrypto/x509v3/v3err.c
@@ -64,118 +64,114 @@
64 64
65/* BEGIN ERROR CODES */ 65/* BEGIN ERROR CODES */
66#ifndef OPENSSL_NO_ERR 66#ifndef OPENSSL_NO_ERR
67
68#define ERR_FUNC(func) ERR_PACK(ERR_LIB_X509V3,func,0)
69#define ERR_REASON(reason) ERR_PACK(ERR_LIB_X509V3,0,reason)
70
71static ERR_STRING_DATA X509V3_str_functs[]= 67static ERR_STRING_DATA X509V3_str_functs[]=
72 { 68 {
73{ERR_FUNC(X509V3_F_COPY_EMAIL), "COPY_EMAIL"}, 69{ERR_PACK(0,X509V3_F_COPY_EMAIL,0), "COPY_EMAIL"},
74{ERR_FUNC(X509V3_F_COPY_ISSUER), "COPY_ISSUER"}, 70{ERR_PACK(0,X509V3_F_COPY_ISSUER,0), "COPY_ISSUER"},
75{ERR_FUNC(X509V3_F_DO_EXT_CONF), "DO_EXT_CONF"}, 71{ERR_PACK(0,X509V3_F_DO_EXT_CONF,0), "DO_EXT_CONF"},
76{ERR_FUNC(X509V3_F_DO_EXT_I2D), "DO_EXT_I2D"}, 72{ERR_PACK(0,X509V3_F_DO_EXT_I2D,0), "DO_EXT_I2D"},
77{ERR_FUNC(X509V3_F_HEX_TO_STRING), "hex_to_string"}, 73{ERR_PACK(0,X509V3_F_HEX_TO_STRING,0), "hex_to_string"},
78{ERR_FUNC(X509V3_F_I2S_ASN1_ENUMERATED), "i2s_ASN1_ENUMERATED"}, 74{ERR_PACK(0,X509V3_F_I2S_ASN1_ENUMERATED,0), "i2s_ASN1_ENUMERATED"},
79{ERR_FUNC(X509V3_F_I2S_ASN1_IA5STRING), "I2S_ASN1_IA5STRING"}, 75{ERR_PACK(0,X509V3_F_I2S_ASN1_IA5STRING,0), "I2S_ASN1_IA5STRING"},
80{ERR_FUNC(X509V3_F_I2S_ASN1_INTEGER), "i2s_ASN1_INTEGER"}, 76{ERR_PACK(0,X509V3_F_I2S_ASN1_INTEGER,0), "i2s_ASN1_INTEGER"},
81{ERR_FUNC(X509V3_F_I2V_AUTHORITY_INFO_ACCESS), "I2V_AUTHORITY_INFO_ACCESS"}, 77{ERR_PACK(0,X509V3_F_I2V_AUTHORITY_INFO_ACCESS,0), "I2V_AUTHORITY_INFO_ACCESS"},
82{ERR_FUNC(X509V3_F_NOTICE_SECTION), "NOTICE_SECTION"}, 78{ERR_PACK(0,X509V3_F_NOTICE_SECTION,0), "NOTICE_SECTION"},
83{ERR_FUNC(X509V3_F_NREF_NOS), "NREF_NOS"}, 79{ERR_PACK(0,X509V3_F_NREF_NOS,0), "NREF_NOS"},
84{ERR_FUNC(X509V3_F_POLICY_SECTION), "POLICY_SECTION"}, 80{ERR_PACK(0,X509V3_F_POLICY_SECTION,0), "POLICY_SECTION"},
85{ERR_FUNC(X509V3_F_R2I_CERTPOL), "R2I_CERTPOL"}, 81{ERR_PACK(0,X509V3_F_R2I_CERTPOL,0), "R2I_CERTPOL"},
86{ERR_FUNC(X509V3_F_R2I_PCI), "R2I_PCI"}, 82{ERR_PACK(0,X509V3_F_R2I_PCI,0), "R2I_PCI"},
87{ERR_FUNC(X509V3_F_S2I_ASN1_IA5STRING), "S2I_ASN1_IA5STRING"}, 83{ERR_PACK(0,X509V3_F_S2I_ASN1_IA5STRING,0), "S2I_ASN1_IA5STRING"},
88{ERR_FUNC(X509V3_F_S2I_ASN1_INTEGER), "s2i_ASN1_INTEGER"}, 84{ERR_PACK(0,X509V3_F_S2I_ASN1_INTEGER,0), "s2i_ASN1_INTEGER"},
89{ERR_FUNC(X509V3_F_S2I_ASN1_OCTET_STRING), "s2i_ASN1_OCTET_STRING"}, 85{ERR_PACK(0,X509V3_F_S2I_ASN1_OCTET_STRING,0), "s2i_ASN1_OCTET_STRING"},
90{ERR_FUNC(X509V3_F_S2I_ASN1_SKEY_ID), "S2I_ASN1_SKEY_ID"}, 86{ERR_PACK(0,X509V3_F_S2I_ASN1_SKEY_ID,0), "S2I_ASN1_SKEY_ID"},
91{ERR_FUNC(X509V3_F_S2I_S2I_SKEY_ID), "S2I_S2I_SKEY_ID"}, 87{ERR_PACK(0,X509V3_F_S2I_S2I_SKEY_ID,0), "S2I_S2I_SKEY_ID"},
92{ERR_FUNC(X509V3_F_STRING_TO_HEX), "string_to_hex"}, 88{ERR_PACK(0,X509V3_F_STRING_TO_HEX,0), "string_to_hex"},
93{ERR_FUNC(X509V3_F_SXNET_ADD_ASC), "SXNET_ADD_ASC"}, 89{ERR_PACK(0,X509V3_F_SXNET_ADD_ASC,0), "SXNET_ADD_ASC"},
94{ERR_FUNC(X509V3_F_SXNET_ADD_ID_INTEGER), "SXNET_add_id_INTEGER"}, 90{ERR_PACK(0,X509V3_F_SXNET_ADD_ID_INTEGER,0), "SXNET_add_id_INTEGER"},
95{ERR_FUNC(X509V3_F_SXNET_ADD_ID_ULONG), "SXNET_add_id_ulong"}, 91{ERR_PACK(0,X509V3_F_SXNET_ADD_ID_ULONG,0), "SXNET_add_id_ulong"},
96{ERR_FUNC(X509V3_F_SXNET_GET_ID_ASC), "SXNET_get_id_asc"}, 92{ERR_PACK(0,X509V3_F_SXNET_GET_ID_ASC,0), "SXNET_get_id_asc"},
97{ERR_FUNC(X509V3_F_SXNET_GET_ID_ULONG), "SXNET_get_id_ulong"}, 93{ERR_PACK(0,X509V3_F_SXNET_GET_ID_ULONG,0), "SXNET_get_id_ulong"},
98{ERR_FUNC(X509V3_F_V2I_ACCESS_DESCRIPTION), "V2I_ACCESS_DESCRIPTION"}, 94{ERR_PACK(0,X509V3_F_V2I_ACCESS_DESCRIPTION,0), "V2I_ACCESS_DESCRIPTION"},
99{ERR_FUNC(X509V3_F_V2I_ASN1_BIT_STRING), "V2I_ASN1_BIT_STRING"}, 95{ERR_PACK(0,X509V3_F_V2I_ASN1_BIT_STRING,0), "V2I_ASN1_BIT_STRING"},
100{ERR_FUNC(X509V3_F_V2I_AUTHORITY_KEYID), "V2I_AUTHORITY_KEYID"}, 96{ERR_PACK(0,X509V3_F_V2I_AUTHORITY_KEYID,0), "V2I_AUTHORITY_KEYID"},
101{ERR_FUNC(X509V3_F_V2I_BASIC_CONSTRAINTS), "V2I_BASIC_CONSTRAINTS"}, 97{ERR_PACK(0,X509V3_F_V2I_BASIC_CONSTRAINTS,0), "V2I_BASIC_CONSTRAINTS"},
102{ERR_FUNC(X509V3_F_V2I_CRLD), "V2I_CRLD"}, 98{ERR_PACK(0,X509V3_F_V2I_CRLD,0), "V2I_CRLD"},
103{ERR_FUNC(X509V3_F_V2I_EXT_KU), "V2I_EXT_KU"}, 99{ERR_PACK(0,X509V3_F_V2I_EXT_KU,0), "V2I_EXT_KU"},
104{ERR_FUNC(X509V3_F_V2I_GENERAL_NAME), "v2i_GENERAL_NAME"}, 100{ERR_PACK(0,X509V3_F_V2I_GENERAL_NAME,0), "v2i_GENERAL_NAME"},
105{ERR_FUNC(X509V3_F_V2I_GENERAL_NAMES), "v2i_GENERAL_NAMES"}, 101{ERR_PACK(0,X509V3_F_V2I_GENERAL_NAMES,0), "v2i_GENERAL_NAMES"},
106{ERR_FUNC(X509V3_F_V3_GENERIC_EXTENSION), "V3_GENERIC_EXTENSION"}, 102{ERR_PACK(0,X509V3_F_V3_GENERIC_EXTENSION,0), "V3_GENERIC_EXTENSION"},
107{ERR_FUNC(X509V3_F_X509V3_ADD_I2D), "X509V3_ADD_I2D"}, 103{ERR_PACK(0,X509V3_F_X509V3_ADD_I2D,0), "X509V3_ADD_I2D"},
108{ERR_FUNC(X509V3_F_X509V3_ADD_VALUE), "X509V3_add_value"}, 104{ERR_PACK(0,X509V3_F_X509V3_ADD_VALUE,0), "X509V3_add_value"},
109{ERR_FUNC(X509V3_F_X509V3_EXT_ADD), "X509V3_EXT_add"}, 105{ERR_PACK(0,X509V3_F_X509V3_EXT_ADD,0), "X509V3_EXT_add"},
110{ERR_FUNC(X509V3_F_X509V3_EXT_ADD_ALIAS), "X509V3_EXT_add_alias"}, 106{ERR_PACK(0,X509V3_F_X509V3_EXT_ADD_ALIAS,0), "X509V3_EXT_add_alias"},
111{ERR_FUNC(X509V3_F_X509V3_EXT_CONF), "X509V3_EXT_conf"}, 107{ERR_PACK(0,X509V3_F_X509V3_EXT_CONF,0), "X509V3_EXT_conf"},
112{ERR_FUNC(X509V3_F_X509V3_EXT_I2D), "X509V3_EXT_i2d"}, 108{ERR_PACK(0,X509V3_F_X509V3_EXT_I2D,0), "X509V3_EXT_i2d"},
113{ERR_FUNC(X509V3_F_X509V3_GET_VALUE_BOOL), "X509V3_get_value_bool"}, 109{ERR_PACK(0,X509V3_F_X509V3_GET_VALUE_BOOL,0), "X509V3_get_value_bool"},
114{ERR_FUNC(X509V3_F_X509V3_PARSE_LIST), "X509V3_parse_list"}, 110{ERR_PACK(0,X509V3_F_X509V3_PARSE_LIST,0), "X509V3_parse_list"},
115{ERR_FUNC(X509V3_F_X509_PURPOSE_ADD), "X509_PURPOSE_add"}, 111{ERR_PACK(0,X509V3_F_X509_PURPOSE_ADD,0), "X509_PURPOSE_add"},
116{ERR_FUNC(X509V3_F_X509_PURPOSE_SET), "X509_PURPOSE_set"}, 112{ERR_PACK(0,X509V3_F_X509_PURPOSE_SET,0), "X509_PURPOSE_set"},
117{0,NULL} 113{0,NULL}
118 }; 114 };
119 115
120static ERR_STRING_DATA X509V3_str_reasons[]= 116static ERR_STRING_DATA X509V3_str_reasons[]=
121 { 117 {
122{ERR_REASON(X509V3_R_BAD_IP_ADDRESS) ,"bad ip address"}, 118{X509V3_R_BAD_IP_ADDRESS ,"bad ip address"},
123{ERR_REASON(X509V3_R_BAD_OBJECT) ,"bad object"}, 119{X509V3_R_BAD_OBJECT ,"bad object"},
124{ERR_REASON(X509V3_R_BN_DEC2BN_ERROR) ,"bn dec2bn error"}, 120{X509V3_R_BN_DEC2BN_ERROR ,"bn dec2bn error"},
125{ERR_REASON(X509V3_R_BN_TO_ASN1_INTEGER_ERROR),"bn to asn1 integer error"}, 121{X509V3_R_BN_TO_ASN1_INTEGER_ERROR ,"bn to asn1 integer error"},
126{ERR_REASON(X509V3_R_DUPLICATE_ZONE_ID) ,"duplicate zone id"}, 122{X509V3_R_DUPLICATE_ZONE_ID ,"duplicate zone id"},
127{ERR_REASON(X509V3_R_ERROR_CONVERTING_ZONE),"error converting zone"}, 123{X509V3_R_ERROR_CONVERTING_ZONE ,"error converting zone"},
128{ERR_REASON(X509V3_R_ERROR_CREATING_EXTENSION),"error creating extension"}, 124{X509V3_R_ERROR_CREATING_EXTENSION ,"error creating extension"},
129{ERR_REASON(X509V3_R_ERROR_IN_EXTENSION) ,"error in extension"}, 125{X509V3_R_ERROR_IN_EXTENSION ,"error in extension"},
130{ERR_REASON(X509V3_R_EXPECTED_A_SECTION_NAME),"expected a section name"}, 126{X509V3_R_EXPECTED_A_SECTION_NAME ,"expected a section name"},
131{ERR_REASON(X509V3_R_EXTENSION_EXISTS) ,"extension exists"}, 127{X509V3_R_EXTENSION_EXISTS ,"extension exists"},
132{ERR_REASON(X509V3_R_EXTENSION_NAME_ERROR),"extension name error"}, 128{X509V3_R_EXTENSION_NAME_ERROR ,"extension name error"},
133{ERR_REASON(X509V3_R_EXTENSION_NOT_FOUND),"extension not found"}, 129{X509V3_R_EXTENSION_NOT_FOUND ,"extension not found"},
134{ERR_REASON(X509V3_R_EXTENSION_SETTING_NOT_SUPPORTED),"extension setting not supported"}, 130{X509V3_R_EXTENSION_SETTING_NOT_SUPPORTED,"extension setting not supported"},
135{ERR_REASON(X509V3_R_EXTENSION_VALUE_ERROR),"extension value error"}, 131{X509V3_R_EXTENSION_VALUE_ERROR ,"extension value error"},
136{ERR_REASON(X509V3_R_ILLEGAL_HEX_DIGIT) ,"illegal hex digit"}, 132{X509V3_R_ILLEGAL_HEX_DIGIT ,"illegal hex digit"},
137{ERR_REASON(X509V3_R_INCORRECT_POLICY_SYNTAX_TAG),"incorrect policy syntax tag"}, 133{X509V3_R_INCORRECT_POLICY_SYNTAX_TAG ,"incorrect policy syntax tag"},
138{ERR_REASON(X509V3_R_INVALID_BOOLEAN_STRING),"invalid boolean string"}, 134{X509V3_R_INVALID_BOOLEAN_STRING ,"invalid boolean string"},
139{ERR_REASON(X509V3_R_INVALID_EXTENSION_STRING),"invalid extension string"}, 135{X509V3_R_INVALID_EXTENSION_STRING ,"invalid extension string"},
140{ERR_REASON(X509V3_R_INVALID_NAME) ,"invalid name"}, 136{X509V3_R_INVALID_NAME ,"invalid name"},
141{ERR_REASON(X509V3_R_INVALID_NULL_ARGUMENT),"invalid null argument"}, 137{X509V3_R_INVALID_NULL_ARGUMENT ,"invalid null argument"},
142{ERR_REASON(X509V3_R_INVALID_NULL_NAME) ,"invalid null name"}, 138{X509V3_R_INVALID_NULL_NAME ,"invalid null name"},
143{ERR_REASON(X509V3_R_INVALID_NULL_VALUE) ,"invalid null value"}, 139{X509V3_R_INVALID_NULL_VALUE ,"invalid null value"},
144{ERR_REASON(X509V3_R_INVALID_NUMBER) ,"invalid number"}, 140{X509V3_R_INVALID_NUMBER ,"invalid number"},
145{ERR_REASON(X509V3_R_INVALID_NUMBERS) ,"invalid numbers"}, 141{X509V3_R_INVALID_NUMBERS ,"invalid numbers"},
146{ERR_REASON(X509V3_R_INVALID_OBJECT_IDENTIFIER),"invalid object identifier"}, 142{X509V3_R_INVALID_OBJECT_IDENTIFIER ,"invalid object identifier"},
147{ERR_REASON(X509V3_R_INVALID_OPTION) ,"invalid option"}, 143{X509V3_R_INVALID_OPTION ,"invalid option"},
148{ERR_REASON(X509V3_R_INVALID_POLICY_IDENTIFIER),"invalid policy identifier"}, 144{X509V3_R_INVALID_POLICY_IDENTIFIER ,"invalid policy identifier"},
149{ERR_REASON(X509V3_R_INVALID_PROXY_POLICY_IDENTIFIER),"invalid proxy policy identifier"}, 145{X509V3_R_INVALID_PROXY_POLICY_IDENTIFIER,"invalid proxy policy identifier"},
150{ERR_REASON(X509V3_R_INVALID_PROXY_POLICY_SETTING),"invalid proxy policy setting"}, 146{X509V3_R_INVALID_PROXY_POLICY_SETTING ,"invalid proxy policy setting"},
151{ERR_REASON(X509V3_R_INVALID_PURPOSE) ,"invalid purpose"}, 147{X509V3_R_INVALID_PURPOSE ,"invalid purpose"},
152{ERR_REASON(X509V3_R_INVALID_SECTION) ,"invalid section"}, 148{X509V3_R_INVALID_SECTION ,"invalid section"},
153{ERR_REASON(X509V3_R_INVALID_SYNTAX) ,"invalid syntax"}, 149{X509V3_R_INVALID_SYNTAX ,"invalid syntax"},
154{ERR_REASON(X509V3_R_ISSUER_DECODE_ERROR),"issuer decode error"}, 150{X509V3_R_ISSUER_DECODE_ERROR ,"issuer decode error"},
155{ERR_REASON(X509V3_R_MISSING_VALUE) ,"missing value"}, 151{X509V3_R_MISSING_VALUE ,"missing value"},
156{ERR_REASON(X509V3_R_NEED_ORGANIZATION_AND_NUMBERS),"need organization and numbers"}, 152{X509V3_R_NEED_ORGANIZATION_AND_NUMBERS ,"need organization and numbers"},
157{ERR_REASON(X509V3_R_NO_CONFIG_DATABASE) ,"no config database"}, 153{X509V3_R_NO_CONFIG_DATABASE ,"no config database"},
158{ERR_REASON(X509V3_R_NO_ISSUER_CERTIFICATE),"no issuer certificate"}, 154{X509V3_R_NO_ISSUER_CERTIFICATE ,"no issuer certificate"},
159{ERR_REASON(X509V3_R_NO_ISSUER_DETAILS) ,"no issuer details"}, 155{X509V3_R_NO_ISSUER_DETAILS ,"no issuer details"},
160{ERR_REASON(X509V3_R_NO_POLICY_IDENTIFIER),"no policy identifier"}, 156{X509V3_R_NO_POLICY_IDENTIFIER ,"no policy identifier"},
161{ERR_REASON(X509V3_R_NO_PROXY_CERT_POLICY_LANGUAGE_DEFINED),"no proxy cert policy language defined"}, 157{X509V3_R_NO_PROXY_CERT_POLICY_LANGUAGE_DEFINED,"no proxy cert policy language defined"},
162{ERR_REASON(X509V3_R_NO_PUBLIC_KEY) ,"no public key"}, 158{X509V3_R_NO_PUBLIC_KEY ,"no public key"},
163{ERR_REASON(X509V3_R_NO_SUBJECT_DETAILS) ,"no subject details"}, 159{X509V3_R_NO_SUBJECT_DETAILS ,"no subject details"},
164{ERR_REASON(X509V3_R_ODD_NUMBER_OF_DIGITS),"odd number of digits"}, 160{X509V3_R_ODD_NUMBER_OF_DIGITS ,"odd number of digits"},
165{ERR_REASON(X509V3_R_POLICY_LANGUAGE_ALREADTY_DEFINED),"policy language alreadty defined"}, 161{X509V3_R_POLICY_LANGUAGE_ALREADTY_DEFINED,"policy language alreadty defined"},
166{ERR_REASON(X509V3_R_POLICY_PATH_LENGTH) ,"policy path length"}, 162{X509V3_R_POLICY_PATH_LENGTH ,"policy path length"},
167{ERR_REASON(X509V3_R_POLICY_PATH_LENGTH_ALREADTY_DEFINED),"policy path length alreadty defined"}, 163{X509V3_R_POLICY_PATH_LENGTH_ALREADTY_DEFINED,"policy path length alreadty defined"},
168{ERR_REASON(X509V3_R_POLICY_SYNTAX_NOT) ,"policy syntax not"}, 164{X509V3_R_POLICY_SYNTAX_NOT ,"policy syntax not"},
169{ERR_REASON(X509V3_R_POLICY_SYNTAX_NOT_CURRENTLY_SUPPORTED),"policy syntax not currently supported"}, 165{X509V3_R_POLICY_SYNTAX_NOT_CURRENTLY_SUPPORTED,"policy syntax not currently supported"},
170{ERR_REASON(X509V3_R_POLICY_WHEN_PROXY_LANGUAGE_REQUIRES_NO_POLICY),"policy when proxy language requires no policy"}, 166{X509V3_R_POLICY_WHEN_PROXY_LANGUAGE_REQUIRES_NO_POLICY,"policy when proxy language requires no policy"},
171{ERR_REASON(X509V3_R_UNABLE_TO_GET_ISSUER_DETAILS),"unable to get issuer details"}, 167{X509V3_R_UNABLE_TO_GET_ISSUER_DETAILS ,"unable to get issuer details"},
172{ERR_REASON(X509V3_R_UNABLE_TO_GET_ISSUER_KEYID),"unable to get issuer keyid"}, 168{X509V3_R_UNABLE_TO_GET_ISSUER_KEYID ,"unable to get issuer keyid"},
173{ERR_REASON(X509V3_R_UNKNOWN_BIT_STRING_ARGUMENT),"unknown bit string argument"}, 169{X509V3_R_UNKNOWN_BIT_STRING_ARGUMENT ,"unknown bit string argument"},
174{ERR_REASON(X509V3_R_UNKNOWN_EXTENSION) ,"unknown extension"}, 170{X509V3_R_UNKNOWN_EXTENSION ,"unknown extension"},
175{ERR_REASON(X509V3_R_UNKNOWN_EXTENSION_NAME),"unknown extension name"}, 171{X509V3_R_UNKNOWN_EXTENSION_NAME ,"unknown extension name"},
176{ERR_REASON(X509V3_R_UNKNOWN_OPTION) ,"unknown option"}, 172{X509V3_R_UNKNOWN_OPTION ,"unknown option"},
177{ERR_REASON(X509V3_R_UNSUPPORTED_OPTION) ,"unsupported option"}, 173{X509V3_R_UNSUPPORTED_OPTION ,"unsupported option"},
178{ERR_REASON(X509V3_R_USER_TOO_LONG) ,"user too long"}, 174{X509V3_R_USER_TOO_LONG ,"user too long"},
179{0,NULL} 175{0,NULL}
180 }; 176 };
181 177
@@ -189,8 +185,8 @@ void ERR_load_X509V3_strings(void)
189 { 185 {
190 init=0; 186 init=0;
191#ifndef OPENSSL_NO_ERR 187#ifndef OPENSSL_NO_ERR
192 ERR_load_strings(0,X509V3_str_functs); 188 ERR_load_strings(ERR_LIB_X509V3,X509V3_str_functs);
193 ERR_load_strings(0,X509V3_str_reasons); 189 ERR_load_strings(ERR_LIB_X509V3,X509V3_str_reasons);
194#endif 190#endif
195 191
196 } 192 }
diff --git a/src/lib/libcrypto/x509v3/v3prin.c b/src/lib/libcrypto/x509v3/v3prin.c
new file mode 100644
index 0000000000..b529814319
--- /dev/null
+++ b/src/lib/libcrypto/x509v3/v3prin.c
@@ -0,0 +1,99 @@
1/* v3prin.c */
2/* Written by Dr Stephen N Henson (shenson@bigfoot.com) 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}